@expo/metro-config 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/ExpoMetroConfig.js +4 -5
- package/build/ExpoMetroConfig.js.map +1 -1
- package/build/babel-core.d.ts +1 -1
- package/build/babel-core.js +4 -4
- package/build/babel-core.js.map +1 -1
- package/build/babel-transformer.d.ts +0 -7
- package/build/babel-transformer.js +81 -205
- package/build/babel-transformer.js.map +1 -1
- package/build/getModulesPaths.js +1 -1
- package/build/getModulesPaths.js.map +1 -1
- package/build/loadBabelConfig.d.ts +9 -0
- package/build/loadBabelConfig.js +64 -0
- package/build/loadBabelConfig.js.map +1 -0
- package/build/rewriteRequestUrl.d.ts +1 -0
- package/build/rewriteRequestUrl.js +69 -7
- package/build/rewriteRequestUrl.js.map +1 -1
- package/build/serializer/exportHermes.d.ts +12 -0
- package/build/serializer/exportHermes.js +150 -0
- package/build/serializer/exportHermes.js.map +1 -0
- package/build/serializer/exportPath.d.ts +2 -1
- package/build/serializer/exportPath.js +3 -6
- package/build/serializer/exportPath.js.map +1 -1
- package/build/serializer/fork/baseJSBundle.d.ts +6 -1
- package/build/serializer/fork/baseJSBundle.js +14 -6
- package/build/serializer/fork/baseJSBundle.js.map +1 -1
- package/build/serializer/fork/js.d.ts +3 -3
- package/build/serializer/fork/js.js +7 -13
- package/build/serializer/fork/js.js.map +1 -1
- package/build/serializer/fork/processModules.d.ts +3 -3
- package/build/serializer/fork/processModules.js +6 -6
- package/build/serializer/fork/processModules.js.map +1 -1
- package/build/serializer/getCssDeps.js +1 -1
- package/build/serializer/getCssDeps.js.map +1 -1
- package/build/serializer/jsOutput.d.ts +6 -0
- package/build/serializer/jsOutput.js.map +1 -1
- package/build/serializer/serializeChunks.d.ts +14 -0
- package/build/serializer/serializeChunks.js +465 -0
- package/build/serializer/serializeChunks.js.map +1 -0
- package/build/serializer/serializerAssets.d.ts +4 -1
- package/build/serializer/serializerAssets.js.map +1 -1
- package/build/serializer/withExpoSerializers.d.ts +10 -4
- package/build/serializer/withExpoSerializers.js +43 -116
- package/build/serializer/withExpoSerializers.js.map +1 -1
- package/build/transform-worker/asset-transformer.d.ts +4 -0
- package/build/transform-worker/asset-transformer.js +57 -0
- package/build/transform-worker/asset-transformer.js.map +1 -0
- package/build/transform-worker/getAssets.d.ts +23 -0
- package/build/transform-worker/getAssets.js +86 -0
- package/build/transform-worker/getAssets.js.map +1 -0
- package/build/transform-worker/metro-transform-worker.d.ts +11 -0
- package/build/transform-worker/metro-transform-worker.js +538 -0
- package/build/transform-worker/metro-transform-worker.js.map +1 -0
- package/build/transform-worker/transform-worker.d.ts +1 -8
- package/build/transform-worker/transform-worker.js +21 -14
- package/build/transform-worker/transform-worker.js.map +1 -1
- package/build/transformSync.d.ts +10 -0
- package/build/transformSync.js +47 -0
- package/build/transformSync.js.map +1 -0
- package/build/transformer/getBabelConfig.js +3 -3
- package/build/transformer/getBabelConfig.js.map +1 -1
- package/package.json +20 -13
package/build/ExpoMetroConfig.js
CHANGED
|
@@ -247,7 +247,6 @@ function getDefaultConfig(projectRoot, {
|
|
|
247
247
|
});
|
|
248
248
|
const pkg = (0, _config().getPackageJson)(projectRoot);
|
|
249
249
|
const watchFolders = (0, _getWatchFolders().getWatchFolders)(projectRoot);
|
|
250
|
-
// TODO: nodeModulesPaths does not work with the new Node.js package.json exports API, this causes packages like uuid to fail. Disabling for now.
|
|
251
250
|
const nodeModulesPaths = (0, _getModulesPaths().getModulesPaths)(projectRoot);
|
|
252
251
|
if (_env2().env.EXPO_DEBUG) {
|
|
253
252
|
console.log();
|
|
@@ -329,9 +328,7 @@ function getDefaultConfig(projectRoot, {
|
|
|
329
328
|
symbolicator: {
|
|
330
329
|
customizeFrame: (0, _customizeFrame().getDefaultCustomizeFrame)()
|
|
331
330
|
},
|
|
332
|
-
transformerPath:
|
|
333
|
-
// Custom worker that adds CSS support for Metro web.
|
|
334
|
-
require.resolve('./transform-worker/transform-worker') : metroDefaultValues.transformerPath,
|
|
331
|
+
transformerPath: require.resolve('./transform-worker/transform-worker'),
|
|
335
332
|
transformer: {
|
|
336
333
|
// Custom: These are passed to `getCacheKey` and ensure invalidation when the version changes.
|
|
337
334
|
// @ts-expect-error: not on type.
|
|
@@ -344,12 +341,14 @@ function getDefaultConfig(projectRoot, {
|
|
|
344
341
|
unstable_allowRequireContext: true,
|
|
345
342
|
allowOptionalDependencies: true,
|
|
346
343
|
babelTransformerPath: require.resolve('./babel-transformer'),
|
|
344
|
+
// See: https://github.com/facebook/react-native/blob/v0.73.0/packages/metro-config/index.js#L72-L74
|
|
345
|
+
asyncRequireModulePath: _resolveFrom().default.silent(projectRoot, '@expo/metro-runtime/async-require') || (0, _resolveFrom().default)(reactNativePath, metroDefaultValues.transformer.asyncRequireModulePath),
|
|
347
346
|
assetRegistryPath: '@react-native/assets-registry/registry',
|
|
348
347
|
assetPlugins: getAssetPlugins(projectRoot),
|
|
349
348
|
getTransformOptions: async () => ({
|
|
350
349
|
transform: {
|
|
351
350
|
experimentalImportSupport: false,
|
|
352
|
-
inlineRequires:
|
|
351
|
+
inlineRequires: false
|
|
353
352
|
}
|
|
354
353
|
})
|
|
355
354
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoMetroConfig.js","names":["_config","data","require","_paths","runtimeEnv","_interopRequireWildcard","_jsonFile","_interopRequireDefault","_chalk","_metroCache","_metroConfig","_os","_path","_resolveFrom","_customizeFrame","_env2","_fileStore","_getModulesPaths","_getWatchFolders","_rewriteRequestUrl","_withExpoSerializers","_postcss","_metroConfig2","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","debug","getAssetPlugins","projectRoot","hashAssetFilesPath","resolveFrom","silent","Error","hasWarnedAboutExotic","patchMetroGraphToSupportUncachedModules","Graph","original_traverseDependencies","traverseDependencies","__patched","paths","options","dependencies","forEach","dependency","output","find","file","_file$data$css","css","skipCache","includes","path","unstable_transformResultKey","push","getDefaultConfig","mode","isCSSEnabled","getDefaultMetroConfig","mergeConfig","importMetroConfig","isExotic","env","EXPO_USE_EXOTIC","console","log","chalk","gray","bold","reactNativePath","dirname","babelPresetFbjsPath","process","EXPO_METRO_CACHE_KEY_VERSION","String","version","sourceExtsConfig","isTS","isReact","isModern","sourceExts","getBareExtensions","reanimatedVersion","getPkgVersion","sassVersion","envFiles","getFiles","NODE_ENV","pkg","getPackageJson","watchFolders","getWatchFolders","nodeModulesPaths","getModulesPaths","EXPO_DEBUG","join","reporter","metroDefaultValues","getDefaultValues","cacheStore","FileStore","root","os","tmpdir","metroConfig","resolver","unstable_conditionsByPlatform","ios","android","web","unstable_conditionNames","resolverMainFields","platforms","assetExts","concat","filter","assetExt","cacheStores","watcher","additionalExts","map","replace","serializer","getModulesRunBeforeMainModule","preModules","resolve","stdRuntime","metroRuntime","getPolyfills","server","rewriteRequestUrl","getRewriteRequestUrl","port","Number","RCT_METRO_PORT","unstable_serverRoot","getServerRoot","symbolicator","customizeFrame","getDefaultCustomizeFrame","transformerPath","transformer","postcssHash","getPostcssConfigHash","browserslistHash","browserslist","stableHash","JSON","stringify","toString","unstable_allowRequireContext","allowOptionalDependencies","babelTransformerPath","assetRegistryPath","assetPlugins","getTransformOptions","transform","experimentalImportSupport","inlineRequires","withExpoSerializers","loadAsync","metroOptions","defaultConfig","loadConfig","cwd","exports","pkgName","targetPkg","targetPkgJson","findUpPackageJson","JsonFile","read","pkgVersion","sep","found"],"sources":["../src/ExpoMetroConfig.ts"],"sourcesContent":["// Copyright 2023-present 650 Industries (Expo). All rights reserved.\nimport { getPackageJson } from '@expo/config';\nimport { getBareExtensions } from '@expo/config/paths';\nimport * as runtimeEnv from '@expo/env';\nimport JsonFile from '@expo/json-file';\nimport chalk from 'chalk';\nimport { Reporter } from 'metro';\nimport { stableHash } from 'metro-cache';\nimport { ConfigT as MetroConfig, InputConfigT } from 'metro-config';\nimport os from 'os';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { getDefaultCustomizeFrame, INTERNAL_CALLSITES_REGEX } from './customizeFrame';\nimport { env } from './env';\nimport { FileStore } from './file-store';\nimport { getModulesPaths, getServerRoot } from './getModulesPaths';\nimport { getWatchFolders } from './getWatchFolders';\nimport { getRewriteRequestUrl } from './rewriteRequestUrl';\nimport { JSModule } from './serializer/getCssDeps';\nimport { withExpoSerializers } from './serializer/withExpoSerializers';\nimport { getPostcssConfigHash } from './transform-worker/postcss';\nimport { importMetroConfig } from './traveling/metro-config';\nconst debug = require('debug')('expo:metro:config') as typeof console.log;\n\nexport interface LoadOptions {\n config?: string;\n maxWorkers?: number;\n port?: number;\n reporter?: Reporter;\n resetCache?: boolean;\n}\n\nexport interface DefaultConfigOptions {\n /** @deprecated */\n mode?: 'exotic';\n /**\n * **Experimental:** Enable CSS support for Metro web, and shim on native.\n *\n * This is an experimental feature and may change in the future. The underlying implementation\n * is subject to change, and native support for CSS Modules may be added in the future during a non-major SDK release.\n */\n isCSSEnabled?: boolean;\n}\n\nfunction getAssetPlugins(projectRoot: string): string[] {\n const hashAssetFilesPath = resolveFrom.silent(projectRoot, 'expo-asset/tools/hashAssetFiles');\n\n if (!hashAssetFilesPath) {\n throw new Error(`The required package \\`expo-asset\\` cannot be found`);\n }\n\n return [hashAssetFilesPath];\n}\n\nlet hasWarnedAboutExotic = false;\n\n// Patch Metro's graph to support always parsing certain modules. This enables\n// things like Tailwind CSS which update based on their own heuristics.\nfunction patchMetroGraphToSupportUncachedModules() {\n const { Graph } = require('metro/src/DeltaBundler/Graph');\n\n const original_traverseDependencies = Graph.prototype.traverseDependencies;\n if (!original_traverseDependencies.__patched) {\n original_traverseDependencies.__patched = true;\n\n Graph.prototype.traverseDependencies = function (paths: string[], options: unknown) {\n this.dependencies.forEach((dependency: JSModule) => {\n // Find any dependencies that have been marked as `skipCache` and ensure they are invalidated.\n // `skipCache` is set when a CSS module is found by PostCSS.\n if (\n dependency.output.find((file) => file.data.css?.skipCache) &&\n !paths.includes(dependency.path)\n ) {\n // Ensure we invalidate the `unstable_transformResultKey` (input hash) so the module isn't removed in\n // the Graph._processModule method.\n dependency.unstable_transformResultKey = dependency.unstable_transformResultKey + '.';\n\n // Add the path to the list of modified paths so it gets run through the transformer again,\n // this will ensure it is passed to PostCSS -> Tailwind.\n paths.push(dependency.path);\n }\n });\n // Invoke the original method with the new paths to ensure the standard behavior is preserved.\n return original_traverseDependencies.call(this, paths, options);\n };\n // Ensure we don't patch the method twice.\n Graph.prototype.traverseDependencies.__patched = true;\n }\n}\n\nexport function getDefaultConfig(\n projectRoot: string,\n { mode, isCSSEnabled = true }: DefaultConfigOptions = {}\n): InputConfigT {\n const { getDefaultConfig: getDefaultMetroConfig, mergeConfig } = importMetroConfig(projectRoot);\n\n if (isCSSEnabled) {\n patchMetroGraphToSupportUncachedModules();\n }\n\n const isExotic = mode === 'exotic' || env.EXPO_USE_EXOTIC;\n\n if (isExotic && !hasWarnedAboutExotic) {\n hasWarnedAboutExotic = true;\n console.log(\n chalk.gray(`\\u203A Feature ${chalk.bold`EXPO_USE_EXOTIC`} is no longer supported.`)\n );\n }\n\n const reactNativePath = path.dirname(resolveFrom(projectRoot, 'react-native/package.json'));\n\n try {\n // Set the `EXPO_METRO_CACHE_KEY_VERSION` variable for use in the custom babel transformer.\n // This hack is used because there doesn't appear to be anyway to resolve\n // `babel-preset-fbjs` relative to the project root later (in `metro-expo-babel-transformer`).\n const babelPresetFbjsPath = resolveFrom(projectRoot, 'babel-preset-fbjs/package.json');\n process.env.EXPO_METRO_CACHE_KEY_VERSION = String(require(babelPresetFbjsPath).version);\n } catch {\n // noop -- falls back to a hardcoded value.\n }\n\n const sourceExtsConfig = { isTS: true, isReact: true, isModern: true };\n const sourceExts = getBareExtensions([], sourceExtsConfig);\n\n // Add support for cjs (without platform extensions).\n sourceExts.push('cjs');\n\n const reanimatedVersion = getPkgVersion(projectRoot, 'react-native-reanimated');\n\n let sassVersion: string | null = null;\n if (isCSSEnabled) {\n sassVersion = getPkgVersion(projectRoot, 'sass');\n // Enable SCSS by default so we can provide a better error message\n // when sass isn't installed.\n sourceExts.push('scss', 'sass', 'css');\n }\n\n const envFiles = runtimeEnv.getFiles(process.env.NODE_ENV, { silent: true });\n\n const pkg = getPackageJson(projectRoot);\n const watchFolders = getWatchFolders(projectRoot);\n // TODO: nodeModulesPaths does not work with the new Node.js package.json exports API, this causes packages like uuid to fail. Disabling for now.\n const nodeModulesPaths = getModulesPaths(projectRoot);\n if (env.EXPO_DEBUG) {\n console.log();\n console.log(`Expo Metro config:`);\n try {\n console.log(`- Version: ${require('../package.json').version}`);\n } catch {}\n console.log(`- Extensions: ${sourceExts.join(', ')}`);\n console.log(`- React Native: ${reactNativePath}`);\n console.log(`- Watch Folders: ${watchFolders.join(', ')}`);\n console.log(`- Node Module Paths: ${nodeModulesPaths.join(', ')}`);\n console.log(`- Env Files: ${envFiles}`);\n console.log(`- Sass: ${sassVersion}`);\n console.log(`- Reanimated: ${reanimatedVersion}`);\n console.log();\n }\n const {\n // Remove the default reporter which metro always resolves to be the react-native-community/cli reporter.\n // This prints a giant React logo which is less accessible to users on smaller terminals.\n reporter,\n ...metroDefaultValues\n } = getDefaultMetroConfig.getDefaultValues(projectRoot);\n\n const cacheStore = new FileStore<any>({\n root: path.join(os.tmpdir(), 'metro-cache'),\n });\n\n // Merge in the default config from Metro here, even though loadConfig uses it as defaults.\n // This is a convenience for getDefaultConfig use in metro.config.js, e.g. to modify assetExts.\n const metroConfig: Partial<MetroConfig> = mergeConfig(metroDefaultValues, {\n watchFolders,\n resolver: {\n unstable_conditionsByPlatform: {\n ios: ['react-native'],\n android: ['react-native'],\n // This is removed for server platforms.\n web: ['browser'],\n },\n unstable_conditionNames: ['require', 'import'],\n resolverMainFields: ['react-native', 'browser', 'main'],\n platforms: ['ios', 'android'],\n assetExts: metroDefaultValues.resolver.assetExts\n .concat(\n // Add default support for `expo-image` file types.\n ['heic', 'avif']\n )\n .filter((assetExt) => !sourceExts.includes(assetExt)),\n sourceExts,\n nodeModulesPaths,\n },\n cacheStores: [cacheStore],\n watcher: {\n // strip starting dot from env files\n additionalExts: envFiles.map((file: string) => file.replace(/^\\./, '')),\n },\n serializer: {\n getModulesRunBeforeMainModule: () => {\n const preModules: string[] = [\n // MUST be first\n require.resolve(path.join(reactNativePath, 'Libraries/Core/InitializeCore')),\n ];\n\n const stdRuntime = resolveFrom.silent(projectRoot, 'expo/build/winter');\n if (stdRuntime) {\n preModules.push(stdRuntime);\n }\n\n // We need to shift this to be the first module so web Fast Refresh works as expected.\n // This will only be applied if the module is installed and imported somewhere in the bundle already.\n const metroRuntime = resolveFrom.silent(projectRoot, '@expo/metro-runtime');\n if (metroRuntime) {\n preModules.push(metroRuntime);\n }\n\n return preModules;\n },\n getPolyfills: () => require('@react-native/js-polyfills')(),\n },\n server: {\n rewriteRequestUrl: getRewriteRequestUrl(projectRoot),\n port: Number(env.RCT_METRO_PORT) || 8081,\n // NOTE(EvanBacon): Moves the server root down to the monorepo root.\n // This enables proper monorepo support for web.\n unstable_serverRoot: getServerRoot(projectRoot),\n },\n symbolicator: {\n customizeFrame: getDefaultCustomizeFrame(),\n },\n transformerPath: isCSSEnabled\n ? // Custom worker that adds CSS support for Metro web.\n require.resolve('./transform-worker/transform-worker')\n : metroDefaultValues.transformerPath,\n\n transformer: {\n // Custom: These are passed to `getCacheKey` and ensure invalidation when the version changes.\n // @ts-expect-error: not on type.\n postcssHash: getPostcssConfigHash(projectRoot),\n browserslistHash: pkg.browserslist\n ? stableHash(JSON.stringify(pkg.browserslist)).toString('hex')\n : null,\n sassVersion,\n // Ensure invalidation when the version changes due to the Babel plugin.\n reanimatedVersion,\n\n // `require.context` support\n unstable_allowRequireContext: true,\n allowOptionalDependencies: true,\n babelTransformerPath: require.resolve('./babel-transformer'),\n assetRegistryPath: '@react-native/assets-registry/registry',\n assetPlugins: getAssetPlugins(projectRoot),\n getTransformOptions: async () => ({\n transform: {\n experimentalImportSupport: false,\n inlineRequires: true,\n },\n }),\n },\n });\n\n return withExpoSerializers(metroConfig);\n}\n\nexport async function loadAsync(\n projectRoot: string,\n { reporter, ...metroOptions }: LoadOptions = {}\n): Promise<MetroConfig> {\n let defaultConfig = getDefaultConfig(projectRoot);\n if (reporter) {\n defaultConfig = { ...defaultConfig, reporter };\n }\n\n const { loadConfig } = importMetroConfig(projectRoot);\n\n return await loadConfig({ cwd: projectRoot, projectRoot, ...metroOptions }, defaultConfig);\n}\n\n// re-export for use in config files.\nexport { MetroConfig, INTERNAL_CALLSITES_REGEX };\n\n// re-export for legacy cases.\nexport const EXPO_DEBUG = env.EXPO_DEBUG;\n\nfunction getPkgVersion(projectRoot: string, pkgName: string): string | null {\n const targetPkg = resolveFrom.silent(projectRoot, pkgName);\n if (!targetPkg) return null;\n const targetPkgJson = findUpPackageJson(targetPkg);\n if (!targetPkgJson) return null;\n const pkg = JsonFile.read(targetPkgJson);\n\n debug(`${pkgName} package.json:`, targetPkgJson);\n const pkgVersion = pkg.version;\n if (typeof pkgVersion === 'string') {\n return pkgVersion;\n }\n\n return null;\n}\n\nfunction findUpPackageJson(cwd: string): string | null {\n if (['.', path.sep].includes(cwd)) return null;\n\n const found = resolveFrom.silent(cwd, './package.json');\n if (found) {\n return found;\n }\n return findUpPackageJson(path.dirname(cwd));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAI,uBAAA,CAAAH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AAa,CAAC;EAExC7I,KAAK,CAAE,GAAE2I,OAAQ,gBAAe,EAAEE,aAAa,CAAC;EAChD,MAAMI,UAAU,GAAGpF,GAAG,CAACb,OAAO;EAC9B,IAAI,OAAOiG,UAAU,KAAK,QAAQ,EAAE;IAClC,OAAOA,UAAU;EACnB;EAEA,OAAO,IAAI;AACb;AAEA,SAASH,iBAAiBA,CAACL,GAAW,EAAiB;EACrD,IAAI,CAAC,GAAG,EAAEhH,eAAI,CAACyH,GAAG,CAAC,CAAC1H,QAAQ,CAACiH,GAAG,CAAC,EAAE,OAAO,IAAI;EAE9C,MAAMU,KAAK,GAAG/I,sBAAW,CAACC,MAAM,CAACoI,GAAG,EAAE,gBAAgB,CAAC;EACvD,IAAIU,KAAK,EAAE;IACT,OAAOA,KAAK;EACd;EACA,OAAOL,iBAAiB,CAACrH,eAAI,CAACkB,OAAO,CAAC8F,GAAG,CAAC,CAAC;AAC7C"}
|
|
1
|
+
{"version":3,"file":"ExpoMetroConfig.js","names":["_config","data","require","_paths","runtimeEnv","_interopRequireWildcard","_jsonFile","_interopRequireDefault","_chalk","_metroCache","_metroConfig","_os","_path","_resolveFrom","_customizeFrame","_env2","_fileStore","_getModulesPaths","_getWatchFolders","_rewriteRequestUrl","_withExpoSerializers","_postcss","_metroConfig2","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","debug","getAssetPlugins","projectRoot","hashAssetFilesPath","resolveFrom","silent","Error","hasWarnedAboutExotic","patchMetroGraphToSupportUncachedModules","Graph","original_traverseDependencies","traverseDependencies","__patched","paths","options","dependencies","forEach","dependency","output","find","file","_file$data$css","css","skipCache","includes","path","unstable_transformResultKey","push","getDefaultConfig","mode","isCSSEnabled","getDefaultMetroConfig","mergeConfig","importMetroConfig","isExotic","env","EXPO_USE_EXOTIC","console","log","chalk","gray","bold","reactNativePath","dirname","babelPresetFbjsPath","process","EXPO_METRO_CACHE_KEY_VERSION","String","version","sourceExtsConfig","isTS","isReact","isModern","sourceExts","getBareExtensions","reanimatedVersion","getPkgVersion","sassVersion","envFiles","getFiles","NODE_ENV","pkg","getPackageJson","watchFolders","getWatchFolders","nodeModulesPaths","getModulesPaths","EXPO_DEBUG","join","reporter","metroDefaultValues","getDefaultValues","cacheStore","FileStore","root","os","tmpdir","metroConfig","resolver","unstable_conditionsByPlatform","ios","android","web","unstable_conditionNames","resolverMainFields","platforms","assetExts","concat","filter","assetExt","cacheStores","watcher","additionalExts","map","replace","serializer","getModulesRunBeforeMainModule","preModules","resolve","stdRuntime","metroRuntime","getPolyfills","server","rewriteRequestUrl","getRewriteRequestUrl","port","Number","RCT_METRO_PORT","unstable_serverRoot","getServerRoot","symbolicator","customizeFrame","getDefaultCustomizeFrame","transformerPath","transformer","postcssHash","getPostcssConfigHash","browserslistHash","browserslist","stableHash","JSON","stringify","toString","unstable_allowRequireContext","allowOptionalDependencies","babelTransformerPath","asyncRequireModulePath","assetRegistryPath","assetPlugins","getTransformOptions","transform","experimentalImportSupport","inlineRequires","withExpoSerializers","loadAsync","metroOptions","defaultConfig","loadConfig","cwd","exports","pkgName","targetPkg","targetPkgJson","findUpPackageJson","JsonFile","read","pkgVersion","sep","found"],"sources":["../src/ExpoMetroConfig.ts"],"sourcesContent":["// Copyright 2023-present 650 Industries (Expo). All rights reserved.\nimport { getPackageJson } from '@expo/config';\nimport { getBareExtensions } from '@expo/config/paths';\nimport * as runtimeEnv from '@expo/env';\nimport JsonFile from '@expo/json-file';\nimport chalk from 'chalk';\nimport { Reporter } from 'metro';\nimport { stableHash } from 'metro-cache';\nimport { ConfigT as MetroConfig, InputConfigT } from 'metro-config';\nimport os from 'os';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { getDefaultCustomizeFrame, INTERNAL_CALLSITES_REGEX } from './customizeFrame';\nimport { env } from './env';\nimport { FileStore } from './file-store';\nimport { getModulesPaths, getServerRoot } from './getModulesPaths';\nimport { getWatchFolders } from './getWatchFolders';\nimport { getRewriteRequestUrl } from './rewriteRequestUrl';\nimport { JSModule } from './serializer/getCssDeps';\nimport { withExpoSerializers } from './serializer/withExpoSerializers';\nimport { getPostcssConfigHash } from './transform-worker/postcss';\nimport { importMetroConfig } from './traveling/metro-config';\nconst debug = require('debug')('expo:metro:config') as typeof console.log;\n\nexport interface LoadOptions {\n config?: string;\n maxWorkers?: number;\n port?: number;\n reporter?: Reporter;\n resetCache?: boolean;\n}\n\nexport interface DefaultConfigOptions {\n /** @deprecated */\n mode?: 'exotic';\n /**\n * **Experimental:** Enable CSS support for Metro web, and shim on native.\n *\n * This is an experimental feature and may change in the future. The underlying implementation\n * is subject to change, and native support for CSS Modules may be added in the future during a non-major SDK release.\n */\n isCSSEnabled?: boolean;\n}\n\nfunction getAssetPlugins(projectRoot: string): string[] {\n const hashAssetFilesPath = resolveFrom.silent(projectRoot, 'expo-asset/tools/hashAssetFiles');\n\n if (!hashAssetFilesPath) {\n throw new Error(`The required package \\`expo-asset\\` cannot be found`);\n }\n\n return [hashAssetFilesPath];\n}\n\nlet hasWarnedAboutExotic = false;\n\n// Patch Metro's graph to support always parsing certain modules. This enables\n// things like Tailwind CSS which update based on their own heuristics.\nfunction patchMetroGraphToSupportUncachedModules() {\n const { Graph } = require('metro/src/DeltaBundler/Graph');\n\n const original_traverseDependencies = Graph.prototype.traverseDependencies;\n if (!original_traverseDependencies.__patched) {\n original_traverseDependencies.__patched = true;\n\n Graph.prototype.traverseDependencies = function (paths: string[], options: unknown) {\n this.dependencies.forEach((dependency: JSModule) => {\n // Find any dependencies that have been marked as `skipCache` and ensure they are invalidated.\n // `skipCache` is set when a CSS module is found by PostCSS.\n if (\n dependency.output.find((file) => file.data.css?.skipCache) &&\n !paths.includes(dependency.path)\n ) {\n // Ensure we invalidate the `unstable_transformResultKey` (input hash) so the module isn't removed in\n // the Graph._processModule method.\n dependency.unstable_transformResultKey = dependency.unstable_transformResultKey + '.';\n\n // Add the path to the list of modified paths so it gets run through the transformer again,\n // this will ensure it is passed to PostCSS -> Tailwind.\n paths.push(dependency.path);\n }\n });\n // Invoke the original method with the new paths to ensure the standard behavior is preserved.\n return original_traverseDependencies.call(this, paths, options);\n };\n // Ensure we don't patch the method twice.\n Graph.prototype.traverseDependencies.__patched = true;\n }\n}\n\nexport function getDefaultConfig(\n projectRoot: string,\n { mode, isCSSEnabled = true }: DefaultConfigOptions = {}\n): InputConfigT {\n const { getDefaultConfig: getDefaultMetroConfig, mergeConfig } = importMetroConfig(projectRoot);\n\n if (isCSSEnabled) {\n patchMetroGraphToSupportUncachedModules();\n }\n\n const isExotic = mode === 'exotic' || env.EXPO_USE_EXOTIC;\n\n if (isExotic && !hasWarnedAboutExotic) {\n hasWarnedAboutExotic = true;\n console.log(\n chalk.gray(`\\u203A Feature ${chalk.bold`EXPO_USE_EXOTIC`} is no longer supported.`)\n );\n }\n\n const reactNativePath = path.dirname(resolveFrom(projectRoot, 'react-native/package.json'));\n\n try {\n // Set the `EXPO_METRO_CACHE_KEY_VERSION` variable for use in the custom babel transformer.\n // This hack is used because there doesn't appear to be anyway to resolve\n // `babel-preset-fbjs` relative to the project root later (in `metro-expo-babel-transformer`).\n const babelPresetFbjsPath = resolveFrom(projectRoot, 'babel-preset-fbjs/package.json');\n process.env.EXPO_METRO_CACHE_KEY_VERSION = String(require(babelPresetFbjsPath).version);\n } catch {\n // noop -- falls back to a hardcoded value.\n }\n\n const sourceExtsConfig = { isTS: true, isReact: true, isModern: true };\n const sourceExts = getBareExtensions([], sourceExtsConfig);\n\n // Add support for cjs (without platform extensions).\n sourceExts.push('cjs');\n\n const reanimatedVersion = getPkgVersion(projectRoot, 'react-native-reanimated');\n\n let sassVersion: string | null = null;\n if (isCSSEnabled) {\n sassVersion = getPkgVersion(projectRoot, 'sass');\n // Enable SCSS by default so we can provide a better error message\n // when sass isn't installed.\n sourceExts.push('scss', 'sass', 'css');\n }\n\n const envFiles = runtimeEnv.getFiles(process.env.NODE_ENV, { silent: true });\n\n const pkg = getPackageJson(projectRoot);\n const watchFolders = getWatchFolders(projectRoot);\n const nodeModulesPaths = getModulesPaths(projectRoot);\n if (env.EXPO_DEBUG) {\n console.log();\n console.log(`Expo Metro config:`);\n try {\n console.log(`- Version: ${require('../package.json').version}`);\n } catch {}\n console.log(`- Extensions: ${sourceExts.join(', ')}`);\n console.log(`- React Native: ${reactNativePath}`);\n console.log(`- Watch Folders: ${watchFolders.join(', ')}`);\n console.log(`- Node Module Paths: ${nodeModulesPaths.join(', ')}`);\n console.log(`- Env Files: ${envFiles}`);\n console.log(`- Sass: ${sassVersion}`);\n console.log(`- Reanimated: ${reanimatedVersion}`);\n console.log();\n }\n const {\n // Remove the default reporter which metro always resolves to be the react-native-community/cli reporter.\n // This prints a giant React logo which is less accessible to users on smaller terminals.\n reporter,\n ...metroDefaultValues\n } = getDefaultMetroConfig.getDefaultValues(projectRoot);\n\n const cacheStore = new FileStore<any>({\n root: path.join(os.tmpdir(), 'metro-cache'),\n });\n\n // Merge in the default config from Metro here, even though loadConfig uses it as defaults.\n // This is a convenience for getDefaultConfig use in metro.config.js, e.g. to modify assetExts.\n const metroConfig: Partial<MetroConfig> = mergeConfig(metroDefaultValues, {\n watchFolders,\n resolver: {\n unstable_conditionsByPlatform: {\n ios: ['react-native'],\n android: ['react-native'],\n // This is removed for server platforms.\n web: ['browser'],\n },\n unstable_conditionNames: ['require', 'import'],\n resolverMainFields: ['react-native', 'browser', 'main'],\n platforms: ['ios', 'android'],\n assetExts: metroDefaultValues.resolver.assetExts\n .concat(\n // Add default support for `expo-image` file types.\n ['heic', 'avif']\n )\n .filter((assetExt) => !sourceExts.includes(assetExt)),\n sourceExts,\n nodeModulesPaths,\n },\n cacheStores: [cacheStore],\n watcher: {\n // strip starting dot from env files\n additionalExts: envFiles.map((file: string) => file.replace(/^\\./, '')),\n },\n serializer: {\n getModulesRunBeforeMainModule: () => {\n const preModules: string[] = [\n // MUST be first\n require.resolve(path.join(reactNativePath, 'Libraries/Core/InitializeCore')),\n ];\n\n const stdRuntime = resolveFrom.silent(projectRoot, 'expo/build/winter');\n if (stdRuntime) {\n preModules.push(stdRuntime);\n }\n\n // We need to shift this to be the first module so web Fast Refresh works as expected.\n // This will only be applied if the module is installed and imported somewhere in the bundle already.\n const metroRuntime = resolveFrom.silent(projectRoot, '@expo/metro-runtime');\n if (metroRuntime) {\n preModules.push(metroRuntime);\n }\n\n return preModules;\n },\n getPolyfills: () => require('@react-native/js-polyfills')(),\n },\n server: {\n rewriteRequestUrl: getRewriteRequestUrl(projectRoot),\n port: Number(env.RCT_METRO_PORT) || 8081,\n // NOTE(EvanBacon): Moves the server root down to the monorepo root.\n // This enables proper monorepo support for web.\n unstable_serverRoot: getServerRoot(projectRoot),\n },\n symbolicator: {\n customizeFrame: getDefaultCustomizeFrame(),\n },\n transformerPath: require.resolve('./transform-worker/transform-worker'),\n transformer: {\n // Custom: These are passed to `getCacheKey` and ensure invalidation when the version changes.\n // @ts-expect-error: not on type.\n postcssHash: getPostcssConfigHash(projectRoot),\n browserslistHash: pkg.browserslist\n ? stableHash(JSON.stringify(pkg.browserslist)).toString('hex')\n : null,\n sassVersion,\n // Ensure invalidation when the version changes due to the Babel plugin.\n reanimatedVersion,\n\n // `require.context` support\n unstable_allowRequireContext: true,\n allowOptionalDependencies: true,\n babelTransformerPath: require.resolve('./babel-transformer'),\n // See: https://github.com/facebook/react-native/blob/v0.73.0/packages/metro-config/index.js#L72-L74\n asyncRequireModulePath:\n resolveFrom.silent(projectRoot, '@expo/metro-runtime/async-require') ||\n resolveFrom(reactNativePath, metroDefaultValues.transformer.asyncRequireModulePath),\n assetRegistryPath: '@react-native/assets-registry/registry',\n assetPlugins: getAssetPlugins(projectRoot),\n getTransformOptions: async () => ({\n transform: {\n experimentalImportSupport: false,\n inlineRequires: false,\n },\n }),\n },\n });\n\n return withExpoSerializers(metroConfig);\n}\n\nexport async function loadAsync(\n projectRoot: string,\n { reporter, ...metroOptions }: LoadOptions = {}\n): Promise<MetroConfig> {\n let defaultConfig = getDefaultConfig(projectRoot);\n if (reporter) {\n defaultConfig = { ...defaultConfig, reporter };\n }\n\n const { loadConfig } = importMetroConfig(projectRoot);\n\n return await loadConfig({ cwd: projectRoot, projectRoot, ...metroOptions }, defaultConfig);\n}\n\n// re-export for use in config files.\nexport { MetroConfig, INTERNAL_CALLSITES_REGEX };\n\n// re-export for legacy cases.\nexport const EXPO_DEBUG = env.EXPO_DEBUG;\n\nfunction getPkgVersion(projectRoot: string, pkgName: string): string | null {\n const targetPkg = resolveFrom.silent(projectRoot, pkgName);\n if (!targetPkg) return null;\n const targetPkgJson = findUpPackageJson(targetPkg);\n if (!targetPkgJson) return null;\n const pkg = JsonFile.read(targetPkgJson);\n\n debug(`${pkgName} package.json:`, targetPkgJson);\n const pkgVersion = pkg.version;\n if (typeof pkgVersion === 'string') {\n return pkgVersion;\n }\n\n return null;\n}\n\nfunction findUpPackageJson(cwd: string): string | null {\n if (['.', path.sep].includes(cwd)) return null;\n\n const found = resolveFrom.silent(cwd, './package.json');\n if (found) {\n return found;\n }\n return findUpPackageJson(path.dirname(cwd));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAI,uBAAA,CAAAH,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,UAAA;EAAA,MAAAL,IAAA,GAAAM,sBAAA,CAAAL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,GAAE4I,OAAQ,gBAAe,EAAEE,aAAa,CAAC;EAChD,MAAMI,UAAU,GAAGrF,GAAG,CAACb,OAAO;EAC9B,IAAI,OAAOkG,UAAU,KAAK,QAAQ,EAAE;IAClC,OAAOA,UAAU;EACnB;EAEA,OAAO,IAAI;AACb;AAEA,SAASH,iBAAiBA,CAACL,GAAW,EAAiB;EACrD,IAAI,CAAC,GAAG,EAAEjH,eAAI,CAAC0H,GAAG,CAAC,CAAC3H,QAAQ,CAACkH,GAAG,CAAC,EAAE,OAAO,IAAI;EAE9C,MAAMU,KAAK,GAAGhJ,sBAAW,CAACC,MAAM,CAACqI,GAAG,EAAE,gBAAgB,CAAC;EACvD,IAAIU,KAAK,EAAE;IACT,OAAOA,KAAK;EACd;EACA,OAAOL,iBAAiB,CAACtH,eAAI,CAACkB,OAAO,CAAC+F,GAAG,CAAC,CAAC;AAC7C"}
|
package/build/babel-core.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { type PluginItem, type TransformOptions, transformFromAstSync, transformSync, } from '@babel/core';
|
package/build/babel-core.js
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "transformFromAstSync", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return _core().
|
|
9
|
+
return _core().transformFromAstSync;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "transformSync", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function () {
|
|
15
|
-
return _core().
|
|
15
|
+
return _core().transformSync;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
function _core() {
|
package/build/babel-core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babel-core.js","names":["_core","data","require"],"sources":["../src/babel-core.ts"],"sourcesContent":["// re-exported because babel/core is hard to mock.\nexport {\n
|
|
1
|
+
{"version":3,"file":"babel-core.js","names":["_core","data","require"],"sources":["../src/babel-core.ts"],"sourcesContent":["// re-exported because babel/core is hard to mock.\nexport {\n type PluginItem,\n type TransformOptions,\n transformFromAstSync,\n transformSync,\n} from '@babel/core';\n"],"mappings":";;;;;;;;;;;;;;;;;AACA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA"}
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 650 Industries (Expo). All rights reserved.
|
|
3
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
1
|
export {};
|
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _inlineRequires() {
|
|
4
|
-
const data = _interopRequireDefault(require("babel-preset-fbjs/plugins/inline-requires"));
|
|
5
|
-
_inlineRequires = function () {
|
|
6
|
-
return data;
|
|
7
|
-
};
|
|
8
|
-
return data;
|
|
9
|
-
}
|
|
10
|
-
function _hmr() {
|
|
11
|
-
const data = _interopRequireDefault(require("metro-react-native-babel-preset/src/configs/hmr"));
|
|
12
|
-
_hmr = function () {
|
|
13
|
-
return data;
|
|
14
|
-
};
|
|
15
|
-
return data;
|
|
16
|
-
}
|
|
17
3
|
function _nodeAssert() {
|
|
18
4
|
const data = _interopRequireDefault(require("node:assert"));
|
|
19
5
|
_nodeAssert = function () {
|
|
@@ -35,23 +21,16 @@ function _nodeFs() {
|
|
|
35
21
|
};
|
|
36
22
|
return data;
|
|
37
23
|
}
|
|
38
|
-
function
|
|
39
|
-
const data =
|
|
40
|
-
|
|
24
|
+
function _loadBabelConfig() {
|
|
25
|
+
const data = require("./loadBabelConfig");
|
|
26
|
+
_loadBabelConfig = function () {
|
|
41
27
|
return data;
|
|
42
28
|
};
|
|
43
29
|
return data;
|
|
44
30
|
}
|
|
45
|
-
function
|
|
46
|
-
const data =
|
|
47
|
-
|
|
48
|
-
return data;
|
|
49
|
-
};
|
|
50
|
-
return data;
|
|
51
|
-
}
|
|
52
|
-
function _babelCore() {
|
|
53
|
-
const data = require("./babel-core");
|
|
54
|
-
_babelCore = function () {
|
|
31
|
+
function _transformSync() {
|
|
32
|
+
const data = require("./transformSync");
|
|
33
|
+
_transformSync = function () {
|
|
55
34
|
return data;
|
|
56
35
|
};
|
|
57
36
|
return data;
|
|
@@ -67,209 +46,106 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
67
46
|
// A fork of the upstream babel-transformer that uses Expo-specific babel defaults
|
|
68
47
|
// and adds support for web and Node.js environments via `isServer` on the Babel caller.
|
|
69
48
|
|
|
70
|
-
// @ts-expect-error
|
|
71
|
-
|
|
72
|
-
// @ts-expect-error
|
|
73
|
-
|
|
74
49
|
const cacheKeyParts = [_nodeFs().default.readFileSync(__filename), require('babel-preset-fbjs/package.json').version];
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
function isTypeScriptSource(fileName) {
|
|
78
|
-
return !!fileName && fileName.endsWith('.ts');
|
|
79
|
-
}
|
|
80
|
-
function isTSXSource(fileName) {
|
|
81
|
-
return !!fileName && fileName.endsWith('.tsx');
|
|
82
|
-
}
|
|
83
|
-
let babelPresetExpo = null;
|
|
84
|
-
function getBabelPresetExpo(projectRoot) {
|
|
85
|
-
var _resolveFrom$silent;
|
|
86
|
-
if (babelPresetExpo !== undefined) {
|
|
87
|
-
return babelPresetExpo;
|
|
88
|
-
}
|
|
89
|
-
babelPresetExpo = (_resolveFrom$silent = _resolveFrom().default.silent(projectRoot, 'babel-preset-expo')) !== null && _resolveFrom$silent !== void 0 ? _resolveFrom$silent : null;
|
|
90
|
-
return babelPresetExpo;
|
|
50
|
+
function isCustomTruthy(value) {
|
|
51
|
+
return value === true || value === 'true';
|
|
91
52
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const getBabelRC = function () {
|
|
99
|
-
let babelRC = null;
|
|
100
|
-
|
|
101
|
-
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
|
|
102
|
-
* LTI update could not be added via codemod */
|
|
103
|
-
return function _getBabelRC({
|
|
104
|
-
projectRoot,
|
|
105
|
-
extendsBabelConfigPath,
|
|
106
|
-
...options
|
|
107
|
-
}) {
|
|
108
|
-
if (babelRC != null) {
|
|
109
|
-
return babelRC;
|
|
110
|
-
}
|
|
111
|
-
babelRC = {
|
|
112
|
-
plugins: [],
|
|
113
|
-
extends: extendsBabelConfigPath
|
|
114
|
-
};
|
|
115
|
-
if (extendsBabelConfigPath) {
|
|
116
|
-
return babelRC;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Let's look for a babel config file in the project root.
|
|
120
|
-
let projectBabelRCPath;
|
|
121
|
-
|
|
122
|
-
// .babelrc
|
|
123
|
-
if (projectRoot) {
|
|
124
|
-
projectBabelRCPath = _nodePath().default.resolve(projectRoot, '.babelrc');
|
|
125
|
-
}
|
|
126
|
-
if (projectBabelRCPath) {
|
|
127
|
-
// .babelrc.js
|
|
128
|
-
if (!_nodeFs().default.existsSync(projectBabelRCPath)) {
|
|
129
|
-
projectBabelRCPath = _nodePath().default.resolve(projectRoot, '.babelrc.js');
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// babel.config.js
|
|
133
|
-
if (!_nodeFs().default.existsSync(projectBabelRCPath)) {
|
|
134
|
-
projectBabelRCPath = _nodePath().default.resolve(projectRoot, 'babel.config.js');
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// If we found a babel config file, extend our config off of it
|
|
138
|
-
// otherwise the default config will be used
|
|
139
|
-
if (_nodeFs().default.existsSync(projectBabelRCPath)) {
|
|
140
|
-
babelRC.extends = projectBabelRCPath;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// If a babel config file doesn't exist in the project then
|
|
145
|
-
// the default preset for react-native will be used instead.
|
|
146
|
-
if (!babelRC.extends) {
|
|
147
|
-
const {
|
|
148
|
-
experimentalImportSupport,
|
|
149
|
-
...presetOptions
|
|
150
|
-
} = options;
|
|
151
|
-
|
|
152
|
-
// Convert the options into the format expected by the Expo preset.
|
|
153
|
-
const platformOptions = {
|
|
154
|
-
// @ts-expect-error: This is how Metro works by default
|
|
155
|
-
unstable_transformProfile: presetOptions.unstable_transformProfile,
|
|
156
|
-
disableImportExportTransform: experimentalImportSupport,
|
|
157
|
-
dev: presetOptions.dev,
|
|
158
|
-
enableBabelRuntime: presetOptions.enableBabelRuntime
|
|
159
|
-
};
|
|
160
|
-
babelRC.presets = [[
|
|
161
|
-
// NOTE(EvanBacon): Here we use the Expo babel wrapper instead of the default react-native preset.
|
|
162
|
-
require('babel-preset-expo'), {
|
|
163
|
-
web: platformOptions,
|
|
164
|
-
native: platformOptions
|
|
165
|
-
// lazyImports: presetOptions.lazyImportExportTransform,
|
|
166
|
-
}]];
|
|
53
|
+
function memoize(fn) {
|
|
54
|
+
const cache = new Map();
|
|
55
|
+
return (...args) => {
|
|
56
|
+
const key = JSON.stringify(args);
|
|
57
|
+
if (cache.has(key)) {
|
|
58
|
+
return cache.get(key);
|
|
167
59
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}();
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Given a filename and options, build a Babel
|
|
175
|
-
* config object with the appropriate plugins.
|
|
176
|
-
*/
|
|
177
|
-
function buildBabelConfig(filename, options, plugins = []) {
|
|
178
|
-
const babelRC = getBabelRC(options);
|
|
179
|
-
const extraConfig = {
|
|
180
|
-
babelrc: typeof options.enableBabelRCLookup === 'boolean' ? options.enableBabelRCLookup : true,
|
|
181
|
-
code: false,
|
|
182
|
-
cwd: options.projectRoot,
|
|
183
|
-
filename,
|
|
184
|
-
highlightCode: true
|
|
60
|
+
const result = fn(...args);
|
|
61
|
+
cache.set(key, result);
|
|
62
|
+
return result;
|
|
185
63
|
};
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
const
|
|
198
|
-
if (
|
|
199
|
-
|
|
200
|
-
// I'm not sure which one it should use on Windows, and false positives
|
|
201
|
-
// are unlikely anyway. If you later decide to include the separator,
|
|
202
|
-
// don't forget that the string usually *starts* with "node_modules" so
|
|
203
|
-
// the first one often won't be there.
|
|
204
|
-
const mayContainEditableReactComponents = !filename.includes('node_modules');
|
|
205
|
-
if (mayContainEditableReactComponents) {
|
|
206
|
-
const hmrConfig = (0, _hmr().default)();
|
|
207
|
-
hmrConfig.plugins = withExtraPlugins.concat(hmrConfig.plugins);
|
|
208
|
-
config = {
|
|
209
|
-
...config,
|
|
210
|
-
...hmrConfig
|
|
211
|
-
};
|
|
212
|
-
}
|
|
64
|
+
}
|
|
65
|
+
const memoizeWarning = memoize(message => {
|
|
66
|
+
console.warn(message);
|
|
67
|
+
});
|
|
68
|
+
function getBabelCaller({
|
|
69
|
+
filename,
|
|
70
|
+
options
|
|
71
|
+
}) {
|
|
72
|
+
var _options$customTransf, _options$customTransf2, _options$customTransf3, _options$customTransf4, _options$customTransf5, _options$customTransf6;
|
|
73
|
+
const isNodeModule = filename.includes('node_modules');
|
|
74
|
+
const isServer = ((_options$customTransf = options.customTransformOptions) === null || _options$customTransf === void 0 ? void 0 : _options$customTransf.environment) === 'node';
|
|
75
|
+
const routerRoot = typeof ((_options$customTransf2 = options.customTransformOptions) === null || _options$customTransf2 === void 0 ? void 0 : _options$customTransf2.routerRoot) === 'string' ? decodeURI(options.customTransformOptions.routerRoot) : undefined;
|
|
76
|
+
if (routerRoot == null) {
|
|
77
|
+
memoizeWarning('Missing transform.routerRoot option in Metro bundling request, falling back to `app` as routes directory.');
|
|
213
78
|
}
|
|
214
79
|
return {
|
|
215
|
-
|
|
216
|
-
|
|
80
|
+
name: 'metro',
|
|
81
|
+
bundler: 'metro',
|
|
82
|
+
platform: options.platform,
|
|
83
|
+
// Empower the babel preset to know the env it's bundling for.
|
|
84
|
+
// Metro automatically updates the cache to account for the custom transform options.
|
|
85
|
+
isServer,
|
|
86
|
+
// The base url to make requests from, used for hosting from non-standard locations.
|
|
87
|
+
baseUrl: typeof ((_options$customTransf3 = options.customTransformOptions) === null || _options$customTransf3 === void 0 ? void 0 : _options$customTransf3.baseUrl) === 'string' ? decodeURI(options.customTransformOptions.baseUrl) : '',
|
|
88
|
+
// Ensure we always use a mostly-valid router root.
|
|
89
|
+
routerRoot: routerRoot !== null && routerRoot !== void 0 ? routerRoot : 'app',
|
|
90
|
+
isDev: options.dev,
|
|
91
|
+
// This value indicates if the user has disabled the feature or not.
|
|
92
|
+
// Other criteria may still cause the feature to be disabled, but all inputs used are
|
|
93
|
+
// already considered in the cache key.
|
|
94
|
+
preserveEnvVars: isCustomTruthy((_options$customTransf4 = options.customTransformOptions) === null || _options$customTransf4 === void 0 ? void 0 : _options$customTransf4.preserveEnvVars) ? true : undefined,
|
|
95
|
+
asyncRoutes: isCustomTruthy((_options$customTransf5 = options.customTransformOptions) === null || _options$customTransf5 === void 0 ? void 0 : _options$customTransf5.asyncRoutes) ? true : undefined,
|
|
96
|
+
// Pass the engine to babel so we can automatically transpile for the correct
|
|
97
|
+
// target environment.
|
|
98
|
+
engine: (_options$customTransf6 = options.customTransformOptions) === null || _options$customTransf6 === void 0 ? void 0 : _options$customTransf6.engine,
|
|
99
|
+
// Provide the project root for accurately reading the Expo config.
|
|
100
|
+
projectRoot: options.projectRoot,
|
|
101
|
+
isNodeModule,
|
|
102
|
+
isHMREnabled: options.hot,
|
|
103
|
+
// Set the standard Babel flag to disable ESM transformations.
|
|
104
|
+
supportsStaticESM: options.experimentalImportSupport
|
|
217
105
|
};
|
|
218
106
|
}
|
|
219
|
-
function isCustomTruthy(value) {
|
|
220
|
-
return value === true || value === 'true';
|
|
221
|
-
}
|
|
222
107
|
const transform = ({
|
|
223
108
|
filename,
|
|
224
|
-
options,
|
|
225
109
|
src,
|
|
110
|
+
options,
|
|
111
|
+
// `plugins` is used for `functionMapBabelPlugin` from `metro-source-map`. Could make sense to move this to `babel-preset-expo` too.
|
|
226
112
|
plugins
|
|
227
113
|
}) => {
|
|
228
|
-
var _getBabelPresetExpo;
|
|
229
114
|
const OLD_BABEL_ENV = process.env.BABEL_ENV;
|
|
230
115
|
process.env.BABEL_ENV = options.dev ? 'development' : process.env.BABEL_ENV || 'production';
|
|
231
|
-
|
|
232
|
-
// Ensure the default babel preset is Expo.
|
|
233
|
-
options.extendsBabelConfigPath = (_getBabelPresetExpo = getBabelPresetExpo(options.projectRoot)) !== null && _getBabelPresetExpo !== void 0 ? _getBabelPresetExpo : undefined;
|
|
234
116
|
try {
|
|
235
|
-
var _options$customTransf, _options$customTransf2, _options$customTransf3, _options$customTransf4;
|
|
236
117
|
const babelConfig = {
|
|
237
118
|
// ES modules require sourceType='module' but OSS may not always want that
|
|
238
119
|
sourceType: 'unambiguous',
|
|
239
|
-
|
|
240
|
-
caller: {
|
|
241
|
-
name: 'metro',
|
|
242
|
-
// @ts-expect-error: Custom values passed to the caller.
|
|
243
|
-
bundler: 'metro',
|
|
244
|
-
platform: options.platform,
|
|
245
|
-
// Empower the babel preset to know the env it's bundling for.
|
|
246
|
-
// Metro automatically updates the cache to account for the custom transform options.
|
|
247
|
-
isServer: ((_options$customTransf = options.customTransformOptions) === null || _options$customTransf === void 0 ? void 0 : _options$customTransf.environment) === 'node',
|
|
248
|
-
// The base url to make requests from, used for hosting from non-standard locations.
|
|
249
|
-
baseUrl: typeof ((_options$customTransf2 = options.customTransformOptions) === null || _options$customTransf2 === void 0 ? void 0 : _options$customTransf2.baseUrl) === 'string' ? decodeURI(options.customTransformOptions.baseUrl) : '',
|
|
250
|
-
isDev: options.dev,
|
|
251
|
-
// This value indicates if the user has disabled the feature or not.
|
|
252
|
-
// Other criteria may still cause the feature to be disabled, but all inputs used are
|
|
253
|
-
// already considered in the cache key.
|
|
254
|
-
preserveEnvVars: isCustomTruthy((_options$customTransf3 = options.customTransformOptions) === null || _options$customTransf3 === void 0 ? void 0 : _options$customTransf3.preserveEnvVars) ? true : undefined,
|
|
255
|
-
// Pass the engine to babel so we can automatically transpile for the correct
|
|
256
|
-
// target environment.
|
|
257
|
-
engine: (_options$customTransf4 = options.customTransformOptions) === null || _options$customTransf4 === void 0 ? void 0 : _options$customTransf4.engine,
|
|
258
|
-
// Provide the project root for accurately reading the Expo config.
|
|
259
|
-
projectRoot: options.projectRoot
|
|
260
|
-
},
|
|
120
|
+
// The output we want from Babel methods
|
|
261
121
|
ast: true,
|
|
122
|
+
code: false,
|
|
262
123
|
// NOTE(EvanBacon): We split the parse/transform steps up to accommodate
|
|
263
124
|
// Hermes parsing, but this defaults to cloning the AST which increases
|
|
264
125
|
// the transformation time by a fair amount.
|
|
265
126
|
// You get this behavior by default when using Babel's `transform` method directly.
|
|
266
|
-
cloneInputAst: false
|
|
127
|
+
cloneInputAst: false,
|
|
128
|
+
// Options for debugging
|
|
129
|
+
cwd: options.projectRoot,
|
|
130
|
+
filename,
|
|
131
|
+
highlightCode: true,
|
|
132
|
+
// Load the project babel config file.
|
|
133
|
+
...(0, _loadBabelConfig().loadBabelConfig)(options),
|
|
134
|
+
babelrc: typeof options.enableBabelRCLookup === 'boolean' ? options.enableBabelRCLookup : true,
|
|
135
|
+
plugins,
|
|
136
|
+
// NOTE(EvanBacon): We heavily leverage the caller functionality to mutate the babel config.
|
|
137
|
+
// This compensates for the lack of a format plugin system in Metro. Users can modify the
|
|
138
|
+
// all (most) of the transforms in their local Babel config.
|
|
139
|
+
// This also helps us keep the transform layers small and focused on a single task. We can also use this to
|
|
140
|
+
// ensure the Babel config caching is more accurate.
|
|
141
|
+
// Additionally, by moving everything Babel-related to the Babel preset, it makes it easier for users to reason
|
|
142
|
+
// about the requirements of an Expo project, making it easier to migrate to other transpilers in the future.
|
|
143
|
+
caller: getBabelCaller({
|
|
144
|
+
filename,
|
|
145
|
+
options
|
|
146
|
+
})
|
|
267
147
|
};
|
|
268
|
-
const
|
|
269
|
-
babel: true,
|
|
270
|
-
sourceType: babelConfig.sourceType
|
|
271
|
-
});
|
|
272
|
-
const result = (0, _babelCore().transformFromAstSync)(sourceAst, src, babelConfig);
|
|
148
|
+
const result = (0, _transformSync().transformSync)(src, babelConfig, options);
|
|
273
149
|
|
|
274
150
|
// The result from `transformFromAstSync` can be null (if the file is ignored)
|
|
275
151
|
if (!result) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babel-transformer.js","names":["_inlineRequires","data","_interopRequireDefault","require","_hmr","_nodeAssert","_nodeCrypto","_nodeFs","_nodePath","_resolveFrom","_babelCore","obj","__esModule","default","cacheKeyParts","fs","readFileSync","__filename","version","isTypeScriptSource","fileName","endsWith","isTSXSource","babelPresetExpo","getBabelPresetExpo","projectRoot","_resolveFrom$silent","undefined","resolveFrom","silent","getBabelRC","babelRC","_getBabelRC","extendsBabelConfigPath","options","plugins","extends","projectBabelRCPath","path","resolve","existsSync","experimentalImportSupport","presetOptions","platformOptions","unstable_transformProfile","disableImportExportTransform","dev","enableBabelRuntime","presets","web","native","buildBabelConfig","filename","extraConfig","babelrc","enableBabelRCLookup","code","cwd","highlightCode","config","extraPlugins","inlineRequires","push","inlineRequiresPlugin","concat","withExtraPlugins","hot","mayContainEditableReactComponents","includes","hmrConfig","makeHMRConfig","isCustomTruthy","value","transform","src","_getBabelPresetExpo","OLD_BABEL_ENV","process","env","BABEL_ENV","_options$customTransf","_options$customTransf2","_options$customTransf3","_options$customTransf4","babelConfig","sourceType","caller","name","bundler","platform","isServer","customTransformOptions","environment","baseUrl","decodeURI","isDev","preserveEnvVars","engine","ast","cloneInputAst","sourceAst","hermesParser","parseSync","parse","babel","result","transformFromAstSync","assert","metadata","getCacheKey","key","crypto","createHash","forEach","part","update","digest","babelTransformer","module","exports"],"sources":["../src/babel-transformer.ts"],"sourcesContent":["/**\n * Copyright (c) 650 Industries (Expo). All rights reserved.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n// A fork of the upstream babel-transformer that uses Expo-specific babel defaults\n// and adds support for web and Node.js environments via `isServer` on the Babel caller.\n\n// @ts-expect-error\nimport inlineRequiresPlugin from 'babel-preset-fbjs/plugins/inline-requires';\nimport type { BabelTransformer, BabelTransformerArgs } from 'metro-babel-transformer';\n// @ts-expect-error\nimport makeHMRConfig from 'metro-react-native-babel-preset/src/configs/hmr';\nimport assert from 'node:assert';\nimport crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport resolveFrom from 'resolve-from';\n\nimport {\n parseSync,\n type PluginItem,\n type TransformOptions,\n transformFromAstSync,\n} from './babel-core';\n\nconst cacheKeyParts = [\n fs.readFileSync(__filename),\n require('babel-preset-fbjs/package.json').version,\n];\n\n// TS detection conditions copied from metro-react-native-babel-preset\nfunction isTypeScriptSource(fileName: string): boolean {\n return !!fileName && fileName.endsWith('.ts');\n}\n\nfunction isTSXSource(fileName: string): boolean {\n return !!fileName && fileName.endsWith('.tsx');\n}\n\nlet babelPresetExpo: string | null | undefined = null;\n\nfunction getBabelPresetExpo(projectRoot: string): string | null {\n if (babelPresetExpo !== undefined) {\n return babelPresetExpo;\n }\n\n babelPresetExpo = resolveFrom.silent(projectRoot, 'babel-preset-expo') ?? null;\n return babelPresetExpo;\n}\n\n/**\n * Return a memoized function that checks for the existence of a\n * project level .babelrc file, and if it doesn't exist, reads the\n * default RN babelrc file and uses that.\n */\nconst getBabelRC = (function () {\n let babelRC: TransformOptions | null /*: ?BabelCoreOptions */ = null;\n\n /* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's\n * LTI update could not be added via codemod */\n return function _getBabelRC({\n projectRoot,\n extendsBabelConfigPath,\n ...options\n }: BabelTransformerArgs['options']) {\n if (babelRC != null) {\n return babelRC;\n }\n\n babelRC = {\n plugins: [],\n extends: extendsBabelConfigPath,\n };\n\n if (extendsBabelConfigPath) {\n return babelRC;\n }\n\n // Let's look for a babel config file in the project root.\n let projectBabelRCPath;\n\n // .babelrc\n if (projectRoot) {\n projectBabelRCPath = path.resolve(projectRoot, '.babelrc');\n }\n\n if (projectBabelRCPath) {\n // .babelrc.js\n if (!fs.existsSync(projectBabelRCPath)) {\n projectBabelRCPath = path.resolve(projectRoot, '.babelrc.js');\n }\n\n // babel.config.js\n if (!fs.existsSync(projectBabelRCPath)) {\n projectBabelRCPath = path.resolve(projectRoot, 'babel.config.js');\n }\n\n // If we found a babel config file, extend our config off of it\n // otherwise the default config will be used\n if (fs.existsSync(projectBabelRCPath)) {\n babelRC.extends = projectBabelRCPath;\n }\n }\n\n // If a babel config file doesn't exist in the project then\n // the default preset for react-native will be used instead.\n if (!babelRC.extends) {\n const { experimentalImportSupport, ...presetOptions } = options;\n\n // Convert the options into the format expected by the Expo preset.\n const platformOptions = {\n // @ts-expect-error: This is how Metro works by default\n unstable_transformProfile: presetOptions.unstable_transformProfile,\n disableImportExportTransform: experimentalImportSupport,\n dev: presetOptions.dev,\n enableBabelRuntime: presetOptions.enableBabelRuntime,\n };\n\n babelRC.presets = [\n [\n // NOTE(EvanBacon): Here we use the Expo babel wrapper instead of the default react-native preset.\n require('babel-preset-expo'),\n {\n web: platformOptions,\n native: platformOptions,\n // lazyImports: presetOptions.lazyImportExportTransform,\n },\n ],\n ];\n }\n\n return babelRC;\n };\n})();\n\n/**\n * Given a filename and options, build a Babel\n * config object with the appropriate plugins.\n */\nfunction buildBabelConfig(\n filename: string,\n options: BabelTransformerArgs['options'],\n plugins: PluginItem[] = []\n): TransformOptions {\n const babelRC = getBabelRC(options);\n\n const extraConfig: TransformOptions = {\n babelrc: typeof options.enableBabelRCLookup === 'boolean' ? options.enableBabelRCLookup : true,\n code: false,\n cwd: options.projectRoot,\n filename,\n highlightCode: true,\n };\n\n let config: TransformOptions = {\n ...babelRC,\n ...extraConfig,\n };\n\n // Add extra plugins\n const extraPlugins = [];\n\n if (options.inlineRequires) {\n extraPlugins.push(inlineRequiresPlugin);\n }\n\n config.plugins = extraPlugins.concat(config.plugins, plugins);\n\n const withExtraPlugins = config.plugins;\n\n if (options.dev && options.hot) {\n // Note: this intentionally doesn't include the path separator because\n // I'm not sure which one it should use on Windows, and false positives\n // are unlikely anyway. If you later decide to include the separator,\n // don't forget that the string usually *starts* with \"node_modules\" so\n // the first one often won't be there.\n const mayContainEditableReactComponents = !filename.includes('node_modules');\n\n if (mayContainEditableReactComponents) {\n const hmrConfig = makeHMRConfig();\n hmrConfig.plugins = withExtraPlugins.concat(hmrConfig.plugins);\n config = { ...config, ...hmrConfig };\n }\n }\n\n return {\n ...babelRC,\n ...config,\n };\n}\n\nfunction isCustomTruthy(value: any): boolean {\n return value === true || value === 'true';\n}\n\nconst transform: BabelTransformer['transform'] = ({\n filename,\n options,\n src,\n plugins,\n}: BabelTransformerArgs): ReturnType<BabelTransformer['transform']> => {\n const OLD_BABEL_ENV = process.env.BABEL_ENV;\n process.env.BABEL_ENV = options.dev ? 'development' : process.env.BABEL_ENV || 'production';\n\n // Ensure the default babel preset is Expo.\n options.extendsBabelConfigPath = getBabelPresetExpo(options.projectRoot) ?? undefined;\n\n try {\n const babelConfig: TransformOptions = {\n // ES modules require sourceType='module' but OSS may not always want that\n sourceType: 'unambiguous',\n ...buildBabelConfig(filename, options, plugins),\n caller: {\n name: 'metro',\n // @ts-expect-error: Custom values passed to the caller.\n bundler: 'metro',\n platform: options.platform,\n // Empower the babel preset to know the env it's bundling for.\n // Metro automatically updates the cache to account for the custom transform options.\n isServer: options.customTransformOptions?.environment === 'node',\n\n // The base url to make requests from, used for hosting from non-standard locations.\n baseUrl:\n typeof options.customTransformOptions?.baseUrl === 'string'\n ? decodeURI(options.customTransformOptions.baseUrl)\n : '',\n\n isDev: options.dev,\n\n // This value indicates if the user has disabled the feature or not.\n // Other criteria may still cause the feature to be disabled, but all inputs used are\n // already considered in the cache key.\n preserveEnvVars: isCustomTruthy(options.customTransformOptions?.preserveEnvVars)\n ? true\n : undefined,\n // Pass the engine to babel so we can automatically transpile for the correct\n // target environment.\n engine: options.customTransformOptions?.engine,\n\n // Provide the project root for accurately reading the Expo config.\n projectRoot: options.projectRoot,\n },\n ast: true,\n\n // NOTE(EvanBacon): We split the parse/transform steps up to accommodate\n // Hermes parsing, but this defaults to cloning the AST which increases\n // the transformation time by a fair amount.\n // You get this behavior by default when using Babel's `transform` method directly.\n cloneInputAst: false,\n };\n const sourceAst =\n isTypeScriptSource(filename) || isTSXSource(filename) || !options.hermesParser\n ? parseSync(src, babelConfig)\n : require('hermes-parser').parse(src, {\n babel: true,\n sourceType: babelConfig.sourceType,\n });\n\n const result = transformFromAstSync(sourceAst, src, babelConfig);\n\n // The result from `transformFromAstSync` can be null (if the file is ignored)\n if (!result) {\n // BabelTransformer specifies that the `ast` can never be null but\n // the function returns here. Discovered when typing `BabelNode`.\n return { ast: null };\n }\n\n assert(result.ast);\n return { ast: result.ast, metadata: result.metadata };\n } finally {\n if (OLD_BABEL_ENV) {\n process.env.BABEL_ENV = OLD_BABEL_ENV;\n }\n }\n};\n\nfunction getCacheKey() {\n const key = crypto.createHash('md5');\n cacheKeyParts.forEach((part) => key.update(part));\n return key.digest('hex');\n}\n\nconst babelTransformer: BabelTransformer = {\n transform,\n getCacheKey,\n};\n\nmodule.exports = babelTransformer;\n"],"mappings":";;AAWA,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,eAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAA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js","names":["_nodeAssert","data","_interopRequireDefault","require","_nodeCrypto","_nodeFs","_loadBabelConfig","_transformSync","obj","__esModule","default","cacheKeyParts","fs","readFileSync","__filename","version","isCustomTruthy","value","memoize","fn","cache","Map","args","key","JSON","stringify","has","get","result","set","memoizeWarning","message","console","warn","getBabelCaller","filename","options","_options$customTransf","_options$customTransf2","_options$customTransf3","_options$customTransf4","_options$customTransf5","_options$customTransf6","isNodeModule","includes","isServer","customTransformOptions","environment","routerRoot","decodeURI","undefined","name","bundler","platform","baseUrl","isDev","dev","preserveEnvVars","asyncRoutes","engine","projectRoot","isHMREnabled","hot","supportsStaticESM","experimentalImportSupport","transform","src","plugins","OLD_BABEL_ENV","process","env","BABEL_ENV","babelConfig","sourceType","ast","code","cloneInputAst","cwd","highlightCode","loadBabelConfig","babelrc","enableBabelRCLookup","caller","transformSync","assert","metadata","getCacheKey","crypto","createHash","forEach","part","update","digest","babelTransformer","module","exports"],"sources":["../src/babel-transformer.ts"],"sourcesContent":["/**\n * Copyright (c) 650 Industries (Expo). All rights reserved.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n// A fork of the upstream babel-transformer that uses Expo-specific babel defaults\n// and adds support for web and Node.js environments via `isServer` on the Babel caller.\nimport type { BabelTransformer, BabelTransformerArgs } from 'metro-babel-transformer';\nimport assert from 'node:assert';\nimport crypto from 'node:crypto';\nimport fs from 'node:fs';\n\nimport { TransformOptions } from './babel-core';\nimport { loadBabelConfig } from './loadBabelConfig';\nimport { transformSync } from './transformSync';\n\nconst cacheKeyParts = [\n fs.readFileSync(__filename),\n require('babel-preset-fbjs/package.json').version,\n];\n\nfunction isCustomTruthy(value: any): boolean {\n return value === true || value === 'true';\n}\n\nfunction memoize<T extends (...args: any[]) => any>(fn: T): T {\n const cache = new Map<string, ReturnType<T>>();\n return ((...args: any[]) => {\n const key = JSON.stringify(args);\n if (cache.has(key)) {\n return cache.get(key);\n }\n const result = fn(...args);\n cache.set(key, result);\n return result;\n }) as T;\n}\n\nconst memoizeWarning = memoize((message: string) => {\n console.warn(message);\n});\n\nfunction getBabelCaller({ filename, options }: Pick<BabelTransformerArgs, 'filename' | 'options'>) {\n const isNodeModule = filename.includes('node_modules');\n const isServer = options.customTransformOptions?.environment === 'node';\n\n const routerRoot =\n typeof options.customTransformOptions?.routerRoot === 'string'\n ? decodeURI(options.customTransformOptions.routerRoot)\n : undefined;\n\n if (routerRoot == null) {\n memoizeWarning(\n 'Missing transform.routerRoot option in Metro bundling request, falling back to `app` as routes directory.'\n );\n }\n\n return {\n name: 'metro',\n bundler: 'metro',\n platform: options.platform,\n // Empower the babel preset to know the env it's bundling for.\n // Metro automatically updates the cache to account for the custom transform options.\n isServer,\n\n // The base url to make requests from, used for hosting from non-standard locations.\n baseUrl:\n typeof options.customTransformOptions?.baseUrl === 'string'\n ? decodeURI(options.customTransformOptions.baseUrl)\n : '',\n\n // Ensure we always use a mostly-valid router root.\n routerRoot: routerRoot ?? 'app',\n\n isDev: options.dev,\n\n // This value indicates if the user has disabled the feature or not.\n // Other criteria may still cause the feature to be disabled, but all inputs used are\n // already considered in the cache key.\n preserveEnvVars: isCustomTruthy(options.customTransformOptions?.preserveEnvVars)\n ? true\n : undefined,\n asyncRoutes: isCustomTruthy(options.customTransformOptions?.asyncRoutes) ? true : undefined,\n // Pass the engine to babel so we can automatically transpile for the correct\n // target environment.\n engine: options.customTransformOptions?.engine,\n\n // Provide the project root for accurately reading the Expo config.\n projectRoot: options.projectRoot,\n\n isNodeModule,\n\n isHMREnabled: options.hot,\n\n // Set the standard Babel flag to disable ESM transformations.\n supportsStaticESM: options.experimentalImportSupport,\n };\n}\n\nconst transform: BabelTransformer['transform'] = ({\n filename,\n src,\n options,\n // `plugins` is used for `functionMapBabelPlugin` from `metro-source-map`. Could make sense to move this to `babel-preset-expo` too.\n plugins,\n}: BabelTransformerArgs): ReturnType<BabelTransformer['transform']> => {\n const OLD_BABEL_ENV = process.env.BABEL_ENV;\n process.env.BABEL_ENV = options.dev ? 'development' : process.env.BABEL_ENV || 'production';\n\n try {\n const babelConfig: TransformOptions = {\n // ES modules require sourceType='module' but OSS may not always want that\n sourceType: 'unambiguous',\n\n // The output we want from Babel methods\n ast: true,\n code: false,\n // NOTE(EvanBacon): We split the parse/transform steps up to accommodate\n // Hermes parsing, but this defaults to cloning the AST which increases\n // the transformation time by a fair amount.\n // You get this behavior by default when using Babel's `transform` method directly.\n cloneInputAst: false,\n\n // Options for debugging\n cwd: options.projectRoot,\n filename,\n highlightCode: true,\n\n // Load the project babel config file.\n ...loadBabelConfig(options),\n\n babelrc:\n typeof options.enableBabelRCLookup === 'boolean' ? options.enableBabelRCLookup : true,\n\n plugins,\n\n // NOTE(EvanBacon): We heavily leverage the caller functionality to mutate the babel config.\n // This compensates for the lack of a format plugin system in Metro. Users can modify the\n // all (most) of the transforms in their local Babel config.\n // This also helps us keep the transform layers small and focused on a single task. We can also use this to\n // ensure the Babel config caching is more accurate.\n // Additionally, by moving everything Babel-related to the Babel preset, it makes it easier for users to reason\n // about the requirements of an Expo project, making it easier to migrate to other transpilers in the future.\n caller: getBabelCaller({ filename, options }),\n };\n\n const result = transformSync(src, babelConfig, options);\n\n // The result from `transformFromAstSync` can be null (if the file is ignored)\n if (!result) {\n // BabelTransformer specifies that the `ast` can never be null but\n // the function returns here. Discovered when typing `BabelNode`.\n return { ast: null };\n }\n\n assert(result.ast);\n return { ast: result.ast, metadata: result.metadata };\n } finally {\n if (OLD_BABEL_ENV) {\n process.env.BABEL_ENV = OLD_BABEL_ENV;\n }\n }\n};\n\nfunction getCacheKey() {\n const key = crypto.createHash('md5');\n cacheKeyParts.forEach((part) => key.update(part));\n return key.digest('hex');\n}\n\nconst babelTransformer: BabelTransformer = {\n transform,\n getCacheKey,\n};\n\nmodule.exports = babelTransformer;\n"],"mappings":";;AAUA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;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ectRoot) {
|
|
|
46
46
|
// this minimizes the chance of Metro resolver breaking on new Node.js versions.
|
|
47
47
|
const workspaceRoot = getWorkspaceRoot(_path().default.resolve(projectRoot)); // Absolute path or null
|
|
48
48
|
if (workspaceRoot) {
|
|
49
|
-
paths.push(_path().default.resolve(projectRoot));
|
|
49
|
+
paths.push(_path().default.resolve(projectRoot, 'node_modules'));
|
|
50
50
|
paths.push(_path().default.resolve(workspaceRoot, 'node_modules'));
|
|
51
51
|
}
|
|
52
52
|
return paths;
|