@expo/metro-runtime 2.1.8 → 2.1.9

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.
@@ -1 +1 @@
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
+ {"version":3,"file":"buildUrlForBundle.native.d.ts","sourceRoot":"","sources":["../../src/async-require/buildUrlForBundle.native.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAgB5D"}
@@ -5,12 +5,8 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
- var __importDefault = (this && this.__importDefault) || function (mod) {
9
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
- };
11
8
  Object.defineProperty(exports, "__esModule", { value: true });
12
9
  exports.buildUrlForBundle = void 0;
13
- const getDevServer_1 = __importDefault(require("../getDevServer"));
14
10
  function buildUrlForBundle(bundlePath) {
15
11
  if (process.env.NODE_ENV === "production") {
16
12
  if (typeof location !== "undefined") {
@@ -18,8 +14,11 @@ function buildUrlForBundle(bundlePath) {
18
14
  }
19
15
  throw new Error('Unable to determine the production URL where additional JavaScript chunks are hosted because the global "location" variable is not defined.');
20
16
  }
21
- const { url: serverUrl } = (0, getDevServer_1.default)();
22
- return serverUrl.replace(/\/+$/, "") + "/" + bundlePath.replace(/^\/+/, "");
17
+ else {
18
+ const getDevServer = require("../getDevServer");
19
+ const { url: serverUrl } = getDevServer();
20
+ return serverUrl.replace(/\/+$/, "") + "/" + bundlePath.replace(/^\/+/, "");
21
+ }
23
22
  }
24
23
  exports.buildUrlForBundle = buildUrlForBundle;
25
24
  //# 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,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
+ {"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,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;SAAM;QACL,MAAM,YAAY,GAChB,OAAO,CAAC,iBAAiB,CAA6C,CAAC;QAEzE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,YAAY,EAAE,CAAC;QAE1C,OAAO,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;KAC7E;AACH,CAAC;AAhBD,8CAgBC","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 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 } else {\n const getDevServer =\n require(\"../getDevServer\") as typeof import(\"../getDevServer\").default;\n\n const { url: serverUrl } = getDevServer();\n\n return serverUrl.replace(/\\/+$/, \"\") + \"/\" + bundlePath.replace(/^\\/+/, \"\");\n }\n}\n"]}
@@ -1 +1 @@
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
+ {"version":3,"file":"loadBundle.d.ts","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA6BjE"}
@@ -1,7 +1,4 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.loadBundleAsync = void 0;
7
4
  /**
@@ -10,8 +7,6 @@ exports.loadBundleAsync = void 0;
10
7
  * This source code is licensed under the MIT license found in the
11
8
  * LICENSE file in the root directory of this source tree.
12
9
  */
13
- const HMRClient_1 = __importDefault(require("../HMRClient"));
14
- const LoadingView_1 = __importDefault(require("../LoadingView"));
15
10
  const buildUrlForBundle_1 = require("./buildUrlForBundle");
16
11
  const fetchThenEval_1 = require("./fetchThenEval");
17
12
  let pendingRequests = 0;
@@ -22,18 +17,29 @@ let pendingRequests = 0;
22
17
  */
23
18
  function loadBundleAsync(bundlePath) {
24
19
  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();
20
+ if (process.env.NODE_ENV === "production") {
21
+ return (0, fetchThenEval_1.fetchThenEvalAsync)(requestUrl);
22
+ }
23
+ else {
24
+ const LoadingView = require("../LoadingView");
25
+ if (process.env.NODE_ENV !== "production") {
26
+ // Send a signal to the `expo` package to show the loading indicator.
27
+ LoadingView.showMessage("Downloading...", "load");
35
28
  }
36
- });
29
+ pendingRequests++;
30
+ return (0, fetchThenEval_1.fetchThenEvalAsync)(requestUrl)
31
+ .then(() => {
32
+ if (process.env.NODE_ENV !== "production") {
33
+ const HMRClient = require("../HMRClient");
34
+ HMRClient.registerBundle(requestUrl);
35
+ }
36
+ })
37
+ .finally(() => {
38
+ if (!--pendingRequests) {
39
+ LoadingView.hide();
40
+ }
41
+ });
42
+ }
37
43
  }
38
44
  exports.loadBundleAsync = loadBundleAsync;
39
45
  //# sourceMappingURL=loadBundle.js.map
@@ -1 +1 @@
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
+ {"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;AACH,SAAgB,eAAe,CAAC,UAAkB;IAChD,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,GACb,OAAO,CAAC,cAAc,CAA0C,CAAC;gBACnE,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 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 =\n require(\"../HMRClient\") 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/build/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  import "./location/install";
2
2
  import "./effects";
3
- import "./async-require";
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAE5B,OAAO,WAAW,CAAC;AAGnB,OAAO,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAE5B,OAAO,WAAW,CAAC"}
package/build/index.js CHANGED
@@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  require("./location/install");
4
4
  // IMPORT POSITION MATTERS FOR FAST REFRESH ON WEB
5
5
  require("./effects");
6
- // vvv EVERYTHING ELSE vvv
7
- require("./async-require");
6
+ // Ensure this is removed in production.
7
+ // TODO: Enable in production.
8
+ if (process.env.NODE_ENV !== "production") {
9
+ // vvv EVERYTHING ELSE vvv
10
+ require("./async-require");
11
+ }
8
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,8BAA4B;AAC5B,kDAAkD;AAClD,qBAAmB;AAEnB,0BAA0B;AAC1B,2BAAyB","sourcesContent":["import \"./location/install\";\n// IMPORT POSITION MATTERS FOR FAST REFRESH ON WEB\nimport \"./effects\";\n\n// vvv EVERYTHING ELSE vvv\nimport \"./async-require\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,8BAA4B;AAC5B,kDAAkD;AAClD,qBAAmB;AAEnB,wCAAwC;AACxC,8BAA8B;AAC9B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;IACzC,0BAA0B;IAC1B,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC5B","sourcesContent":["import \"./location/install\";\n// IMPORT POSITION MATTERS FOR FAST REFRESH ON WEB\nimport \"./effects\";\n\n// Ensure this is removed in production.\n// TODO: Enable in production.\nif (process.env.NODE_ENV !== \"production\") {\n // vvv EVERYTHING ELSE vvv\n require(\"./async-require\");\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/metro-runtime",
3
- "version": "2.1.8",
3
+ "version": "2.1.9",
4
4
  "description": "Tools for making experimental Metro bundler features work",
5
5
  "main": "build",
6
6
  "homepage": "https://github.com/expo/router/tree/main/packages/expo-metro-runtime",