@expo/cli 0.18.4 → 0.18.6

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 (31) hide show
  1. package/build/bin/cli +1 -1
  2. package/build/src/export/embed/exportEmbedAsync.js +1 -0
  3. package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
  4. package/build/src/export/exportAsync.js +0 -2
  5. package/build/src/export/exportAsync.js.map +1 -1
  6. package/build/src/export/fork-bundleAsync.js +2 -0
  7. package/build/src/export/fork-bundleAsync.js.map +1 -1
  8. package/build/src/run/ios/options/resolveDevice.js +3 -4
  9. package/build/src/run/ios/options/resolveDevice.js.map +1 -1
  10. package/build/src/run/startBundler.js +1 -0
  11. package/build/src/run/startBundler.js.map +1 -1
  12. package/build/src/start/server/metro/MetroBundlerDevServer.js +16 -5
  13. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
  14. package/build/src/start/server/metro/TerminalReporter.js +7 -0
  15. package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
  16. package/build/src/start/server/metro/TerminalReporter.types.js.map +1 -1
  17. package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
  18. package/build/src/start/server/metro/fetchRouterManifest.js +1 -1
  19. package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
  20. package/build/src/start/server/metro/withMetroMultiPlatform.js +6 -5
  21. package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
  22. package/build/src/start/server/middleware/metroOptions.js +6 -2
  23. package/build/src/start/server/middleware/metroOptions.js.map +1 -1
  24. package/build/src/start/server/serverLogLikeMetro.js +59 -4
  25. package/build/src/start/server/serverLogLikeMetro.js.map +1 -1
  26. package/build/src/utils/env.js +3 -0
  27. package/build/src/utils/env.js.map +1 -1
  28. package/build/src/utils/fn.js +4 -4
  29. package/build/src/utils/fn.js.map +1 -1
  30. package/build/src/utils/telemetry/getContext.js +1 -1
  31. package/package.json +2 -2
package/build/bin/cli CHANGED
@@ -120,7 +120,7 @@ const args = (0, _arg().default)({
120
120
  });
121
121
  if (args["--version"]) {
122
122
  // Version is added in the build script.
123
- console.log("0.18.4");
123
+ console.log("0.18.6");
124
124
  process.exit(0);
125
125
  }
126
126
  if (args["--non-interactive"]) {
@@ -150,6 +150,7 @@ async function createMetroServerAndBundleRequestAsync(projectRoot, options) {
150
150
  const bundleRequest = {
151
151
  ..._server().default.DEFAULT_BUNDLE_OPTIONS,
152
152
  ...(0, _metroOptions.getMetroDirectBundleOptionsForExpoConfig)(projectRoot, exp, {
153
+ splitChunks: false,
153
154
  mainModuleName: options.entryFile,
154
155
  platform: options.platform,
155
156
  minify: options.minify,
@@ -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 fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport Server from 'metro/src/Server';\nimport output from 'metro/src/shared/output/bundle';\nimport type { BundleOptions } from 'metro/src/shared/types';\nimport path from 'path';\n\nimport { Options } from './resolveOptions';\nimport { isExecutingFromXcodebuild, logMetroErrorInXcode } from './xcodeCompilerLogger';\nimport { Log } from '../../log';\nimport { loadMetroConfigAsync } from '../../start/server/metro/instantiateMetro';\nimport { getMetroDirectBundleOptionsForExpoConfig } from '../../start/server/middleware/metroOptions';\nimport { stripAnsi } from '../../utils/ansi';\nimport { removeAsync } from '../../utils/dir';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { profile } from '../../utils/profile';\nimport { isEnableHermesManaged } from '../exportHermes';\nimport { getAssets } from '../fork-bundleAsync';\nimport { persistMetroAssetsAsync } from '../persistMetroAssets';\n\nconst debug = require('debug')('expo:export:embed');\n\nfunction guessCopiedAppleBundlePath(bundleOutput: string) {\n // Ensure the path is familiar before guessing.\n if (!bundleOutput.match(/\\/Xcode\\/DerivedData\\/.*\\/Build\\/Products\\//)) {\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(path.join(bundleParent, `*.app/${bundleName}`), {\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 setNodeEnv(options.dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n\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 } = await exportEmbedBundleAndAssetsAsync(projectRoot, options);\n\n fs.mkdirSync(path.dirname(options.bundleOutput), { recursive: true, mode: 0o755 });\n\n // Persist bundle and source maps.\n await Promise.all([\n output.save(bundle, options, Log.log),\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(assets, {\n platform: options.platform,\n outputDirectory: options.assetsDest,\n iosAssetCatalogDirectory: options.assetCatalogDest,\n })\n : null,\n ]);\n}\n\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 const bundleRequest = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n ...getMetroDirectBundleOptionsForExpoConfig(projectRoot, exp, {\n mainModuleName: options.entryFile,\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n bytecode: isHermes,\n isExporting: true,\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 exportEmbedBundleAndAssetsAsync(\n projectRoot: string,\n options: Options\n): Promise<{\n bundle: Awaited<ReturnType<Server['build']>>;\n assets: Awaited<ReturnType<typeof getAssets>>;\n}> {\n const { server, bundleRequest } = await createMetroServerAndBundleRequestAsync(\n projectRoot,\n options\n );\n\n try {\n const bundle = await exportEmbedBundleAsync(server, bundleRequest, projectRoot, options);\n const assets = await exportEmbedAssetsAsync(server, bundleRequest, projectRoot, options);\n return { bundle, assets };\n } finally {\n server.end();\n }\n}\n\nexport async function exportEmbedBundleAsync(\n server: Server,\n bundleRequest: BundleOptions,\n projectRoot: string,\n options: Pick<Options, 'platform'>\n) {\n try {\n return await profile(\n server.build.bind(server),\n 'metro-bundle'\n )({\n ...bundleRequest,\n bundleType: 'bundle',\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\nexport async function exportEmbedAssetsAsync(\n server: Server,\n bundleRequest: BundleOptions,\n projectRoot: string,\n options: Pick<Options, 'platform'>\n) {\n try {\n return await getAssets(server, {\n ...bundleRequest,\n bundleType: 'todo',\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":["exportEmbedAsync","createMetroServerAndBundleRequestAsync","exportEmbedBundleAndAssetsAsync","exportEmbedBundleAsync","exportEmbedAssetsAsync","debug","require","guessCopiedAppleBundlePath","bundleOutput","match","bundleName","path","basename","bundleParent","dirname","possiblePath","globSync","join","dot","projectRoot","options","setNodeEnv","dev","load","removeAsync","platform","previousPath","fs","existsSync","bundle","assets","mkdirSync","recursive","mode","Promise","all","output","save","Log","log","assetsDest","persistMetroAssetsAsync","outputDirectory","iosAssetCatalogDirectory","assetCatalogDest","exp","getConfig","skipSDKVersionRequirement","config","loadMetroConfigAsync","resetCache","maxWorkers","isExporting","getMetroBundler","server","getBundler","isHermes","isEnableHermesManaged","sourceMapUrl","sourcemapOutput","sourcemapUseAbsolutePath","bundleRequest","Server","DEFAULT_BUNDLE_OPTIONS","getMetroDirectBundleOptionsForExpoConfig","mainModuleName","entryFile","minify","engine","undefined","bytecode","unstable_transformProfile","unstableTransformProfile","watch","end","profile","build","bind","bundleType","error","isError","isExecutingFromXcodebuild","message","stripAnsi","logMetroErrorInXcode","getAssets","Error"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;;IAuCsBA,gBAAgB,MAAhBA,gBAAgB;IAoChBC,sCAAsC,MAAtCA,sCAAsC;IAmEtCC,+BAA+B,MAA/BA,+BAA+B;IAqB/BC,sBAAsB,MAAtBA,sBAAsB;IA8BtBC,sBAAsB,MAAtBA,sBAAsB;;;yBAjMlB,cAAc;;;;;;;8DACzB,IAAI;;;;;;;yBACc,MAAM;;;;;;;8DACpB,kBAAkB;;;;;;;8DAClB,gCAAgC;;;;;;;8DAElC,MAAM;;;;;;qCAGyC,uBAAuB;qBACnE,WAAW;kCACM,2CAA2C;8BACvB,4CAA4C;sBAC3E,kBAAkB;qBAChB,iBAAiB;yBAClB,qBAAqB;yBACxB,qBAAqB;8BACP,iBAAiB;iCAC7B,qBAAqB;oCACP,uBAAuB;;;;;;AAE/D,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,mBAAmB,CAAC,AAAC;AAEpD,SAASC,0BAA0B,CAACC,YAAoB,EAAE;IACxD,+CAA+C;IAC/C,IAAI,CAACA,YAAY,CAACC,KAAK,+CAA+C,EAAE;QACtEJ,KAAK,CAAC,oCAAoC,EAAEG,YAAY,CAAC,CAAC;QAC1D,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAME,UAAU,GAAGC,KAAI,EAAA,QAAA,CAACC,QAAQ,CAACJ,YAAY,CAAC,AAAC;IAC/C,MAAMK,YAAY,GAAGF,KAAI,EAAA,QAAA,CAACG,OAAO,CAACN,YAAY,CAAC,AAAC;IAChD,MAAMO,YAAY,GAAGC,IAAAA,KAAQ,EAAA,KAAA,EAACL,KAAI,EAAA,QAAA,CAACM,IAAI,CAACJ,YAAY,EAAE,CAAC,MAAM,EAAEH,UAAU,CAAC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I3D,OAAO,CAACK,QAAQ,KAAK,KAAK,EAAE;gBAC9B,8FAA8F;gBAC9F,IAAI,SAAS,IAAIsD,KAAK,IAAIE,IAAAA,oBAAyB,0BAAA,GAAE,EAAE;oBACrDF,KAAK,CAACG,OAAO,GAAGC,IAAAA,KAAS,UAAA,EAACJ,KAAK,CAACG,OAAO,CAAC,AAAU,CAAC;gBACrD,CAAC;gBACDE,IAAAA,oBAAoB,qBAAA,EAACjE,WAAW,EAAE4D,KAAK,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;QACD,MAAMA,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAASC,OAAO,CAACD,KAAU,EAAkB;IAC3C,OAAOA,KAAK,YAAYO,KAAK,CAAC;AAChC,CAAC"}
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 fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport Server from 'metro/src/Server';\nimport output from 'metro/src/shared/output/bundle';\nimport type { BundleOptions } from 'metro/src/shared/types';\nimport path from 'path';\n\nimport { Options } from './resolveOptions';\nimport { isExecutingFromXcodebuild, logMetroErrorInXcode } from './xcodeCompilerLogger';\nimport { Log } from '../../log';\nimport { loadMetroConfigAsync } from '../../start/server/metro/instantiateMetro';\nimport { getMetroDirectBundleOptionsForExpoConfig } from '../../start/server/middleware/metroOptions';\nimport { stripAnsi } from '../../utils/ansi';\nimport { removeAsync } from '../../utils/dir';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { profile } from '../../utils/profile';\nimport { isEnableHermesManaged } from '../exportHermes';\nimport { getAssets } from '../fork-bundleAsync';\nimport { persistMetroAssetsAsync } from '../persistMetroAssets';\n\nconst debug = require('debug')('expo:export:embed');\n\nfunction guessCopiedAppleBundlePath(bundleOutput: string) {\n // Ensure the path is familiar before guessing.\n if (!bundleOutput.match(/\\/Xcode\\/DerivedData\\/.*\\/Build\\/Products\\//)) {\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(path.join(bundleParent, `*.app/${bundleName}`), {\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 setNodeEnv(options.dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n\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 } = await exportEmbedBundleAndAssetsAsync(projectRoot, options);\n\n fs.mkdirSync(path.dirname(options.bundleOutput), { recursive: true, mode: 0o755 });\n\n // Persist bundle and source maps.\n await Promise.all([\n output.save(bundle, options, Log.log),\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(assets, {\n platform: options.platform,\n outputDirectory: options.assetsDest,\n iosAssetCatalogDirectory: options.assetCatalogDest,\n })\n : null,\n ]);\n}\n\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 const bundleRequest = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n ...getMetroDirectBundleOptionsForExpoConfig(projectRoot, exp, {\n splitChunks: false,\n mainModuleName: options.entryFile,\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n bytecode: isHermes,\n isExporting: true,\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 exportEmbedBundleAndAssetsAsync(\n projectRoot: string,\n options: Options\n): Promise<{\n bundle: Awaited<ReturnType<Server['build']>>;\n assets: Awaited<ReturnType<typeof getAssets>>;\n}> {\n const { server, bundleRequest } = await createMetroServerAndBundleRequestAsync(\n projectRoot,\n options\n );\n\n try {\n const bundle = await exportEmbedBundleAsync(server, bundleRequest, projectRoot, options);\n const assets = await exportEmbedAssetsAsync(server, bundleRequest, projectRoot, options);\n return { bundle, assets };\n } finally {\n server.end();\n }\n}\n\nexport async function exportEmbedBundleAsync(\n server: Server,\n bundleRequest: BundleOptions,\n projectRoot: string,\n options: Pick<Options, 'platform'>\n) {\n try {\n return await profile(\n server.build.bind(server),\n 'metro-bundle'\n )({\n ...bundleRequest,\n bundleType: 'bundle',\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\nexport async function exportEmbedAssetsAsync(\n server: Server,\n bundleRequest: BundleOptions,\n projectRoot: string,\n options: Pick<Options, 'platform'>\n) {\n try {\n return await getAssets(server, {\n ...bundleRequest,\n bundleType: 'todo',\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":["exportEmbedAsync","createMetroServerAndBundleRequestAsync","exportEmbedBundleAndAssetsAsync","exportEmbedBundleAsync","exportEmbedAssetsAsync","debug","require","guessCopiedAppleBundlePath","bundleOutput","match","bundleName","path","basename","bundleParent","dirname","possiblePath","globSync","join","dot","projectRoot","options","setNodeEnv","dev","load","removeAsync","platform","previousPath","fs","existsSync","bundle","assets","mkdirSync","recursive","mode","Promise","all","output","save","Log","log","assetsDest","persistMetroAssetsAsync","outputDirectory","iosAssetCatalogDirectory","assetCatalogDest","exp","getConfig","skipSDKVersionRequirement","config","loadMetroConfigAsync","resetCache","maxWorkers","isExporting","getMetroBundler","server","getBundler","isHermes","isEnableHermesManaged","sourceMapUrl","sourcemapOutput","sourcemapUseAbsolutePath","bundleRequest","Server","DEFAULT_BUNDLE_OPTIONS","getMetroDirectBundleOptionsForExpoConfig","splitChunks","mainModuleName","entryFile","minify","engine","undefined","bytecode","unstable_transformProfile","unstableTransformProfile","watch","end","profile","build","bind","bundleType","error","isError","isExecutingFromXcodebuild","message","stripAnsi","logMetroErrorInXcode","getAssets","Error"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;;IAuCsBA,gBAAgB,MAAhBA,gBAAgB;IAoChBC,sCAAsC,MAAtCA,sCAAsC;IAoEtCC,+BAA+B,MAA/BA,+BAA+B;IAqB/BC,sBAAsB,MAAtBA,sBAAsB;IA8BtBC,sBAAsB,MAAtBA,sBAAsB;;;yBAlMlB,cAAc;;;;;;;8DACzB,IAAI;;;;;;;yBACc,MAAM;;;;;;;8DACpB,kBAAkB;;;;;;;8DAClB,gCAAgC;;;;;;;8DAElC,MAAM;;;;;;qCAGyC,uBAAuB;qBACnE,WAAW;kCACM,2CAA2C;8BACvB,4CAA4C;sBAC3E,kBAAkB;qBAChB,iBAAiB;yBAClB,qBAAqB;yBACxB,qBAAqB;8BACP,iBAAiB;iCAC7B,qBAAqB;oCACP,uBAAuB;;;;;;AAE/D,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,mBAAmB,CAAC,AAAC;AAEpD,SAASC,0BAA0B,CAACC,YAAoB,EAAE;IACxD,+CAA+C;IAC/C,IAAI,CAACA,YAAY,CAACC,KAAK,+CAA+C,EAAE;QACtEJ,KAAK,CAAC,oCAAoC,EAAEG,YAAY,CAAC,CAAC;QAC1D,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAME,UAAU,GAAGC,KAAI,EAAA,QAAA,CAACC,QAAQ,CAACJ,YAAY,CAAC,AAAC;IAC/C,MAAMK,YAAY,GAAGF,KAAI,EAAA,QAAA,CAACG,OAAO,CAACN,YAAY,CAAC,AAAC;IAChD,MAAMO,YAAY,GAAGC,IAAAA,KAAQ,EAAA,KAAA,EAACL,KAAI,EAAA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,EAAO;QACnB,IAAIC,OAAO,CAACD,KAAK,CAAC,EAAE;YAClB,0EAA0E;YAC1E,iIAAiI;YACjI,IAAI5D,OAAO,CAACK,QAAQ,KAAK,KAAK,EAAE;gBAC9B,8FAA8F;gBAC9F,IAAI,SAAS,IAAIuD,KAAK,IAAIE,IAAAA,oBAAyB,0BAAA,GAAE,EAAE;oBACrDF,KAAK,CAACG,OAAO,GAAGC,IAAAA,KAAS,UAAA,EAACJ,KAAK,CAACG,OAAO,CAAC,AAAU,CAAC;gBACrD,CAAC;gBACDE,IAAAA,oBAAoB,qBAAA,EAAClE,WAAW,EAAE6D,KAAK,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;QACD,MAAMA,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAASC,OAAO,CAACD,KAAU,EAAkB;IAC3C,OAAOA,KAAK,YAAYO,KAAK,CAAC;AAChC,CAAC"}
@@ -74,8 +74,6 @@ async function exportAsync(projectRoot, options) {
74
74
  _fileNotifier.FileNotifier.stopAll();
75
75
  // Final notes
76
76
  _log.log(`App exported to: ${options.outputDir}`);
77
- // Force exit because various threading and analytics processes could be hanging, this command needs to run as fast as possible.
78
- process.exit(0);
79
77
  }
80
78
 
81
79
  //# sourceMappingURL=exportAsync.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/export/exportAsync.ts"],"sourcesContent":["import path from 'path';\n\nimport { exportAppAsync } from './exportApp';\nimport { Options } from './resolveOptions';\nimport * as Log from '../log';\nimport { FileNotifier } from '../utils/FileNotifier';\nimport { ensureDirectoryAsync, removeAsync } from '../utils/dir';\n\nexport async function exportAsync(projectRoot: string, options: Options) {\n // Ensure the output directory is created\n const outputPath = path.resolve(projectRoot, options.outputDir);\n // Delete the output directory if it exists\n await removeAsync(outputPath);\n // Create the output directory\n await ensureDirectoryAsync(outputPath);\n\n // Export the app\n await exportAppAsync(projectRoot, options);\n\n // Stop any file watchers to prevent the CLI from hanging.\n FileNotifier.stopAll();\n\n // Final notes\n Log.log(`App exported to: ${options.outputDir}`);\n\n // Force exit because various threading and analytics processes could be hanging, this command needs to run as fast as possible.\n process.exit(0);\n}\n"],"names":["exportAsync","projectRoot","options","outputPath","path","resolve","outputDir","removeAsync","ensureDirectoryAsync","exportAppAsync","FileNotifier","stopAll","Log","log","process","exit"],"mappings":"AAAA;;;;+BAQsBA,aAAW;;aAAXA,WAAW;;;8DARhB,MAAM;;;;;;2BAEQ,aAAa;2DAEvB,QAAQ;8BACA,uBAAuB;qBACF,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzD,eAAeA,WAAW,CAACC,WAAmB,EAAEC,OAAgB,EAAE;IACvE,yCAAyC;IACzC,MAAMC,UAAU,GAAGC,KAAI,EAAA,QAAA,CAACC,OAAO,CAACJ,WAAW,EAAEC,OAAO,CAACI,SAAS,CAAC,AAAC;IAChE,2CAA2C;IAC3C,MAAMC,IAAAA,IAAW,YAAA,EAACJ,UAAU,CAAC,CAAC;IAC9B,8BAA8B;IAC9B,MAAMK,IAAAA,IAAoB,qBAAA,EAACL,UAAU,CAAC,CAAC;IAEvC,iBAAiB;IACjB,MAAMM,IAAAA,UAAc,eAAA,EAACR,WAAW,EAAEC,OAAO,CAAC,CAAC;IAE3C,0DAA0D;IAC1DQ,aAAY,aAAA,CAACC,OAAO,EAAE,CAAC;IAEvB,cAAc;IACdC,IAAG,CAACC,GAAG,CAAC,CAAC,iBAAiB,EAAEX,OAAO,CAACI,SAAS,CAAC,CAAC,CAAC,CAAC;IAEjD,gIAAgI;IAChIQ,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
1
+ {"version":3,"sources":["../../../src/export/exportAsync.ts"],"sourcesContent":["import path from 'path';\n\nimport { exportAppAsync } from './exportApp';\nimport { Options } from './resolveOptions';\nimport * as Log from '../log';\nimport { FileNotifier } from '../utils/FileNotifier';\nimport { ensureDirectoryAsync, removeAsync } from '../utils/dir';\n\nexport async function exportAsync(projectRoot: string, options: Options) {\n // Ensure the output directory is created\n const outputPath = path.resolve(projectRoot, options.outputDir);\n // Delete the output directory if it exists\n await removeAsync(outputPath);\n // Create the output directory\n await ensureDirectoryAsync(outputPath);\n\n // Export the app\n await exportAppAsync(projectRoot, options);\n\n // Stop any file watchers to prevent the CLI from hanging.\n FileNotifier.stopAll();\n\n // Final notes\n Log.log(`App exported to: ${options.outputDir}`);\n}\n"],"names":["exportAsync","projectRoot","options","outputPath","path","resolve","outputDir","removeAsync","ensureDirectoryAsync","exportAppAsync","FileNotifier","stopAll","Log","log"],"mappings":"AAAA;;;;+BAQsBA,aAAW;;aAAXA,WAAW;;;8DARhB,MAAM;;;;;;2BAEQ,aAAa;2DAEvB,QAAQ;8BACA,uBAAuB;qBACF,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzD,eAAeA,WAAW,CAACC,WAAmB,EAAEC,OAAgB,EAAE;IACvE,yCAAyC;IACzC,MAAMC,UAAU,GAAGC,KAAI,EAAA,QAAA,CAACC,OAAO,CAACJ,WAAW,EAAEC,OAAO,CAACI,SAAS,CAAC,AAAC;IAChE,2CAA2C;IAC3C,MAAMC,IAAAA,IAAW,YAAA,EAACJ,UAAU,CAAC,CAAC;IAC9B,8BAA8B;IAC9B,MAAMK,IAAAA,IAAoB,qBAAA,EAACL,UAAU,CAAC,CAAC;IAEvC,iBAAiB;IACjB,MAAMM,IAAAA,UAAc,eAAA,EAACR,WAAW,EAAEC,OAAO,CAAC,CAAC;IAE3C,0DAA0D;IAC1DQ,aAAY,aAAA,CAACC,OAAO,EAAE,CAAC;IAEvB,cAAc;IACdC,IAAG,CAACC,GAAG,CAAC,CAAC,iBAAiB,EAAEX,OAAO,CAACI,SAAS,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC"}
@@ -65,6 +65,7 @@ const _exportHermes = require("./exportHermes");
65
65
  const _instantiateMetro = require("../start/server/metro/instantiateMetro");
66
66
  const _manifestMiddleware = require("../start/server/middleware/ManifestMiddleware");
67
67
  const _metroOptions = require("../start/server/middleware/metroOptions");
68
+ const _env = require("../utils/env");
68
69
  const _errors = require("../utils/errors");
69
70
  function _interopRequireDefault(obj) {
70
71
  return obj && obj.__esModule ? obj : {
@@ -137,6 +138,7 @@ async function bundleProductionMetroClientAsync(projectRoot, expoConfig, metroOp
137
138
  ..._server().default.DEFAULT_BUNDLE_OPTIONS,
138
139
  sourceMapUrl: bundle.sourceMapUrl,
139
140
  ...(0, _metroOptions.getMetroDirectBundleOptionsForExpoConfig)(projectRoot, expoConfig, {
141
+ splitChunks: !_env.env.EXPO_NO_BUNDLE_SPLITTING && bundle.platform === "web",
140
142
  minify: bundle.minify,
141
143
  mainModuleName: bundle.entryPoint,
142
144
  platform: bundle.platform,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/export/fork-bundleAsync.ts"],"sourcesContent":["import { ExpoConfig, getConfigFilePaths, Platform, ProjectConfig } from '@expo/config';\nimport { LoadOptions } from '@expo/metro-config';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport getMetroAssets from '@expo/metro-config/build/transform-worker/getAssets';\nimport assert from 'assert';\nimport Metro, { MixedOutput, Module, ReadOnlyGraph } from 'metro';\nimport type { TransformInputOptions } from 'metro/src/DeltaBundler/types';\nimport IncrementalBundler from 'metro/src/IncrementalBundler';\nimport Server from 'metro/src/Server';\nimport splitBundleOptions from 'metro/src/lib/splitBundleOptions';\nimport type {\n ResolverInputOptions,\n BundleOptions as MetroBundleOptions,\n} from 'metro/src/shared/types';\nimport { ConfigT } from 'metro-config';\nimport path from 'path';\n\nimport { isEnableHermesManaged, maybeThrowFromInconsistentEngineAsync } from './exportHermes';\nimport { loadMetroConfigAsync } from '../start/server/metro/instantiateMetro';\nimport { getEntryWithServerRoot } from '../start/server/middleware/ManifestMiddleware';\nimport {\n ExpoMetroBundleOptions,\n getMetroDirectBundleOptionsForExpoConfig,\n} from '../start/server/middleware/metroOptions';\nimport { CommandError } from '../utils/errors';\n\nexport type MetroDevServerOptions = LoadOptions;\n\nexport type BundleOptions = {\n entryPoint: string;\n platform: 'android' | 'ios' | 'web';\n dev?: boolean;\n minify?: boolean;\n bytecode: boolean;\n sourceMapUrl?: string;\n sourcemaps?: boolean;\n};\nexport type BundleAssetWithFileHashes = Metro.AssetData & {\n fileHashes: string[]; // added by the hashAssets asset plugin\n};\nexport type BundleOutput = {\n artifacts: SerialAsset[];\n assets: readonly BundleAssetWithFileHashes[];\n};\n\nlet nextBuildID = 0;\n\nasync function assertEngineMismatchAsync(\n projectRoot: string,\n exp: Pick<ExpoConfig, 'ios' | 'android' | 'jsEngine'>,\n platform: Platform\n) {\n const isHermesManaged = isEnableHermesManaged(exp, platform);\n\n const paths = getConfigFilePaths(projectRoot);\n const configFilePath = paths.dynamicConfigPath ?? paths.staticConfigPath ?? 'app.json';\n await maybeThrowFromInconsistentEngineAsync(\n projectRoot,\n configFilePath,\n platform,\n isHermesManaged\n );\n}\n\nexport async function createBundlesAsync(\n projectRoot: string,\n projectConfig: ProjectConfig,\n bundleOptions: {\n clear?: boolean;\n maxWorkers?: number;\n platforms: Platform[];\n dev?: boolean;\n minify?: boolean;\n bytecode: boolean;\n sourcemaps?: boolean;\n entryPoint?: string;\n }\n): Promise<Partial<Record<Platform, BundleOutput>>> {\n if (!bundleOptions.platforms.length) {\n return {};\n }\n const { exp, pkg } = projectConfig;\n\n const bundles = await bundleProductionMetroClientAsync(\n projectRoot,\n exp,\n {\n // If not legacy, ignore the target option to prevent warnings from being thrown.\n resetCache: bundleOptions.clear,\n maxWorkers: bundleOptions.maxWorkers,\n },\n bundleOptions.platforms.map((platform: Platform) => ({\n platform,\n entryPoint:\n bundleOptions.entryPoint ?? getEntryWithServerRoot(projectRoot, { platform, pkg }),\n sourcemaps: bundleOptions.sourcemaps,\n minify: bundleOptions.minify,\n bytecode: bundleOptions.bytecode,\n dev: bundleOptions.dev,\n }))\n );\n\n // { ios: bundle, android: bundle }\n return bundleOptions.platforms.reduce<Partial<Record<Platform, BundleOutput>>>(\n (prev, platform, index) => ({\n ...prev,\n [platform]: bundles[index],\n }),\n {}\n );\n}\n\nfunction assertMetroConfig(\n config: ConfigT\n): asserts config is ConfigT & { serializer: NonNullable<ConfigT['serializer']> } {\n if (!config.serializer?.customSerializer) {\n throw new CommandError(\n 'METRO_CONFIG_MALFORMED',\n `The Metro bundler configuration is missing required features from 'expo/metro-config' and cannot be used with Expo CLI. Ensure the metro.config.js file is extending 'expo/metro-config'. Learn more: https://docs.expo.dev/guides/customizing-metro`\n );\n }\n}\n\nasync function bundleProductionMetroClientAsync(\n projectRoot: string,\n expoConfig: ExpoConfig,\n metroOptions: MetroDevServerOptions,\n bundles: BundleOptions[]\n): Promise<BundleOutput[]> {\n // Assert early so the user doesn't have to wait until bundling is complete to find out that\n // Hermes won't be available.\n await Promise.all(\n bundles.map(({ platform }) => assertEngineMismatchAsync(projectRoot, expoConfig, platform))\n );\n\n const { config, reporter } = await loadMetroConfigAsync(projectRoot, metroOptions, {\n exp: expoConfig,\n isExporting: true,\n getMetroBundler() {\n return metroServer.getBundler().getBundler();\n },\n });\n\n assertMetroConfig(config);\n\n const metroServer = await Metro.runMetro(config, {\n watch: false,\n });\n\n const buildAsync = async (bundle: BundleOptions): Promise<BundleOutput> => {\n const buildID = `bundle_${nextBuildID++}_${bundle.platform}`;\n const isHermes = isEnableHermesManaged(expoConfig, bundle.platform);\n if (isHermes) {\n await assertEngineMismatchAsync(projectRoot, expoConfig, bundle.platform);\n }\n const bundleOptions: MetroBundleOptions = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n sourceMapUrl: bundle.sourceMapUrl,\n ...getMetroDirectBundleOptionsForExpoConfig(projectRoot, expoConfig, {\n minify: bundle.minify,\n mainModuleName: bundle.entryPoint,\n platform: bundle.platform,\n mode: bundle.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: bundle.sourcemaps,\n bytecode: bundle.bytecode && isHermes,\n // Bundle splitting on web-only for now.\n // serializerOutput: bundle.platform === 'web' ? 'static' : undefined,\n serializerOutput: 'static',\n isExporting: true,\n }),\n bundleType: 'bundle',\n inlineSourceMap: false,\n createModuleIdFactory: config.serializer.createModuleIdFactory,\n onProgress: (transformedFileCount: number, totalFileCount: number) => {\n reporter.update({\n buildID,\n type: 'bundle_transform_progressed',\n transformedFileCount,\n totalFileCount,\n });\n },\n };\n\n const bundleDetails = {\n ...bundleOptions,\n buildID,\n };\n reporter.update({\n buildID,\n type: 'bundle_build_started',\n bundleDetails,\n });\n try {\n const artifacts = await forkMetroBuildAsync(metroServer, bundleOptions);\n reporter.update({\n buildID,\n type: 'bundle_build_done',\n });\n return artifacts;\n } catch (error) {\n reporter.update({\n buildID,\n type: 'bundle_build_failed',\n });\n\n throw error;\n }\n };\n\n try {\n return await Promise.all(bundles.map((bundle) => buildAsync(bundle)));\n } catch (error) {\n // New line so errors don't show up inline with the progress bar\n console.log('');\n throw error;\n } finally {\n metroServer.end();\n }\n}\n\n// Forked out of Metro because the `this._getServerRootDir()` doesn't match the development\n// behavior.\nexport async function getAssets(metro: Metro.Server, options: MetroBundleOptions) {\n const { entryFile, onProgress, resolverOptions, transformOptions } = splitBundleOptions(options);\n\n // @ts-expect-error: _bundler isn't exposed on the type.\n const dependencies = await metro._bundler.getDependencies(\n [entryFile],\n transformOptions,\n resolverOptions,\n { onProgress, shallow: false, lazy: false }\n );\n\n // @ts-expect-error\n const _config = metro._config as ConfigT;\n\n return getMetroAssets(dependencies, {\n processModuleFilter: _config.serializer.processModuleFilter,\n assetPlugins: _config.transformer.assetPlugins,\n platform: transformOptions.platform!,\n projectRoot: _config.projectRoot, // this._getServerRootDir(),\n publicPath: _config.transformer.publicPath,\n });\n}\n\nfunction isMetroServerInstance(metro: Metro.Server): metro is Metro.Server & {\n _shouldAddModuleToIgnoreList: (module: Module<MixedOutput>) => boolean;\n _bundler: IncrementalBundler;\n _config: ConfigT;\n _createModuleId: (path: string) => number;\n _resolveRelativePath(\n filePath: string,\n {\n relativeTo,\n resolverOptions,\n transformOptions,\n }: {\n relativeTo: 'project' | 'server';\n resolverOptions: ResolverInputOptions;\n transformOptions: TransformInputOptions;\n }\n ): Promise<string>;\n _getEntryPointAbsolutePath(entryFile: string): string;\n _getSortedModules(graph: ReadOnlyGraph): Module<MixedOutput>[];\n} {\n return '_shouldAddModuleToIgnoreList' in metro;\n}\n\nasync function forkMetroBuildAsync(\n metro: Metro.Server,\n options: ExpoMetroBundleOptions\n): Promise<{ artifacts: SerialAsset[]; assets: readonly BundleAssetWithFileHashes[] }> {\n if (!isMetroServerInstance(metro)) {\n throw new Error('Expected Metro server instance to have private functions exposed.');\n }\n\n if (options.serializerOptions?.output !== 'static') {\n throw new Error('Only multi-serializer output is supported.');\n }\n\n const {\n entryFile,\n graphOptions,\n onProgress,\n resolverOptions,\n serializerOptions,\n transformOptions,\n } = splitBundleOptions(options);\n\n const { prepend, graph } = await metro._bundler.buildGraph(\n entryFile,\n transformOptions,\n resolverOptions,\n {\n onProgress,\n shallow: graphOptions.shallow,\n // @ts-expect-error\n lazy: graphOptions.lazy,\n }\n );\n\n const entryPoint = metro._getEntryPointAbsolutePath(entryFile);\n\n const bundleOptions = {\n asyncRequireModulePath: await metro._resolveRelativePath(\n metro._config.transformer.asyncRequireModulePath,\n {\n relativeTo: 'project',\n resolverOptions,\n transformOptions,\n }\n ),\n processModuleFilter: metro._config.serializer.processModuleFilter,\n createModuleId: metro._createModuleId,\n getRunModuleStatement: metro._config.serializer.getRunModuleStatement,\n dev: transformOptions.dev,\n includeAsyncPaths: graphOptions.lazy,\n projectRoot: metro._config.projectRoot,\n modulesOnly: serializerOptions.modulesOnly,\n runBeforeMainModule: metro._config.serializer.getModulesRunBeforeMainModule(\n path.relative(metro._config.projectRoot, entryPoint)\n ),\n runModule: serializerOptions.runModule,\n sourceMapUrl: serializerOptions.sourceMapUrl,\n sourceUrl: serializerOptions.sourceUrl,\n inlineSourceMap: serializerOptions.inlineSourceMap,\n serverRoot: metro._config.server.unstable_serverRoot ?? metro._config.projectRoot,\n shouldAddToIgnoreList: (module: Module<MixedOutput>) =>\n metro._shouldAddModuleToIgnoreList(module),\n // Custom options we pass to the serializer to emulate the URL query parameters.\n serializerOptions: options.serializerOptions,\n };\n\n assertMetroConfig(metro._config);\n\n const bundle = await metro._config.serializer.customSerializer!(\n entryPoint,\n // @ts-expect-error: Metro is typed incorrectly\n prepend,\n graph,\n bundleOptions\n );\n\n try {\n const parsed = typeof bundle === 'string' ? JSON.parse(bundle) : bundle;\n\n assert(\n 'artifacts' in parsed && Array.isArray(parsed.artifacts),\n 'Expected serializer to return an object with key artifacts to contain an array of serial assets.'\n );\n return parsed;\n } catch (error: any) {\n throw new Error(\n 'Serializer did not return expected format. The project copy of `expo/metro-config` may be out of date. Error: ' +\n error.message\n );\n }\n}\n"],"names":["createBundlesAsync","getAssets","nextBuildID","assertEngineMismatchAsync","projectRoot","exp","platform","isHermesManaged","isEnableHermesManaged","paths","getConfigFilePaths","configFilePath","dynamicConfigPath","staticConfigPath","maybeThrowFromInconsistentEngineAsync","projectConfig","bundleOptions","platforms","length","pkg","bundles","bundleProductionMetroClientAsync","resetCache","clear","maxWorkers","map","entryPoint","getEntryWithServerRoot","sourcemaps","minify","bytecode","dev","reduce","prev","index","assertMetroConfig","config","serializer","customSerializer","CommandError","expoConfig","metroOptions","Promise","all","reporter","loadMetroConfigAsync","isExporting","getMetroBundler","metroServer","getBundler","Metro","runMetro","watch","buildAsync","bundle","buildID","isHermes","Server","DEFAULT_BUNDLE_OPTIONS","sourceMapUrl","getMetroDirectBundleOptionsForExpoConfig","mainModuleName","mode","engine","undefined","serializerIncludeMaps","serializerOutput","bundleType","inlineSourceMap","createModuleIdFactory","onProgress","transformedFileCount","totalFileCount","update","type","bundleDetails","artifacts","forkMetroBuildAsync","error","console","log","end","metro","options","entryFile","resolverOptions","transformOptions","splitBundleOptions","dependencies","_bundler","getDependencies","shallow","lazy","_config","getMetroAssets","processModuleFilter","assetPlugins","transformer","publicPath","isMetroServerInstance","Error","serializerOptions","output","graphOptions","prepend","graph","buildGraph","_getEntryPointAbsolutePath","asyncRequireModulePath","_resolveRelativePath","relativeTo","createModuleId","_createModuleId","getRunModuleStatement","includeAsyncPaths","modulesOnly","runBeforeMainModule","getModulesRunBeforeMainModule","path","relative","runModule","sourceUrl","serverRoot","server","unstable_serverRoot","shouldAddToIgnoreList","module","_shouldAddModuleToIgnoreList","parsed","JSON","parse","assert","Array","isArray","message"],"mappings":"AAAA;;;;;;;;;;;IAgEsBA,kBAAkB,MAAlBA,kBAAkB;IA+JlBC,SAAS,MAATA,SAAS;;;yBA/NyC,cAAc;;;;;;;8DAG3D,qDAAqD;;;;;;;8DAC7D,QAAQ;;;;;;;8DAC+B,OAAO;;;;;;;8DAG9C,kBAAkB;;;;;;;8DACN,kCAAkC;;;;;;;8DAMhD,MAAM;;;;;;8BAEsD,gBAAgB;kCACxD,wCAAwC;oCACtC,+CAA+C;8BAI/E,yCAAyC;wBACnB,iBAAiB;;;;;;AAqB9C,IAAIC,WAAW,GAAG,CAAC,AAAC;AAEpB,eAAeC,yBAAyB,CACtCC,WAAmB,EACnBC,GAAqD,EACrDC,QAAkB,EAClB;IACA,MAAMC,eAAe,GAAGC,IAAAA,aAAqB,sBAAA,EAACH,GAAG,EAAEC,QAAQ,CAAC,AAAC;IAE7D,MAAMG,KAAK,GAAGC,IAAAA,OAAkB,EAAA,mBAAA,EAACN,WAAW,CAAC,AAAC;QACvBK,kBAAuB,EAAvBA,GAAiD;IAAxE,MAAME,cAAc,GAAGF,CAAAA,GAAiD,GAAjDA,CAAAA,kBAAuB,GAAvBA,KAAK,CAACG,iBAAiB,YAAvBH,kBAAuB,GAAIA,KAAK,CAACI,gBAAgB,YAAjDJ,GAAiD,GAAI,UAAU,AAAC;IACvF,MAAMK,IAAAA,aAAqC,sCAAA,EACzCV,WAAW,EACXO,cAAc,EACdL,QAAQ,EACRC,eAAe,CAChB,CAA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wC,GAAIA,KAAK,CAACW,OAAO,CAACzF,WAAW;QACjFyH,qBAAqB,EAAE,CAACC,MAA2B,GACjD5C,KAAK,CAAC6C,4BAA4B,CAACD,MAAM,CAAC;QAC5C,gFAAgF;QAChFzB,iBAAiB,EAAElB,OAAO,CAACkB,iBAAiB;KAC7C,AAAC;IAEFlE,iBAAiB,CAAC+C,KAAK,CAACW,OAAO,CAAC,CAAC;IAEjC,MAAMvC,MAAM,GAAG,MAAM4B,KAAK,CAACW,OAAO,CAACxD,UAAU,CAACC,gBAAgB,CAC5DZ,UAAU,EACV,+CAA+C;IAC/C8E,OAAO,EACPC,KAAK,EACLzF,aAAa,CACd,AAAC;IAEF,IAAI;QACF,MAAMgH,MAAM,GAAG,OAAO1E,MAAM,KAAK,QAAQ,GAAG2E,IAAI,CAACC,KAAK,CAAC5E,MAAM,CAAC,GAAGA,MAAM,AAAC;QAExE6E,IAAAA,OAAM,EAAA,QAAA,EACJ,WAAW,IAAIH,MAAM,IAAII,KAAK,CAACC,OAAO,CAACL,MAAM,CAACpD,SAAS,CAAC,EACxD,kGAAkG,CACnG,CAAC;QACF,OAAOoD,MAAM,CAAC;IAChB,EAAE,OAAOlD,KAAK,EAAO;QACnB,MAAM,IAAIsB,KAAK,CACb,gHAAgH,GAC9GtB,KAAK,CAACwD,OAAO,CAChB,CAAC;IACJ,CAAC;AACH,CAAC"}
1
+ {"version":3,"sources":["../../../src/export/fork-bundleAsync.ts"],"sourcesContent":["import { ExpoConfig, getConfigFilePaths, Platform, ProjectConfig } from '@expo/config';\nimport { LoadOptions } from '@expo/metro-config';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport getMetroAssets from '@expo/metro-config/build/transform-worker/getAssets';\nimport assert from 'assert';\nimport Metro, { MixedOutput, Module, ReadOnlyGraph } from 'metro';\nimport type { TransformInputOptions } from 'metro/src/DeltaBundler/types';\nimport IncrementalBundler from 'metro/src/IncrementalBundler';\nimport Server from 'metro/src/Server';\nimport splitBundleOptions from 'metro/src/lib/splitBundleOptions';\nimport type {\n ResolverInputOptions,\n BundleOptions as MetroBundleOptions,\n} from 'metro/src/shared/types';\nimport { ConfigT } from 'metro-config';\nimport path from 'path';\n\nimport { isEnableHermesManaged, maybeThrowFromInconsistentEngineAsync } from './exportHermes';\nimport { loadMetroConfigAsync } from '../start/server/metro/instantiateMetro';\nimport { getEntryWithServerRoot } from '../start/server/middleware/ManifestMiddleware';\nimport {\n ExpoMetroBundleOptions,\n getMetroDirectBundleOptionsForExpoConfig,\n} from '../start/server/middleware/metroOptions';\nimport { env } from '../utils/env';\nimport { CommandError } from '../utils/errors';\n\nexport type MetroDevServerOptions = LoadOptions;\n\nexport type BundleOptions = {\n entryPoint: string;\n platform: 'android' | 'ios' | 'web';\n dev?: boolean;\n minify?: boolean;\n bytecode: boolean;\n sourceMapUrl?: string;\n sourcemaps?: boolean;\n};\nexport type BundleAssetWithFileHashes = Metro.AssetData & {\n fileHashes: string[]; // added by the hashAssets asset plugin\n};\nexport type BundleOutput = {\n artifacts: SerialAsset[];\n assets: readonly BundleAssetWithFileHashes[];\n};\n\nlet nextBuildID = 0;\n\nasync function assertEngineMismatchAsync(\n projectRoot: string,\n exp: Pick<ExpoConfig, 'ios' | 'android' | 'jsEngine'>,\n platform: Platform\n) {\n const isHermesManaged = isEnableHermesManaged(exp, platform);\n\n const paths = getConfigFilePaths(projectRoot);\n const configFilePath = paths.dynamicConfigPath ?? paths.staticConfigPath ?? 'app.json';\n await maybeThrowFromInconsistentEngineAsync(\n projectRoot,\n configFilePath,\n platform,\n isHermesManaged\n );\n}\n\nexport async function createBundlesAsync(\n projectRoot: string,\n projectConfig: ProjectConfig,\n bundleOptions: {\n clear?: boolean;\n maxWorkers?: number;\n platforms: Platform[];\n dev?: boolean;\n minify?: boolean;\n bytecode: boolean;\n sourcemaps?: boolean;\n entryPoint?: string;\n }\n): Promise<Partial<Record<Platform, BundleOutput>>> {\n if (!bundleOptions.platforms.length) {\n return {};\n }\n const { exp, pkg } = projectConfig;\n\n const bundles = await bundleProductionMetroClientAsync(\n projectRoot,\n exp,\n {\n // If not legacy, ignore the target option to prevent warnings from being thrown.\n resetCache: bundleOptions.clear,\n maxWorkers: bundleOptions.maxWorkers,\n },\n bundleOptions.platforms.map((platform: Platform) => ({\n platform,\n entryPoint:\n bundleOptions.entryPoint ?? getEntryWithServerRoot(projectRoot, { platform, pkg }),\n sourcemaps: bundleOptions.sourcemaps,\n minify: bundleOptions.minify,\n bytecode: bundleOptions.bytecode,\n dev: bundleOptions.dev,\n }))\n );\n\n // { ios: bundle, android: bundle }\n return bundleOptions.platforms.reduce<Partial<Record<Platform, BundleOutput>>>(\n (prev, platform, index) => ({\n ...prev,\n [platform]: bundles[index],\n }),\n {}\n );\n}\n\nfunction assertMetroConfig(\n config: ConfigT\n): asserts config is ConfigT & { serializer: NonNullable<ConfigT['serializer']> } {\n if (!config.serializer?.customSerializer) {\n throw new CommandError(\n 'METRO_CONFIG_MALFORMED',\n `The Metro bundler configuration is missing required features from 'expo/metro-config' and cannot be used with Expo CLI. Ensure the metro.config.js file is extending 'expo/metro-config'. Learn more: https://docs.expo.dev/guides/customizing-metro`\n );\n }\n}\n\nasync function bundleProductionMetroClientAsync(\n projectRoot: string,\n expoConfig: ExpoConfig,\n metroOptions: MetroDevServerOptions,\n bundles: BundleOptions[]\n): Promise<BundleOutput[]> {\n // Assert early so the user doesn't have to wait until bundling is complete to find out that\n // Hermes won't be available.\n await Promise.all(\n bundles.map(({ platform }) => assertEngineMismatchAsync(projectRoot, expoConfig, platform))\n );\n\n const { config, reporter } = await loadMetroConfigAsync(projectRoot, metroOptions, {\n exp: expoConfig,\n isExporting: true,\n getMetroBundler() {\n return metroServer.getBundler().getBundler();\n },\n });\n\n assertMetroConfig(config);\n\n const metroServer = await Metro.runMetro(config, {\n watch: false,\n });\n\n const buildAsync = async (bundle: BundleOptions): Promise<BundleOutput> => {\n const buildID = `bundle_${nextBuildID++}_${bundle.platform}`;\n const isHermes = isEnableHermesManaged(expoConfig, bundle.platform);\n if (isHermes) {\n await assertEngineMismatchAsync(projectRoot, expoConfig, bundle.platform);\n }\n const bundleOptions: MetroBundleOptions = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n sourceMapUrl: bundle.sourceMapUrl,\n ...getMetroDirectBundleOptionsForExpoConfig(projectRoot, expoConfig, {\n splitChunks: !env.EXPO_NO_BUNDLE_SPLITTING && bundle.platform === 'web',\n minify: bundle.minify,\n mainModuleName: bundle.entryPoint,\n platform: bundle.platform,\n mode: bundle.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: bundle.sourcemaps,\n bytecode: bundle.bytecode && isHermes,\n // Bundle splitting on web-only for now.\n // serializerOutput: bundle.platform === 'web' ? 'static' : undefined,\n serializerOutput: 'static',\n isExporting: true,\n }),\n bundleType: 'bundle',\n inlineSourceMap: false,\n createModuleIdFactory: config.serializer.createModuleIdFactory,\n onProgress: (transformedFileCount: number, totalFileCount: number) => {\n reporter.update({\n buildID,\n type: 'bundle_transform_progressed',\n transformedFileCount,\n totalFileCount,\n });\n },\n };\n\n const bundleDetails = {\n ...bundleOptions,\n buildID,\n };\n reporter.update({\n buildID,\n type: 'bundle_build_started',\n bundleDetails,\n });\n try {\n const artifacts = await forkMetroBuildAsync(metroServer, bundleOptions);\n reporter.update({\n buildID,\n type: 'bundle_build_done',\n });\n return artifacts;\n } catch (error) {\n reporter.update({\n buildID,\n type: 'bundle_build_failed',\n });\n\n throw error;\n }\n };\n\n try {\n return await Promise.all(bundles.map((bundle) => buildAsync(bundle)));\n } catch (error) {\n // New line so errors don't show up inline with the progress bar\n console.log('');\n throw error;\n } finally {\n metroServer.end();\n }\n}\n\n// Forked out of Metro because the `this._getServerRootDir()` doesn't match the development\n// behavior.\nexport async function getAssets(metro: Metro.Server, options: MetroBundleOptions) {\n const { entryFile, onProgress, resolverOptions, transformOptions } = splitBundleOptions(options);\n\n // @ts-expect-error: _bundler isn't exposed on the type.\n const dependencies = await metro._bundler.getDependencies(\n [entryFile],\n transformOptions,\n resolverOptions,\n { onProgress, shallow: false, lazy: false }\n );\n\n // @ts-expect-error\n const _config = metro._config as ConfigT;\n\n return getMetroAssets(dependencies, {\n processModuleFilter: _config.serializer.processModuleFilter,\n assetPlugins: _config.transformer.assetPlugins,\n platform: transformOptions.platform!,\n projectRoot: _config.projectRoot, // this._getServerRootDir(),\n publicPath: _config.transformer.publicPath,\n });\n}\n\nfunction isMetroServerInstance(metro: Metro.Server): metro is Metro.Server & {\n _shouldAddModuleToIgnoreList: (module: Module<MixedOutput>) => boolean;\n _bundler: IncrementalBundler;\n _config: ConfigT;\n _createModuleId: (path: string) => number;\n _resolveRelativePath(\n filePath: string,\n {\n relativeTo,\n resolverOptions,\n transformOptions,\n }: {\n relativeTo: 'project' | 'server';\n resolverOptions: ResolverInputOptions;\n transformOptions: TransformInputOptions;\n }\n ): Promise<string>;\n _getEntryPointAbsolutePath(entryFile: string): string;\n _getSortedModules(graph: ReadOnlyGraph): Module<MixedOutput>[];\n} {\n return '_shouldAddModuleToIgnoreList' in metro;\n}\n\nasync function forkMetroBuildAsync(\n metro: Metro.Server,\n options: ExpoMetroBundleOptions\n): Promise<{ artifacts: SerialAsset[]; assets: readonly BundleAssetWithFileHashes[] }> {\n if (!isMetroServerInstance(metro)) {\n throw new Error('Expected Metro server instance to have private functions exposed.');\n }\n\n if (options.serializerOptions?.output !== 'static') {\n throw new Error('Only multi-serializer output is supported.');\n }\n\n const {\n entryFile,\n graphOptions,\n onProgress,\n resolverOptions,\n serializerOptions,\n transformOptions,\n } = splitBundleOptions(options);\n\n const { prepend, graph } = await metro._bundler.buildGraph(\n entryFile,\n transformOptions,\n resolverOptions,\n {\n onProgress,\n shallow: graphOptions.shallow,\n // @ts-expect-error\n lazy: graphOptions.lazy,\n }\n );\n\n const entryPoint = metro._getEntryPointAbsolutePath(entryFile);\n\n const bundleOptions = {\n asyncRequireModulePath: await metro._resolveRelativePath(\n metro._config.transformer.asyncRequireModulePath,\n {\n relativeTo: 'project',\n resolverOptions,\n transformOptions,\n }\n ),\n processModuleFilter: metro._config.serializer.processModuleFilter,\n createModuleId: metro._createModuleId,\n getRunModuleStatement: metro._config.serializer.getRunModuleStatement,\n dev: transformOptions.dev,\n includeAsyncPaths: graphOptions.lazy,\n projectRoot: metro._config.projectRoot,\n modulesOnly: serializerOptions.modulesOnly,\n runBeforeMainModule: metro._config.serializer.getModulesRunBeforeMainModule(\n path.relative(metro._config.projectRoot, entryPoint)\n ),\n runModule: serializerOptions.runModule,\n sourceMapUrl: serializerOptions.sourceMapUrl,\n sourceUrl: serializerOptions.sourceUrl,\n inlineSourceMap: serializerOptions.inlineSourceMap,\n serverRoot: metro._config.server.unstable_serverRoot ?? metro._config.projectRoot,\n shouldAddToIgnoreList: (module: Module<MixedOutput>) =>\n metro._shouldAddModuleToIgnoreList(module),\n // Custom options we pass to the serializer to emulate the URL query parameters.\n serializerOptions: options.serializerOptions,\n };\n\n assertMetroConfig(metro._config);\n\n const bundle = await metro._config.serializer.customSerializer!(\n entryPoint,\n // @ts-expect-error: Metro is typed incorrectly\n prepend,\n graph,\n bundleOptions\n );\n\n try {\n const parsed = typeof bundle === 'string' ? JSON.parse(bundle) : bundle;\n\n assert(\n 'artifacts' in parsed && Array.isArray(parsed.artifacts),\n 'Expected serializer to return an object with key artifacts to contain an array of serial assets.'\n );\n return parsed;\n } catch (error: any) {\n throw new Error(\n 'Serializer did not return expected format. The project copy of `expo/metro-config` may be out of date. Error: ' +\n error.message\n );\n }\n}\n"],"names":["createBundlesAsync","getAssets","nextBuildID","assertEngineMismatchAsync","projectRoot","exp","platform","isHermesManaged","isEnableHermesManaged","paths","getConfigFilePaths","configFilePath","dynamicConfigPath","staticConfigPath","maybeThrowFromInconsistentEngineAsync","projectConfig","bundleOptions","platforms","length","pkg","bundles","bundleProductionMetroClientAsync","resetCache","clear","maxWorkers","map","entryPoint","getEntryWithServerRoot","sourcemaps","minify","bytecode","dev","reduce","prev","index","assertMetroConfig","config","serializer","customSerializer","CommandError","expoConfig","metroOptions","Promise","all","reporter","loadMetroConfigAsync","isExporting","getMetroBundler","metroServer","getBundler","Metro","runMetro","watch","buildAsync","bundle","buildID","isHermes","Server","DEFAULT_BUNDLE_OPTIONS","sourceMapUrl","getMetroDirectBundleOptionsForExpoConfig","splitChunks","env","EXPO_NO_BUNDLE_SPLITTING","mainModuleName","mode","engine","undefined","serializerIncludeMaps","serializerOutput","bundleType","inlineSourceMap","createModuleIdFactory","onProgress","transformedFileCount","totalFileCount","update","type","bundleDetails","artifacts","forkMetroBuildAsync","error","console","log","end","metro","options","entryFile","resolverOptions","transformOptions","splitBundleOptions","dependencies","_bundler","getDependencies","shallow","lazy","_config","getMetroAssets","processModuleFilter","assetPlugins","transformer","publicPath","isMetroServerInstance","Error","serializerOptions","output","graphOptions","prepend","graph","buildGraph","_getEntryPointAbsolutePath","asyncRequireModulePath","_resolveRelativePath","relativeTo","createModuleId","_createModuleId","getRunModuleStatement","includeAsyncPaths","modulesOnly","runBeforeMainModule","getModulesRunBeforeMainModule","path","relative","runModule","sourceUrl","serverRoot","server","unstable_serverRoot","shouldAddToIgnoreList","module","_shouldAddModuleToIgnoreList","parsed","JSON","parse","assert","Array","isArray","message"],"mappings":"AAAA;;;;;;;;;;;IAiEsBA,kBAAkB,MAAlBA,kBAAkB;IAgKlBC,SAAS,MAATA,SAAS;;;yBAjOyC,cAAc;;;;;;;8DAG3D,qDAAqD;;;;;;;8DAC7D,QAAQ;;;;;;;8DAC+B,OAAO;;;;;;;8DAG9C,kBAAkB;;;;;;;8DACN,kCAAkC;;;;;;;8DAMhD,MAAM;;;;;;8BAEsD,gBAAgB;kCACxD,wCAAwC;oCACtC,+CAA+C;8BAI/E,yCAAyC;qBAC5B,cAAc;wBACL,iBAAiB;;;;;;AAqB9C,IAAIC,WAAW,GAAG,CAAC,AAAC;AAEpB,eAAeC,yBAAyB,CACtCC,WAAmB,EACnBC,GAAqD,EACrDC,QAAkB,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C,EACxD,kGAAkG,CACnG,CAAC;QACF,OAAOoD,MAAM,CAAC;IAChB,EAAE,OAAOlD,KAAK,EAAO;QACnB,MAAM,IAAIsB,KAAK,CACb,gHAAgH,GAC9GtB,KAAK,CAACwD,OAAO,CAChB,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,3 +1,4 @@
1
+ // import { resolveDestinationsAsync } from './appleDestinations';
1
2
  "use strict";
2
3
  Object.defineProperty(exports, "__esModule", {
3
4
  value: true
@@ -12,7 +13,6 @@ _export(exports, {
12
13
  resolveDeviceAsync: ()=>resolveDeviceAsync,
13
14
  isSimulatorDevice: ()=>isSimulatorDevice
14
15
  });
15
- const _appleDestinations = require("./appleDestinations");
16
16
  const _promptDevice = require("./promptDevice");
17
17
  const _log = /*#__PURE__*/ _interopRequireWildcard(require("../../../log"));
18
18
  const _appleDeviceManager = require("../../../start/platforms/ios/AppleDeviceManager");
@@ -63,11 +63,10 @@ function _interopRequireWildcard(obj, nodeInterop) {
63
63
  return newObj;
64
64
  }
65
65
  // type AnyDevice = SimControl.Device | AppleDevice.ConnectedDevice;
66
- /** Get a list of devices (called destinations) that are connected to the host machine. Filter by `osType` if defined. */ async function getDevicesAsync({ osType , ...buildProps }) {
66
+ /** Get a list of devices (called destinations) that are connected to the host machine. Filter by `osType` if defined. */ async function getDevicesAsync({ osType }) {
67
67
  const devices = await (0, _promptAppleDevice.sortDefaultDeviceToBeginningAsync)((0, _array.uniqBy)((await Promise.all([
68
68
  _appleDevice.getConnectedDevicesAsync(),
69
- await (0, _profile.profile)(_simctl.getDevicesAsync)(),
70
- (0, _appleDestinations.resolveDestinationsAsync)(buildProps),
69
+ await (0, _profile.profile)(_simctl.getDevicesAsync)(),
71
70
  ])).flat(), (item)=>item.udid), osType);
72
71
  // Sort devices to top of front of the list
73
72
  const physical = [];
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/run/ios/options/resolveDevice.ts"],"sourcesContent":["import { resolveDestinationsAsync } from './appleDestinations';\nimport { promptDeviceAsync } from './promptDevice';\nimport * as Log from '../../../log';\nimport {\n AppleDeviceManager,\n ensureSimulatorOpenAsync,\n} from '../../../start/platforms/ios/AppleDeviceManager';\nimport { sortDefaultDeviceToBeginningAsync } from '../../../start/platforms/ios/promptAppleDevice';\nimport { OSType } from '../../../start/platforms/ios/simctl';\nimport * as SimControl from '../../../start/platforms/ios/simctl';\nimport { uniqBy } from '../../../utils/array';\nimport { CommandError } from '../../../utils/errors';\nimport { profile } from '../../../utils/profile';\nimport { logDeviceArgument } from '../../hints';\nimport { BuildProps } from '../XcodeBuild.types';\nimport * as AppleDevice from '../appleDevice/AppleDevice';\n\ntype AnyDevice = {\n name: string;\n osType: OSType;\n osVersion: string;\n udid: string;\n deviceType?: string;\n};\n// type AnyDevice = SimControl.Device | AppleDevice.ConnectedDevice;\n\n/** Get a list of devices (called destinations) that are connected to the host machine. Filter by `osType` if defined. */\nasync function getDevicesAsync({\n osType,\n ...buildProps\n}: { osType?: OSType } & Pick<BuildProps, 'xcodeProject' | 'scheme' | 'configuration'>): Promise<\n AnyDevice[]\n> {\n const devices = await sortDefaultDeviceToBeginningAsync(\n uniqBy(\n (\n await Promise.all([\n AppleDevice.getConnectedDevicesAsync(),\n await profile(SimControl.getDevicesAsync)(),\n resolveDestinationsAsync(buildProps),\n ])\n ).flat(),\n (item) => item.udid\n ),\n osType\n );\n\n // Sort devices to top of front of the list\n\n const physical: AnyDevice[] = [];\n\n const simulators = devices.filter((device) => {\n if ('isAvailable' in device) {\n return true;\n } else {\n physical.push(device);\n return false;\n }\n });\n\n const isPhone = (a: any) => a.osType === 'iOS';\n const sorted = [\n ...physical.sort((a, b) => {\n const aPhone = isPhone(a);\n const bPhone = isPhone(b);\n if (aPhone && !bPhone) return -1;\n if (!aPhone && bPhone) return 1;\n\n return 0;\n }),\n ...simulators,\n ];\n\n // If osType is defined, then filter out ineligible simulators.\n // Only do this inside of the device selection so users who pass the entire device udid can attempt to select any simulator (even if it's invalid).\n return osType ? filterDevicesForOsType(sorted, osType) : sorted;\n}\n\n/** @returns a list of devices, filtered by the provided `osType`. */\nfunction filterDevicesForOsType<TDevice extends { osType: OSType }>(\n devices: TDevice[],\n osType: OSType\n): TDevice[] {\n return devices.filter((device) => {\n if (osType === 'iOS') {\n // Compatible devices for iOS builds\n return ['iOS', 'macOS', 'xrOS'].includes(device.osType);\n }\n return device.osType === osType;\n });\n}\n\n/** Given a `device` argument from the CLI, parse and prompt our way to a usable device for building. */\nexport async function resolveDeviceAsync(\n device: string | boolean | undefined,\n buildProps: { osType?: OSType } & Pick<BuildProps, 'xcodeProject' | 'scheme' | 'configuration'>\n): Promise<AnyDevice> {\n await AppleDeviceManager.assertSystemRequirementsAsync();\n\n if (!device) {\n /** Finds the first possible device and returns in a booted state. */\n const manager = await AppleDeviceManager.resolveAsync({\n device: {\n osType: buildProps.osType,\n },\n });\n Log.debug(\n `Resolved default device (name: ${manager.device.name}, udid: ${manager.device.udid}, osType: ${buildProps.osType})`\n );\n return manager.device;\n }\n\n const devices = await getDevicesAsync(buildProps);\n\n const resolved =\n device === true\n ? // `--device` (no props after)\n // @ts-expect-error\n await promptDeviceAsync(devices)\n : // `--device <name|udid>`\n findDeviceFromSearchValue(devices, device.toLowerCase());\n\n return ensureBootedAsync(resolved);\n}\n\n/** @returns `true` if the given device is a simulator. */\nexport function isSimulatorDevice(device: AnyDevice): boolean {\n return (\n !('deviceType' in device) ||\n !!device.deviceType?.startsWith?.('com.apple.CoreSimulator.SimDeviceType.')\n );\n}\n\n/** @returns device matching the `searchValue` against name or UDID. */\nfunction findDeviceFromSearchValue(devices: AnyDevice[], searchValue: string): AnyDevice {\n const device = devices.find(\n (device) =>\n device.udid.toLowerCase() === searchValue || device.name.toLowerCase() === searchValue\n );\n if (!device) {\n throw new CommandError('BAD_ARGS', `No device UDID or name matching \"${searchValue}\"`);\n }\n return device;\n}\n\n/** Ensures the device is booted if it's a simulator. */\nasync function ensureBootedAsync(device: AnyDevice): Promise<AnyDevice> {\n // --device with no props after\n logDeviceArgument(device.udid);\n if (isSimulatorDevice(device)) {\n return ensureSimulatorOpenAsync({ udid: device.udid });\n }\n return device;\n}\n"],"names":["resolveDeviceAsync","isSimulatorDevice","getDevicesAsync","osType","buildProps","devices","sortDefaultDeviceToBeginningAsync","uniqBy","Promise","all","AppleDevice","getConnectedDevicesAsync","profile","SimControl","resolveDestinationsAsync","flat","item","udid","physical","simulators","filter","device","push","isPhone","a","sorted","sort","b","aPhone","bPhone","filterDevicesForOsType","includes","AppleDeviceManager","assertSystemRequirementsAsync","manager","resolveAsync","Log","debug","name","resolved","promptDeviceAsync","findDeviceFromSearchValue","toLowerCase","ensureBootedAsync","deviceType","startsWith","searchValue","find","CommandError","logDeviceArgument","ensureSimulatorOpenAsync"],"mappings":"AAAA;;;;;;;;;;;IA6FsBA,kBAAkB,MAAlBA,kBAAkB;IAiCxBC,iBAAiB,MAAjBA,iBAAiB;;mCA9HQ,qBAAqB;8BAC5B,gBAAgB;2DAC7B,cAAc;oCAI5B,iDAAiD;mCACN,gDAAgD;8DAEtE,qCAAqC;uBAC1C,sBAAsB;wBAChB,uBAAuB;yBAC5B,wBAAwB;uBACd,aAAa;mEAElB,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASzD,oEAAoE;AAEpE,uHAAuH,GACvH,eAAeC,eAAe,CAAC,EAC7BC,MAAM,CAAA,EACN,GAAGC,UAAU,EACuE,EAEpF;IACA,MAAMC,OAAO,GAAG,MAAMC,IAAAA,kBAAiC,kCAAA,EACrDC,IAAAA,MAAM,OAAA,EACJ,CACE,MAAMC,OAAO,CAACC,GAAG,CAAC;QAChBC,YAAW,CAACC,wBAAwB,EAAE;QACtC,MAAMC,IAAAA,QAAO,QAAA,EAACC,OAAU,CAACX,eAAe,CAAC,EAAE;QAC3CY,IAAAA,kBAAwB,yBAAA,EAACV,UAAU,CAAC;KACrC,CAAC,CACH,CAACW,IAAI,EAAE,EACR,CAACC,IAAI,GAAKA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U,QAA4C,GAAzExB,KAAAA,CAAyE,GAAzEA,GAAiB,CAAEwB,UAAU,CAAG,wCAAwC,CAAC,CAAA,CAC3E;AACJ,CAAC;AAED,qEAAqE,GACrE,SAASJ,yBAAyB,CAACpC,OAAoB,EAAEyC,WAAmB,EAAa;IACvF,MAAMzB,MAAM,GAAGhB,OAAO,CAAC0C,IAAI,CACzB,CAAC1B,MAAM,GACLA,MAAM,CAACJ,IAAI,CAACyB,WAAW,EAAE,KAAKI,WAAW,IAAIzB,MAAM,CAACiB,IAAI,CAACI,WAAW,EAAE,KAAKI,WAAW,CACzF,AAAC;IACF,IAAI,CAACzB,MAAM,EAAE;QACX,MAAM,IAAI2B,OAAY,aAAA,CAAC,UAAU,EAAE,CAAC,iCAAiC,EAAEF,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACzF,CAAC;IACD,OAAOzB,MAAM,CAAC;AAChB,CAAC;AAED,sDAAsD,GACtD,eAAesB,iBAAiB,CAACtB,MAAiB,EAAsB;IACtE,+BAA+B;IAC/B4B,IAAAA,MAAiB,kBAAA,EAAC5B,MAAM,CAACJ,IAAI,CAAC,CAAC;IAC/B,IAAIhB,iBAAiB,CAACoB,MAAM,CAAC,EAAE;QAC7B,OAAO6B,IAAAA,mBAAwB,yBAAA,EAAC;YAAEjC,IAAI,EAAEI,MAAM,CAACJ,IAAI;SAAE,CAAC,CAAC;IACzD,CAAC;IACD,OAAOI,MAAM,CAAC;AAChB,CAAC"}
1
+ {"version":3,"sources":["../../../../../src/run/ios/options/resolveDevice.ts"],"sourcesContent":["// import { resolveDestinationsAsync } from './appleDestinations';\nimport { promptDeviceAsync } from './promptDevice';\nimport * as Log from '../../../log';\nimport {\n AppleDeviceManager,\n ensureSimulatorOpenAsync,\n} from '../../../start/platforms/ios/AppleDeviceManager';\nimport { sortDefaultDeviceToBeginningAsync } from '../../../start/platforms/ios/promptAppleDevice';\nimport { OSType } from '../../../start/platforms/ios/simctl';\nimport * as SimControl from '../../../start/platforms/ios/simctl';\nimport { uniqBy } from '../../../utils/array';\nimport { CommandError } from '../../../utils/errors';\nimport { profile } from '../../../utils/profile';\nimport { logDeviceArgument } from '../../hints';\nimport { BuildProps } from '../XcodeBuild.types';\nimport * as AppleDevice from '../appleDevice/AppleDevice';\n\ntype AnyDevice = {\n name: string;\n osType: OSType;\n osVersion: string;\n udid: string;\n deviceType?: string;\n};\n// type AnyDevice = SimControl.Device | AppleDevice.ConnectedDevice;\n\n/** Get a list of devices (called destinations) that are connected to the host machine. Filter by `osType` if defined. */\nasync function getDevicesAsync({\n osType,\n // ...buildProps\n}: { osType?: OSType } & Pick<BuildProps, 'xcodeProject' | 'scheme' | 'configuration'>): Promise<\n AnyDevice[]\n> {\n const devices = await sortDefaultDeviceToBeginningAsync(\n uniqBy(\n (\n await Promise.all([\n AppleDevice.getConnectedDevicesAsync(),\n await profile(SimControl.getDevicesAsync)(),\n // resolveDestinationsAsync(buildProps),\n ])\n ).flat(),\n (item) => item.udid\n ),\n osType\n );\n\n // Sort devices to top of front of the list\n\n const physical: AnyDevice[] = [];\n\n const simulators = devices.filter((device) => {\n if ('isAvailable' in device) {\n return true;\n } else {\n physical.push(device);\n return false;\n }\n });\n\n const isPhone = (a: any) => a.osType === 'iOS';\n const sorted = [\n ...physical.sort((a, b) => {\n const aPhone = isPhone(a);\n const bPhone = isPhone(b);\n if (aPhone && !bPhone) return -1;\n if (!aPhone && bPhone) return 1;\n\n return 0;\n }),\n ...simulators,\n ];\n\n // If osType is defined, then filter out ineligible simulators.\n // Only do this inside of the device selection so users who pass the entire device udid can attempt to select any simulator (even if it's invalid).\n return osType ? filterDevicesForOsType(sorted, osType) : sorted;\n}\n\n/** @returns a list of devices, filtered by the provided `osType`. */\nfunction filterDevicesForOsType<TDevice extends { osType: OSType }>(\n devices: TDevice[],\n osType: OSType\n): TDevice[] {\n return devices.filter((device) => {\n if (osType === 'iOS') {\n // Compatible devices for iOS builds\n return ['iOS', 'macOS', 'xrOS'].includes(device.osType);\n }\n return device.osType === osType;\n });\n}\n\n/** Given a `device` argument from the CLI, parse and prompt our way to a usable device for building. */\nexport async function resolveDeviceAsync(\n device: string | boolean | undefined,\n buildProps: { osType?: OSType } & Pick<BuildProps, 'xcodeProject' | 'scheme' | 'configuration'>\n): Promise<AnyDevice> {\n await AppleDeviceManager.assertSystemRequirementsAsync();\n\n if (!device) {\n /** Finds the first possible device and returns in a booted state. */\n const manager = await AppleDeviceManager.resolveAsync({\n device: {\n osType: buildProps.osType,\n },\n });\n Log.debug(\n `Resolved default device (name: ${manager.device.name}, udid: ${manager.device.udid}, osType: ${buildProps.osType})`\n );\n return manager.device;\n }\n\n const devices = await getDevicesAsync(buildProps);\n\n const resolved =\n device === true\n ? // `--device` (no props after)\n // @ts-expect-error\n await promptDeviceAsync(devices)\n : // `--device <name|udid>`\n findDeviceFromSearchValue(devices, device.toLowerCase());\n\n return ensureBootedAsync(resolved);\n}\n\n/** @returns `true` if the given device is a simulator. */\nexport function isSimulatorDevice(device: AnyDevice): boolean {\n return (\n !('deviceType' in device) ||\n !!device.deviceType?.startsWith?.('com.apple.CoreSimulator.SimDeviceType.')\n );\n}\n\n/** @returns device matching the `searchValue` against name or UDID. */\nfunction findDeviceFromSearchValue(devices: AnyDevice[], searchValue: string): AnyDevice {\n const device = devices.find(\n (device) =>\n device.udid.toLowerCase() === searchValue || device.name.toLowerCase() === searchValue\n );\n if (!device) {\n throw new CommandError('BAD_ARGS', `No device UDID or name matching \"${searchValue}\"`);\n }\n return device;\n}\n\n/** Ensures the device is booted if it's a simulator. */\nasync function ensureBootedAsync(device: AnyDevice): Promise<AnyDevice> {\n // --device with no props after\n logDeviceArgument(device.udid);\n if (isSimulatorDevice(device)) {\n return ensureSimulatorOpenAsync({ udid: device.udid });\n }\n return device;\n}\n"],"names":["resolveDeviceAsync","isSimulatorDevice","getDevicesAsync","osType","devices","sortDefaultDeviceToBeginningAsync","uniqBy","Promise","all","AppleDevice","getConnectedDevicesAsync","profile","SimControl","flat","item","udid","physical","simulators","filter","device","push","isPhone","a","sorted","sort","b","aPhone","bPhone","filterDevicesForOsType","includes","buildProps","AppleDeviceManager","assertSystemRequirementsAsync","manager","resolveAsync","Log","debug","name","resolved","promptDeviceAsync","findDeviceFromSearchValue","toLowerCase","ensureBootedAsync","deviceType","startsWith","searchValue","find","CommandError","logDeviceArgument","ensureSimulatorOpenAsync"],"mappings":"AAAA,kEAAkE;AAClE;;;;;;;;;;;IA4FsBA,kBAAkB,MAAlBA,kBAAkB;IAiCxBC,iBAAiB,MAAjBA,iBAAiB;;8BA7HC,gBAAgB;2DAC7B,cAAc;oCAI5B,iDAAiD;mCACN,gDAAgD;8DAEtE,qCAAqC;uBAC1C,sBAAsB;wBAChB,uBAAuB;yBAC5B,wBAAwB;uBACd,aAAa;mEAElB,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASzD,oEAAoE;AAEpE,uHAAuH,GACvH,eAAeC,eAAe,CAAC,EAC7BC,MAAM,CAAA,EAE8E,EAEpF;IACA,MAAMC,OAAO,GAAG,MAAMC,IAAAA,kBAAiC,kCAAA,EACrDC,IAAAA,MAAM,OAAA,EACJ,CACE,MAAMC,OAAO,CAACC,GAAG,CAAC;QAChBC,YAAW,CAACC,wBAAwB,EAAE;QACtC,MAAMC,IAAAA,QAAO,QAAA,EAACC,OAAU,CAACV,eAAe,CAAC,EAAE;KAE5C,CAAC,CACH,CAACW,IAAI,EAAE,EACR,CAACC,IAAI,GAAKA,IAAI,CAACC,IAAI,CACpB,EACDZ,MAAM,CACP,AAAC;IAEF,2CAA2C;IAE3C,MAAMa,QAAQ,GAAgB,EAAE,AAAC;IAEjC,MAAMC,UAAU,GAAGb,OAAO,CAACc,MAAM,CAAC,CAACC,MAAM,GAAK;QAC5C,IAAI,aAAa,IAAIA,MAAM,EAAE;YAC3B,OAAO,IAAI,CAAC;QACd,OAAO;YACLH,QAAQ,CAACI,IAAI,CAACD,MAAM,CAAC,CAAC;YACtB,OAAO,KA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AI1B,MAAM,CAACkB,IAAI,CAACI,WAAW,EAAE,KAAKI,WAAW,CACzF,AAAC;IACF,IAAI,CAAC1B,MAAM,EAAE;QACX,MAAM,IAAI4B,OAAY,aAAA,CAAC,UAAU,EAAE,CAAC,iCAAiC,EAAEF,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACzF,CAAC;IACD,OAAO1B,MAAM,CAAC;AAChB,CAAC;AAED,sDAAsD,GACtD,eAAeuB,iBAAiB,CAACvB,MAAiB,EAAsB;IACtE,+BAA+B;IAC/B6B,IAAAA,MAAiB,kBAAA,EAAC7B,MAAM,CAACJ,IAAI,CAAC,CAAC;IAC/B,IAAId,iBAAiB,CAACkB,MAAM,CAAC,EAAE;QAC7B,OAAO8B,IAAAA,mBAAwB,yBAAA,EAAC;YAAElC,IAAI,EAAEI,MAAM,CAACJ,IAAI;SAAE,CAAC,CAAC;IACzD,CAAC;IACD,OAAOI,MAAM,CAAC;AAChB,CAAC"}
@@ -73,6 +73,7 @@ async function startBundlerAsync(projectRoot, { port , headless , scheme }) {
73
73
  port,
74
74
  headless,
75
75
  devClient: true,
76
+ minify: false,
76
77
  location: {
77
78
  scheme
78
79
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/run/startBundler.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport chalk from 'chalk';\n\nimport * as Log from '../log';\nimport { startInterfaceAsync } from '../start/interface/startInterface';\nimport { DevServerManager } from '../start/server/DevServerManager';\nimport { isInteractive } from '../utils/interactive';\n\nexport async function startBundlerAsync(\n projectRoot: string,\n {\n port,\n headless,\n scheme,\n }: {\n port: number;\n headless?: boolean;\n scheme?: string;\n }\n): Promise<DevServerManager> {\n const options = {\n port,\n headless,\n devClient: true,\n\n location: {\n scheme,\n },\n };\n\n const devServerManager = new DevServerManager(projectRoot, options);\n\n await devServerManager.startAsync([\n {\n // TODO: Allow swapping this value for another bundler.\n type: 'metro',\n options,\n },\n ]);\n\n // Present the Terminal UI.\n if (!headless && isInteractive()) {\n // Only read the config if we are going to use the results.\n const { exp } = getConfig(projectRoot, {\n // We don't need very many fields here, just use the lightest possible read.\n skipSDKVersionRequirement: true,\n skipPlugins: true,\n });\n await startInterfaceAsync(devServerManager, {\n platforms: exp.platforms ?? [],\n });\n } else {\n // Display the server location in CI...\n const url = devServerManager.getDefaultDevServer()?.getDevServerUrl();\n if (url) {\n Log.log(chalk`Waiting on {underline ${url}}`);\n }\n }\n\n if (!options.headless) {\n await devServerManager.watchEnvironmentVariables();\n await devServerManager.bootstrapTypeScriptAsync();\n }\n\n return devServerManager;\n}\n"],"names":["startBundlerAsync","projectRoot","port","headless","scheme","options","devClient","location","devServerManager","DevServerManager","startAsync","type","isInteractive","exp","getConfig","skipSDKVersionRequirement","skipPlugins","startInterfaceAsync","platforms","url","getDefaultDevServer","getDevServerUrl","Log","log","chalk","watchEnvironmentVariables","bootstrapTypeScriptAsync"],"mappings":"AAAA;;;;+BAQsBA,mBAAiB;;aAAjBA,iBAAiB;;;yBARb,cAAc;;;;;;;8DACtB,OAAO;;;;;;2DAEJ,QAAQ;gCACO,mCAAmC;kCACtC,kCAAkC;6BACrC,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7C,eAAeA,iBAAiB,CACrCC,WAAmB,EACnB,EACEC,IAAI,CAAA,EACJC,QAAQ,CAAA,EACRC,MAAM,CAAA,EAKP,EAC0B;IAC3B,MAAMC,OAAO,GAAG;QACdH,IAAI;QACJC,QAAQ;QACRG,SAAS,EAAE,IAAI;QAEfC,QAAQ,EAAE;YACRH,MAAM;SACP;KACF,AAAC;IAEF,MAAMI,gBAAgB,GAAG,IAAIC,iBAAgB,iBAAA,CAACR,WAAW,EAAEI,OAAO,CAAC,AAAC;IAEpE,MAAMG,gBAAgB,CAACE,UAAU,CAAC;QAChC;YACE,uDAAuD;YACvDC,IAAI,EAAE,OAAO;YACbN,OAAO;SACR;KACF,CAAC,CAAC;IAEH,2BAA2B;IAC3B,IAAI,CAACF,QAAQ,IAAIS,IAAAA,YAAa,cAAA,GAAE,EAAE;QAChC,2DAA2D;QAC3D,MAAM,EAAEC,GAAG,CAAA,EAAE,GAAGC,IAAAA,OAAS,EAAA,UAAA,EAACb,WAAW,EAAE;YACrC,4EAA4E;YAC5Ec,yBAAyB,EAAE,IAAI;YAC/BC,WAAW,EAAE,IAAI;SAClB,CAAC,AAAC;YAEUH,UAAa;QAD1B,MAAMI,IAAAA,eAAmB,oBAAA,EAACT,gBAAgB,EAAE;YAC1CU,SAAS,EAAEL,CAAAA,UAAa,GAAbA,GAAG,CAACK,SAAS,YAAbL,UAAa,GAAI,EAAE;SAC/B,CAAC,CAAC;IACL,OAAO;YAEOL,GAAsC;QADlD,uCAAuC;QACvC,MAAMW,GAAG,GAAGX,CAAAA,GAAsC,GAAtCA,gBAAgB,CAACY,mBAAmB,EAAE,SAAiB,GAAvDZ,KAAAA,CAAuD,GAAvDA,GAAsC,CAAEa,eAAe,EAAE,AAAC;QACtE,IAAIF,GAAG,EAAE;YACPG,IAAG,CAACC,GAAG,CAACC,IAAAA,MAAK,EAAA,QAAA,CAAA,CAAC,sBAAsB,EAAEL,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED,IAAI,CAACd,OAAO,CAACF,QAAQ,EAAE;QACrB,MAAMK,gBAAgB,CAACiB,yBAAyB,EAAE,CAAC;QACnD,MAAMjB,gBAAgB,CAACkB,wBAAwB,EAAE,CAAC;IACpD,CAAC;IAED,OAAOlB,gBAAgB,CAAC;AAC1B,CAAC"}
1
+ {"version":3,"sources":["../../../src/run/startBundler.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport chalk from 'chalk';\n\nimport * as Log from '../log';\nimport { startInterfaceAsync } from '../start/interface/startInterface';\nimport { BundlerStartOptions } from '../start/server/BundlerDevServer';\nimport { DevServerManager } from '../start/server/DevServerManager';\nimport { isInteractive } from '../utils/interactive';\n\nexport async function startBundlerAsync(\n projectRoot: string,\n {\n port,\n headless,\n scheme,\n }: {\n port: number;\n headless?: boolean;\n scheme?: string;\n }\n): Promise<DevServerManager> {\n const options: BundlerStartOptions = {\n port,\n headless,\n devClient: true,\n minify: false,\n\n location: {\n scheme,\n },\n };\n\n const devServerManager = new DevServerManager(projectRoot, options);\n\n await devServerManager.startAsync([\n {\n // TODO: Allow swapping this value for another bundler.\n type: 'metro',\n options,\n },\n ]);\n\n // Present the Terminal UI.\n if (!headless && isInteractive()) {\n // Only read the config if we are going to use the results.\n const { exp } = getConfig(projectRoot, {\n // We don't need very many fields here, just use the lightest possible read.\n skipSDKVersionRequirement: true,\n skipPlugins: true,\n });\n await startInterfaceAsync(devServerManager, {\n platforms: exp.platforms ?? [],\n });\n } else {\n // Display the server location in CI...\n const url = devServerManager.getDefaultDevServer()?.getDevServerUrl();\n if (url) {\n Log.log(chalk`Waiting on {underline ${url}}`);\n }\n }\n\n if (!options.headless) {\n await devServerManager.watchEnvironmentVariables();\n await devServerManager.bootstrapTypeScriptAsync();\n }\n\n return devServerManager;\n}\n"],"names":["startBundlerAsync","projectRoot","port","headless","scheme","options","devClient","minify","location","devServerManager","DevServerManager","startAsync","type","isInteractive","exp","getConfig","skipSDKVersionRequirement","skipPlugins","startInterfaceAsync","platforms","url","getDefaultDevServer","getDevServerUrl","Log","log","chalk","watchEnvironmentVariables","bootstrapTypeScriptAsync"],"mappings":"AAAA;;;;+BASsBA,mBAAiB;;aAAjBA,iBAAiB;;;yBATb,cAAc;;;;;;;8DACtB,OAAO;;;;;;2DAEJ,QAAQ;gCACO,mCAAmC;kCAEtC,kCAAkC;6BACrC,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7C,eAAeA,iBAAiB,CACrCC,WAAmB,EACnB,EACEC,IAAI,CAAA,EACJC,QAAQ,CAAA,EACRC,MAAM,CAAA,EAKP,EAC0B;IAC3B,MAAMC,OAAO,GAAwB;QACnCH,IAAI;QACJC,QA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B,wBAAwB,EAAE,CAAC;IACpD,CAAC;IAED,OAAOlB,gBAAgB,CAAC;AAC1B,CAAC"}
@@ -70,6 +70,7 @@ const _serializeHtml = require("./serializeHtml");
70
70
  const _waitForMetroToObserveTypeScriptFile = require("./waitForMetroToObserveTypeScriptFile");
71
71
  const _log = require("../../../log");
72
72
  const _getDevClientProperties = /*#__PURE__*/ _interopRequireDefault(require("../../../utils/analytics/getDevClientProperties"));
73
+ const _env1 = require("../../../utils/env");
73
74
  const _errors = require("../../../utils/errors");
74
75
  const _port = require("../../../utils/port");
75
76
  const _telemetry = require("../../../utils/telemetry");
@@ -205,8 +206,11 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
205
206
  };
206
207
  }
207
208
  async getExpoRouterRoutesManifestAsync({ appDir }) {
209
+ var ref, ref1;
208
210
  // getBuiltTimeServerManifest
211
+ const { exp } = (0, _config().getConfig)(this.projectRoot);
209
212
  const manifest = await (0, _fetchRouterManifest.fetchManifest)(this.projectRoot, {
213
+ ...(ref = exp.extra) == null ? void 0 : (ref1 = ref.router) == null ? void 0 : ref1.platformRoutes,
210
214
  asJson: true,
211
215
  appDir
212
216
  });
@@ -216,19 +220,22 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
216
220
  return manifest;
217
221
  }
218
222
  async getStaticRenderFunctionAsync() {
223
+ var ref;
219
224
  const { mode , minify , isExporting } = this.instanceMetroOptions;
220
- (0, _assert().default)(mode != null && minify != null && isExporting != null, "The server must be started before calling ssrLoadModule.");
225
+ (0, _assert().default)(mode != null && isExporting != null, "The server must be started before calling ssrLoadModule.");
221
226
  const url = this.getDevServerUrl();
222
227
  const { getStaticContent , getManifest , getBuildTimeServerManifestAsync } = await this.ssrLoadModule("expo-router/node/render.js", {
223
228
  minify,
224
229
  mode,
225
230
  isExporting
226
231
  });
232
+ const { exp } = (0, _config().getConfig)(this.projectRoot);
227
233
  return {
228
234
  serverManifest: await getBuildTimeServerManifestAsync(),
229
235
  // Get routes from Expo Router.
230
236
  manifest: await getManifest({
231
- preserveApiRoutes: false
237
+ preserveApiRoutes: false,
238
+ ...(ref = exp.extra) == null ? void 0 : ref.router
232
239
  }),
233
240
  // Get route generating function
234
241
  async renderAsync (path) {
@@ -239,9 +246,10 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
239
246
  async getStaticResourcesAsync({ includeSourceMaps , mainModuleName } = {}) {
240
247
  var ref;
241
248
  const { mode , minify , isExporting , baseUrl , routerRoot , asyncRoutes } = this.instanceMetroOptions;
242
- (0, _assert().default)(mode != null && minify != null && isExporting != null && baseUrl != null && routerRoot != null && asyncRoutes != null, "The server must be started before calling getStaticPageAsync.");
249
+ (0, _assert().default)(mode != null && isExporting != null && baseUrl != null && routerRoot != null && asyncRoutes != null, "The server must be started before calling getStaticPageAsync.");
243
250
  const platform = "web";
244
251
  const devBundleUrlPathname = (0, _metroOptions.createBundleUrlPath)({
252
+ splitChunks: isExporting && !_env1.env.EXPO_NO_BUNDLE_SPLITTING,
245
253
  platform,
246
254
  mode,
247
255
  minify,
@@ -301,10 +309,11 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
301
309
  throw new Error("Invalid resources returned from the Metro serializer. Expected array, found: " + data);
302
310
  }
303
311
  async getStaticPageAsync(pathname) {
304
- const { mode , minify , isExporting , baseUrl , routerRoot , asyncRoutes } = this.instanceMetroOptions;
305
- (0, _assert().default)(mode != null && minify != null && isExporting != null && baseUrl != null && routerRoot != null && asyncRoutes != null, "The server must be started before calling getStaticPageAsync.");
312
+ const { mode , isExporting , baseUrl , routerRoot , asyncRoutes } = this.instanceMetroOptions;
313
+ (0, _assert().default)(mode != null && isExporting != null && baseUrl != null && routerRoot != null && asyncRoutes != null, "The server must be started before calling getStaticPageAsync.");
306
314
  const platform = "web";
307
315
  const devBundleUrlPathname = (0, _metroOptions.createBundleUrlPath)({
316
+ splitChunks: isExporting && !_env1.env.EXPO_NO_BUNDLE_SPLITTING,
308
317
  platform,
309
318
  mode,
310
319
  environment: "client",
@@ -481,10 +490,12 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
481
490
  // This should come after the static middleware so it doesn't serve the favicon from `public/favicon.ico`.
482
491
  middleware.use(new _faviconMiddleware.FaviconMiddleware(this.projectRoot).getHandler());
483
492
  if (useServerRendering) {
493
+ var ref2;
484
494
  middleware.use((0, _createServerRouteMiddleware.createRouteHandlerMiddleware)(this.projectRoot, {
485
495
  appDir,
486
496
  routerRoot,
487
497
  config,
498
+ ...(ref2 = config.exp.extra) == null ? void 0 : ref2.router,
488
499
  bundleApiRoute: (functionFilePath)=>this.ssrImportApiRoute(functionFilePath),
489
500
  getStaticPageAsync: (pathname)=>{
490
501
  return this.getStaticPageAsync(pathname);