@stacksjs/stx 0.2.306 → 0.2.308
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build-id.d.ts +2 -1
- package/dist/build-id.js +10 -5
- package/dist/{chunk-ewcxfn7m.js → chunk-02pw67wj.js} +1 -1
- package/dist/{chunk-s3951qwp.js → chunk-0v82gpcf.js} +1 -1
- package/dist/{chunk-1bmtk8s5.js → chunk-1xxnz74a.js} +1 -1
- package/dist/{chunk-fh97a60e.js → chunk-2q8twm6z.js} +1 -1
- package/dist/{chunk-9j1jfhrf.js → chunk-4daek4gx.js} +1 -1
- package/dist/chunk-64ttktzc.js +4 -0
- package/dist/{chunk-bxqzqwv5.js → chunk-7gxyfrbe.js} +1 -1
- package/dist/{chunk-ffexgxm3.js → chunk-8bx26xm5.js} +1 -1
- package/dist/{chunk-1zcm299e.js → chunk-8e0162e8.js} +1 -1
- package/dist/{chunk-aftse9mb.js → chunk-8y9ntpkc.js} +1 -1
- package/dist/{chunk-3qfz82gw.js → chunk-9btvp75h.js} +1 -1
- package/dist/{chunk-kz149fx5.js → chunk-9xxvkztn.js} +1 -1
- package/dist/{chunk-9ypp0a8t.js → chunk-afhr1tgn.js} +1 -1
- package/dist/{chunk-rtaa4ys9.js → chunk-ajhrz96a.js} +1 -1
- package/dist/{chunk-hy1ma54e.js → chunk-avs05pex.js} +1 -1
- package/dist/{chunk-5598ankf.js → chunk-b12xaxfk.js} +1 -1
- package/dist/{chunk-kgtbm5rp.js → chunk-b7s3pmt6.js} +1 -1
- package/dist/{chunk-smtve243.js → chunk-bvn1t6eh.js} +1 -1
- package/dist/{chunk-kdkv0j67.js → chunk-cr31895g.js} +1 -1
- package/dist/{chunk-5yhb5fad.js → chunk-d0ghhht8.js} +1 -1
- package/dist/{chunk-mhety3pf.js → chunk-dsg440z1.js} +1 -1
- package/dist/{chunk-f3k3kk5x.js → chunk-eyahxt4h.js} +1 -1
- package/dist/chunk-f501ws37.js +2 -0
- package/dist/{chunk-7sn5rbrd.js → chunk-gvqvdcn2.js} +1 -1
- package/dist/{chunk-z8yh03mr.js → chunk-h1mazmh8.js} +1 -1
- package/dist/chunk-h6fvyzc9.js +2 -0
- package/dist/{chunk-ejjzrtym.js → chunk-h9h3d1sv.js} +8 -8
- package/dist/{chunk-8n2cafmh.js → chunk-hvgqg4zh.js} +1 -1
- package/dist/{chunk-g812bscg.js → chunk-jq1vxvd0.js} +1 -1
- package/dist/{chunk-7q81jygp.js → chunk-ks2ns2gb.js} +1 -1
- package/dist/{chunk-hq3w5crk.js → chunk-m4he3pe2.js} +1 -1
- package/dist/{chunk-qhnyrwz2.js → chunk-m6e7fqtc.js} +104 -100
- package/dist/{chunk-9eat8v8r.js → chunk-mqt4re9d.js} +1 -1
- package/dist/{chunk-ttkt7xhd.js → chunk-n2ywp0qz.js} +2 -2
- package/dist/{chunk-9b9znn2f.js → chunk-n8jptckf.js} +2 -2
- package/dist/{chunk-e5yebhrk.js → chunk-q9c7pamq.js} +2 -2
- package/dist/{chunk-fzwqh8sy.js → chunk-qq3kq2rw.js} +1 -1
- package/dist/{chunk-7amgwmrw.js → chunk-qx3bmd0r.js} +1 -1
- package/dist/{chunk-74sgwgyt.js → chunk-r3651h5m.js} +1 -1
- package/dist/{chunk-4mtc9vyb.js → chunk-rmwj3pxz.js} +1 -1
- package/dist/{chunk-v7b5ny0x.js → chunk-rpbrhw5f.js} +1 -1
- package/dist/chunk-st4egabz.js +2 -0
- package/dist/{chunk-3qc0h6bj.js → chunk-sta0thbr.js} +1 -1
- package/dist/{chunk-bs18cyh6.js → chunk-szr2bvz6.js} +1 -1
- package/dist/{chunk-ps7nfwq5.js → chunk-tn93hzqz.js} +1 -1
- package/dist/{chunk-79nj87t6.js → chunk-trgzmk7z.js} +1 -1
- package/dist/{chunk-4yky0frv.js → chunk-w0fg9eps.js} +1 -1
- package/dist/{chunk-4k0h6sca.js → chunk-wv0q8dez.js} +1 -1
- package/dist/{chunk-2mx57479.js → chunk-y2rg5pz5.js} +1 -1
- package/dist/{chunk-w764f6g4.js → chunk-yzpkv9kx.js} +1 -1
- package/dist/chunk-z0xrk0gr.js +2 -0
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/head.d.ts +12 -0
- package/dist/head.js +21 -2
- package/dist/pwa.js +1 -1
- package/dist/seo.js +22 -0
- package/dist/ssg.js +2 -2
- package/dist/types/config-types.d.ts +20 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +5 -5
- package/dist/chunk-gt40xkj3.js +0 -2
- package/dist/chunk-nvb9nsqv.js +0 -2
- package/dist/chunk-szdwkfzq.js +0 -2
- package/dist/chunk-w1dxgs78.js +0 -4
- package/dist/chunk-xfdckfqr.js +0 -2
package/dist/craft-entry.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ek as Nj,fk as wj,gk as Aj}from"./chunk-pcvayb2f.js";import{ik as Uj,jk as Xj,kk as Yj,lk as Zj,mk as _j,nk as $j,ok as qj,pk as Fj,qk as Oj,rk as Vj,sk as Ij,tk as Qj,uk as Wj,vk as Kj}from"./chunk-
|
|
2
|
+
import{ek as Nj,fk as wj,gk as Aj}from"./chunk-pcvayb2f.js";import{ik as Uj,jk as Xj,kk as Yj,lk as Zj,mk as _j,nk as $j,ok as qj,pk as Fj,qk as Oj,rk as Vj,sk as Ij,tk as Qj,uk as Wj,vk as Kj}from"./chunk-1xxnz74a.js";import"./chunk-n2ywp0qz.js";import"./chunk-m6e7fqtc.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-02pw67wj.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-yzpkv9kx.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-r7qap4bh.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";var I=new Map,Q=new Map;function L(j,B){let G=B?.id||g(j),J=h(j),U=I.get(G);if(U&&U.hash===J)return U;let X=S(j),Z=y(j),Y=T(j),_=v(X),{staticParts:q,dynamicParts:$}=C(X),F=u(j),O={id:G,hash:J,tree:X,scripts:Z,styles:Y,staticParts:q,dynamicParts:$,dependencies:F,metadata:_};return I.set(G,O),O}async function r(j,B={},G={}){let J=performance.now();if(G.cache){let Y=`${j.id}:${JSON.stringify(B)}`,_=Q.get(Y);if(_&&Date.now()-_.timestamp<(G.cacheTTL||60000))return{html:_.html,styles:j.styles.join(`
|
|
3
3
|
`),scripts:j.scripts.join(`
|
|
4
4
|
`),metadata:{renderTime:0,cacheHit:!0,totalSize:_.html.length,componentCount:j.metadata.componentCount}}}let U;if(G.streaming)U=await H(j.tree,B);else U=W(j.tree,B);let X;if(G.hydrate){let Y=k(U,j,B);U=Y.html,X=Y.data}if(G.minify)U=x(U);if(G.cache){let Y=`${j.id}:${JSON.stringify(B)}`;Q.set(Y,{html:U,timestamp:Date.now()})}let Z=performance.now()-J;return{html:U,styles:j.styles.join(`
|
|
5
5
|
`),scripts:j.scripts.join(`
|
package/dist/craft.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ek as Nj,fk as wj,gk as Aj}from"./chunk-pcvayb2f.js";import{ik as Uj,jk as Xj,kk as Yj,lk as Zj,mk as _j,nk as $j,ok as qj,pk as Fj,qk as Oj,rk as Vj,sk as Ij,tk as Qj,uk as Wj,vk as Kj}from"./chunk-
|
|
2
|
+
import{ek as Nj,fk as wj,gk as Aj}from"./chunk-pcvayb2f.js";import{ik as Uj,jk as Xj,kk as Yj,lk as Zj,mk as _j,nk as $j,ok as qj,pk as Fj,qk as Oj,rk as Vj,sk as Ij,tk as Qj,uk as Wj,vk as Kj}from"./chunk-1xxnz74a.js";import"./chunk-n2ywp0qz.js";import"./chunk-m6e7fqtc.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-02pw67wj.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-yzpkv9kx.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-r7qap4bh.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";var I=new Map,Q=new Map;function L(j,B){let G=B?.id||g(j),J=h(j),U=I.get(G);if(U&&U.hash===J)return U;let X=S(j),Z=y(j),Y=T(j),_=v(X),{staticParts:q,dynamicParts:$}=C(X),F=u(j),O={id:G,hash:J,tree:X,scripts:Z,styles:Y,staticParts:q,dynamicParts:$,dependencies:F,metadata:_};return I.set(G,O),O}async function r(j,B={},G={}){let J=performance.now();if(G.cache){let Y=`${j.id}:${JSON.stringify(B)}`,_=Q.get(Y);if(_&&Date.now()-_.timestamp<(G.cacheTTL||60000))return{html:_.html,styles:j.styles.join(`
|
|
3
3
|
`),scripts:j.scripts.join(`
|
|
4
4
|
`),metadata:{renderTime:0,cacheHit:!0,totalSize:_.html.length,componentCount:j.metadata.componentCount}}}let U;if(G.streaming)U=await H(j.tree,B);else U=W(j.tree,B);let X;if(G.hydrate){let Y=k(U,j,B);U=Y.html,X=Y.data}if(G.minify)U=x(U);if(G.cache){let Y=`${j.id}:${JSON.stringify(B)}`;Q.set(Y,{html:U,timestamp:Date.now()})}let Z=performance.now()-J;return{html:U,styles:j.styles.join(`
|
|
5
5
|
`),scripts:j.scripts.join(`
|
package/dist/head.d.ts
CHANGED
|
@@ -79,14 +79,26 @@ export interface SeoMeta {
|
|
|
79
79
|
ogTitle?: string;
|
|
80
80
|
ogDescription?: string;
|
|
81
81
|
ogImage?: string;
|
|
82
|
+
/** Describes the image for people who cannot see it. Also the card's alt. */
|
|
83
|
+
ogImageAlt?: string;
|
|
84
|
+
/** Pixel size, so a scraper can lay the card out before fetching the image. */
|
|
85
|
+
ogImageWidth?: number;
|
|
86
|
+
ogImageHeight?: number;
|
|
87
|
+
/** MIME type, `image/jpeg` */
|
|
88
|
+
ogImageType?: string;
|
|
82
89
|
ogUrl?: string;
|
|
83
90
|
ogType?: string;
|
|
84
91
|
ogSiteName?: string;
|
|
85
92
|
ogLocale?: string;
|
|
93
|
+
profileFirstName?: string;
|
|
94
|
+
profileLastName?: string;
|
|
95
|
+
profileUsername?: string;
|
|
86
96
|
twitterCard?: 'summary' | 'summary_large_image' | 'app' | 'player';
|
|
87
97
|
twitterTitle?: string;
|
|
88
98
|
twitterDescription?: string;
|
|
89
99
|
twitterImage?: string;
|
|
100
|
+
/** Defaults to `ogImageAlt` when the card falls back to `ogImage`. */
|
|
101
|
+
twitterImageAlt?: string;
|
|
90
102
|
twitterSite?: string;
|
|
91
103
|
twitterCreator?: string;
|
|
92
104
|
articleAuthor?: string;
|
package/dist/head.js
CHANGED
|
@@ -48,8 +48,17 @@ export function seoMetaToHeadConfig(config) {
|
|
|
48
48
|
meta.push({ property: "og:title", content: ogTitle });
|
|
49
49
|
if (ogDescription)
|
|
50
50
|
meta.push({ property: "og:description", content: ogDescription });
|
|
51
|
-
if (config.ogImage)
|
|
51
|
+
if (config.ogImage) {
|
|
52
52
|
meta.push({ property: "og:image", content: config.ogImage });
|
|
53
|
+
if (config.ogImageType)
|
|
54
|
+
meta.push({ property: "og:image:type", content: config.ogImageType });
|
|
55
|
+
if (config.ogImageWidth)
|
|
56
|
+
meta.push({ property: "og:image:width", content: String(config.ogImageWidth) });
|
|
57
|
+
if (config.ogImageHeight)
|
|
58
|
+
meta.push({ property: "og:image:height", content: String(config.ogImageHeight) });
|
|
59
|
+
if (config.ogImageAlt)
|
|
60
|
+
meta.push({ property: "og:image:alt", content: config.ogImageAlt });
|
|
61
|
+
}
|
|
53
62
|
if (config.ogUrl)
|
|
54
63
|
meta.push({ property: "og:url", content: config.ogUrl });
|
|
55
64
|
if (config.ogType)
|
|
@@ -58,6 +67,12 @@ export function seoMetaToHeadConfig(config) {
|
|
|
58
67
|
meta.push({ property: "og:site_name", content: config.ogSiteName });
|
|
59
68
|
if (config.ogLocale)
|
|
60
69
|
meta.push({ property: "og:locale", content: config.ogLocale });
|
|
70
|
+
if (config.profileFirstName)
|
|
71
|
+
meta.push({ property: "profile:first_name", content: config.profileFirstName });
|
|
72
|
+
if (config.profileLastName)
|
|
73
|
+
meta.push({ property: "profile:last_name", content: config.profileLastName });
|
|
74
|
+
if (config.profileUsername)
|
|
75
|
+
meta.push({ property: "profile:username", content: config.profileUsername });
|
|
61
76
|
const twitterTitle = config.twitterTitle ?? config.title, twitterDescription = config.twitterDescription ?? config.description, twitterImage = config.twitterImage ?? config.ogImage;
|
|
62
77
|
if (config.twitterCard)
|
|
63
78
|
meta.push({ name: "twitter:card", content: config.twitterCard });
|
|
@@ -65,8 +80,12 @@ export function seoMetaToHeadConfig(config) {
|
|
|
65
80
|
meta.push({ name: "twitter:title", content: twitterTitle });
|
|
66
81
|
if (twitterDescription)
|
|
67
82
|
meta.push({ name: "twitter:description", content: twitterDescription });
|
|
68
|
-
if (twitterImage)
|
|
83
|
+
if (twitterImage) {
|
|
69
84
|
meta.push({ name: "twitter:image", content: twitterImage });
|
|
85
|
+
const twitterImageAlt = config.twitterImageAlt ?? (config.twitterImage ? void 0 : config.ogImageAlt);
|
|
86
|
+
if (twitterImageAlt)
|
|
87
|
+
meta.push({ name: "twitter:image:alt", content: twitterImageAlt });
|
|
88
|
+
}
|
|
70
89
|
if (config.twitterSite)
|
|
71
90
|
meta.push({ name: "twitter:site", content: config.twitterSite });
|
|
72
91
|
if (config.twitterCreator)
|
package/dist/pwa.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{Ok as wq,Pk as dq,Qk as Cq,Rk as mq,Sk as gq}from"./chunk-m3a20mmb.js";import{$k as w,Tk as S,Uk as Tq,Vk as _q,Wk as z,Xk as D,Yk as P,Zk as kq,_k as vq,al as Iq,bl as d,cl as Hq,dl as Oq,el as Mq}from"./chunk-ybct46zd.js";import{$v as Dq,Xv as Aq,Yv as bq,Zv as Sq,_v as zq,aw as Pq}from"./chunk-9ebfmdyb.js";import{ew as N}from"./chunk-jryjwara.js";import p from"fs";import E from"path";import C from"fs";import L from"path";var k=[72,96,128,144,152,192,384,512],v=[120,152,167,180],I=[16,32];async function H(G,B){let q={success:!0,generatedFiles:[],errors:[],warnings:[]},K=G.pwa?.icons;if(!K?.src)return q.errors.push("No source icon specified in pwa.icons.src"),q.success=!1,q;let Y=L.isAbsolute(K.src)?K.src:L.resolve(process.cwd(),K.src);if(!await Bun.file(Y).exists())return q.errors.push(`Source icon not found: ${Y}`),q.success=!1,q;let Q=L.resolve(B,K.outputDir||"pwa-icons");try{C.mkdirSync(Q,{recursive:!0})}catch{return q.errors.push(`Failed to create output directory: ${Q}`),q.success=!1,q}let X=K.sizes||k,j=K.generateWebP??!0,J=K.generateAppleIcons??!0;try{let y;try{y=await import("sharp")}catch{return q.errors.push(`sharp is not installed. Install it with: bun add sharp
|
|
3
|
-
Icon generation requires the sharp package for image processing.`),q.success=!1,q}let R=await y.default(Y).metadata();if(R.width&&R.width<512)q.warnings.push(`Source icon is ${R.width}x${R.height}. Recommend using at least 512x512 for best quality.`);for(let $ of X){let x=L.join(Q,`icon-${$}x${$}.png`);if(await y.default(Y).resize($,$,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(x),q.generatedFiles.push(x),j){let F=L.join(Q,`icon-${$}x${$}.webp`);await y.default(Y).resize($,$,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(F),q.generatedFiles.push(F)}}if(J){for(let x of v){let F=L.join(Q,`apple-touch-icon-${x}x${x}.png`);await y.default(Y).resize(x,x,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(F),q.generatedFiles.push(F)}let $=L.join(Q,"apple-touch-icon.png");await y.default(Y).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile($),q.generatedFiles.push($)}for(let $ of I){let x=L.join(Q,`favicon-${$}x${$}.png`);await y.default(Y).resize($,$,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(x),q.generatedFiles.push(x)}let U=512,T=L.join(Q,`icon-maskable-${U}x${U}.png`),Z=Math.floor(U*0.1),_=U-Z*2;await y.default(Y).resize(_,_,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:Z,bottom:Z,left:Z,right:Z,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(T),q.generatedFiles.push(T)}catch(y){let V=y instanceof Error?y.message:String(y);q.errors.push(`Icon generation failed: ${V}`),q.success=!1}return q}function n(G){let B=G.sizes||k,q=G.outputDir?`/${G.outputDir}`:"/pwa-icons",K=G.generateWebP??!0,Y=G.generateAppleIcons??!0,Q=[];for(let X of B)if(Q.push(`${q}/icon-${X}x${X}.png`),K)Q.push(`${q}/icon-${X}x${X}.webp`);if(Y){Q.push(`${q}/apple-touch-icon.png`);for(let X of v)Q.push(`${q}/apple-touch-icon-${X}x${X}.png`)}for(let X of I)Q.push(`${q}/favicon-${X}x${X}.png`);return Q.push(`${q}/icon-maskable-512x512.png`),Q}async function O(){try{return await import("sharp"),!0}catch{return!1}}function m(G,B,q,K){let Y=[],Q=K.join(" ");for(let X of G)if(Y.push({src:`${B}/icon-${X}x${X}.png`,sizes:`${X}x${X}`,type:"image/png",purpose:Q}),q)Y.push({src:`${B}/icon-${X}x${X}.webp`,sizes:`${X}x${X}`,type:"image/webp",purpose:Q});return Y}function g(G){return G.map((B)=>({name:B.name,short_name:B.shortName,description:B.description,url:B.url,icons:B.icons?.map((q)=>({src:q.src,sizes:q.sizes,type:q.type}))}))}function h(G){let B=G.pwa?.shareTarget;if(!B?.enabled)return;let q={action:B.action||"/share",method:B.method||"POST",enctype:B.enctype||"multipart/form-data",params:{title:B.params?.title||"title",text:B.params?.text||"text",url:B.params?.url||"url"}};if(B.acceptFiles&&B.acceptFiles.length>0)q.params.files=B.acceptFiles.map((K)=>({name:K.name,accept:K.accept}));return q}function c(G){let B=G.pwa?.fileHandlers;if(!B?.enabled||!B.accept)return;let q=[{action:B.action||"/",accept:B.accept,launch_type:B.launchType||"single-client"}];if(B.icons)q[0].icons=B.icons.map((K)=>({src:K.src,sizes:K.sizes,type:K.type}));return q}function l(G){let B=G.pwa?.protocolHandlers;if(!B||B.length===0)return;return B.map((q)=>({protocol:q.protocol,url:q.url}))}function u(G){let B=G.pwa;if(!B?.enabled||!B.manifest)return null;let{manifest:q,icons:K}=B,Y=K?.sizes||[72,96,128,144,152,192,384,512],Q=K?.outputDir?`/${K.outputDir}`:"/pwa-icons",X=K?.generateWebP??!0,j=K?.purpose||["any","maskable"],J={name:q.name,short_name:q.shortName||q.name,description:q.description,start_url:q.startUrl||"/",display:q.display||"standalone",display_override:q.displayOverride,orientation:q.orientation,theme_color:q.themeColor,background_color:q.backgroundColor,scope:q.scope||"/",lang:q.lang,dir:q.dir,id:q.id,categories:q.categories,icons:m(Y,Q,X,j)};if(q.shortcuts&&q.shortcuts.length>0)J.shortcuts=g(q.shortcuts);if(q.screenshots&&q.screenshots.length>0)J.screenshots=q.screenshots.map((U)=>({src:U.src,sizes:U.sizes,type:U.type,label:U.label,form_factor:U.platform}));let y=h(G);if(y)J.share_target=y;let V=c(G);if(V)J.file_handlers=V;let R=l(G);if(R)J.protocol_handlers=R;if(q.launchHandler)J.launch_handler={client_mode:q.launchHandler};if(q.handleLinks)J.handle_links=q.handleLinks;if(q.edgeSidePanel?.enabled)J.edge_side_panel={preferred_width:q.edgeSidePanel.preferredWidth};return J}function M(G){let B=u(G);if(!B)return"";let q=JSON.parse(JSON.stringify(B));return JSON.stringify(q,null,2)}function i(G,B){return{...B,...G,shortcuts:G.shortcuts||B.shortcuts,screenshots:G.screenshots||B.screenshots,categories:G.categories||B.categories}}function s(G){let B=[],q=G.pwa;if(!q?.enabled)return B;let K=q.manifest;if(!K)return B.push("PWA manifest configuration is missing"),B;if(!K.name)B.push("Manifest name is required");let Y=["fullscreen","standalone","minimal-ui","browser"];if(K.display&&!Y.includes(K.display))B.push(`Invalid display mode: ${K.display}. Must be one of: ${Y.join(", ")}`);let Q=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(K.orientation&&!Q.includes(K.orientation))B.push(`Invalid orientation: ${K.orientation}`);let X=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(K.themeColor&&!X.test(K.themeColor))B.push(`Invalid theme color: ${K.themeColor}. Must be a valid hex color.`);if(K.backgroundColor&&!X.test(K.backgroundColor))B.push(`Invalid background color: ${K.backgroundColor}. Must be a valid hex color.`);if(q.shareTarget?.enabled){if(!q.shareTarget.action)B.push("Share target action URL is required")}if(q.fileHandlers?.enabled){if(!q.fileHandlers.accept||Object.keys(q.fileHandlers.accept).length===0)B.push("File handlers must specify accepted MIME types")}if(q.protocolHandlers)for(let j of q.protocolHandlers){if(!j.protocol)B.push("Protocol handler missing protocol");if(!j.url||!j.url.includes("%s"))B.push(`Protocol handler URL must contain %s placeholder: ${j.protocol}`)}return B}import A from"path";async function b(G){let B=G.pwa?.offline;if(!B?.enabled)return"";if(B.page){let q=A.isAbsolute(B.page)?B.page:A.resolve(process.cwd(),B.page);if(await Bun.file(q).exists())try{let{processDirectives:K}=await import("./chunk-
|
|
3
|
+
Icon generation requires the sharp package for image processing.`),q.success=!1,q}let R=await y.default(Y).metadata();if(R.width&&R.width<512)q.warnings.push(`Source icon is ${R.width}x${R.height}. Recommend using at least 512x512 for best quality.`);for(let $ of X){let x=L.join(Q,`icon-${$}x${$}.png`);if(await y.default(Y).resize($,$,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(x),q.generatedFiles.push(x),j){let F=L.join(Q,`icon-${$}x${$}.webp`);await y.default(Y).resize($,$,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(F),q.generatedFiles.push(F)}}if(J){for(let x of v){let F=L.join(Q,`apple-touch-icon-${x}x${x}.png`);await y.default(Y).resize(x,x,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(F),q.generatedFiles.push(F)}let $=L.join(Q,"apple-touch-icon.png");await y.default(Y).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile($),q.generatedFiles.push($)}for(let $ of I){let x=L.join(Q,`favicon-${$}x${$}.png`);await y.default(Y).resize($,$,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(x),q.generatedFiles.push(x)}let U=512,T=L.join(Q,`icon-maskable-${U}x${U}.png`),Z=Math.floor(U*0.1),_=U-Z*2;await y.default(Y).resize(_,_,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:Z,bottom:Z,left:Z,right:Z,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(T),q.generatedFiles.push(T)}catch(y){let V=y instanceof Error?y.message:String(y);q.errors.push(`Icon generation failed: ${V}`),q.success=!1}return q}function n(G){let B=G.sizes||k,q=G.outputDir?`/${G.outputDir}`:"/pwa-icons",K=G.generateWebP??!0,Y=G.generateAppleIcons??!0,Q=[];for(let X of B)if(Q.push(`${q}/icon-${X}x${X}.png`),K)Q.push(`${q}/icon-${X}x${X}.webp`);if(Y){Q.push(`${q}/apple-touch-icon.png`);for(let X of v)Q.push(`${q}/apple-touch-icon-${X}x${X}.png`)}for(let X of I)Q.push(`${q}/favicon-${X}x${X}.png`);return Q.push(`${q}/icon-maskable-512x512.png`),Q}async function O(){try{return await import("sharp"),!0}catch{return!1}}function m(G,B,q,K){let Y=[],Q=K.join(" ");for(let X of G)if(Y.push({src:`${B}/icon-${X}x${X}.png`,sizes:`${X}x${X}`,type:"image/png",purpose:Q}),q)Y.push({src:`${B}/icon-${X}x${X}.webp`,sizes:`${X}x${X}`,type:"image/webp",purpose:Q});return Y}function g(G){return G.map((B)=>({name:B.name,short_name:B.shortName,description:B.description,url:B.url,icons:B.icons?.map((q)=>({src:q.src,sizes:q.sizes,type:q.type}))}))}function h(G){let B=G.pwa?.shareTarget;if(!B?.enabled)return;let q={action:B.action||"/share",method:B.method||"POST",enctype:B.enctype||"multipart/form-data",params:{title:B.params?.title||"title",text:B.params?.text||"text",url:B.params?.url||"url"}};if(B.acceptFiles&&B.acceptFiles.length>0)q.params.files=B.acceptFiles.map((K)=>({name:K.name,accept:K.accept}));return q}function c(G){let B=G.pwa?.fileHandlers;if(!B?.enabled||!B.accept)return;let q=[{action:B.action||"/",accept:B.accept,launch_type:B.launchType||"single-client"}];if(B.icons)q[0].icons=B.icons.map((K)=>({src:K.src,sizes:K.sizes,type:K.type}));return q}function l(G){let B=G.pwa?.protocolHandlers;if(!B||B.length===0)return;return B.map((q)=>({protocol:q.protocol,url:q.url}))}function u(G){let B=G.pwa;if(!B?.enabled||!B.manifest)return null;let{manifest:q,icons:K}=B,Y=K?.sizes||[72,96,128,144,152,192,384,512],Q=K?.outputDir?`/${K.outputDir}`:"/pwa-icons",X=K?.generateWebP??!0,j=K?.purpose||["any","maskable"],J={name:q.name,short_name:q.shortName||q.name,description:q.description,start_url:q.startUrl||"/",display:q.display||"standalone",display_override:q.displayOverride,orientation:q.orientation,theme_color:q.themeColor,background_color:q.backgroundColor,scope:q.scope||"/",lang:q.lang,dir:q.dir,id:q.id,categories:q.categories,icons:m(Y,Q,X,j)};if(q.shortcuts&&q.shortcuts.length>0)J.shortcuts=g(q.shortcuts);if(q.screenshots&&q.screenshots.length>0)J.screenshots=q.screenshots.map((U)=>({src:U.src,sizes:U.sizes,type:U.type,label:U.label,form_factor:U.platform}));let y=h(G);if(y)J.share_target=y;let V=c(G);if(V)J.file_handlers=V;let R=l(G);if(R)J.protocol_handlers=R;if(q.launchHandler)J.launch_handler={client_mode:q.launchHandler};if(q.handleLinks)J.handle_links=q.handleLinks;if(q.edgeSidePanel?.enabled)J.edge_side_panel={preferred_width:q.edgeSidePanel.preferredWidth};return J}function M(G){let B=u(G);if(!B)return"";let q=JSON.parse(JSON.stringify(B));return JSON.stringify(q,null,2)}function i(G,B){return{...B,...G,shortcuts:G.shortcuts||B.shortcuts,screenshots:G.screenshots||B.screenshots,categories:G.categories||B.categories}}function s(G){let B=[],q=G.pwa;if(!q?.enabled)return B;let K=q.manifest;if(!K)return B.push("PWA manifest configuration is missing"),B;if(!K.name)B.push("Manifest name is required");let Y=["fullscreen","standalone","minimal-ui","browser"];if(K.display&&!Y.includes(K.display))B.push(`Invalid display mode: ${K.display}. Must be one of: ${Y.join(", ")}`);let Q=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(K.orientation&&!Q.includes(K.orientation))B.push(`Invalid orientation: ${K.orientation}`);let X=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(K.themeColor&&!X.test(K.themeColor))B.push(`Invalid theme color: ${K.themeColor}. Must be a valid hex color.`);if(K.backgroundColor&&!X.test(K.backgroundColor))B.push(`Invalid background color: ${K.backgroundColor}. Must be a valid hex color.`);if(q.shareTarget?.enabled){if(!q.shareTarget.action)B.push("Share target action URL is required")}if(q.fileHandlers?.enabled){if(!q.fileHandlers.accept||Object.keys(q.fileHandlers.accept).length===0)B.push("File handlers must specify accepted MIME types")}if(q.protocolHandlers)for(let j of q.protocolHandlers){if(!j.protocol)B.push("Protocol handler missing protocol");if(!j.url||!j.url.includes("%s"))B.push(`Protocol handler URL must contain %s placeholder: ${j.protocol}`)}return B}import A from"path";async function b(G){let B=G.pwa?.offline;if(!B?.enabled)return"";if(B.page){let q=A.isAbsolute(B.page)?B.page:A.resolve(process.cwd(),B.page);if(await Bun.file(q).exists())try{let{processDirectives:K}=await import("./chunk-bvn1t6eh.js"),Y=await Bun.file(q).text();return await K(Y,{},q,G,new Set)}catch(K){console.warn(`[PWA] Failed to process custom offline page: ${K}`)}else console.warn(`[PWA] Custom offline page not found: ${q}`)}return f(G)}function f(G){let B=G.pwa?.offline,q=G.pwa?.manifest,K=B?.fallbackTitle||"You are offline",Y=B?.fallbackMessage||"Please check your internet connection and try again.",Q=q?.themeColor||"#4f46e5",X=q?.shortName||q?.name||"App";return`<!DOCTYPE html>
|
|
4
4
|
<html lang="en">
|
|
5
5
|
<head>
|
|
6
6
|
<meta charset="UTF-8">
|
package/dist/seo.js
CHANGED
|
@@ -193,11 +193,29 @@ export function processSeoDirective(template, context, _filePath, _options) {
|
|
|
193
193
|
`;
|
|
194
194
|
if (og.imageHeight)
|
|
195
195
|
metaTags += `<meta property="og:image:height" content="${escapeHtml(String(og.imageHeight))}">
|
|
196
|
+
`;
|
|
197
|
+
if (og.imageType)
|
|
198
|
+
metaTags += `<meta property="og:image:type" content="${escapeHtml(og.imageType)}">
|
|
196
199
|
`;
|
|
197
200
|
}
|
|
198
201
|
if (og.siteName)
|
|
199
202
|
metaTags += `<meta property="og:site_name" content="${escapeHtml(og.siteName)}">
|
|
200
203
|
`;
|
|
204
|
+
if (og.locale)
|
|
205
|
+
metaTags += `<meta property="og:locale" content="${escapeHtml(og.locale)}">
|
|
206
|
+
`;
|
|
207
|
+
if (og.profile) {
|
|
208
|
+
const profile = [
|
|
209
|
+
["first_name", og.profile.firstName],
|
|
210
|
+
["last_name", og.profile.lastName],
|
|
211
|
+
["username", og.profile.username],
|
|
212
|
+
["gender", og.profile.gender]
|
|
213
|
+
];
|
|
214
|
+
for (const [key, value] of profile)
|
|
215
|
+
if (value)
|
|
216
|
+
metaTags += `<meta property="profile:${key}" content="${escapeHtml(value)}">
|
|
217
|
+
`;
|
|
218
|
+
}
|
|
201
219
|
}
|
|
202
220
|
if (config.twitter) {
|
|
203
221
|
const twitter = config.twitter;
|
|
@@ -216,6 +234,10 @@ export function processSeoDirective(template, context, _filePath, _options) {
|
|
|
216
234
|
if (twitter.image || config.openGraph && config.openGraph.image) {
|
|
217
235
|
const twitterImage = twitter.image || (config.openGraph ? config.openGraph.image : "") || "";
|
|
218
236
|
metaTags += `<meta name="twitter:image" content="${escapeHtml(twitterImage)}">
|
|
237
|
+
`;
|
|
238
|
+
const twitterImageAlt = twitter.imageAlt || (!twitter.image && config.openGraph ? config.openGraph.imageAlt : void 0);
|
|
239
|
+
if (twitterImageAlt)
|
|
240
|
+
metaTags += `<meta name="twitter:image:alt" content="${escapeHtml(twitterImageAlt)}">
|
|
219
241
|
`;
|
|
220
242
|
}
|
|
221
243
|
if (twitter.site)
|
package/dist/ssg.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Fk as Uq,Gk as Iq,Kk as Fq}from"./chunk-k14nr7rz.js";import{Lk as Eq,Mk as Tq,Nk as Dq}from"./chunk-09zjty4k.js";import{gl as _q,jl as zq,kl as Aq}from"./chunk-
|
|
2
|
+
import{Fk as Uq,Gk as Iq,Kk as Fq}from"./chunk-k14nr7rz.js";import{Lk as Eq,Mk as Tq,Nk as Dq}from"./chunk-09zjty4k.js";import{gl as _q,jl as zq,kl as Aq}from"./chunk-trgzmk7z.js";import"./chunk-sta0thbr.js";import{$p as P,Um as Oq,op as Bq,so as l,vo as Hq,yr as n}from"./chunk-m6e7fqtc.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import{au as Xq}from"./chunk-02pw67wj.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import{ou as d}from"./chunk-4ee1aaet.js";import"./chunk-yzpkv9kx.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import{Lv as Yq,Mv as Vq,Nv as jq,Ov as Gq,Pv as Lq,Qv as Nq}from"./chunk-r7qap4bh.js";import"./chunk-9ebfmdyb.js";import{ew as y}from"./chunk-jryjwara.js";import O from"fs";import j from"path";import{createHash as xq}from"crypto";function yq(q){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(q).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return q}}var Pq=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Cq(q){return Bun.hash(q).toString(16)}function Qq(q,Z={}){if(!q.includes('type="stx/island"'))return{html:q,chunks:[]};let $=new Map,Q=q.replace(Pq,(J,W,z,A)=>{let G=A.trim();if(!G)return J;if(/\bdata-stx-src=/.test(z))return J;if(Z.minify)G=yq(G);let X=Cq(G);if(!$.has(X))$.set(X,G);let B=Z.integrity?` data-stx-integrity="sha384-${xq("sha384").update(G).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${W}" data-stx-src="/_stx/islands/${X}.js"${B}${z}></script>`}),K=Array.from($,([J,W])=>({hash:J,code:W}));return{html:Q,chunks:K}}var gq=new Set(["visible","idle"]);function Zq(q){if(!q.includes("data-stx-src="))return q;let Z=new Map,$=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,Q;while((Q=$.exec(q))!==null)Z.set(Q[1],Q[2]);let K=new Set,J=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,W;while((W=J.exec(q))!==null)if(gq.has(Z.get(W[1])||""))K.add(W[2]);let z=q.lastIndexOf("</head>");if(K.size===0||z===-1)return q;let A=Array.from(K).filter((G)=>!q.includes(`rel="prefetch" href="${G}"`)).map((G)=>`<link rel="prefetch" href="${G}" as="script">`).join("");if(!A)return q;return q.slice(0,z)+A+q.slice(z)}var fq=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function h(q){let Z=q.trim();if(!Z)return null;let $=/^https?:\/\//i.test(Z)?Z:`https://${Z}`;try{return new URL($).origin+new URL($).pathname.replace(/\/$/,"")}catch{return null}}function mq(q){for(let Z of fq){let $=q[Z];if(!$)continue;let Q=h($);if(Q)return{url:Q,source:"env",via:Z}}return null}function $q(q){if(!q||typeof q!=="object")return null;let Z=q,$=Z.site?.url??Z.url??Z.app?.url;return typeof $==="string"?h($):null}async function dq(q){let{existsSync:Z}=await import("fs"),$=await import("path");for(let Q of["site.config.ts","site.config.js",".config/site.config.ts"]){let K=$.resolve(q,Q);if(!Z(K))continue;try{let J=await import(K),W=$q(J.default??J);if(W)return W}catch{}}return null}async function Kq(q={}){let Z=q.cwd??process.cwd(),$=q.env??process.env;if(q.explicit){let W=h(q.explicit);if(W)return{url:W,source:"option"}}let Q=$q(q.stxConfig);if(Q)return{url:Q,source:"stx.config",via:"site.url"};let K=await dq(Z);if(K)return{url:K,source:"site.config",via:"url"};let J=mq($);if(J)return J;return{url:"http://localhost",source:"fallback"}}function Wq(){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
|
`)}class wq{cacheDir;cache=new Map;loaded=!1;salt;constructor(q,Z=""){this.cacheDir=q,this.salt=Z}async load(){if(this.loaded)return;let q=j.join(this.cacheDir,"build-cache.json");if(await Bun.file(q).exists())try{let Z=JSON.parse(await Bun.file(q).text());for(let[$,Q]of Object.entries(Z))this.cache.set($,Q)}catch{}this.loaded=!0}async save(){await O.promises.mkdir(this.cacheDir,{recursive:!0});let q=j.join(this.cacheDir,"build-cache.json"),Z={};for(let[$,Q]of this.cache)Z[$]=Q;await Bun.write(q,JSON.stringify(Z))}getHash(q,Z){let $=O.statSync(q),Q=`${this.salt}|${q}:${$.mtimeMs}`;for(let J of Z)if(O.existsSync(J)){let W=O.statSync(J);Q+=`:${J}:${W.mtimeMs}`}let K=0;for(let J=0;J<Q.length;J++){let W=Q.charCodeAt(J);K=(K<<5)-K+W,K=K&K}return Math.abs(K).toString(36)}get(q,Z){let $=this.cache.get(q);if(!$)return null;let Q=this.getHash(Z,$.dependencies??[]);if($.hash!==Q)return this.cache.delete(q),null;return $.html}set(q,Z,$,Q){let K=this.getHash(Z,$);this.cache.set(q,{hash:K,html:Q,generatedAt:Date.now(),dependencies:$})}}class Rq{cacheDir;constructor(q){this.cacheDir=q}getFilePath(q){let Z=q.replace(/[^a-zA-Z0-9]/g,"_")+".json";return j.join(this.cacheDir,"isr",Z)}async get(q){let Z=this.getFilePath(q);if(!await Bun.file(Z).exists())return null;try{return JSON.parse(await Bun.file(Z).text())}catch{return null}}async set(q,Z){let $=this.getFilePath(q);await O.promises.mkdir(j.dirname($),{recursive:!0}),await Bun.write($,JSON.stringify(Z))}async invalidate(q){let Z=this.getFilePath(q);if(await Bun.file(Z).exists())await O.promises.unlink(Z)}async invalidatePattern(q){let Z=j.join(this.cacheDir,"isr");if(!O.existsSync(Z))return;let $=await O.promises.readdir(Z);for(let Q of $){let K=Q.replace(/_/g,"/").replace(".json","");if(q.test(K))await O.promises.unlink(j.join(Z,Q))}}async needsRevalidation(q){let Z=await this.get(q);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function pq(q){try{let $=(await Bun.file(q).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!$)return null;let Q=$[1];if(!Q.includes("getStaticPaths"))return null;let K=Q.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!K)return null;return await Function(`
|
|
4
4
|
return (async function getStaticPaths() {
|
|
5
5
|
${K[1]}
|
|
@@ -41,7 +41,7 @@ ${q.map((Q)=>{let K=new URL(Q.loc,Z).href,J=` <url>
|
|
|
41
41
|
${$.join(`
|
|
42
42
|
`)}
|
|
43
43
|
</channel>
|
|
44
|
-
</rss>`}async function aq(q={}){let Z=Date.now();Aq();let $=await n(process.cwd()),Q=$.build||{},K=await Kq({explicit:q.domain||Q.domain,stxConfig:$});if(K.source==="fallback"&&(q.sitemap??Q.sitemap??!0))console.warn(Wq());let J={router:q.router??$?.router??{},pagesDir:q.pagesDir||Q.pagesDir||"pages",outputDir:q.outputDir||Q.outputDir||"dist",baseUrl:q.baseUrl||Q.baseUrl||"/",domain:K.url,revalidate:q.revalidate??Q.revalidate??!1,sitemap:q.sitemap??Q.sitemap??!0,sitemapExclude:q.sitemapExclude||Q.sitemapExclude||[],robots:q.robots??Q.robots??!0,rss:q.rss??Q.rss??!1,concurrency:q.concurrency||Q.concurrency||10,cache:q.cache??Q.cache??!0,cacheDir:q.cacheDir||Q.cacheDir||d(process.cwd(),"ssg-cache"),contentLoaders:q.contentLoaders||[],hooks:q.hooks||{},minify:q.minify??Q.minify??!0,generate404:q.generate404??Q.generate404??!0,publicDir:q.publicDir||Q.publicDir||"public",trailingSlash:q.trailingSlash??Q.trailingSlash??!1,cleanOutput:q.cleanOutput??Q.cleanOutput??!0,cacheSalt:q.cacheSalt??"",partialsDir:q.partialsDir||$?.partialsDir||"",componentsDir:q.componentsDir||$?.componentsDir||"",failOnIncludeError:q.failOnIncludeError??!0,chunkIslands:q.chunkIslands===!0,prefetchIslands:q.prefetchIslands===!0,integrityIslands:q.integrityIslands===!0},W={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},z=new Set,A=0,G={},X={};await J.hooks.onBuildStart?.();try{if(J.cleanOutput&&O.existsSync(J.outputDir))await O.promises.rm(J.outputDir,{recursive:!0});await O.promises.mkdir(J.outputDir,{recursive:!0});let L=J.cacheSalt;if(!L){let{resolveUserCssConfig:Y,fingerprintConfig:N}=await import("./chunk-
|
|
44
|
+
</rss>`}async function aq(q={}){let Z=Date.now();Aq();let $=await n(process.cwd()),Q=$.build||{},K=await Kq({explicit:q.domain||Q.domain,stxConfig:$});if(K.source==="fallback"&&(q.sitemap??Q.sitemap??!0))console.warn(Wq());let J={router:q.router??$?.router??{},pagesDir:q.pagesDir||Q.pagesDir||"pages",outputDir:q.outputDir||Q.outputDir||"dist",baseUrl:q.baseUrl||Q.baseUrl||"/",domain:K.url,revalidate:q.revalidate??Q.revalidate??!1,sitemap:q.sitemap??Q.sitemap??!0,sitemapExclude:q.sitemapExclude||Q.sitemapExclude||[],robots:q.robots??Q.robots??!0,rss:q.rss??Q.rss??!1,concurrency:q.concurrency||Q.concurrency||10,cache:q.cache??Q.cache??!0,cacheDir:q.cacheDir||Q.cacheDir||d(process.cwd(),"ssg-cache"),contentLoaders:q.contentLoaders||[],hooks:q.hooks||{},minify:q.minify??Q.minify??!0,generate404:q.generate404??Q.generate404??!0,publicDir:q.publicDir||Q.publicDir||"public",trailingSlash:q.trailingSlash??Q.trailingSlash??!1,cleanOutput:q.cleanOutput??Q.cleanOutput??!0,cacheSalt:q.cacheSalt??"",partialsDir:q.partialsDir||$?.partialsDir||"",componentsDir:q.componentsDir||$?.componentsDir||"",failOnIncludeError:q.failOnIncludeError??!0,chunkIslands:q.chunkIslands===!0,prefetchIslands:q.prefetchIslands===!0,integrityIslands:q.integrityIslands===!0},W={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},z=new Set,A=0,G={},X={};await J.hooks.onBuildStart?.();try{if(J.cleanOutput&&O.existsSync(J.outputDir))await O.promises.rm(J.outputDir,{recursive:!0});await O.promises.mkdir(J.outputDir,{recursive:!0});let L=J.cacheSalt;if(!L){let{resolveUserCssConfig:Y,fingerprintConfig:N}=await import("./chunk-9btvp75h.js");try{L=N(await Y(process.cwd()))}catch{}}let{prepareImageDelivery:_}=await import("./chunk-6vt9ddra.js"),F=await _(J.publicDir,J.outputDir);if(F.count>0)console.log(`Optimized ${F.count} image(s) for responsive delivery`),L=[L,F.fingerprint].filter(Boolean).join(":");let C=new wq(J.cacheDir,L);if(J.cache)await C.load();try{let{generateCss:Y}=await import("./chunk-9btvp75h.js");await Y('<div class="bg-black"></div>')}catch{}Yq();let kq=$?.routeMiddleware?.dir||"middleware";await jq(process.cwd(),kq);let p=Vq();if(p.length>0)console.log(`Loaded ${p.length} middleware: ${p.join(", ")}`);let bq=$?.routeMiddleware?.global||[];Fq($?.layoutsDir,d(process.cwd()));let i=l(".",{pagesDir:J.pagesDir,pagesDirs:$?._layerPageDirs});console.log(`Found ${i.length} routes`);let g=[];for(let Y of i){let N=await uq(Y);for(let H of N)g.push({route:Y,url:H.url,params:H.params,props:H.props,revalidate:H.revalidate??J.revalidate})}W.totalPages=g.length,console.log(`Generating ${W.totalPages} pages...`);let b=[],s=[];for(let Y=0;Y<g.length;Y+=J.concurrency)s.push(g.slice(Y,Y+J.concurrency));for(let Y of s)await Promise.all(Y.map(async(N)=>{let{route:H,url:V,params:S,props:Sq,revalidate:a}=N;try{await J.hooks.onPageStart?.(V);let w=await Bun.file(H.filePath).text(),R=JJ(w),vq=R?.middleware?Array.isArray(R.middleware)?R.middleware:[R.middleware]:[],t=[...bq,...vq];if(t.length>0){let D=Gq(V,S,R||{}),M=Lq(D,null,void 0,{isServer:!0}),E=await Nq(t,M);if(E.redirect){let U=typeof E.redirect==="string"?E.redirect:E.redirect.path||E.redirect,x=QJ(String(U),V),k=ZJ(V,J);await O.promises.mkdir(j.dirname(k),{recursive:!0}),await Bun.write(k,x),W.successCount++,W.pages.push({route:V,outputPath:k,size:Buffer.byteLength(x),cached:!1}),b.push({loc:V,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${V} \u2192 redirect to ${U}`);return}if(E.abort){let U=typeof E.abort==="string"?E.abort:E.abort?.error?.message||"aborted";console.warn(` \u21B3 ${V} \u2014 middleware aborted: ${U}`);return}}let e=w.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(e)try{if(!await Function("route",`
|
|
45
45
|
const validate = ${e[1]};
|
|
46
46
|
return validate(route);
|
|
47
47
|
`)({params:S})){console.warn(`Validation failed for ${V}, skipping...`);return}}catch{}let I=null,qq=!1;if(J.cache){if(I=C.get(V,H.filePath),I)qq=!0,W.cachedCount++}if(!I){let D=await Mq(H,S,Sq,J,$);if(I=D.html,J.failOnIncludeError&&D.includeFailures.length>0)throw Error(`${D.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
|
|
@@ -118,8 +118,26 @@ export interface OpenGraphConfig {
|
|
|
118
118
|
imageWidth?: number;
|
|
119
119
|
/** Height of the OG image */
|
|
120
120
|
imageHeight?: number;
|
|
121
|
+
/** MIME type of the OG image (`image/jpeg`), so a scraper need not sniff it */
|
|
122
|
+
imageType?: string;
|
|
121
123
|
/** Site name for Open Graph */
|
|
122
124
|
siteName?: string;
|
|
125
|
+
/** Locale of the page, `language_TERRITORY` (`en_US`) */
|
|
126
|
+
locale?: string;
|
|
127
|
+
/**
|
|
128
|
+
* The `profile:*` properties. Open Graph defines them for `type: 'profile'`,
|
|
129
|
+
* and a profile without them says whose profile it is nowhere.
|
|
130
|
+
*/
|
|
131
|
+
profile?: OpenGraphProfile;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Open Graph `profile` object properties.
|
|
135
|
+
*/
|
|
136
|
+
export interface OpenGraphProfile {
|
|
137
|
+
firstName?: string;
|
|
138
|
+
lastName?: string;
|
|
139
|
+
username?: string;
|
|
140
|
+
gender?: string;
|
|
123
141
|
}
|
|
124
142
|
/**
|
|
125
143
|
* SEO Twitter card configuration
|
|
@@ -133,6 +151,8 @@ export interface TwitterConfig {
|
|
|
133
151
|
description?: string;
|
|
134
152
|
/** Image URL for Twitter card */
|
|
135
153
|
image?: string;
|
|
154
|
+
/** Alt text for the card image. Defaults to the Open Graph `imageAlt`. */
|
|
155
|
+
imageAlt?: string;
|
|
136
156
|
/** Twitter site handle */
|
|
137
157
|
site?: string;
|
|
138
158
|
/** Twitter creator handle */
|
package/dist/types/index.d.ts
CHANGED
|
@@ -15,6 +15,6 @@ export type { AuthContext, BaseTemplateContext, ContextValue, LoopContext, Permi
|
|
|
15
15
|
export type { A11yDirective, AuthDirective, ComponentDirective, ConditionalDirective, CustomDirective, CustomDirectiveHandler, Directive, DirectiveOfKind, EnvDirective, ExpressionDirective, FormDirective, I18nDirective, IncludeDirective, LayoutDirective, LoopDirective, Middleware, MiddlewareHandler, ScriptDirective, SeoDirective, StackDirective, SwitchDirective, UserCustomDirective, } from './directive-types';
|
|
16
16
|
export { isDirectiveKind } from './directive-types';
|
|
17
17
|
export type { ComponentLibraryBuildResult, ComponentLibraryComponent, ComponentLibraryConfig, ComponentLibraryEvent, ComponentLibraryProperty, ComponentConfig, ComponentDefinition, ComponentDoc, ComponentPropDoc, ComponentPropsSchema, DirectiveDoc, DocFormat, DocGeneratorConfig, PropDefinition, PropType, TemplateDoc, WebComponent, WebComponentConfig, } from './component-types';
|
|
18
|
-
export type { A11yConfig, AnalyticsConfig, AnalyticsDriver, AnimationConfig, FormConfig, HydrationConfig, I18nConfig, Island, LoopConfig, MarkdownConfig, OpenGraphConfig, SeoConfig, SeoFeatureConfig, StreamingConfig, StreamRenderer, StrictModeConfig, StxConfig, StxOptions, SyntaxHighlightingConfig, SyntaxHighlightTheme, TwitterConfig, } from './config-types';
|
|
18
|
+
export type { A11yConfig, AnalyticsConfig, AnalyticsDriver, AnimationConfig, FormConfig, HydrationConfig, I18nConfig, Island, LoopConfig, MarkdownConfig, OpenGraphConfig, OpenGraphProfile, SeoConfig, SeoFeatureConfig, StreamingConfig, StreamRenderer, StrictModeConfig, StxConfig, StxOptions, SyntaxHighlightingConfig, SyntaxHighlightTheme, TwitterConfig, } from './config-types';
|
|
19
19
|
export type { PwaBackgroundSyncConfig, PwaCacheStorageConfig, PwaCacheStrategy, PwaConfig, PwaFileHandlerConfig, PwaIconConfig, PwaManifestConfig, PwaOfflineConfig, PwaPrecacheConfig, PwaProtocolHandlerConfig, PwaPushConfig, PwaRouteCache, PwaScreenshot, PwaServiceWorkerConfig, PwaShareTargetConfig, PwaShortcut, PwaUpdateConfig, } from './pwa-types';
|
|
20
20
|
export type { CspConfig, CspDirectives, CspPreset, CspSourceValue, } from './csp-types';
|
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.308",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -117,12 +117,12 @@
|
|
|
117
117
|
"dependencies": {
|
|
118
118
|
"@stacksjs/ts-css": "^0.3.2",
|
|
119
119
|
"@stacksjs/clapp": "^0.2.14",
|
|
120
|
-
"@stacksjs/desktop": "0.2.
|
|
121
|
-
"@stacksjs/sanitizer": "0.2.
|
|
120
|
+
"@stacksjs/desktop": "0.2.308",
|
|
121
|
+
"@stacksjs/sanitizer": "0.2.308",
|
|
122
122
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
123
|
-
"bun-plugin-stx": "0.2.
|
|
123
|
+
"bun-plugin-stx": "0.2.308",
|
|
124
124
|
"bunfig": "^0.15.17",
|
|
125
|
-
"stx-router": "0.2.
|
|
125
|
+
"stx-router": "0.2.308",
|
|
126
126
|
"ts-broadcasting": "^0.0.9",
|
|
127
127
|
"ts-images": "^0.2.18",
|
|
128
128
|
"ts-syntax-highlighter": "^0.2.1"
|
package/dist/chunk-gt40xkj3.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ue as a}from"./chunk-9eat8v8r.js";import"./chunk-dvvx1wny.js";import"./chunk-qhnyrwz2.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-ewcxfn7m.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-w764f6g4.js";import"./chunk-18p8dqya.js";import"./chunk-w1dxgs78.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-r7qap4bh.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as buildApp};
|
package/dist/chunk-nvb9nsqv.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ye as a}from"./chunk-1zcm299e.js";import"./chunk-e5yebhrk.js";import"./chunk-dvvx1wny.js";import"./chunk-3qc0h6bj.js";import"./chunk-qhnyrwz2.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-ewcxfn7m.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-w764f6g4.js";import"./chunk-18p8dqya.js";import"./chunk-w1dxgs78.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-r7qap4bh.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as startProductionServer};
|
package/dist/chunk-szdwkfzq.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Wf as a}from"./chunk-kgtbm5rp.js";import"./chunk-ffexgxm3.js";import"./chunk-e5yebhrk.js";import"./chunk-dvvx1wny.js";import"./chunk-w8hkprzv.js";import"./chunk-t41aaehf.js";import"./chunk-09zjty4k.js";import"./chunk-3qc0h6bj.js";import"./chunk-qhnyrwz2.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-ewcxfn7m.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-w764f6g4.js";import"./chunk-18p8dqya.js";import"./chunk-w1dxgs78.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-r7qap4bh.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as buildForProduction};
|
package/dist/chunk-w1dxgs78.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var K={},Y=[],O={};function I(){return K}function h(){return O}function D(){K={},Y.length=0,O={}}function U(j){K=Q(K,j)}function Q(j,z){return{title:z.title??j.title,titleTemplate:z.titleTemplate??j.titleTemplate,base:z.base??j.base,meta:[...j.meta||[],...z.meta||[]],link:[...j.link||[],...z.link||[]],script:[...j.script||[],...z.script||[]],style:[...j.style||[],...z.style||[]],htmlAttrs:{...j.htmlAttrs,...z.htmlAttrs},bodyAttrs:{...j.bodyAttrs,...z.bodyAttrs}}}function Z(j){U(_(j))}function _(j){let z=[];if(j.description)z.push({name:"description",content:j.description});if(j.keywords){let L=Array.isArray(j.keywords)?j.keywords.join(", "):j.keywords;z.push({name:"keywords",content:L})}if(j.author)z.push({name:"author",content:j.author});if(j.robots)z.push({name:"robots",content:j.robots});let A=j.ogTitle??j.title,B=j.ogDescription??j.description;if(A)z.push({property:"og:title",content:A});if(B)z.push({property:"og:description",content:B});if(j.ogImage)z.push({property:"og:image",content:j.ogImage});if(j.ogUrl)z.push({property:"og:url",content:j.ogUrl});if(j.ogType)z.push({property:"og:type",content:j.ogType});if(j.ogSiteName)z.push({property:"og:site_name",content:j.ogSiteName});if(j.ogLocale)z.push({property:"og:locale",content:j.ogLocale});let E=j.twitterTitle??j.title,F=j.twitterDescription??j.description,J=j.twitterImage??j.ogImage;if(j.twitterCard)z.push({name:"twitter:card",content:j.twitterCard});if(E)z.push({name:"twitter:title",content:E});if(F)z.push({name:"twitter:description",content:F});if(J)z.push({name:"twitter:image",content:J});if(j.twitterSite)z.push({name:"twitter:site",content:j.twitterSite});if(j.twitterCreator)z.push({name:"twitter:creator",content:j.twitterCreator});if(j.articleAuthor)z.push({property:"article:author",content:j.articleAuthor});if(j.articlePublishedTime)z.push({property:"article:published_time",content:j.articlePublishedTime});if(j.articleModifiedTime)z.push({property:"article:modified_time",content:j.articleModifiedTime});if(j.articleSection)z.push({property:"article:section",content:j.articleSection});if(j.articleTags)for(let L of j.articleTags)z.push({property:"article:tag",content:L});let G=[];if(j.canonical)G.push({rel:"canonical",href:j.canonical});return{title:j.title,titleTemplate:j.titleTemplate,meta:z,link:G}}function S(j){if(O={...O,...j},j.title||j.description)Z({title:j.title,description:j.description})}function P(j){let z=typeof j==="function"?j():j;U({title:z})}function C(j=K){let z=[];if(j.title){let A=j.title;if(j.titleTemplate)A=typeof j.titleTemplate==="function"?j.titleTemplate(A):j.titleTemplate.replace("%s",A);z.push(`<title>${N(A)}</title>`)}if(j.base){let A=Object.entries(j.base).map(([B,E])=>`${B}="${N(E)}"`).join(" ");z.push(`<base ${A}>`)}for(let A of j.meta||[]){let B=Object.entries(A).filter(([E,F])=>F!==void 0).map(([E,F])=>{return`${E==="httpEquiv"?"http-equiv":E}="${N(String(F))}"`}).join(" ");z.push(`<meta ${B}>`)}for(let A of j.link||[]){let B=Object.entries(A).filter(([E,F])=>F!==void 0).map(([E,F])=>`${E}="${N(String(F))}"`).join(" ");z.push(`<link ${B}>`)}for(let A of j.script||[]){let{content:B,...E}=A,F=Object.entries(E).filter(([J,G])=>G!==void 0).map(([J,G])=>{if(typeof G==="boolean")return G?J:"";return`${J}="${N(String(G))}"`}).filter(Boolean).join(" ");if(B)z.push(`<script ${F}>${B}</script>`);else z.push(`<script ${F}></script>`)}for(let A of j.style||[]){let B=A.type?` type="${A.type}"`:"";z.push(`<style${B}>${A.content}</style>`)}return z.join(`
|
|
3
|
-
`)}function M(j=K){if(!j.htmlAttrs)return"";return Object.entries(j.htmlAttrs).map(([z,A])=>`${z}="${N(A)}"`).join(" ")}function V(j=K){if(!j.bodyAttrs)return"";return Object.entries(j.bodyAttrs).map(([z,A])=>`${z}="${N(A)}"`).join(" ")}function N(j){return j.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function w(j=K){if(typeof document>"u")return;if(j.title){let z=j.title;if(j.titleTemplate)z=typeof j.titleTemplate==="function"?j.titleTemplate(z):j.titleTemplate.replace("%s",z);document.title=z}for(let z of j.meta||[]){let A=z.name?`meta[name="${z.name}"]`:z.property?`meta[property="${z.property}"]`:null;if(A){let B=document.querySelector(A);if(!B){if(B=document.createElement("meta"),z.name)B.setAttribute("name",z.name);if(z.property)B.setAttribute("property",z.property);document.head.appendChild(B)}B.setAttribute("content",z.content)}}for(let z of j.link||[]){let A=`link[rel="${z.rel}"]${z.href?`[href="${z.href}"]`:""}`,B=document.querySelector(A);if(!B)B=document.createElement("link"),document.head.appendChild(B);for(let[E,F]of Object.entries(z))if(F!==void 0)B.setAttribute(E,String(F))}if(j.htmlAttrs)for(let[z,A]of Object.entries(j.htmlAttrs))if(z==="class")for(let B of String(A).split(/\s+/).filter(Boolean))document.documentElement.classList.add(B);else document.documentElement.setAttribute(z,A);if(j.bodyAttrs)for(let[z,A]of Object.entries(j.bodyAttrs))document.body.setAttribute(z,A)}function y(j){let z="";return{content:j.replace(/@head\s*([\s\S]*?)@endhead/g,(B,E)=>{return z+=E.trim()+`
|
|
4
|
-
`,""}),headContent:z.trim()}}function x(j,z){return j.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(A,B,E,F)=>{let J=B?E:z[(F||"").trim()]??F,G=z.__stx_runtime_head??{};return z.__stx_runtime_head=Q(G,{title:J}),""})}function T(j,z){return j.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(A,B,E,F,J,G)=>{let L=F?J:G,R=F?L:z[(L||"").trim()]??L,W=E.includes(":")?{property:E,content:R}:{name:E,content:R},X=z.__stx_runtime_head??{};return z.__stx_runtime_head=Q(X,{meta:[W]}),""})}export{I as zu,h as Au,D as Bu,U as Cu,Q as Du,Z as Eu,_ as Fu,S as Gu,P as Hu,C as Iu,M as Ju,V as Ku,w as Lu,y as Mu,x as Nu,T as Ou};
|
package/dist/chunk-xfdckfqr.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Pi as a,Qi as b}from"./chunk-4k0h6sca.js";import"./chunk-xwxdwqn9.js";import"./chunk-79nj87t6.js";import"./chunk-3qc0h6bj.js";import"./chunk-qhnyrwz2.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-ewcxfn7m.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-w764f6g4.js";import"./chunk-18p8dqya.js";import"./chunk-w1dxgs78.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-r7qap4bh.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as getStoreScript,b as clearStoreCache};
|