@stacksjs/stx 0.2.178 → 0.2.179
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 +1 -1
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -27301,7 +27301,7 @@ else {
|
|
|
27301
27301
|
`)}function cx($,X){let Z=" ".repeat(X),J=[];for(let[K,W]of Object.entries($.props))if(W.type==="literal"){let U=typeof W.value==="string"?`"${W.value}"`:String(W.value);J.push(`${K}: ${U}`)}let Y=J.length>0?`{ ${J.join(", ")} }`:"{}",Q=$.children.map((K)=>K.type==="text"?`"${K.props.text?.type==="literal"?K.props.text.value:""}"`:cx(K,X+1)),G=Q.length>0?`,
|
|
27302
27302
|
${Z} [${Q.join(`,
|
|
27303
27303
|
${Z} `)}]`:"";return`Craft.create("${$.zigType}", ${Y}${G})`}function k10($,X,Z){if(X.target==="universal"){let J=[];J.push("// Universal entry point"),J.push("");for(let[Y,Q]of Z)J.push(`// --- ${Y.toUpperCase()} ---`),J.push(`#if ${Y.toUpperCase()}`),J.push(Q),J.push("#endif"),J.push("");return J.join(`
|
|
27304
|
-
`)}return Z.get(X.target)||$L($,X)}function S10($,X,Z){let J=[];function Y(Q){J.push({name:Q.zigType,hash:px(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)Y(G)}return Y(X),{version:"1.0.0",components:J,entry:$.id,assets:[],styles:$.styles}}function C10($,X){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}function lx(){return`id_${++P10}`}function px($){let X=0;for(let Z=0;Z<$.length;Z++){let J=$.charCodeAt(Z);X=(X<<5)-X+J,X=X&X}return Math.abs(X).toString(36)}function b10($){return $.charAt(0).toUpperCase()+$.slice(1)}function y10($){let X=[],Z=/<script[^>]*>([\s\S]*?)<\/script>/gi,J;while((J=Z.exec($))!==null)X.push(J[1]);return X}function x10($){let X=[],Z=/<style[^>]*>([\s\S]*?)<\/style>/gi,J;while((J=Z.exec($))!==null)X.push(J[1]);return X}function XL($){let X=$.type==="component"?1:0;if($.children)for(let Z of $.children)X+=XL(Z);return X}function ZL($){let X=$.zigType.startsWith("craft.")?1:0;for(let Z of $.children)X+=ZL(Z);return X}function ix($){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(X)=>{console.log(`[craft-compiler] File changed: ${X}`)}}}var JL,P10=0,v10,f10;var rx=T(()=>{JL=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"}]]);v10={compileToNative:gx,createHotReloadServer:ix,NATIVE_COMPONENTS:JL},f10=v10});import{spawn as ox}from"child_process";import s0 from"fs";import g10 from"os";import K0 from"path";import f from"process";import{CLI as h10}from"@stacksjs/clapp";var M6="0.2.178";R8();DH();Nj();Pj();f4();kj();Oj();v8();LH();var __dirname="/home/runner/work/stx/stx/packages/stx/bin",D0=new h10("stx");function ax($){let X=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(X))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(X<1024||X>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 sx($){try{if(!s0.existsSync($)){let Z=K0.dirname($),J=K0.basename($);if(s0.existsSync(Z)){let Q=s0.readdirSync(Z).filter((K)=>K.toLowerCase().includes(J.toLowerCase().substring(0,3))||K.endsWith(".stx")||K.endsWith(".md")),G=Q.length>0?`File not found. Similar files in ${Z}: ${Q.slice(0,3).join(", ")}`:`File not found. Directory ${Z} 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(s0.statSync($).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${$}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(X){return{isValid:!1,error:`Cannot access file: ${$}`,suggestion:"Check file permissions and path"}}}function YL($){let X=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(X))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(X<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(X>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 l7=($)=>$.includes("*")||$.includes("?")||$.includes("{")||$.includes("["),u10=($)=>$.endsWith(".stx")||$.endsWith(".md");function c7($,X=1){if(console.error(`\u274C ${$.error}`),$.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${$.suggestion}`);f.exit(X)}function m10($){if(!$)return;let X;try{X=JSON.parse($)}catch(Z){console.error(`\u274C --info-plist is not valid JSON: ${Z.message}`),f.exit(1)}if(typeof X!=="object"||X===null||Array.isArray(X))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),f.exit(1);for(let[Z,J]of Object.entries(X))if(typeof J!=="string"&&typeof J!=="number"&&typeof J!=="boolean")console.error(`\u274C --info-plist value for "${Z}" must be a string, number or boolean`),f.exit(1);return X}async function d10($,X){try{let Z=["test"],J=[];if($&&$.length>0)for(let W of $)if(l7(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(J.push(...U),X.verbose)console.log(`Found ${U.length} file(s) matching pattern: ${W}`)}catch(U){return console.error(`Error expanding glob pattern ${W}:`,U),!1}else J.push(W);if(J.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(Z.push(...J),X.filter)Z.push("--pattern",X.filter);if(X.timeout)Z.push("--timeout",X.timeout.toString());if(X.reporter&&X.reporter!=="default")if(X.reporter==="junit"){let W=K0.join(g10.tmpdir(),`stx-test-report-${Date.now()}.xml`);Z.push("--reporter",X.reporter),Z.push("--reporter-outfile",W)}else console.warn(`Warning: Reporter '${X.reporter}' is not supported. Using default reporter.`);if(X.coverage)Z.push("--coverage");if(X.watch)Z.push("--watch");Z.push("--preload",K0.join(__dirname,"../../../test-utils/happy-dom.ts"));let Y={...f.env,STX_TEST_MODE:"true",STX_TEST_UI:X.ui?"true":"false",STX_TEST_VERBOSE:X.verbose?"true":"false"},Q="bun";if(X.verbose)console.log(`Running: ${Q} ${Z.join(" ")}`);let G=performance.now(),K=ox(Q,Z,{stdio:"inherit",shell:!1,env:Y});return new Promise((W)=>{K.on("close",(U)=>{let q=((performance.now()-G)/1000).toFixed(2);if(U===0)W(!0);else W(!1)}),f.on("SIGINT",()=>{console.log(`
|
|
27304
|
+
`)}return Z.get(X.target)||$L($,X)}function S10($,X,Z){let J=[];function Y(Q){J.push({name:Q.zigType,hash:px(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)Y(G)}return Y(X),{version:"1.0.0",components:J,entry:$.id,assets:[],styles:$.styles}}function C10($,X){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}function lx(){return`id_${++P10}`}function px($){let X=0;for(let Z=0;Z<$.length;Z++){let J=$.charCodeAt(Z);X=(X<<5)-X+J,X=X&X}return Math.abs(X).toString(36)}function b10($){return $.charAt(0).toUpperCase()+$.slice(1)}function y10($){let X=[],Z=/<script[^>]*>([\s\S]*?)<\/script>/gi,J;while((J=Z.exec($))!==null)X.push(J[1]);return X}function x10($){let X=[],Z=/<style[^>]*>([\s\S]*?)<\/style>/gi,J;while((J=Z.exec($))!==null)X.push(J[1]);return X}function XL($){let X=$.type==="component"?1:0;if($.children)for(let Z of $.children)X+=XL(Z);return X}function ZL($){let X=$.zigType.startsWith("craft.")?1:0;for(let Z of $.children)X+=ZL(Z);return X}function ix($){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(X)=>{console.log(`[craft-compiler] File changed: ${X}`)}}}var JL,P10=0,v10,f10;var rx=T(()=>{JL=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"}]]);v10={compileToNative:gx,createHotReloadServer:ix,NATIVE_COMPONENTS:JL},f10=v10});import{spawn as ox}from"child_process";import s0 from"fs";import g10 from"os";import K0 from"path";import f from"process";import{CLI as h10}from"@stacksjs/clapp";var M6="0.2.179";R8();DH();Nj();Pj();f4();kj();Oj();v8();LH();var __dirname="/home/runner/work/stx/stx/packages/stx/bin",D0=new h10("stx");function ax($){let X=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(X))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(X<1024||X>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 sx($){try{if(!s0.existsSync($)){let Z=K0.dirname($),J=K0.basename($);if(s0.existsSync(Z)){let Q=s0.readdirSync(Z).filter((K)=>K.toLowerCase().includes(J.toLowerCase().substring(0,3))||K.endsWith(".stx")||K.endsWith(".md")),G=Q.length>0?`File not found. Similar files in ${Z}: ${Q.slice(0,3).join(", ")}`:`File not found. Directory ${Z} 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(s0.statSync($).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${$}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(X){return{isValid:!1,error:`Cannot access file: ${$}`,suggestion:"Check file permissions and path"}}}function YL($){let X=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(X))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(X<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(X>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 l7=($)=>$.includes("*")||$.includes("?")||$.includes("{")||$.includes("["),u10=($)=>$.endsWith(".stx")||$.endsWith(".md");function c7($,X=1){if(console.error(`\u274C ${$.error}`),$.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${$.suggestion}`);f.exit(X)}function m10($){if(!$)return;let X;try{X=JSON.parse($)}catch(Z){console.error(`\u274C --info-plist is not valid JSON: ${Z.message}`),f.exit(1)}if(typeof X!=="object"||X===null||Array.isArray(X))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),f.exit(1);for(let[Z,J]of Object.entries(X))if(typeof J!=="string"&&typeof J!=="number"&&typeof J!=="boolean")console.error(`\u274C --info-plist value for "${Z}" must be a string, number or boolean`),f.exit(1);return X}async function d10($,X){try{let Z=["test"],J=[];if($&&$.length>0)for(let W of $)if(l7(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(J.push(...U),X.verbose)console.log(`Found ${U.length} file(s) matching pattern: ${W}`)}catch(U){return console.error(`Error expanding glob pattern ${W}:`,U),!1}else J.push(W);if(J.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(Z.push(...J),X.filter)Z.push("--pattern",X.filter);if(X.timeout)Z.push("--timeout",X.timeout.toString());if(X.reporter&&X.reporter!=="default")if(X.reporter==="junit"){let W=K0.join(g10.tmpdir(),`stx-test-report-${Date.now()}.xml`);Z.push("--reporter",X.reporter),Z.push("--reporter-outfile",W)}else console.warn(`Warning: Reporter '${X.reporter}' is not supported. Using default reporter.`);if(X.coverage)Z.push("--coverage");if(X.watch)Z.push("--watch");Z.push("--preload",K0.join(__dirname,"../../../test-utils/happy-dom.ts"));let Y={...f.env,STX_TEST_MODE:"true",STX_TEST_UI:X.ui?"true":"false",STX_TEST_VERBOSE:X.verbose?"true":"false"},Q="bun";if(X.verbose)console.log(`Running: ${Q} ${Z.join(" ")}`);let G=performance.now(),K=ox(Q,Z,{stdio:"inherit",shell:!1,env:Y});return new Promise((W)=>{K.on("close",(U)=>{let q=((performance.now()-G)/1000).toFixed(2);if(U===0)W(!0);else W(!1)}),f.on("SIGINT",()=>{console.log(`
|
|
27305
27305
|
Test run interrupted`),K.kill("SIGINT"),f.exit(1)})})}catch(Z){return console.error("Error running tests:",Z instanceof Error?Z.message:String(Z)),!1}}var c10=f.argv.length>=3&&(u10(f.argv[2])&&s0.existsSync(f.argv[2])||l7(f.argv[2]));if(c10){let $=f.argv[2],X={port:3000,watch:!0,cache:!0,markdown:{syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}}};for(let Z=3;Z<f.argv.length;Z++){let J=f.argv[Z];if(J==="--port"&&Z+1<f.argv.length){let Y=ax(f.argv[++Z]);if(!Y.isValid)c7(Y);X.port=Number.parseInt(f.argv[Z],10)}else if(J==="--no-watch")X.watch=!1;else if(J==="--highlight-theme"&&Z+1<f.argv.length){if(!X.markdown)X.markdown={};if(!X.markdown.syntaxHighlighting)X.markdown.syntaxHighlighting={};X.markdown.syntaxHighlighting.defaultTheme=f.argv[++Z]}else if(J==="--no-highlight"){if(!X.markdown)X.markdown={};if(!X.markdown.syntaxHighlighting)X.markdown.syntaxHighlighting={};X.markdown.syntaxHighlighting.enabled=!1}else if(J==="--no-highlight-unknown"){if(!X.markdown)X.markdown={};if(!X.markdown.syntaxHighlighting)X.markdown.syntaxHighlighting={};X.markdown.syntaxHighlighting.highlightUnknownLanguages=!1}else if(J==="--no-cache")X.cache=!1;else if(J==="--native")X.native=!0}if(l7($))try{let Z=await Array.fromAsync(new Bun.Glob($).scan({onlyFiles:!0,absolute:!0})),J=$.endsWith(".stx")?Z.filter((K)=>K.endsWith(".stx")):$.endsWith(".md")?Z.filter((K)=>K.endsWith(".md")):Z.filter((K)=>K.endsWith(".stx")||K.endsWith(".md")),Y=$.split("*")[0].replace(/\/$/,"")||".",Q=K0.resolve(Y);try{let K=new Bun.Glob("**/*.stx"),U=(await Array.fromAsync(K.scan({cwd:Q,onlyFiles:!0,absolute:!0}))).filter((z)=>/\[.+\]/.test(K0.basename(z)));for(let z of U)if(!J.includes(z))J.push(z)}catch{}if(J.length===0)console.error(`Error: No STX or Markdown files found matching pattern: ${$}`),f.exit(1);if(!await DZ(J,X))f.exit(1)}catch(Z){console.error("Failed to process files:",Z),f.exit(1)}else TZ($,X).catch((Z)=>{console.error("Failed to start dev server:",Z),f.exit(1)})}else{let $=function(J,Y){let Q=[];for(let G=0;G<=Y.length;G++)Q[G]=[G];for(let G=0;G<=J.length;G++)Q[0][G]=G;for(let G=1;G<=Y.length;G++)for(let K=1;K<=J.length;K++)if(Y.charAt(G-1)===J.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[Y.length][J.length]};D0.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(J)=>{try{if(await Rj(J))console.log("Documentation generated successfully."),f.exit(0);else console.error("Documentation generation failed."),f.exit(1)}catch(Y){console.error("Error generating documentation:",Y),f.exit(1)}}),D0.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(J,Y)=>{try{let{fetchCollections:Q,generatePackage:G}=await Promise.resolve().then(() => (nb(),ib));if(J==="list"){console.log(`
|
|
27306
27306
|
\uD83D\uDCDA Fetching available icon collections...
|
|
27307
27307
|
`);let K=await Q(),W=Object.entries(K).sort((U,z)=>z[1].total-U[1].total);console.log(`Available collections:
|
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.179",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -117,12 +117,12 @@
|
|
|
117
117
|
"dependencies": {
|
|
118
118
|
"@cwcss/crosswind": "^0.2.14",
|
|
119
119
|
"@stacksjs/clapp": "^0.2.0",
|
|
120
|
-
"@stacksjs/desktop": "0.2.
|
|
121
|
-
"@stacksjs/sanitizer": "0.2.
|
|
120
|
+
"@stacksjs/desktop": "0.2.179",
|
|
121
|
+
"@stacksjs/sanitizer": "0.2.179",
|
|
122
122
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
123
|
-
"bun-plugin-stx": "0.2.
|
|
123
|
+
"bun-plugin-stx": "0.2.179",
|
|
124
124
|
"bunfig": "^0.15.17",
|
|
125
|
-
"stx-router": "0.2.
|
|
125
|
+
"stx-router": "0.2.179",
|
|
126
126
|
"ts-broadcasting": "^0.0.9",
|
|
127
127
|
"ts-images": "^0.1.9",
|
|
128
128
|
"ts-syntax-highlighter": "^0.2.1"
|