@expo/cli 1.0.0-canary-20250729-d8899ae → 54.0.1

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 (101) hide show
  1. package/build/bin/cli +1 -1
  2. package/build/metro-require/require.js +24 -13
  3. package/build/src/api/getExpoSchema.js +8 -7
  4. package/build/src/api/getExpoSchema.js.map +1 -1
  5. package/build/src/expoUpdatesExports.js +28 -0
  6. package/build/src/expoUpdatesExports.js.map +1 -0
  7. package/build/src/export/embed/exportEmbedAsync.js +4 -2
  8. package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
  9. package/build/src/export/exportApp.js +7 -4
  10. package/build/src/export/exportApp.js.map +1 -1
  11. package/build/src/export/exportAssets.js +20 -4
  12. package/build/src/export/exportAssets.js.map +1 -1
  13. package/build/src/export/exportHermes.js +34 -9
  14. package/build/src/export/exportHermes.js.map +1 -1
  15. package/build/src/export/exportStaticAsync.js +19 -2
  16. package/build/src/export/exportStaticAsync.js.map +1 -1
  17. package/build/src/export/index.js +1 -0
  18. package/build/src/export/index.js.map +1 -1
  19. package/build/src/export/resolveOptions.js +1 -0
  20. package/build/src/export/resolveOptions.js.map +1 -1
  21. package/build/src/export/saveAssets.js +12 -0
  22. package/build/src/export/saveAssets.js.map +1 -1
  23. package/build/src/install/checkPackages.js +9 -1
  24. package/build/src/install/checkPackages.js.map +1 -1
  25. package/build/src/lint/lintAsync.js +2 -0
  26. package/build/src/lint/lintAsync.js.map +1 -1
  27. package/build/src/prebuild/prebuildAsync.js +18 -0
  28. package/build/src/prebuild/prebuildAsync.js.map +1 -1
  29. package/build/src/prebuild/resolveLocalTemplate.js +42 -0
  30. package/build/src/prebuild/resolveLocalTemplate.js.map +1 -0
  31. package/build/src/prebuild/resolveTemplate.js +17 -7
  32. package/build/src/prebuild/resolveTemplate.js.map +1 -1
  33. package/build/src/prebuild/updateFromTemplate.js +1 -0
  34. package/build/src/prebuild/updateFromTemplate.js.map +1 -1
  35. package/build/src/prebuild/updatePackageJson.js +5 -3
  36. package/build/src/prebuild/updatePackageJson.js.map +1 -1
  37. package/build/src/run/android/resolveOptions.js +2 -2
  38. package/build/src/run/android/resolveOptions.js.map +1 -1
  39. package/build/src/run/ios/options/resolveOptions.js +2 -2
  40. package/build/src/run/ios/options/resolveOptions.js.map +1 -1
  41. package/build/src/run/ios/runIosAsync.js +3 -0
  42. package/build/src/run/ios/runIosAsync.js.map +1 -1
  43. package/build/src/serve/serveAsync.js +5 -2
  44. package/build/src/serve/serveAsync.js.map +1 -1
  45. package/build/src/start/platforms/ExpoGoInstaller.js +1 -1
  46. package/build/src/start/platforms/ExpoGoInstaller.js.map +1 -1
  47. package/build/src/start/server/DevToolsPluginManager.js +7 -35
  48. package/build/src/start/server/DevToolsPluginManager.js.map +1 -1
  49. package/build/src/start/server/metro/MetroBundlerDevServer.js +68 -29
  50. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
  51. package/build/src/start/server/metro/MetroTerminalReporter.js +63 -18
  52. package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
  53. package/build/src/start/server/metro/createExpoAutolinkingResolver.js +121 -0
  54. package/build/src/start/server/metro/createExpoAutolinkingResolver.js.map +1 -0
  55. package/build/src/start/server/metro/createServerComponentsMiddleware.js +4 -4
  56. package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
  57. package/build/src/start/server/metro/createServerRouteMiddleware.js +54 -8
  58. package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
  59. package/build/src/start/server/metro/dev-server/createMetroMiddleware.js +1 -1
  60. package/build/src/start/server/metro/dev-server/createMetroMiddleware.js.map +1 -1
  61. package/build/src/start/server/metro/fetchRouterManifest.js +1 -0
  62. package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
  63. package/build/src/start/server/metro/instantiateMetro.js +20 -18
  64. package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
  65. package/build/src/start/server/metro/metroErrorInterface.js +20 -13
  66. package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
  67. package/build/src/start/server/metro/router.js +75 -0
  68. package/build/src/start/server/metro/router.js.map +1 -1
  69. package/build/src/start/server/metro/serializeHtml.js +45 -5
  70. package/build/src/start/server/metro/serializeHtml.js.map +1 -1
  71. package/build/src/start/server/metro/withMetroErrorReportingResolver.js +267 -0
  72. package/build/src/start/server/metro/withMetroErrorReportingResolver.js.map +1 -0
  73. package/build/src/start/server/metro/withMetroMultiPlatform.js +50 -35
  74. package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
  75. package/build/src/start/server/metro/withMetroResolvers.js +0 -176
  76. package/build/src/start/server/metro/withMetroResolvers.js.map +1 -1
  77. package/build/src/start/server/metro/withMetroSupervisingTransformWorker.js +63 -0
  78. package/build/src/start/server/metro/withMetroSupervisingTransformWorker.js.map +1 -0
  79. package/build/src/start/server/middleware/createBuiltinAPIRequestHandler.js +1 -1
  80. package/build/src/start/server/middleware/createBuiltinAPIRequestHandler.js.map +1 -1
  81. package/build/src/start/server/middleware/metroOptions.js +7 -2
  82. package/build/src/start/server/middleware/metroOptions.js.map +1 -1
  83. package/build/src/start/server/serverLogLikeMetro.js +13 -11
  84. package/build/src/start/server/serverLogLikeMetro.js.map +1 -1
  85. package/build/src/utils/build-cache-providers/index.js.map +1 -1
  86. package/build/src/utils/dir.js +7 -0
  87. package/build/src/utils/dir.js.map +1 -1
  88. package/build/src/utils/env.js +3 -1
  89. package/build/src/utils/env.js.map +1 -1
  90. package/build/src/utils/errors.js +1 -1
  91. package/build/src/utils/errors.js.map +1 -1
  92. package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
  93. package/build/src/utils/telemetry/utils/context.js +1 -1
  94. package/internal/unstable-expo-updates-exports.d.ts +31 -0
  95. package/internal/unstable-expo-updates-exports.js +3 -0
  96. package/package.json +33 -18
  97. package/static/template/[...rsc]+api.ts +1 -1
  98. package/build/src/start/server/metro/createExpoStickyResolver.js +0 -137
  99. package/build/src/start/server/metro/createExpoStickyResolver.js.map +0 -1
  100. package/build/src/utils/jsonSchemaDeref.js +0 -150
  101. package/build/src/utils/jsonSchemaDeref.js.map +0 -1
package/build/bin/cli CHANGED
@@ -123,7 +123,7 @@ const args = (0, _arg().default)({
123
123
  });
124
124
  if (args['--version']) {
125
125
  // Version is added in the build script.
126
- console.log("1.0.0-canary-20250729-d8899ae");
126
+ console.log("54.0.1");
127
127
  process.exit(0);
128
128
  }
129
129
  if (args['--non-interactive']) {
@@ -10,8 +10,8 @@ const EMPTY = {};
10
10
  const CYCLE_DETECTED = {};
11
11
  const { hasOwnProperty } = {};
12
12
  if (__DEV__) {
13
- global.$RefreshReg$ = ()=>{};
14
- global.$RefreshSig$ = ()=>(type)=>type;
13
+ global.$RefreshReg$ = global.$RefreshReg$ ?? (()=>{});
14
+ global.$RefreshSig$ = global.$RefreshSig$ ?? (()=>(type)=>type);
15
15
  }
16
16
  function clear() {
17
17
  modules = new Map();
@@ -51,6 +51,12 @@ function define(factory, moduleId, dependencyMap) {
51
51
  }
52
52
  }
53
53
  function metroRequire(moduleId, moduleIdHint) {
54
+ if (moduleId === null) {
55
+ if (__DEV__ && typeof moduleIdHint === 'string') {
56
+ throw new Error("Cannot find module '" + moduleIdHint + "'");
57
+ }
58
+ throw new Error('Cannot find module');
59
+ }
54
60
  if (__DEV__) {
55
61
  const initializingIndex = initializingModuleIds.indexOf(moduleId);
56
62
  if (initializingIndex !== -1) {
@@ -232,7 +238,8 @@ function loadModuleImplementation(moduleId, module, moduleIdHint) {
232
238
  if (Refresh != null) {
233
239
  const RefreshRuntime = Refresh;
234
240
  global.$RefreshReg$ = (type, id)=>{
235
- RefreshRuntime.register(type, moduleId + ' ' + id);
241
+ const prefixedModuleId = __METRO_GLOBAL_PREFIX__ + ' ' + moduleId + ' ' + id;
242
+ RefreshRuntime.register(type, prefixedModuleId);
236
243
  };
237
244
  global.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
238
245
  }
@@ -246,7 +253,8 @@ function loadModuleImplementation(moduleId, module, moduleIdHint) {
246
253
  if (__DEV__) {
247
254
  Systrace.endEvent();
248
255
  if (Refresh != null) {
249
- registerExportsForReactRefresh(Refresh, moduleObject.exports, moduleId);
256
+ const prefixedModuleId = __METRO_GLOBAL_PREFIX__ + ' ' + moduleId;
257
+ registerExportsForReactRefresh(Refresh, moduleObject.exports, prefixedModuleId);
250
258
  }
251
259
  }
252
260
  return moduleObject.exports;
@@ -512,6 +520,14 @@ if (__DEV__) {
512
520
  }
513
521
  }
514
522
  };
523
+ var isSpecifierSafeToCheck = (moduleExports, key)=>{
524
+ if (moduleExports && moduleExports.__esModule) {
525
+ return true;
526
+ } else {
527
+ const desc = Object.getOwnPropertyDescriptor(moduleExports, key);
528
+ return !desc || !desc.get;
529
+ }
530
+ };
515
531
  var isReactRefreshBoundary = function(Refresh, moduleExports) {
516
532
  if (Refresh.isLikelyComponentType(moduleExports)) {
517
533
  return true;
@@ -525,9 +541,7 @@ if (__DEV__) {
525
541
  hasExports = true;
526
542
  if (key === '__esModule') {
527
543
  continue;
528
- }
529
- const desc = Object.getOwnPropertyDescriptor(moduleExports, key);
530
- if (desc && desc.get) {
544
+ } else if (!isSpecifierSafeToCheck(moduleExports, key)) {
531
545
  return false;
532
546
  }
533
547
  const exportValue = moduleExports[key];
@@ -559,9 +573,7 @@ if (__DEV__) {
559
573
  for(const key in moduleExports){
560
574
  if (key === '__esModule') {
561
575
  continue;
562
- }
563
- const desc = Object.getOwnPropertyDescriptor(moduleExports, key);
564
- if (desc && desc.get) {
576
+ } else if (!isSpecifierSafeToCheck(moduleExports, key)) {
565
577
  continue;
566
578
  }
567
579
  const exportValue = moduleExports[key];
@@ -576,8 +588,7 @@ if (__DEV__) {
576
588
  return;
577
589
  }
578
590
  for(const key in moduleExports){
579
- const desc = Object.getOwnPropertyDescriptor(moduleExports, key);
580
- if (desc && desc.get) {
591
+ if (!isSpecifierSafeToCheck(moduleExports, key)) {
581
592
  continue;
582
593
  }
583
594
  const exportValue = moduleExports[key];
@@ -592,6 +603,6 @@ if (__DEV__) {
592
603
  return global[__METRO_GLOBAL_PREFIX__ + '__SYSTRACE'] || metroRequire.Systrace;
593
604
  };
594
605
  var requireRefresh = function requireRefresh() {
595
- return global[__METRO_GLOBAL_PREFIX__ + '__ReactRefresh'] || metroRequire.Refresh;
606
+ return global[__METRO_GLOBAL_PREFIX__ + '__ReactRefresh'] || global[global.__METRO_GLOBAL_PREFIX__ + '__ReactRefresh'] || metroRequire.Refresh;
596
607
  };
597
608
  }
@@ -16,6 +16,13 @@ _export(exports, {
16
16
  return getAssetSchemasAsync;
17
17
  }
18
18
  });
19
+ function _schemautils() {
20
+ const data = require("@expo/schema-utils");
21
+ _schemautils = function() {
22
+ return data;
23
+ };
24
+ return data;
25
+ }
19
26
  function _fs() {
20
27
  const data = /*#__PURE__*/ _interop_require_default(require("fs"));
21
28
  _fs = function() {
@@ -33,7 +40,6 @@ function _path() {
33
40
  const _client = require("./rest/client");
34
41
  const _env = require("../utils/env");
35
42
  const _errors = require("../utils/errors");
36
- const _jsonSchemaDeref = require("../utils/jsonSchemaDeref");
37
43
  function _interop_require_default(obj) {
38
44
  return obj && obj.__esModule ? obj : {
39
45
  default: obj
@@ -42,12 +48,7 @@ function _interop_require_default(obj) {
42
48
  const schemaJson = {};
43
49
  async function _getSchemaAsync(sdkVersion) {
44
50
  const json = await getSchemaJSONAsync(sdkVersion);
45
- // NOTE(@kitten): This is a replacement for the `json-schema-deref-sync` package.
46
- // We re-implemented it locally to remove it, since it comes with heavy dependencies
47
- // and a large install time impact.
48
- // The tests have been ported to match the behaviour closely, but we removed
49
- // local file ref support. For our purposes the behaviour should be identical.
50
- return (0, _jsonSchemaDeref.jsonSchemaDeref)(json.schema);
51
+ return (0, _schemautils().derefSchema)(json.schema);
51
52
  }
52
53
  async function getAssetSchemasAsync(sdkVersion = 'UNVERSIONED') {
53
54
  // If no SDK version is available then fall back to unversioned
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/api/getExpoSchema.ts"],"sourcesContent":["import { JSONObject } from '@expo/json-file';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { createCachedFetch, getResponseDataOrThrow } from './rest/client';\nimport { env } from '../utils/env';\nimport { CommandError } from '../utils/errors';\nimport { jsonSchemaDeref } from '../utils/jsonSchemaDeref';\n\nexport type Schema = any;\n\nexport type AssetSchema = {\n fieldPath: string;\n};\n\nconst schemaJson: { [sdkVersion: string]: Schema } = {};\n\nexport async function _getSchemaAsync(sdkVersion: string): Promise<Schema> {\n const json = await getSchemaJSONAsync(sdkVersion);\n // NOTE(@kitten): This is a replacement for the `json-schema-deref-sync` package.\n // We re-implemented it locally to remove it, since it comes with heavy dependencies\n // and a large install time impact.\n // The tests have been ported to match the behaviour closely, but we removed\n // local file ref support. For our purposes the behaviour should be identical.\n return jsonSchemaDeref(json.schema);\n}\n\n/**\n * Array of schema nodes that refer to assets along with their field path (eg. 'notification.icon')\n *\n * @param sdkVersion\n */\nexport async function getAssetSchemasAsync(sdkVersion: string = 'UNVERSIONED'): Promise<string[]> {\n // If no SDK version is available then fall back to unversioned\n const schema = await _getSchemaAsync(sdkVersion);\n const assetSchemas: string[] = [];\n const visit = (node: Schema, fieldPath: string) => {\n if (node.meta && node.meta.asset) {\n assetSchemas.push(fieldPath);\n }\n const properties = node.properties;\n if (properties) {\n Object.keys(properties).forEach((property) =>\n visit(properties[property], `${fieldPath}${fieldPath.length > 0 ? '.' : ''}${property}`)\n );\n }\n };\n visit(schema, '');\n\n return assetSchemas;\n}\n\nasync function getSchemaJSONAsync(sdkVersion: string): Promise<{ schema: Schema }> {\n if (env.EXPO_UNIVERSE_DIR) {\n return JSON.parse(\n fs\n .readFileSync(\n path.join(\n env.EXPO_UNIVERSE_DIR,\n 'server',\n 'www',\n 'xdl-schemas',\n 'UNVERSIONED-schema.json'\n )\n )\n .toString()\n );\n }\n\n if (!schemaJson[sdkVersion]) {\n try {\n schemaJson[sdkVersion] = await getConfigurationSchemaAsync(sdkVersion);\n } catch (e: any) {\n if (e.code === 'INVALID_JSON') {\n throw new CommandError('INVALID_JSON', `Couldn't read schema from server`);\n }\n\n throw e;\n }\n }\n\n return schemaJson[sdkVersion];\n}\n\nasync function getConfigurationSchemaAsync(sdkVersion: string): Promise<JSONObject> {\n // Reconstruct the cached fetch since caching could be disabled.\n const fetchAsync = createCachedFetch({\n cacheDirectory: 'schema-cache',\n // We'll use a 1 week cache for versions so older versions get flushed out eventually.\n ttl: 1000 * 60 * 60 * 24 * 7,\n });\n const response = await fetchAsync(`project/configuration/schema/${sdkVersion}`);\n const json = await response.json();\n\n return getResponseDataOrThrow<JSONObject>(json);\n}\n"],"names":["_getSchemaAsync","getAssetSchemasAsync","schemaJson","sdkVersion","json","getSchemaJSONAsync","jsonSchemaDeref","schema","assetSchemas","visit","node","fieldPath","meta","asset","push","properties","Object","keys","forEach","property","length","env","EXPO_UNIVERSE_DIR","JSON","parse","fs","readFileSync","path","join","toString","getConfigurationSchemaAsync","e","code","CommandError","fetchAsync","createCachedFetch","cacheDirectory","ttl","response","getResponseDataOrThrow"],"mappings":";;;;;;;;;;;IAiBsBA,eAAe;eAAfA;;IAeAC,oBAAoB;eAApBA;;;;gEA/BP;;;;;;;gEACE;;;;;;wBAEyC;qBACtC;wBACS;iCACG;;;;;;AAQhC,MAAMC,aAA+C,CAAC;AAE/C,eAAeF,gBAAgBG,UAAkB;IACtD,MAAMC,OAAO,MAAMC,mBAAmBF;IACtC,iFAAiF;IACjF,oFAAoF;IACpF,mCAAmC;IACnC,4EAA4E;IAC5E,8EAA8E;IAC9E,OAAOG,IAAAA,gCAAe,EAACF,KAAKG,MAAM;AACpC;AAOO,eAAeN,qBAAqBE,aAAqB,aAAa;IAC3E,+DAA+D;IAC/D,MAAMI,SAAS,MAAMP,gBAAgBG;IACrC,MAAMK,eAAyB,EAAE;IACjC,MAAMC,QAAQ,CAACC,MAAcC;QAC3B,IAAID,KAAKE,IAAI,IAAIF,KAAKE,IAAI,CAACC,KAAK,EAAE;YAChCL,aAAaM,IAAI,CAACH;QACpB;QACA,MAAMI,aAAaL,KAAKK,UAAU;QAClC,IAAIA,YAAY;YACdC,OAAOC,IAAI,CAACF,YAAYG,OAAO,CAAC,CAACC,WAC/BV,MAAMM,UAAU,CAACI,SAAS,EAAE,GAAGR,YAAYA,UAAUS,MAAM,GAAG,IAAI,MAAM,KAAKD,UAAU;QAE3F;IACF;IACAV,MAAMF,QAAQ;IAEd,OAAOC;AACT;AAEA,eAAeH,mBAAmBF,UAAkB;IAClD,IAAIkB,QAAG,CAACC,iBAAiB,EAAE;QACzB,OAAOC,KAAKC,KAAK,CACfC,aAAE,CACCC,YAAY,CACXC,eAAI,CAACC,IAAI,CACPP,QAAG,CAACC,iBAAiB,EACrB,UACA,OACA,eACA,4BAGHO,QAAQ;IAEf;IAEA,IAAI,CAAC3B,UAAU,CAACC,WAAW,EAAE;QAC3B,IAAI;YACFD,UAAU,CAACC,WAAW,GAAG,MAAM2B,4BAA4B3B;QAC7D,EAAE,OAAO4B,GAAQ;YACf,IAAIA,EAAEC,IAAI,KAAK,gBAAgB;gBAC7B,MAAM,IAAIC,oBAAY,CAAC,gBAAgB,CAAC,gCAAgC,CAAC;YAC3E;YAEA,MAAMF;QACR;IACF;IAEA,OAAO7B,UAAU,CAACC,WAAW;AAC/B;AAEA,eAAe2B,4BAA4B3B,UAAkB;IAC3D,gEAAgE;IAChE,MAAM+B,aAAaC,IAAAA,yBAAiB,EAAC;QACnCC,gBAAgB;QAChB,sFAAsF;QACtFC,KAAK,OAAO,KAAK,KAAK,KAAK;IAC7B;IACA,MAAMC,WAAW,MAAMJ,WAAW,CAAC,6BAA6B,EAAE/B,YAAY;IAC9E,MAAMC,OAAO,MAAMkC,SAASlC,IAAI;IAEhC,OAAOmC,IAAAA,8BAAsB,EAAanC;AAC5C"}
1
+ {"version":3,"sources":["../../../src/api/getExpoSchema.ts"],"sourcesContent":["import type { JSONObject } from '@expo/json-file';\nimport { derefSchema } from '@expo/schema-utils';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { createCachedFetch, getResponseDataOrThrow } from './rest/client';\nimport { env } from '../utils/env';\nimport { CommandError } from '../utils/errors';\n\nexport type Schema = any;\n\nexport type AssetSchema = {\n fieldPath: string;\n};\n\nconst schemaJson: { [sdkVersion: string]: Schema } = {};\n\nexport async function _getSchemaAsync(sdkVersion: string): Promise<Schema> {\n const json = await getSchemaJSONAsync(sdkVersion);\n return derefSchema(json.schema);\n}\n\n/**\n * Array of schema nodes that refer to assets along with their field path (eg. 'notification.icon')\n *\n * @param sdkVersion\n */\nexport async function getAssetSchemasAsync(sdkVersion: string = 'UNVERSIONED'): Promise<string[]> {\n // If no SDK version is available then fall back to unversioned\n const schema = await _getSchemaAsync(sdkVersion);\n const assetSchemas: string[] = [];\n const visit = (node: Schema, fieldPath: string) => {\n if (node.meta && node.meta.asset) {\n assetSchemas.push(fieldPath);\n }\n const properties = node.properties;\n if (properties) {\n Object.keys(properties).forEach((property) =>\n visit(properties[property], `${fieldPath}${fieldPath.length > 0 ? '.' : ''}${property}`)\n );\n }\n };\n visit(schema, '');\n\n return assetSchemas;\n}\n\nasync function getSchemaJSONAsync(sdkVersion: string): Promise<{ schema: Schema }> {\n if (env.EXPO_UNIVERSE_DIR) {\n return JSON.parse(\n fs\n .readFileSync(\n path.join(\n env.EXPO_UNIVERSE_DIR,\n 'server',\n 'www',\n 'xdl-schemas',\n 'UNVERSIONED-schema.json'\n )\n )\n .toString()\n );\n }\n\n if (!schemaJson[sdkVersion]) {\n try {\n schemaJson[sdkVersion] = await getConfigurationSchemaAsync(sdkVersion);\n } catch (e: any) {\n if (e.code === 'INVALID_JSON') {\n throw new CommandError('INVALID_JSON', `Couldn't read schema from server`);\n }\n\n throw e;\n }\n }\n\n return schemaJson[sdkVersion];\n}\n\nasync function getConfigurationSchemaAsync(sdkVersion: string): Promise<JSONObject> {\n // Reconstruct the cached fetch since caching could be disabled.\n const fetchAsync = createCachedFetch({\n cacheDirectory: 'schema-cache',\n // We'll use a 1 week cache for versions so older versions get flushed out eventually.\n ttl: 1000 * 60 * 60 * 24 * 7,\n });\n const response = await fetchAsync(`project/configuration/schema/${sdkVersion}`);\n const json = await response.json();\n\n return getResponseDataOrThrow<JSONObject>(json);\n}\n"],"names":["_getSchemaAsync","getAssetSchemasAsync","schemaJson","sdkVersion","json","getSchemaJSONAsync","derefSchema","schema","assetSchemas","visit","node","fieldPath","meta","asset","push","properties","Object","keys","forEach","property","length","env","EXPO_UNIVERSE_DIR","JSON","parse","fs","readFileSync","path","join","toString","getConfigurationSchemaAsync","e","code","CommandError","fetchAsync","createCachedFetch","cacheDirectory","ttl","response","getResponseDataOrThrow"],"mappings":";;;;;;;;;;;IAiBsBA,eAAe;eAAfA;;IAUAC,oBAAoB;eAApBA;;;;yBA1BM;;;;;;;gEACb;;;;;;;gEACE;;;;;;wBAEyC;qBACtC;wBACS;;;;;;AAQ7B,MAAMC,aAA+C,CAAC;AAE/C,eAAeF,gBAAgBG,UAAkB;IACtD,MAAMC,OAAO,MAAMC,mBAAmBF;IACtC,OAAOG,IAAAA,0BAAW,EAACF,KAAKG,MAAM;AAChC;AAOO,eAAeN,qBAAqBE,aAAqB,aAAa;IAC3E,+DAA+D;IAC/D,MAAMI,SAAS,MAAMP,gBAAgBG;IACrC,MAAMK,eAAyB,EAAE;IACjC,MAAMC,QAAQ,CAACC,MAAcC;QAC3B,IAAID,KAAKE,IAAI,IAAIF,KAAKE,IAAI,CAACC,KAAK,EAAE;YAChCL,aAAaM,IAAI,CAACH;QACpB;QACA,MAAMI,aAAaL,KAAKK,UAAU;QAClC,IAAIA,YAAY;YACdC,OAAOC,IAAI,CAACF,YAAYG,OAAO,CAAC,CAACC,WAC/BV,MAAMM,UAAU,CAACI,SAAS,EAAE,GAAGR,YAAYA,UAAUS,MAAM,GAAG,IAAI,MAAM,KAAKD,UAAU;QAE3F;IACF;IACAV,MAAMF,QAAQ;IAEd,OAAOC;AACT;AAEA,eAAeH,mBAAmBF,UAAkB;IAClD,IAAIkB,QAAG,CAACC,iBAAiB,EAAE;QACzB,OAAOC,KAAKC,KAAK,CACfC,aAAE,CACCC,YAAY,CACXC,eAAI,CAACC,IAAI,CACPP,QAAG,CAACC,iBAAiB,EACrB,UACA,OACA,eACA,4BAGHO,QAAQ;IAEf;IAEA,IAAI,CAAC3B,UAAU,CAACC,WAAW,EAAE;QAC3B,IAAI;YACFD,UAAU,CAACC,WAAW,GAAG,MAAM2B,4BAA4B3B;QAC7D,EAAE,OAAO4B,GAAQ;YACf,IAAIA,EAAEC,IAAI,KAAK,gBAAgB;gBAC7B,MAAM,IAAIC,oBAAY,CAAC,gBAAgB,CAAC,gCAAgC,CAAC;YAC3E;YAEA,MAAMF;QACR;IACF;IAEA,OAAO7B,UAAU,CAACC,WAAW;AAC/B;AAEA,eAAe2B,4BAA4B3B,UAAkB;IAC3D,gEAAgE;IAChE,MAAM+B,aAAaC,IAAAA,yBAAiB,EAAC;QACnCC,gBAAgB;QAChB,sFAAsF;QACtFC,KAAK,OAAO,KAAK,KAAK,KAAK;IAC7B;IACA,MAAMC,WAAW,MAAMJ,WAAW,CAAC,6BAA6B,EAAE/B,YAAY;IAC9E,MAAMC,OAAO,MAAMkC,SAASlC,IAAI;IAEhC,OAAOmC,IAAAA,8BAAsB,EAAanC;AAC5C"}
@@ -0,0 +1,28 @@
1
+ // NOTE(@kitten): These are currently only used by expo-updates (expo-updates/utols/src/createManifestForBuildAsync)
2
+ // They're re-exported via `expo/internal/cli-unstable-expo-updates-exports` to establish a valid dependency chain
3
+ // NOTE for Expo Maintainers: Do not add to this file. We want to remove this
4
+ "use strict";
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ function _export(target, all) {
9
+ for(var name in all)Object.defineProperty(target, name, {
10
+ enumerable: true,
11
+ get: all[name]
12
+ });
13
+ }
14
+ _export(exports, {
15
+ createMetroServerAndBundleRequestAsync: function() {
16
+ return _exportEmbedAsync.createMetroServerAndBundleRequestAsync;
17
+ },
18
+ drawableFileTypes: function() {
19
+ return _metroAssetLocalPath.drawableFileTypes;
20
+ },
21
+ exportEmbedAssetsAsync: function() {
22
+ return _exportEmbedAsync.exportEmbedAssetsAsync;
23
+ }
24
+ });
25
+ const _metroAssetLocalPath = require("./export/metroAssetLocalPath");
26
+ const _exportEmbedAsync = require("./export/embed/exportEmbedAsync");
27
+
28
+ //# sourceMappingURL=expoUpdatesExports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/expoUpdatesExports.ts"],"sourcesContent":["// NOTE(@kitten): These are currently only used by expo-updates (expo-updates/utols/src/createManifestForBuildAsync)\n// They're re-exported via `expo/internal/cli-unstable-expo-updates-exports` to establish a valid dependency chain\n// NOTE for Expo Maintainers: Do not add to this file. We want to remove this\nexport { drawableFileTypes } from './export/metroAssetLocalPath';\nexport {\n createMetroServerAndBundleRequestAsync,\n exportEmbedAssetsAsync,\n} from './export/embed/exportEmbedAsync';\n"],"names":["createMetroServerAndBundleRequestAsync","drawableFileTypes","exportEmbedAssetsAsync"],"mappings":"AAAA,oHAAoH;AACpH,kHAAkH;AAClH,6EAA6E;;;;;;;;;;;;IAG3EA,sCAAsC;eAAtCA,wDAAsC;;IAF/BC,iBAAiB;eAAjBA,sCAAiB;;IAGxBC,sBAAsB;eAAtBA,wCAAsB;;;qCAHU;kCAI3B"}
@@ -350,7 +350,8 @@ async function createMetroServerAndBundleRequestAsync(projectRoot, options) {
350
350
  engine: isHermes ? 'hermes' : undefined,
351
351
  isExporting: true,
352
352
  // Never output bytecode in the exported bundle since that is hardcoded in the native run script.
353
- bytecode: false
353
+ bytecode: false,
354
+ hosted: false
354
355
  }),
355
356
  sourceMapUrl,
356
357
  unstable_transformProfile: options.unstableTransformProfile || (isHermes ? 'hermes-stable' : 'default')
@@ -385,7 +386,8 @@ async function exportEmbedAssetsAsync(server, bundleRequest, projectRoot, option
385
386
  // Forked out of Metro because the `this._getServerRootDir()` doesn't match the development
386
387
  // behavior.
387
388
  projectRoot: config.projectRoot,
388
- publicPath: config.transformer.publicPath
389
+ publicPath: config.transformer.publicPath,
390
+ isHosted: false
389
391
  });
390
392
  } catch (error) {
391
393
  if (isError(error)) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/export/embed/exportEmbedAsync.ts"],"sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getConfig } from '@expo/config';\nimport Server from '@expo/metro/metro/Server';\nimport splitBundleOptions from '@expo/metro/metro/lib/splitBundleOptions';\nimport output from '@expo/metro/metro/shared/output/bundle';\nimport type { BundleOptions } from '@expo/metro/metro/shared/types.flow';\nimport getMetroAssets from '@expo/metro-config/build/transform-worker/getAssets';\nimport assert from 'assert';\nimport fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport path from 'path';\n\nimport { deserializeEagerKey, getExportEmbedOptionsKey, Options } from './resolveOptions';\nimport { isExecutingFromXcodebuild, logMetroErrorInXcode } from './xcodeCompilerLogger';\nimport { Log } from '../../log';\nimport { DevServerManager } from '../../start/server/DevServerManager';\nimport { MetroBundlerDevServer } from '../../start/server/metro/MetroBundlerDevServer';\nimport { loadMetroConfigAsync } from '../../start/server/metro/instantiateMetro';\nimport { DOM_COMPONENTS_BUNDLE_DIR } from '../../start/server/middleware/DomComponentsMiddleware';\nimport { getMetroDirectBundleOptionsForExpoConfig } from '../../start/server/middleware/metroOptions';\nimport { stripAnsi } from '../../utils/ansi';\nimport { copyAsync, removeAsync } from '../../utils/dir';\nimport { env } from '../../utils/env';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { exportDomComponentAsync } from '../exportDomComponents';\nimport { isEnableHermesManaged } from '../exportHermes';\nimport { persistMetroAssetsAsync } from '../persistMetroAssets';\nimport { copyPublicFolderAsync } from '../publicFolder';\nimport { BundleAssetWithFileHashes, ExportAssetMap, persistMetroFilesAsync } from '../saveAssets';\nimport { exportStandaloneServerAsync } from './exportServer';\nimport { ensureProcessExitsAfterDelay } from '../../utils/exit';\nimport { resolveRealEntryFilePath } from '../../utils/filePath';\n\nconst debug = require('debug')('expo:export:embed');\n\n/**\n * Extended type for the Metro server build result to support the `code` property as a `Buffer`.\n */\ntype ExtendedMetroServerBuildResult =\n | Awaited<ReturnType<Server['build']>>\n | {\n code: string | Buffer;\n };\n\nfunction guessCopiedAppleBundlePath(bundleOutput: string) {\n // Ensure the path is familiar before guessing.\n if (\n !bundleOutput.match(/\\/Xcode\\/DerivedData\\/.*\\/Build\\/Products\\//) &&\n !bundleOutput.match(/\\/CoreSimulator\\/Devices\\/.*\\/data\\/Containers\\/Bundle\\/Application\\//)\n ) {\n debug('Bundling to non-standard location:', bundleOutput);\n return false;\n }\n const bundleName = path.basename(bundleOutput);\n const bundleParent = path.dirname(bundleOutput);\n const possiblePath = globSync(`*.app/${bundleName}`, {\n cwd: bundleParent,\n absolute: true,\n // bundle identifiers can start with dots.\n dot: true,\n })[0];\n debug('Possible path for previous bundle:', possiblePath);\n return possiblePath;\n}\n\nexport async function exportEmbedAsync(projectRoot: string, options: Options) {\n // The React Native build scripts always enable the cache reset but we shouldn't need this in CI environments.\n // By disabling it, we can eagerly bundle code before the build and reuse the cached artifacts in subsequent builds.\n if (env.CI && options.resetCache) {\n debug('CI environment detected, disabling automatic cache reset');\n options.resetCache = false;\n }\n\n setNodeEnv(options.dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n\n // This is an optimized codepath that can occur during `npx expo run` and does not occur during builds from Xcode or Android Studio.\n // Here we reconcile a bundle pass that was run before the native build process. This order can fail faster and is show better errors since the logs won't be obscured by Xcode and Android Studio.\n // This path is also used for automatically deploying server bundles to a remote host.\n const eagerBundleOptions = env.__EXPO_EAGER_BUNDLE_OPTIONS\n ? deserializeEagerKey(env.__EXPO_EAGER_BUNDLE_OPTIONS)\n : null;\n if (eagerBundleOptions) {\n // Get the cache key for the current process to compare against the eager key.\n const inputKey = getExportEmbedOptionsKey(options);\n\n // If the app was bundled previously in the same process, then we should reuse the Metro cache.\n options.resetCache = false;\n\n if (eagerBundleOptions.key === inputKey) {\n // Copy the eager bundleOutput and assets to the new locations.\n await removeAsync(options.bundleOutput);\n\n copyAsync(eagerBundleOptions.options.bundleOutput, options.bundleOutput);\n\n if (eagerBundleOptions.options.assetsDest && options.assetsDest) {\n copyAsync(eagerBundleOptions.options.assetsDest, options.assetsDest);\n }\n\n console.log('info: Copied output to binary:', options.bundleOutput);\n return;\n }\n // TODO: sourcemapOutput is set on Android but not during eager. This is tolerable since it doesn't invalidate the Metro cache.\n console.log(' Eager key:', eagerBundleOptions.key);\n console.log('Request key:', inputKey);\n\n // TODO: We may want an analytic event here in the future to understand when this happens.\n console.warn('warning: Eager bundle does not match new options, bundling again.');\n }\n\n await exportEmbedInternalAsync(projectRoot, options);\n\n // Ensure the process closes after bundling\n ensureProcessExitsAfterDelay();\n}\n\nexport async function exportEmbedInternalAsync(projectRoot: string, options: Options) {\n // Ensure we delete the old bundle to trigger a failure if the bundle cannot be created.\n await removeAsync(options.bundleOutput);\n\n // The iOS bundle is copied in to the Xcode project, so we need to remove the old one\n // to prevent Xcode from loading the old one after a build failure.\n if (options.platform === 'ios') {\n const previousPath = guessCopiedAppleBundlePath(options.bundleOutput);\n if (previousPath && fs.existsSync(previousPath)) {\n debug('Removing previous iOS bundle:', previousPath);\n await removeAsync(previousPath);\n }\n }\n\n const { bundle, assets, files } = await exportEmbedBundleAndAssetsAsync(projectRoot, options);\n\n fs.mkdirSync(path.dirname(options.bundleOutput), { recursive: true, mode: 0o755 });\n\n // On Android, dom components proxy files should write to the assets directory instead of the res directory.\n // We use the bundleOutput directory to get the assets directory.\n const domComponentProxyOutputDir =\n options.platform === 'android' ? path.dirname(options.bundleOutput) : options.assetsDest;\n const hasDomComponents = domComponentProxyOutputDir && files.size > 0;\n\n // Persist bundle and source maps.\n await Promise.all([\n // @ts-expect-error: The `save()` method from metro is typed to support `code: string` only but it also supports `Buffer` actually.\n output.save(bundle, options, Log.log),\n\n // Write dom components proxy files.\n hasDomComponents ? persistMetroFilesAsync(files, domComponentProxyOutputDir) : null,\n // Copy public folder for dom components only if\n hasDomComponents\n ? copyPublicFolderAsync(\n path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER),\n path.join(domComponentProxyOutputDir, DOM_COMPONENTS_BUNDLE_DIR)\n )\n : null,\n\n // NOTE(EvanBacon): This may need to be adjusted in the future if want to support baseUrl on native\n // platforms when doing production embeds (unlikely).\n options.assetsDest\n ? persistMetroAssetsAsync(projectRoot, assets, {\n platform: options.platform,\n outputDirectory: options.assetsDest,\n iosAssetCatalogDirectory: options.assetCatalogDest,\n })\n : null,\n ]);\n}\n\nexport async function exportEmbedBundleAndAssetsAsync(\n projectRoot: string,\n options: Options\n): Promise<{\n bundle: ExtendedMetroServerBuildResult;\n assets: readonly BundleAssetWithFileHashes[];\n files: ExportAssetMap;\n}> {\n const devServerManager = await DevServerManager.startMetroAsync(projectRoot, {\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n port: 8081,\n isExporting: true,\n location: {},\n resetDevServer: options.resetCache,\n maxWorkers: options.maxWorkers,\n });\n\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const { exp, pkg } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n const files: ExportAssetMap = new Map();\n\n try {\n const bundles = await devServer.nativeExportBundleAsync(\n exp,\n {\n // TODO: Re-enable when we get bytecode chunk splitting working again.\n splitChunks: false, //devServer.isReactServerComponentsEnabled,\n mainModuleName: resolveRealEntryFilePath(projectRoot, options.entryFile),\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: !!sourceMapUrl,\n bytecode: options.bytecode ?? false,\n // source map inline\n reactCompiler: !!exp.experiments?.reactCompiler,\n },\n files,\n {\n sourceMapUrl,\n unstable_transformProfile: (options.unstableTransformProfile ||\n (isHermes ? 'hermes-stable' : 'default')) as BundleOptions['unstable_transformProfile'],\n }\n );\n\n const apiRoutesEnabled =\n devServer.isReactServerComponentsEnabled || exp.web?.output === 'server';\n\n if (apiRoutesEnabled) {\n await exportStandaloneServerAsync(projectRoot, devServer, {\n exp,\n pkg,\n files,\n options,\n });\n }\n\n // TODO: Remove duplicates...\n const expoDomComponentReferences = bundles.artifacts\n .map((artifact) =>\n Array.isArray(artifact.metadata.expoDomComponentReferences)\n ? artifact.metadata.expoDomComponentReferences\n : []\n )\n .flat();\n if (expoDomComponentReferences.length > 0) {\n await Promise.all(\n // TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.\n expoDomComponentReferences.map(async (filePath) => {\n const { bundle } = await exportDomComponentAsync({\n filePath,\n projectRoot,\n dev: options.dev,\n devServer,\n isHermes,\n includeSourceMaps: !!sourceMapUrl,\n exp,\n files,\n });\n\n if (options.assetsDest) {\n // Save assets like a typical bundler, preserving the file paths on web.\n // This is saving web-style inside of a native app's binary.\n await persistMetroAssetsAsync(\n projectRoot,\n bundle.assets.map((asset) => ({\n ...asset,\n httpServerLocation: path.join(DOM_COMPONENTS_BUNDLE_DIR, asset.httpServerLocation),\n })),\n {\n files,\n platform: 'web',\n outputDirectory: options.assetsDest,\n }\n );\n }\n })\n );\n }\n\n return {\n files,\n bundle: {\n code: bundles.artifacts.filter((a: any) => a.type === 'js')[0].source,\n // Can be optional when source maps aren't enabled.\n map: bundles.artifacts.filter((a: any) => a.type === 'map')[0]?.source.toString(),\n },\n assets: bundles.assets,\n };\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (options.platform === 'ios') {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n } finally {\n devServerManager.stopAsync();\n }\n}\n\n// Exports for expo-updates\nexport async function createMetroServerAndBundleRequestAsync(\n projectRoot: string,\n options: Pick<\n Options,\n | 'maxWorkers'\n | 'config'\n | 'platform'\n | 'sourcemapOutput'\n | 'sourcemapUseAbsolutePath'\n | 'entryFile'\n | 'minify'\n | 'dev'\n | 'resetCache'\n | 'unstableTransformProfile'\n >\n): Promise<{ server: Server; bundleRequest: BundleOptions }> {\n const exp = getConfig(projectRoot, { skipSDKVersionRequirement: true }).exp;\n\n // TODO: This is slow ~40ms\n const { config } = await loadMetroConfigAsync(\n projectRoot,\n {\n // TODO: This is always enabled in the native script and there's no way to disable it.\n resetCache: options.resetCache,\n\n maxWorkers: options.maxWorkers,\n config: options.config,\n },\n {\n exp,\n isExporting: true,\n getMetroBundler() {\n return server.getBundler().getBundler();\n },\n }\n );\n\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n // TODO(cedric): check if we can use the proper `bundleType=bundle` and `entryPoint=mainModuleName` properties\n // @ts-expect-error: see above\n const bundleRequest: BundleOptions = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n ...getMetroDirectBundleOptionsForExpoConfig(projectRoot, exp, {\n splitChunks: false,\n mainModuleName: resolveRealEntryFilePath(projectRoot, options.entryFile),\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n isExporting: true,\n // Never output bytecode in the exported bundle since that is hardcoded in the native run script.\n bytecode: false,\n }),\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 });\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (options.platform === 'ios') {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n }\n}\n\nfunction isError(error: any): error is Error {\n return error instanceof Error;\n}\n"],"names":["createMetroServerAndBundleRequestAsync","exportEmbedAssetsAsync","exportEmbedAsync","exportEmbedBundleAndAssetsAsync","exportEmbedInternalAsync","debug","require","guessCopiedAppleBundlePath","bundleOutput","match","bundleName","path","basename","bundleParent","dirname","possiblePath","globSync","cwd","absolute","dot","projectRoot","options","env","CI","resetCache","setNodeEnv","dev","load","eagerBundleOptions","__EXPO_EAGER_BUNDLE_OPTIONS","deserializeEagerKey","inputKey","getExportEmbedOptionsKey","key","removeAsync","copyAsync","assetsDest","console","log","warn","ensureProcessExitsAfterDelay","platform","previousPath","fs","existsSync","bundle","assets","files","mkdirSync","recursive","mode","domComponentProxyOutputDir","hasDomComponents","size","Promise","all","output","save","Log","persistMetroFilesAsync","copyPublicFolderAsync","resolve","EXPO_PUBLIC_FOLDER","join","DOM_COMPONENTS_BUNDLE_DIR","persistMetroAssetsAsync","outputDirectory","iosAssetCatalogDirectory","assetCatalogDest","devServerManager","DevServerManager","startMetroAsync","minify","port","isExporting","location","resetDevServer","maxWorkers","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","exp","pkg","getConfig","skipSDKVersionRequirement","isHermes","isEnableHermesManaged","sourceMapUrl","sourcemapOutput","sourcemapUseAbsolutePath","Map","bundles","nativeExportBundleAsync","splitChunks","mainModuleName","resolveRealEntryFilePath","entryFile","engine","undefined","serializerIncludeMaps","bytecode","reactCompiler","experiments","unstable_transformProfile","unstableTransformProfile","apiRoutesEnabled","isReactServerComponentsEnabled","web","exportStandaloneServerAsync","expoDomComponentReferences","artifacts","map","artifact","Array","isArray","metadata","flat","length","filePath","exportDomComponentAsync","includeSourceMaps","asset","httpServerLocation","code","filter","a","type","source","toString","error","isError","isExecutingFromXcodebuild","message","stripAnsi","logMetroErrorInXcode","stopAsync","config","loadMetroConfigAsync","getMetroBundler","server","getBundler","bundleRequest","Server","DEFAULT_BUNDLE_OPTIONS","getMetroDirectBundleOptionsForExpoConfig","watch","onProgress","resolverOptions","transformOptions","splitBundleOptions","bundleType","dependencies","_bundler","getDependencies","shallow","lazy","_config","getMetroAssets","processModuleFilter","serializer","assetPlugins","transformer","publicPath","Error"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;IAiTqBA,sCAAsC;eAAtCA;;IAuEAC,sBAAsB;eAAtBA;;IAvTAC,gBAAgB;eAAhBA;;IAsGAC,+BAA+B;eAA/BA;;IAnDAC,wBAAwB;eAAxBA;;;;yBAnHI;;;;;;;gEACP;;;;;;;gEACY;;;;;;;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AOA,iBAAiBkC;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 output from '@expo/metro/metro/shared/output/bundle';\nimport type { BundleOptions } from '@expo/metro/metro/shared/types.flow';\nimport getMetroAssets from '@expo/metro-config/build/transform-worker/getAssets';\nimport assert from 'assert';\nimport fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport path from 'path';\n\nimport { deserializeEagerKey, getExportEmbedOptionsKey, Options } from './resolveOptions';\nimport { isExecutingFromXcodebuild, logMetroErrorInXcode } from './xcodeCompilerLogger';\nimport { Log } from '../../log';\nimport { DevServerManager } from '../../start/server/DevServerManager';\nimport { MetroBundlerDevServer } from '../../start/server/metro/MetroBundlerDevServer';\nimport { loadMetroConfigAsync } from '../../start/server/metro/instantiateMetro';\nimport { DOM_COMPONENTS_BUNDLE_DIR } from '../../start/server/middleware/DomComponentsMiddleware';\nimport { getMetroDirectBundleOptionsForExpoConfig } from '../../start/server/middleware/metroOptions';\nimport { stripAnsi } from '../../utils/ansi';\nimport { copyAsync, removeAsync } from '../../utils/dir';\nimport { env } from '../../utils/env';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { exportDomComponentAsync } from '../exportDomComponents';\nimport { isEnableHermesManaged } from '../exportHermes';\nimport { persistMetroAssetsAsync } from '../persistMetroAssets';\nimport { copyPublicFolderAsync } from '../publicFolder';\nimport { BundleAssetWithFileHashes, ExportAssetMap, persistMetroFilesAsync } from '../saveAssets';\nimport { exportStandaloneServerAsync } from './exportServer';\nimport { ensureProcessExitsAfterDelay } from '../../utils/exit';\nimport { resolveRealEntryFilePath } from '../../utils/filePath';\n\nconst debug = require('debug')('expo:export:embed');\n\n/**\n * Extended type for the Metro server build result to support the `code` property as a `Buffer`.\n */\ntype ExtendedMetroServerBuildResult =\n | Awaited<ReturnType<Server['build']>>\n | {\n code: string | Buffer;\n };\n\nfunction guessCopiedAppleBundlePath(bundleOutput: string) {\n // Ensure the path is familiar before guessing.\n if (\n !bundleOutput.match(/\\/Xcode\\/DerivedData\\/.*\\/Build\\/Products\\//) &&\n !bundleOutput.match(/\\/CoreSimulator\\/Devices\\/.*\\/data\\/Containers\\/Bundle\\/Application\\//)\n ) {\n debug('Bundling to non-standard location:', bundleOutput);\n return false;\n }\n const bundleName = path.basename(bundleOutput);\n const bundleParent = path.dirname(bundleOutput);\n const possiblePath = globSync(`*.app/${bundleName}`, {\n cwd: bundleParent,\n absolute: true,\n // bundle identifiers can start with dots.\n dot: true,\n })[0];\n debug('Possible path for previous bundle:', possiblePath);\n return possiblePath;\n}\n\nexport async function exportEmbedAsync(projectRoot: string, options: Options) {\n // The React Native build scripts always enable the cache reset but we shouldn't need this in CI environments.\n // By disabling it, we can eagerly bundle code before the build and reuse the cached artifacts in subsequent builds.\n if (env.CI && options.resetCache) {\n debug('CI environment detected, disabling automatic cache reset');\n options.resetCache = false;\n }\n\n setNodeEnv(options.dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n\n // This is an optimized codepath that can occur during `npx expo run` and does not occur during builds from Xcode or Android Studio.\n // Here we reconcile a bundle pass that was run before the native build process. This order can fail faster and is show better errors since the logs won't be obscured by Xcode and Android Studio.\n // This path is also used for automatically deploying server bundles to a remote host.\n const eagerBundleOptions = env.__EXPO_EAGER_BUNDLE_OPTIONS\n ? deserializeEagerKey(env.__EXPO_EAGER_BUNDLE_OPTIONS)\n : null;\n if (eagerBundleOptions) {\n // Get the cache key for the current process to compare against the eager key.\n const inputKey = getExportEmbedOptionsKey(options);\n\n // If the app was bundled previously in the same process, then we should reuse the Metro cache.\n options.resetCache = false;\n\n if (eagerBundleOptions.key === inputKey) {\n // Copy the eager bundleOutput and assets to the new locations.\n await removeAsync(options.bundleOutput);\n\n copyAsync(eagerBundleOptions.options.bundleOutput, options.bundleOutput);\n\n if (eagerBundleOptions.options.assetsDest && options.assetsDest) {\n copyAsync(eagerBundleOptions.options.assetsDest, options.assetsDest);\n }\n\n console.log('info: Copied output to binary:', options.bundleOutput);\n return;\n }\n // TODO: sourcemapOutput is set on Android but not during eager. This is tolerable since it doesn't invalidate the Metro cache.\n console.log(' Eager key:', eagerBundleOptions.key);\n console.log('Request key:', inputKey);\n\n // TODO: We may want an analytic event here in the future to understand when this happens.\n console.warn('warning: Eager bundle does not match new options, bundling again.');\n }\n\n await exportEmbedInternalAsync(projectRoot, options);\n\n // Ensure the process closes after bundling\n ensureProcessExitsAfterDelay();\n}\n\nexport async function exportEmbedInternalAsync(projectRoot: string, options: Options) {\n // Ensure we delete the old bundle to trigger a failure if the bundle cannot be created.\n await removeAsync(options.bundleOutput);\n\n // The iOS bundle is copied in to the Xcode project, so we need to remove the old one\n // to prevent Xcode from loading the old one after a build failure.\n if (options.platform === 'ios') {\n const previousPath = guessCopiedAppleBundlePath(options.bundleOutput);\n if (previousPath && fs.existsSync(previousPath)) {\n debug('Removing previous iOS bundle:', previousPath);\n await removeAsync(previousPath);\n }\n }\n\n const { bundle, assets, files } = await exportEmbedBundleAndAssetsAsync(projectRoot, options);\n\n fs.mkdirSync(path.dirname(options.bundleOutput), { recursive: true, mode: 0o755 });\n\n // On Android, dom components proxy files should write to the assets directory instead of the res directory.\n // We use the bundleOutput directory to get the assets directory.\n const domComponentProxyOutputDir =\n options.platform === 'android' ? path.dirname(options.bundleOutput) : options.assetsDest;\n const hasDomComponents = domComponentProxyOutputDir && files.size > 0;\n\n // Persist bundle and source maps.\n await Promise.all([\n // @ts-expect-error: The `save()` method from metro is typed to support `code: string` only but it also supports `Buffer` actually.\n output.save(bundle, options, Log.log),\n\n // Write dom components proxy files.\n hasDomComponents ? persistMetroFilesAsync(files, domComponentProxyOutputDir) : null,\n // Copy public folder for dom components only if\n hasDomComponents\n ? copyPublicFolderAsync(\n path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER),\n path.join(domComponentProxyOutputDir, DOM_COMPONENTS_BUNDLE_DIR)\n )\n : null,\n\n // NOTE(EvanBacon): This may need to be adjusted in the future if want to support baseUrl on native\n // platforms when doing production embeds (unlikely).\n options.assetsDest\n ? persistMetroAssetsAsync(projectRoot, assets, {\n platform: options.platform,\n outputDirectory: options.assetsDest,\n iosAssetCatalogDirectory: options.assetCatalogDest,\n })\n : null,\n ]);\n}\n\nexport async function exportEmbedBundleAndAssetsAsync(\n projectRoot: string,\n options: Options\n): Promise<{\n bundle: ExtendedMetroServerBuildResult;\n assets: readonly BundleAssetWithFileHashes[];\n files: ExportAssetMap;\n}> {\n const devServerManager = await DevServerManager.startMetroAsync(projectRoot, {\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n port: 8081,\n isExporting: true,\n location: {},\n resetDevServer: options.resetCache,\n maxWorkers: options.maxWorkers,\n });\n\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const { exp, pkg } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n const files: ExportAssetMap = new Map();\n\n try {\n const bundles = await devServer.nativeExportBundleAsync(\n exp,\n {\n // TODO: Re-enable when we get bytecode chunk splitting working again.\n splitChunks: false, //devServer.isReactServerComponentsEnabled,\n mainModuleName: resolveRealEntryFilePath(projectRoot, options.entryFile),\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: !!sourceMapUrl,\n bytecode: options.bytecode ?? false,\n // source map inline\n reactCompiler: !!exp.experiments?.reactCompiler,\n },\n files,\n {\n sourceMapUrl,\n unstable_transformProfile: (options.unstableTransformProfile ||\n (isHermes ? 'hermes-stable' : 'default')) as BundleOptions['unstable_transformProfile'],\n }\n );\n\n const apiRoutesEnabled =\n devServer.isReactServerComponentsEnabled || exp.web?.output === 'server';\n\n if (apiRoutesEnabled) {\n await exportStandaloneServerAsync(projectRoot, devServer, {\n exp,\n pkg,\n files,\n options,\n });\n }\n\n // TODO: Remove duplicates...\n const expoDomComponentReferences = bundles.artifacts\n .map((artifact) =>\n Array.isArray(artifact.metadata.expoDomComponentReferences)\n ? artifact.metadata.expoDomComponentReferences\n : []\n )\n .flat();\n if (expoDomComponentReferences.length > 0) {\n await Promise.all(\n // TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.\n expoDomComponentReferences.map(async (filePath) => {\n const { bundle } = await exportDomComponentAsync({\n filePath,\n projectRoot,\n dev: options.dev,\n devServer,\n isHermes,\n includeSourceMaps: !!sourceMapUrl,\n exp,\n files,\n });\n\n if (options.assetsDest) {\n // Save assets like a typical bundler, preserving the file paths on web.\n // This is saving web-style inside of a native app's binary.\n await persistMetroAssetsAsync(\n projectRoot,\n bundle.assets.map((asset) => ({\n ...asset,\n httpServerLocation: path.join(DOM_COMPONENTS_BUNDLE_DIR, asset.httpServerLocation),\n })),\n {\n files,\n platform: 'web',\n outputDirectory: options.assetsDest,\n }\n );\n }\n })\n );\n }\n\n return {\n files,\n bundle: {\n code: bundles.artifacts.filter((a: any) => a.type === 'js')[0].source,\n // Can be optional when source maps aren't enabled.\n map: bundles.artifacts.filter((a: any) => a.type === 'map')[0]?.source.toString(),\n },\n assets: bundles.assets,\n };\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (options.platform === 'ios') {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n } finally {\n devServerManager.stopAsync();\n }\n}\n\n// Exports for expo-updates\nexport async function createMetroServerAndBundleRequestAsync(\n projectRoot: string,\n options: Pick<\n Options,\n | 'maxWorkers'\n | 'config'\n | 'platform'\n | 'sourcemapOutput'\n | 'sourcemapUseAbsolutePath'\n | 'entryFile'\n | 'minify'\n | 'dev'\n | 'resetCache'\n | 'unstableTransformProfile'\n >\n): Promise<{ server: Server; bundleRequest: BundleOptions }> {\n const exp = getConfig(projectRoot, { skipSDKVersionRequirement: true }).exp;\n\n // TODO: This is slow ~40ms\n const { config } = await loadMetroConfigAsync(\n projectRoot,\n {\n // TODO: This is always enabled in the native script and there's no way to disable it.\n resetCache: options.resetCache,\n\n maxWorkers: options.maxWorkers,\n config: options.config,\n },\n {\n exp,\n isExporting: true,\n getMetroBundler() {\n return server.getBundler().getBundler();\n },\n }\n );\n\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n // TODO(cedric): check if we can use the proper `bundleType=bundle` and `entryPoint=mainModuleName` properties\n // @ts-expect-error: see above\n const bundleRequest: BundleOptions = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n ...getMetroDirectBundleOptionsForExpoConfig(projectRoot, exp, {\n splitChunks: false,\n mainModuleName: resolveRealEntryFilePath(projectRoot, options.entryFile),\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n isExporting: true,\n // Never output bytecode in the exported bundle since that is hardcoded in the native run script.\n bytecode: false,\n hosted: false,\n }),\n sourceMapUrl,\n unstable_transformProfile: (options.unstableTransformProfile ||\n (isHermes ? 'hermes-stable' : 'default')) as BundleOptions['unstable_transformProfile'],\n };\n\n const server = new Server(config, {\n watch: false,\n });\n\n return { server, bundleRequest };\n}\n\nexport async function exportEmbedAssetsAsync(\n server: Server,\n bundleRequest: BundleOptions,\n projectRoot: string,\n options: Pick<Options, 'platform'>\n) {\n try {\n const { entryFile, onProgress, resolverOptions, transformOptions } = splitBundleOptions({\n ...bundleRequest,\n // @ts-ignore-error TODO(@kitten): Very unclear why this is here. Remove?\n bundleType: 'todo',\n });\n\n const dependencies = await server._bundler.getDependencies(\n [entryFile],\n transformOptions,\n resolverOptions,\n { onProgress, shallow: false, lazy: false }\n );\n\n const config = server._config;\n\n return getMetroAssets(dependencies, {\n processModuleFilter: config.serializer.processModuleFilter,\n assetPlugins: config.transformer.assetPlugins,\n platform: transformOptions.platform!,\n // Forked out of Metro because the `this._getServerRootDir()` doesn't match the development\n // behavior.\n projectRoot: config.projectRoot, // this._getServerRootDir(),\n publicPath: config.transformer.publicPath,\n isHosted: false,\n });\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (options.platform === 'ios') {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n }\n}\n\nfunction isError(error: any): error is Error {\n return error instanceof Error;\n}\n"],"names":["createMetroServerAndBundleRequestAsync","exportEmbedAssetsAsync","exportEmbedAsync","exportEmbedBundleAndAssetsAsync","exportEmbedInternalAsync","debug","require","guessCopiedAppleBundlePath","bundleOutput","match","bundleName","path","basename","bundleParent","dirname","possiblePath","globSync","cwd","absolute","dot","projectRoot","options","env","CI","resetCache","setNodeEnv","dev","load","eagerBundleOptions","__EXPO_EAGER_BUNDLE_OPTIONS","deserializeEagerKey","inputKey","getExportEmbedOptionsKey","key","removeAsync","copyAsync","assetsDest","console","log","warn","ensureProcessExitsAfterDelay","platform","previousPath","fs","existsSync","bundle","assets","files","mkdirSync","recursive","mode","domComponentProxyOutputDir","hasDomComponents","size","Promise","all","output","save","Log","persistMetroFilesAsync","copyPublicFolderAsync","resolve","EXPO_PUBLIC_FOLDER","join","DOM_COMPONENTS_BUNDLE_DIR","persistMetroAssetsAsync","outputDirectory","iosAssetCatalogDirectory","assetCatalogDest","devServerManager","DevServerManager","startMetroAsync","minify","port","isExporting","location","resetDevServer","maxWorkers","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","exp","pkg","getConfig","skipSDKVersionRequirement","isHermes","isEnableHermesManaged","sourceMapUrl","sourcemapOutput","sourcemapUseAbsolutePath","Map","bundles","nativeExportBundleAsync","splitChunks","mainModuleName","resolveRealEntryFilePath","entryFile","engine","undefined","serializerIncludeMaps","bytecode","reactCompiler","experiments","unstable_transformProfile","unstableTransformProfile","apiRoutesEnabled","isReactServerComponentsEnabled","web","exportStandaloneServerAsync","expoDomComponentReferences","artifacts","map","artifact","Array","isArray","metadata","flat","length","filePath","exportDomComponentAsync","includeSourceMaps","asset","httpServerLocation","code","filter","a","type","source","toString","error","isError","isExecutingFromXcodebuild","message","stripAnsi","logMetroErrorInXcode","stopAsync","config","loadMetroConfigAsync","getMetroBundler","server","getBundler","bundleRequest","Server","DEFAULT_BUNDLE_OPTIONS","getMetroDirectBundleOptionsForExpoConfig","hosted","watch","onProgress","resolverOptions","transformOptions","splitBundleOptions","bundleType","dependencies","_bundler","getDependencies","shallow","lazy","_config","getMetroAssets","processModuleFilter","serializer","assetPlugins","transformer","publicPath","isHosted","Error"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;IAiTqBA,sCAAsC;eAAtCA;;IAwEAC,sBAAsB;eAAtBA;;IAxTAC,gBAAgB;eAAhBA;;IAsGAC,+BAA+B;eAA/BA;;IAnDAC,wBAAwB;eAAxBA;;;;yBAnHI;;;;;;;gEACP;;;;;;;gEACY;;;;;;;gEACZ;;;;;;;gEAEQ;;;;;;;gEACR;;;;;;;gEACJ;;;;;;;yBACkB;;;;;;;gEA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op_require_wildcard(obj, nodeInterop) {
111
111
  }
112
112
  return newObj;
113
113
  }
114
- async function exportAppAsync(projectRoot, { platforms, outputDir, clear, dev, dumpAssetmap, sourceMaps, minify, bytecode, maxWorkers, skipSSG }) {
114
+ async function exportAppAsync(projectRoot, { platforms, outputDir, clear, dev, dumpAssetmap, sourceMaps, minify, bytecode, maxWorkers, skipSSG, hostedNative }) {
115
115
  var _exp_web, _exp_web1;
116
116
  // Force the environment during export and do not allow overriding it.
117
117
  const environment = dev ? 'development' : 'production';
@@ -206,7 +206,8 @@ async function exportAppAsync(projectRoot, { platforms, outputDir, clear, dev, d
206
206
  engine: isHermes ? 'hermes' : undefined,
207
207
  serializerIncludeMaps: sourceMaps,
208
208
  bytecode: bytecode && isHermes,
209
- reactCompiler: !!((_exp_experiments = exp.experiments) == null ? void 0 : _exp_experiments.reactCompiler)
209
+ reactCompiler: !!((_exp_experiments = exp.experiments) == null ? void 0 : _exp_experiments.reactCompiler),
210
+ hosted: hostedNative
210
211
  }, files);
211
212
  } catch (error) {
212
213
  _log.log('');
@@ -222,7 +223,7 @@ async function exportAppAsync(projectRoot, { platforms, outputDir, clear, dev, d
222
223
  (0, _saveAssets.getFilesFromSerialAssets)(bundle.artifacts, {
223
224
  includeSourceMaps: sourceMaps,
224
225
  files,
225
- isServerHosted: devServer.isReactServerComponentsEnabled
226
+ isServerHosted: devServer.isReactServerComponentsEnabled || hostedNative
226
227
  });
227
228
  // TODO: Remove duplicates...
228
229
  const expoDomComponentReferences = bundle.artifacts.map((artifact)=>Array.isArray(artifact.metadata.expoDomComponentReferences) ? artifact.metadata.expoDomComponentReferences : []).flat();
@@ -249,6 +250,7 @@ async function exportAppAsync(projectRoot, { platforms, outputDir, clear, dev, d
249
250
  htmlOutputName
250
251
  });
251
252
  domComponentAssetsMetadata[platform] = [
253
+ ...domComponentAssetsMetadata[platform] || [],
252
254
  ...await (0, _exportDomComponents.addDomBundleToMetadataAsync)(platformDomComponentsBundle),
253
255
  ...(0, _exportDomComponents.transformDomEntryForMd5Filename)({
254
256
  files,
@@ -304,7 +306,8 @@ async function exportAppAsync(projectRoot, { platforms, outputDir, clear, dev, d
304
306
  exp,
305
307
  outputDir: outputPath,
306
308
  bundles,
307
- baseUrl
309
+ baseUrl,
310
+ hostedNative
308
311
  });
309
312
  if (dumpAssetmap) {
310
313
  _log.log('Creating asset map');
@@ -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 { 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 } 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 minify,\n bytecode,\n maxWorkers,\n skipSSG,\n }: Pick<\n Options,\n | 'dumpAssetmap'\n | 'sourceMaps'\n | 'dev'\n | 'clear'\n | 'outputDir'\n | 'platforms'\n | 'minify'\n | 'bytecode'\n | 'maxWorkers'\n | 'skipSSG'\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\n require('@expo/env').load(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,\n bytecode: bytecode && isHermes,\n reactCompiler: !!exp.experiments?.reactCompiler,\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,\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 // @ts-expect-error: mutate assets\n bundle.assets.push(...platformDomComponentsBundle.assets);\n\n transformNativeBundleForMd5Filename({\n domComponentReference: filePath,\n nativeBundle: bundle,\n files,\n htmlOutputName,\n });\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 });\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","minify","bytecode","maxWorkers","skipSSG","exp","environment","process","env","NODE_ENV","setNodeEnv","require","load","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","reactCompiler","experiments","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":";;;;+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;yBACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEpB,eAAeA,eACpBC,WAAmB,EACnB,EACEC,SAAS,EACTC,SAAS,EACTC,KAAK,EACLC,GAAG,EACHC,YAAY,EACZC,UAAU,EACVC,MAAM,EACNC,QAAQ,EACRC,UAAU,EACVC,OAAO,EAaR;QAmBwDC,UAE1CA;IAnBf,sEAAsE;IACtE,MAAMC,cAAcR,MAAM,gBAAgB;IAC1CS,QAAQC,GAAG,CAACC,QAAQ,GAAGH;IACvBI,IAAAA,mBAAU,EAACJ;IAEXK,QAAQ,aAAaC,IAAI,CAAClB;IAE1B,MAAMmB,gBAAgBC,IAAAA,mBAAS,EAACpB;IAChC,MAAMW,MAAM,MAAMU,IAAAA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wBACtBC,UAAU,CAAC,0BAA0B,CAAC;wBACtCC,cAAc;oBAChB;gBACF;YACF,OAAO,IACL,wCAAwC;YACxC,CAACpE,UAAUO,8BAA8B,EACzC;oBAUmBnD;gBATnB,MAAMqI,IAAAA,wCAAqB,EAAChJ,aAAauD,WAAW;oBAClDf;oBACAM;oBACA3C,OAAO,CAAC,CAACA;oBACTD,WAAW2C;oBACXtC;oBACAwB;oBACA6D,mBAAmBtF;oBACnB2I,YAAYC,IAAAA,8CAAsC,EAAClJ,aAAaW;oBAChE0E,eAAe,CAAC,GAAC1E,mBAAAA,IAAI2E,WAAW,qBAAf3E,iBAAiB0E,aAAa;oBAC/CuD;oBACAnI;oBACA2C,aAAa;oBACbzC,KAAKQ,cAAcR,GAAG;gBACxB;YACF;QACF;IACF,SAAU;QACR,MAAMqC,iBAAiBmG,SAAS;IAClC;IAEA,kDAAkD;IAClD,MAAMC,IAAAA,kCAAsB,EAACtG,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 {\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 } 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 minify,\n bytecode,\n maxWorkers,\n skipSSG,\n hostedNative,\n }: Pick<\n Options,\n | 'dumpAssetmap'\n | 'sourceMaps'\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\n require('@expo/env').load(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,\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 // @ts-expect-error: mutate assets\n bundle.assets.push(...platformDomComponentsBundle.assets);\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","minify","bytecode","maxWorkers","skipSSG","hostedNative","exp","environment","process","env","NODE_ENV","setNodeEnv","require","load","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","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;y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QAE/B,IAAI3H,UAAUwB,QAAQ,CAAC,UAAUG,oBAAoB;gBAC9BhB;YAArB,MAAMkI,eAAelI,EAAAA,YAAAA,IAAIiB,GAAG,qBAAPjB,UAASkB,MAAM,MAAK;YAEzC,IAAIgH,cAAc;gBAChB,0DAA0D;gBAC1D,MAAM5E,IAAAA,mCAAqB,EAACxB,YAAYC,eAAI,CAACC,OAAO,CAACE,YAAY;YACnE;YAEA,IAAIpC,SAAS;gBACXwB,KAAIE,GAAG,CAAC;gBACR,MAAM2F,IAAAA,iDAA8B,EAACvE,WAAW;oBAC9CT;oBACAkB,UAAU;oBACV+D,eAAe;gBACjB;gBAEA,gFAAgF;gBAChF,sEAAsE;gBACtE,MAAMe,mBAAmBpG,eAAI,CAACC,OAAO,CAACE,YAAY;gBAClD,IAAI,CAACkG,aAAE,CAACC,UAAU,CAACF,mBAAmB;oBACpChG,MAAM4E,GAAG,CAAC,cAAc;wBACtBC,UAAU,CAAC,0BAA0B,CAAC;wBACtCC,cAAc;oBAChB;gBACF;YACF,OAAO,IACL,wCAAwC;YACxC,CAACrE,UAAUO,8BAA8B,EACzC;oBAUmBnD;gBATnB,MAAMsI,IAAAA,wCAAqB,EAAClJ,aAAawD,WAAW;oBAClDf;oBACAM;oBACA5C,OAAO,CAAC,CAACA;oBACTD,WAAW4C;oBACXvC;oBACAyB;oBACA8D,mBAAmBxF;oBACnB6I,YAAYC,IAAAA,8CAAsC,EAACpJ,aAAaY;oBAChE0E,eAAe,CAAC,GAAC1E,mBAAAA,IAAI2E,WAAW,qBAAf3E,iBAAiB0E,aAAa;oBAC/CwD;oBACArI;oBACA4C,aAAa;oBACbzC,KAAKQ,cAAcR,GAAG;gBACxB;YACF;QACF;IACF,SAAU;QACR,MAAMqC,iBAAiBoG,SAAS;IAClC;IAEA,kDAAkD;IAClD,MAAMC,IAAAA,kCAAsB,EAACvG,OAAOD;AACtC"}
@@ -163,19 +163,35 @@ function shouldBundleAsset(asset, patterns) {
163
163
  const file = (_asset_files = asset.files) == null ? void 0 : _asset_files[0];
164
164
  return !!('__packager_asset' in asset && asset.__packager_asset && file && patterns.some((pattern)=>(0, _minimatch().minimatch)(file, pattern)));
165
165
  }
166
- async function exportAssetsAsync(projectRoot, { exp, outputDir, bundles: { web, ...bundles }, baseUrl, files = new Map() }) {
166
+ async function exportAssetsAsync(projectRoot, { exp, outputDir, bundles: { web, ...bundles }, baseUrl, files = new Map(), hostedNative }) {
167
167
  var _assets_;
168
- // NOTE: We use a different system for static web
169
- if (web) {
168
+ const hostedAssets = web ? [
169
+ ...web.assets
170
+ ] : [];
171
+ // If the native assets should be hosted like web, then we can add them to the hosted assets to export.
172
+ if (hostedNative) {
173
+ hostedAssets.push(...Object.values(bundles).flatMap((bundle)=>bundle.assets ?? []));
174
+ }
175
+ if (hostedAssets.length) {
170
176
  // Save assets like a typical bundler, preserving the file paths on web.
171
177
  // TODO: Update React Native Web to support loading files from asset hashes.
172
- await (0, _persistMetroAssets.persistMetroAssetsAsync)(projectRoot, web.assets, {
178
+ await (0, _persistMetroAssets.persistMetroAssetsAsync)(projectRoot, hostedAssets, {
173
179
  files,
174
180
  platform: 'web',
175
181
  outputDirectory: outputDir,
176
182
  baseUrl
177
183
  });
178
184
  }
185
+ if (hostedNative) {
186
+ // Add google services file if it exists
187
+ await (0, _resolveAssets.resolveGoogleServicesFile)(projectRoot, exp);
188
+ return {
189
+ exp,
190
+ assets: [],
191
+ embeddedHashSet: new Set(),
192
+ files
193
+ };
194
+ }
179
195
  const assets = (0, _array.uniqBy)(Object.values(bundles).flatMap((bundle)=>bundle.assets), (asset)=>asset.hash);
180
196
  let bundledAssetsSet = undefined;
181
197
  let filteredAssets = assets;