@expo/metro-config 0.7.0 → 0.8.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.
Files changed (69) hide show
  1. package/build/ExpoMetroConfig.d.ts +16 -8
  2. package/build/ExpoMetroConfig.js +157 -103
  3. package/build/ExpoMetroConfig.js.map +1 -1
  4. package/build/customizeFrame.d.ts +10 -0
  5. package/build/customizeFrame.js +85 -0
  6. package/build/customizeFrame.js.map +1 -0
  7. package/build/env.d.ts +16 -0
  8. package/build/env.js +47 -0
  9. package/build/env.js.map +1 -0
  10. package/build/getModulesPaths.d.ts +1 -0
  11. package/build/getModulesPaths.js +12 -0
  12. package/build/getModulesPaths.js.map +1 -1
  13. package/build/getWatchFolders.js.map +1 -1
  14. package/build/rewriteRequestUrl.d.ts +1 -0
  15. package/build/rewriteRequestUrl.js +88 -0
  16. package/build/rewriteRequestUrl.js.map +1 -0
  17. package/build/serializer/environmentVariableSerializerPlugin.d.ts +11 -0
  18. package/build/serializer/environmentVariableSerializerPlugin.js +116 -0
  19. package/build/serializer/environmentVariableSerializerPlugin.js.map +1 -0
  20. package/build/serializer/getCssDeps.d.ts +31 -0
  21. package/build/serializer/getCssDeps.js +107 -0
  22. package/build/serializer/getCssDeps.js.map +1 -0
  23. package/build/serializer/serializerAssets.d.ts +7 -0
  24. package/build/serializer/serializerAssets.js +2 -0
  25. package/build/serializer/serializerAssets.js.map +1 -0
  26. package/build/serializer/withExpoSerializers.d.ts +15 -0
  27. package/build/serializer/withExpoSerializers.js +135 -0
  28. package/build/serializer/withExpoSerializers.js.map +1 -0
  29. package/build/transform-worker/css-modules.d.ts +20 -0
  30. package/build/transform-worker/css-modules.js +93 -0
  31. package/build/transform-worker/css-modules.js.map +1 -0
  32. package/build/transform-worker/css.d.ts +7 -0
  33. package/build/transform-worker/css.js +49 -0
  34. package/build/transform-worker/css.js.map +1 -0
  35. package/build/transform-worker/postcss.d.ts +17 -0
  36. package/build/transform-worker/postcss.js +253 -0
  37. package/build/transform-worker/postcss.js.map +1 -0
  38. package/build/transform-worker/sass.d.ts +9 -0
  39. package/build/transform-worker/sass.js +49 -0
  40. package/build/transform-worker/sass.js.map +1 -0
  41. package/build/transform-worker/transform-worker.d.ts +3 -0
  42. package/build/transform-worker/transform-worker.js +180 -0
  43. package/build/transform-worker/transform-worker.js.map +1 -0
  44. package/build/transform-worker/utils/require.d.ts +2 -0
  45. package/build/transform-worker/utils/require.js +38 -0
  46. package/build/transform-worker/utils/require.js.map +1 -0
  47. package/build/transformer/createExoticTransformer.js.map +1 -1
  48. package/build/transformer/createMatcher.js +1 -1
  49. package/build/transformer/createMatcher.js.map +1 -1
  50. package/build/transformer/createMultiRuleTransformer.js +2 -2
  51. package/build/transformer/createMultiRuleTransformer.js.map +1 -1
  52. package/build/transformer/generateFunctionMap.d.ts +3 -1
  53. package/build/transformer/generateFunctionMap.js +6 -6
  54. package/build/transformer/generateFunctionMap.js.map +1 -1
  55. package/build/transformer/getBabelConfig.js.map +1 -1
  56. package/build/transformer/getCacheKey.js.map +1 -1
  57. package/build/transformer/index.js.map +1 -1
  58. package/build/transformer/metro-expo-babel-transformer.js.map +1 -1
  59. package/build/transformer/metro-expo-exotic-babel-transformer.js.map +1 -1
  60. package/build/traveling/metro-config.d.ts +1 -0
  61. package/build/traveling/metro-config.js +25 -0
  62. package/build/traveling/metro-config.js.map +1 -0
  63. package/build/utils/hash.d.ts +1 -0
  64. package/build/utils/hash.js +18 -0
  65. package/build/utils/hash.js.map +1 -0
  66. package/package.json +9 -7
  67. package/build/importMetroFromProject.d.ts +0 -4
  68. package/build/importMetroFromProject.js +0 -40
  69. package/build/importMetroFromProject.js.map +0 -1
@@ -1,11 +1,6 @@
1
1
  import { Reporter } from 'metro';
2
- import type MetroConfig from 'metro-config';
3
- export declare const EXPO_DEBUG: boolean;
4
- export declare const INTERNAL_CALLSITES_REGEX: RegExp;
5
- export interface DefaultConfigOptions {
6
- mode?: 'exotic';
7
- }
8
- export declare function getDefaultConfig(projectRoot: string, options?: DefaultConfigOptions): MetroConfig.InputConfigT;
2
+ import { ConfigT as MetroConfig, InputConfigT } from 'metro-config';
3
+ import { INTERNAL_CALLSITES_REGEX } from './customizeFrame';
9
4
  export interface LoadOptions {
10
5
  config?: string;
11
6
  maxWorkers?: number;
@@ -13,4 +8,17 @@ export interface LoadOptions {
13
8
  reporter?: Reporter;
14
9
  resetCache?: boolean;
15
10
  }
16
- export declare function loadAsync(projectRoot: string, { reporter, ...metroOptions }?: LoadOptions): Promise<MetroConfig.ConfigT>;
11
+ export interface DefaultConfigOptions {
12
+ mode?: 'exotic';
13
+ /**
14
+ * **Experimental:** Enable CSS support for Metro web, and shim on native.
15
+ *
16
+ * This is an experimental feature and may change in the future. The underlying implementation
17
+ * is subject to change, and native support for CSS Modules may be added in the future during a non-major SDK release.
18
+ */
19
+ isCSSEnabled?: boolean;
20
+ }
21
+ export declare function getDefaultConfig(projectRoot: string, options?: DefaultConfigOptions): InputConfigT;
22
+ export declare function loadAsync(projectRoot: string, { reporter, ...metroOptions }?: LoadOptions): Promise<MetroConfig>;
23
+ export { MetroConfig, INTERNAL_CALLSITES_REGEX };
24
+ export declare const EXPO_DEBUG: boolean;
@@ -3,9 +3,28 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.INTERNAL_CALLSITES_REGEX = exports.EXPO_DEBUG = void 0;
6
+ exports.EXPO_DEBUG = void 0;
7
+ Object.defineProperty(exports, "INTERNAL_CALLSITES_REGEX", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _customizeFrame().INTERNAL_CALLSITES_REGEX;
11
+ }
12
+ });
13
+ Object.defineProperty(exports, "MetroConfig", {
14
+ enumerable: true,
15
+ get: function () {
16
+ return _metroConfig().ConfigT;
17
+ }
18
+ });
7
19
  exports.getDefaultConfig = getDefaultConfig;
8
20
  exports.loadAsync = loadAsync;
21
+ function _config() {
22
+ const data = require("@expo/config");
23
+ _config = function () {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
9
28
  function _paths() {
10
29
  const data = require("@expo/config/paths");
11
30
  _paths = function () {
@@ -13,6 +32,20 @@ function _paths() {
13
32
  };
14
33
  return data;
15
34
  }
35
+ function runtimeEnv() {
36
+ const data = _interopRequireWildcard(require("@expo/env"));
37
+ runtimeEnv = function () {
38
+ return data;
39
+ };
40
+ return data;
41
+ }
42
+ function _jsonFile() {
43
+ const data = _interopRequireDefault(require("@expo/json-file"));
44
+ _jsonFile = function () {
45
+ return data;
46
+ };
47
+ return data;
48
+ }
16
49
  function _chalk() {
17
50
  const data = _interopRequireDefault(require("chalk"));
18
51
  _chalk = function () {
@@ -20,9 +53,16 @@ function _chalk() {
20
53
  };
21
54
  return data;
22
55
  }
23
- function _getenv() {
24
- const data = require("getenv");
25
- _getenv = function () {
56
+ function _metroCache() {
57
+ const data = require("metro-cache");
58
+ _metroCache = function () {
59
+ return data;
60
+ };
61
+ return data;
62
+ }
63
+ function _metroConfig() {
64
+ const data = require("metro-config");
65
+ _metroConfig = function () {
26
66
  return data;
27
67
  };
28
68
  return data;
@@ -41,9 +81,16 @@ function _resolveFrom() {
41
81
  };
42
82
  return data;
43
83
  }
44
- function _url() {
45
- const data = require("url");
46
- _url = function () {
84
+ function _customizeFrame() {
85
+ const data = require("./customizeFrame");
86
+ _customizeFrame = function () {
87
+ return data;
88
+ };
89
+ return data;
90
+ }
91
+ function _env2() {
92
+ const data = require("./env");
93
+ _env2 = function () {
47
94
  return data;
48
95
  };
49
96
  return data;
@@ -62,83 +109,63 @@ function _getWatchFolders() {
62
109
  };
63
110
  return data;
64
111
  }
65
- function _importMetroFromProject() {
66
- const data = require("./importMetroFromProject");
67
- _importMetroFromProject = function () {
112
+ function _rewriteRequestUrl() {
113
+ const data = require("./rewriteRequestUrl");
114
+ _rewriteRequestUrl = function () {
115
+ return data;
116
+ };
117
+ return data;
118
+ }
119
+ function _withExpoSerializers() {
120
+ const data = require("./serializer/withExpoSerializers");
121
+ _withExpoSerializers = function () {
122
+ return data;
123
+ };
124
+ return data;
125
+ }
126
+ function _postcss() {
127
+ const data = require("./transform-worker/postcss");
128
+ _postcss = function () {
129
+ return data;
130
+ };
131
+ return data;
132
+ }
133
+ function _metroConfig2() {
134
+ const data = require("./traveling/metro-config");
135
+ _metroConfig2 = function () {
68
136
  return data;
69
137
  };
70
138
  return data;
71
139
  }
72
140
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
73
- // Copyright 2021-present 650 Industries (Expo). All rights reserved.
141
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
142
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
143
+ // Copyright 2023-present 650 Industries (Expo). All rights reserved.
74
144
 
75
- const EXPO_DEBUG = (0, _getenv().boolish)('EXPO_DEBUG', false);
76
- exports.EXPO_DEBUG = EXPO_DEBUG;
77
- const EXPO_USE_METRO_WORKSPACE_ROOT = (0, _getenv().boolish)('EXPO_USE_METRO_WORKSPACE_ROOT', false);
78
- const EXPO_USE_EXOTIC = (0, _getenv().boolish)('EXPO_USE_EXOTIC', false);
145
+ // @ts-expect-error: incorrectly typed
79
146
 
80
- // Import only the types here, the values will be imported from the project, at runtime.
81
- const INTERNAL_CALLSITES_REGEX = new RegExp(['/Libraries/Renderer/implementations/.+\\.js$', '/Libraries/BatchedBridge/MessageQueue\\.js$', '/Libraries/YellowBox/.+\\.js$', '/Libraries/LogBox/.+\\.js$', '/Libraries/Core/Timers/.+\\.js$', 'node_modules/react-devtools-core/.+\\.js$', 'node_modules/react-refresh/.+\\.js$', 'node_modules/scheduler/.+\\.js$',
82
- // Metro replaces `require()` with a different method,
83
- // we want to omit this method from the stack trace.
84
- // This is akin to most React tooling.
85
- '/metro/.*/polyfills/require.js$',
86
- // Hide frames related to a fast refresh.
87
- '/metro/.*/lib/bundle-modules/.+\\.js$', 'node_modules/react-native/Libraries/Utilities/HMRClient.js$', 'node_modules/eventemitter3/index.js', 'node_modules/event-target-shim/dist/.+\\.js$',
88
- // Ignore the log forwarder used in the expo package.
89
- '/expo/build/logs/RemoteConsole.js$',
90
- // Improve errors thrown by invariant (ex: `Invariant Violation: "main" has not been registered`).
91
- 'node_modules/invariant/.+\\.js$',
92
- // Remove babel runtime additions
93
- 'node_modules/regenerator-runtime/.+\\.js$',
94
- // Remove react native setImmediate ponyfill
95
- 'node_modules/promise/setimmediate/.+\\.js$',
96
- // Babel helpers that implement language features
97
- 'node_modules/@babel/runtime/.+\\.js$',
98
- // Hide Hermes internal bytecode
99
- '/InternalBytecode/InternalBytecode\\.js$',
100
- // Block native code invocations
101
- `\\[native code\\]`,
102
- // Hide react-dom (web)
103
- 'node_modules/react-dom/.+\\.js$'].join('|'));
104
- exports.INTERNAL_CALLSITES_REGEX = INTERNAL_CALLSITES_REGEX;
105
- function isUrl(value) {
106
- try {
107
- // eslint-disable-next-line no-new
108
- new (_url().URL)(value);
109
- return true;
110
- } catch {
111
- return false;
112
- }
113
- }
147
+ const debug = require('debug')('expo:metro:config');
114
148
  function getProjectBabelConfigFile(projectRoot) {
115
149
  return _resolveFrom().default.silent(projectRoot, './babel.config.js') || _resolveFrom().default.silent(projectRoot, './.babelrc') || _resolveFrom().default.silent(projectRoot, './.babelrc.js');
116
150
  }
117
151
  function getAssetPlugins(projectRoot) {
118
- const assetPlugins = [];
119
- let hashAssetFilesPath;
120
- try {
121
- hashAssetFilesPath = (0, _resolveFrom().default)(projectRoot, 'expo-asset/tools/hashAssetFiles');
122
- } catch {
123
- // TODO: we should warn/throw an error if the user has expo-updates installed but does not
124
- // have hashAssetFiles available, or if the user is in managed workflow and does not have
125
- // hashAssetFiles available. but in a bare app w/o expo-updates, just using dev-client,
126
- // it is not needed
127
- }
128
- if (hashAssetFilesPath) {
129
- assetPlugins.push(hashAssetFilesPath);
152
+ const hashAssetFilesPath = _resolveFrom().default.silent(projectRoot, 'expo-asset/tools/hashAssetFiles');
153
+ if (!hashAssetFilesPath) {
154
+ throw new Error(`The required package \`expo-asset\` cannot be found`);
130
155
  }
131
- return assetPlugins;
156
+ return [hashAssetFilesPath];
132
157
  }
133
158
  let hasWarnedAboutExotic = false;
134
159
  function getDefaultConfig(projectRoot, options = {}) {
135
- var _getWorkspaceRoot;
136
- const isExotic = options.mode === 'exotic' || EXPO_USE_EXOTIC;
160
+ const {
161
+ getDefaultConfig: getDefaultMetroConfig,
162
+ mergeConfig
163
+ } = (0, _metroConfig2().importMetroConfig)(projectRoot);
164
+ const isExotic = options.mode === 'exotic' || _env2().env.EXPO_USE_EXOTIC;
137
165
  if (isExotic && !hasWarnedAboutExotic) {
138
166
  hasWarnedAboutExotic = true;
139
167
  console.log(_chalk().default.gray(`\u203A Unstable feature ${_chalk().default.bold`EXPO_USE_EXOTIC`} is enabled. Bundling may not work as expected, and is subject to breaking changes.`));
140
168
  }
141
- const MetroConfig = (0, _importMetroFromProject().importMetroConfigFromProject)(projectRoot);
142
169
  const reactNativePath = _path().default.dirname((0, _resolveFrom().default)(projectRoot, 'react-native/package.json'));
143
170
  try {
144
171
  // Set the `EXPO_METRO_CACHE_KEY_VERSION` variable for use in the custom babel transformer.
@@ -155,10 +182,17 @@ function getDefaultConfig(projectRoot, options = {}) {
155
182
  isModern: false
156
183
  };
157
184
  const sourceExts = (0, _paths().getBareExtensions)([], sourceExtsConfig);
158
- if (isExotic) {
159
- // Add support for cjs (without platform extensions).
160
- sourceExts.push('cjs');
185
+
186
+ // Add support for cjs (without platform extensions).
187
+ sourceExts.push('cjs');
188
+ let sassVersion = null;
189
+ if (options.isCSSEnabled) {
190
+ sassVersion = getSassVersion(projectRoot);
191
+ // Enable SCSS by default so we can provide a better error message
192
+ // when sass isn't installed.
193
+ sourceExts.push('scss', 'sass', 'css');
161
194
  }
195
+ const envFiles = runtimeEnv().getFiles(process.env.NODE_ENV);
162
196
  const babelConfigPath = getProjectBabelConfigFile(projectRoot);
163
197
  const isCustomBabelConfigDefined = !!babelConfigPath;
164
198
  const resolverMainFields = [];
@@ -169,10 +203,11 @@ function getDefaultConfig(projectRoot, options = {}) {
169
203
  resolverMainFields.push('react-native');
170
204
  }
171
205
  resolverMainFields.push('browser', 'main');
206
+ const pkg = (0, _config().getPackageJson)(projectRoot);
172
207
  const watchFolders = (0, _getWatchFolders().getWatchFolders)(projectRoot);
173
208
  // TODO: nodeModulesPaths does not work with the new Node.js package.json exports API, this causes packages like uuid to fail. Disabling for now.
174
209
  const nodeModulesPaths = (0, _getModulesPaths().getModulesPaths)(projectRoot);
175
- if (EXPO_DEBUG) {
210
+ if (_env2().env.EXPO_DEBUG) {
176
211
  console.log();
177
212
  console.log(`Expo Metro config:`);
178
213
  try {
@@ -185,6 +220,8 @@ function getDefaultConfig(projectRoot, options = {}) {
185
220
  console.log(`- Watch Folders: ${watchFolders.join(', ')}`);
186
221
  console.log(`- Node Module Paths: ${nodeModulesPaths.join(', ')}`);
187
222
  console.log(`- Exotic: ${isExotic}`);
223
+ console.log(`- Env Files: ${envFiles}`);
224
+ console.log(`- Sass: ${sassVersion}`);
188
225
  console.log();
189
226
  }
190
227
  const {
@@ -192,21 +229,25 @@ function getDefaultConfig(projectRoot, options = {}) {
192
229
  // This prints a giant React logo which is less accessible to users on smaller terminals.
193
230
  reporter,
194
231
  ...metroDefaultValues
195
- } = MetroConfig.getDefaultConfig.getDefaultValues(projectRoot);
232
+ } = getDefaultMetroConfig.getDefaultValues(projectRoot);
196
233
 
197
234
  // Merge in the default config from Metro here, even though loadConfig uses it as defaults.
198
235
  // This is a convenience for getDefaultConfig use in metro.config.js, e.g. to modify assetExts.
199
- return MetroConfig.mergeConfig(metroDefaultValues, {
236
+ const metroConfig = mergeConfig(metroDefaultValues, {
200
237
  watchFolders,
201
238
  resolver: {
202
239
  resolverMainFields,
203
- platforms: ['ios', 'android', 'native', 'testing'],
240
+ platforms: ['ios', 'android'],
204
241
  assetExts: metroDefaultValues.resolver.assetExts.concat(
205
242
  // Add default support for `expo-image` file types.
206
243
  ['heic', 'avif']).filter(assetExt => !sourceExts.includes(assetExt)),
207
244
  sourceExts,
208
245
  nodeModulesPaths
209
246
  },
247
+ watcher: {
248
+ // strip starting dot from env files
249
+ additionalExts: envFiles.map(file => file.replace(/^\./, ''))
250
+ },
210
251
  serializer: {
211
252
  getModulesRunBeforeMainModule: () => [require.resolve(_path().default.join(reactNativePath, 'Libraries/Core/InitializeCore'))
212
253
  // TODO: Bacon: load Expo side-effects
@@ -215,41 +256,24 @@ function getDefaultConfig(projectRoot, options = {}) {
215
256
  getPolyfills: () => require(_path().default.join(reactNativePath, 'rn-get-polyfills'))()
216
257
  },
217
258
  server: {
218
- port: Number(process.env.RCT_METRO_PORT) || 8081,
259
+ rewriteRequestUrl: (0, _rewriteRequestUrl().getRewriteRequestUrl)(projectRoot),
260
+ port: Number(_env2().env.RCT_METRO_PORT) || 8081,
219
261
  // NOTE(EvanBacon): Moves the server root down to the monorepo root.
220
262
  // This enables proper monorepo support for web.
221
- // @ts-expect-error: not on type
222
- unstable_serverRoot: EXPO_USE_METRO_WORKSPACE_ROOT ? (_getWorkspaceRoot = (0, _getModulesPaths().getWorkspaceRoot)(projectRoot)) !== null && _getWorkspaceRoot !== void 0 ? _getWorkspaceRoot : projectRoot : projectRoot
263
+ unstable_serverRoot: (0, _getModulesPaths().getServerRoot)(projectRoot)
223
264
  },
224
265
  symbolicator: {
225
- customizeFrame: frame => {
226
- if (frame.file && isUrl(frame.file)) {
227
- return {
228
- ...frame,
229
- // HACK: This prevents Metro from attempting to read the invalid file URL it sent us.
230
- lineNumber: null,
231
- column: null,
232
- // This prevents the invalid frame from being shown by default.
233
- collapse: true
234
- };
235
- }
236
- let collapse = Boolean(frame.file && INTERNAL_CALLSITES_REGEX.test(frame.file));
237
- if (!collapse) {
238
- var _frame$file;
239
- // This represents the first frame of the stacktrace.
240
- // Often this looks like: `__r(0);`.
241
- // The URL will also be unactionable in the app and therefore not very useful to the developer.
242
- if (frame.column === 3 && frame.methodName === 'global code' && (_frame$file = frame.file) !== null && _frame$file !== void 0 && _frame$file.match(/^https?:\/\//g)) {
243
- collapse = true;
244
- }
245
- }
246
- return {
247
- ...(frame || {}),
248
- collapse
249
- };
250
- }
266
+ customizeFrame: (0, _customizeFrame().getDefaultCustomizeFrame)()
251
267
  },
268
+ transformerPath: options.isCSSEnabled ?
269
+ // Custom worker that adds CSS support for Metro web.
270
+ require.resolve('./transform-worker/transform-worker') : metroDefaultValues.transformerPath,
252
271
  transformer: {
272
+ // Custom: These are passed to `getCacheKey` and ensure invalidation when the version changes.
273
+ // @ts-expect-error: not on type.
274
+ postcssHash: (0, _postcss().getPostcssConfigHash)(projectRoot),
275
+ browserslistHash: pkg.browserslist ? (0, _metroCache().stableHash)(JSON.stringify(pkg.browserslist)).toString('hex') : null,
276
+ sassVersion,
253
277
  // `require.context` support
254
278
  unstable_allowRequireContext: true,
255
279
  allowOptionalDependencies: true,
@@ -264,6 +288,7 @@ function getDefaultConfig(projectRoot, options = {}) {
264
288
  assetPlugins: getAssetPlugins(projectRoot)
265
289
  }
266
290
  });
291
+ return (0, _withExpoSerializers().withExpoSerializers)(metroConfig);
267
292
  }
268
293
  async function loadAsync(projectRoot, {
269
294
  reporter,
@@ -276,11 +301,40 @@ async function loadAsync(projectRoot, {
276
301
  reporter
277
302
  };
278
303
  }
279
- const MetroConfig = (0, _importMetroFromProject().importMetroConfigFromProject)(projectRoot);
280
- return await MetroConfig.loadConfig({
304
+ const {
305
+ loadConfig
306
+ } = (0, _metroConfig2().importMetroConfig)(projectRoot);
307
+ return await loadConfig({
281
308
  cwd: projectRoot,
282
309
  projectRoot,
283
310
  ...metroOptions
284
311
  }, defaultConfig);
285
312
  }
313
+
314
+ // re-export for use in config files.
315
+
316
+ // re-export for legacy cases.
317
+ const EXPO_DEBUG = _env2().env.EXPO_DEBUG;
318
+ exports.EXPO_DEBUG = EXPO_DEBUG;
319
+ function getSassVersion(projectRoot) {
320
+ const sassPkg = _resolveFrom().default.silent(projectRoot, 'sass');
321
+ if (!sassPkg) return null;
322
+ const sassPkgJson = findUpPackageJson(sassPkg);
323
+ if (!sassPkgJson) return null;
324
+ const pkg = _jsonFile().default.read(sassPkgJson);
325
+ debug('sass package.json:', sassPkgJson);
326
+ const sassVersion = pkg.version;
327
+ if (typeof sassVersion === 'string') {
328
+ return sassVersion;
329
+ }
330
+ return null;
331
+ }
332
+ function findUpPackageJson(cwd) {
333
+ if (['.', _path().default.sep].includes(cwd)) return null;
334
+ const found = _resolveFrom().default.silent(cwd, './package.json');
335
+ if (found) {
336
+ return found;
337
+ }
338
+ return findUpPackageJson(_path().default.dirname(cwd));
339
+ }
286
340
  //# sourceMappingURL=ExpoMetroConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoMetroConfig.js","names":["EXPO_DEBUG","boolish","EXPO_USE_METRO_WORKSPACE_ROOT","EXPO_USE_EXOTIC","INTERNAL_CALLSITES_REGEX","RegExp","join","isUrl","value","URL","getProjectBabelConfigFile","projectRoot","resolveFrom","silent","getAssetPlugins","assetPlugins","hashAssetFilesPath","push","hasWarnedAboutExotic","getDefaultConfig","options","isExotic","mode","console","log","chalk","gray","bold","MetroConfig","importMetroConfigFromProject","reactNativePath","path","dirname","babelPresetFbjsPath","process","env","EXPO_METRO_CACHE_KEY_VERSION","String","require","version","sourceExtsConfig","isTS","isReact","isModern","sourceExts","getBareExtensions","babelConfigPath","isCustomBabelConfigDefined","resolverMainFields","watchFolders","getWatchFolders","nodeModulesPaths","getModulesPaths","reporter","metroDefaultValues","getDefaultValues","mergeConfig","resolver","platforms","assetExts","concat","filter","assetExt","includes","serializer","getModulesRunBeforeMainModule","resolve","getPolyfills","server","port","Number","RCT_METRO_PORT","unstable_serverRoot","getWorkspaceRoot","symbolicator","customizeFrame","frame","file","lineNumber","column","collapse","Boolean","test","methodName","match","transformer","unstable_allowRequireContext","allowOptionalDependencies","babelTransformerPath","assetRegistryPath","loadAsync","metroOptions","defaultConfig","loadConfig","cwd"],"sources":["../src/ExpoMetroConfig.ts"],"sourcesContent":["// Copyright 2021-present 650 Industries (Expo). All rights reserved.\n\nimport { getBareExtensions } from '@expo/config/paths';\nimport chalk from 'chalk';\nimport { boolish } from 'getenv';\nimport { Reporter } from 'metro';\nimport type MetroConfig from 'metro-config';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\nimport { URL } from 'url';\n\nimport { getModulesPaths, getWorkspaceRoot } from './getModulesPaths';\nimport { getWatchFolders } from './getWatchFolders';\nimport { importMetroConfigFromProject } from './importMetroFromProject';\n\nexport const EXPO_DEBUG = boolish('EXPO_DEBUG', false);\nconst EXPO_USE_METRO_WORKSPACE_ROOT = boolish('EXPO_USE_METRO_WORKSPACE_ROOT', false);\nconst EXPO_USE_EXOTIC = boolish('EXPO_USE_EXOTIC', false);\n\n// Import only the types here, the values will be imported from the project, at runtime.\nexport const INTERNAL_CALLSITES_REGEX = new RegExp(\n [\n '/Libraries/Renderer/implementations/.+\\\\.js$',\n '/Libraries/BatchedBridge/MessageQueue\\\\.js$',\n '/Libraries/YellowBox/.+\\\\.js$',\n '/Libraries/LogBox/.+\\\\.js$',\n '/Libraries/Core/Timers/.+\\\\.js$',\n 'node_modules/react-devtools-core/.+\\\\.js$',\n 'node_modules/react-refresh/.+\\\\.js$',\n 'node_modules/scheduler/.+\\\\.js$',\n // Metro replaces `require()` with a different method,\n // we want to omit this method from the stack trace.\n // This is akin to most React tooling.\n '/metro/.*/polyfills/require.js$',\n // Hide frames related to a fast refresh.\n '/metro/.*/lib/bundle-modules/.+\\\\.js$',\n 'node_modules/react-native/Libraries/Utilities/HMRClient.js$',\n 'node_modules/eventemitter3/index.js',\n 'node_modules/event-target-shim/dist/.+\\\\.js$',\n // Ignore the log forwarder used in the expo package.\n '/expo/build/logs/RemoteConsole.js$',\n // Improve errors thrown by invariant (ex: `Invariant Violation: \"main\" has not been registered`).\n 'node_modules/invariant/.+\\\\.js$',\n // Remove babel runtime additions\n 'node_modules/regenerator-runtime/.+\\\\.js$',\n // Remove react native setImmediate ponyfill\n 'node_modules/promise/setimmediate/.+\\\\.js$',\n // Babel helpers that implement language features\n 'node_modules/@babel/runtime/.+\\\\.js$',\n // Hide Hermes internal bytecode\n '/InternalBytecode/InternalBytecode\\\\.js$',\n // Block native code invocations\n `\\\\[native code\\\\]`,\n // Hide react-dom (web)\n 'node_modules/react-dom/.+\\\\.js$',\n ].join('|')\n);\n\nfunction isUrl(value: string): boolean {\n try {\n // eslint-disable-next-line no-new\n new URL(value);\n return true;\n } catch {\n return false;\n }\n}\n\nexport interface DefaultConfigOptions {\n mode?: 'exotic';\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 assetPlugins: string[] = [];\n\n let hashAssetFilesPath;\n try {\n hashAssetFilesPath = resolveFrom(projectRoot, 'expo-asset/tools/hashAssetFiles');\n } catch {\n // TODO: we should warn/throw an error if the user has expo-updates installed but does not\n // have hashAssetFiles available, or if the user is in managed workflow and does not have\n // hashAssetFiles available. but in a bare app w/o expo-updates, just using dev-client,\n // it is not needed\n }\n\n if (hashAssetFilesPath) {\n assetPlugins.push(hashAssetFilesPath);\n }\n\n return assetPlugins;\n}\n\nlet hasWarnedAboutExotic = false;\n\nexport function getDefaultConfig(\n projectRoot: string,\n options: DefaultConfigOptions = {}\n): MetroConfig.InputConfigT {\n const isExotic = options.mode === 'exotic' || 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 const MetroConfig = importMetroConfigFromProject(projectRoot);\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 if (isExotic) {\n // Add support for cjs (without platform extensions).\n sourceExts.push('cjs');\n }\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 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 (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();\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 } = MetroConfig.getDefaultConfig.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 return MetroConfig.mergeConfig(metroDefaultValues, {\n watchFolders,\n resolver: {\n resolverMainFields,\n platforms: ['ios', 'android', 'native', 'testing'],\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 serializer: {\n getModulesRunBeforeMainModule: () => [\n require.resolve(path.join(reactNativePath, 'Libraries/Core/InitializeCore')),\n // TODO: Bacon: load Expo side-effects\n ],\n getPolyfills: () => require(path.join(reactNativePath, 'rn-get-polyfills'))(),\n },\n server: {\n port: Number(process.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 // @ts-expect-error: not on type\n unstable_serverRoot: EXPO_USE_METRO_WORKSPACE_ROOT\n ? getWorkspaceRoot(projectRoot) ?? projectRoot\n : projectRoot,\n },\n symbolicator: {\n customizeFrame: (frame) => {\n if (frame.file && isUrl(frame.file)) {\n return {\n ...frame,\n // HACK: This prevents Metro from attempting to read the invalid file URL it sent us.\n lineNumber: null,\n column: null,\n // This prevents the invalid frame from being shown by default.\n collapse: true,\n };\n }\n let collapse = Boolean(frame.file && INTERNAL_CALLSITES_REGEX.test(frame.file));\n\n if (!collapse) {\n // This represents the first frame of the stacktrace.\n // Often this looks like: `__r(0);`.\n // The URL will also be unactionable in the app and therefore not very useful to the developer.\n if (\n frame.column === 3 &&\n frame.methodName === 'global code' &&\n frame.file?.match(/^https?:\\/\\//g)\n ) {\n collapse = true;\n }\n }\n\n return { ...(frame || {}), collapse };\n },\n },\n transformer: {\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\nexport interface LoadOptions {\n config?: string;\n maxWorkers?: number;\n port?: number;\n reporter?: Reporter;\n resetCache?: boolean;\n}\n\nexport async function loadAsync(\n projectRoot: string,\n { reporter, ...metroOptions }: LoadOptions = {}\n): Promise<MetroConfig.ConfigT> {\n let defaultConfig = getDefaultConfig(projectRoot);\n if (reporter) {\n defaultConfig = { ...defaultConfig, reporter };\n }\n const MetroConfig = importMetroConfigFromProject(projectRoot);\n return await MetroConfig.loadConfig(\n { cwd: projectRoot, projectRoot, ...metroOptions },\n defaultConfig\n );\n}\n"],"mappings":";;;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;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AUO,eAAe+E,SAAS,CAC7B/E,WAAmB,EACnB;EAAE0C,QAAQ;EAAE,GAAGsC;AAA0B,CAAC,GAAG,CAAC,CAAC,EACjB;EAC9B,IAAIC,aAAa,GAAGzE,gBAAgB,CAACR,WAAW,CAAC;EACjD,IAAI0C,QAAQ,EAAE;IACZuC,aAAa,GAAG;MAAE,GAAGA,aAAa;MAAEvC;IAAS,CAAC;EAChD;EACA,MAAMzB,WAAW,GAAG,IAAAC,sDAA4B,EAAClB,WAAW,CAAC;EAC7D,OAAO,MAAMiB,WAAW,CAACiE,UAAU,CACjC;IAAEC,GAAG,EAAEnF,WAAW;IAAEA,WAAW;IAAE,GAAGgF;EAAa,CAAC,EAClDC,aAAa,CACd;AACH"}
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","resolve","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';\n// @ts-expect-error: incorrectly typed\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);\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 require.resolve(path.join(reactNativePath, 'Libraries/Core/InitializeCore')),\n // TODO: Bacon: load Expo side-effects\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;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AE,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,10 @@
1
+ import { SymbolicatorConfigT } from 'metro-config';
2
+ type CustomizeFrameFunc = SymbolicatorConfigT['customizeFrame'];
3
+ export declare const INTERNAL_CALLSITES_REGEX: RegExp;
4
+ /**
5
+ * The default frame processor. This is used to modify the stack traces.
6
+ * This method attempts to collapse all frames that aren't relevant to
7
+ * the user by default.
8
+ */
9
+ export declare function getDefaultCustomizeFrame(): CustomizeFrameFunc;
10
+ export {};
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.INTERNAL_CALLSITES_REGEX = void 0;
7
+ exports.getDefaultCustomizeFrame = getDefaultCustomizeFrame;
8
+ function _url() {
9
+ const data = require("url");
10
+ _url = function () {
11
+ return data;
12
+ };
13
+ return data;
14
+ }
15
+ // Copyright 2023-present 650 Industries (Expo). All rights reserved.
16
+
17
+ // Import only the types here, the values will be imported from the project, at runtime.
18
+ const INTERNAL_CALLSITES_REGEX = new RegExp(['/Libraries/Renderer/implementations/.+\\.js$', '/Libraries/BatchedBridge/MessageQueue\\.js$', '/Libraries/YellowBox/.+\\.js$', '/Libraries/LogBox/.+\\.js$', '/Libraries/Core/Timers/.+\\.js$', 'node_modules/react-devtools-core/.+\\.js$', 'node_modules/react-refresh/.+\\.js$', 'node_modules/scheduler/.+\\.js$',
19
+ // Metro replaces `require()` with a different method,
20
+ // we want to omit this method from the stack trace.
21
+ // This is akin to most React tooling.
22
+ '/metro/.*/polyfills/require.js$',
23
+ // Hide frames related to a fast refresh.
24
+ '/metro/.*/lib/bundle-modules/.+\\.js$', 'node_modules/react-native/Libraries/Utilities/HMRClient.js$', 'node_modules/eventemitter3/index.js', 'node_modules/event-target-shim/dist/.+\\.js$',
25
+ // Ignore the log forwarder used in the expo package.
26
+ '/expo/build/logs/RemoteConsole.js$',
27
+ // Improve errors thrown by invariant (ex: `Invariant Violation: "main" has not been registered`).
28
+ 'node_modules/invariant/.+\\.js$',
29
+ // Remove babel runtime additions
30
+ 'node_modules/regenerator-runtime/.+\\.js$',
31
+ // Remove react native setImmediate ponyfill
32
+ 'node_modules/promise/setimmediate/.+\\.js$',
33
+ // Babel helpers that implement language features
34
+ 'node_modules/@babel/runtime/.+\\.js$',
35
+ // Hide Hermes internal bytecode
36
+ '/InternalBytecode/InternalBytecode\\.js$',
37
+ // Block native code invocations
38
+ `\\[native code\\]`,
39
+ // Hide react-dom (web)
40
+ 'node_modules/react-dom/.+\\.js$'].join('|'));
41
+ exports.INTERNAL_CALLSITES_REGEX = INTERNAL_CALLSITES_REGEX;
42
+ function isUrl(value) {
43
+ try {
44
+ // eslint-disable-next-line no-new
45
+ new (_url().URL)(value);
46
+ return true;
47
+ } catch {
48
+ return false;
49
+ }
50
+ }
51
+
52
+ /**
53
+ * The default frame processor. This is used to modify the stack traces.
54
+ * This method attempts to collapse all frames that aren't relevant to
55
+ * the user by default.
56
+ */
57
+ function getDefaultCustomizeFrame() {
58
+ return frame => {
59
+ if (frame.file && isUrl(frame.file)) {
60
+ return {
61
+ ...frame,
62
+ // HACK: This prevents Metro from attempting to read the invalid file URL it sent us.
63
+ lineNumber: null,
64
+ column: null,
65
+ // This prevents the invalid frame from being shown by default.
66
+ collapse: true
67
+ };
68
+ }
69
+ let collapse = Boolean(frame.file && INTERNAL_CALLSITES_REGEX.test(frame.file));
70
+ if (!collapse) {
71
+ var _frame$file;
72
+ // This represents the first frame of the stacktrace.
73
+ // Often this looks like: `__r(0);`.
74
+ // The URL will also be unactionable in the app and therefore not very useful to the developer.
75
+ if (frame.column === 3 && frame.methodName === 'global code' && (_frame$file = frame.file) !== null && _frame$file !== void 0 && _frame$file.match(/^https?:\/\//g)) {
76
+ collapse = true;
77
+ }
78
+ }
79
+ return {
80
+ ...(frame || {}),
81
+ collapse
82
+ };
83
+ };
84
+ }
85
+ //# sourceMappingURL=customizeFrame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customizeFrame.js","names":["_url","data","require","INTERNAL_CALLSITES_REGEX","RegExp","join","exports","isUrl","value","URL","getDefaultCustomizeFrame","frame","file","lineNumber","column","collapse","Boolean","test","_frame$file","methodName","match"],"sources":["../src/customizeFrame.ts"],"sourcesContent":["// Copyright 2023-present 650 Industries (Expo). All rights reserved.\nimport { SymbolicatorConfigT } from 'metro-config';\nimport { URL } from 'url';\n\ntype CustomizeFrameFunc = SymbolicatorConfigT['customizeFrame'];\n\n// Import only the types here, the values will be imported from the project, at runtime.\nexport const INTERNAL_CALLSITES_REGEX = new RegExp(\n [\n '/Libraries/Renderer/implementations/.+\\\\.js$',\n '/Libraries/BatchedBridge/MessageQueue\\\\.js$',\n '/Libraries/YellowBox/.+\\\\.js$',\n '/Libraries/LogBox/.+\\\\.js$',\n '/Libraries/Core/Timers/.+\\\\.js$',\n 'node_modules/react-devtools-core/.+\\\\.js$',\n 'node_modules/react-refresh/.+\\\\.js$',\n 'node_modules/scheduler/.+\\\\.js$',\n // Metro replaces `require()` with a different method,\n // we want to omit this method from the stack trace.\n // This is akin to most React tooling.\n '/metro/.*/polyfills/require.js$',\n // Hide frames related to a fast refresh.\n '/metro/.*/lib/bundle-modules/.+\\\\.js$',\n 'node_modules/react-native/Libraries/Utilities/HMRClient.js$',\n 'node_modules/eventemitter3/index.js',\n 'node_modules/event-target-shim/dist/.+\\\\.js$',\n // Ignore the log forwarder used in the expo package.\n '/expo/build/logs/RemoteConsole.js$',\n // Improve errors thrown by invariant (ex: `Invariant Violation: \"main\" has not been registered`).\n 'node_modules/invariant/.+\\\\.js$',\n // Remove babel runtime additions\n 'node_modules/regenerator-runtime/.+\\\\.js$',\n // Remove react native setImmediate ponyfill\n 'node_modules/promise/setimmediate/.+\\\\.js$',\n // Babel helpers that implement language features\n 'node_modules/@babel/runtime/.+\\\\.js$',\n // Hide Hermes internal bytecode\n '/InternalBytecode/InternalBytecode\\\\.js$',\n // Block native code invocations\n `\\\\[native code\\\\]`,\n // Hide react-dom (web)\n 'node_modules/react-dom/.+\\\\.js$',\n ].join('|')\n);\n\nfunction isUrl(value: string): boolean {\n try {\n // eslint-disable-next-line no-new\n new URL(value);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * The default frame processor. This is used to modify the stack traces.\n * This method attempts to collapse all frames that aren't relevant to\n * the user by default.\n */\nexport function getDefaultCustomizeFrame(): CustomizeFrameFunc {\n return (frame: Parameters<CustomizeFrameFunc>[0]) => {\n if (frame.file && isUrl(frame.file)) {\n return {\n ...frame,\n // HACK: This prevents Metro from attempting to read the invalid file URL it sent us.\n lineNumber: null,\n column: null,\n // This prevents the invalid frame from being shown by default.\n collapse: true,\n };\n }\n let collapse = Boolean(frame.file && INTERNAL_CALLSITES_REGEX.test(frame.file));\n\n if (!collapse) {\n // This represents the first frame of the stacktrace.\n // Often this looks like: `__r(0);`.\n // The URL will also be unactionable in the app and therefore not very useful to the developer.\n if (\n frame.column === 3 &&\n frame.methodName === 'global code' &&\n frame.file?.match(/^https?:\\/\\//g)\n ) {\n collapse = true;\n }\n }\n\n return { ...(frame || {}), collapse };\n };\n}\n"],"mappings":";;;;;;;AAEA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAFA;;AAMA;AACO,MAAME,wBAAwB,GAAG,IAAIC,MAAM,CAChD,CACE,8CAA8C,EAC9C,6CAA6C,EAC7C,+BAA+B,EAC/B,4BAA4B,EAC5B,iCAAiC,EACjC,2CAA2C,EAC3C,qCAAqC,EACrC,iCAAiC;AACjC;AACA;AACA;AACA,iCAAiC;AACjC;AACA,uCAAuC,EACvC,6DAA6D,EAC7D,qCAAqC,EACrC,8CAA8C;AAC9C;AACA,oCA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/** Enable debug logging */
3
+ get EXPO_DEBUG(): boolean;
4
+ /** Prevent disabling the `x_facebook_sources` non-standard sourcemap extension when `EXPO_USE_EXOTIC` is enabled. */
5
+ get EXPO_USE_FB_SOURCES(): boolean;
6
+ /** Enable the experimental "exotic" mode. [Learn more](https://blog.expo.dev/drastically-faster-bundling-in-react-native-a54f268e0ed1). */
7
+ get EXPO_USE_EXOTIC(): boolean;
8
+ /** The React Metro port that's baked into react-native scripts and tools. */
9
+ get RCT_METRO_PORT(): number;
10
+ /** Enable auto server root detection for Metro. This will change the server root to the workspace root. */
11
+ get EXPO_USE_METRO_WORKSPACE_ROOT(): boolean;
12
+ /** Disable Environment Variable injection in client bundles. */
13
+ get EXPO_NO_CLIENT_ENV_VARS(): boolean;
14
+ }
15
+ export declare const env: Env;
16
+ export {};