@expo/cli 0.18.16 → 0.18.18
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 +110 -41
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/resolveOptions.js +0 -1
- package/build/src/export/embed/resolveOptions.js.map +1 -1
- package/build/src/export/exportApp.js +130 -92
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/exportHermes.js +15 -0
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +3 -48
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/run/startBundler.js +1 -8
- package/build/src/run/startBundler.js.map +1 -1
- package/build/src/start/platforms/DeviceManager.js.map +1 -1
- package/build/src/start/platforms/PlatformManager.js +7 -2
- package/build/src/start/platforms/PlatformManager.js.map +1 -1
- package/build/src/start/platforms/android/AndroidDeviceManager.js +3 -0
- package/build/src/start/platforms/android/AndroidDeviceManager.js.map +1 -1
- package/build/src/start/platforms/ios/AppleDeviceManager.js +6 -2
- package/build/src/start/platforms/ios/AppleDeviceManager.js.map +1 -1
- package/build/src/start/platforms/ios/simctl.js +80 -0
- package/build/src/start/platforms/ios/simctl.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +9 -2
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/DevServerManager.js +13 -1
- package/build/src/start/server/DevServerManager.js.map +1 -1
- package/build/src/start/server/getStaticRenderFunctions.js +9 -123
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +391 -102
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js +0 -9
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +19 -12
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +49 -2
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/metroPrivateServer.js +26 -0
- package/build/src/start/server/metro/metroPrivateServer.js.map +1 -0
- package/build/src/start/server/metro/runServer-fork.js +28 -20
- package/build/src/start/server/metro/runServer-fork.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +5 -13
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +6 -3
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +11 -3
- 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/port.js +1 -1
- package/build/src/utils/port.js.map +1 -1
- package/build/src/utils/telemetry/getContext.js +1 -1
- package/package.json +5 -4
- package/build/src/export/fork-bundleAsync.js +0 -284
- package/build/src/export/fork-bundleAsync.js.map +0 -1
|
@@ -14,7 +14,6 @@ function _export(target, all) {
|
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
_export(exports, {
|
|
17
|
-
ForwardHtmlError: ()=>ForwardHtmlError,
|
|
18
17
|
MetroBundlerDevServer: ()=>MetroBundlerDevServer,
|
|
19
18
|
getDeepLinkHandler: ()=>getDeepLinkHandler
|
|
20
19
|
});
|
|
@@ -46,9 +45,23 @@ function _chalk() {
|
|
|
46
45
|
};
|
|
47
46
|
return data;
|
|
48
47
|
}
|
|
49
|
-
function
|
|
50
|
-
const data = /*#__PURE__*/ _interopRequireDefault(require("
|
|
51
|
-
|
|
48
|
+
function _baseJSBundle() {
|
|
49
|
+
const data = /*#__PURE__*/ _interopRequireDefault(require("metro/src/DeltaBundler/Serializers/baseJSBundle"));
|
|
50
|
+
_baseJSBundle = function() {
|
|
51
|
+
return data;
|
|
52
|
+
};
|
|
53
|
+
return data;
|
|
54
|
+
}
|
|
55
|
+
function _sourceMapGenerator() {
|
|
56
|
+
const data = require("metro/src/DeltaBundler/Serializers/sourceMapGenerator");
|
|
57
|
+
_sourceMapGenerator = function() {
|
|
58
|
+
return data;
|
|
59
|
+
};
|
|
60
|
+
return data;
|
|
61
|
+
}
|
|
62
|
+
function _bundleToString() {
|
|
63
|
+
const data = /*#__PURE__*/ _interopRequireDefault(require("metro/src/lib/bundleToString"));
|
|
64
|
+
_bundleToString = function() {
|
|
52
65
|
return data;
|
|
53
66
|
};
|
|
54
67
|
return data;
|
|
@@ -64,6 +77,7 @@ const _createServerRouteMiddleware = require("./createServerRouteMiddleware");
|
|
|
64
77
|
const _fetchRouterManifest = require("./fetchRouterManifest");
|
|
65
78
|
const _instantiateMetro = require("./instantiateMetro");
|
|
66
79
|
const _metroErrorInterface = require("./metroErrorInterface");
|
|
80
|
+
const _metroPrivateServer = require("./metroPrivateServer");
|
|
67
81
|
const _metroWatchTypeScriptFiles = require("./metroWatchTypeScriptFiles");
|
|
68
82
|
const _router = require("./router");
|
|
69
83
|
const _serializeHtml = require("./serializeHtml");
|
|
@@ -133,14 +147,8 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
133
147
|
}
|
|
134
148
|
return newObj;
|
|
135
149
|
}
|
|
136
|
-
class ForwardHtmlError extends _errors.CommandError {
|
|
137
|
-
constructor(message, html, statusCode){
|
|
138
|
-
super(message);
|
|
139
|
-
this.html = html;
|
|
140
|
-
this.statusCode = statusCode;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
150
|
const debug = require("debug")("expo:start:server:metro");
|
|
151
|
+
const getGraphId = require("metro/src/lib/getGraphId");
|
|
144
152
|
/** Default port to use for apps running in Expo Go. */ const EXPO_GO_METRO_PORT = 8081;
|
|
145
153
|
/** Default port to use for apps that run in standard React Native projects or Expo Dev Clients. */ const DEV_CLIENT_METRO_PORT = 8081;
|
|
146
154
|
class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
@@ -175,16 +183,17 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
175
183
|
// Alternatively, check whether `sourcesRoot` helps here
|
|
176
184
|
const artifactBasename = encodeURIComponent(_path().default.basename(artifactFilename) + ".map");
|
|
177
185
|
src = src.replace(/\/\/# sourceMappingURL=.*/g, `//# sourceMappingURL=${artifactBasename}`);
|
|
186
|
+
const parsedMap = JSON.parse(contents.map);
|
|
178
187
|
files.set(artifactFilename + ".map", {
|
|
179
188
|
contents: JSON.stringify({
|
|
180
|
-
version:
|
|
181
|
-
sources:
|
|
189
|
+
version: parsedMap.version,
|
|
190
|
+
sources: parsedMap.sources.map((source)=>{
|
|
182
191
|
source = typeof source === "string" && source.startsWith(this.projectRoot) ? _path().default.relative(this.projectRoot, source) : source;
|
|
183
192
|
return source.split(_path().default.sep).join("/");
|
|
184
193
|
}),
|
|
185
|
-
sourcesContent: new Array(
|
|
186
|
-
names:
|
|
187
|
-
mappings:
|
|
194
|
+
sourcesContent: new Array(parsedMap.sources.length).fill(null),
|
|
195
|
+
names: parsedMap.names,
|
|
196
|
+
mappings: parsedMap.mappings
|
|
188
197
|
}),
|
|
189
198
|
targetDomain: "server"
|
|
190
199
|
});
|
|
@@ -221,14 +230,8 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
221
230
|
}
|
|
222
231
|
async getStaticRenderFunctionAsync() {
|
|
223
232
|
var ref;
|
|
224
|
-
const { mode , minify , isExporting } = this.instanceMetroOptions;
|
|
225
|
-
(0, _assert().default)(mode != null && isExporting != null, "The server must be started before calling ssrLoadModule.");
|
|
226
233
|
const url = this.getDevServerUrl();
|
|
227
|
-
const { getStaticContent , getManifest , getBuildTimeServerManifestAsync } = await this.ssrLoadModule("expo-router/node/render.js"
|
|
228
|
-
minify,
|
|
229
|
-
mode,
|
|
230
|
-
isExporting
|
|
231
|
-
});
|
|
234
|
+
const { getStaticContent , getManifest , getBuildTimeServerManifestAsync } = await this.ssrLoadModule("expo-router/node/render.js");
|
|
232
235
|
const { exp } = (0, _config().getConfig)(this.projectRoot);
|
|
233
236
|
return {
|
|
234
237
|
serverManifest: await getBuildTimeServerManifestAsync(),
|
|
@@ -244,79 +247,39 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
244
247
|
};
|
|
245
248
|
}
|
|
246
249
|
async getStaticResourcesAsync({ includeSourceMaps , mainModuleName } = {}) {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
(0, _assert().default)(mode != null && isExporting != null && baseUrl != null && routerRoot != null && asyncRoutes != null, "The server must be started before calling getStaticPageAsync.");
|
|
250
|
+
const { mode , minify , isExporting , baseUrl , reactCompiler , routerRoot , asyncRoutes } = this.instanceMetroOptions;
|
|
251
|
+
(0, _assert().default)(mode != null && isExporting != null && baseUrl != null && routerRoot != null && reactCompiler != null && asyncRoutes != null, "The server must be started before calling getStaticResourcesAsync.");
|
|
250
252
|
const platform = "web";
|
|
251
|
-
const
|
|
253
|
+
const resolvedMainModuleName = mainModuleName != null ? mainModuleName : "." + _path().default.sep + (0, _manifestMiddleware.resolveMainModuleName)(this.projectRoot, {
|
|
254
|
+
platform
|
|
255
|
+
});
|
|
256
|
+
return await this.metroImportAsArtifactsAsync(resolvedMainModuleName, {
|
|
252
257
|
splitChunks: isExporting && !_env1.env.EXPO_NO_BUNDLE_SPLITTING,
|
|
253
258
|
platform,
|
|
254
259
|
mode,
|
|
255
260
|
minify,
|
|
256
261
|
environment: "client",
|
|
257
|
-
serializerOutput: "static",
|
|
258
262
|
serializerIncludeMaps: includeSourceMaps,
|
|
259
|
-
mainModuleName:
|
|
260
|
-
platform
|
|
261
|
-
}),
|
|
263
|
+
mainModuleName: resolvedMainModuleName,
|
|
262
264
|
lazy: (0, _metroOptions.shouldEnableAsyncImports)(this.projectRoot),
|
|
263
265
|
asyncRoutes,
|
|
264
266
|
baseUrl,
|
|
265
267
|
isExporting,
|
|
266
268
|
routerRoot,
|
|
269
|
+
reactCompiler,
|
|
267
270
|
bytecode: false
|
|
268
271
|
});
|
|
269
|
-
const bundleUrl = new URL(devBundleUrlPathname, this.getDevServerUrl());
|
|
270
|
-
// Fetch the generated HTML from our custom Metro serializer
|
|
271
|
-
const results = await (0, _nodeFetch().default)(bundleUrl.toString());
|
|
272
|
-
const txt = await results.text();
|
|
273
|
-
let data;
|
|
274
|
-
try {
|
|
275
|
-
data = JSON.parse(txt);
|
|
276
|
-
} catch (error) {
|
|
277
|
-
debug(txt);
|
|
278
|
-
// Metro can throw this error when the initial module id cannot be resolved.
|
|
279
|
-
if (!results.ok && txt.startsWith("<!DOCTYPE html>")) {
|
|
280
|
-
throw new ForwardHtmlError(`Metro failed to bundle the project. Check the console for more information.`, txt, results.status);
|
|
281
|
-
}
|
|
282
|
-
_log.Log.error("Failed to generate resources with Metro, the Metro config may not be using the correct serializer. Ensure the metro.config.js is extending the expo/metro-config and is not overriding the serializer.");
|
|
283
|
-
throw error;
|
|
284
|
-
}
|
|
285
|
-
// NOTE: This could potentially need more validation in the future.
|
|
286
|
-
if ("artifacts" in data && Array.isArray(data.artifacts)) {
|
|
287
|
-
return data;
|
|
288
|
-
}
|
|
289
|
-
if (data != null && (data.errors || ((ref = data.type) == null ? void 0 : ref.match(/.*Error$/)))) {
|
|
290
|
-
// {
|
|
291
|
-
// type: 'InternalError',
|
|
292
|
-
// errors: [],
|
|
293
|
-
// message: 'Metro has encountered an error: While trying to resolve module `stylis` from file `/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js`, the package `/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs`. Indeed, none of these files exist:\n' +
|
|
294
|
-
// '\n' +
|
|
295
|
-
// ' * /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css)\n' +
|
|
296
|
-
// ' * /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs/index(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css): /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/metro/src/node-haste/DependencyGraph.js (289:17)\n' +
|
|
297
|
-
// '\n' +
|
|
298
|
-
// '\x1B[0m \x1B[90m 287 |\x1B[39m }\x1B[0m\n' +
|
|
299
|
-
// '\x1B[0m \x1B[90m 288 |\x1B[39m \x1B[36mif\x1B[39m (error \x1B[36minstanceof\x1B[39m \x1B[33mInvalidPackageError\x1B[39m) {\x1B[0m\n' +
|
|
300
|
-
// '\x1B[0m\x1B[31m\x1B[1m>\x1B[22m\x1B[39m\x1B[90m 289 |\x1B[39m \x1B[36mthrow\x1B[39m \x1B[36mnew\x1B[39m \x1B[33mPackageResolutionError\x1B[39m({\x1B[0m\n' +
|
|
301
|
-
// '\x1B[0m \x1B[90m |\x1B[39m \x1B[31m\x1B[1m^\x1B[22m\x1B[39m\x1B[0m\n' +
|
|
302
|
-
// '\x1B[0m \x1B[90m 290 |\x1B[39m packageError\x1B[33m:\x1B[39m error\x1B[33m,\x1B[39m\x1B[0m\n' +
|
|
303
|
-
// '\x1B[0m \x1B[90m 291 |\x1B[39m originModulePath\x1B[33m:\x1B[39m \x1B[36mfrom\x1B[39m\x1B[33m,\x1B[39m\x1B[0m\n' +
|
|
304
|
-
// '\x1B[0m \x1B[90m 292 |\x1B[39m targetModuleName\x1B[33m:\x1B[39m to\x1B[33m,\x1B[39m\x1B[0m'
|
|
305
|
-
// }
|
|
306
|
-
// The Metro logger already showed this error.
|
|
307
|
-
throw new Error(data.message);
|
|
308
|
-
}
|
|
309
|
-
throw new Error("Invalid resources returned from the Metro serializer. Expected array, found: " + data);
|
|
310
272
|
}
|
|
311
273
|
async getStaticPageAsync(pathname) {
|
|
312
|
-
const { mode , isExporting , baseUrl , routerRoot , asyncRoutes } = this.instanceMetroOptions;
|
|
313
|
-
(0, _assert().default)(mode != null && isExporting != null && baseUrl != null && routerRoot != null && asyncRoutes != null, "The server must be started before calling getStaticPageAsync.");
|
|
274
|
+
const { mode , isExporting , baseUrl , reactCompiler , routerRoot , asyncRoutes } = this.instanceMetroOptions;
|
|
275
|
+
(0, _assert().default)(mode != null && isExporting != null && baseUrl != null && reactCompiler != null && routerRoot != null && asyncRoutes != null, "The server must be started before calling getStaticPageAsync.");
|
|
314
276
|
const platform = "web";
|
|
315
277
|
const devBundleUrlPathname = (0, _metroOptions.createBundleUrlPath)({
|
|
316
278
|
splitChunks: isExporting && !_env1.env.EXPO_NO_BUNDLE_SPLITTING,
|
|
317
279
|
platform,
|
|
318
280
|
mode,
|
|
319
281
|
environment: "client",
|
|
282
|
+
reactCompiler,
|
|
320
283
|
mainModuleName: (0, _manifestMiddleware.resolveMainModuleName)(this.projectRoot, {
|
|
321
284
|
platform
|
|
322
285
|
}),
|
|
@@ -356,36 +319,165 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
356
319
|
// Set when the server is started.
|
|
357
320
|
instanceMetroOptions = {};
|
|
358
321
|
async ssrLoadModule(filePath, specificOptions = {}) {
|
|
359
|
-
const
|
|
360
|
-
(0,
|
|
361
|
-
|
|
322
|
+
const res = await this.ssrLoadModuleContents(filePath, specificOptions);
|
|
323
|
+
return (0, _getStaticRenderFunctions.evalMetroAndWrapFunctions)(this.projectRoot, res.src, res.filename);
|
|
324
|
+
}
|
|
325
|
+
async metroImportAsArtifactsAsync(filePath, specificOptions = {}) {
|
|
326
|
+
const results = await this.ssrLoadModuleContents(filePath, {
|
|
327
|
+
serializerOutput: "static",
|
|
328
|
+
...specificOptions
|
|
329
|
+
});
|
|
330
|
+
// NOTE: This could potentially need more validation in the future.
|
|
331
|
+
if (results.artifacts && results.assets) {
|
|
332
|
+
return {
|
|
333
|
+
artifacts: results.artifacts,
|
|
334
|
+
assets: results.assets,
|
|
335
|
+
src: results.src,
|
|
336
|
+
filename: results.filename,
|
|
337
|
+
map: results.map
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
throw new _errors.CommandError("Invalid bundler results: " + results);
|
|
341
|
+
}
|
|
342
|
+
async metroLoadModuleContents(filePath, specificOptions, extraOptions = {}) {
|
|
343
|
+
const { baseUrl } = this.instanceMetroOptions;
|
|
344
|
+
(0, _assert().default)(baseUrl != null, "The server must be started before calling metroLoadModuleContents.");
|
|
345
|
+
const opts = {
|
|
346
|
+
// TODO: Possibly issues with using an absolute path here...
|
|
347
|
+
// mainModuleName: filePath,
|
|
348
|
+
lazy: false,
|
|
349
|
+
asyncRoutes: false,
|
|
350
|
+
inlineSourceMap: false,
|
|
351
|
+
engine: "hermes",
|
|
352
|
+
minify: false,
|
|
353
|
+
// bytecode: false,
|
|
362
354
|
// Bundle in Node.js mode for SSR.
|
|
363
355
|
environment: "node",
|
|
364
|
-
platform:
|
|
365
|
-
mode:
|
|
366
|
-
|
|
356
|
+
// platform: 'web',
|
|
357
|
+
// mode: 'development',
|
|
358
|
+
//
|
|
367
359
|
...this.instanceMetroOptions,
|
|
368
360
|
baseUrl,
|
|
369
|
-
routerRoot,
|
|
370
|
-
isExporting,
|
|
361
|
+
// routerRoot,
|
|
362
|
+
// isExporting,
|
|
371
363
|
...specificOptions
|
|
372
|
-
}
|
|
364
|
+
};
|
|
365
|
+
const expoBundleOptions = (0, _metroOptions.getMetroDirectBundleOptions)(opts);
|
|
366
|
+
var _customResolverOptions, _dev;
|
|
367
|
+
const resolverOptions = {
|
|
368
|
+
customResolverOptions: (_customResolverOptions = expoBundleOptions.customResolverOptions) != null ? _customResolverOptions : {},
|
|
369
|
+
dev: (_dev = expoBundleOptions.dev) != null ? _dev : true
|
|
370
|
+
};
|
|
371
|
+
var _dev1, _minify, _unstable_transformProfile, ref, _customTransformOptions, _platform;
|
|
372
|
+
const transformOptions = {
|
|
373
|
+
dev: (_dev1 = expoBundleOptions.dev) != null ? _dev1 : true,
|
|
374
|
+
hot: true,
|
|
375
|
+
minify: (_minify = expoBundleOptions.minify) != null ? _minify : false,
|
|
376
|
+
type: "module",
|
|
377
|
+
unstable_transformProfile: (ref = (_unstable_transformProfile = extraOptions.unstable_transformProfile) != null ? _unstable_transformProfile : expoBundleOptions.unstable_transformProfile) != null ? ref : "default",
|
|
378
|
+
customTransformOptions: (_customTransformOptions = expoBundleOptions.customTransformOptions) != null ? _customTransformOptions : Object.create(null),
|
|
379
|
+
platform: (_platform = expoBundleOptions.platform) != null ? _platform : "web",
|
|
380
|
+
runtimeBytecodeVersion: expoBundleOptions.runtimeBytecodeVersion
|
|
381
|
+
};
|
|
382
|
+
const resolvedEntryFilePath = await this.resolveRelativePathAsync(filePath, {
|
|
383
|
+
resolverOptions,
|
|
384
|
+
transformOptions
|
|
385
|
+
});
|
|
386
|
+
// Use fully qualified URL with all options to represent the file path that's used for source maps and HMR. This prevents collisions.
|
|
387
|
+
const filename = (0, _metroOptions.createBundleUrlPath)({
|
|
388
|
+
...opts,
|
|
389
|
+
mainModuleName: resolvedEntryFilePath
|
|
390
|
+
});
|
|
391
|
+
var _lazy, _shallow, _inlineSourceMap, _modulesOnly, _runModule, _sourceMapUrl;
|
|
392
|
+
// https://github.com/facebook/metro/blob/2405f2f6c37a1b641cc379b9c733b1eff0c1c2a1/packages/metro/src/lib/parseOptionsFromUrl.js#L55-L87
|
|
393
|
+
const results = await this._bundleDirectAsync(resolvedEntryFilePath, {
|
|
394
|
+
graphOptions: {
|
|
395
|
+
lazy: (_lazy = expoBundleOptions.lazy) != null ? _lazy : false,
|
|
396
|
+
shallow: (_shallow = expoBundleOptions.shallow) != null ? _shallow : false
|
|
397
|
+
},
|
|
398
|
+
resolverOptions,
|
|
399
|
+
serializerOptions: {
|
|
400
|
+
...expoBundleOptions.serializerOptions,
|
|
401
|
+
inlineSourceMap: (_inlineSourceMap = expoBundleOptions.inlineSourceMap) != null ? _inlineSourceMap : false,
|
|
402
|
+
modulesOnly: (_modulesOnly = expoBundleOptions.modulesOnly) != null ? _modulesOnly : false,
|
|
403
|
+
runModule: (_runModule = expoBundleOptions.runModule) != null ? _runModule : true,
|
|
404
|
+
// @ts-expect-error
|
|
405
|
+
sourceUrl: expoBundleOptions.sourceUrl,
|
|
406
|
+
// @ts-expect-error
|
|
407
|
+
sourceMapUrl: (_sourceMapUrl = extraOptions.sourceMapUrl) != null ? _sourceMapUrl : expoBundleOptions.sourceMapUrl
|
|
408
|
+
},
|
|
409
|
+
transformOptions
|
|
410
|
+
});
|
|
411
|
+
return {
|
|
412
|
+
...results,
|
|
413
|
+
filename
|
|
414
|
+
};
|
|
373
415
|
}
|
|
374
416
|
async ssrLoadModuleContents(filePath, specificOptions = {}) {
|
|
375
417
|
const { baseUrl , routerRoot , isExporting } = this.instanceMetroOptions;
|
|
376
|
-
(0, _assert().default)(baseUrl != null && routerRoot != null && isExporting != null, "The server must be started before calling
|
|
377
|
-
|
|
418
|
+
(0, _assert().default)(baseUrl != null && routerRoot != null && isExporting != null, "The server must be started before calling ssrLoadModuleContents.");
|
|
419
|
+
const opts = {
|
|
420
|
+
// TODO: Possibly issues with using an absolute path here...
|
|
421
|
+
mainModuleName: filePath,
|
|
422
|
+
lazy: false,
|
|
423
|
+
asyncRoutes: false,
|
|
424
|
+
inlineSourceMap: false,
|
|
425
|
+
engine: "hermes",
|
|
426
|
+
minify: false,
|
|
427
|
+
bytecode: false,
|
|
378
428
|
// Bundle in Node.js mode for SSR.
|
|
379
429
|
environment: "node",
|
|
380
430
|
platform: "web",
|
|
381
431
|
mode: "development",
|
|
382
|
-
|
|
432
|
+
//
|
|
383
433
|
...this.instanceMetroOptions,
|
|
434
|
+
// Mostly disable compiler in SSR bundles.
|
|
435
|
+
reactCompiler: false,
|
|
384
436
|
baseUrl,
|
|
385
437
|
routerRoot,
|
|
386
438
|
isExporting,
|
|
387
439
|
...specificOptions
|
|
388
|
-
}
|
|
440
|
+
};
|
|
441
|
+
// https://github.com/facebook/metro/blob/2405f2f6c37a1b641cc379b9c733b1eff0c1c2a1/packages/metro/src/lib/parseOptionsFromUrl.js#L55-L87
|
|
442
|
+
const { filename , bundle , map , ...rest } = await this.metroLoadModuleContents(filePath, opts);
|
|
443
|
+
const scriptContents = wrapBundle(bundle);
|
|
444
|
+
if (map) {
|
|
445
|
+
debug("Registering SSR source map for:", filename);
|
|
446
|
+
_getStaticRenderFunctions.cachedSourceMaps.set(filename, {
|
|
447
|
+
url: this.projectRoot,
|
|
448
|
+
map
|
|
449
|
+
});
|
|
450
|
+
} else {
|
|
451
|
+
debug("No SSR source map found for:", filename);
|
|
452
|
+
}
|
|
453
|
+
return {
|
|
454
|
+
...rest,
|
|
455
|
+
src: scriptContents,
|
|
456
|
+
filename,
|
|
457
|
+
map
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
async legacySinglePageExportBundleAsync(options, extraOptions = {}) {
|
|
461
|
+
const { baseUrl , routerRoot , isExporting } = this.instanceMetroOptions;
|
|
462
|
+
(0, _assert().default)(baseUrl != null && routerRoot != null && isExporting != null, "The server must be started before calling legacySinglePageExportBundleAsync.");
|
|
463
|
+
const opts = {
|
|
464
|
+
...this.instanceMetroOptions,
|
|
465
|
+
baseUrl,
|
|
466
|
+
routerRoot,
|
|
467
|
+
isExporting,
|
|
468
|
+
...options,
|
|
469
|
+
environment: "client",
|
|
470
|
+
serializerOutput: "static"
|
|
471
|
+
};
|
|
472
|
+
// https://github.com/facebook/metro/blob/2405f2f6c37a1b641cc379b9c733b1eff0c1c2a1/packages/metro/src/lib/parseOptionsFromUrl.js#L55-L87
|
|
473
|
+
if (!opts.mainModuleName.startsWith(_path().default.sep)) {
|
|
474
|
+
opts.mainModuleName = "." + _path().default.sep + opts.mainModuleName;
|
|
475
|
+
}
|
|
476
|
+
const output = await this.metroLoadModuleContents(opts.mainModuleName, opts, extraOptions);
|
|
477
|
+
return {
|
|
478
|
+
artifacts: output.artifacts,
|
|
479
|
+
assets: output.assets
|
|
480
|
+
};
|
|
389
481
|
}
|
|
390
482
|
async watchEnvironmentVariables() {
|
|
391
483
|
if (!this.instance) {
|
|
@@ -409,26 +501,24 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
409
501
|
});
|
|
410
502
|
});
|
|
411
503
|
}
|
|
412
|
-
getExpoLineOptions() {
|
|
413
|
-
return this.instanceMetroOptions;
|
|
414
|
-
}
|
|
415
504
|
async startImplementationAsync(options) {
|
|
416
|
-
var ref;
|
|
505
|
+
var ref, ref1;
|
|
417
506
|
options.port = await this.resolvePortAsync(options);
|
|
418
507
|
this.urlCreator = this.getUrlCreator(options);
|
|
419
508
|
const config = (0, _config().getConfig)(this.projectRoot, {
|
|
420
509
|
skipSDKVersionRequirement: true
|
|
421
510
|
});
|
|
422
511
|
const { exp } = config;
|
|
423
|
-
var
|
|
512
|
+
var ref2;
|
|
424
513
|
const useServerRendering = [
|
|
425
514
|
"static",
|
|
426
515
|
"server"
|
|
427
|
-
].includes((
|
|
516
|
+
].includes((ref2 = (ref = exp.web) == null ? void 0 : ref.output) != null ? ref2 : "");
|
|
428
517
|
const baseUrl = (0, _metroOptions.getBaseUrlFromExpoConfig)(exp);
|
|
429
518
|
var _mode;
|
|
430
519
|
const asyncRoutes = (0, _metroOptions.getAsyncRoutesFromExpoConfig)(exp, (_mode = options.mode) != null ? _mode : "development", "web");
|
|
431
520
|
const routerRoot = (0, _router.getRouterDirectoryModuleIdWithManifest)(this.projectRoot, exp);
|
|
521
|
+
const reactCompiler = !!((ref1 = exp.experiments) == null ? void 0 : ref1.reactCompiler);
|
|
432
522
|
const appDir = _path().default.join(this.projectRoot, routerRoot);
|
|
433
523
|
var _mode1;
|
|
434
524
|
const mode = (_mode1 = options.mode) != null ? _mode1 : "development";
|
|
@@ -437,6 +527,7 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
437
527
|
baseUrl,
|
|
438
528
|
mode,
|
|
439
529
|
routerRoot,
|
|
530
|
+
reactCompiler,
|
|
440
531
|
minify: options.minify,
|
|
441
532
|
asyncRoutes
|
|
442
533
|
};
|
|
@@ -490,12 +581,12 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
490
581
|
// This should come after the static middleware so it doesn't serve the favicon from `public/favicon.ico`.
|
|
491
582
|
middleware.use(new _faviconMiddleware.FaviconMiddleware(this.projectRoot).getHandler());
|
|
492
583
|
if (useServerRendering) {
|
|
493
|
-
var
|
|
584
|
+
var ref3;
|
|
494
585
|
middleware.use((0, _createServerRouteMiddleware.createRouteHandlerMiddleware)(this.projectRoot, {
|
|
495
586
|
appDir,
|
|
496
587
|
routerRoot,
|
|
497
588
|
config,
|
|
498
|
-
...(
|
|
589
|
+
...(ref3 = config.exp.extra) == null ? void 0 : ref3.router,
|
|
499
590
|
bundleApiRoute: (functionFilePath)=>this.ssrImportApiRoute(functionFilePath),
|
|
500
591
|
getStaticPageAsync: (pathname)=>{
|
|
501
592
|
return this.getStaticPageAsync(pathname);
|
|
@@ -539,6 +630,7 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
539
630
|
callback == null ? void 0 : callback(err);
|
|
540
631
|
});
|
|
541
632
|
};
|
|
633
|
+
(0, _metroPrivateServer.assertMetroPrivateServer)(metro);
|
|
542
634
|
this.metro = metro;
|
|
543
635
|
return {
|
|
544
636
|
server,
|
|
@@ -624,13 +716,17 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
624
716
|
debug("Bundle API route:", this.instanceMetroOptions.routerRoot, filePath);
|
|
625
717
|
return await this.ssrLoadModuleContents(filePath);
|
|
626
718
|
} catch (error) {
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
719
|
+
var ref;
|
|
720
|
+
const appDir = ((ref = this.instanceMetroOptions) == null ? void 0 : ref.routerRoot) ? _path().default.join(this.projectRoot, this.instanceMetroOptions.routerRoot) : undefined;
|
|
721
|
+
const relativePath = appDir ? _path().default.relative(appDir, filePath) : filePath;
|
|
722
|
+
// Expected errors: invalid syntax, missing resolutions.
|
|
723
|
+
// Wrap with command error for better error messages.
|
|
724
|
+
const err = new _errors.CommandError("API_ROUTE", (0, _chalk().default)`Failed to bundle API Route: {bold ${relativePath}}\n\n` + error.message);
|
|
725
|
+
for(const key in error){
|
|
726
|
+
// @ts-expect-error
|
|
727
|
+
err[key] = error[key];
|
|
632
728
|
}
|
|
633
|
-
throw
|
|
729
|
+
throw err;
|
|
634
730
|
} finally{
|
|
635
731
|
// pendingRouteOperations.delete(filepath);
|
|
636
732
|
}
|
|
@@ -654,7 +750,7 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
654
750
|
const htmlServerError = await (0, _metroErrorInterface.getErrorOverlayHtmlAsync)({
|
|
655
751
|
error,
|
|
656
752
|
projectRoot: this.projectRoot,
|
|
657
|
-
routerRoot: this.
|
|
753
|
+
routerRoot: this.instanceMetroOptions.routerRoot
|
|
658
754
|
});
|
|
659
755
|
return new Response(htmlServerError, {
|
|
660
756
|
status: 500,
|
|
@@ -674,6 +770,188 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
674
770
|
invalidateApiRouteCache() {
|
|
675
771
|
this.pendingRouteOperations.clear();
|
|
676
772
|
}
|
|
773
|
+
// Direct Metro access
|
|
774
|
+
// Emulates the Metro dev server .bundle endpoint without having to go through a server.
|
|
775
|
+
async _bundleDirectAsync(resolvedEntryFilePath, { transformOptions , resolverOptions , graphOptions , serializerOptions }) {
|
|
776
|
+
var ref;
|
|
777
|
+
(0, _assert().default)(this.metro, "Metro server must be running to bundle directly.");
|
|
778
|
+
const config = this.metro._config;
|
|
779
|
+
const buildNumber = this.metro.getNewBuildNumber();
|
|
780
|
+
const bundlePerfLogger = config.unstable_perfLoggerFactory == null ? void 0 : config.unstable_perfLoggerFactory("BUNDLING_REQUEST", {
|
|
781
|
+
key: buildNumber
|
|
782
|
+
});
|
|
783
|
+
const onProgress = (transformedFileCount, totalFileCount)=>{
|
|
784
|
+
var ref, ref1;
|
|
785
|
+
(ref = this.metro) == null ? void 0 : (ref1 = ref._reporter) == null ? void 0 : ref1.update == null ? void 0 : ref1.update({
|
|
786
|
+
buildID: getBuildID(buildNumber),
|
|
787
|
+
type: "bundle_transform_progressed",
|
|
788
|
+
transformedFileCount,
|
|
789
|
+
totalFileCount
|
|
790
|
+
});
|
|
791
|
+
};
|
|
792
|
+
const revPromise = this.getMetroRevision(resolvedEntryFilePath, {
|
|
793
|
+
graphOptions,
|
|
794
|
+
transformOptions,
|
|
795
|
+
resolverOptions
|
|
796
|
+
});
|
|
797
|
+
bundlePerfLogger == null ? void 0 : bundlePerfLogger.point("resolvingAndTransformingDependencies_start");
|
|
798
|
+
bundlePerfLogger == null ? void 0 : bundlePerfLogger.annotate({
|
|
799
|
+
bool: {
|
|
800
|
+
initial_build: revPromise == null
|
|
801
|
+
}
|
|
802
|
+
});
|
|
803
|
+
(ref = this.metro) == null ? void 0 : ref._reporter.update({
|
|
804
|
+
buildID: getBuildID(buildNumber),
|
|
805
|
+
bundleDetails: {
|
|
806
|
+
bundleType: transformOptions.type,
|
|
807
|
+
dev: transformOptions.dev,
|
|
808
|
+
entryFile: resolvedEntryFilePath,
|
|
809
|
+
minify: transformOptions.minify,
|
|
810
|
+
platform: transformOptions.platform,
|
|
811
|
+
// @ts-expect-error: typed incorrectly upstream
|
|
812
|
+
customResolverOptions: resolverOptions.customResolverOptions,
|
|
813
|
+
customTransformOptions: transformOptions.customTransformOptions
|
|
814
|
+
},
|
|
815
|
+
isPrefetch: false,
|
|
816
|
+
type: "bundle_build_started"
|
|
817
|
+
});
|
|
818
|
+
try {
|
|
819
|
+
const { delta , revision } = await (revPromise != null ? this.metro.getBundler().updateGraph(await revPromise, false) : this.metro.getBundler().initializeGraph(// NOTE: Using absolute path instead of relative input path is a breaking change.
|
|
820
|
+
// entryFile,
|
|
821
|
+
resolvedEntryFilePath, transformOptions, resolverOptions, {
|
|
822
|
+
onProgress,
|
|
823
|
+
shallow: graphOptions.shallow,
|
|
824
|
+
// @ts-expect-error: typed incorrectly
|
|
825
|
+
lazy: graphOptions.lazy
|
|
826
|
+
}));
|
|
827
|
+
bundlePerfLogger == null ? void 0 : bundlePerfLogger.annotate({
|
|
828
|
+
int: {
|
|
829
|
+
graph_node_count: revision.graph.dependencies.size
|
|
830
|
+
}
|
|
831
|
+
});
|
|
832
|
+
bundlePerfLogger == null ? void 0 : bundlePerfLogger.point("resolvingAndTransformingDependencies_end");
|
|
833
|
+
bundlePerfLogger == null ? void 0 : bundlePerfLogger.point("serializingBundle_start");
|
|
834
|
+
const shouldAddToIgnoreList = this.metro._shouldAddModuleToIgnoreList.bind(this.metro);
|
|
835
|
+
const serializer = this.getMetroSerializer();
|
|
836
|
+
var _unstable_serverRoot;
|
|
837
|
+
const bundle = await serializer(// NOTE: Using absolute path instead of relative input path is a breaking change.
|
|
838
|
+
// entryFile,
|
|
839
|
+
resolvedEntryFilePath, revision.prepend, revision.graph, {
|
|
840
|
+
asyncRequireModulePath: await this.metro._resolveRelativePath(config.transformer.asyncRequireModulePath, {
|
|
841
|
+
relativeTo: "project",
|
|
842
|
+
resolverOptions,
|
|
843
|
+
transformOptions
|
|
844
|
+
}),
|
|
845
|
+
// ...serializerOptions,
|
|
846
|
+
processModuleFilter: config.serializer.processModuleFilter,
|
|
847
|
+
createModuleId: this.metro._createModuleId,
|
|
848
|
+
getRunModuleStatement: config.serializer.getRunModuleStatement,
|
|
849
|
+
includeAsyncPaths: graphOptions.lazy,
|
|
850
|
+
dev: transformOptions.dev,
|
|
851
|
+
projectRoot: config.projectRoot,
|
|
852
|
+
modulesOnly: serializerOptions.modulesOnly,
|
|
853
|
+
runBeforeMainModule: config.serializer.getModulesRunBeforeMainModule(resolvedEntryFilePath),
|
|
854
|
+
runModule: serializerOptions.runModule,
|
|
855
|
+
sourceMapUrl: serializerOptions.sourceMapUrl,
|
|
856
|
+
sourceUrl: serializerOptions.sourceUrl,
|
|
857
|
+
inlineSourceMap: serializerOptions.inlineSourceMap,
|
|
858
|
+
serverRoot: (_unstable_serverRoot = config.server.unstable_serverRoot) != null ? _unstable_serverRoot : config.projectRoot,
|
|
859
|
+
shouldAddToIgnoreList,
|
|
860
|
+
// @ts-expect-error: passed to our serializer to enable non-serial return values.
|
|
861
|
+
serializerOptions
|
|
862
|
+
});
|
|
863
|
+
this.metro._reporter.update({
|
|
864
|
+
buildID: getBuildID(buildNumber),
|
|
865
|
+
type: "bundle_build_done"
|
|
866
|
+
});
|
|
867
|
+
bundlePerfLogger == null ? void 0 : bundlePerfLogger.point("serializingBundle_end");
|
|
868
|
+
let bundleCode = null;
|
|
869
|
+
let bundleMap = null;
|
|
870
|
+
// @ts-expect-error: If the output is multi-bundle...
|
|
871
|
+
if (serializerOptions.output === "static") {
|
|
872
|
+
try {
|
|
873
|
+
var ref1, ref2;
|
|
874
|
+
const parsed = typeof bundle === "string" ? JSON.parse(bundle) : bundle;
|
|
875
|
+
(0, _assert().default)("artifacts" in parsed && Array.isArray(parsed.artifacts), "Expected serializer to return an object with key artifacts to contain an array of serial assets.");
|
|
876
|
+
const artifacts = parsed.artifacts;
|
|
877
|
+
const assets = parsed.assets;
|
|
878
|
+
const bundleCode1 = artifacts.filter((asset)=>asset.type === "js")[0];
|
|
879
|
+
var ref3;
|
|
880
|
+
const bundleMap1 = (ref3 = (ref1 = artifacts.filter((asset)=>asset.type === "map")) == null ? void 0 : (ref2 = ref1[0]) == null ? void 0 : ref2.source) != null ? ref3 : "";
|
|
881
|
+
return {
|
|
882
|
+
numModifiedFiles: delta.reset ? delta.added.size + revision.prepend.length : delta.added.size + delta.modified.size + delta.deleted.size,
|
|
883
|
+
lastModifiedDate: revision.date,
|
|
884
|
+
nextRevId: revision.id,
|
|
885
|
+
bundle: bundleCode1.source,
|
|
886
|
+
map: bundleMap1,
|
|
887
|
+
artifacts,
|
|
888
|
+
assets
|
|
889
|
+
};
|
|
890
|
+
} catch (error) {
|
|
891
|
+
throw new Error("Serializer did not return expected format. The project copy of `expo/metro-config` may be out of date. Error: " + error.message);
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
if (typeof bundle === "string") {
|
|
895
|
+
bundleCode = bundle;
|
|
896
|
+
// Create the source map in a second pass...
|
|
897
|
+
let { prepend , graph } = revision;
|
|
898
|
+
if (serializerOptions.modulesOnly) {
|
|
899
|
+
prepend = [];
|
|
900
|
+
}
|
|
901
|
+
bundleMap = await sourceMapStringAsync([
|
|
902
|
+
//
|
|
903
|
+
...prepend,
|
|
904
|
+
...this.metro._getSortedModules(graph),
|
|
905
|
+
], {
|
|
906
|
+
excludeSource: serializerOptions.excludeSource,
|
|
907
|
+
processModuleFilter: config.serializer.processModuleFilter,
|
|
908
|
+
shouldAddToIgnoreList
|
|
909
|
+
});
|
|
910
|
+
} else {
|
|
911
|
+
bundleCode = bundle.code;
|
|
912
|
+
bundleMap = bundle.map;
|
|
913
|
+
}
|
|
914
|
+
return {
|
|
915
|
+
numModifiedFiles: delta.reset ? delta.added.size + revision.prepend.length : delta.added.size + delta.modified.size + delta.deleted.size,
|
|
916
|
+
lastModifiedDate: revision.date,
|
|
917
|
+
nextRevId: revision.id,
|
|
918
|
+
bundle: bundleCode,
|
|
919
|
+
map: bundleMap
|
|
920
|
+
};
|
|
921
|
+
} catch (error1) {
|
|
922
|
+
this.metro._reporter.update({
|
|
923
|
+
buildID: getBuildID(buildNumber),
|
|
924
|
+
type: "bundle_build_failed"
|
|
925
|
+
});
|
|
926
|
+
throw error1;
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
getMetroSerializer() {
|
|
930
|
+
var ref, ref1;
|
|
931
|
+
return ((ref = this.metro) == null ? void 0 : (ref1 = ref._config) == null ? void 0 : ref1.serializer.customSerializer) || ((entryPoint, preModules, graph, options)=>(0, _bundleToString().default)((0, _baseJSBundle().default)(entryPoint, preModules, graph, options)).code);
|
|
932
|
+
}
|
|
933
|
+
getMetroRevision(resolvedEntryFilePath, { graphOptions , transformOptions , resolverOptions }) {
|
|
934
|
+
(0, _assert().default)(this.metro, "Metro server must be running to bundle directly.");
|
|
935
|
+
const config = this.metro._config;
|
|
936
|
+
const graphId = getGraphId(resolvedEntryFilePath, transformOptions, {
|
|
937
|
+
unstable_allowRequireContext: config.transformer.unstable_allowRequireContext,
|
|
938
|
+
resolverOptions,
|
|
939
|
+
shallow: graphOptions.shallow,
|
|
940
|
+
lazy: graphOptions.lazy
|
|
941
|
+
});
|
|
942
|
+
return this.metro.getBundler().getRevisionByGraphId(graphId);
|
|
943
|
+
}
|
|
944
|
+
async resolveRelativePathAsync(moduleId, { resolverOptions , transformOptions }) {
|
|
945
|
+
(0, _assert().default)(this.metro, "cannot invoke resolveRelativePathAsync without metro instance");
|
|
946
|
+
return await this.metro._resolveRelativePath(moduleId, {
|
|
947
|
+
relativeTo: "server",
|
|
948
|
+
resolverOptions,
|
|
949
|
+
transformOptions
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
function getBuildID(buildNumber) {
|
|
954
|
+
return buildNumber.toString(36);
|
|
677
955
|
}
|
|
678
956
|
function getDeepLinkHandler(projectRoot) {
|
|
679
957
|
return async ({ runtime })=>{
|
|
@@ -685,5 +963,16 @@ function getDeepLinkHandler(projectRoot) {
|
|
|
685
963
|
});
|
|
686
964
|
};
|
|
687
965
|
}
|
|
966
|
+
function wrapBundle(str) {
|
|
967
|
+
// Skip the metro runtime so debugging is a bit easier.
|
|
968
|
+
// Replace the __r() call with an export statement.
|
|
969
|
+
// Use gm to apply to the last require line. This is needed when the bundle has side-effects.
|
|
970
|
+
return str.replace(/^(__r\(.*\);)$/gm, "module.exports = $1");
|
|
971
|
+
}
|
|
972
|
+
async function sourceMapStringAsync(modules, options) {
|
|
973
|
+
return (await (0, _sourceMapGenerator().sourceMapGeneratorNonBlocking)(modules, options)).toString(undefined, {
|
|
974
|
+
excludeSource: options.excludeSource
|
|
975
|
+
});
|
|
976
|
+
}
|
|
688
977
|
|
|
689
978
|
//# sourceMappingURL=MetroBundlerDevServer.js.map
|