@vizhub/runtime 4.3.0 → 4.5.0
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/dist/build/build.d.ts.map +1 -1
- package/dist/build-4ni0mWxG.cjs +317 -0
- package/dist/build-4ni0mWxG.cjs.map +1 -0
- package/dist/{build-BT6ouBQg.js → build-B7w6NcTo.js} +355 -285
- package/dist/build-B7w6NcTo.js.map +1 -0
- package/dist/common/imageSupport.d.ts +23 -0
- package/dist/common/imageSupport.d.ts.map +1 -0
- package/dist/common/imageSupport.test.d.ts +2 -0
- package/dist/common/imageSupport.test.d.ts.map +1 -0
- package/dist/common/virtualFileSystem.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/test/fixtures/v1/imageSupport.d.ts +18 -0
- package/dist/test/fixtures/v1/imageSupport.d.ts.map +1 -0
- package/dist/test/fixtures/v1/index.d.ts +1 -0
- package/dist/test/fixtures/v1/index.d.ts.map +1 -1
- package/dist/test/fixtures/v2/imageSupport.d.ts +13 -0
- package/dist/test/fixtures/v2/imageSupport.d.ts.map +1 -0
- package/dist/test/fixtures/v2/index.d.ts +1 -0
- package/dist/test/fixtures/v2/index.d.ts.map +1 -1
- package/dist/test/imageSupport.test.d.ts +2 -0
- package/dist/test/imageSupport.test.d.ts.map +1 -0
- package/dist/v3/vizLoad.d.ts.map +1 -1
- package/dist/v3/vizResolve.d.ts.map +1 -1
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +1 -1
- package/package.json +11 -11
- package/dist/build-BT6ouBQg.js.map +0 -1
- package/dist/build-Dh4OViu-.cjs +0 -317
- package/dist/build-Dh4OViu-.cjs.map +0 -1
@@ -1,14 +1,14 @@
|
|
1
1
|
import { magicSandbox as C } from "magic-sandbox";
|
2
|
-
import { isVizId as
|
3
|
-
import { transform as
|
4
|
-
const
|
5
|
-
function
|
2
|
+
import { isVizId as X, getFileText as q, generateVizId as Z, fileCollectionToVizFiles as K, vizFilesToFileCollection as ee } from "@vizhub/viz-utils";
|
3
|
+
import { transform as te } from "sucrase";
|
4
|
+
const qe = () => (Math.random() + "").slice(2);
|
5
|
+
function F(e = {}) {
|
6
6
|
return {
|
7
7
|
name: "sucrase",
|
8
8
|
transform(t, n) {
|
9
9
|
if (!n.match(/\.(?:js|[jt]sx)$/))
|
10
10
|
return null;
|
11
|
-
const
|
11
|
+
const r = te(t, {
|
12
12
|
transforms: ["jsx", "typescript"],
|
13
13
|
// For source maps
|
14
14
|
filePath: n,
|
@@ -19,50 +19,50 @@ function V(e = {}) {
|
|
19
19
|
...e
|
20
20
|
});
|
21
21
|
return {
|
22
|
-
code:
|
23
|
-
map:
|
22
|
+
code: r.code,
|
23
|
+
map: r.sourceMap
|
24
24
|
};
|
25
25
|
}
|
26
26
|
};
|
27
27
|
}
|
28
|
-
const
|
28
|
+
const J = {
|
29
29
|
dependencies: {},
|
30
30
|
vizhub: {},
|
31
31
|
license: "MIT"
|
32
|
-
},
|
32
|
+
}, ne = !1, $ = (e) => {
|
33
33
|
const t = e["package.json"];
|
34
34
|
try {
|
35
|
-
const n = t ? JSON.parse(t) :
|
36
|
-
return
|
35
|
+
const n = t ? JSON.parse(t) : J;
|
36
|
+
return ne && console.log(
|
37
37
|
"[packageJSON] pkg:",
|
38
38
|
JSON.stringify(n, null, 2)
|
39
39
|
), n;
|
40
40
|
} catch {
|
41
|
-
return
|
41
|
+
return J;
|
42
42
|
}
|
43
|
-
},
|
44
|
-
const
|
45
|
-
return
|
46
|
-
},
|
43
|
+
}, W = (e) => $(e).dependencies || {}, V = (e) => ($(e).vizhub || {}).libraries || {}, U = ({ name: e, version: t }, n, r = "jsdelivr") => {
|
44
|
+
const s = n[e] && n[e].path || "";
|
45
|
+
return r === "jsdelivr" ? `https://cdn.jsdelivr.net/npm/${e}@${t}${s}` : `https://unpkg.com/${e}@${t}${s}`;
|
46
|
+
}, re = (e) => {
|
47
47
|
const t = e?.vizhub?.libraries;
|
48
48
|
return t ? Object.entries(t).reduce(
|
49
|
-
(n, [
|
49
|
+
(n, [r, s]) => (s.global && (n[r] = s.global), n),
|
50
50
|
{}
|
51
51
|
) : {};
|
52
|
-
},
|
52
|
+
}, se = {
|
53
53
|
d3: "d3",
|
54
54
|
react: "React",
|
55
55
|
"react-dom": "ReactDOM"
|
56
|
-
},
|
57
|
-
const t =
|
56
|
+
}, G = (e) => {
|
57
|
+
const t = re(e);
|
58
58
|
return {
|
59
|
-
...
|
59
|
+
...se,
|
60
60
|
...t
|
61
61
|
};
|
62
62
|
}, S = (e) => {
|
63
|
-
const [t, ...n] = e.split("/"),
|
64
|
-
return { vizId: t, fileName:
|
65
|
-
},
|
63
|
+
const [t, ...n] = e.split("/"), r = n.join("/");
|
64
|
+
return { vizId: t, fileName: r };
|
65
|
+
}, oe = `var EOL = {},
|
66
66
|
EOF = {},
|
67
67
|
QUOTE = 34,
|
68
68
|
NEWLINE = 10,
|
@@ -182,101 +182,151 @@ var tsv = dsv(' ');
|
|
182
182
|
|
183
183
|
var tsvParse = tsv.parse;
|
184
184
|
|
185
|
-
export { csvParse, tsvParse };`,
|
185
|
+
export { csvParse, tsvParse };`, ie = (e) => (
|
186
186
|
// str.replace(/`/g, '\\`');
|
187
187
|
e.replace(/\\/g, "\\\\").replace(/`/g, "\\`")
|
188
|
-
),
|
188
|
+
), ce = () => ({
|
189
189
|
name: "transformDSV",
|
190
190
|
// `id` here is of the form
|
191
191
|
// `{vizId}/{fileName}`
|
192
192
|
transform: async (e, t) => {
|
193
|
-
const { fileName: n } = S(t),
|
194
|
-
if (
|
193
|
+
const { fileName: n } = S(t), r = n.endsWith(".csv"), s = n.endsWith(".tsv");
|
194
|
+
if (r || s)
|
195
195
|
return {
|
196
196
|
code: `
|
197
|
-
${
|
198
|
-
const data = ${
|
197
|
+
${oe}
|
198
|
+
const data = ${r ? "csvParse" : "tsvParse"}(\`${ie(e)}\`);
|
199
199
|
export default data;
|
200
200
|
`,
|
201
201
|
map: { mappings: "" }
|
202
202
|
};
|
203
203
|
}
|
204
|
-
}),
|
204
|
+
}), ae = (e) => {
|
205
205
|
const t = /^@([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_-]+)$/, n = e.match(t);
|
206
206
|
return n ? {
|
207
207
|
userName: n[1],
|
208
208
|
idOrSlug: n[2]
|
209
209
|
} : null;
|
210
|
-
},
|
210
|
+
}, de = ({
|
211
211
|
vizId: e,
|
212
212
|
slugCache: t
|
213
213
|
}) => ({
|
214
214
|
name: "vizResolve",
|
215
|
-
resolveId: async (n,
|
216
|
-
if (n.startsWith("./") && !
|
215
|
+
resolveId: async (n, r) => {
|
216
|
+
if (n.startsWith("./") && !r?.startsWith("https://")) {
|
217
217
|
let o = n.substring(2);
|
218
|
-
if (!o.endsWith(".js") && !o.endsWith(".css") && !o.endsWith(".csv") && !o.endsWith(".svelte") && (o += ".js"),
|
218
|
+
if (!o.endsWith(".js") && !o.endsWith(".css") && !o.endsWith(".csv") && !o.endsWith(".svelte") && !o.endsWith(".png") && !o.endsWith(".jpg") && !o.endsWith(".jpeg") && !o.endsWith(".gif") && !o.endsWith(".svg") && !o.endsWith(".webp") && !o.endsWith(".bmp") && (o += ".js"), r) {
|
219
219
|
const {
|
220
220
|
vizId: c,
|
221
221
|
fileName: i
|
222
|
-
} = S(
|
223
|
-
return `${c}/${
|
222
|
+
} = S(r), a = i.split("/").slice(0, -1).join("/"), d = a ? `${a}/${o}` : o;
|
223
|
+
return `${c}/${d}`;
|
224
224
|
}
|
225
225
|
return e + "/" + o;
|
226
226
|
}
|
227
|
-
const
|
228
|
-
if (
|
227
|
+
const s = ae(n);
|
228
|
+
if (s) {
|
229
229
|
let o;
|
230
|
-
if (
|
231
|
-
o =
|
230
|
+
if (X(s.idOrSlug))
|
231
|
+
o = s.idOrSlug;
|
232
232
|
else {
|
233
233
|
if (!t)
|
234
234
|
throw new Error(
|
235
235
|
"slugCache is required to import by slug in v3 runtime"
|
236
236
|
);
|
237
237
|
o = await t.get(
|
238
|
-
`${
|
238
|
+
`${s.userName}/${s.idOrSlug}`
|
239
239
|
);
|
240
240
|
}
|
241
241
|
return o + "/index.js";
|
242
242
|
}
|
243
243
|
}
|
244
|
-
}),
|
244
|
+
}), le = [
|
245
|
+
".jpg",
|
246
|
+
".jpeg",
|
247
|
+
".png",
|
248
|
+
".gif",
|
249
|
+
".svg",
|
250
|
+
".webp",
|
251
|
+
".bmp"
|
252
|
+
], z = (e) => {
|
253
|
+
const t = e.toLowerCase().split(".").pop();
|
254
|
+
return t ? le.includes(`.${t}`) : !1;
|
255
|
+
}, ue = (e) => {
|
256
|
+
switch (e.toLowerCase().split(".").pop()) {
|
257
|
+
case "jpg":
|
258
|
+
case "jpeg":
|
259
|
+
return "image/jpeg";
|
260
|
+
case "png":
|
261
|
+
return "image/png";
|
262
|
+
case "gif":
|
263
|
+
return "image/gif";
|
264
|
+
case "svg":
|
265
|
+
return "image/svg+xml";
|
266
|
+
case "webp":
|
267
|
+
return "image/webp";
|
268
|
+
case "bmp":
|
269
|
+
return "image/bmp";
|
270
|
+
default:
|
271
|
+
return "image/png";
|
272
|
+
}
|
273
|
+
}, pe = (e) => {
|
274
|
+
const t = e.replace(/\s/g, "");
|
275
|
+
return /^[A-Za-z0-9+/]*={0,2}$/.test(t);
|
276
|
+
}, P = (e, t) => {
|
277
|
+
const n = ue(e);
|
278
|
+
return e.toLowerCase().split(".").pop() === "svg" && !pe(t) ? `data:${n};utf8,${encodeURIComponent(t)}` : `data:${n};base64,${t}`;
|
279
|
+
}, me = (e, t) => e.replace(
|
280
|
+
/<img([^>]*)\s+src=["']([^"']+)["']([^>]*)>/gi,
|
281
|
+
(n, r, s, o) => {
|
282
|
+
if (t[s] !== void 0 && z(s)) {
|
283
|
+
const c = P(
|
284
|
+
s,
|
285
|
+
t[s]
|
286
|
+
);
|
287
|
+
return `<img${r} src="${c}"${o}>`;
|
288
|
+
}
|
289
|
+
return n;
|
290
|
+
}
|
291
|
+
), fe = ({
|
245
292
|
vizCache: e,
|
246
293
|
trackCSSImport: t,
|
247
294
|
vizId: n,
|
248
|
-
files:
|
295
|
+
files: r
|
249
296
|
}) => ({
|
250
297
|
name: "vizLoad",
|
251
298
|
// `id` here is of the form
|
252
299
|
// `{vizId}/{fileName}`
|
253
|
-
load: async (
|
254
|
-
const o = S(
|
300
|
+
load: async (s) => {
|
301
|
+
const o = S(s), c = o.vizId, i = o.fileName;
|
255
302
|
if (i.endsWith(".css"))
|
256
|
-
return t(
|
303
|
+
return t(s), "";
|
257
304
|
let a = null;
|
258
|
-
if (c === n &&
|
259
|
-
a =
|
305
|
+
if (c === n && r)
|
306
|
+
a = r[i] || null;
|
260
307
|
else {
|
261
|
-
const
|
262
|
-
a =
|
308
|
+
const d = await e.get(c);
|
309
|
+
a = q(d, i);
|
263
310
|
}
|
264
311
|
if (a === null)
|
265
312
|
throw new Error(
|
266
313
|
`Imported file "${i}" not found.`
|
267
314
|
);
|
268
|
-
return
|
315
|
+
return z(i) ? `export default "${P(
|
316
|
+
i,
|
317
|
+
a
|
318
|
+
)}";` : a;
|
269
319
|
}
|
270
|
-
}),
|
320
|
+
}), D = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map();
|
271
321
|
let I;
|
272
|
-
const
|
273
|
-
async function
|
322
|
+
const b = "https://cdn.jsdelivr.net/npm/svelte@5.37.1", Ge = `${b}/compiler/index.js`;
|
323
|
+
async function A(e) {
|
274
324
|
const t = R.get(e);
|
275
325
|
if (t)
|
276
326
|
return t;
|
277
327
|
const n = [".js", "/index.js"];
|
278
|
-
for (const
|
279
|
-
const o = `${e}${
|
328
|
+
for (const s of n) {
|
329
|
+
const o = `${e}${s}`;
|
280
330
|
try {
|
281
331
|
if ((await fetch(o, { method: "HEAD" })).ok)
|
282
332
|
return R.set(e, o), o;
|
@@ -284,10 +334,10 @@ async function W(e) {
|
|
284
334
|
continue;
|
285
335
|
}
|
286
336
|
}
|
287
|
-
const
|
288
|
-
return R.set(e,
|
337
|
+
const r = `${e}.js`;
|
338
|
+
return R.set(e, r), r;
|
289
339
|
}
|
290
|
-
const
|
340
|
+
const he = ({
|
291
341
|
getSvelteCompiler: e
|
292
342
|
}) => ({
|
293
343
|
name: "transformSvelte",
|
@@ -299,45 +349,45 @@ export const DEV = true;
|
|
299
349
|
export const NODE = false;
|
300
350
|
export const PROD = false;
|
301
351
|
`;
|
302
|
-
if (!t.startsWith(
|
352
|
+
if (!t.startsWith(b))
|
303
353
|
return;
|
304
|
-
const n =
|
354
|
+
const n = D.get(t);
|
305
355
|
if (n) return n;
|
306
|
-
const
|
307
|
-
(
|
356
|
+
const r = await fetch(t).then(
|
357
|
+
(s) => s.text()
|
308
358
|
);
|
309
|
-
return
|
359
|
+
return D.set(t, r), r;
|
310
360
|
},
|
311
361
|
// From https://github.com/sveltejs/sites/blob/master/packages/repl/src/lib/workers/bundler/index.js#L255C2-L271C5
|
312
362
|
resolveId: async (t, n) => {
|
313
363
|
if (t === "esm-env")
|
314
364
|
return "virtual:esm-env";
|
315
365
|
if (t === "svelte")
|
316
|
-
return `${
|
366
|
+
return `${b}/src/index-client.js`;
|
317
367
|
if (t.startsWith("svelte/")) {
|
318
|
-
const
|
319
|
-
return await
|
368
|
+
const r = t.slice(7), s = `${b}/src/${r}`;
|
369
|
+
return await A(s);
|
320
370
|
}
|
321
371
|
if (t.startsWith("#client/")) {
|
322
|
-
const
|
323
|
-
return await
|
372
|
+
const r = t.slice(8), s = `${b}/src/internal/client/${r}`;
|
373
|
+
return await A(s);
|
324
374
|
}
|
325
375
|
if (/^https?:/.test(t)) return t;
|
326
|
-
if (t.startsWith(".") && n && n.startsWith(
|
327
|
-
const
|
328
|
-
return new URL(t, n).href,
|
376
|
+
if (t.startsWith(".") && n && n.startsWith(b)) {
|
377
|
+
const r = new URL(t, n).href;
|
378
|
+
return new URL(t, n).href, r;
|
329
379
|
}
|
330
380
|
},
|
331
381
|
transform: async (t, n) => {
|
332
|
-
const { fileName:
|
333
|
-
if (
|
382
|
+
const { fileName: r } = S(n);
|
383
|
+
if (r.endsWith(".svelte")) {
|
334
384
|
if (!I) {
|
335
385
|
if (!e)
|
336
386
|
throw new Error("Svelte compiler not available");
|
337
387
|
I = await e();
|
338
388
|
}
|
339
389
|
const o = I(t, {
|
340
|
-
filename:
|
390
|
+
filename: r,
|
341
391
|
generate: "client",
|
342
392
|
// Svelte 5 uses 'client' instead of 'dom'
|
343
393
|
css: "external",
|
@@ -358,12 +408,12 @@ export const PROD = false;
|
|
358
408
|
` + c), c;
|
359
409
|
}
|
360
410
|
}
|
361
|
-
}),
|
411
|
+
}), ge = async ({
|
362
412
|
files: e,
|
363
413
|
rollup: t,
|
364
414
|
enableSourcemap: n = !0,
|
365
|
-
vizCache:
|
366
|
-
vizId:
|
415
|
+
vizCache: r,
|
416
|
+
vizId: s,
|
367
417
|
slugCache: o,
|
368
418
|
getSvelteCompiler: c
|
369
419
|
}) => {
|
@@ -372,7 +422,7 @@ export const PROD = false;
|
|
372
422
|
};
|
373
423
|
if (!e["index.js"])
|
374
424
|
throw new Error("Missing index.js");
|
375
|
-
const
|
425
|
+
const l = {
|
376
426
|
name: "replace",
|
377
427
|
transform(p, w) {
|
378
428
|
let y = !1, f = p;
|
@@ -381,19 +431,19 @@ export const PROD = false;
|
|
381
431
|
JSON.stringify("production")
|
382
432
|
), y = !0), y ? { code: f, map: null } : null;
|
383
433
|
}
|
384
|
-
},
|
434
|
+
}, u = {
|
385
435
|
input: "./index.js",
|
386
436
|
plugins: [
|
387
|
-
...
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
...
|
393
|
-
|
394
|
-
vizCache:
|
437
|
+
...s ? [de({ vizId: s, slugCache: o })] : [],
|
438
|
+
ce(),
|
439
|
+
F(),
|
440
|
+
he({ getSvelteCompiler: c }),
|
441
|
+
l,
|
442
|
+
...r ? [
|
443
|
+
fe({
|
444
|
+
vizCache: r,
|
395
445
|
trackCSSImport: a,
|
396
|
-
vizId:
|
446
|
+
vizId: s,
|
397
447
|
files: e
|
398
448
|
})
|
399
449
|
] : []
|
@@ -408,32 +458,32 @@ export const PROD = false;
|
|
408
458
|
compact: !0
|
409
459
|
}, g = $(e);
|
410
460
|
if (g) {
|
411
|
-
const p =
|
412
|
-
p && (
|
461
|
+
const p = G(g);
|
462
|
+
p && (u.external = Object.keys(p), m.globals = p);
|
413
463
|
}
|
414
|
-
|
464
|
+
u.external || (u.external = []), m.globals || (m.globals = {}), Array.isArray(u.external) && (u.external = u.external.filter(
|
415
465
|
(p) => typeof p == "string" && !p.startsWith("#client/")
|
416
466
|
));
|
417
|
-
const v = await t(
|
467
|
+
const v = await t(u), { output: E } = await v.generate(m);
|
418
468
|
return {
|
419
|
-
src:
|
469
|
+
src: E[0].code,
|
420
470
|
cssFiles: Array.from(i)
|
421
471
|
};
|
422
|
-
},
|
472
|
+
}, ve = (e) => {
|
423
473
|
if (e instanceof Error) {
|
424
474
|
const t = e.stack || "", n = e.message || "Unknown error";
|
425
475
|
return `${e.name || "Error"}: ${n}
|
426
476
|
${t}`;
|
427
477
|
} else if ("error" in e && e.error instanceof Error) {
|
428
|
-
const t = e.error, n = t.stack || "",
|
478
|
+
const t = e.error, n = t.stack || "", r = t.message || "Unknown error", s = "filename" in e ? e.filename : "", o = "lineno" in e ? e.lineno : "", c = "colno" in e ? e.colno : "";
|
429
479
|
let i = "";
|
430
|
-
return
|
480
|
+
return s && o && (i = ` at ${s}:${o}`, c && (i += `:${c}`)), `${t.name || "Error"}: ${r}${i}
|
431
481
|
${n}`;
|
432
482
|
} else if ("reason" in e) {
|
433
483
|
const t = e.reason;
|
434
484
|
if (t instanceof Error) {
|
435
|
-
const n = t.stack || "",
|
436
|
-
return `Unhandled Promise Rejection - ${t.name || "Error"}: ${
|
485
|
+
const n = t.stack || "", r = t.message || "Unknown error";
|
486
|
+
return `Unhandled Promise Rejection - ${t.name || "Error"}: ${r}
|
437
487
|
${n}`;
|
438
488
|
} else
|
439
489
|
return `Unhandled Promise Rejection: ${String(t)}`;
|
@@ -442,7 +492,7 @@ ${n}`;
|
|
442
492
|
}, j = () => `
|
443
493
|
// Global error handling for runtime errors
|
444
494
|
(() => {
|
445
|
-
const formatRuntimeError = ${
|
495
|
+
const formatRuntimeError = ${ve.toString()};
|
446
496
|
|
447
497
|
// Handle uncaught JavaScript errors
|
448
498
|
window.addEventListener('error', (event) => {
|
@@ -463,15 +513,15 @@ ${n}`;
|
|
463
513
|
});
|
464
514
|
})();
|
465
515
|
`;
|
466
|
-
function
|
516
|
+
function we() {
|
467
517
|
return Math.random().toString().slice(2, 7);
|
468
518
|
}
|
469
|
-
const
|
519
|
+
const ye = ({
|
470
520
|
cdn: e,
|
471
521
|
src: t,
|
472
522
|
styles: n
|
473
523
|
}) => {
|
474
|
-
const
|
524
|
+
const s = `viz-container-${we()}`;
|
475
525
|
return `<!DOCTYPE html>
|
476
526
|
<html>
|
477
527
|
<head>
|
@@ -481,20 +531,20 @@ const pe = ({
|
|
481
531
|
margin: 0;
|
482
532
|
overflow: hidden;
|
483
533
|
}
|
484
|
-
#${
|
534
|
+
#${s} {
|
485
535
|
height: 100vh;
|
486
536
|
}
|
487
537
|
</style>
|
488
538
|
</head>
|
489
539
|
<body>
|
490
|
-
<div id="${
|
540
|
+
<div id="${s}"></div>
|
491
541
|
<script>${j()}<\/script>
|
492
542
|
<script id="injected-script">${t}<\/script>
|
493
543
|
<script>
|
494
544
|
(() => {
|
495
545
|
let cleanup;
|
496
546
|
const render = () => {
|
497
|
-
const container = document.getElementById('${
|
547
|
+
const container = document.getElementById('${s}');
|
498
548
|
typeof cleanup === 'function' && cleanup();
|
499
549
|
cleanup = (Viz.viz || Viz.main)(container, { state: window.state, setState, writeFile });
|
500
550
|
};
|
@@ -552,49 +602,49 @@ const pe = ({
|
|
552
602
|
<\/script>
|
553
603
|
</body>
|
554
604
|
</html>`;
|
555
|
-
},
|
605
|
+
}, be = async ({
|
556
606
|
files: e,
|
557
607
|
rollup: t,
|
558
608
|
enableSourcemap: n = !0,
|
559
|
-
vizCache:
|
560
|
-
vizId:
|
609
|
+
vizCache: r,
|
610
|
+
vizId: s,
|
561
611
|
slugCache: o,
|
562
612
|
getSvelteCompiler: c
|
563
613
|
}) => {
|
564
|
-
const { src: i, cssFiles: a } = await
|
614
|
+
const { src: i, cssFiles: a } = await ge({
|
565
615
|
files: e,
|
566
616
|
rollup: t,
|
567
617
|
enableSourcemap: n,
|
568
|
-
vizCache:
|
569
|
-
vizId:
|
618
|
+
vizCache: r,
|
619
|
+
vizId: s,
|
570
620
|
slugCache: o,
|
571
621
|
getSvelteCompiler: c
|
572
622
|
});
|
573
|
-
let
|
623
|
+
let d = [];
|
574
624
|
if (a.length > 0)
|
575
625
|
for (let v = 0; v < a.length; v++) {
|
576
|
-
const
|
626
|
+
const E = a[v], p = S(E), w = p.vizId, y = p.fileName;
|
577
627
|
let f = null;
|
578
|
-
if (w ===
|
628
|
+
if (w === s && e)
|
579
629
|
f = e[y] || null;
|
580
630
|
else {
|
581
|
-
const
|
582
|
-
f =
|
631
|
+
const Q = await r.get(w);
|
632
|
+
f = q(Q, y);
|
583
633
|
}
|
584
|
-
f &&
|
634
|
+
f && d.push(f);
|
585
635
|
}
|
586
|
-
const
|
587
|
-
`),
|
588
|
-
<style id="injected-style">${
|
636
|
+
const l = d.join(`
|
637
|
+
`), u = `
|
638
|
+
<style id="injected-style">${l}</style>`;
|
589
639
|
let m = "";
|
590
640
|
const g = Object.entries(
|
591
|
-
|
641
|
+
W(e)
|
592
642
|
);
|
593
643
|
if (g.length > 0) {
|
594
|
-
const v =
|
595
|
-
m = g.map(([
|
596
|
-
const y =
|
597
|
-
{ name:
|
644
|
+
const v = V(e);
|
645
|
+
m = g.map(([E, p], w) => {
|
646
|
+
const y = U(
|
647
|
+
{ name: E, version: p },
|
598
648
|
v
|
599
649
|
);
|
600
650
|
return `${w > 0 ? " " : `
|
@@ -602,12 +652,12 @@ const pe = ({
|
|
602
652
|
}).join("");
|
603
653
|
}
|
604
654
|
return {
|
605
|
-
html:
|
606
|
-
css:
|
655
|
+
html: ye({ cdn: m, src: i, styles: u }),
|
656
|
+
css: l,
|
607
657
|
js: i,
|
608
658
|
runtimeVersion: "v3"
|
609
659
|
};
|
610
|
-
},
|
660
|
+
}, Ee = ({
|
611
661
|
initialContents: e,
|
612
662
|
handleCacheMiss: t
|
613
663
|
}) => {
|
@@ -633,7 +683,7 @@ const pe = ({
|
|
633
683
|
}, invalidate: (c) => {
|
634
684
|
n.delete(c);
|
635
685
|
} };
|
636
|
-
},
|
686
|
+
}, Ye = ({
|
637
687
|
initialMappings: e = {},
|
638
688
|
handleCacheMiss: t
|
639
689
|
}) => ({ get: async (o) => {
|
@@ -652,19 +702,19 @@ const pe = ({
|
|
652
702
|
e[o] = c;
|
653
703
|
}, invalidate: (o) => {
|
654
704
|
delete e[o];
|
655
|
-
} }),
|
705
|
+
} }), xe = (e, t = "Sample Content for Exporting", n = Z()) => ({
|
656
706
|
id: n,
|
657
|
-
files:
|
707
|
+
files: K(e),
|
658
708
|
title: t
|
659
|
-
}),
|
709
|
+
}), Se = (e) => {
|
660
710
|
if (Object.keys(e).length === 0)
|
661
711
|
return null;
|
662
|
-
const t = "index.html" in e, n = "index.js" in e,
|
663
|
-
return t ? e["index.html"].includes('type="module"') ? "v4" : n ||
|
664
|
-
}, O = (e, t) => new RegExp(`<${t}\\b`, "i").test(e) && new RegExp(`</${t}>`, "i").test(e),
|
712
|
+
const t = "index.html" in e, n = "index.js" in e, r = "index.jsx" in e;
|
713
|
+
return t ? e["index.html"].includes('type="module"') ? "v4" : n || r ? "v2" : "v1" : !t && n ? "v3" : null;
|
714
|
+
}, O = (e, t) => new RegExp(`<${t}\\b`, "i").test(e) && new RegExp(`</${t}>`, "i").test(e), $e = (e) => {
|
665
715
|
const t = e.trim();
|
666
716
|
return O(t, "html") && O(t, "head") && O(t, "body") ? t : `<html><head></head><body>${t}</body></html>`;
|
667
|
-
},
|
717
|
+
}, je = (e, t) => e.replace(
|
668
718
|
new RegExp(
|
669
719
|
`<script[^>]*src=["'][^"']*${t.source}[^"']*["'][^>]*>\\s*<\/script>`,
|
670
720
|
"gi"
|
@@ -673,16 +723,16 @@ const pe = ({
|
|
673
723
|
), N = (e, t, n) => e.replace(
|
674
724
|
new RegExp(t, "i"),
|
675
725
|
`${n}${t}`
|
676
|
-
),
|
677
|
-
let n =
|
678
|
-
const
|
679
|
-
if (
|
680
|
-
const c =
|
681
|
-
|
682
|
-
n =
|
726
|
+
), Ce = (e, t) => {
|
727
|
+
let n = $e(e);
|
728
|
+
const r = Object.entries(W(t));
|
729
|
+
if (r.length) {
|
730
|
+
const c = V(t);
|
731
|
+
r.forEach(([a]) => {
|
732
|
+
n = je(n, new RegExp(`${a}@`));
|
683
733
|
});
|
684
|
-
const i =
|
685
|
-
([a,
|
734
|
+
const i = r.map(
|
735
|
+
([a, d]) => U({ name: a, version: d }, c)
|
686
736
|
).map((a) => `<script src="${a}"><\/script>`).join(`
|
687
737
|
`);
|
688
738
|
n = N(
|
@@ -695,10 +745,10 @@ const pe = ({
|
|
695
745
|
if (t["bundle.js"] !== void 0 || t["index.js"] !== void 0) {
|
696
746
|
const c = '<script src="bundle.js"><\/script>', i = /<script\b[^>]*\bsrc=["']bundle\.js["'][^>]*>\s*<\/script>/gi, a = [...n.matchAll(i)];
|
697
747
|
a.length === 1 && (() => {
|
698
|
-
const
|
699
|
-
if (
|
700
|
-
const
|
701
|
-
return
|
748
|
+
const l = a[0].index ?? -1;
|
749
|
+
if (l === -1) return !1;
|
750
|
+
const u = n.search(/<body\b[^>]*>/i), m = n.search(/<\/body>/i);
|
751
|
+
return u !== -1 && m !== -1 && l > u && l < m;
|
702
752
|
})() || (n = n.replace(i, ""), n = N(n, "</body>", c));
|
703
753
|
}
|
704
754
|
const o = `<script>${j()}<\/script>
|
@@ -708,16 +758,16 @@ const pe = ({
|
|
708
758
|
"</head>",
|
709
759
|
o
|
710
760
|
), /^\s*<!DOCTYPE/i.test(n) ? n : `<!DOCTYPE html>${n}`;
|
711
|
-
},
|
761
|
+
}, Re = (e) => {
|
712
762
|
const t = e["index.html"];
|
713
|
-
return !t && !e["index.js"] && !e["bundle.js"] ? "" :
|
763
|
+
return !t && !e["index.js"] && !e["bundle.js"] ? "" : Ce(t || "<!DOCTYPE html><html><head></head><body></body></html>", e);
|
714
764
|
};
|
715
|
-
function
|
765
|
+
function Ie(e) {
|
716
766
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
717
767
|
}
|
718
|
-
var
|
719
|
-
function
|
720
|
-
return
|
768
|
+
var T, B;
|
769
|
+
function Oe() {
|
770
|
+
return B || (B = 1, T = {
|
721
771
|
d3: "d3",
|
722
772
|
"d3-array": "d3",
|
723
773
|
"d3-axis": "d3",
|
@@ -765,25 +815,25 @@ function xe() {
|
|
765
815
|
"vizhub-vega-lite-config": "vizhubVegaLiteConfig",
|
766
816
|
semiotic: "Semiotic",
|
767
817
|
"viz.js": "Viz"
|
768
|
-
}),
|
818
|
+
}), T;
|
769
819
|
}
|
770
|
-
var
|
771
|
-
const
|
820
|
+
var Ne = Oe();
|
821
|
+
const Te = /* @__PURE__ */ Ie(Ne), h = "\0virtual:", H = (e) => {
|
772
822
|
let t = e.replace(/^\.\//, "");
|
773
823
|
return t = t.replace(/\/+/g, "/"), t = t.replace(/\/$/, ""), t;
|
774
|
-
},
|
775
|
-
const n = e.includes("/") ? e.slice(0, e.lastIndexOf("/")) : "",
|
776
|
-
for (const o of
|
777
|
-
o === ".." ?
|
778
|
-
return
|
779
|
-
},
|
824
|
+
}, ke = (e, t) => {
|
825
|
+
const n = e.includes("/") ? e.slice(0, e.lastIndexOf("/")) : "", r = t.split("/"), s = n ? n.split("/") : [];
|
826
|
+
for (const o of r)
|
827
|
+
o === ".." ? s.pop() : o !== "." && o !== "" && s.push(o);
|
828
|
+
return s.join("/");
|
829
|
+
}, Y = (e) => ({
|
780
830
|
name: "virtual-file-system",
|
781
831
|
resolveId(t, n) {
|
782
|
-
const
|
832
|
+
const r = n?.startsWith(
|
783
833
|
h
|
784
834
|
) ? n.slice(h.length) : n;
|
785
835
|
if (t.startsWith("./") || t.startsWith("../")) {
|
786
|
-
const o =
|
836
|
+
const o = H(r ? ke(r, t) : t);
|
787
837
|
if (e[o])
|
788
838
|
return h + o;
|
789
839
|
const c = [".js", ".jsx", ".ts", ".tsx"];
|
@@ -795,8 +845,8 @@ const $e = /* @__PURE__ */ be(Se), h = "\0virtual:", U = (e) => {
|
|
795
845
|
}
|
796
846
|
if (e[t])
|
797
847
|
return h + t;
|
798
|
-
const
|
799
|
-
for (const o of
|
848
|
+
const s = [".js", ".jsx", ".ts", ".tsx"];
|
849
|
+
for (const o of s) {
|
800
850
|
const c = t + o;
|
801
851
|
if (e[c])
|
802
852
|
return h + c;
|
@@ -807,58 +857,61 @@ const $e = /* @__PURE__ */ be(Se), h = "\0virtual:", U = (e) => {
|
|
807
857
|
if (t.startsWith(h)) {
|
808
858
|
const n = t.slice(h.length);
|
809
859
|
if (e[n])
|
810
|
-
return
|
860
|
+
return z(n) ? `export default "${P(
|
861
|
+
n,
|
862
|
+
e[n]
|
863
|
+
)}";` : e[n];
|
811
864
|
}
|
812
865
|
return null;
|
813
866
|
}
|
814
|
-
}),
|
867
|
+
}), Le = async ({
|
815
868
|
files: e,
|
816
869
|
rollup: t,
|
817
870
|
enableSourcemap: n = !0
|
818
871
|
}) => {
|
819
|
-
let
|
820
|
-
if (!e[
|
872
|
+
let r = "index.js";
|
873
|
+
if (!e[r] && (r = "index.jsx", !e[r]))
|
821
874
|
throw new Error(
|
822
875
|
"Missing entry point, can't find index.js or index.jsx"
|
823
876
|
);
|
824
877
|
const o = {
|
825
|
-
input: "./" +
|
826
|
-
plugins: [
|
827
|
-
onwarn(
|
828
|
-
|
878
|
+
input: "./" + r,
|
879
|
+
plugins: [Y(e), F()],
|
880
|
+
onwarn(l, u) {
|
881
|
+
l.code !== "UNRESOLVED_IMPORT" && u(l);
|
829
882
|
}
|
830
883
|
}, c = {
|
831
884
|
format: "iife",
|
832
885
|
sourcemap: n
|
833
886
|
}, i = $(e);
|
834
887
|
if (i) {
|
835
|
-
const
|
888
|
+
const l = {
|
836
889
|
// Pre-configured globals for v2 only
|
837
|
-
|
890
|
+
...Te,
|
838
891
|
// Libraries from package.json
|
839
|
-
...
|
892
|
+
...G(i)
|
840
893
|
};
|
841
|
-
|
894
|
+
l && (o.external = Object.keys(l), c.globals = l);
|
842
895
|
}
|
843
|
-
const a = await t(o), { output:
|
844
|
-
return
|
845
|
-
},
|
896
|
+
const a = await t(o), { output: d } = await a.generate(c);
|
897
|
+
return d[0].code;
|
898
|
+
}, Me = async ({
|
846
899
|
files: e,
|
847
900
|
rollup: t,
|
848
901
|
enableSourcemap: n
|
849
902
|
}) => ({
|
850
903
|
...e,
|
851
|
-
"bundle.js": await
|
904
|
+
"bundle.js": await Le({
|
852
905
|
files: e,
|
853
906
|
rollup: t,
|
854
907
|
enableSourcemap: n
|
855
908
|
}),
|
856
|
-
"index.html":
|
857
|
-
}),
|
858
|
-
const t = [], n = [],
|
859
|
-
let
|
860
|
-
for (; (
|
861
|
-
const c =
|
909
|
+
"index.html": Re(e)
|
910
|
+
}), Fe = (e) => {
|
911
|
+
const t = [], n = [], r = /<script\b([^>]*)>([\s\S]*?)<\/script>/gi;
|
912
|
+
let s, o = 0;
|
913
|
+
for (; (s = r.exec(e)) !== null; ) {
|
914
|
+
const c = s[1], i = s[2];
|
862
915
|
if (!/\btype\s*=\s*["']module["']/i.test(c))
|
863
916
|
continue;
|
864
917
|
const a = c.match(
|
@@ -867,36 +920,36 @@ const $e = /* @__PURE__ */ be(Se), h = "\0virtual:", U = (e) => {
|
|
867
920
|
if (a)
|
868
921
|
t.push(a[1]);
|
869
922
|
else if (i.trim()) {
|
870
|
-
const
|
923
|
+
const d = `__inline_script_${o++}.js`;
|
871
924
|
n.push({
|
872
|
-
id:
|
925
|
+
id: d,
|
873
926
|
content: i.trim()
|
874
|
-
}), t.push(
|
927
|
+
}), t.push(d);
|
875
928
|
}
|
876
929
|
}
|
877
930
|
return { entryPoints: t, inlineScripts: n };
|
878
|
-
},
|
931
|
+
}, We = () => ({
|
879
932
|
name: "catch-all-prevent-fs",
|
880
933
|
resolveId(e, t) {
|
881
934
|
return { id: e, external: !0 };
|
882
935
|
}
|
883
|
-
}),
|
936
|
+
}), Ve = async ({
|
884
937
|
entryPoint: e,
|
885
938
|
files: t,
|
886
939
|
rollup: n,
|
887
|
-
enableSourcemap:
|
940
|
+
enableSourcemap: r = !0
|
888
941
|
}) => {
|
889
942
|
const o = {
|
890
943
|
input: e.startsWith("./") ? e : `./${e}`,
|
891
944
|
plugins: [
|
892
|
-
|
893
|
-
|
945
|
+
Y(t),
|
946
|
+
F({
|
894
947
|
// Enable JSX runtime
|
895
948
|
// so we don't need to import React
|
896
949
|
// in every file that uses JSX
|
897
950
|
jsxRuntime: "automatic"
|
898
951
|
}),
|
899
|
-
|
952
|
+
We()
|
900
953
|
],
|
901
954
|
// external: (source: string) => {
|
902
955
|
// DEBUG && console.log("external", source);
|
@@ -908,30 +961,30 @@ const $e = /* @__PURE__ */ be(Se), h = "\0virtual:", U = (e) => {
|
|
908
961
|
// DEBUG && console.log("isExternal", isExternal);
|
909
962
|
// return isExternal;
|
910
963
|
// },
|
911
|
-
onwarn(a,
|
964
|
+
onwarn(a, d) {
|
912
965
|
}
|
913
966
|
}, c = await n(o), { output: i } = await c.generate({
|
914
967
|
format: "es",
|
915
|
-
sourcemap:
|
968
|
+
sourcemap: r
|
916
969
|
});
|
917
970
|
return i[0].code;
|
918
|
-
},
|
971
|
+
}, k = (e, t) => new RegExp(`<${t}\\b`, "i").test(e) && new RegExp(`</${t}>`, "i").test(e), Ue = (e) => {
|
919
972
|
const t = e.trim();
|
920
|
-
return
|
921
|
-
},
|
973
|
+
return k(t, "html") && k(t, "head") && k(t, "body") ? t : `<html><head></head><body>${t}</body></html>`;
|
974
|
+
}, _ = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), L = (e, t, n) => e.replace(
|
922
975
|
new RegExp(t, "i"),
|
923
976
|
`${n}${t}`
|
924
|
-
),
|
925
|
-
const t =
|
977
|
+
), ze = (e) => {
|
978
|
+
const t = W(e);
|
926
979
|
if (Object.keys(t).length === 0) return null;
|
927
|
-
const n =
|
928
|
-
for (const [
|
929
|
-
s
|
930
|
-
{ name:
|
980
|
+
const n = V(e), r = {};
|
981
|
+
for (const [s, o] of Object.entries(t))
|
982
|
+
r[s] = U(
|
983
|
+
{ name: s, version: o },
|
931
984
|
n
|
932
985
|
);
|
933
|
-
return JSON.stringify({ imports:
|
934
|
-
},
|
986
|
+
return JSON.stringify({ imports: r }, null, 2);
|
987
|
+
}, Pe = () => `
|
935
988
|
// V4 Hot Reloading Support
|
936
989
|
(() => {
|
937
990
|
const runJS = (js) => {
|
@@ -985,104 +1038,104 @@ const $e = /* @__PURE__ */ be(Se), h = "\0virtual:", U = (e) => {
|
|
985
1038
|
}
|
986
1039
|
});
|
987
1040
|
})();
|
988
|
-
`,
|
1041
|
+
`, Je = (e, t, n = [], r = !1) => {
|
989
1042
|
if (!e["index.html"]) return "";
|
990
|
-
let
|
1043
|
+
let s = Ue(e["index.html"]);
|
991
1044
|
t.forEach((i, a) => {
|
992
1045
|
if (n.some(
|
993
|
-
(
|
1046
|
+
(l) => l.id === a
|
994
1047
|
)) {
|
995
|
-
const
|
996
|
-
|
1048
|
+
const l = n.find((g) => g.id === a)?.content || "", u = _(
|
1049
|
+
l
|
997
1050
|
), m = new RegExp(
|
998
|
-
`<script\\b[^>]*\\btype=["']module["'][^>]*>\\s*${
|
1051
|
+
`<script\\b[^>]*\\btype=["']module["'][^>]*>\\s*${u}\\s*<\/script>`,
|
999
1052
|
"gi"
|
1000
1053
|
);
|
1001
|
-
|
1054
|
+
s = s.replace(
|
1002
1055
|
m,
|
1003
1056
|
`<script type="module">
|
1004
1057
|
${i}
|
1005
1058
|
<\/script>`
|
1006
1059
|
);
|
1007
1060
|
} else {
|
1008
|
-
const
|
1009
|
-
`<script\\b[^>]*\\bsrc=["']${
|
1061
|
+
const l = new RegExp(
|
1062
|
+
`<script\\b[^>]*\\bsrc=["']${_(a)}["'][^>]*>[^<]*<\/script>`,
|
1010
1063
|
"gi"
|
1011
1064
|
);
|
1012
|
-
|
1013
|
-
|
1065
|
+
s = s.replace(
|
1066
|
+
l,
|
1014
1067
|
`<script type="module">
|
1015
1068
|
${i}
|
1016
1069
|
<\/script>`
|
1017
1070
|
);
|
1018
1071
|
}
|
1019
1072
|
});
|
1020
|
-
const o =
|
1073
|
+
const o = ze(e);
|
1021
1074
|
if (o && !/<script\b[^>]*type=["']importmap["'][^>]*>/i.test(
|
1022
|
-
|
1075
|
+
s
|
1023
1076
|
)) {
|
1024
1077
|
const a = `<script type="importmap">
|
1025
1078
|
${o}
|
1026
1079
|
<\/script>
|
1027
1080
|
`;
|
1028
|
-
|
1029
|
-
|
1081
|
+
s = L(
|
1082
|
+
s,
|
1030
1083
|
"</head>",
|
1031
1084
|
a
|
1032
1085
|
);
|
1033
1086
|
}
|
1034
1087
|
const c = `<script>${j()}<\/script>
|
1035
1088
|
`;
|
1036
|
-
if (
|
1037
|
-
|
1089
|
+
if (s = L(
|
1090
|
+
s,
|
1038
1091
|
"</head>",
|
1039
1092
|
c
|
1040
|
-
),
|
1041
|
-
const i = `<script>${
|
1093
|
+
), r) {
|
1094
|
+
const i = `<script>${Pe()}<\/script>
|
1042
1095
|
`;
|
1043
|
-
|
1044
|
-
|
1096
|
+
s = L(
|
1097
|
+
s,
|
1045
1098
|
"</body>",
|
1046
1099
|
i
|
1047
1100
|
);
|
1048
1101
|
}
|
1049
|
-
return /^\s*<!DOCTYPE/i.test(
|
1050
|
-
},
|
1102
|
+
return /^\s*<!DOCTYPE/i.test(s) ? s : `<!DOCTYPE html>${s}`;
|
1103
|
+
}, De = async ({
|
1051
1104
|
files: e,
|
1052
1105
|
rollup: t,
|
1053
1106
|
enableSourcemap: n = !0
|
1054
1107
|
}) => {
|
1055
|
-
const
|
1056
|
-
if (
|
1108
|
+
const r = e["index.html"] || "", { entryPoints: s, inlineScripts: o } = Fe(r);
|
1109
|
+
if (s.length === 0)
|
1057
1110
|
return { files: e, bundledJS: "" };
|
1058
1111
|
const c = { ...e };
|
1059
|
-
for (const
|
1060
|
-
c[
|
1112
|
+
for (const u of o)
|
1113
|
+
c[u.id] = u.content;
|
1061
1114
|
const i = /* @__PURE__ */ new Map(), a = [];
|
1062
|
-
for (const
|
1063
|
-
const m = await
|
1064
|
-
entryPoint:
|
1115
|
+
for (const u of s) {
|
1116
|
+
const m = await Ve({
|
1117
|
+
entryPoint: u,
|
1065
1118
|
files: c,
|
1066
1119
|
rollup: t,
|
1067
1120
|
enableSourcemap: n
|
1068
1121
|
});
|
1069
|
-
i.set(
|
1122
|
+
i.set(u, m), a.push(m);
|
1070
1123
|
}
|
1071
|
-
const
|
1124
|
+
const d = Je(
|
1072
1125
|
c,
|
1073
1126
|
i,
|
1074
1127
|
o,
|
1075
1128
|
!0
|
1076
|
-
),
|
1129
|
+
), l = a.join(`
|
1077
1130
|
`);
|
1078
1131
|
return {
|
1079
1132
|
files: {
|
1080
1133
|
...e,
|
1081
|
-
"index.html":
|
1134
|
+
"index.html": d
|
1082
1135
|
},
|
1083
|
-
bundledJS:
|
1136
|
+
bundledJS: l
|
1084
1137
|
};
|
1085
|
-
}, x = !1,
|
1138
|
+
}, x = !1, Ae = (e) => {
|
1086
1139
|
const t = `<script>${j()}<\/script>`;
|
1087
1140
|
return e.includes("</head>") ? e.replace(
|
1088
1141
|
"</head>",
|
@@ -1093,12 +1146,22 @@ ${o}
|
|
1093
1146
|
`${t}
|
1094
1147
|
</body>`
|
1095
1148
|
) : e + t;
|
1096
|
-
},
|
1149
|
+
}, M = (e) => {
|
1150
|
+
const t = { ...e };
|
1151
|
+
for (const [n, r] of Object.entries(
|
1152
|
+
t
|
1153
|
+
))
|
1154
|
+
n.toLowerCase().endsWith(".html") && (t[n] = me(
|
1155
|
+
r,
|
1156
|
+
e
|
1157
|
+
));
|
1158
|
+
return t;
|
1159
|
+
}, Qe = async ({
|
1097
1160
|
files: e,
|
1098
1161
|
rollup: t,
|
1099
1162
|
enableSourcemap: n = !0,
|
1100
|
-
vizCache:
|
1101
|
-
vizId:
|
1163
|
+
vizCache: r,
|
1164
|
+
vizId: s,
|
1102
1165
|
slugCache: o,
|
1103
1166
|
getSvelteCompiler: c
|
1104
1167
|
}) => {
|
@@ -1106,35 +1169,40 @@ ${o}
|
|
1106
1169
|
if (x && console.log(
|
1107
1170
|
"[build] files:",
|
1108
1171
|
e ? JSON.stringify(e).substring(0, 100) : void 0
|
1109
|
-
), x && console.log("[build] vizCache:",
|
1172
|
+
), x && console.log("[build] vizCache:", r), x && console.log("[build] vizId:", s), !e && !r)
|
1110
1173
|
throw new Error(
|
1111
1174
|
"Either files or vizCache is required"
|
1112
1175
|
);
|
1113
|
-
if (!e &&
|
1176
|
+
if (!e && r && !s)
|
1114
1177
|
throw new Error(
|
1115
1178
|
"vizId is required when using vizCache"
|
1116
1179
|
);
|
1117
|
-
if (!e &&
|
1118
|
-
(await
|
1180
|
+
if (!e && r && s && (e = ee(
|
1181
|
+
(await r.get(s))?.files
|
1119
1182
|
)), !e)
|
1120
1183
|
throw new Error("Upable to extract viz files");
|
1121
|
-
const i =
|
1122
|
-
if (x && console.log("[build] version:", i), i === "v1")
|
1184
|
+
const i = Se(e);
|
1185
|
+
if (x && console.log("[build] version:", i), i === "v1") {
|
1186
|
+
const a = M(e);
|
1123
1187
|
return {
|
1124
|
-
html:
|
1125
|
-
C(
|
1188
|
+
html: Ae(
|
1189
|
+
C(a)
|
1126
1190
|
),
|
1127
1191
|
runtimeVersion: i
|
1128
1192
|
};
|
1193
|
+
}
|
1129
1194
|
if (i === "v2") {
|
1130
1195
|
if (!t)
|
1131
1196
|
throw new Error(
|
1132
1197
|
"Rollup is required for v2 runtime"
|
1133
1198
|
);
|
1199
|
+
const a = await Me({
|
1200
|
+
files: e,
|
1201
|
+
rollup: t,
|
1202
|
+
enableSourcemap: n
|
1203
|
+
}), d = M(a);
|
1134
1204
|
return {
|
1135
|
-
html: C(
|
1136
|
-
await Re({ files: e, rollup: t, enableSourcemap: n })
|
1137
|
-
),
|
1205
|
+
html: C(d),
|
1138
1206
|
runtimeVersion: i
|
1139
1207
|
};
|
1140
1208
|
}
|
@@ -1143,9 +1211,9 @@ ${o}
|
|
1143
1211
|
throw new Error(
|
1144
1212
|
"Rollup is required for v3 runtime"
|
1145
1213
|
);
|
1146
|
-
if (!
|
1147
|
-
const a =
|
1148
|
-
|
1214
|
+
if (!r && !s) {
|
1215
|
+
const a = xe(e);
|
1216
|
+
s = a.id, r = Ee({
|
1149
1217
|
initialContents: [a],
|
1150
1218
|
handleCacheMiss: async () => {
|
1151
1219
|
throw new Error(
|
@@ -1154,19 +1222,19 @@ ${o}
|
|
1154
1222
|
}
|
1155
1223
|
});
|
1156
1224
|
}
|
1157
|
-
if (!
|
1225
|
+
if (!r)
|
1158
1226
|
throw new Error(
|
1159
1227
|
"vizCache is required for v3 runtime"
|
1160
1228
|
);
|
1161
|
-
if (!
|
1229
|
+
if (!s)
|
1162
1230
|
throw new Error(
|
1163
1231
|
"vizId is required for v3 runtime if vizCache is provided"
|
1164
1232
|
);
|
1165
|
-
return await
|
1233
|
+
return await be({
|
1166
1234
|
files: e,
|
1167
1235
|
rollup: t,
|
1168
|
-
vizCache:
|
1169
|
-
vizId:
|
1236
|
+
vizCache: r,
|
1237
|
+
vizId: s,
|
1170
1238
|
slugCache: o,
|
1171
1239
|
getSvelteCompiler: c
|
1172
1240
|
});
|
@@ -1181,13 +1249,15 @@ ${o}
|
|
1181
1249
|
rollup: t,
|
1182
1250
|
enableSourcemap: n
|
1183
1251
|
});
|
1184
|
-
const a = await
|
1252
|
+
const a = await De({
|
1185
1253
|
files: e,
|
1186
1254
|
rollup: t,
|
1187
1255
|
enableSourcemap: n
|
1188
|
-
})
|
1256
|
+
}), d = M(
|
1257
|
+
a.files
|
1258
|
+
);
|
1189
1259
|
return {
|
1190
|
-
html: C(
|
1260
|
+
html: C(d),
|
1191
1261
|
js: a.bundledJS,
|
1192
1262
|
runtimeVersion: i
|
1193
1263
|
};
|
@@ -1203,14 +1273,14 @@ ${o}
|
|
1203
1273
|
}
|
1204
1274
|
};
|
1205
1275
|
export {
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1276
|
+
Ee as a,
|
1277
|
+
Qe as b,
|
1278
|
+
ge as c,
|
1279
|
+
Se as d,
|
1280
|
+
Ye as e,
|
1281
|
+
xe as f,
|
1282
|
+
qe as g,
|
1283
|
+
Ge as s,
|
1284
|
+
be as v
|
1215
1285
|
};
|
1216
|
-
//# sourceMappingURL=build-
|
1286
|
+
//# sourceMappingURL=build-B7w6NcTo.js.map
|