@stacksjs/stx 0.2.420 → 0.2.422
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-wynvh7dc.js → chunk-1569v24d.js} +1 -1
- package/dist/{chunk-cw6j75ck.js → chunk-1r0c5920.js} +2 -2
- package/dist/{chunk-6aqcgrhw.js → chunk-2cn8krpp.js} +1 -1
- package/dist/{chunk-8j8k27xb.js → chunk-3xm6dyab.js} +30 -7
- package/dist/chunk-4363reg4.js +2 -0
- package/dist/{chunk-bvbank3z.js → chunk-48axv7bm.js} +1 -1
- package/dist/{chunk-dscsvkfa.js → chunk-50hgr79y.js} +1 -1
- package/dist/chunk-54wczcee.js +2 -0
- package/dist/{chunk-rj3hyqff.js → chunk-597rfddk.js} +34 -34
- package/dist/{chunk-4e101kjp.js → chunk-5e9zkd65.js} +1 -1
- package/dist/{chunk-r8wze9ym.js → chunk-681cxw8j.js} +2 -2
- package/dist/{chunk-p7b17yr0.js → chunk-74gz26zs.js} +1 -1
- package/dist/{chunk-32y3767j.js → chunk-788g87ft.js} +1 -1
- package/dist/{chunk-y8rpk1b9.js → chunk-7906p8zs.js} +1 -1
- package/dist/{chunk-014gmm8w.js → chunk-7abgzdsm.js} +1 -1
- package/dist/{chunk-vwxasbtx.js → chunk-7dkfjmjw.js} +1 -1
- package/dist/{chunk-89e1d0rz.js → chunk-7vr5w75r.js} +2 -2
- package/dist/{chunk-ncvfjcr2.js → chunk-7zn0yyqk.js} +1 -1
- package/dist/{chunk-10967rws.js → chunk-837nb4zv.js} +1 -1
- package/dist/{chunk-s0pmn48x.js → chunk-8d2kamh2.js} +1 -1
- package/dist/{chunk-z521cyfv.js → chunk-95e3rz88.js} +2 -2
- package/dist/chunk-9bpnz431.js +2 -0
- package/dist/{chunk-srdzwtsq.js → chunk-d0q2x8e3.js} +1 -1
- package/dist/{chunk-a4r19yxm.js → chunk-d2z6828s.js} +1 -1
- package/dist/{chunk-3kmhv1kf.js → chunk-dejsjk4h.js} +1 -1
- package/dist/{chunk-0y7x0hvr.js → chunk-dmxh7zwq.js} +1 -1
- package/dist/{chunk-debz86rr.js → chunk-ebkpdc45.js} +1 -1
- package/dist/{chunk-rj8rdd8n.js → chunk-epv0ahg1.js} +1 -1
- package/dist/chunk-f5489ese.js +2 -0
- package/dist/{chunk-eav0pt6d.js → chunk-fqq1w9m1.js} +1 -1
- package/dist/{chunk-pzngjk81.js → chunk-gp8xzbyt.js} +6 -6
- package/dist/{chunk-bh4x090w.js → chunk-h1585jbm.js} +3 -3
- package/dist/chunk-hcgsgnq8.js +2 -0
- package/dist/{chunk-4mew0ae3.js → chunk-hmdnn9ja.js} +1 -1
- package/dist/chunk-hp7ewdnp.js +2 -0
- package/dist/{chunk-h1h6xe1k.js → chunk-ja7znxnz.js} +1 -1
- package/dist/{chunk-awtrcb5m.js → chunk-js79j12f.js} +2 -2
- package/dist/{chunk-yvq1f313.js → chunk-kfsp322p.js} +1 -1
- package/dist/chunk-kt557jaj.js +2 -0
- package/dist/{chunk-8vq0qjq9.js → chunk-kzkjc12e.js} +3 -3
- package/dist/{chunk-m16h8ea0.js → chunk-n7jjp08m.js} +2 -2
- package/dist/chunk-n8kqvzba.js +2 -0
- package/dist/{chunk-5eqd40k0.js → chunk-na70r4sp.js} +1 -1
- package/dist/{chunk-8drvzsk1.js → chunk-nqr77pxk.js} +2 -2
- package/dist/{chunk-3zye6eh1.js → chunk-psqk7932.js} +1 -1
- package/dist/{chunk-hahzjyxc.js → chunk-pv5nr9pd.js} +1 -1
- package/dist/{chunk-kea18wnc.js → chunk-q0cehgy2.js} +1 -1
- package/dist/{chunk-b01jqb5f.js → chunk-qeye0901.js} +1 -1
- package/dist/{chunk-z0ck9t6j.js → chunk-qwgdtrhj.js} +1 -1
- package/dist/{chunk-b7z2yegr.js → chunk-qy59yp2v.js} +1 -1
- package/dist/{chunk-m2jphkdv.js → chunk-vv4kkwhn.js} +1 -1
- package/dist/{chunk-bmk0s261.js → chunk-vwhd3h8x.js} +1 -1
- package/dist/{chunk-cvzkbsds.js → chunk-vxj8kd2v.js} +1 -1
- package/dist/chunk-vzzpvn21.js +2 -0
- package/dist/{chunk-mk7b3qdz.js → chunk-w1a2v264.js} +1 -1
- package/dist/{chunk-ax58cds3.js → chunk-w72p2ak0.js} +2 -2
- package/dist/{chunk-hjp990p8.js → chunk-w83djypm.js} +1 -1
- package/dist/{chunk-4488r5j1.js → chunk-wcs7w8wv.js} +1 -1
- package/dist/{chunk-1336h4sv.js → chunk-wr6b99pw.js} +1 -1
- package/dist/{chunk-s58yz9q0.js → chunk-x6ndnpvr.js} +1 -1
- package/dist/{chunk-jjm0ekw8.js → chunk-ykwmqh8z.js} +1 -1
- package/dist/{chunk-y4xs4m7p.js → chunk-ys71pmrb.js} +1 -1
- package/dist/{chunk-8nsqac4z.js → chunk-z5y4qyhg.js} +1 -1
- package/dist/{chunk-3ynkg5dz.js → chunk-zp0mg8b2.js} +1 -1
- package/dist/cli.js +13 -13
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/signals.js +27 -4
- package/dist/ssg.js +2 -2
- package/dist/variable-extractor.js +4 -1
- package/package.json +5 -5
- package/dist/chunk-0n76c3g8.js +0 -2
- package/dist/chunk-4amznxaq.js +0 -2
- package/dist/chunk-5akd7qsb.js +0 -2
- package/dist/chunk-6r9y4p81.js +0 -2
- package/dist/chunk-75zcwcrt.js +0 -2
- package/dist/chunk-k1am0dyg.js +0 -2
- package/dist/chunk-y9m93qkk.js +0 -2
- package/dist/chunk-ya9c8nec.js +0 -2
- package/dist/chunk-yy3dgwfm.js +0 -2
package/dist/signals.js
CHANGED
|
@@ -3047,6 +3047,19 @@ else if (part) {
|
|
|
3047
3047
|
// Use the passed scope parameter to preserve context through nested processing
|
|
3048
3048
|
const attrCapturedScope = { ...globalHelpers, ...scope, ...(findElementScope(el) || {}) };
|
|
3049
3049
|
|
|
3050
|
+
// Keep the conditional owners captured while the element is in the tree.
|
|
3051
|
+
// Walking parents on each update loses an outer owner when an inner :if
|
|
3052
|
+
// detaches its own root. These signals suspend writes while either owner
|
|
3053
|
+
// is hidden and refresh the latest value AFTER reinsertion, even when the
|
|
3054
|
+
// attribute's source did not change on that show.
|
|
3055
|
+
const attrVisibility = [];
|
|
3056
|
+
for (var attrAncestor = el; attrAncestor; attrAncestor = attrAncestor.parentNode) {
|
|
3057
|
+
if (attrAncestor.__stx_if_visible) attrVisibility.push(attrAncestor.__stx_if_visible);
|
|
3058
|
+
}
|
|
3059
|
+
function attributesVisible() {
|
|
3060
|
+
return attrVisibility.every(function(visible) { return visible(); });
|
|
3061
|
+
}
|
|
3062
|
+
|
|
3050
3063
|
// Post-eval unwrap: if the expression result is a signal function (e.g.
|
|
3051
3064
|
// step was resolved via identifier lookup, not via the auto-unwrap
|
|
3052
3065
|
// proxy \u2014 happens when a client script declares const step = state(...)
|
|
@@ -3188,6 +3201,7 @@ catch (e2) {
|
|
|
3188
3201
|
? el.__stx_parent_scope
|
|
3189
3202
|
: attrCapturedScope;
|
|
3190
3203
|
effect(() => {
|
|
3204
|
+
if (!attributesVisible()) return;
|
|
3191
3205
|
const v = evalAttrExpr(value, bindingScope);
|
|
3192
3206
|
// Form control values are live DOM properties. Setting only the HTML
|
|
3193
3207
|
// attribute does not update a <select>'s chosen option and can leave
|
|
@@ -3201,6 +3215,7 @@ catch (e2) {
|
|
|
3201
3215
|
controlValue = v === false || v === null || v === undefined ? '' : String(controlValue);
|
|
3202
3216
|
el.__stx_bound_value = controlValue;
|
|
3203
3217
|
var applyControlValue = function() {
|
|
3218
|
+
if (!attributesVisible()) return;
|
|
3204
3219
|
var desiredValue = el.__stx_bound_value == null ? '' : String(el.__stx_bound_value);
|
|
3205
3220
|
el.value = desiredValue;
|
|
3206
3221
|
if (desiredValue === '' && el.tagName !== 'OPTION') el.removeAttribute(attrName);
|
|
@@ -3291,11 +3306,11 @@ else {
|
|
|
3291
3306
|
el.removeAttribute(name);
|
|
3292
3307
|
}
|
|
3293
3308
|
else if (name === '@class' || name === ':class' || name === 'x-class') {
|
|
3294
|
-
bindClass(el, value, scope);
|
|
3309
|
+
bindClass(el, value, scope, attributesVisible);
|
|
3295
3310
|
el.removeAttribute(name);
|
|
3296
3311
|
}
|
|
3297
3312
|
else if (name === '@style' || name === ':style' || name === 'x-style') {
|
|
3298
|
-
bindStyle(el, value, scope);
|
|
3313
|
+
bindStyle(el, value, scope, attributesVisible);
|
|
3299
3314
|
el.removeAttribute(name);
|
|
3300
3315
|
}
|
|
3301
3316
|
else if (name === '@text' || name === ':text' || name === 'x-text') {
|
|
@@ -3781,7 +3796,7 @@ else {
|
|
|
3781
3796
|
el.removeAttribute(attrName);
|
|
3782
3797
|
}
|
|
3783
3798
|
|
|
3784
|
-
function bindClass(el, expr, passedScope = componentScope) {
|
|
3799
|
+
function bindClass(el, expr, passedScope = componentScope, isVisible) {
|
|
3785
3800
|
const originalClasses = el.className;
|
|
3786
3801
|
const capturedScope = { ...globalHelpers, ...passedScope, ...(findElementScope(el) || {}) };
|
|
3787
3802
|
const keys = Object.keys(capturedScope);
|
|
@@ -3800,6 +3815,7 @@ else {
|
|
|
3800
3815
|
}
|
|
3801
3816
|
|
|
3802
3817
|
effect(() => {
|
|
3818
|
+
if (isVisible && !isVisible()) return;
|
|
3803
3819
|
// Subscribe to signals by reading them, establishing reactive deps.
|
|
3804
3820
|
// But pass RAW scope values to the fn so call-expressions like
|
|
3805
3821
|
// activeTab() === 'overview' work \u2014 if we passed unwrapped values,
|
|
@@ -3849,7 +3865,7 @@ else {
|
|
|
3849
3865
|
});
|
|
3850
3866
|
}
|
|
3851
3867
|
|
|
3852
|
-
function bindStyle(el, expr, passedScope = componentScope) {
|
|
3868
|
+
function bindStyle(el, expr, passedScope = componentScope, isVisible) {
|
|
3853
3869
|
// Capture scope at setup time - use passed scope to preserve context
|
|
3854
3870
|
const capturedScope = { ...globalHelpers, ...passedScope, ...(findElementScope(el) || {}) };
|
|
3855
3871
|
|
|
@@ -3878,6 +3894,7 @@ catch (e2) {
|
|
|
3878
3894
|
};
|
|
3879
3895
|
|
|
3880
3896
|
effect(() => {
|
|
3897
|
+
if (isVisible && !isVisible()) return;
|
|
3881
3898
|
const value = evalExpr();
|
|
3882
3899
|
if (typeof value === 'object' && value !== null) {
|
|
3883
3900
|
Object.assign(el.style, value);
|
|
@@ -4918,6 +4935,7 @@ catch (e) {
|
|
|
4918
4935
|
b.el.__stx_if_bound = true;
|
|
4919
4936
|
b.el.__stx_chain_member = true;
|
|
4920
4937
|
b.el.__stx_chain_active = false;
|
|
4938
|
+
b.el.__stx_if_visible = state(false);
|
|
4921
4939
|
b.capturedElementScope = findElementScope(b.el);
|
|
4922
4940
|
b.placeholder = stxHost.anchor('stx-if-chain');
|
|
4923
4941
|
stxHost.insert(parent, b.placeholder, b.el);
|
|
@@ -5037,6 +5055,7 @@ catch (e2) {
|
|
|
5037
5055
|
if (currentIdx !== -1) {
|
|
5038
5056
|
var gone = chain[currentIdx];
|
|
5039
5057
|
gone.el.__stx_chain_active = false;
|
|
5058
|
+
gone.el.__stx_if_visible.set(false);
|
|
5040
5059
|
|
|
5041
5060
|
if (gone.isTemplate) {
|
|
5042
5061
|
// Everything this branch rendered goes, not just the clones it owns:
|
|
@@ -5097,6 +5116,7 @@ catch (e) { /* a disposer of its own is not this branch's problem */ }
|
|
|
5097
5116
|
if (pickHost.__stx_detached_if) pickHost.__stx_detached_if.delete(n);
|
|
5098
5117
|
stxHost.insert(pickHost, n, anchor);
|
|
5099
5118
|
});
|
|
5119
|
+
pick.el.__stx_if_visible.set(true);
|
|
5100
5120
|
// Bound AFTER the clones, so hiding can remove whatever a structural
|
|
5101
5121
|
// directive inside the branch renders as their sibling.
|
|
5102
5122
|
if (pick.isTemplate) {
|
|
@@ -5192,6 +5212,7 @@ catch (e) { /* a disposer of its own is not this branch's problem */ }
|
|
|
5192
5212
|
|
|
5193
5213
|
// Handle <template> elements specially - clone their content
|
|
5194
5214
|
const isTemplate = el.tagName === 'TEMPLATE';
|
|
5215
|
+
if (!isTemplate) el.__stx_if_visible = state(true);
|
|
5195
5216
|
const componentSetupSiblings = isTemplate ? [] : findConditionalComponentSetupSiblings(el);
|
|
5196
5217
|
let currentNodes = isTemplate ? [] : [el, ...componentSetupSiblings];
|
|
5197
5218
|
|
|
@@ -5362,11 +5383,13 @@ else {
|
|
|
5362
5383
|
const insertionAnchor = placeholder.nextSibling;
|
|
5363
5384
|
currentNodes.forEach(node => stxHost.insert(parent, node, insertionAnchor));
|
|
5364
5385
|
if (parent && parent.__stx_detached_if) currentNodes.forEach(node => parent.__stx_detached_if.delete(node));
|
|
5386
|
+
el.__stx_if_visible.set(true);
|
|
5365
5387
|
el.__stx_shown_at = performance.now();
|
|
5366
5388
|
isInserted = true;
|
|
5367
5389
|
}
|
|
5368
5390
|
else if (!value && isInserted) {
|
|
5369
5391
|
console.log('[stx] bindIf REMOVING element for :if=' + expr, 'el.isConnected:', el.isConnected, 'parent:', parent.tagName);
|
|
5392
|
+
el.__stx_if_visible.set(false);
|
|
5370
5393
|
// Do NOT disposeSubtreeScopes here. :if is a TOGGLE \u2014 the element is
|
|
5371
5394
|
// re-shown when the condition flips back \u2014 not a permanent unmount.
|
|
5372
5395
|
// A nested data-stx-scope inside this subtree is created once by its
|
package/dist/ssg.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-09hhrjk9.js";import"./chunk-x5ks23vx.js";import{Ze,Qe,et,tt,nt,rt}from"./chunk-66k7yxnr.js";import"./chunk-757ec865.js";import"./chunk-tafebmtg.js";import{f,Le,M,q,r,i}from"./chunk-
|
|
2
|
+
import"./chunk-09hhrjk9.js";import"./chunk-x5ks23vx.js";import{Ze,Qe,et,tt,nt,rt}from"./chunk-66k7yxnr.js";import"./chunk-757ec865.js";import"./chunk-tafebmtg.js";import{f,Le,M,q,r,i}from"./chunk-597rfddk.js";import"./chunk-w72p2ak0.js";import{Jn}from"./chunk-788g87ft.js";import"./chunk-62r4fa4q.js";import"./chunk-5e9zkd65.js";import"./chunk-4n6c5rp5.js";import"./chunk-g1fxmp9z.js";import"./chunk-qwgdtrhj.js";import{oe,pt,ft}from"./chunk-2cn8krpp.js";import{xi,Si,ki}from"./chunk-2ewa2sg5.js";import{ut,Kt,Xt}from"./chunk-jjtzm6dn.js";import"./chunk-11ra3sbc.js";import{a}from"./chunk-tfypkw4y.js";import x from"fs";import g 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 ct(t,s={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let o=new Map,n=t.replace(Dt,(e,l,w,y)=>{let h=y.trim();if(!h)return e;if(/\bdata-stx-src=/.test(w))return e;if(s.minify)h=$t(h);let S=Rt(h);if(!o.has(S))o.set(S,h);let P=s.integrity?` data-stx-integrity="sha384-${Pt("sha384").update(h).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${l}" data-stx-src="/_stx/islands/${S}.js"${P}${w}></script>`}),c=Array.from(o,([e,l])=>({hash:e,code:l}));return{html:n,chunks:c}}var kt=new Set(["visible","idle"]);function lt(t){if(!t.includes("data-stx-src="))return t;let s=new Map,o=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,n;while((n=o.exec(t))!==null)s.set(n[1],n[2]);let c=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,l;while((l=e.exec(t))!==null)if(kt.has(s.get(l[1])||""))c.add(l[2]);let w=t.lastIndexOf("</head>");if(c.size===0||w===-1)return t;let y=Array.from(c).filter((h)=>!t.includes(`rel="prefetch" href="${h}"`)).map((h)=>`<link rel="prefetch" href="${h}" as="script">`).join("");if(!y)return t;return t.slice(0,w)+y+t.slice(w)}var Ct=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function J(t){let s=t.trim();if(!s)return null;let o=/^https?:\/\//i.test(s)?s:`https://${s}`;try{return new URL(o).origin+new URL(o).pathname.replace(/\/$/,"")}catch{return null}}function Et(t){for(let s of Ct){let o=t[s];if(!o)continue;let n=J(o);if(n)return{url:n,source:"env",via:s}}return null}function dt(t){if(!t||typeof t!=="object")return null;let s=t,o=s.site?.url??s.url??s.app?.url;return typeof o==="string"?J(o):null}async function It(t){let{existsSync:s}=await import("fs"),o=await import("path");for(let n of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=o.resolve(t,n);if(!s(c))continue;try{let e=await import(c),l=dt(e.default??e);if(l)return l}catch{}}return null}async function gt(t={}){let s=t.cwd??process.cwd(),o=t.env??process.env;if(t.explicit){let l=J(t.explicit);if(l)return{url:l,source:"option"}}let n=dt(t.stxConfig);if(n)return{url:n,source:"stx.config",via:"site.url"};let c=await It(s);if(c)return{url:c,source:"site.config",via:"url"};let e=Et(o);if(e)return e;return{url:"http://localhost",source:"fallback"}}function ht(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
|
|
3
3
|
`)}class mt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,s=""){this.cacheDir=t,this.salt=s}async load(){if(this.loaded)return;let t=g.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let s=JSON.parse(await Bun.file(t).text());for(let[o,n]of Object.entries(s))this.cache.set(o,n)}catch{}this.loaded=!0}async save(){await x.promises.mkdir(this.cacheDir,{recursive:!0});let t=g.join(this.cacheDir,"build-cache.json"),s={};for(let[o,n]of this.cache)s[o]=n;await Bun.write(t,JSON.stringify(s))}getHash(t,s){let o=x.statSync(t),n=`${this.salt}|${t}:${o.mtimeMs}`;for(let e of s)if(x.existsSync(e)){let l=x.statSync(e);n+=`:${e}:${l.mtimeMs}`}let c=0;for(let e=0;e<n.length;e++){let l=n.charCodeAt(e);c=(c<<5)-c+l,c=c&c}return Math.abs(c).toString(36)}get(t,s){let o=this.cache.get(t);if(!o)return null;let n=this.getHash(s,o.dependencies??[]);if(o.hash!==n)return this.cache.delete(t),null;return o.html}set(t,s,o,n){let c=this.getHash(s,o);this.cache.set(t,{hash:c,html:n,generatedAt:Date.now(),dependencies:o})}}class wt{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let s=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return g.join(this.cacheDir,"isr",s)}async get(t){let s=this.getFilePath(t);if(!await Bun.file(s).exists())return null;try{return JSON.parse(await Bun.file(s).text())}catch{return null}}async set(t,s){let o=this.getFilePath(t);await x.promises.mkdir(g.dirname(o),{recursive:!0}),await Bun.write(o,JSON.stringify(s))}async invalidate(t){let s=this.getFilePath(t);if(await Bun.file(s).exists())await x.promises.unlink(s)}async invalidatePattern(t){let s=g.join(this.cacheDir,"isr");if(!x.existsSync(s))return;let o=await x.promises.readdir(s);for(let n of o){let c=n.replace(/_/g,"/").replace(".json","");if(t.test(c))await x.promises.unlink(g.join(s,n))}}async needsRevalidation(t){let s=await this.get(t);if(!s)return!0;return Date.now()>s.revalidateAfter}}async function Bt(t){try{let o=(await Bun.file(t).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!o)return null;let n=o[1];if(!n.includes("getStaticPaths"))return null;let c=n.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!c)return null;return await Function(`
|
|
4
4
|
return (async function getStaticPaths() {
|
|
5
5
|
${c[1]}
|
|
@@ -41,7 +41,7 @@ ${t.map((n)=>{let c=new URL(n.loc,s).href,e=` <url>
|
|
|
41
41
|
${o.join(`
|
|
42
42
|
`)}
|
|
43
43
|
</channel>
|
|
44
|
-
</rss>`}async function Gt(t={}){let s=Date.now();ft();let o=await i(process.cwd()),n=o.build||{},c=await gt({explicit:t.domain||n.domain,stxConfig:o});if(c.source==="fallback"&&(t.sitemap??n.sitemap??!0))console.warn(ht());let e={router:t.router??o?.router??{},pagesDir:t.pagesDir||n.pagesDir||"pages",outputDir:t.outputDir||n.outputDir||"dist",baseUrl:t.baseUrl||n.baseUrl||"/",domain:c.url,revalidate:t.revalidate??n.revalidate??!1,sitemap:t.sitemap??n.sitemap??!0,sitemapExclude:t.sitemapExclude||n.sitemapExclude||[],robots:t.robots??n.robots??!0,rss:t.rss??n.rss??!1,concurrency:t.concurrency||n.concurrency||10,cache:t.cache??n.cache??!0,cacheDir:t.cacheDir||n.cacheDir||a(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??n.minify??!0,generate404:t.generate404??n.generate404??!0,publicDir:t.publicDir||n.publicDir||"public",trailingSlash:t.trailingSlash??n.trailingSlash??!1,cleanOutput:t.cleanOutput??n.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||o?.partialsDir||"",componentsDir:t.componentsDir||o?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},l={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},w=new Set,y=0,h={},S={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&x.existsSync(e.outputDir))await x.promises.rm(e.outputDir,{recursive:!0});await x.promises.mkdir(e.outputDir,{recursive:!0});let D=e.cacheSalt;if(!D){let{resolveUserCssConfig:u,fingerprintConfig:m}=await import("./chunk-
|
|
44
|
+
</rss>`}async function Gt(t={}){let s=Date.now();ft();let o=await i(process.cwd()),n=o.build||{},c=await gt({explicit:t.domain||n.domain,stxConfig:o});if(c.source==="fallback"&&(t.sitemap??n.sitemap??!0))console.warn(ht());let e={router:t.router??o?.router??{},pagesDir:t.pagesDir||n.pagesDir||"pages",outputDir:t.outputDir||n.outputDir||"dist",baseUrl:t.baseUrl||n.baseUrl||"/",domain:c.url,revalidate:t.revalidate??n.revalidate??!1,sitemap:t.sitemap??n.sitemap??!0,sitemapExclude:t.sitemapExclude||n.sitemapExclude||[],robots:t.robots??n.robots??!0,rss:t.rss??n.rss??!1,concurrency:t.concurrency||n.concurrency||10,cache:t.cache??n.cache??!0,cacheDir:t.cacheDir||n.cacheDir||a(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??n.minify??!0,generate404:t.generate404??n.generate404??!0,publicDir:t.publicDir||n.publicDir||"public",trailingSlash:t.trailingSlash??n.trailingSlash??!1,cleanOutput:t.cleanOutput??n.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||o?.partialsDir||"",componentsDir:t.componentsDir||o?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},l={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},w=new Set,y=0,h={},S={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&x.existsSync(e.outputDir))await x.promises.rm(e.outputDir,{recursive:!0});await x.promises.mkdir(e.outputDir,{recursive:!0});let D=e.cacheSalt;if(!D){let{resolveUserCssConfig:u,fingerprintConfig:m}=await import("./chunk-wcs7w8wv.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-w1a2v264.js"),b=await p(e.publicDir,e.outputDir);if(b.count>0)console.log(`Optimized ${b.count} image(s) for responsive delivery`),D=[D,b.fingerprint].filter(Boolean).join(":");let B=new mt(e.cacheDir,D);if(e.cache)await B.load();try{let{generateCss:u}=await import("./chunk-wcs7w8wv.js");await u('<div class="bg-black"></div>')}catch{}Ze();let St=o?.routeMiddleware?.dir||"middleware";await et(process.cwd(),St);let H=Qe();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let xt=o?.routeMiddleware?.global||[];ki(o?.layoutsDir,a(process.cwd()));let K=M(".",{pagesDir:e.pagesDir,pagesDirs:o?._layerPageDirs});console.log(`Found ${K.length} routes`);let G=[];for(let u of K){let m=await jt(u);for(let v of m)G.push({route:u,url:v.url,params:v.params,props:v.props,revalidate:v.revalidate??e.revalidate})}l.totalPages=G.length,console.log(`Generating ${l.totalPages} pages...`);let A=[],X=[];for(let u=0;u<G.length;u+=e.concurrency)X.push(G.slice(u,u+e.concurrency));for(let u of X)await Promise.all(u.map(async(m)=>{let{route:v,url:d,params:L,props:vt,revalidate:Q}=m;try{await e.hooks.onPageStart?.(d);let j=await Bun.file(v.filePath).text(),F=Wt(j),bt=F?.middleware?Array.isArray(F.middleware)?F.middleware:[F.middleware]:[],it=[...xt,...bt];if(it.length>0){let C=tt(d,L,F||{}),O=nt(C,null,void 0,{isServer:!0}),E=await rt(it,O);if(E.redirect){let R=typeof E.redirect==="string"?E.redirect:E.redirect.path||E.redirect,_=qt(String(R),d),T=Jt(d,e);await x.promises.mkdir(g.dirname(T),{recursive:!0}),await Bun.write(T,_),l.successCount++,l.pages.push({route:d,outputPath:T,size:Buffer.byteLength(_),cached:!1}),A.push({loc:d,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${d} \u2192 redirect to ${R}`);return}if(E.abort){let R=typeof E.abort==="string"?E.abort:E.abort?.error?.message||"aborted";console.warn(` \u21B3 ${d} \u2014 middleware aborted: ${R}`);return}}let st=j.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(st)try{if(!await Function("route",`
|
|
45
45
|
const validate = ${st[1]};
|
|
46
46
|
return validate(route);
|
|
47
47
|
`)({params:L})){console.warn(`Validation failed for ${d}, skipping...`);return}}catch{}let k=null,at=!1;if(e.cache){if(k=B.get(d,v.filePath),k)at=!0,l.cachedCount++}if(!k){let C=await yt(v,L,vt,e,o);if(k=C.html,e.failOnIncludeError&&C.includeFailures.length>0)throw Error(`${C.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
|
|
@@ -223,7 +223,10 @@ export function stripTypeScript(scriptContent) {
|
|
|
223
223
|
return result;
|
|
224
224
|
}
|
|
225
225
|
export function withoutStxReferrer(message) {
|
|
226
|
-
return message.replace(/\s*imported from
|
|
226
|
+
return message.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g, (referrer, ...groups) => {
|
|
227
|
+
const [, quotedPath, barePath] = groups, importer = quotedPath ?? barePath;
|
|
228
|
+
return /(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(importer) ? "" : referrer;
|
|
229
|
+
});
|
|
227
230
|
}
|
|
228
231
|
export function isModuleResolutionFailure(message) {
|
|
229
232
|
return /cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(message);
|
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.422",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -122,12 +122,12 @@
|
|
|
122
122
|
"dependencies": {
|
|
123
123
|
"@stacksjs/ts-css": "^0.3.2",
|
|
124
124
|
"@stacksjs/clapp": "^0.2.16",
|
|
125
|
-
"@stacksjs/desktop": "0.2.
|
|
126
|
-
"@stacksjs/sanitizer": "0.2.
|
|
125
|
+
"@stacksjs/desktop": "0.2.422",
|
|
126
|
+
"@stacksjs/sanitizer": "0.2.422",
|
|
127
127
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
128
|
-
"bun-plugin-stx": "0.2.
|
|
128
|
+
"bun-plugin-stx": "0.2.422",
|
|
129
129
|
"bunfig": "^0.15.19",
|
|
130
|
-
"stx-router": "0.2.
|
|
130
|
+
"stx-router": "0.2.422",
|
|
131
131
|
"ts-broadcasting": "^0.0.11",
|
|
132
132
|
"ts-images": "^0.2.22",
|
|
133
133
|
"ts-syntax-highlighter": "^0.2.1"
|
package/dist/chunk-0n76c3g8.js
DELETED
package/dist/chunk-4amznxaq.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{$n,Ut,Hl}from"./chunk-8j8k27xb.js";import{z,En,Vt,Pr,Ir,Tn,Ul,Vl,Wl,Wt,qt,Dr,_n,ql}from"./chunk-8drvzsk1.js";import"./chunk-757ec865.js";export{Pr as batch,Hl as default,En as derived,Vt as effect,$n as generateSignalsRuntime,Ut as generateSignalsRuntimeDev,qt as isDerived,Wt as isSignal,Tn as onDestroy,Ir as onMount,_n as peek,Wl as pendingLifecycleCounts,Vl as runDestroyCallbacks,Ul as runMountCallbacks,z as state,Dr as untrack,ql as useOptimistic};
|
package/dist/chunk-5akd7qsb.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Vc}from"./chunk-89e1d0rz.js";import"./chunk-cw6j75ck.js";import"./chunk-8j8k27xb.js";import"./chunk-z0ck9t6j.js";import"./chunk-rj3hyqff.js";import"./chunk-11ra3sbc.js";import"./chunk-x5ks23vx.js";import"./chunk-g1fxmp9z.js";import"./chunk-4e101kjp.js";import"./chunk-62r4fa4q.js";import"./chunk-32y3767j.js";import"./chunk-ax58cds3.js";import"./chunk-09hhrjk9.js";import"./chunk-tafebmtg.js";import"./chunk-757ec865.js";import"./chunk-66k7yxnr.js";import"./chunk-4n6c5rp5.js";export{Vc as buildForProduction};
|
package/dist/chunk-6r9y4p81.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{_o,Ro}from"./chunk-pzngjk81.js";import"./chunk-8vq0qjq9.js";import"./chunk-h1h6xe1k.js";import"./chunk-debz86rr.js";import"./chunk-aync8qmk.js";import"./chunk-bh4x090w.js";import"./chunk-89e1d0rz.js";import"./chunk-qby6wxat.js";import"./chunk-m16h8ea0.js";import"./chunk-3ynkg5dz.js";import"./chunk-014gmm8w.js";import{Js}from"./chunk-cw6j75ck.js";import"./chunk-qx3js9tk.js";import"./chunk-r8wze9ym.js";import"./chunk-hjp990p8.js";import"./chunk-hy9e3ny6.js";import"./chunk-rsxvbnp4.js";import"./chunk-ep5jnqdb.js";import"./chunk-2tfe2g58.js";import"./chunk-10967rws.js";import"./chunk-b1fg9vg7.js";import"./chunk-kea18wnc.js";import"./chunk-34gy5zjm.js";import"./chunk-0varh725.js";import"./chunk-ap6fehea.js";import"./chunk-xvzxrt9a.js";import"./chunk-tqnysw0k.js";import"./chunk-k31fwm2w.js";import"./chunk-4mew0ae3.js";import"./chunk-8j8k27xb.js";import"./chunk-a4r19yxm.js";import"./chunk-awtrcb5m.js";import"./chunk-2ewa2sg5.js";import"./chunk-6aqcgrhw.js";import"./chunk-z0ck9t6j.js";import{me,Yt,Zt,q,d,r,Vn,A,i,ce}from"./chunk-rj3hyqff.js";import"./chunk-11ra3sbc.js";import"./chunk-x5ks23vx.js";import"./chunk-g1fxmp9z.js";import"./chunk-4e101kjp.js";import"./chunk-62r4fa4q.js";import"./chunk-32y3767j.js";import"./chunk-ax58cds3.js";import"./chunk-09hhrjk9.js";import"./chunk-tafebmtg.js";import"./chunk-757ec865.js";import"./chunk-66k7yxnr.js";import"./chunk-4n6c5rp5.js";export{Vn as buildWebComponents,Zt as cacheTemplate,Yt as checkCache,Js as classifyAllScripts,_o as createMiddleware,Ro as createRoute,A as defaultConfig,d as extractVariables,q as injectRouterScript,i as loadStxConfig,me as processClientScript,r as processDirectives,ce as readMarkdownFile};
|
package/dist/chunk-75zcwcrt.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Oe,Ua,wu,vu,xu,Su,Va,Wa,ku,Cu,Ni,$u,Yt,Zt,On}from"./chunk-rj3hyqff.js";import"./chunk-11ra3sbc.js";import"./chunk-x5ks23vx.js";import"./chunk-g1fxmp9z.js";import"./chunk-4e101kjp.js";import"./chunk-62r4fa4q.js";import"./chunk-32y3767j.js";import"./chunk-ax58cds3.js";import"./chunk-09hhrjk9.js";import"./chunk-tafebmtg.js";import"./chunk-757ec865.js";import"./chunk-66k7yxnr.js";import"./chunk-4n6c5rp5.js";export{Su as __setSignalsGeneratorsForTest,Oe as cacheEngineFingerprint,Zt as cacheTemplate,Yt as checkCache,$u as clearDevCaches,Wa as getCachedRouterScript,Va as getCachedSignalsRuntime,ku as getServeClientAsset,Ni as getServeModuleBundle,On as hashFilePath,vu as invalidateFileCache,xu as invalidateFileCacheByDir,wu as readFileCached,Cu as registerServeModuleBundle,Ua as templateCache};
|
package/dist/chunk-k1am0dyg.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Wo,il,qo,Ko,ol,al}from"./chunk-hjp990p8.js";import"./chunk-rj3hyqff.js";import"./chunk-11ra3sbc.js";import"./chunk-x5ks23vx.js";import"./chunk-g1fxmp9z.js";import"./chunk-4e101kjp.js";import"./chunk-62r4fa4q.js";import"./chunk-32y3767j.js";import"./chunk-ax58cds3.js";import"./chunk-09hhrjk9.js";import"./chunk-tafebmtg.js";import"./chunk-757ec865.js";import"./chunk-66k7yxnr.js";import"./chunk-4n6c5rp5.js";export{al as applySlots,ol as extractSlotContent,il as parseSlotElement,Wo as parseSlots,Ko as processSlots,qo as renderSlot};
|
package/dist/chunk-y9m93qkk.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{rl}from"./chunk-014gmm8w.js";import"./chunk-cw6j75ck.js";import"./chunk-z0ck9t6j.js";import"./chunk-rj3hyqff.js";import"./chunk-11ra3sbc.js";import"./chunk-x5ks23vx.js";import"./chunk-g1fxmp9z.js";import"./chunk-4e101kjp.js";import"./chunk-62r4fa4q.js";import"./chunk-32y3767j.js";import"./chunk-ax58cds3.js";import"./chunk-09hhrjk9.js";import"./chunk-tafebmtg.js";import"./chunk-757ec865.js";import"./chunk-66k7yxnr.js";import"./chunk-4n6c5rp5.js";export{rl as startProductionServer};
|
package/dist/chunk-ya9c8nec.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{ks,Hu,Uu,mo,pe,Sc,Qn,Vu,Wu,qu,Ku,Xu,Gu,Ju,Yu,Zu}from"./chunk-ax58cds3.js";import"./chunk-09hhrjk9.js";export{Gu as applyHead,Vu as definePageMeta,ks as getHead,Hu as getPageMeta,pe as mergeHeadConfigs,Ju as processHeadDirective,Zu as processMetaDirective,Yu as processTitleDirective,Xu as renderBodyAttrs,qu as renderHead,Ku as renderHtmlAttrs,Uu as resetHead,Qn as seoMetaToHeadConfig,mo as useHead,Wu as usePageTitle,Sc as useSeoMeta,Wu as useTitle};
|
package/dist/chunk-yy3dgwfm.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Uc}from"./chunk-bh4x090w.js";import"./chunk-rj3hyqff.js";import"./chunk-11ra3sbc.js";import"./chunk-x5ks23vx.js";import"./chunk-g1fxmp9z.js";import"./chunk-4e101kjp.js";import"./chunk-62r4fa4q.js";import"./chunk-32y3767j.js";import"./chunk-ax58cds3.js";import"./chunk-09hhrjk9.js";import"./chunk-tafebmtg.js";import"./chunk-757ec865.js";import"./chunk-66k7yxnr.js";import"./chunk-4n6c5rp5.js";export{Uc as startInteractive};
|