@expo/cli 54.1.0-canary-20251013-623c5a6 → 54.1.0-canary-20251023-4c86f95

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 (121) hide show
  1. package/build/bin/cli +1 -1
  2. package/build/src/export/embed/exportEmbedAsync.js +43 -3
  3. package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
  4. package/build/src/export/embed/resolveOptions.js.map +1 -1
  5. package/build/src/export/index.js +2 -1
  6. package/build/src/export/index.js.map +1 -1
  7. package/build/src/export/resolveOptions.js +1 -1
  8. package/build/src/export/resolveOptions.js.map +1 -1
  9. package/build/src/start/server/metro/MetroBundlerDevServer.js +29 -9
  10. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
  11. package/build/src/start/server/metro/MetroTerminalReporter.js +2 -4
  12. package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
  13. package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
  14. package/build/src/start/server/metro/externals.js +0 -11
  15. package/build/src/start/server/metro/externals.js.map +1 -1
  16. package/build/src/start/server/metro/fetchRouterManifest.js +1 -1
  17. package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
  18. package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -1
  19. package/build/src/start/server/metro/instantiateMetro.js +14 -10
  20. package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
  21. package/build/src/start/server/metro/log-box/LogBoxLog.js +11 -7
  22. package/build/src/start/server/metro/log-box/LogBoxLog.js.map +1 -1
  23. package/build/src/start/server/metro/log-box/LogBoxSymbolication.js.map +1 -1
  24. package/build/src/start/server/metro/metroErrorInterface.js +14 -43
  25. package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
  26. package/build/src/start/server/metro/withMetroMultiPlatform.js +55 -43
  27. package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
  28. package/build/src/start/server/middleware/metroOptions.js.map +1 -1
  29. package/build/src/start/server/serverLogLikeMetro.js +1 -1
  30. package/build/src/start/server/serverLogLikeMetro.js.map +1 -1
  31. package/build/src/utils/env.js +6 -0
  32. package/build/src/utils/env.js.map +1 -1
  33. package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
  34. package/build/src/utils/telemetry/utils/context.js +1 -1
  35. package/package.json +20 -18
  36. package/static/canary/react-is/cjs/react-is.development.js +0 -133
  37. package/static/canary/react-is/cjs/react-is.production.js +0 -130
  38. package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-dev.js +0 -16820
  39. package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-prod.js +0 -10552
  40. package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-profiling.js +0 -11255
  41. package/static/canary/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +0 -17064
  42. package/static/canary/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +0 -10742
  43. package/static/canary/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +0 -11450
  44. package/static/canary/scheduler/cjs/scheduler-unstable_mock.development.js +0 -414
  45. package/static/canary/scheduler/cjs/scheduler-unstable_mock.production.js +0 -406
  46. package/static/canary/scheduler/cjs/scheduler-unstable_post_task.development.js +0 -150
  47. package/static/canary/scheduler/cjs/scheduler-unstable_post_task.production.js +0 -140
  48. package/static/canary/scheduler/cjs/scheduler.development.js +0 -364
  49. package/static/canary/scheduler/cjs/scheduler.native.development.js +0 -350
  50. package/static/canary/scheduler/cjs/scheduler.native.production.js +0 -330
  51. package/static/canary/scheduler/cjs/scheduler.production.js +0 -340
  52. package/static/canary-full/node_modules/react/LICENSE +0 -21
  53. package/static/canary-full/node_modules/react/README.md +0 -37
  54. package/static/canary-full/node_modules/react/cjs/react-compiler-runtime.development.js +0 -24
  55. package/static/canary-full/node_modules/react/cjs/react-compiler-runtime.production.js +0 -16
  56. package/static/canary-full/node_modules/react/cjs/react-compiler-runtime.profiling.js +0 -16
  57. package/static/canary-full/node_modules/react/cjs/react-jsx-dev-runtime.development.js +0 -349
  58. package/static/canary-full/node_modules/react/cjs/react-jsx-dev-runtime.production.js +0 -14
  59. package/static/canary-full/node_modules/react/cjs/react-jsx-dev-runtime.profiling.js +0 -14
  60. package/static/canary-full/node_modules/react/cjs/react-jsx-dev-runtime.react-server.development.js +0 -385
  61. package/static/canary-full/node_modules/react/cjs/react-jsx-dev-runtime.react-server.production.js +0 -40
  62. package/static/canary-full/node_modules/react/cjs/react-jsx-runtime.development.js +0 -358
  63. package/static/canary-full/node_modules/react/cjs/react-jsx-runtime.production.js +0 -34
  64. package/static/canary-full/node_modules/react/cjs/react-jsx-runtime.profiling.js +0 -34
  65. package/static/canary-full/node_modules/react/cjs/react-jsx-runtime.react-server.development.js +0 -385
  66. package/static/canary-full/node_modules/react/cjs/react-jsx-runtime.react-server.production.js +0 -40
  67. package/static/canary-full/node_modules/react/cjs/react.development.js +0 -1250
  68. package/static/canary-full/node_modules/react/cjs/react.production.js +0 -544
  69. package/static/canary-full/node_modules/react/cjs/react.react-server.development.js +0 -815
  70. package/static/canary-full/node_modules/react/cjs/react.react-server.production.js +0 -429
  71. package/static/canary-full/node_modules/react/compiler-runtime.js +0 -14
  72. package/static/canary-full/node_modules/react/index.js +0 -7
  73. package/static/canary-full/node_modules/react/jsx-dev-runtime.js +0 -7
  74. package/static/canary-full/node_modules/react/jsx-dev-runtime.react-server.js +0 -7
  75. package/static/canary-full/node_modules/react/jsx-runtime.js +0 -7
  76. package/static/canary-full/node_modules/react/jsx-runtime.react-server.js +0 -7
  77. package/static/canary-full/node_modules/react/package.json +0 -51
  78. package/static/canary-full/node_modules/react/react.react-server.js +0 -7
  79. package/static/canary-full/node_modules/react-dom/LICENSE +0 -21
  80. package/static/canary-full/node_modules/react-dom/README.md +0 -60
  81. package/static/canary-full/node_modules/react-dom/cjs/react-dom-client.development.js +0 -25089
  82. package/static/canary-full/node_modules/react-dom/cjs/react-dom-client.production.js +0 -15426
  83. package/static/canary-full/node_modules/react-dom/cjs/react-dom-profiling.development.js +0 -25476
  84. package/static/canary-full/node_modules/react-dom/cjs/react-dom-profiling.profiling.js +0 -16296
  85. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js +0 -9035
  86. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.js +0 -5892
  87. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.js +0 -9035
  88. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.js +0 -5972
  89. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.browser.development.js +0 -9424
  90. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.browser.production.js +0 -6384
  91. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.bun.development.js +0 -8739
  92. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.bun.production.js +0 -5967
  93. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.edge.development.js +0 -9443
  94. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.edge.production.js +0 -6477
  95. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.node.development.js +0 -9317
  96. package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.node.production.js +0 -6372
  97. package/static/canary-full/node_modules/react-dom/cjs/react-dom-test-utils.development.js +0 -24
  98. package/static/canary-full/node_modules/react-dom/cjs/react-dom-test-utils.production.js +0 -21
  99. package/static/canary-full/node_modules/react-dom/cjs/react-dom.development.js +0 -424
  100. package/static/canary-full/node_modules/react-dom/cjs/react-dom.production.js +0 -210
  101. package/static/canary-full/node_modules/react-dom/cjs/react-dom.react-server.development.js +0 -340
  102. package/static/canary-full/node_modules/react-dom/cjs/react-dom.react-server.production.js +0 -152
  103. package/static/canary-full/node_modules/react-dom/client.js +0 -38
  104. package/static/canary-full/node_modules/react-dom/client.react-server.js +0 -5
  105. package/static/canary-full/node_modules/react-dom/index.js +0 -38
  106. package/static/canary-full/node_modules/react-dom/package.json +0 -117
  107. package/static/canary-full/node_modules/react-dom/profiling.js +0 -38
  108. package/static/canary-full/node_modules/react-dom/profiling.react-server.js +0 -5
  109. package/static/canary-full/node_modules/react-dom/react-dom.react-server.js +0 -7
  110. package/static/canary-full/node_modules/react-dom/server.browser.js +0 -18
  111. package/static/canary-full/node_modules/react-dom/server.bun.js +0 -19
  112. package/static/canary-full/node_modules/react-dom/server.edge.js +0 -19
  113. package/static/canary-full/node_modules/react-dom/server.js +0 -3
  114. package/static/canary-full/node_modules/react-dom/server.node.js +0 -18
  115. package/static/canary-full/node_modules/react-dom/server.react-server.js +0 -5
  116. package/static/canary-full/node_modules/react-dom/static.browser.js +0 -12
  117. package/static/canary-full/node_modules/react-dom/static.edge.js +0 -12
  118. package/static/canary-full/node_modules/react-dom/static.js +0 -3
  119. package/static/canary-full/node_modules/react-dom/static.node.js +0 -12
  120. package/static/canary-full/node_modules/react-dom/static.react-server.js +0 -5
  121. package/static/canary-full/node_modules/react-dom/test-utils.js +0 -7
package/build/bin/cli CHANGED
@@ -123,7 +123,7 @@ const args = (0, _arg().default)({
123
123
  });
124
124
  if (args['--version']) {
125
125
  // Version is added in the build script.
126
- console.log("54.1.0-canary-20251013-623c5a6");
126
+ console.log("54.1.0-canary-20251023-4c86f95");
127
127
  process.exit(0);
128
128
  }
129
129
  if (args['--non-interactive']) {
@@ -52,7 +52,7 @@ function _splitBundleOptions() {
52
52
  return data;
53
53
  }
54
54
  function _bundle() {
55
- const data = /*#__PURE__*/ _interop_require_default(require("@expo/metro/metro/shared/output/bundle"));
55
+ const data = /*#__PURE__*/ _interop_require_wildcard(require("@expo/metro/metro/shared/output/bundle"));
56
56
  _bundle = function() {
57
57
  return data;
58
58
  };
@@ -118,6 +118,47 @@ function _interop_require_default(obj) {
118
118
  default: obj
119
119
  };
120
120
  }
121
+ function _getRequireWildcardCache(nodeInterop) {
122
+ if (typeof WeakMap !== "function") return null;
123
+ var cacheBabelInterop = new WeakMap();
124
+ var cacheNodeInterop = new WeakMap();
125
+ return (_getRequireWildcardCache = function(nodeInterop) {
126
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
127
+ })(nodeInterop);
128
+ }
129
+ function _interop_require_wildcard(obj, nodeInterop) {
130
+ if (!nodeInterop && obj && obj.__esModule) {
131
+ return obj;
132
+ }
133
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
134
+ return {
135
+ default: obj
136
+ };
137
+ }
138
+ var cache = _getRequireWildcardCache(nodeInterop);
139
+ if (cache && cache.has(obj)) {
140
+ return cache.get(obj);
141
+ }
142
+ var newObj = {
143
+ __proto__: null
144
+ };
145
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
146
+ for(var key in obj){
147
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
148
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
149
+ if (desc && (desc.get || desc.set)) {
150
+ Object.defineProperty(newObj, key, desc);
151
+ } else {
152
+ newObj[key] = obj[key];
153
+ }
154
+ }
155
+ }
156
+ newObj.default = obj;
157
+ if (cache) {
158
+ cache.set(obj, newObj);
159
+ }
160
+ return newObj;
161
+ }
121
162
  const debug = require('debug')('expo:export:embed');
122
163
  function guessCopiedAppleBundlePath(bundleOutput) {
123
164
  // Ensure the path is familiar before guessing.
@@ -197,8 +238,7 @@ async function exportEmbedInternalAsync(projectRoot, options) {
197
238
  const hasDomComponents = domComponentProxyOutputDir && files.size > 0;
198
239
  // Persist bundle and source maps.
199
240
  await Promise.all([
200
- // @ts-expect-error: The `save()` method from metro is typed to support `code: string` only but it also supports `Buffer` actually.
201
- _bundle().default.save(bundle, options, _log.Log.log),
241
+ _bundle().save(bundle, options, _log.Log.log),
202
242
  // Write dom components proxy files.
203
243
  hasDomComponents ? (0, _saveAssets.persistMetroFilesAsync)(files, domComponentProxyOutputDir) : null,
204
244
  // Copy public folder for dom components only if
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/export/embed/exportEmbedAsync.ts"],"sourcesContent":["/**\n * Copyright © 2023 650 Industries.\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 { getConfig } from '@expo/config';\nimport Server from '@expo/metro/metro/Server';\nimport splitBundleOptions from '@expo/metro/metro/lib/splitBundleOptions';\nimport output from '@expo/metro/metro/shared/output/bundle';\nimport type { BundleOptions } from '@expo/metro/metro/shared/types.flow';\nimport getMetroAssets from '@expo/metro-config/build/transform-worker/getAssets';\nimport assert from 'assert';\nimport fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport path from 'path';\n\nimport { deserializeEagerKey, getExportEmbedOptionsKey, Options } from './resolveOptions';\nimport { isExecutingFromXcodebuild, logMetroErrorInXcode } from './xcodeCompilerLogger';\nimport { Log } from '../../log';\nimport { DevServerManager } from '../../start/server/DevServerManager';\nimport { MetroBundlerDevServer } from '../../start/server/metro/MetroBundlerDevServer';\nimport { loadMetroConfigAsync } from '../../start/server/metro/instantiateMetro';\nimport { DOM_COMPONENTS_BUNDLE_DIR } from '../../start/server/middleware/DomComponentsMiddleware';\nimport { getMetroDirectBundleOptionsForExpoConfig } from '../../start/server/middleware/metroOptions';\nimport { stripAnsi } from '../../utils/ansi';\nimport { copyAsync, removeAsync } from '../../utils/dir';\nimport { env } from '../../utils/env';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { exportDomComponentAsync } from '../exportDomComponents';\nimport { isEnableHermesManaged } from '../exportHermes';\nimport { persistMetroAssetsAsync } from '../persistMetroAssets';\nimport { copyPublicFolderAsync } from '../publicFolder';\nimport { BundleAssetWithFileHashes, ExportAssetMap, persistMetroFilesAsync } from '../saveAssets';\nimport { exportStandaloneServerAsync } from './exportServer';\nimport { ensureProcessExitsAfterDelay } from '../../utils/exit';\nimport { resolveRealEntryFilePath } from '../../utils/filePath';\n\nconst debug = require('debug')('expo:export:embed');\n\n/**\n * Extended type for the Metro server build result to support the `code` property as a `Buffer`.\n */\ntype ExtendedMetroServerBuildResult =\n | Awaited<ReturnType<Server['build']>>\n | {\n code: string | Buffer;\n };\n\nfunction guessCopiedAppleBundlePath(bundleOutput: string) {\n // Ensure the path is familiar before guessing.\n if (\n !bundleOutput.match(/\\/Xcode\\/DerivedData\\/.*\\/Build\\/Products\\//) &&\n !bundleOutput.match(/\\/CoreSimulator\\/Devices\\/.*\\/data\\/Containers\\/Bundle\\/Application\\//)\n ) {\n debug('Bundling to non-standard location:', bundleOutput);\n return false;\n }\n const bundleName = path.basename(bundleOutput);\n const bundleParent = path.dirname(bundleOutput);\n const possiblePath = globSync(`*.app/${bundleName}`, {\n cwd: bundleParent,\n absolute: true,\n // bundle identifiers can start with dots.\n dot: true,\n })[0];\n debug('Possible path for previous bundle:', possiblePath);\n return possiblePath;\n}\n\nexport async function exportEmbedAsync(projectRoot: string, options: Options) {\n // The React Native build scripts always enable the cache reset but we shouldn't need this in CI environments.\n // By disabling it, we can eagerly bundle code before the build and reuse the cached artifacts in subsequent builds.\n if (env.CI && options.resetCache) {\n debug('CI environment detected, disabling automatic cache reset');\n options.resetCache = false;\n }\n\n setNodeEnv(options.dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n\n // This is an optimized codepath that can occur during `npx expo run` and does not occur during builds from Xcode or Android Studio.\n // Here we reconcile a bundle pass that was run before the native build process. This order can fail faster and is show better errors since the logs won't be obscured by Xcode and Android Studio.\n // This path is also used for automatically deploying server bundles to a remote host.\n const eagerBundleOptions = env.__EXPO_EAGER_BUNDLE_OPTIONS\n ? deserializeEagerKey(env.__EXPO_EAGER_BUNDLE_OPTIONS)\n : null;\n if (eagerBundleOptions) {\n // Get the cache key for the current process to compare against the eager key.\n const inputKey = getExportEmbedOptionsKey(options);\n\n // If the app was bundled previously in the same process, then we should reuse the Metro cache.\n options.resetCache = false;\n\n if (eagerBundleOptions.key === inputKey) {\n // Copy the eager bundleOutput and assets to the new locations.\n await removeAsync(options.bundleOutput);\n\n copyAsync(eagerBundleOptions.options.bundleOutput, options.bundleOutput);\n\n if (eagerBundleOptions.options.assetsDest && options.assetsDest) {\n copyAsync(eagerBundleOptions.options.assetsDest, options.assetsDest);\n }\n\n console.log('info: Copied output to binary:', options.bundleOutput);\n return;\n }\n // TODO: sourcemapOutput is set on Android but not during eager. This is tolerable since it doesn't invalidate the Metro cache.\n console.log(' Eager key:', eagerBundleOptions.key);\n console.log('Request key:', inputKey);\n\n // TODO: We may want an analytic event here in the future to understand when this happens.\n console.warn('warning: Eager bundle does not match new options, bundling again.');\n }\n\n await exportEmbedInternalAsync(projectRoot, options);\n\n // Ensure the process closes after bundling\n ensureProcessExitsAfterDelay();\n}\n\nexport async function exportEmbedInternalAsync(projectRoot: string, options: Options) {\n // Ensure we delete the old bundle to trigger a failure if the bundle cannot be created.\n await removeAsync(options.bundleOutput);\n\n // The iOS bundle is copied in to the Xcode project, so we need to remove the old one\n // to prevent Xcode from loading the old one after a build failure.\n if (options.platform === 'ios') {\n const previousPath = guessCopiedAppleBundlePath(options.bundleOutput);\n if (previousPath && fs.existsSync(previousPath)) {\n debug('Removing previous iOS bundle:', previousPath);\n await removeAsync(previousPath);\n }\n }\n\n const { bundle, assets, files } = await exportEmbedBundleAndAssetsAsync(projectRoot, options);\n\n fs.mkdirSync(path.dirname(options.bundleOutput), { recursive: true, mode: 0o755 });\n\n // On Android, dom components proxy files should write to the assets directory instead of the res directory.\n // We use the bundleOutput directory to get the assets directory.\n const domComponentProxyOutputDir =\n options.platform === 'android' ? path.dirname(options.bundleOutput) : options.assetsDest;\n const hasDomComponents = domComponentProxyOutputDir && files.size > 0;\n\n // Persist bundle and source maps.\n await Promise.all([\n // @ts-expect-error: The `save()` method from metro is typed to support `code: string` only but it also supports `Buffer` actually.\n output.save(bundle, options, Log.log),\n\n // Write dom components proxy files.\n hasDomComponents ? persistMetroFilesAsync(files, domComponentProxyOutputDir) : null,\n // Copy public folder for dom components only if\n hasDomComponents\n ? copyPublicFolderAsync(\n path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER),\n path.join(domComponentProxyOutputDir, DOM_COMPONENTS_BUNDLE_DIR)\n )\n : null,\n\n // NOTE(EvanBacon): This may need to be adjusted in the future if want to support baseUrl on native\n // platforms when doing production embeds (unlikely).\n options.assetsDest\n ? persistMetroAssetsAsync(projectRoot, assets, {\n platform: options.platform,\n outputDirectory: options.assetsDest,\n iosAssetCatalogDirectory: options.assetCatalogDest,\n })\n : null,\n ]);\n}\n\nexport async function exportEmbedBundleAndAssetsAsync(\n projectRoot: string,\n options: Options\n): Promise<{\n bundle: ExtendedMetroServerBuildResult;\n assets: readonly BundleAssetWithFileHashes[];\n files: ExportAssetMap;\n}> {\n const devServerManager = await DevServerManager.startMetroAsync(projectRoot, {\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n port: 8081,\n isExporting: true,\n location: {},\n resetDevServer: options.resetCache,\n maxWorkers: options.maxWorkers,\n });\n\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const { exp, pkg } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n const files: ExportAssetMap = new Map();\n\n try {\n const bundles = await devServer.nativeExportBundleAsync(\n exp,\n {\n // TODO: Re-enable when we get bytecode chunk splitting working again.\n splitChunks: false, //devServer.isReactServerComponentsEnabled,\n mainModuleName: resolveRealEntryFilePath(projectRoot, options.entryFile),\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: !!sourceMapUrl,\n bytecode: options.bytecode ?? false,\n // source map inline\n reactCompiler: !!exp.experiments?.reactCompiler,\n },\n files,\n {\n sourceMapUrl,\n unstable_transformProfile: (options.unstableTransformProfile ||\n (isHermes ? 'hermes-stable' : 'default')) as BundleOptions['unstable_transformProfile'],\n }\n );\n\n const apiRoutesEnabled =\n devServer.isReactServerComponentsEnabled || exp.web?.output === 'server';\n\n if (apiRoutesEnabled) {\n await exportStandaloneServerAsync(projectRoot, devServer, {\n exp,\n pkg,\n files,\n options,\n });\n }\n\n // TODO: Remove duplicates...\n const expoDomComponentReferences = bundles.artifacts\n .map((artifact) =>\n Array.isArray(artifact.metadata.expoDomComponentReferences)\n ? artifact.metadata.expoDomComponentReferences\n : []\n )\n .flat();\n if (expoDomComponentReferences.length > 0) {\n await Promise.all(\n // TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.\n expoDomComponentReferences.map(async (filePath) => {\n const { bundle } = await exportDomComponentAsync({\n filePath,\n projectRoot,\n dev: options.dev,\n devServer,\n isHermes,\n includeSourceMaps: !!sourceMapUrl,\n exp,\n files,\n });\n\n if (options.assetsDest) {\n // Save assets like a typical bundler, preserving the file paths on web.\n // This is saving web-style inside of a native app's binary.\n await persistMetroAssetsAsync(\n projectRoot,\n bundle.assets.map((asset) => ({\n ...asset,\n httpServerLocation: path.join(DOM_COMPONENTS_BUNDLE_DIR, asset.httpServerLocation),\n })),\n {\n files,\n platform: 'web',\n outputDirectory: options.assetsDest,\n }\n );\n }\n })\n );\n }\n\n return {\n files,\n bundle: {\n code: bundles.artifacts.filter((a: any) => a.type === 'js')[0].source,\n // Can be optional when source maps aren't enabled.\n map: bundles.artifacts.filter((a: any) => a.type === 'map')[0]?.source.toString(),\n },\n assets: bundles.assets,\n };\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (options.platform === 'ios') {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n } finally {\n devServerManager.stopAsync();\n }\n}\n\n// Exports for expo-updates\nexport async function createMetroServerAndBundleRequestAsync(\n projectRoot: string,\n options: Pick<\n Options,\n | 'maxWorkers'\n | 'config'\n | 'platform'\n | 'sourcemapOutput'\n | 'sourcemapUseAbsolutePath'\n | 'entryFile'\n | 'minify'\n | 'dev'\n | 'resetCache'\n | 'unstableTransformProfile'\n >\n): Promise<{ server: Server; bundleRequest: BundleOptions }> {\n const exp = getConfig(projectRoot, { skipSDKVersionRequirement: true }).exp;\n\n // TODO: This is slow ~40ms\n const { config } = await loadMetroConfigAsync(\n projectRoot,\n {\n // TODO: This is always enabled in the native script and there's no way to disable it.\n resetCache: options.resetCache,\n\n maxWorkers: options.maxWorkers,\n config: options.config,\n },\n {\n exp,\n isExporting: true,\n getMetroBundler() {\n return server.getBundler().getBundler();\n },\n }\n );\n\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n // TODO(cedric): check if we can use the proper `bundleType=bundle` and `entryPoint=mainModuleName` properties\n // @ts-expect-error: see above\n const bundleRequest: BundleOptions = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n ...getMetroDirectBundleOptionsForExpoConfig(projectRoot, exp, {\n splitChunks: false,\n mainModuleName: resolveRealEntryFilePath(projectRoot, options.entryFile),\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n isExporting: true,\n // Never output bytecode in the exported bundle since that is hardcoded in the native run script.\n bytecode: false,\n hosted: false,\n }),\n sourceMapUrl,\n unstable_transformProfile: (options.unstableTransformProfile ||\n (isHermes ? 'hermes-stable' : 'default')) as BundleOptions['unstable_transformProfile'],\n };\n\n const server = new Server(config, {\n watch: false,\n });\n\n return { server, bundleRequest };\n}\n\nexport async function exportEmbedAssetsAsync(\n server: Server,\n bundleRequest: BundleOptions,\n projectRoot: string,\n options: Pick<Options, 'platform'>\n) {\n try {\n const { entryFile, onProgress, resolverOptions, transformOptions } = splitBundleOptions({\n ...bundleRequest,\n // @ts-ignore-error TODO(@kitten): Very unclear why this is here. Remove?\n bundleType: 'todo',\n });\n\n const dependencies = await server._bundler.getDependencies(\n [entryFile],\n transformOptions,\n resolverOptions,\n { onProgress, shallow: false, lazy: false }\n );\n\n const config = server._config;\n\n return getMetroAssets(dependencies, {\n processModuleFilter: config.serializer.processModuleFilter,\n assetPlugins: config.transformer.assetPlugins,\n platform: transformOptions.platform!,\n // Forked out of Metro because the `this._getServerRootDir()` doesn't match the development\n // behavior.\n projectRoot: config.projectRoot, // this._getServerRootDir(),\n publicPath: config.transformer.publicPath,\n isHosted: false,\n });\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (options.platform === 'ios') {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n }\n}\n\nfunction isError(error: any): error is Error {\n return error instanceof Error;\n}\n"],"names":["createMetroServerAndBundleRequestAsync","exportEmbedAssetsAsync","exportEmbedAsync","exportEmbedBundleAndAssetsAsync","exportEmbedInternalAsync","debug","require","guessCopiedAppleBundlePath","bundleOutput","match","bundleName","path","basename","bundleParent","dirname","possiblePath","globSync","cwd","absolute","dot","projectRoot","options","env","CI","resetCache","setNodeEnv","dev","load","eagerBundleOptions","__EXPO_EAGER_BUNDLE_OPTIONS","deserializeEagerKey","inputKey","getExportEmbedOptionsKey","key","removeAsync","copyAsync","assetsDest","console","log","warn","ensureProcessExitsAfterDelay","platform","previousPath","fs","existsSync","bundle","assets","files","mkdirSync","recursive","mode","domComponentProxyOutputDir","hasDomComponents","size","Promise","all","output","save","Log","persistMetroFilesAsync","copyPublicFolderAsync","resolve","EXPO_PUBLIC_FOLDER","join","DOM_COMPONENTS_BUNDLE_DIR","persistMetroAssetsAsync","outputDirectory","iosAssetCatalogDirectory","assetCatalogDest","devServerManager","DevServerManager","startMetroAsync","minify","port","isExporting","location","resetDevServer","maxWorkers","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","exp","pkg","getConfig","skipSDKVersionRequirement","isHermes","isEnableHermesManaged","sourceMapUrl","sourcemapOutput","sourcemapUseAbsolutePath","Map","bundles","nativeExportBundleAsync","splitChunks","mainModuleName","resolveRealEntryFilePath","entryFile","engine","undefined","serializerIncludeMaps","bytecode","reactCompiler","experiments","unstable_transformProfile","unstableTransformProfile","apiRoutesEnabled","isReactServerComponentsEnabled","web","exportStandaloneServerAsync","expoDomComponentReferences","artifacts","map","artifact","Array","isArray","metadata","flat","length","filePath","exportDomComponentAsync","includeSourceMaps","asset","httpServerLocation","code","filter","a","type","source","toString","error","isError","isExecutingFromXcodebuild","message","stripAnsi","logMetroErrorInXcode","stopAsync","config","loadMetroConfigAsync","getMetroBundler","server","getBundler","bundleRequest","Server","DEFAULT_BUNDLE_OPTIONS","getMetroDirectBundleOptionsForExpoConfig","hosted","watch","onProgress","resolverOptions","transformOptions","splitBundleOptions","bundleType","dependencies","_bundler","getDependencies","shallow","lazy","_config","getMetroAssets","processModuleFilter","serializer","assetPlugins","transformer","publicPath","isHosted","Error"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;IAiTqBA,sCAAsC;eAAtCA;;IAwEAC,sBAAsB;eAAtBA;;IAxTAC,gBAAgB;eAAhBA;;IAsGAC,+BAA+B;eAA/BA;;IAnDAC,wBAAwB;eAAxBA;;;;yBAnHI;;;;;;;gEACP;;;;;;;gEACY;;;;;;;gEACZ;;;;;;;gEAEQ;;;;;;;gEACR;;;;;;;gEACJ;;;;;;;yBACkB;;;;;;;gEAChB;;;;;;gCAEsD;qCACP;qBAC5C;kCACa;uCACK;kCACD;yCACK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Industries.\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 { getConfig } from '@expo/config';\nimport Server from '@expo/metro/metro/Server';\nimport splitBundleOptions from '@expo/metro/metro/lib/splitBundleOptions';\nimport * as output from '@expo/metro/metro/shared/output/bundle';\nimport type { BundleOptions } from '@expo/metro/metro/shared/types';\nimport getMetroAssets from '@expo/metro-config/build/transform-worker/getAssets';\nimport assert from 'assert';\nimport fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport path from 'path';\n\nimport { deserializeEagerKey, getExportEmbedOptionsKey, Options } from './resolveOptions';\nimport { isExecutingFromXcodebuild, logMetroErrorInXcode } from './xcodeCompilerLogger';\nimport { Log } from '../../log';\nimport { DevServerManager } from '../../start/server/DevServerManager';\nimport { MetroBundlerDevServer } from '../../start/server/metro/MetroBundlerDevServer';\nimport { loadMetroConfigAsync } from '../../start/server/metro/instantiateMetro';\nimport { DOM_COMPONENTS_BUNDLE_DIR } from '../../start/server/middleware/DomComponentsMiddleware';\nimport { getMetroDirectBundleOptionsForExpoConfig } from '../../start/server/middleware/metroOptions';\nimport { stripAnsi } from '../../utils/ansi';\nimport { copyAsync, removeAsync } from '../../utils/dir';\nimport { env } from '../../utils/env';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { exportDomComponentAsync } from '../exportDomComponents';\nimport { isEnableHermesManaged } from '../exportHermes';\nimport { persistMetroAssetsAsync } from '../persistMetroAssets';\nimport { copyPublicFolderAsync } from '../publicFolder';\nimport { BundleAssetWithFileHashes, ExportAssetMap, persistMetroFilesAsync } from '../saveAssets';\nimport { exportStandaloneServerAsync } from './exportServer';\nimport { ensureProcessExitsAfterDelay } from '../../utils/exit';\nimport { resolveRealEntryFilePath } from '../../utils/filePath';\n\nconst debug = require('debug')('expo:export:embed');\n\nfunction guessCopiedAppleBundlePath(bundleOutput: string) {\n // Ensure the path is familiar before guessing.\n if (\n !bundleOutput.match(/\\/Xcode\\/DerivedData\\/.*\\/Build\\/Products\\//) &&\n !bundleOutput.match(/\\/CoreSimulator\\/Devices\\/.*\\/data\\/Containers\\/Bundle\\/Application\\//)\n ) {\n debug('Bundling to non-standard location:', bundleOutput);\n return false;\n }\n const bundleName = path.basename(bundleOutput);\n const bundleParent = path.dirname(bundleOutput);\n const possiblePath = globSync(`*.app/${bundleName}`, {\n cwd: bundleParent,\n absolute: true,\n // bundle identifiers can start with dots.\n dot: true,\n })[0];\n debug('Possible path for previous bundle:', possiblePath);\n return possiblePath;\n}\n\nexport async function exportEmbedAsync(projectRoot: string, options: Options) {\n // The React Native build scripts always enable the cache reset but we shouldn't need this in CI environments.\n // By disabling it, we can eagerly bundle code before the build and reuse the cached artifacts in subsequent builds.\n if (env.CI && options.resetCache) {\n debug('CI environment detected, disabling automatic cache reset');\n options.resetCache = false;\n }\n\n setNodeEnv(options.dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n\n // This is an optimized codepath that can occur during `npx expo run` and does not occur during builds from Xcode or Android Studio.\n // Here we reconcile a bundle pass that was run before the native build process. This order can fail faster and is show better errors since the logs won't be obscured by Xcode and Android Studio.\n // This path is also used for automatically deploying server bundles to a remote host.\n const eagerBundleOptions = env.__EXPO_EAGER_BUNDLE_OPTIONS\n ? deserializeEagerKey(env.__EXPO_EAGER_BUNDLE_OPTIONS)\n : null;\n if (eagerBundleOptions) {\n // Get the cache key for the current process to compare against the eager key.\n const inputKey = getExportEmbedOptionsKey(options);\n\n // If the app was bundled previously in the same process, then we should reuse the Metro cache.\n options.resetCache = false;\n\n if (eagerBundleOptions.key === inputKey) {\n // Copy the eager bundleOutput and assets to the new locations.\n await removeAsync(options.bundleOutput);\n\n copyAsync(eagerBundleOptions.options.bundleOutput, options.bundleOutput);\n\n if (eagerBundleOptions.options.assetsDest && options.assetsDest) {\n copyAsync(eagerBundleOptions.options.assetsDest, options.assetsDest);\n }\n\n console.log('info: Copied output to binary:', options.bundleOutput);\n return;\n }\n // TODO: sourcemapOutput is set on Android but not during eager. This is tolerable since it doesn't invalidate the Metro cache.\n console.log(' Eager key:', eagerBundleOptions.key);\n console.log('Request key:', inputKey);\n\n // TODO: We may want an analytic event here in the future to understand when this happens.\n console.warn('warning: Eager bundle does not match new options, bundling again.');\n }\n\n await exportEmbedInternalAsync(projectRoot, options);\n\n // Ensure the process closes after bundling\n ensureProcessExitsAfterDelay();\n}\n\nexport async function exportEmbedInternalAsync(projectRoot: string, options: Options) {\n // Ensure we delete the old bundle to trigger a failure if the bundle cannot be created.\n await removeAsync(options.bundleOutput);\n\n // The iOS bundle is copied in to the Xcode project, so we need to remove the old one\n // to prevent Xcode from loading the old one after a build failure.\n if (options.platform === 'ios') {\n const previousPath = guessCopiedAppleBundlePath(options.bundleOutput);\n if (previousPath && fs.existsSync(previousPath)) {\n debug('Removing previous iOS bundle:', previousPath);\n await removeAsync(previousPath);\n }\n }\n\n const { bundle, assets, files } = await exportEmbedBundleAndAssetsAsync(projectRoot, options);\n\n fs.mkdirSync(path.dirname(options.bundleOutput), { recursive: true, mode: 0o755 });\n\n // On Android, dom components proxy files should write to the assets directory instead of the res directory.\n // We use the bundleOutput directory to get the assets directory.\n const domComponentProxyOutputDir =\n options.platform === 'android' ? path.dirname(options.bundleOutput) : options.assetsDest;\n const hasDomComponents = domComponentProxyOutputDir && files.size > 0;\n\n // Persist bundle and source maps.\n await Promise.all([\n output.save(bundle, options, Log.log),\n\n // Write dom components proxy files.\n hasDomComponents ? persistMetroFilesAsync(files, domComponentProxyOutputDir) : null,\n // Copy public folder for dom components only if\n hasDomComponents\n ? copyPublicFolderAsync(\n path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER),\n path.join(domComponentProxyOutputDir, DOM_COMPONENTS_BUNDLE_DIR)\n )\n : null,\n\n // NOTE(EvanBacon): This may need to be adjusted in the future if want to support baseUrl on native\n // platforms when doing production embeds (unlikely).\n options.assetsDest\n ? persistMetroAssetsAsync(projectRoot, assets, {\n platform: options.platform,\n outputDirectory: options.assetsDest,\n iosAssetCatalogDirectory: options.assetCatalogDest,\n })\n : null,\n ]);\n}\n\nexport async function exportEmbedBundleAndAssetsAsync(\n projectRoot: string,\n options: Options\n): Promise<{\n bundle: Awaited<ReturnType<Server['build']>>;\n assets: readonly BundleAssetWithFileHashes[];\n files: ExportAssetMap;\n}> {\n const devServerManager = await DevServerManager.startMetroAsync(projectRoot, {\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n port: 8081,\n isExporting: true,\n location: {},\n resetDevServer: options.resetCache,\n maxWorkers: options.maxWorkers,\n });\n\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const { exp, pkg } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n const files: ExportAssetMap = new Map();\n\n try {\n const bundles = await devServer.nativeExportBundleAsync(\n exp,\n {\n // TODO: Re-enable when we get bytecode chunk splitting working again.\n splitChunks: false, //devServer.isReactServerComponentsEnabled,\n mainModuleName: resolveRealEntryFilePath(projectRoot, options.entryFile),\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: !!sourceMapUrl,\n bytecode: options.bytecode ?? false,\n // source map inline\n reactCompiler: !!exp.experiments?.reactCompiler,\n },\n files,\n {\n sourceMapUrl,\n unstable_transformProfile: (options.unstableTransformProfile ||\n (isHermes ? 'hermes-stable' : 'default')) as BundleOptions['unstable_transformProfile'],\n }\n );\n\n const apiRoutesEnabled =\n devServer.isReactServerComponentsEnabled || exp.web?.output === 'server';\n\n if (apiRoutesEnabled) {\n await exportStandaloneServerAsync(projectRoot, devServer, {\n exp,\n pkg,\n files,\n options,\n });\n }\n\n // TODO: Remove duplicates...\n const expoDomComponentReferences = bundles.artifacts\n .map((artifact) =>\n Array.isArray(artifact.metadata.expoDomComponentReferences)\n ? artifact.metadata.expoDomComponentReferences\n : []\n )\n .flat();\n if (expoDomComponentReferences.length > 0) {\n await Promise.all(\n // TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.\n expoDomComponentReferences.map(async (filePath) => {\n const { bundle } = await exportDomComponentAsync({\n filePath,\n projectRoot,\n dev: options.dev,\n devServer,\n isHermes,\n includeSourceMaps: !!sourceMapUrl,\n exp,\n files,\n });\n\n if (options.assetsDest) {\n // Save assets like a typical bundler, preserving the file paths on web.\n // This is saving web-style inside of a native app's binary.\n await persistMetroAssetsAsync(\n projectRoot,\n bundle.assets.map((asset) => ({\n ...asset,\n httpServerLocation: path.join(DOM_COMPONENTS_BUNDLE_DIR, asset.httpServerLocation),\n })),\n {\n files,\n platform: 'web',\n outputDirectory: options.assetsDest,\n }\n );\n }\n })\n );\n }\n\n return {\n files,\n bundle: {\n code: bundles.artifacts.filter((a: any) => a.type === 'js')[0].source,\n // Can be optional when source maps aren't enabled.\n map: bundles.artifacts.filter((a: any) => a.type === 'map')[0]?.source.toString(),\n },\n assets: bundles.assets,\n };\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (options.platform === 'ios') {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n } finally {\n devServerManager.stopAsync();\n }\n}\n\n// Exports for expo-updates\nexport async function createMetroServerAndBundleRequestAsync(\n projectRoot: string,\n options: Pick<\n Options,\n | 'maxWorkers'\n | 'config'\n | 'platform'\n | 'sourcemapOutput'\n | 'sourcemapUseAbsolutePath'\n | 'entryFile'\n | 'minify'\n | 'dev'\n | 'resetCache'\n | 'unstableTransformProfile'\n >\n): Promise<{ server: Server; bundleRequest: BundleOptions }> {\n const exp = getConfig(projectRoot, { skipSDKVersionRequirement: true }).exp;\n\n // TODO: This is slow ~40ms\n const { config } = await loadMetroConfigAsync(\n projectRoot,\n {\n // TODO: This is always enabled in the native script and there's no way to disable it.\n resetCache: options.resetCache,\n\n maxWorkers: options.maxWorkers,\n config: options.config,\n },\n {\n exp,\n isExporting: true,\n getMetroBundler() {\n return server.getBundler().getBundler();\n },\n }\n );\n\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n // TODO(cedric): check if we can use the proper `bundleType=bundle` and `entryPoint=mainModuleName` properties\n // @ts-expect-error: see above\n const bundleRequest: BundleOptions = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n ...getMetroDirectBundleOptionsForExpoConfig(projectRoot, exp, {\n splitChunks: false,\n mainModuleName: resolveRealEntryFilePath(projectRoot, options.entryFile),\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n isExporting: true,\n // Never output bytecode in the exported bundle since that is hardcoded in the native run script.\n bytecode: false,\n hosted: false,\n }),\n sourceMapUrl,\n unstable_transformProfile: (options.unstableTransformProfile ||\n (isHermes ? 'hermes-stable' : 'default')) as BundleOptions['unstable_transformProfile'],\n };\n\n const server = new Server(config, {\n watch: false,\n });\n\n return { server, bundleRequest };\n}\n\nexport async function exportEmbedAssetsAsync(\n server: Server,\n bundleRequest: BundleOptions,\n projectRoot: string,\n options: Pick<Options, 'platform'>\n) {\n try {\n const { entryFile, onProgress, resolverOptions, transformOptions } = splitBundleOptions({\n ...bundleRequest,\n // @ts-ignore-error TODO(@kitten): Very unclear why this is here. Remove?\n bundleType: 'todo',\n });\n\n const dependencies = await server._bundler.getDependencies(\n [entryFile],\n transformOptions,\n resolverOptions,\n { onProgress, shallow: false, lazy: false }\n );\n\n const config = server._config;\n\n return getMetroAssets(dependencies, {\n processModuleFilter: config.serializer.processModuleFilter,\n assetPlugins: config.transformer.assetPlugins,\n platform: transformOptions.platform!,\n // Forked out of Metro because the `this._getServerRootDir()` doesn't match the development\n // behavior.\n projectRoot: config.projectRoot, // this._getServerRootDir(),\n publicPath: config.transformer.publicPath,\n isHosted: false,\n });\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (options.platform === 'ios') {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n }\n}\n\nfunction isError(error: any): error is Error {\n return error instanceof Error;\n}\n"],"names":["createMetroServerAndBundleRequestAsync","exportEmbedAssetsAsync","exportEmbedAsync","exportEmbedBundleAndAssetsAsync","exportEmbedInternalAsync","debug","require","guessCopiedAppleBundlePath","bundleOutput","match","bundleName","path","basename","bundleParent","dirname","possiblePath","globSync","cwd","absolute","dot","projectRoot","options","env","CI","resetCache","setNodeEnv","dev","load","eagerBundleOptions","__EXPO_EAGER_BUNDLE_OPTIONS","deserializeEagerKey","inputKey","getExportEmbedOptionsKey","key","removeAsync","copyAsync","assetsDest","console","log","warn","ensureProcessExitsAfterDelay","platform","previousPath","fs","existsSync","bundle","assets","files","mkdirSync","recursive","mode","domComponentProxyOutputDir","hasDomComponents","size","Promise","all","output","save","Log","persistMetroFilesAsync","copyPublicFolderAsync","resolve","EXPO_PUBLIC_FOLDER","join","DOM_COMPONENTS_BUNDLE_DIR","persistMetroAssetsAsync","outputDirectory","iosAssetCatalogDirectory","assetCatalogDest","devServerManager","DevServerManager","startMetroAsync","minify","port","isExporting","location","resetDevServer","maxWorkers","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","exp","pkg","getConfig","skipSDKVersionRequirement","isHermes","isEnableHermesManaged","sourceMapUrl","sourcemapOutput","sourcemapUseAbsolutePath","Map","bundles","nativeExportBundleAsync","splitChunks","mainModuleName","resolveRealEntryFilePath","entryFile","engine","undefined","serializerIncludeMaps","bytecode","reactCompiler","experiments","unstable_transformProfile","unstableTransformProfile","apiRoutesEnabled","isReactServerComponentsEnabled","web","exportStandaloneServerAsync","expoDomComponentReferences","artifacts","map","artifact","Array","isArray","metadata","flat","length","filePath","exportDomComponentAsync","includeSourceMaps","asset","httpServerLocation","code","filter","a","type","source","toString","error","isError","isExecutingFromXcodebuild","message","stripAnsi","logMetroErrorInXcode","stopAsync","config","loadMetroConfigAsync","getMetroBundler","server","getBundler","bundleRequest","Server","DEFAULT_BUNDLE_OPTIONS","getMetroDirectBundleOptionsForExpoConfig","hosted","watch","onProgress","resolverOptions","transformOptions","splitBundleOptions","bundleType","dependencies","_bundler","getDependencies","shallow","lazy","_config","getMetroAssets","processModuleFilter","serializer","assetPlugins","transformer","publicPath","isHosted","Error"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;IAuSqBA,sCAAsC;eAAtCA;;IAwEAC,sBAAsB;eAAtBA;;IAvTAC,gBAAgB;eAAhBA;;IAqGAC,+BAA+B;eAA/BA;;IAlDAC,wBAAwB;eAAxBA;;;;yBA1GI;;;;;;;gEACP;;;;;;;gEACY;;;;;;;iEACP;;;;;;;gEAEG;;;;;;;gEACR;;;;;;;gEACJ;;;;;;;yBACkB;;;;;;;gEAChB;;;;;;gCAEsD;qCACP;qBAC5C;kCACa;uCACK;kCACD;yCACK;8BACe;sBAC/B;qBACa;qBACnB;yBACO;qCACa;8BACF;oCACE;8BACF;4BAC4C;8BACtC;sBACC;0BACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzC,MAAMC,QAAQC,QAAQ,SAAS;AAE/B,SAASC,2BAA2BC,YAAoB;IACtD,+CAA+C;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C,eAAe,EAAEC,gBAAgB,EAAE,GAAGC,IAAAA,6BAAkB,EAAC;YACtF,GAAGT,aAAa;YAChB,yEAAyE;YACzEU,YAAY;QACd;QAEA,MAAMC,eAAe,MAAMb,OAAOc,QAAQ,CAACC,eAAe,CACxD;YAAC1D;SAAU,EACXqD,kBACAD,iBACA;YAAED;YAAYQ,SAAS;YAAOC,MAAM;QAAM;QAG5C,MAAMpB,SAASG,OAAOkB,OAAO;QAE7B,OAAOC,IAAAA,oBAAc,EAACN,cAAc;YAClCO,qBAAqBvB,OAAOwB,UAAU,CAACD,mBAAmB;YAC1DE,cAAczB,OAAO0B,WAAW,CAACD,YAAY;YAC7CzH,UAAU6G,iBAAiB7G,QAAQ;YACnC,2FAA2F;YAC3F,YAAY;YACZrB,aAAaqH,OAAOrH,WAAW;YAC/BgJ,YAAY3B,OAAO0B,WAAW,CAACC,UAAU;YACzCC,UAAU;QACZ;IACF,EAAE,OAAOnC,OAAY;QACnB,IAAIC,QAAQD,QAAQ;YAClB,0EAA0E;YAC1E,iIAAiI;YACjI,IAAI7G,QAAQoB,QAAQ,KAAK,OAAO;gBAC9B,8FAA8F;gBAC9F,IAAI,aAAayF,SAASE,IAAAA,8CAAyB,KAAI;oBACrDF,MAAMG,OAAO,GAAGC,IAAAA,eAAS,EAACJ,MAAMG,OAAO;gBACzC;gBACAE,IAAAA,yCAAoB,EAACnH,aAAa8G;YACpC;QACF;QACA,MAAMA;IACR;AACF;AAEA,SAASC,QAAQD,KAAU;IACzB,OAAOA,iBAAiBoC;AAC1B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/export/embed/resolveOptions.ts"],"sourcesContent":["import { resolveEntryPoint } from '@expo/config/paths';\nimport type { OutputOptions } from '@expo/metro/metro/shared/types.flow';\nimport canonicalize from '@expo/metro/metro-core/canonicalize';\nimport arg from 'arg';\nimport os from 'os';\nimport path from 'path';\n\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { resolveCustomBooleanArgsAsync } from '../../utils/resolveArgs';\nimport { isAndroidUsingHermes, isIosUsingHermes } from '../exportHermes';\n\nexport interface Options {\n assetsDest?: string;\n assetCatalogDest?: string;\n entryFile: string;\n resetCache: boolean;\n transformer?: string;\n minify?: boolean;\n config?: string;\n platform: string;\n dev: boolean;\n bundleOutput: string;\n bundleEncoding?: OutputOptions['bundleEncoding'];\n maxWorkers?: number;\n sourcemapOutput?: string;\n sourcemapSourcesRoot?: string;\n sourcemapUseAbsolutePath: boolean;\n verbose: boolean;\n unstableTransformProfile?: string;\n eager?: boolean;\n bytecode?: boolean;\n}\n\nfunction assertIsBoolean(val: any): asserts val is boolean {\n if (typeof val !== 'boolean') {\n throw new CommandError(`Expected boolean, got ${typeof val}`);\n }\n}\n\nfunction getBundleEncoding(encoding: string | undefined): OutputOptions['bundleEncoding'] {\n return encoding === 'utf8' || encoding === 'utf16le' || encoding === 'ascii'\n ? encoding\n : undefined;\n}\n\nexport function resolveOptions(\n projectRoot: string,\n args: arg.Result<arg.Spec>,\n parsed: Awaited<ReturnType<typeof resolveCustomBooleanArgsAsync>>\n): Options {\n const dev = parsed.args['--dev'] ?? true;\n assertIsBoolean(dev);\n\n const platform = args['--platform'];\n if (!platform) {\n throw new CommandError(`Missing required argument: --platform`);\n }\n\n const bundleOutput = args['--bundle-output'];\n\n const commonOptions = {\n entryFile: args['--entry-file'] ?? resolveEntryPoint(projectRoot, { platform }),\n assetCatalogDest: args['--asset-catalog-dest'],\n platform,\n transformer: args['--transformer'],\n // TODO: Support `--dev false`\n // dev: false,\n bundleOutput,\n bundleEncoding: getBundleEncoding(args['--bundle-encoding']) ?? 'utf8',\n maxWorkers: args['--max-workers'],\n sourcemapOutput: args['--sourcemap-output'],\n sourcemapSourcesRoot: args['--sourcemap-sources-root'],\n sourcemapUseAbsolutePath: !!parsed.args['--sourcemap-use-absolute-path'],\n assetsDest: args['--assets-dest'],\n unstableTransformProfile: args['--unstable-transform-profile'],\n resetCache: !!parsed.args['--reset-cache'],\n verbose: args['--verbose'] ?? env.EXPO_DEBUG,\n config: args['--config'] ? path.resolve(args['--config']) : undefined,\n dev,\n minify: parsed.args['--minify'] as boolean | undefined,\n eager: !!parsed.args['--eager'],\n bytecode: parsed.args['--bytecode'] as boolean | undefined,\n };\n\n if (commonOptions.eager) {\n return resolveEagerOptionsAsync(projectRoot, commonOptions);\n }\n\n // Perform extra assertions after the eager options are resolved.\n\n if (!bundleOutput) {\n throw new CommandError(`Missing required argument: --bundle-output`);\n }\n\n const minify = parsed.args['--minify'] ?? !dev;\n assertIsBoolean(minify);\n\n return { ...commonOptions, minify, bundleOutput };\n}\n\nfunction getTemporaryPath() {\n return path.join(os.tmpdir(), Math.random().toString(36).substring(2));\n}\n\n/** Best effort guess of which options will be used for the export:embed invocation that is called from the native build scripts. */\nexport function resolveEagerOptionsAsync(\n projectRoot: string,\n {\n dev,\n platform,\n assetsDest,\n bundleOutput,\n minify,\n ...options\n }: Partial<Omit<Options, 'platform' | 'dev'>> & {\n platform: string;\n dev: boolean;\n }\n): Options {\n // If the minify prop is undefined, then check if the project is using hermes.\n minify ??= !(platform === 'android'\n ? isAndroidUsingHermes(projectRoot)\n : isIosUsingHermes(projectRoot));\n\n let destination: string | undefined;\n\n if (!assetsDest) {\n destination ??= getTemporaryPath();\n assetsDest = path.join(destination, 'assets');\n }\n\n if (!bundleOutput) {\n destination ??= getTemporaryPath();\n bundleOutput =\n platform === 'ios'\n ? path.join(destination, 'main.jsbundle')\n : path.join(destination, 'index.js');\n }\n\n return {\n ...options,\n eager: options.eager ?? true,\n bundleOutput,\n assetsDest,\n entryFile: options.entryFile ?? resolveEntryPoint(projectRoot, { platform }),\n resetCache: !!options.resetCache,\n platform,\n minify,\n dev,\n bundleEncoding: 'utf8',\n sourcemapUseAbsolutePath: false,\n verbose: env.EXPO_DEBUG,\n };\n}\n\nexport function getExportEmbedOptionsKey({\n // Extract all values that won't change the Metro results.\n resetCache,\n assetsDest,\n bundleOutput,\n verbose,\n maxWorkers,\n eager,\n ...options\n}: Options) {\n // Create a sorted key for the options, removing values that won't change the Metro results.\n return JSON.stringify(options, canonicalize);\n}\n\nexport function deserializeEagerKey(key: string) {\n return JSON.parse(key) as { options: Options; key: string };\n}\n"],"names":["deserializeEagerKey","getExportEmbedOptionsKey","resolveEagerOptionsAsync","resolveOptions","assertIsBoolean","val","CommandError","getBundleEncoding","encoding","undefined","projectRoot","args","parsed","dev","platform","bundleOutput","commonOptions","entryFile","resolveEntryPoint","assetCatalogDest","transformer","bundleEncoding","maxWorkers","sourcemapOutput","sourcemapSourcesRoot","sourcemapUseAbsolutePath","assetsDest","unstableTransformProfile","resetCache","verbose","env","EXPO_DEBUG","config","path","resolve","minify","eager","bytecode","getTemporaryPath","join","os","tmpdir","Math","random","toString","substring","options","isAndroidUsingHermes","isIosUsingHermes","destination","JSON","stringify","canonicalize","key","parse"],"mappings":";;;;;;;;;;;IA0KgBA,mBAAmB;eAAnBA;;IAdAC,wBAAwB;eAAxBA;;IAlDAC,wBAAwB;eAAxBA;;IA5DAC,cAAc;eAAdA;;;;yBA9CkB;;;;;;;gEAET;;;;;;;gEAEV;;;;;;;gEACE;;;;;;qBAEG;wBACS;8BAE0B;;;;;;AAwBvD,SAASC,gBAAgBC,GAAQ;IAC/B,IAAI,OAAOA,QAAQ,WAAW;QAC5B,MAAM,IAAIC,oBAAY,CAAC,CAAC,sBAAsB,EAAE,OAAOD,KAAK;IAC9D;AACF;AAEA,SAASE,kBAAkBC,QAA4B;IACrD,OAAOA,aAAa,UAAUA,aAAa,aAAaA,aAAa,UACjEA,WACAC;AACN;AAEO,SAASN,eACdO,WAAmB,EACnBC,IAA0B,EAC1BC,MAAiE;IAEjE,MAAMC,MAAMD,OAAOD,IAAI,CAAC,QAAQ,IAAI;IACpCP,gBAAgBS;IAEhB,MAAMC,WAAWH,IAAI,CAAC,aAAa;IACnC,IAAI,CAACG,UAAU;QACb,MAAM,IAAIR,oBAAY,CAAC,CAAC,qCAAqC,CAAC;IAChE;I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ts"],"sourcesContent":["import { resolveEntryPoint } from '@expo/config/paths';\nimport type { OutputOptions } from '@expo/metro/metro/shared/types';\nimport canonicalize from '@expo/metro/metro-core/canonicalize';\nimport arg from 'arg';\nimport os from 'os';\nimport path from 'path';\n\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { resolveCustomBooleanArgsAsync } from '../../utils/resolveArgs';\nimport { isAndroidUsingHermes, isIosUsingHermes } from '../exportHermes';\n\nexport interface Options {\n assetsDest?: string;\n assetCatalogDest?: string;\n entryFile: string;\n resetCache: boolean;\n transformer?: string;\n minify?: boolean;\n config?: string;\n platform: string;\n dev: boolean;\n bundleOutput: string;\n bundleEncoding?: OutputOptions['bundleEncoding'];\n maxWorkers?: number;\n sourcemapOutput?: string;\n sourcemapSourcesRoot?: string;\n sourcemapUseAbsolutePath: boolean;\n verbose: boolean;\n unstableTransformProfile?: string;\n eager?: boolean;\n bytecode?: boolean;\n}\n\nfunction assertIsBoolean(val: any): asserts val is boolean {\n if (typeof val !== 'boolean') {\n throw new CommandError(`Expected boolean, got ${typeof val}`);\n }\n}\n\nfunction getBundleEncoding(encoding: string | undefined): OutputOptions['bundleEncoding'] {\n return encoding === 'utf8' || encoding === 'utf16le' || encoding === 'ascii'\n ? encoding\n : undefined;\n}\n\nexport function resolveOptions(\n projectRoot: string,\n args: arg.Result<arg.Spec>,\n parsed: Awaited<ReturnType<typeof resolveCustomBooleanArgsAsync>>\n): Options {\n const dev = parsed.args['--dev'] ?? true;\n assertIsBoolean(dev);\n\n const platform = args['--platform'];\n if (!platform) {\n throw new CommandError(`Missing required argument: --platform`);\n }\n\n const bundleOutput = args['--bundle-output'];\n\n const commonOptions = {\n entryFile: args['--entry-file'] ?? resolveEntryPoint(projectRoot, { platform }),\n assetCatalogDest: args['--asset-catalog-dest'],\n platform,\n transformer: args['--transformer'],\n // TODO: Support `--dev false`\n // dev: false,\n bundleOutput,\n bundleEncoding: getBundleEncoding(args['--bundle-encoding']) ?? 'utf8',\n maxWorkers: args['--max-workers'],\n sourcemapOutput: args['--sourcemap-output'],\n sourcemapSourcesRoot: args['--sourcemap-sources-root'],\n sourcemapUseAbsolutePath: !!parsed.args['--sourcemap-use-absolute-path'],\n assetsDest: args['--assets-dest'],\n unstableTransformProfile: args['--unstable-transform-profile'],\n resetCache: !!parsed.args['--reset-cache'],\n verbose: args['--verbose'] ?? env.EXPO_DEBUG,\n config: args['--config'] ? path.resolve(args['--config']) : undefined,\n dev,\n minify: parsed.args['--minify'] as boolean | undefined,\n eager: !!parsed.args['--eager'],\n bytecode: parsed.args['--bytecode'] as boolean | undefined,\n };\n\n if (commonOptions.eager) {\n return resolveEagerOptionsAsync(projectRoot, commonOptions);\n }\n\n // Perform extra assertions after the eager options are resolved.\n\n if (!bundleOutput) {\n throw new CommandError(`Missing required argument: --bundle-output`);\n }\n\n const minify = parsed.args['--minify'] ?? !dev;\n assertIsBoolean(minify);\n\n return { ...commonOptions, minify, bundleOutput };\n}\n\nfunction getTemporaryPath() {\n return path.join(os.tmpdir(), Math.random().toString(36).substring(2));\n}\n\n/** Best effort guess of which options will be used for the export:embed invocation that is called from the native build scripts. */\nexport function resolveEagerOptionsAsync(\n projectRoot: string,\n {\n dev,\n platform,\n assetsDest,\n bundleOutput,\n minify,\n ...options\n }: Partial<Omit<Options, 'platform' | 'dev'>> & {\n platform: string;\n dev: boolean;\n }\n): Options {\n // If the minify prop is undefined, then check if the project is using hermes.\n minify ??= !(platform === 'android'\n ? isAndroidUsingHermes(projectRoot)\n : isIosUsingHermes(projectRoot));\n\n let destination: string | undefined;\n\n if (!assetsDest) {\n destination ??= getTemporaryPath();\n assetsDest = path.join(destination, 'assets');\n }\n\n if (!bundleOutput) {\n destination ??= getTemporaryPath();\n bundleOutput =\n platform === 'ios'\n ? path.join(destination, 'main.jsbundle')\n : path.join(destination, 'index.js');\n }\n\n return {\n ...options,\n eager: options.eager ?? true,\n bundleOutput,\n assetsDest,\n entryFile: options.entryFile ?? resolveEntryPoint(projectRoot, { platform }),\n resetCache: !!options.resetCache,\n platform,\n minify,\n dev,\n bundleEncoding: 'utf8',\n sourcemapUseAbsolutePath: false,\n verbose: env.EXPO_DEBUG,\n };\n}\n\nexport function getExportEmbedOptionsKey({\n // Extract all values that won't change the Metro results.\n resetCache,\n assetsDest,\n bundleOutput,\n verbose,\n maxWorkers,\n eager,\n ...options\n}: Options) {\n // Create a sorted key for the options, removing values that won't change the Metro results.\n return JSON.stringify(options, canonicalize);\n}\n\nexport function deserializeEagerKey(key: string) {\n return JSON.parse(key) as { options: Options; key: string };\n}\n"],"names":["deserializeEagerKey","getExportEmbedOptionsKey","resolveEagerOptionsAsync","resolveOptions","assertIsBoolean","val","CommandError","getBundleEncoding","encoding","undefined","projectRoot","args","parsed","dev","platform","bundleOutput","commonOptions","entryFile","resolveEntryPoint","assetCatalogDest","transformer","bundleEncoding","maxWorkers","sourcemapOutput","sourcemapSourcesRoot","sourcemapUseAbsolutePath","assetsDest","unstableTransformProfile","resetCache","verbose","env","EXPO_DEBUG","config","path","resolve","minify","eager","bytecode","getTemporaryPath","join","os","tmpdir","Math","random","toString","substring","options","isAndroidUsingHermes","isIosUsingHermes","destination","JSON","stringify","canonicalize","key","parse"],"mappings":";;;;;;;;;;;IA0KgBA,mBAAmB;eAAnBA;;IAdAC,wBAAwB;eAAxBA;;IAlDAC,wBAAwB;eAAxBA;;IA5DAC,cAAc;eAAdA;;;;yBA9CkB;;;;;;;gEAET;;;;;;;gEAEV;;;;;;;gEACE;;;;;;qBAEG;wBACS;8BAE0B;;;;;;AAwBvD,SAASC,gBAAgBC,GAAQ;IAC/B,IAAI,OAAOA,QAAQ,WAAW;QAC5B,MAAM,IAAIC,oBAAY,CAAC,CAAC,sBAAsB,EAAE,OAAOD,KAAK;IAC9D;AACF;AAEA,SAASE,kBAAkBC,QAA4B;IACrD,OAAOA,aAAa,UAAUA,aAAa,aAAaA,aAAa,UACjEA,WACAC;AACN;AAEO,SAASN,eACdO,WAAmB,EACnBC,IA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AAU,EACVc,KAAK,EACL,GAAGU,SACK;IACR,4FAA4F;IAC5F,OAAOI,KAAKC,SAAS,CAACL,SAASM,uBAAY;AAC7C;AAEO,SAASpD,oBAAoBqD,GAAW;IAC7C,OAAOH,KAAKI,KAAK,CAACD;AACpB"}
@@ -80,6 +80,7 @@ const expoExport = async (argv)=>{
80
80
  '--no-minify': Boolean,
81
81
  '--no-bytecode': Boolean,
82
82
  '--no-ssg': Boolean,
83
+ '--api-only': Boolean,
83
84
  '--unstable-hosted-native': Boolean,
84
85
  // Hack: This is added because EAS CLI always includes the flag.
85
86
  // If supplied, we'll do nothing with the value, but at least the process won't crash.
@@ -105,7 +106,7 @@ const expoExport = async (argv)=>{
105
106
  `--no-bytecode Prevent generating Hermes bytecode`,
106
107
  `--max-workers <number> Maximum number of tasks to allow the bundler to spawn`,
107
108
  `--dump-assetmap Emit an asset map for further processing`,
108
- `--no-ssg Skip exporting static HTML files for web routes`,
109
+ `--no-ssg, --api-only Skip exporting static HTML files and only export API routes for web`,
109
110
  (0, _chalk().default)`-p, --platform <platform> Options: android, ios, web, all. {dim Default: all}`,
110
111
  `-s, --source-maps Emit JavaScript source maps`,
111
112
  `-c, --clear Clear the bundler cache`,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/export/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\n\nimport { Command } from '../../bin/cli';\nimport { assertArgs, getProjectRoot, printHelp } from '../utils/args';\nimport { logCmdError } from '../utils/errors';\n\nexport const expoExport: Command = async (argv) => {\n const args = assertArgs(\n {\n // Types\n '--help': Boolean,\n '--clear': Boolean,\n '--dump-assetmap': Boolean,\n '--dev': Boolean,\n '--source-maps': Boolean,\n '--max-workers': Number,\n '--output-dir': String,\n '--platform': [String],\n '--no-minify': Boolean,\n '--no-bytecode': Boolean,\n '--no-ssg': Boolean,\n '--unstable-hosted-native': Boolean,\n\n // Hack: This is added because EAS CLI always includes the flag.\n // If supplied, we'll do nothing with the value, but at least the process won't crash.\n // Note that we also don't show this value in the `--help` prompt since we don't want people to use it.\n '--experimental-bundle': Boolean,\n\n // Aliases\n '-h': '--help',\n '-s': '--source-maps',\n // '-d': '--dump-assetmap',\n '-c': '--clear',\n '-p': '--platform',\n // Interop with Metro docs and RedBox errors.\n '--reset-cache': '--clear',\n\n // Deprecated\n '--dump-sourcemap': '--source-maps',\n },\n argv\n );\n\n if (args['--help']) {\n printHelp(\n `Export the static files of the app for hosting it on a web server`,\n chalk`npx expo export {dim <dir>}`,\n [\n chalk`<dir> Directory of the Expo project. {dim Default: Current working directory}`,\n chalk`--output-dir <dir> The directory to export the static files to. {dim Default: dist}`,\n `--dev Configure static files for developing locally using a non-https server`,\n `--no-minify Prevent minifying source`,\n `--no-bytecode Prevent generating Hermes bytecode`,\n `--max-workers <number> Maximum number of tasks to allow the bundler to spawn`,\n `--dump-assetmap Emit an asset map for further processing`,\n `--no-ssg Skip exporting static HTML files for web routes`,\n chalk`-p, --platform <platform> Options: android, ios, web, all. {dim Default: all}`,\n `-s, --source-maps Emit JavaScript source maps`,\n `-c, --clear Clear the bundler cache`,\n `-h, --help Usage info`,\n ].join('\\n')\n );\n }\n\n const projectRoot = getProjectRoot(args);\n const { resolveOptionsAsync } = await import('./resolveOptions.js');\n const options = await resolveOptionsAsync(projectRoot, args).catch(logCmdError);\n\n const { exportAsync } = await import('./exportAsync.js');\n return exportAsync(projectRoot, options).catch(logCmdError);\n};\n"],"names":["expoExport","argv","args","assertArgs","Boolean","Number","String","printHelp","chalk","join","projectRoot","getProjectRoot","resolveOptionsAsync","options","catch","logCmdError","exportAsync"],"mappings":";;;;;+BAOaA;;;eAAAA;;;;gEANK;;;;;;sBAGoC;wBAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErB,MAAMA,aAAsB,OAAOC;IACxC,MAAMC,OAAOC,IAAAA,gBAAU,EACrB;QACE,QAAQ;QACR,UAAUC;QACV,WAAWA;QACX,mBAAmBA;QAC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/env node\nimport chalk from 'chalk';\n\nimport { Command } from '../../bin/cli';\nimport { assertArgs, getProjectRoot, printHelp } from '../utils/args';\nimport { logCmdError } from '../utils/errors';\n\nexport const expoExport: Command = async (argv) => {\n const args = assertArgs(\n {\n // Types\n '--help': Boolean,\n '--clear': Boolean,\n '--dump-assetmap': Boolean,\n '--dev': Boolean,\n '--source-maps': Boolean,\n '--max-workers': Number,\n '--output-dir': String,\n '--platform': [String],\n '--no-minify': Boolean,\n '--no-bytecode': Boolean,\n '--no-ssg': Boolean,\n '--api-only': Boolean,\n '--unstable-hosted-native': Boolean,\n\n // Hack: This is added because EAS CLI always includes the flag.\n // If supplied, we'll do nothing with the value, but at least the process won't crash.\n // Note that we also don't show this value in the `--help` prompt since we don't want people to use it.\n '--experimental-bundle': Boolean,\n\n // Aliases\n '-h': '--help',\n '-s': '--source-maps',\n // '-d': '--dump-assetmap',\n '-c': '--clear',\n '-p': '--platform',\n // Interop with Metro docs and RedBox errors.\n '--reset-cache': '--clear',\n\n // Deprecated\n '--dump-sourcemap': '--source-maps',\n },\n argv\n );\n\n if (args['--help']) {\n printHelp(\n `Export the static files of the app for hosting it on a web server`,\n chalk`npx expo export {dim <dir>}`,\n [\n chalk`<dir> Directory of the Expo project. {dim Default: Current working directory}`,\n chalk`--output-dir <dir> The directory to export the static files to. {dim Default: dist}`,\n `--dev Configure static files for developing locally using a non-https server`,\n `--no-minify Prevent minifying source`,\n `--no-bytecode Prevent generating Hermes bytecode`,\n `--max-workers <number> Maximum number of tasks to allow the bundler to spawn`,\n `--dump-assetmap Emit an asset map for further processing`,\n `--no-ssg, --api-only Skip exporting static HTML files and only export API routes for web`,\n chalk`-p, --platform <platform> Options: android, ios, web, all. {dim Default: all}`,\n `-s, --source-maps Emit JavaScript source maps`,\n `-c, --clear Clear the bundler cache`,\n `-h, --help Usage info`,\n ].join('\\n')\n );\n }\n\n const projectRoot = getProjectRoot(args);\n const { resolveOptionsAsync } = await import('./resolveOptions.js');\n const options = await resolveOptionsAsync(projectRoot, args).catch(logCmdError);\n\n const { exportAsync } = await import('./exportAsync.js');\n return exportAsync(projectRoot, options).catch(logCmdError);\n};\n"],"names":["expoExport","argv","args","assertArgs","Boolean","Number","String","printHelp","chalk","join","projectRoot","getProjectRoot","resolveOptionsAsync","options","catch","logCmdError","exportAsync"],"mappings":";;;;;+BAOaA;;;eAAAA;;;;gEANK;;;;;;sBAGoC;wBAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErB,MAAMA,aAAsB,OAAOC;IACxC,MAAMC,OAAOC,IAAAA,gBAAU,EACrB;QACE,QAAQ;QACR,UAAUC;QACV,WAAWA;QACX,mBAAmBA;QACnB,SAASA;QACT,iBAAiBA;QACjB,iBAAiBC;QACjB,gBAAgBC;QAChB,cAAc;YAACA;SAAO;QACtB,eAAeF;QACf,iBAAiBA;QACjB,YAAYA;QACZ,cAAcA;QACd,4BAA4BA;QAE5B,gEAAgE;QAChE,sFAAsF;QACtF,uGAAuG;QACvG,yBAAyBA;QAEzB,UAAU;QACV,MAAM;QACN,MAAM;QACN,2BAA2B;QAC3B,MAAM;QACN,MAAM;QACN,6CAA6C;QAC7C,iBAAiB;QAEjB,aAAa;QACb,oBAAoB;IACtB,GACAH;IAGF,IAAIC,IAAI,CAAC,SAAS,EAAE;QAClBK,IAAAA,eAAS,EACP,CAAC,iEAAiE,CAAC,EACnEC,IAAAA,gBAAK,CAAA,CAAC,2BAA2B,CAAC,EAClC;YACEA,IAAAA,gBAAK,CAAA,CAAC,kGAAkG,CAAC;YACzGA,IAAAA,gBAAK,CAAA,CAAC,2FAA2F,CAAC;YAClG,CAAC,iGAAiG,CAAC;YACnG,CAAC,mDAAmD,CAAC;YACrD,CAAC,6DAA6D,CAAC;YAC/D,CAAC,gFAAgF,CAAC;YAClF,CAAC,mEAAmE,CAAC;YACrE,CAAC,8FAA8F,CAAC;YAChGA,IAAAA,gBAAK,CAAA,CAAC,8EAA8E,CAAC;YACrF,CAAC,sDAAsD,CAAC;YACxD,CAAC,kDAAkD,CAAC;YACpD,CAAC,qCAAqC,CAAC;SACxC,CAACC,IAAI,CAAC;IAEX;IAEA,MAAMC,cAAcC,IAAAA,oBAAc,EAACT;IACnC,MAAM,EAAEU,mBAAmB,EAAE,GAAG,MAAM,mEAAA,QAAO;IAC7C,MAAMC,UAAU,MAAMD,oBAAoBF,aAAaR,MAAMY,KAAK,CAACC,mBAAW;IAE9E,MAAM,EAAEC,WAAW,EAAE,GAAG,MAAM,mEAAA,QAAO;IACrC,OAAOA,YAAYN,aAAaG,SAASC,KAAK,CAACC,mBAAW;AAC5D"}
@@ -80,7 +80,7 @@ async function resolveOptionsAsync(projectRoot, args) {
80
80
  maxWorkers: args['--max-workers'],
81
81
  dumpAssetmap: !!args['--dump-assetmap'],
82
82
  sourceMaps: !!args['--source-maps'],
83
- skipSSG: !!args['--no-ssg']
83
+ skipSSG: !!args['--no-ssg'] || !!args['--api-only']
84
84
  };
85
85
  }
86
86
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/export/resolveOptions.ts"],"sourcesContent":["import { ExpoConfig, getConfig, Platform } from '@expo/config';\n\nimport { getPlatformBundlers, PlatformBundlers } from '../start/server/platformBundlers';\nimport { CommandError } from '../utils/errors';\n\nexport type Options = {\n outputDir: string;\n platforms: Platform[];\n maxWorkers?: number;\n dev: boolean;\n clear: boolean;\n minify: boolean;\n bytecode: boolean;\n dumpAssetmap: boolean;\n sourceMaps: boolean;\n skipSSG: boolean;\n hostedNative: boolean;\n};\n\n/** Returns an array of platforms based on the input platform identifier and runtime constraints. */\nexport function resolvePlatformOption(\n exp: ExpoConfig,\n platformBundlers: PlatformBundlers,\n platform: string[] = ['all']\n): Platform[] {\n const platformsAvailable: Partial<PlatformBundlers> = Object.fromEntries(\n Object.entries(platformBundlers).filter(\n ([platform, bundler]) => bundler === 'metro' && exp.platforms?.includes(platform as Platform)\n )\n );\n\n if (!Object.keys(platformsAvailable).length) {\n throw new CommandError(\n `No platforms are configured to use the Metro bundler in the project Expo config.`\n );\n }\n\n const assertPlatformBundler = (platform: Platform): Platform => {\n if (!platformsAvailable[platform]) {\n if (!exp.platforms?.includes(platform) && platform === 'web') {\n // Pass through so the more robust error message is shown.\n return platform;\n }\n throw new CommandError(\n 'BAD_ARGS',\n `Platform \"${platform}\" is not configured to use the Metro bundler in the project Expo config, or is missing from the supported platforms in the platforms array: [${exp.platforms?.join(\n ', '\n )}].`\n );\n }\n\n return platform;\n };\n\n const knownPlatforms = ['android', 'ios', 'web'] as Platform[];\n const assertPlatformIsKnown = (platform: string): Platform => {\n if (!knownPlatforms.includes(platform as Platform)) {\n throw new CommandError(\n `Unsupported platform \"${platform}\". Options are: ${knownPlatforms.join(',')},all`\n );\n }\n\n return platform as Platform;\n };\n\n return (\n platform\n // Expand `all` to all available platforms.\n .map((platform) => (platform === 'all' ? Object.keys(platformsAvailable) : platform))\n .flat()\n // Remove duplicated platforms\n .filter((platform, index, list) => list.indexOf(platform) === index)\n // Assert platforms are valid\n .map((platform) => assertPlatformIsKnown(platform))\n .map((platform) => assertPlatformBundler(platform))\n );\n}\n\nexport async function resolveOptionsAsync(projectRoot: string, args: any): Promise<Options> {\n const { exp } = getConfig(projectRoot, { skipPlugins: true, skipSDKVersionRequirement: true });\n const platformBundlers = getPlatformBundlers(projectRoot, exp);\n\n const platforms = resolvePlatformOption(exp, platformBundlers, args['--platform']);\n return {\n platforms,\n hostedNative: !!args['--unstable-hosted-native'],\n outputDir: args['--output-dir'] ?? 'dist',\n minify: !args['--no-minify'],\n bytecode: !args['--no-bytecode'],\n clear: !!args['--clear'],\n dev: !!args['--dev'],\n maxWorkers: args['--max-workers'],\n dumpAssetmap: !!args['--dump-assetmap'],\n sourceMaps: !!args['--source-maps'],\n skipSSG: !!args['--no-ssg'],\n };\n}\n"],"names":["resolveOptionsAsync","resolvePlatformOption","exp","platformBundlers","platform","platformsAvailable","Object","fromEntries","entries","filter","bundler","platforms","includes","keys","length","CommandError","assertPlatformBundler","join","knownPlatforms","assertPlatformIsKnown","map","flat","index","list","indexOf","projectRoot","args","getConfig","skipPlugins","skipSDKVersionRequirement","getPlatformBundlers","hostedNative","outputDir","minify","bytecode","clear","dev","maxWorkers","dumpAssetmap","sourceMaps","skipSSG"],"mappings":";;;;;;;;;;;IA8EsBA,mBAAmB;eAAnBA;;IA1DNC,qBAAqB;eAArBA;;;;yBApBgC;;;;;;kCAEM;wBACzB;AAiBtB,SAASA,sBACdC,GAAe,EACfC,gBAAkC,EAClCC,WAAqB;IAAC;CAAM;IAE5B,MAAMC,qBAAgDC,OAAOC,WAAW,CACtED,OAAOE,OAAO,CAACL,kBAAkBM,MAAM,CACrC,CAAC,CAACL,UAAUM,QAAQ;YAA4BR;eAAvBQ,YAAY,aAAWR,iBAAAA,IAAIS,SAAS,qBAAbT,eAAeU,QAAQ,CAACR;;IAI5E,IAAI,CAACE,OAAOO,IAAI,CAACR,oBAAoBS,MAAM,EAAE;QAC3C,MAAM,IAAIC,oBAAY,CACpB,CAAC,gFAAgF,CAAC;IAEtF;IAEA,MAAMC,wBAAwB,CAACZ;QAC7B,IAAI,CAACC,kBAAkB,CAACD,SAAS,EAAE;gBAC5BF,gBAMkKA;YANvK,IAAI,GAACA,iBAAAA,IAAIS,SAAS,qBAAbT,eAAeU,QAAQ,CAACR,cAAaA,aAAa,OAAO;gBAC5D,0DAA0D;gBAC1D,OAAOA;YACT;YACA,MAAM,IAAIW,oBAAY,CACpB,YACA,CAAC,UAAU,EAAEX,SAAS,6IAA6I,GAAEF,kBAAAA,IAAIS,SAAS,qBAAbT,gBAAee,IAAI,CACtL,MACA,EAAE,CAAC;QAET;QAEA,OAAOb;IACT;IAEA,MAAMc,iBAAiB;QAAC;QAAW;QAAO;KAAM;IAChD,MAAMC,wBAAwB,CAACf;QAC7B,IAAI,CAACc,eAAeN,QAAQ,CAACR,WAAuB;YAClD,MAAM,IAAIW,oBAAY,CACpB,CAAC,sBAAsB,EAAEX,SAAS,gBAAgB,EAAEc,eAAeD,IAAI,CAAC,KAAK,IAAI,CAAC;QAEtF;QAEA,OAAOb;IACT;IAEA,OACEA,QACE,2CAA2C;KAC1CgB,GAAG,CAAC,CAAChB,WAAcA,aAAa,QAAQE,OAAOO,IAAI,CAACR,sBAAsBD,UAC1EiB,IAAI,EACL,8BAA8B;KAC7BZ,MAAM,CAAC,CAACL,UAAUkB,OAAOC,OAASA,KAAKC,OAAO,CAACpB,cAAckB,MAC9D,6BAA6B;KAC5BF,GAAG,CAAC,CAAChB,WAAae,sBAAsBf,WACxCgB,GAAG,CAAC,CAAChB,WAAaY,sBAAsBZ;AAE/C;AAEO,eAAeJ,oBAAoByB,WAAmB,EAAEC,IAAS;IACtE,MAAM,EAAExB,GAAG,EAAE,GAAGyB,IAAAA,mBAAS,EAACF,aAAa;QAAEG,aAAa;QAAMC,2BAA2B;IAAK;IAC5F,MAAM1B,mBAAmB2B,IAAAA,qCAAmB,EAACL,aAAavB;IAE1D,MAAMS,YAAYV,sBAAsBC,KAAKC,kBAAkBuB,IAAI,CAAC,aAAa;IACjF,OAAO;QACLf;QACAoB,cAAc,CAAC,CAACL,IAAI,CAAC,2BAA2B;QAChDM,WAAWN,IAAI,CAAC,eAAe,IAAI;QACnCO,QAAQ,CAACP,IAAI,CAAC,cAAc;QAC5BQ,UAAU,CAACR,IAAI,CAAC,gBAAgB;QAChCS,OAAO,CAAC,CAACT,IAAI,CAAC,UAAU;QACxBU,KAAK,CAAC,CAACV,IAAI,CAAC,QAAQ;QACpBW,YAAYX,IAAI,CAAC,gBAAgB;QACjCY,cAAc,CAAC,CAACZ,IAAI,CAAC,kBAAkB;QACvCa,YAAY,CAAC,CAACb,IAAI,CAAC,gBAAgB;QACnCc,SAAS,CAAC,CAACd,IAAI,CAAC,WAAW;IAC7B;AACF"}
1
+ {"version":3,"sources":["../../../src/export/resolveOptions.ts"],"sourcesContent":["import { ExpoConfig, getConfig, Platform } from '@expo/config';\n\nimport { getPlatformBundlers, PlatformBundlers } from '../start/server/platformBundlers';\nimport { CommandError } from '../utils/errors';\n\nexport type Options = {\n outputDir: string;\n platforms: Platform[];\n maxWorkers?: number;\n dev: boolean;\n clear: boolean;\n minify: boolean;\n bytecode: boolean;\n dumpAssetmap: boolean;\n sourceMaps: boolean;\n skipSSG: boolean;\n hostedNative: boolean;\n};\n\n/** Returns an array of platforms based on the input platform identifier and runtime constraints. */\nexport function resolvePlatformOption(\n exp: ExpoConfig,\n platformBundlers: PlatformBundlers,\n platform: string[] = ['all']\n): Platform[] {\n const platformsAvailable: Partial<PlatformBundlers> = Object.fromEntries(\n Object.entries(platformBundlers).filter(\n ([platform, bundler]) => bundler === 'metro' && exp.platforms?.includes(platform as Platform)\n )\n );\n\n if (!Object.keys(platformsAvailable).length) {\n throw new CommandError(\n `No platforms are configured to use the Metro bundler in the project Expo config.`\n );\n }\n\n const assertPlatformBundler = (platform: Platform): Platform => {\n if (!platformsAvailable[platform]) {\n if (!exp.platforms?.includes(platform) && platform === 'web') {\n // Pass through so the more robust error message is shown.\n return platform;\n }\n throw new CommandError(\n 'BAD_ARGS',\n `Platform \"${platform}\" is not configured to use the Metro bundler in the project Expo config, or is missing from the supported platforms in the platforms array: [${exp.platforms?.join(\n ', '\n )}].`\n );\n }\n\n return platform;\n };\n\n const knownPlatforms = ['android', 'ios', 'web'] as Platform[];\n const assertPlatformIsKnown = (platform: string): Platform => {\n if (!knownPlatforms.includes(platform as Platform)) {\n throw new CommandError(\n `Unsupported platform \"${platform}\". Options are: ${knownPlatforms.join(',')},all`\n );\n }\n\n return platform as Platform;\n };\n\n return (\n platform\n // Expand `all` to all available platforms.\n .map((platform) => (platform === 'all' ? Object.keys(platformsAvailable) : platform))\n .flat()\n // Remove duplicated platforms\n .filter((platform, index, list) => list.indexOf(platform) === index)\n // Assert platforms are valid\n .map((platform) => assertPlatformIsKnown(platform))\n .map((platform) => assertPlatformBundler(platform))\n );\n}\n\nexport async function resolveOptionsAsync(projectRoot: string, args: any): Promise<Options> {\n const { exp } = getConfig(projectRoot, { skipPlugins: true, skipSDKVersionRequirement: true });\n const platformBundlers = getPlatformBundlers(projectRoot, exp);\n\n const platforms = resolvePlatformOption(exp, platformBundlers, args['--platform']);\n return {\n platforms,\n hostedNative: !!args['--unstable-hosted-native'],\n outputDir: args['--output-dir'] ?? 'dist',\n minify: !args['--no-minify'],\n bytecode: !args['--no-bytecode'],\n clear: !!args['--clear'],\n dev: !!args['--dev'],\n maxWorkers: args['--max-workers'],\n dumpAssetmap: !!args['--dump-assetmap'],\n sourceMaps: !!args['--source-maps'],\n skipSSG: !!args['--no-ssg'] || !!args['--api-only'],\n };\n}\n"],"names":["resolveOptionsAsync","resolvePlatformOption","exp","platformBundlers","platform","platformsAvailable","Object","fromEntries","entries","filter","bundler","platforms","includes","keys","length","CommandError","assertPlatformBundler","join","knownPlatforms","assertPlatformIsKnown","map","flat","index","list","indexOf","projectRoot","args","getConfig","skipPlugins","skipSDKVersionRequirement","getPlatformBundlers","hostedNative","outputDir","minify","bytecode","clear","dev","maxWorkers","dumpAssetmap","sourceMaps","skipSSG"],"mappings":";;;;;;;;;;;IA8EsBA,mBAAmB;eAAnBA;;IA1DNC,qBAAqB;eAArBA;;;;yBApBgC;;;;;;kCAEM;wBACzB;AAiBtB,SAASA,sBACdC,GAAe,EACfC,gBAAkC,EAClCC,WAAqB;IAAC;CAAM;IAE5B,MAAMC,qBAAgDC,OAAOC,WAAW,CACtED,OAAOE,OAAO,CAACL,kBAAkBM,MAAM,CACrC,CAAC,CAACL,UAAUM,QAAQ;YAA4BR;eAAvBQ,YAAY,aAAWR,iBAAAA,IAAIS,SAAS,qBAAbT,eAAeU,QAAQ,CAACR;;IAI5E,IAAI,CAACE,OAAOO,IAAI,CAACR,oBAAoBS,MAAM,EAAE;QAC3C,MAAM,IAAIC,oBAAY,CACpB,CAAC,gFAAgF,CAAC;IAEtF;IAEA,MAAMC,wBAAwB,CAACZ;QAC7B,IAAI,CAACC,kBAAkB,CAACD,SAAS,EAAE;gBA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,IAAI,CAAC,eAAe,IAAI;QACnCO,QAAQ,CAACP,IAAI,CAAC,cAAc;QAC5BQ,UAAU,CAACR,IAAI,CAAC,gBAAgB;QAChCS,OAAO,CAAC,CAACT,IAAI,CAAC,UAAU;QACxBU,KAAK,CAAC,CAACV,IAAI,CAAC,QAAQ;QACpBW,YAAYX,IAAI,CAAC,gBAAgB;QACjCY,cAAc,CAAC,CAACZ,IAAI,CAAC,kBAAkB;QACvCa,YAAY,CAAC,CAACb,IAAI,CAAC,gBAAgB;QACnCc,SAAS,CAAC,CAACd,IAAI,CAAC,WAAW,IAAI,CAAC,CAACA,IAAI,CAAC,aAAa;IACrD;AACF"}
@@ -307,7 +307,7 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
307
307
  var _exp_extra, _exp_extra1;
308
308
  const { exp } = (0, _config().getConfig)(this.projectRoot);
309
309
  // NOTE: This could probably be folded back into `renderStaticContent` when expo-asset and font support RSC.
310
- const { getBuildTimeServerManifestAsync, getManifest } = await this.ssrLoadModule('expo-router/build/static/getServerManifest.js', {
310
+ const { getBuildTimeServerManifestAsync, getManifest } = await this.ssrLoadModule('@expo/router-server/build/static/getServerManifest.js', {
311
311
  // Only use react-server environment when the routes are using react-server rendering by default.
312
312
  environment: this.isReactServerRoutesEnabled ? 'react-server' : 'node'
313
313
  });
@@ -325,7 +325,7 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
325
325
  */ async getStaticRenderFunctionAsync() {
326
326
  var _exp_extra, _exp_extra1;
327
327
  const url = this.getDevServerUrlOrAssert();
328
- const { getStaticContent, getManifest, getBuildTimeServerManifestAsync } = await this.ssrLoadModule('expo-router/node/render.js', {
328
+ const { getStaticContent, getManifest, getBuildTimeServerManifestAsync } = await this.ssrLoadModule('@expo/router-server/node/render.js', {
329
329
  // This must always use the legacy rendering resolution (no `react-server`) because it leverages
330
330
  // the previous React SSG utilities which aren't available in React 19.
331
331
  environment: 'node'
@@ -397,7 +397,7 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
397
397
  });
398
398
  const bundleStaticHtml = async ()=>{
399
399
  var _exp_extra_router, _exp_extra;
400
- const { getStaticContent } = await this.ssrLoadModule('expo-router/node/render.js', {
400
+ const { getStaticContent } = await this.ssrLoadModule('@expo/router-server/node/render.js', {
401
401
  // This must always use the legacy rendering resolution (no `react-server`) because it leverages
402
402
  // the previous React SSG utilities which aren't available in React 19.
403
403
  environment: 'node',
@@ -484,7 +484,6 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
484
484
  };
485
485
  const transformOptions = {
486
486
  dev: expoBundleOptions.dev ?? true,
487
- hot: true,
488
487
  minify: expoBundleOptions.minify ?? false,
489
488
  type: 'module',
490
489
  unstable_transformProfile: extraOptions.unstable_transformProfile ?? expoBundleOptions.unstable_transformProfile ?? 'default',
@@ -821,7 +820,24 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
821
820
  // Add support for DOM components.
822
821
  // TODO: Maybe put behind a flag for now?
823
822
  middleware.use(domComponentRenderer);
823
+ // TODO: Disable both of these when tunneling to prevent security issues
824
824
  middleware.use(new _CreateFileMiddleware.CreateFileMiddleware(this.projectRoot).getHandler());
825
+ // For providing info to the error overlay.
826
+ middleware.use((req, res, next)=>{
827
+ var _req_url;
828
+ // Use by `@expo/log-box` https://github.com/expo/expo/blob/f29b9f3715e42dca87bf3eebf11f7e7dd1ff73c1/packages/%40expo/log-box/src/utils/devServerEndpoints.ts#L82
829
+ if ((_req_url = req.url) == null ? void 0 : _req_url.startsWith('/_expo/error-overlay-meta')) {
830
+ res.statusCode = 200;
831
+ res.setHeader('Content-Type', 'application/json');
832
+ res.end(JSON.stringify({
833
+ projectRoot: this.projectRoot,
834
+ serverRoot,
835
+ sdkVersion: exp.sdkVersion
836
+ }));
837
+ return;
838
+ }
839
+ return next();
840
+ });
825
841
  // Append support for redirecting unhandled requests to the index.html page on web.
826
842
  if (this.isTargetingWeb()) {
827
843
  var _exp_extra_router1, _exp_extra2;
@@ -1352,9 +1368,7 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
1352
1368
  bundlePerfLogger == null ? void 0 : bundlePerfLogger.point('serializingBundle_start');
1353
1369
  const shouldAddToIgnoreList = this.metro._shouldAddModuleToIgnoreList.bind(this.metro);
1354
1370
  const serializer = this.getMetroSerializer();
1355
- const bundle = await serializer(// NOTE: Using absolute path instead of relative input path is a breaking change.
1356
- // entryFile,
1357
- resolvedEntryFilePath, revision.prepend, revision.graph, {
1371
+ const options = {
1358
1372
  asyncRequireModulePath: await this.metro._resolveRelativePath(config.transformer.asyncRequireModulePath, {
1359
1373
  relativeTo: 'project',
1360
1374
  resolverOptions,
@@ -1364,6 +1378,7 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
1364
1378
  processModuleFilter: config.serializer.processModuleFilter,
1365
1379
  createModuleId: this.metro._createModuleId,
1366
1380
  getRunModuleStatement: config.serializer.getRunModuleStatement,
1381
+ globalPrefix: config.transformer.globalPrefix,
1367
1382
  includeAsyncPaths: graphOptions.lazy,
1368
1383
  dev: transformOptions.dev,
1369
1384
  projectRoot: config.projectRoot,
@@ -1375,9 +1390,14 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
1375
1390
  inlineSourceMap: serializerOptions.inlineSourceMap,
1376
1391
  serverRoot: config.server.unstable_serverRoot ?? config.projectRoot,
1377
1392
  shouldAddToIgnoreList,
1378
- // @ts-expect-error: passed to our serializer to enable non-serial return values.
1393
+ // TODO(@kitten): This is incoherently typed. The target should be typed to accept this coherently
1394
+ // but we have no type overrides or a proper type chain for this
1379
1395
  serializerOptions
1380
- });
1396
+ };
1397
+ // TODO(@kitten): Yearns for a refactor. The typings here were and are questionable
1398
+ const bundle = await serializer(// NOTE: Using absolute path instead of relative input path is a breaking change.
1399
+ // entryFile,
1400
+ resolvedEntryFilePath, revision.prepend, revision.graph, options);
1381
1401
  this.metro._reporter.update({
1382
1402
  buildID: getBuildID(buildNumber),
1383
1403
  type: 'bundle_build_done'