@vxrn/vite-native-hmr 1.25.4 → 1.25.5
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/package.json +1 -1
- package/dist/cjs/devServerClient.cjs +0 -154
- package/dist/cjs/devServerClient.native.js +0 -231
- package/dist/cjs/devServerClient.native.js.map +0 -1
- package/dist/cjs/getDevServerLocation.cjs +0 -59
- package/dist/cjs/getDevServerLocation.native.js +0 -62
- package/dist/cjs/getDevServerLocation.native.js.map +0 -1
- package/dist/cjs/hmr-client.cjs +0 -187
- package/dist/cjs/hmr-client.native.js +0 -247
- package/dist/cjs/hmr-client.native.js.map +0 -1
- package/dist/cjs/index.cjs +0 -31
- package/dist/cjs/index.native.js +0 -34
- package/dist/cjs/index.native.js.map +0 -1
- package/dist/esm/devServerClient.mjs +0 -113
- package/dist/esm/devServerClient.mjs.map +0 -1
- package/dist/esm/devServerClient.native.js +0 -187
- package/dist/esm/devServerClient.native.js.map +0 -1
- package/dist/esm/getDevServerLocation.mjs +0 -23
- package/dist/esm/getDevServerLocation.mjs.map +0 -1
- package/dist/esm/getDevServerLocation.native.js +0 -23
- package/dist/esm/getDevServerLocation.native.js.map +0 -1
- package/dist/esm/hmr-client.mjs +0 -162
- package/dist/esm/hmr-client.mjs.map +0 -1
- package/dist/esm/hmr-client.native.js +0 -219
- package/dist/esm/hmr-client.native.js.map +0 -1
- package/dist/esm/index.js +0 -5
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs +0 -5
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js +0 -5
- package/dist/esm/index.native.js.map +0 -1
- package/types/devServerClient.d.ts.map +0 -1
- package/types/getDevServerLocation.d.ts.map +0 -1
- package/types/hmr-client.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
package/dist/cjs/hmr-client.cjs
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all) __defProp(target, name, {
|
|
7
|
-
get: all[name],
|
|
8
|
-
enumerable: true
|
|
9
|
-
});
|
|
10
|
-
};
|
|
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;
|
|
19
|
-
};
|
|
20
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value: true
|
|
22
|
-
}), mod);
|
|
23
|
-
var hmr_client_exports = {};
|
|
24
|
-
__export(hmr_client_exports, {
|
|
25
|
-
loadHMRClient: () => loadHMRClient
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(hmr_client_exports);
|
|
28
|
-
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
|
-
}
|
|
161
|
-
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
|
-
};
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all) __defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: true
|
|
11
|
-
});
|
|
12
|
-
};
|
|
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;
|
|
21
|
-
};
|
|
22
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
-
value: true
|
|
24
|
-
}), mod);
|
|
25
|
-
var hmr_client_exports = {};
|
|
26
|
-
__export(hmr_client_exports, {
|
|
27
|
-
loadHMRClient: () => loadHMRClient
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(hmr_client_exports);
|
|
30
|
-
var import_getDevServerLocation = require("./getDevServerLocation.native.js");
|
|
31
|
-
function _class_call_check(instance, Constructor) {
|
|
32
|
-
if (!(instance instanceof Constructor)) {
|
|
33
|
-
throw new TypeError("Cannot call a class as a function");
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
function _defineProperties(target, props) {
|
|
37
|
-
for (var i = 0; i < props.length; i++) {
|
|
38
|
-
var descriptor = props[i];
|
|
39
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
40
|
-
descriptor.configurable = true;
|
|
41
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
42
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
46
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
47
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
48
|
-
return Constructor;
|
|
49
|
-
}
|
|
50
|
-
function _define_property(obj, key, value) {
|
|
51
|
-
if (key in obj) {
|
|
52
|
-
Object.defineProperty(obj, key, {
|
|
53
|
-
value,
|
|
54
|
-
enumerable: true,
|
|
55
|
-
configurable: true,
|
|
56
|
-
writable: true
|
|
57
|
-
});
|
|
58
|
-
} else {
|
|
59
|
-
obj[key] = value;
|
|
60
|
-
}
|
|
61
|
-
return obj;
|
|
62
|
-
}
|
|
63
|
-
var HMRClient = /* @__PURE__ */function () {
|
|
64
|
-
"use strict";
|
|
65
|
-
|
|
66
|
-
function HMRClient2(app) {
|
|
67
|
-
var _this = this;
|
|
68
|
-
_class_call_check(this, HMRClient2);
|
|
69
|
-
_define_property(this, "app", void 0);
|
|
70
|
-
_define_property(this, "url", void 0);
|
|
71
|
-
_define_property(this, "socket", void 0);
|
|
72
|
-
_define_property(this, "lastHash", void 0);
|
|
73
|
-
this.app = app;
|
|
74
|
-
this.lastHash = "";
|
|
75
|
-
var port = process.env.REACT_NATIVE_SERVER_PUBLIC_PORT || 8081;
|
|
76
|
-
this.url = `ws://${(0, import_getDevServerLocation.getDevServerLocation)().hostname}:${port}/__hmr?platform=${process.env.REACT_NATIVE_PLATFORM || "ios"}`;
|
|
77
|
-
this.socket = new WebSocket(this.url);
|
|
78
|
-
console.info(" \u24F5 [hmr] connecting...");
|
|
79
|
-
this.socket.onopen = function () {
|
|
80
|
-
console.info(" \u24F5 [hmr] connected");
|
|
81
|
-
};
|
|
82
|
-
this.socket.onclose = function () {
|
|
83
|
-
console.info(` \u24F5 [hmr] disconnected ${_this.url}`);
|
|
84
|
-
};
|
|
85
|
-
this.socket.onerror = function (event) {
|
|
86
|
-
console.error(" \u24F5 [hmr] error", event);
|
|
87
|
-
};
|
|
88
|
-
this.socket.onmessage = function (event) {
|
|
89
|
-
try {
|
|
90
|
-
var data = JSON.parse(event.data.toString());
|
|
91
|
-
_this.processMessage(data);
|
|
92
|
-
} catch (error) {
|
|
93
|
-
console.warn(" \u24F5 [hmr] invalid message", error);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
_create_class(HMRClient2, [{
|
|
98
|
-
key: "upToDate",
|
|
99
|
-
value: function upToDate(hash) {
|
|
100
|
-
if (hash) {
|
|
101
|
-
this.lastHash = hash;
|
|
102
|
-
}
|
|
103
|
-
return this.lastHash === __webpack_hash__;
|
|
104
|
-
}
|
|
105
|
-
}, {
|
|
106
|
-
key: "processMessage",
|
|
107
|
-
value: function processMessage(message) {
|
|
108
|
-
switch (message.action) {
|
|
109
|
-
case "building":
|
|
110
|
-
var _message_body;
|
|
111
|
-
this.app.LoadingView.showMessage("Rebuilding...", "refresh");
|
|
112
|
-
console.info(" \u24F5 [hmr] bundle rebuilding", {
|
|
113
|
-
name: (_message_body = message.body) === null || _message_body === void 0 ? void 0 : _message_body.name
|
|
114
|
-
});
|
|
115
|
-
break;
|
|
116
|
-
// biome-ignore lint/suspicious/noFallthroughSwitchClause: <explanation>
|
|
117
|
-
case "built":
|
|
118
|
-
var _message_body1, _message_body2;
|
|
119
|
-
console.info(" \u24F5 [hmr] bundle rebuilt", {
|
|
120
|
-
name: (_message_body1 = message.body) === null || _message_body1 === void 0 ? void 0 : _message_body1.name,
|
|
121
|
-
time: (_message_body2 = message.body) === null || _message_body2 === void 0 ? void 0 : _message_body2.time
|
|
122
|
-
});
|
|
123
|
-
// Fall through
|
|
124
|
-
case "sync":
|
|
125
|
-
var _message_body_errors, _message_body_warnings;
|
|
126
|
-
if (!message.body) {
|
|
127
|
-
console.warn(" \u24F5 [hmr] message body is empty");
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
if ((_message_body_errors = message.body.errors) === null || _message_body_errors === void 0 ? void 0 : _message_body_errors.length) {
|
|
131
|
-
message.body.errors.forEach(function (error) {
|
|
132
|
-
console.error("Cannot apply update due to error:", error);
|
|
133
|
-
});
|
|
134
|
-
this.app.LoadingView.hide();
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
if ((_message_body_warnings = message.body.warnings) === null || _message_body_warnings === void 0 ? void 0 : _message_body_warnings.length) {
|
|
138
|
-
message.body.warnings.forEach(function (warning) {
|
|
139
|
-
console.warn(" \u24F5 [hmr] bundle contains warnings:", warning);
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
this.applyUpdate(message.body);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}, {
|
|
146
|
-
key: "applyUpdate",
|
|
147
|
-
value: function applyUpdate(update) {
|
|
148
|
-
if (!module.hot) {
|
|
149
|
-
throw new Error(" \u24F5 [hmr] hot Module Replacement is disabled.");
|
|
150
|
-
}
|
|
151
|
-
if (!this.upToDate(update.hash) && module.hot.status() === "idle") {
|
|
152
|
-
console.info(" \u24F5 [hmr] checking for updates on the server...");
|
|
153
|
-
this.checkUpdates(update);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}, {
|
|
157
|
-
key: "checkUpdates",
|
|
158
|
-
value: function checkUpdates(update) {
|
|
159
|
-
var _this = this;
|
|
160
|
-
try {
|
|
161
|
-
var _module_hot;
|
|
162
|
-
this.app.LoadingView.showMessage("Refreshing...", "refresh");
|
|
163
|
-
(_module_hot = module.hot) === null || _module_hot === void 0 ? void 0 : _module_hot.check(false).then(function (updatedModules) {
|
|
164
|
-
var _module_hot3;
|
|
165
|
-
if (!updatedModules) {
|
|
166
|
-
console.warn(" \u24F5 [hmr] cannot find update - full reload needed");
|
|
167
|
-
_this.app.reload();
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
(_module_hot3 = module.hot) === null || _module_hot3 === void 0 ? void 0 : _module_hot3.apply({
|
|
171
|
-
ignoreDeclined: true,
|
|
172
|
-
ignoreUnaccepted: false,
|
|
173
|
-
ignoreErrored: false,
|
|
174
|
-
onDeclined: function (data) {
|
|
175
|
-
console.warn(" \u24F5 [hmr] ignored an update due to declined module", {
|
|
176
|
-
chain: data.chain
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
}).then(function (renewedModules) {
|
|
180
|
-
if (!_this.upToDate()) {
|
|
181
|
-
_this.checkUpdates(update);
|
|
182
|
-
}
|
|
183
|
-
var unacceptedModules = updatedModules.filter(function (moduleId) {
|
|
184
|
-
return renewedModules && renewedModules.indexOf(moduleId) < 0;
|
|
185
|
-
});
|
|
186
|
-
if (unacceptedModules.length) {
|
|
187
|
-
console.warn(" \u24F5 [hmr] not every module was accepted - full reload needed", {
|
|
188
|
-
unacceptedModules
|
|
189
|
-
});
|
|
190
|
-
_this.app.reload();
|
|
191
|
-
} else {
|
|
192
|
-
console.info(" \u24F5 [hmr] renewed modules - app is up to date", {
|
|
193
|
-
renewedModules
|
|
194
|
-
});
|
|
195
|
-
_this.app.dismissErrors();
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
|
-
} catch (error) {
|
|
200
|
-
var _module_hot1, _module_hot2;
|
|
201
|
-
if (((_module_hot1 = module.hot) === null || _module_hot1 === void 0 ? void 0 : _module_hot1.status()) === "fail" || ((_module_hot2 = module.hot) === null || _module_hot2 === void 0 ? void 0 : _module_hot2.status()) === "abort") {
|
|
202
|
-
console.warn(" \u24F5 [hmr] cannot check for update - full reload needed");
|
|
203
|
-
console.warn("[hmr]", error);
|
|
204
|
-
this.app.reload();
|
|
205
|
-
} else {
|
|
206
|
-
console.warn(" \u24F5 [hmr] update check failed", {
|
|
207
|
-
error
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
} finally {
|
|
211
|
-
this.app.LoadingView.hide();
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}]);
|
|
215
|
-
return HMRClient2;
|
|
216
|
-
}();
|
|
217
|
-
var loadHMRClient = function () {
|
|
218
|
-
var {
|
|
219
|
-
DevSettings,
|
|
220
|
-
Platform
|
|
221
|
-
} = require("react-native");
|
|
222
|
-
var LoadingView = {
|
|
223
|
-
showMessage: function () {},
|
|
224
|
-
hide: function () {}
|
|
225
|
-
};
|
|
226
|
-
var reload = function () {
|
|
227
|
-
return DevSettings.reload();
|
|
228
|
-
};
|
|
229
|
-
var dismissErrors = function () {
|
|
230
|
-
if (Platform.OS === "ios") {
|
|
231
|
-
var _NativeRedBox_dismiss;
|
|
232
|
-
var NativeRedBox = require("react-native/Libraries/NativeModules/specs/NativeRedBox").default;
|
|
233
|
-
NativeRedBox === null || NativeRedBox === void 0 ? void 0 : (_NativeRedBox_dismiss = NativeRedBox.dismiss) === null || _NativeRedBox_dismiss === void 0 ? void 0 : _NativeRedBox_dismiss.call(NativeRedBox);
|
|
234
|
-
} else {
|
|
235
|
-
var NativeExceptionsManager = require("react-native/Libraries/Core/NativeExceptionsManager").default;
|
|
236
|
-
NativeExceptionsManager === null || NativeExceptionsManager === void 0 ? void 0 : NativeExceptionsManager.dismissRedbox();
|
|
237
|
-
}
|
|
238
|
-
var LogBoxData = require("react-native/Libraries/LogBox/Data/LogBoxData");
|
|
239
|
-
LogBoxData.clear();
|
|
240
|
-
};
|
|
241
|
-
new HMRClient({
|
|
242
|
-
reload,
|
|
243
|
-
dismissErrors,
|
|
244
|
-
LoadingView
|
|
245
|
-
});
|
|
246
|
-
};
|
|
247
|
-
//# sourceMappingURL=hmr-client.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","hmr_client_exports","loadHMRClient","module","exports","import_getDevServerLocation","require","_class_call_check","instance","Constructor","TypeError","_defineProperties","props","i","length","descriptor","configurable","writable","_create_class","protoProps","staticProps","_define_property","obj","HMRClient","HMRClient2","app","_this","lastHash","port","process","env","REACT_NATIVE_SERVER_PUBLIC_PORT","url","getDevServerLocation","hostname","REACT_NATIVE_PLATFORM","socket","WebSocket","console","info","onopen","onclose","onerror","event","error","onmessage","data","JSON","parse","toString","processMessage","warn","upToDate","hash","__webpack_hash__","message","action","_message_body","LoadingView","showMessage","body","_message_body1","_message_body2","time","_message_body_errors","_message_body_warnings","errors","forEach","hide","warnings","warning","applyUpdate","update","hot","Error","status","checkUpdates","_module_hot","check","then","updatedModules","_module_hot3","reload","apply","ignoreDeclined","ignoreUnaccepted","ignoreErrored","onDeclined","chain","renewedModules","unacceptedModules","filter","moduleId","indexOf","dismissErrors","_module_hot1","_module_hot2","DevSettings","Platform","OS","_NativeRedBox_dismiss","NativeRedBox","default","dismiss","NativeExceptionsManager","dismissRedbox","LogBoxData","clear"],"sources":["hmr-client.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\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 __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar hmr_client_exports = {};\n__export(hmr_client_exports, {\n loadHMRClient: () => loadHMRClient\n});\nmodule.exports = __toCommonJS(hmr_client_exports);\nvar import_getDevServerLocation = require(\"./getDevServerLocation\");\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}\nvar HMRClient = /* @__PURE__ */ (function() {\n \"use strict\";\n function HMRClient2(app) {\n var _this = this;\n _class_call_check(this, HMRClient2);\n _define_property(this, \"app\", void 0);\n _define_property(this, \"url\", void 0);\n _define_property(this, \"socket\", void 0);\n _define_property(this, \"lastHash\", void 0);\n this.app = app;\n this.lastHash = \"\";\n var port = process.env.REACT_NATIVE_SERVER_PUBLIC_PORT || 8081;\n this.url = `ws://${(0, import_getDevServerLocation.getDevServerLocation)().hostname}:${port}/__hmr?platform=${process.env.REACT_NATIVE_PLATFORM || \"ios\"}`;\n this.socket = new WebSocket(this.url);\n console.info(\" \\u24F5 [hmr] connecting...\");\n this.socket.onopen = function() {\n console.info(\" \\u24F5 [hmr] connected\");\n };\n this.socket.onclose = function() {\n console.info(` \\u24F5 [hmr] disconnected ${_this.url}`);\n };\n this.socket.onerror = function(event) {\n console.error(\" \\u24F5 [hmr] error\", event);\n };\n this.socket.onmessage = function(event) {\n try {\n var data = JSON.parse(event.data.toString());\n _this.processMessage(data);\n } catch (error) {\n console.warn(\" \\u24F5 [hmr] invalid message\", error);\n }\n };\n }\n _create_class(HMRClient2, [\n {\n key: \"upToDate\",\n value: function upToDate(hash) {\n if (hash) {\n this.lastHash = hash;\n }\n return this.lastHash === __webpack_hash__;\n }\n },\n {\n key: \"processMessage\",\n value: function processMessage(message) {\n switch (message.action) {\n case \"building\":\n var _message_body;\n this.app.LoadingView.showMessage(\"Rebuilding...\", \"refresh\");\n console.info(\" \\u24F5 [hmr] bundle rebuilding\", {\n name: (_message_body = message.body) === null || _message_body === void 0 ? void 0 : _message_body.name\n });\n break;\n // biome-ignore lint/suspicious/noFallthroughSwitchClause: <explanation>\n case \"built\":\n var _message_body1, _message_body2;\n console.info(\" \\u24F5 [hmr] bundle rebuilt\", {\n name: (_message_body1 = message.body) === null || _message_body1 === void 0 ? void 0 : _message_body1.name,\n time: (_message_body2 = message.body) === null || _message_body2 === void 0 ? void 0 : _message_body2.time\n });\n // Fall through\n case \"sync\":\n var _message_body_errors, _message_body_warnings;\n if (!message.body) {\n console.warn(\" \\u24F5 [hmr] message body is empty\");\n return;\n }\n if ((_message_body_errors = message.body.errors) === null || _message_body_errors === void 0 ? void 0 : _message_body_errors.length) {\n message.body.errors.forEach(function(error) {\n console.error(\"Cannot apply update due to error:\", error);\n });\n this.app.LoadingView.hide();\n return;\n }\n if ((_message_body_warnings = message.body.warnings) === null || _message_body_warnings === void 0 ? void 0 : _message_body_warnings.length) {\n message.body.warnings.forEach(function(warning) {\n console.warn(\" \\u24F5 [hmr] bundle contains warnings:\", warning);\n });\n }\n this.applyUpdate(message.body);\n }\n }\n },\n {\n key: \"applyUpdate\",\n value: function applyUpdate(update) {\n if (!module.hot) {\n throw new Error(\" \\u24F5 [hmr] hot Module Replacement is disabled.\");\n }\n if (!this.upToDate(update.hash) && module.hot.status() === \"idle\") {\n console.info(\" \\u24F5 [hmr] checking for updates on the server...\");\n this.checkUpdates(update);\n }\n }\n },\n {\n key: \"checkUpdates\",\n value: function checkUpdates(update) {\n var _this = this;\n try {\n var _module_hot;\n this.app.LoadingView.showMessage(\"Refreshing...\", \"refresh\");\n (_module_hot = module.hot) === null || _module_hot === void 0 ? void 0 : _module_hot.check(false).then(function(updatedModules) {\n var _module_hot3;\n if (!updatedModules) {\n console.warn(\" \\u24F5 [hmr] cannot find update - full reload needed\");\n _this.app.reload();\n return;\n }\n (_module_hot3 = module.hot) === null || _module_hot3 === void 0 ? void 0 : _module_hot3.apply({\n ignoreDeclined: true,\n ignoreUnaccepted: false,\n ignoreErrored: false,\n onDeclined: function(data) {\n console.warn(\" \\u24F5 [hmr] ignored an update due to declined module\", {\n chain: data.chain\n });\n }\n }).then(function(renewedModules) {\n if (!_this.upToDate()) {\n _this.checkUpdates(update);\n }\n var unacceptedModules = updatedModules.filter(function(moduleId) {\n return renewedModules && renewedModules.indexOf(moduleId) < 0;\n });\n if (unacceptedModules.length) {\n console.warn(\" \\u24F5 [hmr] not every module was accepted - full reload needed\", {\n unacceptedModules\n });\n _this.app.reload();\n } else {\n console.info(\" \\u24F5 [hmr] renewed modules - app is up to date\", {\n renewedModules\n });\n _this.app.dismissErrors();\n }\n });\n });\n } catch (error) {\n var _module_hot1, _module_hot2;\n if (((_module_hot1 = module.hot) === null || _module_hot1 === void 0 ? void 0 : _module_hot1.status()) === \"fail\" || ((_module_hot2 = module.hot) === null || _module_hot2 === void 0 ? void 0 : _module_hot2.status()) === \"abort\") {\n console.warn(\" \\u24F5 [hmr] cannot check for update - full reload needed\");\n console.warn(\"[hmr]\", error);\n this.app.reload();\n } else {\n console.warn(\" \\u24F5 [hmr] update check failed\", {\n error\n });\n }\n } finally {\n this.app.LoadingView.hide();\n }\n }\n }\n ]);\n return HMRClient2;\n})();\nvar loadHMRClient = function() {\n var { DevSettings, Platform } = require(\"react-native\");\n var LoadingView = {\n showMessage: function() {\n },\n hide: function() {\n }\n };\n var reload = function() {\n return DevSettings.reload();\n };\n var dismissErrors = function() {\n if (Platform.OS === \"ios\") {\n var _NativeRedBox_dismiss;\n var NativeRedBox = require(\"react-native/Libraries/NativeModules/specs/NativeRedBox\").default;\n NativeRedBox === null || NativeRedBox === void 0 ? void 0 : (_NativeRedBox_dismiss = NativeRedBox.dismiss) === null || _NativeRedBox_dismiss === void 0 ? void 0 : _NativeRedBox_dismiss.call(NativeRedBox);\n } else {\n var NativeExceptionsManager = require(\"react-native/Libraries/Core/NativeExceptionsManager\").default;\n NativeExceptionsManager === null || NativeExceptionsManager === void 0 ? void 0 : NativeExceptionsManager.dismissRedbox();\n }\n var LogBoxData = require(\"react-native/Libraries/LogBox/Data/LogBoxData\");\n LogBoxData.clear();\n };\n new HMRClient({\n reload,\n dismissErrors,\n LoadingView\n });\n};\n//# sourceMappingURL=hmr-client.js.map\n"],"mappings":"AAAA,YAAY;;AACZ,IAAIA,SAAS,GAAGC,MAAM,CAACC,cAAc;AACrC,IAAIC,gBAAgB,GAAGF,MAAM,CAACG,wBAAwB;AACtD,IAAIC,iBAAiB,GAAGJ,MAAM,CAACK,mBAAmB;AAClD,IAAIC,YAAY,GAAGN,MAAM,CAACO,SAAS,CAACC,cAAc;AAClD,IAAIC,QAAQ,GAAGA,CAACC,MAAM,EAAEC,GAAG,KAAK;EAC9B,KAAK,IAAIC,IAAI,IAAID,GAAG,EAClBZ,SAAS,CAACW,MAAM,EAAEE,IAAI,EAAE;IAAEC,GAAG,EAAEF,GAAG,CAACC,IAAI,CAAC;IAAEE,UAAU,EAAE;EAAK,CAAC,CAAC;AACjE,CAAC;AACD,IAAIC,WAAW,GAAGA,CAACC,EAAE,EAAEC,IAAI,EAAEC,MAAM,EAAEC,IAAI,KAAK;EAC5C,IAAIF,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,IAAI,OAAOA,IAAI,KAAK,UAAU,EAAE;IAClE,KAAK,IAAIG,GAAG,IAAIhB,iBAAiB,CAACa,IAAI,CAAC,EACrC,IAAI,CAACX,YAAY,CAACe,IAAI,CAACL,EAAE,EAAEI,GAAG,CAAC,IAAIA,GAAG,KAAKF,MAAM,EAC/CnB,SAAS,CAACiB,EAAE,EAAEI,GAAG,EAAE;MAAEP,GAAG,EAAE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,GAAG,SAAAA,CAAA,EAAW;IACtB,OAAOe,WAAW,CAACf,MAAM,CAAC,CAAC;EAC7B,CAAC;EACD,IAAIY,aAAa,GAAG,SAAAA,CAAA,EAAW;IAC7B,IAAII,QAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;MACzB,IAAIC,qBAAqB;MACzB,IAAIC,YAAY,GAAG/F,OAAO,CAAC,yDAAyD,CAAC,CAACgG,OAAO;MAC7FD,YAAY,KAAK,IAAI,IAAIA,YAAY,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,CAACD,qBAAqB,GAAGC,YAAY,CAACE,OAAO,MAAM,IAAI,IAAIH,qBAAqB,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,qBAAqB,CAACvG,IAAI,CAACwG,YAAY,CAAC;IAC7M,CAAC,MAAM;MACL,IAAIG,uBAAuB,GAAGlG,OAAO,CAAC,qDAAqD,CAAC,CAACgG,OAAO;MACpGE,uBAAuB,KAAK,IAAI,IAAIA,uBAAuB,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,uBAAuB,CAACC,aAAa,CAAC,CAAC;IAC3H;IACA,IAAIC,UAAU,GAAGpG,OAAO,CAAC,+CAA+C,CAAC;IACzEoG,UAAU,CAACC,KAAK,CAAC,CAAC;EACpB,CAAC;EACD,IAAIpF,SAAS,CAAC;IACZ2D,MAAM;IACNY,aAAa;IACbpC;EACF,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
package/dist/cjs/index.cjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all) __defProp(target, name, {
|
|
7
|
-
get: all[name],
|
|
8
|
-
enumerable: true
|
|
9
|
-
});
|
|
10
|
-
};
|
|
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;
|
|
19
|
-
};
|
|
20
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
22
|
-
value: true
|
|
23
|
-
}), mod);
|
|
24
|
-
var index_exports = {};
|
|
25
|
-
__export(index_exports, {
|
|
26
|
-
default: () => index_default
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(index_exports);
|
|
29
|
-
__reExport(index_exports, require("./devServerClient.cjs"), module.exports);
|
|
30
|
-
var import_devServerClient = require("./devServerClient.cjs");
|
|
31
|
-
var index_default = import_devServerClient.client;
|
package/dist/cjs/index.native.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all) __defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: true
|
|
11
|
-
});
|
|
12
|
-
};
|
|
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;
|
|
21
|
-
};
|
|
22
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
23
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
24
|
-
value: true
|
|
25
|
-
}), mod);
|
|
26
|
-
var index_exports = {};
|
|
27
|
-
__export(index_exports, {
|
|
28
|
-
default: () => index_default
|
|
29
|
-
});
|
|
30
|
-
module.exports = __toCommonJS(index_exports);
|
|
31
|
-
__reExport(index_exports, require("./devServerClient.native.js"), module.exports);
|
|
32
|
-
var import_devServerClient = require("./devServerClient.native.js");
|
|
33
|
-
var index_default = import_devServerClient.client;
|
|
34
|
-
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__reExport","mod","secondTarget","__toCommonJS","value","index_exports","default","index_default","module","exports","require","import_devServerClient","client"],"sources":["index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\n__export(index_exports, {\n default: () => index_default\n});\nmodule.exports = __toCommonJS(index_exports);\n__reExport(index_exports, require(\"./devServerClient\"), module.exports);\nvar import_devServerClient = require(\"./devServerClient\");\nvar index_default = import_devServerClient.client;\n//# sourceMappingURL=index.js.map\n"],"mappings":"AAAA,YAAY;;AACZ,IAAIA,SAAS,GAAGC,MAAM,CAACC,cAAc;AACrC,IAAIC,gBAAgB,GAAGF,MAAM,CAACG,wBAAwB;AACtD,IAAIC,iBAAiB,GAAGJ,MAAM,CAACK,mBAAmB;AAClD,IAAIC,YAAY,GAAGN,MAAM,CAACO,SAAS,CAACC,cAAc;AAClD,IAAIC,QAAQ,GAAGA,CAACC,MAAM,EAAEC,GAAG,KAAK;EAC9B,KAAK,IAAIC,IAAI,IAAID,GAAG,EAClBZ,SAAS,CAACW,MAAM,EAAEE,IAAI,EAAE;IAAEC,GAAG,EAAEF,GAAG,CAACC,IAAI,CAAC;IAAEE,UAAU,EAAE;EAAK,CAAC,CAAC;AACjE,CAAC;AACD,IAAIC,WAAW,GAAGA,CAACC,EAAE,EAAEC,IAAI,EAAEC,MAAM,EAAEC,IAAI,KAAK;EAC5C,IAAIF,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,IAAI,OAAOA,IAAI,KAAK,UAAU,EAAE;IAClE,KAAK,IAAIG,GAAG,IAAIhB,iBAAiB,CAACa,IAAI,CAAC,EACrC,IAAI,CAACX,YAAY,CAACe,IAAI,CAACL,EAAE,EAAEI,GAAG,CAAC,IAAIA,GAAG,KAAKF,MAAM,EAC/CnB,SAAS,CAACiB,EAAE,EAAEI,GAAG,EAAE;MAAEP,GAAG,EAAEA,CAAA,KAAMI,IAAI,CAACG,GAAG,CAAC;MAAEN,UAAU,EAAE,EAAEK,IAAI,GAAGjB,gBAAgB,CAACe,IAAI,EAAEG,GAAG,CAAC,CAAC,IAAID,IAAI,CAACL;IAAW,CAAC,CAAC;EACxH;EACA,OAAOE,EAAE;AACX,CAAC;AACD,IAAIM,UAAU,GAAGA,CAACZ,MAAM,EAAEa,GAAG,EAAEC,YAAY,MAAMT,WAAW,CAACL,MAAM,EAAEa,GAAG,EAAE,SAAS,CAAC,EAAEC,YAAY,IAAIT,WAAW,CAACS,YAAY,EAAED,GAAG,EAAE,SAAS,CAAC,CAAC;AAChJ,IAAIE,YAAY,GAAIF,GAAG,IAAKR,WAAW,CAAChB,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE;EAAE2B,KAAK,EAAE;AAAK,CAAC,CAAC,EAAEH,GAAG,CAAC;AAC1F,IAAII,aAAa,GAAG,CAAC,CAAC;AACtBlB,QAAQ,CAACkB,aAAa,EAAE;EACtBC,OAAO,EAAEA,CAAA,KAAMC;AACjB,CAAC,CAAC;AACFC,MAAM,CAACC,OAAO,GAAGN,YAAY,CAACE,aAAa,CAAC;AAC5CL,UAAU,CAACK,aAAa,EAAEK,OAAO,CAAC,6BAAmB,CAAC,EAAEF,MAAM,CAACC,OAAO,CAAC;AACvE,IAAIE,sBAAsB,GAAGD,OAAO,CAAC,6BAAmB,CAAC;AACzD,IAAIH,aAAa,GAAGI,sBAAsB,CAACC,MAAM","ignoreList":[]}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import prettyFormat from "pretty-format";
|
|
2
|
-
import { getDevServerLocation } from "./getDevServerLocation.mjs";
|
|
3
|
-
import { loadHMRClient } from "./hmr-client.mjs";
|
|
4
|
-
loadHMRClient();
|
|
5
|
-
class DevServerClient {
|
|
6
|
-
socket;
|
|
7
|
-
buffer = [];
|
|
8
|
-
constructor() {
|
|
9
|
-
const initSocket = () => {
|
|
10
|
-
const address = `ws://${getDevServerLocation().host}/__client`;
|
|
11
|
-
this.socket = new WebSocket(address);
|
|
12
|
-
const onClose = event => {
|
|
13
|
-
console.warn("Disconnected from the Dev Server:", event.message);
|
|
14
|
-
this.socket = void 0;
|
|
15
|
-
};
|
|
16
|
-
this.socket.onclose = onClose;
|
|
17
|
-
this.socket.onerror = onClose;
|
|
18
|
-
this.socket.onopen = () => {
|
|
19
|
-
this.flushBuffer();
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
if (process.env.NODE_ENV === "development") {
|
|
23
|
-
initSocket();
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
send(level, data) {
|
|
27
|
-
try {
|
|
28
|
-
this.socket?.send(JSON.stringify({
|
|
29
|
-
type: "client-log",
|
|
30
|
-
level,
|
|
31
|
-
data: data.map(item => typeof item === "string" ? item : prettyFormat(item, {
|
|
32
|
-
escapeString: true,
|
|
33
|
-
highlight: true,
|
|
34
|
-
maxDepth: 3,
|
|
35
|
-
min: true,
|
|
36
|
-
plugins: [
|
|
37
|
-
// @ts-expect-error
|
|
38
|
-
prettyFormat.plugins.ReactElement]
|
|
39
|
-
}))
|
|
40
|
-
}));
|
|
41
|
-
} catch {
|
|
42
|
-
try {
|
|
43
|
-
this.socket?.send(JSON.stringify({
|
|
44
|
-
type: "client-log",
|
|
45
|
-
level,
|
|
46
|
-
data: data.map((item, index) => {
|
|
47
|
-
try {
|
|
48
|
-
return typeof item === "string" ? item : JSON.stringify(item);
|
|
49
|
-
} catch (err) {
|
|
50
|
-
return `Error stringifying item at index ${index} - ${item} - ${err}`;
|
|
51
|
-
}
|
|
52
|
-
})
|
|
53
|
-
}));
|
|
54
|
-
} catch (err) {
|
|
55
|
-
try {
|
|
56
|
-
this.socket?.send(JSON.stringify({
|
|
57
|
-
type: "client-log",
|
|
58
|
-
level: "error",
|
|
59
|
-
data: ["error sending client log: " + err]
|
|
60
|
-
}));
|
|
61
|
-
} catch {}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
flushBuffer() {
|
|
66
|
-
if (globalThis["__vxrnTmpLogs"]) {
|
|
67
|
-
globalThis["__vxrnTmpLogs"].forEach(({
|
|
68
|
-
level,
|
|
69
|
-
data
|
|
70
|
-
}) => {
|
|
71
|
-
this.buffer.push({
|
|
72
|
-
level,
|
|
73
|
-
data
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
delete globalThis["__vxrnTmpLogs"];
|
|
77
|
-
}
|
|
78
|
-
for (const {
|
|
79
|
-
level,
|
|
80
|
-
data
|
|
81
|
-
} of this.buffer) {
|
|
82
|
-
this.send(level, data);
|
|
83
|
-
}
|
|
84
|
-
this.buffer = [];
|
|
85
|
-
}
|
|
86
|
-
log(level, data) {
|
|
87
|
-
if (level === "groupEnd") {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
if (this.socket && this.socket.readyState === WebSocket.OPEN) {
|
|
91
|
-
this.flushBuffer();
|
|
92
|
-
this.send(level, data);
|
|
93
|
-
} else {
|
|
94
|
-
if (globalThis["__vxrnTmpLogs"]) return;
|
|
95
|
-
this.buffer.push({
|
|
96
|
-
level,
|
|
97
|
-
data
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
// Mock for React Native 0.79 to prevent native error "getPropertyAsObject: property 'setup' is undefined, expected an Object"
|
|
102
|
-
setup() {}
|
|
103
|
-
}
|
|
104
|
-
const client = new DevServerClient();
|
|
105
|
-
const setup = () => {};
|
|
106
|
-
const enable = () => {};
|
|
107
|
-
const disable = () => {};
|
|
108
|
-
const registerBundle = () => {};
|
|
109
|
-
const log = (level, data) => {
|
|
110
|
-
client.log(level, data);
|
|
111
|
-
};
|
|
112
|
-
export { client, disable, enable, log, registerBundle, setup };
|
|
113
|
-
//# sourceMappingURL=devServerClient.mjs.map
|