@vxrn/vite-native-hmr 1.27.1 → 2.0.0-beta.101.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,225 +7,210 @@ 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 devServerClient_exports = {};
37
30
  __export(devServerClient_exports, {
38
- client: () => client,
39
- disable: () => disable,
40
- enable: () => enable,
41
- log: () => log,
42
- registerBundle: () => registerBundle,
43
- setup: () => setup
31
+ client: () => client,
32
+ disable: () => disable,
33
+ enable: () => enable,
34
+ log: () => log,
35
+ registerBundle: () => registerBundle,
36
+ setup: () => setup
44
37
  });
45
38
  module.exports = __toCommonJS(devServerClient_exports);
46
39
  var import_pretty_format = __toESM(require("pretty-format"));
47
40
  var import_getDevServerLocation = require("./getDevServerLocation.native.js");
48
41
  var import_hmr_client = require("./hmr-client.native.js");
49
42
  function _class_call_check(instance, Constructor) {
50
- if (!(instance instanceof Constructor)) {
51
- throw new TypeError("Cannot call a class as a function");
52
- }
43
+ if (!(instance instanceof Constructor)) {
44
+ throw new TypeError("Cannot call a class as a function");
45
+ }
53
46
  }
54
47
  function _defineProperties(target, props) {
55
- for (var i = 0; i < props.length; i++) {
56
- var descriptor = props[i];
57
- descriptor.enumerable = descriptor.enumerable || false;
58
- descriptor.configurable = true;
59
- if ("value" in descriptor) descriptor.writable = true;
60
- Object.defineProperty(target, descriptor.key, descriptor);
61
- }
48
+ for (var i = 0; i < props.length; i++) {
49
+ var descriptor = props[i];
50
+ descriptor.enumerable = descriptor.enumerable || false;
51
+ descriptor.configurable = true;
52
+ if ("value" in descriptor) descriptor.writable = true;
53
+ Object.defineProperty(target, descriptor.key, descriptor);
54
+ }
62
55
  }
63
56
  function _create_class(Constructor, protoProps, staticProps) {
64
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
65
- if (staticProps) _defineProperties(Constructor, staticProps);
66
- return Constructor;
57
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
58
+ if (staticProps) _defineProperties(Constructor, staticProps);
59
+ return Constructor;
67
60
  }
68
61
  function _define_property(obj, key, value) {
69
- if (key in obj) {
70
- Object.defineProperty(obj, key, {
71
- value,
72
- enumerable: true,
73
- configurable: true,
74
- writable: true
75
- });
76
- } else {
77
- obj[key] = value;
78
- }
79
- return obj;
62
+ if (key in obj) {
63
+ Object.defineProperty(obj, key, {
64
+ value,
65
+ enumerable: true,
66
+ configurable: true,
67
+ writable: true
68
+ });
69
+ } else {
70
+ obj[key] = value;
71
+ }
72
+ return obj;
80
73
  }
81
74
  (0, import_hmr_client.loadHMRClient)();
82
- var DevServerClient = /* @__PURE__ */function () {
83
- "use strict";
84
-
85
- function DevServerClient2() {
86
- var _this = this;
87
- _class_call_check(this, DevServerClient2);
88
- _define_property(this, "socket", void 0);
89
- _define_property(this, "buffer", []);
90
- var initSocket = function () {
91
- var address = `ws://${(0, import_getDevServerLocation.getDevServerLocation)().host}/__client`;
92
- _this.socket = new WebSocket(address);
93
- var onClose = function (event) {
94
- console.warn("Disconnected from the Dev Server:", event.message);
95
- _this.socket = void 0;
96
- };
97
- _this.socket.onclose = onClose;
98
- _this.socket.onerror = onClose;
99
- _this.socket.onopen = function () {
100
- _this.flushBuffer();
101
- };
102
- };
103
- if (process.env.NODE_ENV === "development") {
104
- initSocket();
105
- }
106
- }
107
- _create_class(DevServerClient2, [{
108
- key: "send",
109
- value: function send(level, data) {
110
- try {
111
- var _this_socket;
112
- (_this_socket = this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.send(JSON.stringify({
113
- type: "client-log",
114
- level,
115
- data: data.map(function (item) {
116
- return typeof item === "string" ? item : (0, import_pretty_format.default)(item, {
117
- escapeString: true,
118
- highlight: true,
119
- maxDepth: 3,
120
- min: true,
121
- plugins: [
122
- // @ts-expect-error
123
- import_pretty_format.default.plugins.ReactElement]
124
- });
125
- })
126
- }));
127
- } catch (unused) {
128
- try {
129
- var _this_socket1;
130
- (_this_socket1 = this.socket) === null || _this_socket1 === void 0 ? void 0 : _this_socket1.send(JSON.stringify({
131
- type: "client-log",
132
- level,
133
- data: data.map(function (item, index) {
134
- try {
135
- return typeof item === "string" ? item : JSON.stringify(item);
136
- } catch (err) {
137
- return `Error stringifying item at index ${index} - ${item} - ${err}`;
138
- }
139
- })
140
- }));
141
- } catch (err) {
142
- try {
143
- var _this_socket2;
144
- (_this_socket2 = this.socket) === null || _this_socket2 === void 0 ? void 0 : _this_socket2.send(JSON.stringify({
145
- type: "client-log",
146
- level: "error",
147
- data: ["error sending client log: " + err]
148
- }));
149
- } catch (unused2) {}
150
- }
151
- }
152
- }
153
- }, {
154
- // final err
155
- // Ignore error
156
- key: "flushBuffer",
157
- value: function flushBuffer() {
158
- var _this = this;
159
- if (globalThis["__vxrnTmpLogs"]) {
160
- globalThis["__vxrnTmpLogs"].forEach(function (param) {
161
- var {
162
- level: level2,
163
- data: data2
164
- } = param;
165
- _this.buffer.push({
166
- level: level2,
167
- data: data2
168
- });
169
- });
170
- delete globalThis["__vxrnTmpLogs"];
171
- }
172
- var _iteratorNormalCompletion = true,
173
- _didIteratorError = false,
174
- _iteratorError = void 0;
175
- try {
176
- for (var _iterator = this.buffer[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
177
- var {
178
- level,
179
- data
180
- } = _step.value;
181
- this.send(level, data);
182
- }
183
- } catch (err) {
184
- _didIteratorError = true;
185
- _iteratorError = err;
186
- } finally {
187
- try {
188
- if (!_iteratorNormalCompletion && _iterator.return != null) {
189
- _iterator.return();
190
- }
191
- } finally {
192
- if (_didIteratorError) {
193
- throw _iteratorError;
194
- }
195
- }
196
- }
197
- this.buffer = [];
198
- }
199
- }, {
200
- key: "log",
201
- value: function log2(level, data) {
202
- if (level === "groupEnd") {
203
- return;
204
- }
205
- if (this.socket && this.socket.readyState === WebSocket.OPEN) {
206
- this.flushBuffer();
207
- this.send(level, data);
208
- } else {
209
- if (globalThis["__vxrnTmpLogs"]) return;
210
- this.buffer.push({
211
- level,
212
- data
213
- });
214
- }
215
- }
216
- }, {
217
- // Mock for React Native 0.79 to prevent native error "getPropertyAsObject: property 'setup' is undefined, expected an Object"
218
- key: "setup",
219
- value: function setup2() {}
220
- }]);
221
- return DevServerClient2;
222
- }();
75
+ var DevServerClient = /* @__PURE__ */ (function() {
76
+ "use strict";
77
+ function DevServerClient2() {
78
+ var _this = this;
79
+ _class_call_check(this, DevServerClient2);
80
+ _define_property(this, "socket", void 0);
81
+ _define_property(this, "buffer", []);
82
+ var initSocket = function() {
83
+ var address = `ws://${(0, import_getDevServerLocation.getDevServerLocation)().host}/__client`;
84
+ _this.socket = new WebSocket(address);
85
+ var onClose = function(event) {
86
+ console.warn("Disconnected from the Dev Server:", event.message);
87
+ _this.socket = void 0;
88
+ };
89
+ _this.socket.onclose = onClose;
90
+ _this.socket.onerror = onClose;
91
+ _this.socket.onopen = function() {
92
+ _this.flushBuffer();
93
+ };
94
+ };
95
+ if (process.env.NODE_ENV === "development") {
96
+ initSocket();
97
+ }
98
+ }
99
+ _create_class(DevServerClient2, [
100
+ {
101
+ key: "send",
102
+ value: function send(level, data) {
103
+ try {
104
+ var _this_socket;
105
+ (_this_socket = this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.send(JSON.stringify({
106
+ type: "client-log",
107
+ level,
108
+ data: data.map(function(item) {
109
+ return typeof item === "string" ? item : (0, import_pretty_format.default)(item, {
110
+ escapeString: true,
111
+ highlight: true,
112
+ maxDepth: 3,
113
+ min: true,
114
+ plugins: [import_pretty_format.default.plugins.ReactElement]
115
+ });
116
+ })
117
+ }));
118
+ } catch (unused) {
119
+ try {
120
+ var _this_socket1;
121
+ (_this_socket1 = this.socket) === null || _this_socket1 === void 0 ? void 0 : _this_socket1.send(JSON.stringify({
122
+ type: "client-log",
123
+ level,
124
+ data: data.map(function(item, index) {
125
+ try {
126
+ return typeof item === "string" ? item : JSON.stringify(item);
127
+ } catch (err) {
128
+ return `Error stringifying item at index ${index} - ${item} - ${err}`;
129
+ }
130
+ })
131
+ }));
132
+ } catch (err) {
133
+ try {
134
+ var _this_socket2;
135
+ (_this_socket2 = this.socket) === null || _this_socket2 === void 0 ? void 0 : _this_socket2.send(JSON.stringify({
136
+ type: "client-log",
137
+ level: "error",
138
+ data: ["error sending client log: " + err]
139
+ }));
140
+ } catch (unused2) {}
141
+ }
142
+ }
143
+ }
144
+ },
145
+ {
146
+ key: "flushBuffer",
147
+ value: function flushBuffer() {
148
+ var _this = this;
149
+ if (globalThis["__vxrnTmpLogs"]) {
150
+ globalThis["__vxrnTmpLogs"].forEach(function(param) {
151
+ var { level: level2, data: data2 } = param;
152
+ _this.buffer.push({
153
+ level: level2,
154
+ data: data2
155
+ });
156
+ });
157
+ delete globalThis["__vxrnTmpLogs"];
158
+ }
159
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
160
+ try {
161
+ for (var _iterator = this.buffer[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
162
+ var { level, data } = _step.value;
163
+ this.send(level, data);
164
+ }
165
+ } catch (err) {
166
+ _didIteratorError = true;
167
+ _iteratorError = err;
168
+ } finally {
169
+ try {
170
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
171
+ _iterator.return();
172
+ }
173
+ } finally {
174
+ if (_didIteratorError) {
175
+ throw _iteratorError;
176
+ }
177
+ }
178
+ }
179
+ this.buffer = [];
180
+ }
181
+ },
182
+ {
183
+ key: "log",
184
+ value: function log2(level, data) {
185
+ if (level === "groupEnd") {
186
+ return;
187
+ }
188
+ if (this.socket && this.socket.readyState === WebSocket.OPEN) {
189
+ this.flushBuffer();
190
+ this.send(level, data);
191
+ } else {
192
+ if (globalThis["__vxrnTmpLogs"]) return;
193
+ this.buffer.push({
194
+ level,
195
+ data
196
+ });
197
+ }
198
+ }
199
+ },
200
+ {
201
+ key: "setup",
202
+ value: function setup2() {}
203
+ }
204
+ ]);
205
+ return DevServerClient2;
206
+ })();
223
207
  var client = new DevServerClient();
224
- var setup = function () {};
225
- var enable = function () {};
226
- var disable = function () {};
227
- var registerBundle = function () {};
228
- var log = function (level, data) {
229
- client.log(level, data);
208
+ var setup = function() {};
209
+ var enable = function() {};
210
+ var disable = function() {};
211
+ var registerBundle = function() {};
212
+ var log = function(level, data) {
213
+ client.log(level, data);
230
214
  };
215
+
231
216
  //# sourceMappingURL=devServerClient.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","devServerClient_exports","__export","client","disable","enable","log","registerBundle","setup","module","exports","import_pretty_format","__toESM","require","import_getDevServerLocation","import_hmr_client","_class_call_check","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","_create_class","protoProps","staticProps","prototype","_define_property","obj","loadHMRClient","DevServerClient","DevServerClient2","_this","initSocket","address","getDevServerLocation","host","socket","WebSocket","onClose","event","console","warn","message","onclose","onerror","onopen","flushBuffer","process","env","NODE_ENV","send","level","data","_this_socket","JSON","stringify","type","map","item","default","escapeString","highlight","maxDepth","min","plugins","ReactElement","unused","_this_socket1","index","err","_this_socket2","unused2"],"sources":["../../src/devServerClient.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,uBAAA;AAAAC,QAAA,CAAAD,uBAAA;EAAAE,MAAA,EAAAA,CAAA,KAAAA,MAAA;EAAAC,OAAA,EAAAA,CAAA,KAAAA,OAAA;EAAAC,MAAA,EAAAA,CAAA,KAAAA,MAAA;EAAAC,GAAA,EAAAA,CAAA,KAAAA,GAAA;EAAAC,cAAA,EAAAA,CAAA,KAAAA,cAAA;EAAAC,KAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAd,YAAyB,CAAAK,uBAAA;AAEzB,IAAAU,oBAAA,GAAAC,OAAqC,CAAAC,OAAA;AACrC,IAAAC,2BAA8B,GAAAD,OAAA;AAAA,IAG9B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AEmBC,IAAA,EAAaA,IAAA,CAAAK,GAAA,WAAAC,IAAA,EAAAU,KAAA;cAC1B,IAAU;gBACZ,cAAAV,IAAA,gBAAAA,IAAA,GAAAJ,IAAA,CAAAC,SAAA,CAAAG,IAAA;cACF,SAAAW,GAAA;gBAES,OAAU,oCAAqCD,KAAM,MAAAV,IAAA,MAAAW,GAAA;cACvD;YACA;UACA;QACD,SAAAA,GAAW;UACV;YACP,IAAAC,aAAA;YACF,CAAAA,aAAA,QAAAlC,MAAA,cAAAkC,aAAA,uBAAAA,aAAA,CAAApB,IAAA,CAAAI,IAAA,CAAAC,SAAA;cAAAC,IAAA;cAGQL,KAAA;cAERC,IAAA,GACF,+BAAAiB,GAAA;YAIqB;UAAO,SAAAE,OAAA,GACf;QAAgB;MAChB;IAAiB;EACvB,GAA8B;IACxB;IACX;IACFlD,GAAA","ignoreList":[]}
1
+ {"version":3,"file":"devServerClient.native.js","names":[],"sources":["cjs/devServerClient.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 devServerClient_exports = {};\n__export(devServerClient_exports, {\n client: () => client,\n disable: () => disable,\n enable: () => enable,\n log: () => log,\n registerBundle: () => registerBundle,\n setup: () => setup\n});\nmodule.exports = __toCommonJS(devServerClient_exports);\nvar import_pretty_format = __toESM(require(\"pretty-format\"));\nvar import_getDevServerLocation = require(\"./getDevServerLocation\");\nvar import_hmr_client = require(\"./hmr-client\");\nfunction _class_call_check(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\nfunction _create_class(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\nfunction _define_property(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}\n(0, import_hmr_client.loadHMRClient)();\nvar DevServerClient = /* @__PURE__ */ (function() {\n \"use strict\";\n function DevServerClient2() {\n var _this = this;\n _class_call_check(this, DevServerClient2);\n _define_property(this, \"socket\", void 0);\n _define_property(this, \"buffer\", []);\n var initSocket = function() {\n var address = `ws://${(0, import_getDevServerLocation.getDevServerLocation)().host}/__client`;\n _this.socket = new WebSocket(address);\n var onClose = function(event) {\n console.warn(\"Disconnected from the Dev Server:\", event.message);\n _this.socket = void 0;\n };\n _this.socket.onclose = onClose;\n _this.socket.onerror = onClose;\n _this.socket.onopen = function() {\n _this.flushBuffer();\n };\n };\n if (process.env.NODE_ENV === \"development\") {\n initSocket();\n }\n }\n _create_class(DevServerClient2, [\n {\n key: \"send\",\n value: function send(level, data) {\n try {\n var _this_socket;\n (_this_socket = this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.send(JSON.stringify({\n type: \"client-log\",\n level,\n data: data.map(function(item) {\n return typeof item === \"string\" ? item : (0, import_pretty_format.default)(item, {\n escapeString: true,\n highlight: true,\n maxDepth: 3,\n min: true,\n plugins: [\n // @ts-expect-error\n import_pretty_format.default.plugins.ReactElement\n ]\n });\n })\n }));\n } catch (unused) {\n try {\n var _this_socket1;\n (_this_socket1 = this.socket) === null || _this_socket1 === void 0 ? void 0 : _this_socket1.send(JSON.stringify({\n type: \"client-log\",\n level,\n data: data.map(function(item, index) {\n try {\n return typeof item === \"string\" ? item : JSON.stringify(item);\n } catch (err) {\n return `Error stringifying item at index ${index} - ${item} - ${err}`;\n }\n })\n }));\n } catch (err) {\n try {\n var _this_socket2;\n (_this_socket2 = this.socket) === null || _this_socket2 === void 0 ? void 0 : _this_socket2.send(JSON.stringify({\n type: \"client-log\",\n level: \"error\",\n data: [\n \"error sending client log: \" + err\n ]\n }));\n } catch (unused2) {\n }\n }\n }\n }\n },\n {\n // final err\n // Ignore error\n key: \"flushBuffer\",\n value: function flushBuffer() {\n var _this = this;\n if (globalThis[\"__vxrnTmpLogs\"]) {\n globalThis[\"__vxrnTmpLogs\"].forEach(function(param) {\n var { level: level2, data: data2 } = param;\n _this.buffer.push({\n level: level2,\n data: data2\n });\n });\n delete globalThis[\"__vxrnTmpLogs\"];\n }\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = this.buffer[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var { level, data } = _step.value;\n this.send(level, data);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n this.buffer = [];\n }\n },\n {\n key: \"log\",\n value: function log2(level, data) {\n if (level === \"groupEnd\") {\n return;\n }\n if (this.socket && this.socket.readyState === WebSocket.OPEN) {\n this.flushBuffer();\n this.send(level, data);\n } else {\n if (globalThis[\"__vxrnTmpLogs\"]) return;\n this.buffer.push({\n level,\n data\n });\n }\n }\n },\n {\n // Mock for React Native 0.79 to prevent native error \"getPropertyAsObject: property 'setup' is undefined, expected an Object\"\n key: \"setup\",\n value: function setup2() {\n }\n }\n ]);\n return DevServerClient2;\n})();\nvar client = new DevServerClient();\nvar setup = function() {\n};\nvar enable = function() {\n};\nvar disable = function() {\n};\nvar registerBundle = function() {\n};\nvar log = function(level, data) {\n client.log(level, data);\n};\n//# sourceMappingURL=devServerClient.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,SA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AAO,SAAS,KAAK,OAAO,MAAM;IAChC,IAAI,UAAU,YAAY;KACxB;IACF;IACA,IAAI,KAAK,UAAU,KAAK,OAAO,eAAe,UAAU,MAAM;KAC5D,KAAK,YAAY;KACjB,KAAK,KAAK,OAAO,IAAI;IACvB,OAAO;KACL,IAAI,WAAW,kBAAkB;KACjC,KAAK,OAAO,KAAK;MACf;MACA;KACF,CAAC;IACH;GACF;EACF;EACA;GAEE,KAAK;GACL,OAAO,SAAS,SAAS,CACzB;EACF;CACF,CAAC;CACD,OAAO;AACT,EAAC,CAAE;AACH,IAAI,SAAS,IAAI,gBAAgB;AACjC,IAAI,QAAQ,WAAW,CACvB;AACA,IAAI,SAAS,WAAW,CACxB;AACA,IAAI,UAAU,WAAW,CACzB;AACA,IAAI,iBAAiB,WAAW,CAChC;AACA,IAAI,MAAM,SAAS,OAAO,MAAM;CAC9B,OAAO,IAAI,OAAO,IAAI;AACxB"}
@@ -5,55 +5,44 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
12
  };
13
13
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
21
  };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
- value: mod,
29
- enumerable: true
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
30
25
  }) : target, mod));
31
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
- value: true
33
- }), mod);
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
27
  var getDevServerLocation_exports = {};
35
- __export(getDevServerLocation_exports, {
36
- getDevServerLocation: () => getDevServerLocation
37
- });
28
+ __export(getDevServerLocation_exports, { getDevServerLocation: () => getDevServerLocation });
38
29
  module.exports = __toCommonJS(getDevServerLocation_exports);
39
30
  var import_getDevServer = __toESM(require("react-native/Libraries/Core/Devtools/getDevServer"));
40
31
  let location;
41
32
  function getDevServerLocation() {
42
- if (!location) {
43
- const {
44
- url
45
- } = (0, import_getDevServer.default)();
46
- const origin = url.replace(/\/$/, "");
47
- const host = origin.replace(/https?:\/\//, "");
48
- location = {
49
- host,
50
- hostname: host.split(":")[0],
51
- href: url,
52
- origin,
53
- pathname: url.split(host)[1],
54
- port: host.split(":")[1],
55
- protocol: (url.match(/^([a-z])+:\/\//) || [void 0, void 0])[1]
56
- };
57
- }
58
- return location;
59
- }
33
+ if (!location) {
34
+ const { url } = (0, import_getDevServer.default)();
35
+ const origin = url.replace(/\/$/, "");
36
+ const host = origin.replace(/https?:\/\//, "");
37
+ location = {
38
+ host,
39
+ hostname: host.split(":")[0],
40
+ href: url,
41
+ origin,
42
+ pathname: url.split(host)[1],
43
+ port: host.split(":")[1],
44
+ protocol: (url.match(/^([a-z])+:\/\//) || [void 0, void 0])[1]
45
+ };
46
+ }
47
+ return location;
48
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ };
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;
23
+ };
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
27
+ }) : target, mod));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var getDevServerLocation_exports = {};
30
+ __export(getDevServerLocation_exports, { getDevServerLocation: () => getDevServerLocation });
31
+ module.exports = __toCommonJS(getDevServerLocation_exports);
32
+ var import_getDevServer = __toESM(require("react-native/Libraries/Core/Devtools/getDevServer"));
33
+ var location;
34
+ function getDevServerLocation() {
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;
50
+ }