@stacksjs/stx 0.2.415 → 0.2.417
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/chunk-072f6hnz.js +2 -0
- package/dist/{chunk-0zaess6f.js → chunk-072mzamc.js} +5 -5
- package/dist/{chunk-q9bdh4s5.js → chunk-08p07eq7.js} +2 -2
- package/dist/chunk-0x076wz1.js +2 -0
- package/dist/{chunk-xfp7k0v8.js → chunk-0xgf3xgy.js} +16 -16
- package/dist/chunk-1680nbq4.js +2816 -0
- package/dist/{chunk-9g27ybyr.js → chunk-25n4gmek.js} +2 -2
- package/dist/chunk-2gfj59pt.js +2 -0
- package/dist/chunk-2gntnw7e.js +2 -0
- package/dist/chunk-2hvvwhmv.js +2 -0
- package/dist/{chunk-m4sk62wb.js → chunk-31a8eh0j.js} +4 -4
- package/dist/{chunk-t4hzprsm.js → chunk-3aqe7wy7.js} +2 -2
- package/dist/{chunk-ej9j6k1q.js → chunk-3f5td68v.js} +2 -2
- package/dist/chunk-3senpdjt.js +3 -0
- package/dist/{chunk-5qns2sdz.js → chunk-3wmxb126.js} +2 -2
- package/dist/{chunk-ft4p6d28.js → chunk-47h689h6.js} +2 -2
- package/dist/chunk-4bhertga.js +2 -0
- package/dist/chunk-4s9dypby.js +2 -0
- package/dist/{chunk-s5xezjps.js → chunk-5f3k2mke.js} +1 -1
- package/dist/{chunk-r3f9jcf7.js → chunk-5fwy3xap.js} +3 -3
- package/dist/{chunk-g186znp9.js → chunk-5vzamjf6.js} +4 -4
- package/dist/chunk-5z56g0n4.js +2 -0
- package/dist/chunk-68rq2fqt.js +12 -0
- package/dist/chunk-6ad0nseq.js +2 -0
- package/dist/{chunk-czxt605c.js → chunk-76japd6k.js} +4 -4
- package/dist/chunk-7eazcxzf.js +2 -0
- package/dist/chunk-7hy29tcy.js +2 -0
- package/dist/{chunk-ngc2wke4.js → chunk-7q1yy18q.js} +2 -2
- package/dist/{chunk-thyt8ed8.js → chunk-85bm5xrm.js} +3 -3
- package/dist/{chunk-7gkv67ky.js → chunk-865xvpp2.js} +2 -2
- package/dist/chunk-8fyqbq14.js +2 -0
- package/dist/chunk-92xzpt6p.js +2 -0
- package/dist/{chunk-96k8s808.js → chunk-94ky725r.js} +2 -2
- package/dist/{chunk-fh1qrp68.js → chunk-9af8qbwb.js} +5 -5
- package/dist/{chunk-j03revz2.js → chunk-9bq4w4d6.js} +3 -3
- package/dist/chunk-9kmmafp4.js +2 -0
- package/dist/{chunk-vgvtnwxa.js → chunk-9r5ycpdg.js} +3 -3
- package/dist/{chunk-gawrg4gb.js → chunk-9yt899e7.js} +6 -6
- package/dist/chunk-atgwc7r7.js +2 -0
- package/dist/{chunk-a688m6js.js → chunk-ayd5r3se.js} +2 -2
- package/dist/{chunk-ce1sejr3.js → chunk-bk5ndwv3.js} +2 -2
- package/dist/chunk-bs6y5wy2.js +2 -0
- package/dist/{chunk-y5310237.js → chunk-bt11a8z4.js} +3 -3
- package/dist/{chunk-amd6ey3t.js → chunk-c8p4v1rd.js} +5 -5
- package/dist/chunk-ccg6xjr1.js +2 -0
- package/dist/chunk-ckv4aty5.js +2 -0
- package/dist/{chunk-mp6hy8g4.js → chunk-d0ynfema.js} +1 -1
- package/dist/chunk-d6h9rpm4.js +30 -0
- package/dist/chunk-dbh7h0kt.js +2 -0
- package/dist/chunk-dhqkg0ph.js +2 -0
- package/dist/{chunk-h6zsqb9r.js → chunk-dw961rvn.js} +2 -2
- package/dist/{chunk-340a824p.js → chunk-dym1eteb.js} +1 -1
- package/dist/{chunk-ak1cgcah.js → chunk-e2m674vf.js} +4 -4
- package/dist/{chunk-169n1vpx.js → chunk-e83j8xe9.js} +4 -4
- package/dist/chunk-ettat5ah.js +2 -0
- package/dist/{chunk-6hc5vz20.js → chunk-ev8bhsc0.js} +2 -2
- package/dist/chunk-f4ws0qcd.js +2 -0
- package/dist/chunk-f97v10zr.js +2 -0
- package/dist/chunk-fe5st320.js +2 -0
- package/dist/chunk-fet3hce8.js +2 -0
- package/dist/chunk-fq7128p1.js +2 -0
- package/dist/{chunk-x0q32ees.js → chunk-fr8jq2ys.js} +2 -2
- package/dist/chunk-fwy2h1ms.js +2 -0
- package/dist/{chunk-shr559s7.js → chunk-fxhvkenf.js} +2 -2
- package/dist/{chunk-6h38kkjf.js → chunk-g947brd0.js} +6 -6
- package/dist/{chunk-tafqyf2g.js → chunk-gfm7g98y.js} +95 -95
- package/dist/chunk-gtkhykc4.js +2 -0
- package/dist/{chunk-y1cmjvk3.js → chunk-h8f18cc5.js} +6 -6
- package/dist/chunk-h8pkm7c5.js +2 -0
- package/dist/{chunk-hkrmcbwy.js → chunk-hg3tyzn5.js} +11 -11
- package/dist/{chunk-ym95v4nc.js → chunk-hkxxfzfd.js} +2 -2
- package/dist/{chunk-b84h16er.js → chunk-hm2k9a04.js} +7 -7
- package/dist/chunk-hneg0155.js +2 -0
- package/dist/chunk-hs90en70.js +2 -0
- package/dist/{chunk-v91p6ekp.js → chunk-jfjym18d.js} +5 -5
- package/dist/chunk-jgsgd6rt.js +17 -0
- package/dist/chunk-jn3njpxs.js +2 -0
- package/dist/chunk-ka8x4sw6.js +18 -0
- package/dist/{chunk-8eqrwj1k.js → chunk-kds79hq3.js} +11 -11
- package/dist/{chunk-9vrja6vp.js → chunk-kkj5x9rp.js} +1 -1
- package/dist/chunk-mcqn70v8.js +3 -0
- package/dist/chunk-mcs7p3fy.js +2 -0
- package/dist/{chunk-hepd9qgx.js → chunk-mj6fme15.js} +5 -5
- package/dist/{chunk-yazk54jr.js → chunk-mj9yv1vb.js} +1 -1
- package/dist/chunk-mmtg0jxd.js +2 -0
- package/dist/chunk-mrsxwd0h.js +2 -0
- package/dist/chunk-mscky0ww.js +2 -0
- package/dist/chunk-mtphm33a.js +2 -0
- package/dist/chunk-p2jbc71s.js +2 -0
- package/dist/{chunk-fr2txj8q.js → chunk-pb0fgdvn.js} +4 -4
- package/dist/{chunk-amtr3rmf.js → chunk-psmdbcbc.js} +4 -4
- package/dist/chunk-pvd9k3kx.js +2 -0
- package/dist/chunk-pz1jc3db.js +2 -0
- package/dist/chunk-q8swb7na.js +4 -0
- package/dist/{chunk-3kthfs03.js → chunk-qmzwhtr2.js} +2 -2
- package/dist/chunk-qvr6e2ve.js +3 -0
- package/dist/chunk-ra0pkkvd.js +2 -0
- package/dist/chunk-rcbtd4w3.js +2 -0
- package/dist/chunk-rd2r9jvn.js +2 -0
- package/dist/chunk-s8srb8bg.js +2 -0
- package/dist/{chunk-md8rqn48.js → chunk-sjjc670z.js} +9 -9
- package/dist/chunk-snf2b68p.js +2 -0
- package/dist/chunk-t2bfwr9v.js +2 -0
- package/dist/chunk-tbmwdahm.js +2 -0
- package/dist/{chunk-qghxz7jm.js → chunk-v15g9jjh.js} +6 -6
- package/dist/{chunk-8nhshfz6.js → chunk-vdqa5gt7.js} +2 -2
- package/dist/{chunk-9amp82bx.js → chunk-vepc9rbt.js} +2 -2
- package/dist/{chunk-eed4fwps.js → chunk-vfdwvt23.js} +2 -2
- package/dist/chunk-vpv896zx.js +2 -0
- package/dist/{chunk-bay9s6rs.js → chunk-vyfg2qd2.js} +5 -5
- package/dist/{chunk-9pt8fd2n.js → chunk-w5zmvn7b.js} +3 -3
- package/dist/chunk-w6h63b48.js +2 -0
- package/dist/{chunk-pgzvyrv6.js → chunk-wgzxmh7w.js} +3 -3
- package/dist/{chunk-jnkrn913.js → chunk-wpkxbggq.js} +1 -1
- package/dist/chunk-wrk3gkgg.js +2 -0
- package/dist/chunk-wtd71jsa.js +2 -0
- package/dist/{chunk-z0g9jvv0.js → chunk-wweasgq9.js} +18 -18
- package/dist/chunk-wymf1ek6.js +2 -0
- package/dist/chunk-wz8hyh8h.js +4 -0
- package/dist/chunk-x32wpjs0.js +2 -0
- package/dist/chunk-x4q2eyt0.js +2 -0
- package/dist/chunk-x95ejws0.js +2 -0
- package/dist/chunk-xket8ejt.js +2 -0
- package/dist/{chunk-pbh4smw3.js → chunk-xt6d3zws.js} +4 -4
- package/dist/{chunk-752hw7cd.js → chunk-xvn3sv3v.js} +3 -3
- package/dist/{chunk-tfexmdkt.js → chunk-xwkdv585.js} +2 -2
- package/dist/{chunk-765e1s44.js → chunk-y9t55tv7.js} +6 -6
- package/dist/chunk-ypfzy1mq.js +2 -0
- package/dist/{chunk-9p9qkbtg.js → chunk-yrbzsrde.js} +2 -2
- package/dist/chunk-zg68pwy8.js +2 -0
- package/dist/chunk-zs58fnme.js +2 -0
- package/dist/chunk-zy3p0vmx.js +3 -0
- package/dist/cli.js +21 -21
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/dev-server/serve-app.js +3 -0
- package/dist/dev-server/serve-multi.js +1 -1
- package/dist/dev-server/ts-css.d.ts +11 -0
- package/dist/dev-server/ts-css.js +13 -1
- package/dist/document-shell.js +15 -3
- package/dist/native/components/primitives.d.ts +2 -0
- package/dist/production-server.js +4 -4
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +17 -17
- package/package.json +5 -5
- package/dist/chunk-020xyn9q.js +0 -3
- package/dist/chunk-04jhmfbz.js +0 -2
- package/dist/chunk-0pnj3zt2.js +0 -2
- package/dist/chunk-1098mas0.js +0 -2
- package/dist/chunk-18vmfkcc.js +0 -2
- package/dist/chunk-1b6t12hd.js +0 -2
- package/dist/chunk-1zs30k3y.js +0 -2
- package/dist/chunk-2ce7f416.js +0 -2
- package/dist/chunk-393341w7.js +0 -2
- package/dist/chunk-39g1134q.js +0 -2
- package/dist/chunk-3efw27as.js +0 -2785
- package/dist/chunk-3qn1wcdg.js +0 -2
- package/dist/chunk-3s2vnqcf.js +0 -2
- package/dist/chunk-42wbs8vq.js +0 -17
- package/dist/chunk-4bjravgk.js +0 -2
- package/dist/chunk-5gsxpaqk.js +0 -2
- package/dist/chunk-6cfa3g0r.js +0 -2
- package/dist/chunk-7z2ra0yf.js +0 -2
- package/dist/chunk-92ps1xpk.js +0 -2
- package/dist/chunk-9xrbve19.js +0 -2
- package/dist/chunk-atws6p5s.js +0 -2
- package/dist/chunk-b98be3yp.js +0 -32
- package/dist/chunk-dd8cja4h.js +0 -2
- package/dist/chunk-dgdm3hy3.js +0 -2
- package/dist/chunk-e9hs7kk6.js +0 -12
- package/dist/chunk-et0rr8c7.js +0 -3
- package/dist/chunk-f1sxycmv.js +0 -2
- package/dist/chunk-f46qsp4m.js +0 -4
- package/dist/chunk-fbcv4fes.js +0 -2
- package/dist/chunk-fjs0a8h7.js +0 -2
- package/dist/chunk-fpfzm238.js +0 -2
- package/dist/chunk-fyzajkrx.js +0 -2
- package/dist/chunk-fzapbw9p.js +0 -3
- package/dist/chunk-g03s93qr.js +0 -3
- package/dist/chunk-gc1drn2p.js +0 -2
- package/dist/chunk-gea5hf0v.js +0 -2
- package/dist/chunk-gqv3ta5d.js +0 -2
- package/dist/chunk-h6kp2m9r.js +0 -2
- package/dist/chunk-hbxz85wy.js +0 -2
- package/dist/chunk-hhnw2sn3.js +0 -2
- package/dist/chunk-hjg3ndgh.js +0 -2
- package/dist/chunk-hk1mj4tz.js +0 -2
- package/dist/chunk-hn9pkyv8.js +0 -2
- package/dist/chunk-hpgr4qgp.js +0 -2
- package/dist/chunk-hrbbbtbn.js +0 -2
- package/dist/chunk-j9qcrwbg.js +0 -2
- package/dist/chunk-jk4njz0w.js +0 -2
- package/dist/chunk-jmabeqfq.js +0 -2
- package/dist/chunk-jp10q90g.js +0 -2
- package/dist/chunk-jt0n43mk.js +0 -2
- package/dist/chunk-kjbv8a3m.js +0 -2
- package/dist/chunk-m1vdghnx.js +0 -2
- package/dist/chunk-nc8my58s.js +0 -2
- package/dist/chunk-nn2vstke.js +0 -2
- package/dist/chunk-nppdrf0x.js +0 -2
- package/dist/chunk-p2v2a68k.js +0 -2
- package/dist/chunk-pazfr1a1.js +0 -2
- package/dist/chunk-pdb5fw3r.js +0 -2
- package/dist/chunk-pdt69hpb.js +0 -2
- package/dist/chunk-px7fvbj6.js +0 -3
- package/dist/chunk-q6vrb2pe.js +0 -2
- package/dist/chunk-q7qchkvk.js +0 -2
- package/dist/chunk-re8b5r9x.js +0 -3
- package/dist/chunk-sd321bn3.js +0 -2
- package/dist/chunk-t5pvq5mx.js +0 -2
- package/dist/chunk-w72qx0eb.js +0 -2
- package/dist/chunk-wfy1zq53.js +0 -30
- package/dist/chunk-wzx0164n.js +0 -18
- package/dist/chunk-xtvf6n6f.js +0 -4
- package/dist/chunk-xwzvfqcb.js +0 -2
- package/dist/chunk-ydjfar14.js +0 -2
- package/dist/chunk-z23kaxq6.js +0 -2
- package/dist/chunk-z8xn5ta3.js +0 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { hasLocalConfig } from "bunfig";
|
|
3
|
+
import { getServeModuleBundle } from "../caching.js";
|
|
3
4
|
import { mergeCssConfig } from "../ts-css-config.js";
|
|
4
5
|
import { stateDir } from "../state-dir.js";
|
|
5
6
|
import { dedupeScopedStyles, findDuplicateScopedStyleRanges } from "../style-scoping.js";
|
|
@@ -331,12 +332,23 @@ export async function generateCss(htmlContent, appDir) {
|
|
|
331
332
|
cssByPage.set(contentKey(htmlContent, appDir, rootFingerprint()), css);
|
|
332
333
|
return css;
|
|
333
334
|
}
|
|
335
|
+
export function withLinkedModuleBundles(htmlContent) {
|
|
336
|
+
const bundles = [];
|
|
337
|
+
for (const match of htmlContent.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)) {
|
|
338
|
+
const code = getServeModuleBundle(match[1]);
|
|
339
|
+
if (code)
|
|
340
|
+
bundles.push(code);
|
|
341
|
+
}
|
|
342
|
+
return bundles.length ? `${htmlContent}
|
|
343
|
+
${bundles.join(`
|
|
344
|
+
`)}` : htmlContent;
|
|
345
|
+
}
|
|
334
346
|
async function generateCssUncached(htmlContent, appDir) {
|
|
335
347
|
try {
|
|
336
348
|
const hw = await loadCssEngine();
|
|
337
349
|
if (!hw)
|
|
338
350
|
return "";
|
|
339
|
-
const classes = typeof hw.extractClasses === "function" ? hw.extractClasses(
|
|
351
|
+
const scanned = withLinkedModuleBundles(htmlContent), classes = typeof hw.extractClasses === "function" ? hw.extractClasses(scanned) : extractClassNames(scanned);
|
|
340
352
|
if (classes.size === 0)
|
|
341
353
|
return "";
|
|
342
354
|
const resolveRoot = appDir ? path.resolve(appDir) : process.cwd(), appDiskCache = stateDir(resolveRoot, "cache");
|
package/dist/document-shell.js
CHANGED
|
@@ -18,6 +18,15 @@ export function metaDedupKey(m) {
|
|
|
18
18
|
return `http-equiv="${m["http-equiv"]}"`;
|
|
19
19
|
return "";
|
|
20
20
|
}
|
|
21
|
+
function metaAttributes(tag) {
|
|
22
|
+
const open = /^\s*<meta\b([^>]*)>/i.exec(tag);
|
|
23
|
+
if (!open)
|
|
24
|
+
return null;
|
|
25
|
+
const attrs = {};
|
|
26
|
+
for (const match of open[1].matchAll(/([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g))
|
|
27
|
+
attrs[match[1].toLowerCase()] = match[2] ?? match[3] ?? match[4] ?? "";
|
|
28
|
+
return attrs;
|
|
29
|
+
}
|
|
21
30
|
function attrPairs(entries, skip) {
|
|
22
31
|
return Object.entries(entries).filter(([k]) => !skip?.(k)).map(([k, v]) => `${k}="${escapeAttr(String(v))}"`).join(" ");
|
|
23
32
|
}
|
|
@@ -214,10 +223,13 @@ export function generateDocumentShell(content, headConfig = {}, options = {}) {
|
|
|
214
223
|
} = headConfig, pageTitle = options.title || configTitle, defaultMeta = [
|
|
215
224
|
{ charset: "UTF-8" },
|
|
216
225
|
{ name: "viewport", content: "width=device-width, initial-scale=1.0" }
|
|
217
|
-
], configuredMetaKeys = new Set(meta.map(metaDedupKey).filter(Boolean)),
|
|
226
|
+
], configuredMetaKeys = new Set(meta.map(metaDedupKey).filter(Boolean)), { body: pageBody, hoisted: pageHeadTags } = hoistLeadingHeadTags(content), pageMetaKeys = new Set(pageHeadTags.flatMap((tag) => {
|
|
227
|
+
const attrs = metaAttributes(tag);
|
|
228
|
+
return attrs ? [metaDedupKey(attrs)].filter(Boolean) : [];
|
|
229
|
+
})), metaTags = [
|
|
218
230
|
...defaultMeta.filter((d) => !configuredMetaKeys.has(metaDedupKey(d))),
|
|
219
231
|
...meta
|
|
220
|
-
].map((m) => {
|
|
232
|
+
].filter((m) => !pageMetaKeys.has(metaDedupKey(m))).map((m) => {
|
|
221
233
|
return ` <meta ${attrPairs(m)}>`;
|
|
222
234
|
}).join(`
|
|
223
235
|
`), linkTags = link.map((l) => {
|
|
@@ -230,7 +242,7 @@ export function generateDocumentShell(content, headConfig = {}, options = {}) {
|
|
|
230
242
|
return ` <script>${s.content}</script>`;
|
|
231
243
|
return "";
|
|
232
244
|
}).filter(Boolean).join(`
|
|
233
|
-
`), htmlAttrStr = buildHtmlAttrs(htmlAttrs, lang), bodyAttrStr = Object.entries(bodyAttrs).map(([k, v]) => ` ${k}="${escapeAttr(String(v))}"`).join(""), bodyClassStr = bodyClass ? ` class="${escapeAttr(bodyClass)}"` : "",
|
|
245
|
+
`), htmlAttrStr = buildHtmlAttrs(htmlAttrs, lang), bodyAttrStr = Object.entries(bodyAttrs).map(([k, v]) => ` ${k}="${escapeAttr(String(v))}"`).join(""), bodyClassStr = bodyClass ? ` class="${escapeAttr(bodyClass)}"` : "", headParts = [
|
|
234
246
|
metaTags,
|
|
235
247
|
options.colorMode ? ` ${generateColorModeBootScript(options.colorMode)}` : "",
|
|
236
248
|
` <title>${options.titleIsHtml ? pageTitle : escapeText(pageTitle)}</title>`,
|
|
@@ -54,6 +54,8 @@ export declare interface ScrollViewProps extends ViewProps {
|
|
|
54
54
|
contentContainerStyle?: STXStyle
|
|
55
55
|
keyboardDismissMode?: 'none' | 'on-drag' | 'interactive'
|
|
56
56
|
refreshControl?: RefreshControlProps
|
|
57
|
+
stickyHeaderIndices?: number[]
|
|
58
|
+
scrollTarget?: string | { id: string, key?: string | number, animated?: boolean } | null
|
|
57
59
|
pagingEnabled?: boolean
|
|
58
60
|
scrollEnabled?: boolean
|
|
59
61
|
}
|
|
@@ -5,7 +5,7 @@ import { loadManifest } from "./manifest.js";
|
|
|
5
5
|
import { hydrateTemplateStream } from "./template-hydrator.js";
|
|
6
6
|
import { extractContainerContent, extractLayoutMetadata } from "./app-shell.js";
|
|
7
7
|
import { pageShipsSignalsRuntime } from "./runtime-injection.js";
|
|
8
|
-
import { patternToRegex } from "stx-router";
|
|
8
|
+
import { isFileRequestPath, patternToRegex } from "stx-router";
|
|
9
9
|
import { compressResponse } from "./compression.js";
|
|
10
10
|
import { actionRedirectResponse, isActionableMethod } from "./page-action.js";
|
|
11
11
|
import { FRAGMENT_CACHE_CONTROL, isSpaNavRequest, spaNavVaryHeaders } from "./spa-nav.js";
|
|
@@ -69,7 +69,7 @@ export async function startProductionServer(options = {}) {
|
|
|
69
69
|
const exactRoutes = new Map, paramRoutes = [];
|
|
70
70
|
for (const route of manifest.routes)
|
|
71
71
|
if (route.hasParams) {
|
|
72
|
-
const { regex, params: paramNames } = patternToRegex(route.pattern);
|
|
72
|
+
const { regex, params: paramNames } = patternToRegex(route.pattern, { page: !0 });
|
|
73
73
|
paramRoutes.push({ regex, route, paramNames });
|
|
74
74
|
} else
|
|
75
75
|
exactRoutes.set(route.pattern, route);
|
|
@@ -132,7 +132,7 @@ export async function startProductionServer(options = {}) {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
if (!matchedRoute) {
|
|
135
|
-
const errorPage = exactRoutes.get("/404") || null;
|
|
135
|
+
const errorPage = isFileRequestPath(pathname) ? null : exactRoutes.get("/404") || null;
|
|
136
136
|
if (errorPage) {
|
|
137
137
|
const compiled = compiledTemplates.get(errorPage.pattern);
|
|
138
138
|
if (compiled)
|
|
@@ -141,7 +141,7 @@ export async function startProductionServer(options = {}) {
|
|
|
141
141
|
headers: { "Content-Type": "text/html" }
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
|
-
return new Response("Not Found", { status: 404 });
|
|
144
|
+
return new Response("Not Found", { status: 404, headers: { "Content-Type": "text/plain; charset=utf-8" } });
|
|
145
145
|
}
|
|
146
146
|
const rule = resolveRule(pathname), controlled = Object.keys(rule).length > 0;
|
|
147
147
|
return responseCache.respond(request, rule.cache, async () => {
|
package/dist/pwa.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-
|
|
2
|
+
import{_n,Ae,Ci,Ea}from"./chunk-pb0fgdvn.js";import{Tn,Dr,ka,Ca,$a}from"./chunk-hm2k9a04.js";import{xi,Si,ki,xa,Sa}from"./chunk-08p07eq7.js";import{ie,ut,Or}from"./chunk-85bm5xrm.js";import{Rc,Ac,Pc,Ic,rr,Ju}from"./chunk-47h689h6.js";import B from"fs";import w from"path";import O from"fs";import u from"path";var v=[72,96,128,144,152,192,384,512],S=[120,152,167,180],P=[16,32];async function M(n,t){let e={success:!0,generatedFiles:[],errors:[],warnings:[]},r=n.pwa?.icons;if(!r?.src)return e.errors.push("No source icon specified in pwa.icons.src"),e.success=!1,e;let o=u.isAbsolute(r.src)?r.src:u.resolve(process.cwd(),r.src);if(!await Bun.file(o).exists())return e.errors.push(`Source icon not found: ${o}`),e.success=!1,e;let a=u.resolve(t,r.outputDir||"pwa-icons");try{O.mkdirSync(a,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${a}`),e.success=!1,e}let s=r.sizes||v,l=r.generateWebP??!0,p=r.generateAppleIcons??!0;try{let c;try{c=await import("sharp")}catch{return e.errors.push(`sharp is not installed. Install it with: bun add sharp
|
|
3
|
+
Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-pvd9k3kx.js"),o=await Bun.file(e).text();return await r(o,{},e,n,new Set)}catch(r){console.warn(`[PWA] Failed to process custom offline page: ${r}`)}else console.warn(`[PWA] Custom offline page not found: ${e}`)}return E(n)}function E(n){let t=n.pwa?.offline,e=n.pwa?.manifest,r=t?.fallbackTitle||"You are offline",o=t?.fallbackMessage||"Please check your internet connection and try again.",a=e?.themeColor||"#4f46e5",s=e?.shortName||e?.name||"App";return`<!DOCTYPE html>
|
|
4
4
|
<html lang="en">
|
|
5
5
|
<head>
|
|
6
6
|
<meta charset="UTF-8">
|
|
@@ -233,4 +233,4 @@ Icon generation requires the sharp package for image processing.`),e.success=!1,
|
|
|
233
233
|
}, 5000);
|
|
234
234
|
</script>
|
|
235
235
|
</body>
|
|
236
|
-
</html>`}function b(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=
|
|
236
|
+
</html>`}function b(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=ie(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=_n(n,t);if(a){let s=Ae(n),l=w.join(t,s);await Bun.write(l,a),e.files.serviceWorker=l}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate service worker: ${s}`),e.success=!1}return e}function ae(n,t){return Dr(n,t)}function se(n){return n.pwa?.enabled===!0}export{S as APPLE_TOUCH_ICON_SIZES,v as DEFAULT_ICON_SIZES,P as FAVICON_SIZES,Si as auditBuildOutput,xi as auditConfig,re as buildPwaAssets,ki as calculateAuditResult,Sa as formatAuditResult,Or as formatSize,j as generateManifest,_ as generateManifestJson,Ca as generateManifestLink,F as generateOfflinePage,ie as generatePrecacheManifest,ut as generatePrecacheManifestJs,M as generatePwaIcons,Tn as generatePwaTags,_n as generateServiceWorker,Ea as generateServiceWorkerAuto,ka as generateSwRegistrationScript,$a as generateThemeColorMeta,N as getExpectedIconPaths,Ae as getServiceWorkerFileName,Dr as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,Ci as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,rr as pwaDirectives,Rc as pwaInstallDirective,Pc as pwaOfflineDirective,Ic as pwaPushDirective,Ac as pwaUpdateDirective,Ju as registerPwaDirectives,xa as runPwaAudit,D as validateManifest};
|
package/dist/ssg.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
3
|
-
`)}class
|
|
2
|
+
import"./chunk-wweasgq9.js";import"./chunk-fxhvkenf.js";import{Ye,Ze,Qe,et,tt,nt}from"./chunk-76japd6k.js";import"./chunk-bk5ndwv3.js";import"./chunk-vdqa5gt7.js";import{f,Ne,M,q,r,i}from"./chunk-1680nbq4.js";import"./chunk-31a8eh0j.js";import{Kn}from"./chunk-0xgf3xgy.js";import"./chunk-7q1yy18q.js";import"./chunk-vepc9rbt.js";import"./chunk-865xvpp2.js";import"./chunk-e2m674vf.js";import"./chunk-mj6fme15.js";import{oe,dt,pt}from"./chunk-jgsgd6rt.js";import{bi,vi,wi}from"./chunk-5fwy3xap.js";import{lt,qt,Xt}from"./chunk-zy3p0vmx.js";import"./chunk-xvn3sv3v.js";import{a}from"./chunk-mcqn70v8.js";import x from"fs";import g from"path";import{createHash as bt}from"crypto";function Pt(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var $t=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Dt(t){return Bun.hash(t).toString(16)}function ot(t,s={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let o=new Map,n=t.replace($t,(e,l,w,y)=>{let h=y.trim();if(!h)return e;if(/\bdata-stx-src=/.test(w))return e;if(s.minify)h=Pt(h);let S=Dt(h);if(!o.has(S))o.set(S,h);let P=s.integrity?` data-stx-integrity="sha384-${bt("sha384").update(h).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${l}" data-stx-src="/_stx/islands/${S}.js"${P}${w}></script>`}),c=Array.from(o,([e,l])=>({hash:e,code:l}));return{html:n,chunks:c}}var Rt=new Set(["visible","idle"]);function ct(t){if(!t.includes("data-stx-src="))return t;let s=new Map,o=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,n;while((n=o.exec(t))!==null)s.set(n[1],n[2]);let c=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,l;while((l=e.exec(t))!==null)if(Rt.has(s.get(l[1])||""))c.add(l[2]);let w=t.lastIndexOf("</head>");if(c.size===0||w===-1)return t;let y=Array.from(c).filter((h)=>!t.includes(`rel="prefetch" href="${h}"`)).map((h)=>`<link rel="prefetch" href="${h}" as="script">`).join("");if(!y)return t;return t.slice(0,w)+y+t.slice(w)}var kt=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function J(t){let s=t.trim();if(!s)return null;let o=/^https?:\/\//i.test(s)?s:`https://${s}`;try{return new URL(o).origin+new URL(o).pathname.replace(/\/$/,"")}catch{return null}}function Ct(t){for(let s of kt){let o=t[s];if(!o)continue;let n=J(o);if(n)return{url:n,source:"env",via:s}}return null}function ut(t){if(!t||typeof t!=="object")return null;let s=t,o=s.site?.url??s.url??s.app?.url;return typeof o==="string"?J(o):null}async function Et(t){let{existsSync:s}=await import("fs"),o=await import("path");for(let n of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=o.resolve(t,n);if(!s(c))continue;try{let e=await import(c),l=ut(e.default??e);if(l)return l}catch{}}return null}async function gt(t={}){let s=t.cwd??process.cwd(),o=t.env??process.env;if(t.explicit){let l=J(t.explicit);if(l)return{url:l,source:"option"}}let n=ut(t.stxConfig);if(n)return{url:n,source:"stx.config",via:"site.url"};let c=await Et(s);if(c)return{url:c,source:"site.config",via:"url"};let e=Ct(o);if(e)return e;return{url:"http://localhost",source:"fallback"}}function ht(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
|
|
3
|
+
`)}class ft{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,s=""){this.cacheDir=t,this.salt=s}async load(){if(this.loaded)return;let t=g.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let s=JSON.parse(await Bun.file(t).text());for(let[o,n]of Object.entries(s))this.cache.set(o,n)}catch{}this.loaded=!0}async save(){await x.promises.mkdir(this.cacheDir,{recursive:!0});let t=g.join(this.cacheDir,"build-cache.json"),s={};for(let[o,n]of this.cache)s[o]=n;await Bun.write(t,JSON.stringify(s))}getHash(t,s){let o=x.statSync(t),n=`${this.salt}|${t}:${o.mtimeMs}`;for(let e of s)if(x.existsSync(e)){let l=x.statSync(e);n+=`:${e}:${l.mtimeMs}`}let c=0;for(let e=0;e<n.length;e++){let l=n.charCodeAt(e);c=(c<<5)-c+l,c=c&c}return Math.abs(c).toString(36)}get(t,s){let o=this.cache.get(t);if(!o)return null;let n=this.getHash(s,o.dependencies??[]);if(o.hash!==n)return this.cache.delete(t),null;return o.html}set(t,s,o,n){let c=this.getHash(s,o);this.cache.set(t,{hash:c,html:n,generatedAt:Date.now(),dependencies:o})}}class mt{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let s=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return g.join(this.cacheDir,"isr",s)}async get(t){let s=this.getFilePath(t);if(!await Bun.file(s).exists())return null;try{return JSON.parse(await Bun.file(s).text())}catch{return null}}async set(t,s){let o=this.getFilePath(t);await x.promises.mkdir(g.dirname(o),{recursive:!0}),await Bun.write(o,JSON.stringify(s))}async invalidate(t){let s=this.getFilePath(t);if(await Bun.file(s).exists())await x.promises.unlink(s)}async invalidatePattern(t){let s=g.join(this.cacheDir,"isr");if(!x.existsSync(s))return;let o=await x.promises.readdir(s);for(let n of o){let c=n.replace(/_/g,"/").replace(".json","");if(t.test(c))await x.promises.unlink(g.join(s,n))}}async needsRevalidation(t){let s=await this.get(t);if(!s)return!0;return Date.now()>s.revalidateAfter}}async function It(t){try{let o=(await Bun.file(t).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!o)return null;let n=o[1];if(!n.includes("getStaticPaths"))return null;let c=n.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!c)return null;return await Function(`
|
|
4
4
|
return (async function getStaticPaths() {
|
|
5
5
|
${c[1]}
|
|
6
6
|
})()
|
|
7
|
-
`)()}catch(s){return console.error(`Error extracting static paths from ${t}:`,s),null}}async function
|
|
7
|
+
`)()}catch(s){return console.error(`Error extracting static paths from ${t}:`,s),null}}async function Bt(t){let s=[];if(!t.isDynamic)s.push({url:t.pattern,params:{}});else{let o=await It(t.filePath);if(!o||o.paths.length===0)return console.warn(`Warning: Dynamic route ${t.pattern} has no getStaticPaths or returned empty paths`),s;for(let n of o.paths){let c=t.pattern;for(let[e,l]of Object.entries(n.params))c=c.replace(`:${e}`,l).replace(`:${e}*`,l);s.push({url:c,params:n.params,props:n.props,revalidate:n.revalidate})}}return s}async function jt(t){let s=[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"];for(let o of s)if(await Bun.file(o).exists())try{let n=await import(o);if(typeof n.default==="function")return await n.default();else if(typeof n.default==="object")return n.default;else if(typeof n.getData==="function")return await n.getData();else{let{default:c,...e}=n;return e}}catch(n){console.error(`Error loading data file ${o}:`,n)}return null}async function Ft(t,s,o){let n=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!n)return null;let c=n[1];if(!c.includes("getStaticProps"))return null;try{let e=c.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!e)return null;return await Function("params",`
|
|
8
8
|
return (async function getStaticProps() {
|
|
9
9
|
${e[1]}
|
|
10
10
|
})()
|
|
11
|
-
`)(s)}catch(e){return console.error(`Error executing getStaticProps in ${
|
|
12
|
-
resolved against partialsDir: ${b.partialsDir}`)},onServerScriptError:(b)=>{P.push(`${g.relative(process.cwd(),b.sourcePath)} (${b.kind}): ${b.message}`)}};if(
|
|
11
|
+
`)(s)}catch(e){return console.error(`Error executing getStaticProps in ${o}:`,e),null}}function Ot(t){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test(t)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test(t)}async function wt(t,s,o={},n,c){let e=await Bun.file(t.filePath).text(),l=await jt(t.filePath),w=await Ft(e,s,t.filePath),y={...l||{},...w||{},...o,params:s,$route:{path:t.pattern,params:s}},h=new Set,S=[],P=[],D={...c,...n.partialsDir?{partialsDir:n.partialsDir}:{},...n.componentsDir?{componentsDir:n.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(b)=>{S.push(`${g.relative(process.cwd(),b.templatePath)}: ${b.message}
|
|
12
|
+
resolved against partialsDir: ${b.partialsDir}`)},onServerScriptError:(b)=>{P.push(`${g.relative(process.cwd(),b.sourcePath)} (${b.kind}): ${b.message}`)}};if(Ot(e))console.warn(`Warning: ${t.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let p=await r(e,y,t.filePath,D,h);for(let b of[t.filePath,...h])for(let B of oe(b))h.add(B);if(Object.keys(s).length>0){let b=`<script>if(window.stx)window.stx._rp=${JSON.stringify(s)};else window.__stx_rp=${JSON.stringify(s)};</script>`;if(p.includes("</head>"))p=p.replace("</head>",`${b}
|
|
13
13
|
</head>`);else p=`${b}
|
|
14
|
-
${p}`}if(p=await
|
|
14
|
+
${p}`}if(p=await q(p,{router:n.router}),p=await f(p),n.minify!==!1)return{html:Tt(p),dependencies:Array.from(h),includeFailures:S,serverScriptFailures:P};return{html:p,dependencies:Array.from(h),includeFailures:S,serverScriptFailures:P}}function Tt(t){let s=[],o=0,n=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,c;while((c=n.exec(t))!==null){let l=t.slice(o,c.index);s.push(l.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let w=c[1],y=c[2],h=c[3];y=y.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),s.push(w+y+h),o=c.index+c[0].length}let e=t.slice(o);return s.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),s.join("").trim()}function At(t){let s=0;for(let o=0;o<t.length;o++){let n=t.charCodeAt(o);s=(s<<5)-s+n,s=s&s}return`"${Math.abs(s).toString(36)}"`}function Lt(t,s,o,n){if(o?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(s))return!0;return n.some((c)=>{if(c instanceof RegExp)return c.test(t);return c.endsWith("/")?t===c.slice(0,-1)||t.startsWith(c):t===c})}function Mt(t,s){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
15
15
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
16
16
|
${t.map((n)=>{let c=new URL(n.loc,s).href,e=` <url>
|
|
17
17
|
<loc>${I(c)}</loc>`;if(n.lastmod)e+=`
|
|
@@ -20,7 +20,7 @@ ${t.map((n)=>{let c=new URL(n.loc,s).href,e=` <url>
|
|
|
20
20
|
<priority>${n.priority}</priority>`;return e+=`
|
|
21
21
|
</url>`,e}).join(`
|
|
22
22
|
`)}
|
|
23
|
-
</urlset>`}function I(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function
|
|
23
|
+
</urlset>`}function I(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ut(t,s){let o=s.map((n)=>{let c=" <item>";if(c+=`
|
|
24
24
|
<title>${I(n.title)}</title>`,c+=`
|
|
25
25
|
<link>${I(n.link)}</link>`,n.description)c+=`
|
|
26
26
|
<description>${I(n.description)}</description>`;if(n.pubDate)c+=`
|
|
@@ -38,21 +38,21 @@ ${t.map((n)=>{let c=new URL(n.loc,s).href,e=` <url>
|
|
|
38
38
|
${t.copyright?`<copyright>${I(t.copyright)}</copyright>`:""}
|
|
39
39
|
<lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
|
|
40
40
|
<atom:link href="${t.link}/rss.xml" rel="self" type="application/rss+xml"/>
|
|
41
|
-
${
|
|
41
|
+
${o.join(`
|
|
42
42
|
`)}
|
|
43
43
|
</channel>
|
|
44
|
-
</rss>`}async function
|
|
45
|
-
const validate = ${
|
|
44
|
+
</rss>`}async function _t(t={}){let s=Date.now();pt();let o=await i(process.cwd()),n=o.build||{},c=await gt({explicit:t.domain||n.domain,stxConfig:o});if(c.source==="fallback"&&(t.sitemap??n.sitemap??!0))console.warn(ht());let e={router:t.router??o?.router??{},pagesDir:t.pagesDir||n.pagesDir||"pages",outputDir:t.outputDir||n.outputDir||"dist",baseUrl:t.baseUrl||n.baseUrl||"/",domain:c.url,revalidate:t.revalidate??n.revalidate??!1,sitemap:t.sitemap??n.sitemap??!0,sitemapExclude:t.sitemapExclude||n.sitemapExclude||[],robots:t.robots??n.robots??!0,rss:t.rss??n.rss??!1,concurrency:t.concurrency||n.concurrency||10,cache:t.cache??n.cache??!0,cacheDir:t.cacheDir||n.cacheDir||a(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??n.minify??!0,generate404:t.generate404??n.generate404??!0,publicDir:t.publicDir||n.publicDir||"public",trailingSlash:t.trailingSlash??n.trailingSlash??!1,cleanOutput:t.cleanOutput??n.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||o?.partialsDir||"",componentsDir:t.componentsDir||o?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},l={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},w=new Set,y=0,h={},S={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&x.existsSync(e.outputDir))await x.promises.rm(e.outputDir,{recursive:!0});await x.promises.mkdir(e.outputDir,{recursive:!0});let D=e.cacheSalt;if(!D){let{resolveUserCssConfig:u,fingerprintConfig:m}=await import("./chunk-w6h63b48.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-wrk3gkgg.js"),b=await p(e.publicDir,e.outputDir);if(b.count>0)console.log(`Optimized ${b.count} image(s) for responsive delivery`),D=[D,b.fingerprint].filter(Boolean).join(":");let B=new ft(e.cacheDir,D);if(e.cache)await B.load();try{let{generateCss:u}=await import("./chunk-w6h63b48.js");await u('<div class="bg-black"></div>')}catch{}Ye();let yt=o?.routeMiddleware?.dir||"middleware";await Qe(process.cwd(),yt);let H=Ze();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let St=o?.routeMiddleware?.global||[];wi(o?.layoutsDir,a(process.cwd()));let K=M(".",{pagesDir:e.pagesDir,pagesDirs:o?._layerPageDirs});console.log(`Found ${K.length} routes`);let G=[];for(let u of K){let m=await Bt(u);for(let v of m)G.push({route:u,url:v.url,params:v.params,props:v.props,revalidate:v.revalidate??e.revalidate})}l.totalPages=G.length,console.log(`Generating ${l.totalPages} pages...`);let A=[],X=[];for(let u=0;u<G.length;u+=e.concurrency)X.push(G.slice(u,u+e.concurrency));for(let u of X)await Promise.all(u.map(async(m)=>{let{route:v,url:d,params:L,props:xt,revalidate:Q}=m;try{await e.hooks.onPageStart?.(d);let j=await Bun.file(v.filePath).text(),F=Ht(j),vt=F?.middleware?Array.isArray(F.middleware)?F.middleware:[F.middleware]:[],rt=[...St,...vt];if(rt.length>0){let C=et(d,L,F||{}),O=tt(C,null,void 0,{isServer:!0}),E=await nt(rt,O);if(E.redirect){let R=typeof E.redirect==="string"?E.redirect:E.redirect.path||E.redirect,_=Wt(String(R),d),T=Jt(d,e);await x.promises.mkdir(g.dirname(T),{recursive:!0}),await Bun.write(T,_),l.successCount++,l.pages.push({route:d,outputPath:T,size:Buffer.byteLength(_),cached:!1}),A.push({loc:d,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${d} \u2192 redirect to ${R}`);return}if(E.abort){let R=typeof E.abort==="string"?E.abort:E.abort?.error?.message||"aborted";console.warn(` \u21B3 ${d} \u2014 middleware aborted: ${R}`);return}}let it=j.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(it)try{if(!await Function("route",`
|
|
45
|
+
const validate = ${it[1]};
|
|
46
46
|
return validate(route);
|
|
47
|
-
`)({params:L})){console.warn(`Validation failed for ${d}, skipping...`);return}}catch{}let k=null,
|
|
47
|
+
`)({params:L})){console.warn(`Validation failed for ${d}, skipping...`);return}}catch{}let k=null,st=!1;if(e.cache){if(k=B.get(d,v.filePath),k)st=!0,l.cachedCount++}if(!k){let C=await wt(v,L,xt,e,o);if(k=C.html,e.failOnIncludeError&&C.includeFailures.length>0)throw Error(`${C.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
|
|
48
48
|
${C.includeFailures.join(`
|
|
49
49
|
`)}
|
|
50
50
|
Set ssg.failOnIncludeError to false to build anyway.`);if(e.failOnServerScriptError&&C.serverScriptFailures.length>0)throw Error(`${C.serverScriptFailures.length} <script server> block(s) failed, so this page would have shipped with the content they produce missing:
|
|
51
51
|
${C.serverScriptFailures.join(`
|
|
52
52
|
`)}
|
|
53
|
-
Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)B.set(d,v.filePath,C.dependencies,k)}let U;if(e.trailingSlash)U=g.join(e.outputDir,d,"index.html");else U=d==="/"?g.join(e.outputDir,"index.html"):g.join(e.outputDir,`${d}.html`);if(e.chunkIslands){let{html:C,chunks:O}=
|
|
53
|
+
Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)B.set(d,v.filePath,C.dependencies,k)}let U;if(e.trailingSlash)U=g.join(e.outputDir,d,"index.html");else U=d==="/"?g.join(e.outputDir,"index.html"):g.join(e.outputDir,`${d}.html`);if(e.chunkIslands){let{html:C,chunks:O}=ot(k,{integrity:e.integrityIslands,minify:e.minify});if(O.length>0){let E=g.join(e.outputDir,"_stx","islands");await x.promises.mkdir(E,{recursive:!0});for(let R of O){let _=g.join(E,`${R.hash}.js`);if(!await Bun.file(_).exists())await Bun.write(_,R.code);if(!w.has(R.hash)){w.add(R.hash);let T=Buffer.byteLength(R.code,"utf8");y+=T,h[R.hash]={bytes:T,file:`/_stx/islands/${R.hash}.js`}}}if(S[d]=O.map((R)=>R.hash),k=C,e.prefetchIslands)k=ct(k)}}if(await x.promises.mkdir(g.dirname(U),{recursive:!0}),await Bun.write(U,k),!Lt(d,k,F,e.sitemapExclude))A.push({loc:d,lastmod:new Date().toISOString().split("T")[0],priority:d==="/"?1:0.8});let at={route:d,outputPath:U,size:Buffer.byteLength(k,"utf8"),cached:st};if(Q!==!1)at.revalidateAt=Date.now()+Q*1000;l.pages.push(at),l.successCount++,await e.hooks.onPageEnd?.(d,k)}catch(j){l.failedCount++,l.errors.push({route:d,error:j}),await e.hooks.onError?.(j,d),console.error(`Error generating ${d}:`,j)}}));let Y=dt();if(Y.length>0){let u=Y.map((m)=>`${m.filePath}: ${m.message}`).join(`
|
|
54
54
|
`);throw Error(`Client script bundling failed:
|
|
55
|
-
${u}`)}if(e.cache)await B.save();if(e.generate404){let u=g.join(e.pagesDir,"404.stx");if(await Bun.file(u).exists()){let m=new Set,v={...
|
|
55
|
+
${u}`)}if(e.cache)await B.save();if(e.generate404){let u=g.join(e.pagesDir,"404.stx");if(await Bun.file(u).exists()){let m=new Set,v={...o,debug:!1,cache:!1},d=await r(await Bun.file(u).text(),{},u,v,m);await Bun.write(g.join(e.outputDir,"404.html"),d)}else await Bun.write(g.join(e.outputDir,"404.html"),`<!DOCTYPE html>
|
|
56
56
|
<html lang="en">
|
|
57
57
|
<head>
|
|
58
58
|
<meta charset="UTF-8">
|
|
@@ -73,7 +73,7 @@ ${u}`)}if(e.cache)await B.save();if(e.generate404){let u=g.join(e.pagesDir,"404.
|
|
|
73
73
|
<a href="/">Go home</a>
|
|
74
74
|
</div>
|
|
75
75
|
</body>
|
|
76
|
-
</html>`)}for(let u of[500]){let m=g.join(e.pagesDir,`${u}.stx`);if(await Bun.file(m).exists()){let v=new Set,d={...
|
|
76
|
+
</html>`)}for(let u of[500]){let m=g.join(e.pagesDir,`${u}.stx`);if(await Bun.file(m).exists()){let v=new Set,d={...o,debug:!1,cache:!1},L=await r(await Bun.file(m).text(),{},m,d,v);await Bun.write(g.join(e.outputDir,`${u}.html`),L)}}let W=g.join(e.pagesDir,"error.stx");if(await Bun.file(W).exists()){let u=new Set,m={...o,debug:!1,cache:!1},v=await r(await Bun.file(W).text(),{},W,m,u);await Bun.write(g.join(e.outputDir,"error.html"),v)}if(e.sitemap&&A.length>0){let u=Mt(A,e.domain),m=g.join(e.outputDir,"sitemap.xml");await Bun.write(m,u),l.sitemapPath=m,console.log(`Generated sitemap.xml with ${A.length} URLs`)}if(e.robots!==!1){let u=typeof e.robots==="object"?e.robots:{},m=[...e.sitemapExclude.filter((d)=>typeof d==="string"),...u.disallow||[]],v=Kn({rules:[{userAgent:u.userAgent||"*",allow:u.allow||["/"],...m.length>0?{disallow:m}:{}}],...u.sitemap!==!1&&l.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(g.join(e.outputDir,"robots.txt"),v),console.log("Generated robots.txt")}if(e.rss){let u=typeof e.rss==="object"?e.rss:{title:"Site Feed",description:"Latest updates",link:e.domain},m=[];if(u.getItems)m=await u.getItems();let v=Ut(u,m),d=g.join(e.outputDir,"rss.xml");await Bun.write(d,v),l.rssPath=d,console.log(`Generated rss.xml with ${m.length} items`)}let N=bi(e.outputDir);if(N.assets>0)console.log(`Externalized ${N.assets} asset(s) from ${N.pages} page(s) (${(N.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let z=vi(e.outputDir);if(z.assets>0)console.log(`Externalized ${z.assets} repeated asset(s) from ${z.pages} page(s) (${(z.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&x.existsSync(e.publicDir))await V(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let Z=Xt();if(Z)await V(Z,g.join(e.outputDir,qt)),console.log(`Copied assets from ${lt}`)}catch(D){throw await e.hooks.onError?.(D),D}if(l.buildTime=Date.now()-s,w.size>0){l.islandChunks={count:w.size,totalBytes:y};let D={generatedChunks:w.size,totalBytes:y,chunks:h,pages:S};await Bun.write(g.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(D,null,2))}await e.hooks.onBuildEnd?.(l);let P=l.islandChunks?`
|
|
77
77
|
Island chunks: ${l.islandChunks.count} (${(l.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
|
|
78
78
|
Build complete!
|
|
79
79
|
Total: ${l.totalPages} pages
|
|
@@ -81,8 +81,8 @@ Build complete!
|
|
|
81
81
|
Cached: ${l.cachedCount}
|
|
82
82
|
Failed: ${l.failedCount}
|
|
83
83
|
Time: ${l.buildTime}ms${P}
|
|
84
|
-
`),l}async function
|
|
85
|
-
`)){let P=S.indexOf(":");if(P>0){let D=S.slice(0,P).trim(),p=S.slice(P+1).trim();if(p==="true")p=!0;else if(p==="false")p=!1;else if(/^\d+$/.test(p))p=parseInt(p,10);else if(/^\d+\.\d+$/.test(p))p=parseFloat(p);else if(p.startsWith("[")&&p.endsWith("]"))p=p.slice(1,-1).split(",").map((b)=>b.trim().replace(/^['"]|['"]$/g,""));n[D]=p}}}let e=c.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),l=[],w=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,y;while((y=w.exec(e))!==null){let h=parseInt(y[1],10),S=y[2],P=S.toLowerCase().replace(/[^a-z0-9]+/g,"-");l.push({id:P,text:S,level:h})}return{content:e,data:n,toc:l}}}}function
|
|
84
|
+
`),l}async function V(t,s){await x.promises.mkdir(s,{recursive:!0});let o=await x.promises.readdir(t,{withFileTypes:!0});for(let n of o){let c=g.join(t,n.name),e=g.join(s,n.name);if(n.isDirectory())await x.promises.mkdir(e,{recursive:!0}),await V(c,e);else await x.promises.copyFile(c,e)}}function Gt(t={}){let s=t.cacheDir||a(process.cwd(),"ssg-cache"),o=new mt(s),n=t.revalidate||3600;return{async get(c){let e=await o.get(c);if(!e)return null;if(Date.now()>e.revalidateAfter)this.revalidate(c).catch(console.error);return{html:e.html,headers:{"Cache-Control":`public, max-age=${n}, stale-while-revalidate=${n*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(c){let l=M(".",{pagesDir:t.pagesDir||"pages"}).find((P)=>c.match(P.regex)!==null);if(!l){console.warn(`Route not found for revalidation: ${c}`);return}let w=c.match(l.regex),y={};if(w)l.params.forEach((P,D)=>{y[P]=w[D+1]});let h=await i(),{html:S}=await wt(l,y,{},t,h);await o.set(c,{html:S,generatedAt:Date.now(),revalidateAfter:Date.now()+n*1000,etag:At(S)}),console.log(`Revalidated: ${c}`)},async invalidate(c){if(typeof c==="string")await o.invalidate(c);else await o.invalidatePattern(c)}}}function Nt(t){return async()=>({paths:await t(),fallback:!1})}function zt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let s=await Bun.file(t).text(),o=s.match(/^---\n([\s\S]*?)\n---/),n={},c=s;if(o){let h=o[1];c=s.slice(o[0].length).trim();for(let S of h.split(`
|
|
85
|
+
`)){let P=S.indexOf(":");if(P>0){let D=S.slice(0,P).trim(),p=S.slice(P+1).trim();if(p==="true")p=!0;else if(p==="false")p=!1;else if(/^\d+$/.test(p))p=parseInt(p,10);else if(/^\d+\.\d+$/.test(p))p=parseFloat(p);else if(p.startsWith("[")&&p.endsWith("]"))p=p.slice(1,-1).split(",").map((b)=>b.trim().replace(/^['"]|['"]$/g,""));n[D]=p}}}let e=c.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),l=[],w=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,y;while((y=w.exec(e))!==null){let h=parseInt(y[1],10),S=y[2],P=S.toLowerCase().replace(/[^a-z0-9]+/g,"-");l.push({id:P,text:S,level:h})}return{content:e,data:n,toc:l}}}}function Ht(t){return Ne(t)}function Wt(t,s){return`<!DOCTYPE html>
|
|
86
86
|
<html>
|
|
87
87
|
<head>
|
|
88
88
|
<meta charset="utf-8">
|
|
@@ -94,4 +94,4 @@ Build complete!
|
|
|
94
94
|
<p>Redirecting to <a href="${t}">${t}</a>...</p>
|
|
95
95
|
<script>window.location.replace('${t}')</script>
|
|
96
96
|
</body>
|
|
97
|
-
</html>`}function
|
|
97
|
+
</html>`}function Jt(t,s){if(t==="/"||t==="")return g.join(s.outputDir,"index.html");let o=t.replace(/^\/|\/$/g,"");if(s.trailingSlash)return g.join(s.outputDir,o,"index.html");return g.join(s.outputDir,`${o}.html`)}var we={generateStaticSite:_t,createISRHandler:Gt,defineStaticPaths:Nt,createMarkdownLoader:zt};export{Gt as createISRHandler,zt as createMarkdownLoader,Ot as declaresPageAction,we as default,Nt as defineStaticPaths,_t as generateStaticSite,Lt as isExcludedFromSitemap};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/stx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.417",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -122,12 +122,12 @@
|
|
|
122
122
|
"dependencies": {
|
|
123
123
|
"@stacksjs/ts-css": "^0.3.2",
|
|
124
124
|
"@stacksjs/clapp": "^0.2.16",
|
|
125
|
-
"@stacksjs/desktop": "0.2.
|
|
126
|
-
"@stacksjs/sanitizer": "0.2.
|
|
125
|
+
"@stacksjs/desktop": "0.2.417",
|
|
126
|
+
"@stacksjs/sanitizer": "0.2.417",
|
|
127
127
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
128
|
-
"bun-plugin-stx": "0.2.
|
|
128
|
+
"bun-plugin-stx": "0.2.417",
|
|
129
129
|
"bunfig": "^0.15.19",
|
|
130
|
-
"stx-router": "0.2.
|
|
130
|
+
"stx-router": "0.2.417",
|
|
131
131
|
"ts-broadcasting": "^0.0.11",
|
|
132
132
|
"ts-images": "^0.2.22",
|
|
133
133
|
"ts-syntax-highlighter": "^0.2.1"
|
package/dist/chunk-020xyn9q.js
DELETED
package/dist/chunk-04jhmfbz.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{L,j,B,Lt,Z,oe,Tn,Yo,Ie,ut,jt,Bt,Ft,F,zt,Ht,_n}from"./chunk-eed4fwps.js";export{j as DEFAULT_FORMATS,B as DEFAULT_QUALITY,L as DEFAULT_WIDTHS,_n as ImageProcessingError,Ht as formatSize,ut as generateSizes,Ie as generateSrcSet,jt as getFallbackVariant,Tn as getImageMetadata,F as getMimeType,zt as getTotalSize,Bt as groupVariantsByFormat,Z as isImageBackendAvailable,Ft as isImageFile,Lt as isSharpAvailable,oe as processImage,Yo as resizeAndConvert};
|
package/dist/chunk-0pnj3zt2.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Nu,ve,Gi,Lu,cs,ls,us}from"./chunk-3efw27as.js";import"./chunk-752hw7cd.js";import"./chunk-shr559s7.js";import"./chunk-ak1cgcah.js";import"./chunk-9amp82bx.js";import"./chunk-b98be3yp.js";import"./chunk-ngc2wke4.js";import"./chunk-xfp7k0v8.js";import"./chunk-m4sk62wb.js";import"./chunk-z0g9jvv0.js";import"./chunk-8nhshfz6.js";import"./chunk-7gkv67ky.js";import"./chunk-ce1sejr3.js";import"./chunk-czxt605c.js";export{Lu as clearOnceStore,Gi as onceStore,ve as partialsCache,cs as processIncludes,ls as processStackPushDirectives,us as processStackReplacements,Nu as resetUnscopedSignalWarnings};
|
package/dist/chunk-1098mas0.js
DELETED
package/dist/chunk-18vmfkcc.js
DELETED
package/dist/chunk-1b6t12hd.js
DELETED
package/dist/chunk-1zs30k3y.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Mr,bl,vl}from"./chunk-g186znp9.js";import"./chunk-42wbs8vq.js";import"./chunk-hepd9qgx.js";import"./chunk-3efw27as.js";import"./chunk-752hw7cd.js";import"./chunk-shr559s7.js";import"./chunk-ak1cgcah.js";import"./chunk-9amp82bx.js";import"./chunk-b98be3yp.js";import"./chunk-ngc2wke4.js";import"./chunk-xfp7k0v8.js";import"./chunk-m4sk62wb.js";import"./chunk-z0g9jvv0.js";import"./chunk-8nhshfz6.js";import"./chunk-7gkv67ky.js";import"./chunk-ce1sejr3.js";import"./chunk-czxt605c.js";export{vl as clearComposableCache,bl as getComposableScript,Mr as listComposableModules};
|
package/dist/chunk-2ce7f416.js
DELETED
package/dist/chunk-393341w7.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Wo,Qs,Wc,qo,Xo,qc,Xc}from"./chunk-8eqrwj1k.js";import"./chunk-g186znp9.js";import"./chunk-42wbs8vq.js";import"./chunk-hepd9qgx.js";import{He,pc}from"./chunk-3efw27as.js";import"./chunk-752hw7cd.js";import"./chunk-shr559s7.js";import"./chunk-ak1cgcah.js";import"./chunk-9amp82bx.js";import"./chunk-b98be3yp.js";import"./chunk-ngc2wke4.js";import"./chunk-xfp7k0v8.js";import"./chunk-m4sk62wb.js";import"./chunk-z0g9jvv0.js";import"./chunk-8nhshfz6.js";import"./chunk-7gkv67ky.js";import"./chunk-ce1sejr3.js";import"./chunk-czxt605c.js";export{Wo as buildVirtualSource,He as extractScriptBlocks,pc as extractTemplateExpressions,qo as findRuntimeTypeDeclarations,Xo as findStxModuleDeclarations,Xc as formatTypecheckDiagnostics,Wc as sourcePathFor,qc as typecheckStxFiles,Qs as virtualPathFor};
|
package/dist/chunk-39g1134q.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Lo,Js,jo,Bo,Ys,Fo,zo,Ho,Vo,Zs,Uo,Uc}from"./chunk-y1cmjvk3.js";import{ei,Jo}from"./chunk-ej9j6k1q.js";import{L,j,B,Lt,Z,oe,Tn,Ie,ut,jt,Bt,Ft,F,zt,Ht,_n}from"./chunk-eed4fwps.js";import{Ta}from"./chunk-t4hzprsm.js";export{j as DEFAULT_FORMATS,B as DEFAULT_QUALITY,L as DEFAULT_WIDTHS,_n as ImageProcessingError,Bo as clearImageCache,Ys as createImageDirective,Jo as createImageHandler,zo as createImagePlugin,Uc as defaultImageConfig,Ht as formatSize,Zs as generateImageManifest,ut as generateSizes,Ie as generateSrcSet,jt as getFallbackVariant,Tn as getImageMetadata,F as getMimeType,zt as getTotalSize,Bt as groupVariantsByFormat,ei as handleImageRequest,Fo as imageDirective,Z as isImageBackendAvailable,Ft as isImageFile,Lt as isSharpAvailable,Vo as optimizeDirectory,Ho as optimizeImage,Js as parseImageComponent,oe as processImage,jo as processImageComponents,Lo as renderImageComponent,Ta as rewriteImagesWithSiblings,Uo as writeImageManifest};
|