@expo/metro-runtime 3.0.3 → 3.0.4
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/getDevServer.d.ts.map +1 -1
- package/build/getDevServer.js +3 -7
- package/build/getDevServer.js.map +1 -1
- package/build/location/Location.native.d.ts.map +1 -1
- package/build/location/Location.native.js +1 -8
- package/build/location/Location.native.js.map +1 -1
- package/build/location/install.native.js +2 -3
- package/build/location/install.native.js.map +1 -1
- package/package.json +2 -21
- package/src/getDevServer.ts +4 -7
- package/src/location/Location.native.ts +2 -5
- package/src/location/install.native.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDevServer.d.ts","sourceRoot":"","sources":["../src/getDevServer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getDevServer.d.ts","sourceRoot":"","sources":["../src/getDevServer.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,YAAY;;IAcd,0DAA0D;;;CAc7D,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
package/build/getDevServer.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
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
|
-
const qs_1 = __importDefault(require("qs"));
|
|
7
3
|
const getDevServer = () => {
|
|
8
4
|
// Disable for SSR
|
|
9
5
|
if (typeof window === 'undefined') {
|
|
@@ -21,9 +17,9 @@ const getDevServer = () => {
|
|
|
21
17
|
if (document?.currentScript && 'src' in document.currentScript) {
|
|
22
18
|
return document.currentScript.src;
|
|
23
19
|
}
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
return
|
|
20
|
+
const bundleUrl = new URL(location.href);
|
|
21
|
+
bundleUrl.searchParams.set('platform', 'web');
|
|
22
|
+
return bundleUrl.toString();
|
|
27
23
|
},
|
|
28
24
|
url: location.origin + location.pathname,
|
|
29
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDevServer.js","sourceRoot":"","sources":["../src/getDevServer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getDevServer.js","sourceRoot":"","sources":["../src/getDevServer.ts"],"names":[],"mappings":";;AAAA,MAAM,YAAY,GAAG,GAAG,EAAE;IACxB,kBAAkB;IAClB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO;YACL,sBAAsB,EAAE,IAAI;YAC5B,aAAa,EAAE,EAAE;YACjB,GAAG,EAAE,EAAE;SACR,CAAC;KACH;IAED,OAAO;QACL,4DAA4D;QAC5D,sBAAsB,EAAE,IAAI;QAE5B,0DAA0D;QAC1D,IAAI,aAAa;YACf,IAAI,QAAQ,EAAE,aAAa,IAAI,KAAK,IAAI,QAAQ,CAAC,aAAa,EAAE;gBAC9D,OAAO,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC;aACnC;YAED,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAEzC,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;YAE9C,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC;QAC9B,CAAC;QACD,GAAG,EAAE,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC,QAAQ;KACzC,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC","sourcesContent":["const getDevServer = () => {\n // Disable for SSR\n if (typeof window === 'undefined') {\n return {\n bundleLoadedFromServer: true,\n fullBundleUrl: '',\n url: '',\n };\n }\n\n return {\n // The bundle is always loaded from a server in the browser.\n bundleLoadedFromServer: true,\n\n /** URL but ensures that platform query param is added. */\n get fullBundleUrl() {\n if (document?.currentScript && 'src' in document.currentScript) {\n return document.currentScript.src;\n }\n\n const bundleUrl = new URL(location.href);\n\n bundleUrl.searchParams.set('platform', 'web');\n\n return bundleUrl.toString();\n },\n url: location.origin + location.pathname,\n };\n};\n\nexport default getDevServer;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Location.native.d.ts","sourceRoot":"","sources":["../../src/location/Location.native.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Location.native.d.ts","sourceRoot":"","sources":["../../src/location/Location.native.ts"],"names":[],"mappings":"AAiLA,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,QAE3C;AAED,wBAAgB,OAAO,SAgBtB"}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright © 2023 650 Industries.
|
|
3
3
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
4
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
|
-
};
|
|
7
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
5
|
exports.install = exports.setLocationHref = void 0;
|
|
9
|
-
const url_parse_1 = __importDefault(require("url-parse"));
|
|
10
6
|
class DOMException extends Error {
|
|
11
7
|
constructor(message, name) {
|
|
12
8
|
super(message);
|
|
@@ -20,12 +16,10 @@ class DOMException extends Error {
|
|
|
20
16
|
// - https://heycam.github.io/webidl/#LegacyUnforgeable
|
|
21
17
|
class Location {
|
|
22
18
|
constructor(href = null) {
|
|
23
|
-
const url = new
|
|
19
|
+
const url = new URL(
|
|
24
20
|
// @ts-expect-error
|
|
25
21
|
href);
|
|
26
|
-
// @ts-expect-error
|
|
27
22
|
url.username = '';
|
|
28
|
-
// @ts-expect-error
|
|
29
23
|
url.password = '';
|
|
30
24
|
Object.defineProperties(this, {
|
|
31
25
|
hash: {
|
|
@@ -99,7 +93,6 @@ class Location {
|
|
|
99
93
|
},
|
|
100
94
|
search: {
|
|
101
95
|
get() {
|
|
102
|
-
// @ts-expect-error
|
|
103
96
|
return url.search;
|
|
104
97
|
},
|
|
105
98
|
set() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Location.native.js","sourceRoot":"","sources":["../../src/location/Location.native.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,0EAA0E
|
|
1
|
+
{"version":3,"file":"Location.native.js","sourceRoot":"","sources":["../../src/location/Location.native.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,0EAA0E;;;AAE1E,MAAM,YAAa,SAAQ,KAAK;IAC9B,YAAY,OAAe,EAAE,IAAY;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,6EAA6E;AAC7E,uEAAuE;AACvE,gCAAgC;AAChC,+EAA+E;AAC/E,uDAAuD;AACvD,MAAM,QAAQ;IACZ,YAAY,OAAsB,IAAI;QACpC,MAAM,GAAG,GAAG,IAAI,GAAG;QACjB,mBAAmB;QACnB,IAAI,CACL,CAAC;QAEF,GAAG,CAAC,QAAQ,GAAG,EAAE,CAAC;QAElB,GAAG,CAAC,QAAQ,GAAG,EAAE,CAAC;QAClB,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE;YAC5B,IAAI,EAAE;gBACJ,GAAG;oBACD,OAAO,GAAG,CAAC,IAAI,CAAC;gBAClB,CAAC;gBACD,GAAG;oBACD,MAAM,IAAI,YAAY,CAAC,6BAA6B,EAAE,mBAAmB,CAAC,CAAC;gBAC7E,CAAC;gBACD,UAAU,EAAE,IAAI;aACjB;YACD,IAAI,EAAE;gBACJ,GAAG;oBACD,OAAO,GAAG,CAAC,IAAI,CAAC;gBAClB,CAAC;gBACD,GAAG;oBACD,MAAM,IAAI,YAAY,CAAC,6BAA6B,EAAE,mBAAmB,CAAC,CAAC;gBAC7E,CAAC;gBACD,UAAU,EAAE,IAAI;aACjB;YACD,QAAQ,EAAE;gBACR,GAAG;oBACD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BC","sourcesContent":["// Copyright © 2023 650 Industries.\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n\nclass DOMException extends Error {\n constructor(message: string, name: string) {\n super(message);\n this.name = name;\n }\n}\n\n// The differences between the definitions of `Location` and `WorkerLocation`\n// are because of the `LegacyUnforgeable` attribute only specified upon\n// `Location`'s properties. See:\n// - https://html.spec.whatwg.org/multipage/history.html#the-location-interface\n// - https://heycam.github.io/webidl/#LegacyUnforgeable\nclass Location {\n constructor(href: string | null = null) {\n const url = new URL(\n // @ts-expect-error\n href\n );\n\n url.username = '';\n\n url.password = '';\n Object.defineProperties(this, {\n hash: {\n get() {\n return url.hash;\n },\n set() {\n throw new DOMException(`Cannot set \"location.hash\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n host: {\n get() {\n return url.host;\n },\n set() {\n throw new DOMException(`Cannot set \"location.host\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n hostname: {\n get() {\n return url.hostname;\n },\n set() {\n throw new DOMException(`Cannot set \"location.hostname\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n href: {\n get() {\n return url.href;\n },\n set() {\n throw new DOMException(`Cannot set \"location.href\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n origin: {\n get() {\n return url.origin;\n },\n enumerable: true,\n },\n pathname: {\n get() {\n return url.pathname;\n },\n set() {\n throw new DOMException(`Cannot set \"location.pathname\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n port: {\n get() {\n return url.port;\n },\n set() {\n throw new DOMException(`Cannot set \"location.port\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n protocol: {\n get() {\n return url.protocol;\n },\n set() {\n throw new DOMException(`Cannot set \"location.protocol\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n search: {\n get() {\n return url.search;\n },\n set() {\n throw new DOMException(`Cannot set \"location.search\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n ancestorOrigins: {\n get() {\n return {\n length: 0,\n item: () => null,\n contains: () => false,\n };\n },\n enumerable: true,\n },\n assign: {\n value: function assign() {\n throw new DOMException(`Cannot call \"location.assign()\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n reload: {\n value: function reload() {\n if (process.env.NODE_ENV !== 'production') {\n // NOTE: This does change how native fast refresh works. The upstream metro-runtime will check\n // if `location.reload` exists before falling back on an implementation that is nearly identical to\n // this. The main difference is that on iOS there is a \"reason\" message sent, but at the time of writing\n // this, that message is unused (ref: `RCTTriggerReloadCommandNotification`).\n const DevSettings = (require('react-native') as typeof import('react-native'))\n .DevSettings;\n return DevSettings.reload();\n } else {\n throw new DOMException(`Cannot call \"location.reload()\".`, 'NotSupportedError');\n }\n },\n enumerable: true,\n },\n replace: {\n value: function replace() {\n throw new DOMException(`Cannot call \"location.replace()\".`, 'NotSupportedError');\n },\n enumerable: true,\n },\n toString: {\n value: function toString() {\n return url.href;\n },\n enumerable: true,\n },\n [Symbol.for('Expo.privateCustomInspect')]: {\n value(inspect: any) {\n const object = {\n hash: this.hash,\n host: this.host,\n hostname: this.hostname,\n href: this.href,\n origin: this.origin,\n pathname: this.pathname,\n port: this.port,\n protocol: this.protocol,\n search: this.search,\n };\n return `${this.constructor.name} ${inspect(object)}`;\n },\n },\n });\n }\n}\n\nObject.defineProperties(Location.prototype, {\n [Symbol.toString()]: {\n value: 'Location',\n configurable: true,\n },\n});\n\nlet location: Location | undefined = undefined;\n\nexport function setLocationHref(href: string) {\n location = new Location(href);\n}\n\nexport function install() {\n Object.defineProperty(global, 'Location', {\n value: Location,\n configurable: true,\n writable: true,\n });\n\n Object.defineProperty(window, 'location', {\n get() {\n return location;\n },\n set() {\n throw new DOMException(`Cannot set \"location\".`, 'NotSupportedError');\n },\n enumerable: true,\n });\n}\n"]}
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
// This MUST be first to ensure that `fetch` is defined in the React Native environment.
|
|
7
7
|
require("react-native/Libraries/Core/InitializeCore");
|
|
8
8
|
const expo_constants_1 = __importDefault(require("expo-constants"));
|
|
9
|
-
const url_parse_1 = __importDefault(require("url-parse"));
|
|
10
9
|
const Location_1 = require("./Location");
|
|
11
10
|
const getDevServer_1 = __importDefault(require("../getDevServer"));
|
|
12
11
|
let hasWarned = false;
|
|
@@ -47,14 +46,14 @@ function wrapFetchWithWindowLocation(fetch) {
|
|
|
47
46
|
if (process.env.NODE_ENV !== 'production') {
|
|
48
47
|
warnProductionOriginNotConfigured(props[0]);
|
|
49
48
|
}
|
|
50
|
-
props[0] = new
|
|
49
|
+
props[0] = new URL(props[0], window.location?.origin).toString();
|
|
51
50
|
}
|
|
52
51
|
else if (props[0] && typeof props[0] === 'object') {
|
|
53
52
|
if (props[0].url && typeof props[0].url === 'string' && props[0].url.startsWith('/')) {
|
|
54
53
|
if (process.env.NODE_ENV !== 'production') {
|
|
55
54
|
warnProductionOriginNotConfigured(props[0]);
|
|
56
55
|
}
|
|
57
|
-
props[0].url = new
|
|
56
|
+
props[0].url = new URL(props[0].url, window.location?.origin).toString();
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
59
|
return fetch(...props);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.native.js","sourceRoot":"","sources":["../../src/location/install.native.ts"],"names":[],"mappings":";;;;;AAAA,wFAAwF;AACxF,sDAAoD;AAEpD,oEAAuC;
|
|
1
|
+
{"version":3,"file":"install.native.js","sourceRoot":"","sources":["../../src/location/install.native.ts"],"names":[],"mappings":";;;;;AAAA,wFAAwF;AACxF,sDAAoD;AAEpD,oEAAuC;AAEvC,yCAAsD;AACtD,mEAA2C;AAE3C,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB,MAAM,QAAQ,GAAG,wBAAS,CAAC,UAAwC,CAAC;AAEpE,mEAAmE;AACnE,uEAAuE;AACvE,2EAA2E;AAC3E,SAAS,iCAAiC,CAAC,UAAkB;IAC3D,IAAI,SAAS,EAAE;QACb,OAAO;KACR;IACD,SAAS,GAAG,IAAI,CAAC;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AAC,IAAI,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;YACnD,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;gBACpF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;oBACzC,iCAAiC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;iBAC7C;gBAED,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC;aAC1E;SACF;QACD,OAAO,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC;IACzB,CAAC,CAAC;IAEF,MAAM,CAAC,0BAA0B,GAAG,IAAI,CAAC;IAEzC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,IAAI,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,KAAK,EAAE;IAC7C,+CAA+C;IAC/C,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;QACrD,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;QACzB,IAAI,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';\n\nimport { install, setLocationHref } from './Location';\nimport getDevServer from '../getDevServer';\n\nlet hasWarned = false;\n\nconst manifest = 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(fetch: Function & { __EXPO_BASE_URL_POLYFILLED?: boolean }) {\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 (props[0].url && typeof props[0].url === 'string' && props[0].url.startsWith('/')) {\n if (process.env.NODE_ENV !== 'production') {\n warnProductionOriginNotConfigured(props[0]);\n }\n\n props[0].url = new URL(props[0].url, window.location?.origin).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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/metro-runtime",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "Tools for making advanced Metro bundler features work",
|
|
5
5
|
"types": "build",
|
|
6
6
|
"main": "build",
|
|
@@ -36,24 +36,5 @@
|
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"react-native": "*"
|
|
38
38
|
},
|
|
39
|
-
"
|
|
40
|
-
"qs": "^6.10.3"
|
|
41
|
-
},
|
|
42
|
-
"jest": {
|
|
43
|
-
"projects": [
|
|
44
|
-
{
|
|
45
|
-
"preset": "jest-expo/ios",
|
|
46
|
-
"clearMocks": true
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
"preset": "jest-expo/android",
|
|
50
|
-
"clearMocks": true
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"preset": "jest-expo/web",
|
|
54
|
-
"clearMocks": true
|
|
55
|
-
}
|
|
56
|
-
]
|
|
57
|
-
},
|
|
58
|
-
"gitHead": "ee7897097f5f946ad7fcb94447eed789b984dd02"
|
|
39
|
+
"gitHead": "3142a086578deffd8704a8f1b6f0f661527d836c"
|
|
59
40
|
}
|
package/src/getDevServer.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import qs from 'qs';
|
|
2
|
-
|
|
3
1
|
const getDevServer = () => {
|
|
4
2
|
// Disable for SSR
|
|
5
3
|
if (typeof window === 'undefined') {
|
|
@@ -20,12 +18,11 @@ const getDevServer = () => {
|
|
|
20
18
|
return document.currentScript.src;
|
|
21
19
|
}
|
|
22
20
|
|
|
23
|
-
const
|
|
24
|
-
|
|
21
|
+
const bundleUrl = new URL(location.href);
|
|
22
|
+
|
|
23
|
+
bundleUrl.searchParams.set('platform', 'web');
|
|
25
24
|
|
|
26
|
-
return (
|
|
27
|
-
location.origin + location.pathname + '?' + qs.stringify({ ...query, platform: 'web' })
|
|
28
|
-
);
|
|
25
|
+
return bundleUrl.toString();
|
|
29
26
|
},
|
|
30
27
|
url: location.origin + location.pathname,
|
|
31
28
|
};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
// Copyright © 2023 650 Industries.
|
|
2
2
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
|
|
4
|
-
import URL from 'url-parse';
|
|
5
|
-
|
|
6
4
|
class DOMException extends Error {
|
|
7
5
|
constructor(message: string, name: string) {
|
|
8
6
|
super(message);
|
|
@@ -21,9 +19,9 @@ class Location {
|
|
|
21
19
|
// @ts-expect-error
|
|
22
20
|
href
|
|
23
21
|
);
|
|
24
|
-
|
|
22
|
+
|
|
25
23
|
url.username = '';
|
|
26
|
-
|
|
24
|
+
|
|
27
25
|
url.password = '';
|
|
28
26
|
Object.defineProperties(this, {
|
|
29
27
|
hash: {
|
|
@@ -97,7 +95,6 @@ class Location {
|
|
|
97
95
|
},
|
|
98
96
|
search: {
|
|
99
97
|
get() {
|
|
100
|
-
// @ts-expect-error
|
|
101
98
|
return url.search;
|
|
102
99
|
},
|
|
103
100
|
set() {
|