@stacksjs/stx 0.2.400 → 0.2.401
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/appearance-bootstrap.d.ts +30 -2
- package/dist/appearance-bootstrap.js +26 -17
- package/dist/{chunk-mt0j29hr.js → chunk-0fwecpfm.js} +1 -1
- package/dist/{chunk-d6q7cv8w.js → chunk-0nqcv7z7.js} +1 -1
- package/dist/{chunk-2t41acdt.js → chunk-160zge7a.js} +1 -1
- package/dist/{chunk-3xpws4kd.js → chunk-19kj26z3.js} +1 -1
- package/dist/{chunk-6wcfe0s5.js → chunk-1nj174s0.js} +1 -1
- package/dist/{chunk-b3b3s1kr.js → chunk-1rskz446.js} +1 -1
- package/dist/{chunk-h1qtbdfs.js → chunk-1s9jswhp.js} +1 -1
- package/dist/{chunk-q25qsg28.js → chunk-21dz636m.js} +1 -1
- package/dist/{chunk-18qyx80g.js → chunk-2m88psbh.js} +1 -1
- package/dist/{chunk-b4d5pbhs.js → chunk-2x9gpv2d.js} +1 -1
- package/dist/{chunk-vd7thynz.js → chunk-3t17hkar.js} +1 -1
- package/dist/{chunk-1h9rc1jm.js → chunk-3wsrhb1a.js} +1 -1
- package/dist/{chunk-nvpjt609.js → chunk-3znzj20j.js} +1 -1
- package/dist/{chunk-ymkv623c.js → chunk-45etne17.js} +1 -1
- package/dist/{chunk-83ewzshg.js → chunk-61cwdy7h.js} +1 -1
- package/dist/{chunk-06h5zrm2.js → chunk-7bym5kky.js} +8 -8
- package/dist/{chunk-wjzcggh6.js → chunk-7c8r36ve.js} +1 -1
- package/dist/{chunk-27wgfqs0.js → chunk-8kkqx4sc.js} +1 -1
- package/dist/{chunk-awz5cx5w.js → chunk-8xm3z6dh.js} +1 -1
- package/dist/{chunk-es5qfybg.js → chunk-8ywzw4h9.js} +1 -1
- package/dist/{chunk-dzaf7qx8.js → chunk-bf6zcjr5.js} +1 -1
- package/dist/{chunk-x04ktd35.js → chunk-bgy4hwh4.js} +1 -1
- package/dist/{chunk-wva3ggqj.js → chunk-btn4481e.js} +1 -1
- package/dist/{chunk-zm92mg10.js → chunk-ch2aycnm.js} +1 -1
- package/dist/{chunk-x5z3r1d9.js → chunk-cmnve329.js} +1 -1
- package/dist/{chunk-4bnv6c6t.js → chunk-ef3y864p.js} +1 -1
- package/dist/{chunk-dazf77tr.js → chunk-epzm35py.js} +1 -1
- package/dist/{chunk-eqtc6w4a.js → chunk-h7sgg3vh.js} +1 -1
- package/dist/{chunk-rswsrggp.js → chunk-hh8abhtc.js} +1 -1
- package/dist/{chunk-vs3zfaxp.js → chunk-k9t7pyb8.js} +1 -1
- package/dist/{chunk-h4nydbnx.js → chunk-kfhm9vh1.js} +2 -2
- package/dist/{chunk-m4q3nsch.js → chunk-kxxph6d4.js} +1 -1
- package/dist/{chunk-1bvm3byf.js → chunk-mgndzdqy.js} +1 -1
- package/dist/{chunk-3818kp2d.js → chunk-nm7jfzmz.js} +2 -2
- package/dist/{chunk-gjpq3pmz.js → chunk-pm8wzxsb.js} +1 -1
- package/dist/{chunk-rem5ne21.js → chunk-pqc4sv02.js} +2 -2
- package/dist/{chunk-8gwby0r0.js → chunk-q4v62yed.js} +80 -21
- package/dist/{chunk-3ey6ha6w.js → chunk-r0jqyxbc.js} +1 -1
- package/dist/{chunk-0tak2f33.js → chunk-re9rv45k.js} +1 -1
- package/dist/{chunk-1f8kqg6a.js → chunk-s4yq7q1d.js} +1 -1
- package/dist/{chunk-74ebps1a.js → chunk-twws9vvz.js} +1 -1
- package/dist/{chunk-yc3x3rmf.js → chunk-vyn2y774.js} +1 -1
- package/dist/{chunk-ej2mb0t3.js → chunk-w680bfze.js} +1 -1
- package/dist/{chunk-126tkba9.js → chunk-waz1sddd.js} +1 -1
- package/dist/{chunk-38an983e.js → chunk-wdszjnbp.js} +1 -1
- package/dist/{chunk-nrgcfg8h.js → chunk-wmqhn6rq.js} +1 -1
- package/dist/{chunk-xs7f8h2r.js → chunk-x3h04mgd.js} +1 -1
- package/dist/{chunk-1qbj1kz4.js → chunk-y5gyez1p.js} +1 -1
- package/dist/{chunk-4tpsw999.js → chunk-zfs01pjr.js} +1 -1
- package/dist/{chunk-6am7e1be.js → chunk-zstrcmbj.js} +19 -19
- package/dist/cli.js +8 -8
- package/dist/color-mode-boot.d.ts +20 -0
- package/dist/color-mode-boot.js +5 -3
- package/dist/composables/use-color-mode.d.ts +1 -0
- package/dist/composables/use-color-mode.js +9 -5
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/script-validation.js +1 -1
- package/dist/signals.js +80 -21
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
|
@@ -43,10 +43,38 @@ export interface ColorModeBootstrapValue {
|
|
|
43
43
|
default: 'light' | 'dark' | 'system';
|
|
44
44
|
}
|
|
45
45
|
export interface AppearanceBootstrapOptions {
|
|
46
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* localStorage key holding the persisted preference.
|
|
48
|
+
*
|
|
49
|
+
* Read as a JSON object, and also as a bare `'light'` / `'dark'` /
|
|
50
|
+
* `'system'` string, which is what `useColorMode` writes under its own
|
|
51
|
+
* `storageKey` and the overwhelmingly common shape in existing apps.
|
|
52
|
+
*/
|
|
47
53
|
storageKey: string;
|
|
48
|
-
|
|
54
|
+
/**
|
|
55
|
+
* A second axis beside colour mode, such as a sidebar style.
|
|
56
|
+
*
|
|
57
|
+
* Optional: colour mode is the common case and this is the specialised one,
|
|
58
|
+
* so an app that themes only light/dark leaves it out rather than inventing
|
|
59
|
+
* a single-valued axis to satisfy the normalizer and then carrying a
|
|
60
|
+
* meaningless `data-*` attribute on every page (stacksjs/stx#2050).
|
|
61
|
+
*/
|
|
62
|
+
appearance?: AppearanceBootstrapValue;
|
|
49
63
|
colorMode: ColorModeBootstrapValue;
|
|
64
|
+
/**
|
|
65
|
+
* Leave an attribute alone when it already carries a concrete value, and
|
|
66
|
+
* resolve to that instead of to what is stored. @default false
|
|
67
|
+
*
|
|
68
|
+
* For a page whose theme is not the visitor's to choose: stamped
|
|
69
|
+
* server-side during render, it has to outrank whatever they stored from
|
|
70
|
+
* their own browsing. Without this the bootstrap resolved purely from
|
|
71
|
+
* storage and stamped unconditionally (stacksjs/stx#2050).
|
|
72
|
+
*
|
|
73
|
+
* `system` is not concrete: it is an instruction to resolve rather than an
|
|
74
|
+
* answer, so the stored preference still wins for it. For the appearance
|
|
75
|
+
* axis, concrete means a value in `allowed`.
|
|
76
|
+
*/
|
|
77
|
+
respectExisting?: boolean;
|
|
50
78
|
}
|
|
51
79
|
/**
|
|
52
80
|
* Transform every `@appearanceBootstrap({...})` directive in a template.
|
|
@@ -9,46 +9,55 @@ function normalizeOptions(value) {
|
|
|
9
9
|
throw Error("@appearanceBootstrap expects an options object");
|
|
10
10
|
const input = value, appearance = input.appearance, colorMode = input.colorMode;
|
|
11
11
|
assertString(input.storageKey, "storageKey");
|
|
12
|
-
if (!appearance || typeof appearance !== "object" || Array.isArray(appearance))
|
|
13
|
-
throw Error("@appearanceBootstrap appearance must be an object");
|
|
12
|
+
if (appearance !== void 0 && (!appearance || typeof appearance !== "object" || Array.isArray(appearance)))
|
|
13
|
+
throw Error("@appearanceBootstrap appearance must be an object when given");
|
|
14
14
|
if (!colorMode || typeof colorMode !== "object" || Array.isArray(colorMode))
|
|
15
15
|
throw Error("@appearanceBootstrap colorMode must be an object");
|
|
16
|
-
assertString(appearance.key, "appearance.key");
|
|
17
|
-
assertString(appearance.attribute, "appearance.attribute");
|
|
18
|
-
assertString(appearance.default, "appearance.default");
|
|
19
16
|
assertString(colorMode.key, "colorMode.key");
|
|
20
17
|
assertString(colorMode.attribute, "colorMode.attribute");
|
|
21
18
|
assertString(colorMode.default, "colorMode.default");
|
|
22
|
-
if (!PROPERTY_PATTERN.test(
|
|
19
|
+
if (!PROPERTY_PATTERN.test(colorMode.key))
|
|
23
20
|
throw Error("@appearanceBootstrap preference keys must be JavaScript property names");
|
|
24
|
-
if (!DATA_ATTRIBUTE_PATTERN.test(
|
|
21
|
+
if (!DATA_ATTRIBUTE_PATTERN.test(colorMode.attribute))
|
|
25
22
|
throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");
|
|
26
|
-
if (!Array.isArray(appearance.allowed) || appearance.allowed.length === 0 || appearance.allowed.some((item) => typeof item !== "string" || item.length === 0))
|
|
27
|
-
throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");
|
|
28
|
-
if (!appearance.allowed.includes(appearance.default))
|
|
29
|
-
throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");
|
|
30
23
|
if (!COLOR_MODES.has(colorMode.default))
|
|
31
24
|
throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
appearance
|
|
25
|
+
let normalizedAppearance = null;
|
|
26
|
+
if (appearance) {
|
|
27
|
+
assertString(appearance.key, "appearance.key");
|
|
28
|
+
assertString(appearance.attribute, "appearance.attribute");
|
|
29
|
+
assertString(appearance.default, "appearance.default");
|
|
30
|
+
if (!PROPERTY_PATTERN.test(appearance.key))
|
|
31
|
+
throw Error("@appearanceBootstrap preference keys must be JavaScript property names");
|
|
32
|
+
if (!DATA_ATTRIBUTE_PATTERN.test(appearance.attribute))
|
|
33
|
+
throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");
|
|
34
|
+
if (!Array.isArray(appearance.allowed) || appearance.allowed.length === 0 || appearance.allowed.some((item) => typeof item !== "string" || item.length === 0))
|
|
35
|
+
throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");
|
|
36
|
+
if (!appearance.allowed.includes(appearance.default))
|
|
37
|
+
throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");
|
|
38
|
+
normalizedAppearance = {
|
|
35
39
|
key: appearance.key,
|
|
36
40
|
attribute: appearance.attribute,
|
|
37
41
|
allowed: [...new Set(appearance.allowed)],
|
|
38
42
|
default: appearance.default
|
|
39
|
-
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
storageKey: input.storageKey,
|
|
47
|
+
appearance: normalizedAppearance,
|
|
40
48
|
colorMode: {
|
|
41
49
|
key: colorMode.key,
|
|
42
50
|
attribute: colorMode.attribute,
|
|
43
51
|
default: colorMode.default
|
|
44
|
-
}
|
|
52
|
+
},
|
|
53
|
+
respectExisting: input.respectExisting === !0
|
|
45
54
|
};
|
|
46
55
|
}
|
|
47
56
|
function serializeForScript(value) {
|
|
48
57
|
return JSON.stringify(value).replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/&/g, "\\u0026").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
49
58
|
}
|
|
50
59
|
function generateBootstrap(options) {
|
|
51
|
-
return `<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${serializeForScript(options)};const root=document.documentElement;const MODES=["light","dark","system"];function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);
|
|
60
|
+
return `<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${serializeForScript(options)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`;
|
|
52
61
|
}
|
|
53
62
|
function findClosingParenthesis(source, openIndex) {
|
|
54
63
|
let depth = 1, quote = null, escaped = !1;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{$w as H}from"./chunk-rxz43r6k.js";import P from"path";var $=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function G(...w){let v=new Set;for(let q of w){if(!q||!q.includes("__stxModules["))continue;for(let z of q.matchAll($))try{v.add(JSON.parse(`"${z[1]}"`))}catch{}}return[...v].sort()}async function T(w,v={}){if(w.length===0)return null;let q=process.cwd(),z=[],J=[];w.forEach((j,X)=>{let Z=j.startsWith("npm:")?j.slice(4):P.resolve(q,j),N=`__stxRegistered${X}`,O=JSON.stringify(j);z.push(`import * as ${N} from ${JSON.stringify(Z)};`),J.push(`if (!globalThis.__stxModules[${O}]) globalThis.__stxModules[${O}] = ${N};`)});let L=[...z,"globalThis.__stxModules = globalThis.__stxModules || {};",...J].join(`
|
|
3
|
-
`),B;try{let{bundleClientScript:j}=await import("./chunk-
|
|
3
|
+
`),B;try{let{bundleClientScript:j}=await import("./chunk-cmnve329.js");B=await j(L,P.join(q,".stx-module-registry.ts"),{projectRoot:q,minify:v.minify,externalizeUserModules:!1,collectInputs:v.collectInputs})}catch(j){return console.warn("[stx] could not build the page module registry (#1957):",j),null}let{transformAutoImports:Q,generateAutoImportDestructuring:U}=await import("./chunk-w680bfze.js"),F=Q(B),V=U(F.stxImports,F.browserImports),{transformStoreImports:W}=await import("./chunk-07syq64h.js");B=W(F.code);let M=JSON.stringify(new Bun.CryptoHasher("md5").update(L).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${M}]) return;`,` __stxBundles[${M}] = true;`,V,B,"})();"].join(`
|
|
4
4
|
`)}export{G as registeredModuleIdsIn,T as buildModuleRegistryScript};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{To as a,Uo as b,Vo as c,Wo as d}from"./chunk-
|
|
2
|
+
import{To as a,Uo as b,Vo as c,Wo as d}from"./chunk-zstrcmbj.js";import"./chunk-4cv7bw5e.js";import"./chunk-7tgjn256.js";import"./chunk-h8zp2fz9.js";import"./chunk-ekvejzvk.js";import"./chunk-3769e62c.js";import"./chunk-7c8r36ve.js";import"./chunk-yj5gkn17.js";import"./chunk-cy8hgd86.js";import"./chunk-twws9vvz.js";import"./chunk-g7qmxjyc.js";import"./chunk-88tt0qg0.js";import"./chunk-e1rv01pn.js";import"./chunk-bdz7nznw.js";import"./chunk-rwtj7j0r.js";import"./chunk-eqhsprr0.js";import"./chunk-csgshaeh.js";import"./chunk-d0qy1ezf.js";import"./chunk-c9kj8p6j.js";import"./chunk-x2wmn8m7.js";import"./chunk-rxz43r6k.js";export{b as reportDeferredLoopWarnings,c as processLoops,a as parseLoopBinding,d as declareBareLoopHead};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ok as a,pk as b,qk as c,rk as d}from"./chunk-
|
|
2
|
+
import{ok as a,pk as b,qk as c,rk as d}from"./chunk-hh8abhtc.js";import"./chunk-pqc4sv02.js";import"./chunk-zstrcmbj.js";import"./chunk-4cv7bw5e.js";import"./chunk-7tgjn256.js";import"./chunk-h8zp2fz9.js";import"./chunk-ekvejzvk.js";import"./chunk-3769e62c.js";import"./chunk-7c8r36ve.js";import"./chunk-yj5gkn17.js";import"./chunk-cy8hgd86.js";import"./chunk-twws9vvz.js";import"./chunk-g7qmxjyc.js";import"./chunk-88tt0qg0.js";import"./chunk-e1rv01pn.js";import"./chunk-bdz7nznw.js";import"./chunk-rwtj7j0r.js";import"./chunk-eqhsprr0.js";import"./chunk-csgshaeh.js";import"./chunk-d0qy1ezf.js";import"./chunk-c9kj8p6j.js";import"./chunk-x2wmn8m7.js";import"./chunk-rxz43r6k.js";export{b as getAvailableTargets,c as getAvailableFormats,d as default,a as buildNative};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$i as l,Qi as a,Ri as b,Si as c,Ti as d,Ui as e,Vi as f,Wi as g,Xi as h,Yi as i,Zi as j,_i as k,aj as m,bj as n}from"./chunk-
|
|
2
|
+
import{$i as l,Qi as a,Ri as b,Si as c,Ti as d,Ui as e,Vi as f,Wi as g,Xi as h,Yi as i,Zi as j,_i as k,aj as m,bj as n}from"./chunk-45etne17.js";import"./chunk-zstrcmbj.js";import"./chunk-4cv7bw5e.js";import"./chunk-7tgjn256.js";import"./chunk-h8zp2fz9.js";import"./chunk-ekvejzvk.js";import"./chunk-3769e62c.js";import"./chunk-7c8r36ve.js";import"./chunk-yj5gkn17.js";import"./chunk-cy8hgd86.js";import"./chunk-twws9vvz.js";import"./chunk-g7qmxjyc.js";import"./chunk-88tt0qg0.js";import"./chunk-e1rv01pn.js";import"./chunk-bdz7nznw.js";import"./chunk-rwtj7j0r.js";import"./chunk-eqhsprr0.js";import"./chunk-csgshaeh.js";import"./chunk-d0qy1ezf.js";import"./chunk-c9kj8p6j.js";import"./chunk-x2wmn8m7.js";import"./chunk-rxz43r6k.js";export{i as streamingSuspenseDirective,m as streamToResponse,g as streamTemplateSimple,a as streamTemplate,d as renderStreamingPage,k as registerStreamingDirectives,e as processStreamDirectives,l as processSectionDirectives,j as islandDirective,n as generateHydrationRuntime,f as extractStreamBoundaries,h as createStreamRenderer,b as buildSuspenseResolveScript,c as SUSPENSE_RESOLVER_RUNTIME};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ii as a,ji as b,ki as c}from"./chunk-
|
|
2
|
+
import{ii as a,ji as b,ki as c}from"./chunk-r0jqyxbc.js";import"./chunk-452k8psm.js";import"./chunk-21dz636m.js";import"./chunk-h7sgg3vh.js";import"./chunk-2andsajh.js";import"./chunk-zstrcmbj.js";import"./chunk-4cv7bw5e.js";import"./chunk-7tgjn256.js";import"./chunk-h8zp2fz9.js";import"./chunk-ekvejzvk.js";import"./chunk-3769e62c.js";import"./chunk-7c8r36ve.js";import"./chunk-yj5gkn17.js";import"./chunk-cy8hgd86.js";import"./chunk-twws9vvz.js";import"./chunk-g7qmxjyc.js";import"./chunk-88tt0qg0.js";import"./chunk-e1rv01pn.js";import"./chunk-bdz7nznw.js";import"./chunk-rwtj7j0r.js";import"./chunk-eqhsprr0.js";import"./chunk-csgshaeh.js";import"./chunk-d0qy1ezf.js";import"./chunk-c9kj8p6j.js";import"./chunk-x2wmn8m7.js";import"./chunk-rxz43r6k.js";export{a as listComposableModules,b as getComposableScript,c as clearComposableCache};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{kt as a,lt as b,mt as c,nt as d,ot as e,pt as f,qt as g,rt as h,st as i,tt as j,ut as k,vt as l}from"./chunk-
|
|
2
|
+
import{kt as a,lt as b,mt as c,nt as d,ot as e,pt as f,qt as g,rt as h,st as i,tt as j,ut as k,vt as l}from"./chunk-7c8r36ve.js";import"./chunk-yj5gkn17.js";import"./chunk-rxz43r6k.js";export{e as resolveUserCssConfig,c as resetCssCache,h as rebuildCss,d as loadCssEngineConfig,b as loadCssEngine,l as injectCss,a as getCssServeAsset,i as getCachedCSS,k as generateCss,f as fingerprintConfig,j as extractClassNames,g as buildCss};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Nj as b,Oj as c,Pj as d,Qj as e,Rj as f,Sj as g,Tj as h,Uj as i,Vj as j,Wj as k,Xj as l,Yj as m,Zj as n,_j as o}from"./chunk-
|
|
2
|
+
import{Nj as b,Oj as c,Pj as d,Qj as e,Rj as f,Sj as g,Tj as h,Uj as i,Vj as j,Wj as k,Xj as l,Yj as m,Zj as n,_j as o}from"./chunk-8xm3z6dh.js";import{xl as a}from"./chunk-2andsajh.js";import"./chunk-zstrcmbj.js";import"./chunk-4cv7bw5e.js";import"./chunk-7tgjn256.js";import"./chunk-h8zp2fz9.js";import"./chunk-ekvejzvk.js";import"./chunk-3769e62c.js";import"./chunk-7c8r36ve.js";import"./chunk-yj5gkn17.js";import"./chunk-cy8hgd86.js";import"./chunk-twws9vvz.js";import"./chunk-g7qmxjyc.js";import"./chunk-88tt0qg0.js";import"./chunk-e1rv01pn.js";import"./chunk-bdz7nznw.js";import"./chunk-rwtj7j0r.js";import"./chunk-eqhsprr0.js";import"./chunk-csgshaeh.js";import"./chunk-d0qy1ezf.js";import"./chunk-c9kj8p6j.js";import"./chunk-x2wmn8m7.js";import"./chunk-rxz43r6k.js";export{b as templateCache,j as registerServeModuleBundle,c as readFileCached,e as invalidateFileCacheByDir,d as invalidateFileCache,o as hashFilePath,k as getServeModuleBundle,i as getServeClientAsset,g as getCachedSignalsRuntime,h as getCachedRouterScript,l as clearDevCaches,m as checkCache,n as cacheTemplate,a as cacheEngineFingerprint,f as __setSignalsGeneratorsForTest};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{wl as QJ}from"./chunk-
|
|
2
|
+
import{wl as QJ}from"./chunk-h7sgg3vh.js";import{xl as WJ}from"./chunk-2andsajh.js";import{Fr as XJ,Gr as qJ,em as GJ}from"./chunk-zstrcmbj.js";import{ys as ZJ,zs as $J}from"./chunk-h8zp2fz9.js";import{Ss as YJ,Ws as u}from"./chunk-7c8r36ve.js";import{At as c}from"./chunk-yj5gkn17.js";import X from"path";import O from"fs";function UJ(J){if(!J||typeof J!=="object")return!1;let K=J;return typeof K.message==="string"&&(K.name==="BuildMessage"||K.name==="ResolveMessage"||("position"in K))}function LJ(J){if(J&&typeof J==="object"&&Array.isArray(J.errors))return J.errors;return[J]}function b(J,K){let $=[];for(let W of LJ(J)){if(UJ(W)){let Y=W.position||void 0;$.push({file:K||Y?.file,line:Y?.line,column:Y?.column,message:W.message??"",lineText:Y?.lineText});continue}$.push({file:K,message:W instanceof Error?W.message:String(W)})}return $}function t(J,K){return b(J,K).map(($)=>{let W=$.file?`${$.file}${$.line?`:${$.line}${$.column?`:${$.column}`:""}`:""}`:"",Y=$.lineText?`
|
|
3
3
|
${$.lineText.trim()}`:"";return W?`${W}: ${$.message}${Y}`:`${$.message}${Y}`}).join(`
|
|
4
4
|
`)}var TJ=9;function P(J,K,$){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(X.basename(J))||QJ(J,K,$)}var HJ=1,zJ=new Map,f=600,AJ=100,g=new Map;async function MJ(J){let K=g.get(J)??0;if(K>0&&K<AJ){g.set(J,K+1);return}g.set(J,1);try{let $=(await O.promises.readdir(J)).filter((z)=>z.endsWith(".js"));if($.length<=f)return;let Y=(await Promise.all($.map(async(z)=>{try{return{name:z,at:(await O.promises.stat(X.join(J,z))).mtimeMs}}catch{return null}}))).filter((z)=>z!==null);Y.sort((z,H)=>H.at-z.at);for(let z of Y.slice(f)){let H=z.name.slice(0,-3);await O.promises.rm(X.join(J,`${H}.js`),{force:!0}),await O.promises.rm(X.join(J,`${H}.deps.json`),{force:!0})}x("pruned bundle cache to",f,"entries")}catch{}}function nJ(J){return zJ.get(J)??[]}function h(J,K){if(J)zJ.set(J,K)}function CJ(J=process.env){return J.STX_DEBUG==="true"||J.STX_DEBUG==="1"}function x(...J){if(CJ())console.log("[stx:bundler]",...J)}var n=[];function r(J,K,$){n.push({filePath:J||"<inline>",message:K,details:$})}function oJ(){return n.slice()}function lJ(){n.length=0}var p;function dJ(J){p=J}function a(){if(p)return p;try{let J=qJ.strict;return typeof J==="object"&&J!==null?J.bundlerFallback??"warn":"warn"}catch{return"warn"}}var e=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function sJ(J){let K=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,$;while(($=K.exec(J))!==null){let Y=$[1];if(!e.some((H)=>H.test(Y)))return x("detected user import:",Y),!0}let W=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while(($=W.exec(J))!==null){let Y=$[1];if(/\.css(?:\?.*)?$/.test(Y))continue;if(!e.some((H)=>H.test(Y)))return x("detected side-effect import:",Y),!0}return!1}var v="stx-module:",xJ=/\.(?:[cm]?[jt]sx?|json)$/i;function IJ(J,K){return X.relative(J,K).split(X.sep).join("/")}function _J(J,K){if(K.size===0)return J;return J.replace(/^([ \t]*import\s+(?:[^;"']*?\s+from\s+)?)(["'])([^"']+)\2/gm,($,W,Y,z)=>{let H=K.get(z);return H&&!z.startsWith(v)?`${W}${Y}${H}${Y}`:$})}function NJ(J,K){let $=0,W=(z)=>{let H=`__stxMod${$++}`,j=JSON.stringify(z);return K.push(`var ${H} = globalThis.__stxModules && globalThis.__stxModules[${j}];`,`if (${H} === undefined) throw new Error("[stx] module " + ${JSON.stringify(j)} + " is not registered on this page (#1957)");`),H},Y=(z,H)=>{for(let j of z.split(",")){let T=j.trim();if(!T)continue;let Q=T.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!Q)continue;let Z=Q[1].startsWith('"')?JSON.parse(Q[1]):Q[1],G=Q[2]??Z;K.push(`var ${G} = ${H}[${JSON.stringify(Z)}];`)}};return J=J.replace(/^[ \t]*import\s+([^;"']*?)\s+from\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(z,H,j)=>{let T=j.slice(v.length),Q=W(T),Z=H.trim(),G=Z.match(/^([\w$]+)\s*(?:,\s*|$)/);if(G&&!Z.startsWith("{")&&!Z.startsWith("*"))K.push(`var ${G[1]} = ${Q}.default;`),Z=Z.slice(G[0].length).trim();let q=Z.match(/^\*\s*as\s+([\w$]+)$/);if(q)K.push(`var ${q[1]} = ${Q};`);else if(Z.startsWith("{"))Y(Z.replace(/^\{|\}$/g,""),Q);return""}),J=J.replace(/^[ \t]*import\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(z,H)=>{return W(H.slice(v.length)),""}),J}function JJ(J){let K=[J,`${J}.ts`,`${J}.tsx`,`${J}.js`,`${J}.mjs`,`${J}.jsx`,X.join(J,"index.ts"),X.join(J,"index.tsx"),X.join(J,"index.js"),X.join(J,"index.mjs")];for(let $ of K)try{if(O.existsSync($)&&O.statSync($,{throwIfNoEntry:!1})?.isFile())return $}catch{}return}function SJ(J,K,$,W,Y,z=new Map,H){let j=(Q,Z,G)=>{if(P(Z,J,H))return null;if(!Y||Q!==$||!xJ.test(Z))return null;try{if(!O.statSync(Z,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}W.add(Z);let q=`${v}${IJ(process.cwd(),Z)}`;return z.set(G,q),{path:q,external:!0}},T=(Q,Z)=>{let G=Q===$?K:X.dirname(Q),q=X.resolve(G,Z);return JJ(q)??q};return{name:"stx-client-bundle",setup(Q){if(Q.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(Z)=>({path:Z.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(Z)=>({path:Z.path,external:!0})),Q.onResolve({filter:/^\//},(Z)=>{let G=JJ(Z.path);if(G){let q=j(Z.importer,G,Z.path);if(q)return q;if(G!==$)W.add(G);return{path:G}}return{path:Z.path,external:!0}}),Q.onResolve({filter:/^\.\.?\//},(Z)=>{let G=T(Z.importer,Z.path),q=j(Z.importer,G,Z.path);if(q)return q;return W.add(G),{path:G}}),Q.onResolve({filter:/^[@~]\//},(Z)=>{let G=X.resolve(J,Z.path.slice(2)),q=[G,`${G}.ts`,`${G}.tsx`,`${G}.js`,`${G}.mjs`,`${G}.jsx`,X.join(G,"index.ts"),X.join(G,"index.tsx"),X.join(G,"index.js"),X.join(G,"index.mjs")];for(let w of q)if(O.existsSync(w)&&O.statSync(w,{throwIfNoEntry:!1})?.isFile()){let y=j(Z.importer,w,Z.path);if(y)return y;return x(`resolved ${Z.path[0]}/ import:`,Z.path,"\u2192",w),W.add(w),{path:w}}return console.warn(`[stx:bundler] could not resolve ${Z.path[0]}/ import:`,Z.path),{path:G}}),Y)Q.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(Z)=>{if(Z.importer!==$)return;let G=`${v}npm:${Z.path}`;return z.set(Z.path,G),{path:G,external:!0}});Q.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(Z)=>{if(P(Z.path,J,H))throw Error(`Server-only API source cannot be imported by a client script: ${Z.path}`);let G=X.extname(Z.path).toLowerCase(),q=G===".json"?"json":G===".tsx"?"tsx":G===".jsx"?"jsx":G===".ts"||G===".mts"||G===".cts"?"ts":"js";if(Z.path!==$)W.add(Z.path);return{contents:O.readFileSync(Z.path,"utf8"),loader:q}})}}}var m=new Map,D=YJ(64),KJ=Symbol.for("stx.client-bundle-build-queue");function yJ(J){let K=globalThis,W=(K[KJ]??Promise.resolve()).then(J,J);return K[KJ]=W.then(()=>{return},()=>{return}),W}async function iJ(J,K,$={}){let W=$.projectRoot||process.cwd(),Y=(await XJ(W)).serverApi,z=$.minify??!1,H=$.externalizeUserModules??!0,j=$.cacheDir||c(W,"bundle-cache"),T=new Bun.CryptoHasher("md5");T.update(`${TJ}\x00${WJ()}\x00${JSON.stringify(Y??!1)}\x00${H?"registry":"inline"}\x00${J}\x00${K}`);let Q=T.digest("hex").slice(0,12),Z=X.join(j,`${Q}.js`),G=D.get(Z);if(G){if(u(G.files)&&G.files.every((A)=>!P(A.path,W,Y))){x("memo hit:",Q);let A=G.files.map((M)=>M.path);return h(K,A),$.collectInputs?.push(...A),G.code}D.delete(Z),x("memo invalidated by dep change:",Q)}let q=X.join(j,`${Q}.deps.json`),w=Bun.file(Z);if(await w.exists()){let A=Bun.file(q),M=!1,U=null;if(await A.exists())try{let N=JSON.parse(await A.text());if(N.metadataVersion!==HJ||!Array.isArray(N.files))M=!1;else U=N.files,M=!0;if(U&&(!u(U)||U.some((B)=>P(B.path,W,Y))))M=!1}catch{M=!1}if(M){if(x("cache hit:",Q),U)h(K,U.map((B)=>B.path)),$.collectInputs?.push(...U.map((B)=>B.path));let N=await w.text();if(U)D.set(Z,{code:N,files:U});return N}x("cache invalidated by dep change:",Q)}let y=m.get(Q);if(y){let A=await y;if($.collectInputs)$.collectInputs.push(...(D.get(Z)?.files??[]).map((M)=>M.path));return A}let I=yJ(()=>FJ(J,K,{projectRoot:W,minify:z,cacheDir:j,hash:Q,cachePath:Z,depsPath:q,collectInputs:$.collectInputs,externalizeUserModules:H,serverApi:Y}));m.set(Q,I);try{return await I}finally{m.delete(Q)}}var BJ=0;function RJ(J){return`${J}-${process.pid}-${++BJ}`}async function FJ(J,K,$){let{projectRoot:W,minify:Y,cacheDir:z,hash:H,cachePath:j,depsPath:T,externalizeUserModules:Q}=$,Z=c(W,"bundle-tmp"),G=RJ(H),q=X.join(Z,`${G}.ts`),w=X.join(Z,"out",G);O.mkdirSync(Z,{recursive:!0}),O.mkdirSync(w,{recursive:!0});let y=X.dirname(K),I=new Set,A=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,M=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,U=ZJ(J),{depths:N,balanced:B}=$J(U),o=(L)=>!B||N[L]===0,C;while((C=A.exec(U))!==null){if(C[1])continue;if(!o(C.index))continue;if(C[2])C[2].split(",").forEach((L)=>{let k=DJ(L);if(k)I.add(k)});else if(C[3])I.add(C[3])}while((C=M.exec(U))!==null){if(C[1])continue;if(!o(C.index))continue;I.add(C[2])}let VJ=I.size>0?`
|
|
5
5
|
export { ${[...I].join(", ")} }`:"";await Bun.write(q,J+VJ),x("bundling:",H,"from:",X.basename(K));let l=new Set,d=new Map;try{let L=await Bun.build({entrypoints:[q],outdir:w,target:"browser",format:"esm",minify:Y,plugins:[SJ(W,y,q,l,Q,d,$.serverApi)],define:{"process.env.NODE_ENV":Y?'"production"':'"development"',...GJ()},root:W});if(!L.success){let S=L.logs.filter((R)=>R.level==="error").map((R)=>R.message).join(", ")||`Unable to bundle ${X.basename(K)}`,F=b(L.logs,K||void 0);if(console.warn("[stx:bundler] build failed:",S),r(K||"",S,F),a()==="error")throw Error(S);return J}let k="";for(let V of L.outputs){k=await V.text();break}let _=[];for(let V of k.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let S of V[1].split(",")){let F=S.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(F){_.push([F[2],F[1]]);continue}let R=S.trim();if(/^[A-Za-z_$][\w$]*$/.test(R))_.push([R,R])}let s=[];k=NJ(_J(k,d),s);let kJ=k.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];k=k.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let i=`__stxBundle_${H}`,jJ=_.map(([V,S])=>`${JSON.stringify(V)}: ${S}`).join(", "),OJ=_.map(([V])=>`var ${V} = undefined;`).join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$o as e,Xo as a,Yo as b,Zo as c,_o as d,ap as f,bp as g}from"./chunk-
|
|
2
|
+
import{$o as e,Xo as a,Yo as b,Zo as c,_o as d,ap as f,bp as g}from"./chunk-zstrcmbj.js";import"./chunk-4cv7bw5e.js";import"./chunk-7tgjn256.js";import"./chunk-h8zp2fz9.js";import"./chunk-ekvejzvk.js";import"./chunk-3769e62c.js";import"./chunk-7c8r36ve.js";import"./chunk-yj5gkn17.js";import"./chunk-cy8hgd86.js";import"./chunk-twws9vvz.js";import"./chunk-g7qmxjyc.js";import"./chunk-88tt0qg0.js";import"./chunk-e1rv01pn.js";import"./chunk-bdz7nznw.js";import"./chunk-rwtj7j0r.js";import"./chunk-eqhsprr0.js";import"./chunk-csgshaeh.js";import"./chunk-d0qy1ezf.js";import"./chunk-c9kj8p6j.js";import"./chunk-x2wmn8m7.js";import"./chunk-rxz43r6k.js";export{a as resetUnscopedSignalWarnings,g as processStackReplacements,f as processStackPushDirectives,e as processIncludes,b as partialsCache,c as onceStore,d as clearOnceStore};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ao as j,Bo as k,Co as l,Do as m,ro as a,so as b,to as c,uo as d,vo as e,wo as f,xo as g,yo as h,zo as i}from"./chunk-
|
|
2
|
+
import{Ao as j,Bo as k,Co as l,Do as m,ro as a,so as b,to as c,uo as d,vo as e,wo as f,xo as g,yo as h,zo as i}from"./chunk-zstrcmbj.js";import"./chunk-4cv7bw5e.js";import"./chunk-7tgjn256.js";import"./chunk-h8zp2fz9.js";import"./chunk-ekvejzvk.js";import"./chunk-3769e62c.js";import"./chunk-7c8r36ve.js";import"./chunk-yj5gkn17.js";import"./chunk-cy8hgd86.js";import"./chunk-twws9vvz.js";import"./chunk-g7qmxjyc.js";import"./chunk-88tt0qg0.js";import"./chunk-e1rv01pn.js";import"./chunk-bdz7nznw.js";import"./chunk-rwtj7j0r.js";import"./chunk-eqhsprr0.js";import"./chunk-csgshaeh.js";import"./chunk-d0qy1ezf.js";import"./chunk-c9kj8p6j.js";import"./chunk-x2wmn8m7.js";import"./chunk-rxz43r6k.js";export{m as stripStxRuntimeImports,b as scanScriptTags,l as rewriteStxImportSpecifiers,j as processSignals,h as processScriptSetup,f as preEvalLiteralReactiveIfs,c as parseLoopExpression,d as hasSignalsSyntax,k as findMarkupIndexOutsideScripts,i as extractExports,g as convertSignalLoopsToAttributes,e as convertSignalDirectivesToAttributes,a as clearScriptScanCache};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Xe as a}from"./chunk-
|
|
2
|
+
import{Xe as a}from"./chunk-61cwdy7h.js";import"./chunk-zstrcmbj.js";import"./chunk-4cv7bw5e.js";import"./chunk-7tgjn256.js";import"./chunk-h8zp2fz9.js";import"./chunk-ekvejzvk.js";import"./chunk-3769e62c.js";import"./chunk-7c8r36ve.js";import"./chunk-yj5gkn17.js";import"./chunk-cy8hgd86.js";import"./chunk-twws9vvz.js";import"./chunk-g7qmxjyc.js";import"./chunk-88tt0qg0.js";import"./chunk-e1rv01pn.js";import"./chunk-bdz7nznw.js";import"./chunk-rwtj7j0r.js";import"./chunk-eqhsprr0.js";import"./chunk-csgshaeh.js";import"./chunk-d0qy1ezf.js";import"./chunk-c9kj8p6j.js";import"./chunk-x2wmn8m7.js";import"./chunk-rxz43r6k.js";export{a as startInteractive};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Og as a,Pg as b,Qg as c,Rg as d,Sg as e,Tg as f}from"./chunk-
|
|
2
|
+
import{Og as a,Pg as b,Qg as c,Rg as d,Sg as e,Tg as f}from"./chunk-pm8wzxsb.js";import"./chunk-zstrcmbj.js";import"./chunk-4cv7bw5e.js";import"./chunk-7tgjn256.js";import"./chunk-h8zp2fz9.js";import"./chunk-ekvejzvk.js";import"./chunk-3769e62c.js";import"./chunk-7c8r36ve.js";import"./chunk-yj5gkn17.js";import"./chunk-cy8hgd86.js";import"./chunk-twws9vvz.js";import"./chunk-g7qmxjyc.js";import"./chunk-88tt0qg0.js";import"./chunk-e1rv01pn.js";import"./chunk-bdz7nznw.js";import"./chunk-rwtj7j0r.js";import"./chunk-eqhsprr0.js";import"./chunk-csgshaeh.js";import"./chunk-d0qy1ezf.js";import"./chunk-c9kj8p6j.js";import"./chunk-x2wmn8m7.js";import"./chunk-rxz43r6k.js";export{c as renderSlot,d as processSlots,a as parseSlots,b as parseSlotElement,e as extractSlotContent,f as applySlots};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ql as a,rl as b,sl as c,tl as d,ul as e,vl as f,wl as g}from"./chunk-
|
|
2
|
+
import{ql as a,rl as b,sl as c,tl as d,ul as e,vl as f,wl as g}from"./chunk-h7sgg3vh.js";import"./chunk-ekvejzvk.js";import"./chunk-yj5gkn17.js";import"./chunk-g7qmxjyc.js";import"./chunk-d0qy1ezf.js";import"./chunk-rxz43r6k.js";export{e as productionApiDispatcher,g as isServerApiSource,b as generateApiTypes,a as discoverServerApi,f as createServerApi,d as createApiDispatcher,c as buildServerApi};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Dr as g,Em as O,No as R,Tp as H,yq as x}from"./chunk-
|
|
2
|
+
import{Dr as g,Em as O,No as R,Tp as H,yq as x}from"./chunk-zstrcmbj.js";import b from"path";var v={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},M=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var T=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function f(q){let B=[],Q=0,G;T.lastIndex=0;while((G=T.exec(q))!==null){if(G.index>Q){let X=q.slice(Q,G.index);if(X.trim())B.push({type:B.length===0?"shell":"content",content:X})}let J=G[1],K=G[2];B.push({type:"suspense",name:J,content:K}),Q=G.index+G[0].length}if(Q<q.length){let J=q.slice(Q);if(J.trim())B.push({type:B.length===0?"shell":"content",content:J})}if(B.length===0)B.push({type:"shell",content:q});return B}async function r(q,B={},Q={}){let G={...g,...Q,streaming:{...v,...Q.streaming}},J=G.streaming?.bufferSize||16384;return new ReadableStream({async start(K){try{let X=await Bun.file(q).text(),z=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),L=z?z[1]:"",Y=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),j={...B,__filename:q,__dirname:b.dirname(q)};if(L.trim())await R(L,j,q);let D=f(Y),$=new Set;if(!D.some((w)=>w.type==="suspense")){let w=G.streaming?.strategy||"auto",U=new RegExp(M.source,"g");if(!(w!=="manual"&&U.test(Y))){let F=await H(Y,j,q,G,$);for(let V=0;V<F.length;V+=J)K.enqueue(F.slice(V,V+J)),await new Promise((W)=>setTimeout(W,0))}else{let F=[],V=new RegExp(M.source,"g"),W;while((W=V.exec(Y))!==null)F.push({name:W[1],content:W[2],start:W.index,end:W.index+W[0].length});let y=0;for(let A of F){if(A.start>y){let k=Y.slice(y,A.start);if(k.trim()){let E=await H(k,j,q,G,$);K.enqueue(E),await new Promise((S)=>setTimeout(S,0))}}let I=await H(A.content,j,q,G,$);K.enqueue(I),await new Promise((k)=>setTimeout(k,0)),y=A.end}if(y<Y.length){let A=Y.slice(y);if(A.trim()){let I=await H(A,j,q,G,$);K.enqueue(I)}}}}else{let w=new Map;for(let Z of D)if(Z.type==="shell"||Z.type==="content"){let F=await H(Z.content,j,q,G,$);K.enqueue(F)}else if(Z.type==="suspense"&&Z.name){let F=`stx-suspense-${Z.name}`;K.enqueue(`<div id="${F}" data-suspense="${Z.name}" style="display:contents;">
|
|
3
3
|
<template data-suspense-fallback>Loading...</template>
|
|
4
4
|
</div>`),w.set(Z.name,H(Z.content,j,q,G,$))}K.enqueue(`
|
|
5
5
|
<script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Lm as W,Tp as X}from"./chunk-
|
|
2
|
+
import{Lm as W,Tp as X}from"./chunk-zstrcmbj.js";import V from"fs";import M from"path";import*as Y from"readline";var j={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},Q={help:{description:"Show available commands",usage:"help [command]",handler:async(q,z)=>{if(q[0]&&Q[q[0]]){let A=Q[q[0]];console.log(`
|
|
3
3
|
${j.bold}${q[0]}${j.reset} - ${A.description}`),console.log(` Usage: ${j.cyan}${A.usage}${j.reset}
|
|
4
4
|
`)}else{console.log(`
|
|
5
5
|
${j.bold}Available Commands:${j.reset}
|