@stacksjs/stx 0.2.588 → 0.2.590
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-s043hpvd.js → chunk-04gt67sv.js} +1 -1
- package/dist/chunk-122y2fkw.js +3 -0
- package/dist/chunk-138zjhwa.js +2 -0
- package/dist/{chunk-751b5zv9.js → chunk-14t0wps0.js} +1 -1
- package/dist/{chunk-03qf2z4d.js → chunk-18ws9heh.js} +1 -1
- package/dist/{chunk-33q5zka4.js → chunk-1944jgb2.js} +1 -1
- package/dist/{chunk-tc15vkfh.js → chunk-25zpd110.js} +2 -2
- package/dist/{chunk-emxa2djv.js → chunk-2qt63502.js} +1 -1
- package/dist/{chunk-qhr1tkhj.js → chunk-38mt83wa.js} +6 -6
- package/dist/chunk-3bx12g3y.js +2 -0
- package/dist/{chunk-j8v5164e.js → chunk-3q312svf.js} +1 -1
- package/dist/chunk-3vcvsc17.js +2 -0
- package/dist/{chunk-k1szsenr.js → chunk-48s1nprc.js} +2 -2
- package/dist/{chunk-qf3axv86.js → chunk-4st1qw62.js} +2 -2
- package/dist/chunk-55bmmwtx.js +2 -0
- package/dist/{chunk-cqr5cv7h.js → chunk-5rs5jnqk.js} +5 -5
- package/dist/chunk-64xcx3y4.js +2 -0
- package/dist/{chunk-y5x8xnnf.js → chunk-6eg9a3mt.js} +2 -2
- package/dist/{chunk-3qmx12d3.js → chunk-6qnemg0e.js} +298 -298
- package/dist/{chunk-ww28zfwt.js → chunk-7b0svfg0.js} +1 -1
- package/dist/chunk-7frsbxzd.js +2 -0
- package/dist/chunk-7nr3f2bw.js +2 -0
- package/dist/chunk-83rmpb0b.js +2 -0
- package/dist/chunk-88mj71mb.js +2 -0
- package/dist/{chunk-9qsnq026.js → chunk-9cgga2aw.js} +2 -2
- package/dist/{chunk-45x4myqe.js → chunk-9e49fnj9.js} +2 -2
- package/dist/{chunk-f29fk7dw.js → chunk-9h1ytsgm.js} +2 -2
- package/dist/{chunk-jtx74677.js → chunk-9q079ttt.js} +1 -1
- package/dist/chunk-9t6gzmze.js +2 -0
- package/dist/{chunk-vf15db1j.js → chunk-9wtb959p.js} +5 -5
- package/dist/{chunk-794v5crp.js → chunk-9x4r15mv.js} +2 -2
- package/dist/{chunk-pxw4edw8.js → chunk-a7crvy3b.js} +2 -2
- package/dist/chunk-acm2tym9.js +2 -0
- package/dist/{chunk-c6egfhy6.js → chunk-b3c1gggs.js} +2 -2
- package/dist/chunk-bd5gxtt2.js +2 -0
- package/dist/chunk-bepj7q9j.js +2 -0
- package/dist/{chunk-t212h9zm.js → chunk-cxhqps9m.js} +1 -1
- package/dist/chunk-d81h4mxd.js +2 -0
- package/dist/{chunk-b217d16p.js → chunk-dbp1sj5f.js} +36 -36
- package/dist/chunk-dgtxj56t.js +3 -0
- package/dist/chunk-ds66kaac.js +127 -0
- package/dist/chunk-emx9v5z8.js +2 -0
- package/dist/chunk-eqa0wdv9.js +4 -0
- package/dist/{chunk-haag5n42.js → chunk-f17rcvdb.js} +1 -1
- package/dist/chunk-ffykng6w.js +2 -0
- package/dist/{chunk-076h7nb9.js → chunk-fjw3sn55.js} +5 -5
- package/dist/chunk-fn9gdw2x.js +2 -0
- package/dist/{chunk-bhg4pvtn.js → chunk-frm8k9gj.js} +1 -1
- package/dist/chunk-fwt5fh5w.js +2 -0
- package/dist/{chunk-m7ddgrsm.js → chunk-g6ew2drc.js} +4 -4
- package/dist/{chunk-6cg03r93.js → chunk-g7fjra7a.js} +4 -4
- package/dist/{chunk-03xsf9jm.js → chunk-gh181dnr.js} +8 -8
- package/dist/{chunk-6hgngmn0.js → chunk-gzpxvca7.js} +1 -1
- package/dist/{chunk-d0tmc6v5.js → chunk-h9gbsgrt.js} +1 -1
- package/dist/{chunk-qx0tcsdm.js → chunk-hhcmn37g.js} +3 -3
- package/dist/chunk-hhwnd24n.js +2 -0
- package/dist/chunk-hq4mtcp0.js +2 -0
- package/dist/{chunk-7fghm9zy.js → chunk-j1dmkt29.js} +1 -1
- package/dist/chunk-jhswy523.js +2 -0
- package/dist/{chunk-mmbspaqh.js → chunk-jtq8e3b0.js} +2 -2
- package/dist/chunk-jyqanvwp.js +2 -0
- package/dist/chunk-k6bmhf83.js +2 -0
- package/dist/{chunk-3ybbat49.js → chunk-khdvzjzd.js} +1 -1
- package/dist/{chunk-q03kn4d1.js → chunk-krvaknk7.js} +1 -1
- package/dist/{chunk-30acme5g.js → chunk-kx52xt96.js} +2 -2
- package/dist/chunk-m0ngddr1.js +2 -0
- package/dist/{chunk-yhhfxx17.js → chunk-mkmgy50k.js} +4 -4
- package/dist/chunk-n06xznty.js +2 -0
- package/dist/{chunk-048eyjyj.js → chunk-nb0ytx70.js} +2 -2
- package/dist/chunk-nft0k8sy.js +2 -0
- package/dist/{chunk-wkrf41se.js → chunk-nmfnstjg.js} +1 -1
- package/dist/chunk-p69ay3bg.js +2 -0
- package/dist/{chunk-hj8tr9g0.js → chunk-p9yqetnj.js} +1 -1
- package/dist/{chunk-07869zev.js → chunk-pb7vste8.js} +3 -3
- package/dist/chunk-pbvtyw5h.js +2 -0
- package/dist/{chunk-a30mtx17.js → chunk-ph2hzxz7.js} +2 -2
- package/dist/chunk-pq9yr5f5.js +2 -0
- package/dist/chunk-q5rqp7rm.js +2 -0
- package/dist/{chunk-cy07dhqh.js → chunk-q66ry997.js} +2 -2
- package/dist/{chunk-pg164sdw.js → chunk-q6h6yjg4.js} +2 -2
- package/dist/{chunk-91pdg853.js → chunk-qf39z0hg.js} +3 -3
- package/dist/chunk-qhy84exn.js +2 -0
- package/dist/chunk-san161h4.js +2 -0
- package/dist/{chunk-7ydavm3h.js → chunk-shnsvsg4.js} +2 -2
- package/dist/{chunk-kfhghjh6.js → chunk-shnvs7x9.js} +2 -2
- package/dist/{chunk-s2h601k7.js → chunk-sjehpstn.js} +7 -7
- package/dist/{chunk-w24qmxc3.js → chunk-t19th11m.js} +1 -1
- package/dist/{chunk-awgvt956.js → chunk-tc3ne706.js} +9 -9
- package/dist/chunk-td7a6wwq.js +2 -0
- package/dist/{chunk-3y5tzxm6.js → chunk-tds3d65g.js} +2 -2
- package/dist/{chunk-mnnxa3r7.js → chunk-vhgdz0qf.js} +2 -2
- package/dist/{chunk-j7kcjgxy.js → chunk-vn6h03nq.js} +68 -40
- package/dist/chunk-w3k1r8r5.js +2 -0
- package/dist/{chunk-e556dvy4.js → chunk-wkxzzdzs.js} +2 -2
- package/dist/{chunk-ns1jqzqk.js → chunk-wr6gw263.js} +1 -1
- package/dist/chunk-wrp7m33d.js +2 -0
- package/dist/{chunk-7xw1e8t6.js → chunk-y0qjpcc8.js} +3 -3
- package/dist/chunk-y3g9jaa4.js +2 -0
- package/dist/{chunk-fkq55rh7.js → chunk-y3wdf7v7.js} +1 -1
- package/dist/chunk-y6909jm7.js +2 -0
- package/dist/{chunk-ede39b7h.js → chunk-zvs13kgh.js} +2 -2
- package/dist/cli.js +14 -14
- package/dist/client/signals-component-hydration-runtime.js +57 -29
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/dev-server/ts-css.js +7 -2
- package/dist/native/compiler/app-theme.d.ts +9 -0
- package/dist/native/compiler/app-theme.js +51 -0
- package/dist/native/compiler/bundle.js +7 -3
- package/dist/native/compiler/headwind-to-style.d.ts +6 -0
- package/dist/native/compiler/headwind-to-style.js +7 -0
- package/dist/native/compiler/html-to-ir.js +7 -1
- package/dist/native/compiler/render-screen.js +2 -1
- package/dist/native/runtime/craft-bridge.js +1 -1
- package/dist/native/ui.d.ts +90 -0
- package/dist/native/ui.js +37 -0
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +10 -10
- package/dist/theme-tokens.d.ts +38 -3
- package/dist/theme-tokens.js +18 -6
- package/dist/ts-css-config.d.ts +1 -0
- package/dist/ts-css-config.js +4 -3
- package/package.json +5 -5
- package/dist/chunk-11jmasqb.js +0 -2
- package/dist/chunk-2wx2aczp.js +0 -2
- package/dist/chunk-4dpab4j6.js +0 -2
- package/dist/chunk-4vnwge6p.js +0 -2
- package/dist/chunk-4w37cqg9.js +0 -2
- package/dist/chunk-51pz8cwa.js +0 -2
- package/dist/chunk-65agttgm.js +0 -2
- package/dist/chunk-7ae40484.js +0 -2
- package/dist/chunk-7dtyf7hq.js +0 -2
- package/dist/chunk-7ebt9n43.js +0 -4
- package/dist/chunk-80g8kaes.js +0 -2
- package/dist/chunk-9pk5jhqa.js +0 -3
- package/dist/chunk-a3d5g1ss.js +0 -122
- package/dist/chunk-a3k4nfq2.js +0 -2
- package/dist/chunk-c8fdccgp.js +0 -2
- package/dist/chunk-cw76edds.js +0 -2
- package/dist/chunk-czrs87r9.js +0 -2
- package/dist/chunk-d9vjsqs4.js +0 -2
- package/dist/chunk-ddgyj88h.js +0 -2
- package/dist/chunk-dj90w48e.js +0 -2
- package/dist/chunk-dngzks8e.js +0 -2
- package/dist/chunk-eztvhppz.js +0 -2
- package/dist/chunk-h2534p6q.js +0 -2
- package/dist/chunk-h9gtc6bk.js +0 -2
- package/dist/chunk-hwnvfke9.js +0 -2
- package/dist/chunk-hygxh993.js +0 -2
- package/dist/chunk-jqy5q8m0.js +0 -2
- package/dist/chunk-jy7yzat1.js +0 -2
- package/dist/chunk-n7yk4nc1.js +0 -2
- package/dist/chunk-qd4snptd.js +0 -2
- package/dist/chunk-r90v2jz6.js +0 -2
- package/dist/chunk-rtgf9fgc.js +0 -2
- package/dist/chunk-sjkdpsca.js +0 -3
- package/dist/chunk-sqpme1hg.js +0 -2
- package/dist/chunk-thydj877.js +0 -2
- package/dist/chunk-vv1kr9dn.js +0 -2
- package/dist/chunk-wm9nzg76.js +0 -2
- package/dist/chunk-x5qymgxa.js +0 -2
- package/dist/chunk-xnbkyj4g.js +0 -2
- package/dist/chunk-xyepqdjy.js +0 -2
- package/dist/chunk-y93y2qat.js +0 -2
package/dist/cli.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
import"./chunk-
|
|
4
|
-
Test run interrupted`),n.kill("SIGINT"),s.exit(1)})})}catch(x){return console.error("Error running tests:",x instanceof Error?x.message:String(x)),!1}}var L=s.argv.length>=3&&(V(s.argv[2])&&S.existsSync(s.argv[2])||O(s.argv[2]));if(L){let h=s.argv[2],p={port:3000,watch:!0,cache:!0,markdown:{syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}}};for(let x=3;x<s.argv.length;x++){let t=s.argv[x];if(t==="--port"&&x+1<s.argv.length){let e=B(s.argv[++x]);if(!e.isValid)F(e);p.port=Number.parseInt(s.argv[x],10)}else if(t==="--no-watch")p.watch=!1;else if(t==="--highlight-theme"&&x+1<s.argv.length){if(!p.markdown)p.markdown={};if(!p.markdown.syntaxHighlighting)p.markdown.syntaxHighlighting={};p.markdown.syntaxHighlighting.defaultTheme=s.argv[++x]}else if(t==="--no-highlight"){if(!p.markdown)p.markdown={};if(!p.markdown.syntaxHighlighting)p.markdown.syntaxHighlighting={};p.markdown.syntaxHighlighting.enabled=!1}else if(t==="--no-highlight-unknown"){if(!p.markdown)p.markdown={};if(!p.markdown.syntaxHighlighting)p.markdown.syntaxHighlighting={};p.markdown.syntaxHighlighting.highlightUnknownLanguages=!1}else if(t==="--no-cache")p.cache=!1;else if(t==="--native")p.native=!0}if(O(h))try{let x=await Array.fromAsync(new Bun.Glob(h).scan({onlyFiles:!0,absolute:!0})),t=h.endsWith(".stx")?x.filter((n)=>n.endsWith(".stx")):h.endsWith(".md")?x.filter((n)=>n.endsWith(".md")):x.filter((n)=>n.endsWith(".stx")||n.endsWith(".md")),e=h.split("*")[0].replace(/\/$/,"")||".",o=f.resolve(e);try{let n=new Bun.Glob("**/*.stx"),r=(await Array.fromAsync(n.scan({cwd:o,onlyFiles:!0,absolute:!0}))).filter((l)=>/\[.+\]/.test(f.basename(l)));for(let l of r)if(!t.includes(l))t.push(l)}catch{}if(t.length===0)console.error(`Error: No STX or Markdown files found matching pattern: ${h}`),s.exit(1);if(!await
|
|
3
|
+
import"./chunk-38mt83wa.js";import"./chunk-v8ze2q95.js";import"./chunk-a7crvy3b.js";import"./chunk-b3c1gggs.js";import"./chunk-jtq8e3b0.js";import{G}from"./chunk-6qnemg0e.js";import"./chunk-gh181dnr.js";import"./chunk-qf39z0hg.js";import"./chunk-48s1nprc.js";import"./chunk-9e49fnj9.js";import"./chunk-82bttwqm.js";import"./chunk-k71e38fk.js";import"./chunk-wkxzzdzs.js";import"./chunk-tc3ne706.js";import"./chunk-y0qjpcc8.js";import"./chunk-nb0ytx70.js";import"./chunk-bfbmdjh4.js";import"./chunk-f17rcvdb.js";import"./chunk-g6ew2drc.js";import"./chunk-fjw3sn55.js";import"./chunk-8s7zbhdd.js";import"./chunk-h9gbsgrt.js";import"./chunk-vn6h03nq.js";import"./chunk-hsy9rhct.js";import"./chunk-hz11wmx9.js";import"./chunk-shnvs7x9.js";import"./chunk-4h58as2c.js";import"./chunk-14t0wps0.js";import"./chunk-y09g63k0.js";import"./chunk-mkmgy50k.js";import"./chunk-7b0svfg0.js";import"./chunk-nmfnstjg.js";import"./chunk-h7atbtds.js";import"./chunk-q1cvef6b.js";import"./chunk-axz1x4r9.js";import"./chunk-tds3d65g.js";import{kt,Ct}from"./chunk-5rs5jnqk.js";import"./chunk-vhgdz0qf.js";import"./chunk-q66ry997.js";import"./chunk-bsy10tz6.js";import"./chunk-htcptqtn.js";import"./chunk-1944jgb2.js";import"./chunk-gzpxvca7.js";import"./chunk-tnafnb23.js";import"./chunk-ph2hzxz7.js";import"./chunk-9q079ttt.js";import{lo,uo,po,fo,Ir,go,mo,ho,Or,Dr,Fn,zn,Hn}from"./chunk-dbp1sj5f.js";import"./chunk-g7fjra7a.js";import"./chunk-zrw1zf54.js";import{Di}from"./chunk-t19th11m.js";import{d}from"./chunk-yn2d8x8m.js";import{spawn as R}from"child_process";import S from"fs";import f from"path";import s from"process";import{CLI as W}from"@stacksjs/clapp";var j="0.2.590";var __dirname="/home/runner/work/stx/stx/packages/stx/bin",y=new W("stx");function B(h){let p=typeof h==="string"?Number.parseInt(h,10):h;if(Number.isNaN(p))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(p<1024||p>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 A(h){try{if(!S.existsSync(h)){let x=f.dirname(h),t=f.basename(h);if(S.existsSync(x)){let o=S.readdirSync(x).filter((n)=>n.toLowerCase().includes(t.toLowerCase().substring(0,3))||n.endsWith(".stx")||n.endsWith(".md")),i=o.length>0?`File not found. Similar files in ${x}: ${o.slice(0,3).join(", ")}`:`File not found. Directory ${x} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${h}`,suggestion:i}}return{isValid:!1,error:`File does not exist: ${h}`,suggestion:"Check the file path and try again"}}if(S.statSync(h).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${h}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(p){return{isValid:!1,error:`Cannot access file: ${h}`,suggestion:"Check file permissions and path"}}}function z(h){let p=typeof h==="string"?Number.parseInt(h,10):h;if(Number.isNaN(p))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(p<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(p>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 O=(h)=>h.includes("*")||h.includes("?")||h.includes("{")||h.includes("["),V=(h)=>h.endsWith(".stx")||h.endsWith(".md");function F(h,p=1){if(console.error(`\u274C ${h.error}`),h.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${h.suggestion}`);s.exit(p)}function U(h){if(!h)return;let p;try{p=JSON.parse(h)}catch(x){console.error(`\u274C --info-plist is not valid JSON: ${x.message}`),s.exit(1)}if(typeof p!=="object"||p===null||Array.isArray(p))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),s.exit(1);for(let[x,t]of Object.entries(p))if(typeof t!=="string"&&typeof t!=="number"&&typeof t!=="boolean")console.error(`\u274C --info-plist value for "${x}" must be a string, number or boolean`),s.exit(1);return p}async function H(h,p){try{let x=["test"],t=[];if(h&&h.length>0)for(let c of h)if(O(c))try{let r=await Array.fromAsync(new Bun.Glob(c).scan({onlyFiles:!0,absolute:!0}));if(r.length===0)console.warn(`Warning: No files found matching pattern: ${c}`);else if(t.push(...r),p.verbose)console.log(`Found ${r.length} file(s) matching pattern: ${c}`)}catch(r){return console.error(`Error expanding glob pattern ${c}:`,r),!1}else t.push(c);if(t.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(x.push(...t),p.filter)x.push("--pattern",p.filter);if(p.timeout)x.push("--timeout",p.timeout.toString());if(p.reporter&&p.reporter!=="default")if(p.reporter==="junit"){let c=f.resolve("stx-test-report.xml");x.push("--reporter",p.reporter),x.push("--reporter-outfile",c),console.log(`JUnit report: ${c}`)}else console.warn(`Warning: Reporter '${p.reporter}' is not supported. Using default reporter.`);if(p.coverage)x.push("--coverage");if(p.watch)x.push("--watch");x.push("--preload",f.join(__dirname,"../../../test-utils/happy-dom.ts"));let e={...s.env,STX_TEST_MODE:"true",STX_TEST_UI:p.ui?"true":"false",STX_TEST_VERBOSE:p.verbose?"true":"false"},o="bun";if(p.verbose)console.log(`Running: ${o} ${x.join(" ")}`);let i=performance.now(),n=R(o,x,{stdio:"inherit",shell:!1,env:e});return new Promise((c)=>{n.on("close",(r)=>{let u=((performance.now()-i)/1000).toFixed(2);if(r===0)c(!0);else c(!1)}),s.on("SIGINT",()=>{console.log(`
|
|
4
|
+
Test run interrupted`),n.kill("SIGINT"),s.exit(1)})})}catch(x){return console.error("Error running tests:",x instanceof Error?x.message:String(x)),!1}}var L=s.argv.length>=3&&(V(s.argv[2])&&S.existsSync(s.argv[2])||O(s.argv[2]));if(L){let h=s.argv[2],p={port:3000,watch:!0,cache:!0,markdown:{syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}}};for(let x=3;x<s.argv.length;x++){let t=s.argv[x];if(t==="--port"&&x+1<s.argv.length){let e=B(s.argv[++x]);if(!e.isValid)F(e);p.port=Number.parseInt(s.argv[x],10)}else if(t==="--no-watch")p.watch=!1;else if(t==="--highlight-theme"&&x+1<s.argv.length){if(!p.markdown)p.markdown={};if(!p.markdown.syntaxHighlighting)p.markdown.syntaxHighlighting={};p.markdown.syntaxHighlighting.defaultTheme=s.argv[++x]}else if(t==="--no-highlight"){if(!p.markdown)p.markdown={};if(!p.markdown.syntaxHighlighting)p.markdown.syntaxHighlighting={};p.markdown.syntaxHighlighting.enabled=!1}else if(t==="--no-highlight-unknown"){if(!p.markdown)p.markdown={};if(!p.markdown.syntaxHighlighting)p.markdown.syntaxHighlighting={};p.markdown.syntaxHighlighting.highlightUnknownLanguages=!1}else if(t==="--no-cache")p.cache=!1;else if(t==="--native")p.native=!0}if(O(h))try{let x=await Array.fromAsync(new Bun.Glob(h).scan({onlyFiles:!0,absolute:!0})),t=h.endsWith(".stx")?x.filter((n)=>n.endsWith(".stx")):h.endsWith(".md")?x.filter((n)=>n.endsWith(".md")):x.filter((n)=>n.endsWith(".stx")||n.endsWith(".md")),e=h.split("*")[0].replace(/\/$/,"")||".",o=f.resolve(e);try{let n=new Bun.Glob("**/*.stx"),r=(await Array.fromAsync(n.scan({cwd:o,onlyFiles:!0,absolute:!0}))).filter((l)=>/\[.+\]/.test(f.basename(l)));for(let l of r)if(!t.includes(l))t.push(l)}catch{}if(t.length===0)console.error(`Error: No STX or Markdown files found matching pattern: ${h}`),s.exit(1);if(!await zn(t,p))s.exit(1)}catch(x){console.error("Failed to process files:",x),s.exit(1)}else Fn(h,p).catch((x)=>{console.error("Failed to start dev server:",x),s.exit(1)})}else{let h=function(t,e){let o=[];for(let i=0;i<=e.length;i++)o[i]=[i];for(let i=0;i<=t.length;i++)o[0][i]=i;for(let i=1;i<=e.length;i++)for(let n=1;n<=t.length;n++)if(e.charAt(i-1)===t.charAt(n-1))o[i][n]=o[i-1][n-1];else o[i][n]=Math.min(o[i-1][n-1]+1,o[i][n-1]+1,o[i-1][n]+1);return o[e.length][t.length]};y.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(t)=>{try{if(await fo(t))console.log("Documentation generated successfully."),s.exit(0);else console.error("Documentation generation failed."),s.exit(1)}catch(e){console.error("Error generating documentation:",e),s.exit(1)}}),y.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(t,e)=>{try{let{fetchCollections:o,generatePackage:i}=await import("./chunk-ktvr45qg.js");if(t==="list"){console.log(`
|
|
5
5
|
\uD83D\uDCDA Fetching available icon collections...
|
|
6
6
|
`);let n=await o(),c=Object.entries(n).sort((r,l)=>l[1].total-r[1].total);console.log(`Available collections:
|
|
7
7
|
`);for(let[r,l]of c){let u=l;console.log(` ${r.padEnd(30)} ${u.name} (${u.total} icons)`)}console.log(`
|
|
8
8
|
Total: ${c.length} collections`)}else if(t.startsWith("generate")){let n=t==="generate"?"":t.replace("generate:","").replace("generate-","").replace("generate","").trim();if(!n)console.error("Error: Please specify a collection prefix"),console.error("Usage: stx iconify generate <prefix> [--icons icon1,icon2,...]"),s.exit(1);let c=e.output||f.join(s.cwd(),"packages/collections"),r=e.icons?e.icons.split(",").map((l)=>l.trim()):void 0;await i(n,c,r),console.log(`
|
|
9
9
|
\u2713 Package generated successfully!`),console.log(`
|
|
10
|
-
To use the package:`),console.log(` 1. cd packages/collections/iconify-${n}`),console.log(" 2. bun install"),console.log(" 3. bun run build")}else console.error(`Unknown iconify command: ${t}`),console.error("Available commands: list, generate"),s.exit(1)}catch(o){console.error("Error:",o instanceof Error?o.message:String(o)),s.exit(1)}}),y.command("pwa <command>","PWA tools - audit configuration and build output").option("--output <dir>","Build output directory to audit",{default:"dist"}).example("stx pwa audit").example("stx pwa audit --output build").action(async(t,e)=>{try{if(t==="audit"){let{runPwaAudit:o,formatAuditResult:i}=await import("./chunk-xjwgzp6s.js"),{loadConfig:n}=await import("./chunk-
|
|
10
|
+
To use the package:`),console.log(` 1. cd packages/collections/iconify-${n}`),console.log(" 2. bun install"),console.log(" 3. bun run build")}else console.error(`Unknown iconify command: ${t}`),console.error("Available commands: list, generate"),s.exit(1)}catch(o){console.error("Error:",o instanceof Error?o.message:String(o)),s.exit(1)}}),y.command("pwa <command>","PWA tools - audit configuration and build output").option("--output <dir>","Build output directory to audit",{default:"dist"}).example("stx pwa audit").example("stx pwa audit --output build").action(async(t,e)=>{try{if(t==="audit"){let{runPwaAudit:o,formatAuditResult:i}=await import("./chunk-xjwgzp6s.js"),{loadConfig:n}=await import("./chunk-m0ngddr1.js");console.log(`
|
|
11
11
|
\uD83D\uDD0D Running PWA audit...
|
|
12
|
-
`);let c=await n(),r=e.output||"dist",l=o(c,r);if(console.log(i(l)),l.failed>0)s.exit(1)}else console.error(`Unknown pwa command: ${t}`),console.error("Available commands: audit"),s.exit(1)}catch(o){console.error("Error:",o instanceof Error?o.message:String(o)),s.exit(1)}}),y.command("dev [file]","Start a development server for an STX app or file").option("--port <port>","Port to use for the dev server",{default:3000}).option("--pages <dir>",'Directory containing page templates (default: pagesDir from stx.config.ts, else "pages")').option("--no-watch","Disable file watching and auto-reload").option("--native","Open in a native desktop window using Zyte").option("--titlebar-hidden","Hide the native titlebar but keep the traffic-light buttons (web content draws under a transparent full-size titlebar). Implies --native.").option("--highlight-theme <theme>","Syntax highlighting theme for Markdown code blocks",{default:"github-dark"}).option("--no-highlight","Disable syntax highlighting for Markdown code blocks").option("--no-highlight-unknown","Disable syntax highlighting for unknown languages in Markdown").option("--no-cache","Disable caching of parsed files").option("--no-hmr","Disable HMR / live-reload script injection (useful for clean network traces)").option("--profile","Print per-directive timing for every page render via performanceMonitor").option("--debug-directives","Log directive ordering and intermediate template state during rendering").example("stx dev").example("stx dev --port 8080").example("stx dev --pages src/pages").example("stx dev template.stx").example("stx dev components/hero.stx --port 8080").example("stx dev **/*.stx").example("stx dev docs/guide.md").example("stx dev template.stx --native").action(async(t,e)=>{try{if(e.port!==void 0){let i=B(e.port);if(!i.isValid)F(i);e.port=Number.parseInt(String(e.port),10)}if(e.timeout!==void 0){let i=z(e.timeout);if(!i.isValid)F(i)}let o={syntaxHighlighting:{enabled:e.highlight!==!1,serverSide:!0,defaultTheme:e.highlightTheme||"github-dark",highlightUnknownLanguages:e.highlightUnknown!==!1}};if(!t){if(!await
|
|
12
|
+
`);let c=await n(),r=e.output||"dist",l=o(c,r);if(console.log(i(l)),l.failed>0)s.exit(1)}else console.error(`Unknown pwa command: ${t}`),console.error("Available commands: audit"),s.exit(1)}catch(o){console.error("Error:",o instanceof Error?o.message:String(o)),s.exit(1)}}),y.command("dev [file]","Start a development server for an STX app or file").option("--port <port>","Port to use for the dev server",{default:3000}).option("--pages <dir>",'Directory containing page templates (default: pagesDir from stx.config.ts, else "pages")').option("--no-watch","Disable file watching and auto-reload").option("--native","Open in a native desktop window using Zyte").option("--titlebar-hidden","Hide the native titlebar but keep the traffic-light buttons (web content draws under a transparent full-size titlebar). Implies --native.").option("--highlight-theme <theme>","Syntax highlighting theme for Markdown code blocks",{default:"github-dark"}).option("--no-highlight","Disable syntax highlighting for Markdown code blocks").option("--no-highlight-unknown","Disable syntax highlighting for unknown languages in Markdown").option("--no-cache","Disable caching of parsed files").option("--no-hmr","Disable HMR / live-reload script injection (useful for clean network traces)").option("--profile","Print per-directive timing for every page render via performanceMonitor").option("--debug-directives","Log directive ordering and intermediate template state during rendering").example("stx dev").example("stx dev --port 8080").example("stx dev --pages src/pages").example("stx dev template.stx").example("stx dev components/hero.stx --port 8080").example("stx dev **/*.stx").example("stx dev docs/guide.md").example("stx dev template.stx --native").action(async(t,e)=>{try{if(e.port!==void 0){let i=B(e.port);if(!i.isValid)F(i);e.port=Number.parseInt(String(e.port),10)}if(e.timeout!==void 0){let i=z(e.timeout);if(!i.isValid)F(i)}let o={syntaxHighlighting:{enabled:e.highlight!==!1,serverSide:!0,defaultTheme:e.highlightTheme||"github-dark",highlightUnknownLanguages:e.highlightUnknown!==!1}};if(!t){if(!await Hn(".",{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,cache:e.cache!==!1,hotReload:e.hmr!==!1,profile:e.profile===!0,debugDirectives:e.debugDirectives===!0,...e.pages&&{pagesDir:e.pages}}))s.exit(1);return}if(!O(t))try{let i=await import("fs");if(i.existsSync(t)&&i.statSync(t).isDirectory()){if(!await Hn(t,{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,cache:e.cache!==!1,hotReload:e.hmr!==!1,profile:e.profile===!0,debugDirectives:e.debugDirectives===!0,...e.pages&&{pagesDir:e.pages}}))s.exit(1);return}}catch{}if(O(t)){console.log(`Expanding glob pattern: ${t}`);let i=await G.timeAsync("glob-expansion",async()=>Array.fromAsync(new Bun.Glob(t).scan({onlyFiles:!0,absolute:!0}))),n=t.endsWith(".stx")?i.filter((u)=>u.endsWith(".stx")):t.endsWith(".md")?i.filter((u)=>u.endsWith(".md")):i.filter((u)=>u.endsWith(".stx")||u.endsWith(".md"));if(n.length===0)console.error(`No STX or Markdown files found matching pattern: ${t}`),console.error("Try using patterns like '*.stx' or 'components/**/*.stx'"),s.exit(1);let c=t.split("*")[0].replace(/\/$/,"")||".",r=f.resolve(c);try{let u=new Bun.Glob("**/*.stx"),m=(await Array.fromAsync(u.scan({cwd:r,onlyFiles:!0,absolute:!0}))).filter((g)=>/\[.+\]/.test(f.basename(g)));for(let g of m)if(!n.includes(g))n.push(g)}catch{}if(console.log(`Found ${n.length} ${n.length===1?"file":"files"} matching ${t}`),!await zn(n,{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,markdown:o,cache:e.cache!==!1}))s.exit(1)}else{if(!O(t)){let n=A(t);if(!n.isValid)F(n)}if(!await Fn(t,{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,markdown:o,cache:e.cache!==!1}))s.exit(1)}}catch(o){console.error("Error starting dev server:",o),s.exit(1)}}),y.command("a11y [target]","Scan .stx files for accessibility issues (directory, file, or glob)").option("--no-recursive","Disable recursive scanning of directories").option("--ignore <paths>","Comma-separated paths to ignore",{default:""}).option("--json","Output results as JSON").option("--output <file>","Write results to a file instead of stdout").option("--fix","Automatically fix common accessibility issues").example("stx a11y ./templates").example('stx a11y "resources/**/*.stx"').example("stx a11y resources/emails/welcome.stx").example("stx a11y --json --output a11y-report.json").action(async(t=".",e)=>{try{console.log(`Scanning ${t} for accessibility issues...`);let o=e.ignore?e.ignore.split(",").map((l)=>l.trim()):[],{results:i,scannedFiles:n}=await Di(t,{recursive:e.recursive!==!1,ignorePaths:o});if(n.length===0)console.log(`
|
|
13
13
|
No .stx files matched ${t}
|
|
14
14
|
`),s.exit(1);let c=Object.keys(i).length,r=Object.values(i).reduce((l,u)=>l+u.length,0);if(e.json){let l=JSON.stringify(i,null,2);if(e.output)await Bun.write(e.output,l),console.log(`A11y scan results written to ${e.output}`);else console.log(l)}else if(c===0)console.log(`\u2713 No accessibility issues found in ${n.length} file(s)!`);else{console.log(`Found ${r} accessibility issues in ${c} files:
|
|
15
15
|
`);for(let[l,u]of Object.entries(i)){let a=f.relative(s.cwd(),l);console.log(`
|
|
@@ -69,13 +69,13 @@ Total: ${r} issues in ${c} files`),e.output){let l=`
|
|
|
69
69
|
File not found: ${t}`),s.exit(1);if(!t.endsWith(".stx"))console.error(`
|
|
70
70
|
File must have .stx extension: ${t}`),s.exit(1)}let i=f.resolve(e.pages),n=f.resolve(e.out);if(!t&&!S.existsSync(i))console.error(`
|
|
71
71
|
Pages directory not found: ${i}`),console.log(`
|
|
72
|
-
Create a 'pages' directory with .stx files, or use --pages to specify a different directory.`),s.exit(1);let{buildApp:c}=await import("./chunk-
|
|
72
|
+
Create a 'pages' directory with .stx files, or use --pages to specify a different directory.`),s.exit(1);let{buildApp:c}=await import("./chunk-7nr3f2bw.js");Ct();let r=await c({root:t?f.dirname(t):void 0,debug:e.verbose,ssg:{pagesDir:e.pages,outputDir:e.out,domain:e.domain,baseUrl:e.base,sitemap:e.sitemap,rss:e.rss,minify:e.minify,cache:e.cache!==!1,cleanOutput:e.clean,concurrency:Number.parseInt(e.concurrency,10)||10,publicDir:e.public,trailingSlash:e.trailingSlash,generate404:!0,hooks:e.verbose?{onPageStart:(u)=>console.log(` Generating: ${u}`),onPageEnd:(u,a)=>console.log(` Generated: ${u} (${a.length} bytes)`),onError:(u,a)=>console.error(` Error in ${a}: ${u.message}`)}:void 0},ssr:{outputDir:e.out==="dist"?".output":e.out,debug:e.verbose}}),l=((performance.now()-o)/1000).toFixed(2);if(r.mode==="ssr"&&r.ssr)console.log(`
|
|
73
73
|
Build complete! (SSR)
|
|
74
74
|
`),console.log(` Pages compiled: ${r.ssr.pageCount}`),console.log(` Output: ${r.ssr.outputDir}`),console.log(` Duration: ${l}s
|
|
75
75
|
`);else if(r.ssg){if(console.log(`
|
|
76
76
|
Build complete! (SSG)
|
|
77
77
|
`),console.log(` Pages generated: ${r.ssg.successCount}`),r.ssg.failedCount>0)console.log(` Failed: ${r.ssg.failedCount}`);if(r.ssg.cachedCount>0)console.log(` From cache: ${r.ssg.cachedCount}`);if(r.ssg.sitemapPath)console.log(` Sitemap: ${f.relative(s.cwd(),r.ssg.sitemapPath)}`);if(r.ssg.rssPath)console.log(` RSS: ${f.relative(s.cwd(),r.ssg.rssPath)}`);if(console.log(` Build time: ${l}s`),console.log(` Output: ${f.relative(s.cwd(),e.out||"dist")}/
|
|
78
|
-
`),r.ssg.errors.length>0){console.log(" Errors:");for(let a of r.ssg.errors)console.error(` ${a.route}: ${a.error}`);console.log("")}if(e.verbose&&r.ssg.pages.length>0&&r.ssg.pages.length<=20){console.log(" Generated pages:");for(let a of r.ssg.pages){let m=f.relative(s.cwd(),a.outputPath),g=(a.size/1024).toFixed(1);console.log(` ${m} (${g} KB)${a.cached?" [cached]":""}`)}console.log("")}let u=
|
|
78
|
+
`),r.ssg.errors.length>0){console.log(" Errors:");for(let a of r.ssg.errors)console.error(` ${a.route}: ${a.error}`);console.log("")}if(e.verbose&&r.ssg.pages.length>0&&r.ssg.pages.length<=20){console.log(" Generated pages:");for(let a of r.ssg.pages){let m=f.relative(s.cwd(),a.outputPath),g=(a.size/1024).toFixed(1);console.log(` ${m} (${g} KB)${a.cached?" [cached]":""}`)}console.log("")}let u=kt();if(u.length>0){console.error(`
|
|
79
79
|
${u.length} client script(s) failed to bundle:
|
|
80
80
|
`);for(let a of u)console.error(` ${f.relative(s.cwd(),a.filePath)}
|
|
81
81
|
${a.message}
|
|
@@ -84,8 +84,8 @@ Total: ${r} issues in ${c} files`),e.output){let l=`
|
|
|
84
84
|
Build completed with ${r.ssg.failedCount} error(s). Fix the issues above and try again.
|
|
85
85
|
`),s.exit(1);console.log(" To preview locally:"),console.log(` cd ${e.out||"dist"} && npx serve
|
|
86
86
|
`)}}catch(o){console.error(`
|
|
87
|
-
Build failed:`,o instanceof Error?o.message:String(o)),s.exit(1)}}),y.command("start","Start the production server (serves pre-built .output/)").option("--port <number>","Server port",{default:"3000"}).option("--output <dir>","Output directory from stx build",{default:".output"}).example("stx start").example("stx start --port 8080").action(async(t)=>{try{let e=f.resolve(t.output);if(!S.existsSync(f.join(e,"manifest.json")))console.error("\n No production build found. Run `stx build --out .output` first.\n"),s.exit(1);let{startProductionServer:o}=await import("./chunk-
|
|
88
|
-
Failed to start production server:`,e instanceof Error?e.message:String(e)),s.exit(1)}}),y.command("deploy [directory]","Deploy built site to Netlify").option("--site-id <id>","Netlify site ID (or set NETLIFY_SITE_ID env var)").option("--token <token>","Auth token (or set NETLIFY_AUTH_TOKEN env var)").option("--production","Deploy to production (default: draft preview)").option("--message <msg>","Deploy message/title").option("--no-build","Skip build step before deploy").option("--open","Open deployed URL in browser").option("--dry-run","Preview deployment without uploading").option("--init","Initialize Netlify configuration for this project").example("stx deploy").example("stx deploy --production").example("stx deploy dist --site-id my-site-abc123").example("stx deploy --init").example("stx deploy --dry-run").action(async(t,e)=>{try{let{deploy:o,initNetlify:i,DeployError:n}=await import("./chunk-
|
|
87
|
+
Build failed:`,o instanceof Error?o.message:String(o)),s.exit(1)}}),y.command("start","Start the production server (serves pre-built .output/)").option("--port <number>","Server port",{default:"3000"}).option("--output <dir>","Output directory from stx build",{default:".output"}).example("stx start").example("stx start --port 8080").action(async(t)=>{try{let e=f.resolve(t.output);if(!S.existsSync(f.join(e,"manifest.json")))console.error("\n No production build found. Run `stx build --out .output` first.\n"),s.exit(1);let{startProductionServer:o}=await import("./chunk-emx9v5z8.js");await o({outputDir:e,port:Number.parseInt(t.port,10)||3000})}catch(e){console.error(`
|
|
88
|
+
Failed to start production server:`,e instanceof Error?e.message:String(e)),s.exit(1)}}),y.command("deploy [directory]","Deploy built site to Netlify").option("--site-id <id>","Netlify site ID (or set NETLIFY_SITE_ID env var)").option("--token <token>","Auth token (or set NETLIFY_AUTH_TOKEN env var)").option("--production","Deploy to production (default: draft preview)").option("--message <msg>","Deploy message/title").option("--no-build","Skip build step before deploy").option("--open","Open deployed URL in browser").option("--dry-run","Preview deployment without uploading").option("--init","Initialize Netlify configuration for this project").example("stx deploy").example("stx deploy --production").example("stx deploy dist --site-id my-site-abc123").example("stx deploy --init").example("stx deploy --dry-run").action(async(t,e)=>{try{let{deploy:o,initNetlify:i,DeployError:n}=await import("./chunk-fwt5fh5w.js");if(console.log(`\x1B[1mstx deploy\x1B[0m \x1B[2mv${j}\x1B[0m`),e.init){console.log(`
|
|
89
89
|
\uD83D\uDCDD Initializing Netlify configuration...
|
|
90
90
|
`);let r=await i({directory:t||s.cwd(),siteId:e.siteId});if(console.log(`\u2713 Created ${r.configPath}`),r.siteId)console.log("\u2713 Saved site ID to .env.local");console.log(`
|
|
91
91
|
You can now deploy with: stx deploy`);return}if(e.build!==!1){if(console.log(`
|
|
@@ -97,7 +97,7 @@ You can now deploy with: stx deploy`);return}if(e.build!==!1){if(console.log(`
|
|
|
97
97
|
`),console.log(` ${e.dryRun?"Would deploy":"Draft URL"}: ${c.url}`),c.siteUrl)console.log(` Site URL: ${c.siteUrl}`);if(!e.dryRun)console.log(`
|
|
98
98
|
Deploy ID: ${c.deployId}`),console.log(` Duration: ${(c.duration/1000).toFixed(1)}s`),console.log(` Files: ${c.filesUploaded}`)}}catch(o){if(o instanceof Error&&o.name==="DeployError")console.error(`
|
|
99
99
|
\u274C ${o.message}`),s.exit(1);console.error(`
|
|
100
|
-
\u274C Deploy failed:`,o instanceof Error?o.message:String(o)),s.exit(1)}}),y.command("images <input>","Optimize images for production").option("-o, --output <dir>","Output directory",{default:"dist/images"}).option("-w, --widths <sizes>","Output widths (comma-separated)",{default:"320,640,768,1024,1280,1536,1920"}).option("-f, --formats <types>","Output formats (comma-separated)",{default:"webp,jpeg"}).option("-q, --quality <n>","Output quality (1-100)",{default:"80"}).option("--placeholder <type>","Placeholder type: blur, dominant-color, none",{default:"none"}).option("--dry-run","Preview without processing").option("--verbose","Show detailed output").example("stx images public/images").example("stx images public/images -o dist/images").example("stx images public/images --widths 640,1024,1920").example("stx images public/images --formats webp,avif").example("stx images public/images --quality 85").example("stx images public/images --dry-run").action(async(t,e)=>{try{let{optimizeDirectory:o,isSharpAvailable:i,formatSize:n}=await import("./chunk-
|
|
100
|
+
\u274C Deploy failed:`,o instanceof Error?o.message:String(o)),s.exit(1)}}),y.command("images <input>","Optimize images for production").option("-o, --output <dir>","Output directory",{default:"dist/images"}).option("-w, --widths <sizes>","Output widths (comma-separated)",{default:"320,640,768,1024,1280,1536,1920"}).option("-f, --formats <types>","Output formats (comma-separated)",{default:"webp,jpeg"}).option("-q, --quality <n>","Output quality (1-100)",{default:"80"}).option("--placeholder <type>","Placeholder type: blur, dominant-color, none",{default:"none"}).option("--dry-run","Preview without processing").option("--verbose","Show detailed output").example("stx images public/images").example("stx images public/images -o dist/images").example("stx images public/images --widths 640,1024,1920").example("stx images public/images --formats webp,avif").example("stx images public/images --quality 85").example("stx images public/images --dry-run").action(async(t,e)=>{try{let{optimizeDirectory:o,isSharpAvailable:i,formatSize:n}=await import("./chunk-hhwnd24n.js"),c=await import("fs"),r=await import("path");if(console.log(`\x1B[1mstx images\x1B[0m \x1B[2mv${j}\x1B[0m`),!await i())console.error(`
|
|
101
101
|
\u274C sharp is required for image optimization.`),console.log(`
|
|
102
102
|
Install sharp with:`),console.log(" bun add sharp"),s.exit(1);let u=e.widths.split(",").map((v)=>Number.parseInt(v.trim(),10)).filter((v)=>!Number.isNaN(v)),a=e.formats.split(",").map((v)=>v.trim().toLowerCase()),m=Number.parseInt(e.quality,10)||80,g=e.placeholder,b=r.resolve(t);if(!c.existsSync(b))console.error(`
|
|
103
103
|
\u274C Input directory not found: ${b}`),s.exit(1);if(!c.statSync(b).isDirectory())console.error(`
|
|
@@ -124,7 +124,7 @@ To view it in the development server:`),console.log(` stx dev ${t}
|
|
|
124
124
|
\uD83D\uDCDD ${f.relative(s.cwd(),a)}:`),console.log("--- Original"),console.log("+++ Formatted"),console.log(`@@ Changes in ${f.basename(a)} @@`),console.log("+ Formatted content would be applied");else await Bun.write(a,b),console.log(`\u2705 Formatted ${f.relative(s.cwd(),a)}`),l++}catch(m){console.error(`\u274C Error formatting ${f.relative(s.cwd(),a)}:`,m),u++}if(e.check&&u>0)console.log(`
|
|
125
125
|
${u} files need formatting. Run 'stx format' to fix.`),s.exit(1);else if(!e.check&&!e.diff)console.log(`\u2728 Formatted ${l} files successfully`)}catch(o){console.error("Error formatting files:",o),s.exit(1)}}),y.command("perf [command...]","Show performance statistics for STX operations").option("--clear","Clear performance statistics").option("--json","Output as JSON").example("stx perf").example("stx perf --clear").example("stx perf --json").action(async(t,e)=>{try{if(e.clear){G.clear(),console.log("\u2705 Performance statistics cleared");return}let o=G.getStats();if(Object.keys(o).length===0){if(e.json){console.log(JSON.stringify({},null,2));return}console.log("No performance data available. Run some STX commands first.");return}if(e.json)console.log(JSON.stringify(o,null,2));else{console.log(`
|
|
126
126
|
\uD83D\uDCCA STX Performance Statistics
|
|
127
|
-
`);for(let[i,n]of Object.entries(o))console.log(`\uD83D\uDD27 ${i}:`),console.log(` Count: ${n.count}`),console.log(` Average: ${n.avgTime.toFixed(2)}ms`),console.log(` Total: ${n.totalTime.toFixed(2)}ms`),console.log(` Min: ${n.minTime.toFixed(2)}ms`),console.log(` Max: ${n.maxTime.toFixed(2)}ms`),console.log("")}}catch(o){console.error("Error showing performance stats:",o),s.exit(1)}}),y.command("typecheck [patterns...]","Type-check the TypeScript inside .stx script blocks").option("--no-client","Skip <script client> and bare <script> blocks").option("--no-server","Skip <script server> blocks").option("--no-templates","Skip {{ }} and directive expressions in the markup").option("--lib <path>","Extra ambient declaration file (repeatable)").example("stx typecheck").example('stx typecheck "resources/views/**/*.stx"').action(async(t,e)=>{let{formatTypecheckDiagnostics:o,typecheckStxFiles:i}=await import("./chunk-
|
|
127
|
+
`);for(let[i,n]of Object.entries(o))console.log(`\uD83D\uDD27 ${i}:`),console.log(` Count: ${n.count}`),console.log(` Average: ${n.avgTime.toFixed(2)}ms`),console.log(` Total: ${n.totalTime.toFixed(2)}ms`),console.log(` Min: ${n.minTime.toFixed(2)}ms`),console.log(` Max: ${n.maxTime.toFixed(2)}ms`),console.log("")}}catch(o){console.error("Error showing performance stats:",o),s.exit(1)}}),y.command("typecheck [patterns...]","Type-check the TypeScript inside .stx script blocks").option("--no-client","Skip <script client> and bare <script> blocks").option("--no-server","Skip <script server> blocks").option("--no-templates","Skip {{ }} and directive expressions in the markup").option("--lib <path>","Extra ambient declaration file (repeatable)").example("stx typecheck").example('stx typecheck "resources/views/**/*.stx"').action(async(t,e)=>{let{formatTypecheckDiagnostics:o,typecheckStxFiles:i}=await import("./chunk-k6bmhf83.js"),{resolveStxTargets:n}=await import("./chunk-ce2d0hz9.js"),c=Array.isArray(t)?t:t?[t]:[],r=c.length?c:["**/*.stx"],l=await n(r);if(l.length===0){console.log(`
|
|
128
128
|
No .stx files matched ${r.join(", ")}
|
|
129
129
|
`);return}let u=lo(s.argv,"--lib"),a=u.length>0?u:e.lib?Array.isArray(e.lib)?e.lib:[e.lib]:[],m=await i(l,{client:e.client!==!1,server:e.server!==!1,templates:e.templates!==!1,extraLibs:a});if(m.failure)console.error(`
|
|
130
130
|
Type-check did not run.
|
|
@@ -135,8 +135,8 @@ ${u} files need formatting. Run 'stx format' to fix.`),s.exit(1);else if(!e.chec
|
|
|
135
135
|
`),s.exit(2);let g=m.diagnostics.filter((b)=>b.category==="error");if(m.diagnostics.length>0)console.error(`
|
|
136
136
|
${o(m.diagnostics)}
|
|
137
137
|
`);if(console.log(` Checked ${m.blockCount} script block(s) and ${m.expressionCount} template expression(s) in ${m.checkedFiles.length} file(s) \u2014 `+`${g.length} error(s), ${m.diagnostics.length-g.length} warning(s)
|
|
138
|
-
`),g.length>0)s.exit(1)}),y.command("codemod [patterns...]","Find hand-rolled code that an stx primitive already covers").option("--fix","Write the safe rewrites (default is report-only)").option("--rule <rule>","Run one rule only: confirm | tooltip (rewritable) \xB7 alert | route-params | search-params | navigate | "+"fetch | polling | debounce | click-outside | focus | clipboard | watch (report-only)").example("stx codemod").example("stx codemod --rule route-params").example('stx codemod --fix "resources/views/**/*.stx"').action(async(t,e)=>{let{codemodSource:o,formatCodemodFindings:i}=await import("./chunk-
|
|
139
|
-
${m} file(s) written.`)}),y.command("doctor","Diagnose the stx framework-runtime resolution + staleness chain").option("--json","Output the report as JSON").example("stx doctor").example("stx doctor --json").action(async(t)=>{try{let e;try{let i=await import("./chunk-
|
|
138
|
+
`),g.length>0)s.exit(1)}),y.command("codemod [patterns...]","Find hand-rolled code that an stx primitive already covers").option("--fix","Write the safe rewrites (default is report-only)").option("--rule <rule>","Run one rule only: confirm | tooltip (rewritable) \xB7 alert | route-params | search-params | navigate | "+"fetch | polling | debounce | click-outside | focus | clipboard | watch (report-only)").example("stx codemod").example("stx codemod --rule route-params").example('stx codemod --fix "resources/views/**/*.stx"').action(async(t,e)=>{let{codemodSource:o,formatCodemodFindings:i}=await import("./chunk-j1dmkt29.js"),n=globalThis.Bun.Glob,c=Array.isArray(t)?t:t?[t]:[],r=c.length?c:["**/*.stx","**/*.ts"],l=e.rule?[e.rule]:void 0;if(e.rule&&e.rule!=="confirm"&&e.rule!=="tooltip")console.error(`Unknown rule "${e.rule}". Expected: confirm | tooltip`),s.exit(1);let u=new Set,a=[],m=0,g=new Set;try{let b=Bun.spawnSync(["git","ls-files","--others","--ignored","--exclude-standard","-z"],{cwd:s.cwd(),stdout:"pipe",stderr:"pipe"});for(let w of new TextDecoder().decode(b.stdout).split("\x00"))if(w)g.add(f.resolve(s.cwd(),w))}catch{}for(let b of r)for await(let w of new n(b).scan({cwd:s.cwd(),absolute:!0})){if(w.includes("/node_modules/")||w.includes("/dist/")||u.has(w)||g.has(w))continue;u.add(w);let k=await Bun.file(w).text(),v=o(k,{file:w,rules:l});if(a.push(...v.findings),e.fix&&v.code!==k)await Bun.write(w,v.code),m++}if(console.error(i(a,Boolean(e.fix))),e.fix)console.error(`
|
|
139
|
+
${m} file(s) written.`)}),y.command("doctor","Diagnose the stx framework-runtime resolution + staleness chain").option("--json","Output the report as JSON").example("stx doctor").example("stx doctor --json").action(async(t)=>{try{let e;try{let i=await import("./chunk-d81h4mxd.js");e=i.generateSignalsRuntime}catch{e=void 0}let o=await Or({generateRuntime:e});if(t.json)console.log(JSON.stringify(o,null,2));else console.log(Dr(o));if(!o.ok)s.exit(1)}catch(e){console.error("Error running doctor:",e),s.exit(1)}}),y.command("debug <file>","Debug STX template processing step by step").option("--step","Step through processing stages interactively").option("--verbose","Show detailed processing information").option("--context <data>","JSON string of context data to use").option("--save-report <file>","Save debug report to file").example("stx debug template.stx").example("stx debug template.stx --step").example(`stx debug template.stx --context '{"name": "John", "items": [1,2,3]}'`).action(async(t,e)=>{try{let o=A(t);if(!o.isValid)F(o);console.log(`\uD83D\uDD0D Debugging stx template: ${t}
|
|
140
140
|
`);let i={};if(e.context)try{i=JSON.parse(e.context)}catch(r){console.error("\u274C Invalid JSON in --context option"),s.exit(1)}let n=await Bun.file(t).text();console.log(`\uD83D\uDCC4 Template Content (${n.length} chars):`),console.log("\u2500".repeat(50)),console.log(n.substring(0,500)+(n.length>500?`
|
|
141
141
|
...
|
|
142
142
|
`:"")),console.log("\u2500".repeat(50));let c=n.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(c)console.log(`
|
|
@@ -160,11 +160,11 @@ Press Ctrl+C to stop watching...
|
|
|
160
160
|
\uD83D\uDCC4 Files with issues:`),u.forEach((a)=>{let m=a.issues.filter((g)=>n[g.type]>=c).length;if(m>0)console.log(` ${f.relative(s.cwd(),a.file)} (${m} issues)`)});if(e.saveReport){let a={summary:l,results:u,generatedAt:new Date().toISOString(),commandOptions:e};await Bun.write(e.saveReport,JSON.stringify(a,null,2)),console.log(`
|
|
161
161
|
\uD83D\uDCCB Analysis report saved to: ${e.saveReport}`)}console.log(`
|
|
162
162
|
\u2728 Analysis complete! Use --detailed for more information.`)}catch(o){console.error("Error analyzing templates:",o),s.exit(1)}}),y.command("screenshot [input]","Capture PNG screenshot(s) of page(s) via Bun WebView \u2014 a file, URL, or dist directory").option("--out <dir>","Output directory",{default:"screenshots"}).option("--width <px>","Viewport width",{default:"1440"}).option("--height <px>","Viewport height",{default:"2200"}).option("--wait <ms>","Settle time after navigation before capture",{default:"800"}).option("--timeout <ms>","Hard cap on waiting for navigation",{default:"15000"}).option("--full-page","Capture the entire scrollable page, not just the viewport").option("--wait-selector <sel>","Wait until a CSS selector exists before capturing").option("--format <fmt>","Image format: png | jpeg | webp",{default:"png"}).option("--backend <name>","WebView backend: webkit (macOS, default) | chrome").action(async(t,e)=>{let{captureScreenshots:o}=await import("./chunk-6djvj6hg.js"),i=t||"dist";try{let n=await o(i,e.out,{width:Number.parseInt(e.width,10),height:Number.parseInt(e.height,10),waitMs:Number.parseInt(e.wait,10),timeoutMs:Number.parseInt(e.timeout,10),fullPage:Boolean(e.fullPage),waitSelector:e.waitSelector,format:e.format,backend:e.backend});for(let c of n)console.log(`\uD83D\uDCF8 ${c.output} (${(c.bytes/1024).toFixed(0)} KB)`);console.log(`
|
|
163
|
-
\u2728 Captured ${n.length} screenshot(s) to ${e.out}/ via Bun WebView`)}catch(n){console.error(`Screenshot failed: ${n.message}`),s.exit(1)}}),y.command("version","Show the version of the CLI").action(()=>{console.log(j)}),y.command("interactive","Start interactive REPL mode for template development").alias("i").option("--context <file>","Load initial context from JSON file").option("--cwd <directory>","Set working directory").option("--verbose","Show verbose output").action(async(t)=>{let{startInteractive:e}=await import("./chunk-
|
|
163
|
+
\u2728 Captured ${n.length} screenshot(s) to ${e.out}/ via Bun WebView`)}catch(n){console.error(`Screenshot failed: ${n.message}`),s.exit(1)}}),y.command("version","Show the version of the CLI").action(()=>{console.log(j)}),y.command("interactive","Start interactive REPL mode for template development").alias("i").option("--context <file>","Load initial context from JSON file").option("--cwd <directory>","Set working directory").option("--verbose","Show verbose output").action(async(t)=>{let{startInteractive:e}=await import("./chunk-p69ay3bg.js"),o={};if(t.context){let i=f.resolve(t.context);if(S.existsSync(i))try{let n=S.readFileSync(i,"utf-8");o=JSON.parse(n)}catch(n){console.error("Error loading context file:",n),s.exit(1)}else console.error(`Context file not found: ${i}`),s.exit(1)}await e({context:o,cwd:t.cwd?f.resolve(t.cwd):s.cwd(),verbose:t.verbose})}),y.command("build:native <input>","Build stx template into a native desktop/mobile app").option("--output <dir>","Output directory",{default:"dist/native"}).option("--target <platform>","Target platform: macos, windows, linux, ios, android").option("--format <format>","Output format: app, dmg, pkg, msi, zip, deb, rpm, appimage, ipa, apk").option("--name <name>","Application name (defaults to filename)").option("--version <version>","Application version",{default:"1.0.0"}).option("--description <desc>","Application description").option("--author <author>","Author/Maintainer name").option("--bundle-id <id>","Bundle identifier (macOS/iOS)").option("--icon <path>","Path to application icon").option("--width <width>","Window width",{default:"1200"}).option("--height <height>","Window height",{default:"800"}).option("--title <title>","Window title").option("--system-tray","Enable system tray/menubar mode").option("--menubar-only","Run without a dock icon (implied by --system-tray)").option("--category <type>","LSApplicationCategoryType (macOS)").option("--copyright <text>","NSHumanReadableCopyright (macOS)").option("--min-system-version <v>","LSMinimumSystemVersion (macOS)").option("--info-plist <json>","Extra Info.plist keys as a JSON object (macOS)").option("--dev-tools","Enable developer tools").option("--frameless","Create frameless window").option("--always-on-top","Keep window always on top").option("--craft-path <path>","Path to Craft binary").option("--verbose","Show verbose output").example("stx build:native app.stx --target macos").example("stx build:native app.stx --target macos --format dmg").example("stx build:native app.stx --target linux --format appimage").example('stx build:native app.stx --name "My App" --icon icon.png').action(async(t,e)=>{try{let{buildNative:o,getAvailableTargets:i,getAvailableFormats:n}=await import("./chunk-bd5gxtt2.js"),c=f.resolve(t);if(!S.existsSync(c))console.error(`\u274C Input file not found: ${t}`),s.exit(1);let r=i();if(e.target&&!["macos","windows","linux","ios","android"].includes(e.target))console.error(`\u274C Invalid target: ${e.target}`),console.error("\uD83D\uDCA1 Available targets: macos, windows, linux, ios, android"),console.error(`\uD83D\uDCA1 Targets available on this machine: ${r.join(", ")}`),s.exit(1);let l=e.target||r[0],u=n(l);if(e.format&&!u.includes(e.format))console.error(`\u274C Invalid format for ${l}: ${e.format}`),console.error(`\uD83D\uDCA1 Available formats: ${u.join(", ")}`),s.exit(1);console.log(`
|
|
164
164
|
\uD83D\uDD28 Building native app...`),console.log(` Input: ${t}`),console.log(` Target: ${l}`),console.log(` Format: ${e.format||"default"}`),console.log(` Output: ${e.output}
|
|
165
165
|
`);let a=await o({input:c,output:f.resolve(e.output),target:l,format:e.format,name:e.name,version:e.version,description:e.description,author:e.author,bundleId:e.bundleId,icon:e.icon?f.resolve(e.icon):void 0,window:{title:e.title,width:Number.parseInt(e.width,10),height:Number.parseInt(e.height,10),frameless:e.frameless,alwaysOnTop:e.alwaysOnTop},systemTray:e.systemTray,menubarOnly:e.menubarOnly,category:e.category,copyright:e.copyright,minimumSystemVersion:e.minSystemVersion,infoPlist:U(e.infoPlist),devTools:e.devTools,craftPath:e.craftPath,verbose:e.verbose});if(a.success){if(console.log("\u2705 Build successful!"),console.log(` Output: ${a.outputPath}`),a.duration)console.log(` Duration: ${(a.duration/1000).toFixed(2)}s`);if(l==="macos"&&a.format==="app")console.log(`
|
|
166
166
|
\uD83D\uDCA1 To run: open "${a.outputPath}"`);else if(l==="linux"&&a.format==="appimage")console.log(`
|
|
167
|
-
\uD83D\uDCA1 To run: chmod +x "${a.outputPath}" && "${a.outputPath}"`)}else console.error(`\u274C Build failed: ${a.error}`),s.exit(1)}catch(o){console.error(`\u274C Build error: ${o.message}`),s.exit(1)}}),y.command("story","Start component showcase and testing server").option("-p, --port <port>","Server port",{default:"6006"}).option("-o, --open","Open browser automatically",{default:!1}).option("--host <host>","Host to bind to",{default:"localhost"}).example("stx story").example("stx story --port 3000 --open").action(async(t)=>{try{let{devCommand:e}=await import("./chunk-
|
|
167
|
+
\uD83D\uDCA1 To run: chmod +x "${a.outputPath}" && "${a.outputPath}"`)}else console.error(`\u274C Build failed: ${a.error}`),s.exit(1)}catch(o){console.error(`\u274C Build error: ${o.message}`),s.exit(1)}}),y.command("story","Start component showcase and testing server").option("-p, --port <port>","Server port",{default:"6006"}).option("-o, --open","Open browser automatically",{default:!1}).option("--host <host>","Host to bind to",{default:"localhost"}).example("stx story").example("stx story --port 3000 --open").action(async(t)=>{try{let{devCommand:e}=await import("./chunk-sjehpstn.js");await e({port:t.port?Number.parseInt(t.port,10):6006,open:t.open,host:t.host})}catch(e){console.error(`\u274C Story error: ${e.message}`),s.exit(1)}}),y.command("story:build","Build static story site").option("-o, --outDir <dir>","Output directory",{default:".stx/dist/story"}).example("stx story:build").example("stx story:build --outDir ./docs/components").action(async(t)=>{try{let{buildCommand:e}=await import("./chunk-18ws9heh.js");await e({outDir:t.outDir})}catch(e){console.error(`\u274C Story build error: ${e.message}`),s.exit(1)}}),y.command("story:test","Run visual regression tests").option("-u, --update","Update snapshots",{default:!1}).option("-f, --filter <name>","Filter components by name").example("stx story:test").example("stx story:test --update").example("stx story:test --filter Button").action(async(t)=>{try{let{createContext:e}=await import("./chunk-n06xznty.js"),{runVisualTests:o,updateSnapshots:i,formatTestResults:n}=await import("./chunk-y3wdf7v7.js"),c=await e({mode:"build"});if(t.update){let r=await i(c,{filter:t.filter?[t.filter]:void 0});console.log(`Updated ${r} snapshots`)}else{let r=await o(c,{filter:t.filter?[t.filter]:void 0});if(console.log(n(r)),r.failed>0)s.exit(1)}}catch(e){console.error(`\u274C Story test error: ${e.message}`),s.exit(1)}}),y.command("native <action> [file]","Compile .stx screens into the JavaScriptCore bundle Craft renders natively").option("--format <format>","bundle (the JavaScriptCore bundle) or ir (the template as JSON)",{default:"ir"}).option("--output <path>","Write to this file instead of stdout").option("--minify","Minify the bundle",{default:!1}).option("--config <file>","Screens config (default: native.config.json in the working directory)").example("stx native compile Screen.stx --format bundle --output native-screen.js").example("stx native compile --format bundle --output native-screen.js --minify").example("stx native compile Screen.stx").action(async(t,e,o)=>{if(t!=="compile")console.error(`Unknown native command: ${t}`),console.error("Usage: stx native compile [file.stx] --format bundle|ir [--output <file>] [--minify] [--config <file>]"),s.exit(1);try{let{runNativeCompile:i}=await import("./chunk-ds66kaac.js"),n=await i(e,{format:o.format,output:o.output,minify:Boolean(o.minify),config:o.config});for(let c of n.diagnostics)console.warn(`${c.level}: ${c.message}`);if(n.written)console.log(`Compiled: ${e??"screens"} \u2192 ${f.relative(s.cwd(),n.written)||n.written}`);else console.log(n.output)}catch(i){console.error(i instanceof Error?i.message:String(i)),s.exit(1)}}),y.command("compile <input>","Compile stx template to native Craft component code").option("--target <platform>","Target platform: macos, windows, linux, ios, android, universal",{default:"universal"}).option("--format <format>","Output format: zig, typescript, json",{default:"zig"}).option("--output <path>","Output directory for compiled files",{default:"./dist"}).option("--optimize","Enable optimizations",{default:!0}).option("--tree-shake","Enable tree shaking",{default:!0}).option("--hot-reload","Enable hot reload support",{default:!1}).option("--sourcemaps","Generate source maps",{default:!1}).option("--bundle","Bundle all dependencies",{default:!0}).option("--minify","Minify output",{default:!1}).option("--verbose","Show detailed output",{default:!1}).example("stx compile app.stx").example("stx compile app.stx --target macos --format zig").example("stx compile app.stx --format typescript --output ./native").example("stx compile app.stx --optimize --tree-shake --minify").action(async(t,e)=>{try{let{compileToNative:o}=await import("./chunk-9j6hk72q.js"),i=f.resolve(t);if(!S.existsSync(i))console.error(`\u274C Input file not found: ${t}`),s.exit(1);let n=["macos","windows","linux","ios","android","universal"];if(!n.includes(e.target))console.error(`\u274C Invalid target: ${e.target}`),console.error(`\uD83D\uDCA1 Available targets: ${n.join(", ")}`),s.exit(1);let c=["zig","typescript","json"];if(!c.includes(e.format))console.error(`\u274C Invalid format: ${e.format}`),console.error(`\uD83D\uDCA1 Available formats: ${c.join(", ")}`),s.exit(1);console.log(`
|
|
168
168
|
\uD83D\uDD27 Compiling stx template to native code...`),console.log(` Input: ${t}`),console.log(` Target: ${e.target}`),console.log(` Format: ${e.format}`),console.log(` Output: ${e.output}
|
|
169
169
|
`);let r=S.readFileSync(i,"utf-8"),l=await o(r,{target:e.target,format:e.format,optimize:e.optimize,treeShake:e.treeShake,hotReload:e.hotReload,debug:e.verbose,sourceMaps:e.sourcemaps,bundle:e.bundle,minify:e.minify}),u=f.resolve(e.output);if(!S.existsSync(u))S.mkdirSync(u,{recursive:!0});let a=f.basename(t,f.extname(t)),m=e.format==="typescript"?"ts":e.format==="json"?"json":"zig",g=f.join(u,`${a}.${m}`);S.writeFileSync(g,l.code);let b=f.join(u,`${a}.manifest.json`);if(S.writeFileSync(b,JSON.stringify(l.manifest,null,2)),e.sourcemaps&&l.sourceMaps){let w=f.join(u,`${a}.${m}.map`);S.writeFileSync(w,l.sourceMaps)}if(e.target==="universal"&&l.platformCode.size>0)for(let[w,k]of l.platformCode){let v=f.join(u,`${a}.${w}.${m}`);S.writeFileSync(v,k)}if(console.log("\u2705 Compilation successful!"),console.log(` Output: ${g}`),console.log(` Manifest: ${b}`),console.log(`
|
|
170
170
|
\uD83D\uDCCA Statistics:`),console.log(` Compilation time: ${l.stats.compilationTime.toFixed(2)}ms`),console.log(` Total components: ${l.stats.totalComponents}`),console.log(` Native components: ${l.stats.nativeComponents}`),console.log(` Web fallback components: ${l.stats.webComponents}`),console.log(` Bundle size: ${(l.stats.bundleSize/1024).toFixed(2)}KB`),l.stats.warnings.length>0){console.log(`
|
|
@@ -1,4 +1,38 @@
|
|
|
1
|
-
export const SIGNALS_COMPONENT_HYDRATION_RUNTIME = `
|
|
1
|
+
export const SIGNALS_COMPONENT_HYDRATION_RUNTIME = ` /*
|
|
2
|
+
* Run a component setup for one clone. The compiled setup finds its root by
|
|
3
|
+
* the template's scope id, so the clone answers to that id while it runs,
|
|
4
|
+
* and the scope it registers is moved to the clone's own id afterwards.
|
|
5
|
+
*/
|
|
6
|
+
function runClonedComponentSetup(setup, root) {
|
|
7
|
+
var scopeId = root.getAttribute('data-stx-scope');
|
|
8
|
+
var originalScopeId = root.getAttribute('data-stx-template-scope') || scopeId;
|
|
9
|
+
if (!scopeId || !originalScopeId) return;
|
|
10
|
+
|
|
11
|
+
root.setAttribute('data-stx-scope', originalScopeId);
|
|
12
|
+
// The setup finds its root by id, which a detached clone cannot answer
|
|
13
|
+
// to: rows a :for builds inside a component's closed :if are set up
|
|
14
|
+
// before the :if puts them in the document, and found nothing, so they
|
|
15
|
+
// never read a prop. Hand the root over (utils.ts reads it).
|
|
16
|
+
var previousSetupRoot = window.__STX_SETUP_ROOT__;
|
|
17
|
+
window.__STX_SETUP_ROOT__ = root;
|
|
18
|
+
try {
|
|
19
|
+
setup();
|
|
20
|
+
var registeredScope = window.stx._scopes && (window.stx._scopes[originalScopeId] || window.stx._scopes[scopeId]);
|
|
21
|
+
if (registeredScope && originalScopeId !== scopeId) {
|
|
22
|
+
delete window.stx._scopes[originalScopeId];
|
|
23
|
+
window.stx._scopes[scopeId] = registeredScope;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch (e) {
|
|
27
|
+
console.error('[stx] cloned component setup error:', e);
|
|
28
|
+
}
|
|
29
|
+
finally {
|
|
30
|
+
window.__STX_SETUP_ROOT__ = previousSetupRoot;
|
|
31
|
+
root.setAttribute('data-stx-scope', scopeId);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function hydrateComponentScopes(nodes, callerScope) {
|
|
2
36
|
var roots = [];
|
|
3
37
|
var scripts = [];
|
|
4
38
|
forEachGroupElement(nodes, function(node, insideTemplateContent) {
|
|
@@ -62,34 +96,7 @@ export const SIGNALS_COMPONENT_HYDRATION_RUNTIME = ` function hydrateComponentS
|
|
|
62
96
|
}
|
|
63
97
|
}
|
|
64
98
|
|
|
65
|
-
pendingRoots.forEach(function(root) {
|
|
66
|
-
var scopeId = root.getAttribute('data-stx-scope');
|
|
67
|
-
var originalScopeId = root.getAttribute('data-stx-template-scope') || scopeId;
|
|
68
|
-
if (!scopeId || !originalScopeId) return;
|
|
69
|
-
|
|
70
|
-
root.setAttribute('data-stx-scope', originalScopeId);
|
|
71
|
-
// The setup finds its root by id, which a detached clone cannot answer
|
|
72
|
-
// to: rows a :for builds inside a component's closed :if are set up
|
|
73
|
-
// before the :if puts them in the document, and found nothing, so they
|
|
74
|
-
// never read a prop. Hand the root over (utils.ts reads it).
|
|
75
|
-
var previousSetupRoot = window.__STX_SETUP_ROOT__;
|
|
76
|
-
window.__STX_SETUP_ROOT__ = root;
|
|
77
|
-
try {
|
|
78
|
-
setup();
|
|
79
|
-
var registeredScope = window.stx._scopes && (window.stx._scopes[originalScopeId] || window.stx._scopes[scopeId]);
|
|
80
|
-
if (registeredScope && originalScopeId !== scopeId) {
|
|
81
|
-
delete window.stx._scopes[originalScopeId];
|
|
82
|
-
window.stx._scopes[scopeId] = registeredScope;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
catch (e) {
|
|
86
|
-
console.error('[stx] cloned component setup error:', e);
|
|
87
|
-
}
|
|
88
|
-
finally {
|
|
89
|
-
window.__STX_SETUP_ROOT__ = previousSetupRoot;
|
|
90
|
-
root.setAttribute('data-stx-scope', scopeId);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
99
|
+
pendingRoots.forEach(function(root) { runClonedComponentSetup(setup, root); });
|
|
93
100
|
|
|
94
101
|
// A component that is itself a structural source still needs its setup
|
|
95
102
|
// sibling when bindFor/bindIf turns that source into a clone template.
|
|
@@ -105,6 +112,27 @@ export const SIGNALS_COMPONENT_HYDRATION_RUNTIME = ` function hydrateComponentS
|
|
|
105
112
|
if (!isStructuralSource && old.parentNode) old.parentNode.removeChild(old);
|
|
106
113
|
});
|
|
107
114
|
|
|
115
|
+
/*
|
|
116
|
+
* A host with no script elements. A native screen's setup scripts are
|
|
117
|
+
* compiled out of the tree, so a clone a :for or :if builds carries none
|
|
118
|
+
* to copy, and every row after the template rendered with no scope at
|
|
119
|
+
* all: no props, no state, no handlers. The native bundle registers each
|
|
120
|
+
* component's setup by its compiled scope id instead, and a clone is set
|
|
121
|
+
* up from that the same way a cloned script would set it up here.
|
|
122
|
+
*/
|
|
123
|
+
var registeredSetups = window.__stx_componentSetups;
|
|
124
|
+
if (registeredSetups) {
|
|
125
|
+
roots.forEach(function(root) {
|
|
126
|
+
// A :for clone carries a remapped id beside the template's; an :if
|
|
127
|
+
// clone keeps the template's id, whose scope the source reclaimed.
|
|
128
|
+
var scopeId = root.getAttribute('data-stx-scope');
|
|
129
|
+
var originalScopeId = root.getAttribute('data-stx-template-scope') || scopeId;
|
|
130
|
+
if (!scopeId || hasPendingStructuralAncestor(root) || (window.stx._scopes && window.stx._scopes[scopeId])) return;
|
|
131
|
+
var setup = registeredSetups[originalScopeId];
|
|
132
|
+
if (typeof setup === 'function') runClonedComponentSetup(setup, root);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
108
136
|
roots.forEach(function(root) {
|
|
109
137
|
// Still inside a conditional or loop this walk has not bound: the
|
|
110
138
|
// directive decides whether the component is on the page at all, and
|
package/dist/craft-entry.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{rs,qo,Go}from"./chunk-9nt3q23a.js";import"./chunk-
|
|
2
|
+
import{rs,qo,Go}from"./chunk-9nt3q23a.js";import"./chunk-38mt83wa.js";import"./chunk-v8ze2q95.js";import"./chunk-a7crvy3b.js";import"./chunk-b3c1gggs.js";import"./chunk-jtq8e3b0.js";import"./chunk-6qnemg0e.js";import"./chunk-gh181dnr.js";import"./chunk-qf39z0hg.js";import"./chunk-48s1nprc.js";import"./chunk-9e49fnj9.js";import"./chunk-82bttwqm.js";import"./chunk-k71e38fk.js";import"./chunk-y0qjpcc8.js";import{Lu,Bo,ju,Bu,Fo,ns,zo,Fu,Ho,zu,Hu,Vo,Uo,Wo}from"./chunk-hhcmn37g.js";import"./chunk-g7fjra7a.js";import"./chunk-t19th11m.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
|
|
3
3
|
`),scripts:t.scripts.join(`
|
|
4
4
|
`),metadata:{renderTime:0,cacheHit:!0,totalSize:c.html.length,componentCount:t.metadata.componentCount}}}let a;if(n.streaming)a=await H(t.tree,e);else a=h(t.tree,e);let i;if(n.hydrate){let o=j(a,t,e);a=o.html,i=o.data}if(n.minify)a=D(a);if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`;d.set(o,{html:a,timestamp:Date.now()})}let s=performance.now()-r;return{html:a,styles:t.styles.join(`
|
|
5
5
|
`),scripts:t.scripts.join(`
|
package/dist/craft.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{rs,qo,Go}from"./chunk-9nt3q23a.js";import"./chunk-
|
|
2
|
+
import{rs,qo,Go}from"./chunk-9nt3q23a.js";import"./chunk-38mt83wa.js";import"./chunk-v8ze2q95.js";import"./chunk-a7crvy3b.js";import"./chunk-b3c1gggs.js";import"./chunk-jtq8e3b0.js";import"./chunk-6qnemg0e.js";import"./chunk-gh181dnr.js";import"./chunk-qf39z0hg.js";import"./chunk-48s1nprc.js";import"./chunk-9e49fnj9.js";import"./chunk-82bttwqm.js";import"./chunk-k71e38fk.js";import"./chunk-y0qjpcc8.js";import{Lu,Bo,ju,Bu,Fo,ns,zo,Fu,Ho,zu,Hu,Vo,Uo,Wo}from"./chunk-hhcmn37g.js";import"./chunk-g7fjra7a.js";import"./chunk-t19th11m.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
|
|
3
3
|
`),scripts:t.scripts.join(`
|
|
4
4
|
`),metadata:{renderTime:0,cacheHit:!0,totalSize:c.html.length,componentCount:t.metadata.componentCount}}}let a;if(n.streaming)a=await H(t.tree,e);else a=h(t.tree,e);let i;if(n.hydrate){let o=j(a,t,e);a=o.html,i=o.data}if(n.minify)a=D(a);if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`;d.set(o,{html:a,timestamp:Date.now()})}let s=performance.now()-r;return{html:a,styles:t.styles.join(`
|
|
5
5
|
`),scripts:t.scripts.join(`
|
|
@@ -19,7 +19,7 @@ function stampEngine(file) {
|
|
|
19
19
|
let cssLoadAttempted = !1, cachedConfig = null, cachedCSS = "", isBuilding = !1;
|
|
20
20
|
const MAX_CACHE = 256, cssByClassSet = new Map, serveCssByHash = new Map;
|
|
21
21
|
let diskCacheRoot = null, configFingerprint = null;
|
|
22
|
-
const configByRoot = new Map;
|
|
22
|
+
const configByRoot = new Map, warnedRoleRoots = new Set;
|
|
23
23
|
function shortHash(input) {
|
|
24
24
|
return Bun.hash(input).toString(16).padStart(16, "0").slice(0, 16);
|
|
25
25
|
}
|
|
@@ -398,7 +398,12 @@ async function generateCssUncached(htmlContent, appDir) {
|
|
|
398
398
|
setLruCache(cacheKey, onDisk);
|
|
399
399
|
return onDisk;
|
|
400
400
|
}
|
|
401
|
-
const baseConfig = hw.defaultConfig || hw.config, userConfig = rootConfig.config || {}, merged = mergeCssConfig(baseConfig, userConfig), { safelist, includePreflight, minify, tokenCSS } = merged
|
|
401
|
+
const baseConfig = hw.defaultConfig || hw.config, userConfig = rootConfig.config || {}, merged = mergeCssConfig(baseConfig, userConfig), { safelist, includePreflight, minify, tokenCSS } = merged;
|
|
402
|
+
if (merged.unknownRoles.length > 0 && !warnedRoleRoots.has(resolveRoot)) {
|
|
403
|
+
warnedRoleRoots.add(resolveRoot);
|
|
404
|
+
console.warn(`${colors.yellow}[ts-css]${colors.reset} No stx role for ${merged.unknownRoles.join(", ")} - these keep the stock value. Role names: semanticTokenNames() in @stacksjs/stx/theme-tokens.`);
|
|
405
|
+
}
|
|
406
|
+
const cssConfig = merged.config, generator = new hw.CSSGenerator(cssConfig), shortcuts = cssConfig.shortcuts || userConfig.shortcuts || {}, usedShortcuts = Object.keys(shortcuts).filter((name) => classes.has(name) || safelist.includes(name));
|
|
402
407
|
for (const cls of safelist)
|
|
403
408
|
if (!shortcuts[cls])
|
|
404
409
|
generator.generate(cls);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** The answered roles as `:root` and `.dark` declarations, from a css config. */
|
|
2
|
+
export declare function nativeThemeCSS(config: Record<string, any>): string;
|
|
3
|
+
/**
|
|
4
|
+
* The role block for the app at `root`, or `''` when its css config answers
|
|
5
|
+
* no role. Read once per root per process.
|
|
6
|
+
*/
|
|
7
|
+
export declare function appThemeCSS(root: string): Promise<string>;
|
|
8
|
+
/** Forget what was read, for a test or a config edit in a long-lived process. */
|
|
9
|
+
export declare function resetAppThemeCSS(): void;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { DENSITY_TOKENS, densityVariable, SEMANTIC_TOKENS, SHAPE_TOKENS, shapeVariable, tokenVariable } from "../../theme-tokens.js";
|
|
3
|
+
import { nativePaletteColor } from "./headwind-to-style.js";
|
|
4
|
+
const byRoot = new Map;
|
|
5
|
+
function nativeColor(reference, appColors) {
|
|
6
|
+
if (!reference)
|
|
7
|
+
return;
|
|
8
|
+
const value = reference.trim(), split = value.lastIndexOf("-"), family = split === -1 ? appColors[value] : appColors[value.slice(0, split)], own = split === -1 ? family : family?.[value.slice(split + 1)];
|
|
9
|
+
if (typeof own === "string" && /^#[\da-f]{3,8}$/i.test(own))
|
|
10
|
+
return own;
|
|
11
|
+
return nativePaletteColor(value) ?? nativePaletteColor(`[${value}]`);
|
|
12
|
+
}
|
|
13
|
+
export function nativeThemeCSS(config) {
|
|
14
|
+
const roles = config.roles ?? {}, shapes = config.shapes ?? {}, density = config.density ?? {}, appColors = { ...config.theme?.colors, ...config.theme?.extend?.colors }, light = [], dark = [];
|
|
15
|
+
for (const [name, answer] of Object.entries(roles)) {
|
|
16
|
+
if (!SEMANTIC_TOKENS[name])
|
|
17
|
+
continue;
|
|
18
|
+
const lightValue = nativeColor(typeof answer === "string" ? answer : answer?.light, appColors), darkValue = nativeColor(typeof answer === "string" ? answer : answer?.dark, appColors);
|
|
19
|
+
if (lightValue)
|
|
20
|
+
light.push(`${tokenVariable(name)}: ${lightValue};`);
|
|
21
|
+
if (darkValue)
|
|
22
|
+
dark.push(`${tokenVariable(name)}: ${darkValue};`);
|
|
23
|
+
}
|
|
24
|
+
for (const [name, value] of Object.entries(shapes))
|
|
25
|
+
if (SHAPE_TOKENS[name])
|
|
26
|
+
light.push(`${shapeVariable(name)}: ${value};`);
|
|
27
|
+
for (const [name, value] of Object.entries(density))
|
|
28
|
+
if (DENSITY_TOKENS[name])
|
|
29
|
+
light.push(`${densityVariable(name)}: ${value};`);
|
|
30
|
+
return [
|
|
31
|
+
light.length ? `:root { ${light.join(" ")} }` : "",
|
|
32
|
+
dark.length ? `.dark { ${dark.join(" ")} }` : ""
|
|
33
|
+
].filter(Boolean).join(`
|
|
34
|
+
`);
|
|
35
|
+
}
|
|
36
|
+
async function load(root) {
|
|
37
|
+
const { resolveUserCssConfig } = await import("../../dev-server/ts-css.js"), user = await resolveUserCssConfig(root);
|
|
38
|
+
return user ? nativeThemeCSS(user) : "";
|
|
39
|
+
}
|
|
40
|
+
export function appThemeCSS(root) {
|
|
41
|
+
const key = path.resolve(root);
|
|
42
|
+
let pending = byRoot.get(key);
|
|
43
|
+
if (!pending) {
|
|
44
|
+
pending = load(key).catch(() => "");
|
|
45
|
+
byRoot.set(key, pending);
|
|
46
|
+
}
|
|
47
|
+
return pending;
|
|
48
|
+
}
|
|
49
|
+
export function resetAppThemeCSS() {
|
|
50
|
+
byRoot.clear();
|
|
51
|
+
}
|
|
@@ -150,10 +150,14 @@ var isApp = false;`, selections = bundled.map(({ name, compiled }, index) => `${
|
|
|
150
150
|
}`).join(`
|
|
151
151
|
`), setups = bundled.map(({ name, compiled }, index) => `${index === 0 ? "if" : "else if"} (routeName === ${JSON.stringify(routed ? name : "main")}) {
|
|
152
152
|
g.__stx_latestSetup = null;
|
|
153
|
-
${compiled.scripts.map((script) => script.owner ? ` g.
|
|
154
|
-
|
|
153
|
+
${compiled.scripts.map((script) => script.owner ? ` g.__stx_componentSetups = g.__stx_componentSetups || {};
|
|
154
|
+
// Kept by id as well as run once: a :for or :if clone of this component
|
|
155
|
+
// has no script to copy, and is set up from this (component hydration).
|
|
156
|
+
g.__stx_componentSetups[${JSON.stringify(script.owner)}] = function() {
|
|
155
157
|
${script.code}
|
|
156
|
-
}
|
|
158
|
+
};
|
|
159
|
+
g.__STX_SETUP_ROOT__ = screen && screen.scopeRoot(${JSON.stringify(script.owner)});
|
|
160
|
+
try { g.__stx_componentSetups[${JSON.stringify(script.owner)}](); }
|
|
157
161
|
finally { g.__STX_SETUP_ROOT__ = null; }` : script.code).join(`
|
|
158
162
|
`)}
|
|
159
163
|
}`).join(`
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { NativeStyleVariables } from './style-variables';
|
|
2
2
|
import type { STXStyle } from './ir';
|
|
3
|
+
/**
|
|
4
|
+
* A palette reference (`emerald-600`, `white`) or a bracketed colour as the
|
|
5
|
+
* hex a native host reads, or undefined. The web palette is oklch, which
|
|
6
|
+
* neither host parses, so an app's role answers resolve here for a phone.
|
|
7
|
+
*/
|
|
8
|
+
export declare function nativePaletteColor(reference: string): string | undefined;
|
|
3
9
|
/**
|
|
4
10
|
* The class list as styles, with `dark:` variants kept apart.
|
|
5
11
|
*
|
|
@@ -380,6 +380,9 @@ function resolveColor(colorClass) {
|
|
|
380
380
|
}
|
|
381
381
|
return;
|
|
382
382
|
}
|
|
383
|
+
export function nativePaletteColor(reference) {
|
|
384
|
+
return resolveColor(reference.trim());
|
|
385
|
+
}
|
|
383
386
|
function withAlpha(color, alpha) {
|
|
384
387
|
if (color === "transparent")
|
|
385
388
|
return color;
|
|
@@ -634,6 +637,10 @@ const classParsers = {
|
|
|
634
637
|
style.overflow = "scroll";
|
|
635
638
|
return !0;
|
|
636
639
|
},
|
|
640
|
+
"overflow-x-auto": () => !0,
|
|
641
|
+
"overflow-x-scroll": () => !0,
|
|
642
|
+
"overflow-y-auto": () => !0,
|
|
643
|
+
"overflow-y-scroll": () => !0,
|
|
637
644
|
"font-thin": (_, style) => {
|
|
638
645
|
style.fontWeight = "100";
|
|
639
646
|
return !0;
|
|
@@ -197,7 +197,7 @@ function settle(frame, diagnostics) {
|
|
|
197
197
|
return node;
|
|
198
198
|
}
|
|
199
199
|
if (node.type === "Text" && elements.length > 0) {
|
|
200
|
-
if (elements.some((child) => child.type !== "Text")) {
|
|
200
|
+
if (/(?:^|\s)(?:inline-)?(?:flex|grid)(?:\s|$)/.test(node._classes ?? "") || elements.some((child) => child.type !== "Text")) {
|
|
201
201
|
node.type = "View";
|
|
202
202
|
node.children = node.children.map((child) => typeof child === "string" ? createNode("Text", {}, {}, {}, [child]) : child);
|
|
203
203
|
return node;
|
|
@@ -292,6 +292,12 @@ export async function translateHtmlToIR(html, options = {}) {
|
|
|
292
292
|
seenUnmapped.add(`drop:${tag}`);
|
|
293
293
|
diagnostics.push({ kind: "dropped-subtree", tag });
|
|
294
294
|
}
|
|
295
|
+
if (type === "View" && /(?:^|\s)overflow-x-(?:auto|scroll)(?:\s|$)/.test(classes)) {
|
|
296
|
+
type = "ScrollView";
|
|
297
|
+
props.horizontal = !0;
|
|
298
|
+
props.showsHorizontalScrollIndicator ??= !1;
|
|
299
|
+
} else if (type === "View" && /(?:^|\s)overflow-y-(?:auto|scroll)(?:\s|$)/.test(classes))
|
|
300
|
+
type = "ScrollView";
|
|
295
301
|
if (tag === "form")
|
|
296
302
|
props["data-stx-form"] = !0;
|
|
297
303
|
if (tag === "button" && props.type === void 0)
|
|
@@ -4,6 +4,7 @@ import { loadStxConfig } from "../../config.js";
|
|
|
4
4
|
import { extractBindingManifest } from "../../binding-manifest.js";
|
|
5
5
|
import { processDirectives } from "../../process.js";
|
|
6
6
|
import { processScriptSetup } from "../../signal-processing.js";
|
|
7
|
+
import { appThemeCSS } from "./app-theme.js";
|
|
7
8
|
import { translateHtmlToDocument } from "./html-to-ir.js";
|
|
8
9
|
import { extractClientScript } from "./client-script.js";
|
|
9
10
|
import { extractGeneratedSetupScript, extractNativeClientScripts } from "./setup-script.js";
|
|
@@ -27,7 +28,7 @@ export async function compileScreenSource(source, filePath, options = {}) {
|
|
|
27
28
|
_targetComponentFallbackNames: ["Button"],
|
|
28
29
|
_nativeHostAttrs: !0,
|
|
29
30
|
_pluginComponentDirs: loaded._pluginComponentDirs ?? []
|
|
30
|
-
}, context = { ...options.context ?? {}, __stx_inject_css: !1 }, dependencies = new Set([filePath]), renderedHtml = await processDirectives(source, context, filePath, config, dependencies), { html, manifest } = extractBindingManifest(renderedHtml), { document, diagnostics } = await translateHtmlToDocument(html, {
|
|
31
|
+
}, context = { ...options.context ?? {}, __stx_inject_css: !1 }, dependencies = new Set([filePath]), renderedHtml = await processDirectives(source, context, filePath, config, dependencies), { html, manifest } = extractBindingManifest(renderedHtml), theme = await appThemeCSS(root), { document, diagnostics } = await translateHtmlToDocument(theme ? `<style>${theme}</style>${html}` : html, {
|
|
31
32
|
source: filePath,
|
|
32
33
|
script: extractClientScript(source)
|
|
33
34
|
});
|
|
@@ -97,7 +97,7 @@ export function installCraftBridge(protocol, nativeBridge, target = globalThis,
|
|
|
97
97
|
leftButtons: new Map,
|
|
98
98
|
rightButtons: new Map
|
|
99
99
|
}, appearHandlers = new Set, disappearHandlers = new Set;
|
|
100
|
-
let focused = !
|
|
100
|
+
let focused = target.__stxNativeFocused !== !1;
|
|
101
101
|
const routeName = options.routeName || "main", routeNames = options.routeNames || [routeName];
|
|
102
102
|
craft.platform = nativeBridge.platform || "unknown";
|
|
103
103
|
const navigatorObject = target.navigator || (target.navigator = {});
|