@expo/metro-config 0.10.6 → 0.11.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/babel-transformer/index.d.ts +1 -0
- package/babel-transformer/index.js +1 -0
- package/build/ExpoMetroConfig.js +3 -13
- package/build/ExpoMetroConfig.js.map +1 -1
- package/build/babel-core.d.ts +1 -0
- package/build/babel-core.js +25 -0
- package/build/babel-core.js.map +1 -0
- package/build/babel-transformer.d.ts +8 -0
- package/build/babel-transformer.js +291 -0
- package/build/babel-transformer.js.map +1 -0
- package/build/rewriteRequestUrl.js +10 -2
- package/build/rewriteRequestUrl.js.map +1 -1
- package/build/transform-worker/transform-worker.js +1 -1
- package/build/transform-worker/transform-worker.js.map +1 -1
- package/package.json +11 -5
- package/build/transformer/metro-expo-babel-transformer.d.ts +0 -1
- package/build/transformer/metro-expo-babel-transformer.js +0 -55
- package/build/transformer/metro-expo-babel-transformer.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../build/babel-transformer';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../build/babel-transformer');
|
package/build/ExpoMetroConfig.js
CHANGED
|
@@ -143,9 +143,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
143
143
|
// Copyright 2023-present 650 Industries (Expo). All rights reserved.
|
|
144
144
|
|
|
145
145
|
const debug = require('debug')('expo:metro:config');
|
|
146
|
-
function getProjectBabelConfigFile(projectRoot) {
|
|
147
|
-
return _resolveFrom().default.silent(projectRoot, './babel.config.js') || _resolveFrom().default.silent(projectRoot, './.babelrc') || _resolveFrom().default.silent(projectRoot, './.babelrc.js');
|
|
148
|
-
}
|
|
149
146
|
function getAssetPlugins(projectRoot) {
|
|
150
147
|
const hashAssetFilesPath = _resolveFrom().default.silent(projectRoot, 'expo-asset/tools/hashAssetFiles');
|
|
151
148
|
if (!hashAssetFilesPath) {
|
|
@@ -193,8 +190,6 @@ function getDefaultConfig(projectRoot, options = {}) {
|
|
|
193
190
|
const envFiles = runtimeEnv().getFiles(process.env.NODE_ENV, {
|
|
194
191
|
silent: true
|
|
195
192
|
});
|
|
196
|
-
const babelConfigPath = getProjectBabelConfigFile(projectRoot);
|
|
197
|
-
const isCustomBabelConfigDefined = !!babelConfigPath;
|
|
198
193
|
const resolverMainFields = [];
|
|
199
194
|
|
|
200
195
|
// Disable `react-native` in exotic mode, since library authors
|
|
@@ -215,7 +210,6 @@ function getDefaultConfig(projectRoot, options = {}) {
|
|
|
215
210
|
} catch {}
|
|
216
211
|
console.log(`- Extensions: ${sourceExts.join(', ')}`);
|
|
217
212
|
console.log(`- React Native: ${reactNativePath}`);
|
|
218
|
-
console.log(`- Babel config: ${babelConfigPath || 'babel-preset-expo (default)'}`);
|
|
219
213
|
console.log(`- Resolver Fields: ${resolverMainFields.join(', ')}`);
|
|
220
214
|
console.log(`- Watch Folders: ${watchFolders.join(', ')}`);
|
|
221
215
|
console.log(`- Node Module Paths: ${nodeModulesPaths.join(', ')}`);
|
|
@@ -286,13 +280,9 @@ function getDefaultConfig(projectRoot, options = {}) {
|
|
|
286
280
|
// `require.context` support
|
|
287
281
|
unstable_allowRequireContext: true,
|
|
288
282
|
allowOptionalDependencies: true,
|
|
289
|
-
babelTransformerPath: isExotic ?
|
|
290
|
-
//
|
|
291
|
-
|
|
292
|
-
// Try to use the project copy before falling back on the global version
|
|
293
|
-
_resolveFrom().default.silent(projectRoot, 'metro-react-native-babel-transformer') :
|
|
294
|
-
// Otherwise, use a custom transformer that uses `babel-preset-expo` by default for projects.
|
|
295
|
-
require.resolve('./transformer/metro-expo-babel-transformer'),
|
|
283
|
+
babelTransformerPath: isExotic ?
|
|
284
|
+
// TODO: Combine these into one transformer.
|
|
285
|
+
require.resolve('./transformer/metro-expo-exotic-babel-transformer') : require.resolve('./babel-transformer'),
|
|
296
286
|
assetRegistryPath: 'react-native/Libraries/Image/AssetRegistry',
|
|
297
287
|
assetPlugins: getAssetPlugins(projectRoot)
|
|
298
288
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoMetroConfig.js","names":["_config","data","require","_paths","runtimeEnv","_interopRequireWildcard","_jsonFile","_interopRequireDefault","_chalk","_metroCache","_metroConfig","_path","_resolveFrom","_customizeFrame","_env2","_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","getProjectBabelConfigFile","projectRoot","resolveFrom","silent","getAssetPlugins","hashAssetFilesPath","Error","hasWarnedAboutExotic","getDefaultConfig","options","getDefaultMetroConfig","mergeConfig","importMetroConfig","isExotic","mode","env","EXPO_USE_EXOTIC","console","log","chalk","gray","bold","reactNativePath","path","dirname","babelPresetFbjsPath","process","EXPO_METRO_CACHE_KEY_VERSION","String","version","sourceExtsConfig","isTS","isReact","isModern","sourceExts","getBareExtensions","push","sassVersion","isCSSEnabled","getSassVersion","envFiles","getFiles","NODE_ENV","babelConfigPath","isCustomBabelConfigDefined","resolverMainFields","pkg","getPackageJson","watchFolders","getWatchFolders","nodeModulesPaths","getModulesPaths","EXPO_DEBUG","join","reporter","metroDefaultValues","getDefaultValues","metroConfig","resolver","platforms","assetExts","concat","filter","assetExt","includes","watcher","additionalExts","map","file","replace","serializer","getModulesRunBeforeMainModule","preModules","resolve","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","withExpoSerializers","loadAsync","metroOptions","defaultConfig","loadConfig","cwd","exports","sassPkg","sassPkgJson","findUpPackageJson","JsonFile","read","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 path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { getDefaultCustomizeFrame, INTERNAL_CALLSITES_REGEX } from './customizeFrame';\nimport { env } from './env';\nimport { getModulesPaths, getServerRoot } from './getModulesPaths';\nimport { getWatchFolders } from './getWatchFolders';\nimport { getRewriteRequestUrl } from './rewriteRequestUrl';\nimport { withExpoSerializers } from './serializer/withExpoSerializers';\nimport { getPostcssConfigHash } from './transform-worker/postcss';\nimport { importMetroConfig } from './traveling/metro-config';\n\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 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 getProjectBabelConfigFile(projectRoot: string): string | undefined {\n return (\n resolveFrom.silent(projectRoot, './babel.config.js') ||\n resolveFrom.silent(projectRoot, './.babelrc') ||\n resolveFrom.silent(projectRoot, './.babelrc.js')\n );\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\nexport function getDefaultConfig(\n projectRoot: string,\n options: DefaultConfigOptions = {}\n): InputConfigT {\n const { getDefaultConfig: getDefaultMetroConfig, mergeConfig } = importMetroConfig(projectRoot);\n\n const isExotic = options.mode === 'exotic' || env.EXPO_USE_EXOTIC;\n\n if (isExotic && !hasWarnedAboutExotic) {\n hasWarnedAboutExotic = true;\n console.log(\n chalk.gray(\n `\\u203A Unstable feature ${chalk.bold`EXPO_USE_EXOTIC`} is enabled. Bundling may not work as expected, and is subject to breaking changes.`\n )\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: false };\n const sourceExts = getBareExtensions([], sourceExtsConfig);\n\n // Add support for cjs (without platform extensions).\n sourceExts.push('cjs');\n\n let sassVersion: string | null = null;\n if (options.isCSSEnabled) {\n sassVersion = getSassVersion(projectRoot);\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 babelConfigPath = getProjectBabelConfigFile(projectRoot);\n const isCustomBabelConfigDefined = !!babelConfigPath;\n\n const resolverMainFields: string[] = [];\n\n // Disable `react-native` in exotic mode, since library authors\n // use it to ship raw application code to the project.\n if (!isExotic) {\n resolverMainFields.push('react-native');\n }\n resolverMainFields.push('browser', 'main');\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(`- Babel config: ${babelConfigPath || 'babel-preset-expo (default)'}`);\n console.log(`- Resolver Fields: ${resolverMainFields.join(', ')}`);\n console.log(`- Watch Folders: ${watchFolders.join(', ')}`);\n console.log(`- Node Module Paths: ${nodeModulesPaths.join(', ')}`);\n console.log(`- Exotic: ${isExotic}`);\n console.log(`- Env Files: ${envFiles}`);\n console.log(`- Sass: ${sassVersion}`);\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 // 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 resolverMainFields,\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 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 // 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(path.join(reactNativePath, 'rn-get-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: options.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\n // `require.context` support\n unstable_allowRequireContext: true,\n allowOptionalDependencies: true,\n babelTransformerPath: isExotic\n ? require.resolve('./transformer/metro-expo-exotic-babel-transformer')\n : isCustomBabelConfigDefined\n ? // If the user defined a babel config file in their project,\n // then use the default transformer.\n // Try to use the project copy before falling back on the global version\n resolveFrom.silent(projectRoot, 'metro-react-native-babel-transformer')\n : // Otherwise, use a custom transformer that uses `babel-preset-expo` by default for projects.\n require.resolve('./transformer/metro-expo-babel-transformer'),\n assetRegistryPath: 'react-native/Libraries/Image/AssetRegistry',\n assetPlugins: getAssetPlugins(projectRoot),\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 getSassVersion(projectRoot: string): string | null {\n const sassPkg = resolveFrom.silent(projectRoot, 'sass');\n if (!sassPkg) return null;\n const sassPkgJson = findUpPackageJson(sassPkg);\n if (!sassPkgJson) return null;\n const pkg = JsonFile.read(sassPkgJson);\n\n debug('sass package.json:', sassPkgJson);\n const sassVersion = pkg.version;\n if (typeof sassVersion === 'string') {\n return sassVersion;\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,OAAA;EAAAI,SAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,OAAA;EAAA,MAAAP,IAAA,GAAAM,sBAAA,CAAAL,OAAA;EAAAM,MAAA,Y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H,sBAAW,CAACC,MAAM,CAACwG,GAAG,EAAE,gBAAgB,CAAC;EACvD,IAAIQ,KAAK,EAAE;IACT,OAAOA,KAAK;EACd;EACA,OAAOJ,iBAAiB,CAACxF,eAAI,CAACC,OAAO,CAACmF,GAAG,CAAC,CAAC;AAC7C"}
|
|
1
|
+
{"version":3,"file":"ExpoMetroConfig.js","names":["_config","data","require","_paths","runtimeEnv","_interopRequireWildcard","_jsonFile","_interopRequireDefault","_chalk","_metroCache","_metroConfig","_path","_resolveFrom","_customizeFrame","_env2","_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","getDefaultConfig","options","getDefaultMetroConfig","mergeConfig","importMetroConfig","isExotic","mode","env","EXPO_USE_EXOTIC","console","log","chalk","gray","bold","reactNativePath","path","dirname","babelPresetFbjsPath","process","EXPO_METRO_CACHE_KEY_VERSION","String","version","sourceExtsConfig","isTS","isReact","isModern","sourceExts","getBareExtensions","push","sassVersion","isCSSEnabled","getSassVersion","envFiles","getFiles","NODE_ENV","resolverMainFields","pkg","getPackageJson","watchFolders","getWatchFolders","nodeModulesPaths","getModulesPaths","EXPO_DEBUG","join","reporter","metroDefaultValues","getDefaultValues","metroConfig","resolver","platforms","assetExts","concat","filter","assetExt","includes","watcher","additionalExts","map","file","replace","serializer","getModulesRunBeforeMainModule","preModules","resolve","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","withExpoSerializers","loadAsync","metroOptions","defaultConfig","loadConfig","cwd","exports","sassPkg","sassPkgJson","findUpPackageJson","JsonFile","read","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 path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { getDefaultCustomizeFrame, INTERNAL_CALLSITES_REGEX } from './customizeFrame';\nimport { env } from './env';\nimport { getModulesPaths, getServerRoot } from './getModulesPaths';\nimport { getWatchFolders } from './getWatchFolders';\nimport { getRewriteRequestUrl } from './rewriteRequestUrl';\nimport { withExpoSerializers } from './serializer/withExpoSerializers';\nimport { getPostcssConfigHash } from './transform-worker/postcss';\nimport { importMetroConfig } from './traveling/metro-config';\n\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 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\nexport function getDefaultConfig(\n projectRoot: string,\n options: DefaultConfigOptions = {}\n): InputConfigT {\n const { getDefaultConfig: getDefaultMetroConfig, mergeConfig } = importMetroConfig(projectRoot);\n\n const isExotic = options.mode === 'exotic' || env.EXPO_USE_EXOTIC;\n\n if (isExotic && !hasWarnedAboutExotic) {\n hasWarnedAboutExotic = true;\n console.log(\n chalk.gray(\n `\\u203A Unstable feature ${chalk.bold`EXPO_USE_EXOTIC`} is enabled. Bundling may not work as expected, and is subject to breaking changes.`\n )\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: false };\n const sourceExts = getBareExtensions([], sourceExtsConfig);\n\n // Add support for cjs (without platform extensions).\n sourceExts.push('cjs');\n\n let sassVersion: string | null = null;\n if (options.isCSSEnabled) {\n sassVersion = getSassVersion(projectRoot);\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 resolverMainFields: string[] = [];\n\n // Disable `react-native` in exotic mode, since library authors\n // use it to ship raw application code to the project.\n if (!isExotic) {\n resolverMainFields.push('react-native');\n }\n resolverMainFields.push('browser', 'main');\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(`- Resolver Fields: ${resolverMainFields.join(', ')}`);\n console.log(`- Watch Folders: ${watchFolders.join(', ')}`);\n console.log(`- Node Module Paths: ${nodeModulesPaths.join(', ')}`);\n console.log(`- Exotic: ${isExotic}`);\n console.log(`- Env Files: ${envFiles}`);\n console.log(`- Sass: ${sassVersion}`);\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 // 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 resolverMainFields,\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 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 // 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(path.join(reactNativePath, 'rn-get-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: options.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\n // `require.context` support\n unstable_allowRequireContext: true,\n allowOptionalDependencies: true,\n babelTransformerPath: isExotic\n ? // TODO: Combine these into one transformer.\n require.resolve('./transformer/metro-expo-exotic-babel-transformer')\n : require.resolve('./babel-transformer'),\n assetRegistryPath: 'react-native/Libraries/Image/AssetRegistry',\n assetPlugins: getAssetPlugins(projectRoot),\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 getSassVersion(projectRoot: string): string | null {\n const sassPkg = resolveFrom.silent(projectRoot, 'sass');\n if (!sassPkg) return null;\n const sassPkgJson = findUpPackageJson(sassPkg);\n if (!sassPkgJson) return null;\n const pkg = JsonFile.read(sassPkgJson);\n\n debug('sass package.json:', sassPkgJson);\n const sassVersion = pkg.version;\n if (typeof sassVersion === 'string') {\n return sassVersion;\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,OAAA;EAAAI,SAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,OAAA;EAAA,MAAAP,IAAA,GAAAM,sBAAA,CAAAL,OAAA;EAAAM,MAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAQ,YAAA;EAAA,MAAAR,IAAA,GAAAC,OAAA;EAAAO,WAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,aAAA;EAAA,MAAAT,IAAA,GAAAC,OAAA;EAAAQ,YAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAU,MAA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,WAAW,CAAC;EAEtC5G,KAAK,CAAC,oBAAoB,EAAE4G,WAAW,CAAC;EACxC,MAAMvE,WAAW,GAAGO,GAAG,CAACf,OAAO;EAC/B,IAAI,OAAOQ,WAAW,KAAK,QAAQ,EAAE;IACnC,OAAOA,WAAW;EACpB;EAEA,OAAO,IAAI;AACb;AAEA,SAASwE,iBAAiBA,CAACJ,GAAW,EAAiB;EACrD,IAAI,CAAC,GAAG,EAAElF,eAAI,CAACyF,GAAG,CAAC,CAAClD,QAAQ,CAAC2C,GAAG,CAAC,EAAE,OAAO,IAAI;EAE9C,MAAMQ,KAAK,GAAG7G,sBAAW,CAACC,MAAM,CAACoG,GAAG,EAAE,gBAAgB,CAAC;EACvD,IAAIQ,KAAK,EAAE;IACT,OAAOA,KAAK;EACd;EACA,OAAOJ,iBAAiB,CAACtF,eAAI,CAACC,OAAO,CAACiF,GAAG,CAAC,CAAC;AAC7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { parseSync, type PluginItem, type TransformOptions, transformFromAstSync, } from '@babel/core';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "parseSync", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _core().parseSync;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "transformFromAstSync", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _core().transformFromAstSync;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
function _core() {
|
|
19
|
+
const data = require("@babel/core");
|
|
20
|
+
_core = function () {
|
|
21
|
+
return data;
|
|
22
|
+
};
|
|
23
|
+
return data;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=babel-core.js.map
|
|
@@ -0,0 +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 parseSync,\n type PluginItem,\n type TransformOptions,\n transformFromAstSync,\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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
export {};
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
function _nodeAssert() {
|
|
18
|
+
const data = _interopRequireDefault(require("node:assert"));
|
|
19
|
+
_nodeAssert = function () {
|
|
20
|
+
return data;
|
|
21
|
+
};
|
|
22
|
+
return data;
|
|
23
|
+
}
|
|
24
|
+
function _nodeCrypto() {
|
|
25
|
+
const data = _interopRequireDefault(require("node:crypto"));
|
|
26
|
+
_nodeCrypto = function () {
|
|
27
|
+
return data;
|
|
28
|
+
};
|
|
29
|
+
return data;
|
|
30
|
+
}
|
|
31
|
+
function _nodeFs() {
|
|
32
|
+
const data = _interopRequireDefault(require("node:fs"));
|
|
33
|
+
_nodeFs = function () {
|
|
34
|
+
return data;
|
|
35
|
+
};
|
|
36
|
+
return data;
|
|
37
|
+
}
|
|
38
|
+
function _nodePath() {
|
|
39
|
+
const data = _interopRequireDefault(require("node:path"));
|
|
40
|
+
_nodePath = function () {
|
|
41
|
+
return data;
|
|
42
|
+
};
|
|
43
|
+
return data;
|
|
44
|
+
}
|
|
45
|
+
function _resolveFrom() {
|
|
46
|
+
const data = _interopRequireDefault(require("resolve-from"));
|
|
47
|
+
_resolveFrom = function () {
|
|
48
|
+
return data;
|
|
49
|
+
};
|
|
50
|
+
return data;
|
|
51
|
+
}
|
|
52
|
+
function _babelCore() {
|
|
53
|
+
const data = require("./babel-core");
|
|
54
|
+
_babelCore = function () {
|
|
55
|
+
return data;
|
|
56
|
+
};
|
|
57
|
+
return data;
|
|
58
|
+
}
|
|
59
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
60
|
+
/**
|
|
61
|
+
* Copyright (c) 650 Industries (Expo). All rights reserved.
|
|
62
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
63
|
+
*
|
|
64
|
+
* This source code is licensed under the MIT license found in the
|
|
65
|
+
* LICENSE file in the root directory of this source tree.
|
|
66
|
+
*/
|
|
67
|
+
// A fork of the upstream babel-transformer that uses Expo-specific babel defaults
|
|
68
|
+
// and adds support for web and Node.js environments via `metroTarget` on the Babel caller.
|
|
69
|
+
|
|
70
|
+
// @ts-expect-error
|
|
71
|
+
|
|
72
|
+
// @ts-expect-error
|
|
73
|
+
|
|
74
|
+
const cacheKeyParts = [_nodeFs().default.readFileSync(__filename), require('babel-preset-fbjs/package.json').version];
|
|
75
|
+
|
|
76
|
+
// TS detection conditions copied from metro-react-native-babel-preset
|
|
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;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Return a memoized function that checks for the existence of a
|
|
95
|
+
* project level .babelrc file, and if it doesn't exist, reads the
|
|
96
|
+
* default RN babelrc file and uses that.
|
|
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
|
+
// @ts-expect-error: This is how Metro works by default
|
|
157
|
+
withDevTools: presetOptions.withDevTools,
|
|
158
|
+
disableImportExportTransform: experimentalImportSupport,
|
|
159
|
+
dev: presetOptions.dev,
|
|
160
|
+
enableBabelRuntime: presetOptions.enableBabelRuntime
|
|
161
|
+
};
|
|
162
|
+
babelRC.presets = [[
|
|
163
|
+
// NOTE(EvanBacon): Here we use the Expo babel wrapper instead of the default react-native preset.
|
|
164
|
+
require('babel-preset-expo'), {
|
|
165
|
+
web: platformOptions,
|
|
166
|
+
native: platformOptions
|
|
167
|
+
// lazyImports: presetOptions.lazyImportExportTransform,
|
|
168
|
+
}]];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return babelRC;
|
|
172
|
+
};
|
|
173
|
+
}();
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Given a filename and options, build a Babel
|
|
177
|
+
* config object with the appropriate plugins.
|
|
178
|
+
*/
|
|
179
|
+
function buildBabelConfig(filename, options, plugins = []) {
|
|
180
|
+
const babelRC = getBabelRC(options);
|
|
181
|
+
const extraConfig = {
|
|
182
|
+
babelrc: typeof options.enableBabelRCLookup === 'boolean' ? options.enableBabelRCLookup : true,
|
|
183
|
+
code: false,
|
|
184
|
+
cwd: options.projectRoot,
|
|
185
|
+
filename,
|
|
186
|
+
highlightCode: true
|
|
187
|
+
};
|
|
188
|
+
let config = {
|
|
189
|
+
...babelRC,
|
|
190
|
+
...extraConfig
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
// Add extra plugins
|
|
194
|
+
const extraPlugins = [];
|
|
195
|
+
if (options.inlineRequires) {
|
|
196
|
+
extraPlugins.push(_inlineRequires().default);
|
|
197
|
+
}
|
|
198
|
+
config.plugins = extraPlugins.concat(config.plugins, plugins);
|
|
199
|
+
const withExtraPlugins = config.plugins;
|
|
200
|
+
if (options.dev && options.hot) {
|
|
201
|
+
// Note: this intentionally doesn't include the path separator because
|
|
202
|
+
// I'm not sure which one it should use on Windows, and false positives
|
|
203
|
+
// are unlikely anyway. If you later decide to include the separator,
|
|
204
|
+
// don't forget that the string usually *starts* with "node_modules" so
|
|
205
|
+
// the first one often won't be there.
|
|
206
|
+
const mayContainEditableReactComponents = !filename.includes('node_modules');
|
|
207
|
+
if (mayContainEditableReactComponents) {
|
|
208
|
+
const hmrConfig = (0, _hmr().default)();
|
|
209
|
+
hmrConfig.plugins = withExtraPlugins.concat(hmrConfig.plugins);
|
|
210
|
+
config = {
|
|
211
|
+
...config,
|
|
212
|
+
...hmrConfig
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return {
|
|
217
|
+
...babelRC,
|
|
218
|
+
...config
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
const transform = ({
|
|
222
|
+
filename,
|
|
223
|
+
options,
|
|
224
|
+
src,
|
|
225
|
+
plugins
|
|
226
|
+
}) => {
|
|
227
|
+
var _getBabelPresetExpo;
|
|
228
|
+
const OLD_BABEL_ENV = process.env.BABEL_ENV;
|
|
229
|
+
process.env.BABEL_ENV = options.dev ? 'development' : process.env.BABEL_ENV || 'production';
|
|
230
|
+
|
|
231
|
+
// Ensure the default babel preset is Expo.
|
|
232
|
+
options.extendsBabelConfigPath = (_getBabelPresetExpo = getBabelPresetExpo(options.projectRoot)) !== null && _getBabelPresetExpo !== void 0 ? _getBabelPresetExpo : undefined;
|
|
233
|
+
try {
|
|
234
|
+
var _options$customTransf;
|
|
235
|
+
const babelConfig = {
|
|
236
|
+
// ES modules require sourceType='module' but OSS may not always want that
|
|
237
|
+
sourceType: 'unambiguous',
|
|
238
|
+
...buildBabelConfig(filename, options, plugins),
|
|
239
|
+
caller: {
|
|
240
|
+
name: 'metro',
|
|
241
|
+
// @ts-expect-error: Custom values passed to the caller.
|
|
242
|
+
bundler: 'metro',
|
|
243
|
+
platform: options.platform,
|
|
244
|
+
// Empower the babel preset to know the env it's bundling for.
|
|
245
|
+
// Metro automatically updates the cache to account for the custom transform options.
|
|
246
|
+
// client | node | undefined
|
|
247
|
+
metroTarget: (_options$customTransf = options.customTransformOptions) === null || _options$customTransf === void 0 ? void 0 : _options$customTransf.environment
|
|
248
|
+
},
|
|
249
|
+
ast: true,
|
|
250
|
+
// NOTE(EvanBacon): We split the parse/transform steps up to accommodate
|
|
251
|
+
// Hermes parsing, but this defaults to cloning the AST which increases
|
|
252
|
+
// the transformation time by a fair amount.
|
|
253
|
+
// You get this behavior by default when using Babel's `transform` method directly.
|
|
254
|
+
cloneInputAst: false
|
|
255
|
+
};
|
|
256
|
+
const sourceAst = isTypeScriptSource(filename) || isTSXSource(filename) || !options.hermesParser ? (0, _babelCore().parseSync)(src, babelConfig) : require('hermes-parser').parse(src, {
|
|
257
|
+
babel: true,
|
|
258
|
+
sourceType: babelConfig.sourceType
|
|
259
|
+
});
|
|
260
|
+
const result = (0, _babelCore().transformFromAstSync)(sourceAst, src, babelConfig);
|
|
261
|
+
|
|
262
|
+
// The result from `transformFromAstSync` can be null (if the file is ignored)
|
|
263
|
+
if (!result) {
|
|
264
|
+
// BabelTransformer specifies that the `ast` can never be null but
|
|
265
|
+
// the function returns here. Discovered when typing `BabelNode`.
|
|
266
|
+
return {
|
|
267
|
+
ast: null
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
(0, _nodeAssert().default)(result.ast);
|
|
271
|
+
return {
|
|
272
|
+
ast: result.ast,
|
|
273
|
+
metadata: result.metadata
|
|
274
|
+
};
|
|
275
|
+
} finally {
|
|
276
|
+
if (OLD_BABEL_ENV) {
|
|
277
|
+
process.env.BABEL_ENV = OLD_BABEL_ENV;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
function getCacheKey() {
|
|
282
|
+
const key = _nodeCrypto().default.createHash('md5');
|
|
283
|
+
cacheKeyParts.forEach(part => key.update(part));
|
|
284
|
+
return key.digest('hex');
|
|
285
|
+
}
|
|
286
|
+
const babelTransformer = {
|
|
287
|
+
transform,
|
|
288
|
+
getCacheKey
|
|
289
|
+
};
|
|
290
|
+
module.exports = babelTransformer;
|
|
291
|
+
//# sourceMappingURL=babel-transformer.js.map
|
|
@@ -0,0 +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","withDevTools","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","transform","src","_getBabelPresetExpo","OLD_BABEL_ENV","process","env","BABEL_ENV","_options$customTransf","babelConfig","sourceType","caller","name","bundler","platform","metroTarget","customTransformOptions","environment","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 `metroTarget` 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 // @ts-expect-error: This is how Metro works by default\n withDevTools: presetOptions.withDevTools,\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\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 // client | node | undefined\n metroTarget: options.customTransformOptions?.environment,\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;EAAA;EAAA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AAEU,QAAQ,EAAEH,MAAM,CAACG;IAAS,CAAC;EACvD,CAAC,SAAS;IACR,IAAIxB,aAAa,EAAE;MACjBC,OAAO,CAACC,GAAG,CAACC,SAAS,GAAGH,aAAa;IACvC;EACF;AACF,CAAC;AAED,SAASyB,WAAWA,CAAA,EAAG;EACrB,MAAMC,GAAG,GAAGC,qBAAM,CAACC,UAAU,CAAC,KAAK,CAAC;EACpCzF,aAAa,CAAC0F,OAAO,CAAEC,IAAI,IAAKJ,GAAG,CAACK,MAAM,CAACD,IAAI,CAAC,CAAC;EACjD,OAAOJ,GAAG,CAACM,MAAM,CAAC,KAAK,CAAC;AAC1B;AAEA,MAAMC,gBAAkC,GAAG;EACzCpC,SAAS;EACT4B;AACF,CAAC;AAEDS,MAAM,CAACC,OAAO,GAAGF,gBAAgB"}
|
|
@@ -78,8 +78,16 @@ function getRewriteRequestUrl(projectRoot) {
|
|
|
78
78
|
serverRoot
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
-
//
|
|
82
|
-
|
|
81
|
+
// Only return the pathname when url is relative
|
|
82
|
+
if (url.startsWith('/')) {
|
|
83
|
+
// Like: `/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=com.bacon.test-custom-entry`
|
|
84
|
+
return '/' + relativeEntry + '.bundle' + search;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Modify the pathname within the URL and return the full URL
|
|
88
|
+
ensured.pathname = '/' + relativeEntry + '.bundle';
|
|
89
|
+
// Like: `http://localhost:19001/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=com.bacon.test-custom-entry`
|
|
90
|
+
return ensured.toString();
|
|
83
91
|
}
|
|
84
92
|
return url;
|
|
85
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rewriteRequestUrl.js","names":["_config","data","require","_paths","_chalk","_interopRequireDefault","_path","_getModulesPaths","obj","__esModule","default","debug","getRewriteRequestUrl","projectRoot","rewriteExpoRequestUrl","url","includes","_searchParams$get","ensured","startsWith","URL","search","searchParams","platform","get","entry","resolveEntryPoint","projectConfig","pkg","getPackageJson","Error","chalk","serverRoot","getServerRoot","relativeEntry","path","relative","replace"],"sources":["../src/rewriteRequestUrl.ts"],"sourcesContent":["// Copyright 2023-present 650 Industries (Expo). All rights reserved.\nimport { getPackageJson } from '@expo/config';\nimport { resolveEntryPoint } from '@expo/config/paths';\nimport chalk from 'chalk';\nimport path from 'path';\n\nimport { getServerRoot } from './getModulesPaths';\n\nconst debug = require('debug')('expo:metro:config:rewriteRequestUrl');\n\nexport function getRewriteRequestUrl(projectRoot: string) {\n function rewriteExpoRequestUrl(url: string): string {\n // Like: `/.expo/.virtual-metro-entry.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=com.bacon.test-custom-entry`\n // Sometimes a fully qualified URL is passed in, e.g. `http://localhost:19001/.expo/.virtual-metro-entry.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=com.bacon.test-custom-entry`\n if (url.includes('/.expo/.virtual-metro-entry.bundle?')) {\n const ensured = url.startsWith('/') ? new URL(url, 'https://acme.dev') : new URL(url);\n // TODO: Maybe this function could be memoized in some capacity?\n const { search, searchParams } = ensured;\n\n const platform = searchParams.get('platform') ?? 'web';\n\n debug('Rewriting magic request url to entry point', { url, platform });\n\n const entry = resolveEntryPoint(projectRoot, {\n platform,\n // @ts-ignore\n projectConfig: {\n pkg: getPackageJson(projectRoot),\n },\n });\n\n if (!entry) {\n throw new Error(\n chalk`The project entry file could not be resolved (platform: ${platform}, root: ${projectRoot}). Define it in the {bold package.json} \"main\" field.`\n );\n }\n\n const serverRoot = getServerRoot(projectRoot);\n const relativeEntry = path.relative(serverRoot, entry).replace(/\\.[tj]sx?$/, '');\n debug('Resolved entry point', { entry, relativeEntry, serverRoot });\n\n // Like: `/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=com.bacon.test-custom-entry`\n
|
|
1
|
+
{"version":3,"file":"rewriteRequestUrl.js","names":["_config","data","require","_paths","_chalk","_interopRequireDefault","_path","_getModulesPaths","obj","__esModule","default","debug","getRewriteRequestUrl","projectRoot","rewriteExpoRequestUrl","url","includes","_searchParams$get","ensured","startsWith","URL","search","searchParams","platform","get","entry","resolveEntryPoint","projectConfig","pkg","getPackageJson","Error","chalk","serverRoot","getServerRoot","relativeEntry","path","relative","replace","pathname","toString"],"sources":["../src/rewriteRequestUrl.ts"],"sourcesContent":["// Copyright 2023-present 650 Industries (Expo). All rights reserved.\nimport { getPackageJson } from '@expo/config';\nimport { resolveEntryPoint } from '@expo/config/paths';\nimport chalk from 'chalk';\nimport path from 'path';\n\nimport { getServerRoot } from './getModulesPaths';\n\nconst debug = require('debug')('expo:metro:config:rewriteRequestUrl');\n\nexport function getRewriteRequestUrl(projectRoot: string) {\n function rewriteExpoRequestUrl(url: string): string {\n // Like: `/.expo/.virtual-metro-entry.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=com.bacon.test-custom-entry`\n // Sometimes a fully qualified URL is passed in, e.g. `http://localhost:19001/.expo/.virtual-metro-entry.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=com.bacon.test-custom-entry`\n if (url.includes('/.expo/.virtual-metro-entry.bundle?')) {\n const ensured = url.startsWith('/') ? new URL(url, 'https://acme.dev') : new URL(url);\n // TODO: Maybe this function could be memoized in some capacity?\n const { search, searchParams } = ensured;\n\n const platform = searchParams.get('platform') ?? 'web';\n\n debug('Rewriting magic request url to entry point', { url, platform });\n\n const entry = resolveEntryPoint(projectRoot, {\n platform,\n // @ts-ignore\n projectConfig: {\n pkg: getPackageJson(projectRoot),\n },\n });\n\n if (!entry) {\n throw new Error(\n chalk`The project entry file could not be resolved (platform: ${platform}, root: ${projectRoot}). Define it in the {bold package.json} \"main\" field.`\n );\n }\n\n const serverRoot = getServerRoot(projectRoot);\n const relativeEntry = path.relative(serverRoot, entry).replace(/\\.[tj]sx?$/, '');\n debug('Resolved entry point', { entry, relativeEntry, serverRoot });\n\n // Only return the pathname when url is relative\n if (url.startsWith('/')) {\n // Like: `/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=com.bacon.test-custom-entry`\n return '/' + relativeEntry + '.bundle' + search;\n }\n\n // Modify the pathname within the URL and return the full URL\n ensured.pathname = '/' + relativeEntry + '.bundle';\n // Like: `http://localhost:19001/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=com.bacon.test-custom-entry`\n return ensured.toString();\n }\n\n return url;\n }\n return rewriteExpoRequestUrl;\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,OAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,MAAA;EAAA,MAAAL,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAI,KAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,iBAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,gBAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAkD,SAAAI,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AANlD;;AAQA,MAAMG,KAAK,GAAGT,OAAO,CAAC,OAAO,CAAC,CAAC,qC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AO,GAAG,GAAGe,aAAa,GAAG,SAAS,GAAGb,MAAM;MACjD;;MAEA;MACAH,OAAO,CAACoB,QAAQ,GAAG,GAAG,GAAGJ,aAAa,GAAG,SAAS;MAClD;MACA,OAAOhB,OAAO,CAACqB,QAAQ,EAAE;IAC3B;IAEA,OAAOxB,GAAG;EACZ;EACA,OAAOD,qBAAqB;AAC9B"}
|
|
@@ -65,7 +65,7 @@ async function transform(config, projectRoot, filename, data, options) {
|
|
|
65
65
|
|
|
66
66
|
// If the platform is not web, then return an empty module.
|
|
67
67
|
if (options.platform !== 'web') {
|
|
68
|
-
const code = (0, _cssModules().matchCssModule)(filename) ? 'module.exports={};' : '';
|
|
68
|
+
const code = (0, _cssModules().matchCssModule)(filename) ? 'module.exports={ unstable_styles: {} };' : '';
|
|
69
69
|
return _metroTransformWorker().default.transform(config, projectRoot, filename,
|
|
70
70
|
// TODO: Native CSS Modules
|
|
71
71
|
Buffer.from(code), options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-worker.js","names":["_metroTransformWorker","data","_interopRequireDefault","require","_css","_cssModules","_postcss","_sass","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","_interopRequireWildcard","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","countLines","transform","config","projectRoot","filename","options","_jsModuleResults$outp2","isCss","type","test","_options$customTransf","environment","customTransformOptions","match","RegExp","platform","worker","minify","Buffer","from","code","matchCssModule","toString","transformPostCssModule","src","syntax","matchSass","compileSass","_jsModuleResults$outp","results","transformCssModuleWeb","dev","sourceMap","jsModuleResults","output","cssCode","css","lineCount","map","functionMap","dependencies","Promise","resolve","then","cssResults","cssModules","wrapDevelopmentCSS","module","exports"],"sources":["../../src/transform-worker/transform-worker.ts"],"sourcesContent":["/**\n * Copyright 2023-present 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 */\nimport { FBSourceFunctionMap, MetroSourceMapSegmentTuple } from 'metro-source-map';\nimport worker, {\n JsTransformerConfig,\n JsTransformOptions,\n TransformResponse,\n} from 'metro-transform-worker';\n\nimport { wrapDevelopmentCSS } from './css';\nimport { matchCssModule, transformCssModuleWeb } from './css-modules';\nimport { transformPostCssModule } from './postcss';\nimport { compileSass, matchSass } from './sass';\n\nconst countLines = require('metro/src/lib/countLines') as (string: string) => number;\n\ntype JSFileType = 'js/script' | 'js/module' | 'js/module/asset';\n\ntype JsOutput = {\n data: {\n code: string;\n lineCount: number;\n map: MetroSourceMapSegmentTuple[];\n functionMap: FBSourceFunctionMap | null;\n };\n type: JSFileType;\n};\n\nexport async function transform(\n config: JsTransformerConfig,\n projectRoot: string,\n filename: string,\n data: Buffer,\n options: JsTransformOptions\n): Promise<TransformResponse> {\n const isCss = options.type !== 'asset' && /\\.(s?css|sass)$/.test(filename);\n // If the file is not CSS, then use the default behavior.\n if (!isCss) {\n const environment = options.customTransformOptions?.environment;\n\n if (\n environment === 'client' &&\n // TODO: Ensure this works with windows.\n // TODO: Add +api files.\n filename.match(new RegExp(`^app/\\\\+html(\\\\.${options.platform})?\\\\.([tj]sx?|[cm]js)?$`))\n ) {\n // Remove the server-only +html file from the bundle when bundling for a client environment.\n return worker.transform(\n config,\n projectRoot,\n filename,\n !options.minify\n ? Buffer.from(\n // Use a string so this notice is visible in the bundle if the user is\n // looking for it.\n '\"> The server-only +html file was removed from the client JS bundle by Expo CLI.\"'\n )\n : Buffer.from(''),\n options\n );\n }\n\n return worker.transform(config, projectRoot, filename, data, options);\n }\n\n // If the platform is not web, then return an empty module.\n if (options.platform !== 'web') {\n const code = matchCssModule(filename) ? 'module.exports={};' : '';\n return worker.transform(\n config,\n projectRoot,\n filename,\n // TODO: Native CSS Modules\n Buffer.from(code),\n options\n );\n }\n\n let code = data.toString('utf8');\n\n // Apply postcss transforms\n code = await transformPostCssModule(projectRoot, {\n src: code,\n filename,\n });\n\n // TODO: When native has CSS support, this will need to move higher up.\n const syntax = matchSass(filename);\n if (syntax) {\n code = compileSass(projectRoot, { filename, src: code }, { syntax }).src;\n }\n\n // If the file is a CSS Module, then transform it to a JS module\n // in development and a static CSS file in production.\n if (matchCssModule(filename)) {\n const results = await transformCssModuleWeb({\n filename,\n src: code,\n options: {\n projectRoot,\n dev: options.dev,\n minify: options.minify,\n sourceMap: false,\n },\n });\n\n const jsModuleResults = await worker.transform(\n config,\n projectRoot,\n filename,\n Buffer.from(results.output),\n options\n );\n\n const cssCode = results.css.toString();\n const output: JsOutput[] = [\n {\n type: 'js/module',\n data: {\n // @ts-expect-error\n ...jsModuleResults.output[0]?.data,\n\n // Append additional css metadata for static extraction.\n css: {\n code: cssCode,\n lineCount: countLines(cssCode),\n map: [],\n functionMap: null,\n },\n },\n },\n ];\n\n return {\n dependencies: jsModuleResults.dependencies,\n output,\n };\n }\n\n // Global CSS:\n\n const { transform } = await import('lightningcss');\n\n // TODO: Add bundling to resolve imports\n // https://lightningcss.dev/bundling.html#bundling-order\n\n const cssResults = transform({\n filename,\n code: Buffer.from(code),\n sourceMap: false,\n cssModules: false,\n projectRoot,\n minify: options.minify,\n });\n\n // TODO: Warnings:\n // cssResults.warnings.forEach((warning) => {\n // });\n\n // Create a mock JS module that exports an empty object,\n // this ensures Metro dependency graph is correct.\n const jsModuleResults = await worker.transform(\n config,\n projectRoot,\n filename,\n options.dev ? Buffer.from(wrapDevelopmentCSS({ src: code, filename })) : Buffer.from(''),\n options\n );\n\n const cssCode = cssResults.code.toString();\n\n // In production, we export the CSS as a string and use a special type to prevent\n // it from being included in the JS bundle. We'll extract the CSS like an asset later\n // and append it to the HTML bundle.\n const output: JsOutput[] = [\n {\n type: 'js/module',\n data: {\n // @ts-expect-error\n ...jsModuleResults.output[0]?.data,\n\n // Append additional css metadata for static extraction.\n css: {\n code: cssCode,\n lineCount: countLines(cssCode),\n map: [],\n functionMap: null,\n },\n },\n },\n ];\n\n return {\n dependencies: jsModuleResults.dependencies,\n output,\n };\n}\n\n/**\n * A custom Metro transformer that adds support for processing Expo-specific bundler features.\n * - Global CSS files on web.\n * - CSS Modules on web.\n * - TODO: Tailwind CSS on web.\n */\nmodule.exports = {\n // Use defaults for everything that's not custom.\n ...worker,\n transform,\n};\n"],"mappings":";;;;;;AAQA,SAAAA,sBAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,qBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAMA,SAAAG,KAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,MAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,KAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAgD,SAAAC,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAI,wBAAAR,GAAA,E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G3C,SAAS,CAAC;IAC3BG,QAAQ;IACRgB,IAAI,EAAEF,MAAM,CAACC,IAAI,CAACC,IAAI,CAAC;IACvBY,SAAS,EAAE,KAAK;IAChBa,UAAU,EAAE,KAAK;IACjB1C,WAAW;IACXc,MAAM,EAAEZ,OAAO,CAACY;EAClB,CAAC,CAAC;;EAEF;EACA;EACA;;EAEA;EACA;EACA,MAAMgB,eAAe,GAAG,MAAMjB,+BAAM,CAACf,SAAS,CAC5CC,MAAM,EACNC,WAAW,EACXC,QAAQ,EACRC,OAAO,CAAC0B,GAAG,GAAGb,MAAM,CAACC,IAAI,CAAC,IAAA2B,yBAAkB,EAAC;IAAEtB,GAAG,EAAEJ,IAAI;IAAEhB;EAAS,CAAC,CAAC,CAAC,GAAGc,MAAM,CAACC,IAAI,CAAC,EAAE,CAAC,EACxFd,OAAO,CACR;EAED,MAAM8B,OAAO,GAAGS,UAAU,CAACxB,IAAI,CAACE,QAAQ,EAAE;;EAE1C;EACA;EACA;EACA,MAAMY,MAAkB,GAAG,CACzB;IACE1B,IAAI,EAAE,WAAW;IACjBtC,IAAI,EAAE;MACJ;MACA,KAAAoC,sBAAA,GAAG2B,eAAe,CAACC,MAAM,CAAC,CAAC,CAAC,cAAA5B,sBAAA,uBAAzBA,sBAAA,CAA2BpC,IAAI;MAElC;MACAkE,GAAG,EAAE;QACHhB,IAAI,EAAEe,OAAO;QACbE,SAAS,EAAErC,UAAU,CAACmC,OAAO,CAAC;QAC9BG,GAAG,EAAE,EAAE;QACPC,WAAW,EAAE;MACf;IACF;EACF,CAAC,CACF;EAED,OAAO;IACLC,YAAY,EAAEP,eAAe,CAACO,YAAY;IAC1CN;EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACAa,MAAM,CAACC,OAAO,GAAG;EACf;EACA,GAAGhC,+BAAM;EACTf;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"transform-worker.js","names":["_metroTransformWorker","data","_interopRequireDefault","require","_css","_cssModules","_postcss","_sass","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","_interopRequireWildcard","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","countLines","transform","config","projectRoot","filename","options","_jsModuleResults$outp2","isCss","type","test","_options$customTransf","environment","customTransformOptions","match","RegExp","platform","worker","minify","Buffer","from","code","matchCssModule","toString","transformPostCssModule","src","syntax","matchSass","compileSass","_jsModuleResults$outp","results","transformCssModuleWeb","dev","sourceMap","jsModuleResults","output","cssCode","css","lineCount","map","functionMap","dependencies","Promise","resolve","then","cssResults","cssModules","wrapDevelopmentCSS","module","exports"],"sources":["../../src/transform-worker/transform-worker.ts"],"sourcesContent":["/**\n * Copyright 2023-present 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 */\nimport { FBSourceFunctionMap, MetroSourceMapSegmentTuple } from 'metro-source-map';\nimport worker, {\n JsTransformerConfig,\n JsTransformOptions,\n TransformResponse,\n} from 'metro-transform-worker';\n\nimport { wrapDevelopmentCSS } from './css';\nimport { matchCssModule, transformCssModuleWeb } from './css-modules';\nimport { transformPostCssModule } from './postcss';\nimport { compileSass, matchSass } from './sass';\n\nconst countLines = require('metro/src/lib/countLines') as (string: string) => number;\n\ntype JSFileType = 'js/script' | 'js/module' | 'js/module/asset';\n\ntype JsOutput = {\n data: {\n code: string;\n lineCount: number;\n map: MetroSourceMapSegmentTuple[];\n functionMap: FBSourceFunctionMap | null;\n };\n type: JSFileType;\n};\n\nexport async function transform(\n config: JsTransformerConfig,\n projectRoot: string,\n filename: string,\n data: Buffer,\n options: JsTransformOptions\n): Promise<TransformResponse> {\n const isCss = options.type !== 'asset' && /\\.(s?css|sass)$/.test(filename);\n // If the file is not CSS, then use the default behavior.\n if (!isCss) {\n const environment = options.customTransformOptions?.environment;\n\n if (\n environment === 'client' &&\n // TODO: Ensure this works with windows.\n // TODO: Add +api files.\n filename.match(new RegExp(`^app/\\\\+html(\\\\.${options.platform})?\\\\.([tj]sx?|[cm]js)?$`))\n ) {\n // Remove the server-only +html file from the bundle when bundling for a client environment.\n return worker.transform(\n config,\n projectRoot,\n filename,\n !options.minify\n ? Buffer.from(\n // Use a string so this notice is visible in the bundle if the user is\n // looking for it.\n '\"> The server-only +html file was removed from the client JS bundle by Expo CLI.\"'\n )\n : Buffer.from(''),\n options\n );\n }\n\n return worker.transform(config, projectRoot, filename, data, options);\n }\n\n // If the platform is not web, then return an empty module.\n if (options.platform !== 'web') {\n const code = matchCssModule(filename) ? 'module.exports={ unstable_styles: {} };' : '';\n return worker.transform(\n config,\n projectRoot,\n filename,\n // TODO: Native CSS Modules\n Buffer.from(code),\n options\n );\n }\n\n let code = data.toString('utf8');\n\n // Apply postcss transforms\n code = await transformPostCssModule(projectRoot, {\n src: code,\n filename,\n });\n\n // TODO: When native has CSS support, this will need to move higher up.\n const syntax = matchSass(filename);\n if (syntax) {\n code = compileSass(projectRoot, { filename, src: code }, { syntax }).src;\n }\n\n // If the file is a CSS Module, then transform it to a JS module\n // in development and a static CSS file in production.\n if (matchCssModule(filename)) {\n const results = await transformCssModuleWeb({\n filename,\n src: code,\n options: {\n projectRoot,\n dev: options.dev,\n minify: options.minify,\n sourceMap: false,\n },\n });\n\n const jsModuleResults = await worker.transform(\n config,\n projectRoot,\n filename,\n Buffer.from(results.output),\n options\n );\n\n const cssCode = results.css.toString();\n const output: JsOutput[] = [\n {\n type: 'js/module',\n data: {\n // @ts-expect-error\n ...jsModuleResults.output[0]?.data,\n\n // Append additional css metadata for static extraction.\n css: {\n code: cssCode,\n lineCount: countLines(cssCode),\n map: [],\n functionMap: null,\n },\n },\n },\n ];\n\n return {\n dependencies: jsModuleResults.dependencies,\n output,\n };\n }\n\n // Global CSS:\n\n const { transform } = await import('lightningcss');\n\n // TODO: Add bundling to resolve imports\n // https://lightningcss.dev/bundling.html#bundling-order\n\n const cssResults = transform({\n filename,\n code: Buffer.from(code),\n sourceMap: false,\n cssModules: false,\n projectRoot,\n minify: options.minify,\n });\n\n // TODO: Warnings:\n // cssResults.warnings.forEach((warning) => {\n // });\n\n // Create a mock JS module that exports an empty object,\n // this ensures Metro dependency graph is correct.\n const jsModuleResults = await worker.transform(\n config,\n projectRoot,\n filename,\n options.dev ? Buffer.from(wrapDevelopmentCSS({ src: code, filename })) : Buffer.from(''),\n options\n );\n\n const cssCode = cssResults.code.toString();\n\n // In production, we export the CSS as a string and use a special type to prevent\n // it from being included in the JS bundle. We'll extract the CSS like an asset later\n // and append it to the HTML bundle.\n const output: JsOutput[] = [\n {\n type: 'js/module',\n data: {\n // @ts-expect-error\n ...jsModuleResults.output[0]?.data,\n\n // Append additional css metadata for static extraction.\n css: {\n code: cssCode,\n lineCount: countLines(cssCode),\n map: [],\n functionMap: null,\n },\n },\n },\n ];\n\n return {\n dependencies: jsModuleResults.dependencies,\n output,\n };\n}\n\n/**\n * A custom Metro transformer that adds support for processing Expo-specific bundler features.\n * - Global CSS files on web.\n * - CSS Modules on web.\n * - TODO: Tailwind CSS on web.\n */\nmodule.exports = {\n // Use defaults for everything that's not custom.\n ...worker,\n transform,\n};\n"],"mappings":";;;;;;AAQA,SAAAA,sBAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,qBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAMA,SAAAG,KAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA,MAA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AI,EAAE;MACJ;MACA,KAAAoC,sBAAA,GAAG2B,eAAe,CAACC,MAAM,CAAC,CAAC,CAAC,cAAA5B,sBAAA,uBAAzBA,sBAAA,CAA2BpC,IAAI;MAElC;MACAkE,GAAG,EAAE;QACHhB,IAAI,EAAEe,OAAO;QACbE,SAAS,EAAErC,UAAU,CAACmC,OAAO,CAAC;QAC9BG,GAAG,EAAE,EAAE;QACPC,WAAW,EAAE;MACf;IACF;EACF,CAAC,CACF;EAED,OAAO;IACLC,YAAY,EAAEP,eAAe,CAACO,YAAY;IAC1CN;EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACAa,MAAM,CAACC,OAAO,GAAG;EACf;EACA,GAAGhC,+BAAM;EACTf;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/metro-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "A Metro config for running React Native projects with the Metro bundler",
|
|
5
5
|
"main": "build/ExpoMetroConfig.js",
|
|
6
6
|
"scripts": {
|
|
@@ -27,11 +27,13 @@
|
|
|
27
27
|
"homepage": "https://github.com/expo/expo/tree/main/packages/@expo/metro-config#readme",
|
|
28
28
|
"files": [
|
|
29
29
|
"build",
|
|
30
|
-
"transformer"
|
|
30
|
+
"transformer",
|
|
31
|
+
"babel-transformer"
|
|
31
32
|
],
|
|
32
33
|
"dependencies": {
|
|
33
|
-
"
|
|
34
|
-
"@expo/
|
|
34
|
+
"babel-preset-fbjs": "^3.4.0",
|
|
35
|
+
"@expo/config": "~8.2.0",
|
|
36
|
+
"@expo/env": "~0.1.0",
|
|
35
37
|
"@expo/json-file": "~8.2.37",
|
|
36
38
|
"chalk": "^4.1.0",
|
|
37
39
|
"debug": "^4.3.2",
|
|
@@ -43,6 +45,10 @@
|
|
|
43
45
|
"resolve-from": "^5.0.0",
|
|
44
46
|
"sucrase": "^3.20.0"
|
|
45
47
|
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@babel/core": "*",
|
|
50
|
+
"metro-react-native-babel-preset": "*"
|
|
51
|
+
},
|
|
46
52
|
"devDependencies": {
|
|
47
53
|
"@babel/core": "^7.15.5",
|
|
48
54
|
"sass": "^1.60.0"
|
|
@@ -50,5 +56,5 @@
|
|
|
50
56
|
"publishConfig": {
|
|
51
57
|
"access": "public"
|
|
52
58
|
},
|
|
53
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "663654577a7068c641b5e9474efbc502e3f334ea"
|
|
54
60
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _resolveFrom() {
|
|
4
|
-
const data = _interopRequireDefault(require("resolve-from"));
|
|
5
|
-
_resolveFrom = function () {
|
|
6
|
-
return data;
|
|
7
|
-
};
|
|
8
|
-
return data;
|
|
9
|
-
}
|
|
10
|
-
function _getCacheKey() {
|
|
11
|
-
const data = require("./getCacheKey");
|
|
12
|
-
_getCacheKey = function () {
|
|
13
|
-
return data;
|
|
14
|
-
};
|
|
15
|
-
return data;
|
|
16
|
-
}
|
|
17
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
// Copyright 2021-present 650 Industries (Expo). All rights reserved.
|
|
19
|
-
|
|
20
|
-
let transformer = null;
|
|
21
|
-
function resolveTransformer(projectRoot) {
|
|
22
|
-
if (transformer) {
|
|
23
|
-
return transformer;
|
|
24
|
-
}
|
|
25
|
-
const resolvedPath = _resolveFrom().default.silent(projectRoot, 'metro-react-native-babel-transformer');
|
|
26
|
-
if (!resolvedPath) {
|
|
27
|
-
throw new Error('Missing package "metro-react-native-babel-transformer" in the project. ' + 'This usually means `react-native` is not installed. ' + 'Please verify that dependencies in package.json include "react-native" ' + 'and run `yarn` or `npm install`.');
|
|
28
|
-
}
|
|
29
|
-
transformer = require(resolvedPath);
|
|
30
|
-
return transformer;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Extends the default `metro-react-native-babel-transformer`
|
|
35
|
-
* and uses babel-preset-expo as the default instead of metro-react-native-babel-preset.
|
|
36
|
-
* This enables users to safely transpile an Expo project without
|
|
37
|
-
* needing to explicitly define a `babel.config.js`
|
|
38
|
-
*
|
|
39
|
-
* @param filename string
|
|
40
|
-
* @param options BabelTransformerOptions
|
|
41
|
-
* @param plugins $PropertyType<BabelCoreOptions, 'plugins'>
|
|
42
|
-
* @param src string
|
|
43
|
-
*
|
|
44
|
-
* @returns
|
|
45
|
-
*/
|
|
46
|
-
function transform(props) {
|
|
47
|
-
// Use babel-preset-expo by default if available...
|
|
48
|
-
props.options.extendsBabelConfigPath = _resolveFrom().default.silent(props.options.projectRoot, 'babel-preset-expo');
|
|
49
|
-
return resolveTransformer(props.options.projectRoot).transform(props);
|
|
50
|
-
}
|
|
51
|
-
module.exports = {
|
|
52
|
-
getCacheKey: _getCacheKey().getCacheKey,
|
|
53
|
-
transform
|
|
54
|
-
};
|
|
55
|
-
//# sourceMappingURL=metro-expo-babel-transformer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metro-expo-babel-transformer.js","names":["_resolveFrom","data","_interopRequireDefault","require","_getCacheKey","obj","__esModule","default","transformer","resolveTransformer","projectRoot","resolvedPath","resolveFrom","silent","Error","transform","props","options","extendsBabelConfigPath","module","exports","getCacheKey"],"sources":["../../src/transformer/metro-expo-babel-transformer.ts"],"sourcesContent":["// Copyright 2021-present 650 Industries (Expo). All rights reserved.\n\nimport resolveFrom from 'resolve-from';\n\nimport { getCacheKey } from './getCacheKey';\n\nlet transformer: any = null;\n\nfunction resolveTransformer(projectRoot: string) {\n if (transformer) {\n return transformer;\n }\n const resolvedPath = resolveFrom.silent(projectRoot, 'metro-react-native-babel-transformer');\n if (!resolvedPath) {\n throw new Error(\n 'Missing package \"metro-react-native-babel-transformer\" in the project. ' +\n 'This usually means `react-native` is not installed. ' +\n 'Please verify that dependencies in package.json include \"react-native\" ' +\n 'and run `yarn` or `npm install`.'\n );\n }\n transformer = require(resolvedPath);\n return transformer;\n}\n\n/**\n * Extends the default `metro-react-native-babel-transformer`\n * and uses babel-preset-expo as the default instead of metro-react-native-babel-preset.\n * This enables users to safely transpile an Expo project without\n * needing to explicitly define a `babel.config.js`\n *\n * @param filename string\n * @param options BabelTransformerOptions\n * @param plugins $PropertyType<BabelCoreOptions, 'plugins'>\n * @param src string\n *\n * @returns\n */\nfunction transform(props: {\n filename: string;\n options: Record<string, any> & { projectRoot: string };\n plugins?: unknown;\n src: string;\n}) {\n // Use babel-preset-expo by default if available...\n props.options.extendsBabelConfigPath = resolveFrom.silent(\n props.options.projectRoot,\n 'babel-preset-expo'\n );\n return resolveTransformer(props.options.projectRoot).transform(props);\n}\n\nmodule.exports = {\n getCacheKey,\n transform,\n};\n"],"mappings":";;AAEA,SAAAA,aAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,YAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA4C,SAAAC,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAJ5C;;AAMA,IAAIG,WAAgB,GAAG,IAAI;AAE3B,SAASC,kBAAkBA,CAACC,WAAmB,EAAE;EAC/C,IAAIF,WAAW,EAAE;IACf,OAAOA,WAAW;EACpB;EACA,MAAMG,YAAY,GAAGC,sBAAW,CAACC,MAAM,CAACH,WAAW,EAAE,sCAAsC,CAAC;EAC5F,IAAI,CAACC,YAAY,EAAE;IACjB,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