rollipop 0.1.0-alpha.12 → 0.1.0-alpha.13
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/CHANGELOG.md +7 -0
- package/dist/{chunk-Dj-qOoLf.js → chunk-D0rfrjR5.js} +4 -5
- package/dist/commands.cjs +261 -1649
- package/dist/commands.js +253 -1642
- package/dist/hmr-client.js +137 -133
- package/dist/hmr-runtime.d.ts +1 -1
- package/dist/hmr-runtime.js +195 -187
- package/dist/index.d.ts +8 -27
- package/dist/index.js +341 -1740
- package/dist/pluginutils.d.ts +4 -21
- package/dist/pluginutils.js +7 -7
- package/dist/runtime.cjs +1 -0
- package/package.json +27 -33
- package/dist/pluginutils.cjs +0 -210
- package/dist/pluginutils.d.cts +0 -660
package/dist/hmr-client.js
CHANGED
|
@@ -4,83 +4,87 @@ import d from "../NativeModules/specs/NativeRedBox";
|
|
|
4
4
|
import h from "./DevLoadingView";
|
|
5
5
|
import f from "./Platform";
|
|
6
6
|
|
|
7
|
-
//#region
|
|
8
|
-
var __require =
|
|
7
|
+
//#region \0rolldown/runtime.js
|
|
8
|
+
var __require = function(e) {
|
|
9
|
+
return typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(e, { get: function(e, r) {
|
|
10
|
+
return (typeof require !== "undefined" ? require : e)[r];
|
|
11
|
+
} }) : e;
|
|
12
|
+
}(function(e) {
|
|
9
13
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
10
|
-
throw Error("Calling `require` for \"" +
|
|
14
|
+
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
11
15
|
});
|
|
12
16
|
|
|
13
17
|
//#endregion
|
|
14
18
|
//#region src/runtime/hmr-client.ts
|
|
15
|
-
function e(e
|
|
16
|
-
if (t
|
|
17
|
-
for (var n
|
|
18
|
-
return r
|
|
19
|
+
function e(e, t) {
|
|
20
|
+
if (t == null || t > e.length) t = e.length;
|
|
21
|
+
for (var n = 0, r = new Array(t); n < t; n++) r[n] = e[n];
|
|
22
|
+
return r;
|
|
19
23
|
}
|
|
20
|
-
function t(e
|
|
21
|
-
if (Array.isArray(e
|
|
24
|
+
function t(e) {
|
|
25
|
+
if (Array.isArray(e)) return e;
|
|
22
26
|
}
|
|
23
|
-
function n(e
|
|
24
|
-
if (!(e
|
|
27
|
+
function n(e, t) {
|
|
28
|
+
if (!(e instanceof t)) {
|
|
25
29
|
throw new TypeError("Cannot call a class as a function");
|
|
26
30
|
}
|
|
27
31
|
}
|
|
28
|
-
function r(e
|
|
29
|
-
for (var n
|
|
30
|
-
var r
|
|
31
|
-
r
|
|
32
|
-
r
|
|
33
|
-
if ("value" in r
|
|
34
|
-
Object.defineProperty(e
|
|
32
|
+
function r(e, t) {
|
|
33
|
+
for (var n = 0; n < t.length; n++) {
|
|
34
|
+
var r = t[n];
|
|
35
|
+
r.enumerable = r.enumerable || false;
|
|
36
|
+
r.configurable = true;
|
|
37
|
+
if ("value" in r) r.writable = true;
|
|
38
|
+
Object.defineProperty(e, r.key, r);
|
|
35
39
|
}
|
|
36
40
|
}
|
|
37
|
-
function o(e
|
|
38
|
-
if (t
|
|
39
|
-
if (n
|
|
40
|
-
return e
|
|
41
|
+
function o(e, t, n) {
|
|
42
|
+
if (t) r(e.prototype, t);
|
|
43
|
+
if (n) r(e, n);
|
|
44
|
+
return e;
|
|
41
45
|
}
|
|
42
|
-
function i(e
|
|
43
|
-
var n
|
|
44
|
-
if (n
|
|
45
|
-
var r
|
|
46
|
-
var o
|
|
47
|
-
var i
|
|
48
|
-
var a
|
|
46
|
+
function i(e, t) {
|
|
47
|
+
var n = e == null ? null : typeof Symbol !== "undefined" && e[Symbol.iterator] || e["@@iterator"];
|
|
48
|
+
if (n == null) return;
|
|
49
|
+
var r = [];
|
|
50
|
+
var o = true;
|
|
51
|
+
var i = false;
|
|
52
|
+
var a, s;
|
|
49
53
|
try {
|
|
50
|
-
for (n
|
|
51
|
-
r
|
|
52
|
-
if (t
|
|
54
|
+
for (n = n.call(e); !(o = (a = n.next()).done); o = true) {
|
|
55
|
+
r.push(a.value);
|
|
56
|
+
if (t && r.length === t) break;
|
|
53
57
|
}
|
|
54
|
-
} catch (e
|
|
55
|
-
i
|
|
56
|
-
s
|
|
58
|
+
} catch (e) {
|
|
59
|
+
i = true;
|
|
60
|
+
s = e;
|
|
57
61
|
} finally {
|
|
58
62
|
try {
|
|
59
|
-
if (!o
|
|
63
|
+
if (!o && n["return"] != null) n["return"]();
|
|
60
64
|
} finally {
|
|
61
|
-
if (i
|
|
65
|
+
if (i) throw s;
|
|
62
66
|
}
|
|
63
67
|
}
|
|
64
|
-
return r
|
|
68
|
+
return r;
|
|
65
69
|
}
|
|
66
70
|
function a() {
|
|
67
71
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
68
72
|
}
|
|
69
|
-
function s(e
|
|
70
|
-
return t(e
|
|
73
|
+
function s(e, n) {
|
|
74
|
+
return t(e) || i(e, n) || l(e, n) || a();
|
|
71
75
|
}
|
|
72
|
-
function l(t
|
|
73
|
-
if (!t
|
|
74
|
-
if (typeof t
|
|
75
|
-
var r
|
|
76
|
-
if (r
|
|
77
|
-
if (r
|
|
78
|
-
if (r
|
|
76
|
+
function l(t, n) {
|
|
77
|
+
if (!t) return;
|
|
78
|
+
if (typeof t === "string") return e(t, n);
|
|
79
|
+
var r = Object.prototype.toString.call(t).slice(8, -1);
|
|
80
|
+
if (r === "Object" && t.constructor) r = t.constructor.name;
|
|
81
|
+
if (r === "Map" || r === "Set") return Array.from(r);
|
|
82
|
+
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return e(t, n);
|
|
79
83
|
}
|
|
80
84
|
var p = /* @__PURE__ */ function() {
|
|
81
85
|
"use strict";
|
|
82
|
-
function e
|
|
83
|
-
n(this, e
|
|
86
|
+
function e() {
|
|
87
|
+
n(this, e);
|
|
84
88
|
this.enabled = true;
|
|
85
89
|
this._socketHolder = null;
|
|
86
90
|
this.unavailableMessage = null;
|
|
@@ -88,15 +92,15 @@ var p = /* @__PURE__ */ function() {
|
|
|
88
92
|
this.pendingUpdatesCount = 0;
|
|
89
93
|
this.pendingLogs = [];
|
|
90
94
|
}
|
|
91
|
-
o(e
|
|
95
|
+
o(e, [
|
|
92
96
|
{
|
|
93
97
|
key: "enable",
|
|
94
|
-
value: function t
|
|
98
|
+
value: function t() {
|
|
95
99
|
if (this.unavailableMessage) {
|
|
96
100
|
throw new Error(this.unavailableMessage);
|
|
97
101
|
}
|
|
98
102
|
if (this._socketHolder == null) {
|
|
99
|
-
throw new Error(e
|
|
103
|
+
throw new Error(e.STARTUP_ERROR);
|
|
100
104
|
}
|
|
101
105
|
this.enabled = true;
|
|
102
106
|
this.showCompileErrorIfNeeded();
|
|
@@ -104,35 +108,35 @@ var p = /* @__PURE__ */ function() {
|
|
|
104
108
|
},
|
|
105
109
|
{
|
|
106
110
|
key: "disable",
|
|
107
|
-
value: function e
|
|
111
|
+
value: function e() {
|
|
108
112
|
this.enabled = false;
|
|
109
113
|
}
|
|
110
114
|
},
|
|
111
115
|
{
|
|
112
116
|
key: "registerBundle",
|
|
113
|
-
value: function t
|
|
117
|
+
value: function t(t) {
|
|
114
118
|
if (this._socketHolder == null) {
|
|
115
|
-
throw new Error(e
|
|
119
|
+
throw new Error(e.STARTUP_ERROR);
|
|
116
120
|
}
|
|
117
|
-
if (!t
|
|
118
|
-
console.warn("[HMR]: Cannot register bundle from unknown origin:\n".concat(t
|
|
121
|
+
if (!t.startsWith(this._socketHolder.origin)) {
|
|
122
|
+
console.warn("[HMR]: Cannot register bundle from unknown origin:\n".concat(t, "\n") + "(expected: ".concat(this._socketHolder.origin, ")"));
|
|
119
123
|
return;
|
|
120
124
|
}
|
|
121
125
|
}
|
|
122
126
|
},
|
|
123
127
|
{
|
|
124
128
|
key: "log",
|
|
125
|
-
value: function t
|
|
129
|
+
value: function t(t, n) {
|
|
126
130
|
if (this._socketHolder == null) {
|
|
127
|
-
this.pendingLogs.push([t
|
|
128
|
-
if (this.pendingLogs.length > e
|
|
131
|
+
this.pendingLogs.push([t, n]);
|
|
132
|
+
if (this.pendingLogs.length > e.MAX_PENDING_LOGS) {
|
|
129
133
|
this.pendingLogs.shift();
|
|
130
134
|
}
|
|
131
135
|
return;
|
|
132
136
|
}
|
|
133
137
|
try {
|
|
134
|
-
var r
|
|
135
|
-
return typeof e
|
|
138
|
+
var r = n.map(function(e) {
|
|
139
|
+
return typeof e === "string" ? e : u.format(e, {
|
|
136
140
|
escapeString: true,
|
|
137
141
|
highlight: true,
|
|
138
142
|
maxDepth: 3,
|
|
@@ -142,100 +146,100 @@ var p = /* @__PURE__ */ function() {
|
|
|
142
146
|
});
|
|
143
147
|
this.send({
|
|
144
148
|
type: "hmr:log",
|
|
145
|
-
level: t
|
|
146
|
-
data: r
|
|
149
|
+
level: t,
|
|
150
|
+
data: r
|
|
147
151
|
});
|
|
148
|
-
} catch (e
|
|
152
|
+
} catch (e) {}
|
|
149
153
|
}
|
|
150
154
|
},
|
|
151
155
|
{
|
|
152
156
|
key: "setup",
|
|
153
|
-
value: function e
|
|
154
|
-
var o
|
|
155
|
-
var i
|
|
157
|
+
value: function e(e, t, n, r) {
|
|
158
|
+
var o = this;
|
|
159
|
+
var i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true, a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : "http";
|
|
156
160
|
if (!__DEV__) {
|
|
157
161
|
throw new Error("HMR is only available in development mode");
|
|
158
162
|
}
|
|
159
163
|
if (this._socketHolder != null) {
|
|
160
164
|
throw new Error("Cannot initialize HMRClient more than once");
|
|
161
165
|
}
|
|
162
|
-
if (e
|
|
166
|
+
if (e == null) {
|
|
163
167
|
throw new Error("Missing required parameter `platform`");
|
|
164
168
|
}
|
|
165
|
-
if (t
|
|
169
|
+
if (t == null) {
|
|
166
170
|
throw new Error("Missing required parameter `bundleEntry`");
|
|
167
171
|
}
|
|
168
|
-
if (n
|
|
172
|
+
if (n == null) {
|
|
169
173
|
throw new Error("Missing required parameter `host`");
|
|
170
174
|
}
|
|
171
|
-
var s
|
|
172
|
-
var l
|
|
173
|
-
var u
|
|
175
|
+
var s = r !== null && r !== "" ? "".concat(n, ":").concat(r) : n;
|
|
176
|
+
var l = "".concat(a, "://").concat(s);
|
|
177
|
+
var u = new __ROLLIPOP_GLOBAL__.WebSocket("".concat(l, "/hot"));
|
|
174
178
|
this._socketHolder = {
|
|
175
|
-
socket: u
|
|
176
|
-
origin: l
|
|
179
|
+
socket: u,
|
|
180
|
+
origin: l
|
|
177
181
|
};
|
|
178
|
-
u
|
|
179
|
-
u
|
|
182
|
+
u.addEventListener("open", function() {
|
|
183
|
+
u.send(JSON.stringify({
|
|
180
184
|
type: "hmr:connected",
|
|
181
|
-
bundleEntry: t
|
|
182
|
-
platform: e
|
|
185
|
+
bundleEntry: t,
|
|
186
|
+
platform: e
|
|
183
187
|
}));
|
|
184
|
-
o
|
|
188
|
+
o.handleConnection();
|
|
185
189
|
});
|
|
186
|
-
u
|
|
187
|
-
o
|
|
190
|
+
u.addEventListener("error", function(e) {
|
|
191
|
+
o.handleConnectionError(e.error, l);
|
|
188
192
|
});
|
|
189
|
-
u
|
|
190
|
-
o
|
|
193
|
+
u.addEventListener("message", function(e) {
|
|
194
|
+
o.handleMessage(e);
|
|
191
195
|
});
|
|
192
|
-
u
|
|
193
|
-
o
|
|
196
|
+
u.addEventListener("close", function(e) {
|
|
197
|
+
o.handleClose(e);
|
|
194
198
|
});
|
|
195
199
|
if (__ROLLIPOP_GLOBAL__.__rolldown_runtime__ != null) {
|
|
196
|
-
__ROLLIPOP_GLOBAL__.__rolldown_runtime__.setup(u
|
|
200
|
+
__ROLLIPOP_GLOBAL__.__rolldown_runtime__.setup(u, l);
|
|
197
201
|
}
|
|
198
|
-
this.enabled = i
|
|
202
|
+
this.enabled = i;
|
|
199
203
|
}
|
|
200
204
|
},
|
|
201
205
|
{
|
|
202
206
|
key: "send",
|
|
203
|
-
value: function e
|
|
207
|
+
value: function e(e) {
|
|
204
208
|
if (this._socketHolder == null) {
|
|
205
209
|
return;
|
|
206
210
|
}
|
|
207
211
|
if (this._socketHolder.socket.readyState === WebSocket.OPEN) {
|
|
208
|
-
this._socketHolder.socket.send(JSON.stringify(e
|
|
212
|
+
this._socketHolder.socket.send(JSON.stringify(e));
|
|
209
213
|
}
|
|
210
214
|
}
|
|
211
215
|
},
|
|
212
216
|
{
|
|
213
217
|
key: "flushEarlyLogs",
|
|
214
|
-
value: function e
|
|
218
|
+
value: function e() {
|
|
215
219
|
if (this._socketHolder == null || this._socketHolder.socket.readyState !== WebSocket.OPEN) {
|
|
216
220
|
return;
|
|
217
221
|
}
|
|
218
|
-
var e
|
|
222
|
+
var e = true, t = false, n = undefined;
|
|
219
223
|
try {
|
|
220
|
-
for (var r
|
|
221
|
-
var i
|
|
224
|
+
for (var r = this.pendingLogs[Symbol.iterator](), o; !(e = (o = r.next()).done); e = true) {
|
|
225
|
+
var i = s(o.value, 2), a = i[0], l = i[1];
|
|
222
226
|
this.send({
|
|
223
227
|
type: "hmr:log",
|
|
224
|
-
level: a
|
|
225
|
-
data: l
|
|
228
|
+
level: a,
|
|
229
|
+
data: l
|
|
226
230
|
});
|
|
227
231
|
}
|
|
228
|
-
} catch (e
|
|
229
|
-
t
|
|
230
|
-
n
|
|
232
|
+
} catch (e) {
|
|
233
|
+
t = true;
|
|
234
|
+
n = e;
|
|
231
235
|
} finally {
|
|
232
236
|
try {
|
|
233
|
-
if (!e
|
|
234
|
-
r
|
|
237
|
+
if (!e && r.return != null) {
|
|
238
|
+
r.return();
|
|
235
239
|
}
|
|
236
240
|
} finally {
|
|
237
|
-
if (t
|
|
238
|
-
throw n
|
|
241
|
+
if (t) {
|
|
242
|
+
throw n;
|
|
239
243
|
}
|
|
240
244
|
}
|
|
241
245
|
}
|
|
@@ -244,33 +248,33 @@ var p = /* @__PURE__ */ function() {
|
|
|
244
248
|
},
|
|
245
249
|
{
|
|
246
250
|
key: "dismissRedbox",
|
|
247
|
-
value: function e
|
|
251
|
+
value: function e() {
|
|
248
252
|
if (f.OS === "ios" && d != null && d.dismiss != null) {
|
|
249
253
|
d.dismiss();
|
|
250
254
|
} else {
|
|
251
|
-
var e
|
|
252
|
-
if (e
|
|
253
|
-
e
|
|
255
|
+
var e = __require("../Core/NativeExceptionsManager").default;
|
|
256
|
+
if (e != null && e.dismissRedbox) {
|
|
257
|
+
e.dismissRedbox();
|
|
254
258
|
}
|
|
255
259
|
}
|
|
256
260
|
}
|
|
257
261
|
},
|
|
258
262
|
{
|
|
259
263
|
key: "showCompileErrorIfNeeded",
|
|
260
|
-
value: function e
|
|
264
|
+
value: function e() {
|
|
261
265
|
if (this.compileErrorMessage == null) {
|
|
262
266
|
return;
|
|
263
267
|
}
|
|
264
268
|
this.dismissRedbox();
|
|
265
|
-
var e
|
|
269
|
+
var e = new Error(this.compileErrorMessage);
|
|
266
270
|
this.compileErrorMessage = null;
|
|
267
|
-
Object.defineProperty(e
|
|
268
|
-
throw e
|
|
271
|
+
Object.defineProperty(e, "preventSymbolication", { value: true });
|
|
272
|
+
throw e;
|
|
269
273
|
}
|
|
270
274
|
},
|
|
271
275
|
{
|
|
272
276
|
key: "showUnavailableMessageIfNeeded",
|
|
273
|
-
value: function e
|
|
277
|
+
value: function e() {
|
|
274
278
|
if (this.unavailableMessage == null) {
|
|
275
279
|
return;
|
|
276
280
|
}
|
|
@@ -283,34 +287,34 @@ var p = /* @__PURE__ */ function() {
|
|
|
283
287
|
},
|
|
284
288
|
{
|
|
285
289
|
key: "handleConnection",
|
|
286
|
-
value: function e
|
|
290
|
+
value: function e() {
|
|
287
291
|
h.hide();
|
|
288
292
|
this.flushEarlyLogs();
|
|
289
293
|
}
|
|
290
294
|
},
|
|
291
295
|
{
|
|
292
296
|
key: "handleConnectionError",
|
|
293
|
-
value: function e
|
|
294
|
-
var n
|
|
295
|
-
var r
|
|
297
|
+
value: function e(e, t) {
|
|
298
|
+
var n;
|
|
299
|
+
var r = "Cannot connect to Rollipop.\n\n" + "Try the following to fix the issue:\n" + "- Ensure that Rollipop is running and available on the same network";
|
|
296
300
|
if (f.OS === "ios") {
|
|
297
|
-
r
|
|
301
|
+
r += "- Ensure that the Rollipop URL is correctly set in AppDelegate";
|
|
298
302
|
} else {
|
|
299
|
-
r
|
|
303
|
+
r += "- Ensure that your device/emulator is connected to your machine and has USB debugging enabled - run 'adb devices' to see a list of connected devices\n" + "- If you're on a physical device connected to the same machine, run 'adb reverse tcp:8081 tcp:8081' to forward requests from your device\n" + "- If your device is on the same Wi-Fi network, set 'Debug server host & port for device' in 'Dev settings' to your machine's IP address and the port of the local dev server - e.g. 10.0.1.1:8081";
|
|
300
304
|
}
|
|
301
|
-
r
|
|
302
|
-
(n
|
|
305
|
+
r += "\n\nURL: ".concat(t) + "\n\nError: ".concat(e.message);
|
|
306
|
+
(n = this.unavailableMessage) !== null && n !== void 0 ? n : this.unavailableMessage = r;
|
|
303
307
|
this.showCompileErrorIfNeeded();
|
|
304
308
|
}
|
|
305
309
|
},
|
|
306
310
|
{
|
|
307
311
|
key: "handleMessage",
|
|
308
|
-
value: function e
|
|
309
|
-
var t
|
|
310
|
-
if (!this.enabled && t
|
|
312
|
+
value: function e(e) {
|
|
313
|
+
var t = JSON.parse(String(e.data));
|
|
314
|
+
if (!this.enabled && t.type.startsWith("hmr:")) {
|
|
311
315
|
return;
|
|
312
316
|
}
|
|
313
|
-
switch (t
|
|
317
|
+
switch (t.type) {
|
|
314
318
|
case "hmr:update-start":
|
|
315
319
|
this.pendingUpdatesCount++;
|
|
316
320
|
this.compileErrorMessage = null;
|
|
@@ -327,7 +331,7 @@ var p = /* @__PURE__ */ function() {
|
|
|
327
331
|
}
|
|
328
332
|
break;
|
|
329
333
|
case "hmr:error":
|
|
330
|
-
this.compileErrorMessage = t
|
|
334
|
+
this.compileErrorMessage = t.payload.message;
|
|
331
335
|
this.showCompileErrorIfNeeded();
|
|
332
336
|
break;
|
|
333
337
|
}
|
|
@@ -335,17 +339,17 @@ var p = /* @__PURE__ */ function() {
|
|
|
335
339
|
},
|
|
336
340
|
{
|
|
337
341
|
key: "handleClose",
|
|
338
|
-
value: function e
|
|
339
|
-
var t
|
|
340
|
-
var n
|
|
341
|
-
var o
|
|
342
|
-
var i
|
|
343
|
-
(t
|
|
342
|
+
value: function e(e) {
|
|
343
|
+
var t;
|
|
344
|
+
var n = e.code, r = e.reason;
|
|
345
|
+
var o = n === 1e3 || n === 1005;
|
|
346
|
+
var i = o ? "Disconnected from Rollipop." : "Disconnected from Rollipop (".concat(n, ": \"").concat(r, "\").");
|
|
347
|
+
(t = this.unavailableMessage) !== null && t !== void 0 ? t : this.unavailableMessage = i + "\n\n" + "To reconnect:\n" + "- Ensure that Rollipop is running and available on the same network\n" + "- Reload this app (will trigger further help if Rollipop cannot be connected to)\n";
|
|
344
348
|
this.showUnavailableMessageIfNeeded();
|
|
345
349
|
}
|
|
346
350
|
}
|
|
347
351
|
]);
|
|
348
|
-
return e
|
|
352
|
+
return e;
|
|
349
353
|
}();
|
|
350
354
|
p.STARTUP_ERROR = "Expected HMRClient.setup() call at startup";
|
|
351
355
|
p.MAX_PENDING_LOGS = 100;
|
package/dist/hmr-runtime.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
//#endregion
|
|
2
|
-
export { type
|
|
2
|
+
export { type f as DevRuntime };
|