@netlify/spark-ui 1.27.4 → 1.27.6

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.
@@ -1,3 +1,13 @@
1
+ /**
2
+ * Thrown when the user drops or picks a single loose file that Drop can't turn
3
+ * into a site on its own — anything that isn't a `.zip` (a site archive) or an
4
+ * HTML page (served as index.html). A folder, multiple files, a zip, or a lone
5
+ * HTML file are all fine; any other single file is rejected rather than
6
+ * deployed as a one-asset site (matches react-ui).
7
+ */
8
+ export declare class UnsupportedDropError extends Error {
9
+ constructor();
10
+ }
1
11
  /**
2
12
  * Turn a raw deploy failure into copy a non-technical user can act on.
3
13
  * The original message is still tracked via analytics — this is only for display.
@@ -1,5 +1,12 @@
1
+ class n extends Error {
2
+ constructor() {
3
+ super("unsupported single file"), this.name = "UnsupportedDropError";
4
+ }
5
+ }
1
6
  function a(e) {
2
7
  if (!(e instanceof Error)) return "Something went wrong. Please try again.";
8
+ if (e instanceof n)
9
+ return "To deploy, drop a folder or a .zip file — or a single HTML page.";
3
10
  if (e.message === "Deploy did not become ready in time")
4
11
  return "Your site is taking longer than expected to go live. Please try again in a moment.";
5
12
  if (e instanceof TypeError)
@@ -25,5 +32,6 @@ function a(e) {
25
32
  }
26
33
  }
27
34
  export {
35
+ n as UnsupportedDropError,
28
36
  a as humanizeDropError
29
37
  };
@@ -1,15 +1,17 @@
1
1
  import { getDigest as o } from "./digest.js";
2
- import { getSingleNonIndexHtmlFileName as i, hasMultipleHtmlFilesWithoutIndex as l, readDataTransfer as m, readFileList as n } from "./readFiles.js";
3
- import { AnonymousDropClient as a } from "./client.js";
4
- import { deployFiles as x } from "./deploy.js";
5
- import { humanizeDropError as d } from "./errors.js";
2
+ import { getSingleNonIndexHtmlFileName as n, hasMultipleHtmlFilesWithoutIndex as l, readDataTransfer as i, readFileList as m, renameSingleNonIndexHtmlToIndex as p } from "./readFiles.js";
3
+ import { AnonymousDropClient as x } from "./client.js";
4
+ import { deployFiles as s } from "./deploy.js";
5
+ import { UnsupportedDropError as g, humanizeDropError as u } from "./errors.js";
6
6
  export {
7
- a as AnonymousDropClient,
8
- x as deployFiles,
7
+ x as AnonymousDropClient,
8
+ g as UnsupportedDropError,
9
+ s as deployFiles,
9
10
  o as getDigest,
10
- i as getSingleNonIndexHtmlFileName,
11
+ n as getSingleNonIndexHtmlFileName,
11
12
  l as hasMultipleHtmlFilesWithoutIndex,
12
- d as humanizeDropError,
13
- m as readDataTransfer,
14
- n as readFileList
13
+ u as humanizeDropError,
14
+ i as readDataTransfer,
15
+ m as readFileList,
16
+ p as renameSingleNonIndexHtmlToIndex
15
17
  };
@@ -11,3 +11,11 @@ export declare function readDataTransfer(dt: DataTransfer): Promise<ProcessedFil
11
11
  export declare function readFileList(files: FileList): Promise<ProcessedFile[]>;
12
12
  export declare function getSingleNonIndexHtmlFileName(files: ProcessedFile[]): string | null;
13
13
  export declare function hasMultipleHtmlFilesWithoutIndex(files: ProcessedFile[]): boolean;
14
+ /**
15
+ * When the set has no index.html but exactly one HTML file (a lone page
16
+ * alongside its assets, or a single dropped file), rename that file to
17
+ * index.html — keeping its directory — so it is served at the site root
18
+ * instead of 404ing. Content and sha are untouched. Any other set (already has
19
+ * an index, multiple HTML files, or no HTML) is returned unchanged.
20
+ */
21
+ export declare function renameSingleNonIndexHtmlToIndex(files: ProcessedFile[]): ProcessedFile[];
@@ -1,18 +1,19 @@
1
- import { g as F } from "../../../../chunks/_commonjsHelpers.C6fGbg64.js";
2
- var L = { exports: {} }, I = L.exports, M;
3
- function z() {
4
- return M || (M = 1, function(g, _) {
5
- (function(b, p) {
6
- g.exports = p();
7
- })(typeof self < "u" ? self : I, function() {
1
+ import { g as P } from "../../../../chunks/_commonjsHelpers.C6fGbg64.js";
2
+ import { UnsupportedDropError as U } from "./errors.js";
3
+ var L = { exports: {} }, G = L.exports, D;
4
+ function J() {
5
+ return D || (D = 1, function(y, m) {
6
+ (function(_, h) {
7
+ y.exports = h();
8
+ })(typeof self < "u" ? self : G, function() {
8
9
  return (
9
10
  /******/
10
- function(x) {
11
- var b = {};
12
- function p(v) {
13
- if (b[v])
14
- return b[v].exports;
15
- var s = b[v] = {
11
+ function(w) {
12
+ var _ = {};
13
+ function h(v) {
14
+ if (_[v])
15
+ return _[v].exports;
16
+ var s = _[v] = {
16
17
  /******/
17
18
  i: v,
18
19
  /******/
@@ -21,19 +22,19 @@ function z() {
21
22
  exports: {}
22
23
  /******/
23
24
  };
24
- return x[v].call(s.exports, s, s.exports, p), s.l = !0, s.exports;
25
+ return w[v].call(s.exports, s, s.exports, h), s.l = !0, s.exports;
25
26
  }
26
- return p.m = x, p.c = b, p.d = function(v, s, y) {
27
- p.o(v, s) || Object.defineProperty(v, s, {
27
+ return h.m = w, h.c = _, h.d = function(v, s, g) {
28
+ h.o(v, s) || Object.defineProperty(v, s, {
28
29
  /******/
29
30
  configurable: !1,
30
31
  /******/
31
32
  enumerable: !0,
32
33
  /******/
33
- get: y
34
+ get: g
34
35
  /******/
35
36
  });
36
- }, p.n = function(v) {
37
+ }, h.n = function(v) {
37
38
  var s = v && v.__esModule ? (
38
39
  /******/
39
40
  function() {
@@ -45,25 +46,25 @@ function z() {
45
46
  return v;
46
47
  }
47
48
  );
48
- return p.d(s, "a", s), s;
49
- }, p.o = function(v, s) {
49
+ return h.d(s, "a", s), s;
50
+ }, h.o = function(v, s) {
50
51
  return Object.prototype.hasOwnProperty.call(v, s);
51
- }, p.p = "", p(p.s = 3);
52
+ }, h.p = "", h(h.s = 3);
52
53
  }([
53
54
  /* 0 */
54
55
  /***/
55
- function(x, b, p) {
56
+ function(w, _, h) {
56
57
  function v(e, o) {
57
58
  if (!(e instanceof o))
58
59
  throw new TypeError("Cannot call a class as a function");
59
60
  }
60
- var s = p(5), y = p(1), u = y.toHex, f = y.ceilHeapSize, l = p(6), d = function(e) {
61
+ var s = h(5), g = h(1), u = g.toHex, f = g.ceilHeapSize, l = h(6), d = function(e) {
61
62
  for (e += 9; e % 64 > 0; e += 1)
62
63
  ;
63
64
  return e;
64
65
  }, i = function(e, o) {
65
- var n = new Uint8Array(e.buffer), h = o % 4, a = o - h;
66
- switch (h) {
66
+ var n = new Uint8Array(e.buffer), p = o % 4, a = o - p;
67
+ switch (p) {
67
68
  case 0:
68
69
  n[a + 3] = 0;
69
70
  case 1:
@@ -73,38 +74,38 @@ function z() {
73
74
  case 3:
74
75
  n[a + 0] = 0;
75
76
  }
76
- for (var w = (o >> 2) + 1; w < e.length; w++)
77
- e[w] = 0;
77
+ for (var x = (o >> 2) + 1; x < e.length; x++)
78
+ e[x] = 0;
78
79
  }, r = function(e, o, n) {
79
80
  e[o >> 2] |= 128 << 24 - (o % 4 << 3), e[((o >> 2) + 2 & -16) + 14] = n / (1 << 29) | 0, e[((o >> 2) + 2 & -16) + 15] = n << 3;
80
81
  }, t = function(e, o) {
81
- var n = new Int32Array(e, o + 320, 5), h = new Int32Array(5), a = new DataView(h.buffer);
82
- return a.setInt32(0, n[0], !1), a.setInt32(4, n[1], !1), a.setInt32(8, n[2], !1), a.setInt32(12, n[3], !1), a.setInt32(16, n[4], !1), h;
82
+ var n = new Int32Array(e, o + 320, 5), p = new Int32Array(5), a = new DataView(p.buffer);
83
+ return a.setInt32(0, n[0], !1), a.setInt32(4, n[1], !1), a.setInt32(8, n[2], !1), a.setInt32(12, n[3], !1), a.setInt32(16, n[4], !1), p;
83
84
  }, c = function() {
84
85
  function e(o) {
85
86
  if (v(this, e), o = o || 64 * 1024, o % 64 > 0)
86
87
  throw new Error("Chunk size must be a multiple of 128 bit");
87
88
  this._offset = 0, this._maxChunkLen = o, this._padMaxChunkLen = d(o), this._heap = new ArrayBuffer(f(this._padMaxChunkLen + 320 + 20)), this._h32 = new Int32Array(this._heap), this._h8 = new Int8Array(this._heap), this._core = new s({ Int32Array }, {}, this._heap);
88
89
  }
89
- return e.prototype._initState = function(n, h) {
90
+ return e.prototype._initState = function(n, p) {
90
91
  this._offset = 0;
91
- var a = new Int32Array(n, h + 320, 5);
92
+ var a = new Int32Array(n, p + 320, 5);
92
93
  a[0] = 1732584193, a[1] = -271733879, a[2] = -1732584194, a[3] = 271733878, a[4] = -1009589776;
93
- }, e.prototype._padChunk = function(n, h) {
94
- var a = d(n), w = new Int32Array(this._heap, 0, a >> 2);
95
- return i(w, n), r(w, n, h), a;
96
- }, e.prototype._write = function(n, h, a, w) {
97
- l(n, this._h8, this._h32, h, a, w || 0);
98
- }, e.prototype._coreCall = function(n, h, a, w, m) {
94
+ }, e.prototype._padChunk = function(n, p) {
95
+ var a = d(n), x = new Int32Array(this._heap, 0, a >> 2);
96
+ return i(x, n), r(x, n, p), a;
97
+ }, e.prototype._write = function(n, p, a, x) {
98
+ l(n, this._h8, this._h32, p, a, x || 0);
99
+ }, e.prototype._coreCall = function(n, p, a, x, b) {
99
100
  var C = a;
100
- this._write(n, h, a), m && (C = this._padChunk(a, w)), this._core.hash(C, this._padMaxChunkLen);
101
+ this._write(n, p, a), b && (C = this._padChunk(a, x)), this._core.hash(C, this._padMaxChunkLen);
101
102
  }, e.prototype.rawDigest = function(n) {
102
- var h = n.byteLength || n.length || n.size || 0;
103
+ var p = n.byteLength || n.length || n.size || 0;
103
104
  this._initState(this._heap, this._padMaxChunkLen);
104
- var a = 0, w = this._maxChunkLen;
105
- for (a = 0; h > a + w; a += w)
106
- this._coreCall(n, a, w, h, !1);
107
- return this._coreCall(n, a, h - a, h, !0), t(this._heap, this._padMaxChunkLen);
105
+ var a = 0, x = this._maxChunkLen;
106
+ for (a = 0; p > a + x; a += x)
107
+ this._coreCall(n, a, x, p, !1);
108
+ return this._coreCall(n, a, p - a, p, !0), t(this._heap, this._padMaxChunkLen);
108
109
  }, e.prototype.digest = function(n) {
109
110
  return u(this.rawDigest(n).buffer);
110
111
  }, e.prototype.digestFromString = function(n) {
@@ -116,75 +117,75 @@ function z() {
116
117
  }, e.prototype.resetState = function() {
117
118
  return this._initState(this._heap, this._padMaxChunkLen), this;
118
119
  }, e.prototype.append = function(n) {
119
- var h = 0, a = n.byteLength || n.length || n.size || 0, w = this._offset % this._maxChunkLen, m = void 0;
120
- for (this._offset += a; h < a; )
121
- m = Math.min(a - h, this._maxChunkLen - w), this._write(n, h, m, w), w += m, h += m, w === this._maxChunkLen && (this._core.hash(this._maxChunkLen, this._padMaxChunkLen), w = 0);
120
+ var p = 0, a = n.byteLength || n.length || n.size || 0, x = this._offset % this._maxChunkLen, b = void 0;
121
+ for (this._offset += a; p < a; )
122
+ b = Math.min(a - p, this._maxChunkLen - x), this._write(n, p, b, x), x += b, p += b, x === this._maxChunkLen && (this._core.hash(this._maxChunkLen, this._padMaxChunkLen), x = 0);
122
123
  return this;
123
124
  }, e.prototype.getState = function() {
124
- var n = this._offset % this._maxChunkLen, h = void 0;
125
+ var n = this._offset % this._maxChunkLen, p = void 0;
125
126
  if (n)
126
- h = this._heap.slice(0);
127
+ p = this._heap.slice(0);
127
128
  else {
128
129
  var a = new Int32Array(this._heap, this._padMaxChunkLen + 320, 5);
129
- h = a.buffer.slice(a.byteOffset, a.byteOffset + a.byteLength);
130
+ p = a.buffer.slice(a.byteOffset, a.byteOffset + a.byteLength);
130
131
  }
131
132
  return {
132
133
  offset: this._offset,
133
- heap: h
134
+ heap: p
134
135
  };
135
136
  }, e.prototype.setState = function(n) {
136
137
  if (this._offset = n.offset, n.heap.byteLength === 20) {
137
- var h = new Int32Array(this._heap, this._padMaxChunkLen + 320, 5);
138
- h.set(new Int32Array(n.heap));
138
+ var p = new Int32Array(this._heap, this._padMaxChunkLen + 320, 5);
139
+ p.set(new Int32Array(n.heap));
139
140
  } else
140
141
  this._h32.set(new Int32Array(n.heap));
141
142
  return this;
142
143
  }, e.prototype.rawEnd = function() {
143
- var n = this._offset, h = n % this._maxChunkLen, a = this._padChunk(h, n);
144
+ var n = this._offset, p = n % this._maxChunkLen, a = this._padChunk(p, n);
144
145
  this._core.hash(a, this._padMaxChunkLen);
145
- var w = t(this._heap, this._padMaxChunkLen);
146
- return this._initState(this._heap, this._padMaxChunkLen), w;
146
+ var x = t(this._heap, this._padMaxChunkLen);
147
+ return this._initState(this._heap, this._padMaxChunkLen), x;
147
148
  }, e.prototype.end = function() {
148
149
  return u(this.rawEnd().buffer);
149
150
  }, e;
150
151
  }();
151
- x.exports = c, x.exports._core = s;
152
+ w.exports = c, w.exports._core = s;
152
153
  },
153
154
  /* 1 */
154
155
  /***/
155
- function(x, b) {
156
- for (var p = new Array(256), v = 0; v < 256; v++)
157
- p[v] = (v < 16 ? "0" : "") + v.toString(16);
158
- x.exports.toHex = function(s) {
159
- for (var y = new Uint8Array(s), u = new Array(s.byteLength), f = 0; f < u.length; f++)
160
- u[f] = p[y[f]];
156
+ function(w, _) {
157
+ for (var h = new Array(256), v = 0; v < 256; v++)
158
+ h[v] = (v < 16 ? "0" : "") + v.toString(16);
159
+ w.exports.toHex = function(s) {
160
+ for (var g = new Uint8Array(s), u = new Array(s.byteLength), f = 0; f < u.length; f++)
161
+ u[f] = h[g[f]];
161
162
  return u.join("");
162
- }, x.exports.ceilHeapSize = function(s) {
163
- var y = 0;
163
+ }, w.exports.ceilHeapSize = function(s) {
164
+ var g = 0;
164
165
  if (s <= 65536) return 65536;
165
166
  if (s < 16777216)
166
- for (y = 1; y < s; y = y << 1)
167
+ for (g = 1; g < s; g = g << 1)
167
168
  ;
168
169
  else
169
- for (y = 16777216; y < s; y += 16777216)
170
+ for (g = 16777216; g < s; g += 16777216)
170
171
  ;
171
- return y;
172
- }, x.exports.isDedicatedWorkerScope = function(s) {
173
- var y = "WorkerGlobalScope" in s && s instanceof s.WorkerGlobalScope, u = "SharedWorkerGlobalScope" in s && s instanceof s.SharedWorkerGlobalScope, f = "ServiceWorkerGlobalScope" in s && s instanceof s.ServiceWorkerGlobalScope;
174
- return y && !u && !f;
172
+ return g;
173
+ }, w.exports.isDedicatedWorkerScope = function(s) {
174
+ var g = "WorkerGlobalScope" in s && s instanceof s.WorkerGlobalScope, u = "SharedWorkerGlobalScope" in s && s instanceof s.SharedWorkerGlobalScope, f = "ServiceWorkerGlobalScope" in s && s instanceof s.ServiceWorkerGlobalScope;
175
+ return g && !u && !f;
175
176
  };
176
177
  },
177
178
  /* 2 */
178
179
  /***/
179
- function(x, b, p) {
180
- x.exports = function() {
181
- var v = p(0), s = function(f, l, d) {
180
+ function(w, _, h) {
181
+ w.exports = function() {
182
+ var v = h(0), s = function(f, l, d) {
182
183
  try {
183
184
  return d(null, f.digest(l));
184
185
  } catch (i) {
185
186
  return d(i);
186
187
  }
187
- }, y = function(f, l, d, i, r) {
188
+ }, g = function(f, l, d, i, r) {
188
189
  var t = new self.FileReader();
189
190
  t.onloadend = function() {
190
191
  if (t.error)
@@ -197,7 +198,7 @@ function z() {
197
198
  r(o);
198
199
  return;
199
200
  }
200
- l < i.size ? y(f, l, d, i, r) : r(null, f.end());
201
+ l < i.size ? g(f, l, d, i, r) : r(null, f.end());
201
202
  }, t.readAsArrayBuffer(i.slice(l, l + d));
202
203
  }, u = !0;
203
204
  return self.onmessage = function(f) {
@@ -209,7 +210,7 @@ function z() {
209
210
  var c = function(e, o) {
210
211
  e ? self.postMessage({ id: i, error: e.name }) : self.postMessage({ id: i, hash: o });
211
212
  };
212
- l && s(t, l, c), d && y(t, 0, r, d, c);
213
+ l && s(t, l, c), d && g(t, 0, r, d, c);
213
214
  }
214
215
  }
215
216
  }, function() {
@@ -219,8 +220,8 @@ function z() {
219
220
  },
220
221
  /* 3 */
221
222
  /***/
222
- function(x, b, p) {
223
- var v = p(4), s = p(0), y = p(7), u = p(2), f = p(1), l = f.isDedicatedWorkerScope, d = typeof self < "u" && l(self);
223
+ function(w, _, h) {
224
+ var v = h(4), s = h(0), g = h(7), u = h(2), f = h(1), l = f.isDedicatedWorkerScope, d = typeof self < "u" && l(self);
224
225
  s.disableWorkerBehaviour = d ? u() : function() {
225
226
  }, s.createWorker = function() {
226
227
  var i = v(
@@ -230,11 +231,11 @@ function z() {
230
231
  return i.terminate = function() {
231
232
  URL.revokeObjectURL(i.objectURL), r.call(i);
232
233
  }, i;
233
- }, s.createHash = y, x.exports = s;
234
+ }, s.createHash = g, w.exports = s;
234
235
  },
235
236
  /* 4 */
236
237
  /***/
237
- function(x, b, p) {
238
+ function(w, _, h) {
238
239
  function v(i) {
239
240
  var r = {};
240
241
  function t(e) {
@@ -286,7 +287,7 @@ function z() {
286
287
  var c = t(t.s = ENTRY_MODULE);
287
288
  return c.default || c;
288
289
  }
289
- var s = "[\\.|\\-|\\+|\\w|/|@]+", y = "\\((/\\*.*?\\*/)?s?.*?(" + s + ").*?\\)";
290
+ var s = "[\\.|\\-|\\+|\\w|/|@]+", g = "\\((/\\*.*?\\*/)?s?.*?(" + s + ").*?\\)";
290
291
  function u(i) {
291
292
  return (i + "").replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&");
292
293
  }
@@ -295,10 +296,10 @@ function z() {
295
296
  c[t] = [];
296
297
  var e = r.toString(), o = e.match(/^function\s?\(\w+,\s*\w+,\s*(\w+)\)/);
297
298
  if (!o) return c;
298
- for (var n = o[1], h = new RegExp("(\\\\n|\\W)" + u(n) + y, "g"), a; a = h.exec(e); )
299
+ for (var n = o[1], p = new RegExp("(\\\\n|\\W)" + u(n) + g, "g"), a; a = p.exec(e); )
299
300
  a[3] !== "dll-reference" && c[t].push(a[3]);
300
- for (h = new RegExp("\\(" + u(n) + '\\("(dll-reference\\s(' + s + '))"\\)\\)' + y, "g"); a = h.exec(e); )
301
- i[a[2]] || (c[t].push(a[1]), i[a[2]] = p(a[1]).m), c[a[2]] = c[a[2]] || [], c[a[2]].push(a[4]);
301
+ for (p = new RegExp("\\(" + u(n) + '\\("(dll-reference\\s(' + s + '))"\\)\\)' + g, "g"); a = p.exec(e); )
302
+ i[a[2]] || (c[t].push(a[1]), i[a[2]] = h(a[1]).m), c[a[2]] = c[a[2]] || [], c[a[2]].push(a[4]);
302
303
  return c;
303
304
  }
304
305
  function l(i) {
@@ -316,69 +317,69 @@ function z() {
316
317
  main: {}
317
318
  }; l(t); )
318
319
  for (var o = Object.keys(t), n = 0; n < o.length; n++) {
319
- var h = o[n], a = t[h], w = a.pop();
320
- if (e[h] = e[h] || {}, !(e[h][w] || !i[h][w])) {
321
- e[h][w] = !0, c[h] = c[h] || [], c[h].push(w);
322
- for (var m = f(i, i[h][w], h), C = Object.keys(m), S = 0; S < C.length; S++)
323
- t[C[S]] = t[C[S]] || [], t[C[S]] = t[C[S]].concat(m[C[S]]);
320
+ var p = o[n], a = t[p], x = a.pop();
321
+ if (e[p] = e[p] || {}, !(e[p][x] || !i[p][x])) {
322
+ e[p][x] = !0, c[p] = c[p] || [], c[p].push(x);
323
+ for (var b = f(i, i[p][x], p), C = Object.keys(b), S = 0; S < C.length; S++)
324
+ t[C[S]] = t[C[S]] || [], t[C[S]] = t[C[S]].concat(b[C[S]]);
324
325
  }
325
326
  }
326
327
  return c;
327
328
  }
328
- x.exports = function(i, r) {
329
+ w.exports = function(i, r) {
329
330
  r = r || {};
330
331
  var t = {
331
- main: p.m
332
+ main: h.m
332
333
  }, c = r.all ? { main: Object.keys(t) } : d(t, i), e = "";
333
- Object.keys(c).filter(function(w) {
334
- return w !== "main";
335
- }).forEach(function(w) {
336
- for (var m = 0; c[w][m]; )
337
- m++;
338
- c[w].push(m), t[w][m] = "(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })", e = e + "var " + w + " = (" + v.toString().replace("ENTRY_MODULE", JSON.stringify(m)) + ")({" + c[w].map(function(C) {
339
- return "" + JSON.stringify(C) + ": " + t[w][C].toString();
334
+ Object.keys(c).filter(function(x) {
335
+ return x !== "main";
336
+ }).forEach(function(x) {
337
+ for (var b = 0; c[x][b]; )
338
+ b++;
339
+ c[x].push(b), t[x][b] = "(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })", e = e + "var " + x + " = (" + v.toString().replace("ENTRY_MODULE", JSON.stringify(b)) + ")({" + c[x].map(function(C) {
340
+ return "" + JSON.stringify(C) + ": " + t[x][C].toString();
340
341
  }).join(",") + `});
341
342
  `;
342
- }), e = e + "(" + v.toString().replace("ENTRY_MODULE", JSON.stringify(i)) + ")({" + c.main.map(function(w) {
343
- return "" + JSON.stringify(w) + ": " + t.main[w].toString();
343
+ }), e = e + "(" + v.toString().replace("ENTRY_MODULE", JSON.stringify(i)) + ")({" + c.main.map(function(x) {
344
+ return "" + JSON.stringify(x) + ": " + t.main[x].toString();
344
345
  }).join(",") + "})(self);";
345
346
  var o = new window.Blob([e], { type: "text/javascript" });
346
347
  if (r.bare)
347
348
  return o;
348
- var n = window.URL || window.webkitURL || window.mozURL || window.msURL, h = n.createObjectURL(o), a = new window.Worker(h);
349
- return a.objectURL = h, a;
349
+ var n = window.URL || window.webkitURL || window.mozURL || window.msURL, p = n.createObjectURL(o), a = new window.Worker(p);
350
+ return a.objectURL = p, a;
350
351
  };
351
352
  },
352
353
  /* 5 */
353
354
  /***/
354
- function(x, b) {
355
- x.exports = function(v, s, y) {
356
- var u = new v.Int32Array(y);
355
+ function(w, _) {
356
+ w.exports = function(v, s, g) {
357
+ var u = new v.Int32Array(g);
357
358
  function f(l, d) {
358
359
  l = l | 0, d = d | 0;
359
- var i = 0, r = 0, t = 0, c = 0, e = 0, o = 0, n = 0, h = 0, a = 0, w = 0, m = 0, C = 0, S = 0, A = 0;
360
- for (t = u[d + 320 >> 2] | 0, e = u[d + 324 >> 2] | 0, n = u[d + 328 >> 2] | 0, a = u[d + 332 >> 2] | 0, m = u[d + 336 >> 2] | 0, i = 0; (i | 0) < (l | 0); i = i + 64 | 0) {
361
- for (c = t, o = e, h = n, w = a, C = m, r = 0; (r | 0) < 64; r = r + 4 | 0)
362
- A = u[i + r >> 2] | 0, S = ((t << 5 | t >>> 27) + (e & n | ~e & a) | 0) + ((A + m | 0) + 1518500249 | 0) | 0, m = a, a = n, n = e << 30 | e >>> 2, e = t, t = S, u[l + r >> 2] = A;
360
+ var i = 0, r = 0, t = 0, c = 0, e = 0, o = 0, n = 0, p = 0, a = 0, x = 0, b = 0, C = 0, S = 0, A = 0;
361
+ for (t = u[d + 320 >> 2] | 0, e = u[d + 324 >> 2] | 0, n = u[d + 328 >> 2] | 0, a = u[d + 332 >> 2] | 0, b = u[d + 336 >> 2] | 0, i = 0; (i | 0) < (l | 0); i = i + 64 | 0) {
362
+ for (c = t, o = e, p = n, x = a, C = b, r = 0; (r | 0) < 64; r = r + 4 | 0)
363
+ A = u[i + r >> 2] | 0, S = ((t << 5 | t >>> 27) + (e & n | ~e & a) | 0) + ((A + b | 0) + 1518500249 | 0) | 0, b = a, a = n, n = e << 30 | e >>> 2, e = t, t = S, u[l + r >> 2] = A;
363
364
  for (r = l + 64 | 0; (r | 0) < (l + 80 | 0); r = r + 4 | 0)
364
- A = (u[r - 12 >> 2] ^ u[r - 32 >> 2] ^ u[r - 56 >> 2] ^ u[r - 64 >> 2]) << 1 | (u[r - 12 >> 2] ^ u[r - 32 >> 2] ^ u[r - 56 >> 2] ^ u[r - 64 >> 2]) >>> 31, S = ((t << 5 | t >>> 27) + (e & n | ~e & a) | 0) + ((A + m | 0) + 1518500249 | 0) | 0, m = a, a = n, n = e << 30 | e >>> 2, e = t, t = S, u[r >> 2] = A;
365
+ A = (u[r - 12 >> 2] ^ u[r - 32 >> 2] ^ u[r - 56 >> 2] ^ u[r - 64 >> 2]) << 1 | (u[r - 12 >> 2] ^ u[r - 32 >> 2] ^ u[r - 56 >> 2] ^ u[r - 64 >> 2]) >>> 31, S = ((t << 5 | t >>> 27) + (e & n | ~e & a) | 0) + ((A + b | 0) + 1518500249 | 0) | 0, b = a, a = n, n = e << 30 | e >>> 2, e = t, t = S, u[r >> 2] = A;
365
366
  for (r = l + 80 | 0; (r | 0) < (l + 160 | 0); r = r + 4 | 0)
366
- A = (u[r - 12 >> 2] ^ u[r - 32 >> 2] ^ u[r - 56 >> 2] ^ u[r - 64 >> 2]) << 1 | (u[r - 12 >> 2] ^ u[r - 32 >> 2] ^ u[r - 56 >> 2] ^ u[r - 64 >> 2]) >>> 31, S = ((t << 5 | t >>> 27) + (e ^ n ^ a) | 0) + ((A + m | 0) + 1859775393 | 0) | 0, m = a, a = n, n = e << 30 | e >>> 2, e = t, t = S, u[r >> 2] = A;
367
+ A = (u[r - 12 >> 2] ^ u[r - 32 >> 2] ^ u[r - 56 >> 2] ^ u[r - 64 >> 2]) << 1 | (u[r - 12 >> 2] ^ u[r - 32 >> 2] ^ u[r - 56 >> 2] ^ u[r - 64 >> 2]) >>> 31, S = ((t << 5 | t >>> 27) + (e ^ n ^ a) | 0) + ((A + b | 0) + 1859775393 | 0) | 0, b = a, a = n, n = e << 30 | e >>> 2, e = t, t = S, u[r >> 2] = A;
367
368
  for (r = l + 160 | 0; (r | 0) < (l + 240 | 0); r = r + 4 | 0)
368
- A = (u[r - 12 >> 2] ^ u[r - 32 >> 2] ^ u[r - 56 >> 2] ^ u[r - 64 >> 2]) << 1 | (u[r - 12 >> 2] ^ u[r - 32 >> 2] ^ u[r - 56 >> 2] ^ u[r - 64 >> 2]) >>> 31, S = ((t << 5 | t >>> 27) + (e & n | e & a | n & a) | 0) + ((A + m | 0) - 1894007588 | 0) | 0, m = a, a = n, n = e << 30 | e >>> 2, e = t, t = S, u[r >> 2] = A;
369
+ A = (u[r - 12 >> 2] ^ u[r - 32 >> 2] ^ u[r - 56 >> 2] ^ u[r - 64 >> 2]) << 1 | (u[r - 12 >> 2] ^ u[r - 32 >> 2] ^ u[r - 56 >> 2] ^ u[r - 64 >> 2]) >>> 31, S = ((t << 5 | t >>> 27) + (e & n | e & a | n & a) | 0) + ((A + b | 0) - 1894007588 | 0) | 0, b = a, a = n, n = e << 30 | e >>> 2, e = t, t = S, u[r >> 2] = A;
369
370
  for (r = l + 240 | 0; (r | 0) < (l + 320 | 0); r = r + 4 | 0)
370
- A = (u[r - 12 >> 2] ^ u[r - 32 >> 2] ^ u[r - 56 >> 2] ^ u[r - 64 >> 2]) << 1 | (u[r - 12 >> 2] ^ u[r - 32 >> 2] ^ u[r - 56 >> 2] ^ u[r - 64 >> 2]) >>> 31, S = ((t << 5 | t >>> 27) + (e ^ n ^ a) | 0) + ((A + m | 0) - 899497514 | 0) | 0, m = a, a = n, n = e << 30 | e >>> 2, e = t, t = S, u[r >> 2] = A;
371
- t = t + c | 0, e = e + o | 0, n = n + h | 0, a = a + w | 0, m = m + C | 0;
371
+ A = (u[r - 12 >> 2] ^ u[r - 32 >> 2] ^ u[r - 56 >> 2] ^ u[r - 64 >> 2]) << 1 | (u[r - 12 >> 2] ^ u[r - 32 >> 2] ^ u[r - 56 >> 2] ^ u[r - 64 >> 2]) >>> 31, S = ((t << 5 | t >>> 27) + (e ^ n ^ a) | 0) + ((A + b | 0) - 899497514 | 0) | 0, b = a, a = n, n = e << 30 | e >>> 2, e = t, t = S, u[r >> 2] = A;
372
+ t = t + c | 0, e = e + o | 0, n = n + p | 0, a = a + x | 0, b = b + C | 0;
372
373
  }
373
- u[d + 320 >> 2] = t, u[d + 324 >> 2] = e, u[d + 328 >> 2] = n, u[d + 332 >> 2] = a, u[d + 336 >> 2] = m;
374
+ u[d + 320 >> 2] = t, u[d + 324 >> 2] = e, u[d + 328 >> 2] = n, u[d + 332 >> 2] = a, u[d + 336 >> 2] = b;
374
375
  }
375
376
  return { hash: f };
376
377
  };
377
378
  },
378
379
  /* 6 */
379
380
  /***/
380
- function(x, b) {
381
- var p = this, v = void 0;
381
+ function(w, _) {
382
+ var h = this, v = void 0;
382
383
  typeof self < "u" && typeof self.FileReaderSync < "u" && (v = new self.FileReaderSync());
383
384
  var s = function(f, l, d, i, r, t) {
384
385
  var c = void 0, e = t % 4, o = (r + e) % 4, n = r - o;
@@ -404,7 +405,7 @@ function z() {
404
405
  l[t + n + 3 | 0] = f.charCodeAt(i + n);
405
406
  }
406
407
  }
407
- }, y = function(f, l, d, i, r, t) {
408
+ }, g = function(f, l, d, i, r, t) {
408
409
  var c = void 0, e = t % 4, o = (r + e) % 4, n = r - o;
409
410
  switch (e) {
410
411
  case 0:
@@ -429,39 +430,39 @@ function z() {
429
430
  }
430
431
  }
431
432
  }, u = function(f, l, d, i, r, t) {
432
- var c = void 0, e = t % 4, o = (r + e) % 4, n = r - o, h = new Uint8Array(v.readAsArrayBuffer(f.slice(i, i + r)));
433
+ var c = void 0, e = t % 4, o = (r + e) % 4, n = r - o, p = new Uint8Array(v.readAsArrayBuffer(f.slice(i, i + r)));
433
434
  switch (e) {
434
435
  case 0:
435
- l[t] = h[3];
436
+ l[t] = p[3];
436
437
  case 1:
437
- l[t + 1 - (e << 1) | 0] = h[2];
438
+ l[t + 1 - (e << 1) | 0] = p[2];
438
439
  case 2:
439
- l[t + 2 - (e << 1) | 0] = h[1];
440
+ l[t + 2 - (e << 1) | 0] = p[1];
440
441
  case 3:
441
- l[t + 3 - (e << 1) | 0] = h[0];
442
+ l[t + 3 - (e << 1) | 0] = p[0];
442
443
  }
443
444
  if (!(r < o + (4 - e))) {
444
445
  for (c = 4 - e; c < n; c = c + 4 | 0)
445
- d[t + c >> 2 | 0] = h[c] << 24 | h[c + 1] << 16 | h[c + 2] << 8 | h[c + 3];
446
+ d[t + c >> 2 | 0] = p[c] << 24 | p[c + 1] << 16 | p[c + 2] << 8 | p[c + 3];
446
447
  switch (o) {
447
448
  case 3:
448
- l[t + n + 1 | 0] = h[n + 2];
449
+ l[t + n + 1 | 0] = p[n + 2];
449
450
  case 2:
450
- l[t + n + 2 | 0] = h[n + 1];
451
+ l[t + n + 2 | 0] = p[n + 1];
451
452
  case 1:
452
- l[t + n + 3 | 0] = h[n];
453
+ l[t + n + 3 | 0] = p[n];
453
454
  }
454
455
  }
455
456
  };
456
- x.exports = function(f, l, d, i, r, t) {
457
+ w.exports = function(f, l, d, i, r, t) {
457
458
  if (typeof f == "string")
458
459
  return s(f, l, d, i, r, t);
459
- if (f instanceof Array || p && p.Buffer && p.Buffer.isBuffer(f))
460
- return y(f, l, d, i, r, t);
460
+ if (f instanceof Array || h && h.Buffer && h.Buffer.isBuffer(f))
461
+ return g(f, l, d, i, r, t);
461
462
  if (f instanceof ArrayBuffer)
462
- return y(new Uint8Array(f), l, d, i, r, t);
463
+ return g(new Uint8Array(f), l, d, i, r, t);
463
464
  if (f.buffer instanceof ArrayBuffer)
464
- return y(new Uint8Array(f.buffer, f.byteOffset, f.byteLength), l, d, i, r, t);
465
+ return g(new Uint8Array(f.buffer, f.byteOffset, f.byteLength), l, d, i, r, t);
465
466
  if (f instanceof Blob)
466
467
  return u(f, l, d, i, r, t);
467
468
  throw new Error("Unsupported data type.");
@@ -469,7 +470,7 @@ function z() {
469
470
  },
470
471
  /* 7 */
471
472
  /***/
472
- function(x, b, p) {
473
+ function(w, _, h) {
473
474
  var v = /* @__PURE__ */ function() {
474
475
  function d(i, r) {
475
476
  for (var t = 0; t < r.length; t++) {
@@ -485,9 +486,9 @@ function z() {
485
486
  if (!(d instanceof i))
486
487
  throw new TypeError("Cannot call a class as a function");
487
488
  }
488
- var y = p(0), u = p(1), f = u.toHex, l = function() {
489
+ var g = h(0), u = h(1), f = u.toHex, l = function() {
489
490
  function d() {
490
- s(this, d), this._rusha = new y(), this._rusha.resetState();
491
+ s(this, d), this._rusha = new g(), this._rusha.resetState();
491
492
  }
492
493
  return d.prototype.update = function(r) {
493
494
  return this._rusha.append(r), this;
@@ -508,7 +509,7 @@ function z() {
508
509
  }
509
510
  }]), d;
510
511
  }();
511
- x.exports = function() {
512
+ w.exports = function() {
512
513
  return new l();
513
514
  };
514
515
  }
@@ -518,101 +519,114 @@ function z() {
518
519
  });
519
520
  }(L)), L.exports;
520
521
  }
521
- var P = z();
522
- const G = /* @__PURE__ */ F(P), J = new G(), R = (g) => g.startsWith(".") || g === "__MACOSX" || g === "node_modules", $ = (g) => g.split("/").some((_) => _ && R(_)), k = (g) => g.startsWith("/") ? g : `/${g}`;
523
- function O(g, _, x) {
522
+ var $ = J();
523
+ const N = /* @__PURE__ */ P($), Y = new N(), R = (y) => /\.html?$/i.test(y), B = (y) => /\.zip$/i.test(y), O = (y) => y.startsWith(".") || y === "__MACOSX" || y === "node_modules", Z = (y) => y.split("/").some((m) => m && O(m)), k = (y) => y.startsWith("/") ? y : `/${y}`;
524
+ function E(y, m, w) {
524
525
  return {
525
- path: k(g),
526
- size: _.byteLength,
527
- sha: J.digest(_),
528
- content: _,
529
- name: x
526
+ path: k(y),
527
+ size: m.byteLength,
528
+ sha: Y.digest(m),
529
+ content: m,
530
+ name: w
530
531
  };
531
532
  }
532
- async function D(g) {
533
- const _ = await new Promise((b, p) => g.file(b, p)), x = await _.arrayBuffer();
534
- return O(g.fullPath, x, _.name);
533
+ async function W(y) {
534
+ const m = await new Promise((_, h) => y.file(_, h)), w = await m.arrayBuffer();
535
+ return E(y.fullPath, w, m.name);
535
536
  }
536
- async function B(g) {
537
- const _ = g.createReader(), x = [];
537
+ async function j(y) {
538
+ const m = y.createReader(), w = [];
538
539
  for (; ; ) {
539
- const b = await new Promise((p, v) => _.readEntries(p, v));
540
- if (!b.length) break;
541
- for (const p of b)
542
- R(p.name) || x.push(...p.isDirectory ? await B(p) : [await D(p)]);
540
+ const _ = await new Promise((h, v) => m.readEntries(h, v));
541
+ if (!_.length) break;
542
+ for (const h of _)
543
+ O(h.name) || w.push(...h.isDirectory ? await j(h) : [await W(h)]);
543
544
  }
544
- return x;
545
+ return w;
545
546
  }
546
- async function V(g) {
547
- var p;
548
- const _ = (p = g.files) == null ? void 0 : p[0];
549
- if (g.files.length === 1 && _ && /\.zip$/i.test(_.name))
550
- return U(_);
551
- const b = Array.from(g.items ?? []).map((v) => {
547
+ async function K(y) {
548
+ var h;
549
+ const m = (h = y.files) == null ? void 0 : h[0];
550
+ if (y.files.length === 1 && m && B(m.name))
551
+ return I(m);
552
+ const _ = Array.from(y.items ?? []).map((v) => {
552
553
  var s;
553
554
  return (s = v.webkitGetAsEntry) == null ? void 0 : s.call(v);
554
555
  }).filter(Boolean);
555
- if (b.length) {
556
+ if (_.length) {
557
+ if (_.length === 1 && !_[0].isDirectory && !R(_[0].name))
558
+ throw new U();
556
559
  const v = await Promise.all(
557
- b.map(
558
- (s) => R(s.name) ? [] : s.isDirectory ? B(s) : D(s).then((y) => [y])
560
+ _.map(
561
+ (s) => O(s.name) ? [] : s.isDirectory ? j(s) : W(s).then((g) => [g])
559
562
  )
560
563
  );
561
- return E(v.flat());
564
+ return M(v.flat());
562
565
  }
563
- return Y(g.files);
566
+ return Q(y.files);
564
567
  }
565
- async function Y(g) {
566
- const _ = Array.from(g);
567
- if (_.length === 1 && /\.zip$/i.test(_[0].name))
568
- return U(_[0]);
569
- const x = [];
570
- for (const b of _) {
571
- const p = b.webkitRelativePath || b.name;
572
- x.push(O(p, await b.arrayBuffer(), b.name));
568
+ async function Q(y) {
569
+ const m = Array.from(y);
570
+ if (m.length === 1 && B(m[0].name))
571
+ return I(m[0]);
572
+ if (m.length === 1 && !R(m[0].name))
573
+ throw new U();
574
+ const w = [];
575
+ for (const _ of m) {
576
+ const h = _.webkitRelativePath || _.name;
577
+ w.push(E(h, await _.arrayBuffer(), _.name));
573
578
  }
574
- return E(x);
579
+ return M(w);
575
580
  }
576
- async function U(g) {
577
- const { unzip: _ } = await import("../../../../chunks/browser.D58rdxmc.js"), x = new Uint8Array(await g.arrayBuffer()), b = await new Promise(
578
- (v, s) => _(x, (y, u) => y ? s(y) : v(u))
579
- ), p = [];
580
- for (const [v, s] of Object.entries(b)) {
581
- if (v.endsWith("/") || $(v)) continue;
582
- const y = s.buffer.slice(
581
+ async function I(y) {
582
+ const { unzip: m } = await import("../../../../chunks/browser.D58rdxmc.js"), w = new Uint8Array(await y.arrayBuffer()), _ = await new Promise(
583
+ (v, s) => m(w, (g, u) => g ? s(g) : v(u))
584
+ ), h = [];
585
+ for (const [v, s] of Object.entries(_)) {
586
+ if (v.endsWith("/") || Z(v)) continue;
587
+ const g = s.buffer.slice(
583
588
  s.byteOffset,
584
589
  s.byteOffset + s.byteLength
585
590
  );
586
- p.push(O(v, y, v.split("/").pop()));
591
+ h.push(E(v, g, v.split("/").pop()));
587
592
  }
588
- return E(p);
593
+ return M(h);
589
594
  }
590
- function E(g) {
591
- if (!g.length) return g;
592
- const _ = (p) => k(p).split("/").slice(1);
593
- let x = _(g[0].path).slice(0, -1);
594
- for (const p of g) {
595
- const v = _(p.path);
595
+ function M(y) {
596
+ if (!y.length) return y;
597
+ const m = (h) => k(h).split("/").slice(1);
598
+ let w = m(y[0].path).slice(0, -1);
599
+ for (const h of y) {
600
+ const v = m(h.path);
596
601
  let s = 0;
597
- for (; s < x.length && s < v.length - 1 && x[s] === v[s]; ) s++;
598
- x = x.slice(0, s);
602
+ for (; s < w.length && s < v.length - 1 && w[s] === v[s]; ) s++;
603
+ w = w.slice(0, s);
599
604
  }
600
- if (!x.length) return g;
601
- const b = "/" + x.join("/");
602
- return g.map((p) => ({ ...p, path: k(p.path.slice(b.length)) }));
605
+ if (!w.length) return y;
606
+ const _ = "/" + w.join("/");
607
+ return y.map((h) => ({ ...h, path: k(h.path.slice(_.length)) }));
603
608
  }
604
- const W = (g) => g.filter((_) => /\.html?$/i.test(_.name)), j = (g) => g.some((_) => /^index\.html?$/i.test(_.name));
605
- function Z(g) {
606
- const _ = W(g);
607
- return j(_) ? null : _.length === 1 ? _[0].name : null;
609
+ const F = (y) => y.filter((m) => R(m.name)), z = (y) => y.some((m) => /^index\.html?$/i.test(m.name));
610
+ function V(y) {
611
+ const m = F(y);
612
+ return z(m) ? null : m.length === 1 ? m[0].name : null;
608
613
  }
609
- function X(g) {
610
- const _ = W(g);
611
- return _.length > 1 && !j(_);
614
+ function q(y) {
615
+ const m = F(y);
616
+ return m.length > 1 && !z(m);
617
+ }
618
+ function H(y) {
619
+ const m = V(y);
620
+ return m ? y.map((w) => {
621
+ if (w.name !== m) return w;
622
+ const _ = w.path.lastIndexOf("/"), h = _ === -1 ? "" : w.path.slice(0, _);
623
+ return { ...w, name: "index.html", path: k(`${h}/index.html`) };
624
+ }) : y;
612
625
  }
613
626
  export {
614
- Z as getSingleNonIndexHtmlFileName,
615
- X as hasMultipleHtmlFilesWithoutIndex,
616
- V as readDataTransfer,
617
- Y as readFileList
627
+ V as getSingleNonIndexHtmlFileName,
628
+ q as hasMultipleHtmlFilesWithoutIndex,
629
+ K as readDataTransfer,
630
+ Q as readFileList,
631
+ H as renameSingleNonIndexHtmlToIndex
618
632
  };
@@ -1,9 +1,9 @@
1
- import { d as p, A as S } from "../../../chunks/hooks.module.DRcxknIz.js";
2
- import { getSingleNonIndexHtmlFileName as b, hasMultipleHtmlFilesWithoutIndex as I } from "./drop-core/readFiles.js";
3
- import { AnonymousDropClient as z } from "./drop-core/client.js";
4
- import { deployFiles as F } from "./drop-core/deploy.js";
1
+ import { d as p, A as I } from "../../../chunks/hooks.module.DRcxknIz.js";
2
+ import { renameSingleNonIndexHtmlToIndex as S, getSingleNonIndexHtmlFileName as b, hasMultipleHtmlFilesWithoutIndex as z } from "./drop-core/readFiles.js";
3
+ import { AnonymousDropClient as F } from "./drop-core/client.js";
4
+ import { deployFiles as H } from "./drop-core/deploy.js";
5
5
  import { humanizeDropError as E } from "./drop-core/errors.js";
6
- function H(e) {
6
+ function W(e) {
7
7
  switch (e.phase) {
8
8
  case "creating":
9
9
  return { kind: "creating" };
@@ -14,51 +14,51 @@ function H(e) {
14
14
  return { kind: "processing" };
15
15
  }
16
16
  }
17
- function W(e) {
17
+ function $(e) {
18
18
  const d = b(e);
19
- return d ? `No index.html found — "${d}" won’t be served at the site root.` : I(e) ? "No index.html found — your site may not have a landing page." : null;
19
+ return d ? `No index.html found — "${d}" won’t be served at the site root.` : z(e) ? "No index.html found — your site may not have a landing page." : null;
20
20
  }
21
21
  function P({
22
22
  apiBase: e,
23
23
  client: d,
24
24
  claimUrl: f,
25
- onDeploy: a,
26
- track: l
25
+ onDeploy: l,
26
+ track: a
27
27
  }) {
28
- const [u, t] = p({ kind: "idle" }), [g, c] = p(null), h = S(d ?? new z(e)).current, y = u.kind !== "idle" && u.kind !== "error";
28
+ const [u, t] = p({ kind: "idle" }), [g, c] = p(null), h = I(d ?? new F(e)).current, y = u.kind !== "idle" && u.kind !== "error";
29
29
  async function k(N, s) {
30
30
  c(null), t({ kind: "reading" });
31
31
  const m = (n, i, o) => {
32
- t({ kind: "error", message: n }), l("dropzone_deploy_failed", { method: s, reason: i, ...o });
33
- }, w = (n, i) => {
32
+ t({ kind: "error", message: n }), a("dropzone_deploy_failed", { method: s, reason: i, ...o });
33
+ }, x = (n, i) => {
34
34
  const o = n instanceof Error ? n.message : String(n);
35
35
  m(E(n), o, i);
36
36
  };
37
37
  try {
38
- const n = await N();
38
+ const n = S(await N());
39
39
  if (!n.length) {
40
40
  m("No files found to deploy.", "No files found to deploy.", { file_count: 0 });
41
41
  return;
42
42
  }
43
- s === "drag" && l("dropzone_files_dropped", { method: s, file_count: n.length }), c(W(n));
43
+ s === "drag" && a("dropzone_files_dropped", { method: s, file_count: n.length }), c($(n));
44
44
  const {
45
45
  url: i,
46
46
  token: o,
47
47
  deploy: r
48
- } = await F(h, n, {
49
- onProgress: (x) => t(H(x))
48
+ } = await H(h, n, {
49
+ onProgress: (w) => t(W(w))
50
50
  });
51
51
  try {
52
52
  localStorage.setItem("drop-token", o), localStorage.setItem("dropSiteName", r.subdomain);
53
53
  } catch {
54
54
  }
55
- t({ kind: "redirecting" }), l("dropzone_deploy_succeeded", {
55
+ t({ kind: "redirecting" }), a("dropzone_deploy_succeeded", {
56
56
  method: s,
57
57
  site_name: r.subdomain,
58
58
  file_count: n.length
59
- }), a == null || a({ url: i, token: o, siteName: r.subdomain, siteId: r.id }), window.location.assign(`${f(r.subdomain)}#drop_token=${o}`);
59
+ }), l == null || l({ url: i, token: o, siteName: r.subdomain, siteId: r.id }), window.location.assign(`${f(r.subdomain)}#drop_token=${o}`);
60
60
  } catch (n) {
61
- w(n);
61
+ x(n);
62
62
  }
63
63
  }
64
64
  function _() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@netlify/spark-ui",
3
3
  "description": "Assets, design tokens, components, and utilities",
4
- "version": "1.27.4",
4
+ "version": "1.27.6",
5
5
  "type": "module",
6
6
  "main": "dist/components/preact/index.js",
7
7
  "types": "dist/components/preact/index.d.ts",
@@ -1,3 +1,17 @@
1
+ /**
2
+ * Thrown when the user drops or picks a single loose file that Drop can't turn
3
+ * into a site on its own — anything that isn't a `.zip` (a site archive) or an
4
+ * HTML page (served as index.html). A folder, multiple files, a zip, or a lone
5
+ * HTML file are all fine; any other single file is rejected rather than
6
+ * deployed as a one-asset site (matches react-ui).
7
+ */
8
+ export class UnsupportedDropError extends Error {
9
+ constructor() {
10
+ super('unsupported single file');
11
+ this.name = 'UnsupportedDropError';
12
+ }
13
+ }
14
+
1
15
  /**
2
16
  * Turn a raw deploy failure into copy a non-technical user can act on.
3
17
  * The original message is still tracked via analytics — this is only for display.
@@ -5,6 +19,10 @@
5
19
  export function humanizeDropError(err: unknown): string {
6
20
  if (!(err instanceof Error)) return 'Something went wrong. Please try again.';
7
21
 
22
+ if (err instanceof UnsupportedDropError) {
23
+ return 'To deploy, drop a folder or a .zip file — or a single HTML page.';
24
+ }
25
+
8
26
  if (err.message === 'Deploy did not become ready in time') {
9
27
  return 'Your site is taking longer than expected to go live. Please try again in a moment.';
10
28
  }
@@ -1,10 +1,15 @@
1
1
  import Rusha from 'rusha';
2
2
  import type { ProcessedFile } from './types';
3
+ import { UnsupportedDropError } from './errors';
3
4
 
4
5
  /* eslint-disable @typescript-eslint/no-explicit-any -- webkit FileSystem entry APIs are untyped */
5
6
 
6
7
  const rusha = new Rusha();
7
8
 
9
+ /** A file we can serve as a page: `.html` / `.htm` (a lone one becomes index.html). */
10
+ const isHtmlName = (name: string) => /\.html?$/i.test(name);
11
+ const isZipName = (name: string) => /\.zip$/i.test(name);
12
+
8
13
  /** A single path segment we never deploy: dotfiles, macOS metadata, deps. */
9
14
  const isJunkName = (name: string) =>
10
15
  name.startsWith('.') || name === '__MACOSX' || name === 'node_modules';
@@ -58,12 +63,18 @@ async function readDirEntry(entry: any): Promise<ProcessedFile[]> {
58
63
  export async function readDataTransfer(dt: DataTransfer): Promise<ProcessedFile[]> {
59
64
  // single zip?
60
65
  const first = dt.files?.[0];
61
- if (dt.files.length === 1 && first && /\.zip$/i.test(first.name)) {
66
+ if (dt.files.length === 1 && first && isZipName(first.name)) {
62
67
  return readZip(first);
63
68
  }
64
69
  const items = Array.from(dt.items ?? []);
65
70
  const entries = items.map(i => i.webkitGetAsEntry?.()).filter(Boolean) as any[];
66
71
  if (entries.length) {
72
+ // A single loose file that isn't a zip (handled above) or an HTML page
73
+ // can't stand up a site on its own — reject it rather than deploy one
74
+ // stray asset. A lone folder (isDirectory) or multiple entries are fine.
75
+ if (entries.length === 1 && !entries[0].isDirectory && !isHtmlName(entries[0].name)) {
76
+ throw new UnsupportedDropError();
77
+ }
67
78
  const nested = await Promise.all(
68
79
  entries.map(e =>
69
80
  isJunkName(e.name) ? [] : e.isDirectory ? readDirEntry(e) : readFileEntry(e).then(f => [f])
@@ -79,9 +90,14 @@ export async function readDataTransfer(dt: DataTransfer): Promise<ProcessedFile[
79
90
 
80
91
  export async function readFileList(files: FileList): Promise<ProcessedFile[]> {
81
92
  const list = Array.from(files);
82
- if (list.length === 1 && /\.zip$/i.test(list[0].name)) {
93
+ if (list.length === 1 && isZipName(list[0].name)) {
83
94
  return readZip(list[0]);
84
95
  }
96
+ // Same single-loose-file guard as the drag path (also the drag fallback when
97
+ // the entries API is unavailable): only a zip or an HTML page may stand alone.
98
+ if (list.length === 1 && !isHtmlName(list[0].name)) {
99
+ throw new UnsupportedDropError();
100
+ }
85
101
  const out: ProcessedFile[] = [];
86
102
  for (const file of list) {
87
103
  const rel = (file as any).webkitRelativePath || file.name;
@@ -133,7 +149,7 @@ function normalizeFiles(files: ProcessedFile[]): ProcessedFile[] {
133
149
 
134
150
  // --- index.html validation (UI can surface these as warnings) ---------------
135
151
 
136
- const htmlFiles = (files: ProcessedFile[]) => files.filter(f => /\.html?$/i.test(f.name));
152
+ const htmlFiles = (files: ProcessedFile[]) => files.filter(f => isHtmlName(f.name));
137
153
  const hasIndex = (html: ProcessedFile[]) => html.some(f => /^index\.html?$/i.test(f.name));
138
154
 
139
155
  export function getSingleNonIndexHtmlFileName(files: ProcessedFile[]): string | null {
@@ -146,3 +162,21 @@ export function hasMultipleHtmlFilesWithoutIndex(files: ProcessedFile[]): boolea
146
162
  const html = htmlFiles(files);
147
163
  return html.length > 1 && !hasIndex(html);
148
164
  }
165
+
166
+ /**
167
+ * When the set has no index.html but exactly one HTML file (a lone page
168
+ * alongside its assets, or a single dropped file), rename that file to
169
+ * index.html — keeping its directory — so it is served at the site root
170
+ * instead of 404ing. Content and sha are untouched. Any other set (already has
171
+ * an index, multiple HTML files, or no HTML) is returned unchanged.
172
+ */
173
+ export function renameSingleNonIndexHtmlToIndex(files: ProcessedFile[]): ProcessedFile[] {
174
+ const name = getSingleNonIndexHtmlFileName(files);
175
+ if (!name) return files;
176
+ return files.map(f => {
177
+ if (f.name !== name) return f;
178
+ const slash = f.path.lastIndexOf('/');
179
+ const dir = slash === -1 ? '' : f.path.slice(0, slash);
180
+ return { ...f, name: 'index.html', path: slashPrefix(`${dir}/index.html`) };
181
+ });
182
+ }
@@ -5,6 +5,7 @@ import {
5
5
  getSingleNonIndexHtmlFileName,
6
6
  hasMultipleHtmlFilesWithoutIndex,
7
7
  humanizeDropError,
8
+ renameSingleNonIndexHtmlToIndex,
8
9
  type DeployProgress,
9
10
  type DropClient,
10
11
  type ProcessedFile,
@@ -106,7 +107,11 @@ export function useDropDeploy({
106
107
  };
107
108
 
108
109
  try {
109
- const files = await read();
110
+ // Auto-rename a lone non-index HTML file to index.html so it is served at
111
+ // the site root. Detection (getSingleNonIndexHtmlFileName) sits on the
112
+ // read side; recompute the warning on the renamed set so the fixable
113
+ // single-file case no longer warns and only the multi-HTML case does.
114
+ const files = renameSingleNonIndexHtmlToIndex(await read());
110
115
  if (!files.length) {
111
116
  fail('No files found to deploy.', 'No files found to deploy.', { file_count: 0 });
112
117
  return;