1 line
2.0 KiB
Plaintext
1 line
2.0 KiB
Plaintext
{"version":3,"sources":["../src/isLegacyImportsEnabled.ts"],"names":["isLegacyImportsEnabled","exp","console","warn","lteSdkVersion","expJson","sdkVersion","semver","lte","e","Error"],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAIA;AACA;AACA;AACA;AACA;AACO,SAASA,sBAAT,CAAgCC,GAAhC,EAAqE;AAC1E,MAAI,uBAAQ,qBAAR,EAA+B,KAA/B,CAAJ,EAA2C;AACzCC,IAAAA,OAAO,CAACC,IAAR,CACE,sHADF;AAGA,WAAO,IAAP;AACD,GANyE,CAO1E;AACA;;;AACA,SAAOC,aAAa,CAACH,GAAD,EAAM,QAAN,CAApB;AACD;;AAED,SAASG,aAAT,CAAuBC,OAAvB,EAAgEC,UAAhE,EAA6F;AAC3F,MAAI,CAACD,OAAO,CAACC,UAAb,EAAyB;AACvB,WAAO,KAAP;AACD;;AAED,MAAID,OAAO,CAACC,UAAR,KAAuB,aAA3B,EAA0C;AACxC,WAAO,KAAP;AACD;;AAED,MAAI;AACF,WAAOC,kBAAOC,GAAP,CAAWH,OAAO,CAACC,UAAnB,EAA+BA,UAA/B,CAAP;AACD,GAFD,CAEE,OAAOG,CAAP,EAAU;AACV,UAAM,IAAIC,KAAJ,CAAW,GAAEL,OAAO,CAACC,UAAW,uDAAhC,CAAN;AACD;AACF","sourcesContent":["import { boolish } from 'getenv';\nimport semver from 'semver';\n\nimport { ExpoConfig } from './Config.types';\n\n/**\n * Should the bundler use .expo file extensions.\n *\n * @param exp\n */\nexport function isLegacyImportsEnabled(exp: Pick<ExpoConfig, 'sdkVersion'>) {\n if (boolish('EXPO_LEGACY_IMPORTS', false)) {\n console.warn(\n 'Dangerously enabled the deprecated `.expo` extensions feature, this functionality may be removed between SDK cycles.'\n );\n return true;\n }\n // Only allow target if the SDK version is available and it's less 41.\n // This is optimized for making future projects work.\n return lteSdkVersion(exp, '40.0.0');\n}\n\nfunction lteSdkVersion(expJson: Pick<ExpoConfig, 'sdkVersion'>, sdkVersion: string): boolean {\n if (!expJson.sdkVersion) {\n return false;\n }\n\n if (expJson.sdkVersion === 'UNVERSIONED') {\n return false;\n }\n\n try {\n return semver.lte(expJson.sdkVersion, sdkVersion);\n } catch (e) {\n throw new Error(`${expJson.sdkVersion} is not a valid version. Must be in the form of x.y.z`);\n }\n}\n"],"file":"isLegacyImportsEnabled.js"} |