@vxrn/vite-native-hmr 1.27.1 → 2.0.0-beta.100.1

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.
Files changed (37) hide show
  1. package/dist/cjs/devServerClient.cjs +113 -129
  2. package/dist/cjs/devServerClient.native.cjs +214 -0
  3. package/dist/cjs/devServerClient.native.js +184 -199
  4. package/dist/cjs/devServerClient.native.js.map +1 -1
  5. package/dist/cjs/getDevServerLocation.cjs +32 -43
  6. package/dist/cjs/getDevServerLocation.native.cjs +50 -0
  7. package/dist/cjs/getDevServerLocation.native.js +32 -42
  8. package/dist/cjs/getDevServerLocation.native.js.map +1 -1
  9. package/dist/cjs/hmr-client.cjs +155 -175
  10. package/dist/cjs/hmr-client.native.cjs +231 -0
  11. package/dist/cjs/hmr-client.native.js +210 -224
  12. package/dist/cjs/hmr-client.native.js.map +1 -1
  13. package/dist/cjs/index.cjs +14 -18
  14. package/dist/cjs/index.native.cjs +29 -0
  15. package/dist/cjs/index.native.js +14 -17
  16. package/dist/cjs/index.native.js.map +1 -1
  17. package/dist/esm/devServerClient.mjs +93 -100
  18. package/dist/esm/devServerClient.mjs.map +1 -1
  19. package/dist/esm/devServerClient.native.js +164 -171
  20. package/dist/esm/devServerClient.native.js.map +1 -1
  21. package/dist/esm/getDevServerLocation.mjs +17 -17
  22. package/dist/esm/getDevServerLocation.mjs.map +1 -1
  23. package/dist/esm/getDevServerLocation.native.js +17 -17
  24. package/dist/esm/getDevServerLocation.native.js.map +1 -1
  25. package/dist/esm/hmr-client.mjs +143 -157
  26. package/dist/esm/hmr-client.mjs.map +1 -1
  27. package/dist/esm/hmr-client.native.js +198 -207
  28. package/dist/esm/hmr-client.native.js.map +1 -1
  29. package/dist/esm/index.js +4 -1
  30. package/dist/esm/index.js.map +1 -1
  31. package/dist/esm/index.mjs +4 -1
  32. package/dist/esm/index.mjs.map +1 -1
  33. package/dist/esm/index.native.js +4 -1
  34. package/dist/esm/index.native.js.map +1 -1
  35. package/package.json +4 -4
  36. package/types/devServerClient.d.ts.map +1 -1
  37. package/types/index.d.ts.map +1 -1
@@ -7,56 +7,46 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
9
  var __export = (target, all) => {
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
14
  };
15
15
  var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") {
17
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
- get: () => from[key],
19
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
- });
21
- }
22
- return to;
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
+ get: () => from[key],
19
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
+ });
21
+ }
22
+ return to;
23
23
  };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
- // If the importer is in node compatibility mode or this is not an ESM
26
- // file that has been converted to a CommonJS file using a Babel-
27
- // compatible transform (i.e. "__esModule" has not been set), then set
28
- // "default" to the CommonJS "module.exports" for node compatibility.
29
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
- value: mod,
31
- enumerable: true
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
25
+ value: mod,
26
+ enumerable: true
32
27
  }) : target, mod));
33
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
- value: true
35
- }), mod);
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
29
  var getDevServerLocation_exports = {};
37
- __export(getDevServerLocation_exports, {
38
- getDevServerLocation: () => getDevServerLocation
39
- });
30
+ __export(getDevServerLocation_exports, { getDevServerLocation: () => getDevServerLocation });
40
31
  module.exports = __toCommonJS(getDevServerLocation_exports);
41
32
  var import_getDevServer = __toESM(require("react-native/Libraries/Core/Devtools/getDevServer"));
42
33
  var location;
43
34
  function getDevServerLocation() {
44
- if (!location) {
45
- var {
46
- url
47
- } = (0, import_getDevServer.default)();
48
- var origin = url.replace(/\/$/, "");
49
- var host = origin.replace(/https?:\/\//, "");
50
- location = {
51
- host,
52
- hostname: host.split(":")[0],
53
- href: url,
54
- origin,
55
- pathname: url.split(host)[1],
56
- port: host.split(":")[1],
57
- protocol: (url.match(/^([a-z])+:\/\//) || [void 0, void 0])[1]
58
- };
59
- }
60
- return location;
35
+ if (!location) {
36
+ var { url } = (0, import_getDevServer.default)();
37
+ var origin = url.replace(/\/$/, "");
38
+ var host = origin.replace(/https?:\/\//, "");
39
+ location = {
40
+ host,
41
+ hostname: host.split(":")[0],
42
+ href: url,
43
+ origin,
44
+ pathname: url.split(host)[1],
45
+ port: host.split(":")[1],
46
+ protocol: (url.match(/^([a-z])+:\/\//) || [void 0, void 0])[1]
47
+ };
48
+ }
49
+ return location;
61
50
  }
51
+
62
52
  //# sourceMappingURL=getDevServerLocation.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","getDevServerLocation_exports","__export","getDevServerLocation","module","exports","import_getDevServer","__toESM","require","location","url","default","origin","replace","host","hostname","split","href","pathname","port","protocol","match"],"sources":["../../src/getDevServerLocation.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,4BAAA;AAAAC,QAAA,CAAAD,4BAAA;EAAAE,oBAAA,EAAAA,CAAA,KAAAA;AAAA;AACAC,MAAA,CAAAC,OAAA,GAAAT,YAAyB,CAAAK,4BAAA;AAYzB,IAAIK,mBAAA,GAAAC,OAAA,CAAAC,OAAA;AAEG,IAAAC,QAAS;AACd,SAAKN,oBAAUA,CAAA;EACb,KAAAM,QAAQ,EAAI;IACZ;MAAMC;IAAA,KAAS,GAAAJ,mBAAqB,CAAAK,OAAA;IACpC,IAAAC,MAAM,GAAOF,GAAA,CAAAG,OAAO,MAAQ;IAC5B,IAAAC,IAAA,GAAWF,MAAA,CAAAC,OAAA;IAAAJ,QACT;MACAK,IAAA;MACAC,QAAM,EAAAD,IAAA,CAAAE,KAAA;MACNC,IAAA,EAAAP,GAAA;MACAE,MAAA;MACAM,QAAM,EAAAR,GAAK,CAAAM,KAAM,CAAGF,IAAG;MACvBK,IAAA,EAAAL,IAAA,CAAWE,KAAI,KAAM;MACvBI,QAAA,GAAAV,GAAA,CAAAW,KAAA,uBACF,QAEA,KAAO,EACT","ignoreList":[]}
1
+ {"version":3,"file":"getDevServerLocation.native.js","names":[],"sources":["cjs/getDevServerLocation.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar getDevServerLocation_exports = {};\n__export(getDevServerLocation_exports, {\n getDevServerLocation: () => getDevServerLocation\n});\nmodule.exports = __toCommonJS(getDevServerLocation_exports);\nvar import_getDevServer = __toESM(require(\"react-native/Libraries/Core/Devtools/getDevServer\"));\nvar location;\nfunction getDevServerLocation() {\n if (!location) {\n var { url } = (0, import_getDevServer.default)();\n var origin = url.replace(/\\/$/, \"\");\n var host = origin.replace(/https?:\\/\\//, \"\");\n location = {\n host,\n hostname: host.split(\":\")[0],\n href: url,\n origin,\n pathname: url.split(host)[1],\n port: host.split(\":\")[1],\n protocol: (url.match(/^([a-z])+:\\/\\//) || [\n void 0,\n void 0\n ])[1]\n };\n }\n return location;\n}\n//# sourceMappingURL=getDevServerLocation.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKnG,cAAc,CAAC,OAAO,CAAC,IAAI,aAAa,UAAU,QAAQ,WAAW;CAAE,OAAO;CAAK,YAAY;AAAK,CAAC,IAAI,QACzG,GACF;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,+BAA+B,CAAC;AACpC,SAAS,8BAA8B,EACrC,4BAA4B,qBAC9B,CAAC;AACD,OAAO,UAAU,aAAa,4BAA4B;AAC1D,IAAI,sBAAsB,QAAQ,QAAQ,mDAAmD,CAAC;AAC9F,IAAI;AACJ,SAAS,uBAAuB;CAC9B,IAAI,CAAC,UAAU;EACb,IAAI,EAAE,SAAS,GAAG,oBAAoB,QAAO,CAAE;EAC/C,IAAI,SAAS,IAAI,QAAQ,OAAO,EAAE;EAClC,IAAI,OAAO,OAAO,QAAQ,eAAe,EAAE;EAC3C,WAAW;GACT;GACA,UAAU,KAAK,MAAM,GAAG,CAAC,CAAC;GAC1B,MAAM;GACN;GACA,UAAU,IAAI,MAAM,IAAI,CAAC,CAAC;GAC1B,MAAM,KAAK,MAAM,GAAG,CAAC,CAAC;GACtB,WAAW,IAAI,MAAM,gBAAgB,KAAK,CACxC,KAAK,GACL,KAAK,CACP,EAAC,CAAE;EACL;CACF;CACA,OAAO;AACT"}
@@ -3,185 +3,165 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
10
  };
11
11
  var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- return to;
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
19
  };
20
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: true
22
- }), mod);
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
21
  var hmr_client_exports = {};
24
- __export(hmr_client_exports, {
25
- loadHMRClient: () => loadHMRClient
26
- });
22
+ __export(hmr_client_exports, { loadHMRClient: () => loadHMRClient });
27
23
  module.exports = __toCommonJS(hmr_client_exports);
28
24
  var import_getDevServerLocation = require("./getDevServerLocation.cjs");
29
- class HMRClient {
30
- constructor(app) {
31
- this.app = app;
32
- const port = process.env.REACT_NATIVE_SERVER_PUBLIC_PORT || 8081;
33
- this.url = `ws://${(0, import_getDevServerLocation.getDevServerLocation)().hostname}:${port}/__hmr?platform=${process.env.REACT_NATIVE_PLATFORM || "ios"}`;
34
- this.socket = new WebSocket(this.url);
35
- console.info(" \u24F5 [hmr] connecting...");
36
- this.socket.onopen = () => {
37
- console.info(" \u24F5 [hmr] connected");
38
- };
39
- this.socket.onclose = () => {
40
- console.info(` \u24F5 [hmr] disconnected ${this.url}`);
41
- };
42
- this.socket.onerror = event => {
43
- console.error(" \u24F5 [hmr] error", event);
44
- };
45
- this.socket.onmessage = event => {
46
- try {
47
- const data = JSON.parse(event.data.toString());
48
- this.processMessage(data);
49
- } catch (error) {
50
- console.warn(" \u24F5 [hmr] invalid message", error);
51
- }
52
- };
53
- }
54
- app;
55
- url;
56
- socket;
57
- lastHash = "";
58
- upToDate(hash) {
59
- if (hash) {
60
- this.lastHash = hash;
61
- }
62
- return this.lastHash === __webpack_hash__;
63
- }
64
- processMessage(message) {
65
- switch (message.action) {
66
- case "building":
67
- this.app.LoadingView.showMessage("Rebuilding...", "refresh");
68
- console.info(" \u24F5 [hmr] bundle rebuilding", {
69
- name: message.body?.name
70
- });
71
- break;
72
- // biome-ignore lint/suspicious/noFallthroughSwitchClause: <explanation>
73
- case "built":
74
- console.info(" \u24F5 [hmr] bundle rebuilt", {
75
- name: message.body?.name,
76
- time: message.body?.time
77
- });
78
- // Fall through
79
- case "sync":
80
- if (!message.body) {
81
- console.warn(" \u24F5 [hmr] message body is empty");
82
- return;
83
- }
84
- if (message.body.errors?.length) {
85
- message.body.errors.forEach(error => {
86
- console.error("Cannot apply update due to error:", error);
87
- });
88
- this.app.LoadingView.hide();
89
- return;
90
- }
91
- if (message.body.warnings?.length) {
92
- message.body.warnings.forEach(warning => {
93
- console.warn(" \u24F5 [hmr] bundle contains warnings:", warning);
94
- });
95
- }
96
- this.applyUpdate(message.body);
97
- }
98
- }
99
- applyUpdate(update) {
100
- if (!module.hot) {
101
- throw new Error(" \u24F5 [hmr] hot Module Replacement is disabled.");
102
- }
103
- if (!this.upToDate(update.hash) && module.hot.status() === "idle") {
104
- console.info(" \u24F5 [hmr] checking for updates on the server...");
105
- this.checkUpdates(update);
106
- }
107
- }
108
- checkUpdates(update) {
109
- try {
110
- this.app.LoadingView.showMessage("Refreshing...", "refresh");
111
- module.hot?.check(false).then(updatedModules => {
112
- if (!updatedModules) {
113
- console.warn(" \u24F5 [hmr] cannot find update - full reload needed");
114
- this.app.reload();
115
- return;
116
- }
117
- module.hot?.apply({
118
- ignoreDeclined: true,
119
- ignoreUnaccepted: false,
120
- ignoreErrored: false,
121
- onDeclined: data => {
122
- console.warn(" \u24F5 [hmr] ignored an update due to declined module", {
123
- chain: data.chain
124
- });
125
- }
126
- }).then(renewedModules => {
127
- if (!this.upToDate()) {
128
- this.checkUpdates(update);
129
- }
130
- const unacceptedModules = updatedModules.filter(moduleId => {
131
- return renewedModules && renewedModules.indexOf(moduleId) < 0;
132
- });
133
- if (unacceptedModules.length) {
134
- console.warn(" \u24F5 [hmr] not every module was accepted - full reload needed", {
135
- unacceptedModules
136
- });
137
- this.app.reload();
138
- } else {
139
- console.info(" \u24F5 [hmr] renewed modules - app is up to date", {
140
- renewedModules
141
- });
142
- this.app.dismissErrors();
143
- }
144
- });
145
- });
146
- } catch (error) {
147
- if (module.hot?.status() === "fail" || module.hot?.status() === "abort") {
148
- console.warn(" \u24F5 [hmr] cannot check for update - full reload needed");
149
- console.warn("[hmr]", error);
150
- this.app.reload();
151
- } else {
152
- console.warn(" \u24F5 [hmr] update check failed", {
153
- error
154
- });
155
- }
156
- } finally {
157
- this.app.LoadingView.hide();
158
- }
159
- }
160
- }
25
+ var HMRClient = class {
26
+ constructor(app) {
27
+ this.app = app;
28
+ const port = process.env.REACT_NATIVE_SERVER_PUBLIC_PORT || 8081;
29
+ this.url = `ws://${(0, import_getDevServerLocation.getDevServerLocation)().hostname}:${port}/__hmr?platform=${process.env.REACT_NATIVE_PLATFORM || "ios"}`;
30
+ this.socket = new WebSocket(this.url);
31
+ console.info(" ⓵ [hmr] connecting...");
32
+ this.socket.onopen = () => {
33
+ console.info(" ⓵ [hmr] connected");
34
+ };
35
+ this.socket.onclose = () => {
36
+ console.info(` \u24F5 [hmr] disconnected ${this.url}`);
37
+ };
38
+ this.socket.onerror = (event) => {
39
+ console.error(" ⓵ [hmr] error", event);
40
+ };
41
+ this.socket.onmessage = (event) => {
42
+ try {
43
+ const data = JSON.parse(event.data.toString());
44
+ this.processMessage(data);
45
+ } catch (error) {
46
+ console.warn(" ⓵ [hmr] invalid message", error);
47
+ }
48
+ };
49
+ }
50
+ app;
51
+ url;
52
+ socket;
53
+ lastHash = "";
54
+ upToDate(hash) {
55
+ if (hash) {
56
+ this.lastHash = hash;
57
+ }
58
+ return this.lastHash === __webpack_hash__;
59
+ }
60
+ processMessage(message) {
61
+ switch (message.action) {
62
+ case "building":
63
+ this.app.LoadingView.showMessage("Rebuilding...", "refresh");
64
+ console.info(" ⓵ [hmr] bundle rebuilding", { name: message.body?.name });
65
+ break;
66
+ case "built": console.info(" ⓵ [hmr] bundle rebuilt", {
67
+ name: message.body?.name,
68
+ time: message.body?.time
69
+ });
70
+ case "sync":
71
+ if (!message.body) {
72
+ console.warn(" ⓵ [hmr] message body is empty");
73
+ return;
74
+ }
75
+ if (message.body.errors?.length) {
76
+ message.body.errors.forEach((error) => {
77
+ console.error("Cannot apply update due to error:", error);
78
+ });
79
+ this.app.LoadingView.hide();
80
+ return;
81
+ }
82
+ if (message.body.warnings?.length) {
83
+ message.body.warnings.forEach((warning) => {
84
+ console.warn(" ⓵ [hmr] bundle contains warnings:", warning);
85
+ });
86
+ }
87
+ this.applyUpdate(message.body);
88
+ }
89
+ }
90
+ applyUpdate(update) {
91
+ if (!module.hot) {
92
+ throw new Error(" ⓵ [hmr] hot Module Replacement is disabled.");
93
+ }
94
+ if (!this.upToDate(update.hash) && module.hot.status() === "idle") {
95
+ console.info(" ⓵ [hmr] checking for updates on the server...");
96
+ this.checkUpdates(update);
97
+ }
98
+ }
99
+ checkUpdates(update) {
100
+ try {
101
+ this.app.LoadingView.showMessage("Refreshing...", "refresh");
102
+ module.hot?.check(false).then((updatedModules) => {
103
+ if (!updatedModules) {
104
+ console.warn(" ⓵ [hmr] cannot find update - full reload needed");
105
+ this.app.reload();
106
+ return;
107
+ }
108
+ module.hot?.apply({
109
+ ignoreDeclined: true,
110
+ ignoreUnaccepted: false,
111
+ ignoreErrored: false,
112
+ onDeclined: (data) => {
113
+ console.warn(" ⓵ [hmr] ignored an update due to declined module", { chain: data.chain });
114
+ }
115
+ }).then((renewedModules) => {
116
+ if (!this.upToDate()) {
117
+ this.checkUpdates(update);
118
+ }
119
+ const unacceptedModules = updatedModules.filter((moduleId) => {
120
+ return renewedModules && renewedModules.indexOf(moduleId) < 0;
121
+ });
122
+ if (unacceptedModules.length) {
123
+ console.warn(" ⓵ [hmr] not every module was accepted - full reload needed", { unacceptedModules });
124
+ this.app.reload();
125
+ } else {
126
+ console.info(" ⓵ [hmr] renewed modules - app is up to date", { renewedModules });
127
+ this.app.dismissErrors();
128
+ }
129
+ });
130
+ });
131
+ } catch (error) {
132
+ if (module.hot?.status() === "fail" || module.hot?.status() === "abort") {
133
+ console.warn(" ⓵ [hmr] cannot check for update - full reload needed");
134
+ console.warn("[hmr]", error);
135
+ this.app.reload();
136
+ } else {
137
+ console.warn(" ⓵ [hmr] update check failed", { error });
138
+ }
139
+ } finally {
140
+ this.app.LoadingView.hide();
141
+ }
142
+ }
143
+ };
161
144
  const loadHMRClient = () => {
162
- const {
163
- DevSettings,
164
- Platform
165
- } = require("react-native-web");
166
- const LoadingView = {
167
- showMessage: () => {},
168
- hide: () => {}
169
- };
170
- const reload = () => DevSettings.reload();
171
- const dismissErrors = () => {
172
- if (Platform.OS === "ios") {
173
- const NativeRedBox = require("react-native/Libraries/NativeModules/specs/NativeRedBox").default;
174
- NativeRedBox?.dismiss?.();
175
- } else {
176
- const NativeExceptionsManager = require("react-native/Libraries/Core/NativeExceptionsManager").default;
177
- NativeExceptionsManager?.dismissRedbox();
178
- }
179
- const LogBoxData = require("react-native/Libraries/LogBox/Data/LogBoxData");
180
- LogBoxData.clear();
181
- };
182
- new HMRClient({
183
- reload,
184
- dismissErrors,
185
- LoadingView
186
- });
187
- };
145
+ const { DevSettings, Platform } = require("react-native-web");
146
+ const LoadingView = {
147
+ showMessage: () => {},
148
+ hide: () => {}
149
+ };
150
+ const reload = () => DevSettings.reload();
151
+ const dismissErrors = () => {
152
+ if (Platform.OS === "ios") {
153
+ const NativeRedBox = require("react-native/Libraries/NativeModules/specs/NativeRedBox").default;
154
+ NativeRedBox?.dismiss?.();
155
+ } else {
156
+ const NativeExceptionsManager = require("react-native/Libraries/Core/NativeExceptionsManager").default;
157
+ NativeExceptionsManager?.dismissRedbox();
158
+ }
159
+ const LogBoxData = require("react-native/Libraries/LogBox/Data/LogBoxData");
160
+ LogBoxData.clear();
161
+ };
162
+ new HMRClient({
163
+ reload,
164
+ dismissErrors,
165
+ LoadingView
166
+ });
167
+ };