@expo/cli 54.1.0-canary-20251023-4c86f95 → 54.1.0-canary-20260119-17896bf

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 (186) hide show
  1. package/add-module.js +4 -1
  2. package/build/bin/cli +3 -1
  3. package/build/bin/cli.map +1 -1
  4. package/build/src/export/embed/exportEmbedAsync.js +1 -2
  5. package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
  6. package/build/src/install/applyPlugins.js +2 -1
  7. package/build/src/install/applyPlugins.js.map +1 -1
  8. package/build/src/install/fixPackages.js +1 -1
  9. package/build/src/install/fixPackages.js.map +1 -1
  10. package/build/src/install/installAsync.js +1 -1
  11. package/build/src/install/installAsync.js.map +1 -1
  12. package/build/src/install/utils/parsePackageSpecifier.js +24 -0
  13. package/build/src/install/utils/parsePackageSpecifier.js.map +1 -0
  14. package/build/src/run/ios/runIosAsync.js +8 -0
  15. package/build/src/run/ios/runIosAsync.js.map +1 -1
  16. package/build/src/start/interface/commandsTable.js.map +1 -1
  17. package/build/src/start/interface/interactiveActions.js +14 -9
  18. package/build/src/start/interface/interactiveActions.js.map +1 -1
  19. package/build/src/start/interface/startInterface.js +3 -0
  20. package/build/src/start/interface/startInterface.js.map +1 -1
  21. package/build/src/start/platforms/android/adb.js +1 -1
  22. package/build/src/start/platforms/android/adb.js.map +1 -1
  23. package/build/src/start/server/DevToolsPluginManager.js +8 -4
  24. package/build/src/start/server/DevToolsPluginManager.js.map +1 -1
  25. package/build/src/start/server/MCP.js +28 -5
  26. package/build/src/start/server/MCP.js.map +1 -1
  27. package/build/src/start/server/UrlCreator.js +1 -1
  28. package/build/src/start/server/UrlCreator.js.map +1 -1
  29. package/build/src/start/server/metro/DevToolsPluginWebsocketEndpoint.js +10 -2
  30. package/build/src/start/server/metro/DevToolsPluginWebsocketEndpoint.js.map +1 -1
  31. package/build/src/start/server/metro/MetroBundlerDevServer.js +29 -155
  32. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
  33. package/build/src/start/server/metro/MetroTerminalReporter.js +151 -33
  34. package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
  35. package/build/src/start/server/metro/createExpoAutolinkingResolver.js +1 -3
  36. package/build/src/start/server/metro/createExpoAutolinkingResolver.js.map +1 -1
  37. package/build/src/start/server/metro/createExpoFallbackResolver.js +1 -3
  38. package/build/src/start/server/metro/createExpoFallbackResolver.js.map +1 -1
  39. package/build/src/start/server/metro/createServerComponentsMiddleware.js +1 -2
  40. package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
  41. package/build/src/start/server/metro/createServerRouteMiddleware.js +2 -2
  42. package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
  43. package/build/src/start/server/metro/debugging/createDebugMiddleware.js +23 -9
  44. package/build/src/start/server/metro/debugging/createDebugMiddleware.js.map +1 -1
  45. package/build/src/start/server/metro/dev-server/compression.js +45 -0
  46. package/build/src/start/server/metro/dev-server/compression.js.map +1 -0
  47. package/build/src/start/server/metro/dev-server/createMetroMiddleware.js +2 -2
  48. package/build/src/start/server/metro/dev-server/createMetroMiddleware.js.map +1 -1
  49. package/build/src/start/server/metro/externals.js +11 -0
  50. package/build/src/start/server/metro/externals.js.map +1 -1
  51. package/build/src/start/server/metro/fetchRouterManifest.js +1 -1
  52. package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
  53. package/build/src/start/server/metro/instantiateMetro.js +98 -27
  54. package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
  55. package/build/src/start/server/metro/log-box/LogBoxLog.js +7 -11
  56. package/build/src/start/server/metro/log-box/LogBoxLog.js.map +1 -1
  57. package/build/src/start/server/metro/log-box/LogBoxSymbolication.js.map +1 -1
  58. package/build/src/start/server/metro/metroErrorInterface.js +43 -14
  59. package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
  60. package/build/src/start/server/metro/withMetroMultiPlatform.js +74 -57
  61. package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
  62. package/build/src/start/server/middleware/CorsMiddleware.js +43 -12
  63. package/build/src/start/server/middleware/CorsMiddleware.js.map +1 -1
  64. package/build/src/start/server/middleware/CreateFileMiddleware.js +63 -24
  65. package/build/src/start/server/middleware/CreateFileMiddleware.js.map +1 -1
  66. package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +3 -1
  67. package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
  68. package/build/src/start/server/middleware/ManifestMiddleware.js +14 -9
  69. package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
  70. package/build/src/start/startAsync.js +12 -9
  71. package/build/src/start/startAsync.js.map +1 -1
  72. package/build/src/utils/env.js +36 -2
  73. package/build/src/utils/env.js.map +1 -1
  74. package/build/src/utils/interactive.js +1 -1
  75. package/build/src/utils/interactive.js.map +1 -1
  76. package/build/src/utils/jsonl.js +243 -0
  77. package/build/src/utils/jsonl.js.map +1 -0
  78. package/build/src/utils/net.js +43 -0
  79. package/build/src/utils/net.js.map +1 -0
  80. package/build/src/utils/progress.js +5 -0
  81. package/build/src/utils/progress.js.map +1 -1
  82. package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
  83. package/build/src/utils/telemetry/utils/context.js +1 -1
  84. package/build/src/utils/url.js +4 -8
  85. package/build/src/utils/url.js.map +1 -1
  86. package/package.json +25 -28
  87. package/static/canary/react-is/cjs/react-is.development.js +133 -0
  88. package/static/canary/react-is/cjs/react-is.production.js +130 -0
  89. package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-dev.js +16820 -0
  90. package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-prod.js +10552 -0
  91. package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-profiling.js +11255 -0
  92. package/static/canary/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +17064 -0
  93. package/static/canary/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +10742 -0
  94. package/static/canary/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +11450 -0
  95. package/static/canary/scheduler/cjs/scheduler-unstable_mock.development.js +414 -0
  96. package/static/canary/scheduler/cjs/scheduler-unstable_mock.production.js +406 -0
  97. package/static/canary/scheduler/cjs/scheduler-unstable_post_task.development.js +150 -0
  98. package/static/canary/scheduler/cjs/scheduler-unstable_post_task.production.js +140 -0
  99. package/static/canary/scheduler/cjs/scheduler.development.js +364 -0
  100. package/static/canary/scheduler/cjs/scheduler.native.development.js +350 -0
  101. package/static/canary/scheduler/cjs/scheduler.native.production.js +330 -0
  102. package/static/canary/scheduler/cjs/scheduler.production.js +340 -0
  103. package/static/canary-full/node_modules/react/LICENSE +21 -0
  104. package/static/canary-full/node_modules/react/README.md +37 -0
  105. package/static/canary-full/node_modules/react/cjs/react-compiler-runtime.development.js +24 -0
  106. package/static/canary-full/node_modules/react/cjs/react-compiler-runtime.production.js +16 -0
  107. package/static/canary-full/node_modules/react/cjs/react-compiler-runtime.profiling.js +16 -0
  108. package/static/canary-full/node_modules/react/cjs/react-jsx-dev-runtime.development.js +349 -0
  109. package/static/canary-full/node_modules/react/cjs/react-jsx-dev-runtime.production.js +14 -0
  110. package/static/canary-full/node_modules/react/cjs/react-jsx-dev-runtime.profiling.js +14 -0
  111. package/static/canary-full/node_modules/react/cjs/react-jsx-dev-runtime.react-server.development.js +385 -0
  112. package/static/canary-full/node_modules/react/cjs/react-jsx-dev-runtime.react-server.production.js +40 -0
  113. package/static/canary-full/node_modules/react/cjs/react-jsx-runtime.development.js +358 -0
  114. package/static/canary-full/node_modules/react/cjs/react-jsx-runtime.production.js +34 -0
  115. package/static/canary-full/node_modules/react/cjs/react-jsx-runtime.profiling.js +34 -0
  116. package/static/canary-full/node_modules/react/cjs/react-jsx-runtime.react-server.development.js +385 -0
  117. package/static/canary-full/node_modules/react/cjs/react-jsx-runtime.react-server.production.js +40 -0
  118. package/static/canary-full/node_modules/react/cjs/react.development.js +1250 -0
  119. package/static/canary-full/node_modules/react/cjs/react.production.js +544 -0
  120. package/static/canary-full/node_modules/react/cjs/react.react-server.development.js +815 -0
  121. package/static/canary-full/node_modules/react/cjs/react.react-server.production.js +429 -0
  122. package/static/canary-full/node_modules/react/compiler-runtime.js +14 -0
  123. package/static/canary-full/node_modules/react/index.js +7 -0
  124. package/static/canary-full/node_modules/react/jsx-dev-runtime.js +7 -0
  125. package/static/canary-full/node_modules/react/jsx-dev-runtime.react-server.js +7 -0
  126. package/static/canary-full/node_modules/react/jsx-runtime.js +7 -0
  127. package/static/canary-full/node_modules/react/jsx-runtime.react-server.js +7 -0
  128. package/static/canary-full/node_modules/react/package.json +51 -0
  129. package/static/canary-full/node_modules/react/react.react-server.js +7 -0
  130. package/static/canary-full/node_modules/react-dom/LICENSE +21 -0
  131. package/static/canary-full/node_modules/react-dom/README.md +60 -0
  132. package/static/canary-full/node_modules/react-dom/cjs/react-dom-client.development.js +25089 -0
  133. package/static/canary-full/node_modules/react-dom/cjs/react-dom-client.production.js +15426 -0
  134. package/static/canary-full/node_modules/react-dom/cjs/react-dom-profiling.development.js +25476 -0
  135. package/static/canary-full/node_modules/react-dom/cjs/react-dom-profiling.profiling.js +16296 -0
  136. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js +9035 -0
  137. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.js +5892 -0
  138. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.js +9035 -0
  139. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.js +5972 -0
  140. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.browser.development.js +9424 -0
  141. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.browser.production.js +6384 -0
  142. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.bun.development.js +8739 -0
  143. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.bun.production.js +5967 -0
  144. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.edge.development.js +9443 -0
  145. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.edge.production.js +6477 -0
  146. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.node.development.js +9317 -0
  147. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.node.production.js +6372 -0
  148. package/static/canary-full/node_modules/react-dom/cjs/react-dom-test-utils.development.js +24 -0
  149. package/static/canary-full/node_modules/react-dom/cjs/react-dom-test-utils.production.js +21 -0
  150. package/static/canary-full/node_modules/react-dom/cjs/react-dom.development.js +424 -0
  151. package/static/canary-full/node_modules/react-dom/cjs/react-dom.production.js +210 -0
  152. package/static/canary-full/node_modules/react-dom/cjs/react-dom.react-server.development.js +340 -0
  153. package/static/canary-full/node_modules/react-dom/cjs/react-dom.react-server.production.js +152 -0
  154. package/static/canary-full/node_modules/react-dom/client.js +38 -0
  155. package/static/canary-full/node_modules/react-dom/client.react-server.js +5 -0
  156. package/static/canary-full/node_modules/react-dom/index.js +38 -0
  157. package/static/canary-full/node_modules/react-dom/package.json +117 -0
  158. package/static/canary-full/node_modules/react-dom/profiling.js +38 -0
  159. package/static/canary-full/node_modules/react-dom/profiling.react-server.js +5 -0
  160. package/static/canary-full/node_modules/react-dom/react-dom.react-server.js +7 -0
  161. package/static/canary-full/node_modules/react-dom/server.browser.js +18 -0
  162. package/static/canary-full/node_modules/react-dom/server.bun.js +19 -0
  163. package/static/canary-full/node_modules/react-dom/server.edge.js +19 -0
  164. package/static/canary-full/node_modules/react-dom/server.js +3 -0
  165. package/static/canary-full/node_modules/react-dom/server.node.js +18 -0
  166. package/static/canary-full/node_modules/react-dom/server.react-server.js +5 -0
  167. package/static/canary-full/node_modules/react-dom/static.browser.js +12 -0
  168. package/static/canary-full/node_modules/react-dom/static.edge.js +12 -0
  169. package/static/canary-full/node_modules/react-dom/static.js +3 -0
  170. package/static/canary-full/node_modules/react-dom/static.node.js +12 -0
  171. package/static/canary-full/node_modules/react-dom/static.react-server.js +5 -0
  172. package/static/canary-full/node_modules/react-dom/test-utils.js +7 -0
  173. package/build/src/start/interface/cliExtensionMenuItemHandler.js +0 -173
  174. package/build/src/start/interface/cliExtensionMenuItemHandler.js.map +0 -1
  175. package/build/src/start/interface/createDevToolsMenuItems.js +0 -159
  176. package/build/src/start/interface/createDevToolsMenuItems.js.map +0 -1
  177. package/build/src/start/server/DevToolsPlugin.js +0 -60
  178. package/build/src/start/server/DevToolsPlugin.js.map +0 -1
  179. package/build/src/start/server/DevToolsPlugin.schema.js +0 -79
  180. package/build/src/start/server/DevToolsPlugin.schema.js.map +0 -1
  181. package/build/src/start/server/DevToolsPluginCliExtensionExecutor.js +0 -119
  182. package/build/src/start/server/DevToolsPluginCliExtensionExecutor.js.map +0 -1
  183. package/build/src/start/server/DevToolsPluginCliExtensionResults.js +0 -61
  184. package/build/src/start/server/DevToolsPluginCliExtensionResults.js.map +0 -1
  185. package/build/src/start/server/middleware/DataLoaderModuleMiddleware.js +0 -75
  186. package/build/src/start/server/middleware/DataLoaderModuleMiddleware.js.map +0 -1
@@ -17,6 +17,9 @@ _export(exports, {
17
17
  },
18
18
  loadMetroConfigAsync: function() {
19
19
  return loadMetroConfigAsync;
20
+ },
21
+ overrideExpoMetroCacheStores: function() {
22
+ return overrideExpoMetroCacheStores;
20
23
  }
21
24
  });
22
25
  function _config() {
@@ -68,6 +71,13 @@ function _metroconfig1() {
68
71
  };
69
72
  return data;
70
73
  }
74
+ function _filestore() {
75
+ const data = require("@expo/metro-config/file-store");
76
+ _filestore = function() {
77
+ return data;
78
+ };
79
+ return data;
80
+ }
71
81
  function _chalk() {
72
82
  const data = /*#__PURE__*/ _interop_require_default(require("chalk"));
73
83
  _chalk = function() {
@@ -75,6 +85,13 @@ function _chalk() {
75
85
  };
76
86
  return data;
77
87
  }
88
+ function _fs() {
89
+ const data = /*#__PURE__*/ _interop_require_default(require("fs"));
90
+ _fs = function() {
91
+ return data;
92
+ };
93
+ return data;
94
+ }
78
95
  function _path() {
79
96
  const data = /*#__PURE__*/ _interop_require_default(require("path"));
80
97
  _path = function() {
@@ -124,7 +141,7 @@ class LogRespectingTerminal extends _metrocore().Terminal {
124
141
  // Share one instance of Terminal for all instances of Metro.
125
142
  const terminal = new LogRespectingTerminal(process.stdout);
126
143
  async function loadMetroConfigAsync(projectRoot, options, { exp, isExporting, getMetroBundler }) {
127
- var _exp_experiments, _exp_experiments1, _exp_experiments2, _exp_experiments3, _config_resolver, _exp_experiments4, _exp_experiments5, _exp_experiments6;
144
+ var _exp_experiments, _exp_experiments1, _exp_experiments2, _exp_experiments3, _exp_experiments4, _config_resolver, _exp_experiments5, _exp_experiments6, _exp_experiments7;
128
145
  let reportEvent;
129
146
  const autolinkingModuleResolutionEnabled = ((_exp_experiments = exp.experiments) == null ? void 0 : _exp_experiments.autolinkingModuleResolution) ?? _env.env.EXPO_USE_STICKY_RESOLVER;
130
147
  const serverActionsEnabled = ((_exp_experiments1 = exp.experiments) == null ? void 0 : _exp_experiments1.reactServerFunctions) ?? _env.env.EXPO_UNSTABLE_SERVER_FUNCTIONS;
@@ -135,19 +152,30 @@ async function loadMetroConfigAsync(projectRoot, options, { exp, isExporting, ge
135
152
  if (((_exp_experiments2 = exp.experiments) == null ? void 0 : _exp_experiments2.reactServerComponentRoutes) || serverActionsEnabled) {
136
153
  process.env.EXPO_USE_METRO_REQUIRE = '1';
137
154
  }
138
- if ((_exp_experiments3 = exp.experiments) == null ? void 0 : _exp_experiments3.reactCanary) {
139
- _log.Log.warn(`React 19 is enabled by default. Remove unused experiments.reactCanary flag.`);
140
- }
155
+ const isReactCanaryEnabled = (((_exp_experiments3 = exp.experiments) == null ? void 0 : _exp_experiments3.reactServerComponentRoutes) || serverActionsEnabled || ((_exp_experiments4 = exp.experiments) == null ? void 0 : _exp_experiments4.reactCanary)) ?? false;
141
156
  const serverRoot = (0, _paths().getMetroServerRoot)(projectRoot);
142
157
  const terminalReporter = new _MetroTerminalReporter.MetroTerminalReporter(serverRoot, terminal);
143
- const hasConfig = await (0, _metroconfig().resolveConfig)(options.config, projectRoot);
144
- let config = {
145
- ...await (0, _metroconfig().loadConfig)({
146
- cwd: projectRoot,
147
- projectRoot,
148
- ...options
149
- }, // If the project does not have a metro.config.js, then we use the default config.
150
- hasConfig.isEmpty ? (0, _metroconfig1().getDefaultConfig)(projectRoot) : undefined),
158
+ // NOTE: Allow external tools to override the metro config. This is considered internal and unstable
159
+ const configPath = _env.env.EXPO_OVERRIDE_METRO_CONFIG ?? undefined;
160
+ const resolvedConfig = await (0, _metroconfig().resolveConfig)(configPath, projectRoot);
161
+ const defaultConfig = (0, _metroconfig1().getDefaultConfig)(projectRoot);
162
+ let config = resolvedConfig.isEmpty ? defaultConfig : await (0, _metroconfig().mergeConfig)(defaultConfig, resolvedConfig.config);
163
+ // Set the watchfolders to include the projectRoot, as Metro assumes this
164
+ // Force-override the reporter
165
+ config = {
166
+ ...config,
167
+ // See: `overrideConfigWithArguments` https://github.com/facebook/metro/blob/5059e26/packages/metro-config/src/loadConfig.js#L274-L339
168
+ // Compare to `LoadOptions` type (disregard `reporter` as we don't expose this)
169
+ resetCache: !!options.resetCache,
170
+ maxWorkers: options.maxWorkers ?? config.maxWorkers,
171
+ server: {
172
+ ...config.server,
173
+ port: options.port ?? config.server.port
174
+ },
175
+ watchFolders: !config.watchFolders.includes(config.projectRoot) ? [
176
+ config.projectRoot,
177
+ ...config.watchFolders
178
+ ] : config.watchFolders,
151
179
  reporter: {
152
180
  update (event) {
153
181
  terminalReporter.update(event);
@@ -157,19 +185,22 @@ async function loadMetroConfigAsync(projectRoot, options, { exp, isExporting, ge
157
185
  }
158
186
  }
159
187
  };
188
+ overrideExpoMetroCacheStores(config, {
189
+ projectRoot
190
+ });
160
191
  // @ts-expect-error: Set the global require cycle ignore patterns for SSR bundles. This won't work with custom global prefixes, but we don't use those.
161
192
  globalThis.__requireCycleIgnorePatterns = (_config_resolver = config.resolver) == null ? void 0 : _config_resolver.requireCycleIgnorePatterns;
162
193
  if (isExporting) {
163
- var _exp_experiments7;
194
+ var _exp_experiments8;
164
195
  // This token will be used in the asset plugin to ensure the path is correct for writing locally.
165
196
  // @ts-expect-error: typed as readonly.
166
- config.transformer.publicPath = `/assets?export_path=${(((_exp_experiments7 = exp.experiments) == null ? void 0 : _exp_experiments7.baseUrl) ?? '') + '/assets'}`;
197
+ config.transformer.publicPath = `/assets?export_path=${(((_exp_experiments8 = exp.experiments) == null ? void 0 : _exp_experiments8.baseUrl) ?? '') + '/assets'}`;
167
198
  } else {
168
199
  // @ts-expect-error: typed as readonly
169
200
  config.transformer.publicPath = '/assets/?unstable_path=.';
170
201
  }
171
202
  const platformBundlers = (0, _platformBundlers.getPlatformBundlers)(projectRoot, exp);
172
- if ((_exp_experiments4 = exp.experiments) == null ? void 0 : _exp_experiments4.reactCompiler) {
203
+ if ((_exp_experiments5 = exp.experiments) == null ? void 0 : _exp_experiments5.reactCompiler) {
173
204
  _log.Log.log(_chalk().default.gray`React Compiler enabled`);
174
205
  }
175
206
  if (_env.env.EXPO_UNSTABLE_TREE_SHAKING && !_env.env.EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH) {
@@ -184,26 +215,24 @@ async function loadMetroConfigAsync(projectRoot, options, { exp, isExporting, ge
184
215
  if (_env.env.EXPO_UNSTABLE_TREE_SHAKING) {
185
216
  _log.Log.warn(`Experimental tree shaking is enabled.`);
186
217
  }
187
- if (_env.env.EXPO_UNSTABLE_LOG_BOX) {
188
- _log.Log.warn(`Experimental Expo LogBox is enabled.`);
189
- }
190
218
  if (autolinkingModuleResolutionEnabled) {
191
219
  _log.Log.warn(`Experimental Expo Autolinking module resolver is enabled.`);
192
220
  }
193
221
  if (serverActionsEnabled) {
194
- var _exp_experiments8;
195
- _log.Log.warn(`React Server Functions (beta) are enabled. Route rendering mode: ${((_exp_experiments8 = exp.experiments) == null ? void 0 : _exp_experiments8.reactServerComponentRoutes) ? 'server' : 'client'}`);
222
+ var _exp_experiments9;
223
+ _log.Log.warn(`React Server Functions (beta) are enabled. Route rendering mode: ${((_exp_experiments9 = exp.experiments) == null ? void 0 : _exp_experiments9.reactServerComponentRoutes) ? 'server' : 'client'}`);
196
224
  }
197
225
  config = await (0, _withMetroMultiPlatform.withMetroMultiPlatformAsync)(projectRoot, {
198
226
  config,
199
227
  exp,
200
228
  platformBundlers,
201
- isTsconfigPathsEnabled: ((_exp_experiments5 = exp.experiments) == null ? void 0 : _exp_experiments5.tsconfigPaths) ?? true,
229
+ isTsconfigPathsEnabled: ((_exp_experiments6 = exp.experiments) == null ? void 0 : _exp_experiments6.tsconfigPaths) ?? true,
202
230
  isAutolinkingResolverEnabled: autolinkingModuleResolutionEnabled,
203
231
  isFastResolverEnabled: _env.env.EXPO_USE_FAST_RESOLVER,
204
232
  isExporting,
233
+ isReactCanaryEnabled,
205
234
  isNamedRequiresEnabled: _env.env.EXPO_USE_METRO_REQUIRE,
206
- isReactServerComponentsEnabled: !!((_exp_experiments6 = exp.experiments) == null ? void 0 : _exp_experiments6.reactServerComponentRoutes),
235
+ isReactServerComponentsEnabled: !!((_exp_experiments7 = exp.experiments) == null ? void 0 : _exp_experiments7.reactServerComponentRoutes),
207
236
  getMetroBundler
208
237
  });
209
238
  return {
@@ -225,11 +254,20 @@ async function instantiateMetroAsync(metroBundler, options, { isExporting, exp =
225
254
  });
226
255
  // Create the core middleware stack for Metro, including websocket listeners
227
256
  const { middleware, messagesSocket, eventsSocket, websocketEndpoints } = (0, _createMetroMiddleware.createMetroMiddleware)(metroConfig);
257
+ // Get local URL to Metro bundler server (typically configured as 127.0.0.1:8081)
258
+ const serverBaseUrl = metroBundler.getUrlCreator().constructUrl({
259
+ scheme: 'http',
260
+ hostType: 'localhost'
261
+ });
228
262
  if (!isExporting) {
229
263
  // Enable correct CORS headers for Expo Router features
230
264
  (0, _mutations.prependMiddleware)(middleware, (0, _CorsMiddleware.createCorsMiddleware)(exp));
231
265
  // Enable debug middleware for CDP-related debugging
232
- const { debugMiddleware, debugWebsocketEndpoints } = (0, _createDebugMiddleware.createDebugMiddleware)(metroBundler, reporter);
266
+ const { debugMiddleware, debugWebsocketEndpoints } = (0, _createDebugMiddleware.createDebugMiddleware)({
267
+ projectRoot: metroBundler.projectRoot,
268
+ serverBaseUrl,
269
+ reporter
270
+ });
233
271
  Object.assign(websocketEndpoints, debugWebsocketEndpoints);
234
272
  middleware.use(debugMiddleware);
235
273
  middleware.use('/_expo/debugger', (0, _createJsInspectorMiddleware.createJsInspectorMiddleware)());
@@ -244,6 +282,10 @@ async function instantiateMetroAsync(metroBundler, options, { isExporting, exp =
244
282
  }
245
283
  return middleware.use(metroMiddleware);
246
284
  };
285
+ const devtoolsWebsocketEndpoints = (0, _DevToolsPluginWebsocketEndpoint.createDevToolsPluginWebsocketEndpoint)({
286
+ serverBaseUrl
287
+ });
288
+ Object.assign(websocketEndpoints, devtoolsWebsocketEndpoints);
247
289
  }
248
290
  // Attach Expo Atlas if enabled
249
291
  await (0, _attachAtlas.attachAtlasAsync)({
@@ -256,10 +298,7 @@ async function instantiateMetroAsync(metroBundler, options, { isExporting, exp =
256
298
  resetAtlasFile: isExporting
257
299
  });
258
300
  const { server, hmrServer, metro } = await (0, _runServerfork.runServer)(metroBundler, metroConfig, {
259
- websocketEndpoints: {
260
- ...websocketEndpoints,
261
- ...(0, _DevToolsPluginWebsocketEndpoint.createDevToolsPluginWebsocketEndpoint)()
262
- },
301
+ websocketEndpoints,
263
302
  watch: !isExporting && isWatchEnabled()
264
303
  }, {
265
304
  mockServer: isExporting
@@ -409,5 +448,37 @@ function isWatchEnabled() {
409
448
  }
410
449
  return !_env.env.CI;
411
450
  }
451
+ async function overrideExpoMetroCacheStores(config, { projectRoot }) {
452
+ var _config_cacheStores;
453
+ if (!_env.env.EXPO_METRO_CACHE_STORES_DIR) {
454
+ return;
455
+ }
456
+ // Resolve relative paths to absolute paths based on project root
457
+ const cacheStoresDir = _path().default.isAbsolute(_env.env.EXPO_METRO_CACHE_STORES_DIR) ? _env.env.EXPO_METRO_CACHE_STORES_DIR : _path().default.resolve(projectRoot, _env.env.EXPO_METRO_CACHE_STORES_DIR);
458
+ // Create the directory if it doesn't exist
459
+ try {
460
+ await _fs().default.promises.mkdir(cacheStoresDir, {
461
+ recursive: true
462
+ });
463
+ } catch (error) {
464
+ if (error.code !== 'EEXIST') {
465
+ _log.Log.error(`Provided EXPO_METRO_CACHE_STORES_DIR="${cacheStoresDir}" is not a directory. Use new or existing directory path.`);
466
+ throw error;
467
+ }
468
+ }
469
+ // Check if user has custom cacheStores in their metro.config.js
470
+ if ((_config_cacheStores = config.cacheStores) == null ? void 0 : _config_cacheStores.length) {
471
+ _log.Log.warn(`Using EXPO_METRO_CACHE_STORES_DIR="${cacheStoresDir}" which overrides cacheStores from metro.config.js`);
472
+ } else {
473
+ _log.Log.log(_chalk().default.gray(`Using Metro cache directory: ${cacheStoresDir}`));
474
+ }
475
+ // Override cacheStores with the env-specified directory
476
+ // @ts-expect-error - cacheStores is a read-only property
477
+ config.cacheStores = [
478
+ new (_filestore()).FileStore({
479
+ root: cacheStoresDir
480
+ })
481
+ ];
482
+ }
412
483
 
413
484
  //# sourceMappingURL=instantiateMetro.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/server/metro/instantiateMetro.ts"],"sourcesContent":["import { type ExpoConfig, getConfig } from '@expo/config';\nimport { getMetroServerRoot } from '@expo/config/paths';\nimport type Bundler from '@expo/metro/metro/Bundler';\nimport type { ReadOnlyGraph } from '@expo/metro/metro/DeltaBundler';\nimport type { TransformOptions } from '@expo/metro/metro/DeltaBundler/Worker';\nimport MetroHmrServer, { Client as MetroHmrClient } from '@expo/metro/metro/HmrServer';\nimport RevisionNotFoundError from '@expo/metro/metro/IncrementalBundler/RevisionNotFoundError';\nimport type MetroServer from '@expo/metro/metro/Server';\nimport formatBundlingError from '@expo/metro/metro/lib/formatBundlingError';\nimport { loadConfig, resolveConfig, type ConfigT } from '@expo/metro/metro-config';\nimport { Terminal } from '@expo/metro/metro-core';\nimport { getDefaultConfig, type LoadOptions } from '@expo/metro-config';\nimport chalk from 'chalk';\nimport http from 'http';\nimport path from 'path';\n\nimport { createDevToolsPluginWebsocketEndpoint } from './DevToolsPluginWebsocketEndpoint';\nimport { MetroBundlerDevServer } from './MetroBundlerDevServer';\nimport { MetroTerminalReporter } from './MetroTerminalReporter';\nimport { attachAtlasAsync } from './debugging/attachAtlas';\nimport { createDebugMiddleware } from './debugging/createDebugMiddleware';\nimport { createMetroMiddleware } from './dev-server/createMetroMiddleware';\nimport { runServer } from './runServer-fork';\nimport { withMetroMultiPlatformAsync } from './withMetroMultiPlatform';\nimport { Log } from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { createCorsMiddleware } from '../middleware/CorsMiddleware';\nimport { createJsInspectorMiddleware } from '../middleware/inspector/createJsInspectorMiddleware';\nimport { prependMiddleware } from '../middleware/mutations';\nimport { getPlatformBundlers } from '../platformBundlers';\n\n// From expo/dev-server but with ability to use custom logger.\ntype MessageSocket = {\n broadcast: (method: string, params?: Record<string, any> | undefined) => void;\n};\n\n// Wrap terminal and polyfill console.log so we can log during bundling without breaking the indicator.\nclass LogRespectingTerminal extends Terminal {\n constructor(stream: import('node:net').Socket | import('node:stream').Writable) {\n super(stream, { ttyPrint: true });\n\n const sendLog = (...msg: any[]) => {\n if (!msg.length) {\n this.log('');\n } else {\n const [format, ...args] = msg;\n this.log(format, ...args);\n }\n // Flush the logs to the terminal immediately so logs at the end of the process are not lost.\n this.flush();\n };\n\n console.log = sendLog;\n console.info = sendLog;\n }\n}\n\n// Share one instance of Terminal for all instances of Metro.\nconst terminal = new LogRespectingTerminal(process.stdout);\n\nexport async function loadMetroConfigAsync(\n projectRoot: string,\n options: LoadOptions,\n {\n exp,\n isExporting,\n getMetroBundler,\n }: { exp: ExpoConfig; isExporting: boolean; getMetroBundler: () => Bundler }\n) {\n let reportEvent: ((event: any) => void) | undefined;\n\n const autolinkingModuleResolutionEnabled =\n exp.experiments?.autolinkingModuleResolution ?? env.EXPO_USE_STICKY_RESOLVER;\n\n const serverActionsEnabled =\n exp.experiments?.reactServerFunctions ?? env.EXPO_UNSTABLE_SERVER_FUNCTIONS;\n\n if (serverActionsEnabled) {\n process.env.EXPO_UNSTABLE_SERVER_FUNCTIONS = '1';\n }\n\n // NOTE: Enable all the experimental Metro flags when RSC is enabled.\n if (exp.experiments?.reactServerComponentRoutes || serverActionsEnabled) {\n process.env.EXPO_USE_METRO_REQUIRE = '1';\n }\n\n if (exp.experiments?.reactCanary) {\n Log.warn(`React 19 is enabled by default. Remove unused experiments.reactCanary flag.`);\n }\n\n const serverRoot = getMetroServerRoot(projectRoot);\n const terminalReporter = new MetroTerminalReporter(serverRoot, terminal);\n\n const hasConfig = await resolveConfig(options.config, projectRoot);\n let config: ConfigT = {\n ...(await loadConfig(\n { cwd: projectRoot, projectRoot, ...options },\n // If the project does not have a metro.config.js, then we use the default config.\n hasConfig.isEmpty ? getDefaultConfig(projectRoot) : undefined\n )),\n reporter: {\n update(event: any) {\n terminalReporter.update(event);\n if (reportEvent) {\n reportEvent(event);\n }\n },\n },\n };\n\n // @ts-expect-error: Set the global require cycle ignore patterns for SSR bundles. This won't work with custom global prefixes, but we don't use those.\n globalThis.__requireCycleIgnorePatterns = config.resolver?.requireCycleIgnorePatterns;\n\n if (isExporting) {\n // This token will be used in the asset plugin to ensure the path is correct for writing locally.\n // @ts-expect-error: typed as readonly.\n config.transformer.publicPath = `/assets?export_path=${\n (exp.experiments?.baseUrl ?? '') + '/assets'\n }`;\n } else {\n // @ts-expect-error: typed as readonly\n config.transformer.publicPath = '/assets/?unstable_path=.';\n }\n\n const platformBundlers = getPlatformBundlers(projectRoot, exp);\n\n if (exp.experiments?.reactCompiler) {\n Log.log(chalk.gray`React Compiler enabled`);\n }\n\n if (env.EXPO_UNSTABLE_TREE_SHAKING && !env.EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH) {\n throw new CommandError(\n 'EXPO_UNSTABLE_TREE_SHAKING requires EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH to be enabled.'\n );\n }\n\n if (env.EXPO_UNSTABLE_TREE_SHAKING) {\n Log.warn(`Experimental fast resolver is enabled.`);\n }\n if (env.EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH) {\n Log.warn(`Experimental bundle optimization is enabled.`);\n }\n if (env.EXPO_UNSTABLE_TREE_SHAKING) {\n Log.warn(`Experimental tree shaking is enabled.`);\n }\n if (env.EXPO_UNSTABLE_LOG_BOX) {\n Log.warn(`Experimental Expo LogBox is enabled.`);\n }\n if (autolinkingModuleResolutionEnabled) {\n Log.warn(`Experimental Expo Autolinking module resolver is enabled.`);\n }\n\n if (serverActionsEnabled) {\n Log.warn(\n `React Server Functions (beta) are enabled. Route rendering mode: ${exp.experiments?.reactServerComponentRoutes ? 'server' : 'client'}`\n );\n }\n\n config = await withMetroMultiPlatformAsync(projectRoot, {\n config,\n exp,\n platformBundlers,\n isTsconfigPathsEnabled: exp.experiments?.tsconfigPaths ?? true,\n isAutolinkingResolverEnabled: autolinkingModuleResolutionEnabled,\n isFastResolverEnabled: env.EXPO_USE_FAST_RESOLVER,\n isExporting,\n isNamedRequiresEnabled: env.EXPO_USE_METRO_REQUIRE,\n isReactServerComponentsEnabled: !!exp.experiments?.reactServerComponentRoutes,\n getMetroBundler,\n });\n\n return {\n config,\n setEventReporter: (logger: (event: any) => void) => (reportEvent = logger),\n reporter: terminalReporter,\n };\n}\n\n/** The most generic possible setup for Metro bundler. */\nexport async function instantiateMetroAsync(\n metroBundler: MetroBundlerDevServer,\n options: Omit<LoadOptions, 'logger'>,\n {\n isExporting,\n exp = getConfig(metroBundler.projectRoot, {\n skipSDKVersionRequirement: true,\n }).exp,\n }: { isExporting: boolean; exp?: ExpoConfig }\n): Promise<{\n metro: MetroServer;\n hmrServer: MetroHmrServer<MetroHmrClient> | null;\n server: http.Server;\n middleware: any;\n messageSocket: MessageSocket;\n}> {\n const projectRoot = metroBundler.projectRoot;\n\n const {\n config: metroConfig,\n setEventReporter,\n reporter,\n } = await loadMetroConfigAsync(projectRoot, options, {\n exp,\n isExporting,\n getMetroBundler() {\n return metro.getBundler().getBundler();\n },\n });\n\n // Create the core middleware stack for Metro, including websocket listeners\n const { middleware, messagesSocket, eventsSocket, websocketEndpoints } =\n createMetroMiddleware(metroConfig);\n\n if (!isExporting) {\n // Enable correct CORS headers for Expo Router features\n prependMiddleware(middleware, createCorsMiddleware(exp));\n\n // Enable debug middleware for CDP-related debugging\n const { debugMiddleware, debugWebsocketEndpoints } = createDebugMiddleware(\n metroBundler,\n reporter\n );\n Object.assign(websocketEndpoints, debugWebsocketEndpoints);\n middleware.use(debugMiddleware);\n middleware.use('/_expo/debugger', createJsInspectorMiddleware());\n\n // TODO(cedric): `enhanceMiddleware` is deprecated, but is currently used to unify the middleware stacks\n // See: https://github.com/facebook/metro/commit/22e85fde85ec454792a1b70eba4253747a2587a9\n // See: https://github.com/facebook/metro/commit/d0d554381f119bb80ab09dbd6a1d310b54737e52\n const customEnhanceMiddleware = metroConfig.server.enhanceMiddleware;\n // @ts-expect-error: can't mutate readonly config\n metroConfig.server.enhanceMiddleware = (metroMiddleware: any, server: MetroServer) => {\n if (customEnhanceMiddleware) {\n metroMiddleware = customEnhanceMiddleware(metroMiddleware, server);\n }\n return middleware.use(metroMiddleware);\n };\n }\n\n // Attach Expo Atlas if enabled\n await attachAtlasAsync({\n isExporting,\n exp,\n projectRoot,\n middleware,\n metroConfig,\n // NOTE(cedric): reset the Atlas file once, and reuse it for static exports\n resetAtlasFile: isExporting,\n });\n\n const { server, hmrServer, metro } = await runServer(\n metroBundler,\n metroConfig,\n {\n websocketEndpoints: {\n ...websocketEndpoints,\n ...createDevToolsPluginWebsocketEndpoint(),\n },\n watch: !isExporting && isWatchEnabled(),\n },\n {\n mockServer: isExporting,\n }\n );\n\n // Patch transform file to remove inconvenient customTransformOptions which are only used in single well-known files.\n const originalTransformFile = metro\n .getBundler()\n .getBundler()\n .transformFile.bind(metro.getBundler().getBundler());\n\n metro.getBundler().getBundler().transformFile = async function (\n filePath: string,\n transformOptions: TransformOptions,\n fileBuffer?: Buffer\n ) {\n return originalTransformFile(\n filePath,\n pruneCustomTransformOptions(\n filePath,\n // Clone the options so we don't mutate the original.\n {\n ...transformOptions,\n customTransformOptions: {\n __proto__: null,\n ...transformOptions.customTransformOptions,\n },\n }\n ),\n fileBuffer\n );\n };\n\n setEventReporter(eventsSocket.reportMetroEvent);\n\n // This function ensures that modules in source maps are sorted in the same\n // order as in a plain JS bundle.\n metro._getSortedModules = function (this: MetroServer, graph: ReadOnlyGraph) {\n const modules = [...graph.dependencies.values()];\n\n const ctx = {\n platform: graph.transformOptions.platform,\n environment: graph.transformOptions.customTransformOptions?.environment,\n };\n // Assign IDs to modules in a consistent order\n for (const module of modules) {\n // @ts-expect-error\n this._createModuleId(module.path, ctx);\n }\n // Sort by IDs\n return modules.sort(\n // @ts-expect-error\n (a, b) => this._createModuleId(a.path, ctx) - this._createModuleId(b.path, ctx)\n );\n };\n\n if (hmrServer) {\n let hmrJSBundle:\n | typeof import('@expo/metro-config/build/serializer/fork/hmrJSBundle').default\n | typeof import('@expo/metro/metro/DeltaBundler/Serializers/hmrJSBundle').default;\n\n try {\n hmrJSBundle = require('@expo/metro-config/build/serializer/fork/hmrJSBundle').default;\n } catch {\n // TODO: Add fallback for monorepo tests up until the fork is merged.\n Log.warn('Failed to load HMR serializer from @expo/metro-config, using fallback version.');\n hmrJSBundle = require('@expo/metro/metro/DeltaBundler/Serializers/hmrJSBundle');\n }\n\n // Patch HMR Server to send more info to the `_createModuleId` function for deterministic module IDs and add support for serializing HMR updates the same as all other bundles.\n hmrServer._prepareMessage = async function (\n this: MetroHmrServer<MetroHmrClient>,\n group,\n options,\n changeEvent\n ) {\n // Fork of https://github.com/facebook/metro/blob/3b3e0aaf725cfa6907bf2c8b5fbc0da352d29efe/packages/metro/src/HmrServer.js#L327-L393\n // with patch for `_createModuleId`.\n const logger = !options.isInitialUpdate ? changeEvent?.logger : null;\n try {\n const revPromise = this._bundler.getRevision(group.revisionId);\n if (!revPromise) {\n return {\n type: 'error',\n body: formatBundlingError(new RevisionNotFoundError(group.revisionId)),\n };\n }\n logger?.point('updateGraph_start');\n const { revision, delta } = await this._bundler.updateGraph(await revPromise, false);\n logger?.point('updateGraph_end');\n this._clientGroups.delete(group.revisionId);\n group.revisionId = revision.id;\n for (const client of group.clients) {\n client.revisionIds = client.revisionIds.filter(\n (revisionId) => revisionId !== group.revisionId\n );\n client.revisionIds.push(revision.id);\n }\n this._clientGroups.set(group.revisionId, group);\n logger?.point('serialize_start');\n // NOTE(EvanBacon): This is the patch\n const moduleIdContext = {\n platform: revision.graph.transformOptions.platform,\n environment: revision.graph.transformOptions.customTransformOptions?.environment,\n };\n const hmrUpdate = hmrJSBundle(delta, revision.graph, {\n clientUrl: group.clientUrl,\n // NOTE(EvanBacon): This is also the patch\n createModuleId: (moduleId: string) => {\n // @ts-expect-error\n return this._createModuleId(moduleId, moduleIdContext);\n },\n includeAsyncPaths: group.graphOptions.lazy,\n projectRoot: this._config.projectRoot,\n serverRoot: this._config.server.unstable_serverRoot ?? this._config.projectRoot,\n });\n logger?.point('serialize_end');\n return {\n type: 'update',\n body: {\n revisionId: revision.id,\n isInitialUpdate: options.isInitialUpdate,\n ...hmrUpdate,\n },\n };\n } catch (error: any) {\n const formattedError = formatBundlingError(error);\n this._config.reporter.update({\n type: 'bundling_error',\n error,\n });\n return {\n type: 'error',\n body: formattedError,\n };\n }\n };\n }\n\n return {\n metro,\n hmrServer,\n server,\n middleware,\n messageSocket: messagesSocket,\n };\n}\n\n// TODO: Fork the entire transform function so we can simply regex the file contents for keywords instead.\nfunction pruneCustomTransformOptions(\n filePath: string,\n transformOptions: TransformOptions\n): TransformOptions {\n // Normalize the filepath for cross platform checking.\n filePath = filePath.split(path.sep).join('/');\n\n if (\n transformOptions.customTransformOptions?.dom &&\n // The only generated file that needs the dom root is `expo/dom/entry.js`\n !filePath.match(/expo\\/dom\\/entry\\.js$/)\n ) {\n // Clear the dom root option if we aren't transforming the magic entry file, this ensures\n // that cached artifacts from other DOM component bundles can be reused.\n transformOptions.customTransformOptions.dom = 'true';\n }\n\n if (\n transformOptions.customTransformOptions?.routerRoot &&\n // The router root is used all over expo-router (`process.env.EXPO_ROUTER_ABS_APP_ROOT`, `process.env.EXPO_ROUTER_APP_ROOT`) so we'll just ignore the entire package.\n !(filePath.match(/\\/expo-router\\/_ctx/) || filePath.match(/\\/expo-router\\/build\\//))\n ) {\n // Set to the default value.\n transformOptions.customTransformOptions.routerRoot = 'app';\n }\n\n if (\n transformOptions.customTransformOptions?.asyncRoutes &&\n // The async routes settings are also used in `expo-router/_ctx.ios.js` (and other platform variants) via `process.env.EXPO_ROUTER_IMPORT_MODE`\n !(filePath.match(/\\/expo-router\\/_ctx/) || filePath.match(/\\/expo-router\\/build\\//))\n ) {\n delete transformOptions.customTransformOptions.asyncRoutes;\n }\n\n if (\n transformOptions.customTransformOptions?.clientBoundaries &&\n // The client boundaries are only used in `expo/virtual/rsc.js` for production RSC exports.\n !filePath.match(/\\/expo\\/virtual\\/rsc\\.js$/)\n ) {\n delete transformOptions.customTransformOptions.clientBoundaries;\n }\n\n return transformOptions;\n}\n\n/**\n * Simplify and communicate if Metro is running without watching file updates,.\n * Exposed for testing.\n */\nexport function isWatchEnabled() {\n if (env.CI) {\n Log.log(\n chalk`Metro is running in CI mode, reloads are disabled. Remove {bold CI=true} to enable watch mode.`\n );\n }\n\n return !env.CI;\n}\n"],"names":["instantiateMetroAsync","isWatchEnabled","loadMetroConfigAsync","LogRespectingTerminal","Terminal","constructor","stream","ttyPrint","sendLog","msg","length","log","format","args","flush","console","info","terminal","process","stdout","projectRoot","options","exp","isExporting","getMetroBundler","config","reportEvent","autolinkingModuleResolutionEnabled","experiments","autolinkingModuleResolution","env","EXPO_USE_STICKY_RESOLVER","serverActionsEnabled","reactServerFunctions","EXPO_UNSTABLE_SERVER_FUNCTIONS","reactServerComponentRoutes","EXPO_USE_METRO_REQUIRE","reactCanary","Log","warn","serverRoot","getMetroServerRoot","terminalReporter","MetroTerminalReporter","hasConfig","resolveConfig","loadConfig","cwd","isEmpty","getDefaultConfig","undefined","reporter","update","event","globalThis","__requireCycleIgnorePatterns","resolver","requireCycleIgnorePatterns","transformer","publicPath","baseUrl","platformBundlers","getPlatformBundlers","reactCompiler","chalk","gray","EXPO_UNSTABLE_TREE_SHAKING","EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH","CommandError","EXPO_UNSTABLE_LOG_BOX","withMetroMultiPlatformAsync","isTsconfigPathsEnabled","tsconfigPaths","isAutolinkingResolverEnabled","isFastResolverEnabled","EXPO_USE_FAST_RESOLVER","isNamedRequiresEnabled","isReactServerComponentsEnabled","setEventReporter","logger","metroBundler","getConfig","skipSDKVersionRequirement","metroConfig","metro","getBundler","middleware","messagesSocket","eventsSocket","websocketEndpoints","createMetroMiddleware","prependMiddleware","createCorsMiddleware","debugMiddleware","debugWebsocketEndpoints","createDebugMiddleware","Object","assign","use","createJsInspectorMiddleware","customEnhanceMiddleware","server","enhanceMiddleware","metroMiddleware","attachAtlasAsync","resetAtlasFile","hmrServer","runServer","createDevToolsPluginWebsocketEndpoint","watch","mockServer","originalTransformFile","transformFile","bind","filePath","transformOptions","fileBuffer","pruneCustomTransformOptions","customTransformOptions","__proto__","reportMetroEvent","_getSortedModules","graph","modules","dependencies","values","ctx","platform","environment","module","_createModuleId","path","sort","a","b","hmrJSBundle","require","default","_prepareMessage","group","changeEvent","isInitialUpdate","revision","revPromise","_bundler","getRevision","revisionId","type","body","formatBundlingError","RevisionNotFoundError","point","delta","updateGraph","_clientGroups","delete","id","client","clients","revisionIds","filter","push","set","moduleIdContext","hmrUpdate","clientUrl","createModuleId","moduleId","includeAsyncPaths","graphOptions","lazy","_config","unstable_serverRoot","error","formattedError","messageSocket","split","sep","join","dom","match","routerRoot","asyncRoutes","clientBoundaries","CI"],"mappings":";;;;;;;;;;;IAoLsBA,qBAAqB;eAArBA;;IAuRNC,cAA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tDD,WAAWA,SAAS8D,KAAK,CAAC7C,eAAI,CAAC8C,GAAG,EAAEC,IAAI,CAAC;IAEzC,IACE/D,EAAAA,2CAAAA,iBAAiBG,sBAAsB,qBAAvCH,yCAAyCgE,GAAG,KAC5C,yEAAyE;IACzE,CAACjE,SAASkE,KAAK,CAAC,0BAChB;QACA,yFAAyF;QACzF,wEAAwE;QACxEjE,iBAAiBG,sBAAsB,CAAC6D,GAAG,GAAG;IAChD;IAEA,IACEhE,EAAAA,4CAAAA,iBAAiBG,sBAAsB,qBAAvCH,0CAAyCkE,UAAU,KACnD,qKAAqK;IACrK,CAAEnE,CAAAA,SAASkE,KAAK,CAAC,0BAA0BlE,SAASkE,KAAK,CAAC,yBAAwB,GAClF;QACA,4BAA4B;QAC5BjE,iBAAiBG,sBAAsB,CAAC+D,UAAU,GAAG;IACvD;IAEA,IACElE,EAAAA,4CAAAA,iBAAiBG,sBAAsB,qBAAvCH,0CAAyCmE,WAAW,KACpD,+IAA+I;IAC/I,CAAEpE,CAAAA,SAASkE,KAAK,CAAC,0BAA0BlE,SAASkE,KAAK,CAAC,yBAAwB,GAClF;QACA,OAAOjE,iBAAiBG,sBAAsB,CAACgE,WAAW;IAC5D;IAEA,IACEnE,EAAAA,4CAAAA,iBAAiBG,sBAAsB,qBAAvCH,0CAAyCoE,gBAAgB,KACzD,2FAA2F;IAC3F,CAACrE,SAASkE,KAAK,CAAC,8BAChB;QACA,OAAOjE,iBAAiBG,sBAAsB,CAACiE,gBAAgB;IACjE;IAEA,OAAOpE;AACT;AAMO,SAASlH;IACd,IAAI6B,QAAG,CAAC0J,EAAE,EAAE;QACVlJ,QAAG,CAAC3B,GAAG,CACLqD,IAAAA,gBAAK,CAAA,CAAC,8FAA8F,CAAC;IAEzG;IAEA,OAAO,CAAClC,QAAG,CAAC0J,EAAE;AAChB"}
1
+ {"version":3,"sources":["../../../../../src/start/server/metro/instantiateMetro.ts"],"sourcesContent":["import { type ExpoConfig, getConfig } from '@expo/config';\nimport { getMetroServerRoot } from '@expo/config/paths';\nimport type { Reporter } from '@expo/metro/metro';\nimport type Bundler from '@expo/metro/metro/Bundler';\nimport type { ReadOnlyGraph } from '@expo/metro/metro/DeltaBundler';\nimport type { TransformOptions } from '@expo/metro/metro/DeltaBundler/Worker';\nimport MetroHmrServer, { Client as MetroHmrClient } from '@expo/metro/metro/HmrServer';\nimport RevisionNotFoundError from '@expo/metro/metro/IncrementalBundler/RevisionNotFoundError';\nimport type MetroServer from '@expo/metro/metro/Server';\nimport formatBundlingError from '@expo/metro/metro/lib/formatBundlingError';\nimport { mergeConfig, resolveConfig, type ConfigT } from '@expo/metro/metro-config';\nimport { Terminal } from '@expo/metro/metro-core';\nimport { getDefaultConfig } from '@expo/metro-config';\nimport { FileStore } from '@expo/metro-config/file-store';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport http from 'http';\nimport path from 'path';\n\nimport { createDevToolsPluginWebsocketEndpoint } from './DevToolsPluginWebsocketEndpoint';\nimport { MetroBundlerDevServer } from './MetroBundlerDevServer';\nimport { MetroTerminalReporter } from './MetroTerminalReporter';\nimport { attachAtlasAsync } from './debugging/attachAtlas';\nimport { createDebugMiddleware } from './debugging/createDebugMiddleware';\nimport { createMetroMiddleware } from './dev-server/createMetroMiddleware';\nimport { runServer } from './runServer-fork';\nimport { withMetroMultiPlatformAsync } from './withMetroMultiPlatform';\nimport { Log } from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { createCorsMiddleware } from '../middleware/CorsMiddleware';\nimport { createJsInspectorMiddleware } from '../middleware/inspector/createJsInspectorMiddleware';\nimport { prependMiddleware } from '../middleware/mutations';\nimport { getPlatformBundlers } from '../platformBundlers';\n\n// From expo/dev-server but with ability to use custom logger.\ntype MessageSocket = {\n broadcast: (method: string, params?: Record<string, any> | undefined) => void;\n};\n\n// Wrap terminal and polyfill console.log so we can log during bundling without breaking the indicator.\nclass LogRespectingTerminal extends Terminal {\n constructor(stream: import('node:net').Socket | import('node:stream').Writable) {\n super(stream, { ttyPrint: true });\n\n const sendLog = (...msg: any[]) => {\n if (!msg.length) {\n this.log('');\n } else {\n const [format, ...args] = msg;\n this.log(format, ...args);\n }\n // Flush the logs to the terminal immediately so logs at the end of the process are not lost.\n this.flush();\n };\n\n console.log = sendLog;\n console.info = sendLog;\n }\n}\n\n// Share one instance of Terminal for all instances of Metro.\nconst terminal = new LogRespectingTerminal(process.stdout);\n\ninterface LoadMetroConfigOptions {\n maxWorkers?: number;\n port?: number;\n reporter?: Reporter;\n resetCache?: boolean;\n}\n\nexport async function loadMetroConfigAsync(\n projectRoot: string,\n options: LoadMetroConfigOptions,\n {\n exp,\n isExporting,\n getMetroBundler,\n }: { exp: ExpoConfig; isExporting: boolean; getMetroBundler: () => Bundler }\n) {\n let reportEvent: ((event: any) => void) | undefined;\n\n const autolinkingModuleResolutionEnabled =\n exp.experiments?.autolinkingModuleResolution ?? env.EXPO_USE_STICKY_RESOLVER;\n\n const serverActionsEnabled =\n exp.experiments?.reactServerFunctions ?? env.EXPO_UNSTABLE_SERVER_FUNCTIONS;\n\n if (serverActionsEnabled) {\n process.env.EXPO_UNSTABLE_SERVER_FUNCTIONS = '1';\n }\n\n // NOTE: Enable all the experimental Metro flags when RSC is enabled.\n if (exp.experiments?.reactServerComponentRoutes || serverActionsEnabled) {\n process.env.EXPO_USE_METRO_REQUIRE = '1';\n }\n\n const isReactCanaryEnabled =\n (exp.experiments?.reactServerComponentRoutes ||\n serverActionsEnabled ||\n exp.experiments?.reactCanary) ??\n false;\n\n const serverRoot = getMetroServerRoot(projectRoot);\n const terminalReporter = new MetroTerminalReporter(serverRoot, terminal);\n\n // NOTE: Allow external tools to override the metro config. This is considered internal and unstable\n const configPath = env.EXPO_OVERRIDE_METRO_CONFIG ?? undefined;\n const resolvedConfig = await resolveConfig(configPath, projectRoot);\n const defaultConfig = getDefaultConfig(projectRoot);\n\n let config: ConfigT = resolvedConfig.isEmpty\n ? defaultConfig\n : await mergeConfig(defaultConfig, resolvedConfig.config);\n\n // Set the watchfolders to include the projectRoot, as Metro assumes this\n // Force-override the reporter\n config = {\n ...config,\n\n // See: `overrideConfigWithArguments` https://github.com/facebook/metro/blob/5059e26/packages/metro-config/src/loadConfig.js#L274-L339\n // Compare to `LoadOptions` type (disregard `reporter` as we don't expose this)\n resetCache: !!options.resetCache,\n maxWorkers: options.maxWorkers ?? config.maxWorkers,\n server: {\n ...config.server,\n port: options.port ?? config.server.port,\n },\n\n watchFolders: !config.watchFolders.includes(config.projectRoot)\n ? [config.projectRoot, ...config.watchFolders]\n : config.watchFolders,\n reporter: {\n update(event) {\n terminalReporter.update(event);\n if (reportEvent) {\n reportEvent(event);\n }\n },\n },\n };\n\n overrideExpoMetroCacheStores(config, { projectRoot });\n\n // @ts-expect-error: Set the global require cycle ignore patterns for SSR bundles. This won't work with custom global prefixes, but we don't use those.\n globalThis.__requireCycleIgnorePatterns = config.resolver?.requireCycleIgnorePatterns;\n\n if (isExporting) {\n // This token will be used in the asset plugin to ensure the path is correct for writing locally.\n // @ts-expect-error: typed as readonly.\n config.transformer.publicPath = `/assets?export_path=${\n (exp.experiments?.baseUrl ?? '') + '/assets'\n }`;\n } else {\n // @ts-expect-error: typed as readonly\n config.transformer.publicPath = '/assets/?unstable_path=.';\n }\n\n const platformBundlers = getPlatformBundlers(projectRoot, exp);\n\n if (exp.experiments?.reactCompiler) {\n Log.log(chalk.gray`React Compiler enabled`);\n }\n\n if (env.EXPO_UNSTABLE_TREE_SHAKING && !env.EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH) {\n throw new CommandError(\n 'EXPO_UNSTABLE_TREE_SHAKING requires EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH to be enabled.'\n );\n }\n\n if (env.EXPO_UNSTABLE_TREE_SHAKING) {\n Log.warn(`Experimental fast resolver is enabled.`);\n }\n if (env.EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH) {\n Log.warn(`Experimental bundle optimization is enabled.`);\n }\n if (env.EXPO_UNSTABLE_TREE_SHAKING) {\n Log.warn(`Experimental tree shaking is enabled.`);\n }\n if (autolinkingModuleResolutionEnabled) {\n Log.warn(`Experimental Expo Autolinking module resolver is enabled.`);\n }\n\n if (serverActionsEnabled) {\n Log.warn(\n `React Server Functions (beta) are enabled. Route rendering mode: ${exp.experiments?.reactServerComponentRoutes ? 'server' : 'client'}`\n );\n }\n\n config = await withMetroMultiPlatformAsync(projectRoot, {\n config,\n exp,\n platformBundlers,\n isTsconfigPathsEnabled: exp.experiments?.tsconfigPaths ?? true,\n isAutolinkingResolverEnabled: autolinkingModuleResolutionEnabled,\n isFastResolverEnabled: env.EXPO_USE_FAST_RESOLVER,\n isExporting,\n isReactCanaryEnabled,\n isNamedRequiresEnabled: env.EXPO_USE_METRO_REQUIRE,\n isReactServerComponentsEnabled: !!exp.experiments?.reactServerComponentRoutes,\n getMetroBundler,\n });\n\n return {\n config,\n setEventReporter: (logger: (event: any) => void) => (reportEvent = logger),\n reporter: terminalReporter,\n };\n}\n\n/** The most generic possible setup for Metro bundler. */\nexport async function instantiateMetroAsync(\n metroBundler: MetroBundlerDevServer,\n options: LoadMetroConfigOptions,\n {\n isExporting,\n exp = getConfig(metroBundler.projectRoot, {\n skipSDKVersionRequirement: true,\n }).exp,\n }: { isExporting: boolean; exp?: ExpoConfig }\n): Promise<{\n metro: MetroServer;\n hmrServer: MetroHmrServer<MetroHmrClient> | null;\n server: http.Server;\n middleware: any;\n messageSocket: MessageSocket;\n}> {\n const projectRoot = metroBundler.projectRoot;\n\n const {\n config: metroConfig,\n setEventReporter,\n reporter,\n } = await loadMetroConfigAsync(projectRoot, options, {\n exp,\n isExporting,\n getMetroBundler() {\n return metro.getBundler().getBundler();\n },\n });\n\n // Create the core middleware stack for Metro, including websocket listeners\n const { middleware, messagesSocket, eventsSocket, websocketEndpoints } =\n createMetroMiddleware(metroConfig);\n\n // Get local URL to Metro bundler server (typically configured as 127.0.0.1:8081)\n const serverBaseUrl = metroBundler\n .getUrlCreator()\n .constructUrl({ scheme: 'http', hostType: 'localhost' });\n\n if (!isExporting) {\n // Enable correct CORS headers for Expo Router features\n prependMiddleware(middleware, createCorsMiddleware(exp));\n\n // Enable debug middleware for CDP-related debugging\n const { debugMiddleware, debugWebsocketEndpoints } = createDebugMiddleware({\n projectRoot: metroBundler.projectRoot,\n serverBaseUrl,\n reporter,\n });\n Object.assign(websocketEndpoints, debugWebsocketEndpoints);\n middleware.use(debugMiddleware);\n middleware.use('/_expo/debugger', createJsInspectorMiddleware());\n\n // TODO(cedric): `enhanceMiddleware` is deprecated, but is currently used to unify the middleware stacks\n // See: https://github.com/facebook/metro/commit/22e85fde85ec454792a1b70eba4253747a2587a9\n // See: https://github.com/facebook/metro/commit/d0d554381f119bb80ab09dbd6a1d310b54737e52\n const customEnhanceMiddleware = metroConfig.server.enhanceMiddleware;\n // @ts-expect-error: can't mutate readonly config\n metroConfig.server.enhanceMiddleware = (metroMiddleware: any, server: MetroServer) => {\n if (customEnhanceMiddleware) {\n metroMiddleware = customEnhanceMiddleware(metroMiddleware, server);\n }\n return middleware.use(metroMiddleware);\n };\n\n const devtoolsWebsocketEndpoints = createDevToolsPluginWebsocketEndpoint({ serverBaseUrl });\n Object.assign(websocketEndpoints, devtoolsWebsocketEndpoints);\n }\n\n // Attach Expo Atlas if enabled\n await attachAtlasAsync({\n isExporting,\n exp,\n projectRoot,\n middleware,\n metroConfig,\n // NOTE(cedric): reset the Atlas file once, and reuse it for static exports\n resetAtlasFile: isExporting,\n });\n\n const { server, hmrServer, metro } = await runServer(\n metroBundler,\n metroConfig,\n {\n websocketEndpoints,\n watch: !isExporting && isWatchEnabled(),\n },\n {\n mockServer: isExporting,\n }\n );\n\n // Patch transform file to remove inconvenient customTransformOptions which are only used in single well-known files.\n const originalTransformFile = metro\n .getBundler()\n .getBundler()\n .transformFile.bind(metro.getBundler().getBundler());\n\n metro.getBundler().getBundler().transformFile = async function (\n filePath: string,\n transformOptions: TransformOptions,\n fileBuffer?: Buffer\n ) {\n return originalTransformFile(\n filePath,\n pruneCustomTransformOptions(\n filePath,\n // Clone the options so we don't mutate the original.\n {\n ...transformOptions,\n customTransformOptions: {\n __proto__: null,\n ...transformOptions.customTransformOptions,\n },\n }\n ),\n fileBuffer\n );\n };\n\n setEventReporter(eventsSocket.reportMetroEvent);\n\n // This function ensures that modules in source maps are sorted in the same\n // order as in a plain JS bundle.\n metro._getSortedModules = function (this: MetroServer, graph: ReadOnlyGraph) {\n const modules = [...graph.dependencies.values()];\n\n const ctx = {\n platform: graph.transformOptions.platform,\n environment: graph.transformOptions.customTransformOptions?.environment,\n };\n // Assign IDs to modules in a consistent order\n for (const module of modules) {\n // @ts-expect-error\n this._createModuleId(module.path, ctx);\n }\n // Sort by IDs\n return modules.sort(\n // @ts-expect-error\n (a, b) => this._createModuleId(a.path, ctx) - this._createModuleId(b.path, ctx)\n );\n };\n\n if (hmrServer) {\n let hmrJSBundle:\n | typeof import('@expo/metro-config/build/serializer/fork/hmrJSBundle').default\n | typeof import('@expo/metro/metro/DeltaBundler/Serializers/hmrJSBundle').default;\n\n try {\n hmrJSBundle = require('@expo/metro-config/build/serializer/fork/hmrJSBundle').default;\n } catch {\n // TODO: Add fallback for monorepo tests up until the fork is merged.\n Log.warn('Failed to load HMR serializer from @expo/metro-config, using fallback version.');\n hmrJSBundle = require('@expo/metro/metro/DeltaBundler/Serializers/hmrJSBundle');\n }\n\n // Patch HMR Server to send more info to the `_createModuleId` function for deterministic module IDs and add support for serializing HMR updates the same as all other bundles.\n hmrServer._prepareMessage = async function (\n this: MetroHmrServer<MetroHmrClient>,\n group,\n options,\n changeEvent\n ) {\n // Fork of https://github.com/facebook/metro/blob/3b3e0aaf725cfa6907bf2c8b5fbc0da352d29efe/packages/metro/src/HmrServer.js#L327-L393\n // with patch for `_createModuleId`.\n const logger = !options.isInitialUpdate ? changeEvent?.logger : null;\n try {\n const revPromise = this._bundler.getRevision(group.revisionId);\n if (!revPromise) {\n return {\n type: 'error',\n body: formatBundlingError(new RevisionNotFoundError(group.revisionId)),\n };\n }\n logger?.point('updateGraph_start');\n const { revision, delta } = await this._bundler.updateGraph(await revPromise, false);\n logger?.point('updateGraph_end');\n this._clientGroups.delete(group.revisionId);\n group.revisionId = revision.id;\n for (const client of group.clients) {\n client.revisionIds = client.revisionIds.filter(\n (revisionId) => revisionId !== group.revisionId\n );\n client.revisionIds.push(revision.id);\n }\n this._clientGroups.set(group.revisionId, group);\n logger?.point('serialize_start');\n // NOTE(EvanBacon): This is the patch\n const moduleIdContext = {\n platform: revision.graph.transformOptions.platform,\n environment: revision.graph.transformOptions.customTransformOptions?.environment,\n };\n const hmrUpdate = hmrJSBundle(delta, revision.graph, {\n clientUrl: group.clientUrl,\n // NOTE(EvanBacon): This is also the patch\n createModuleId: (moduleId: string) => {\n // @ts-expect-error\n return this._createModuleId(moduleId, moduleIdContext);\n },\n includeAsyncPaths: group.graphOptions.lazy,\n projectRoot: this._config.projectRoot,\n serverRoot: this._config.server.unstable_serverRoot ?? this._config.projectRoot,\n });\n logger?.point('serialize_end');\n return {\n type: 'update',\n body: {\n revisionId: revision.id,\n isInitialUpdate: options.isInitialUpdate,\n ...hmrUpdate,\n },\n };\n } catch (error: any) {\n const formattedError = formatBundlingError(error);\n this._config.reporter.update({\n type: 'bundling_error',\n error,\n });\n return {\n type: 'error',\n body: formattedError,\n };\n }\n };\n }\n\n return {\n metro,\n hmrServer,\n server,\n middleware,\n messageSocket: messagesSocket,\n };\n}\n\n// TODO: Fork the entire transform function so we can simply regex the file contents for keywords instead.\nfunction pruneCustomTransformOptions(\n filePath: string,\n transformOptions: TransformOptions\n): TransformOptions {\n // Normalize the filepath for cross platform checking.\n filePath = filePath.split(path.sep).join('/');\n\n if (\n transformOptions.customTransformOptions?.dom &&\n // The only generated file that needs the dom root is `expo/dom/entry.js`\n !filePath.match(/expo\\/dom\\/entry\\.js$/)\n ) {\n // Clear the dom root option if we aren't transforming the magic entry file, this ensures\n // that cached artifacts from other DOM component bundles can be reused.\n transformOptions.customTransformOptions.dom = 'true';\n }\n\n if (\n transformOptions.customTransformOptions?.routerRoot &&\n // The router root is used all over expo-router (`process.env.EXPO_ROUTER_ABS_APP_ROOT`, `process.env.EXPO_ROUTER_APP_ROOT`) so we'll just ignore the entire package.\n !(filePath.match(/\\/expo-router\\/_ctx/) || filePath.match(/\\/expo-router\\/build\\//))\n ) {\n // Set to the default value.\n transformOptions.customTransformOptions.routerRoot = 'app';\n }\n\n if (\n transformOptions.customTransformOptions?.asyncRoutes &&\n // The async routes settings are also used in `expo-router/_ctx.ios.js` (and other platform variants) via `process.env.EXPO_ROUTER_IMPORT_MODE`\n !(filePath.match(/\\/expo-router\\/_ctx/) || filePath.match(/\\/expo-router\\/build\\//))\n ) {\n delete transformOptions.customTransformOptions.asyncRoutes;\n }\n\n if (\n transformOptions.customTransformOptions?.clientBoundaries &&\n // The client boundaries are only used in `expo/virtual/rsc.js` for production RSC exports.\n !filePath.match(/\\/expo\\/virtual\\/rsc\\.js$/)\n ) {\n delete transformOptions.customTransformOptions.clientBoundaries;\n }\n\n return transformOptions;\n}\n\n/**\n * Simplify and communicate if Metro is running without watching file updates,.\n * Exposed for testing.\n */\nexport function isWatchEnabled() {\n if (env.CI) {\n Log.log(\n chalk`Metro is running in CI mode, reloads are disabled. Remove {bold CI=true} to enable watch mode.`\n );\n }\n\n return !env.CI;\n}\n\n/**\n * Override the Metro cache stores directory using the EXPO_METRO_CACHE_STORES_DIR environment variable.\n * Exposed for testing.\n */\nexport async function overrideExpoMetroCacheStores(\n config: ConfigT,\n { projectRoot }: { projectRoot: string }\n) {\n if (!env.EXPO_METRO_CACHE_STORES_DIR) {\n return;\n }\n\n // Resolve relative paths to absolute paths based on project root\n const cacheStoresDir = path.isAbsolute(env.EXPO_METRO_CACHE_STORES_DIR)\n ? env.EXPO_METRO_CACHE_STORES_DIR\n : path.resolve(projectRoot, env.EXPO_METRO_CACHE_STORES_DIR);\n\n // Create the directory if it doesn't exist\n try {\n await fs.promises.mkdir(cacheStoresDir, { recursive: true });\n } catch (error: any) {\n if (error.code !== 'EEXIST') {\n Log.error(\n `Provided EXPO_METRO_CACHE_STORES_DIR=\"${cacheStoresDir}\" is not a directory. Use new or existing directory path.`\n );\n throw error;\n }\n }\n\n // Check if user has custom cacheStores in their metro.config.js\n if (config.cacheStores?.length) {\n Log.warn(\n `Using EXPO_METRO_CACHE_STORES_DIR=\"${cacheStoresDir}\" which overrides cacheStores from metro.config.js`\n );\n } else {\n Log.log(chalk.gray(`Using Metro cache directory: ${cacheStoresDir}`));\n }\n\n // Override cacheStores with the env-specified directory\n // @ts-expect-error - cacheStores is a read-only property\n config.cacheStores = [\n new FileStore({\n root: cacheStoresDir,\n }),\n ];\n}\n"],"names":["instantiateMetroAsync","isWatchEnabled","loadMetroConfigAsync","overrideExpoMetroCacheStores","LogRespectingTerminal","Terminal","constructor","stream","ttyPrint","sendLog","msg","length","log","format","args","flush","console","info","terminal","process","stdout","projectRoot","options","exp","isExporting","getMetroBundler","config","reportEvent","autolinkingModuleResolutionEnabled","experiments","autolinkingModuleResolution","env","EXPO_USE_STICKY_RESOLVER","serverActionsEnabled","reactServerFunctions","EXPO_UNSTABLE_SERVER_FUNCTIONS","reactServerComponentRoutes","EXPO_USE_METRO_REQUIRE","isReactCanaryEnabled","reactCanary","serverRoot","getMetroServerRoot","terminalReporter","MetroTerminalReporter","configPath","EXPO_OVERRIDE_METRO_CONFIG","undefined","resolvedConfig","resolveConfig","defaultConfig","getDefaultConfig","isEmpty","mergeConfig","resetCache","maxWorkers","server","port","watchFolders","includes","reporter","update","event","globalThis","__requireCycleIgnorePatterns","resolver","requireCycleIgnorePatterns","transformer","publicPath","baseUrl","platformBundlers","getPlatformBundlers","reactCompiler","Log","chalk","gray","EXPO_UNSTABLE_TREE_SHAKING","EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH","CommandError","warn","withMetroMultiPlatformAsync","isTsconfigPathsEnabled","tsconfigPaths","isAutolinkingResolverEnabled","isFastResolverEnabled","EXPO_USE_FAST_RESOLVER","isNamedRequiresEnabled","isReactServerComponentsEnabled","setEventReporter","logger","metroBundler","getConfig","skipSDKVersionRequirement","metroConfig","metro","getBundler","middleware","messagesSocket","eventsSocket","websocketEndpoints","createMetroMiddleware","serverBaseUrl","getUrlCreator","constructUrl","scheme","hostType","prependMiddleware","createCorsMiddleware","debugMiddleware","debugWebsocketEndpoints","createDebugMiddleware","Object","assign","use","createJsInspectorMiddleware","customEnhanceMiddleware","enhanceMiddleware","metroMiddleware","devtoolsWebsocketEndpoints","createDevToolsPluginWebsocketEndpoint","attachAtlasAsync","resetAtlasFile","hmrServer","runServer","watch","mockServer","originalTransformFile","transformFile","bind","filePath","transformOptions","fileBuffer","pruneCustomTransformOptions","customTransformOptions","__proto__","reportMetroEvent","_getSortedModules","graph","modules","dependencies","values","ctx","platform","environment","module","_createModuleId","path","sort","a","b","hmrJSBundle","require","default","_prepareMessage","group","changeEvent","isInitialUpdate","revision","revPromise","_bundler","getRevision","revisionId","type","body","formatBundlingError","RevisionNotFoundError","point","delta","updateGraph","_clientGroups","delete","id","client","clients","revisionIds","filter","push","set","moduleIdContext","hmrUpdate","clientUrl","createModuleId","moduleId","includeAsyncPaths","graphOptions","lazy","_config","unstable_serverRoot","error","formattedError","messageSocket","split","sep","join","dom","match","routerRoot","asyncRoutes","clientBoundaries","CI","EXPO_METRO_CACHE_STORES_DIR","cacheStoresDir","isAbsolute","resolve","fs","promises","mkdir","recursive","code","cacheStores","FileStore","root"],"mappings":";;;;;;;;;;;IAmNsBA,qBAAqB;eAArBA;;IA6RNC,cAAc;eAAdA;;IAzaMC,oBAAoB;eAApBA;;IAubAC,4BAA4B;eAA5BA;;;;yBA9fqB;;;;;;;yBACR;;;;;;;gEAMD;;;;;;;gEAEF;;;;;;;yBACyB;;;;;;;yBAChC;;;;;;;yBACQ;;;;;;;yBACP;;;;;;;gEACR;;;;;;;gEACH;;;;;;;gEAEE;;;;;;iDAEqC;uCAEhB;6BACL;uC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yDAAyD;IACzD9K,OAAOsL,WAAW,GAAG;QACnB,IAAIC,CAAAA,YAAQ,WAAC,CAAC;YACZC,MAAMV;QACR;KACD;AACH"}
@@ -99,16 +99,14 @@ class LogBoxLog {
99
99
  this.count += 1;
100
100
  }
101
101
  getAvailableStack(type) {
102
- var _this_symbolicated_type;
103
- if (((_this_symbolicated_type = this.symbolicated[type]) == null ? void 0 : _this_symbolicated_type.status) === 'COMPLETE') {
102
+ if (this.symbolicated[type].status === 'COMPLETE') {
104
103
  return this.symbolicated[type].stack;
105
104
  }
106
105
  return this.getStack(type);
107
106
  }
108
107
  flushCallbacks(type) {
109
- var _this_symbolicated_type;
110
108
  const callbacks = this.callbacks.get(type);
111
- const status = (_this_symbolicated_type = this.symbolicated[type]) == null ? void 0 : _this_symbolicated_type.status;
109
+ const status = this.symbolicated[type].status;
112
110
  if (callbacks) {
113
111
  for (const callback of callbacks){
114
112
  callback(status);
@@ -131,11 +129,10 @@ class LogBoxLog {
131
129
  this._symbolicate(type, false, callback);
132
130
  }
133
131
  _symbolicate(type, retry, callback) {
134
- var _this_symbolicated_type;
135
132
  if (callback) {
136
133
  this.pushCallback(type, callback);
137
134
  }
138
- const status = (_this_symbolicated_type = this.symbolicated[type]) == null ? void 0 : _this_symbolicated_type.status;
135
+ const status = this.symbolicated[type].status;
139
136
  if (status === 'COMPLETE') {
140
137
  return this.flushCallbacks(type);
141
138
  }
@@ -158,11 +155,11 @@ class LogBoxLog {
158
155
  return this.stack;
159
156
  }
160
157
  handleSymbolicate(type) {
161
- var _this_componentStack, _this_symbolicated_type;
158
+ var _this_componentStack;
162
159
  if (type === 'component' && !((_this_componentStack = this.componentStack) == null ? void 0 : _this_componentStack.length)) {
163
160
  return;
164
161
  }
165
- if (((_this_symbolicated_type = this.symbolicated[type]) == null ? void 0 : _this_symbolicated_type.status) !== 'PENDING') {
162
+ if (this.symbolicated[type].status !== 'PENDING') {
166
163
  this.updateStatus(type, null, null, null);
167
164
  _LogBoxSymbolication.symbolicate(this.getStack(type)).then((data)=>{
168
165
  this.updateStatus(type, null, data == null ? void 0 : data.stack, data == null ? void 0 : data.codeFrame);
@@ -172,8 +169,7 @@ class LogBoxLog {
172
169
  }
173
170
  }
174
171
  updateStatus(type, error, stack, codeFrame) {
175
- var _this_symbolicated_type, _this_symbolicated_type1;
176
- const lastStatus = (_this_symbolicated_type = this.symbolicated[type]) == null ? void 0 : _this_symbolicated_type.status;
172
+ const lastStatus = this.symbolicated[type].status;
177
173
  if (error != null) {
178
174
  this.symbolicated[type] = {
179
175
  error,
@@ -196,7 +192,7 @@ class LogBoxLog {
196
192
  status: 'PENDING'
197
193
  };
198
194
  }
199
- const status = (_this_symbolicated_type1 = this.symbolicated[type]) == null ? void 0 : _this_symbolicated_type1.status;
195
+ const status = this.symbolicated[type].status;
200
196
  if (lastStatus !== status) {
201
197
  if ([
202
198
  'COMPLETE',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/start/server/metro/log-box/LogBoxLog.ts"],"sourcesContent":["/**\n * Copyright (c) 650 Industries.\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\nimport * as LogBoxSymbolication from './LogBoxSymbolication';\nimport type { CodeFrame, StackFrame } from './LogBoxSymbolication';\n\ntype Category = string;\n\ntype Message = {\n content: string;\n substitutions: {\n length: number;\n offset: number;\n }[];\n};\n\ntype ComponentStack = CodeFrame[];\n\ntype SymbolicationStatus = 'NONE' | 'PENDING' | 'COMPLETE' | 'FAILED';\n\nexport type LogLevel = 'warn' | 'error' | 'fatal' | 'syntax' | 'resolution' | 'static';\n\nexport type LogBoxLogData = {\n level: LogLevel;\n type?: string;\n message: Message;\n stack: StackFrame[];\n category: string;\n componentStack: ComponentStack;\n codeFrame?: CodeFrame;\n isComponentError: boolean;\n};\n\nexport type StackType = 'stack' | 'component';\n\nfunction componentStackToStack(componentStack: ComponentStack): StackFrame[] {\n return componentStack.map((stack) => ({\n file: stack.fileName,\n methodName: stack.content,\n lineNumber: stack.location?.row ?? 0,\n column: stack.location?.column ?? 0,\n arguments: [],\n }));\n}\n\ntype SymbolicationCallback = (status: SymbolicationStatus) => void;\n\ntype SymbolicationResult =\n | { error: null; stack: null; status: 'NONE' }\n | { error: null; stack: null; status: 'PENDING' }\n | { error: null; stack: StackFrame[]; status: 'COMPLETE' }\n | { error: Error; stack: null; status: 'FAILED' };\n\nexport class LogBoxLog {\n message: Message;\n type: string;\n category: Category;\n componentStack: ComponentStack;\n stack: StackFrame[];\n count: number;\n level: LogLevel;\n codeFrame?: CodeFrame;\n isComponentError: boolean;\n symbolicated: Record<StackType, SymbolicationResult> = {\n stack: {\n error: null,\n stack: null,\n status: 'NONE',\n },\n component: {\n error: null,\n stack: null,\n status: 'NONE',\n },\n };\n\n private callbacks: Map<StackType, Set<SymbolicationCallback>> = new Map();\n\n constructor(\n data: LogBoxLogData & {\n symbolicated?: Record<StackType, SymbolicationResult>;\n }\n ) {\n this.level = data.level;\n this.type = data.type ?? 'error';\n this.message = data.message;\n this.stack = data.stack;\n this.category = data.category;\n this.componentStack = data.componentStack;\n this.codeFrame = data.codeFrame;\n this.isComponentError = data.isComponentError;\n this.count = 1;\n this.symbolicated = data.symbolicated ?? this.symbolicated;\n }\n\n incrementCount(): void {\n this.count += 1;\n }\n\n getAvailableStack(type: StackType): StackFrame[] | null {\n if (this.symbolicated[type]?.status === 'COMPLETE') {\n return this.symbolicated[type].stack;\n }\n return this.getStack(type);\n }\n\n private flushCallbacks(type: StackType): void {\n const callbacks = this.callbacks.get(type);\n const status = this.symbolicated[type]?.status;\n if (callbacks) {\n for (const callback of callbacks) {\n callback(status);\n }\n callbacks.clear();\n }\n }\n\n private pushCallback(type: StackType, callback: SymbolicationCallback): void {\n let callbacks = this.callbacks.get(type);\n if (!callbacks) {\n callbacks = new Set();\n this.callbacks.set(type, callbacks);\n }\n callbacks.add(callback);\n }\n\n retrySymbolicate(type: StackType, callback?: (status: SymbolicationStatus) => void): void {\n this._symbolicate(type, true, callback);\n }\n\n symbolicate(type: StackType, callback?: (status: SymbolicationStatus) => void): void {\n this._symbolicate(type, false, callback);\n }\n\n private _symbolicate(\n type: StackType,\n retry: boolean,\n callback?: (status: SymbolicationStatus) => void\n ): void {\n if (callback) {\n this.pushCallback(type, callback);\n }\n const status = this.symbolicated[type]?.status;\n\n if (status === 'COMPLETE') {\n return this.flushCallbacks(type);\n }\n\n if (retry) {\n LogBoxSymbolication.deleteStack(this.getStack(type));\n this.handleSymbolicate(type);\n } else {\n if (status === 'NONE') {\n this.handleSymbolicate(type);\n }\n }\n }\n\n private componentStackCache: StackFrame[] | null = null;\n\n private getStack(type: StackType): StackFrame[] {\n if (type === 'component') {\n if (this.componentStackCache == null) {\n this.componentStackCache = componentStackToStack(this.componentStack);\n }\n return this.componentStackCache;\n }\n return this.stack;\n }\n\n private handleSymbolicate(type: StackType): void {\n if (type === 'component' && !this.componentStack?.length) {\n return;\n }\n\n if (this.symbolicated[type]?.status !== 'PENDING') {\n this.updateStatus(type, null, null, null);\n LogBoxSymbolication.symbolicate(this.getStack(type)).then(\n (data) => {\n this.updateStatus(type, null, data?.stack, data?.codeFrame);\n },\n (error) => {\n this.updateStatus(type, error, null, null);\n }\n );\n }\n }\n\n private updateStatus(\n type: StackType,\n error?: Error | null,\n stack?: StackFrame[] | null,\n codeFrame?: CodeFrame | null\n ): void {\n const lastStatus = this.symbolicated[type]?.status;\n if (error != null) {\n this.symbolicated[type] = {\n error,\n stack: null,\n status: 'FAILED',\n };\n } else if (stack != null) {\n if (codeFrame) {\n this.codeFrame = codeFrame;\n }\n\n this.symbolicated[type] = {\n error: null,\n stack,\n status: 'COMPLETE',\n };\n } else {\n this.symbolicated[type] = {\n error: null,\n stack: null,\n status: 'PENDING',\n };\n }\n\n const status = this.symbolicated[type]?.status;\n if (lastStatus !== status) {\n if (['COMPLETE', 'FAILED'].includes(status)) {\n this.flushCallbacks(type);\n }\n }\n }\n}\n"],"names":["LogBoxLog","componentStackToStack","componentStack","map","stack","file","fileName","methodName","content","lineNumber","location","row","column","arguments","constructor","data","symbolicated","error","status","component","callbacks","Map","componentStackCache","level","type","message","category","codeFrame","isComponentError","count","incrementCount","getAvailableStack","getStack","flushCallbacks","get","callback","clear","pushCallback","Set","set","add","retrySymbolicate","_symbolicate","symbolicate","retry","LogBoxSymbolication","deleteStack","handleSymbolicate","length","updateStatus","then","lastStatus","includes"],"mappings":"AAAA;;;;;;CAMC;;;;+BAoDYA;;;eAAAA;;;6EAlDwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCrC,SAASC,sBAAsBC,cAA8B;IAC3D,OAAOA,eAAeC,GAAG,CAAC,CAACC;YAGbA,iBACJA;eAJ4B;YACpCC,MAAMD,MAAME,QAAQ;YACpBC,YAAYH,MAAMI,OAAO;YACzBC,YAAYL,EAAAA,kBAAAA,MAAMM,QAAQ,qBAAdN,gBAAgBO,GAAG,KAAI;YACnCC,QAAQR,EAAAA,mBAAAA,MAAMM,QAAQ,qBAAdN,iBAAgBQ,MAAM,KAAI;YAClCC,WAAW,EAAE;QACf;;AACF;AAUO,MAAMb;IAyBXc,YACEC,IAEC,CACD;aAnBFC,eAAuD;YACrDZ,OAAO;gBACLa,OAAO;gBACPb,OAAO;gBACPc,QAAQ;YACV;YACAC,WAAW;gBACTF,OAAO;gBACPb,OAAO;gBACPc,QAAQ;YACV;QACF;aAEQE,YAAwD,IAAIC;aAkF5DC,sBAA2C;QA3EjD,IAAI,CAACC,KAAK,GAAGR,KAAKQ,KAAK;QACvB,IAAI,CAACC,IAAI,GAAGT,KAAKS,IAAI,IAAI;QACzB,IAAI,CAACC,OAAO,GAAGV,KAAKU,OAAO;QAC3B,IAAI,CAACrB,KAAK,GAAGW,KAAKX,KAAK;QACvB,IAAI,CAACsB,QAAQ,GAAGX,KAAKW,QAAQ;QAC7B,IAAI,CAACxB,cAAc,GAAGa,KAAKb,cAAc;QACzC,IAAI,CAAC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C,aACNzB,IAAe,EACfP,KAAoB,EACpBb,KAA2B,EAC3BuB,SAA4B,EACtB;YACa,yBAyBJ;QAzBf,MAAMwB,cAAa,0BAAA,IAAI,CAACnC,YAAY,CAACQ,KAAK,qBAAvB,wBAAyBN,MAAM;QAClD,IAAID,SAAS,MAAM;YACjB,IAAI,CAACD,YAAY,CAACQ,KAAK,GAAG;gBACxBP;gBACAb,OAAO;gBACPc,QAAQ;YACV;QACF,OAAO,IAAId,SAAS,MAAM;YACxB,IAAIuB,WAAW;gBACb,IAAI,CAACA,SAAS,GAAGA;YACnB;YAEA,IAAI,CAACX,YAAY,CAACQ,KAAK,GAAG;gBACxBP,OAAO;gBACPb;gBACAc,QAAQ;YACV;QACF,OAAO;YACL,IAAI,CAACF,YAAY,CAACQ,KAAK,GAAG;gBACxBP,OAAO;gBACPb,OAAO;gBACPc,QAAQ;YACV;QACF;QAEA,MAAMA,UAAS,2BAAA,IAAI,CAACF,YAAY,CAACQ,KAAK,qBAAvB,yBAAyBN,MAAM;QAC9C,IAAIiC,eAAejC,QAAQ;YACzB,IAAI;gBAAC;gBAAY;aAAS,CAACkC,QAAQ,CAAClC,SAAS;gBAC3C,IAAI,CAACe,cAAc,CAACT;YACtB;QACF;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../../../src/start/server/metro/log-box/LogBoxLog.ts"],"sourcesContent":["/**\n * Copyright (c) 650 Industries.\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\nimport * as LogBoxSymbolication from './LogBoxSymbolication';\nimport type { CodeFrame, StackFrame } from './LogBoxSymbolication';\n\ntype Category = string;\n\ntype Message = {\n content: string;\n substitutions: {\n length: number;\n offset: number;\n }[];\n};\n\ntype ComponentStack = CodeFrame[];\n\ntype SymbolicationStatus = 'NONE' | 'PENDING' | 'COMPLETE' | 'FAILED';\n\nexport type LogLevel = 'warn' | 'error' | 'fatal' | 'syntax' | 'static';\n\nexport type LogBoxLogData = {\n level: LogLevel;\n type?: string;\n message: Message;\n stack: StackFrame[];\n category: string;\n componentStack: ComponentStack;\n codeFrame?: CodeFrame;\n isComponentError: boolean;\n};\n\nexport type StackType = 'stack' | 'component';\n\nfunction componentStackToStack(componentStack: ComponentStack): StackFrame[] {\n return componentStack.map((stack) => ({\n file: stack.fileName,\n methodName: stack.content,\n lineNumber: stack.location?.row ?? 0,\n column: stack.location?.column ?? 0,\n arguments: [],\n }));\n}\n\ntype SymbolicationCallback = (status: SymbolicationStatus) => void;\n\ntype SymbolicationResult =\n | { error: null; stack: null; status: 'NONE' }\n | { error: null; stack: null; status: 'PENDING' }\n | { error: null; stack: StackFrame[]; status: 'COMPLETE' }\n | { error: Error; stack: null; status: 'FAILED' };\n\nexport class LogBoxLog {\n message: Message;\n type: string;\n category: Category;\n componentStack: ComponentStack;\n stack: StackFrame[];\n count: number;\n level: LogLevel;\n codeFrame?: CodeFrame;\n isComponentError: boolean;\n symbolicated: Record<StackType, SymbolicationResult> = {\n stack: {\n error: null,\n stack: null,\n status: 'NONE',\n },\n component: {\n error: null,\n stack: null,\n status: 'NONE',\n },\n };\n\n private callbacks: Map<StackType, Set<SymbolicationCallback>> = new Map();\n\n constructor(\n data: LogBoxLogData & {\n symbolicated?: Record<StackType, SymbolicationResult>;\n }\n ) {\n this.level = data.level;\n this.type = data.type ?? 'error';\n this.message = data.message;\n this.stack = data.stack;\n this.category = data.category;\n this.componentStack = data.componentStack;\n this.codeFrame = data.codeFrame;\n this.isComponentError = data.isComponentError;\n this.count = 1;\n this.symbolicated = data.symbolicated ?? this.symbolicated;\n }\n\n incrementCount(): void {\n this.count += 1;\n }\n\n getAvailableStack(type: StackType): StackFrame[] | null {\n if (this.symbolicated[type].status === 'COMPLETE') {\n return this.symbolicated[type].stack;\n }\n return this.getStack(type);\n }\n\n private flushCallbacks(type: StackType): void {\n const callbacks = this.callbacks.get(type);\n const status = this.symbolicated[type].status;\n if (callbacks) {\n for (const callback of callbacks) {\n callback(status);\n }\n callbacks.clear();\n }\n }\n\n private pushCallback(type: StackType, callback: SymbolicationCallback): void {\n let callbacks = this.callbacks.get(type);\n if (!callbacks) {\n callbacks = new Set();\n this.callbacks.set(type, callbacks);\n }\n callbacks.add(callback);\n }\n\n retrySymbolicate(type: StackType, callback?: (status: SymbolicationStatus) => void): void {\n this._symbolicate(type, true, callback);\n }\n\n symbolicate(type: StackType, callback?: (status: SymbolicationStatus) => void): void {\n this._symbolicate(type, false, callback);\n }\n\n private _symbolicate(\n type: StackType,\n retry: boolean,\n callback?: (status: SymbolicationStatus) => void\n ): void {\n if (callback) {\n this.pushCallback(type, callback);\n }\n const status = this.symbolicated[type].status;\n\n if (status === 'COMPLETE') {\n return this.flushCallbacks(type);\n }\n\n if (retry) {\n LogBoxSymbolication.deleteStack(this.getStack(type));\n this.handleSymbolicate(type);\n } else {\n if (status === 'NONE') {\n this.handleSymbolicate(type);\n }\n }\n }\n\n private componentStackCache: StackFrame[] | null = null;\n\n private getStack(type: StackType): StackFrame[] {\n if (type === 'component') {\n if (this.componentStackCache == null) {\n this.componentStackCache = componentStackToStack(this.componentStack);\n }\n return this.componentStackCache;\n }\n return this.stack;\n }\n\n private handleSymbolicate(type: StackType): void {\n if (type === 'component' && !this.componentStack?.length) {\n return;\n }\n\n if (this.symbolicated[type].status !== 'PENDING') {\n this.updateStatus(type, null, null, null);\n LogBoxSymbolication.symbolicate(this.getStack(type)).then(\n (data) => {\n this.updateStatus(type, null, data?.stack, data?.codeFrame);\n },\n (error) => {\n this.updateStatus(type, error, null, null);\n }\n );\n }\n }\n\n private updateStatus(\n type: StackType,\n error?: Error | null,\n stack?: StackFrame[] | null,\n codeFrame?: CodeFrame | null\n ): void {\n const lastStatus = this.symbolicated[type].status;\n if (error != null) {\n this.symbolicated[type] = {\n error,\n stack: null,\n status: 'FAILED',\n };\n } else if (stack != null) {\n if (codeFrame) {\n this.codeFrame = codeFrame;\n }\n\n this.symbolicated[type] = {\n error: null,\n stack,\n status: 'COMPLETE',\n };\n } else {\n this.symbolicated[type] = {\n error: null,\n stack: null,\n status: 'PENDING',\n };\n }\n\n const status = this.symbolicated[type].status;\n if (lastStatus !== status) {\n if (['COMPLETE', 'FAILED'].includes(status)) {\n this.flushCallbacks(type);\n }\n }\n }\n}\n"],"names":["LogBoxLog","componentStackToStack","componentStack","map","stack","file","fileName","methodName","content","lineNumber","location","row","column","arguments","constructor","data","symbolicated","error","status","component","callbacks","Map","componentStackCache","level","type","message","category","codeFrame","isComponentError","count","incrementCount","getAvailableStack","getStack","flushCallbacks","get","callback","clear","pushCallback","Set","set","add","retrySymbolicate","_symbolicate","symbolicate","retry","LogBoxSymbolication","deleteStack","handleSymbolicate","length","updateStatus","then","lastStatus","includes"],"mappings":"AAAA;;;;;;CAMC;;;;+BAoDYA;;;eAAAA;;;6EAlDwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCrC,SAASC,sBAAsBC,cAA8B;IAC3D,OAAOA,eAAeC,GAAG,CAAC,CAACC;YAGbA,iBACJA;eAJ4B;YACpCC,MAAMD,MAAME,QAAQ;YACpBC,YAAYH,MAAMI,OAAO;YACzBC,YAAYL,EAAAA,kBAAAA,MAAMM,QAAQ,qBAAdN,gBAAgBO,GAAG,KAAI;YACnCC,QAAQR,EAAAA,mBAAAA,MAAMM,QAAQ,qBAAdN,iBAAgBQ,MAAM,KAAI;YAClCC,WAAW,EAAE;QACf;;AACF;AAUO,MAAMb;IAyBXc,YACEC,IAEC,CACD;aAnBFC,eAAuD;YACrDZ,OAAO;gBACLa,OAAO;gBACPb,OAAO;gBACPc,QAAQ;YACV;YACAC,WAAW;gBACTF,OAAO;gBACPb,OAAO;gBACPc,QAAQ;YACV;QACF;aAEQE,YAAwD,IAAIC;aAkF5DC,sBAA2C;QA3EjD,IAAI,CAACC,KAAK,GAAGR,KAAKQ,KAAK;QACvB,IAAI,CAACC,IAAI,GAAGT,KAAKS,IAAI,IAAI;QACzB,IAAI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BACC,IAAI,CAACgC,YAAY,CAACzB,MAAMP,OAAO,MAAM;YACvC;QAEJ;IACF;IAEQgC,aACNzB,IAAe,EACfP,KAAoB,EACpBb,KAA2B,EAC3BuB,SAA4B,EACtB;QACN,MAAMwB,aAAa,IAAI,CAACnC,YAAY,CAACQ,KAAK,CAACN,MAAM;QACjD,IAAID,SAAS,MAAM;YACjB,IAAI,CAACD,YAAY,CAACQ,KAAK,GAAG;gBACxBP;gBACAb,OAAO;gBACPc,QAAQ;YACV;QACF,OAAO,IAAId,SAAS,MAAM;YACxB,IAAIuB,WAAW;gBACb,IAAI,CAACA,SAAS,GAAGA;YACnB;YAEA,IAAI,CAACX,YAAY,CAACQ,KAAK,GAAG;gBACxBP,OAAO;gBACPb;gBACAc,QAAQ;YACV;QACF,OAAO;YACL,IAAI,CAACF,YAAY,CAACQ,KAAK,GAAG;gBACxBP,OAAO;gBACPb,OAAO;gBACPc,QAAQ;YACV;QACF;QAEA,MAAMA,SAAS,IAAI,CAACF,YAAY,CAACQ,KAAK,CAACN,MAAM;QAC7C,IAAIiC,eAAejC,QAAQ;YACzB,IAAI;gBAAC;gBAAY;aAAS,CAACkC,QAAQ,CAAClC,SAAS;gBAC3C,IAAI,CAACe,cAAc,CAACT;YACtB;QACF;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/start/server/metro/log-box/LogBoxSymbolication.ts"],"sourcesContent":["/**\n * Copyright (c) 650 Industries.\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 { parse, StackFrame as UpstreamStackFrame } from 'stacktrace-parser';\n\nexport type CodeFrame = {\n content: string;\n location?: {\n row: number;\n column: number;\n [key: string]: any;\n } | null;\n fileName: string;\n\n // TODO: When React switched to using call stack frames,\n // we gained the ability to use the collapse flag, but\n // it is not integrated into the LogBox UI.\n collapse?: boolean;\n};\n\nexport type SymbolicatedStackTrace = {\n stack: UpstreamStackFrame[];\n codeFrame?: CodeFrame;\n};\n\nexport type StackFrame = UpstreamStackFrame & {\n collapse?: boolean;\n};\n\nconst cache: Map<StackFrame[], Promise<SymbolicatedStackTrace>> = new Map();\n\n/**\n * Sanitize because sometimes `symbolicateStackTrace` gives us invalid values.\n */\nconst sanitize = ({\n stack: maybeStack,\n codeFrame,\n}: SymbolicatedStackTrace): SymbolicatedStackTrace => {\n if (!Array.isArray(maybeStack)) {\n throw new Error('Expected stack to be an array.');\n }\n const stack: StackFrame[] = [];\n for (const maybeFrame of maybeStack) {\n let collapse = false;\n if ('collapse' in maybeFrame) {\n if (typeof maybeFrame.collapse !== 'boolean') {\n throw new Error('Expected stack frame `collapse` to be a boolean.');\n }\n collapse = maybeFrame.collapse;\n }\n stack.push({\n arguments: maybeFrame.arguments?.map((arg) => String(arg)) ?? [],\n column: maybeFrame.column,\n file: maybeFrame.file,\n lineNumber: maybeFrame.lineNumber,\n methodName: maybeFrame.methodName,\n collapse,\n });\n }\n return { stack, codeFrame };\n};\n\nexport function deleteStack(stack: StackFrame[]): void {\n cache.delete(stack);\n}\n\nexport function symbolicate(stack: StackFrame[]): Promise<SymbolicatedStackTrace> {\n let promise = cache.get(stack);\n if (promise == null) {\n promise = symbolicateStackTrace(stack).then(sanitize);\n cache.set(stack, promise);\n }\n\n return promise;\n}\n\nasync function symbolicateStackTrace(stack: UpstreamStackFrame[]): Promise<SymbolicatedStackTrace> {\n const baseUrl =\n typeof window === 'undefined'\n ? process.env.EXPO_DEV_SERVER_ORIGIN\n : window.location.protocol + '//' + window.location.host;\n\n return fetch(baseUrl + '/symbolicate', {\n method: 'POST',\n body: JSON.stringify({ stack }),\n }).then((res) => res.json());\n}\n\nexport function parseErrorStack(stack?: string): (UpstreamStackFrame & { collapse?: boolean })[] {\n if (stack == null) {\n return [];\n }\n if (Array.isArray(stack)) {\n return stack;\n }\n\n return parse(stack).map((frame) => {\n // Add back support for Hermes native calls:\n // ` at apply (native)`\n // Which are parsed to:\n // {\n // \"file\": null,\n // \"methodName\": \"apply\",\n // \"arguments\": [\"native\"],\n // \"lineNumber\": null,\n // \"column\": null,\n // \"collapse\": false\n // },\n // https://github.com/facebook/react-native/blob/f0ad39446404bb6e027d0c486b579c312f35180a/packages/react-native/Libraries/Core/Devtools/parseHermesStack.js#L70\n if (frame.file == null && frame.arguments?.length === 1 && frame.arguments[0] === 'native') {\n // Use `<native>` to match the `<anonymous>` and `<unknown>` used by other runtimes.\n frame.file = '<native>';\n frame.arguments = [];\n }\n\n // frame.file will mostly look like `http://localhost:8081/index.bundle?platform=web&dev=true&hot=false`\n return {\n ...frame,\n column: frame.column != null ? frame.column - 1 : null,\n };\n });\n}\n"],"names":["deleteStack","parseErrorStack","symbolicate","cache","Map","sanitize","stack","maybeStack","codeFrame","Array","isArray","Error","maybeFrame","collapse","push","arguments","map","arg","String","column","file","lineNumber","methodName","delete","promise","get","symbolicateStackTrace","then","set","baseUrl","window","process","env","EXPO_DEV_SERVER_ORIGIN","location","protocol","host","fetch","method","body","JSON","stringify","res","json","parse","frame","length"],"mappings":"AAAA;;;;;;CAMC;;;;;;;;;;;IA4DeA,WAAW;eAAXA;;IA0BAC,eAAe;eAAfA;;IAtBAC,WAAW;eAAXA;;;;yBA/DwC;;;;;;AA0BxD,MAAMC,QAA4D,IAAIC;AAEtE;;CAEC,GACD,MAAMC,WAAW,CAAC,EAChBC,OAAOC,UAAU,EACjBC,SAAS,EACc;IACvB,IAAI,CAACC,MAAMC,OAAO,CAACH,aAAa;QAC9B,MAAM,IAAII,MAAM;IAClB;IACA,MAAML,QAAsB,EAAE;IAC9B,KAAK,MAAMM,cAAcL,WAAY;YAStBK;QARb,IAAIC,WAAW;QACf,IAAI,cAAcD,YAAY;YAC5B,IAAI,OAAOA,WAAWC,QAAQ,KAAK,WAAW;gBAC5C,MAAM,IAAIF,MAAM;YAClB;YACAE,WAAWD,WAAWC,QAAQ;QAChC;QACAP,MAAMQ,IAAI,CAAC;YACTC,WAAWH,EAAAA,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AA+J;QAC/J,IAAIA,MAAMzB,IAAI,IAAI,QAAQyB,EAAAA,mBAAAA,MAAM9B,SAAS,qBAAf8B,iBAAiBC,MAAM,MAAK,KAAKD,MAAM9B,SAAS,CAAC,EAAE,KAAK,UAAU;YAC1F,oFAAoF;YACpF8B,MAAMzB,IAAI,GAAG;YACbyB,MAAM9B,SAAS,GAAG,EAAE;QACtB;QAEA,wGAAwG;QACxG,OAAO;YACL,GAAG8B,KAAK;YACR1B,QAAQ0B,MAAM1B,MAAM,IAAI,OAAO0B,MAAM1B,MAAM,GAAG,IAAI;QACpD;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../../../src/start/server/metro/log-box/LogBoxSymbolication.ts"],"sourcesContent":["/**\n * Copyright (c) 650 Industries.\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 { parse, StackFrame as UpstreamStackFrame } from 'stacktrace-parser';\n\nexport type CodeFrame = {\n content: string;\n location?: {\n row: number;\n column: number;\n [key: string]: any;\n } | null;\n fileName: string;\n\n // TODO: When React switched to using call stack frames,\n // we gained the ability to use the collapse flag, but\n // it is not integrated into the LogBox UI.\n collapse?: boolean;\n};\n\nexport type SymbolicatedStackTrace = {\n stack: UpstreamStackFrame[];\n codeFrame?: CodeFrame;\n};\n\nexport type StackFrame = UpstreamStackFrame & { collapse?: boolean };\n\nconst cache: Map<StackFrame[], Promise<SymbolicatedStackTrace>> = new Map();\n\n/**\n * Sanitize because sometimes `symbolicateStackTrace` gives us invalid values.\n */\nconst sanitize = ({\n stack: maybeStack,\n codeFrame,\n}: SymbolicatedStackTrace): SymbolicatedStackTrace => {\n if (!Array.isArray(maybeStack)) {\n throw new Error('Expected stack to be an array.');\n }\n const stack: StackFrame[] = [];\n for (const maybeFrame of maybeStack) {\n let collapse = false;\n if ('collapse' in maybeFrame) {\n if (typeof maybeFrame.collapse !== 'boolean') {\n throw new Error('Expected stack frame `collapse` to be a boolean.');\n }\n collapse = maybeFrame.collapse;\n }\n stack.push({\n arguments: maybeFrame.arguments?.map((arg) => String(arg)) ?? [],\n column: maybeFrame.column,\n file: maybeFrame.file,\n lineNumber: maybeFrame.lineNumber,\n methodName: maybeFrame.methodName,\n collapse,\n });\n }\n return { stack, codeFrame };\n};\n\nexport function deleteStack(stack: StackFrame[]): void {\n cache.delete(stack);\n}\n\nexport function symbolicate(stack: StackFrame[]): Promise<SymbolicatedStackTrace> {\n let promise = cache.get(stack);\n if (promise == null) {\n promise = symbolicateStackTrace(stack).then(sanitize);\n cache.set(stack, promise);\n }\n\n return promise;\n}\n\nasync function symbolicateStackTrace(stack: UpstreamStackFrame[]): Promise<SymbolicatedStackTrace> {\n const baseUrl =\n typeof window === 'undefined'\n ? process.env.EXPO_DEV_SERVER_ORIGIN\n : window.location.protocol + '//' + window.location.host;\n\n return fetch(baseUrl + '/symbolicate', {\n method: 'POST',\n body: JSON.stringify({ stack }),\n }).then((res) => res.json());\n}\n\nexport function parseErrorStack(stack?: string): (UpstreamStackFrame & { collapse?: boolean })[] {\n if (stack == null) {\n return [];\n }\n if (Array.isArray(stack)) {\n return stack;\n }\n\n return parse(stack).map((frame) => {\n // Add back support for Hermes native calls:\n // ` at apply (native)`\n // Which are parsed to:\n // {\n // \"file\": null,\n // \"methodName\": \"apply\",\n // \"arguments\": [\"native\"],\n // \"lineNumber\": null,\n // \"column\": null,\n // \"collapse\": false\n // },\n // https://github.com/facebook/react-native/blob/f0ad39446404bb6e027d0c486b579c312f35180a/packages/react-native/Libraries/Core/Devtools/parseHermesStack.js#L70\n if (frame.file == null && frame.arguments?.length === 1 && frame.arguments[0] === 'native') {\n // Use `<native>` to match the `<anonymous>` and `<unknown>` used by other runtimes.\n frame.file = '<native>';\n frame.arguments = [];\n }\n\n // frame.file will mostly look like `http://localhost:8081/index.bundle?platform=web&dev=true&hot=false`\n return {\n ...frame,\n column: frame.column != null ? frame.column - 1 : null,\n };\n });\n}\n"],"names":["deleteStack","parseErrorStack","symbolicate","cache","Map","sanitize","stack","maybeStack","codeFrame","Array","isArray","Error","maybeFrame","collapse","push","arguments","map","arg","String","column","file","lineNumber","methodName","delete","promise","get","symbolicateStackTrace","then","set","baseUrl","window","process","env","EXPO_DEV_SERVER_ORIGIN","location","protocol","host","fetch","method","body","JSON","stringify","res","json","parse","frame","length"],"mappings":"AAAA;;;;;;CAMC;;;;;;;;;;;IA0DeA,WAAW;eAAXA;;IA0BAC,eAAe;eAAfA;;IAtBAC,WAAW;eAAXA;;;;yBA7DwC;;;;;;AAwBxD,MAAMC,QAA4D,IAAIC;AAEtE;;CAEC,GACD,MAAMC,WAAW,CAAC,EAChBC,OAAOC,UAAU,EACjBC,SAAS,EACc;IACvB,IAAI,CAACC,MAAMC,OAAO,CAACH,aAAa;QAC9B,MAAM,IAAII,MAAM;IAClB;IACA,MAAML,QAAsB,EAAE;IAC9B,KAAK,MAAMM,cAAcL,WAAY;YAStBK;QARb,IAAIC,WAAW;QACf,IAAI,cAAcD,YAAY;YAC5B,IAAI,OAAOA,WAAWC,QAAQ,KAAK,WAAW;gBAC5C,MAAM,IAAIF,MAAM;YAClB;YACAE,WAAWD,WAAWC,QAAQ;QAChC;QACAP,MAAMQ,IAAI,CAAC;YACTC,WAAWH,EAAAA,wBAAAA,WAAWG,SAAS,qBAApBH,sBAAsBI,GAAG,CAAC,CAACC,MAAQC,OAAOD,UAAS,EAAE;YAChEE,QAAQP,WAAWO,MAAM;YACzBC,MAAMR,WAAWQ,IAAI;YACrBC,YAAYT,WAAWS,UAAU;YACjCC,YAAYV,WAAWU,UAAU;YACjCT;QACF;IACF;IACA,OAAO;QAAEP;QAAOE;IAAU;AAC5B;AAEO,SAASR,YAAYM,KAAmB;IAC7CH,MAAMoB,MAAM,CAACjB;AACf;AAEO,SAASJ,YAAYI,KAAmB;IAC7C,IAAIkB,UAAUrB,MAAMsB,GAAG,CAACnB;IACxB,IAAIkB,WAAW,MAAM;QACnBA,UAAUE,sBAAsBpB,O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ils() {
56
- const data = require("@expo/log-box/utils");
57
- _utils = function() {
58
- return data;
59
- };
60
- return data;
61
- }
62
55
  function _chalk() {
63
56
  const data = /*#__PURE__*/ _interop_require_default(require("chalk"));
64
57
  _chalk = function() {
@@ -270,13 +263,50 @@ async function logMetroError(projectRoot, { error }) {
270
263
  error
271
264
  });
272
265
  }
266
+ function isTransformError(error) {
267
+ return error.type === 'TransformError';
268
+ }
273
269
  /** @returns the html required to render the static metro error as an SPA. */ function logFromError({ error, projectRoot }) {
274
- const data = (0, _utils().parseWebBuildErrors)({
275
- error,
276
- projectRoot,
277
- parseErrorStack
270
+ // Remap direct Metro Node.js errors to a format that will appear more client-friendly in the logbox UI.
271
+ let stack;
272
+ if (isTransformError(error) && error.filename) {
273
+ // Syntax errors in static rendering.
274
+ stack = [
275
+ {
276
+ file: _path().default.join(projectRoot, error.filename),
277
+ methodName: '<unknown>',
278
+ arguments: [],
279
+ // TODO: Import stack
280
+ lineNumber: error.lineNumber,
281
+ column: error.column
282
+ }
283
+ ];
284
+ } else if ('originModulePath' in error && typeof error.originModulePath === 'string') {
285
+ // TODO: Use import stack here when the error is resolution based.
286
+ stack = [
287
+ {
288
+ file: error.originModulePath,
289
+ methodName: '<unknown>',
290
+ arguments: [],
291
+ // TODO: Import stack
292
+ lineNumber: 0,
293
+ column: 0
294
+ }
295
+ ];
296
+ } else {
297
+ stack = parseErrorStack(projectRoot, error.stack);
298
+ }
299
+ return new _LogBoxLog.LogBoxLog({
300
+ level: 'static',
301
+ message: {
302
+ content: error.message,
303
+ substitutions: []
304
+ },
305
+ isComponentError: false,
306
+ stack,
307
+ category: 'static',
308
+ componentStack: []
278
309
  });
279
- return new _LogBoxLog.LogBoxLog(data);
280
310
  }
281
311
  async function logMetroErrorAsync({ error, projectRoot }) {
282
312
  var _log_symbolicated_stack, _log_symbolicated;
@@ -313,8 +343,7 @@ async function getErrorOverlayHtmlAsync({ error, projectRoot, routerRoot }) {
313
343
  log
314
344
  ]
315
345
  };
316
- const html = `<html><head><style>#root,body,html{height:100%;background-color:black}body{overflow:hidden}#root{display:flex}</style></head><body><div id="root"></div><script id="_expo-static-error" type="application/json">${JSON.stringify(logBoxContext)}</script></body></html>`;
317
- // TODO: We could reuse the pre-built DOM Log Box from @expo/log-box
346
+ const html = `<html><head><style>#root,body,html{height:100%}body{overflow:hidden}#root{display:flex}</style></head><body><div id="root"></div><script id="_expo-static-error" type="application/json">${JSON.stringify(logBoxContext)}</script></body></html>`;
318
347
  const errorOverlayEntry = await (0, _getStaticRenderFunctions.createMetroEndpointAsync)(projectRoot, // Keep the URL relative
319
348
  '', (0, _resolvefrom().default)(projectRoot, 'expo-router/_error'), {
320
349
  mode: 'development',