@expo/cli 0.19.14 → 0.20.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.
- package/build/bin/cli +1 -1
- package/build/src/export/createMetadataJson.js +14 -10
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +34 -94
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/resolveOptions.js +3 -3
- package/build/src/export/embed/resolveOptions.js.map +1 -1
- package/build/src/export/exportApp.js +32 -1
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportDomComponents.js +156 -0
- package/build/src/export/exportDomComponents.js.map +1 -0
- package/build/src/export/exportHermes.js +49 -1
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/install/installExpoPackage.js +15 -15
- package/build/src/install/installExpoPackage.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +2 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/createServerComponentsMiddleware.js +21 -5
- package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/utils/filePath.js +28 -0
- package/build/src/utils/filePath.js.map +1 -0
- package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
- package/build/src/utils/telemetry/clients/RudderDetachedClient.js +13 -13
- package/build/src/utils/telemetry/clients/RudderDetachedClient.js.map +1 -1
- package/build/src/utils/telemetry/utils/context.js +1 -1
- package/package.json +3 -3
- package/build/src/export/embed/guessHermes.js +0 -69
- package/build/src/export/embed/guessHermes.js.map +0 -1
package/build/bin/cli
CHANGED
|
@@ -18,28 +18,32 @@ function _interopRequireDefault(obj) {
|
|
|
18
18
|
default: obj
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
function createMetadataJson({ bundles , fileNames , embeddedHashSet }) {
|
|
21
|
+
function createMetadataJson({ bundles , fileNames , embeddedHashSet , domComponentAssetsMetadata }) {
|
|
22
22
|
// Build metadata.json
|
|
23
23
|
return {
|
|
24
24
|
version: 0,
|
|
25
25
|
bundler: "metro",
|
|
26
26
|
fileMetadata: Object.entries(bundles).reduce((metadata, [platform, bundle])=>{
|
|
27
27
|
if (platform === "web") return metadata;
|
|
28
|
+
// Collect all of the assets and convert them to the serial format.
|
|
29
|
+
const assets = bundle.assets.filter((asset)=>!embeddedHashSet || !embeddedHashSet.has(asset.hash)).map((asset)=>{
|
|
30
|
+
var // Each asset has multiple hashes which we convert and then flatten.
|
|
31
|
+
ref;
|
|
32
|
+
return (ref = asset.fileHashes) == null ? void 0 : ref.map((hash)=>({
|
|
33
|
+
path: _path().default.join("assets", hash),
|
|
34
|
+
ext: asset.type
|
|
35
|
+
}));
|
|
36
|
+
}).filter(Boolean).flat();
|
|
37
|
+
if ((domComponentAssetsMetadata == null ? void 0 : domComponentAssetsMetadata[platform]) != null) {
|
|
38
|
+
assets.push(...domComponentAssetsMetadata == null ? void 0 : domComponentAssetsMetadata[platform]);
|
|
39
|
+
}
|
|
28
40
|
return {
|
|
29
41
|
...metadata,
|
|
30
42
|
[platform]: {
|
|
31
43
|
// Get the filename for each platform's bundle.
|
|
32
44
|
// TODO: Add multi-bundle support to EAS Update!!
|
|
33
45
|
bundle: fileNames[platform][0],
|
|
34
|
-
|
|
35
|
-
assets: bundle.assets.filter((asset)=>!embeddedHashSet || !embeddedHashSet.has(asset.hash)).map((asset)=>{
|
|
36
|
-
var // Each asset has multiple hashes which we convert and then flatten.
|
|
37
|
-
ref;
|
|
38
|
-
return (ref = asset.fileHashes) == null ? void 0 : ref.map((hash)=>({
|
|
39
|
-
path: _path().default.join("assets", hash),
|
|
40
|
-
ext: asset.type
|
|
41
|
-
}));
|
|
42
|
-
}).filter(Boolean).flat()
|
|
46
|
+
assets
|
|
43
47
|
}
|
|
44
48
|
};
|
|
45
49
|
}, {})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/createMetadataJson.ts"],"sourcesContent":["import path from 'path';\n\nimport type { BundleOutput } from './saveAssets';\n\nexport type BundlePlatform = 'android' | 'ios';\n\ntype PlatformMetadataAsset = { path: string; ext: string };\n\
|
|
1
|
+
{"version":3,"sources":["../../../src/export/createMetadataJson.ts"],"sourcesContent":["import path from 'path';\n\nimport type { BundleOutput } from './saveAssets';\n\nexport type BundlePlatform = 'android' | 'ios';\n\ntype PlatformMetadataAsset = { path: string; ext: string };\n\nexport type PlatformMetadata = { bundle: string; assets: PlatformMetadataAsset[] };\n\ntype FileMetadata = {\n [key in BundlePlatform]: PlatformMetadata;\n};\n\nexport function createMetadataJson({\n bundles,\n fileNames,\n embeddedHashSet,\n domComponentAssetsMetadata,\n}: {\n bundles: Partial<Record<BundlePlatform, Pick<BundleOutput, 'assets'>>>;\n fileNames: Record<string, string[]>;\n embeddedHashSet?: Set<string>;\n domComponentAssetsMetadata?: Record<string, PlatformMetadataAsset[]>;\n}): {\n version: 0;\n bundler: 'metro';\n fileMetadata: FileMetadata;\n} {\n // Build metadata.json\n return {\n version: 0,\n bundler: 'metro',\n fileMetadata: Object.entries(bundles).reduce<Record<string, Partial<PlatformMetadata>>>(\n (metadata, [platform, bundle]) => {\n if (platform === 'web') return metadata;\n\n // Collect all of the assets and convert them to the serial format.\n const assets = bundle.assets\n .filter((asset) => !embeddedHashSet || !embeddedHashSet.has(asset.hash))\n .map((asset) =>\n // Each asset has multiple hashes which we convert and then flatten.\n asset.fileHashes?.map((hash) => ({\n path: path.join('assets', hash),\n ext: asset.type,\n }))\n )\n .filter(Boolean)\n .flat();\n\n if (domComponentAssetsMetadata?.[platform] != null) {\n assets.push(...domComponentAssetsMetadata?.[platform]);\n }\n\n return {\n ...metadata,\n [platform]: {\n // Get the filename for each platform's bundle.\n // TODO: Add multi-bundle support to EAS Update!!\n bundle: fileNames[platform][0],\n assets,\n },\n };\n },\n {}\n ) as FileMetadata,\n };\n}\n"],"names":["createMetadataJson","bundles","fileNames","embeddedHashSet","domComponentAssetsMetadata","version","bundler","fileMetadata","Object","entries","reduce","metadata","platform","bundle","assets","filter","asset","has","hash","map","fileHashes","path","join","ext","type","Boolean","flat","push"],"mappings":"AAAA;;;;+BAcgBA,oBAAkB;;aAAlBA,kBAAkB;;;8DAdjB,MAAM;;;;;;;;;;;AAchB,SAASA,kBAAkB,CAAC,EACjCC,OAAO,CAAA,EACPC,SAAS,CAAA,EACTC,eAAe,CAAA,EACfC,0BAA0B,CAAA,EAM3B,EAIC;IACA,sBAAsB;IACtB,OAAO;QACLC,OAAO,EAAE,CAAC;QACVC,OAAO,EAAE,OAAO;QAChBC,YAAY,EAAEC,MAAM,CAACC,OAAO,CAACR,OAAO,CAAC,CAACS,MAAM,CAC1C,CAACC,QAAQ,EAAE,CAACC,QAAQ,EAAEC,MAAM,CAAC,GAAK;YAChC,IAAID,QAAQ,KAAK,KAAK,EAAE,OAAOD,QAAQ,CAAC;YAExC,mEAAmE;YACnE,MAAMG,MAAM,GAAGD,MAAM,CAACC,MAAM,CACzBC,MAAM,CAAC,CAACC,KAAK,GAAK,CAACb,eAAe,IAAI,CAACA,eAAe,CAACc,GAAG,CAACD,KAAK,CAACE,IAAI,CAAC,CAAC,CACvEC,GAAG,CAAC,CAACH,KAAK;oBACT,oEAAoE;gBACpEA,GAAgB;gBAAhBA,OAAAA,CAAAA,GAAgB,GAAhBA,KAAK,CAACI,UAAU,SAAK,GAArBJ,KAAAA,CAAqB,GAArBA,GAAgB,CAAEG,GAAG,CAAC,CAACD,IAAI,GAAK,CAAC;wBAC/BG,IAAI,EAAEA,KAAI,EAAA,QAAA,CAACC,IAAI,CAAC,QAAQ,EAAEJ,IAAI,CAAC;wBAC/BK,GAAG,EAAEP,KAAK,CAACQ,IAAI;qBAChB,CAAC,CAAC,CAAA;aAAA,CACJ,CACAT,MAAM,CAACU,OAAO,CAAC,CACfC,IAAI,EAAE,AAAC;YAEV,IAAItB,CAAAA,0BAA0B,QAAY,GAAtCA,KAAAA,CAAsC,GAAtCA,0BAA0B,AAAE,CAACQ,QAAQ,CAAC,CAAA,IAAI,IAAI,EAAE;gBAClDE,MAAM,CAACa,IAAI,IAAIvB,0BAA0B,QAAY,GAAtCA,KAAAA,CAAsC,GAAtCA,0BAA0B,AAAE,CAACQ,QAAQ,CAAC,CAAC,CAAC;YACzD,CAAC;YAED,OAAO;gBACL,GAAGD,QAAQ;gBACX,CAACC,QAAQ,CAAC,EAAE;oBACV,+CAA+C;oBAC/C,iDAAiD;oBACjDC,MAAM,EAAEX,SAAS,CAACU,QAAQ,CAAC,CAAC,CAAC,CAAC;oBAC9BE,MAAM;iBACP;aACF,CAAC;QACJ,CAAC,EACD,EAAE,CACH;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -41,13 +41,6 @@ function _assert() {
|
|
|
41
41
|
};
|
|
42
42
|
return data;
|
|
43
43
|
}
|
|
44
|
-
function _crypto() {
|
|
45
|
-
const data = /*#__PURE__*/ _interopRequireDefault(require("crypto"));
|
|
46
|
-
_crypto = function() {
|
|
47
|
-
return data;
|
|
48
|
-
};
|
|
49
|
-
return data;
|
|
50
|
-
}
|
|
51
44
|
function _fs() {
|
|
52
45
|
const data = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
|
53
46
|
_fs = function() {
|
|
@@ -90,13 +83,6 @@ function _path() {
|
|
|
90
83
|
};
|
|
91
84
|
return data;
|
|
92
85
|
}
|
|
93
|
-
function _resolveFrom() {
|
|
94
|
-
const data = /*#__PURE__*/ _interopRequireDefault(require("resolve-from"));
|
|
95
|
-
_resolveFrom = function() {
|
|
96
|
-
return data;
|
|
97
|
-
};
|
|
98
|
-
return data;
|
|
99
|
-
}
|
|
100
86
|
const _resolveOptions = require("./resolveOptions");
|
|
101
87
|
const _xcodeCompilerLogger = require("./xcodeCompilerLogger");
|
|
102
88
|
const _log = require("../../log");
|
|
@@ -104,19 +90,20 @@ const _devServerManager = require("../../start/server/DevServerManager");
|
|
|
104
90
|
const _metroBundlerDevServer = require("../../start/server/metro/MetroBundlerDevServer");
|
|
105
91
|
const _instantiateMetro = require("../../start/server/metro/instantiateMetro");
|
|
106
92
|
const _metroPrivateServer = require("../../start/server/metro/metroPrivateServer");
|
|
107
|
-
const _serializeHtml = require("../../start/server/metro/serializeHtml");
|
|
108
93
|
const _domComponentsMiddleware = require("../../start/server/middleware/DomComponentsMiddleware");
|
|
109
94
|
const _metroOptions = require("../../start/server/middleware/metroOptions");
|
|
110
95
|
const _ansi = require("../../utils/ansi");
|
|
111
96
|
const _dir = require("../../utils/dir");
|
|
112
97
|
const _env = require("../../utils/env");
|
|
113
98
|
const _nodeEnv = require("../../utils/nodeEnv");
|
|
99
|
+
const _exportDomComponents = require("../exportDomComponents");
|
|
114
100
|
const _exportHermes = require("../exportHermes");
|
|
115
101
|
const _persistMetroAssets = require("../persistMetroAssets");
|
|
116
102
|
const _publicFolder = require("../publicFolder");
|
|
117
103
|
const _saveAssets = require("../saveAssets");
|
|
118
104
|
const _exportServer = require("./exportServer");
|
|
119
105
|
const _exit = require("../../utils/exit");
|
|
106
|
+
const _filePath = require("../../utils/filePath");
|
|
120
107
|
function _interopRequireDefault(obj) {
|
|
121
108
|
return obj && obj.__esModule ? obj : {
|
|
122
109
|
default: obj
|
|
@@ -131,7 +118,9 @@ function guessCopiedAppleBundlePath(bundleOutput) {
|
|
|
131
118
|
}
|
|
132
119
|
const bundleName = _path().default.basename(bundleOutput);
|
|
133
120
|
const bundleParent = _path().default.dirname(bundleOutput);
|
|
134
|
-
const possiblePath = (0, _glob().sync)(
|
|
121
|
+
const possiblePath = (0, _glob().sync)(`*.app/${bundleName}`, {
|
|
122
|
+
cwd: bundleParent,
|
|
123
|
+
absolute: true,
|
|
135
124
|
// bundle identifiers can start with dots.
|
|
136
125
|
dot: true
|
|
137
126
|
})[0];
|
|
@@ -239,7 +228,7 @@ async function exportEmbedBundleAndAssetsAsync(projectRoot, options) {
|
|
|
239
228
|
const bundles = await devServer.nativeExportBundleAsync({
|
|
240
229
|
// TODO: Re-enable when we get bytecode chunk splitting working again.
|
|
241
230
|
splitChunks: false,
|
|
242
|
-
mainModuleName: resolveRealEntryFilePath(projectRoot, options.entryFile),
|
|
231
|
+
mainModuleName: (0, _filePath.resolveRealEntryFilePath)(projectRoot, options.entryFile),
|
|
243
232
|
platform: options.platform,
|
|
244
233
|
minify: options.minify,
|
|
245
234
|
mode: options.dev ? "development" : "production",
|
|
@@ -264,7 +253,33 @@ async function exportEmbedBundleAndAssetsAsync(projectRoot, options) {
|
|
|
264
253
|
}
|
|
265
254
|
// TODO: Remove duplicates...
|
|
266
255
|
const expoDomComponentReferences = bundles.artifacts.map((artifact)=>Array.isArray(artifact.metadata.expoDomComponentReferences) ? artifact.metadata.expoDomComponentReferences : []).flat();
|
|
267
|
-
|
|
256
|
+
if (expoDomComponentReferences.length > 0) {
|
|
257
|
+
await Promise.all(// TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.
|
|
258
|
+
expoDomComponentReferences.map(async (filePath)=>{
|
|
259
|
+
const { bundle } = await (0, _exportDomComponents.exportDomComponentAsync)({
|
|
260
|
+
filePath,
|
|
261
|
+
projectRoot,
|
|
262
|
+
dev: options.dev,
|
|
263
|
+
devServer,
|
|
264
|
+
isHermes,
|
|
265
|
+
includeSourceMaps: !!sourceMapUrl,
|
|
266
|
+
exp,
|
|
267
|
+
files
|
|
268
|
+
});
|
|
269
|
+
if (options.assetsDest) {
|
|
270
|
+
// Save assets like a typical bundler, preserving the file paths on web.
|
|
271
|
+
// This is saving web-style inside of a native app's binary.
|
|
272
|
+
await (0, _persistMetroAssets.persistMetroAssetsAsync)(projectRoot, bundle.assets.map((asset)=>({
|
|
273
|
+
...asset,
|
|
274
|
+
httpServerLocation: _path().default.join(_domComponentsMiddleware.DOM_COMPONENTS_BUNDLE_DIR, asset.httpServerLocation)
|
|
275
|
+
})), {
|
|
276
|
+
files,
|
|
277
|
+
platform: "web",
|
|
278
|
+
outputDirectory: options.assetsDest
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}));
|
|
282
|
+
}
|
|
268
283
|
return {
|
|
269
284
|
files,
|
|
270
285
|
bundle: {
|
|
@@ -291,70 +306,6 @@ async function exportEmbedBundleAndAssetsAsync(projectRoot, options) {
|
|
|
291
306
|
devServerManager.stopAsync();
|
|
292
307
|
}
|
|
293
308
|
}
|
|
294
|
-
// TODO(EvanBacon): Move this to expo export in the future when we determine how to support DOM Components with hosting.
|
|
295
|
-
async function exportDomComponentsAsync(projectRoot, expoDomComponentReferences, options, devServer, isHermes, sourceMapUrl, exp, files) {
|
|
296
|
-
if (!expoDomComponentReferences.length) {
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
const virtualEntry = (0, _resolveFrom().default)(projectRoot, "expo/dom/entry.js");
|
|
300
|
-
await Promise.all(// TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.
|
|
301
|
-
expoDomComponentReferences.map(async (filePath)=>{
|
|
302
|
-
var ref;
|
|
303
|
-
debug("Bundle DOM Component:", filePath);
|
|
304
|
-
// MUST MATCH THE BABEL PLUGIN!
|
|
305
|
-
const hash = _crypto().default.createHash("sha1").update(filePath).digest("hex");
|
|
306
|
-
const outputName = `${_domComponentsMiddleware.DOM_COMPONENTS_BUNDLE_DIR}/${hash}.html`;
|
|
307
|
-
const generatedEntryPath = filePath.startsWith("file://") ? filePath.slice(7) : filePath;
|
|
308
|
-
const baseUrl = `/${_domComponentsMiddleware.DOM_COMPONENTS_BUNDLE_DIR}`;
|
|
309
|
-
const relativeImport = "./" + _path().default.relative(_path().default.dirname(virtualEntry), generatedEntryPath);
|
|
310
|
-
// Run metro bundler and create the JS bundles/source maps.
|
|
311
|
-
const bundle = await devServer.legacySinglePageExportBundleAsync({
|
|
312
|
-
platform: "web",
|
|
313
|
-
domRoot: encodeURI(relativeImport),
|
|
314
|
-
splitChunks: !_env.env.EXPO_NO_BUNDLE_SPLITTING,
|
|
315
|
-
mainModuleName: resolveRealEntryFilePath(projectRoot, virtualEntry),
|
|
316
|
-
mode: options.dev ? "development" : "production",
|
|
317
|
-
engine: isHermes ? "hermes" : undefined,
|
|
318
|
-
serializerIncludeMaps: !!sourceMapUrl,
|
|
319
|
-
bytecode: false,
|
|
320
|
-
reactCompiler: !!((ref = exp.experiments) == null ? void 0 : ref.reactCompiler),
|
|
321
|
-
baseUrl: "./",
|
|
322
|
-
// Minify may be false because it's skipped on native when Hermes is enabled, default to true.
|
|
323
|
-
minify: true
|
|
324
|
-
});
|
|
325
|
-
const html = await (0, _serializeHtml.serializeHtmlWithAssets)({
|
|
326
|
-
isExporting: true,
|
|
327
|
-
resources: bundle.artifacts,
|
|
328
|
-
template: (0, _domComponentsMiddleware.getDomComponentHtml)(),
|
|
329
|
-
baseUrl: "./"
|
|
330
|
-
});
|
|
331
|
-
(0, _saveAssets.getFilesFromSerialAssets)(bundle.artifacts.map((a)=>{
|
|
332
|
-
return {
|
|
333
|
-
...a,
|
|
334
|
-
filename: _path().default.join(baseUrl, a.filename)
|
|
335
|
-
};
|
|
336
|
-
}), {
|
|
337
|
-
includeSourceMaps: !!sourceMapUrl,
|
|
338
|
-
files,
|
|
339
|
-
platform: "web"
|
|
340
|
-
});
|
|
341
|
-
files.set(outputName, {
|
|
342
|
-
contents: html
|
|
343
|
-
});
|
|
344
|
-
if (options.assetsDest) {
|
|
345
|
-
// Save assets like a typical bundler, preserving the file paths on web.
|
|
346
|
-
// This is saving web-style inside of a native app's binary.
|
|
347
|
-
await (0, _persistMetroAssets.persistMetroAssetsAsync)(projectRoot, bundle.assets.map((asset)=>({
|
|
348
|
-
...asset,
|
|
349
|
-
httpServerLocation: _path().default.join(_domComponentsMiddleware.DOM_COMPONENTS_BUNDLE_DIR, asset.httpServerLocation)
|
|
350
|
-
})), {
|
|
351
|
-
files,
|
|
352
|
-
platform: "web",
|
|
353
|
-
outputDirectory: options.assetsDest
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
}));
|
|
357
|
-
}
|
|
358
309
|
async function createMetroServerAndBundleRequestAsync(projectRoot, options) {
|
|
359
310
|
const exp = (0, _config().getConfig)(projectRoot, {
|
|
360
311
|
skipSDKVersionRequirement: true
|
|
@@ -383,7 +334,7 @@ async function createMetroServerAndBundleRequestAsync(projectRoot, options) {
|
|
|
383
334
|
..._server().default.DEFAULT_BUNDLE_OPTIONS,
|
|
384
335
|
...(0, _metroOptions.getMetroDirectBundleOptionsForExpoConfig)(projectRoot, exp, {
|
|
385
336
|
splitChunks: false,
|
|
386
|
-
mainModuleName: resolveRealEntryFilePath(projectRoot, options.entryFile),
|
|
337
|
+
mainModuleName: (0, _filePath.resolveRealEntryFilePath)(projectRoot, options.entryFile),
|
|
387
338
|
platform: options.platform,
|
|
388
339
|
minify: options.minify,
|
|
389
340
|
mode: options.dev ? "development" : "production",
|
|
@@ -445,16 +396,5 @@ async function exportEmbedAssetsAsync(server, bundleRequest, projectRoot, option
|
|
|
445
396
|
function isError(error) {
|
|
446
397
|
return error instanceof Error;
|
|
447
398
|
}
|
|
448
|
-
/**
|
|
449
|
-
* This is a workaround for Metro not resolving entry file paths to their real location.
|
|
450
|
-
* When running exports through `eas build --local` on macOS, the `/var/folders` path is used instead of `/private/var/folders`.
|
|
451
|
-
*
|
|
452
|
-
* See: https://github.com/expo/expo/issues/28890
|
|
453
|
-
*/ function resolveRealEntryFilePath(projectRoot, entryFile) {
|
|
454
|
-
if (projectRoot.startsWith("/private/var") && entryFile.startsWith("/var")) {
|
|
455
|
-
return _fs().default.realpathSync(entryFile);
|
|
456
|
-
}
|
|
457
|
-
return entryFile;
|
|
458
|
-
}
|
|
459
399
|
|
|
460
400
|
//# sourceMappingURL=exportEmbedAsync.js.map
|
|
@@ -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 { ExpoConfig, getConfig } from '@expo/config';\nimport getMetroAssets from '@expo/metro-config/build/transform-worker/getAssets';\nimport assert from 'assert';\nimport crypto from 'crypto';\nimport fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport Server from 'metro/src/Server';\nimport splitBundleOptions from 'metro/src/lib/splitBundleOptions';\nimport output from 'metro/src/shared/output/bundle';\nimport type { BundleOptions } from 'metro/src/shared/types';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\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 { assertMetroPrivateServer } from '../../start/server/metro/metroPrivateServer';\nimport { serializeHtmlWithAssets } from '../../start/server/metro/serializeHtml';\nimport {\n getDomComponentHtml,\n DOM_COMPONENTS_BUNDLE_DIR,\n} 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 { isEnableHermesManaged } from '../exportHermes';\nimport { persistMetroAssetsAsync } from '../persistMetroAssets';\nimport { copyPublicFolderAsync } from '../publicFolder';\nimport {\n BundleAssetWithFileHashes,\n ExportAssetMap,\n getFilesFromSerialAssets,\n persistMetroFilesAsync,\n} from '../saveAssets';\nimport { exportStandaloneServerAsync } from './exportServer';\nimport { ensureProcessExitsAfterDelay } from '../../utils/exit';\n\nconst debug = require('debug')('expo:export:embed');\n\nfunction guessCopiedAppleBundlePath(bundleOutput: string) {\n // Ensure the path is familiar before guessing.\n if (!bundleOutput.match(/\\/Xcode\\/DerivedData\\/.*\\/Build\\/Products\\//)) {\n debug('Bundling to non-standard location:', bundleOutput);\n return false;\n }\n const bundleName = path.basename(bundleOutput);\n const bundleParent = path.dirname(bundleOutput);\n const possiblePath = globSync(path.join(bundleParent, `*.app/${bundleName}`), {\n // bundle identifiers can start with dots.\n dot: true,\n })[0];\n debug('Possible path for previous bundle:', possiblePath);\n return possiblePath;\n}\n\nexport async function exportEmbedAsync(projectRoot: string, options: Options) {\n // The React Native build scripts always enable the cache reset but we shouldn't need this in CI environments.\n // By disabling it, we can eagerly bundle code before the build and reuse the cached artifacts in subsequent builds.\n if (env.CI && options.resetCache) {\n debug('CI environment detected, disabling automatic cache reset');\n options.resetCache = false;\n }\n\n setNodeEnv(options.dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n\n // This is an optimized codepath that can occur during `npx expo run` and does not occur during builds from Xcode or Android Studio.\n // Here we reconcile a bundle pass that was run before the native build process. This order can fail faster and is show better errors since the logs won't be obscured by Xcode and Android Studio.\n // This path is also used for automatically deploying server bundles to a remote host.\n const eagerBundleOptions = env.__EXPO_EAGER_BUNDLE_OPTIONS\n ? deserializeEagerKey(env.__EXPO_EAGER_BUNDLE_OPTIONS)\n : null;\n if (eagerBundleOptions) {\n // Get the cache key for the current process to compare against the eager key.\n const inputKey = getExportEmbedOptionsKey(options);\n\n // If the app was bundled previously in the same process, then we should reuse the Metro cache.\n options.resetCache = false;\n\n if (eagerBundleOptions.key === inputKey) {\n // Copy the eager bundleOutput and assets to the new locations.\n await removeAsync(options.bundleOutput);\n\n copyAsync(eagerBundleOptions.options.bundleOutput, options.bundleOutput);\n\n if (eagerBundleOptions.options.assetsDest && options.assetsDest) {\n copyAsync(eagerBundleOptions.options.assetsDest, options.assetsDest);\n }\n\n console.log('info: Copied output to binary:', options.bundleOutput);\n return;\n }\n // TODO: sourcemapOutput is set on Android but not during eager. This is tolerable since it doesn't invalidate the Metro cache.\n console.log(' Eager key:', eagerBundleOptions.key);\n console.log('Request key:', inputKey);\n\n // TODO: We may want an analytic event here in the future to understand when this happens.\n console.warn('warning: Eager bundle does not match new options, bundling again.');\n }\n\n await exportEmbedInternalAsync(projectRoot, options);\n\n // Ensure the process closes after bundling\n ensureProcessExitsAfterDelay();\n}\n\nexport async function exportEmbedInternalAsync(projectRoot: string, options: Options) {\n // Ensure we delete the old bundle to trigger a failure if the bundle cannot be created.\n await removeAsync(options.bundleOutput);\n\n // The iOS bundle is copied in to the Xcode project, so we need to remove the old one\n // to prevent Xcode from loading the old one after a build failure.\n if (options.platform === 'ios') {\n const previousPath = guessCopiedAppleBundlePath(options.bundleOutput);\n if (previousPath && fs.existsSync(previousPath)) {\n debug('Removing previous iOS bundle:', previousPath);\n await removeAsync(previousPath);\n }\n }\n\n const { bundle, assets, files } = await exportEmbedBundleAndAssetsAsync(projectRoot, options);\n\n fs.mkdirSync(path.dirname(options.bundleOutput), { recursive: true, mode: 0o755 });\n\n // On Android, dom components proxy files should write to the assets directory instead of the res directory.\n // We use the bundleOutput directory to get the assets directory.\n const domComponentProxyOutputDir =\n options.platform === 'android' ? path.dirname(options.bundleOutput) : options.assetsDest;\n const hasDomComponents = domComponentProxyOutputDir && files.size > 0;\n\n // Persist bundle and source maps.\n await Promise.all([\n output.save(bundle, options, Log.log),\n\n // Write dom components proxy files.\n hasDomComponents ? persistMetroFilesAsync(files, domComponentProxyOutputDir) : null,\n // Copy public folder for dom components only if\n hasDomComponents\n ? copyPublicFolderAsync(\n path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER),\n path.join(domComponentProxyOutputDir, DOM_COMPONENTS_BUNDLE_DIR)\n )\n : null,\n\n // NOTE(EvanBacon): This may need to be adjusted in the future if want to support baseUrl on native\n // platforms when doing production embeds (unlikely).\n options.assetsDest\n ? persistMetroAssetsAsync(projectRoot, assets, {\n platform: options.platform,\n outputDirectory: options.assetsDest,\n iosAssetCatalogDirectory: options.assetCatalogDest,\n })\n : null,\n ]);\n}\n\nexport async function exportEmbedBundleAndAssetsAsync(\n projectRoot: string,\n options: Options\n): Promise<{\n bundle: Awaited<ReturnType<Server['build']>>;\n assets: readonly BundleAssetWithFileHashes[];\n files: ExportAssetMap;\n}> {\n const devServerManager = await DevServerManager.startMetroAsync(projectRoot, {\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n port: 8081,\n isExporting: true,\n location: {},\n resetDevServer: options.resetCache,\n maxWorkers: options.maxWorkers,\n });\n\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const { exp, pkg } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n const files: ExportAssetMap = new Map();\n\n try {\n const bundles = await devServer.nativeExportBundleAsync(\n {\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 // Never output bytecode in the exported bundle since that is hardcoded in the native run script.\n 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\n await exportDomComponentsAsync(\n projectRoot,\n expoDomComponentReferences,\n options,\n devServer,\n isHermes,\n sourceMapUrl,\n exp,\n files\n );\n\n return {\n files,\n bundle: {\n code: bundles.artifacts.filter((a: any) => a.type === 'js')[0].source.toString(),\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// TODO(EvanBacon): Move this to expo export in the future when we determine how to support DOM Components with hosting.\nasync function exportDomComponentsAsync(\n projectRoot: string,\n expoDomComponentReferences: string[],\n options: Options,\n devServer: MetroBundlerDevServer,\n isHermes: boolean,\n sourceMapUrl: string | undefined,\n exp: ExpoConfig,\n files: ExportAssetMap\n) {\n if (!expoDomComponentReferences.length) {\n return;\n }\n\n const virtualEntry = resolveFrom(projectRoot, 'expo/dom/entry.js');\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 debug('Bundle DOM Component:', filePath);\n // MUST MATCH THE BABEL PLUGIN!\n const hash = crypto.createHash('sha1').update(filePath).digest('hex');\n const outputName = `${DOM_COMPONENTS_BUNDLE_DIR}/${hash}.html`;\n const generatedEntryPath = filePath.startsWith('file://') ? filePath.slice(7) : filePath;\n const baseUrl = `/${DOM_COMPONENTS_BUNDLE_DIR}`;\n const relativeImport = './' + path.relative(path.dirname(virtualEntry), generatedEntryPath);\n // Run metro bundler and create the JS bundles/source maps.\n const bundle = await devServer.legacySinglePageExportBundleAsync({\n platform: 'web',\n domRoot: encodeURI(relativeImport),\n splitChunks: !env.EXPO_NO_BUNDLE_SPLITTING,\n mainModuleName: resolveRealEntryFilePath(projectRoot, virtualEntry),\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: !!sourceMapUrl,\n bytecode: false,\n reactCompiler: !!exp.experiments?.reactCompiler,\n baseUrl: './',\n // Minify may be false because it's skipped on native when Hermes is enabled, default to true.\n minify: true,\n });\n\n const html = await serializeHtmlWithAssets({\n isExporting: true,\n resources: bundle.artifacts,\n template: getDomComponentHtml(),\n baseUrl: './',\n });\n\n getFilesFromSerialAssets(\n bundle.artifacts.map((a) => {\n return {\n ...a,\n filename: path.join(baseUrl, a.filename),\n };\n }),\n {\n includeSourceMaps: !!sourceMapUrl,\n files,\n platform: 'web',\n }\n );\n\n files.set(outputName, {\n contents: html,\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// 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 bundleType: 'todo',\n });\n\n assertMetroPrivateServer(server);\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\n/**\n * This is a workaround for Metro not resolving entry file paths to their real location.\n * When running exports through `eas build --local` on macOS, the `/var/folders` path is used instead of `/private/var/folders`.\n *\n * See: https://github.com/expo/expo/issues/28890\n */\nfunction resolveRealEntryFilePath(projectRoot: string, entryFile: string): string {\n if (projectRoot.startsWith('/private/var') && entryFile.startsWith('/var')) {\n return fs.realpathSync(entryFile);\n }\n\n return entryFile;\n}\n"],"names":["exportEmbedAsync","exportEmbedInternalAsync","exportEmbedBundleAndAssetsAsync","createMetroServerAndBundleRequestAsync","exportEmbedAssetsAsync","debug","require","guessCopiedAppleBundlePath","bundleOutput","match","bundleName","path","basename","bundleParent","dirname","possiblePath","globSync","join","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","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","exportDomComponentsAsync","code","filter","a","type","source","toString","error","isError","isExecutingFromXcodebuild","message","stripAnsi","logMetroErrorInXcode","stopAsync","length","virtualEntry","resolveFrom","filePath","hash","crypto","createHash","update","digest","outputName","generatedEntryPath","startsWith","slice","baseUrl","relativeImport","relative","legacySinglePageExportBundleAsync","domRoot","encodeURI","EXPO_NO_BUNDLE_SPLITTING","html","serializeHtmlWithAssets","resources","template","getDomComponentHtml","getFilesFromSerialAssets","filename","includeSourceMaps","set","contents","asset","httpServerLocation","config","loadMetroConfigAsync","getMetroBundler","server","getBundler","bundleRequest","Server","DEFAULT_BUNDLE_OPTIONS","getMetroDirectBundleOptionsForExpoConfig","watch","onProgress","resolverOptions","transformOptions","splitBundleOptions","bundleType","assertMetroPrivateServer","dependencies","_bundler","getDependencies","shallow","lazy","_config","getMetroAssets","processModuleFilter","serializer","assetPlugins","transformer","publicPath","Error","realpathSync"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;;IA4DsBA,gBAAgB,MAAhBA,gBAAgB;IAmDhBC,wBAAwB,MAAxBA,wBAAwB;IAkDxBC,+BAA+B,MAA/BA,+BAA+B;IA0M/BC,sCAAsC,MAAtCA,sCAAsC;IAuEtCC,sBAAsB,MAAtBA,sBAAsB;;;yBAlbN,cAAc;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O,CAAC,AAAU,CAAC;gBACrD,CAAC;gBACDE,IAAAA,oBAAoB,qBAAA,EAAC7G,WAAW,EAAEwG,KAAK,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;QACD,MAAMA,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAASC,OAAO,CAACD,KAAU,EAAkB;IAC3C,OAAOA,KAAK,YAAYmE,KAAK,CAAC;AAChC,CAAC;AAED;;;;;CAKC,GACD,SAAShG,wBAAwB,CAAC3E,WAAmB,EAAE4E,SAAiB,EAAU;IAChF,IAAI5E,WAAW,CAAC0H,UAAU,CAAC,cAAc,CAAC,IAAI9C,SAAS,CAAC8C,UAAU,CAAC,MAAM,CAAC,EAAE;QAC1E,OAAOnG,GAAE,EAAA,QAAA,CAACqJ,YAAY,CAAChG,SAAS,CAAC,CAAC;IACpC,CAAC;IAED,OAAOA,SAAS,CAAC;AACnB,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/export/embed/exportEmbedAsync.ts"],"sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getConfig } from '@expo/config';\nimport getMetroAssets from '@expo/metro-config/build/transform-worker/getAssets';\nimport assert from 'assert';\nimport fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport Server from 'metro/src/Server';\nimport splitBundleOptions from 'metro/src/lib/splitBundleOptions';\nimport output from 'metro/src/shared/output/bundle';\nimport type { BundleOptions } from 'metro/src/shared/types';\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 { assertMetroPrivateServer } from '../../start/server/metro/metroPrivateServer';\nimport { DOM_COMPONENTS_BUNDLE_DIR } from '../../start/server/middleware/DomComponentsMiddleware';\nimport { getMetroDirectBundleOptionsForExpoConfig } from '../../start/server/middleware/metroOptions';\nimport { stripAnsi } from '../../utils/ansi';\nimport { copyAsync, removeAsync } from '../../utils/dir';\nimport { env } from '../../utils/env';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { exportDomComponentAsync } from '../exportDomComponents';\nimport { isEnableHermesManaged } from '../exportHermes';\nimport { persistMetroAssetsAsync } from '../persistMetroAssets';\nimport { copyPublicFolderAsync } from '../publicFolder';\nimport { BundleAssetWithFileHashes, ExportAssetMap, persistMetroFilesAsync } from '../saveAssets';\nimport { exportStandaloneServerAsync } from './exportServer';\nimport { ensureProcessExitsAfterDelay } from '../../utils/exit';\nimport { resolveRealEntryFilePath } from '../../utils/filePath';\n\nconst debug = require('debug')('expo:export:embed');\n\nfunction guessCopiedAppleBundlePath(bundleOutput: string) {\n // Ensure the path is familiar before guessing.\n if (!bundleOutput.match(/\\/Xcode\\/DerivedData\\/.*\\/Build\\/Products\\//)) {\n debug('Bundling to non-standard location:', bundleOutput);\n return false;\n }\n const bundleName = path.basename(bundleOutput);\n const bundleParent = path.dirname(bundleOutput);\n const possiblePath = globSync(`*.app/${bundleName}`, {\n cwd: bundleParent,\n absolute: true,\n // bundle identifiers can start with dots.\n dot: true,\n })[0];\n debug('Possible path for previous bundle:', possiblePath);\n return possiblePath;\n}\n\nexport async function exportEmbedAsync(projectRoot: string, options: Options) {\n // The React Native build scripts always enable the cache reset but we shouldn't need this in CI environments.\n // By disabling it, we can eagerly bundle code before the build and reuse the cached artifacts in subsequent builds.\n if (env.CI && options.resetCache) {\n debug('CI environment detected, disabling automatic cache reset');\n options.resetCache = false;\n }\n\n setNodeEnv(options.dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n\n // This is an optimized codepath that can occur during `npx expo run` and does not occur during builds from Xcode or Android Studio.\n // Here we reconcile a bundle pass that was run before the native build process. This order can fail faster and is show better errors since the logs won't be obscured by Xcode and Android Studio.\n // This path is also used for automatically deploying server bundles to a remote host.\n const eagerBundleOptions = env.__EXPO_EAGER_BUNDLE_OPTIONS\n ? deserializeEagerKey(env.__EXPO_EAGER_BUNDLE_OPTIONS)\n : null;\n if (eagerBundleOptions) {\n // Get the cache key for the current process to compare against the eager key.\n const inputKey = getExportEmbedOptionsKey(options);\n\n // If the app was bundled previously in the same process, then we should reuse the Metro cache.\n options.resetCache = false;\n\n if (eagerBundleOptions.key === inputKey) {\n // Copy the eager bundleOutput and assets to the new locations.\n await removeAsync(options.bundleOutput);\n\n copyAsync(eagerBundleOptions.options.bundleOutput, options.bundleOutput);\n\n if (eagerBundleOptions.options.assetsDest && options.assetsDest) {\n copyAsync(eagerBundleOptions.options.assetsDest, options.assetsDest);\n }\n\n console.log('info: Copied output to binary:', options.bundleOutput);\n return;\n }\n // TODO: sourcemapOutput is set on Android but not during eager. This is tolerable since it doesn't invalidate the Metro cache.\n console.log(' Eager key:', eagerBundleOptions.key);\n console.log('Request key:', inputKey);\n\n // TODO: We may want an analytic event here in the future to understand when this happens.\n console.warn('warning: Eager bundle does not match new options, bundling again.');\n }\n\n await exportEmbedInternalAsync(projectRoot, options);\n\n // Ensure the process closes after bundling\n ensureProcessExitsAfterDelay();\n}\n\nexport async function exportEmbedInternalAsync(projectRoot: string, options: Options) {\n // Ensure we delete the old bundle to trigger a failure if the bundle cannot be created.\n await removeAsync(options.bundleOutput);\n\n // The iOS bundle is copied in to the Xcode project, so we need to remove the old one\n // to prevent Xcode from loading the old one after a build failure.\n if (options.platform === 'ios') {\n const previousPath = guessCopiedAppleBundlePath(options.bundleOutput);\n if (previousPath && fs.existsSync(previousPath)) {\n debug('Removing previous iOS bundle:', previousPath);\n await removeAsync(previousPath);\n }\n }\n\n const { bundle, assets, files } = await exportEmbedBundleAndAssetsAsync(projectRoot, options);\n\n fs.mkdirSync(path.dirname(options.bundleOutput), { recursive: true, mode: 0o755 });\n\n // On Android, dom components proxy files should write to the assets directory instead of the res directory.\n // We use the bundleOutput directory to get the assets directory.\n const domComponentProxyOutputDir =\n options.platform === 'android' ? path.dirname(options.bundleOutput) : options.assetsDest;\n const hasDomComponents = domComponentProxyOutputDir && files.size > 0;\n\n // Persist bundle and source maps.\n await Promise.all([\n output.save(bundle, options, Log.log),\n\n // Write dom components proxy files.\n hasDomComponents ? persistMetroFilesAsync(files, domComponentProxyOutputDir) : null,\n // Copy public folder for dom components only if\n hasDomComponents\n ? copyPublicFolderAsync(\n path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER),\n path.join(domComponentProxyOutputDir, DOM_COMPONENTS_BUNDLE_DIR)\n )\n : null,\n\n // NOTE(EvanBacon): This may need to be adjusted in the future if want to support baseUrl on native\n // platforms when doing production embeds (unlikely).\n options.assetsDest\n ? persistMetroAssetsAsync(projectRoot, assets, {\n platform: options.platform,\n outputDirectory: options.assetsDest,\n iosAssetCatalogDirectory: options.assetCatalogDest,\n })\n : null,\n ]);\n}\n\nexport async function exportEmbedBundleAndAssetsAsync(\n projectRoot: string,\n options: Options\n): Promise<{\n bundle: Awaited<ReturnType<Server['build']>>;\n assets: readonly BundleAssetWithFileHashes[];\n files: ExportAssetMap;\n}> {\n const devServerManager = await DevServerManager.startMetroAsync(projectRoot, {\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n port: 8081,\n isExporting: true,\n location: {},\n resetDevServer: options.resetCache,\n maxWorkers: options.maxWorkers,\n });\n\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const { exp, pkg } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n const files: ExportAssetMap = new Map();\n\n try {\n const bundles = await devServer.nativeExportBundleAsync(\n {\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 // Never output bytecode in the exported bundle since that is hardcoded in the native run script.\n 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.toString(),\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 bundleType: 'todo',\n });\n\n assertMetroPrivateServer(server);\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":["exportEmbedAsync","exportEmbedInternalAsync","exportEmbedBundleAndAssetsAsync","createMetroServerAndBundleRequestAsync","exportEmbedAssetsAsync","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","assertMetroPrivateServer","dependencies","_bundler","getDependencies","shallow","lazy","_config","getMetroAssets","processModuleFilter","serializer","assetPlugins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AAC5G,QAAQ;YACnC,2FAA2F;YAC3F,YAAY;YACZrB,WAAW,EAAEqH,MAAM,CAACrH,WAAW;YAC/BgJ,UAAU,EAAE3B,MAAM,CAAC0B,WAAW,CAACC,UAAU;SAC1C,CAAC,CAAC;IACL,EAAE,OAAOlC,KAAK,EAAO;QACnB,IAAIC,OAAO,CAACD,KAAK,CAAC,EAAE;YAClB,0EAA0E;YAC1E,iIAAiI;YACjI,IAAI7G,OAAO,CAACoB,QAAQ,KAAK,KAAK,EAAE;gBAC9B,8FAA8F;gBAC9F,IAAI,SAAS,IAAIyF,KAAK,IAAIE,IAAAA,oBAAyB,0BAAA,GAAE,EAAE;oBACrDF,KAAK,CAACG,OAAO,GAAGC,IAAAA,KAAS,UAAA,EAACJ,KAAK,CAACG,OAAO,CAAC,AAAU,CAAC;gBACrD,CAAC;gBACDE,IAAAA,oBAAoB,qBAAA,EAACnH,WAAW,EAAE8G,KAAK,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;QACD,MAAMA,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAASC,OAAO,CAACD,KAAU,EAAkB;IAC3C,OAAOA,KAAK,YAAYmC,KAAK,CAAC;AAChC,CAAC"}
|
|
@@ -42,9 +42,9 @@ function _path() {
|
|
|
42
42
|
};
|
|
43
43
|
return data;
|
|
44
44
|
}
|
|
45
|
-
const _guessHermes = require("./guessHermes");
|
|
46
45
|
const _env = require("../../utils/env");
|
|
47
46
|
const _errors = require("../../utils/errors");
|
|
47
|
+
const _exportHermes = require("../exportHermes");
|
|
48
48
|
function _interopRequireDefault(obj) {
|
|
49
49
|
return obj && obj.__esModule ? obj : {
|
|
50
50
|
default: obj
|
|
@@ -110,7 +110,7 @@ function getTemporaryPath() {
|
|
|
110
110
|
}
|
|
111
111
|
function resolveEagerOptionsAsync(projectRoot, { dev , platform , assetsDest , bundleOutput , minify , ...options }) {
|
|
112
112
|
// If the minify prop is undefined, then check if the project is using hermes.
|
|
113
|
-
minify ??= !(platform === "android" ? (0,
|
|
113
|
+
minify ??= !(platform === "android" ? (0, _exportHermes.isAndroidUsingHermes)(projectRoot) : (0, _exportHermes.isIosUsingHermes)(projectRoot));
|
|
114
114
|
let destination;
|
|
115
115
|
if (!assetsDest) {
|
|
116
116
|
destination ??= getTemporaryPath();
|
|
@@ -138,7 +138,7 @@ function resolveEagerOptionsAsync(projectRoot, { dev , platform , assetsDest , b
|
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
140
|
function getExportEmbedOptionsKey({ // Extract all values that won't change the Metro results.
|
|
141
|
-
resetCache , assetsDest , bundleOutput , verbose , maxWorkers , ...options }) {
|
|
141
|
+
resetCache , assetsDest , bundleOutput , verbose , maxWorkers , eager , ...options }) {
|
|
142
142
|
// Create a sorted key for the options, removing values that won't change the Metro results.
|
|
143
143
|
return JSON.stringify(options, _canonicalize().default);
|
|
144
144
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/export/embed/resolveOptions.ts"],"sourcesContent":["import { resolveEntryPoint } from '@expo/config/paths';\nimport arg from 'arg';\nimport type { OutputOptions } from 'metro/src/shared/types';\nimport canonicalize from 'metro-core/src/canonicalize';\nimport os from 'os';\nimport path from 'path';\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/export/embed/resolveOptions.ts"],"sourcesContent":["import { resolveEntryPoint } from '@expo/config/paths';\nimport arg from 'arg';\nimport type { OutputOptions } from 'metro/src/shared/types';\nimport canonicalize from 'metro-core/src/canonicalize';\nimport os from 'os';\nimport path from 'path';\n\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { resolveCustomBooleanArgsAsync } from '../../utils/resolveArgs';\nimport { isAndroidUsingHermes, isIosUsingHermes } from '../exportHermes';\n\nexport interface Options {\n assetsDest?: string;\n assetCatalogDest?: string;\n entryFile: string;\n resetCache: boolean;\n transformer?: string;\n minify?: boolean;\n config?: string;\n platform: string;\n dev: boolean;\n bundleOutput: string;\n bundleEncoding?: OutputOptions['bundleEncoding'];\n maxWorkers?: number;\n sourcemapOutput?: string;\n sourcemapSourcesRoot?: string;\n sourcemapUseAbsolutePath: boolean;\n verbose: boolean;\n unstableTransformProfile?: string;\n eager?: boolean;\n}\n\nfunction assertIsBoolean(val: any): asserts val is boolean {\n if (typeof val !== 'boolean') {\n throw new CommandError(`Expected boolean, got ${typeof val}`);\n }\n}\n\nfunction getBundleEncoding(encoding: string | undefined): OutputOptions['bundleEncoding'] {\n return encoding === 'utf8' || encoding === 'utf16le' || encoding === 'ascii'\n ? encoding\n : undefined;\n}\n\nexport function resolveOptions(\n projectRoot: string,\n args: arg.Result<arg.Spec>,\n parsed: Awaited<ReturnType<typeof resolveCustomBooleanArgsAsync>>\n): Options {\n const dev = parsed.args['--dev'] ?? true;\n assertIsBoolean(dev);\n\n const platform = args['--platform'];\n if (!platform) {\n throw new CommandError(`Missing required argument: --platform`);\n }\n\n const bundleOutput = args['--bundle-output'];\n\n const commonOptions = {\n entryFile: args['--entry-file'] ?? resolveEntryPoint(projectRoot, { platform }),\n assetCatalogDest: args['--asset-catalog-dest'],\n platform,\n transformer: args['--transformer'],\n // TODO: Support `--dev false`\n // dev: false,\n bundleOutput,\n bundleEncoding: getBundleEncoding(args['--bundle-encoding']) ?? 'utf8',\n maxWorkers: args['--max-workers'],\n sourcemapOutput: args['--sourcemap-output'],\n sourcemapSourcesRoot: args['--sourcemap-sources-root'],\n sourcemapUseAbsolutePath: !!parsed.args['--sourcemap-use-absolute-path'],\n assetsDest: args['--assets-dest'],\n unstableTransformProfile: args['--unstable-transform-profile'],\n resetCache: !!parsed.args['--reset-cache'],\n verbose: args['--verbose'] ?? env.EXPO_DEBUG,\n config: args['--config'] ? path.resolve(args['--config']) : undefined,\n dev,\n minify: parsed.args['--minify'] as boolean | undefined,\n eager: !!parsed.args['--eager'],\n };\n\n if (commonOptions.eager) {\n return resolveEagerOptionsAsync(projectRoot, commonOptions);\n }\n\n // Perform extra assertions after the eager options are resolved.\n\n if (!bundleOutput) {\n throw new CommandError(`Missing required argument: --bundle-output`);\n }\n\n const minify = parsed.args['--minify'] ?? !dev;\n assertIsBoolean(minify);\n\n return { ...commonOptions, minify, bundleOutput };\n}\n\nfunction getTemporaryPath() {\n return path.join(os.tmpdir(), Math.random().toString(36).substring(2));\n}\n\n/** Best effort guess of which options will be used for the export:embed invocation that is called from the native build scripts. */\nexport function resolveEagerOptionsAsync(\n projectRoot: string,\n {\n dev,\n platform,\n assetsDest,\n bundleOutput,\n minify,\n ...options\n }: Partial<Omit<Options, 'platform' | 'dev'>> & {\n platform: string;\n dev: boolean;\n }\n): Options {\n // If the minify prop is undefined, then check if the project is using hermes.\n minify ??= !(platform === 'android'\n ? isAndroidUsingHermes(projectRoot)\n : isIosUsingHermes(projectRoot));\n\n let destination: string | undefined;\n\n if (!assetsDest) {\n destination ??= getTemporaryPath();\n assetsDest = path.join(destination, 'assets');\n }\n\n if (!bundleOutput) {\n destination ??= getTemporaryPath();\n bundleOutput =\n platform === 'ios'\n ? path.join(destination, 'main.jsbundle')\n : path.join(destination, 'index.js');\n }\n\n return {\n ...options,\n eager: options.eager ?? true,\n bundleOutput,\n assetsDest,\n entryFile: options.entryFile ?? resolveEntryPoint(projectRoot, { platform }),\n resetCache: !!options.resetCache,\n platform,\n minify,\n dev,\n bundleEncoding: 'utf8',\n sourcemapUseAbsolutePath: false,\n verbose: env.EXPO_DEBUG,\n };\n}\n\nexport function getExportEmbedOptionsKey({\n // Extract all values that won't change the Metro results.\n resetCache,\n assetsDest,\n bundleOutput,\n verbose,\n maxWorkers,\n eager,\n ...options\n}: Options) {\n // Create a sorted key for the options, removing values that won't change the Metro results.\n return JSON.stringify(options, canonicalize);\n}\n\nexport function deserializeEagerKey(key: string) {\n return JSON.parse(key) as { options: Options; key: string };\n}\n"],"names":["resolveOptions","resolveEagerOptionsAsync","getExportEmbedOptionsKey","deserializeEagerKey","assertIsBoolean","val","CommandError","getBundleEncoding","encoding","undefined","projectRoot","args","parsed","dev","platform","bundleOutput","commonOptions","entryFile","resolveEntryPoint","assetCatalogDest","transformer","bundleEncoding","maxWorkers","sourcemapOutput","sourcemapSourcesRoot","sourcemapUseAbsolutePath","assetsDest","unstableTransformProfile","resetCache","verbose","env","EXPO_DEBUG","config","path","resolve","minify","eager","getTemporaryPath","join","os","tmpdir","Math","random","toString","substring","options","isAndroidUsingHermes","isIosUsingHermes","destination","JSON","stringify","canonicalize","key","parse"],"mappings":"AAAA;;;;;;;;;;;IA6CgBA,cAAc,MAAdA,cAAc;IA2DdC,wBAAwB,MAAxBA,wBAAwB;IAkDxBC,wBAAwB,MAAxBA,wBAAwB;IAcxBC,mBAAmB,MAAnBA,mBAAmB;;;yBAxKD,oBAAoB;;;;;;;8DAG7B,6BAA6B;;;;;;;8DACvC,IAAI;;;;;;;8DACF,MAAM;;;;;;qBAEH,iBAAiB;wBACR,oBAAoB;8BAEM,iBAAiB;;;;;;AAuBxE,SAASC,eAAe,CAACC,GAAQ,EAA0B;IACzD,IAAI,OAAOA,GAAG,KAAK,SAAS,EAAE;QAC5B,MAAM,IAAIC,OAAY,aAAA,CAAC,CAAC,sBAAsB,EAAE,OAAOD,GAAG,CAAC,CAAC,CAAC,CAAC;IAChE,CAAC;AACH,CAAC;AAED,SAASE,iBAAiB,CAACC,QAA4B,EAAmC;IACxF,OAAOA,QAAQ,KAAK,MAAM,IAAIA,QAAQ,KAAK,SAAS,IAAIA,QAAQ,KAAK,OAAO,GACxEA,QAAQ,GACRC,SAAS,CAAC;AAChB,CAAC;AAEM,SAAST,cAAc,CAC5BU,WAAmB,EACnBC,IAA0B,EAC1BC,MAAiE,EACxD;IACT,MAAMC,GAAG,GAAGD,MAAM,CAACD,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,AAAC;IACzCP,eAAe,CAACS,GAAG,CAAC,CAAC;IAErB,MAAMC,QAAQ,GAAGH,IAAI,CAAC,YAAY,CAAC,AAAC;IACpC,IAAI,CAACG,QAAQ,EAAE;QACb,MAAM,IAA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
45
45
|
const _exportAssets = require("./exportAssets");
|
|
46
|
+
const _exportDomComponents = require("./exportDomComponents");
|
|
46
47
|
const _exportHermes = require("./exportHermes");
|
|
47
48
|
const _exportStaticAsync = require("./exportStaticAsync");
|
|
48
49
|
const _favicon = require("./favicon");
|
|
@@ -155,6 +156,7 @@ async function exportAppAsync(projectRoot, { platforms , outputDir , clear , dev
|
|
|
155
156
|
const devServer = devServerManager.getDefaultDevServer();
|
|
156
157
|
(0, _assert().default)(devServer instanceof _metroBundlerDevServer.MetroBundlerDevServer);
|
|
157
158
|
const bundles = {};
|
|
159
|
+
const domComponentAssetsMetadata = {};
|
|
158
160
|
const spaPlatforms = useServerRendering ? platforms.filter((platform)=>platform !== "web") : platforms;
|
|
159
161
|
try {
|
|
160
162
|
// NOTE(kitten): The public folder is currently always copied, regardless of targetDomain
|
|
@@ -185,11 +187,39 @@ async function exportAppAsync(projectRoot, { platforms , outputDir , clear , dev
|
|
|
185
187
|
reactCompiler: !!((ref = exp.experiments) == null ? void 0 : ref.reactCompiler)
|
|
186
188
|
}, files);
|
|
187
189
|
bundles[platform] = bundle;
|
|
190
|
+
domComponentAssetsMetadata[platform] = [];
|
|
188
191
|
(0, _saveAssets.getFilesFromSerialAssets)(bundle.artifacts, {
|
|
189
192
|
includeSourceMaps: sourceMaps,
|
|
190
193
|
files,
|
|
191
194
|
isServerHosted: devServer.isReactServerComponentsEnabled
|
|
192
195
|
});
|
|
196
|
+
// TODO: Remove duplicates...
|
|
197
|
+
const expoDomComponentReferences = bundle.artifacts.map((artifact)=>Array.isArray(artifact.metadata.expoDomComponentReferences) ? artifact.metadata.expoDomComponentReferences : []).flat();
|
|
198
|
+
await Promise.all(// TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.
|
|
199
|
+
expoDomComponentReferences.map(async (filePath)=>{
|
|
200
|
+
var ref;
|
|
201
|
+
const { bundle: platformDomComponentsBundle , htmlOutputName } = await (0, _exportDomComponents.exportDomComponentAsync)({
|
|
202
|
+
filePath,
|
|
203
|
+
projectRoot,
|
|
204
|
+
dev,
|
|
205
|
+
devServer,
|
|
206
|
+
isHermes,
|
|
207
|
+
includeSourceMaps: sourceMaps,
|
|
208
|
+
exp,
|
|
209
|
+
files
|
|
210
|
+
});
|
|
211
|
+
// Merge the assets from the DOM component into the output assets.
|
|
212
|
+
// @ts-expect-error: mutate assets
|
|
213
|
+
bundle.assets.push(...platformDomComponentsBundle.assets);
|
|
214
|
+
const assetsMetadata = (0, _exportDomComponents.updateDomComponentAssetsForMD5Naming)({
|
|
215
|
+
domComponentReference: filePath,
|
|
216
|
+
nativeBundle: bundle,
|
|
217
|
+
domComponentBundle: platformDomComponentsBundle,
|
|
218
|
+
files,
|
|
219
|
+
htmlOutputName
|
|
220
|
+
});
|
|
221
|
+
(ref = domComponentAssetsMetadata[platform]) == null ? void 0 : ref.push(...assetsMetadata);
|
|
222
|
+
}));
|
|
193
223
|
if (platform === "web") {
|
|
194
224
|
// TODO: Unify with exportStaticAsync
|
|
195
225
|
// TODO: Maybe move to the serializer.
|
|
@@ -255,7 +285,8 @@ async function exportAppAsync(projectRoot, { platforms , outputDir , clear , dev
|
|
|
255
285
|
const contents = (0, _createMetadataJson.createMetadataJson)({
|
|
256
286
|
bundles,
|
|
257
287
|
fileNames,
|
|
258
|
-
embeddedHashSet
|
|
288
|
+
embeddedHashSet,
|
|
289
|
+
domComponentAssetsMetadata
|
|
259
290
|
});
|
|
260
291
|
files.set("metadata.json", {
|
|
261
292
|
contents: JSON.stringify(contents)
|