@stacksjs/stx 0.2.109 → 0.2.110
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/cli.js +3 -3
- package/dist/client-script-bundler.js +1 -2
- package/dist/pwa.js +2 -2
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -810,11 +810,11 @@ ${H}
|
|
|
810
810
|
`),X)J=J.replace(/\n/g,`<br />
|
|
811
811
|
`);for(let _=0;_<Q.length;_++)J=J.replace(`\x00CODEBLOCK${_}\x00`,Q[_]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}function q4($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,J)=>{return`const { ${J.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
|
|
812
812
|
`});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(X,J)=>{return`const { ${J.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
|
|
813
|
-
`}),$}import kU from"process";function y1($="STX_PUBLIC_"){let Z={},Y={};for(let[X,J]of Object.entries(kU.env)){if(!X.startsWith($)||J===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(J),Y[X]=J}return Z["import.meta.env"]=JSON.stringify(Y),Z}function SU($="STX_PUBLIC_"){let Z={};for(let[Y,X]of Object.entries(kU.env))if(Y.startsWith($)&&X!==void 0)Z[Y]=X;return Z}var M6=()=>{};import l$ from"path";function YJ($){bU=$?.trim()||null}function K5(){return process.env[CU]?.trim()||bU||T6}function f0($=process.cwd(),...Z){let Y=K5();return l$.isAbsolute(Y)?l$.join(Y,...Z):l$.join($,Y,...Z)}function W5($){if(!$||l$.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==T6&&!Z.startsWith(`${T6}/`))return $;let Y=Z.slice(T6.length+1);return Y?l$.join(K5(),Y):K5()}var T6=".stx",CU="STX_DIR",bU=null;var $4=()=>{};var I3={};e(I3,{hasUserImports:()=>mw,bundleClientScript:()=>lw});import o0 from"path";import x1 from"fs";function mw($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let X=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,J;while((J=X.exec($))!==null){let G=J[1];if(!PU.some((W)=>W.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let Q=/^\s*import\s+['"]([^'"]+)['"]/gm;while((J=Q.exec($))!==null){let G=J[1];if(/\.css(?:\?.*)?$/.test(G))continue;if(!PU.some((W)=>W.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function cw($,Z,Y,X){let J=(Q,G)=>{let K=Q===Y?Z:o0.dirname(Q),W=o0.resolve(K,G),U=[W,`${W}.ts`,`${W}.tsx`,`${W}.js`,`${W}.mjs`,`${W}.jsx`,o0.join(W,"index.ts"),o0.join(W,"index.tsx"),o0.join(W,"index.js"),o0.join(W,"index.mjs")];for(let _ of U)try{if(x1.existsSync(_)&&x1.statSync(_,{throwIfNoEntry:!1})?.isFile())return _}catch{}return W};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx
|
|
813
|
+
`}),$}import kU from"process";function y1($="STX_PUBLIC_"){let Z={},Y={};for(let[X,J]of Object.entries(kU.env)){if(!X.startsWith($)||J===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(J),Y[X]=J}return Z["import.meta.env"]=JSON.stringify(Y),Z}function SU($="STX_PUBLIC_"){let Z={};for(let[Y,X]of Object.entries(kU.env))if(Y.startsWith($)&&X!==void 0)Z[Y]=X;return Z}var M6=()=>{};import l$ from"path";function YJ($){bU=$?.trim()||null}function K5(){return process.env[CU]?.trim()||bU||T6}function f0($=process.cwd(),...Z){let Y=K5();return l$.isAbsolute(Y)?l$.join(Y,...Z):l$.join($,Y,...Z)}function W5($){if(!$||l$.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==T6&&!Z.startsWith(`${T6}/`))return $;let Y=Z.slice(T6.length+1);return Y?l$.join(K5(),Y):K5()}var T6=".stx",CU="STX_DIR",bU=null;var $4=()=>{};var I3={};e(I3,{hasUserImports:()=>mw,bundleClientScript:()=>lw});import o0 from"path";import x1 from"fs";function mw($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let X=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,J;while((J=X.exec($))!==null){let G=J[1];if(!PU.some((W)=>W.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let Q=/^\s*import\s+['"]([^'"]+)['"]/gm;while((J=Q.exec($))!==null){let G=J[1];if(/\.css(?:\?.*)?$/.test(G))continue;if(!PU.some((W)=>W.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function cw($,Z,Y,X){let J=(Q,G)=>{let K=Q===Y?Z:o0.dirname(Q),W=o0.resolve(K,G),U=[W,`${W}.ts`,`${W}.tsx`,`${W}.js`,`${W}.mjs`,`${W}.jsx`,o0.join(W,"index.ts"),o0.join(W,"index.tsx"),o0.join(W,"index.js"),o0.join(W,"index.mjs")];for(let _ of U)try{if(x1.existsSync(_)&&x1.statSync(_,{throwIfNoEntry:!1})?.isFile())return _}catch{}return W};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^\.\.?\//},(G)=>{let K=J(G.importer,G.path);return X.add(K),{path:K}}),Q.onResolve({filter:/^[@~]\//},(G)=>{let K=o0.resolve($,G.path.slice(2)),W=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,o0.join(K,"index.ts"),o0.join(K,"index.tsx"),o0.join(K,"index.js"),o0.join(K,"index.mjs")];for(let U of W)if(x1.existsSync(U)&&x1.statSync(U,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",U),X.add(U),{path:U};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}})}}}async function lw($,Z,Y={}){let X=Y.projectRoot||process.cwd(),J=Y.minify??!1,Q=Y.cacheDir||f0(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Z);let K=G.digest("hex").slice(0,12),W=o0.join(Q,`${K}.js`),U=o0.join(Q,`${K}.deps.json`),_=Bun.file(W);if(await _.exists()){let N=Bun.file(U),w=!0;if(await N.exists())try{let R=JSON.parse(await N.text());for(let T of R.files)try{if(x1.statSync(T.path).mtimeMs!==T.mtimeMs){w=!1;break}}catch{w=!1;break}}catch{w=!1}if(w)return console.log("[stx:bundler] cache hit:",K),await _.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let z=f0(X,"bundle-tmp"),B=o0.join(z,`${K}.ts`),q=o0.join(z,"out",K);x1.mkdirSync(z,{recursive:!0}),x1.mkdirSync(q,{recursive:!0});let j=o0.dirname(Z),H=[],O=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,V=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=O.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((N)=>{let w=N.split(":")[0].trim();if(w)H.push(w)});else if(L[3])H.push(L[3])}while((L=V.exec($))!==null){if(L[1])continue;H.push(L[2])}let F=H.length>0?`
|
|
814
814
|
export { ${H.join(", ")} }`:"";await Bun.write(B,$+F),console.log("[stx:bundler] bundling:",K,"from:",o0.basename(Z));let A=new Set;try{let N=await Bun.build({entrypoints:[B],outdir:q,target:"browser",format:"esm",minify:J,plugins:[cw(X,j,B,A)],define:{"process.env.NODE_ENV":J?'"production"':'"development"',...y1()},root:X});if(!N.success){let E=N.logs.filter((I)=>I.level==="error").map((I)=>I.message).join(", ");return console.warn("[stx:bundler] build failed:",E),$}let w="";for(let E of N.outputs){w=await E.text();break}let R=[];for(let E of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let I of E[1].split(",")){let k=I.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k&&k[1]!==k[2])R.push([k[2],k[1]])}if(w=w.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),R.length>0){let E=R.map(([I,k])=>`${JSON.stringify(I)}: ${k}`).join(", ");w+=`
|
|
815
815
|
var __stxScopeRenames = { ${E} };`}console.log("[stx:bundler] bundled:",K,"output:",w.length,"bytes"),x1.mkdirSync(Q,{recursive:!0}),await Bun.write(W,w);let T=Array.from(A).map((E)=>{try{return{path:E,mtimeMs:x1.statSync(E).mtimeMs}}catch{return null}}).filter((E)=>E!==null);return await Bun.write(U,JSON.stringify({files:T})),w}catch(N){let w=N instanceof Error?N.message:String(N),R=N?.errors,T=Array.isArray(R)&&R.length>0?`
|
|
816
816
|
${R.map((E)=>`- ${E?.message??E}`).join(`
|
|
817
|
-
`)}`:"";return console.warn(`[stx:bundler] error: ${w}${T}`),$}finally{try{x1.rmSync(B,{force:!0}),x1.rmSync(q,{recursive:!0,force:!0})}catch{}}}var PU;var D3=D(()=>{M6();$4();PU=[/^stx$/,/^@stacksjs\/stx$/,/^@
|
|
817
|
+
`)}`:"";return console.warn(`[stx:bundler] error: ${w}${T}`),$}finally{try{x1.rmSync(B,{force:!0}),x1.rmSync(q,{recursive:!0,force:!0})}catch{}}}var PU;var D3=D(()=>{M6();$4();PU=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});var xU={};e(xU,{renderVendorStyleTags:()=>JJ,processClientScript:()=>v4,generateServerDataBridge:()=>i$,generateAutoImportDestructuring:()=>QJ,extractBridgeData:()=>x4,extractAndStripCssImports:()=>XJ});import E6 from"path";import p$ from"fs";function iw($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function nw($,Z){let Y=Z;while(!0){let X=E6.join(Y,"node_modules",$,"package.json");if(p$.existsSync(X))return E6.dirname(X);let J=E6.dirname(Y);if(J===Y)return null;Y=J}}function rw($,Z){if(!$||typeof $!=="object")return null;let Y=(J)=>{if(typeof J==="string")return J;if(J&&typeof J==="object"){if(typeof J.import==="string")return J.import;if(typeof J.default==="string")return J.default;if(typeof J.import==="object")return Y(J.import);if(typeof J.default==="object")return Y(J.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let X=null;for(let J of Object.keys($)){let Q=J.indexOf("*");if(Q===-1)continue;let G=J.slice(0,Q),K=J.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!X||G.length>X.prefix.length)X={pattern:J,prefix:G,suffix:K}}if(X){let J=Z.slice(X.prefix.length,Z.length-X.suffix.length),Q=Y($[X.pattern]);if(Q)return Q.replace("*",J)}return null}function aw($,Z){let Y=iw($);if(!Y||!Y.subpath)return null;let X=nw(Y.pkg,Z);if(!X)return null;let J;try{J=JSON.parse(p$.readFileSync(E6.join(X,"package.json"),"utf8"))}catch{return null}let Q=`.${Y.subpath}`,G=rw(J.exports,Q);if(!G)return null;let K=E6.resolve(X,G);return p$.existsSync(K)?K:null}function XJ($,Z){let Y=Z.filePath?E6.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),J=new Set,Q=[];return{code:$.replace(pw,(K,W)=>{let U;try{if(W.startsWith("./")||W.startsWith("../")||W.startsWith("/")){if(U=W.startsWith("/")?W:E6.resolve(Y,W),!p$.existsSync(U))throw Error(`file not found: ${U}`)}else{let _=null;try{_=Bun.resolveSync(W,X)}catch{_=aw(W,X)}if(!_)throw Error(`could not resolve ${W} (Bun.resolveSync + exports fallback both failed)`);U=_}}catch(_){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(W)} (from ${Z.filePath||"<unknown>"}): ${_?.message||_}`),""}if(J.has(U))return"";J.add(U);try{let _=p$.readFileSync(U,"utf8");Q.push({source:W,resolvedPath:U,contents:_})}catch(_){console.warn(`[stx:vendor-css] could not read ${U}: ${_?.message||_}`)}return""}),styles:Q}}function sw($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function JJ($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${sw(Z.source)}" data-stx-layer="vendor">
|
|
818
818
|
@layer vendor {
|
|
819
819
|
${Z.contents}
|
|
820
820
|
}
|
|
@@ -20792,7 +20792,7 @@ else {
|
|
|
20792
20792
|
`)}function Kw($,Z){let Y=" ".repeat(Z),X=[];for(let[K,W]of Object.entries($.props))if(W.type==="literal"){let U=typeof W.value==="string"?`"${W.value}"`:String(W.value);X.push(`${K}: ${U}`)}let J=X.length>0?`{ ${X.join(", ")} }`:"{}",Q=$.children.map((K)=>K.type==="text"?`"${K.props.text?.type==="literal"?K.props.text.value:""}"`:Kw(K,Z+1)),G=Q.length>0?`,
|
|
20793
20793
|
${Y} [${Q.join(`,
|
|
20794
20794
|
${Y} `)}]`:"";return`Craft.create("${$.zigType}", ${J}${G})`}function If($,Z,Y){if(Z.target==="universal"){let X=[];X.push("// Universal entry point"),X.push("");for(let[J,Q]of Y)X.push(`// --- ${J.toUpperCase()} ---`),X.push(`#if ${J.toUpperCase()}`),X.push(Q),X.push("#endif"),X.push("");return X.join(`
|
|
20795
|
-
`)}return Y.get(Z.target)||WU($,Z)}function Df($,Z,Y){let X=[];function J(Q){X.push({name:Q.zigType,hash:Uw(JSON.stringify(Q.props)),props:Object.keys(Q.props),events:Array.from(Q.events.keys()),slots:[],isNative:Q.zigType.startsWith("craft.")});for(let G of Q.children)J(G)}return J(Z),{version:"1.0.0",components:X,entry:$.id,assets:[],styles:$.styles}}function kf($,Z){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}function Ww(){return`id_${++Sf}`}function Uw($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$.charCodeAt(Y);Z=(Z<<5)-Z+X,Z=Z&Z}return Math.abs(Z).toString(36)}function Cf($){return $.charAt(0).toUpperCase()+$.slice(1)}function bf($){let Z=[],Y=/<script[^>]*>([\s\S]*?)<\/script>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function Pf($){let Z=[],Y=/<style[^>]*>([\s\S]*?)<\/style>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function UU($){let Z=$.type==="component"?1:0;if($.children)for(let Y of $.children)Z+=UU(Y);return Z}function _U($){let Z=$.zigType.startsWith("craft.")?1:0;for(let Y of $.children)Z+=_U(Y);return Z}function _w($){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(Z)=>{console.log(`[craft-compiler] File changed: ${Z}`)}}}var zU,Sf=0,yf,xf;var Bw=D(()=>{zU=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);yf={compileToNative:Yw,createHotReloadServer:_w,NATIVE_COMPONENTS:zU},xf=yf});import{spawn as Hw}from"child_process";import y0 from"fs";import vf from"os";import Y0 from"path";import y from"process";import{CLI as gf}from"@stacksjs/clapp";var R6="0.2.109";G5();hW();nG();YK();h4();eG();cG();kW();var __dirname="/home/runner/work/stx/stx/packages/stx/bin",H0=new gf("stx");function qw($){let Z=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(Z))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(Z<1024||Z>65535)return{isValid:!1,error:"Port must be between 1024 and 65535",suggestion:"Try using a port between 1024 and 65535"};return{isValid:!0}}function jw($){try{if(!y0.existsSync($)){let Y=Y0.dirname($),X=Y0.basename($);if(y0.existsSync(Y)){let Q=y0.readdirSync(Y).filter((K)=>K.toLowerCase().includes(X.toLowerCase().substring(0,3))||K.endsWith(".stx")||K.endsWith(".md")),G=Q.length>0?`File not found. Similar files in ${Y}: ${Q.slice(0,3).join(", ")}`:`File not found. Directory ${Y} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${$}`,suggestion:G}}return{isValid:!1,error:`File does not exist: ${$}`,suggestion:"Check the file path and try again"}}if(y0.statSync($).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${$}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(Z){return{isValid:!1,error:`Cannot access file: ${$}`,suggestion:"Check file permissions and path"}}}function BU($){let Z=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(Z))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(Z<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(Z>300000)return{isValid:!1,error:"Timeout too long (maximum 5 minutes)",suggestion:"Use a timeout of less than 300000ms (5 minutes)"};return{isValid:!0}}var m$=($)=>$.includes("*")||$.includes("?")||$.includes("{")||$.includes("["),ff=($)=>$.endsWith(".stx")||$.endsWith(".md");function u$($,Z=1){if(console.error(`\u274C ${$.error}`),$.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${$.suggestion}`);y.exit(Z)}async function hf($,Z){try{let Y=["test"],X=[];if($&&$.length>0)for(let W of $)if(m$(W))try{let U=await Array.fromAsync(new Bun.Glob(W).scan({onlyFiles:!0,absolute:!0}));if(U.length===0)console.warn(`Warning: No files found matching pattern: ${W}`);else if(X.push(...U),Z.verbose)console.log(`Found ${U.length} file(s) matching pattern: ${W}`)}catch(U){return console.error(`Error expanding glob pattern ${W}:`,U),!1}else X.push(W);if(X.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(Y.push(...X),Z.filter)Y.push("--pattern",Z.filter);if(Z.timeout)Y.push("--timeout",Z.timeout.toString());if(Z.reporter&&Z.reporter!=="default")if(Z.reporter==="junit"){let W=Y0.join(vf.tmpdir(),`stx-test-report-${Date.now()}.xml`);Y.push("--reporter",Z.reporter),Y.push("--reporter-outfile",W)}else console.warn(`Warning: Reporter '${Z.reporter}' is not supported. Using default reporter.`);if(Z.coverage)Y.push("--coverage");if(Z.watch)Y.push("--watch");Y.push("--preload",Y0.join(__dirname,"../../../test-utils/happy-dom.ts"));let J={...y.env,STX_TEST_MODE:"true",STX_TEST_UI:Z.ui?"true":"false",STX_TEST_VERBOSE:Z.verbose?"true":"false"},Q="bun";if(Z.verbose)console.log(`Running: ${Q} ${Y.join(" ")}`);let G=performance.now(),K=Hw(Q,Y,{stdio:"inherit",shell:!1,env:J});return new Promise((W)=>{K.on("close",(U)=>{let z=((performance.now()-G)/1000).toFixed(2);if(U===0)W(!0);else W(!1)}),y.on("SIGINT",()=>{console.log(`
|
|
20795
|
+
`)}return Y.get(Z.target)||WU($,Z)}function Df($,Z,Y){let X=[];function J(Q){X.push({name:Q.zigType,hash:Uw(JSON.stringify(Q.props)),props:Object.keys(Q.props),events:Array.from(Q.events.keys()),slots:[],isNative:Q.zigType.startsWith("craft.")});for(let G of Q.children)J(G)}return J(Z),{version:"1.0.0",components:X,entry:$.id,assets:[],styles:$.styles}}function kf($,Z){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}function Ww(){return`id_${++Sf}`}function Uw($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$.charCodeAt(Y);Z=(Z<<5)-Z+X,Z=Z&Z}return Math.abs(Z).toString(36)}function Cf($){return $.charAt(0).toUpperCase()+$.slice(1)}function bf($){let Z=[],Y=/<script[^>]*>([\s\S]*?)<\/script>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function Pf($){let Z=[],Y=/<style[^>]*>([\s\S]*?)<\/style>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function UU($){let Z=$.type==="component"?1:0;if($.children)for(let Y of $.children)Z+=UU(Y);return Z}function _U($){let Z=$.zigType.startsWith("craft.")?1:0;for(let Y of $.children)Z+=_U(Y);return Z}function _w($){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(Z)=>{console.log(`[craft-compiler] File changed: ${Z}`)}}}var zU,Sf=0,yf,xf;var Bw=D(()=>{zU=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);yf={compileToNative:Yw,createHotReloadServer:_w,NATIVE_COMPONENTS:zU},xf=yf});import{spawn as Hw}from"child_process";import y0 from"fs";import vf from"os";import Y0 from"path";import y from"process";import{CLI as gf}from"@stacksjs/clapp";var R6="0.2.110";G5();hW();nG();YK();h4();eG();cG();kW();var __dirname="/home/runner/work/stx/stx/packages/stx/bin",H0=new gf("stx");function qw($){let Z=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(Z))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(Z<1024||Z>65535)return{isValid:!1,error:"Port must be between 1024 and 65535",suggestion:"Try using a port between 1024 and 65535"};return{isValid:!0}}function jw($){try{if(!y0.existsSync($)){let Y=Y0.dirname($),X=Y0.basename($);if(y0.existsSync(Y)){let Q=y0.readdirSync(Y).filter((K)=>K.toLowerCase().includes(X.toLowerCase().substring(0,3))||K.endsWith(".stx")||K.endsWith(".md")),G=Q.length>0?`File not found. Similar files in ${Y}: ${Q.slice(0,3).join(", ")}`:`File not found. Directory ${Y} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${$}`,suggestion:G}}return{isValid:!1,error:`File does not exist: ${$}`,suggestion:"Check the file path and try again"}}if(y0.statSync($).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${$}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(Z){return{isValid:!1,error:`Cannot access file: ${$}`,suggestion:"Check file permissions and path"}}}function BU($){let Z=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(Z))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(Z<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(Z>300000)return{isValid:!1,error:"Timeout too long (maximum 5 minutes)",suggestion:"Use a timeout of less than 300000ms (5 minutes)"};return{isValid:!0}}var m$=($)=>$.includes("*")||$.includes("?")||$.includes("{")||$.includes("["),ff=($)=>$.endsWith(".stx")||$.endsWith(".md");function u$($,Z=1){if(console.error(`\u274C ${$.error}`),$.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${$.suggestion}`);y.exit(Z)}async function hf($,Z){try{let Y=["test"],X=[];if($&&$.length>0)for(let W of $)if(m$(W))try{let U=await Array.fromAsync(new Bun.Glob(W).scan({onlyFiles:!0,absolute:!0}));if(U.length===0)console.warn(`Warning: No files found matching pattern: ${W}`);else if(X.push(...U),Z.verbose)console.log(`Found ${U.length} file(s) matching pattern: ${W}`)}catch(U){return console.error(`Error expanding glob pattern ${W}:`,U),!1}else X.push(W);if(X.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(Y.push(...X),Z.filter)Y.push("--pattern",Z.filter);if(Z.timeout)Y.push("--timeout",Z.timeout.toString());if(Z.reporter&&Z.reporter!=="default")if(Z.reporter==="junit"){let W=Y0.join(vf.tmpdir(),`stx-test-report-${Date.now()}.xml`);Y.push("--reporter",Z.reporter),Y.push("--reporter-outfile",W)}else console.warn(`Warning: Reporter '${Z.reporter}' is not supported. Using default reporter.`);if(Z.coverage)Y.push("--coverage");if(Z.watch)Y.push("--watch");Y.push("--preload",Y0.join(__dirname,"../../../test-utils/happy-dom.ts"));let J={...y.env,STX_TEST_MODE:"true",STX_TEST_UI:Z.ui?"true":"false",STX_TEST_VERBOSE:Z.verbose?"true":"false"},Q="bun";if(Z.verbose)console.log(`Running: ${Q} ${Y.join(" ")}`);let G=performance.now(),K=Hw(Q,Y,{stdio:"inherit",shell:!1,env:J});return new Promise((W)=>{K.on("close",(U)=>{let z=((performance.now()-G)/1000).toFixed(2);if(U===0)W(!0);else W(!1)}),y.on("SIGINT",()=>{console.log(`
|
|
20796
20796
|
Test run interrupted`),K.kill("SIGINT"),y.exit(1)})})}catch(Y){return console.error("Error running tests:",Y instanceof Error?Y.message:String(Y)),!1}}var df=y.argv.length>=3&&(ff(y.argv[2])&&y0.existsSync(y.argv[2])||m$(y.argv[2]));if(df){let $=y.argv[2],Z={port:3000,watch:!0,cache:!0,markdown:{syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}}};for(let Y=3;Y<y.argv.length;Y++){let X=y.argv[Y];if(X==="--port"&&Y+1<y.argv.length){let J=qw(y.argv[++Y]);if(!J.isValid)u$(J);Z.port=Number.parseInt(y.argv[Y],10)}else if(X==="--no-watch")Z.watch=!1;else if(X==="--highlight-theme"&&Y+1<y.argv.length){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.defaultTheme=y.argv[++Y]}else if(X==="--no-highlight"){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.enabled=!1}else if(X==="--no-highlight-unknown"){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.highlightUnknownLanguages=!1}else if(X==="--no-cache")Z.cache=!1;else if(X==="--native")Z.native=!0}if(m$($))try{let Y=await Array.fromAsync(new Bun.Glob($).scan({onlyFiles:!0,absolute:!0})),X=$.endsWith(".stx")?Y.filter((K)=>K.endsWith(".stx")):$.endsWith(".md")?Y.filter((K)=>K.endsWith(".md")):Y.filter((K)=>K.endsWith(".stx")||K.endsWith(".md")),J=$.split("*")[0].replace(/\/$/,"")||".",Q=Y0.resolve(J);try{let K=new Bun.Glob("**/*.stx"),U=(await Array.fromAsync(K.scan({cwd:Q,onlyFiles:!0,absolute:!0}))).filter((_)=>/\[.+\]/.test(Y0.basename(_)));for(let _ of U)if(!X.includes(_))X.push(_)}catch{}if(X.length===0)console.error(`Error: No STX or Markdown files found matching pattern: ${$}`),y.exit(1);if(!await t8(X,Z))y.exit(1)}catch(Y){console.error("Failed to process files:",Y),y.exit(1)}else o8($,Z).catch((Y)=>{console.error("Failed to start dev server:",Y),y.exit(1)})}else{let $=function(X,J){let Q=[];for(let G=0;G<=J.length;G++)Q[G]=[G];for(let G=0;G<=X.length;G++)Q[0][G]=G;for(let G=1;G<=J.length;G++)for(let K=1;K<=X.length;K++)if(J.charAt(G-1)===X.charAt(K-1))Q[G][K]=Q[G-1][K-1];else Q[G][K]=Math.min(Q[G-1][K-1]+1,Q[G][K-1]+1,Q[G-1][K]+1);return Q[J.length][X.length]};H0.command("docs","Generate documentation for components, templates, and directives").option("--output <dir>","Output directory for documentation",{default:"docs"}).option("--format <format>","Documentation format (markdown, html, json)",{default:"markdown"}).option("--components-dir <dir>","Components directory",{default:"components"}).option("--templates-dir <dir>","Templates directory",{default:"."}).option("--no-components","Disable components documentation").option("--no-templates","Disable templates documentation").option("--no-directives","Disable directives documentation").option("--extra-content <content>","Extra content to include in documentation").example("stx docs --output docs --format html").action(async(X)=>{try{if(await iG(X))console.log("Documentation generated successfully."),y.exit(0);else console.error("Documentation generation failed."),y.exit(1)}catch(J){console.error("Error generating documentation:",J),y.exit(1)}}),H0.command("iconify <command>","Generate Iconify icon packages").option("--output <dir>","Output directory for generated packages",{default:"packages"}).option("--icons <icons>","Comma-separated list of specific icons to generate").example("stx iconify list").example("stx iconify generate mdi").example("stx iconify generate lucide --icons home,settings,user").action(async(X,J)=>{try{let{fetchCollections:Q,generatePackage:G}=await import("@stacksjs/iconify-generator");if(X==="list"){console.log(`
|
|
20797
20797
|
\uD83D\uDCDA Fetching available icon collections...
|
|
20798
20798
|
`);let K=await Q(),W=Object.entries(K).sort((U,_)=>_[1].total-U[1].total);console.log(`Available collections:
|
|
@@ -5,7 +5,6 @@ import { stateDir } from "./state-dir.js";
|
|
|
5
5
|
const EXTERNAL_PATTERNS = [
|
|
6
6
|
/^stx$/,
|
|
7
7
|
/^@stacksjs\/stx$/,
|
|
8
|
-
/^@stacksjs\/browser$/,
|
|
9
8
|
/^@stores$/,
|
|
10
9
|
/^stx\/stores$/,
|
|
11
10
|
/^@composables$/
|
|
@@ -59,7 +58,7 @@ function createBundlePlugin(projectRoot, templateDir, tmpEntry, inputFiles) {
|
|
|
59
58
|
return {
|
|
60
59
|
name: "stx-client-bundle",
|
|
61
60
|
setup(build) {
|
|
62
|
-
build.onResolve({ filter: /^(stx|@stacksjs\/stx
|
|
61
|
+
build.onResolve({ filter: /^(stx|@stacksjs\/stx)$/ }, (args) => ({
|
|
63
62
|
path: args.path,
|
|
64
63
|
external: !0
|
|
65
64
|
}));
|
package/dist/pwa.js
CHANGED
|
@@ -1830,11 +1830,11 @@ ${H}
|
|
|
1830
1830
|
`),X)Q=Q.replace(/\n/g,`<br />
|
|
1831
1831
|
`);for(let U=0;U<J.length;U++)Q=Q.replace(`\x00CODEBLOCK${U}\x00`,J[U]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}function a0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
|
|
1832
1832
|
`});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
|
|
1833
|
-
`}),$}import tJ from"process";function l0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries(tJ.env)){if(!X.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Q),Y[X]=Q}return Z["import.meta.env"]=JSON.stringify(Y),Z}var h1=()=>{};var $4={};o($4,{hasUserImports:()=>eJ,bundleClientScript:()=>ZQ});import j0 from"path";import x0 from"fs";function eJ($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let X=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,Q;while((Q=X.exec($))!==null){let G=Q[1];if(!J9.some((q)=>q.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let J=/^\s*import\s+['"]([^'"]+)['"]/gm;while((Q=J.exec($))!==null){let G=Q[1];if(/\.css(?:\?.*)?$/.test(G))continue;if(!J9.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function $Q($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:j0.dirname(J),q=j0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,j0.join(q,"index.ts"),j0.join(q,"index.tsx"),j0.join(q,"index.js"),j0.join(q,"index.mjs")];for(let U of W)try{if(x0.existsSync(U)&&x0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return q};return{name:"stx-client-bundle",setup(J){J.onResolve({filter:/^(stx|@stacksjs\/stx
|
|
1833
|
+
`}),$}import tJ from"process";function l0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries(tJ.env)){if(!X.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Q),Y[X]=Q}return Z["import.meta.env"]=JSON.stringify(Y),Z}var h1=()=>{};var $4={};o($4,{hasUserImports:()=>eJ,bundleClientScript:()=>ZQ});import j0 from"path";import x0 from"fs";function eJ($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let X=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,Q;while((Q=X.exec($))!==null){let G=Q[1];if(!J9.some((q)=>q.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let J=/^\s*import\s+['"]([^'"]+)['"]/gm;while((Q=J.exec($))!==null){let G=Q[1];if(/\.css(?:\?.*)?$/.test(G))continue;if(!J9.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function $Q($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:j0.dirname(J),q=j0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,j0.join(q,"index.ts"),j0.join(q,"index.tsx"),j0.join(q,"index.js"),j0.join(q,"index.mjs")];for(let U of W)try{if(x0.existsSync(U)&&x0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return q};return{name:"stx-client-bundle",setup(J){J.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^\.\.?\//},(G)=>{let K=Q(G.importer,G.path);return X.add(K),{path:K}}),J.onResolve({filter:/^[@~]\//},(G)=>{let K=j0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,j0.join(K,"index.ts"),j0.join(K,"index.tsx"),j0.join(K,"index.js"),j0.join(K,"index.mjs")];for(let W of q)if(x0.existsSync(W)&&x0.statSync(W,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}})}}}async function ZQ($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||W5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Z);let K=G.digest("hex").slice(0,12),q=j0.join(J,`${K}.js`),W=j0.join(J,`${K}.deps.json`),U=Bun.file(q);if(await U.exists()){let A=Bun.file(W),N=!0;if(await A.exists())try{let w=JSON.parse(await A.text());for(let T of w.files)try{if(x0.statSync(T.path).mtimeMs!==T.mtimeMs){N=!1;break}}catch{N=!1;break}}catch{N=!1}if(N)return console.log("[stx:bundler] cache hit:",K),await U.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let z=W5(X,"bundle-tmp"),B=j0.join(z,`${K}.ts`),_=j0.join(z,"out",K);x0.mkdirSync(z,{recursive:!0}),x0.mkdirSync(_,{recursive:!0});let j=j0.dirname(Z),H=[],L=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=L.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((A)=>{let N=A.split(":")[0].trim();if(N)H.push(N)});else if(O[3])H.push(O[3])}while((O=F.exec($))!==null){if(O[1])continue;H.push(O[2])}let V=H.length>0?`
|
|
1834
1834
|
export { ${H.join(", ")} }`:"";await Bun.write(B,$+V),console.log("[stx:bundler] bundling:",K,"from:",j0.basename(Z));let R=new Set;try{let A=await Bun.build({entrypoints:[B],outdir:_,target:"browser",format:"esm",minify:Q,plugins:[$Q(X,j,B,R)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...l0()},root:X});if(!A.success){let M=A.logs.filter((I)=>I.level==="error").map((I)=>I.message).join(", ");return console.warn("[stx:bundler] build failed:",M),$}let N="";for(let M of A.outputs){N=await M.text();break}let w=[];for(let M of N.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let I of M[1].split(",")){let D=I.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D&&D[1]!==D[2])w.push([D[2],D[1]])}if(N=N.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),w.length>0){let M=w.map(([I,D])=>`${JSON.stringify(I)}: ${D}`).join(", ");N+=`
|
|
1835
1835
|
var __stxScopeRenames = { ${M} };`}console.log("[stx:bundler] bundled:",K,"output:",N.length,"bytes"),x0.mkdirSync(J,{recursive:!0}),await Bun.write(q,N);let T=Array.from(R).map((M)=>{try{return{path:M,mtimeMs:x0.statSync(M).mtimeMs}}catch{return null}}).filter((M)=>M!==null);return await Bun.write(W,JSON.stringify({files:T})),N}catch(A){let N=A instanceof Error?A.message:String(A),w=A?.errors,T=Array.isArray(w)&&w.length>0?`
|
|
1836
1836
|
${w.map((M)=>`- ${M?.message??M}`).join(`
|
|
1837
|
-
`)}`:"";return console.warn(`[stx:bundler] error: ${N}${T}`),$}finally{try{x0.rmSync(B,{force:!0}),x0.rmSync(_,{recursive:!0,force:!0})}catch{}}}var J9;var Z4=b(()=>{h1();e5();J9=[/^stx$/,/^@stacksjs\/stx$/,/^@
|
|
1837
|
+
`)}`:"";return console.warn(`[stx:bundler] error: ${N}${T}`),$}finally{try{x0.rmSync(B,{force:!0}),x0.rmSync(_,{recursive:!0,force:!0})}catch{}}}var J9;var Z4=b(()=>{h1();e5();J9=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});var U9={};o(U9,{renderVendorStyleTags:()=>K9,processClientScript:()=>H5,generateServerDataBridge:()=>Y4,generateAutoImportDestructuring:()=>q9,extractBridgeData:()=>j5,extractAndStripCssImports:()=>G9});import O1 from"path";import _5 from"fs";function XQ($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function JQ($,Z){let Y=Z;while(!0){let X=O1.join(Y,"node_modules",$,"package.json");if(_5.existsSync(X))return O1.dirname(X);let Q=O1.dirname(Y);if(Q===Y)return null;Y=Q}}function QQ($,Z){if(!$||typeof $!=="object")return null;let Y=(Q)=>{if(typeof Q==="string")return Q;if(Q&&typeof Q==="object"){if(typeof Q.import==="string")return Q.import;if(typeof Q.default==="string")return Q.default;if(typeof Q.import==="object")return Y(Q.import);if(typeof Q.default==="object")return Y(Q.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let X=null;for(let Q of Object.keys($)){let J=Q.indexOf("*");if(J===-1)continue;let G=Q.slice(0,J),K=Q.slice(J+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!X||G.length>X.prefix.length)X={pattern:Q,prefix:G,suffix:K}}if(X){let Q=Z.slice(X.prefix.length,Z.length-X.suffix.length),J=Y($[X.pattern]);if(J)return J.replace("*",Q)}return null}function GQ($,Z){let Y=XQ($);if(!Y||!Y.subpath)return null;let X=JQ(Y.pkg,Z);if(!X)return null;let Q;try{Q=JSON.parse(_5.readFileSync(O1.join(X,"package.json"),"utf8"))}catch{return null}let J=`.${Y.subpath}`,G=QQ(Q.exports,J);if(!G)return null;let K=O1.resolve(X,G);return _5.existsSync(K)?K:null}function G9($,Z){let Y=Z.filePath?O1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Q=new Set,J=[];return{code:$.replace(YQ,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:O1.resolve(Y,q),!_5.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(q,X)}catch{U=GQ(q,X)}if(!U)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${U?.message||U}`),""}if(Q.has(W))return"";Q.add(W);try{let U=_5.readFileSync(W,"utf8");J.push({source:q,resolvedPath:W,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${W}: ${U?.message||U}`)}return""}),styles:J}}function KQ($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function K9($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${KQ(Z.source)}" data-stx-layer="vendor">
|
|
1838
1838
|
@layer vendor {
|
|
1839
1839
|
${Z.contents}
|
|
1840
1840
|
}
|
package/dist/ssg.js
CHANGED
|
@@ -639,11 +639,11 @@ ${H}
|
|
|
639
639
|
`),J)X=X.replace(/\n/g,`<br />
|
|
640
640
|
`);for(let z=0;z<Q.length;z++)X=X.replace(`\x00CODEBLOCK${z}\x00`,Q[z]);return X=X.replace(/<p>\s*<\/p>/g,""),X.trim()}function $1($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(J,X)=>{return`const { ${X.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
|
|
641
641
|
`});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(J,X)=>{return`const { ${X.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
|
|
642
|
-
`}),$}import LX from"process";function o0($="STX_PUBLIC_"){let Z={},Y={};for(let[J,X]of Object.entries(LX.env)){if(!J.startsWith($)||X===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(X),Y[J]=X}return Z["import.meta.env"]=JSON.stringify(Y),Z}var u1=()=>{};var a5={};r(a5,{hasUserImports:()=>FX,bundleClientScript:()=>wX});import w0 from"path";import h0 from"fs";function FX($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let J=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,X;while((X=J.exec($))!==null){let G=X[1];if(!P6.some((q)=>q.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let Q=/^\s*import\s+['"]([^'"]+)['"]/gm;while((X=Q.exec($))!==null){let G=X[1];if(/\.css(?:\?.*)?$/.test(G))continue;if(!P6.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function VX($,Z,Y,J){let X=(Q,G)=>{let K=Q===Y?Z:w0.dirname(Q),q=w0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,w0.join(q,"index.ts"),w0.join(q,"index.tsx"),w0.join(q,"index.js"),w0.join(q,"index.mjs")];for(let z of W)try{if(h0.existsSync(z)&&h0.statSync(z,{throwIfNoEntry:!1})?.isFile())return z}catch{}return q};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx
|
|
642
|
+
`}),$}import LX from"process";function o0($="STX_PUBLIC_"){let Z={},Y={};for(let[J,X]of Object.entries(LX.env)){if(!J.startsWith($)||X===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(X),Y[J]=X}return Z["import.meta.env"]=JSON.stringify(Y),Z}var u1=()=>{};var a5={};r(a5,{hasUserImports:()=>FX,bundleClientScript:()=>wX});import w0 from"path";import h0 from"fs";function FX($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let J=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,X;while((X=J.exec($))!==null){let G=X[1];if(!P6.some((q)=>q.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let Q=/^\s*import\s+['"]([^'"]+)['"]/gm;while((X=Q.exec($))!==null){let G=X[1];if(/\.css(?:\?.*)?$/.test(G))continue;if(!P6.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function VX($,Z,Y,J){let X=(Q,G)=>{let K=Q===Y?Z:w0.dirname(Q),q=w0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,w0.join(q,"index.ts"),w0.join(q,"index.tsx"),w0.join(q,"index.js"),w0.join(q,"index.mjs")];for(let z of W)try{if(h0.existsSync(z)&&h0.statSync(z,{throwIfNoEntry:!1})?.isFile())return z}catch{}return q};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^\.\.?\//},(G)=>{let K=X(G.importer,G.path);return J.add(K),{path:K}}),Q.onResolve({filter:/^[@~]\//},(G)=>{let K=w0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,w0.join(K,"index.ts"),w0.join(K,"index.tsx"),w0.join(K,"index.js"),w0.join(K,"index.mjs")];for(let W of q)if(h0.existsSync(W)&&h0.statSync(W,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),J.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}})}}}async function wX($,Z,Y={}){let J=Y.projectRoot||process.cwd(),X=Y.minify??!1,Q=Y.cacheDir||Q1(J,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Z);let K=G.digest("hex").slice(0,12),q=w0.join(Q,`${K}.js`),W=w0.join(Q,`${K}.deps.json`),z=Bun.file(q);if(await z.exists()){let A=Bun.file(W),N=!0;if(await A.exists())try{let R=JSON.parse(await A.text());for(let T of R.files)try{if(h0.statSync(T.path).mtimeMs!==T.mtimeMs){N=!1;break}}catch{N=!1;break}}catch{N=!1}if(N)return console.log("[stx:bundler] cache hit:",K),await z.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let U=Q1(J,"bundle-tmp"),_=w0.join(U,`${K}.ts`),B=w0.join(U,"out",K);h0.mkdirSync(U,{recursive:!0}),h0.mkdirSync(B,{recursive:!0});let j=w0.dirname(Z),H=[],L=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=L.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((A)=>{let N=A.split(":")[0].trim();if(N)H.push(N)});else if(O[3])H.push(O[3])}while((O=F.exec($))!==null){if(O[1])continue;H.push(O[2])}let V=H.length>0?`
|
|
643
643
|
export { ${H.join(", ")} }`:"";await Bun.write(_,$+V),console.log("[stx:bundler] bundling:",K,"from:",w0.basename(Z));let w=new Set;try{let A=await Bun.build({entrypoints:[_],outdir:B,target:"browser",format:"esm",minify:X,plugins:[VX(J,j,_,w)],define:{"process.env.NODE_ENV":X?'"production"':'"development"',...o0()},root:J});if(!A.success){let M=A.logs.filter((I)=>I.level==="error").map((I)=>I.message).join(", ");return console.warn("[stx:bundler] build failed:",M),$}let N="";for(let M of A.outputs){N=await M.text();break}let R=[];for(let M of N.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let I of M[1].split(",")){let D=I.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D&&D[1]!==D[2])R.push([D[2],D[1]])}if(N=N.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),R.length>0){let M=R.map(([I,D])=>`${JSON.stringify(I)}: ${D}`).join(", ");N+=`
|
|
644
644
|
var __stxScopeRenames = { ${M} };`}console.log("[stx:bundler] bundled:",K,"output:",N.length,"bytes"),h0.mkdirSync(Q,{recursive:!0}),await Bun.write(q,N);let T=Array.from(w).map((M)=>{try{return{path:M,mtimeMs:h0.statSync(M).mtimeMs}}catch{return null}}).filter((M)=>M!==null);return await Bun.write(W,JSON.stringify({files:T})),N}catch(A){let N=A instanceof Error?A.message:String(A),R=A?.errors,T=Array.isArray(R)&&R.length>0?`
|
|
645
645
|
${R.map((M)=>`- ${M?.message??M}`).join(`
|
|
646
|
-
`)}`:"";return console.warn(`[stx:bundler] error: ${N}${T}`),$}finally{try{h0.rmSync(_,{force:!0}),h0.rmSync(B,{recursive:!0,force:!0})}catch{}}}var P6;var t5=S(()=>{u1();H5();P6=[/^stx$/,/^@stacksjs\/stx$/,/^@
|
|
646
|
+
`)}`:"";return console.warn(`[stx:bundler] error: ${N}${T}`),$}finally{try{h0.rmSync(_,{force:!0}),h0.rmSync(B,{recursive:!0,force:!0})}catch{}}}var P6;var t5=S(()=>{u1();H5();P6=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});var h6={};r(h6,{renderVendorStyleTags:()=>f6,processClientScript:()=>V5,generateServerDataBridge:()=>e5,generateAutoImportDestructuring:()=>g6,extractBridgeData:()=>F5,extractAndStripCssImports:()=>x6});import w1 from"path";import L5 from"fs";function NX($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function RX($,Z){let Y=Z;while(!0){let J=w1.join(Y,"node_modules",$,"package.json");if(L5.existsSync(J))return w1.dirname(J);let X=w1.dirname(Y);if(X===Y)return null;Y=X}}function TX($,Z){if(!$||typeof $!=="object")return null;let Y=(X)=>{if(typeof X==="string")return X;if(X&&typeof X==="object"){if(typeof X.import==="string")return X.import;if(typeof X.default==="string")return X.default;if(typeof X.import==="object")return Y(X.import);if(typeof X.default==="object")return Y(X.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let J=null;for(let X of Object.keys($)){let Q=X.indexOf("*");if(Q===-1)continue;let G=X.slice(0,Q),K=X.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!J||G.length>J.prefix.length)J={pattern:X,prefix:G,suffix:K}}if(J){let X=Z.slice(J.prefix.length,Z.length-J.suffix.length),Q=Y($[J.pattern]);if(Q)return Q.replace("*",X)}return null}function MX($,Z){let Y=NX($);if(!Y||!Y.subpath)return null;let J=RX(Y.pkg,Z);if(!J)return null;let X;try{X=JSON.parse(L5.readFileSync(w1.join(J,"package.json"),"utf8"))}catch{return null}let Q=`.${Y.subpath}`,G=TX(X.exports,Q);if(!G)return null;let K=w1.resolve(J,G);return L5.existsSync(K)?K:null}function x6($,Z){let Y=Z.filePath?w1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),X=new Set,Q=[];return{code:$.replace(AX,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:w1.resolve(Y,q),!L5.existsSync(W))throw Error(`file not found: ${W}`)}else{let z=null;try{z=Bun.resolveSync(q,J)}catch{z=MX(q,J)}if(!z)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=z}}catch(z){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${z?.message||z}`),""}if(X.has(W))return"";X.add(W);try{let z=L5.readFileSync(W,"utf8");Q.push({source:q,resolvedPath:W,contents:z})}catch(z){console.warn(`[stx:vendor-css] could not read ${W}: ${z?.message||z}`)}return""}),styles:Q}}function IX($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function f6($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${IX(Z.source)}" data-stx-layer="vendor">
|
|
647
647
|
@layer vendor {
|
|
648
648
|
${Z.contents}
|
|
649
649
|
}
|
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.110",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -117,16 +117,16 @@
|
|
|
117
117
|
"dependencies": {
|
|
118
118
|
"@cwcss/crosswind": "^0.2.6",
|
|
119
119
|
"@stacksjs/clapp": "^0.2.0",
|
|
120
|
-
"@stacksjs/sanitizer": "0.2.
|
|
120
|
+
"@stacksjs/sanitizer": "0.2.110",
|
|
121
121
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
122
|
-
"bun-plugin-stx": "0.2.
|
|
122
|
+
"bun-plugin-stx": "0.2.110",
|
|
123
123
|
"bunfig": "^0.15.15",
|
|
124
|
-
"stx-router": "0.2.
|
|
124
|
+
"stx-router": "0.2.110",
|
|
125
125
|
"ts-broadcasting": "^0.0.9",
|
|
126
126
|
"ts-images": "^0.1.9",
|
|
127
127
|
"ts-syntax-highlighter": "^0.2.1"
|
|
128
128
|
},
|
|
129
129
|
"optionalDependencies": {
|
|
130
|
-
"@stacksjs/desktop": "0.2.
|
|
130
|
+
"@stacksjs/desktop": "0.2.110"
|
|
131
131
|
}
|
|
132
132
|
}
|