@stacksjs/stx 0.2.682 → 0.2.684
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-z5av310q.js → chunk-12760frv.js} +1 -1
- package/dist/{chunk-7yree929.js → chunk-15tkxrfe.js} +1 -1
- package/dist/{chunk-96hkch4q.js → chunk-1q8cx10w.js} +1 -1
- package/dist/chunk-1yb1haw7.js +2 -0
- package/dist/{chunk-xfdfk4g4.js → chunk-273mr301.js} +1 -1
- package/dist/{chunk-8nk56cs2.js → chunk-2vm6pbj6.js} +1 -1
- package/dist/{chunk-42qtadka.js → chunk-2yphax0x.js} +2 -2
- package/dist/{chunk-n8jq9yjy.js → chunk-39g00f1z.js} +1 -1
- package/dist/{chunk-ev1tnd36.js → chunk-3ntkdmm9.js} +1 -1
- package/dist/{chunk-4z4sqc8q.js → chunk-54mq30ag.js} +1 -1
- package/dist/{chunk-remsyfdx.js → chunk-5h618jv3.js} +1 -1
- package/dist/{chunk-g83qeh2x.js → chunk-6q1cv39j.js} +3 -3
- package/dist/chunk-6rzbn1nb.js +2 -0
- package/dist/{chunk-3tkag58v.js → chunk-75ftntkm.js} +1 -1
- package/dist/{chunk-tdwqwxhf.js → chunk-7kzwpskb.js} +1 -1
- package/dist/{chunk-1t6dg4s8.js → chunk-8gbp2p7c.js} +1 -1
- package/dist/{chunk-b5vqp3b2.js → chunk-8t0fpc9h.js} +1 -1
- package/dist/{chunk-zr16mga0.js → chunk-910s13rr.js} +1 -1
- package/dist/{chunk-bv43s0gx.js → chunk-97zv3gpm.js} +1 -1
- package/dist/{chunk-0527ytat.js → chunk-98xp87m0.js} +1 -1
- package/dist/chunk-9md86rzc.js +2 -0
- package/dist/{chunk-4g9wrxkm.js → chunk-a20ytcth.js} +1 -1
- package/dist/chunk-aftam4we.js +2 -0
- package/dist/{chunk-np3zdjhr.js → chunk-btdxdmew.js} +1 -1
- package/dist/{chunk-qb806pks.js → chunk-cv10vetd.js} +1 -1
- package/dist/{chunk-e97xj3rf.js → chunk-dr1em45p.js} +4 -4
- package/dist/chunk-ehvjbag8.js +2 -0
- package/dist/{chunk-pmma4f1x.js → chunk-fv1k21jx.js} +1 -1
- package/dist/{chunk-5nrqc6v4.js → chunk-gwyx2pwf.js} +1 -1
- package/dist/{chunk-bmv6spcd.js → chunk-hk6w3zhm.js} +1 -1
- package/dist/{chunk-rs67af2x.js → chunk-jayacz7s.js} +5 -5
- package/dist/{chunk-18jfkg1q.js → chunk-jv7dk4dq.js} +1 -1
- package/dist/{chunk-hg7ys8rn.js → chunk-jwxr8rya.js} +1 -1
- package/dist/{chunk-brcj3953.js → chunk-mhjnz2rh.js} +1 -1
- package/dist/{chunk-se4n8tth.js → chunk-mhsshvg1.js} +1 -1
- package/dist/{chunk-h3bdqqzy.js → chunk-mwxz9kbh.js} +1 -1
- package/dist/{chunk-ka3xmbrd.js → chunk-n11mcrmk.js} +26 -26
- package/dist/{chunk-r8hszntk.js → chunk-nfkaeycg.js} +1 -1
- package/dist/{chunk-47fwr1z7.js → chunk-nvbkt6a3.js} +1 -1
- package/dist/chunk-p9228zqe.js +2 -0
- package/dist/{chunk-5nfb4gxk.js → chunk-p9jkv2y0.js} +6 -6
- package/dist/{chunk-yhfm939b.js → chunk-pkcd41b9.js} +1 -1
- package/dist/{chunk-g2v6c7kf.js → chunk-ps5v9vm3.js} +1 -1
- package/dist/{chunk-fqts9wvd.js → chunk-q28n3hyy.js} +2 -2
- package/dist/{chunk-wfg5379k.js → chunk-qv0zkqem.js} +2 -2
- package/dist/{chunk-hwaqwrc2.js → chunk-rwzmfx1g.js} +1 -1
- package/dist/{chunk-bmqker64.js → chunk-sa574ehw.js} +2 -2
- package/dist/{chunk-1gw26g89.js → chunk-sz9xjmx0.js} +2 -2
- package/dist/{chunk-s0wa7zjr.js → chunk-t9hx6cr0.js} +1 -1
- package/dist/{chunk-veh25cv5.js → chunk-vf8kma48.js} +1 -1
- package/dist/{chunk-f1hxrs7b.js → chunk-vfsapkh9.js} +1 -1
- package/dist/{chunk-4m5g3f2b.js → chunk-wyvcxjb8.js} +1 -1
- package/dist/{chunk-ypwetty7.js → chunk-x145xm5r.js} +2 -2
- package/dist/chunk-x8w54snc.js +2 -0
- package/dist/{chunk-rk8kmshp.js → chunk-xpqcr7yj.js} +1 -1
- package/dist/{chunk-5rdfcpfe.js → chunk-xy16pnty.js} +1 -1
- package/dist/chunk-yps3rpny.js +2 -0
- package/dist/chunk-ysra569w.js +2 -0
- package/dist/{chunk-65jb75vz.js → chunk-yxx4866s.js} +1 -1
- package/dist/chunk-zhe25pab.js +2 -0
- package/dist/chunk-zr2vnj6g.js +2 -0
- package/dist/{chunk-th45zgbz.js → chunk-zxqgr2n6.js} +4 -4
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/dev-server/serve-app.js +34 -10
- package/dist/dev-server/types.d.ts +2 -0
- package/dist/dev-server/types.js +2 -0
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-0gmwqhs0.js +0 -2
- package/dist/chunk-34ps2w1z.js +0 -2
- package/dist/chunk-9qx6ansy.js +0 -2
- package/dist/chunk-b375wt1n.js +0 -2
- package/dist/chunk-f80aqbwm.js +0 -2
- package/dist/chunk-fbbp8j97.js +0 -2
- package/dist/chunk-fy1waxy0.js +0 -2
- package/dist/chunk-g9a56wwk.js +0 -2
- package/dist/chunk-h5r4c9v5.js +0 -2
- package/dist/chunk-jecmxby7.js +0 -2
- package/dist/chunk-q7mpearc.js +0 -2
package/dist/craft.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Xs,Ji,Yi}from"./chunk-y55pcfaj.js";import"./chunk-w28wc7mv.js";import"./chunk-gtktv6nn.js";import"./chunk-6beg47t4.js";import"./chunk-
|
|
2
|
+
import{Xs,Ji,Yi}from"./chunk-y55pcfaj.js";import"./chunk-w28wc7mv.js";import"./chunk-gtktv6nn.js";import"./chunk-6beg47t4.js";import"./chunk-p9jkv2y0.js";import"./chunk-t6m5d64b.js";import"./chunk-5h618jv3.js";import"./chunk-tenbwcts.js";import"./chunk-gymmbbzc.js";import"./chunk-2yphax0x.js";import"./chunk-nbjyed3q.js";import"./chunk-912r15hr.js";import"./chunk-pkcd41b9.js";import"./chunk-sa574ehw.js";import"./chunk-jayacz7s.js";import"./chunk-mhjnz2rh.js";import"./chunk-zxqgr2n6.js";import"./chunk-x145xm5r.js";import"./chunk-7kzwpskb.js";import"./chunk-9bgb9n12.js";import"./chunk-03xn8244.js";import{ep,Hi,tp,np,Vi,Ks,Ui,rp,Wi,sp,op,qi,Gi,Ki,Xi}from"./chunk-vfsapkh9.js";import"./chunk-qv0zkqem.js";import"./chunk-2a1eeywj.js";import"./chunk-dr1em45p.js";import"./chunk-zt5hp5w5.js";import"./chunk-jwxr8rya.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
|
|
3
3
|
`),scripts:t.scripts.join(`
|
|
4
4
|
`),metadata:{renderTime:0,cacheHit:!0,totalSize:c.html.length,componentCount:t.metadata.componentCount}}}let a;if(n.streaming)a=await H(t.tree,e);else a=h(t.tree,e);let i;if(n.hydrate){let o=j(a,t,e);a=o.html,i=o.data}if(n.minify)a=D(a);if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`;d.set(o,{html:a,timestamp:Date.now()})}let s=performance.now()-r;return{html:a,styles:t.styles.join(`
|
|
5
5
|
`),scripts:t.scripts.join(`
|
|
@@ -320,24 +320,26 @@ export async function serveApp(appDir = ".", options = {}) {
|
|
|
320
320
|
return null;
|
|
321
321
|
}
|
|
322
322
|
}, BUILD_CONCURRENCY = 8, buildAllPages = async () => {
|
|
323
|
+
const activePages = new Set(builtPages.keys()), activePluginPages = new Set(builtPluginPages.keys());
|
|
323
324
|
builtPages.clear();
|
|
324
325
|
builtPluginPages.clear();
|
|
325
|
-
|
|
326
|
-
|
|
326
|
+
const selectedRoutes = options.prebuild === !1 ? routes.filter((route) => activePages.has(route.pattern)) : routes, selectedPlugins = options.prebuild === !1 ? pluginRoutes.filter(({ route }) => activePluginPages.has(route.pattern)) : pluginRoutes;
|
|
327
|
+
for (let i = 0;i < selectedRoutes.length; i += BUILD_CONCURRENCY) {
|
|
328
|
+
const chunk = selectedRoutes.slice(i, i + BUILD_CONCURRENCY), results = await Promise.all(chunk.map((route) => buildPage(route)));
|
|
327
329
|
for (const built of results)
|
|
328
330
|
if (built)
|
|
329
331
|
builtPages.set(built.route.pattern, built);
|
|
330
332
|
}
|
|
331
|
-
for (let i = 0;i <
|
|
332
|
-
const chunk =
|
|
333
|
+
for (let i = 0;i < selectedPlugins.length; i += BUILD_CONCURRENCY) {
|
|
334
|
+
const chunk = selectedPlugins.slice(i, i + BUILD_CONCURRENCY), results = await Promise.all(chunk.map(({ route }) => buildPage(route)));
|
|
333
335
|
for (const built of results)
|
|
334
336
|
if (built)
|
|
335
337
|
builtPluginPages.set(built.route.pattern, built);
|
|
336
338
|
}
|
|
337
339
|
return builtPages.size > 0;
|
|
338
340
|
};
|
|
339
|
-
console.log(`${colors.blue}Building pages
|
|
340
|
-
if (!await buildAllPages()) {
|
|
341
|
+
console.log(`${colors.blue}${options.prebuild === !1 ? "Rendering pages on request..." : "Building pages..."}${colors.reset}`);
|
|
342
|
+
if (!(options.prebuild === !1 ? routes.length + pluginRoutes.length > 0 : await buildAllPages())) {
|
|
341
343
|
console.error(`${colors.red}No pages were successfully built${colors.reset}`);
|
|
342
344
|
return !1;
|
|
343
345
|
}
|
|
@@ -367,6 +369,7 @@ export async function serveApp(appDir = ".", options = {}) {
|
|
|
367
369
|
console.log(`${colors.blue}Starting server...${colors.reset}`);
|
|
368
370
|
const server = serve({
|
|
369
371
|
port: actualPort,
|
|
372
|
+
hostname: options.hostname,
|
|
370
373
|
async fetch(request) {
|
|
371
374
|
const url = new URL(request.url), offline = options.stxOptions?.offline ?? projectConfig.offline;
|
|
372
375
|
if (url.pathname === OFFLINE_WORKER_PATH && offline?.enabled) {
|
|
@@ -430,10 +433,13 @@ export async function serveApp(appDir = ".", options = {}) {
|
|
|
430
433
|
if (routeMatch) {
|
|
431
434
|
let builtPage = builtPages.get(routeMatch.route.pattern);
|
|
432
435
|
const isStreamingRoute = streamingRoutes.has(routeMatch.route.pattern);
|
|
433
|
-
if (routeMatch.route.isDynamic && Object.keys(routeMatch.params).length > 0 || isStreamingRoute) {
|
|
436
|
+
if (!builtPage || routeMatch.route.isDynamic && Object.keys(routeMatch.params).length > 0 || isStreamingRoute) {
|
|
434
437
|
const rebuilt = await buildPage(routeMatch.route, routeMatch.params);
|
|
435
|
-
if (rebuilt)
|
|
438
|
+
if (rebuilt) {
|
|
436
439
|
builtPage = rebuilt;
|
|
440
|
+
if (!routeMatch.route.isDynamic && !isStreamingRoute)
|
|
441
|
+
builtPages.set(routeMatch.route.pattern, rebuilt);
|
|
442
|
+
}
|
|
437
443
|
}
|
|
438
444
|
if (builtPage) {
|
|
439
445
|
const responseStatus = builtPage.status ?? 200, pageHeaders = builtPage.headers ?? {}, pageMeta = (routeMatch.route.filePath ? extractPageMetaFromSource(await Bun.file(routeMatch.route.filePath).text().catch(() => "")) : null) ?? {};
|
|
@@ -546,7 +552,15 @@ export async function serveApp(appDir = ".", options = {}) {
|
|
|
546
552
|
if (pluginRoutes.length > 0) {
|
|
547
553
|
const allPluginPatterns = pluginRoutes.map((pr) => pr.route), pluginMatch = matchRoute(url.pathname, allPluginPatterns);
|
|
548
554
|
if (pluginMatch) {
|
|
549
|
-
|
|
555
|
+
let builtPage = builtPluginPages.get(pluginMatch.route.pattern);
|
|
556
|
+
if (!builtPage || pluginMatch.route.isDynamic) {
|
|
557
|
+
const rebuilt = await buildPage(pluginMatch.route, pluginMatch.params);
|
|
558
|
+
if (rebuilt) {
|
|
559
|
+
builtPage = rebuilt;
|
|
560
|
+
if (!pluginMatch.route.isDynamic)
|
|
561
|
+
builtPluginPages.set(pluginMatch.route.pattern, rebuilt);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
550
564
|
if (builtPage) {
|
|
551
565
|
let content = builtPage.content;
|
|
552
566
|
if (shell)
|
|
@@ -569,7 +583,17 @@ export async function serveApp(appDir = ".", options = {}) {
|
|
|
569
583
|
}
|
|
570
584
|
for (const { prefix: pluginPrefix } of pluginPageDirs)
|
|
571
585
|
if (pluginPrefix !== "/" && url.pathname.startsWith(pluginPrefix)) {
|
|
572
|
-
|
|
586
|
+
let pluginIndex = builtPluginPages.get(pluginPrefix) || builtPluginPages.get(pluginPrefix + "/");
|
|
587
|
+
if (!pluginIndex) {
|
|
588
|
+
const indexRoute = pluginRoutes.find(({ route }) => route.pattern === pluginPrefix || route.pattern === `${pluginPrefix}/`);
|
|
589
|
+
if (indexRoute) {
|
|
590
|
+
const rebuilt = await buildPage(indexRoute.route);
|
|
591
|
+
if (rebuilt) {
|
|
592
|
+
pluginIndex = rebuilt;
|
|
593
|
+
builtPluginPages.set(indexRoute.route.pattern, rebuilt);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}
|
|
573
597
|
if (pluginIndex) {
|
|
574
598
|
let content = pluginIndex.content;
|
|
575
599
|
if (shell)
|
package/dist/dev-server/types.js
CHANGED
package/dist/pwa.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{As,Bt,kc,vu}from"./chunk-6e60jp4a.js";import{Rs,ei,hu,yu,bu}from"./chunk-49c5v5fh.js";import{wc,xc,Sc,gu,mu}from"./chunk-sq4w1e1g.js";import{He,Sn,ti}from"./chunk-e26pxzjj.js";import{wu,xu,Su,ku,Ps,Yp}from"./chunk-vxrhvrr9.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-
|
|
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-x8w54snc.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">
|
package/dist/ssg.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-374nhgyf.js";import{y,sc}from"./chunk-w28wc7mv.js";import"./chunk-gtktv6nn.js";import"./chunk-6beg47t4.js";import{Et}from"./chunk-
|
|
2
|
+
import"./chunk-374nhgyf.js";import{y,sc}from"./chunk-w28wc7mv.js";import"./chunk-gtktv6nn.js";import"./chunk-6beg47t4.js";import{Et}from"./chunk-p9jkv2y0.js";import"./chunk-t6m5d64b.js";import"./chunk-5h618jv3.js";import"./chunk-tenbwcts.js";import{wt,xt,St,kt,_t,Ct}from"./chunk-gymmbbzc.js";import{i}from"./chunk-2yphax0x.js";import{ts}from"./chunk-nbjyed3q.js";import"./chunk-912r15hr.js";import"./chunk-cv10vetd.js";import{Ee,Xt,Jt}from"./chunk-gwyx2pwf.js";import"./chunk-pkcd41b9.js";import{h}from"./chunk-sa574ehw.js";import{gt,o}from"./chunk-jayacz7s.js";import"./chunk-mhjnz2rh.js";import"./chunk-zxqgr2n6.js";import"./chunk-x145xm5r.js";import"./chunk-7kzwpskb.js";import"./chunk-9bgb9n12.js";import{ea,ta,na}from"./chunk-rspe6qa5.js";import{Gt,Fn,zn}from"./chunk-bpf3xxng.js";import{Kt}from"./chunk-mwxz9kbh.js";import"./chunk-2a1eeywj.js";import{q,ye}from"./chunk-dr1em45p.js";import"./chunk-zt5hp5w5.js";import"./chunk-jwxr8rya.js";import{c}from"./chunk-xvs84gas.js";import{r,fe}from"./chunk-9tg4995v.js";import k from"fs";import p from"path";import{createHash as Pt}from"crypto";function $t(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var Dt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Rt(t){return Bun.hash(t).toString(16)}function at(t,n={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let a=new Map,s=t.replace(Dt,(e,u,f,x)=>{let m=x.trim();if(!m)return e;if(/\bdata-stx-src=/.test(f))return e;if(n.minify)m=$t(m);let b=Rt(m);if(!a.has(b))a.set(b,m);let v=n.integrity?` data-stx-integrity="sha384-${Pt("sha384").update(m).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${b}.js"${v}${f}></script>`}),l=Array.from(a,([e,u])=>({hash:e,code:u}));return{html:s,chunks:l}}var It=new Set(["visible","idle"]);function ot(t){if(!t.includes("data-stx-src="))return t;let n=new Map,a=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,s;while((s=a.exec(t))!==null)n.set(s[1],s[2]);let l=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=e.exec(t))!==null)if(It.has(n.get(u[1])||""))l.add(u[2]);let f=t.lastIndexOf("</head>");if(l.size===0||f===-1)return t;let x=Array.from(l).filter((m)=>!t.includes(`rel="prefetch" href="${m}"`)).map((m)=>`<link rel="prefetch" href="${m}" as="script">`).join("");if(!x)return t;return t.slice(0,f)+x+t.slice(f)}var Bt=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function K(t){let n=t.trim();if(!n)return null;let a=/^https?:\/\//i.test(n)?n:`https://${n}`;try{return new URL(a).origin+new URL(a).pathname.replace(/\/$/,"")}catch{return null}}function jt(t){for(let n of Bt){let a=t[n];if(!a)continue;let s=K(a);if(s)return{url:s,source:"env",via:n}}return null}function ct(t){if(!t||typeof t!=="object")return null;let n=t,a=n.site?.url??n.url??n.app?.url;return typeof a==="string"?K(a):null}async function Ft(t){let{existsSync:n}=await import("fs"),a=await import("path");for(let s of["site.config.ts","site.config.js",".config/site.config.ts"]){let l=a.resolve(t,s);if(!n(l))continue;try{let e=await import(l),u=ct(e.default??e);if(u)return u}catch{}}return null}async function lt(t={}){let n=t.cwd??process.cwd(),a=t.env??process.env;if(t.explicit){let u=K(t.explicit);if(u)return{url:u,source:"option"}}let s=ct(t.stxConfig);if(s)return{url:s,source:"stx.config",via:"site.url"};let l=await Ft(n);if(l)return{url:l,source:"site.config",via:"url"};let e=jt(a);if(e)return e;return{url:"http://localhost",source:"fallback"}}function ut(){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
3
|
`)}function W(t){return async()=>({paths:await t(),fallback:!1})}var Tt;function Ot(t){let n=r(t),{depths:a}=fe(n),s=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,l;while((l=s.exec(n))!==null){if(a[l.index]!==0)continue;let u=y(n,"(",")",s.lastIndex-1),f=n.indexOf("{",u+1),x=y(n,"{","}",f);if(u<0||f<0||x<0)break;return t.slice(l.index,x+1)}let e=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((l=e.exec(n))!==null){if(a[l.index]!==0)continue;let u=sc(n,e.lastIndex).endPos;return t.slice(e.lastIndex,u).trim()}throw SyntaxError("Could not extract getStaticPaths; use a top-level function or const declaration")}async function dt(t){let n="read";try{let a=await Bun.file(t).text();n="parse";let s=Kt(a),l=[...s.server,...s.client,...s.signals].filter((e)=>/(?:^|\s)server(?:\s|=|$)/i.test(r(e.attrs))).sort((e,u)=>a.indexOf(e.fullTag)-a.indexOf(u.fullTag));for(let e of l){if(!/\bgetStaticPaths\b/.test(r(e.content)))continue;let u=(Tt??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(e.content);if(!/\bgetStaticPaths\b/.test(r(u)))continue;let f=Ot(u);if(/\bdefineStaticPaths\b/.test(r(f))&&Et(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");n="execute";let x=Function("defineStaticPaths",`return (${f})`)(W);if(typeof x!=="function")throw TypeError("getStaticPaths must be a function");let m=await x();n="result";let b=Array.isArray(m)?{paths:m}:m;if(!b||typeof b!=="object"||!("paths"in b)||!Array.isArray(b.paths))throw TypeError("getStaticPaths must return { paths: [...] } or an array of paths");for(let v of b.paths)if(!v||typeof v!=="object"||!v.params||typeof v.params!=="object"||Array.isArray(v.params))throw TypeError("Each getStaticPaths path must contain a params object");return{kind:"ok",value:b}}return{kind:"absent"}}catch(a){return{kind:"error",phase:n,error:a instanceof Error?a:Error(String(a))}}}class pt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,n=""){this.cacheDir=t,this.salt=n}async load(){if(this.loaded)return;let t=p.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let n=JSON.parse(await Bun.file(t).text());for(let[a,s]of Object.entries(n))this.cache.set(a,s)}catch{}this.loaded=!0}async save(){await k.promises.mkdir(this.cacheDir,{recursive:!0});let t=p.join(this.cacheDir,"build-cache.json"),n={};for(let[a,s]of this.cache)n[a]=s;await Bun.write(t,JSON.stringify(n))}getHash(t,n){let a=k.statSync(t),s=`${this.salt}|${t}:${a.mtimeMs}`;for(let e of n)if(k.existsSync(e)){let u=k.statSync(e);s+=`:${e}:${u.mtimeMs}`}let l=0;for(let e=0;e<s.length;e++){let u=s.charCodeAt(e);l=(l<<5)-l+u,l=l&l}return Math.abs(l).toString(36)}get(t,n){let a=this.cache.get(t);if(!a)return null;let s=this.getHash(n,a.dependencies??[]);if(a.hash!==s)return this.cache.delete(t),null;return a.html}set(t,n,a,s){let l=this.getHash(n,a);this.cache.set(t,{hash:l,html:s,generatedAt:Date.now(),dependencies:a})}}class ht{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let n=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return p.join(this.cacheDir,"isr",n)}async get(t){let n=this.getFilePath(t);if(!await Bun.file(n).exists())return null;try{return JSON.parse(await Bun.file(n).text())}catch{return null}}async set(t,n){let a=this.getFilePath(t);await k.promises.mkdir(p.dirname(a),{recursive:!0}),await Bun.write(a,JSON.stringify(n))}async invalidate(t){let n=this.getFilePath(t);if(await Bun.file(n).exists())await k.promises.unlink(n)}async invalidatePattern(t){let n=p.join(this.cacheDir,"isr");if(!k.existsSync(n))return;let a=await k.promises.readdir(n);for(let s of a){let l=s.replace(/_/g,"/").replace(".json","");if(t.test(l))await k.promises.unlink(p.join(n,s))}}async needsRevalidation(t){let n=await this.get(t);if(!n)return!0;return Date.now()>n.revalidateAfter}}async function At(t){let n=[];if(!t.isDynamic)n.push({url:t.pattern,params:{}});else{let a=await dt(t.filePath);if(a.kind==="error")throw Error(`getStaticPaths ${a.phase} failed for ${t.pattern} (${t.filePath}): ${a.error.message}`,{cause:a.error});if(a.kind==="absent")return console.warn(`Warning: Dynamic route ${t.pattern} (${t.filePath}) has no getStaticPaths`),n;let s=a.value;if(s.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${t.pattern} (${t.filePath})`),n;for(let l of s.paths){let e=t.pattern;for(let[u,f]of Object.entries(l.params))e=e.replace(`:${u}`,f).replace(`:${u}*`,f);n.push({url:e,params:l.params,props:l.props,revalidate:l.revalidate})}}return n}async function Lt(t){let n=[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"];for(let a of n)if(await Bun.file(a).exists())try{let s=await import(a);if(typeof s.default==="function")return await s.default();else if(typeof s.default==="object")return s.default;else if(typeof s.getData==="function")return await s.getData();else{let{default:l,...e}=s;return e}}catch(s){console.error(`Error loading data file ${a}:`,s)}return null}async function Ut(t,n,a){let s=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!s)return null;let l=s[1];if(!l.includes("getStaticProps"))return null;try{let e=l.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!e)return null;return await Function("params",`
|
|
4
4
|
return (async function getStaticProps() {
|
|
5
5
|
${e[1]}
|
|
@@ -37,7 +37,7 @@ ${t.map((s)=>{let l=new URL(s.loc,n).href,e=` <url>
|
|
|
37
37
|
${a.join(`
|
|
38
38
|
`)}
|
|
39
39
|
</channel>
|
|
40
|
-
</rss>`}async function Vt(t={}){let n=Date.now();Jt();let a=await i(process.cwd()),s=a.build||{},l=await lt({explicit:t.domain||s.domain,stxConfig:a});if(l.source==="fallback"&&(t.sitemap??s.sitemap??!0))console.warn(ut());let e={router:t.router??a?.router??{},pagesDir:t.pagesDir||s.pagesDir||"pages",outputDir:t.outputDir||s.outputDir||"dist",baseUrl:t.baseUrl||s.baseUrl||"/",domain:l.url,revalidate:t.revalidate??s.revalidate??!1,sitemap:t.sitemap??s.sitemap??!0,sitemapExclude:t.sitemapExclude||s.sitemapExclude||[],robots:t.robots??s.robots??!0,rss:t.rss??s.rss??!1,concurrency:t.concurrency||s.concurrency||10,cache:t.cache??s.cache??!0,cacheDir:t.cacheDir||s.cacheDir||c(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??s.minify??!0,generate404:t.generate404??s.generate404??!0,publicDir:t.publicDir||s.publicDir||"public",trailingSlash:t.trailingSlash??s.trailingSlash??!1,cleanOutput:t.cleanOutput??s.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||a?.partialsDir||"",componentsDir:t.componentsDir||a?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},u={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},f=new Set,x=0,m={},b={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&k.existsSync(e.outputDir))await k.promises.rm(e.outputDir,{recursive:!0});await k.promises.mkdir(e.outputDir,{recursive:!0});let R=e.cacheSalt;if(!R){let{resolveUserCssConfig:d,fingerprintConfig:w}=await import("./chunk-
|
|
40
|
+
</rss>`}async function Vt(t={}){let n=Date.now();Jt();let a=await i(process.cwd()),s=a.build||{},l=await lt({explicit:t.domain||s.domain,stxConfig:a});if(l.source==="fallback"&&(t.sitemap??s.sitemap??!0))console.warn(ut());let e={router:t.router??a?.router??{},pagesDir:t.pagesDir||s.pagesDir||"pages",outputDir:t.outputDir||s.outputDir||"dist",baseUrl:t.baseUrl||s.baseUrl||"/",domain:l.url,revalidate:t.revalidate??s.revalidate??!1,sitemap:t.sitemap??s.sitemap??!0,sitemapExclude:t.sitemapExclude||s.sitemapExclude||[],robots:t.robots??s.robots??!0,rss:t.rss??s.rss??!1,concurrency:t.concurrency||s.concurrency||10,cache:t.cache??s.cache??!0,cacheDir:t.cacheDir||s.cacheDir||c(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??s.minify??!0,generate404:t.generate404??s.generate404??!0,publicDir:t.publicDir||s.publicDir||"public",trailingSlash:t.trailingSlash??s.trailingSlash??!1,cleanOutput:t.cleanOutput??s.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||a?.partialsDir||"",componentsDir:t.componentsDir||a?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},u={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},f=new Set,x=0,m={},b={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&k.existsSync(e.outputDir))await k.promises.rm(e.outputDir,{recursive:!0});await k.promises.mkdir(e.outputDir,{recursive:!0});let R=e.cacheSalt;if(!R){let{resolveUserCssConfig:d,fingerprintConfig:w}=await import("./chunk-nfkaeycg.js");try{R=w(await d(process.cwd()))}catch{}}let{prepareImageDelivery:S}=await import("./chunk-ps5v9vm3.js"),D=await S(e.publicDir,e.outputDir);if(D.count>0)console.log(`Optimized ${D.count} image(s) for responsive delivery`),R=[R,D.fingerprint].filter(Boolean).join(":");let F=new pt(e.cacheDir,R);if(e.cache)await F.load();try{let{generateCss:d}=await import("./chunk-nfkaeycg.js");await d('<div class="bg-black"></div>')}catch{}wt();let mt=a?.routeMiddleware?.dir||"middleware";await St(process.cwd(),mt);let J=xt();if(J.length>0)console.log(`Loaded ${J.length} middleware: ${J.join(", ")}`);let yt=a?.routeMiddleware?.global||[];na(a?.layoutsDir,c(process.cwd()));let Y=q(".",{pagesDir:e.pagesDir,pagesDirs:a?._layerPageDirs});console.log(`Found ${Y.length} routes`);let U=[];for(let d of Y)try{let w=await At(d);for(let P of w)U.push({route:d,url:P.url,params:P.params,props:P.props,revalidate:P.revalidate??e.revalidate})}catch(w){let P=w instanceof Error?w:Error(String(w));u.failedCount++,u.errors.push({route:d.pattern,error:P}),await e.hooks.onError?.(P,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,P)}u.totalPages=U.length+u.failedCount,console.log(`Generating ${U.length} pages...`);let M=[],Z=[];for(let d=0;d<U.length;d+=e.concurrency)Z.push(U.slice(d,d+e.concurrency));for(let d of Z)await Promise.all(d.map(async(w)=>{let{route:P,url:g,params:_,props:bt,revalidate:et}=w;try{await e.hooks.onPageStart?.(g);let T=await Bun.file(P.filePath).text(),O=Qt(T),vt=O?.middleware?Array.isArray(O.middleware)?O.middleware:[O.middleware]:[],rt=[...yt,...vt];if(rt.length>0){let I=kt(g,_,O||{}),A=_t(I,null,void 0,{isServer:!0}),B=await Ct(rt,A);if(B.redirect){let E=typeof B.redirect==="string"?B.redirect:B.redirect.path||B.redirect,N=te(String(E),g),L=ee(g,e);await k.promises.mkdir(p.dirname(L),{recursive:!0}),await Bun.write(L,N),u.successCount++,u.pages.push({route:g,outputPath:L,size:Buffer.byteLength(N),cached:!1}),M.push({loc:g,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${g} \u2192 redirect to ${E}`);return}if(B.abort){let E=typeof B.abort==="string"?B.abort:B.abort?.error?.message||"aborted";console.warn(` \u21B3 ${g} \u2014 middleware aborted: ${E}`);return}}let nt=T.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(nt)try{if(!await Function("route",`
|
|
41
41
|
const validate = ${nt[1]};
|
|
42
42
|
return validate(route);
|
|
43
43
|
`)({params:_})){console.warn(`Validation failed for ${g}, skipping...`);return}}catch{}let C=null,it=!1;if(e.cache){if(C=F.get(g,P.filePath),C)it=!0,u.cachedCount++}if(!C){let I=await ft(P,_,bt,e,a);if(C=I.html,e.failOnIncludeError&&I.includeFailures.length>0)throw Error(`${I.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
|
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.684",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -128,12 +128,12 @@
|
|
|
128
128
|
"dependencies": {
|
|
129
129
|
"@stacksjs/ts-css": "^0.3.11",
|
|
130
130
|
"@stacksjs/clapp": "^0.2.16",
|
|
131
|
-
"@stacksjs/desktop": "0.2.
|
|
132
|
-
"@stacksjs/sanitizer": "0.2.
|
|
131
|
+
"@stacksjs/desktop": "0.2.684",
|
|
132
|
+
"@stacksjs/sanitizer": "0.2.684",
|
|
133
133
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
134
|
-
"bun-plugin-stx": "0.2.
|
|
134
|
+
"bun-plugin-stx": "0.2.684",
|
|
135
135
|
"bunfig": "^0.15.21",
|
|
136
|
-
"stx-router": "0.2.
|
|
136
|
+
"stx-router": "0.2.684",
|
|
137
137
|
"ts-broadcasting": "^0.0.11",
|
|
138
138
|
"ts-images": "^0.2.22",
|
|
139
139
|
"ts-syntax-highlighter": "^0.2.1"
|
package/dist/chunk-0gmwqhs0.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Iu}from"./chunk-4z4sqc8q.js";import"./chunk-rs67af2x.js";import"./chunk-bmqker64.js";import"./chunk-9bgb9n12.js";import"./chunk-tdwqwxhf.js";import"./chunk-th45zgbz.js";import"./chunk-brcj3953.js";import"./chunk-2a1eeywj.js";import"./chunk-ypwetty7.js";import"./chunk-e97xj3rf.js";import"./chunk-zt5hp5w5.js";import"./chunk-yhfm939b.js";import"./chunk-42qtadka.js";import"./chunk-hg7ys8rn.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-nbjyed3q.js";import"./chunk-gymmbbzc.js";import"./chunk-5nfb4gxk.js";import"./chunk-remsyfdx.js";import"./chunk-t6m5d64b.js";import"./chunk-w28wc7mv.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{Iu as startInteractive};
|
package/dist/chunk-34ps2w1z.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{qi,Gi,Ki,Xi,ip}from"./chunk-f1hxrs7b.js";import"./chunk-wfg5379k.js";import"./chunk-03xn8244.js";import"./chunk-rs67af2x.js";import"./chunk-bmqker64.js";import"./chunk-9bgb9n12.js";import"./chunk-tdwqwxhf.js";import"./chunk-th45zgbz.js";import"./chunk-brcj3953.js";import"./chunk-2a1eeywj.js";import"./chunk-ypwetty7.js";import"./chunk-e97xj3rf.js";import"./chunk-zt5hp5w5.js";import"./chunk-yhfm939b.js";import"./chunk-42qtadka.js";import"./chunk-hg7ys8rn.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-nbjyed3q.js";import"./chunk-gymmbbzc.js";import"./chunk-5nfb4gxk.js";import"./chunk-remsyfdx.js";import"./chunk-t6m5d64b.js";import"./chunk-w28wc7mv.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{qi as buildNative,ip as default,Gi as findCraftBinary,Xi as getAvailableFormats,Ki as getAvailableTargets};
|
package/dist/chunk-9qx6ansy.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{cd,zi,dl,ld,ud,dd,pd,fd,pl,fl,gd,md,hd,yd}from"./chunk-np3zdjhr.js";import"./chunk-rs67af2x.js";import"./chunk-bmqker64.js";import"./chunk-9bgb9n12.js";import"./chunk-tdwqwxhf.js";import"./chunk-th45zgbz.js";import"./chunk-brcj3953.js";import"./chunk-2a1eeywj.js";import"./chunk-ypwetty7.js";import"./chunk-e97xj3rf.js";import"./chunk-zt5hp5w5.js";import"./chunk-yhfm939b.js";import"./chunk-42qtadka.js";import"./chunk-hg7ys8rn.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-nbjyed3q.js";import"./chunk-gymmbbzc.js";import"./chunk-5nfb4gxk.js";import"./chunk-remsyfdx.js";import"./chunk-t6m5d64b.js";import"./chunk-w28wc7mv.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{dl as SUSPENSE_RESOLVER_RUNTIME,zi as buildSuspenseResolveScript,fd as createStreamRenderer,dd as extractStreamBoundaries,yd as generateHydrationRuntime,fl as islandDirective,md as processSectionDirectives,ud as processStreamDirectives,gd as registerStreamingDirectives,ld as renderStreamingPage,cd as streamTemplate,pd as streamTemplateSimple,hd as streamToResponse,pl as streamingSuspenseDirective};
|
package/dist/chunk-b375wt1n.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ud,Wd}from"./chunk-pmma4f1x.js";import"./chunk-5nrqc6v4.js";import"./chunk-qb806pks.js";import"./chunk-374nhgyf.js";import"./chunk-ypwetty7.js";import"./chunk-e97xj3rf.js";import"./chunk-zt5hp5w5.js";import"./chunk-42qtadka.js";import"./chunk-hg7ys8rn.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-nbjyed3q.js";import"./chunk-gymmbbzc.js";import"./chunk-5nfb4gxk.js";import"./chunk-remsyfdx.js";import"./chunk-t6m5d64b.js";import"./chunk-w28wc7mv.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{Wd as clearStoreCache,Ud as getStoreScript};
|
package/dist/chunk-f80aqbwm.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{zu}from"./chunk-0527ytat.js";import"./chunk-1gw26g89.js";import"./chunk-w1wzydvp.js";import"./chunk-h3bdqqzy.js";import"./chunk-qb806pks.js";import"./chunk-rs67af2x.js";import"./chunk-bmqker64.js";import"./chunk-9bgb9n12.js";import"./chunk-tdwqwxhf.js";import"./chunk-th45zgbz.js";import"./chunk-brcj3953.js";import"./chunk-2a1eeywj.js";import"./chunk-ypwetty7.js";import"./chunk-e97xj3rf.js";import"./chunk-zt5hp5w5.js";import"./chunk-yhfm939b.js";import"./chunk-42qtadka.js";import"./chunk-hg7ys8rn.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-nbjyed3q.js";import"./chunk-gymmbbzc.js";import"./chunk-5nfb4gxk.js";import"./chunk-remsyfdx.js";import"./chunk-t6m5d64b.js";import"./chunk-w28wc7mv.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{zu as buildForProduction};
|
package/dist/chunk-fbbp8j97.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ec,Tc}from"./chunk-ka3xmbrd.js";import"./chunk-4z4sqc8q.js";import"./chunk-se4n8tth.js";import"./chunk-xr9a0hcr.js";import"./chunk-km37yrk4.js";import"./chunk-n8jq9yjy.js";import"./chunk-58dv14c3.js";import"./chunk-0527ytat.js";import"./chunk-1gw26g89.js";import"./chunk-1y50gat7.js";import"./chunk-xvnrm5c3.js";import"./chunk-xfdfk4g4.js";import"./chunk-f4z9w4kc.js";import"./chunk-65jb75vz.js";import"./chunk-brftzqzj.js";import"./chunk-hm69jxmh.js";import"./chunk-3zbege39.js";import"./chunk-hwaqwrc2.js";import"./chunk-pzxy40a2.js";import"./chunk-np3zdjhr.js";import"./chunk-qh7fvr2z.js";import"./chunk-ae12wgc5.js";import"./chunk-d7js6v1m.js";import"./chunk-ry501z40.js";import"./chunk-974prn41.js";import"./chunk-d1ssvg9k.js";import"./chunk-pmma4f1x.js";import"./chunk-z5av310q.js";import"./chunk-w1wzydvp.js";import"./chunk-wfg5379k.js";import"./chunk-03xn8244.js";import"./chunk-rspe6qa5.js";import{Kt}from"./chunk-h3bdqqzy.js";import"./chunk-5nrqc6v4.js";import"./chunk-qb806pks.js";import"./chunk-374nhgyf.js";import{$e,o}from"./chunk-rs67af2x.js";import"./chunk-bmqker64.js";import"./chunk-9bgb9n12.js";import"./chunk-tdwqwxhf.js";import"./chunk-th45zgbz.js";import"./chunk-brcj3953.js";import"./chunk-2a1eeywj.js";import"./chunk-ypwetty7.js";import{ye}from"./chunk-e97xj3rf.js";import"./chunk-zt5hp5w5.js";import{Zn,Qn}from"./chunk-yhfm939b.js";import{Jr,N,i}from"./chunk-42qtadka.js";import"./chunk-hg7ys8rn.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-nbjyed3q.js";import"./chunk-gymmbbzc.js";import{g,De}from"./chunk-5nfb4gxk.js";import"./chunk-remsyfdx.js";import"./chunk-t6m5d64b.js";import"./chunk-w28wc7mv.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";import"./chunk-b7z6rqfg.js";import"./chunk-drabexxq.js";export{Jr as buildWebComponents,Qn as cacheTemplate,Zn as checkCache,Kt as classifyAllScripts,Ec as createMiddleware,Tc as createRoute,N as defaultConfig,g as extractVariables,ye as injectRouterScript,i as loadStxConfig,De as processClientScript,o as processDirectives,$e as readMarkdownFile};
|
package/dist/chunk-fy1waxy0.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ws,qd,Gd}from"./chunk-z5av310q.js";import"./chunk-5nrqc6v4.js";import"./chunk-qb806pks.js";import"./chunk-374nhgyf.js";import"./chunk-ypwetty7.js";import"./chunk-e97xj3rf.js";import"./chunk-zt5hp5w5.js";import"./chunk-42qtadka.js";import"./chunk-hg7ys8rn.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-nbjyed3q.js";import"./chunk-gymmbbzc.js";import"./chunk-5nfb4gxk.js";import"./chunk-remsyfdx.js";import"./chunk-t6m5d64b.js";import"./chunk-w28wc7mv.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{Gd as clearComposableCache,qd as getComposableScript,Ws as listComposableModules};
|
package/dist/chunk-g9a56wwk.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Mc,$i,Lu,Lc,jc,ju,Bu}from"./chunk-n8jq9yjy.js";import"./chunk-z5av310q.js";import"./chunk-5nrqc6v4.js";import"./chunk-qb806pks.js";import"./chunk-374nhgyf.js";import"./chunk-ypwetty7.js";import"./chunk-e97xj3rf.js";import"./chunk-zt5hp5w5.js";import"./chunk-42qtadka.js";import"./chunk-hg7ys8rn.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-nbjyed3q.js";import"./chunk-gymmbbzc.js";import{Rt,Wl}from"./chunk-5nfb4gxk.js";import"./chunk-remsyfdx.js";import"./chunk-t6m5d64b.js";import"./chunk-w28wc7mv.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{Mc as buildVirtualSource,Rt as extractScriptBlocks,Wl as extractTemplateExpressions,Lc as findRuntimeTypeDeclarations,jc as findStxModuleDeclarations,Bu as formatTypecheckDiagnostics,Lu as sourcePathFor,ju as typecheckStxFiles,$i as virtualPathFor};
|
package/dist/chunk-h5r4c9v5.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ou}from"./chunk-se4n8tth.js";import"./chunk-1gw26g89.js";import"./chunk-h3bdqqzy.js";import"./chunk-qb806pks.js";import"./chunk-e97xj3rf.js";import"./chunk-42qtadka.js";import"./chunk-hg7ys8rn.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-nbjyed3q.js";import"./chunk-gymmbbzc.js";import"./chunk-5nfb4gxk.js";import"./chunk-remsyfdx.js";import"./chunk-t6m5d64b.js";import"./chunk-w28wc7mv.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{Ou as startProductionServer};
|
package/dist/chunk-jecmxby7.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Un,o}from"./chunk-rs67af2x.js";import"./chunk-bmqker64.js";import"./chunk-9bgb9n12.js";import"./chunk-tdwqwxhf.js";import"./chunk-th45zgbz.js";import"./chunk-brcj3953.js";import"./chunk-2a1eeywj.js";import"./chunk-ypwetty7.js";import{ye}from"./chunk-e97xj3rf.js";import"./chunk-zt5hp5w5.js";import"./chunk-yhfm939b.js";import"./chunk-42qtadka.js";import"./chunk-hg7ys8rn.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-nbjyed3q.js";import"./chunk-gymmbbzc.js";import{Pe,ys,bs}from"./chunk-5nfb4gxk.js";import"./chunk-remsyfdx.js";import"./chunk-t6m5d64b.js";import"./chunk-w28wc7mv.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{Un as buildModulesTag,ye as injectRouterScript,o as processDirectives,ys as processJsonDirective,bs as processOnceDirective,Pe as validateClientScript};
|
package/dist/chunk-q7mpearc.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{jr,Kn,El}from"./chunk-tdwqwxhf.js";import"./chunk-2a1eeywj.js";import"./chunk-ypwetty7.js";import"./chunk-e97xj3rf.js";import"./chunk-zt5hp5w5.js";import"./chunk-42qtadka.js";import"./chunk-hg7ys8rn.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-nbjyed3q.js";import"./chunk-gymmbbzc.js";import{$t}from"./chunk-5nfb4gxk.js";import"./chunk-remsyfdx.js";import"./chunk-t6m5d64b.js";import"./chunk-w28wc7mv.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{El as declareBareLoopHead,$t as parseLoopBinding,Kn as processLoops,jr as reportDeferredLoopWarnings};
|