@stacksjs/stx 0.2.731 → 0.2.733
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-r3b215k4.js → chunk-0k8brc0y.js} +1 -1
- package/dist/{chunk-vba39qx0.js → chunk-0qawc007.js} +1 -1
- package/dist/{chunk-5drnbdj8.js → chunk-0vk8pzv4.js} +1 -1
- package/dist/{chunk-3ynfgvpy.js → chunk-1nmn9czn.js} +3 -3
- package/dist/{chunk-7m06vgxj.js → chunk-2cabhkpn.js} +1 -1
- package/dist/{chunk-ynbqdg6p.js → chunk-2pbwahvy.js} +1 -1
- package/dist/{chunk-mh7wxkpc.js → chunk-31prs86b.js} +4 -4
- package/dist/chunk-34ew8ajd.js +2 -0
- package/dist/{chunk-csfghrwe.js → chunk-3bz50xz2.js} +4 -4
- package/dist/{chunk-94jm76pr.js → chunk-3h9j3yx2.js} +1 -1
- package/dist/{chunk-91km397c.js → chunk-3jj2df6a.js} +2 -2
- package/dist/{chunk-yez7513h.js → chunk-3kfg2ker.js} +1 -1
- package/dist/{chunk-j7471e9y.js → chunk-479hbkh7.js} +1 -1
- package/dist/{chunk-0gv1jjkd.js → chunk-4mnegcaa.js} +1 -1
- package/dist/chunk-4v1y537y.js +2 -0
- package/dist/{chunk-acgpk94p.js → chunk-69q481z2.js} +1 -1
- package/dist/{chunk-70rawzs2.js → chunk-6tt71pnj.js} +2 -2
- package/dist/{chunk-fhbwdk0y.js → chunk-76z18kst.js} +1 -1
- package/dist/{chunk-apznv2mt.js → chunk-77hsgt6f.js} +1 -1
- package/dist/{chunk-h219k9qd.js → chunk-8tbzz5es.js} +1 -1
- package/dist/{chunk-bx7mqza3.js → chunk-9jsbv82n.js} +2 -2
- package/dist/{chunk-4gmc4vm0.js → chunk-9na35ds9.js} +1 -1
- package/dist/chunk-9rnbde3n.js +2 -0
- package/dist/{chunk-qprabe63.js → chunk-a2k2snqg.js} +1 -1
- package/dist/{chunk-vkws6yvd.js → chunk-amtb1c4p.js} +1 -1
- package/dist/{chunk-rhcfdp90.js → chunk-awbypej5.js} +1 -1
- package/dist/{chunk-fzpkf5w7.js → chunk-awjnm4zm.js} +1 -1
- package/dist/{chunk-z00ag8jy.js → chunk-ayfsp80a.js} +1 -1
- package/dist/{chunk-haxzq49z.js → chunk-b497tpkv.js} +1 -1
- package/dist/{chunk-38cas2am.js → chunk-b71gpq0p.js} +3 -3
- package/dist/{chunk-r7vtb2pc.js → chunk-denda8ez.js} +1 -1
- package/dist/{chunk-r4y0p0m1.js → chunk-djamgzzc.js} +5 -5
- package/dist/{chunk-152dg4h2.js → chunk-dnhrkftc.js} +1 -1
- package/dist/chunk-edkfa1zn.js +2 -0
- package/dist/{chunk-33s441gw.js → chunk-gk4kmqd7.js} +1 -1
- package/dist/{chunk-kd4fjgz5.js → chunk-hwth34q3.js} +1 -1
- package/dist/{chunk-qnpfkdea.js → chunk-j6a01a4f.js} +1 -1
- package/dist/chunk-j73adwcq.js +2 -0
- package/dist/{chunk-09ty695q.js → chunk-jjhhee2e.js} +1 -1
- package/dist/chunk-k3w76e36.js +2 -0
- package/dist/{chunk-4c27r05w.js → chunk-kabff5cq.js} +5 -5
- package/dist/{chunk-qsksxtn7.js → chunk-kdhy75b3.js} +2 -2
- package/dist/{chunk-zcktxs74.js → chunk-kn8s5374.js} +1 -1
- package/dist/{chunk-msb3q876.js → chunk-krawfkhh.js} +1 -1
- package/dist/chunk-nbmm30dk.js +2 -0
- package/dist/{chunk-mq8tmepp.js → chunk-nef9c96n.js} +1 -1
- package/dist/{chunk-cm7h9f3y.js → chunk-p4s4h4vk.js} +1 -1
- package/dist/{chunk-028w2zsn.js → chunk-pjc853dg.js} +57 -57
- package/dist/{chunk-k86adw4s.js → chunk-qgd0grrh.js} +1 -1
- package/dist/{chunk-3m5kbph6.js → chunk-qnje980z.js} +1 -1
- package/dist/{chunk-t7dnt01m.js → chunk-qwjbt8eq.js} +1 -1
- package/dist/chunk-rjfvf9wg.js +3 -0
- package/dist/chunk-s1vrppt9.js +2 -0
- package/dist/{chunk-2md9ffgh.js → chunk-t2hhb472.js} +1 -1
- package/dist/{chunk-ck04vpy8.js → chunk-t4wrkxtd.js} +1 -1
- package/dist/{chunk-16jn5hdg.js → chunk-tmxapwrn.js} +1 -1
- package/dist/chunk-v8c9g9ej.js +2 -0
- package/dist/{chunk-v1rpc5ap.js → chunk-v9e078mp.js} +1 -1
- package/dist/{chunk-6qxyrafx.js → chunk-w1sbdn9p.js} +2 -2
- package/dist/{chunk-s5sf1pyq.js → chunk-wa5b9h31.js} +1 -1
- package/dist/{chunk-3x4q1014.js → chunk-xybg6p62.js} +1 -1
- package/dist/{chunk-z8s83g6g.js → chunk-ymdkx2aj.js} +1 -1
- package/dist/chunk-zdd095t7.js +2 -0
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/dist/utils.d.ts +0 -9
- package/dist/utils.js +14 -2
- package/package.json +5 -5
- package/dist/chunk-42ryy009.js +0 -2
- package/dist/chunk-4xvt5tkt.js +0 -2
- package/dist/chunk-6hpx7070.js +0 -2
- package/dist/chunk-8shya0zr.js +0 -2
- package/dist/chunk-b7s7sxqj.js +0 -2
- package/dist/chunk-exsx47p8.js +0 -2
- package/dist/chunk-h4gehmrp.js +0 -2
- package/dist/chunk-k29p6g0h.js +0 -2
- package/dist/chunk-m2aksmz2.js +0 -2
- package/dist/chunk-re5vaz0d.js +0 -3
- package/dist/chunk-ym46qt2x.js +0 -2
package/dist/ssg.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-1xjv71dw.js";import{b,Fc}from"./chunk-zkx2m308.js";import"./chunk-ez35607j.js";import"./chunk-zn3c0ew5.js";import{Tt,S}from"./chunk-
|
|
2
|
+
import"./chunk-1xjv71dw.js";import{b,Fc}from"./chunk-zkx2m308.js";import"./chunk-ez35607j.js";import"./chunk-zn3c0ew5.js";import{Tt,S}from"./chunk-pjc853dg.js";import"./chunk-rbmt5w9v.js";import"./chunk-v9e078mp.js";import"./chunk-4c86wr9a.js";import{xt,St,kt,_t,Ct,Et}from"./chunk-2mqzpzy7.js";import{a}from"./chunk-6tt71pnj.js";import{ms}from"./chunk-q7fh1xka.js";import"./chunk-3fwdxxh1.js";import"./chunk-wa5b9h31.js";import{Te,Yt,Zt}from"./chunk-hwth34q3.js";import"./chunk-8tbzz5es.js";import{y}from"./chunk-w1sbdn9p.js";import{mt,i}from"./chunk-djamgzzc.js";import"./chunk-0k8brc0y.js";import"./chunk-3bz50xz2.js";import"./chunk-9jsbv82n.js";import"./chunk-4mnegcaa.js";import"./chunk-x9wwd2ee.js";import{Ma,La,ja}from"./chunk-dmnncw90.js";import{Xt,Gn,Xn}from"./chunk-9adx6f4k.js";import{Jt}from"./chunk-77hsgt6f.js";import"./chunk-rjfvf9wg.js";import"./chunk-r3j4m04w.js";import{G,be}from"./chunk-31prs86b.js";import"./chunk-m5nzpjej.js";import"./chunk-jjhhee2e.js";import{l}from"./chunk-qc93ce5h.js";import{s,ge}from"./chunk-05qf3e2p.js";import D from"fs";import h 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 ot(t,r={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let o=new Map,n=t.replace(Dt,(e,u,f,v)=>{let w=v.trim();if(!w)return e;if(/\bdata-stx-src=/.test(f))return e;if(r.minify)w=$t(w);let g=Rt(w);if(!o.has(g))o.set(g,w);let P=r.integrity?` data-stx-integrity="sha384-${Pt("sha384").update(w).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${g}.js"${P}${f}></script>`}),c=Array.from(o,([e,u])=>({hash:e,code:u}));return{html:n,chunks:c}}var It=new Set(["visible","idle"]);function ct(t){if(!t.includes("data-stx-src="))return t;let r=new Map,o=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,n;while((n=o.exec(t))!==null)r.set(n[1],n[2]);let c=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=e.exec(t))!==null)if(It.has(r.get(u[1])||""))c.add(u[2]);let f=/<\/head\s*>/iy,v=S(t,(g,P)=>(f.lastIndex=P,f.exec(g)?f.lastIndex:-1))[0]?.start??-1;if(c.size===0||v===-1)return t;let w=Array.from(c).filter((g)=>!t.includes(`rel="prefetch" href="${g}"`)).map((g)=>`<link rel="prefetch" href="${g}" as="script">`).join("");if(!w)return t;return t.slice(0,v)+w+t.slice(v)}var Bt=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function X(t){let r=t.trim();if(!r)return null;let o=/^https?:\/\//i.test(r)?r:`https://${r}`;try{return new URL(o).origin+new URL(o).pathname.replace(/\/$/,"")}catch{return null}}function jt(t){for(let r of Bt){let o=t[r];if(!o)continue;let n=X(o);if(n)return{url:n,source:"env",via:r}}return null}function lt(t){if(!t||typeof t!=="object")return null;let r=t,o=r.site?.url??r.url??r.app?.url;return typeof o==="string"?X(o):null}async function Ft(t){let{existsSync:r}=await import("fs"),o=await import("path");for(let n of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=o.resolve(t,n);if(!r(c))continue;try{let e=await import(c),u=lt(e.default??e);if(u)return u}catch{}}return null}async function ut(t={}){let r=t.cwd??process.cwd(),o=t.env??process.env;if(t.explicit){let u=X(t.explicit);if(u)return{url:u,source:"option"}}let n=lt(t.stxConfig);if(n)return{url:n,source:"stx.config",via:"site.url"};let c=await Ft(r);if(c)return{url:c,source:"site.config",via:"url"};let e=jt(o);if(e)return e;return{url:"http://localhost",source:"fallback"}}function dt(){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 J(t){return async()=>({paths:await t(),fallback:!1})}var At;function Ot(t){let r=s(t),{depths:o}=ge(r),n=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,c;while((c=n.exec(r))!==null){if(o[c.index]!==0)continue;let u=b(r,"(",")",n.lastIndex-1),f=r.indexOf("{",u+1),v=b(r,"{","}",f);if(u<0||f<0||v<0)break;return t.slice(c.index,v+1)}let e=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((c=e.exec(r))!==null){if(o[c.index]!==0)continue;let u=Fc(r,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 gt(t){let r="read";try{let o=await Bun.file(t).text();r="parse";let n=Jt(o),c=[...n.server,...n.client,...n.signals].filter((e)=>/(?:^|\s)server(?:\s|=|$)/i.test(s(e.attrs))).sort((e,u)=>o.indexOf(e.fullTag)-o.indexOf(u.fullTag));for(let e of c){if(!/\bgetStaticPaths\b/.test(s(e.content)))continue;let u=(At??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(e.content);if(!/\bgetStaticPaths\b/.test(s(u)))continue;let f=Ot(u);if(/\bdefineStaticPaths\b/.test(s(f))&&Tt(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");r="execute";let v=Function("defineStaticPaths",`return (${f})`)(J);if(typeof v!=="function")throw TypeError("getStaticPaths must be a function");let w=await v();r="result";let g=Array.isArray(w)?{paths:w}:w;if(!g||typeof g!=="object"||!("paths"in g)||!Array.isArray(g.paths))throw TypeError("getStaticPaths must return { paths: [...] } or an array of paths");for(let P of g.paths)if(!P||typeof P!=="object"||!P.params||typeof P.params!=="object"||Array.isArray(P.params))throw TypeError("Each getStaticPaths path must contain a params object");return{kind:"ok",value:g}}return{kind:"absent"}}catch(o){return{kind:"error",phase:r,error:o instanceof Error?o:Error(String(o))}}}class pt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,r=""){this.cacheDir=t,this.salt=r}async load(){if(this.loaded)return;let t=h.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let r=JSON.parse(await Bun.file(t).text());for(let[o,n]of Object.entries(r))this.cache.set(o,n)}catch{}this.loaded=!0}async save(){await D.promises.mkdir(this.cacheDir,{recursive:!0});let t=h.join(this.cacheDir,"build-cache.json"),r={};for(let[o,n]of this.cache)r[o]=n;await Bun.write(t,JSON.stringify(r))}getHash(t,r){let o=D.statSync(t),n=`${this.salt}|${t}:${o.mtimeMs}`;for(let e of r)if(D.existsSync(e)){let u=D.statSync(e);n+=`:${e}:${u.mtimeMs}`}let c=0;for(let e=0;e<n.length;e++){let u=n.charCodeAt(e);c=(c<<5)-c+u,c=c&c}return Math.abs(c).toString(36)}get(t,r){let o=this.cache.get(t);if(!o)return null;let n=this.getHash(r,o.dependencies??[]);if(o.hash!==n)return this.cache.delete(t),null;return o.html}set(t,r,o,n){let c=this.getHash(r,o);this.cache.set(t,{hash:c,html:n,generatedAt:Date.now(),dependencies:o})}}class ht{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let r=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return h.join(this.cacheDir,"isr",r)}async get(t){let r=this.getFilePath(t);if(!await Bun.file(r).exists())return null;try{return JSON.parse(await Bun.file(r).text())}catch{return null}}async set(t,r){let o=this.getFilePath(t);await D.promises.mkdir(h.dirname(o),{recursive:!0}),await Bun.write(o,JSON.stringify(r))}async invalidate(t){let r=this.getFilePath(t);if(await Bun.file(r).exists())await D.promises.unlink(r)}async invalidatePattern(t){let r=h.join(this.cacheDir,"isr");if(!D.existsSync(r))return;let o=await D.promises.readdir(r);for(let n of o){let c=n.replace(/_/g,"/").replace(".json","");if(t.test(c))await D.promises.unlink(h.join(r,n))}}async needsRevalidation(t){let r=await this.get(t);if(!r)return!0;return Date.now()>r.revalidateAfter}}async function Lt(t){let r=[];if(!t.isDynamic)r.push({url:t.pattern,params:{}});else{let o=await gt(t.filePath);if(o.kind==="error")throw Error(`getStaticPaths ${o.phase} failed for ${t.pattern} (${t.filePath}): ${o.error.message}`,{cause:o.error});if(o.kind==="absent")return console.warn(`Warning: Dynamic route ${t.pattern} (${t.filePath}) has no getStaticPaths`),r;let n=o.value;if(n.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${t.pattern} (${t.filePath})`),r;for(let c of n.paths){let e=t.pattern;for(let[u,f]of Object.entries(c.params))e=e.replace(`:${u}`,f).replace(`:${u}*`,f);r.push({url:e,params:c.params,props:c.props,revalidate:c.revalidate})}}return r}async function Ut(t){let r=[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"];for(let o of r)if(await Bun.file(o).exists())try{let n=await import(o);if(typeof n.default==="function")return await n.default();else if(typeof n.default==="object")return n.default;else if(typeof n.getData==="function")return await n.getData();else{let{default:c,...e}=n;return e}}catch(n){console.error(`Error loading data file ${o}:`,n)}return null}async function Mt(t,r,o){let n=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!n)return null;let c=n[1];if(!c.includes("getStaticProps"))return null;try{let e=c.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!e)return null;return await Function("params",`
|
|
4
4
|
return (async function getStaticProps() {
|
|
5
5
|
${e[1]}
|
|
@@ -37,7 +37,7 @@ ${t.map((n)=>{let c=new URL(n.loc,r).href,e=` <url>
|
|
|
37
37
|
${o.join(`
|
|
38
38
|
`)}
|
|
39
39
|
</channel>
|
|
40
|
-
</rss>`}async function Vt(t={}){let r=Date.now();Zt();let o=await a(process.cwd()),n=o.build||{},c=await ut({explicit:t.domain||n.domain,stxConfig:o});if(c.source==="fallback"&&(t.sitemap??n.sitemap??!0))console.warn(dt());let e={router:t.router??o?.router??{},pagesDir:t.pagesDir||n.pagesDir||"pages",outputDir:t.outputDir||n.outputDir||"dist",baseUrl:t.baseUrl||n.baseUrl||"/",domain:c.url,revalidate:t.revalidate??n.revalidate??!1,sitemap:t.sitemap??n.sitemap??!0,sitemapExclude:t.sitemapExclude||n.sitemapExclude||[],robots:t.robots??n.robots??!0,rss:t.rss??n.rss??!1,concurrency:t.concurrency||n.concurrency||10,cache:t.cache??n.cache??!0,cacheDir:t.cacheDir||n.cacheDir||l(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??n.minify??!0,generate404:t.generate404??n.generate404??!0,publicDir:t.publicDir||n.publicDir||"public",trailingSlash:t.trailingSlash??n.trailingSlash??!1,cleanOutput:t.cleanOutput??n.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||o?.partialsDir||"",componentsDir:t.componentsDir||o?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},u={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},f=new Set,v=0,w={},g={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&D.existsSync(e.outputDir))await D.promises.rm(e.outputDir,{recursive:!0});await D.promises.mkdir(e.outputDir,{recursive:!0});let E=e.cacheSalt;if(!E){let{resolveUserCssConfig:d,fingerprintConfig:m}=await import("./chunk-
|
|
40
|
+
</rss>`}async function Vt(t={}){let r=Date.now();Zt();let o=await a(process.cwd()),n=o.build||{},c=await ut({explicit:t.domain||n.domain,stxConfig:o});if(c.source==="fallback"&&(t.sitemap??n.sitemap??!0))console.warn(dt());let e={router:t.router??o?.router??{},pagesDir:t.pagesDir||n.pagesDir||"pages",outputDir:t.outputDir||n.outputDir||"dist",baseUrl:t.baseUrl||n.baseUrl||"/",domain:c.url,revalidate:t.revalidate??n.revalidate??!1,sitemap:t.sitemap??n.sitemap??!0,sitemapExclude:t.sitemapExclude||n.sitemapExclude||[],robots:t.robots??n.robots??!0,rss:t.rss??n.rss??!1,concurrency:t.concurrency||n.concurrency||10,cache:t.cache??n.cache??!0,cacheDir:t.cacheDir||n.cacheDir||l(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??n.minify??!0,generate404:t.generate404??n.generate404??!0,publicDir:t.publicDir||n.publicDir||"public",trailingSlash:t.trailingSlash??n.trailingSlash??!1,cleanOutput:t.cleanOutput??n.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||o?.partialsDir||"",componentsDir:t.componentsDir||o?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},u={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},f=new Set,v=0,w={},g={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&D.existsSync(e.outputDir))await D.promises.rm(e.outputDir,{recursive:!0});await D.promises.mkdir(e.outputDir,{recursive:!0});let E=e.cacheSalt;if(!E){let{resolveUserCssConfig:d,fingerprintConfig:m}=await import("./chunk-xybg6p62.js");try{E=m(await d(process.cwd()))}catch{}}let{prepareImageDelivery:x}=await import("./chunk-ymdkx2aj.js"),R=await x(e.publicDir,e.outputDir);if(R.count>0)console.log(`Optimized ${R.count} image(s) for responsive delivery`),E=[E,R.fingerprint].filter(Boolean).join(":");let T=new pt(e.cacheDir,E);if(e.cache)await T.load();try{let{generateCss:d}=await import("./chunk-xybg6p62.js");await d('<div class="bg-black"></div>')}catch{}xt();let wt=o?.routeMiddleware?.dir||"middleware";await kt(process.cwd(),wt);let V=St();if(V.length>0)console.log(`Loaded ${V.length} middleware: ${V.join(", ")}`);let yt=o?.routeMiddleware?.global||[];ja(o?.layoutsDir,l(process.cwd()));let Z=G(".",{pagesDir:e.pagesDir,pagesDirs:o?._layerPageDirs});console.log(`Found ${Z.length} routes`);let M=[];for(let d of Z)try{let m=await Lt(d);for(let k of m)M.push({route:d,url:k.url,params:k.params,props:k.props,revalidate:k.revalidate??e.revalidate})}catch(m){let k=m instanceof Error?m:Error(String(m));u.failedCount++,u.errors.push({route:d.pattern,error:k}),await e.hooks.onError?.(k,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,k)}u.totalPages=M.length+u.failedCount,console.log(`Generating ${M.length} pages...`);let _=[],Q=[];for(let d=0;d<M.length;d+=e.concurrency)Q.push(M.slice(d,d+e.concurrency));for(let d of Q)await Promise.all(d.map(async(m)=>{let{route:k,url:p,params:N,props:bt,revalidate:rt}=m;try{await e.hooks.onPageStart?.(p);let A=await Bun.file(k.filePath).text(),O=te(A),vt=O?.middleware?Array.isArray(O.middleware)?O.middleware:[O.middleware]:[],nt=[...yt,...vt];if(nt.length>0){let B=_t(p,N,O||{}),L=Ct(B,null,void 0,{isServer:!0}),j=await Et(nt,L);if(j.redirect){let C=typeof j.redirect==="string"?j.redirect:j.redirect.path||j.redirect,z=ee(String(C),p),U=re(p,e);await D.promises.mkdir(h.dirname(U),{recursive:!0}),await Bun.write(U,z),u.successCount++,u.pages.push({route:p,outputPath:U,size:Buffer.byteLength(z),cached:!1}),_.push({loc:p,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${p} \u2192 redirect to ${C}`);return}if(j.abort){let C=typeof j.abort==="string"?j.abort:j.abort?.error?.message||"aborted";console.warn(` \u21B3 ${p} \u2014 middleware aborted: ${C}`);return}}let it=A.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(it)try{if(!await Function("route",`
|
|
41
41
|
const validate = ${it[1]};
|
|
42
42
|
return validate(route);
|
|
43
43
|
`)({params:N})){console.warn(`Validation failed for ${p}, skipping...`);return}}catch{}let I=null,st=!1;if(e.cache){if(I=T.get(p,k.filePath),I)st=!0,u.cachedCount++}if(!I){let B=await ft(k,N,bt,e,o);if(I=B.html,e.failOnIncludeError&&B.includeFailures.length>0)throw Error(`${B.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
|
package/dist/utils.d.ts
CHANGED
|
@@ -38,15 +38,6 @@ export declare function transpileTypeScript(code: string): string;
|
|
|
38
38
|
* of its kind at the top level, closing at the end.
|
|
39
39
|
*/
|
|
40
40
|
export declare function scopeOnRootElement(html: string, attrs: string): string | null;
|
|
41
|
-
/**
|
|
42
|
-
* Does a project-authored component file exist for `componentPath`?
|
|
43
|
-
*
|
|
44
|
-
* Used to let a user component (e.g. `components/Icon.stx`) take precedence
|
|
45
|
-
* over a built-in component of the same name (e.g. the Lucide `Icon`). It
|
|
46
|
-
* mirrors the primary search directories used by `renderComponentWithSlot`
|
|
47
|
-
* but deliberately EXCLUDES stx's own built-in components directory — a
|
|
48
|
-
* built-in shipping its own `.stx` file must not count as a user override.
|
|
49
|
-
*/
|
|
50
41
|
export declare function userComponentFileExists(componentPath: string, componentsDir: string, parentContext: Record<string, unknown>, parentFilePath: string, options: StxOptions): Promise<boolean>;
|
|
51
42
|
/**
|
|
52
43
|
* Whether a `client="..."` value is a deferring island trigger (#1746).
|
package/dist/utils.js
CHANGED
|
@@ -535,6 +535,14 @@ export function scopeOnRootElement(html, attrs) {
|
|
|
535
535
|
const insertAt = opening[0].length;
|
|
536
536
|
return html.slice(0, insertAt) + attrs + html.slice(insertAt);
|
|
537
537
|
}
|
|
538
|
+
function isInsideFrameworkComponentsDir(dir, options) {
|
|
539
|
+
if (!dir)
|
|
540
|
+
return !1;
|
|
541
|
+
return [...options.additionalComponentsDirs ?? [], ...options.fallbackComponentsDir ? [options.fallbackComponentsDir] : []].some((root) => {
|
|
542
|
+
const relativeDir = path.relative(path.resolve(root), path.resolve(dir));
|
|
543
|
+
return !relativeDir.startsWith("..") && !path.isAbsolute(relativeDir);
|
|
544
|
+
});
|
|
545
|
+
}
|
|
538
546
|
export async function userComponentFileExists(componentPath, componentsDir, parentContext, parentFilePath, options) {
|
|
539
547
|
const baseName = componentPath.endsWith(".stx") ? componentPath.slice(0, -4) : componentPath, kebabToPascal = (str) => str.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(""), importedComponents = parentContext.__importedComponents;
|
|
540
548
|
if (importedComponents) {
|
|
@@ -548,6 +556,8 @@ export async function userComponentFileExists(componentPath, componentsDir, pare
|
|
|
548
556
|
}, originalFilePath = parentContext.__originalFilePath;
|
|
549
557
|
if (originalFilePath)
|
|
550
558
|
push(path.join(path.dirname(originalFilePath), "components"));
|
|
559
|
+
if (isInsideFrameworkComponentsDir(componentsDir, options))
|
|
560
|
+
push(options._rootComponentsDir);
|
|
551
561
|
push(componentsDir);
|
|
552
562
|
push(options._rootComponentsDir);
|
|
553
563
|
push(path.join(path.dirname(parentFilePath), "components"));
|
|
@@ -698,9 +708,11 @@ export async function renderComponentWithSlot(componentPath, props, slotContent,
|
|
|
698
708
|
const originalDir = path.join(path.dirname(originalFilePath), "components");
|
|
699
709
|
searchDirs.push(originalDir);
|
|
700
710
|
}
|
|
701
|
-
if (componentsDir)
|
|
702
|
-
searchDirs.push(componentsDir);
|
|
703
711
|
const rootComponentsDir = options._rootComponentsDir;
|
|
712
|
+
if (typeof rootComponentsDir === "string" && isInsideFrameworkComponentsDir(componentsDir, options) && !searchDirs.includes(rootComponentsDir))
|
|
713
|
+
searchDirs.push(rootComponentsDir);
|
|
714
|
+
if (componentsDir && !searchDirs.includes(componentsDir))
|
|
715
|
+
searchDirs.push(componentsDir);
|
|
704
716
|
if (typeof rootComponentsDir === "string" && !searchDirs.includes(rootComponentsDir))
|
|
705
717
|
searchDirs.push(rootComponentsDir);
|
|
706
718
|
const parentRelative = path.join(path.dirname(parentFilePath), "components");
|
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.733",
|
|
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.733",
|
|
132
|
+
"@stacksjs/sanitizer": "0.2.733",
|
|
133
133
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
134
|
-
"bun-plugin-stx": "0.2.
|
|
134
|
+
"bun-plugin-stx": "0.2.733",
|
|
135
135
|
"bunfig": "^0.15.21",
|
|
136
|
-
"stx-router": "0.2.
|
|
136
|
+
"stx-router": "0.2.733",
|
|
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-42ryy009.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Zn,i}from"./chunk-r4y0p0m1.js";import"./chunk-6qxyrafx.js";import"./chunk-x9wwd2ee.js";import"./chunk-0gv1jjkd.js";import"./chunk-csfghrwe.js";import"./chunk-r3b215k4.js";import"./chunk-re5vaz0d.js";import"./chunk-r3j4m04w.js";import"./chunk-bx7mqza3.js";import{be}from"./chunk-mh7wxkpc.js";import"./chunk-m5nzpjej.js";import"./chunk-h219k9qd.js";import"./chunk-70rawzs2.js";import"./chunk-09ty695q.js";import"./chunk-4c86wr9a.js";import"./chunk-3fwdxxh1.js";import"./chunk-q7fh1xka.js";import"./chunk-2mqzpzy7.js";import{Ie,As,Ps}from"./chunk-028w2zsn.js";import"./chunk-v1rpc5ap.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{Zn as buildModulesTag,be as injectRouterScript,i as processDirectives,As as processJsonDirective,Ps as processOnceDirective,Ie as validateClientScript};
|
package/dist/chunk-4xvt5tkt.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Rg}from"./chunk-4gmc4vm0.js";import"./chunk-3ynfgvpy.js";import"./chunk-755wsp41.js";import"./chunk-apznv2mt.js";import"./chunk-s5sf1pyq.js";import"./chunk-r4y0p0m1.js";import"./chunk-6qxyrafx.js";import"./chunk-x9wwd2ee.js";import"./chunk-0gv1jjkd.js";import"./chunk-csfghrwe.js";import"./chunk-r3b215k4.js";import"./chunk-re5vaz0d.js";import"./chunk-r3j4m04w.js";import"./chunk-bx7mqza3.js";import"./chunk-mh7wxkpc.js";import"./chunk-m5nzpjej.js";import"./chunk-h219k9qd.js";import"./chunk-70rawzs2.js";import"./chunk-09ty695q.js";import"./chunk-4c86wr9a.js";import"./chunk-3fwdxxh1.js";import"./chunk-q7fh1xka.js";import"./chunk-2mqzpzy7.js";import"./chunk-028w2zsn.js";import"./chunk-v1rpc5ap.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{Rg as buildForProduction};
|
package/dist/chunk-6hpx7070.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{cl,ll}from"./chunk-4c27r05w.js";import"./chunk-zcktxs74.js";import"./chunk-16jn5hdg.js";import"./chunk-3xyvc3g1.js";import"./chunk-3e40sm05.js";import"./chunk-msb3q876.js";import"./chunk-f2c3t1ky.js";import"./chunk-4gmc4vm0.js";import"./chunk-3ynfgvpy.js";import"./chunk-74fepz6h.js";import"./chunk-serrx31a.js";import"./chunk-yez7513h.js";import"./chunk-rj4j7qcj.js";import"./chunk-33s441gw.js";import"./chunk-39nkd53v.js";import"./chunk-hnqpqtk2.js";import"./chunk-x5dc06p5.js";import"./chunk-fzpkf5w7.js";import"./chunk-mwxbdpb1.js";import"./chunk-haxzq49z.js";import"./chunk-8fazd6fr.js";import"./chunk-pd89jnqk.js";import"./chunk-fsz9k5k0.js";import"./chunk-72hfqwvk.js";import"./chunk-78x8qfvt.js";import"./chunk-y3w2rc1y.js";import"./chunk-acgpk94p.js";import"./chunk-94jm76pr.js";import"./chunk-755wsp41.js";import"./chunk-91km397c.js";import"./chunk-hez09ssh.js";import"./chunk-dmnncw90.js";import{Jt}from"./chunk-apznv2mt.js";import"./chunk-kd4fjgz5.js";import"./chunk-s5sf1pyq.js";import"./chunk-1xjv71dw.js";import{Re,i}from"./chunk-r4y0p0m1.js";import"./chunk-6qxyrafx.js";import"./chunk-x9wwd2ee.js";import"./chunk-0gv1jjkd.js";import"./chunk-csfghrwe.js";import"./chunk-r3b215k4.js";import"./chunk-re5vaz0d.js";import"./chunk-r3j4m04w.js";import"./chunk-bx7mqza3.js";import{be}from"./chunk-mh7wxkpc.js";import"./chunk-m5nzpjej.js";import{ir,ar}from"./chunk-h219k9qd.js";import{ls,j,a}from"./chunk-70rawzs2.js";import"./chunk-09ty695q.js";import"./chunk-4c86wr9a.js";import"./chunk-3fwdxxh1.js";import"./chunk-q7fh1xka.js";import"./chunk-2mqzpzy7.js";import{m,Me}from"./chunk-028w2zsn.js";import"./chunk-v1rpc5ap.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";import"./chunk-62awa752.js";import"./chunk-d9hw6n2d.js";export{ls as buildWebComponents,ar as cacheTemplate,ir as checkCache,Jt as classifyAllScripts,cl as createMiddleware,ll as createRoute,j as defaultConfig,m as extractVariables,be as injectRouterScript,a as loadStxConfig,Me as processClientScript,i as processDirectives,Re as readMarkdownFile};
|
package/dist/chunk-8shya0zr.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{bl,qi,Cg,vl,wl,Eg,Tg}from"./chunk-msb3q876.js";import"./chunk-94jm76pr.js";import"./chunk-kd4fjgz5.js";import"./chunk-s5sf1pyq.js";import"./chunk-1xjv71dw.js";import"./chunk-bx7mqza3.js";import"./chunk-mh7wxkpc.js";import"./chunk-m5nzpjej.js";import"./chunk-70rawzs2.js";import"./chunk-09ty695q.js";import"./chunk-4c86wr9a.js";import"./chunk-3fwdxxh1.js";import"./chunk-q7fh1xka.js";import"./chunk-2mqzpzy7.js";import{At,Of}from"./chunk-028w2zsn.js";import"./chunk-v1rpc5ap.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{bl as buildVirtualSource,At as extractScriptBlocks,Of as extractTemplateExpressions,vl as findRuntimeTypeDeclarations,wl as findStxModuleDeclarations,Tg as formatTypecheckDiagnostics,Cg as sourcePathFor,Eg as typecheckStxFiles,qi as virtualPathFor};
|
package/dist/chunk-b7s7sxqj.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{wg}from"./chunk-zcktxs74.js";import"./chunk-r4y0p0m1.js";import"./chunk-6qxyrafx.js";import"./chunk-x9wwd2ee.js";import"./chunk-0gv1jjkd.js";import"./chunk-csfghrwe.js";import"./chunk-r3b215k4.js";import"./chunk-re5vaz0d.js";import"./chunk-r3j4m04w.js";import"./chunk-bx7mqza3.js";import"./chunk-mh7wxkpc.js";import"./chunk-m5nzpjej.js";import"./chunk-h219k9qd.js";import"./chunk-70rawzs2.js";import"./chunk-09ty695q.js";import"./chunk-4c86wr9a.js";import"./chunk-3fwdxxh1.js";import"./chunk-q7fh1xka.js";import"./chunk-2mqzpzy7.js";import"./chunk-028w2zsn.js";import"./chunk-v1rpc5ap.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{wg as startInteractive};
|
package/dist/chunk-exsx47p8.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Yr,nr,gf}from"./chunk-0gv1jjkd.js";import"./chunk-r3j4m04w.js";import"./chunk-bx7mqza3.js";import"./chunk-mh7wxkpc.js";import"./chunk-m5nzpjej.js";import"./chunk-70rawzs2.js";import"./chunk-09ty695q.js";import"./chunk-4c86wr9a.js";import"./chunk-3fwdxxh1.js";import"./chunk-q7fh1xka.js";import"./chunk-2mqzpzy7.js";import{Rt}from"./chunk-028w2zsn.js";import"./chunk-v1rpc5ap.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{gf as declareBareLoopHead,Rt as parseLoopBinding,nr as processLoops,Yr as reportDeferredLoopWarnings};
|
package/dist/chunk-h4gehmrp.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{so,Nm,Dm}from"./chunk-94jm76pr.js";import"./chunk-kd4fjgz5.js";import"./chunk-s5sf1pyq.js";import"./chunk-1xjv71dw.js";import"./chunk-bx7mqza3.js";import"./chunk-mh7wxkpc.js";import"./chunk-m5nzpjej.js";import"./chunk-70rawzs2.js";import"./chunk-09ty695q.js";import"./chunk-4c86wr9a.js";import"./chunk-3fwdxxh1.js";import"./chunk-q7fh1xka.js";import"./chunk-2mqzpzy7.js";import"./chunk-028w2zsn.js";import"./chunk-v1rpc5ap.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{Dm as clearComposableCache,Nm as getComposableScript,so as listComposableModules};
|
package/dist/chunk-k29p6g0h.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{xg}from"./chunk-16jn5hdg.js";import"./chunk-3ynfgvpy.js";import"./chunk-apznv2mt.js";import"./chunk-s5sf1pyq.js";import"./chunk-re5vaz0d.js";import"./chunk-mh7wxkpc.js";import"./chunk-70rawzs2.js";import"./chunk-09ty695q.js";import"./chunk-4c86wr9a.js";import"./chunk-3fwdxxh1.js";import"./chunk-q7fh1xka.js";import"./chunk-2mqzpzy7.js";import"./chunk-028w2zsn.js";import"./chunk-v1rpc5ap.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{xg as startProductionServer};
|
package/dist/chunk-m2aksmz2.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Im,Om}from"./chunk-acgpk94p.js";import"./chunk-kd4fjgz5.js";import"./chunk-s5sf1pyq.js";import"./chunk-1xjv71dw.js";import"./chunk-bx7mqza3.js";import"./chunk-mh7wxkpc.js";import"./chunk-m5nzpjej.js";import"./chunk-70rawzs2.js";import"./chunk-09ty695q.js";import"./chunk-4c86wr9a.js";import"./chunk-3fwdxxh1.js";import"./chunk-q7fh1xka.js";import"./chunk-2mqzpzy7.js";import"./chunk-028w2zsn.js";import"./chunk-v1rpc5ap.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{Om as clearStoreCache,Im as getStoreScript};
|
package/dist/chunk-re5vaz0d.js
DELETED
package/dist/chunk-ym46qt2x.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{la,ua,da,pa,qm}from"./chunk-j7471e9y.js";import"./chunk-4hv1camf.js";import"./chunk-91km397c.js";import"./chunk-hez09ssh.js";import"./chunk-r4y0p0m1.js";import"./chunk-6qxyrafx.js";import"./chunk-x9wwd2ee.js";import"./chunk-0gv1jjkd.js";import"./chunk-csfghrwe.js";import"./chunk-r3b215k4.js";import"./chunk-re5vaz0d.js";import"./chunk-r3j4m04w.js";import"./chunk-bx7mqza3.js";import"./chunk-mh7wxkpc.js";import"./chunk-m5nzpjej.js";import"./chunk-h219k9qd.js";import"./chunk-70rawzs2.js";import"./chunk-09ty695q.js";import"./chunk-4c86wr9a.js";import"./chunk-3fwdxxh1.js";import"./chunk-q7fh1xka.js";import"./chunk-2mqzpzy7.js";import"./chunk-028w2zsn.js";import"./chunk-v1rpc5ap.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{la as buildNative,qm as default,ua as findCraftBinary,pa as getAvailableFormats,da as getAvailableTargets};
|