@expo/cli 0.18.17 → 0.18.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +1 -1
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +41 -110
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/resolveOptions.js +1 -0
- package/build/src/export/embed/resolveOptions.js.map +1 -1
- package/build/src/export/exportApp.js +92 -130
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/exportHermes.js +0 -15
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +48 -3
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js +284 -0
- package/build/src/export/fork-bundleAsync.js.map +1 -0
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/run/startBundler.js +8 -1
- package/build/src/run/startBundler.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +2 -9
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/DevServerManager.js +1 -13
- package/build/src/start/server/DevServerManager.js.map +1 -1
- package/build/src/start/server/getStaticRenderFunctions.js +123 -9
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +102 -391
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js +9 -0
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +12 -19
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +2 -49
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/runServer-fork.js +20 -28
- package/build/src/start/server/metro/runServer-fork.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +1 -5
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +3 -6
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +3 -11
- package/build/src/start/server/middleware/metroOptions.js.map +1 -1
- package/build/src/start/server/middleware/resolveAssets.js.map +1 -1
- package/build/src/utils/telemetry/getContext.js +1 -1
- package/package.json +4 -4
- package/build/src/start/server/metro/metroPrivateServer.js +0 -26
- package/build/src/start/server/metro/metroPrivateServer.js.map +0 -1
package/build/bin/cli
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/createMetadataJson.ts"],"sourcesContent":["import path from 'path';\n\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/export/createMetadataJson.ts"],"sourcesContent":["import path from 'path';\n\nimport { BundleOutput } from './fork-bundleAsync';\n\nexport type BundlePlatform = 'android' | 'ios';\n\ntype PlatformMetadataAsset = { path: string; ext: string };\n\ntype 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}: {\n bundles: Partial<Record<BundlePlatform, Pick<BundleOutput, 'assets'>>>;\n fileNames: Record<string, string[]>;\n embeddedHashSet?: Set<string>;\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 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 // Collect all of the assets and convert them to the serial format.\n 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 };\n },\n {}\n ) as FileMetadata,\n };\n}\n"],"names":["createMetadataJson","bundles","fileNames","embeddedHashSet","version","bundler","fileMetadata","Object","entries","reduce","metadata","platform","bundle","assets","filter","asset","has","hash","map","fileHashes","path","join","ext","type","Boolean","flat"],"mappings":"AAAA;;;;+BAcgBA,oBAAkB;;aAAlBA,kBAAkB;;;8DAdjB,MAAM;;;;;;;;;;;AAchB,SAASA,kBAAkB,CAAC,EACjCC,OAAO,CAAA,EACPC,SAAS,CAAA,EACTC,eAAe,CAAA,EAKhB,EAIC;IACA,sBAAsB;IACtB,OAAO;QACLC,OAAO,EAAE,CAAC;QACVC,OAAO,EAAE,OAAO;QAChBC,YAAY,EAAEC,MAAM,CAACC,OAAO,CAACP,OAAO,CAAC,CAACQ,MAAM,CAC1C,CAACC,QAAQ,EAAE,CAACC,QAAQ,EAAEC,MAAM,CAAC,GAAK;YAChC,IAAID,QAAQ,KAAK,KAAK,EAAE,OAAOD,QAAQ,CAAC;YAExC,OAAO;gBACL,GAAGA,QAAQ;gBACX,CAACC,QAAQ,CAAC,EAAE;oBACV,+CAA+C;oBAC/C,iDAAiD;oBACjDC,MAAM,EAAEV,SAAS,CAACS,QAAQ,CAAC,CAAC,CAAC,CAAC;oBAC9B,mEAAmE;oBACnEE,MAAM,EAAED,MAAM,CAACC,MAAM,CAClBC,MAAM,CAAC,CAACC,KAAK,GAAK,CAACZ,eAAe,IAAI,CAACA,eAAe,CAACa,GAAG,CAACD,KAAK,CAACE,IAAI,CAAC,CAAC,CACvEC,GAAG,CAAC,CAACH,KAAK;4BACT,oEAAoE;wBACpEA,GAAgB;wBAAhBA,OAAAA,CAAAA,GAAgB,GAAhBA,KAAK,CAACI,UAAU,SAAK,GAArBJ,KAAAA,CAAqB,GAArBA,GAAgB,CAAEG,GAAG,CAAC,CAACD,IAAI,GAAK,CAAC;gCAC/BG,IAAI,EAAEA,KAAI,EAAA,QAAA,CAACC,IAAI,CAAC,QAAQ,EAAEJ,IAAI,CAAC;gCAC/BK,GAAG,EAAEP,KAAK,CAACQ,IAAI;6BAChB,CAAC,CAAC,CAAA;qBAAA,CACJ,CACAT,MAAM,CAACU,OAAO,CAAC,CACfC,IAAI,EAAE;iBACV;aACF,CAAC;QACJ,CAAC,EACD,EAAE,CACH;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -15,8 +15,9 @@ function _export(target, all) {
|
|
|
15
15
|
}
|
|
16
16
|
_export(exports, {
|
|
17
17
|
exportEmbedAsync: ()=>exportEmbedAsync,
|
|
18
|
-
exportEmbedBundleAndAssetsAsync: ()=>exportEmbedBundleAndAssetsAsync,
|
|
19
18
|
createMetroServerAndBundleRequestAsync: ()=>createMetroServerAndBundleRequestAsync,
|
|
19
|
+
exportEmbedBundleAndAssetsAsync: ()=>exportEmbedBundleAndAssetsAsync,
|
|
20
|
+
exportEmbedBundleAsync: ()=>exportEmbedBundleAsync,
|
|
20
21
|
exportEmbedAssetsAsync: ()=>exportEmbedAssetsAsync
|
|
21
22
|
});
|
|
22
23
|
function _config() {
|
|
@@ -26,20 +27,6 @@ function _config() {
|
|
|
26
27
|
};
|
|
27
28
|
return data;
|
|
28
29
|
}
|
|
29
|
-
function _getAssets() {
|
|
30
|
-
const data = /*#__PURE__*/ _interopRequireDefault(require("@expo/metro-config/build/transform-worker/getAssets"));
|
|
31
|
-
_getAssets = function() {
|
|
32
|
-
return data;
|
|
33
|
-
};
|
|
34
|
-
return data;
|
|
35
|
-
}
|
|
36
|
-
function _assert() {
|
|
37
|
-
const data = /*#__PURE__*/ _interopRequireDefault(require("assert"));
|
|
38
|
-
_assert = function() {
|
|
39
|
-
return data;
|
|
40
|
-
};
|
|
41
|
-
return data;
|
|
42
|
-
}
|
|
43
30
|
function _fs() {
|
|
44
31
|
const data = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
|
45
32
|
_fs = function() {
|
|
@@ -61,13 +48,6 @@ function _server() {
|
|
|
61
48
|
};
|
|
62
49
|
return data;
|
|
63
50
|
}
|
|
64
|
-
function _splitBundleOptions() {
|
|
65
|
-
const data = /*#__PURE__*/ _interopRequireDefault(require("metro/src/lib/splitBundleOptions"));
|
|
66
|
-
_splitBundleOptions = function() {
|
|
67
|
-
return data;
|
|
68
|
-
};
|
|
69
|
-
return data;
|
|
70
|
-
}
|
|
71
51
|
function _bundle() {
|
|
72
52
|
const data = /*#__PURE__*/ _interopRequireDefault(require("metro/src/shared/output/bundle"));
|
|
73
53
|
_bundle = function() {
|
|
@@ -84,15 +64,14 @@ function _path() {
|
|
|
84
64
|
}
|
|
85
65
|
const _xcodeCompilerLogger = require("./xcodeCompilerLogger");
|
|
86
66
|
const _log = require("../../log");
|
|
87
|
-
const _devServerManager = require("../../start/server/DevServerManager");
|
|
88
|
-
const _metroBundlerDevServer = require("../../start/server/metro/MetroBundlerDevServer");
|
|
89
67
|
const _instantiateMetro = require("../../start/server/metro/instantiateMetro");
|
|
90
|
-
const _metroPrivateServer = require("../../start/server/metro/metroPrivateServer");
|
|
91
68
|
const _metroOptions = require("../../start/server/middleware/metroOptions");
|
|
92
69
|
const _ansi = require("../../utils/ansi");
|
|
93
70
|
const _dir = require("../../utils/dir");
|
|
94
71
|
const _nodeEnv = require("../../utils/nodeEnv");
|
|
72
|
+
const _profile = require("../../utils/profile");
|
|
95
73
|
const _exportHermes = require("../exportHermes");
|
|
74
|
+
const _forkBundleAsync = require("../fork-bundleAsync");
|
|
96
75
|
const _persistMetroAssets = require("../persistMetroAssets");
|
|
97
76
|
function _interopRequireDefault(obj) {
|
|
98
77
|
return obj && obj.__esModule ? obj : {
|
|
@@ -146,69 +125,6 @@ async function exportEmbedAsync(projectRoot, options) {
|
|
|
146
125
|
}) : null,
|
|
147
126
|
]);
|
|
148
127
|
}
|
|
149
|
-
async function exportEmbedBundleAndAssetsAsync(projectRoot, options) {
|
|
150
|
-
const devServerManager = await _devServerManager.DevServerManager.startMetroAsync(projectRoot, {
|
|
151
|
-
minify: options.minify,
|
|
152
|
-
mode: options.dev ? "development" : "production",
|
|
153
|
-
port: 8081,
|
|
154
|
-
isExporting: true,
|
|
155
|
-
location: {},
|
|
156
|
-
resetDevServer: options.resetCache,
|
|
157
|
-
maxWorkers: options.maxWorkers
|
|
158
|
-
});
|
|
159
|
-
const devServer = devServerManager.getDefaultDevServer();
|
|
160
|
-
(0, _assert().default)(devServer instanceof _metroBundlerDevServer.MetroBundlerDevServer);
|
|
161
|
-
const exp = (0, _config().getConfig)(projectRoot, {
|
|
162
|
-
skipSDKVersionRequirement: true
|
|
163
|
-
}).exp;
|
|
164
|
-
const isHermes = (0, _exportHermes.isEnableHermesManaged)(exp, options.platform);
|
|
165
|
-
let sourceMapUrl = options.sourcemapOutput;
|
|
166
|
-
if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {
|
|
167
|
-
sourceMapUrl = _path().default.basename(sourceMapUrl);
|
|
168
|
-
}
|
|
169
|
-
try {
|
|
170
|
-
var ref, ref1;
|
|
171
|
-
const bundles = await devServer.legacySinglePageExportBundleAsync({
|
|
172
|
-
splitChunks: false,
|
|
173
|
-
mainModuleName: options.entryFile,
|
|
174
|
-
platform: options.platform,
|
|
175
|
-
minify: options.minify,
|
|
176
|
-
mode: options.dev ? "development" : "production",
|
|
177
|
-
engine: isHermes ? "hermes" : undefined,
|
|
178
|
-
serializerIncludeMaps: !!sourceMapUrl,
|
|
179
|
-
// Never output bytecode in the exported bundle since that is hardcoded in the native run script.
|
|
180
|
-
bytecode: false,
|
|
181
|
-
// source map inline
|
|
182
|
-
reactCompiler: !!((ref = exp.experiments) == null ? void 0 : ref.reactCompiler)
|
|
183
|
-
}, {
|
|
184
|
-
sourceMapUrl,
|
|
185
|
-
unstable_transformProfile: options.unstableTransformProfile || (isHermes ? "hermes-stable" : "default")
|
|
186
|
-
});
|
|
187
|
-
return {
|
|
188
|
-
bundle: {
|
|
189
|
-
code: bundles.artifacts.filter((a)=>a.type === "js")[0].source.toString(),
|
|
190
|
-
// Can be optional when source maps aren't enabled.
|
|
191
|
-
map: (ref1 = bundles.artifacts.filter((a)=>a.type === "map")[0]) == null ? void 0 : ref1.source.toString()
|
|
192
|
-
},
|
|
193
|
-
assets: bundles.assets
|
|
194
|
-
};
|
|
195
|
-
} catch (error) {
|
|
196
|
-
if (isError(error)) {
|
|
197
|
-
// Log using Xcode error format so the errors are picked up by xcodebuild.
|
|
198
|
-
// https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script
|
|
199
|
-
if (options.platform === "ios") {
|
|
200
|
-
// If the error is about to be presented in Xcode, strip the ansi characters from the message.
|
|
201
|
-
if ("message" in error && (0, _xcodeCompilerLogger.isExecutingFromXcodebuild)()) {
|
|
202
|
-
error.message = (0, _ansi.stripAnsi)(error.message);
|
|
203
|
-
}
|
|
204
|
-
(0, _xcodeCompilerLogger.logMetroErrorInXcode)(projectRoot, error);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
throw error;
|
|
208
|
-
} finally{
|
|
209
|
-
devServerManager.stopAsync();
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
128
|
async function createMetroServerAndBundleRequestAsync(projectRoot, options) {
|
|
213
129
|
const exp = (0, _config().getConfig)(projectRoot, {
|
|
214
130
|
skipSDKVersionRequirement: true
|
|
@@ -240,9 +156,8 @@ async function createMetroServerAndBundleRequestAsync(projectRoot, options) {
|
|
|
240
156
|
minify: options.minify,
|
|
241
157
|
mode: options.dev ? "development" : "production",
|
|
242
158
|
engine: isHermes ? "hermes" : undefined,
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
bytecode: false
|
|
159
|
+
bytecode: isHermes,
|
|
160
|
+
isExporting: true
|
|
246
161
|
}),
|
|
247
162
|
sourceMapUrl,
|
|
248
163
|
unstable_transformProfile: options.unstableTransformProfile || (isHermes ? "hermes-stable" : "default")
|
|
@@ -255,30 +170,46 @@ async function createMetroServerAndBundleRequestAsync(projectRoot, options) {
|
|
|
255
170
|
bundleRequest
|
|
256
171
|
};
|
|
257
172
|
}
|
|
173
|
+
async function exportEmbedBundleAndAssetsAsync(projectRoot, options) {
|
|
174
|
+
const { server , bundleRequest } = await createMetroServerAndBundleRequestAsync(projectRoot, options);
|
|
175
|
+
try {
|
|
176
|
+
const bundle = await exportEmbedBundleAsync(server, bundleRequest, projectRoot, options);
|
|
177
|
+
const assets = await exportEmbedAssetsAsync(server, bundleRequest, projectRoot, options);
|
|
178
|
+
return {
|
|
179
|
+
bundle,
|
|
180
|
+
assets
|
|
181
|
+
};
|
|
182
|
+
} finally{
|
|
183
|
+
server.end();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
async function exportEmbedBundleAsync(server, bundleRequest, projectRoot, options) {
|
|
187
|
+
try {
|
|
188
|
+
return await (0, _profile.profile)(server.build.bind(server), "metro-bundle")({
|
|
189
|
+
...bundleRequest,
|
|
190
|
+
bundleType: "bundle"
|
|
191
|
+
});
|
|
192
|
+
} catch (error) {
|
|
193
|
+
if (isError(error)) {
|
|
194
|
+
// Log using Xcode error format so the errors are picked up by xcodebuild.
|
|
195
|
+
// https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script
|
|
196
|
+
if (options.platform === "ios") {
|
|
197
|
+
// If the error is about to be presented in Xcode, strip the ansi characters from the message.
|
|
198
|
+
if ("message" in error && (0, _xcodeCompilerLogger.isExecutingFromXcodebuild)()) {
|
|
199
|
+
error.message = (0, _ansi.stripAnsi)(error.message);
|
|
200
|
+
}
|
|
201
|
+
(0, _xcodeCompilerLogger.logMetroErrorInXcode)(projectRoot, error);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
throw error;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
258
207
|
async function exportEmbedAssetsAsync(server, bundleRequest, projectRoot, options) {
|
|
259
208
|
try {
|
|
260
|
-
|
|
209
|
+
return await (0, _forkBundleAsync.getAssets)(server, {
|
|
261
210
|
...bundleRequest,
|
|
262
211
|
bundleType: "todo"
|
|
263
212
|
});
|
|
264
|
-
(0, _metroPrivateServer.assertMetroPrivateServer)(server);
|
|
265
|
-
const dependencies = await server._bundler.getDependencies([
|
|
266
|
-
entryFile
|
|
267
|
-
], transformOptions, resolverOptions, {
|
|
268
|
-
onProgress,
|
|
269
|
-
shallow: false,
|
|
270
|
-
lazy: false
|
|
271
|
-
});
|
|
272
|
-
const config = server._config;
|
|
273
|
-
return (0, _getAssets().default)(dependencies, {
|
|
274
|
-
processModuleFilter: config.serializer.processModuleFilter,
|
|
275
|
-
assetPlugins: config.transformer.assetPlugins,
|
|
276
|
-
platform: transformOptions.platform,
|
|
277
|
-
// Forked out of Metro because the `this._getServerRootDir()` doesn't match the development
|
|
278
|
-
// behavior.
|
|
279
|
-
projectRoot: config.projectRoot,
|
|
280
|
-
publicPath: config.transformer.publicPath
|
|
281
|
-
});
|
|
282
213
|
} catch (error) {
|
|
283
214
|
if (isError(error)) {
|
|
284
215
|
// Log using Xcode error format so the errors are picked up by xcodebuild.
|
|
@@ -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 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 { 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 { getMetroDirectBundleOptionsForExpoConfig } from '../../start/server/middleware/metroOptions';\nimport { stripAnsi } from '../../utils/ansi';\nimport { removeAsync } from '../../utils/dir';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { isEnableHermesManaged } from '../exportHermes';\nimport { persistMetroAssetsAsync } from '../persistMetroAssets';\nimport { BundleAssetWithFileHashes } from '../saveAssets';\n\nconst debug = require('debug')('expo:export:embed');\n\nfunction guessCopiedAppleBundlePath(bundleOutput: string) {\n // Ensure the path is familiar before guessing.\n if (!bundleOutput.match(/\\/Xcode\\/DerivedData\\/.*\\/Build\\/Products\\//)) {\n debug('Bundling to non-standard location:', bundleOutput);\n return false;\n }\n const bundleName = path.basename(bundleOutput);\n const bundleParent = path.dirname(bundleOutput);\n const possiblePath = globSync(path.join(bundleParent, `*.app/${bundleName}`), {\n // bundle identifiers can start with dots.\n dot: true,\n })[0];\n debug('Possible path for previous bundle:', possiblePath);\n return possiblePath;\n}\n\nexport async function exportEmbedAsync(projectRoot: string, options: Options) {\n setNodeEnv(options.dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n\n // Ensure we delete the old bundle to trigger a failure if the bundle cannot be created.\n await removeAsync(options.bundleOutput);\n\n // The iOS bundle is copied in to the Xcode project, so we need to remove the old one\n // to prevent Xcode from loading the old one after a build failure.\n if (options.platform === 'ios') {\n const previousPath = guessCopiedAppleBundlePath(options.bundleOutput);\n if (previousPath && fs.existsSync(previousPath)) {\n debug('Removing previous iOS bundle:', previousPath);\n await removeAsync(previousPath);\n }\n }\n\n const { bundle, assets } = await exportEmbedBundleAndAssetsAsync(projectRoot, options);\n\n fs.mkdirSync(path.dirname(options.bundleOutput), { recursive: true, mode: 0o755 });\n\n // Persist bundle and source maps.\n await Promise.all([\n output.save(bundle, options, Log.log),\n // NOTE(EvanBacon): This may need to be adjusted in the future if want to support baseUrl on native\n // platforms when doing production embeds (unlikely).\n options.assetsDest\n ? persistMetroAssetsAsync(assets, {\n platform: options.platform,\n outputDirectory: options.assetsDest,\n iosAssetCatalogDirectory: options.assetCatalogDest,\n })\n : null,\n ]);\n}\n\nexport async function exportEmbedBundleAndAssetsAsync(\n projectRoot: string,\n options: Options\n): Promise<{\n bundle: Awaited<ReturnType<Server['build']>>;\n assets: readonly BundleAssetWithFileHashes[];\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 = getConfig(projectRoot, { skipSDKVersionRequirement: true }).exp;\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 try {\n const bundles = await devServer.legacySinglePageExportBundleAsync(\n {\n splitChunks: false,\n mainModuleName: options.entryFile,\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n 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 {\n sourceMapUrl,\n unstable_transformProfile: (options.unstableTransformProfile ||\n (isHermes ? 'hermes-stable' : 'default')) as BundleOptions['unstable_transformProfile'],\n }\n );\n\n return {\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 const bundleRequest = {\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","exportEmbedBundleAndAssetsAsync","createMetroServerAndBundleRequestAsync","exportEmbedAssetsAsync","debug","require","guessCopiedAppleBundlePath","bundleOutput","match","bundleName","path","basename","bundleParent","dirname","possiblePath","globSync","join","dot","projectRoot","options","setNodeEnv","dev","load","removeAsync","platform","previousPath","fs","existsSync","bundle","assets","mkdirSync","recursive","mode","Promise","all","output","save","Log","log","assetsDest","persistMetroAssetsAsync","outputDirectory","iosAssetCatalogDirectory","assetCatalogDest","devServerManager","DevServerManager","startMetroAsync","minify","port","isExporting","location","resetDevServer","resetCache","maxWorkers","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","exp","getConfig","skipSDKVersionRequirement","isHermes","isEnableHermesManaged","sourceMapUrl","sourcemapOutput","sourcemapUseAbsolutePath","bundles","legacySinglePageExportBundleAsync","splitChunks","mainModuleName","entryFile","engine","undefined","serializerIncludeMaps","bytecode","reactCompiler","experiments","unstable_transformProfile","unstableTransformProfile","code","artifacts","filter","a","type","source","toString","map","error","isError","isExecutingFromXcodebuild","message","stripAnsi","logMetroErrorInXcode","stopAsync","config","loadMetroConfigAsync","getMetroBundler","server","getBundler","bundleRequest","Server","DEFAULT_BUNDLE_OPTIONS","getMetroDirectBundleOptionsForExpoConfig","resolveRealEntryFilePath","watch","onProgress","resolverOptions","transformOptions","splitBundleOptions","bundleType","assertMetroPrivateServer","dependencies","_bundler","getDependencies","shallow","lazy","_config","getMetroAssets","processModuleFilter","serializer","assetPlugins","transformer","publicPath","Error","startsWith","realpathSync"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;;IA4CsBA,gBAAgB,MAAhBA,gBAAgB;IAoChBC,+BAA+B,MAA/BA,+BAA+B;IA6E/BC,sCAAsC,MAAtCA,sCAAsC;IAqEtCC,sBAAsB,MAAtBA,sBAAsB;;;yBAlOlB,cAAc;;;;;;;8DACb,qDAAqD;;;;;;;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,KAAK,YAAYoC,KAAK,CAAC;AAChC,CAAC;AAED;;;;;CAKC,GACD,SAASpB,wBAAwB,CAACrF,WAAmB,EAAEoD,SAAiB,EAAU;IAChF,IAAIpD,WAAW,CAAC0G,UAAU,CAAC,cAAc,CAAC,IAAItD,SAAS,CAACsD,UAAU,CAAC,MAAM,CAAC,EAAE;QAC1E,OAAOlG,GAAE,EAAA,QAAA,CAACmG,YAAY,CAACvD,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 fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport Server from 'metro/src/Server';\nimport output from 'metro/src/shared/output/bundle';\nimport type { BundleOptions } from 'metro/src/shared/types';\nimport path from 'path';\n\nimport { Options } from './resolveOptions';\nimport { isExecutingFromXcodebuild, logMetroErrorInXcode } from './xcodeCompilerLogger';\nimport { Log } from '../../log';\nimport { loadMetroConfigAsync } from '../../start/server/metro/instantiateMetro';\nimport { getMetroDirectBundleOptionsForExpoConfig } from '../../start/server/middleware/metroOptions';\nimport { stripAnsi } from '../../utils/ansi';\nimport { removeAsync } from '../../utils/dir';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { profile } from '../../utils/profile';\nimport { isEnableHermesManaged } from '../exportHermes';\nimport { getAssets } from '../fork-bundleAsync';\nimport { persistMetroAssetsAsync } from '../persistMetroAssets';\n\nconst debug = require('debug')('expo:export:embed');\n\nfunction guessCopiedAppleBundlePath(bundleOutput: string) {\n // Ensure the path is familiar before guessing.\n if (!bundleOutput.match(/\\/Xcode\\/DerivedData\\/.*\\/Build\\/Products\\//)) {\n debug('Bundling to non-standard location:', bundleOutput);\n return false;\n }\n const bundleName = path.basename(bundleOutput);\n const bundleParent = path.dirname(bundleOutput);\n const possiblePath = globSync(path.join(bundleParent, `*.app/${bundleName}`), {\n // bundle identifiers can start with dots.\n dot: true,\n })[0];\n debug('Possible path for previous bundle:', possiblePath);\n return possiblePath;\n}\n\nexport async function exportEmbedAsync(projectRoot: string, options: Options) {\n setNodeEnv(options.dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n\n // Ensure we delete the old bundle to trigger a failure if the bundle cannot be created.\n await removeAsync(options.bundleOutput);\n\n // The iOS bundle is copied in to the Xcode project, so we need to remove the old one\n // to prevent Xcode from loading the old one after a build failure.\n if (options.platform === 'ios') {\n const previousPath = guessCopiedAppleBundlePath(options.bundleOutput);\n if (previousPath && fs.existsSync(previousPath)) {\n debug('Removing previous iOS bundle:', previousPath);\n await removeAsync(previousPath);\n }\n }\n\n const { bundle, assets } = await exportEmbedBundleAndAssetsAsync(projectRoot, options);\n\n fs.mkdirSync(path.dirname(options.bundleOutput), { recursive: true, mode: 0o755 });\n\n // Persist bundle and source maps.\n await Promise.all([\n output.save(bundle, options, Log.log),\n // NOTE(EvanBacon): This may need to be adjusted in the future if want to support baseUrl on native\n // platforms when doing production embeds (unlikely).\n options.assetsDest\n ? persistMetroAssetsAsync(assets, {\n platform: options.platform,\n outputDirectory: options.assetsDest,\n iosAssetCatalogDirectory: options.assetCatalogDest,\n })\n : null,\n ]);\n}\n\nexport async function createMetroServerAndBundleRequestAsync(\n projectRoot: string,\n options: Pick<\n Options,\n | 'maxWorkers'\n | 'config'\n | 'platform'\n | 'sourcemapOutput'\n | 'sourcemapUseAbsolutePath'\n | 'entryFile'\n | 'minify'\n | 'dev'\n | 'resetCache'\n | 'unstableTransformProfile'\n >\n): Promise<{ server: Server; bundleRequest: BundleOptions }> {\n const exp = getConfig(projectRoot, { skipSDKVersionRequirement: true }).exp;\n\n // TODO: This is slow ~40ms\n const { config } = await loadMetroConfigAsync(\n projectRoot,\n {\n // TODO: This is always enabled in the native script and there's no way to disable it.\n resetCache: options.resetCache,\n\n maxWorkers: options.maxWorkers,\n config: options.config,\n },\n {\n exp,\n isExporting: true,\n getMetroBundler() {\n return server.getBundler().getBundler();\n },\n }\n );\n\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n const bundleRequest = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n ...getMetroDirectBundleOptionsForExpoConfig(projectRoot, exp, {\n splitChunks: false,\n mainModuleName: resolveRealEntryFilePath(projectRoot, options.entryFile),\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n bytecode: isHermes,\n isExporting: true,\n }),\n sourceMapUrl,\n unstable_transformProfile: (options.unstableTransformProfile ||\n (isHermes ? 'hermes-stable' : 'default')) as BundleOptions['unstable_transformProfile'],\n };\n\n const server = new Server(config, {\n watch: false,\n });\n\n return { server, bundleRequest };\n}\n\nexport async function exportEmbedBundleAndAssetsAsync(\n projectRoot: string,\n options: Options\n): Promise<{\n bundle: Awaited<ReturnType<Server['build']>>;\n assets: Awaited<ReturnType<typeof getAssets>>;\n}> {\n const { server, bundleRequest } = await createMetroServerAndBundleRequestAsync(\n projectRoot,\n options\n );\n\n try {\n const bundle = await exportEmbedBundleAsync(server, bundleRequest, projectRoot, options);\n const assets = await exportEmbedAssetsAsync(server, bundleRequest, projectRoot, options);\n return { bundle, assets };\n } finally {\n server.end();\n }\n}\n\nexport async function exportEmbedBundleAsync(\n server: Server,\n bundleRequest: BundleOptions,\n projectRoot: string,\n options: Pick<Options, 'platform'>\n) {\n try {\n return await profile(\n server.build.bind(server),\n 'metro-bundle'\n )({\n ...bundleRequest,\n bundleType: 'bundle',\n });\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (options.platform === 'ios') {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n }\n}\n\nexport async function exportEmbedAssetsAsync(\n server: Server,\n bundleRequest: BundleOptions,\n projectRoot: string,\n options: Pick<Options, 'platform'>\n) {\n try {\n return await getAssets(server, {\n ...bundleRequest,\n bundleType: 'todo',\n });\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (options.platform === 'ios') {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n }\n}\n\nfunction isError(error: any): error is Error {\n return error instanceof Error;\n}\n\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","createMetroServerAndBundleRequestAsync","exportEmbedBundleAndAssetsAsync","exportEmbedBundleAsync","exportEmbedAssetsAsync","debug","require","guessCopiedAppleBundlePath","bundleOutput","match","bundleName","path","basename","bundleParent","dirname","possiblePath","globSync","join","dot","projectRoot","options","setNodeEnv","dev","load","removeAsync","platform","previousPath","fs","existsSync","bundle","assets","mkdirSync","recursive","mode","Promise","all","output","save","Log","log","assetsDest","persistMetroAssetsAsync","outputDirectory","iosAssetCatalogDirectory","assetCatalogDest","exp","getConfig","skipSDKVersionRequirement","config","loadMetroConfigAsync","resetCache","maxWorkers","isExporting","getMetroBundler","server","getBundler","isHermes","isEnableHermesManaged","sourceMapUrl","sourcemapOutput","sourcemapUseAbsolutePath","bundleRequest","Server","DEFAULT_BUNDLE_OPTIONS","getMetroDirectBundleOptionsForExpoConfig","splitChunks","mainModuleName","resolveRealEntryFilePath","entryFile","minify","engine","undefined","bytecode","unstable_transformProfile","unstableTransformProfile","watch","end","profile","build","bind","bundleType","error","isError","isExecutingFromXcodebuild","message","stripAnsi","logMetroErrorInXcode","getAssets","Error","startsWith","realpathSync"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;;IAuCsBA,gBAAgB,MAAhBA,gBAAgB;IAoChBC,sCAAsC,MAAtCA,sCAAsC;IAoEtCC,+BAA+B,MAA/BA,+BAA+B;IAqB/BC,sBAAsB,MAAtBA,sBAAsB;IA8BtBC,sBAAsB,MAAtBA,sBAAsB;;;yBAlMlB,cAAc;;;;;;;8DACzB,IAAI;;;;;;;yBACc,MAAM;;;;;;;8DACpB,kBAAkB;;;;;;;8DAClB,gCAAgC;;;;;;;8DAElC,MAAM;;;;;;qCAGyC,uBAAuB;qBACnE,WAAW;kCACM,2CAA2C;8BACvB,4CAA4C;sBAC3E,kBAAkB;qBAChB,iBAAiB;yBAClB,qBAAqB;yBACxB,qBAAqB;8BACP,iBAAiB;iCAC7B,qBAAqB;oCACP,uBAAuB;;;;;;AAE/D,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,mBAAmB,CAAC,AAAC;AAEpD,SAASC,0BAA0B,CAACC,YAAoB,EAAE;IACxD,+CAA+C;IAC/C,IAAI,CAACA,YAAY,CAACC,KAAK,+CAA+C,EAAE;QACtEJ,KAAK,CAAC,oCAAoC,EAAEG,YAAY,CAAC,CAAC;QAC1D,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAME,UAAU,GAAGC,KAAI,EAAA,QAAA,CAACC,QAAQ,CAAC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dO,aAA4B,EAC5B1C,WAAmB,EACnBC,OAAkC,EAClC;IACA,IAAI;QACF,OAAO,MAAMmE,IAAAA,gBAAS,UAAA,EAACjC,MAAM,EAAE;YAC7B,GAAGO,aAAa;YAChBmB,UAAU,EAAE,MAAM;SACnB,CAAC,CAAC;IACL,EAAE,OAAOC,KAAK,EAAO;QACnB,IAAIC,OAAO,CAACD,KAAK,CAAC,EAAE;YAClB,0EAA0E;YAC1E,iIAAiI;YACjI,IAAI7D,OAAO,CAACK,QAAQ,KAAK,KAAK,EAAE;gBAC9B,8FAA8F;gBAC9F,IAAI,SAAS,IAAIwD,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,EAACnE,WAAW,EAAE8D,KAAK,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;QACD,MAAMA,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAASC,OAAO,CAACD,KAAU,EAAkB;IAC3C,OAAOA,KAAK,YAAYO,KAAK,CAAC;AAChC,CAAC;AAED;;;;;CAKC,GACD,SAASrB,wBAAwB,CAAChD,WAAmB,EAAEiD,SAAiB,EAAU;IAChF,IAAIjD,WAAW,CAACsE,UAAU,CAAC,cAAc,CAAC,IAAIrB,SAAS,CAACqB,UAAU,CAAC,MAAM,CAAC,EAAE;QAC1E,OAAO9D,GAAE,EAAA,QAAA,CAAC+D,YAAY,CAACtB,SAAS,CAAC,CAAC;IACpC,CAAC;IAED,OAAOA,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -57,6 +57,7 @@ function resolveOptions(args, parsed) {
|
|
|
57
57
|
assetsDest: args["--assets-dest"],
|
|
58
58
|
unstableTransformProfile: args["--unstable-transform-profile"],
|
|
59
59
|
resetCache: !!parsed.args["--reset-cache"],
|
|
60
|
+
resetGlobalCache: false,
|
|
60
61
|
verbose: (ref4 = args["--verbose"]) != null ? ref4 : _env.env.EXPO_DEBUG,
|
|
61
62
|
config: args["--config"] ? _path().default.resolve(args["--config"]) : undefined,
|
|
62
63
|
dev,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/export/embed/resolveOptions.ts"],"sourcesContent":["import arg from 'arg';\nimport path from 'path';\n\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { resolveCustomBooleanArgsAsync } from '../../utils/resolveArgs';\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?: string;\n maxWorkers?: number;\n sourcemapOutput?: string;\n sourcemapSourcesRoot?: string;\n sourcemapUseAbsolutePath: boolean;\n verbose: boolean;\n unstableTransformProfile?: string;\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\nexport function resolveOptions(\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 minify = parsed.args['--minify'] ?? !dev;\n assertIsBoolean(minify);\n\n const entryFile = args['--entry-file'];\n if (!entryFile) {\n throw new CommandError(`Missing required argument: --entry-file`);\n }\n const bundleOutput = args['--bundle-output'];\n if (!bundleOutput) {\n throw new CommandError(`Missing required argument: --bundle-output`);\n }\n return {\n entryFile,\n assetCatalogDest: args['--asset-catalog-dest'],\n platform: args['--platform'] ?? 'ios',\n transformer: args['--transformer'],\n // TODO: Support `--dev false`\n // dev: false,\n bundleOutput,\n bundleEncoding: 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,\n };\n}\n"],"names":["resolveOptions","assertIsBoolean","val","CommandError","args","parsed","dev","minify","entryFile","bundleOutput","assetCatalogDest","platform","transformer","bundleEncoding","maxWorkers","sourcemapOutput","sourcemapSourcesRoot","sourcemapUseAbsolutePath","assetsDest","unstableTransformProfile","resetCache","verbose","env","EXPO_DEBUG","config","path","resolve","undefined"],"mappings":"AAAA;;;;+
|
|
1
|
+
{"version":3,"sources":["../../../../src/export/embed/resolveOptions.ts"],"sourcesContent":["import arg from 'arg';\nimport path from 'path';\n\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { resolveCustomBooleanArgsAsync } from '../../utils/resolveArgs';\n\nexport interface Options {\n assetsDest?: string;\n assetCatalogDest?: string;\n entryFile: string;\n resetCache: boolean;\n resetGlobalCache: boolean;\n transformer?: string;\n minify?: boolean;\n config?: string;\n platform: string;\n dev: boolean;\n bundleOutput: string;\n bundleEncoding?: string;\n maxWorkers?: number;\n sourcemapOutput?: string;\n sourcemapSourcesRoot?: string;\n sourcemapUseAbsolutePath: boolean;\n verbose: boolean;\n unstableTransformProfile?: string;\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\nexport function resolveOptions(\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 minify = parsed.args['--minify'] ?? !dev;\n assertIsBoolean(minify);\n\n const entryFile = args['--entry-file'];\n if (!entryFile) {\n throw new CommandError(`Missing required argument: --entry-file`);\n }\n const bundleOutput = args['--bundle-output'];\n if (!bundleOutput) {\n throw new CommandError(`Missing required argument: --bundle-output`);\n }\n return {\n entryFile,\n assetCatalogDest: args['--asset-catalog-dest'],\n platform: args['--platform'] ?? 'ios',\n transformer: args['--transformer'],\n // TODO: Support `--dev false`\n // dev: false,\n bundleOutput,\n bundleEncoding: 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 resetGlobalCache: false,\n verbose: args['--verbose'] ?? env.EXPO_DEBUG,\n config: args['--config'] ? path.resolve(args['--config']) : undefined,\n dev,\n minify,\n };\n}\n"],"names":["resolveOptions","assertIsBoolean","val","CommandError","args","parsed","dev","minify","entryFile","bundleOutput","assetCatalogDest","platform","transformer","bundleEncoding","maxWorkers","sourcemapOutput","sourcemapSourcesRoot","sourcemapUseAbsolutePath","assetsDest","unstableTransformProfile","resetCache","resetGlobalCache","verbose","env","EXPO_DEBUG","config","path","resolve","undefined"],"mappings":"AAAA;;;;+BAkCgBA,gBAAc;;aAAdA,cAAc;;;8DAjCb,MAAM;;;;;;qBAEH,iBAAiB;wBACR,oBAAoB;;;;;;AAwBjD,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;AAEM,SAASF,cAAc,CAC5BI,IAA0B,EAC1BC,MAAiE,EACxD;QACGA,GAAoB;IAAhC,MAAM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