@expo/metro-runtime 2.1.9 → 2.1.10
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/async-require/buildUrlForBundle.native.js +5 -2
- package/build/async-require/buildUrlForBundle.native.js.map +1 -1
- package/build/async-require/loadBundle.d.ts.map +1 -1
- package/build/async-require/loadBundle.js +3 -2
- package/build/async-require/loadBundle.js.map +1 -1
- package/package.json +1 -1
|
@@ -10,15 +10,18 @@ exports.buildUrlForBundle = void 0;
|
|
|
10
10
|
function buildUrlForBundle(bundlePath) {
|
|
11
11
|
if (process.env.NODE_ENV === "production") {
|
|
12
12
|
if (typeof location !== "undefined") {
|
|
13
|
-
return location.origin
|
|
13
|
+
return joinComponents(location.origin, bundlePath);
|
|
14
14
|
}
|
|
15
15
|
throw new Error('Unable to determine the production URL where additional JavaScript chunks are hosted because the global "location" variable is not defined.');
|
|
16
16
|
}
|
|
17
17
|
else {
|
|
18
18
|
const getDevServer = require("../getDevServer");
|
|
19
19
|
const { url: serverUrl } = getDevServer();
|
|
20
|
-
return serverUrl
|
|
20
|
+
return joinComponents(serverUrl, bundlePath);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
exports.buildUrlForBundle = buildUrlForBundle;
|
|
24
|
+
function joinComponents(prefix, suffix) {
|
|
25
|
+
return prefix.replace(/\/+$/, "") + "/" + suffix.replace(/^\/+/, "");
|
|
26
|
+
}
|
|
24
27
|
//# sourceMappingURL=buildUrlForBundle.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildUrlForBundle.native.js","sourceRoot":"","sources":["../../src/async-require/buildUrlForBundle.native.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,SAAgB,iBAAiB,CAAC,UAAkB;IAClD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACzC,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;YACnC,OAAO,
|
|
1
|
+
{"version":3,"file":"buildUrlForBundle.native.js","sourceRoot":"","sources":["../../src/async-require/buildUrlForBundle.native.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,SAAgB,iBAAiB,CAAC,UAAkB;IAClD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACzC,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;YACnC,OAAO,cAAc,CAAC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;SACpD;QACD,MAAM,IAAI,KAAK,CACb,6IAA6I,CAC9I,CAAC;KACH;SAAM;QACL,MAAM,YAAY,GAChB,OAAO,CAAC,iBAAiB,CAA6C,CAAC;QAEzE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,YAAY,EAAE,CAAC;QAE1C,OAAO,cAAc,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;KAC9C;AACH,CAAC;AAhBD,8CAgBC;AAED,SAAS,cAAc,CAAC,MAAc,EAAE,MAAc;IACpD,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACvE,CAAC","sourcesContent":["/**\n * Copyright © 2022 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 */\n\nexport function buildUrlForBundle(bundlePath: string): string {\n if (process.env.NODE_ENV === \"production\") {\n if (typeof location !== \"undefined\") {\n return joinComponents(location.origin, bundlePath);\n }\n throw new Error(\n 'Unable to determine the production URL where additional JavaScript chunks are hosted because the global \"location\" variable is not defined.'\n );\n } else {\n const getDevServer =\n require(\"../getDevServer\") as typeof import(\"../getDevServer\").default;\n\n const { url: serverUrl } = getDevServer();\n\n return joinComponents(serverUrl, bundlePath);\n }\n}\n\nfunction joinComponents(prefix: string, suffix: string): string {\n return prefix.replace(/\\/+$/, \"\") + \"/\" + suffix.replace(/^\\/+/, \"\");\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadBundle.d.ts","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,
|
|
1
|
+
{"version":3,"file":"loadBundle.d.ts","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA6BvE"}
|
|
@@ -15,7 +15,7 @@ let pendingRequests = 0;
|
|
|
15
15
|
*
|
|
16
16
|
* @param bundlePath Given a statement like `import('./Bacon')` `bundlePath` would be `Bacon.bundle?params=from-metro`.
|
|
17
17
|
*/
|
|
18
|
-
function loadBundleAsync(bundlePath) {
|
|
18
|
+
async function loadBundleAsync(bundlePath) {
|
|
19
19
|
const requestUrl = (0, buildUrlForBundle_1.buildUrlForBundle)(bundlePath);
|
|
20
20
|
if (process.env.NODE_ENV === "production") {
|
|
21
21
|
return (0, fetchThenEval_1.fetchThenEvalAsync)(requestUrl);
|
|
@@ -30,7 +30,8 @@ function loadBundleAsync(bundlePath) {
|
|
|
30
30
|
return (0, fetchThenEval_1.fetchThenEvalAsync)(requestUrl)
|
|
31
31
|
.then(() => {
|
|
32
32
|
if (process.env.NODE_ENV !== "production") {
|
|
33
|
-
const HMRClient = require("../HMRClient")
|
|
33
|
+
const HMRClient = require("../HMRClient")
|
|
34
|
+
.default;
|
|
34
35
|
HMRClient.registerBundle(requestUrl);
|
|
35
36
|
}
|
|
36
37
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadBundle.js","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,2DAAwD;AACxD,mDAAqD;AAErD,IAAI,eAAe,GAAG,CAAC,CAAC;AAExB;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"loadBundle.js","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,2DAAwD;AACxD,mDAAqD;AAErD,IAAI,eAAe,GAAG,CAAC,CAAC;AAExB;;;;GAIG;AACI,KAAK,UAAU,eAAe,CAAC,UAAkB;IACtD,MAAM,UAAU,GAAG,IAAA,qCAAiB,EAAC,UAAU,CAAC,CAAC;IAEjD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACzC,OAAO,IAAA,kCAAkB,EAAC,UAAU,CAAC,CAAC;KACvC;SAAM;QACL,MAAM,WAAW,GACf,OAAO,CAAC,gBAAgB,CAA4C,CAAC;QAEvE,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;YACzC,qEAAqE;YACrE,WAAW,CAAC,WAAW,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;SACnD;QACD,eAAe,EAAE,CAAC;QAElB,OAAO,IAAA,kCAAkB,EAAC,UAAU,CAAC;aAClC,IAAI,CAAC,GAAG,EAAE;YACT,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;gBACzC,MAAM,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC;qBACtC,OAAgD,CAAC;gBACpD,SAAS,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;aACtC;QACH,CAAC,CAAC;aACD,OAAO,CAAC,GAAG,EAAE;YACZ,IAAI,CAAC,EAAE,eAAe,EAAE;gBACtB,WAAW,CAAC,IAAI,EAAE,CAAC;aACpB;QACH,CAAC,CAAC,CAAC;KACN;AACH,CAAC;AA7BD,0CA6BC","sourcesContent":["/**\n * Copyright © 2022 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 { buildUrlForBundle } from \"./buildUrlForBundle\";\nimport { fetchThenEvalAsync } from \"./fetchThenEval\";\n\nlet pendingRequests = 0;\n\n/**\n * Load a bundle for a URL using fetch + eval on native and script tag injection on web.\n *\n * @param bundlePath Given a statement like `import('./Bacon')` `bundlePath` would be `Bacon.bundle?params=from-metro`.\n */\nexport async function loadBundleAsync(bundlePath: string): Promise<void> {\n const requestUrl = buildUrlForBundle(bundlePath);\n\n if (process.env.NODE_ENV === \"production\") {\n return fetchThenEvalAsync(requestUrl);\n } else {\n const LoadingView =\n require(\"../LoadingView\") as typeof import(\"../LoadingView\").default;\n\n if (process.env.NODE_ENV !== \"production\") {\n // Send a signal to the `expo` package to show the loading indicator.\n LoadingView.showMessage(\"Downloading...\", \"load\");\n }\n pendingRequests++;\n\n return fetchThenEvalAsync(requestUrl)\n .then(() => {\n if (process.env.NODE_ENV !== \"production\") {\n const HMRClient = require(\"../HMRClient\")\n .default as typeof import(\"../HMRClient\").default;\n HMRClient.registerBundle(requestUrl);\n }\n })\n .finally(() => {\n if (!--pendingRequests) {\n LoadingView.hide();\n }\n });\n }\n}\n"]}
|
package/package.json
CHANGED