@expo/metro-runtime 2.1.1 → 2.1.3
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/buildAsyncRequire.d.ts +10 -18
- package/build/async-require/buildAsyncRequire.d.ts.map +1 -1
- package/build/async-require/buildAsyncRequire.js +13 -42
- package/build/async-require/buildAsyncRequire.js.map +1 -1
- package/build/async-require/buildUrlForBundle.d.ts +7 -1
- package/build/async-require/buildUrlForBundle.d.ts.map +1 -1
- package/build/async-require/buildUrlForBundle.js +4 -13
- package/build/async-require/buildUrlForBundle.js.map +1 -1
- package/build/async-require/buildUrlForBundle.native.d.ts +7 -1
- package/build/async-require/buildUrlForBundle.native.d.ts.map +1 -1
- package/build/async-require/buildUrlForBundle.native.js +12 -18
- package/build/async-require/buildUrlForBundle.native.js.map +1 -1
- package/build/async-require/index.js +4 -1
- package/build/async-require/index.js.map +1 -1
- package/build/async-require/loadBundle.d.ts +3 -4
- package/build/async-require/loadBundle.d.ts.map +1 -1
- package/build/async-require/loadBundle.js +29 -2
- package/build/async-require/loadBundle.js.map +1 -1
- package/build/error-overlay/LogBox.web.d.ts.map +1 -1
- package/build/error-overlay/LogBox.web.js +12 -2
- package/build/error-overlay/LogBox.web.js.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/location/install.native.d.ts +1 -1
- package/build/location/install.native.d.ts.map +1 -1
- package/build/location/install.native.js +3 -1
- package/build/location/install.native.js.map +1 -1
- package/package.json +1 -1
- package/build/async-require/loadBundle.android.d.ts +0 -2
- package/build/async-require/loadBundle.android.d.ts.map +0 -1
- package/build/async-require/loadBundle.android.js +0 -29
- package/build/async-require/loadBundle.android.js.map +0 -1
- package/build/async-require/loadBundlePolyfill.d.ts +0 -7
- package/build/async-require/loadBundlePolyfill.d.ts.map +0 -1
- package/build/async-require/loadBundlePolyfill.js +0 -46
- package/build/async-require/loadBundlePolyfill.js.map +0 -1
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
type ImportBundleNames = Record<string, string>;
|
|
2
|
-
type MetroRequire = {
|
|
3
|
-
(id: number): any;
|
|
4
|
-
importAll: (id: number) => any;
|
|
5
|
-
};
|
|
6
1
|
/**
|
|
7
|
-
*
|
|
8
|
-
* https://github.com/facebook/metro/blob/f9fe277986ff7e7e53ae0418040f3aa1eb1c7056/packages/metro/src/ModuleGraph/worker/collectDependencies.js#L629-L639
|
|
2
|
+
* Copyright © 2022 650 Industries.
|
|
9
3
|
*
|
|
10
|
-
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Must satisfy the requirements of the Metro bundler.
|
|
9
|
+
* https://github.com/react-native-community/discussions-and-proposals/blob/main/proposals/0605-lazy-bundling.md#__loadbundleasync-in-metro
|
|
11
10
|
*/
|
|
12
|
-
type AsyncRequire =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}): Promise<TModule | void> | TModule;
|
|
16
|
-
prefetch(moduleID: number, moduleName: string, paths: ImportBundleNames): void;
|
|
17
|
-
/** NOTE(EvanBacon): Unclear what this should return `__jsResource` ?? */
|
|
18
|
-
resource(moduleID: number, moduleName: string, paths: ImportBundleNames): never;
|
|
19
|
-
};
|
|
20
|
-
/** Create an `asyncRequire` function in the expected shape for Metro bundler. */
|
|
21
|
-
export declare function buildAsyncRequire(metroRequire: MetroRequire): AsyncRequire;
|
|
11
|
+
type AsyncRequire = (path: string) => Promise<void>;
|
|
12
|
+
/** Create an `loadBundleAsync` function in the expected shape for Metro bundler. */
|
|
13
|
+
export declare function buildAsyncRequire(): AsyncRequire;
|
|
22
14
|
export {};
|
|
23
15
|
//# sourceMappingURL=buildAsyncRequire.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildAsyncRequire.d.ts","sourceRoot":"","sources":["../../src/async-require/buildAsyncRequire.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildAsyncRequire.d.ts","sourceRoot":"","sources":["../../src/async-require/buildAsyncRequire.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;GAGG;AACH,KAAK,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEpD,oFAAoF;AACpF,wBAAgB,iBAAiB,IAAI,YAAY,CAiBhD"}
|
|
@@ -1,56 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildAsyncRequire = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* Copyright © 2022 650 Industries.
|
|
6
4
|
*
|
|
7
5
|
* This source code is licensed under the MIT license found in the
|
|
8
6
|
* LICENSE file in the root directory of this source tree.
|
|
9
7
|
*/
|
|
10
|
-
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.buildAsyncRequire = void 0;
|
|
11
10
|
const loadBundle_1 = require("./loadBundle");
|
|
12
|
-
/** Create an `
|
|
13
|
-
function buildAsyncRequire(
|
|
14
|
-
const
|
|
15
|
-
function
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
(react_native_1.Platform.OS === "web" && typeof window === "undefined")) {
|
|
19
|
-
// TODO: Don't disable in production
|
|
20
|
-
return Promise.resolve().then(() => metroRequire.importAll(moduleID));
|
|
21
|
-
}
|
|
22
|
-
if (options.isPrefetchOnly) {
|
|
23
|
-
return Promise.resolve();
|
|
11
|
+
/** Create an `loadBundleAsync` function in the expected shape for Metro bundler. */
|
|
12
|
+
function buildAsyncRequire() {
|
|
13
|
+
const cache = new Map();
|
|
14
|
+
return async function universal_loadBundleAsync(path) {
|
|
15
|
+
if (cache.has(path)) {
|
|
16
|
+
return cache.get(path);
|
|
24
17
|
}
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (bundlePath) {
|
|
29
|
-
// Prevent loading the same module more than once.
|
|
30
|
-
if (!importBundlePromises[stringModuleID]) {
|
|
31
|
-
importBundlePromises[stringModuleID] = (0, loadBundle_1.loadBundleAsync)(bundlePath).then(() => metroRequire(moduleID));
|
|
32
|
-
}
|
|
33
|
-
// Return for the user to resolve.
|
|
34
|
-
return importBundlePromises[stringModuleID];
|
|
35
|
-
}
|
|
36
|
-
return metroRequire.importAll(moduleID);
|
|
37
|
-
}
|
|
38
|
-
asyncRequire.prefetch = function (moduleID, moduleName, paths) {
|
|
39
|
-
// TODO: Don't disable in production
|
|
40
|
-
if (process.env.NODE_ENV === "production") {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const result = asyncRequire(moduleID, moduleName, paths, {
|
|
44
|
-
isPrefetchOnly: true,
|
|
18
|
+
const promise = (0, loadBundle_1.loadBundleAsync)(path).catch((error) => {
|
|
19
|
+
cache.delete(path);
|
|
20
|
+
throw error;
|
|
45
21
|
});
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
asyncRequire.resource = function (moduleID, moduleName, paths) {
|
|
51
|
-
throw new Error("Unimplemented Metro runtime feature");
|
|
22
|
+
cache.set(path, promise);
|
|
23
|
+
return promise;
|
|
52
24
|
};
|
|
53
|
-
return asyncRequire;
|
|
54
25
|
}
|
|
55
26
|
exports.buildAsyncRequire = buildAsyncRequire;
|
|
56
27
|
//# sourceMappingURL=buildAsyncRequire.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildAsyncRequire.js","sourceRoot":"","sources":["../../src/async-require/buildAsyncRequire.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildAsyncRequire.js","sourceRoot":"","sources":["../../src/async-require/buildAsyncRequire.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,6CAA+C;AAQ/C,oFAAoF;AACpF,SAAgB,iBAAiB;IAC/B,MAAM,KAAK,GAAG,IAAI,GAAG,EAAyB,CAAC;IAE/C,OAAO,KAAK,UAAU,yBAAyB,CAAC,IAAY;QAC1D,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YACnB,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC;SACzB;QAED,MAAM,OAAO,GAAG,IAAA,4BAAe,EAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACpD,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACnB,MAAM,KAAK,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEzB,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC;AAjBD,8CAiBC","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\nimport { loadBundleAsync } from \"./loadBundle\";\n\n/**\n * Must satisfy the requirements of the Metro bundler.\n * https://github.com/react-native-community/discussions-and-proposals/blob/main/proposals/0605-lazy-bundling.md#__loadbundleasync-in-metro\n */\ntype AsyncRequire = (path: string) => Promise<void>;\n\n/** Create an `loadBundleAsync` function in the expected shape for Metro bundler. */\nexport function buildAsyncRequire(): AsyncRequire {\n const cache = new Map<string, Promise<void>>();\n\n return async function universal_loadBundleAsync(path: string): Promise<void> {\n if (cache.has(path)) {\n return cache.get(path)!;\n }\n\n const promise = loadBundleAsync(path).catch((error) => {\n cache.delete(path);\n throw error;\n });\n\n cache.set(path, promise);\n\n return promise;\n };\n}\n"]}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2022 650 Industries.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
1
7
|
/**
|
|
2
8
|
* Given a path and some optional additional query parameters, create the dev server bundle URL.
|
|
3
9
|
* @param bundlePath like `/foobar`
|
|
4
10
|
* @param params like `{ platform: "web" }`
|
|
5
11
|
* @returns a URL like "/foobar.bundle?platform=android&modulesOnly=true&runModule=false&runtimeBytecodeVersion=null"
|
|
6
12
|
*/
|
|
7
|
-
export declare function buildUrlForBundle(bundlePath: string
|
|
13
|
+
export declare function buildUrlForBundle(bundlePath: string): string;
|
|
8
14
|
//# sourceMappingURL=buildUrlForBundle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildUrlForBundle.d.ts","sourceRoot":"","sources":["../../src/async-require/buildUrlForBundle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildUrlForBundle.d.ts","sourceRoot":"","sources":["../../src/async-require/buildUrlForBundle.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAI5D"}
|
|
@@ -1,31 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.buildUrlForBundle = void 0;
|
|
7
2
|
/**
|
|
8
3
|
* Copyright © 2022 650 Industries.
|
|
9
4
|
*
|
|
10
5
|
* This source code is licensed under the MIT license found in the
|
|
11
6
|
* LICENSE file in the root directory of this source tree.
|
|
12
7
|
*/
|
|
13
|
-
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.buildUrlForBundle = void 0;
|
|
14
10
|
/**
|
|
15
11
|
* Given a path and some optional additional query parameters, create the dev server bundle URL.
|
|
16
12
|
* @param bundlePath like `/foobar`
|
|
17
13
|
* @param params like `{ platform: "web" }`
|
|
18
14
|
* @returns a URL like "/foobar.bundle?platform=android&modulesOnly=true&runModule=false&runtimeBytecodeVersion=null"
|
|
19
15
|
*/
|
|
20
|
-
function buildUrlForBundle(bundlePath
|
|
16
|
+
function buildUrlForBundle(bundlePath) {
|
|
21
17
|
// NOTE(EvanBacon): This must come from the window origin (at least in dev mode).
|
|
22
18
|
// Otherwise Metro will crash from attempting to load a bundle that doesn't exist.
|
|
23
|
-
|
|
24
|
-
if (!bundlePath.startsWith("/")) {
|
|
25
|
-
url += "/";
|
|
26
|
-
}
|
|
27
|
-
const query = qs_1.default.stringify(params);
|
|
28
|
-
return url + bundlePath + ".bundle" + (query ? "?" + query : "");
|
|
19
|
+
return "/" + bundlePath.replace(/^\/+/, "");
|
|
29
20
|
}
|
|
30
21
|
exports.buildUrlForBundle = buildUrlForBundle;
|
|
31
22
|
//# sourceMappingURL=buildUrlForBundle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildUrlForBundle.js","sourceRoot":"","sources":["../../src/async-require/buildUrlForBundle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildUrlForBundle.js","sourceRoot":"","sources":["../../src/async-require/buildUrlForBundle.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,UAAkB;IAClD,iFAAiF;IACjF,kFAAkF;IAClF,OAAO,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAC9C,CAAC;AAJD,8CAIC","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\n/**\n * Given a path and some optional additional query parameters, create the dev server bundle URL.\n * @param bundlePath like `/foobar`\n * @param params like `{ platform: \"web\" }`\n * @returns a URL like \"/foobar.bundle?platform=android&modulesOnly=true&runModule=false&runtimeBytecodeVersion=null\"\n */\nexport function buildUrlForBundle(bundlePath: string): string {\n // NOTE(EvanBacon): This must come from the window origin (at least in dev mode).\n // Otherwise Metro will crash from attempting to load a bundle that doesn't exist.\n return \"/\" + bundlePath.replace(/^\\/+/, \"\");\n}\n"]}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2022 650 Industries.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildUrlForBundle(bundlePath: string): string;
|
|
2
8
|
//# sourceMappingURL=buildUrlForBundle.native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildUrlForBundle.native.d.ts","sourceRoot":"","sources":["../../src/async-require/buildUrlForBundle.native.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildUrlForBundle.native.d.ts","sourceRoot":"","sources":["../../src/async-require/buildUrlForBundle.native.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAY5D"}
|
|
@@ -1,31 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.buildUrlForBundle = void 0;
|
|
7
2
|
/**
|
|
8
3
|
* Copyright © 2022 650 Industries.
|
|
9
4
|
*
|
|
10
5
|
* This source code is licensed under the MIT license found in the
|
|
11
6
|
* LICENSE file in the root directory of this source tree.
|
|
12
7
|
*/
|
|
13
|
-
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.buildUrlForBundle = void 0;
|
|
14
13
|
const getDevServer_1 = __importDefault(require("../getDevServer"));
|
|
15
|
-
function buildUrlForBundle(bundlePath
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
let query = {};
|
|
21
|
-
if (fullBundleUrl != null) {
|
|
22
|
-
const queryStart = fullBundleUrl.indexOf("?");
|
|
23
|
-
if (queryStart !== -1) {
|
|
24
|
-
query = qs_1.default.parse(fullBundleUrl.substring(queryStart + 1));
|
|
14
|
+
function buildUrlForBundle(bundlePath) {
|
|
15
|
+
if (process.env.NODE_ENV === "production") {
|
|
16
|
+
if (typeof location !== "undefined") {
|
|
17
|
+
return location.origin.replace(/\/+$/, "") + "/" + bundlePath;
|
|
25
18
|
}
|
|
19
|
+
throw new Error('Unable to determine the production URL where additional JavaScript chunks are hosted because the global "location" variable is not defined.');
|
|
26
20
|
}
|
|
27
|
-
|
|
28
|
-
return serverUrl
|
|
21
|
+
const { url: serverUrl } = (0, getDevServer_1.default)();
|
|
22
|
+
return serverUrl.replace(/\/+$/, "") + "/" + bundlePath.replace(/^\/+/, "");
|
|
29
23
|
}
|
|
30
24
|
exports.buildUrlForBundle = buildUrlForBundle;
|
|
31
25
|
//# sourceMappingURL=buildUrlForBundle.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildUrlForBundle.native.js","sourceRoot":"","sources":["../../src/async-require/buildUrlForBundle.native.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildUrlForBundle.native.js","sourceRoot":"","sources":["../../src/async-require/buildUrlForBundle.native.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,mEAA2C;AAE3C,SAAgB,iBAAiB,CAAC,UAAkB;IAClD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACzC,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;YACnC,OAAO,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,UAAU,CAAC;SAC/D;QACD,MAAM,IAAI,KAAK,CACb,6IAA6I,CAC9I,CAAC;KACH;IACD,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE1C,OAAO,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAC9E,CAAC;AAZD,8CAYC","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\nimport getDevServer from \"../getDevServer\";\n\nexport function buildUrlForBundle(bundlePath: string): string {\n if (process.env.NODE_ENV === \"production\") {\n if (typeof location !== \"undefined\") {\n return location.origin.replace(/\\/+$/, \"\") + \"/\" + 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 }\n const { url: serverUrl } = getDevServer();\n\n return serverUrl.replace(/\\/+$/, \"\") + \"/\" + bundlePath.replace(/^\\/+/, \"\");\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var _a;
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
/**
|
|
4
5
|
* Copyright © 2022 650 Industries.
|
|
@@ -7,5 +8,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
8
|
* LICENSE file in the root directory of this source tree.
|
|
8
9
|
*/
|
|
9
10
|
const buildAsyncRequire_1 = require("./buildAsyncRequire");
|
|
10
|
-
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
global[`${(_a = global.__METRO_GLOBAL_PREFIX__) !== null && _a !== void 0 ? _a : ""}__loadBundleAsync`] =
|
|
13
|
+
(0, buildAsyncRequire_1.buildAsyncRequire)();
|
|
11
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/async-require/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/async-require/index.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,2DAAwD;AAExD,aAAa;AACb,MAAM,CAAC,GAAG,MAAA,MAAM,CAAC,uBAAuB,mCAAI,EAAE,mBAAmB,CAAC;IAChE,IAAA,qCAAiB,GAAE,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 */\nimport { buildAsyncRequire } from \"./buildAsyncRequire\";\n\n// @ts-ignore\nglobal[`${global.__METRO_GLOBAL_PREFIX__ ?? \"\"}__loadBundleAsync`] =\n buildAsyncRequire();\n"]}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Load a bundle for a URL using fetch + eval on native and script tag injection on web.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
4
|
+
* @param bundlePath Given a statement like `import('./Bacon')` `bundlePath` would be `Bacon.bundle?params=from-metro`.
|
|
6
5
|
*/
|
|
7
|
-
export
|
|
6
|
+
export declare function loadBundleAsync(bundlePath: string): Promise<void>;
|
|
8
7
|
//# sourceMappingURL=loadBundle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadBundle.d.ts","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loadBundle.d.ts","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":"AAaA;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBjE"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.loadBundleAsync = void 0;
|
|
4
7
|
/**
|
|
@@ -7,6 +10,30 @@ exports.loadBundleAsync = void 0;
|
|
|
7
10
|
* This source code is licensed under the MIT license found in the
|
|
8
11
|
* LICENSE file in the root directory of this source tree.
|
|
9
12
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
const HMRClient_1 = __importDefault(require("../HMRClient"));
|
|
14
|
+
const LoadingView_1 = __importDefault(require("../LoadingView"));
|
|
15
|
+
const buildUrlForBundle_1 = require("./buildUrlForBundle");
|
|
16
|
+
const fetchThenEval_1 = require("./fetchThenEval");
|
|
17
|
+
let pendingRequests = 0;
|
|
18
|
+
/**
|
|
19
|
+
* Load a bundle for a URL using fetch + eval on native and script tag injection on web.
|
|
20
|
+
*
|
|
21
|
+
* @param bundlePath Given a statement like `import('./Bacon')` `bundlePath` would be `Bacon.bundle?params=from-metro`.
|
|
22
|
+
*/
|
|
23
|
+
function loadBundleAsync(bundlePath) {
|
|
24
|
+
const requestUrl = (0, buildUrlForBundle_1.buildUrlForBundle)(bundlePath);
|
|
25
|
+
// Send a signal to the `expo` package to show the loading indicator.
|
|
26
|
+
LoadingView_1.default.showMessage("Downloading...", "load");
|
|
27
|
+
pendingRequests++;
|
|
28
|
+
return (0, fetchThenEval_1.fetchThenEvalAsync)(requestUrl)
|
|
29
|
+
.then(() => {
|
|
30
|
+
HMRClient_1.default.registerBundle(requestUrl);
|
|
31
|
+
})
|
|
32
|
+
.finally(() => {
|
|
33
|
+
if (!--pendingRequests) {
|
|
34
|
+
LoadingView_1.default.hide();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
exports.loadBundleAsync = loadBundleAsync;
|
|
12
39
|
//# sourceMappingURL=loadBundle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadBundle.js","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loadBundle.js","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;GAKG;AACH,6DAAqC;AACrC,iEAAyC;AACzC,2DAAwD;AACxD,mDAAqD;AAErD,IAAI,eAAe,GAAG,CAAC,CAAC;AAExB;;;;GAIG;AACH,SAAgB,eAAe,CAAC,UAAkB;IAChD,MAAM,UAAU,GAAG,IAAA,qCAAiB,EAAC,UAAU,CAAC,CAAC;IAEjD,qEAAqE;IACrE,qBAAW,CAAC,WAAW,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;IAClD,eAAe,EAAE,CAAC;IAElB,OAAO,IAAA,kCAAkB,EAAC,UAAU,CAAC;SAClC,IAAI,CAAC,GAAG,EAAE;QACT,mBAAS,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC,CAAC;SACD,OAAO,CAAC,GAAG,EAAE;QACZ,IAAI,CAAC,EAAE,eAAe,EAAE;YACtB,qBAAW,CAAC,IAAI,EAAE,CAAC;SACpB;IACH,CAAC,CAAC,CAAC;AACP,CAAC;AAhBD,0CAgBC","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 HMRClient from \"../HMRClient\";\nimport LoadingView from \"../LoadingView\";\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 function loadBundleAsync(bundlePath: string): Promise<void> {\n const requestUrl = buildUrlForBundle(bundlePath);\n\n // Send a signal to the `expo` package to show the loading indicator.\n LoadingView.showMessage(\"Downloading...\", \"load\");\n pendingRequests++;\n\n return fetchThenEvalAsync(requestUrl)\n .then(() => {\n HMRClient.registerBundle(requestUrl);\n })\n .finally(() => {\n if (!--pendingRequests) {\n LoadingView.hide();\n }\n });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogBox.web.d.ts","sourceRoot":"","sources":["../../src/error-overlay/LogBox.web.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,CAAC;AAEzD,QAAA,IAAI,MAAM,EAAE,OAAO,CAAC;AAEpB,UAAU,OAAO;IACf,OAAO,IAAI,IAAI,CAAC;IAChB,SAAS,IAAI,IAAI,CAAC;IAClB,WAAW,IAAI,OAAO,CAAC;IACvB,UAAU,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI,CAAC;IACrD,aAAa,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACtC,YAAY,IAAI,IAAI,CAAC;IACrB,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,YAAY,CAAC,KAAK,EAAE,qBAAqB,GAAG,IAAI,CAAC;CAClD;
|
|
1
|
+
{"version":3,"file":"LogBox.web.d.ts","sourceRoot":"","sources":["../../src/error-overlay/LogBox.web.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,CAAC;AAEzD,QAAA,IAAI,MAAM,EAAE,OAAO,CAAC;AAEpB,UAAU,OAAO;IACf,OAAO,IAAI,IAAI,CAAC;IAChB,SAAS,IAAI,IAAI,CAAC;IAClB,WAAW,IAAI,OAAO,CAAC;IACvB,UAAU,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI,CAAC;IACrD,aAAa,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACtC,YAAY,IAAI,IAAI,CAAC;IACrB,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,YAAY,CAAC,KAAK,EAAE,qBAAqB,GAAG,IAAI,CAAC;CAClD;AAyJD,eAAe,MAAM,CAAC"}
|
|
@@ -14,7 +14,7 @@ let LogBox;
|
|
|
14
14
|
*/
|
|
15
15
|
if (__DEV__) {
|
|
16
16
|
const LogBoxData = require("./Data/LogBoxData");
|
|
17
|
-
const { parseLogBoxLog, parseInterpolation
|
|
17
|
+
const { parseLogBoxLog, parseInterpolation } = require("./Data/parseLogBoxLog");
|
|
18
18
|
let originalConsoleError;
|
|
19
19
|
let consoleErrorImpl;
|
|
20
20
|
let isLogBoxInstalled = false;
|
|
@@ -97,12 +97,22 @@ if (__DEV__) {
|
|
|
97
97
|
originalConsoleError === null || originalConsoleError === void 0 ? void 0 : originalConsoleError(...args);
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
|
-
const { message } = parseLogBoxLog(args);
|
|
100
|
+
const { category, message, componentStack } = parseLogBoxLog(args);
|
|
101
101
|
if (!LogBoxData.isMessageIgnored(message.content)) {
|
|
102
102
|
// Interpolate the message so they are formatted for adb and other CLIs.
|
|
103
103
|
// This is different than the message.content above because it includes component stacks.
|
|
104
104
|
const interpolated = parseInterpolation(args);
|
|
105
105
|
originalConsoleError === null || originalConsoleError === void 0 ? void 0 : originalConsoleError(interpolated.message.content);
|
|
106
|
+
LogBoxData.addLog({
|
|
107
|
+
// Always show the static rendering issues as full screen since they
|
|
108
|
+
// are too confusing otherwise.
|
|
109
|
+
level: /did not match\. Server:/.test(message.content)
|
|
110
|
+
? "fatal"
|
|
111
|
+
: "error",
|
|
112
|
+
category,
|
|
113
|
+
message,
|
|
114
|
+
componentStack,
|
|
115
|
+
});
|
|
106
116
|
}
|
|
107
117
|
}
|
|
108
118
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogBox.web.js","sourceRoot":"","sources":["../../src/error-overlay/LogBox.web.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAEH,+CAAwC;AAOxC,IAAI,MAAe,CAAC;AAapB;;GAEG;AACH,IAAI,OAAO,EAAE;IACX,MAAM,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChD,MAAM,
|
|
1
|
+
{"version":3,"file":"LogBox.web.js","sourceRoot":"","sources":["../../src/error-overlay/LogBox.web.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAEH,+CAAwC;AAOxC,IAAI,MAAe,CAAC;AAapB;;GAEG;AACH,IAAI,OAAO,EAAE;IACX,MAAM,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChD,MAAM,EAAE,cAAc,EAAE,kBAAkB,EAAE,GAC1C,OAAO,CAAC,uBAAuB,CAA2C,CAAC;IAE7E,IAAI,oBAAsD,CAAC;IAC3D,IAAI,gBAAkD,CAAC;IAEvD,IAAI,iBAAiB,GAAY,KAAK,CAAC;IAEvC,MAAM,GAAG;QACP,OAAO;YACL,IAAI,iBAAiB,EAAE;gBACrB,OAAO;aACR;YAED,iBAAiB,GAAG,IAAI,CAAC;YAEzB,yCAAyC;YACzC,kDAAkD;YAElD,wEAAwE;YACxE,mEAAmE;YACnE,0BAA0B;YAC1B,MAAM,cAAc,GAAG,oBAAoB,IA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AAC,CAAC,OAAO;oBACX,QAAQ;oBACR,OAAO;oBACP,cAAc;iBACf,CAAC,CAAC;aACJ;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,UAAU,CAAC,2BAA2B,CAAC,GAAG,CAAC,CAAC;SAC7C;IACH,CAAC,CAAC;CACH;KAAM;IACL,MAAM,GAAG;QACP,OAAO,KAAU,CAAC;QAClB,SAAS,KAAU,CAAC;QACpB,WAAW;YACT,OAAO,KAAK,CAAC;QACf,CAAC;QACD,UAAU,CAAC,QAAkC,IAAS,CAAC;QACvD,aAAa,CAAC,KAAe,IAAS,CAAC;QACvC,YAAY,KAAU,CAAC;QACvB,MAAM,CAAC,GAAY,IAAS,CAAC;QAC7B,YAAY,CAAC,EAAyB,IAAS,CAAC;KACjD,CAAC;CACH;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC;AAExB,kBAAe,MAAM,CAAC","sourcesContent":["/**\n * Copyright (c) Evan Bacon.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\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\nimport { Platform } from \"react-native\";\n\nimport { IgnorePattern, LogData } from \"./Data/LogBoxData\";\nimport { ExtendedExceptionData } from \"./Data/parseLogBoxLog\";\n\nexport { LogData, ExtendedExceptionData, IgnorePattern };\n\nlet LogBox: ILogBox;\n\ninterface ILogBox {\n install(): void;\n uninstall(): void;\n isInstalled(): boolean;\n ignoreLogs(patterns: readonly IgnorePattern[]): void;\n ignoreAllLogs(ignore?: boolean): void;\n clearAllLogs(): void;\n addLog(log: LogData): void;\n addException(error: ExtendedExceptionData): void;\n}\n\n/**\n * LogBox displays logs in the app.\n */\nif (__DEV__) {\n const LogBoxData = require(\"./Data/LogBoxData\");\n const { parseLogBoxLog, parseInterpolation } =\n require(\"./Data/parseLogBoxLog\") as typeof import(\"./Data/parseLogBoxLog\");\n\n let originalConsoleError: typeof console.error | undefined;\n let consoleErrorImpl: typeof console.error | undefined;\n\n let isLogBoxInstalled: boolean = false;\n\n LogBox = {\n install(): void {\n if (isLogBoxInstalled) {\n return;\n }\n\n isLogBoxInstalled = true;\n\n // Trigger lazy initialization of module.\n // require(\"../NativeModules/specs/NativeLogBox\");\n\n // IMPORTANT: we only overwrite `console.error` and `console.warn` once.\n // When we uninstall we keep the same reference and only change its\n // internal implementation\n const isFirstInstall = originalConsoleError == null;\n if (isFirstInstall) {\n originalConsoleError = console.error.bind(console);\n\n console.error = (...args) => {\n consoleErrorImpl?.(...args);\n };\n }\n\n consoleErrorImpl = registerError;\n\n if (Platform.isTesting) {\n LogBoxData.setDisabled(true);\n }\n },\n\n uninstall(): void {\n if (!isLogBoxInstalled) {\n return;\n }\n\n isLogBoxInstalled = false;\n\n // IMPORTANT: we don't re-assign to `console` in case the method has been\n // decorated again after installing LogBox. E.g.:\n // Before uninstalling: original > LogBox > OtherErrorHandler\n // After uninstalling: original > LogBox (noop) > OtherErrorHandler\n consoleErrorImpl = originalConsoleError;\n delete (console as any).disableLogBox;\n },\n\n isInstalled(): boolean {\n return isLogBoxInstalled;\n },\n\n ignoreLogs(patterns: readonly IgnorePattern[]): void {\n LogBoxData.addIgnorePatterns(patterns);\n },\n\n ignoreAllLogs(value?: boolean): void {\n LogBoxData.setDisabled(value == null ? true : value);\n },\n\n clearAllLogs(): void {\n LogBoxData.clear();\n },\n\n addLog(log: LogData): void {\n if (isLogBoxInstalled) {\n LogBoxData.addLog(log);\n }\n },\n\n addException(error: ExtendedExceptionData): void {\n if (isLogBoxInstalled) {\n LogBoxData.addException(error);\n }\n },\n };\n\n const isWarningModuleWarning = (...args: any) => {\n return typeof args[0] === \"string\" && args[0].startsWith(\"Warning: \");\n };\n\n const registerError = (...args: Parameters<typeof console.error>): void => {\n // Let errors within LogBox itself fall through.\n if (LogBoxData.isLogBoxErrorMessage(args[0])) {\n originalConsoleError?.(...args);\n return;\n }\n\n try {\n if (!isWarningModuleWarning(...args)) {\n // Only show LogBox for the 'warning' module, otherwise pass through.\n // By passing through, this will get picked up by the React console override,\n // potentially adding the component stack. React then passes it back to the\n // React Native ExceptionsManager, which reports it to LogBox as an error.\n //\n // The 'warning' module needs to be handled here because React internally calls\n // `console.error('Warning: ')` with the component stack already included.\n originalConsoleError?.(...args);\n return;\n }\n\n const { category, message, componentStack } = parseLogBoxLog(args);\n\n if (!LogBoxData.isMessageIgnored(message.content)) {\n // Interpolate the message so they are formatted for adb and other CLIs.\n // This is different than the message.content above because it includes component stacks.\n const interpolated = parseInterpolation(args);\n originalConsoleError?.(interpolated.message.content);\n\n LogBoxData.addLog({\n // Always show the static rendering issues as full screen since they\n // are too confusing otherwise.\n level: /did not match\\. Server:/.test(message.content)\n ? \"fatal\"\n : \"error\",\n category,\n message,\n componentStack,\n });\n }\n } catch (err) {\n LogBoxData.reportUnexpectedLogBoxError(err);\n }\n };\n} else {\n LogBox = {\n install(): void {},\n uninstall(): void {},\n isInstalled(): boolean {\n return false;\n },\n ignoreLogs(patterns: readonly IgnorePattern[]): void {},\n ignoreAllLogs(value?: boolean): void {},\n clearAllLogs(): void {},\n addLog(log: LogData): void {},\n addException(ex: ExtendedExceptionData): void {},\n };\n}\n\nmodule.exports = LogBox;\n\nexport default LogBox;\n"]}
|
package/build/index.d.ts
CHANGED
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAC5B,OAAO,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAC5B,OAAO,iBAAiB,CAAC;AACzB,OAAO,WAAW,CAAC"}
|
package/build/index.js
CHANGED
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,8BAA4B;AAC5B,qBAAmB","sourcesContent":["import \"./location/install\";\nimport \"./effects\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,8BAA4B;AAC5B,2BAAyB;AACzB,qBAAmB","sourcesContent":["import \"./location/install\";\nimport \"./async-require\";\nimport \"./effects\";\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import "react-native/Libraries/Core/InitializeCore";
|
|
2
2
|
//# sourceMappingURL=install.native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.native.d.ts","sourceRoot":"","sources":["../../src/location/install.native.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"install.native.d.ts","sourceRoot":"","sources":["../../src/location/install.native.ts"],"names":[],"mappings":"AACA,OAAO,4CAA4C,CAAC"}
|
|
@@ -4,6 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
var _a, _b, _c, _d;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
// This MUST be first to ensure that `fetch` is defined in the React Native environment.
|
|
8
|
+
require("react-native/Libraries/Core/InitializeCore");
|
|
7
9
|
const expo_constants_1 = __importDefault(require("expo-constants"));
|
|
8
10
|
const url_parse_1 = __importDefault(require("url-parse"));
|
|
9
11
|
const getDevServer_1 = __importDefault(require("../getDevServer"));
|
|
@@ -20,7 +22,7 @@ function warnProductionOriginNotConfigured(requestUrl) {
|
|
|
20
22
|
}
|
|
21
23
|
hasWarned = true;
|
|
22
24
|
if (!((_b = (_a = manifest === null || manifest === void 0 ? void 0 : manifest.extra) === null || _a === void 0 ? void 0 : _a.router) === null || _b === void 0 ? void 0 : _b.origin)) {
|
|
23
|
-
console.warn(`The relative fetch request "${requestUrl}" will not work in production until the Expo
|
|
25
|
+
console.warn(`The relative fetch request "${requestUrl}" will not work in production until the Expo Router Config Plugin (app.json) is configured with the \`origin\` prop set to the base URL of your web server, e.g. \`{ plugins: [["expo-router", { origin: "..." }]] }\`. [Learn more](https://expo.github.io/router/docs/lab/runtime-location)`);
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
28
|
// TODO: This would be better if native and tied as close to the JS engine as possible, i.e. it should
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.native.js","sourceRoot":"","sources":["../../src/location/install.native.ts"],"names":[],"mappings":";;;;;;AAAA,oEAAuC;AACvC,0DAA4B;AAE5B,mEAA2C;AAC3C,yCAAsD;AAEtD,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB,MAAM,QAAQ,GAAG,CAAC,MAAA,MAAA,wBAAS,CAAC,QAAQ,mCAClC,wBAAS,CAAC,SAAS,mCACnB,wBAAS,CAAC,UAAU,CAA+B,CAAC;AAEtD,mEAAmE;AACnE,uEAAuE;AACvE,2EAA2E;AAC3E,SAAS,iCAAiC,CAAC,UAAkB;;IAC3D,IAAI,SAAS,EAAE;QACb,OAAO;KACR;IACD,SAAS,GAAG,IAAI,CAAC;IACjB,IAAI,CAAC,CAAA,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,KAAK,0CAAE,MAAM,0CAAE,MAAM,CAAA,EAAE;QACpC,OAAO,CAAC,IAAI,CACV,+BAA+B,UAAU,
|
|
1
|
+
{"version":3,"file":"install.native.js","sourceRoot":"","sources":["../../src/location/install.native.ts"],"names":[],"mappings":";;;;;;AAAA,wFAAwF;AACxF,sDAAoD;AAEpD,oEAAuC;AACvC,0DAA4B;AAE5B,mEAA2C;AAC3C,yCAAsD;AAEtD,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB,MAAM,QAAQ,GAAG,CAAC,MAAA,MAAA,wBAAS,CAAC,QAAQ,mCAClC,wBAAS,CAAC,SAAS,mCACnB,wBAAS,CAAC,UAAU,CAA+B,CAAC;AAEtD,mEAAmE;AACnE,uEAAuE;AACvE,2EA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AI,GAAG,EAAE;YACP,IAAA,0BAAe,EAAC,GAAG,CAAC,CAAC;YACrB,IAAA,kBAAO,GAAE,CAAC;SACX;KACF;IACD,iDAAiD;IACjD,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE;QACrC,KAAK,EAAE,2BAA2B,CAAC,KAAK,CAAC;KAC1C,CAAC,CAAC;CACJ","sourcesContent":["// This MUST be first to ensure that `fetch` is defined in the React Native environment.\nimport \"react-native/Libraries/Core/InitializeCore\";\n\nimport Constants from \"expo-constants\";\nimport URL from \"url-parse\";\n\nimport getDevServer from \"../getDevServer\";\nimport { install, setLocationHref } from \"./Location\";\n\nlet hasWarned = false;\n\nconst manifest = (Constants.manifest ??\n Constants.manifest2 ??\n Constants.expoConfig) as Record<string, any> | null;\n\n// Add a development warning for fetch requests with relative paths\n// to ensure developers are aware of the need to configure a production\n// base URL in the Expo config (app.json) under `expo.extra.router.origin`.\nfunction warnProductionOriginNotConfigured(requestUrl: string) {\n if (hasWarned) {\n return;\n }\n hasWarned = true;\n if (!manifest?.extra?.router?.origin) {\n console.warn(\n `The relative fetch request \"${requestUrl}\" will not work in production until the Expo Router Config Plugin (app.json) is configured with the \\`origin\\` prop set to the base URL of your web server, e.g. \\`{ plugins: [[\"expo-router\", { origin: \"...\" }]] }\\`. [Learn more](https://expo.github.io/router/docs/lab/runtime-location)`\n );\n }\n}\n\n// TODO: This would be better if native and tied as close to the JS engine as possible, i.e. it should\n// reflect the exact location of the JS file that was executed.\nfunction getBaseUrl() {\n if (process.env.NODE_ENV !== \"production\") {\n // e.g. http://localhost:19006\n return getDevServer().url?.replace(/\\/$/, \"\");\n }\n\n // TODO: Make it official by moving out of `extra`\n const productionBaseUrl = manifest?.extra?.router?.origin;\n\n if (!productionBaseUrl) {\n return null;\n }\n\n // Ensure no trailing slash\n return productionBaseUrl?.replace(/\\/$/, \"\");\n}\n\nfunction wrapFetchWithWindowLocation(\n fetch: Function & { __EXPO_BASE_URL_POLYFILLED?: boolean }\n) {\n if (fetch.__EXPO_BASE_URL_POLYFILLED) {\n return fetch;\n }\n\n const _fetch = (...props: any[]) => {\n if (props[0] && typeof props[0] === \"string\" && props[0].startsWith(\"/\")) {\n if (process.env.NODE_ENV !== \"production\") {\n warnProductionOriginNotConfigured(props[0]);\n }\n\n props[0] = new URL(props[0], window.location?.origin).toString();\n } else if (props[0] && typeof props[0] === \"object\") {\n if (\n props[0].url &&\n typeof props[0].url === \"string\" &&\n props[0].url.startsWith(\"/\")\n ) {\n if (process.env.NODE_ENV !== \"production\") {\n warnProductionOriginNotConfigured(props[0]);\n }\n\n props[0].url = new URL(\n props[0].url,\n window.location?.origin\n ).toString();\n }\n }\n return fetch(...props);\n };\n\n _fetch.__EXPO_BASE_URL_POLYFILLED = true;\n\n return _fetch;\n}\n\nif (manifest?.extra?.router?.origin !== false) {\n // Polyfill window.location in native runtimes.\n if (typeof window !== \"undefined\" && !window.location) {\n const url = getBaseUrl();\n if (url) {\n setLocationHref(url);\n install();\n }\n }\n // Polyfill native fetch to support relative URLs\n Object.defineProperty(global, \"fetch\", {\n value: wrapFetchWithWindowLocation(fetch),\n });\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loadBundle.android.d.ts","sourceRoot":"","sources":["../../src/async-require/loadBundle.android.ts"],"names":[],"mappings":"AAWA,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAchE"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.loadBundleAsync = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* Copyright © 2022 650 Industries.
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the MIT license found in the
|
|
11
|
-
* LICENSE file in the root directory of this source tree.
|
|
12
|
-
*/
|
|
13
|
-
// @ts-expect-error
|
|
14
|
-
const NativeDevSplitBundleLoader_1 = __importDefault(require("react-native/Libraries/Utilities/NativeDevSplitBundleLoader"));
|
|
15
|
-
const loadBundlePolyfill_1 = require("./loadBundlePolyfill");
|
|
16
|
-
function loadBundleAsync(bundlePath) {
|
|
17
|
-
if (
|
|
18
|
-
// NOTE(EvanBacon): This is broken on iOS afaict
|
|
19
|
-
NativeDevSplitBundleLoader_1.default === null || NativeDevSplitBundleLoader_1.default === void 0 ? void 0 : NativeDevSplitBundleLoader_1.default.loadBundle) {
|
|
20
|
-
return NativeDevSplitBundleLoader_1.default.loadBundle(bundlePath).catch((e) => {
|
|
21
|
-
// On Android 'e' is not an instance of Error, which seems to be a bug.
|
|
22
|
-
// As a workaround, re-throw an Error to not break the error handling code.
|
|
23
|
-
throw new Error(e.message);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
return (0, loadBundlePolyfill_1.loadBundleAsync)(bundlePath);
|
|
27
|
-
}
|
|
28
|
-
exports.loadBundleAsync = loadBundleAsync;
|
|
29
|
-
//# sourceMappingURL=loadBundle.android.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loadBundle.android.js","sourceRoot":"","sources":["../../src/async-require/loadBundle.android.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;GAKG;AACH,mBAAmB;AACnB,6HAAqG;AAErG,6DAAkF;AAElF,SAAgB,eAAe,CAAC,UAAkB;IAChD;IACE,gDAAgD;IAChD,oCAA0B,aAA1B,oCAA0B,uBAA1B,oCAA0B,CAAE,UAAU,EACtC;QACA,OAAO,oCAA0B,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,KAAK,CAC5D,CAAC,CAAQ,EAAE,EAAE;YACX,uEAAuE;YACvE,2EAA2E;YAC3E,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC,CACF,CAAC;KACH;IACD,OAAO,IAAA,oCAAuB,EAAC,UAAU,CAAC,CAAC;AAC7C,CAAC;AAdD,0CAcC","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// @ts-expect-error\nimport NativeDevSplitBundleLoader from \"react-native/Libraries/Utilities/NativeDevSplitBundleLoader\";\n\nimport { loadBundleAsync as loadBundlePolyfillAsync } from \"./loadBundlePolyfill\";\n\nexport function loadBundleAsync(bundlePath: string): Promise<any> {\n if (\n // NOTE(EvanBacon): This is broken on iOS afaict\n NativeDevSplitBundleLoader?.loadBundle\n ) {\n return NativeDevSplitBundleLoader.loadBundle(bundlePath).catch(\n (e: Error) => {\n // On Android 'e' is not an instance of Error, which seems to be a bug.\n // As a workaround, re-throw an Error to not break the error handling code.\n throw new Error(e.message);\n }\n );\n }\n return loadBundlePolyfillAsync(bundlePath);\n}\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Load a bundle for a URL using fetch + eval on native and script tag injection on web.
|
|
3
|
-
*
|
|
4
|
-
* @param bundlePath Given a statement like `import('./Bacon')` `bundlePath` would be `Bacon`.
|
|
5
|
-
*/
|
|
6
|
-
export declare function loadBundleAsync(bundlePath: string): Promise<void>;
|
|
7
|
-
//# sourceMappingURL=loadBundlePolyfill.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loadBundlePolyfill.d.ts","sourceRoot":"","sources":["../../src/async-require/loadBundlePolyfill.ts"],"names":[],"mappings":"AAeA;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBjE"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.loadBundleAsync = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* Copyright © 2022 650 Industries.
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the MIT license found in the
|
|
11
|
-
* LICENSE file in the root directory of this source tree.
|
|
12
|
-
*/
|
|
13
|
-
const react_native_1 = require("react-native");
|
|
14
|
-
const HMRClient_1 = __importDefault(require("../HMRClient"));
|
|
15
|
-
const LoadingView_1 = __importDefault(require("../LoadingView"));
|
|
16
|
-
const buildUrlForBundle_1 = require("./buildUrlForBundle");
|
|
17
|
-
const fetchThenEval_1 = require("./fetchThenEval");
|
|
18
|
-
let pendingRequests = 0;
|
|
19
|
-
/**
|
|
20
|
-
* Load a bundle for a URL using fetch + eval on native and script tag injection on web.
|
|
21
|
-
*
|
|
22
|
-
* @param bundlePath Given a statement like `import('./Bacon')` `bundlePath` would be `Bacon`.
|
|
23
|
-
*/
|
|
24
|
-
function loadBundleAsync(bundlePath) {
|
|
25
|
-
const requestUrl = (0, buildUrlForBundle_1.buildUrlForBundle)(bundlePath, {
|
|
26
|
-
modulesOnly: "true",
|
|
27
|
-
runModule: "false",
|
|
28
|
-
platform: react_native_1.Platform.OS,
|
|
29
|
-
// The JavaScript loader does not support bytecode.
|
|
30
|
-
runtimeBytecodeVersion: null,
|
|
31
|
-
});
|
|
32
|
-
// Send a signal to the `expo` package to show the loading indicator.
|
|
33
|
-
LoadingView_1.default.showMessage("Downloading...", "load");
|
|
34
|
-
pendingRequests++;
|
|
35
|
-
return (0, fetchThenEval_1.fetchThenEvalAsync)(requestUrl)
|
|
36
|
-
.then(() => {
|
|
37
|
-
HMRClient_1.default.registerBundle(requestUrl);
|
|
38
|
-
})
|
|
39
|
-
.finally(() => {
|
|
40
|
-
if (!--pendingRequests) {
|
|
41
|
-
LoadingView_1.default.hide();
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
exports.loadBundleAsync = loadBundleAsync;
|
|
46
|
-
//# sourceMappingURL=loadBundlePolyfill.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loadBundlePolyfill.js","sourceRoot":"","sources":["../../src/async-require/loadBundlePolyfill.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;GAKG;AACH,+CAAwC;AAExC,6DAAqC;AACrC,iEAAyC;AACzC,2DAAwD;AACxD,mDAAqD;AAErD,IAAI,eAAe,GAAG,CAAC,CAAC;AAExB;;;;GAIG;AACH,SAAgB,eAAe,CAAC,UAAkB;IAChD,MAAM,UAAU,GAAG,IAAA,qCAAiB,EAAC,UAAU,EAAE;QAC/C,WAAW,EAAE,MAAM;QACnB,SAAS,EAAE,OAAO;QAClB,QAAQ,EAAE,uBAAQ,CAAC,EAAE;QACrB,mDAAmD;QACnD,sBAAsB,EAAE,IAAI;KAC7B,CAAC,CAAC;IAEH,qEAAqE;IACrE,qBAAW,CAAC,WAAW,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;IAClD,eAAe,EAAE,CAAC;IAElB,OAAO,IAAA,kCAAkB,EAAC,UAAU,CAAC;SAClC,IAAI,CAAC,GAAG,EAAE;QACT,mBAAS,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC,CAAC;SACD,OAAO,CAAC,GAAG,EAAE;QACZ,IAAI,CAAC,EAAE,eAAe,EAAE;YACtB,qBAAW,CAAC,IAAI,EAAE,CAAC;SACpB;IACH,CAAC,CAAC,CAAC;AACP,CAAC;AAtBD,0CAsBC","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 { Platform } from \"react-native\";\n\nimport HMRClient from \"../HMRClient\";\nimport LoadingView from \"../LoadingView\";\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`.\n */\nexport function loadBundleAsync(bundlePath: string): Promise<void> {\n const requestUrl = buildUrlForBundle(bundlePath, {\n modulesOnly: \"true\",\n runModule: \"false\",\n platform: Platform.OS,\n // The JavaScript loader does not support bytecode.\n runtimeBytecodeVersion: null,\n });\n\n // Send a signal to the `expo` package to show the loading indicator.\n LoadingView.showMessage(\"Downloading...\", \"load\");\n pendingRequests++;\n\n return fetchThenEvalAsync(requestUrl)\n .then(() => {\n HMRClient.registerBundle(requestUrl);\n })\n .finally(() => {\n if (!--pendingRequests) {\n LoadingView.hide();\n }\n });\n}\n"]}
|