@expo/metro-runtime 2.1.3 → 2.1.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/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -1
- package/build/index.js.map +1 -1
- package/build/location/Location.native.d.ts.map +1 -1
- package/build/location/Location.native.js +8 -2
- package/build/location/Location.native.js.map +1 -1
- package/package.json +1 -1
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;
|
|
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"}
|
package/build/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
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
8
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,8BAA4B;AAC5B,
|
|
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 +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":"AAsNA,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,QAE3C;AAED,wBAAgB,OAAO,SAgBtB"}
|
|
@@ -126,10 +126,16 @@ class Location {
|
|
|
126
126
|
reload: {
|
|
127
127
|
value: function reload() {
|
|
128
128
|
if (process.env.NODE_ENV !== "production") {
|
|
129
|
+
// NOTE: This does change how native fast refresh works. The upstream metro-runtime will check
|
|
130
|
+
// if `location.reload` exists before falling back on an implementation that is nearly identical to
|
|
131
|
+
// this. The main difference is that on iOS there is a "reason" message sent, but at the time of writing
|
|
132
|
+
// this, that message is unused (ref: `RCTTriggerReloadCommandNotification`).
|
|
129
133
|
const DevSettings = require("react-native").DevSettings;
|
|
130
|
-
DevSettings.reload();
|
|
134
|
+
return DevSettings.reload();
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
throw new DOMException(`Cannot call "location.reload()".`, "NotSupportedError");
|
|
131
138
|
}
|
|
132
|
-
throw new DOMException(`Cannot call "location.reload()".`, "NotSupportedError");
|
|
133
139
|
},
|
|
134
140
|
enumerable: true,
|
|
135
141
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Location.native.js","sourceRoot":"","sources":["../../src/location/Location.native.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,0EAA0E;;;;;;AAE1E,0DAA4B;AAE5B,MAAM,YAAa,SAAQ,KAAK;IAC9B,YAAY,OAAe,EAAE,IAAY;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;C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AC,QAAQ,CAAC,SAAS,EAAE;IAC1C,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,EAAE;QACnB,KAAK,EAAE,UAAU;QACjB,YAAY,EAAE,IAAI;KACnB;CACF,CAAC,CAAC;AAEH,IAAI,QAAQ,GAAyB,SAAS,CAAC;AAE/C,SAAgB,eAAe,CAAC,IAAY;IAC1C,QAAQ,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;AAFD,0CAEC;AAED,SAAgB,OAAO;IACrB,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE;QACxC,KAAK,EAAE,QAAQ;QACf,YAAY,EAAE,IAAI;QAClB,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IAEH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE;QACxC,GAAG;YACD,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,GAAG;YACD,MAAM,IAAI,YAAY,CAAC,wBAAwB,EAAE,mBAAmB,CAAC,CAAC;QACxE,CAAC;QACD,UAAU,EAAE,IAAI;KACjB,CAAC,CAAC;AACL,CAAC;AAhBD,0BAgBC","sourcesContent":["// Copyright © 2023 650 Industries.\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n\nimport URL from \"url-parse\";\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 // @ts-expect-error\n url.username = \"\";\n // @ts-expect-error\n url.password = \"\";\n Object.defineProperties(this, {\n hash: {\n get() {\n return url.hash;\n },\n set() {\n throw new DOMException(\n `Cannot set \"location.hash\".`,\n \"NotSupportedError\"\n );\n },\n enumerable: true,\n },\n host: {\n get() {\n return url.host;\n },\n set() {\n throw new DOMException(\n `Cannot set \"location.host\".`,\n \"NotSupportedError\"\n );\n },\n enumerable: true,\n },\n hostname: {\n get() {\n return url.hostname;\n },\n set() {\n throw new DOMException(\n `Cannot set \"location.hostname\".`,\n \"NotSupportedError\"\n );\n },\n enumerable: true,\n },\n href: {\n get() {\n return url.href;\n },\n set() {\n throw new DOMException(\n `Cannot set \"location.href\".`,\n \"NotSupportedError\"\n );\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(\n `Cannot set \"location.pathname\".`,\n \"NotSupportedError\"\n );\n },\n enumerable: true,\n },\n port: {\n get() {\n return url.port;\n },\n set() {\n throw new DOMException(\n `Cannot set \"location.port\".`,\n \"NotSupportedError\"\n );\n },\n enumerable: true,\n },\n protocol: {\n get() {\n return url.protocol;\n },\n set() {\n throw new DOMException(\n `Cannot set \"location.protocol\".`,\n \"NotSupportedError\"\n );\n },\n enumerable: true,\n },\n search: {\n get() {\n // @ts-expect-error\n return url.search;\n },\n set() {\n throw new DOMException(\n `Cannot set \"location.search\".`,\n \"NotSupportedError\"\n );\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(\n `Cannot call \"location.assign()\".`,\n \"NotSupportedError\"\n );\n },\n enumerable: true,\n },\n reload: {\n value: function reload() {\n if (process.env.NODE_ENV !== \"production\") {\n const DevSettings = (\n require(\"react-native\") as typeof import(\"react-native\")\n ).DevSettings;\n DevSettings.reload();\n }\n throw new DOMException(\n `Cannot call \"location.reload()\".`,\n \"NotSupportedError\"\n );\n },\n enumerable: true,\n },\n replace: {\n value: function replace() {\n throw new DOMException(\n `Cannot call \"location.replace()\".`,\n \"NotSupportedError\"\n );\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"]}
|
|
1
|
+
{"version":3,"file":"Location.native.js","sourceRoot":"","sources":["../../src/location/Location.native.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,0EAA0E;;;;;;AAE1E,0DAA4B;AAE5B,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,mBAAG;QACjB,mBAAmB;QACnB,IAAI,CACL,CAAC;QACF,mBAAmB;QACnB,GAAG,CAAC,QAAQ,GAAG,EAAE,CAAC;QAClB,mBAAmB;QACnB,GAAG,CAAC,QAAQ,GAAG,EAAE,CAAC;QAClB,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE;YAC5B,IA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AChC,CAAC;AAFD,0CAEC;AAED,SAAgB,OAAO;IACrB,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE;QACxC,KAAK,EAAE,QAAQ;QACf,YAAY,EAAE,IAAI;QAClB,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IAEH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE;QACxC,GAAG;YACD,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,GAAG;YACD,MAAM,IAAI,YAAY,CAAC,wBAAwB,EAAE,mBAAmB,CAAC,CAAC;QACxE,CAAC;QACD,UAAU,EAAE,IAAI;KACjB,CAAC,CAAC;AACL,CAAC;AAhBD,0BAgBC","sourcesContent":["// Copyright © 2023 650 Industries.\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n\nimport URL from \"url-parse\";\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 // @ts-expect-error\n url.username = \"\";\n // @ts-expect-error\n url.password = \"\";\n Object.defineProperties(this, {\n hash: {\n get() {\n return url.hash;\n },\n set() {\n throw new DOMException(\n `Cannot set \"location.hash\".`,\n \"NotSupportedError\"\n );\n },\n enumerable: true,\n },\n host: {\n get() {\n return url.host;\n },\n set() {\n throw new DOMException(\n `Cannot set \"location.host\".`,\n \"NotSupportedError\"\n );\n },\n enumerable: true,\n },\n hostname: {\n get() {\n return url.hostname;\n },\n set() {\n throw new DOMException(\n `Cannot set \"location.hostname\".`,\n \"NotSupportedError\"\n );\n },\n enumerable: true,\n },\n href: {\n get() {\n return url.href;\n },\n set() {\n throw new DOMException(\n `Cannot set \"location.href\".`,\n \"NotSupportedError\"\n );\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(\n `Cannot set \"location.pathname\".`,\n \"NotSupportedError\"\n );\n },\n enumerable: true,\n },\n port: {\n get() {\n return url.port;\n },\n set() {\n throw new DOMException(\n `Cannot set \"location.port\".`,\n \"NotSupportedError\"\n );\n },\n enumerable: true,\n },\n protocol: {\n get() {\n return url.protocol;\n },\n set() {\n throw new DOMException(\n `Cannot set \"location.protocol\".`,\n \"NotSupportedError\"\n );\n },\n enumerable: true,\n },\n search: {\n get() {\n // @ts-expect-error\n return url.search;\n },\n set() {\n throw new DOMException(\n `Cannot set \"location.search\".`,\n \"NotSupportedError\"\n );\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(\n `Cannot call \"location.assign()\".`,\n \"NotSupportedError\"\n );\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 = (\n require(\"react-native\") as typeof import(\"react-native\")\n ).DevSettings;\n return DevSettings.reload();\n } else {\n throw new DOMException(\n `Cannot call \"location.reload()\".`,\n \"NotSupportedError\"\n );\n }\n },\n enumerable: true,\n },\n replace: {\n value: function replace() {\n throw new DOMException(\n `Cannot call \"location.replace()\".`,\n \"NotSupportedError\"\n );\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"]}
|
package/package.json
CHANGED