rollipop 0.1.0-alpha.11 → 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.
@@ -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 rolldown:runtime
8
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a$1, b) => (typeof require !== "undefined" ? require : a$1)[b] }) : x)(function(x) {
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 \"" + x + "\" in an environment that doesn't expose the `require` function.");
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$1, t$1) {
16
- if (t$1 == null || t$1 > e$1.length) t$1 = e$1.length;
17
- for (var n$1 = 0, r$1 = new Array(t$1); n$1 < t$1; n$1++) r$1[n$1] = e$1[n$1];
18
- return r$1;
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$1) {
21
- if (Array.isArray(e$1)) return e$1;
24
+ function t(e) {
25
+ if (Array.isArray(e)) return e;
22
26
  }
23
- function n(e$1, t$1) {
24
- if (!(e$1 instanceof t$1)) {
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$1, t$1) {
29
- for (var n$1 = 0; n$1 < t$1.length; n$1++) {
30
- var r$1 = t$1[n$1];
31
- r$1.enumerable = r$1.enumerable || false;
32
- r$1.configurable = true;
33
- if ("value" in r$1) r$1.writable = true;
34
- Object.defineProperty(e$1, r$1.key, r$1);
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$1, t$1, n$1) {
38
- if (t$1) r(e$1.prototype, t$1);
39
- if (n$1) r(e$1, n$1);
40
- return e$1;
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$1, t$1) {
43
- var n$1 = e$1 == null ? null : typeof Symbol !== "undefined" && e$1[Symbol.iterator] || e$1["@@iterator"];
44
- if (n$1 == null) return;
45
- var r$1 = [];
46
- var o$1 = true;
47
- var i$1 = false;
48
- var a$1, s$1;
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$1 = n$1.call(e$1); !(o$1 = (a$1 = n$1.next()).done); o$1 = true) {
51
- r$1.push(a$1.value);
52
- if (t$1 && r$1.length === t$1) break;
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$2) {
55
- i$1 = true;
56
- s$1 = e$2;
58
+ } catch (e) {
59
+ i = true;
60
+ s = e;
57
61
  } finally {
58
62
  try {
59
- if (!o$1 && n$1["return"] != null) n$1["return"]();
63
+ if (!o && n["return"] != null) n["return"]();
60
64
  } finally {
61
- if (i$1) throw s$1;
65
+ if (i) throw s;
62
66
  }
63
67
  }
64
- return r$1;
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$1, n$1) {
70
- return t(e$1) || i(e$1, n$1) || l(e$1, n$1) || a();
73
+ function s(e, n) {
74
+ return t(e) || i(e, n) || l(e, n) || a();
71
75
  }
72
- function l(t$1, n$1) {
73
- if (!t$1) return;
74
- if (typeof t$1 === "string") return e(t$1, n$1);
75
- var r$1 = Object.prototype.toString.call(t$1).slice(8, -1);
76
- if (r$1 === "Object" && t$1.constructor) r$1 = t$1.constructor.name;
77
- if (r$1 === "Map" || r$1 === "Set") return Array.from(r$1);
78
- if (r$1 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r$1)) return e(t$1, n$1);
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$1() {
83
- n(this, e$1);
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$1, [
95
+ o(e, [
92
96
  {
93
97
  key: "enable",
94
- value: function t$1() {
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$1.STARTUP_ERROR);
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$2() {
111
+ value: function e() {
108
112
  this.enabled = false;
109
113
  }
110
114
  },
111
115
  {
112
116
  key: "registerBundle",
113
- value: function t$1(t$2) {
117
+ value: function t(t) {
114
118
  if (this._socketHolder == null) {
115
- throw new Error(e$1.STARTUP_ERROR);
119
+ throw new Error(e.STARTUP_ERROR);
116
120
  }
117
- if (!t$2.startsWith(this._socketHolder.origin)) {
118
- console.warn("[HMR]: Cannot register bundle from unknown origin:\n".concat(t$2, "\n") + "(expected: ".concat(this._socketHolder.origin, ")"));
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$1(t$2, n$1) {
129
+ value: function t(t, n) {
126
130
  if (this._socketHolder == null) {
127
- this.pendingLogs.push([t$2, n$1]);
128
- if (this.pendingLogs.length > e$1.MAX_PENDING_LOGS) {
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$1 = n$1.map(function(e$2) {
135
- return typeof e$2 === "string" ? e$2 : u.format(e$2, {
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$2,
146
- data: r$1
149
+ level: t,
150
+ data: r
147
151
  });
148
- } catch (e$2) {}
152
+ } catch (e) {}
149
153
  }
150
154
  },
151
155
  {
152
156
  key: "setup",
153
- value: function e$2(e$3, t$1, n$1, r$1) {
154
- var o$1 = this;
155
- var i$1 = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true, a$1 = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : "http";
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$3 == null) {
166
+ if (e == null) {
163
167
  throw new Error("Missing required parameter `platform`");
164
168
  }
165
- if (t$1 == null) {
169
+ if (t == null) {
166
170
  throw new Error("Missing required parameter `bundleEntry`");
167
171
  }
168
- if (n$1 == null) {
172
+ if (n == null) {
169
173
  throw new Error("Missing required parameter `host`");
170
174
  }
171
- var s$1 = r$1 !== null && r$1 !== "" ? "".concat(n$1, ":").concat(r$1) : n$1;
172
- var l$1 = "".concat(a$1, "://").concat(s$1);
173
- var u$1 = new __ROLLIPOP_GLOBAL__.WebSocket("".concat(l$1, "/hot"));
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$1,
176
- origin: l$1
179
+ socket: u,
180
+ origin: l
177
181
  };
178
- u$1.addEventListener("open", function() {
179
- u$1.send(JSON.stringify({
182
+ u.addEventListener("open", function() {
183
+ u.send(JSON.stringify({
180
184
  type: "hmr:connected",
181
- bundleEntry: t$1,
182
- platform: e$3
185
+ bundleEntry: t,
186
+ platform: e
183
187
  }));
184
- o$1.handleConnection();
188
+ o.handleConnection();
185
189
  });
186
- u$1.addEventListener("error", function(e$4) {
187
- o$1.handleConnectionError(e$4.error, l$1);
190
+ u.addEventListener("error", function(e) {
191
+ o.handleConnectionError(e.error, l);
188
192
  });
189
- u$1.addEventListener("message", function(e$4) {
190
- o$1.handleMessage(e$4);
193
+ u.addEventListener("message", function(e) {
194
+ o.handleMessage(e);
191
195
  });
192
- u$1.addEventListener("close", function(e$4) {
193
- o$1.handleClose(e$4);
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$1, l$1);
200
+ __ROLLIPOP_GLOBAL__.__rolldown_runtime__.setup(u, l);
197
201
  }
198
- this.enabled = i$1;
202
+ this.enabled = i;
199
203
  }
200
204
  },
201
205
  {
202
206
  key: "send",
203
- value: function e$2(e$3) {
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$3));
212
+ this._socketHolder.socket.send(JSON.stringify(e));
209
213
  }
210
214
  }
211
215
  },
212
216
  {
213
217
  key: "flushEarlyLogs",
214
- value: function e$2() {
218
+ value: function e() {
215
219
  if (this._socketHolder == null || this._socketHolder.socket.readyState !== WebSocket.OPEN) {
216
220
  return;
217
221
  }
218
- var e$3 = true, t$1 = false, n$1 = undefined;
222
+ var e = true, t = false, n = undefined;
219
223
  try {
220
- for (var r$1 = this.pendingLogs[Symbol.iterator](), o$1; !(e$3 = (o$1 = r$1.next()).done); e$3 = true) {
221
- var i$1 = s(o$1.value, 2), a$1 = i$1[0], l$1 = i$1[1];
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$1,
225
- data: l$1
228
+ level: a,
229
+ data: l
226
230
  });
227
231
  }
228
- } catch (e$4) {
229
- t$1 = true;
230
- n$1 = e$4;
232
+ } catch (e) {
233
+ t = true;
234
+ n = e;
231
235
  } finally {
232
236
  try {
233
- if (!e$3 && r$1.return != null) {
234
- r$1.return();
237
+ if (!e && r.return != null) {
238
+ r.return();
235
239
  }
236
240
  } finally {
237
- if (t$1) {
238
- throw n$1;
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$2() {
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$3 = __require("../Core/NativeExceptionsManager").default;
252
- if (e$3 != null && e$3.dismissRedbox) {
253
- e$3.dismissRedbox();
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$2() {
264
+ value: function e() {
261
265
  if (this.compileErrorMessage == null) {
262
266
  return;
263
267
  }
264
268
  this.dismissRedbox();
265
- var e$3 = new Error(this.compileErrorMessage);
269
+ var e = new Error(this.compileErrorMessage);
266
270
  this.compileErrorMessage = null;
267
- Object.defineProperty(e$3, "preventSymbolication", { value: true });
268
- throw e$3;
271
+ Object.defineProperty(e, "preventSymbolication", { value: true });
272
+ throw e;
269
273
  }
270
274
  },
271
275
  {
272
276
  key: "showUnavailableMessageIfNeeded",
273
- value: function e$2() {
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$2() {
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$2(e$3, t$1) {
294
- var n$1;
295
- var r$1 = "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";
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$1 += "- Ensure that the Rollipop URL is correctly set in AppDelegate";
301
+ r += "- Ensure that the Rollipop URL is correctly set in AppDelegate";
298
302
  } else {
299
- r$1 += "- 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";
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$1 += "\n\nURL: ".concat(t$1) + "\n\nError: ".concat(e$3.message);
302
- (n$1 = this.unavailableMessage) !== null && n$1 !== void 0 ? n$1 : this.unavailableMessage = r$1;
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$2(e$3) {
309
- var t$1 = JSON.parse(String(e$3.data));
310
- if (!this.enabled && t$1.type.startsWith("hmr:")) {
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$1.type) {
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$1.payload.message;
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$2(e$3) {
339
- var t$1;
340
- var n$1 = e$3.code, r$1 = e$3.reason;
341
- var o$1 = n$1 === 1e3 || n$1 === 1005;
342
- var i$1 = o$1 ? "Disconnected from Rollipop." : "Disconnected from Rollipop (".concat(n$1, ": \"").concat(r$1, "\").");
343
- (t$1 = this.unavailableMessage) !== null && t$1 !== void 0 ? t$1 : this.unavailableMessage = i$1 + "\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";
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$1;
352
+ return e;
349
353
  }();
350
354
  p.STARTUP_ERROR = "Expected HMRClient.setup() call at startup";
351
355
  p.MAX_PENDING_LOGS = 100;
@@ -1,2 +1,2 @@
1
1
  //#endregion
2
- export { type c as DevRuntime };
2
+ export { type f as DevRuntime };