@expo/cli 55.0.18 → 55.0.19

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/metro-require/require.js +4 -4
  3. package/build/src/events/index.js +1 -1
  4. package/build/src/export/createMetadataJson.js +7 -2
  5. package/build/src/export/createMetadataJson.js.map +1 -1
  6. package/build/src/export/embed/exportEmbedAsync.js +3 -2
  7. package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
  8. package/build/src/export/exportApp.js +6 -4
  9. package/build/src/export/exportApp.js.map +1 -1
  10. package/build/src/run/android/runAndroidAsync.js.map +1 -1
  11. package/build/src/run/ios/launchApp.js +1 -1
  12. package/build/src/run/ios/launchApp.js.map +1 -1
  13. package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js +3 -2
  14. package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js.map +1 -1
  15. package/build/src/start/platforms/android/AndroidPlatformManager.js.map +1 -1
  16. package/build/src/start/platforms/ios/ApplePlatformManager.js.map +1 -1
  17. package/build/src/start/server/BundlerDevServer.js +18 -4
  18. package/build/src/start/server/BundlerDevServer.js.map +1 -1
  19. package/build/src/start/server/metro/dev-server/createMetroMiddleware.js +72 -15
  20. package/build/src/start/server/metro/dev-server/createMetroMiddleware.js.map +1 -1
  21. package/build/src/start/server/metro/instantiateMetro.js +1 -0
  22. package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
  23. package/build/src/start/server/metro/withMetroMultiPlatform.js +36 -8
  24. package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
  25. package/build/src/start/server/middleware/DomComponentsMiddleware.js +0 -3
  26. package/build/src/start/server/middleware/DomComponentsMiddleware.js.map +1 -1
  27. package/build/src/utils/resolveWatchFolders.js +67 -0
  28. package/build/src/utils/resolveWatchFolders.js.map +1 -0
  29. package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
  30. package/build/src/utils/telemetry/utils/context.js +1 -1
  31. package/package.json +6 -6
package/build/bin/cli CHANGED
@@ -139,7 +139,7 @@ const args = (0, _arg().default)({
139
139
  });
140
140
  if (args['--version']) {
141
141
  // Version is added in the build script.
142
- console.log("55.0.18");
142
+ console.log("55.0.19");
143
143
  process.exit(0);
144
144
  }
145
145
  if (args['--non-interactive']) {
@@ -84,22 +84,22 @@ function shouldPrintRequireCycle(modules) {
84
84
  const isIgnored = (module)=>module != null && regExps.some((regExp)=>regExp.test(module));
85
85
  return modules.every((module)=>!isIgnored(module));
86
86
  }
87
- function metroImportDefault(moduleId) {
87
+ function metroImportDefault(moduleId, moduleIdHint) {
88
88
  var _modules_get;
89
89
  if (modules.has(moduleId) && ((_modules_get = modules.get(moduleId)) == null ? void 0 : _modules_get.importedDefault) !== EMPTY) {
90
90
  return modules.get(moduleId).importedDefault;
91
91
  }
92
- const exports = metroRequire(moduleId);
92
+ const exports = metroRequire(moduleId, moduleIdHint);
93
93
  const importedDefault = exports && exports.__esModule ? exports.default : exports;
94
94
  return modules.get(moduleId).importedDefault = importedDefault;
95
95
  }
96
96
  metroRequire.importDefault = metroImportDefault;
97
- function metroImportAll(moduleId) {
97
+ function metroImportAll(moduleId, moduleIdHint) {
98
98
  var _modules_get;
99
99
  if (modules.has(moduleId) && ((_modules_get = modules.get(moduleId)) == null ? void 0 : _modules_get.importedAll) !== EMPTY) {
100
100
  return modules.get(moduleId).importedAll;
101
101
  }
102
- const exports = metroRequire(moduleId);
102
+ const exports = metroRequire(moduleId, moduleIdHint);
103
103
  let importedAll;
104
104
  if (exports && exports.__esModule) {
105
105
  importedAll = exports;
@@ -70,7 +70,7 @@ function getInitMetadata() {
70
70
  return {
71
71
  format: 'v0-jsonl',
72
72
  // Version is added in the build script.
73
- version: "55.0.18" ?? 'UNVERSIONED'
73
+ version: "55.0.19" ?? 'UNVERSIONED'
74
74
  };
75
75
  }
76
76
  function installEventLogger(env = process.env.LOG_EVENTS) {
@@ -27,7 +27,8 @@ function createMetadataJson({ bundles, fileNames, embeddedHashSet, domComponentA
27
27
  bundler: 'metro',
28
28
  fileMetadata: Object.entries(bundles).reduce((metadata, [platform, bundle])=>{
29
29
  if (platform === 'web') return metadata;
30
- // Collect all of the assets and convert them to the serial format.
30
+ // Collect all of the assets and convert them to the serial format, deduplicating by path.
31
+ const seen = new Set();
31
32
  const assets = bundle.assets.filter((asset)=>!embeddedHashSet || !embeddedHashSet.has(asset.hash)).map((asset)=>{
32
33
  var // Each asset has multiple hashes which we convert and then flatten.
33
34
  _asset_fileHashes;
@@ -35,7 +36,11 @@ function createMetadataJson({ bundles, fileNames, embeddedHashSet, domComponentA
35
36
  path: _path().default.join('assets', hash),
36
37
  ext: asset.type
37
38
  }));
38
- }).filter(Boolean).flat();
39
+ }).filter(Boolean).flat().filter((a)=>{
40
+ if (seen.has(a.path)) return false;
41
+ seen.add(a.path);
42
+ return true;
43
+ });
39
44
  if ((domComponentAssetsMetadata == null ? void 0 : domComponentAssetsMetadata[platform]) != null) {
40
45
  assets.push(...domComponentAssetsMetadata == null ? void 0 : domComponentAssetsMetadata[platform]);
41
46
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/export/createMetadataJson.ts"],"sourcesContent":["import path from 'path';\n\nimport type { BundleOutput } from './saveAssets';\n\nexport type BundlePlatform = 'android' | 'ios';\n\ntype PlatformMetadataAsset = { path: string; ext: string };\n\nexport type PlatformMetadata = { bundle: string; assets: PlatformMetadataAsset[] };\n\ntype FileMetadata = {\n [key in BundlePlatform]: PlatformMetadata;\n};\n\nexport function createMetadataJson({\n bundles,\n fileNames,\n embeddedHashSet,\n domComponentAssetsMetadata,\n}: {\n bundles: Partial<Record<BundlePlatform, Pick<BundleOutput, 'assets'>>>;\n fileNames: Record<string, string[]>;\n embeddedHashSet?: Set<string>;\n domComponentAssetsMetadata?: Record<string, PlatformMetadataAsset[]>;\n}): {\n version: 0;\n bundler: 'metro';\n fileMetadata: FileMetadata;\n} {\n // Build metadata.json\n return {\n version: 0,\n bundler: 'metro',\n fileMetadata: Object.entries(bundles).reduce<Record<string, Partial<PlatformMetadata>>>(\n (metadata, [platform, bundle]) => {\n if (platform === 'web') return metadata;\n\n // Collect all of the assets and convert them to the serial format.\n const assets = bundle.assets\n .filter((asset) => !embeddedHashSet || !embeddedHashSet.has(asset.hash))\n .map((asset) =>\n // Each asset has multiple hashes which we convert and then flatten.\n asset.fileHashes?.map((hash) => ({\n path: path.join('assets', hash),\n ext: asset.type,\n }))\n )\n .filter(Boolean)\n .flat();\n\n if (domComponentAssetsMetadata?.[platform] != null) {\n assets.push(...domComponentAssetsMetadata?.[platform]);\n }\n\n return {\n ...metadata,\n [platform]: {\n // Get the filename for each platform's bundle.\n // TODO: Add multi-bundle support to EAS Update!!\n bundle: fileNames[platform][0],\n assets,\n },\n };\n },\n {}\n ) as FileMetadata,\n };\n}\n"],"names":["createMetadataJson","bundles","fileNames","embeddedHashSet","domComponentAssetsMetadata","version","bundler","fileMetadata","Object","entries","reduce","metadata","platform","bundle","assets","filter","asset","has","hash","map","fileHashes","path","join","ext","type","Boolean","flat","push"],"mappings":";;;;+BAcgBA;;;eAAAA;;;;gEAdC;;;;;;;;;;;AAcV,SAASA,mBAAmB,EACjCC,OAAO,EACPC,SAAS,EACTC,eAAe,EACfC,0BAA0B,EAM3B;IAKC,sBAAsB;IACtB,OAAO;QACLC,SAAS;QACTC,SAAS;QACTC,cAAcC,OAAOC,OAAO,CAACR,SAASS,MAAM,CAC1C,CAACC,UAAU,CAACC,UAAUC,OAAO;YAC3B,IAAID,aAAa,OAAO,OAAOD;YAE/B,mEAAmE;YACnE,MAAMG,SAASD,OAAOC,MAAM,CACzBC,MAAM,CAAC,CAACC,QAAU,CAACb,mBAAmB,CAACA,gBAAgBc,GAAG,CAACD,MAAME,IAAI,GACrEC,GAAG,CAAC,CAACH;oBACJ,oEAAoE;gBACpEA;wBAAAA,oBAAAA,MAAMI,UAAU,qBAAhBJ,kBAAkBG,GAAG,CAAC,CAACD,OAAU,CAAA;wBAC/BG,MAAMA,eAAI,CAACC,IAAI,CAAC,UAAUJ;wBAC1BK,KAAKP,MAAMQ,IAAI;oBACjB,CAAA;eAEDT,MAAM,CAACU,SACPC,IAAI;YAEP,IAAItB,CAAAA,8CAAAA,0BAA4B,CAACQ,SAAS,KAAI,MAAM;gBAClDE,OAAOa,IAAI,IAAIvB,8CAAAA,0BAA4B,CAACQ,SAAS;YACvD;YAEA,OAAO;gBACL,GAAGD,QAAQ;gBACX,CAACC,SAAS,EAAE;oBACV,+CAA+C;oBAC/C,iDAAiD;oBACjDC,QAAQX,SAAS,CAACU,SAAS,CAAC,EAAE;oBAC9BE;gBACF;YACF;QACF,GACA,CAAC;IAEL;AACF"}
1
+ {"version":3,"sources":["../../../src/export/createMetadataJson.ts"],"sourcesContent":["import path from 'path';\n\nimport type { BundleOutput } from './saveAssets';\n\nexport type BundlePlatform = 'android' | 'ios';\n\ntype PlatformMetadataAsset = { path: string; ext: string };\n\nexport type PlatformMetadata = { bundle: string; assets: PlatformMetadataAsset[] };\n\ntype FileMetadata = {\n [key in BundlePlatform]: PlatformMetadata;\n};\n\nexport function createMetadataJson({\n bundles,\n fileNames,\n embeddedHashSet,\n domComponentAssetsMetadata,\n}: {\n bundles: Partial<Record<BundlePlatform, Pick<BundleOutput, 'assets'>>>;\n fileNames: Record<string, string[]>;\n embeddedHashSet?: Set<string>;\n domComponentAssetsMetadata?: Record<string, PlatformMetadataAsset[]>;\n}): {\n version: 0;\n bundler: 'metro';\n fileMetadata: FileMetadata;\n} {\n // Build metadata.json\n return {\n version: 0,\n bundler: 'metro',\n fileMetadata: Object.entries(bundles).reduce<Record<string, Partial<PlatformMetadata>>>(\n (metadata, [platform, bundle]) => {\n if (platform === 'web') return metadata;\n\n // Collect all of the assets and convert them to the serial format, deduplicating by path.\n const seen = new Set<string>();\n const assets = bundle.assets\n .filter((asset) => !embeddedHashSet || !embeddedHashSet.has(asset.hash))\n .map((asset) =>\n // Each asset has multiple hashes which we convert and then flatten.\n asset.fileHashes?.map((hash) => ({\n path: path.join('assets', hash),\n ext: asset.type,\n }))\n )\n .filter(Boolean)\n .flat()\n .filter((a) => {\n if (seen.has(a.path)) return false;\n seen.add(a.path);\n return true;\n });\n\n if (domComponentAssetsMetadata?.[platform] != null) {\n assets.push(...domComponentAssetsMetadata?.[platform]);\n }\n\n return {\n ...metadata,\n [platform]: {\n // Get the filename for each platform's bundle.\n // TODO: Add multi-bundle support to EAS Update!!\n bundle: fileNames[platform][0],\n assets,\n },\n };\n },\n {}\n ) as FileMetadata,\n };\n}\n"],"names":["createMetadataJson","bundles","fileNames","embeddedHashSet","domComponentAssetsMetadata","version","bundler","fileMetadata","Object","entries","reduce","metadata","platform","bundle","seen","Set","assets","filter","asset","has","hash","map","fileHashes","path","join","ext","type","Boolean","flat","a","add","push"],"mappings":";;;;+BAcgBA;;;eAAAA;;;;gEAdC;;;;;;;;;;;AAcV,SAASA,mBAAmB,EACjCC,OAAO,EACPC,SAAS,EACTC,eAAe,EACfC,0BAA0B,EAM3B;IAKC,sBAAsB;IACtB,OAAO;QACLC,SAAS;QACTC,SAAS;QACTC,cAAcC,OAAOC,OAAO,CAACR,SAASS,MAAM,CAC1C,CAACC,UAAU,CAACC,UAAUC,OAAO;YAC3B,IAAID,aAAa,OAAO,OAAOD;YAE/B,0FAA0F;YAC1F,MAAMG,OAAO,IAAIC;YACjB,MAAMC,SAASH,OAAOG,MAAM,CACzBC,MAAM,CAAC,CAACC,QAAU,CAACf,mBAAmB,CAACA,gBAAgBgB,GAAG,CAACD,MAAME,IAAI,GACrEC,GAAG,CAAC,CAACH;oBACJ,oEAAoE;gBACpEA;wBAAAA,oBAAAA,MAAMI,UAAU,qBAAhBJ,kBAAkBG,GAAG,CAAC,CAACD,OAAU,CAAA;wBAC/BG,MAAMA,eAAI,CAACC,IAAI,CAAC,UAAUJ;wBAC1BK,KAAKP,MAAMQ,IAAI;oBACjB,CAAA;eAEDT,MAAM,CAACU,SACPC,IAAI,GACJX,MAAM,CAAC,CAACY;gBACP,IAAIf,KAAKK,GAAG,CAACU,EAAEN,IAAI,GAAG,OAAO;gBAC7BT,KAAKgB,GAAG,CAACD,EAAEN,IAAI;gBACf,OAAO;YACT;YAEF,IAAInB,CAAAA,8CAAAA,0BAA4B,CAACQ,SAAS,KAAI,MAAM;gBAClDI,OAAOe,IAAI,IAAI3B,8CAAAA,0BAA4B,CAACQ,SAAS;YACvD;YAEA,OAAO;gBACL,GAAGD,QAAQ;gBACX,CAACC,SAAS,EAAE;oBACV,+CAA+C;oBAC/C,iDAAiD;oBACjDC,QAAQX,SAAS,CAACU,SAAS,CAAC,EAAE;oBAC9BI;gBACF;YACF;QACF,GACA,CAAC;IAEL;AACF"}
@@ -303,8 +303,9 @@ async function exportEmbedBundleAndAssetsAsync(projectRoot, options) {
303
303
  options
304
304
  });
305
305
  }
306
- // TODO: Remove duplicates...
307
- const expoDomComponentReferences = bundles.artifacts.map((artifact)=>Array.isArray(artifact.metadata.expoDomComponentReferences) ? artifact.metadata.expoDomComponentReferences : []).flat();
306
+ const expoDomComponentReferences = [
307
+ ...new Set(bundles.artifacts.map((artifact)=>Array.isArray(artifact.metadata.expoDomComponentReferences) ? artifact.metadata.expoDomComponentReferences : []).flat())
308
+ ];
308
309
  if (expoDomComponentReferences.length > 0) {
309
310
  await Promise.all(// TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.
310
311
  expoDomComponentReferences.map(async (filePath)=>{
@@ -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 * 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, loadEnvFiles } 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 loadEnvFiles(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 // We optimistically build the server-side API routes code here, to ensure they're\n // valid or to enable parallel deployment in the future (TBD). This is disabled using\n // the explicit `--skip-server` flag.\n const apiRoutesEnabled =\n devServer.isReactServerComponentsEnabled || exp.web?.output === 'server';\n if (!options.skipServer && 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 maxWorkers: options.maxWorkers,\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 directBundleOptions = 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\n // TODO(cedric): check if we can use the proper `bundleType=bundle` and `entryPoint=mainModuleName` properties\n const bundleRequest: BundleOptions = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n ...directBundleOptions,\n\n // NOTE(@kitten): Cast non-optional defaults\n lazy: directBundleOptions.lazy ?? Server.DEFAULT_BUNDLE_OPTIONS.lazy,\n modulesOnly: directBundleOptions.modulesOnly ?? Server.DEFAULT_BUNDLE_OPTIONS.modulesOnly,\n runModule: directBundleOptions.runModule ?? Server.DEFAULT_BUNDLE_OPTIONS.runModule,\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","loadEnvFiles","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","skipServer","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","directBundleOptions","getMetroDirectBundleOptionsForExpoConfig","hosted","bundleRequest","Server","DEFAULT_BUNDLE_OPTIONS","lazy","modulesOnly","runModule","watch","onProgress","resolverOptions","transformOptions","splitBundleOptions","bundleType","dependencies","_bundler","getDependencies","shallow","_config","getMetroAssets","processModuleFilter","serializer","assetPlugins","transformer","publicPath","isHosted","Error"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;IAySqBA,sCAAsC;eAAtCA;;IA6EAC,sBAAsB;eAAtBA;;IA9TAC,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;yBACqB;qCACD;8BACF;oCACE;8BACF;4BAC4C;8BACtC;sBACC;0BACJ;;;;;;;;;;;;;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AAA,yCAAoB,EAACpH,aAAa+G;YACpC;QACF;QACA,MAAMA;IACR;AACF;AAEA,SAASC,QAAQD,KAAU;IACzB,OAAOA,iBAAiBuC;AAC1B"}
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 * 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, loadEnvFiles } 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 loadEnvFiles(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 // We optimistically build the server-side API routes code here, to ensure they're\n // valid or to enable parallel deployment in the future (TBD). This is disabled using\n // the explicit `--skip-server` flag.\n const apiRoutesEnabled =\n devServer.isReactServerComponentsEnabled || exp.web?.output === 'server';\n if (!options.skipServer && apiRoutesEnabled) {\n await exportStandaloneServerAsync(projectRoot, devServer, {\n exp,\n pkg,\n files,\n options,\n });\n }\n\n const expoDomComponentReferences = [\n ...new Set(\n bundles.artifacts\n .map((artifact) =>\n Array.isArray(artifact.metadata.expoDomComponentReferences)\n ? artifact.metadata.expoDomComponentReferences\n : []\n )\n .flat()\n ),\n ];\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 maxWorkers: options.maxWorkers,\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 directBundleOptions = 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\n // TODO(cedric): check if we can use the proper `bundleType=bundle` and `entryPoint=mainModuleName` properties\n const bundleRequest: BundleOptions = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n ...directBundleOptions,\n\n // NOTE(@kitten): Cast non-optional defaults\n lazy: directBundleOptions.lazy ?? Server.DEFAULT_BUNDLE_OPTIONS.lazy,\n modulesOnly: directBundleOptions.modulesOnly ?? Server.DEFAULT_BUNDLE_OPTIONS.modulesOnly,\n runModule: directBundleOptions.runModule ?? Server.DEFAULT_BUNDLE_OPTIONS.runModule,\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","loadEnvFiles","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","skipServer","exportStandaloneServerAsync","expoDomComponentReferences","Set","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","directBundleOptions","getMetroDirectBundleOptionsForExpoConfig","hosted","bundleRequest","Server","DEFAULT_BUNDLE_OPTIONS","lazy","modulesOnly","runModule","watch","onProgress","resolverOptions","transformOptions","splitBundleOptions","bundleType","dependencies","_bundler","getDependencies","shallow","_config","getMetroAssets","processModuleFilter","serializer","assetPlugins","transformer","publicPath","isHosted","Error"],"mappings":"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,WAAW,CAACD,YAAY;YAC7C9H,UAAUmH,iBAAiBnH,QAAQ;YACnC,2FAA2F;YAC3F,YAAY;YACZrB,aAAauH,OAAOvH,WAAW;YAC/BqJ,YAAY9B,OAAO6B,WAAW,CAACC,UAAU;YACzCC,UAAU;QACZ;IACF,EAAE,OAAOtC,OAAY;QACnB,IAAIC,QAAQD,QAAQ;YAClB,0EAA0E;YAC1E,iIAAiI;YACjI,IAAI/G,QAAQoB,QAAQ,KAAK,OAAO;gBAC9B,8FAA8F;gBAC9F,IAAI,aAAa2F,SAASE,IAAAA,8CAAyB,KAAI;oBACrDF,MAAMG,OAAO,GAAGC,IAAAA,eAAS,EAACJ,MAAMG,OAAO;gBACzC;gBACAE,IAAAA,yCAAoB,EAACrH,aAAagH;YACpC;QACF;QACA,MAAMA;IACR;AACF;AAEA,SAASC,QAAQD,KAAU;IACzB,OAAOA,iBAAiBuC;AAC1B"}
@@ -226,8 +226,9 @@ async function exportAppAsync(projectRoot, { platforms, outputDir, clear, dev, d
226
226
  files,
227
227
  isServerHosted: devServer.isReactServerComponentsEnabled || hostedNative
228
228
  });
229
- // TODO: Remove duplicates...
230
- const expoDomComponentReferences = bundle.artifacts.map((artifact)=>Array.isArray(artifact.metadata.expoDomComponentReferences) ? artifact.metadata.expoDomComponentReferences : []).flat();
229
+ const expoDomComponentReferences = [
230
+ ...new Set(bundle.artifacts.map((artifact)=>Array.isArray(artifact.metadata.expoDomComponentReferences) ? artifact.metadata.expoDomComponentReferences : []).flat())
231
+ ];
231
232
  await Promise.all(// TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.
232
233
  expoDomComponentReferences.map(async (filePath)=>{
233
234
  const { bundle: platformDomComponentsBundle, htmlOutputName } = await (0, _exportDomComponents.exportDomComponentAsync)({
@@ -241,8 +242,9 @@ async function exportAppAsync(projectRoot, { platforms, outputDir, clear, dev, d
241
242
  files,
242
243
  useMd5Filename: true
243
244
  });
244
- // Merge the assets from the DOM component into the output assets.
245
- bundle.assets.push(...platformDomComponentsBundle.assets);
245
+ // Merge the assets from the DOM component into the output assets, deduplicating by hash.
246
+ const existingHashes = new Set(bundle.assets.map((a)=>a.hash));
247
+ bundle.assets.push(...platformDomComponentsBundle.assets.filter((a)=>!existingHashes.has(a.hash)));
246
248
  (0, _exportDomComponents.transformNativeBundleForMd5Filename)({
247
249
  domComponentReference: filePath,
248
250
  nativeBundle: bundle,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/export/exportApp.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport type { Platform } from '@expo/config';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { type PlatformMetadata, createMetadataJson } from './createMetadataJson';\nimport { exportAssetsAsync } from './exportAssets';\nimport {\n addDomBundleToMetadataAsync,\n exportDomComponentAsync,\n transformNativeBundleForMd5Filename,\n transformDomEntryForMd5Filename,\n} from './exportDomComponents';\nimport { assertEngineMismatchAsync, isEnableHermesManaged } from './exportHermes';\nimport {\n exportApiRoutesStandaloneAsync,\n exportFromServerAsync,\n injectScriptTags,\n} from './exportStaticAsync';\nimport { getVirtualFaviconAssetsAsync } from './favicon';\nimport { getPublicExpoManifestAsync } from './getPublicExpoManifest';\nimport { copyPublicFolderAsync } from './publicFolder';\nimport { Options } from './resolveOptions';\nimport {\n ExportAssetMap,\n BundleOutput,\n getFilesFromSerialAssets,\n persistMetroFilesAsync,\n BundleAssetWithFileHashes,\n} from './saveAssets';\nimport { createAssetMap } from './writeContents';\nimport * as Log from '../log';\nimport { WebSupportProjectPrerequisite } from '../start/doctor/web/WebSupportProjectPrerequisite';\nimport { DevServerManager } from '../start/server/DevServerManager';\nimport { MetroBundlerDevServer } from '../start/server/metro/MetroBundlerDevServer';\nimport { getRouterDirectoryModuleIdWithManifest } from '../start/server/metro/router';\nimport { serializeHtmlWithAssets } from '../start/server/metro/serializeHtml';\nimport { getEntryWithServerRoot } from '../start/server/middleware/ManifestMiddleware';\nimport { getBaseUrlFromExpoConfig } from '../start/server/middleware/metroOptions';\nimport { createTemplateHtmlFromExpoConfigAsync } from '../start/server/webTemplate';\nimport { env } from '../utils/env';\nimport { CommandError } from '../utils/errors';\nimport { setNodeEnv, loadEnvFiles } from '../utils/nodeEnv';\n\nexport async function exportAppAsync(\n projectRoot: string,\n {\n platforms,\n outputDir,\n clear,\n dev,\n dumpAssetmap,\n sourceMaps,\n inlineSourceMaps,\n minify,\n bytecode,\n maxWorkers,\n skipSSG,\n hostedNative,\n }: Pick<\n Options,\n | 'dumpAssetmap'\n | 'sourceMaps'\n | 'inlineSourceMaps'\n | 'dev'\n | 'clear'\n | 'outputDir'\n | 'platforms'\n | 'minify'\n | 'bytecode'\n | 'maxWorkers'\n | 'skipSSG'\n | 'hostedNative'\n >\n): Promise<void> {\n // Force the environment during export and do not allow overriding it.\n const environment = dev ? 'development' : 'production';\n process.env.NODE_ENV = environment;\n setNodeEnv(environment);\n loadEnvFiles(projectRoot);\n\n const projectConfig = getConfig(projectRoot);\n const exp = await getPublicExpoManifestAsync(projectRoot, {\n // Web doesn't require validation.\n skipValidation: platforms.length === 1 && platforms[0] === 'web',\n });\n\n if (platforms.includes('web')) {\n await new WebSupportProjectPrerequisite(projectRoot).assertAsync();\n }\n\n const useServerRendering = ['static', 'server'].includes(exp.web?.output ?? '');\n\n if (skipSSG && exp.web?.output !== 'server') {\n throw new CommandError('--no-ssg can only be used with `web.output: server`');\n }\n\n const baseUrl = getBaseUrlFromExpoConfig(exp);\n\n if (!bytecode && (platforms.includes('ios') || platforms.includes('android'))) {\n Log.warn(\n `Bytecode makes the app startup faster, disabling bytecode is highly discouraged and should only be used for debugging purposes.`\n );\n }\n\n // Print out logs\n if (baseUrl) {\n Log.log();\n Log.log(chalk.gray`Using (experimental) base path: ${baseUrl}`);\n // Warn if not using an absolute path.\n if (!baseUrl.startsWith('/')) {\n Log.log(\n chalk.yellow` Base path does not start with a slash. Requests will not be absolute.`\n );\n }\n }\n\n const mode = dev ? 'development' : 'production';\n const publicPath = path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER);\n const outputPath = path.resolve(projectRoot, outputDir);\n\n // Write the JS bundles to disk, and get the bundle file names (this could change with async chunk loading support).\n\n const files: ExportAssetMap = new Map();\n\n const devServerManager = await DevServerManager.startMetroAsync(projectRoot, {\n minify,\n mode,\n port: 8081,\n isExporting: true,\n location: {},\n resetDevServer: clear,\n maxWorkers,\n });\n\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const bundles: Partial<Record<Platform, BundleOutput>> = {};\n const domComponentAssetsMetadata: Partial<Record<Platform, PlatformMetadata['assets']>> = {};\n\n const spaPlatforms =\n // TODO: Support server and static rendering for server component exports.\n useServerRendering && !devServer.isReactServerComponentsEnabled\n ? platforms.filter((platform) => platform !== 'web')\n : platforms;\n\n try {\n if (devServer.isReactServerComponentsEnabled) {\n // In RSC mode, we only need these to be in the client dir.\n // TODO: Merge back with other copy after we add SSR.\n try {\n await copyPublicFolderAsync(publicPath, path.join(outputPath, 'client'));\n } catch (error) {\n Log.error('Failed to copy public directory to dist directory');\n throw error;\n }\n } else {\n // NOTE(kitten): The public folder is currently always copied, regardless of targetDomain\n // split. Hence, there's another separate `copyPublicFolderAsync` call below for `web`\n await copyPublicFolderAsync(publicPath, outputPath);\n }\n\n let templateHtml: string | undefined;\n // Can be empty during web-only SSG.\n if (spaPlatforms.length) {\n await Promise.all(\n spaPlatforms.map(async (platform) => {\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 const isHermes = isEnableHermesManaged(exp, platform);\n if (isHermes) {\n await assertEngineMismatchAsync(projectRoot, exp, platform);\n }\n\n let bundle: {\n artifacts: SerialAsset[];\n assets: readonly BundleAssetWithFileHashes[];\n files?: ExportAssetMap;\n };\n\n try {\n // Run metro bundler and create the JS bundles/source maps.\n bundle = await devServer.nativeExportBundleAsync(\n exp,\n {\n platform,\n splitChunks:\n !env.EXPO_NO_BUNDLE_SPLITTING &&\n ((devServer.isReactServerComponentsEnabled && !bytecode) || platform === 'web'),\n mainModuleName: getEntryWithServerRoot(projectRoot, {\n platform,\n pkg: projectConfig.pkg,\n }),\n mode: dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: sourceMaps || inlineSourceMaps,\n inlineSourceMap: inlineSourceMaps,\n bytecode: bytecode && isHermes,\n reactCompiler: !!exp.experiments?.reactCompiler,\n hosted: hostedNative,\n },\n files\n );\n } catch (error) {\n Log.log('');\n if (error instanceof Error) {\n Log.exception(error);\n } else {\n Log.error('Failed to bundle the app');\n Log.log(error as any);\n }\n process.exit(1);\n }\n\n bundles[platform] = bundle;\n\n getFilesFromSerialAssets(bundle.artifacts, {\n includeSourceMaps: sourceMaps,\n files,\n isServerHosted: devServer.isReactServerComponentsEnabled || hostedNative,\n });\n\n // TODO: Remove duplicates...\n const expoDomComponentReferences = bundle.artifacts\n .map((artifact) =>\n Array.isArray(artifact.metadata.expoDomComponentReferences)\n ? artifact.metadata.expoDomComponentReferences\n : []\n )\n .flat();\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: platformDomComponentsBundle, htmlOutputName } =\n await exportDomComponentAsync({\n filePath,\n projectRoot,\n dev,\n devServer,\n isHermes,\n includeSourceMaps: sourceMaps,\n exp,\n files,\n useMd5Filename: true,\n });\n\n // Merge the assets from the DOM component into the output assets.\n (bundle.assets as (typeof bundle.assets)[0][]).push(\n ...platformDomComponentsBundle.assets\n );\n\n transformNativeBundleForMd5Filename({\n domComponentReference: filePath,\n nativeBundle: bundle,\n files,\n htmlOutputName,\n });\n domComponentAssetsMetadata[platform] = [\n ...(domComponentAssetsMetadata[platform] || []),\n ...(await addDomBundleToMetadataAsync(platformDomComponentsBundle)),\n ...transformDomEntryForMd5Filename({\n files,\n htmlOutputName,\n }),\n ];\n })\n );\n\n if (platform === 'web') {\n // TODO: Unify with exportStaticAsync\n // TODO: Maybe move to the serializer.\n let html = await serializeHtmlWithAssets({\n isExporting: true,\n resources: bundle.artifacts,\n template: await createTemplateHtmlFromExpoConfigAsync(projectRoot, {\n scripts: [],\n cssLinks: [],\n exp: projectConfig.exp,\n }),\n baseUrl,\n });\n\n // Add the favicon assets to the HTML.\n const modifyHtml = await getVirtualFaviconAssetsAsync(projectRoot, {\n outputDir,\n baseUrl,\n files,\n exp: projectConfig.exp,\n });\n if (modifyHtml) {\n html = modifyHtml(html);\n }\n\n // HACK: This is used for adding SSR shims in React Server Components.\n templateHtml = html;\n\n // Generate SPA-styled HTML file.\n // If web exists, then write the template HTML file.\n files.set('index.html', {\n contents: html,\n targetDomain: devServer.isReactServerComponentsEnabled ? 'server' : 'client',\n });\n }\n })\n );\n\n if (devServer.isReactServerComponentsEnabled) {\n const isWeb = platforms.includes('web');\n\n await exportApiRoutesStandaloneAsync(devServer, {\n files,\n platform: 'web',\n apiRoutesOnly: !isWeb,\n templateHtml,\n });\n }\n\n // TODO: Use same asset system across platforms again.\n const { assets, embeddedHashSet } = await exportAssetsAsync(projectRoot, {\n files,\n exp,\n outputDir: outputPath,\n bundles,\n baseUrl,\n hostedNative,\n });\n\n if (dumpAssetmap) {\n Log.log('Creating asset map');\n files.set('assetmap.json', { contents: JSON.stringify(createAssetMap({ assets })) });\n }\n\n const targetDomain = devServer.isReactServerComponentsEnabled ? 'client/' : '';\n const fileNames = Object.fromEntries(\n Object.entries(bundles).map(([platform, bundle]) => [\n platform,\n bundle.artifacts\n .filter((asset) => asset.type === 'js')\n .map((asset) => targetDomain + asset.filename),\n ])\n );\n\n // Generate a `metadata.json` for EAS Update.\n const contents = createMetadataJson({\n bundles,\n fileNames,\n embeddedHashSet,\n domComponentAssetsMetadata,\n });\n files.set('metadata.json', { contents: JSON.stringify(contents) });\n }\n\n // Additional web-only steps...\n\n if (platforms.includes('web') && useServerRendering) {\n const exportServer = exp.web?.output === 'server';\n\n if (exportServer) {\n // TODO: Remove when this is abstracted into the files map\n await copyPublicFolderAsync(publicPath, path.resolve(outputPath, 'client'));\n }\n\n if (skipSSG) {\n Log.log('Skipping static site generation');\n await exportApiRoutesStandaloneAsync(devServer, {\n files,\n platform: 'web',\n apiRoutesOnly: true,\n });\n\n // Output a placeholder index.html if one doesn't exist in the public directory.\n // This ensures native + API routes have some content at the root URL.\n const placeholderIndex = path.resolve(outputPath, 'client/index.html');\n if (!fs.existsSync(placeholderIndex)) {\n files.set('index.html', {\n contents: `<html><body></body></html>`,\n targetDomain: 'client',\n });\n }\n } else if (\n // TODO: Support static export with RSC.\n !devServer.isReactServerComponentsEnabled\n ) {\n await exportFromServerAsync(projectRoot, devServer, {\n mode,\n files,\n clear: !!clear,\n outputDir: outputPath,\n minify,\n baseUrl,\n includeSourceMaps: sourceMaps,\n routerRoot: getRouterDirectoryModuleIdWithManifest(projectRoot, exp),\n reactCompiler: !!exp.experiments?.reactCompiler,\n exportServer,\n maxWorkers,\n isExporting: true,\n exp: projectConfig.exp,\n });\n }\n }\n } finally {\n await devServerManager.stopAsync();\n }\n\n // Write all files at the end for unified logging.\n await persistMetroFilesAsync(files, outputPath);\n}\n"],"names":["exportAppAsync","projectRoot","platforms","outputDir","clear","dev","dumpAssetmap","sourceMaps","inlineSourceMaps","minify","bytecode","maxWorkers","skipSSG","hostedNative","exp","environment","process","env","NODE_ENV","setNodeEnv","loadEnvFiles","projectConfig","getConfig","getPublicExpoManifestAsync","skipValidation","length","includes","WebSupportProjectPrerequisite","assertAsync","useServerRendering","web","output","CommandError","baseUrl","getBaseUrlFromExpoConfig","Log","warn","log","chalk","gray","startsWith","yellow","mode","publicPath","path","resolve","EXPO_PUBLIC_FOLDER","outputPath","files","Map","devServerManager","DevServerManager","startMetroAsync","port","isExporting","location","resetDevServer","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","bundles","domComponentAssetsMetadata","spaPlatforms","isReactServerComponentsEnabled","filter","platform","copyPublicFolderAsync","join","error","templateHtml","Promise","all","map","isHermes","isEnableHermesManaged","assertEngineMismatchAsync","bundle","nativeExportBundleAsync","splitChunks","EXPO_NO_BUNDLE_SPLITTING","mainModuleName","getEntryWithServerRoot","pkg","engine","undefined","serializerIncludeMaps","inlineSourceMap","reactCompiler","experiments","hosted","Error","exception","exit","getFilesFromSerialAssets","artifacts","includeSourceMaps","isServerHosted","expoDomComponentReferences","artifact","Array","isArray","metadata","flat","filePath","platformDomComponentsBundle","htmlOutputName","exportDomComponentAsync","useMd5Filename","assets","push","transformNativeBundleForMd5Filename","domComponentReference","nativeBundle","addDomBundleToMetadataAsync","transformDomEntryForMd5Filename","html","serializeHtmlWithAssets","resources","template","createTemplateHtmlFromExpoConfigAsync","scripts","cssLinks","modifyHtml","getVirtualFaviconAssetsAsync","set","contents","targetDomain","isWeb","exportApiRoutesStandaloneAsync","apiRoutesOnly","embeddedHashSet","exportAssetsAsync","JSON","stringify","createAssetMap","fileNames","Object","fromEntries","entries","asset","type","filename","createMetadataJson","exportServer","placeholderIndex","fs","existsSync","exportFromServerAsync","routerRoot","getRouterDirectoryModuleIdWithManifest","stopAsync","persistMetroFilesAsync"],"mappings":";;;;+BA+CsBA;;;eAAAA;;;;yBA/CI;;;;;;;gEAGP;;;;;;;gEACD;;;;;;;gEACH;;;;;;;gEACE;;;;;;oCAEyC;8BACxB;qCAM3B;8BAC0D;mCAK1D;yBACsC;uCACF;8BACL;4BAQ/B;+BACwB;6DACV;+CACyB;kCACb;uCACK;wBACiB;+BACf;oCACD;8BACE;6BACa;qBAClC;wBACS;yBACY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElC,eAAeA,eACpBC,WAAmB,EACnB,EACEC,SAAS,EACTC,SAAS,EACTC,KAAK,EACLC,GAAG,EACHC,YAAY,EACZC,UAAU,EACVC,gBAAgB,EAChBC,MAAM,EACNC,QAAQ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C1D,MAAM7E,IAAAA,mCAAqB,EAACxB,YAAYC,eAAI,CAACC,OAAO,CAACE,YAAY;YACnE;YAEA,IAAInC,SAAS;gBACXuB,KAAIE,GAAG,CAAC;gBACR,MAAM4F,IAAAA,iDAA8B,EAACxE,WAAW;oBAC9CT;oBACAkB,UAAU;oBACVgE,eAAe;gBACjB;gBAEA,gFAAgF;gBAChF,sEAAsE;gBACtE,MAAMe,mBAAmBrG,eAAI,CAACC,OAAO,CAACE,YAAY;gBAClD,IAAI,CAACmG,aAAE,CAACC,UAAU,CAACF,mBAAmB;oBACpCjG,MAAM6E,GAAG,CAAC,cAAc;wBACtBC,UAAU,CAAC,0BAA0B,CAAC;wBACtCC,cAAc;oBAChB;gBACF;YACF,OAAO,IACL,wCAAwC;YACxC,CAACtE,UAAUO,8BAA8B,EACzC;oBAUmBlD;gBATnB,MAAMsI,IAAAA,wCAAqB,EAACnJ,aAAawD,WAAW;oBAClDf;oBACAM;oBACA5C,OAAO,CAAC,CAACA;oBACTD,WAAW4C;oBACXtC;oBACAwB;oBACA+D,mBAAmBzF;oBACnB8I,YAAYC,IAAAA,8CAAsC,EAACrJ,aAAaa;oBAChE0E,eAAe,CAAC,GAAC1E,mBAAAA,IAAI2E,WAAW,qBAAf3E,iBAAiB0E,aAAa;oBAC/CwD;oBACArI;oBACA2C,aAAa;oBACbxC,KAAKO,cAAcP,GAAG;gBACxB;YACF;QACF;IACF,SAAU;QACR,MAAMoC,iBAAiBqG,SAAS;IAClC;IAEA,kDAAkD;IAClD,MAAMC,IAAAA,kCAAsB,EAACxG,OAAOD;AACtC"}
1
+ {"version":3,"sources":["../../../src/export/exportApp.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport type { Platform } from '@expo/config';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { type PlatformMetadata, createMetadataJson } from './createMetadataJson';\nimport { exportAssetsAsync } from './exportAssets';\nimport {\n addDomBundleToMetadataAsync,\n exportDomComponentAsync,\n transformNativeBundleForMd5Filename,\n transformDomEntryForMd5Filename,\n} from './exportDomComponents';\nimport { assertEngineMismatchAsync, isEnableHermesManaged } from './exportHermes';\nimport { exportApiRoutesStandaloneAsync, exportFromServerAsync } from './exportStaticAsync';\nimport { getVirtualFaviconAssetsAsync } from './favicon';\nimport { getPublicExpoManifestAsync } from './getPublicExpoManifest';\nimport { copyPublicFolderAsync } from './publicFolder';\nimport { Options } from './resolveOptions';\nimport {\n ExportAssetMap,\n BundleOutput,\n getFilesFromSerialAssets,\n persistMetroFilesAsync,\n BundleAssetWithFileHashes,\n} from './saveAssets';\nimport { createAssetMap } from './writeContents';\nimport * as Log from '../log';\nimport { WebSupportProjectPrerequisite } from '../start/doctor/web/WebSupportProjectPrerequisite';\nimport { DevServerManager } from '../start/server/DevServerManager';\nimport { MetroBundlerDevServer } from '../start/server/metro/MetroBundlerDevServer';\nimport { getRouterDirectoryModuleIdWithManifest } from '../start/server/metro/router';\nimport { serializeHtmlWithAssets } from '../start/server/metro/serializeHtml';\nimport { getEntryWithServerRoot } from '../start/server/middleware/ManifestMiddleware';\nimport { getBaseUrlFromExpoConfig } from '../start/server/middleware/metroOptions';\nimport { createTemplateHtmlFromExpoConfigAsync } from '../start/server/webTemplate';\nimport { env } from '../utils/env';\nimport { CommandError } from '../utils/errors';\nimport { setNodeEnv, loadEnvFiles } from '../utils/nodeEnv';\n\nexport async function exportAppAsync(\n projectRoot: string,\n {\n platforms,\n outputDir,\n clear,\n dev,\n dumpAssetmap,\n sourceMaps,\n inlineSourceMaps,\n minify,\n bytecode,\n maxWorkers,\n skipSSG,\n hostedNative,\n }: Pick<\n Options,\n | 'dumpAssetmap'\n | 'sourceMaps'\n | 'inlineSourceMaps'\n | 'dev'\n | 'clear'\n | 'outputDir'\n | 'platforms'\n | 'minify'\n | 'bytecode'\n | 'maxWorkers'\n | 'skipSSG'\n | 'hostedNative'\n >\n): Promise<void> {\n // Force the environment during export and do not allow overriding it.\n const environment = dev ? 'development' : 'production';\n process.env.NODE_ENV = environment;\n setNodeEnv(environment);\n loadEnvFiles(projectRoot);\n\n const projectConfig = getConfig(projectRoot);\n const exp = await getPublicExpoManifestAsync(projectRoot, {\n // Web doesn't require validation.\n skipValidation: platforms.length === 1 && platforms[0] === 'web',\n });\n\n if (platforms.includes('web')) {\n await new WebSupportProjectPrerequisite(projectRoot).assertAsync();\n }\n\n const useServerRendering = ['static', 'server'].includes(exp.web?.output ?? '');\n\n if (skipSSG && exp.web?.output !== 'server') {\n throw new CommandError('--no-ssg can only be used with `web.output: server`');\n }\n\n const baseUrl = getBaseUrlFromExpoConfig(exp);\n\n if (!bytecode && (platforms.includes('ios') || platforms.includes('android'))) {\n Log.warn(\n `Bytecode makes the app startup faster, disabling bytecode is highly discouraged and should only be used for debugging purposes.`\n );\n }\n\n // Print out logs\n if (baseUrl) {\n Log.log();\n Log.log(chalk.gray`Using (experimental) base path: ${baseUrl}`);\n // Warn if not using an absolute path.\n if (!baseUrl.startsWith('/')) {\n Log.log(\n chalk.yellow` Base path does not start with a slash. Requests will not be absolute.`\n );\n }\n }\n\n const mode = dev ? 'development' : 'production';\n const publicPath = path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER);\n const outputPath = path.resolve(projectRoot, outputDir);\n\n // Write the JS bundles to disk, and get the bundle file names (this could change with async chunk loading support).\n\n const files: ExportAssetMap = new Map();\n\n const devServerManager = await DevServerManager.startMetroAsync(projectRoot, {\n minify,\n mode,\n port: 8081,\n isExporting: true,\n location: {},\n resetDevServer: clear,\n maxWorkers,\n });\n\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const bundles: Partial<Record<Platform, BundleOutput>> = {};\n const domComponentAssetsMetadata: Partial<Record<Platform, PlatformMetadata['assets']>> = {};\n\n const spaPlatforms =\n // TODO: Support server and static rendering for server component exports.\n useServerRendering && !devServer.isReactServerComponentsEnabled\n ? platforms.filter((platform) => platform !== 'web')\n : platforms;\n\n try {\n if (devServer.isReactServerComponentsEnabled) {\n // In RSC mode, we only need these to be in the client dir.\n // TODO: Merge back with other copy after we add SSR.\n try {\n await copyPublicFolderAsync(publicPath, path.join(outputPath, 'client'));\n } catch (error) {\n Log.error('Failed to copy public directory to dist directory');\n throw error;\n }\n } else {\n // NOTE(kitten): The public folder is currently always copied, regardless of targetDomain\n // split. Hence, there's another separate `copyPublicFolderAsync` call below for `web`\n await copyPublicFolderAsync(publicPath, outputPath);\n }\n\n let templateHtml: string | undefined;\n // Can be empty during web-only SSG.\n if (spaPlatforms.length) {\n await Promise.all(\n spaPlatforms.map(async (platform) => {\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 const isHermes = isEnableHermesManaged(exp, platform);\n if (isHermes) {\n await assertEngineMismatchAsync(projectRoot, exp, platform);\n }\n\n let bundle: {\n artifacts: SerialAsset[];\n assets: readonly BundleAssetWithFileHashes[];\n files?: ExportAssetMap;\n };\n\n try {\n // Run metro bundler and create the JS bundles/source maps.\n bundle = await devServer.nativeExportBundleAsync(\n exp,\n {\n platform,\n splitChunks:\n !env.EXPO_NO_BUNDLE_SPLITTING &&\n ((devServer.isReactServerComponentsEnabled && !bytecode) || platform === 'web'),\n mainModuleName: getEntryWithServerRoot(projectRoot, {\n platform,\n pkg: projectConfig.pkg,\n }),\n mode: dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: sourceMaps || inlineSourceMaps,\n inlineSourceMap: inlineSourceMaps,\n bytecode: bytecode && isHermes,\n reactCompiler: !!exp.experiments?.reactCompiler,\n hosted: hostedNative,\n },\n files\n );\n } catch (error) {\n Log.log('');\n if (error instanceof Error) {\n Log.exception(error);\n } else {\n Log.error('Failed to bundle the app');\n Log.log(error as any);\n }\n process.exit(1);\n }\n\n bundles[platform] = bundle;\n\n getFilesFromSerialAssets(bundle.artifacts, {\n includeSourceMaps: sourceMaps,\n files,\n isServerHosted: devServer.isReactServerComponentsEnabled || hostedNative,\n });\n\n const expoDomComponentReferences = [\n ...new Set(\n bundle.artifacts\n .map((artifact) =>\n Array.isArray(artifact.metadata.expoDomComponentReferences)\n ? artifact.metadata.expoDomComponentReferences\n : []\n )\n .flat()\n ),\n ];\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: platformDomComponentsBundle, htmlOutputName } =\n await exportDomComponentAsync({\n filePath,\n projectRoot,\n dev,\n devServer,\n isHermes,\n includeSourceMaps: sourceMaps,\n exp,\n files,\n useMd5Filename: true,\n });\n\n // Merge the assets from the DOM component into the output assets, deduplicating by hash.\n const existingHashes = new Set(bundle.assets.map((a) => a.hash));\n (bundle.assets as (typeof bundle.assets)[0][]).push(\n ...platformDomComponentsBundle.assets.filter((a) => !existingHashes.has(a.hash))\n );\n\n transformNativeBundleForMd5Filename({\n domComponentReference: filePath,\n nativeBundle: bundle,\n files,\n htmlOutputName,\n });\n domComponentAssetsMetadata[platform] = [\n ...(domComponentAssetsMetadata[platform] || []),\n ...(await addDomBundleToMetadataAsync(platformDomComponentsBundle)),\n ...transformDomEntryForMd5Filename({\n files,\n htmlOutputName,\n }),\n ];\n })\n );\n\n if (platform === 'web') {\n // TODO: Unify with exportStaticAsync\n // TODO: Maybe move to the serializer.\n let html = await serializeHtmlWithAssets({\n isExporting: true,\n resources: bundle.artifacts,\n template: await createTemplateHtmlFromExpoConfigAsync(projectRoot, {\n scripts: [],\n cssLinks: [],\n exp: projectConfig.exp,\n }),\n baseUrl,\n });\n\n // Add the favicon assets to the HTML.\n const modifyHtml = await getVirtualFaviconAssetsAsync(projectRoot, {\n outputDir,\n baseUrl,\n files,\n exp: projectConfig.exp,\n });\n if (modifyHtml) {\n html = modifyHtml(html);\n }\n\n // HACK: This is used for adding SSR shims in React Server Components.\n templateHtml = html;\n\n // Generate SPA-styled HTML file.\n // If web exists, then write the template HTML file.\n files.set('index.html', {\n contents: html,\n targetDomain: devServer.isReactServerComponentsEnabled ? 'server' : 'client',\n });\n }\n })\n );\n\n if (devServer.isReactServerComponentsEnabled) {\n const isWeb = platforms.includes('web');\n\n await exportApiRoutesStandaloneAsync(devServer, {\n files,\n platform: 'web',\n apiRoutesOnly: !isWeb,\n templateHtml,\n });\n }\n\n // TODO: Use same asset system across platforms again.\n const { assets, embeddedHashSet } = await exportAssetsAsync(projectRoot, {\n files,\n exp,\n outputDir: outputPath,\n bundles,\n baseUrl,\n hostedNative,\n });\n\n if (dumpAssetmap) {\n Log.log('Creating asset map');\n files.set('assetmap.json', { contents: JSON.stringify(createAssetMap({ assets })) });\n }\n\n const targetDomain = devServer.isReactServerComponentsEnabled ? 'client/' : '';\n const fileNames = Object.fromEntries(\n Object.entries(bundles).map(([platform, bundle]) => [\n platform,\n bundle.artifacts\n .filter((asset) => asset.type === 'js')\n .map((asset) => targetDomain + asset.filename),\n ])\n );\n\n // Generate a `metadata.json` for EAS Update.\n const contents = createMetadataJson({\n bundles,\n fileNames,\n embeddedHashSet,\n domComponentAssetsMetadata,\n });\n files.set('metadata.json', { contents: JSON.stringify(contents) });\n }\n\n // Additional web-only steps...\n\n if (platforms.includes('web') && useServerRendering) {\n const exportServer = exp.web?.output === 'server';\n\n if (exportServer) {\n // TODO: Remove when this is abstracted into the files map\n await copyPublicFolderAsync(publicPath, path.resolve(outputPath, 'client'));\n }\n\n if (skipSSG) {\n Log.log('Skipping static site generation');\n await exportApiRoutesStandaloneAsync(devServer, {\n files,\n platform: 'web',\n apiRoutesOnly: true,\n });\n\n // Output a placeholder index.html if one doesn't exist in the public directory.\n // This ensures native + API routes have some content at the root URL.\n const placeholderIndex = path.resolve(outputPath, 'client/index.html');\n if (!fs.existsSync(placeholderIndex)) {\n files.set('index.html', {\n contents: `<html><body></body></html>`,\n targetDomain: 'client',\n });\n }\n } else if (\n // TODO: Support static export with RSC.\n !devServer.isReactServerComponentsEnabled\n ) {\n await exportFromServerAsync(projectRoot, devServer, {\n mode,\n files,\n clear: !!clear,\n outputDir: outputPath,\n minify,\n baseUrl,\n includeSourceMaps: sourceMaps,\n routerRoot: getRouterDirectoryModuleIdWithManifest(projectRoot, exp),\n reactCompiler: !!exp.experiments?.reactCompiler,\n exportServer,\n maxWorkers,\n isExporting: true,\n exp: projectConfig.exp,\n });\n }\n }\n } finally {\n await devServerManager.stopAsync();\n }\n\n // Write all files at the end for unified logging.\n await persistMetroFilesAsync(files, outputPath);\n}\n"],"names":["exportAppAsync","projectRoot","platforms","outputDir","clear","dev","dumpAssetmap","sourceMaps","inlineSourceMaps","minify","bytecode","maxWorkers","skipSSG","hostedNative","exp","environment","process","env","NODE_ENV","setNodeEnv","loadEnvFiles","projectConfig","getConfig","getPublicExpoManifestAsync","skipValidation","length","includes","WebSupportProjectPrerequisite","assertAsync","useServerRendering","web","output","CommandError","baseUrl","getBaseUrlFromExpoConfig","Log","warn","log","chalk","gray","startsWith","yellow","mode","publicPath","path","resolve","EXPO_PUBLIC_FOLDER","outputPath","files","Map","devServerManager","DevServerManager","startMetroAsync","port","isExporting","location","resetDevServer","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","bundles","domComponentAssetsMetadata","spaPlatforms","isReactServerComponentsEnabled","filter","platform","copyPublicFolderAsync","join","error","templateHtml","Promise","all","map","isHermes","isEnableHermesManaged","assertEngineMismatchAsync","bundle","nativeExportBundleAsync","splitChunks","EXPO_NO_BUNDLE_SPLITTING","mainModuleName","getEntryWithServerRoot","pkg","engine","undefined","serializerIncludeMaps","inlineSourceMap","reactCompiler","experiments","hosted","Error","exception","exit","getFilesFromSerialAssets","artifacts","includeSourceMaps","isServerHosted","expoDomComponentReferences","Set","artifact","Array","isArray","metadata","flat","filePath","platformDomComponentsBundle","htmlOutputName","exportDomComponentAsync","useMd5Filename","existingHashes","assets","a","hash","push","has","transformNativeBundleForMd5Filename","domComponentReference","nativeBundle","addDomBundleToMetadataAsync","transformDomEntryForMd5Filename","html","serializeHtmlWithAssets","resources","template","createTemplateHtmlFromExpoConfigAsync","scripts","cssLinks","modifyHtml","getVirtualFaviconAssetsAsync","set","contents","targetDomain","isWeb","exportApiRoutesStandaloneAsync","apiRoutesOnly","embeddedHashSet","exportAssetsAsync","JSON","stringify","createAssetMap","fileNames","Object","fromEntries","entries","asset","type","filename","createMetadataJson","exportServer","placeholderIndex","fs","existsSync","exportFromServerAsync","routerRoot","getRouterDirectoryModuleIdWithManifest","stopAsync","persistMetroFilesAsync"],"mappings":";;;;+BA2CsBA;;;eAAAA;;;;yBA3CI;;;;;;;gEAGP;;;;;;;gEACD;;;;;;;gEACH;;;;;;;gEACE;;;;;;oCAEyC;8BACxB;qCAM3B;8BAC0D;mCACK;yBACzB;uCACF;8BACL;4BAQ/B;+BACwB;6DACV;+CACyB;kCACb;uCACK;wBACiB;+BACf;oCACD;8BACE;6BACa;qBAClC;wBACS;yBACY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElC,eAAeA,eACpBC,WAAmB,EACnB,EACEC,SAAS,EACTC,SAAS,EACTC,KAAK,EACLC,GAAG,EACHC,YAAY,EACZC,UAAU,EACVC,gBAAgB,EAChBC,MAAM,EACNC,QAAQ,EACRC,UAAU,EACVC,OAAO,EACPC,YAAY,EAeb;QAkBwDC,UAE1CA;IAlBf,sEAAsE;IACtE,MAAMC,cAAcV,MAAM,gBAAgB;IAC1CW,QAAQC,GAAG,CAACC,QAAQ,GAAGH;IACvBI,IAAAA,mBAAU,EAACJ;IACXK,IAAAA,qBAAY,EAACnB;IAEb,MAAMoB,gBAAgBC,IAAAA,mBAAS,EAACrB;IAChC,MAAMa,MAAM,MAAMS,IAAAA,iDAA0B,EAACtB,aAAa;QACxD,kCAAkC;QAClCuB,gBAAgBtB,UAAUuB,MAAM,KAAK,KAAKvB,SAAS,CAAC,EAAE,KAAK;IAC7D;IAEA,IAAIA,UAAUwB,QAAQ,CAAC,QAAQ;QAC7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,eAAI,CAACC,OAAO,CAACE,YAAY;gBAClD,IAAI,CAACwG,aAAE,CAACC,UAAU,CAACF,mBAAmB;oBACpCtG,MAAMkF,GAAG,CAAC,cAAc;wBACtBC,UAAU,CAAC,0BAA0B,CAAC;wBACtCC,cAAc;oBAChB;gBACF;YACF,OAAO,IACL,wCAAwC;YACxC,CAAC3E,UAAUO,8BAA8B,EACzC;oBAUmBlD;gBATnB,MAAM2I,IAAAA,wCAAqB,EAACxJ,aAAawD,WAAW;oBAClDf;oBACAM;oBACA5C,OAAO,CAAC,CAACA;oBACTD,WAAW4C;oBACXtC;oBACAwB;oBACA+D,mBAAmBzF;oBACnBmJ,YAAYC,IAAAA,8CAAsC,EAAC1J,aAAaa;oBAChE0E,eAAe,CAAC,GAAC1E,mBAAAA,IAAI2E,WAAW,qBAAf3E,iBAAiB0E,aAAa;oBAC/C6D;oBACA1I;oBACA2C,aAAa;oBACbxC,KAAKO,cAAcP,GAAG;gBACxB;YACF;QACF;IACF,SAAU;QACR,MAAMoC,iBAAiB0G,SAAS;IAClC;IAEA,kDAAkD;IAClD,MAAMC,IAAAA,kCAAsB,EAAC7G,OAAOD;AACtC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/run/android/runAndroidAsync.ts"],"sourcesContent":["import chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { resolveInstallApkNameAsync } from './resolveInstallApkName';\nimport { Options, ResolvedOptions, resolveOptionsAsync } from './resolveOptions';\nimport { exportEagerAsync } from '../../export/embed/exportEager';\nimport { Log } from '../../log';\nimport type { AndroidOpenInCustomProps } from '../../start/platforms/android/AndroidPlatformManager';\nimport { assembleAsync, installAsync } from '../../start/platforms/android/gradle';\nimport { resolveBuildCache, uploadBuildCache } from '../../utils/build-cache-providers';\nimport { CommandError } from '../../utils/errors';\nimport { setNodeEnv, loadEnvFiles } from '../../utils/nodeEnv';\nimport { ensurePortAvailabilityAsync } from '../../utils/port';\nimport { getSchemesForAndroidAsync } from '../../utils/scheme';\nimport { ensureNativeProjectAsync } from '../ensureNativeProject';\nimport { logProjectLogsLocation } from '../hints';\nimport { startBundlerAsync } from '../startBundler';\n\nconst debug = require('debug')('expo:run:android');\n\nexport async function runAndroidAsync(projectRoot: string, { install, ...options }: Options) {\n // NOTE: This is a guess, the developer can overwrite with `NODE_ENV`.\n const isProduction = options.variant?.toLowerCase().endsWith('release');\n setNodeEnv(isProduction ? 'production' : 'development');\n loadEnvFiles(projectRoot);\n\n await ensureNativeProjectAsync(projectRoot, { platform: 'android', install });\n\n const props = await resolveOptionsAsync(projectRoot, options);\n\n if (!options.binary && props.buildCacheProvider) {\n const localPath = await resolveBuildCache({\n projectRoot,\n platform: 'android',\n provider: props.buildCacheProvider,\n runOptions: options,\n });\n if (localPath) {\n options.binary = localPath;\n }\n }\n\n debug('Package name: ' + props.packageName);\n Log.log('› Building app...');\n\n const androidProjectRoot = path.join(projectRoot, 'android');\n\n let shouldUpdateBuildCache = false;\n if (!options.binary) {\n let eagerBundleOptions: string | undefined;\n\n if (isProduction) {\n eagerBundleOptions = JSON.stringify(\n await exportEagerAsync(projectRoot, {\n dev: false,\n platform: 'android',\n })\n );\n }\n\n await assembleAsync(androidProjectRoot, {\n variant: props.variant,\n port: props.port,\n appName: props.appName,\n buildCache: props.buildCache,\n architectures: props.architectures,\n eagerBundleOptions,\n });\n shouldUpdateBuildCache = true;\n\n // Ensure the port hasn't become busy during the build.\n if (props.shouldStartBundler && !(await ensurePortAvailabilityAsync(projectRoot, props))) {\n props.shouldStartBundler = false;\n }\n }\n\n const manager = await startBundlerAsync(projectRoot, {\n port: props.port,\n // If a scheme is specified then use that instead of the package name.\n scheme: (await getSchemesForAndroidAsync(projectRoot))?.[0],\n headless: !props.shouldStartBundler,\n });\n\n if (!options.binary) {\n // Find the APK file path\n const apkFile = await resolveInstallApkNameAsync(props.device.device, props);\n if (apkFile) {\n // Attempt to install the APK from the file path\n options.binary = path.join(props.apkVariantDirectory, apkFile);\n }\n }\n\n if (options.binary) {\n // Attempt to install the APK from the file path\n const binaryPath = path.join(options.binary);\n\n if (!fs.existsSync(binaryPath)) {\n throw new CommandError(`The path to the custom Android binary does not exist: ${binaryPath}`);\n }\n Log.log(chalk.gray`\\u203A Installing ${binaryPath}`);\n await props.device.installAppAsync(binaryPath);\n } else {\n await installAppAsync(androidProjectRoot, props);\n }\n\n await manager.getDefaultDevServer().openCustomRuntimeAsync<AndroidOpenInCustomProps>(\n 'emulator',\n {\n applicationId: props.packageName,\n customAppId: props.customAppId,\n launchActivity: props.launchActivity,\n },\n { device: props.device.device }\n );\n\n if (props.shouldStartBundler) {\n logProjectLogsLocation();\n } else {\n await manager.stopAsync();\n }\n\n if (options.binary && shouldUpdateBuildCache && props.buildCacheProvider) {\n await uploadBuildCache({\n projectRoot,\n platform: 'android',\n provider: props.buildCacheProvider,\n buildPath: options.binary,\n runOptions: options,\n });\n }\n}\n\nasync function installAppAsync(androidProjectRoot: string, props: ResolvedOptions) {\n // If we cannot resolve the APK file path then we can attempt to install using Gradle.\n // This offers more advanced resolution that we may not have first class support for.\n Log.log('› Failed to locate binary file, installing with Gradle...');\n await installAsync(androidProjectRoot, {\n variant: props.variant ?? 'debug',\n appName: props.appName ?? 'app',\n port: props.port,\n });\n}\n"],"names":["runAndroidAsync","debug","require","projectRoot","install","options","isProduction","variant","toLowerCase","endsWith","setNodeEnv","loadEnvFiles","ensureNativeProjectAsync","platform","props","resolveOptionsAsync","binary","buildCacheProvider","localPath","resolveBuildCache","provider","runOptions","packageName","Log","log","androidProjectRoot","path","join","shouldUpdateBuildCache","eagerBundleOptions","JSON","stringify","exportEagerAsync","dev","assembleAsync","port","appName","buildCache","architectures","shouldStartBundler","ensurePortAvailabilityAsync","manager","startBundlerAsync","scheme","getSchemesForAndroidAsync","headless","apkFile","resolveInstallApkNameAsync","device","apkVariantDirectory","binaryPath","fs","existsSync","CommandError","chalk","gray","installAppAsync","getDefaultDevServer","openCustomRuntimeAsync","applicationId","customAppId","launchActivity","log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AoBX;IAC5C;IAEA,MAAM2B,QAAQgB,mBAAmB,GAAGC,sBAAsB,CACxD,YACA;QACEC,eAAe7C,MAAMQ,WAAW;QAChCsC,aAAa9C,MAAM8C,WAAW;QAC9BC,gBAAgB/C,MAAM+C,cAAc;IACtC,GACA;QAAEb,QAAQlC,MAAMkC,MAAM,CAACA,MAAM;IAAC;IAGhC,IAAIlC,MAAMyB,kBAAkB,EAAE;QAC5BuB,IAAAA,6BAAsB;IACxB,OAAO;QACL,MAAMrB,QAAQsB,SAAS;IACzB;IAEA,IAAI1D,QAAQW,MAAM,IAAIY,0BAA0Bd,MAAMG,kBAAkB,EAAE;QACxE,MAAM+C,IAAAA,qCAAgB,EAAC;YACrB7D;YACAU,UAAU;YACVO,UAAUN,MAAMG,kBAAkB;YAClCgD,WAAW5D,QAAQW,MAAM;YACzBK,YAAYhB;QACd;IACF;AACF;AAEA,eAAemD,gBAAgB/B,kBAA0B,EAAEX,KAAsB;IAC/E,sFAAsF;IACtF,qFAAqF;IACrFS,QAAG,CAACC,GAAG,CAAC;IACR,MAAM0C,IAAAA,oBAAY,EAACzC,oBAAoB;QACrClB,SAASO,MAAMP,OAAO,IAAI;QAC1B6B,SAAStB,MAAMsB,OAAO,IAAI;QAC1BD,MAAMrB,MAAMqB,IAAI;IAClB;AACF"}
1
+ {"version":3,"sources":["../../../../src/run/android/runAndroidAsync.ts"],"sourcesContent":["import chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { resolveInstallApkNameAsync } from './resolveInstallApkName';\nimport { Options, ResolvedOptions, resolveOptionsAsync } from './resolveOptions';\nimport { exportEagerAsync } from '../../export/embed/exportEager';\nimport { Log } from '../../log';\nimport type { AndroidOpenInCustomProps } from '../../start/platforms/android/AndroidPlatformManager';\nimport { assembleAsync, installAsync } from '../../start/platforms/android/gradle';\nimport { resolveBuildCache, uploadBuildCache } from '../../utils/build-cache-providers';\nimport { CommandError } from '../../utils/errors';\nimport { setNodeEnv, loadEnvFiles } from '../../utils/nodeEnv';\nimport { ensurePortAvailabilityAsync } from '../../utils/port';\nimport { getSchemesForAndroidAsync } from '../../utils/scheme';\nimport { ensureNativeProjectAsync } from '../ensureNativeProject';\nimport { logProjectLogsLocation } from '../hints';\nimport { startBundlerAsync } from '../startBundler';\n\nconst debug = require('debug')('expo:run:android');\n\nexport async function runAndroidAsync(projectRoot: string, { install, ...options }: Options) {\n // NOTE: This is a guess, the developer can overwrite with `NODE_ENV`.\n const isProduction = options.variant?.toLowerCase().endsWith('release');\n setNodeEnv(isProduction ? 'production' : 'development');\n loadEnvFiles(projectRoot);\n\n await ensureNativeProjectAsync(projectRoot, { platform: 'android', install });\n\n const props = await resolveOptionsAsync(projectRoot, options);\n\n if (!options.binary && props.buildCacheProvider) {\n const localPath = await resolveBuildCache({\n projectRoot,\n platform: 'android',\n provider: props.buildCacheProvider,\n runOptions: options,\n });\n if (localPath) {\n options.binary = localPath;\n }\n }\n\n debug('Package name: ' + props.packageName);\n Log.log('› Building app...');\n\n const androidProjectRoot = path.join(projectRoot, 'android');\n\n let shouldUpdateBuildCache = false;\n if (!options.binary) {\n let eagerBundleOptions: string | undefined;\n\n if (isProduction) {\n eagerBundleOptions = JSON.stringify(\n await exportEagerAsync(projectRoot, {\n dev: false,\n platform: 'android',\n })\n );\n }\n\n await assembleAsync(androidProjectRoot, {\n variant: props.variant,\n port: props.port,\n appName: props.appName,\n buildCache: props.buildCache,\n architectures: props.architectures,\n eagerBundleOptions,\n });\n shouldUpdateBuildCache = true;\n\n // Ensure the port hasn't become busy during the build.\n if (props.shouldStartBundler && !(await ensurePortAvailabilityAsync(projectRoot, props))) {\n props.shouldStartBundler = false;\n }\n }\n\n const manager = await startBundlerAsync(projectRoot, {\n port: props.port,\n // If a scheme is specified then use that instead of the package name.\n scheme: (await getSchemesForAndroidAsync(projectRoot))?.[0],\n headless: !props.shouldStartBundler,\n });\n\n if (!options.binary) {\n // Find the APK file path\n const apkFile = await resolveInstallApkNameAsync(props.device.device, props);\n if (apkFile) {\n // Attempt to install the APK from the file path\n options.binary = path.join(props.apkVariantDirectory, apkFile);\n }\n }\n\n if (options.binary) {\n // Attempt to install the APK from the file path\n const binaryPath = path.join(options.binary);\n\n if (!fs.existsSync(binaryPath)) {\n throw new CommandError(`The path to the custom Android binary does not exist: ${binaryPath}`);\n }\n Log.log(chalk.gray`\\u203A Installing ${binaryPath}`);\n await props.device.installAppAsync(binaryPath);\n } else {\n await installAppAsync(androidProjectRoot, props);\n }\n\n await manager.getDefaultDevServer().openCustomRuntimeAsync(\n 'emulator',\n {\n applicationId: props.packageName,\n customAppId: props.customAppId,\n launchActivity: props.launchActivity,\n },\n { device: props.device.device }\n );\n\n if (props.shouldStartBundler) {\n logProjectLogsLocation();\n } else {\n await manager.stopAsync();\n }\n\n if (options.binary && shouldUpdateBuildCache && props.buildCacheProvider) {\n await uploadBuildCache({\n projectRoot,\n platform: 'android',\n provider: props.buildCacheProvider,\n buildPath: options.binary,\n runOptions: options,\n });\n }\n}\n\nasync function installAppAsync(androidProjectRoot: string, props: ResolvedOptions) {\n // If we cannot resolve the APK file path then we can attempt to install using Gradle.\n // This offers more advanced resolution that we may not have first class support for.\n Log.log('› Failed to locate binary file, installing with Gradle...');\n await installAsync(androidProjectRoot, {\n variant: props.variant ?? 'debug',\n appName: props.appName ?? 'app',\n port: props.port,\n });\n}\n"],"names":["runAndroidAsync","debug","require","projectRoot","install","options","isProduction","variant","toLowerCase","endsWith","setNodeEnv","loadEnvFiles","ensureNativeProjectAsync","platform","props","resolveOptionsAsync","binary","buildCacheProvider","localPath","resolveBuildCache","provider","runOptions","packageName","Log","log","androidProjectRoot","path","join","shouldUpdateBuildCache","eagerBundleOptions","JSON","stringify","exportEagerAsync","dev","assembleAsync","port","appName","buildCache","architectures","shouldStartBundler","ensurePortAvailabilityAsync","manager","startBundlerAsync","scheme","getSchemesForAndroidAsync","headless","apkFile","resolveInstallApkNameAsync","device","apkVariantDirectory","binaryPath","fs","existsSync","CommandError","chalk","gray","installAppAsync","getDefaultDevServer","openCustomRuntimeAsync","applicationId","customAppId","launchActivity","logProjectLogsLocation","stopAsync","uploadBuildCache","buildPath","installAsync"],"mappings":";;;;+BAqBsBA;;;eAAAA;;;;gEArBJ;;;;;;;gEACH;;;;;;;gEACE;;;;;;uCAE0B;gCACmB;6BAC7B;qBACb;wBAEwB;qCACQ;wBACvB;yBACY;sBACG;wBACF;qCACD;uBACF;8BACL;;;;;;AAElC,MAAMC,QAAQC,QAAQ,SAAS;AAExB,eAAeF,gBAAgBG,WAAmB,EAAE,EAAEC,OAAO,EAAE,GAAGC,SAAkB;QAEpEA,kBAyDV;IA1DX,sEAAsE;IACtE,MAAMC,gBAAeD,mBAAAA,QAAQE,OAAO,qBAAfF,iBAAiBG,WAAW,GAAGC,QAAQ,CAAC;IAC7DC,IAAAA,mBAAU,EAACJ,eAAe,eAAe;IACzCK,IAAAA,qBAAY,EAACR;IAEb,MAAMS,IAAAA,6CAAwB,EAACT,aAAa;QAAEU,UAAU;QAAWT;IAAQ;IAE3E,MAAMU,QAAQ,MAAMC,IAAAA,mCAAmB,EAACZ,aAAaE;IAErD,IAAI,CAACA,QAAQW,MAAM,IAAIF,MAAMG,kBAAkB,EAAE;QAC/C,MAAMC,YAAY,MAAMC,IAAAA,sCAAiB,EAAC;YACxChB;YACAU,UAAU;YACVO,UAAUN,MAAMG,kBAAkB;YAClCI,YAAYhB;QACd;QACA,IAAIa,WAAW;YACbb,QAAQW,MAAM,GAAGE;QACnB;IACF;IAEAjB,MAAM,mBAAmBa,MAAMQ,WAAW;IAC1CC,QAAG,CAACC,GAAG,CAAC;IAER,MAAMC,qBAAqBC,eAAI,CAACC,IAAI,CAACxB,aAAa;IAElD,IAAIyB,yBAAyB;IAC7B,IAAI,CAACvB,QAAQW,MAAM,EAAE;QACnB,IAAIa;QAEJ,IAAIvB,cAAc;YAChBuB,qBAAqBC,KAAKC,SAAS,CACjC,MAAMC,IAAAA,6BAAgB,EAAC7B,aAAa;gBAClC8B,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CAACQ,eAAe,CAACN;IACrC,OAAO;QACL,MAAMM,gBAAgB/B,oBAAoBX;IAC5C;IAEA,MAAM2B,QAAQgB,mBAAmB,GAAGC,sBAAsB,CACxD,YACA;QACEC,eAAe7C,MAAMQ,WAAW;QAChCsC,aAAa9C,MAAM8C,WAAW;QAC9BC,gBAAgB/C,MAAM+C,cAAc;IACtC,GACA;QAAEb,QAAQlC,MAAMkC,MAAM,CAACA,MAAM;IAAC;IAGhC,IAAIlC,MAAMyB,kBAAkB,EAAE;QAC5BuB,IAAAA,6BAAsB;IACxB,OAAO;QACL,MAAMrB,QAAQsB,SAAS;IACzB;IAEA,IAAI1D,QAAQW,MAAM,IAAIY,0BAA0Bd,MAAMG,kBAAkB,EAAE;QACxE,MAAM+C,IAAAA,qCAAgB,EAAC;YACrB7D;YACAU,UAAU;YACVO,UAAUN,MAAMG,kBAAkB;YAClCgD,WAAW5D,QAAQW,MAAM;YACzBK,YAAYhB;QACd;IACF;AACF;AAEA,eAAemD,gBAAgB/B,kBAA0B,EAAEX,KAAsB;IAC/E,sFAAsF;IACtF,qFAAqF;IACrFS,QAAG,CAACC,GAAG,CAAC;IACR,MAAM0C,IAAAA,oBAAY,EAACzC,oBAAoB;QACrClB,SAASO,MAAMP,OAAO,IAAI;QAC1B6B,SAAStB,MAAMsB,OAAO,IAAI;QAC1BD,MAAMrB,MAAMqB,IAAI;IAClB;AACF"}
@@ -115,7 +115,7 @@ async function launchAppAsync(binaryPath, manager, props, appId) {
115
115
  await manager.getDefaultDevServer().openCustomRuntimeAsync('simulator', {
116
116
  applicationId: appId
117
117
  }, {
118
- device
118
+ device: device.device
119
119
  });
120
120
  }
121
121
  async function getLaunchInfoForBinaryAsync(binaryPath) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/run/ios/launchApp.ts"],"sourcesContent":["import chalk from 'chalk';\nimport path from 'path';\n\nimport * as XcodeBuild from './XcodeBuild';\nimport { BuildProps } from './XcodeBuild.types';\nimport { getAppDeltaDirectory, installOnDeviceAsync } from './appleDevice/installOnDeviceAsync';\nimport { Log } from '../../log';\nimport { AppleDeviceManager } from '../../start/platforms/ios/AppleDeviceManager';\nimport { launchBinaryOnMacAsync } from '../../start/platforms/ios/devicectl';\nimport { SimulatorLogStreamer } from '../../start/platforms/ios/simctlLogging';\nimport { DevServerManager } from '../../start/server/DevServerManager';\nimport { parsePlistAsync } from '../../utils/plist';\nimport { profile } from '../../utils/profile';\n\ntype BinaryLaunchInfo = {\n bundleId: string;\n schemes: string[];\n};\n\n/** Install and launch the app binary on a device. */\nexport async function launchAppAsync(\n binaryPath: string,\n manager: DevServerManager,\n props: Pick<BuildProps, 'isSimulator' | 'device' | 'shouldStartBundler'>,\n appId?: string\n) {\n appId ??= (await profile(getLaunchInfoForBinaryAsync)(binaryPath)).bundleId;\n\n Log.log(chalk.gray`\\u203A Installing ${binaryPath}`);\n if (!props.isSimulator) {\n if (props.device.osType === 'macOS') {\n await launchBinaryOnMacAsync(appId, binaryPath);\n } else {\n await profile(installOnDeviceAsync)({\n bundleIdentifier: appId,\n bundle: binaryPath,\n appDeltaDirectory: getAppDeltaDirectory(appId),\n udid: props.device.udid,\n deviceName: props.device.name,\n });\n }\n\n return;\n }\n\n XcodeBuild.logPrettyItem(chalk`{bold Installing} on ${props.device.name}`);\n\n const device = await AppleDeviceManager.resolveAsync({ device: props.device });\n await device.installAppAsync(binaryPath);\n\n XcodeBuild.logPrettyItem(chalk`{bold Opening} on ${device.name} {dim (${appId})}`);\n\n if (props.shouldStartBundler) {\n await SimulatorLogStreamer.getStreamer(device.device, {\n appId,\n }).attachAsync();\n }\n\n await manager.getDefaultDevServer().openCustomRuntimeAsync(\n 'simulator',\n {\n applicationId: appId,\n },\n { device }\n );\n}\n\nexport async function getLaunchInfoForBinaryAsync(binaryPath: string): Promise<BinaryLaunchInfo> {\n const builtInfoPlistPath = path.join(binaryPath, 'Info.plist');\n const { CFBundleIdentifier, CFBundleURLTypes } = await parsePlistAsync(builtInfoPlistPath);\n\n let schemes: string[] = [];\n\n if (Array.isArray(CFBundleURLTypes)) {\n schemes =\n CFBundleURLTypes.reduce<string[]>((acc, urlType: unknown) => {\n if (\n urlType &&\n typeof urlType === 'object' &&\n 'CFBundleURLSchemes' in urlType &&\n Array.isArray(urlType.CFBundleURLSchemes)\n ) {\n return [...acc, ...urlType.CFBundleURLSchemes];\n }\n return acc;\n }, []) ?? [];\n }\n\n return { bundleId: CFBundleIdentifier, schemes };\n}\n"],"names":["getLaunchInfoForBinaryAsync","launchAppAsync","binaryPath","manager","props","appId","profile","bundleId","Log","log","chalk","gray","isSimulator","device","osType","launchBinaryOnMacAsync","installOnDeviceAsync","bundleIdentifier","bundle","appDeltaDirectory","getAppDeltaDirectory","udid","deviceName","name","XcodeBuild","logPrettyItem","AppleDeviceManager","resolveAsync","installAppAsync","shouldStartBundler","SimulatorLogStreamer","getStreamer","attachAsync","getDefaultDevServer","openCustomRuntimeAsync","applicationId","builtInfoPlistPath","path","join","CFBundleIdentifier","CFBundleURLTypes","parsePlistAsync","schemes","Array","isArray","reduce","acc","urlType","CFBundleURLSchemes"],"mappings":";;;;;;;;;;;IAmEsBA,2BAA2B;eAA3BA;;IA/CAC,cAAc;eAAdA;;;;gEApBJ;;;;;;;gEACD;;;;;;oEAEW;sCAE+B;qBACvC;oCACe;2BACI;+BACF;uBAEL;yBACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQjB,eAAeA,eACpBC,UAAkB,EAClBC,OAAyB,EACzBC,KAAwE,EACxEC,KAAc;IAEdA,UAAU,AAAC,CAAA,MAAMC,IAAAA,gBAAO,EAACN,6BAA6BE,WAAU,EAAGK,QAAQ;IAE3EC,QAAG,CAACC,GAAG,CAACC,gBAAK,CAACC,IAAI,CAAC,kBAAkB,EAAET,WAAW,CAAC;IACnD,IAAI,CAACE,MAAMQ,WAAW,EAAE;QACtB,IAAIR,MAAMS,MAAM,CAACC,MAAM,KAAK,SAAS;YACnC,MAAM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BAAkB,GACxC;gBACA,OAAO;uBAAIF;uBAAQC,QAAQC,kBAAkB;iBAAC;YAChD;YACA,OAAOF;QACT,GAAG,EAAE,KAAK,EAAE;IAChB;IAEA,OAAO;QAAEvC,UAAUgC;QAAoBG;IAAQ;AACjD"}
1
+ {"version":3,"sources":["../../../../src/run/ios/launchApp.ts"],"sourcesContent":["import chalk from 'chalk';\nimport path from 'path';\n\nimport * as XcodeBuild from './XcodeBuild';\nimport { BuildProps } from './XcodeBuild.types';\nimport { getAppDeltaDirectory, installOnDeviceAsync } from './appleDevice/installOnDeviceAsync';\nimport { Log } from '../../log';\nimport { AppleDeviceManager } from '../../start/platforms/ios/AppleDeviceManager';\nimport { launchBinaryOnMacAsync } from '../../start/platforms/ios/devicectl';\nimport { SimulatorLogStreamer } from '../../start/platforms/ios/simctlLogging';\nimport { DevServerManager } from '../../start/server/DevServerManager';\nimport { parsePlistAsync } from '../../utils/plist';\nimport { profile } from '../../utils/profile';\n\ntype BinaryLaunchInfo = {\n bundleId: string;\n schemes: string[];\n};\n\n/** Install and launch the app binary on a device. */\nexport async function launchAppAsync(\n binaryPath: string,\n manager: DevServerManager,\n props: Pick<BuildProps, 'isSimulator' | 'device' | 'shouldStartBundler'>,\n appId?: string\n) {\n appId ??= (await profile(getLaunchInfoForBinaryAsync)(binaryPath)).bundleId;\n\n Log.log(chalk.gray`\\u203A Installing ${binaryPath}`);\n if (!props.isSimulator) {\n if (props.device.osType === 'macOS') {\n await launchBinaryOnMacAsync(appId, binaryPath);\n } else {\n await profile(installOnDeviceAsync)({\n bundleIdentifier: appId,\n bundle: binaryPath,\n appDeltaDirectory: getAppDeltaDirectory(appId),\n udid: props.device.udid,\n deviceName: props.device.name,\n });\n }\n\n return;\n }\n\n XcodeBuild.logPrettyItem(chalk`{bold Installing} on ${props.device.name}`);\n\n const device = await AppleDeviceManager.resolveAsync({ device: props.device });\n await device.installAppAsync(binaryPath);\n\n XcodeBuild.logPrettyItem(chalk`{bold Opening} on ${device.name} {dim (${appId})}`);\n\n if (props.shouldStartBundler) {\n await SimulatorLogStreamer.getStreamer(device.device, {\n appId,\n }).attachAsync();\n }\n\n await manager.getDefaultDevServer().openCustomRuntimeAsync(\n 'simulator',\n {\n applicationId: appId,\n },\n { device: device.device }\n );\n}\n\nexport async function getLaunchInfoForBinaryAsync(binaryPath: string): Promise<BinaryLaunchInfo> {\n const builtInfoPlistPath = path.join(binaryPath, 'Info.plist');\n const { CFBundleIdentifier, CFBundleURLTypes } = await parsePlistAsync(builtInfoPlistPath);\n\n let schemes: string[] = [];\n\n if (Array.isArray(CFBundleURLTypes)) {\n schemes =\n CFBundleURLTypes.reduce<string[]>((acc, urlType: unknown) => {\n if (\n urlType &&\n typeof urlType === 'object' &&\n 'CFBundleURLSchemes' in urlType &&\n Array.isArray(urlType.CFBundleURLSchemes)\n ) {\n return [...acc, ...urlType.CFBundleURLSchemes];\n }\n return acc;\n }, []) ?? [];\n }\n\n return { bundleId: CFBundleIdentifier, schemes };\n}\n"],"names":["getLaunchInfoForBinaryAsync","launchAppAsync","binaryPath","manager","props","appId","profile","bundleId","Log","log","chalk","gray","isSimulator","device","osType","launchBinaryOnMacAsync","installOnDeviceAsync","bundleIdentifier","bundle","appDeltaDirectory","getAppDeltaDirectory","udid","deviceName","name","XcodeBuild","logPrettyItem","AppleDeviceManager","resolveAsync","installAppAsync","shouldStartBundler","SimulatorLogStreamer","getStreamer","attachAsync","getDefaultDevServer","openCustomRuntimeAsync","applicationId","builtInfoPlistPath","path","join","CFBundleIdentifier","CFBundleURLTypes","parsePlistAsync","schemes","Array","isArray","reduce","acc","urlType","CFBundleURLSchemes"],"mappings":";;;;;;;;;;;IAmEsBA,2BAA2B;eAA3BA;;IA/CAC,cAAc;eAAdA;;;;gEApBJ;;;;;;;gEACD;;;;;;oEAEW;sCAE+B;qBACvC;oCACe;2BACI;+BACF;uBAEL;yBACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQjB,eA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E,UAAkB;IAClE,MAAMkC,qBAAqBC,eAAI,CAACC,IAAI,CAACpC,YAAY;IACjD,MAAM,EAAEqC,kBAAkB,EAAEC,gBAAgB,EAAE,GAAG,MAAMC,IAAAA,sBAAe,EAACL;IAEvE,IAAIM,UAAoB,EAAE;IAE1B,IAAIC,MAAMC,OAAO,CAACJ,mBAAmB;QACnCE,UACEF,iBAAiBK,MAAM,CAAW,CAACC,KAAKC;YACtC,IACEA,WACA,OAAOA,YAAY,YACnB,wBAAwBA,WACxBJ,MAAMC,OAAO,CAACG,QAAQC,kBAAkB,GACxC;gBACA,OAAO;uBAAIF;uBAAQC,QAAQC,kBAAkB;iBAAC;YAChD;YACA,OAAOF;QACT,GAAG,EAAE,KAAK,EAAE;IAChB;IAEA,OAAO;QAAEvC,UAAUgC;QAAoBG;IAAQ;AACjD"}
@@ -92,7 +92,8 @@ class WebSupportProjectPrerequisite extends _Prerequisite.ProjectPrerequisite {
92
92
  const result = await this._shouldSetupWebSupportAsync();
93
93
  // Ensure web packages are installed
94
94
  await this._ensureWebDependenciesInstalledAsync({
95
- exp: result.exp
95
+ exp: result.exp,
96
+ pkg: result.pkg
96
97
  });
97
98
  }
98
99
  /** Exposed for testing. */ async _shouldSetupWebSupportAsync() {
@@ -105,7 +106,7 @@ class WebSupportProjectPrerequisite extends _Prerequisite.ProjectPrerequisite {
105
106
  }
106
107
  return config;
107
108
  }
108
- /** Exposed for testing. */ async _ensureWebDependenciesInstalledAsync({ exp }) {
109
+ /** Exposed for testing. */ async _ensureWebDependenciesInstalledAsync({ exp, pkg }) {
109
110
  const requiredPackages = [
110
111
  {
111
112
  file: 'react-dom/package.json',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/doctor/web/WebSupportProjectPrerequisite.ts"],"sourcesContent":["import {\n AppJSONConfig,\n ExpoConfig,\n getConfig,\n getProjectConfigDescriptionWithPaths,\n ProjectConfig,\n} from '@expo/config';\nimport chalk from 'chalk';\n\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { getPlatformBundlers } from '../../server/platformBundlers';\nimport { PrerequisiteCommandError, ProjectPrerequisite } from '../Prerequisite';\nimport { ensureDependenciesAsync } from '../dependencies/ensureDependenciesAsync';\nimport { ResolvedPackage } from '../dependencies/getMissingPackages';\n\nconst debug = require('debug')('expo:doctor:webSupport') as typeof console.log;\n\n/** Ensure the project has the required web support settings. */\nexport class WebSupportProjectPrerequisite extends ProjectPrerequisite {\n /** Ensure a project that hasn't explicitly disabled web support has all the required packages for running in the browser. */\n async assertImplementation(): Promise<void> {\n if (env.EXPO_NO_WEB_SETUP) {\n Log.warn('Skipping web setup: EXPO_NO_WEB_SETUP is enabled.');\n return;\n }\n debug('Ensuring web support is setup');\n\n const result = await this._shouldSetupWebSupportAsync();\n\n // Ensure web packages are installed\n await this._ensureWebDependenciesInstalledAsync({ exp: result.exp });\n }\n\n /** Exposed for testing. */\n async _shouldSetupWebSupportAsync(): Promise<ProjectConfig> {\n const config = getConfig(this.projectRoot);\n\n // Detect if the 'web' string is purposefully missing from the platforms array.\n if (isWebPlatformExcluded(config.rootConfig)) {\n // Get exact config description with paths.\n const configName = getProjectConfigDescriptionWithPaths(this.projectRoot, config);\n throw new PrerequisiteCommandError(\n 'WEB_SUPPORT',\n chalk`Skipping web setup: {bold \"web\"} is not included in the project ${configName} {bold \"platforms\"} array.`\n );\n }\n\n return config;\n }\n\n /** Exposed for testing. */\n async _ensureWebDependenciesInstalledAsync({ exp }: { exp: ExpoConfig }): Promise<boolean> {\n const requiredPackages: ResolvedPackage[] = [\n { file: 'react-dom/package.json', pkg: 'react-dom' },\n ];\n if (!env.EXPO_NO_REACT_NATIVE_WEB) {\n // use react-native-web/package.json to skip node module cache issues when the user installs\n // the package and attempts to resolve the module in the same process.\n requiredPackages.push({ file: 'react-native-web/package.json', pkg: 'react-native-web' });\n }\n\n const bundler = getPlatformBundlers(this.projectRoot, exp).web;\n // Only include webpack-config if bundler is webpack.\n if (bundler === 'webpack') {\n requiredPackages.push(\n // `webpack` and `webpack-dev-server` should be installed in the `@expo/webpack-config`\n {\n file: '@expo/webpack-config/package.json',\n pkg: '@expo/webpack-config',\n dev: true,\n }\n );\n } else if (bundler === 'metro') {\n // NOTE(@kitten): We used to require `@expo/metro-runtime` here but part of what we required from\n // it has moved out of that package (async-require). Hence, this isn't needed anymore, and if\n // a user has `expo-router`, this is fulfilled anyway.\n /*requiredPackages.push({\n file: '@expo/metro-runtime/package.json',\n pkg: '@expo/metro-runtime',\n });*/\n }\n\n try {\n return await ensureDependenciesAsync(this.projectRoot, {\n // This never seems to work when prompting, installing, and running -- instead just inform the user to run the install command and try again.\n skipPrompt: true,\n isProjectMutable: false,\n exp,\n installMessage: `It looks like you're trying to use web support but don't have the required dependencies installed.`,\n warningMessage: chalk`If you're not using web, please ensure you remove the {bold \"web\"} string from the platforms array in the project Expo config.`,\n requiredPackages,\n });\n } catch (error) {\n // Reset the cached check so we can re-run the check if the user re-runs the command by pressing 'w' in the Terminal UI.\n this.resetAssertion();\n throw error;\n }\n }\n}\n\n/** Return `true` if the `web` platform is purposefully excluded from the project Expo config. */\nexport function isWebPlatformExcluded(rootConfig: AppJSONConfig): boolean {\n // Detect if the 'web' string is purposefully missing from the platforms array.\n const isWebExcluded =\n Array.isArray(rootConfig?.expo?.platforms) &&\n !!rootConfig.expo?.platforms.length &&\n !rootConfig.expo?.platforms.includes('web');\n return isWebExcluded;\n}\n"],"names":["WebSupportProjectPrerequisite","isWebPlatformExcluded","debug","require","ProjectPrerequisite","assertImplementation","env","EXPO_NO_WEB_SETUP","Log","warn","result","_shouldSetupWebSupportAsync","_ensureWebDependenciesInstalledAsync","exp","config","getConfig","projectRoot","rootConfig","configName","getProjectConfigDescriptionWithPaths","PrerequisiteCommandError","chalk","requiredPackages","file","pkg","EXPO_NO_REACT_NATIVE_WEB","push","bundler","getPlatformBundlers","web","dev","ensureDependenciesAsync","skipPrompt","isProjectMutable","installMessage","warningMessage","error","resetAssertion","isWebExcluded","Array","is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AAC,IAAI,CAACZ,WAAW,EAAEH,KAAKgB,GAAG;QAC9D,qDAAqD;QACrD,IAAIF,YAAY,WAAW;YACzBL,iBAAiBI,IAAI,CACnB,uFAAuF;YACvF;gBACEH,MAAM;gBACNC,KAAK;gBACLM,KAAK;YACP;QAEJ,OAAO,IAAIH,YAAY,SAAS;QAC9B,iGAAiG;QACjG,6FAA6F;QAC7F,sDAAsD;QACtD;;;SAGG,GACL;QAEA,IAAI;YACF,OAAO,MAAMI,IAAAA,gDAAuB,EAAC,IAAI,CAACf,WAAW,EAAE;gBACrD,6IAA6I;gBAC7IgB,YAAY;gBACZC,kBAAkB;gBAClBpB;gBACAqB,gBAAgB,CAAC,kGAAkG,CAAC;gBACpHC,gBAAgBd,IAAAA,gBAAK,CAAA,CAAC,8HAA8H,CAAC;gBACrJC;YACF;QACF,EAAE,OAAOc,OAAO;YACd,wHAAwH;YACxH,IAAI,CAACC,cAAc;YACnB,MAAMD;QACR;IACF;AACF;AAGO,SAASnC,sBAAsBgB,UAAyB;QAG7CA,kBACZA,mBACDA;IAJH,+EAA+E;IAC/E,MAAMqB,gBACJC,MAAMC,OAAO,CAACvB,+BAAAA,mBAAAA,WAAYwB,IAAI,qBAAhBxB,iBAAkByB,SAAS,KACzC,CAAC,GAACzB,oBAAAA,WAAWwB,IAAI,qBAAfxB,kBAAiByB,SAAS,CAACC,MAAM,KACnC,GAAC1B,oBAAAA,WAAWwB,IAAI,qBAAfxB,kBAAiByB,SAAS,CAACE,QAAQ,CAAC;IACvC,OAAON;AACT"}
1
+ {"version":3,"sources":["../../../../../src/start/doctor/web/WebSupportProjectPrerequisite.ts"],"sourcesContent":["import {\n AppJSONConfig,\n ExpoConfig,\n getConfig,\n getProjectConfigDescriptionWithPaths,\n PackageJSONConfig,\n ProjectConfig,\n} from '@expo/config';\nimport chalk from 'chalk';\n\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { getPlatformBundlers } from '../../server/platformBundlers';\nimport { PrerequisiteCommandError, ProjectPrerequisite } from '../Prerequisite';\nimport { ensureDependenciesAsync } from '../dependencies/ensureDependenciesAsync';\nimport { ResolvedPackage } from '../dependencies/getMissingPackages';\n\nconst debug = require('debug')('expo:doctor:webSupport') as typeof console.log;\n\n/** Ensure the project has the required web support settings. */\nexport class WebSupportProjectPrerequisite extends ProjectPrerequisite {\n /** Ensure a project that hasn't explicitly disabled web support has all the required packages for running in the browser. */\n async assertImplementation(): Promise<void> {\n if (env.EXPO_NO_WEB_SETUP) {\n Log.warn('Skipping web setup: EXPO_NO_WEB_SETUP is enabled.');\n return;\n }\n debug('Ensuring web support is setup');\n\n const result = await this._shouldSetupWebSupportAsync();\n\n // Ensure web packages are installed\n await this._ensureWebDependenciesInstalledAsync({ exp: result.exp, pkg: result.pkg });\n }\n\n /** Exposed for testing. */\n async _shouldSetupWebSupportAsync(): Promise<ProjectConfig> {\n const config = getConfig(this.projectRoot);\n\n // Detect if the 'web' string is purposefully missing from the platforms array.\n if (isWebPlatformExcluded(config.rootConfig)) {\n // Get exact config description with paths.\n const configName = getProjectConfigDescriptionWithPaths(this.projectRoot, config);\n throw new PrerequisiteCommandError(\n 'WEB_SUPPORT',\n chalk`Skipping web setup: {bold \"web\"} is not included in the project ${configName} {bold \"platforms\"} array.`\n );\n }\n\n return config;\n }\n\n /** Exposed for testing. */\n async _ensureWebDependenciesInstalledAsync({\n exp,\n pkg,\n }: {\n exp: ExpoConfig;\n pkg: PackageJSONConfig;\n }): Promise<boolean> {\n const requiredPackages: ResolvedPackage[] = [\n { file: 'react-dom/package.json', pkg: 'react-dom' },\n ];\n if (!env.EXPO_NO_REACT_NATIVE_WEB) {\n // use react-native-web/package.json to skip node module cache issues when the user installs\n // the package and attempts to resolve the module in the same process.\n requiredPackages.push({ file: 'react-native-web/package.json', pkg: 'react-native-web' });\n }\n\n const bundler = getPlatformBundlers(this.projectRoot, exp).web;\n // Only include webpack-config if bundler is webpack.\n if (bundler === 'webpack') {\n requiredPackages.push(\n // `webpack` and `webpack-dev-server` should be installed in the `@expo/webpack-config`\n {\n file: '@expo/webpack-config/package.json',\n pkg: '@expo/webpack-config',\n dev: true,\n }\n );\n } else if (bundler === 'metro') {\n // NOTE(@kitten): We used to require `@expo/metro-runtime` here but part of what we required from\n // it has moved out of that package (async-require). Hence, this isn't needed anymore, and if\n // a user has `expo-router`, this is fulfilled anyway.\n /*requiredPackages.push({\n file: '@expo/metro-runtime/package.json',\n pkg: '@expo/metro-runtime',\n });*/\n }\n\n try {\n return await ensureDependenciesAsync(this.projectRoot, {\n // This never seems to work when prompting, installing, and running -- instead just inform the user to run the install command and try again.\n skipPrompt: true,\n isProjectMutable: false,\n exp,\n installMessage: `It looks like you're trying to use web support but don't have the required dependencies installed.`,\n warningMessage: chalk`If you're not using web, please ensure you remove the {bold \"web\"} string from the platforms array in the project Expo config.`,\n requiredPackages,\n });\n } catch (error) {\n // Reset the cached check so we can re-run the check if the user re-runs the command by pressing 'w' in the Terminal UI.\n this.resetAssertion();\n throw error;\n }\n }\n}\n\n/** Return `true` if the `web` platform is purposefully excluded from the project Expo config. */\nexport function isWebPlatformExcluded(rootConfig: AppJSONConfig): boolean {\n // Detect if the 'web' string is purposefully missing from the platforms array.\n const isWebExcluded =\n Array.isArray(rootConfig?.expo?.platforms) &&\n !!rootConfig.expo?.platforms.length &&\n !rootConfig.expo?.platforms.includes('web');\n return isWebExcluded;\n}\n"],"names":["WebSupportProjectPrerequisite","isWebPlatformExcluded","debug","require","ProjectPrerequisite","assertImplementation","env","EXPO_NO_WEB_SETUP","Log","warn","result","_shouldSetupWebSupportAsync","_ensureWebDependenciesInstalledAsync","exp","pkg","config","getConfig","projectRoot","rootConfig","configName","getProjectConfigDescriptionWithPaths","PrerequisiteCommandError","chalk","requiredPackages","file","EXPO_NO_REACT_NATIVE_WEB","push","bundler","getPlatformBundlers","web","dev","ensureDependenciesAsync","skipPrompt","isProjectMutable","installMessage","warningMessage","error","resetAssertion","isWebExcluded","Array","isArray","expo","platforms","length","includes"],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