knarr 0.0.1

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.
Files changed (69) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +163 -0
  3. package/dist/add-ODK52RZI.mjs +3 -0
  4. package/dist/bell-YD6IWNXO.mjs +2 -0
  5. package/dist/check-YVEJEI2G.mjs +6 -0
  6. package/dist/chokidar-LVDD2IK4.mjs +4 -0
  7. package/dist/chunk-23HXXAGG.mjs +5 -0
  8. package/dist/chunk-2EZDTBUU.mjs +3 -0
  9. package/dist/chunk-2GDRDQA5.mjs +3 -0
  10. package/dist/chunk-2QPLXLJW.mjs +3 -0
  11. package/dist/chunk-2VCW5RWI.mjs +3 -0
  12. package/dist/chunk-3KNUBUPH.mjs +3 -0
  13. package/dist/chunk-7DZPDPP6.mjs +3 -0
  14. package/dist/chunk-7HVPEBK5.mjs +7 -0
  15. package/dist/chunk-7JG555TZ.mjs +3 -0
  16. package/dist/chunk-B3DZ5HVQ.mjs +3 -0
  17. package/dist/chunk-BS4VKVYH.mjs +3 -0
  18. package/dist/chunk-FU7FCNTW.mjs +3 -0
  19. package/dist/chunk-FUINO5RD.mjs +3 -0
  20. package/dist/chunk-HQ7NKBQW.mjs +4 -0
  21. package/dist/chunk-IM555H3S.mjs +4 -0
  22. package/dist/chunk-KXLQGVT2.mjs +13 -0
  23. package/dist/chunk-MBKCCWSD.mjs +3 -0
  24. package/dist/chunk-NBSJGM2X.mjs +3 -0
  25. package/dist/chunk-OLUZ7T7G.mjs +3 -0
  26. package/dist/chunk-OXI2KGCW.mjs +14 -0
  27. package/dist/chunk-SFLWVTJC.mjs +3 -0
  28. package/dist/chunk-SYADAYF4.mjs +3 -0
  29. package/dist/chunk-TEFMLGCB.mjs +3 -0
  30. package/dist/chunk-U5ZZAYNU.mjs +13 -0
  31. package/dist/chunk-V2ED74ZQ.mjs +3 -0
  32. package/dist/chunk-XQPVRRTN.mjs +3 -0
  33. package/dist/chunk-XQVMCMO7.mjs +7 -0
  34. package/dist/chunk-YZCBBQCH.mjs +19 -0
  35. package/dist/chunk-Z22BYXWQ.mjs +3 -0
  36. package/dist/clean-XMLDIZDZ.mjs +3 -0
  37. package/dist/cli.mjs +10 -0
  38. package/dist/dev-7L35BV6M.mjs +3 -0
  39. package/dist/doctor-4TTAYNGW.mjs +4 -0
  40. package/dist/fs-35635IS7.mjs +2 -0
  41. package/dist/history-XUZSDCNE.mjs +2 -0
  42. package/dist/index.d.ts +434 -0
  43. package/dist/index.mjs +3530 -0
  44. package/dist/init-OBJFQ6OB.mjs +7 -0
  45. package/dist/list-AQKUBZ2I.mjs +5 -0
  46. package/dist/migrate-7B7ACQHY.mjs +8 -0
  47. package/dist/preflight-TVJFHRI2.mjs +2 -0
  48. package/dist/publish-Q4JYQPQP.mjs +3 -0
  49. package/dist/push-NHCPN6MO.mjs +3 -0
  50. package/dist/remove-PDERBH66.mjs +2 -0
  51. package/dist/reset-3FXWAAPQ.mjs +3 -0
  52. package/dist/restore-YGPO42W4.mjs +11 -0
  53. package/dist/rollback-FKNGLGFC.mjs +3 -0
  54. package/dist/status-3VUPPR5D.mjs +4 -0
  55. package/dist/tailwind-source-ND5FE6PQ.mjs +5 -0
  56. package/dist/topo-sort-WEIVPJKN.mjs +2 -0
  57. package/dist/tracker-R4ZZIDJV.mjs +2 -0
  58. package/dist/update-QPBWYDSG.mjs +3 -0
  59. package/dist/use-NKLXGPIZ.mjs +3 -0
  60. package/dist/vite-config-URP2SYRQ.mjs +2 -0
  61. package/dist/vite-plugin.d.ts +5 -0
  62. package/dist/vite-plugin.mjs +215 -0
  63. package/dist/watch-orchestrator-F6S5WQQX.mjs +3 -0
  64. package/dist/watcher-PTPUN2HE.mjs +3 -0
  65. package/dist/webpack-plugin.d.ts +47 -0
  66. package/dist/webpack-plugin.mjs +143 -0
  67. package/dist/workspace-L5CGPK7U.mjs +2 -0
  68. package/dist/xxhash-wasm-DTW44IIQ.mjs +3 -0
  69. package/package.json +126 -0
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import {createRequire}from'node:module';import {a as a$2}from'./chunk-7JG555TZ.mjs';import {a as a$5,b as b$2}from'./chunk-KXLQGVT2.mjs';import {a as a$4,d}from'./chunk-HQ7NKBQW.mjs';import {a as a$3}from'./chunk-MBKCCWSD.mjs';import {b as b$1,a as a$7}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import {a as a$6,c as c$1}from'./chunk-OLUZ7T7G.mjs';import'./chunk-Z22BYXWQ.mjs';import {A,y,r as r$1}from'./chunk-23HXXAGG.mjs';import {b as b$3}from'./chunk-NBSJGM2X.mjs';import {a,b}from'./chunk-B3DZ5HVQ.mjs';import {c,a as a$1}from'./chunk-2VCW5RWI.mjs';import {join,resolve,basename}from'path';import {readFile,writeFile}from'fs/promises';globalThis.require=createRequire(import.meta.url);
3
+ var r=c(a(),1);var ae={meta:{name:"init",description:"Set up knarr in the current project"},args:{yes:{type:"boolean",alias:"y",description:"Skip confirmation prompts",default:false},role:{type:"string",description:'Project role: "consumer" or "library"'}},async run({args:o}){b$1();let n=new a$3,i=resolve("."),p=o.yes;b.info(`Initializing knarr in ${r.default.cyan(i)}
4
+ `);let a=await a$4(i),u={pnpm:"pnpm-lock.yaml",bun:"bun.lockb",yarn:"yarn.lock",npm:"package-lock.json"};b.success(`Detected package manager: ${r.default.cyan(a)}`+(u[a]?` (from ${u[a]})`:""));let l=a;if(!p&&await b.prompt(`Use ${a}?`,{type:"confirm",initial:true})===false){let c=["npm","pnpm","yarn","bun"].filter(f=>f!==a),d=await b.prompt("Select package manager:",{type:"select",options:c.map(f=>({label:f,value:f}))});typeof d=="string"&&(l=d);}let s="consumer";o.role==="consumer"||o.role==="library"?s=o.role:p||await b.prompt("How will you use knarr in this project?",{type:"select",options:[{label:"Consumer (app) - I want to link packages INTO this project",value:"consumer"},{label:"Library (package) - I want to publish this package FOR other projects",value:"library"}]})==="library"&&(s="library"),b.success(`Project role: ${r.default.cyan(s)}`);let B=join(i,".gitignore");await a$5(B)&&b.success("Added .knarr/ to .gitignore");let m=join(i,"package.json");if(await A(m))if(s==="consumer"){if(await b$2(m)&&b.success('Added "postinstall": "knarr restore" to package.json scripts'),!p){let c=await b.prompt("Package name to link (leave blank to skip):",{type:"text",default:""});if(typeof c=="string"&&c.trim()){let d=c.trim();await $(m,"knarr:add",`knarr add ${d}`)&&b.success(`Added "knarr:add": "knarr add ${d}" to package.json scripts`);}}}else {await H(m,l,p);let t=await L(m);for(let c of t)b.success(`Added "${c}" script to package.json`);}let y$1=join(i,".knarr");if(!await A(y$1))await y(y$1),await writeFile(join(y$1,"state.json"),JSON.stringify({version:"1",packageManager:l,role:s,links:{}},null,2)),b.success("Created .knarr/ state directory");else {let t=await a$6(i);t.packageManager=l,t.role=s,await c$1(i,t);}if(s==="consumer"){let t=await d(i);if(t.type==="vite"&&t.configFile){b.success(`Detected bundler: ${r.default.cyan("Vite")} (${basename(t.configFile)})`);let{addKnarrVitePlugin:c}=await import('./vite-config-URP2SYRQ.mjs'),d=await c(t.configFile);d.modified?b.success(`Added knarr plugin to ${basename(t.configFile)}`):d.error&&b.info(`Add the Vite plugin for automatic dev server restarts:
5
+ ${r.default.cyan('import knarr from "knarr/vite"')}
6
+ ${r.default.cyan("plugins: [knarr()]")}`);}else if(t.type==="next"&&t.configFile)b.success(`Detected bundler: ${r.default.cyan("Next.js")} (${basename(t.configFile)})`),b.info(`Next.js transpilePackages will be auto-configured when you run ${r.default.cyan("knarr add")}`);else if(t.type){let c={webpack:"Webpack",turbo:"Turbopack",rollup:"Rollup"};b.success(`Detected bundler: ${r.default.cyan(c[t.type]||t.type)} - no config needed, works out of the box`);}b.log(""),b.info(`${r.default.bold("Next steps:")}`),b.log(` 1. ${r.default.cyan("knarr use ../my-lib")} <- publish + link a local package`),b.log(` 2. ${r.default.cyan("cd ../my-lib && knarr dev")} <- watch + rebuild + auto-push`);}else b.log(""),b.info(`${r.default.bold("Next steps:")}`),b.log(` 1. ${r.default.cyan("knarr publish")} <- copy built files to knarr store`),b.log(` 2. ${r.default.cyan(`${l} run knarr:dev`)} <- watch + rebuild + auto-push to consumers`),b.log(` 3. In consumer project: ${r.default.cyan("knarr use "+i)}`);b.info(`Done in ${n.elapsed()}`),a$7({packageManager:l,role:s,elapsed:n.elapsedMs()}),b$3()&&r$1();}};async function $(o,n,i){let p=await readFile(o,"utf-8"),a=JSON.parse(p);if(a.scripts?.[n])return false;a.scripts||(a.scripts={}),a.scripts[n]=i;let u=p.match(/^(\s+)"/m)?.[1]||" ";return await writeFile(o,JSON.stringify(a,null,u)+`
7
+ `),true}a$1($,"addScript");async function H(o,n,i){let p=join(o,".."),a=await a$2(p,n);if(a)return b.success(`Detected build script: ${r.default.cyan(a)}`),a;let u=n==="npm"?"npm run ":`${n} `;if(!i){b.warn("No build script found in package.json");let s=await b.prompt("Build command (e.g. tsc, tsup, rollup -c):",{type:"text",default:""});if(typeof s=="string"&&s.trim())return s.trim()}let l=`${u}build`;return b.warn(`Using ${r.default.cyan(l)} as placeholder - add a "build" script to package.json`),l}a$1(H,"detectBuildCommand");async function L(o){let n=[];return await $(o,"knarr:publish","knarr publish")&&n.push("knarr:publish"),await $(o,"knarr:dev","knarr dev")&&n.push("knarr:dev"),n}a$1(L,"addLibraryScripts");export{ae as default};
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import {createRequire}from'node:module';import {a as a$4}from'./chunk-2GDRDQA5.mjs';import {b as b$1,d}from'./chunk-V2ED74ZQ.mjs';import {a as a$3,b as b$3}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import {a as a$2,g}from'./chunk-OLUZ7T7G.mjs';import'./chunk-Z22BYXWQ.mjs';import {b as b$2}from'./chunk-2QPLXLJW.mjs';import {o,C}from'./chunk-23HXXAGG.mjs';import'./chunk-NBSJGM2X.mjs';import {a,b}from'./chunk-B3DZ5HVQ.mjs';import {c,a as a$1}from'./chunk-2VCW5RWI.mjs';import {resolve}from'path';globalThis.require=createRequire(import.meta.url);
3
+ var s=c(a(),1);var q={meta:{name:"list",description:"List linked packages in current project or in the store"},args:{store:{type:"boolean",description:"List all packages in the global Knarr store",default:false},history:{type:"boolean",description:"Show build history for linked packages",default:false}},async run({args:n}){b$3(),n.store?await D():n.history?await L():await T();}};async function T(){let n=await a$2(resolve(".")),l=Object.entries(n.links);if(l.length===0){b.info("No linked packages in this project"),a$3({packages:[]});return}b.info(`Linked packages (${l.length}):
4
+ `);let c=o(8),r=await Promise.all(l.map(([e,i])=>c(async()=>{let t=await b$1(e,i.version),o=!!(t&&t.meta.contentHash!==i.contentHash);return {name:e,version:i.version,buildId:i.buildId??null,stale:o,sourcePath:i.sourcePath}})));for(let e of r){let i=e.buildId?`[${e.buildId}]`:"[--------]",t=e.stale?s.default.yellow(" (stale)"):"";b.log(` ${s.default.cyan(e.name)} ${s.default.dim("@"+e.version)} ${s.default.dim(i)}${t} \u2190 ${s.default.dim(e.sourcePath)}`);}a$3({packages:r});}a$1(T,"listProject");async function D(){let[n,l]=await Promise.all([d(),g()]);if(n.length===0){b.info("Knarr store is empty"),a$3({entries:[],totalSize:0});return}let c=o(8),r=await Promise.all(n.map(t=>c(()=>C(t.packageDir)))),e=r.reduce((t,o)=>t+o,0);b.info(`Store entries (${n.length}, ${a$4(e)} total):
5
+ `);let i=[];for(let t=0;t<n.length;t++){let o=n[t],g=r[t],H=P(new Date(o.meta.publishedAt)),S=o.meta.buildId?`[${o.meta.buildId}]`:"[--------]",u=l[o.name]?.length??0,j=u>0?s.default.green(`${u} consumer${u>1?"s":""}`):s.default.dim("no consumers");b.log(` ${s.default.cyan(o.name)} ${s.default.dim("@"+o.version)} ${s.default.dim(S)} ${s.default.dim(a$4(g))} ${s.default.dim(`published ${H}`)} ${j}`),b.log(` ${s.default.dim(`from: ${o.meta.sourcePath}`)}`),i.push({name:o.name,version:o.version,buildId:o.meta.buildId??null,publishedAt:o.meta.publishedAt,sourcePath:o.meta.sourcePath,consumers:u,size:g});}a$3({entries:i,totalSize:e});}a$1(D,"listStore");async function L(){let n=await a$2(resolve(".")),l=Object.entries(n.links);if(l.length===0){b.info("No linked packages in this project"),a$3({packages:[]});return}let c={};for(let[r,e]of l){let i=await b$2(r,e.version);b.info(`${s.default.cyan(r)} ${s.default.dim("@"+e.version)} \u2014 ${i.length} historical build(s)`);for(let t of i){let o=P(new Date(t.publishedAt));b.log(` ${s.default.dim(t.buildId)} ${s.default.dim(`published ${o}`)}`);}c[r]=i.map(t=>({buildId:t.buildId,publishedAt:t.publishedAt,contentHash:t.contentHash}));}a$3({history:c});}a$1(L,"listHistory");function P(n){let l=Date.now()-n.getTime(),c=Math.floor(l/1e3);if(c<60)return `${c}s ago`;let r=Math.floor(c/60);if(r<60)return `${r}m ago`;let e=Math.floor(r/60);return e<24?`${e}h ago`:`${Math.floor(e/24)}d ago`}a$1(P,"getRelativeTime");export{q as default};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import {createRequire}from'node:module';import {a as a$1}from'./chunk-MBKCCWSD.mjs';import {b,a as a$2}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import {A}from'./chunk-23HXXAGG.mjs';import'./chunk-NBSJGM2X.mjs';import {a,b as b$1}from'./chunk-B3DZ5HVQ.mjs';import {c}from'./chunk-2VCW5RWI.mjs';import {resolve,join}from'path';import {readFile,writeFile,rm}from'fs/promises';globalThis.require=createRequire(import.meta.url);
3
+ var o=c(a(),1);var E={meta:{name:"migrate",description:"Migrate from yalc to Knarr"},args:{yes:{type:"boolean",alias:"y",description:"Skip confirmation prompts",default:false}},async run({args:Y}){b();let y=new a$1,i=resolve(".");b$1.info(`Checking for yalc usage...
4
+ `);let u=join(i,".yalc"),s=join(i,"yalc.lock"),l=join(i,"package.json"),k=await A(u),f=await A(s);if(!k&&!f){b$1.info("No yalc usage detected in this project."),a$2({migrated:false,packages:[]});return}if(!Y.yes){let a=await b$1.prompt("Migrate from yalc to Knarr? This will modify package.json and remove .yalc/ and yalc.lock.",{type:"confirm"});if(!a||typeof a=="symbol"){b$1.info("Cancelled");return}}let t=[];if(f)try{let a=await readFile(s,"utf-8"),n=JSON.parse(a);n.packages&&(t.push(...Object.keys(n.packages)),b$1.info(`Found ${t.length} yalc-linked package(s): ${t.map(r=>o.default.cyan(r)).join(", ")}`));}catch{b$1.warn("Could not parse yalc.lock \u2014 the file may be corrupted. Continuing with cleanup.");}if(await A(l))try{let a=await readFile(l,"utf-8"),n=JSON.parse(a),r=!1;for(let p of ["dependencies","devDependencies","peerDependencies"]){let m=n[p];if(m)for(let[h,w]of Object.entries(m))typeof w=="string"&&w.includes(".yalc/")&&(delete m[h],r=!0,b$1.info(`Removed file:.yalc/ reference for ${o.default.cyan(h)}`));}if(r){let p=a.match(/^(\s+)"/m)?.[1]||" ";await writeFile(l,JSON.stringify(n,null,p)+`
5
+ `),b$1.success("Cleaned up package.json");}}catch(a){b$1.warn(`Could not clean package.json: ${a instanceof Error?a.message:String(a)}. You may need to manually remove file:.yalc/ references.`);}if(k&&(await rm(u,{recursive:true,force:true}),b$1.success("Removed .yalc/ directory")),f&&(await rm(s,{force:true}),b$1.success("Removed yalc.lock")),b$1.log(""),b$1.info(`${o.default.bold("Migration complete!")} Next steps:
6
+ `),b$1.log(` 1. ${o.default.cyan("knarr init")}`),t.length>0)for(let a of t)b$1.log(` 2. ${o.default.cyan(`knarr add ${a} --from <path-to-${a}>`)}`);b$1.log(`
7
+ Run ${o.default.cyan("knarr doctor")} to verify your setup.
8
+ `),b$1.info(`Migrated in ${y.elapsed()}`),a$2({migrated:true,packages:t,elapsed:y.elapsedMs()});}};export{E as default};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {createRequire}from'node:module';export{a as runPreflightChecks}from'./chunk-XQPVRRTN.mjs';import'./chunk-NBSJGM2X.mjs';import'./chunk-B3DZ5HVQ.mjs';import'./chunk-2VCW5RWI.mjs';globalThis.require=createRequire(import.meta.url);
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import {createRequire}from'node:module';import {a as a$2}from'./chunk-IM555H3S.mjs';import'./chunk-V2ED74ZQ.mjs';import {a as a$1}from'./chunk-TEFMLGCB.mjs';import {a}from'./chunk-MBKCCWSD.mjs';import {b,a as a$3}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import'./chunk-Z22BYXWQ.mjs';import'./chunk-3KNUBUPH.mjs';import {o,r}from'./chunk-23HXXAGG.mjs';import {d,b as b$2}from'./chunk-NBSJGM2X.mjs';import {b as b$1}from'./chunk-B3DZ5HVQ.mjs';import'./chunk-2VCW5RWI.mjs';import {resolve}from'path';globalThis.require=createRequire(import.meta.url);
3
+ var P=o(4),O={meta:{name:"publish",description:"Publish current package to the Knarr store"},args:{dir:{type:"positional",description:"Package directory (default: current directory)",required:false},private:{type:"boolean",description:"Allow publishing private packages",default:false},"no-scripts":{type:"boolean",description:"Skip prepack/postpack lifecycle hooks",default:false},recursive:{type:"boolean",alias:"r",description:"Publish all packages in the workspace",default:false},"no-check":{type:"boolean",description:"Skip pre-flight validation checks",default:false}},async run({args:r$1}){b();let m=new a,i=resolve(r$1.dir||"."),h={allowPrivate:r$1.private,runScripts:!r$1["no-scripts"]};if(!r$1["no-check"]&&!r$1.recursive){let{runPreflightChecks:e}=await import('./preflight-TVJFHRI2.mjs'),t=await e(i);for(let s of t)s.severity==="error"?b$1.error(`[${s.code}] ${s.message}`):b$1.warn(`[${s.code}] ${s.message}`);}if(r$1.recursive){d(`[publish] Discovering workspace packages from ${i}`);let{findWorkspacePackages:e}=await import('./workspace-L5CGPK7U.mjs'),t=await e(i);t.length===0&&(a$1("No workspace packages found. Make sure you're in a workspace root or subdirectory."),process.exit(1));let s=0,c=0,l=0,v=await Promise.all(t.map(o=>P(async()=>{try{return (await a$2(o,h)).skipped?"skipped":"published"}catch(p){return b$1.warn(`Failed to publish ${o}: ${p instanceof Error?p.message:String(p)}`),"failed"}})));for(let o of v)o==="published"?s++:o==="skipped"?c++:l++;b$1.success(`Workspace publish: ${s} published, ${c} up to date, ${l} failed`),a$3({recursive:true,packages:t.length,published:s,skipped:c,failed:l,elapsed:m.elapsedMs()});}else {d(`[publish] Publishing from ${i}`);try{let e=await a$2(i,h);a$3({...e,elapsed:m.elapsedMs()});}catch(e){a$1(e instanceof Error?e.message:String(e)),process.exit(1);}}b$2()&&r();}};export{O as default};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import {createRequire}from'node:module';import {a as a$1}from'./chunk-7DZPDPP6.mjs';import'./chunk-SYADAYF4.mjs';import {a,e,b as b$1,c}from'./chunk-FU7FCNTW.mjs';import'./chunk-IM555H3S.mjs';import'./chunk-V2ED74ZQ.mjs';import'./chunk-YZCBBQCH.mjs';import'./chunk-TEFMLGCB.mjs';import'./chunk-7JG555TZ.mjs';import'./chunk-HQ7NKBQW.mjs';import'./chunk-MBKCCWSD.mjs';import {b}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import'./chunk-OLUZ7T7G.mjs';import'./chunk-Z22BYXWQ.mjs';import'./chunk-2EZDTBUU.mjs';import'./chunk-3KNUBUPH.mjs';import {r}from'./chunk-23HXXAGG.mjs';import {b as b$2}from'./chunk-NBSJGM2X.mjs';import'./chunk-B3DZ5HVQ.mjs';import {a as a$2}from'./chunk-2VCW5RWI.mjs';import {resolve}from'path';globalThis.require=createRequire(import.meta.url);
3
+ var M={meta:{name:"push",description:"Publish and push to all consumers. Use --watch for continuous mode."},args:{watch:{type:"boolean",description:"Watch for changes and auto-push",default:false},all:{type:"boolean",description:"Push all workspace packages in dependency order",default:false},build:{type:"string",description:"Build command to run before publishing (watch mode)"},"skip-build":{type:"boolean",description:"Watch output dirs directly, skip build command detection",default:false},debounce:{type:"string",description:"Debounce delay in ms for watch mode (default: 500)"},cooldown:{type:"string",description:"Minimum time between builds in ms (default: 500)"},"no-scripts":{type:"boolean",description:"Skip prepack/postpack lifecycle hooks",default:false},force:{type:"boolean",alias:"f",description:"Force copy all files, bypassing hash comparison",default:false},notify:{type:"boolean",description:"Ring terminal bell on push completion (watch mode)",default:false},"no-cascade":{type:"boolean",description:"Disable cascading rebuilds in --all watch mode",default:false}},async run({args:o}){b();let e$1=resolve("."),f=await a(e$1),t={runScripts:!o["no-scripts"],force:o.force,historyLimit:f.historyLimit};if(o.all)await a$1(e$1,t),o.watch&&await e(e$1,o,t);else {let i=a$2(()=>b$1(e$1,t),"push");await i(),o.watch&&await c(e$1,o,i);}b$2()&&r();}};export{M as default};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {createRequire}from'node:module';export{a as default,b as removeSinglePackage}from'./chunk-FUINO5RD.mjs';import'./chunk-XQVMCMO7.mjs';import'./chunk-YZCBBQCH.mjs';import'./chunk-TEFMLGCB.mjs';import'./chunk-U5ZZAYNU.mjs';import'./chunk-HQ7NKBQW.mjs';import'./chunk-MBKCCWSD.mjs';import'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import'./chunk-OLUZ7T7G.mjs';import'./chunk-Z22BYXWQ.mjs';import'./chunk-23HXXAGG.mjs';import'./chunk-NBSJGM2X.mjs';import'./chunk-B3DZ5HVQ.mjs';import'./chunk-2VCW5RWI.mjs';globalThis.require=createRequire(import.meta.url);
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import {createRequire}from'node:module';import {b as b$2}from'./chunk-FUINO5RD.mjs';import'./chunk-XQVMCMO7.mjs';import'./chunk-YZCBBQCH.mjs';import'./chunk-TEFMLGCB.mjs';import'./chunk-U5ZZAYNU.mjs';import {c}from'./chunk-KXLQGVT2.mjs';import'./chunk-HQ7NKBQW.mjs';import {a}from'./chunk-MBKCCWSD.mjs';import {b,a as a$1}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import {a as a$2}from'./chunk-OLUZ7T7G.mjs';import'./chunk-Z22BYXWQ.mjs';import {j,A,x,r}from'./chunk-23HXXAGG.mjs';import {d,b as b$3}from'./chunk-NBSJGM2X.mjs';import {b as b$1}from'./chunk-B3DZ5HVQ.mjs';import'./chunk-2VCW5RWI.mjs';import {resolve,join}from'path';globalThis.require=createRequire(import.meta.url);
3
+ var M={meta:{name:"reset",description:"Remove all Knarr links and teardown Knarr from this project"},args:{yes:{type:"boolean",alias:"y",description:"Skip confirmation prompts",default:false}},async run({args:$}){b();let p=new a,o=resolve("."),c$1=j(o);if(!await A(c$1)){b$1.info("No Knarr setup found in this project"),a$1({reset:false});return}let j$1=await a$2(o),t=Object.entries(j$1.links);if(!$.yes){let r=[];t.length>0&&r.push(`remove ${t.length} linked package(s)`),r.push("delete .knarr/ directory","remove postinstall hook");let s=await b$1.prompt(`Reset Knarr? This will ${r.join(", ")}.`,{type:"confirm"});if(!s||typeof s=="symbol"){b$1.info("Cancelled");return}}d(`[reset] Removing ${t.length} linked package(s) from ${o}`);let a$3=0;for(let[r,s]of t)try{await b$2(o,r,s),a$3++;}catch(i){b$1.warn(`Failed to remove ${r}: ${i instanceof Error?i.message:String(i)}`);}await x(c$1),b$1.success("Removed .knarr/ directory");let l=join(o,"package.json");await A(l)&&await c(l)&&b$1.success("Removed postinstall hook from package.json"),b$1.success(`Reset complete: ${a$3} package(s) restored in ${p.elapsed()}`),a$1({reset:true,removed:a$3,elapsed:p.elapsedMs()}),b$3()&&r();}};export{M as default};
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ import {createRequire}from'node:module';import {b as b$3}from'./chunk-V2ED74ZQ.mjs';import {a as a$4}from'./chunk-YZCBBQCH.mjs';import {a as a$2,b as b$1,c}from'./chunk-HQ7NKBQW.mjs';import {a}from'./chunk-MBKCCWSD.mjs';import {b,a as a$3}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import {a as a$1,d}from'./chunk-OLUZ7T7G.mjs';import'./chunk-Z22BYXWQ.mjs';import {o,r}from'./chunk-23HXXAGG.mjs';import {d as d$1,b as b$4}from'./chunk-NBSJGM2X.mjs';import {b as b$2}from'./chunk-B3DZ5HVQ.mjs';import'./chunk-2VCW5RWI.mjs';import {resolve}from'path';globalThis.require=createRequire(import.meta.url);
3
+ var D=o(4),F={meta:{name:"restore",description:"Re-inject all linked packages (use after npm install wipes overrides)"},args:{silent:{type:"boolean",description:"Suppress output when no packages are linked (for postinstall scripts)",default:false}},async run({args:v}){b();let c$1=new a,t=resolve("."),L=await a$1(t);if(await a$2(t)==="yarn"){let e=await b$1(t);(e==="pnp"||e===null&&await c(t))&&(b$2.error(`Yarn PnP mode is not compatible with Knarr.
4
+
5
+ Knarr works by copying files into node_modules/, but PnP eliminates
6
+ node_modules/ entirely. To use Knarr with Yarn Berry, add this to
7
+ .yarnrc.yml:
8
+
9
+ nodeLinker: node-modules
10
+
11
+ Then run: yarn install`),process.exit(1));}let m=Object.entries(L.links);if(m.length===0){v.silent||b$2.info("No linked packages in this project"),a$3({restored:0,failed:0});return}let i=0,a$5=0,Y=await Promise.all(m.map(([e,n])=>D(async()=>{let o=await b$3(e,n.version);if(!o)return b$2.warn(`Store entry missing for ${e}@${n.version}. Re-publish it.`),{packageName:e,success:false};try{let s=await a$4(o,t,n.packageManager);return await d(t,e,{...n,contentHash:o.meta.contentHash,buildId:o.meta.buildId??"",linkedAt:new Date().toISOString()}),d$1(`[restore] ${e}@${n.version}: ${s.copied} files`),{packageName:e,success:!0,copied:s.copied}}catch(s){return b$2.error(`Failed to restore ${e}: ${s instanceof Error?s.message:String(s)}`),{packageName:e,success:false}}}))),p=[];for(let e of Y)e.success?(b$2.success(`Restored ${e.packageName} (${e.copied} files)`),i++):(a$5++,p.push(e.packageName));b$2.info(`Restore complete: ${i} restored, ${a$5} failed in ${c$1.elapsed()}`),a$3({restored:i,failed:a$5,failedPackages:p,elapsed:c$1.elapsedMs()}),b$4()&&r();}};export{F as default};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import {createRequire}from'node:module';import {a as a$3,b as b$3}from'./chunk-FU7FCNTW.mjs';import'./chunk-IM555H3S.mjs';import'./chunk-V2ED74ZQ.mjs';import'./chunk-YZCBBQCH.mjs';import {a as a$1}from'./chunk-TEFMLGCB.mjs';import'./chunk-7JG555TZ.mjs';import'./chunk-HQ7NKBQW.mjs';import'./chunk-MBKCCWSD.mjs';import {b,a as a$2}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import'./chunk-OLUZ7T7G.mjs';import'./chunk-Z22BYXWQ.mjs';import {b as b$1,g,d}from'./chunk-2QPLXLJW.mjs';import'./chunk-3KNUBUPH.mjs';import {r}from'./chunk-23HXXAGG.mjs';import {b as b$4}from'./chunk-NBSJGM2X.mjs';import {a,b as b$2}from'./chunk-B3DZ5HVQ.mjs';import {c}from'./chunk-2VCW5RWI.mjs';import {resolve}from'path';import {readFile}from'fs/promises';globalThis.require=createRequire(import.meta.url);
3
+ var f=c(a(),1);var F={meta:{name:"rollback",description:"Restore a previous build from history"},args:{"build-id":{type:"string",description:"Specific build ID to restore (default: previous build)"},yes:{type:"boolean",alias:"y",description:"Skip confirmation prompts",default:false}},async run({args:a}){b();let l=resolve("."),i;try{i=JSON.parse(await readFile(resolve(l,"package.json"),"utf-8"));}catch{a$1("No package.json found in current directory"),process.exit(1);}(!i.name||!i.version)&&(a$1("package.json missing name or version field"),process.exit(1));let t=await b$1(i.name,i.version);if(t.length===0){b$2.info("No build history available"),a$2({rolledBack:false});return}let r$1;if(a["build-id"]){if(r$1=a["build-id"],!t.find(n=>n.buildId===r$1)){b$2.error(`Build ${r$1} not found in history`),b$2.info("Available builds:");for(let n of t)b$2.log(` ${f.default.cyan(n.buildId)} ${f.default.dim(n.publishedAt)}`);a$2({rolledBack:false});return}}else r$1=t[0].buildId;let v=t.find(e=>e.buildId===r$1);if(!a.yes){let e=await b$2.prompt(`Restore build ${r$1} (published ${v.publishedAt})?`,{type:"confirm"});if(!e||typeof e=="symbol"){b$2.info("Cancelled");return}}let $=await a$3(l),w=g($.historyLimit);if(!await d(i.name,i.version,r$1,w)){b$2.error(`Failed to restore build ${r$1}`),a$2({rolledBack:false});return}b$2.success(`Restored ${i.name}@${i.version} to build ${r$1}`);try{await b$3(l,{force:!0});}catch(e){b$2.warn(`Push after rollback failed: ${e instanceof Error?e.message:String(e)}`);}a$2({rolledBack:true,buildId:r$1}),b$4()&&r();}};export{F as default};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import {createRequire}from'node:module';import {b as b$2}from'./chunk-V2ED74ZQ.mjs';import {b,a as a$2}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import {a as a$1}from'./chunk-OLUZ7T7G.mjs';import'./chunk-Z22BYXWQ.mjs';import {o as o$1,A}from'./chunk-23HXXAGG.mjs';import'./chunk-NBSJGM2X.mjs';import {a,b as b$1}from'./chunk-B3DZ5HVQ.mjs';import {c}from'./chunk-2VCW5RWI.mjs';import {resolve,join}from'path';globalThis.require=createRequire(import.meta.url);
3
+ var o=c(a(),1);var y=o$1(4),L={meta:{name:"status",description:"Show status of linked packages with health checks"},async run(){b();let c=resolve("."),h=await a$1(c),i=Object.entries(h.links);if(i.length===0){b$1.info("No linked packages in this project"),a$2({packages:[]});return}b$1.info(`Package status (${i.length} linked):
4
+ `);let m=await Promise.all(i.map(([t,s])=>y(async()=>{let e=[],n=await b$2(t,s.version);n?n.meta.contentHash!==s.contentHash&&e.push("store has newer content (run knarr update)"):e.push("store entry missing");let f=join(c,"node_modules",t);return await A(f)||e.push("missing from node_modules (run knarr restore)"),await A(s.sourcePath)||e.push(`source directory missing: ${s.sourcePath}`),{name:t,version:s.version,buildId:s.buildId??"",issues:e,linkedAt:s.linkedAt,sourcePath:s.sourcePath}})));for(let t of m){let s=t.issues.length===0?o.default.green("OK"):o.default.yellow("!"),e=t.buildId?`[${t.buildId}]`:"[--------]";b$1.log(` ${s} ${o.default.cyan(t.name)} ${o.default.dim("@"+t.version)} ${o.default.dim(e)}`),b$1.log(` ${o.default.dim(`linked ${new Date(t.linkedAt).toLocaleString()} from ${t.sourcePath}`)}`);for(let n of t.issues)b$1.log(` ${o.default.yellow("!")} ${n}`);}a$2({packages:m.map(({name:t,version:s,buildId:e,issues:n})=>({name:t,version:s,buildId:e||null,healthy:n.length===0,issues:n}))});}};export{L as default};
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import {createRequire}from'node:module';import {m,B}from'./chunk-23HXXAGG.mjs';import'./chunk-NBSJGM2X.mjs';import'./chunk-B3DZ5HVQ.mjs';import {a}from'./chunk-2VCW5RWI.mjs';import {readdir,readFile}from'fs/promises';import {join,dirname,relative}from'path';globalThis.require=createRequire(import.meta.url);
3
+ var x=new Set(["node_modules",".knarr","dist",".git"]);async function P(t){let n;try{n=await readdir(t,{recursive:!0,encoding:"utf-8"});}catch{return null}let r=n.filter(e=>e.endsWith(".css")?!m(e).split("/").some(c=>x.has(c)):false).map(e=>join(t,e));for(let e of r){let i;try{i=await readFile(e,"utf-8");}catch{continue}if(i.includes('@import "tailwindcss"')||i.includes("@import 'tailwindcss'"))return e}return null}a(P,"findTailwindCss");async function _(t,n,r){let e;try{e=await readFile(t,"utf-8");}catch{return {modified:false,error:"could not read CSS file"}}if(e.includes(`node_modules/${n}`))return {modified:false};let i=y(t,n,r),c=/^@(import|source|plugin|theme)\s.+$/gm,o=null,d;for(;(d=c.exec(e))!==null;)o=d;let f=`@source "${i}";`;if(o){let m=o.index+o[0].length;e=e.slice(0,m)+`
4
+ `+f+e.slice(m);}else e=f+`
5
+ `+e;return await B(t,e),{modified:true}}a(_,"addTailwindSource");async function v(t,n){let r;try{r=await readFile(t,"utf-8");}catch{return {modified:false}}let e=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`^@source\\s+["'][^"']*node_modules/${e}["'];?\\s*\\n?`,"m");return i.test(r)?(r=r.replace(i,""),await B(t,r),{modified:true}):{modified:false}}a(v,"removeTailwindSource");function y(t,n,r){let e=dirname(t),i=join(r,"node_modules",n);return m(relative(e,i))}a(y,"computeSourcePath");export{_ as addTailwindSource,P as findTailwindCss,v as removeTailwindSource};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {createRequire}from'node:module';export{a as CycleError,b as topoSort}from'./chunk-SYADAYF4.mjs';import'./chunk-2VCW5RWI.mjs';globalThis.require=createRequire(import.meta.url);
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {createRequire}from'node:module';export{d as addLink,k as cleanStaleConsumers,j as getConsumers,f as getLink,a as readConsumerState,b as readConsumerStateSafe,g as readConsumersRegistry,h as registerConsumer,e as removeLink,i as unregisterConsumer,c as writeConsumerState}from'./chunk-OLUZ7T7G.mjs';import'./chunk-Z22BYXWQ.mjs';import'./chunk-23HXXAGG.mjs';import'./chunk-NBSJGM2X.mjs';import'./chunk-B3DZ5HVQ.mjs';import'./chunk-2VCW5RWI.mjs';globalThis.require=createRequire(import.meta.url);
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import {createRequire}from'node:module';import {c}from'./chunk-V2ED74ZQ.mjs';import {a as a$4}from'./chunk-YZCBBQCH.mjs';import {a as a$3}from'./chunk-TEFMLGCB.mjs';import'./chunk-HQ7NKBQW.mjs';import {a}from'./chunk-MBKCCWSD.mjs';import {b,a as a$2}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import {a as a$1,d as d$1}from'./chunk-OLUZ7T7G.mjs';import {d as d$2}from'./chunk-Z22BYXWQ.mjs';import {o}from'./chunk-23HXXAGG.mjs';import {d}from'./chunk-NBSJGM2X.mjs';import {b as b$1}from'./chunk-B3DZ5HVQ.mjs';import'./chunk-2VCW5RWI.mjs';import {resolve}from'path';globalThis.require=createRequire(import.meta.url);
3
+ var M=o(4),z={meta:{name:"update",description:"Pull latest versions from the store for linked packages"},args:{package:{type:"positional",description:"Package name to update (default: all linked)",required:false}},async run({args:n}){b();let f=new a,r=resolve("."),E=await a$1(r),p=Object.entries(E.links);if(p.length===0){b$1.info("No linked packages in this project"),a$2({updated:0,skipped:0});return}let k=n.package?p.filter(([t])=>t===n.package):p;n.package&&k.length===0&&(a$3(`Package "${n.package}" is not linked in this project. Run 'knarr list' to see linked packages.`),process.exit(1));let d$3=0,c$1=0,o=0,a$5=0,H=await Promise.all(k.map(([t,l])=>M(async()=>{let e=await c(t);if(!e)return b$1.warn(`Store entry missing for ${t}. Re-publish it.`),"missing";if(e.meta.contentHash===l.contentHash)return d(`[update] ${t}@${e.version} already up to date`),"skipped";try{let s=await a$4(e,r,l.packageManager),P={...l,version:e.version,contentHash:e.meta.contentHash,buildId:e.meta.buildId??"",linkedAt:new Date().toISOString()};return await d$1(r,t,P),await d$2(r,t,e.version),b$1.success(`Updated ${t}@${e.version} (${s.copied} files changed)`),"updated"}catch(s){return b$1.warn(`Failed to update ${t}: ${s instanceof Error?s.message:String(s)}`),"failed"}})));for(let t of H)t==="updated"?d$3++:t==="skipped"?c$1++:t==="missing"?o++:a$5++;let m=[`${d$3} updated`,`${c$1} unchanged`];o>0&&m.push(`${o} missing`),a$5>0&&m.push(`${a$5} failed`),b$1.info(`Update complete: ${m.join(", ")} in ${f.elapsed()}`),a$2({updated:d$3,skipped:c$1,missing:o,failed:a$5,elapsed:f.elapsedMs()});}};export{z as default};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import {createRequire}from'node:module';import {b as b$1,a as a$1}from'./chunk-OXI2KGCW.mjs';import'./chunk-IM555H3S.mjs';import'./chunk-V2ED74ZQ.mjs';import'./chunk-XQVMCMO7.mjs';import'./chunk-YZCBBQCH.mjs';import'./chunk-TEFMLGCB.mjs';import'./chunk-U5ZZAYNU.mjs';import'./chunk-KXLQGVT2.mjs';import'./chunk-HQ7NKBQW.mjs';import {a}from'./chunk-MBKCCWSD.mjs';import {b}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import'./chunk-OLUZ7T7G.mjs';import'./chunk-Z22BYXWQ.mjs';import'./chunk-3KNUBUPH.mjs';import'./chunk-23HXXAGG.mjs';import'./chunk-NBSJGM2X.mjs';import'./chunk-B3DZ5HVQ.mjs';import'./chunk-2VCW5RWI.mjs';import {resolve}from'path';globalThis.require=createRequire(import.meta.url);
3
+ var d={meta:{name:"use",description:"Publish a local package path and link it into this project"},args:{path:{type:"positional",description:"Path to the local package source",required:true},yes:{type:"boolean",alias:"y",description:"Auto-accept prompts (install missing deps, etc.)",default:false}},async run({args:e}){b();let p=new a,a$2=resolve(e.path),s=await b$1(a$2);await a$1({packageArg:s,from:a$2,yes:e.yes,timer:p});}};export{d as default};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {createRequire}from'node:module';export{b as addKnarrVitePlugin,a as isComplexConfig,c as removeFromViteConfig}from'./chunk-U5ZZAYNU.mjs';import'./chunk-23HXXAGG.mjs';import'./chunk-NBSJGM2X.mjs';import'./chunk-B3DZ5HVQ.mjs';import'./chunk-2VCW5RWI.mjs';globalThis.require=createRequire(import.meta.url);
@@ -0,0 +1,5 @@
1
+ import { Plugin } from 'vite';
2
+
3
+ declare function knarrPlugin(): Plugin;
4
+
5
+ export { knarrPlugin as default };
@@ -0,0 +1,215 @@
1
+ // src/vite-plugin.ts
2
+ import { join, normalize } from "path";
3
+ import { readFileSync } from "fs";
4
+ function readLinkedPackagesSync(stateFile) {
5
+ try {
6
+ const content = readFileSync(stateFile, "utf-8");
7
+ const state = JSON.parse(content);
8
+ return Object.keys(state.links ?? {});
9
+ } catch {
10
+ return [];
11
+ }
12
+ }
13
+ function knarrPlugin() {
14
+ let knarrStateFile;
15
+ let nodeModulesDir;
16
+ let pollTimer;
17
+ return {
18
+ name: "vite-plugin-knarr",
19
+ apply: "serve",
20
+ // Exclude linked packages from pre-bundling so Vite serves them
21
+ // directly from node_modules. This ensures fresh code after push.
22
+ config(config, { command }) {
23
+ if (command !== "serve") return;
24
+ const root = config.root ?? process.cwd();
25
+ const stateFile = join(root, ".knarr", "state.json");
26
+ const linkedPackages = readLinkedPackagesSync(stateFile);
27
+ const result = {};
28
+ if (linkedPackages.length > 0) {
29
+ const existingExclude = config.optimizeDeps?.exclude ?? [];
30
+ const newExclude = [
31
+ ...existingExclude,
32
+ ...linkedPackages.filter((pkg) => !existingExclude.includes(pkg))
33
+ ];
34
+ console.log(`[knarr] Excluding from pre-bundling: ${newExclude.join(", ")}`);
35
+ result.optimizeDeps = { exclude: newExclude };
36
+ }
37
+ const isWebContainer = !!process.versions?.webcontainer;
38
+ if (isWebContainer && !config.server?.watch?.usePolling) {
39
+ result.server = {
40
+ watch: { usePolling: true, interval: 1e3 }
41
+ };
42
+ console.log("[knarr] WebContainer detected, enabling filesystem polling");
43
+ }
44
+ if (Object.keys(result).length === 0) return;
45
+ return result;
46
+ },
47
+ configResolved(config) {
48
+ nodeModulesDir = join(config.root, "node_modules");
49
+ knarrStateFile = normalize(join(config.root, ".knarr", "state.json"));
50
+ console.log(`[knarr] Watching state file: ${knarrStateFile}`);
51
+ },
52
+ configureServer(server) {
53
+ const watchedPackages = /* @__PURE__ */ new Set();
54
+ let isRestarting = false;
55
+ let pendingRestart = false;
56
+ let debounceTimer = null;
57
+ let reloadTimer = null;
58
+ function syncPackageWatchers() {
59
+ let added = false;
60
+ for (const pkg of readLinkedPackagesSync(knarrStateFile)) {
61
+ if (!watchedPackages.has(pkg)) {
62
+ watchedPackages.add(pkg);
63
+ added = true;
64
+ }
65
+ }
66
+ if (added && watchedPackages.size > 0) {
67
+ const escaped = [...watchedPackages].sort((a, b) => b.length - a.length).map((p) => p.replace(/[/\\.*+?^${}()|[\]]/g, "\\$&")).join("|");
68
+ server.watcher.options = {
69
+ ...server.watcher.options,
70
+ ignored: [
71
+ new RegExp(`node_modules\\/(?!(?:${escaped})(?:\\/|$)).*`),
72
+ /[/\\]\.git[/\\]/,
73
+ /[/\\]test-results[/\\]/
74
+ ]
75
+ };
76
+ server.watcher._userIgnored = void 0;
77
+ for (const pkg of watchedPackages) {
78
+ const pkgPath = join(nodeModulesDir, pkg);
79
+ server.watcher.add(pkgPath);
80
+ console.log(`[knarr] Added watcher for package: ${pkgPath}`);
81
+ }
82
+ }
83
+ }
84
+ async function restartServer(source) {
85
+ if (isRestarting) {
86
+ pendingRestart = true;
87
+ console.log(`[knarr] Restart already in progress, queued: ${source}`);
88
+ return;
89
+ }
90
+ isRestarting = true;
91
+ syncPackageWatchers();
92
+ console.log(`[knarr] ${source}, restarting server...`);
93
+ try {
94
+ await server.restart();
95
+ } finally {
96
+ isRestarting = false;
97
+ if (pendingRestart) {
98
+ pendingRestart = false;
99
+ await restartServer("Queued change detected");
100
+ }
101
+ }
102
+ }
103
+ function scheduleRestart(source) {
104
+ if (debounceTimer) return;
105
+ debounceTimer = setTimeout(() => {
106
+ debounceTimer = null;
107
+ restartServer(source);
108
+ }, 1500);
109
+ }
110
+ function scheduleReload() {
111
+ if (reloadTimer) clearTimeout(reloadTimer);
112
+ reloadTimer = setTimeout(() => {
113
+ reloadTimer = null;
114
+ console.log("[knarr] Linked package updated, reloading");
115
+ server.hot.send({ type: "full-reload", path: "*" });
116
+ }, 200);
117
+ }
118
+ function invalidateAndReload(changedPath) {
119
+ const normalized = normalize(changedPath);
120
+ const mods = server.moduleGraph.getModulesByFile(normalized);
121
+ if (mods) {
122
+ mods.forEach((m) => server.moduleGraph.invalidateModule(m));
123
+ }
124
+ scheduleReload();
125
+ }
126
+ function invalidateLinkedModules() {
127
+ for (const [url, mod] of server.moduleGraph.urlToModuleMap) {
128
+ for (const pkg of watchedPackages) {
129
+ if (url.includes(pkg)) {
130
+ server.moduleGraph.invalidateModule(mod);
131
+ break;
132
+ }
133
+ }
134
+ }
135
+ scheduleReload();
136
+ }
137
+ server.watcher.add(knarrStateFile);
138
+ console.log(`[knarr] Added watcher for: ${knarrStateFile}`);
139
+ syncPackageWatchers();
140
+ server.watcher.on("change", async (changedPath) => {
141
+ const normalizedChanged = normalize(changedPath);
142
+ if (normalizedChanged === knarrStateFile) {
143
+ const currentPackages = readLinkedPackagesSync(knarrStateFile);
144
+ const hasNew = currentPackages.some((pkg) => !watchedPackages.has(pkg));
145
+ if (hasNew) {
146
+ scheduleRestart("New package linked");
147
+ } else {
148
+ invalidateLinkedModules();
149
+ }
150
+ return;
151
+ }
152
+ const isLinkedPackage = [...watchedPackages].some(
153
+ (pkg) => normalizedChanged.includes(normalize(join(nodeModulesDir, pkg)))
154
+ );
155
+ if (isLinkedPackage) {
156
+ invalidateAndReload(changedPath);
157
+ }
158
+ });
159
+ server.watcher.on("add", (addedPath) => {
160
+ const normalizedAdded = normalize(addedPath);
161
+ const isLinkedPackage = [...watchedPackages].some(
162
+ (pkg) => normalizedAdded.includes(normalize(join(nodeModulesDir, pkg)))
163
+ );
164
+ if (isLinkedPackage) {
165
+ invalidateAndReload(addedPath);
166
+ }
167
+ });
168
+ if (process.versions?.webcontainer) {
169
+ if (pollTimer) clearInterval(pollTimer);
170
+ let lastStateContent = "";
171
+ try {
172
+ lastStateContent = readFileSync(knarrStateFile, "utf-8");
173
+ } catch {
174
+ }
175
+ pollTimer = setInterval(async () => {
176
+ try {
177
+ const content = readFileSync(knarrStateFile, "utf-8");
178
+ if (lastStateContent && content !== lastStateContent) {
179
+ lastStateContent = content;
180
+ const currentPackages = readLinkedPackagesSync(knarrStateFile);
181
+ const hasNew = currentPackages.some(
182
+ (pkg) => !watchedPackages.has(pkg)
183
+ );
184
+ if (hasNew) {
185
+ scheduleRestart("New package linked (polling fallback)");
186
+ } else {
187
+ invalidateLinkedModules();
188
+ }
189
+ }
190
+ if (!lastStateContent) lastStateContent = content;
191
+ } catch {
192
+ }
193
+ }, 1e3);
194
+ console.log("[knarr] WebContainer polling fallback active (1s interval)");
195
+ }
196
+ server.httpServer?.on("close", () => {
197
+ if (pollTimer) {
198
+ clearInterval(pollTimer);
199
+ pollTimer = void 0;
200
+ }
201
+ if (debounceTimer) {
202
+ clearTimeout(debounceTimer);
203
+ debounceTimer = null;
204
+ }
205
+ if (reloadTimer) {
206
+ clearTimeout(reloadTimer);
207
+ reloadTimer = null;
208
+ }
209
+ });
210
+ }
211
+ };
212
+ }
213
+ export {
214
+ knarrPlugin as default
215
+ };
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import {createRequire}from'node:module';import {a as a$1,d,b as b$2}from'./chunk-FU7FCNTW.mjs';import'./chunk-IM555H3S.mjs';import'./chunk-V2ED74ZQ.mjs';import'./chunk-YZCBBQCH.mjs';import'./chunk-TEFMLGCB.mjs';import'./chunk-7JG555TZ.mjs';import'./chunk-HQ7NKBQW.mjs';import'./chunk-MBKCCWSD.mjs';import'./chunk-BS4VKVYH.mjs';import'./chunk-OLUZ7T7G.mjs';import'./chunk-Z22BYXWQ.mjs';import'./chunk-3KNUBUPH.mjs';import {o}from'./chunk-23HXXAGG.mjs';import {d as d$1}from'./chunk-NBSJGM2X.mjs';import {b as b$1}from'./chunk-B3DZ5HVQ.mjs';import {a}from'./chunk-2VCW5RWI.mjs';globalThis.require=createRequire(import.meta.url);
3
+ var M=o(2),b=class{static{a(this,"WatchOrchestrator");}packages=new Map;dependents=new Map;cascade;pushOptions={};constructor(t){this.cascade=t;}async start(t,e,s){this.pushOptions=s;let{buildWorkspaceGraph:o,buildReverseAdjacency:u}=await import('./workspace-L5CGPK7U.mjs'),{topoSort:f,CycleError:v}=await import('./topo-sort-WEIVPJKN.mjs'),{startWatcher:C}=await import('./watcher-PTPUN2HE.mjs'),d$1=await o(t);if(d$1.packages.length===0){b$1.warn("No workspace packages found");return}let h;try{h=f(d$1.adjacency);}catch(a){if(a instanceof v){b$1.error(`Cannot watch: ${a.message}`);return}throw a}this.cascade&&(this.dependents=u(d$1.adjacency),b$1.info("Cascade mode enabled"));let $=new Map(d$1.packages.map(a=>[a.name,a.dir]));for(let a$2 of h){let i=$.get(a$2);if(!i)continue;let p=await a$1(i),{buildCmd:q,patterns:S}=await d(i,e,p),R=e.notify??p.notify??false,j=a(async()=>{await b$2(i,s),await this.onPackagePushed(a$2);},"wrappedOnChange"),w=a(m=>{if(!m)return;let k=parseInt(m,10);return Number.isFinite(k)?k:void 0},"parseMs"),E=await C(i,{patterns:S,buildCmd:q,debounce:w(e.debounce)??p.debounce,cooldown:w(e.cooldown)??p.cooldown,notify:R},j);this.packages.set(a$2,{dir:i,state:"idle",watcher:E});}b$1.info(`Watching ${this.packages.size} workspace packages`),await new Promise(a$1=>{let i=a(async()=>{b$1.info("Stopping watchers..."),await this.close(),a$1();},"cleanup");process.once("SIGINT",i),process.once("SIGTERM",i);});}async onPackagePushed(t){if(!this.cascade)return;let e=this.dependents.get(t);if(!e||e.size===0)return;d$1(`[cascade] ${t} pushed, triggering dependents: ${[...e].join(", ")}`);let s=[...e].map(o=>M(()=>this.requestRebuild(o)));await Promise.all(s);}async requestRebuild(t){let e=this.packages.get(t);if(e){if(e.state==="queued"){d$1(`[cascade] ${t} already queued, skipping`);return}if(e.state==="building"){d$1(`[cascade] ${t} is building, marking as queued`),e.state="queued";return}e.state="building",d$1(`[cascade] Rebuilding ${t}`);try{let o=(await a$1(e.dir)).buildCmd;if(o){let{runBuildCommand:u}=await import('./watcher-PTPUN2HE.mjs');if(!await u(o,e.dir)){b$1.warn(`[cascade] Build failed for ${t}, skipping dependents`),e.state="idle";return}}await b$2(e.dir,this.pushOptions),await this.onPackagePushed(t);}catch(s){b$1.warn(`[cascade] Push failed for ${t}: ${s instanceof Error?s.message:String(s)}`);}finally{let s=e.state==="queued";e.state="idle",s&&await this.requestRebuild(t);}}}async close(){await Promise.all([...this.packages.values()].map(t=>t.watcher.close())),this.packages.clear();}};export{b as WatchOrchestrator};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import {createRequire}from'node:module';import {a as a$1}from'./chunk-SFLWVTJC.mjs';import {b}from'./chunk-B3DZ5HVQ.mjs';import {a}from'./chunk-2VCW5RWI.mjs';import {spawn}from'child_process';import {readdir,stat}from'fs/promises';import {platform}from'os';import {join}from'path';globalThis.require=createRequire(import.meta.url);
3
+ var d=null;function x(){d&&!d.killed&&(d.kill("SIGTERM"),d=null);}a(x,"killActiveBuild");var _=new Set(["node_modules",".git",".knarr"]);async function $(o,t){let r;try{r=await readdir(o,{withFileTypes:!0});}catch{return}for(let s of r){if(_.has(s.name))continue;let f=join(o,s.name);if(s.isDirectory())await $(f,t);else try{let m=await stat(f);t.set(f,m.mtimeMs);}catch{}}}a($,"walkDir");async function S(o){let t=new Map;for(let r of o)try{let s=await stat(r);s.isDirectory()?await $(r,t):t.set(r,s.mtimeMs);}catch{}return t}a(S,"buildSnapshot");async function J(o,t,r){let{watch:s}=await import('./chokidar-LVDD2IK4.mjs'),f=t.patterns??["src","lib"],m=f.map(n=>n.startsWith("/")||n.includes(":")?n:`${o}/${n}`),h=t.debounce??500,l=t.cooldown??500,e=null,w=false,b$1=false,g=0,v=false,T=a(async()=>{if(w||b$1)return;let n=Date.now()-g;if(g>0&&n<l){let i=l-n;e&&clearTimeout(e),e=setTimeout(()=>{e=null,T();},i);return}b$1=true,v=false;try{if(t.buildCmd&&!await G(t.buildCmd,o)){if(b.warn("Build failed (see output above), skipping push"),t.notify){let{ringBell:a}=await import('./bell-YD6IWNXO.mjs');a(!0);}return}await r(),t.notify&&a$1(!0);}catch(i){b.error(`Push failed: ${i instanceof Error?i.message:String(i)}`),t.notify&&a$1(true);}finally{b$1=false,g=Date.now(),v&&!w&&(v=false,e=setTimeout(()=>{e=null,T();},l));}},"doBuild"),p=a(n=>{if(w)return;if(b$1){v=true;return}let i=Date.now()-g;if(g>0&&i<l){e&&clearTimeout(e);let a=l-i;e=setTimeout(()=>{e=null,T();},a+h);return}e&&clearTimeout(e),e=setTimeout(()=>{e=null,T();},h);},"onFileEvent"),D=t.buildCmd?false:t.awaitWriteFinish??{stabilityThreshold:200,pollInterval:50},P=!!process.versions?.webcontainer,y=s(m,{ignoreInitial:true,ignored:[/[/\\]node_modules[/\\]/,/[/\\]\.git[/\\]/,/[/\\]\.knarr[/\\]/],awaitWriteFinish:D,usePolling:P,...P&&{interval:1e3}});y.on("change",p),y.on("add",p),y.on("unlink",p),y.on("error",n=>{b.error(`Watcher error: ${n instanceof Error?n.message:String(n)}`);});let B=null;if(P){let n=await S(m);B=setInterval(async()=>{if(!w)try{let i=await S(m);for(let[a,E]of i){let C=n.get(a);if(C===void 0||C!==E){p(a);break}}if(!w){for(let a of n.keys())if(!i.has(a)){p(a);break}}n=i;}catch{}},1e3);}let W={close:a(async()=>{w=true,B&&clearInterval(B),e&&clearTimeout(e),x(),await y.close();},"close")};return b.info(`Watching for changes in: ${f.join(", ")}`),W}a(J,"startWatcher");function G(o,t){return new Promise(r=>{let s=platform()==="win32",f=s?"cmd":"sh",m=s?"/c":"-c";b.start(`Running: ${o}`);let h=spawn(f,[m,o],{cwd:t,stdio:"inherit"});d=h,h.on("close",l=>{d=null,l===0?(b.success("Build succeeded"),r(true)):(b.error(`Build failed with code ${l}`),r(false));}),h.on("error",l=>{d=null,b.error(`Build error: ${l.message}`),r(false);});})}a(G,"runBuildCommand");export{x as killActiveBuild,G as runBuildCommand,J as startWatcher};
@@ -0,0 +1,47 @@
1
+ interface Compiler {
2
+ options: {
3
+ snapshot?: {
4
+ managedPaths?: (string | RegExp)[];
5
+ };
6
+ context?: string;
7
+ };
8
+ hooks: {
9
+ afterEnvironment: {
10
+ tap(name: string, fn: () => void): void;
11
+ };
12
+ watchRun: {
13
+ tapPromise(name: string, fn: (compiler: Compiler) => Promise<void>): void;
14
+ };
15
+ afterCompile: {
16
+ tapPromise(name: string, fn: (compilation: Compilation) => Promise<void>): void;
17
+ };
18
+ watchClose: {
19
+ tap(name: string, fn: () => void): void;
20
+ };
21
+ };
22
+ watching?: {
23
+ invalidate(cb?: () => void): void;
24
+ };
25
+ }
26
+ interface Compilation {
27
+ contextDependencies: Set<string>;
28
+ }
29
+ interface KnarrWebpackPluginOptions {
30
+ /** Project root (default: compiler.options.context or cwd) */
31
+ root?: string;
32
+ }
33
+ /**
34
+ * Webpack/rspack plugin for knarr.
35
+ *
36
+ * - Excludes linked packages from webpack's snapshot cache (managedPaths)
37
+ * - Watches .knarr/state.json and linked package directories
38
+ * - Invalidates the compiler on changes to trigger a rebuild
39
+ * - Works with webpack 5 and rspack (uses loose typing, no webpack import)
40
+ */
41
+ declare class KnarrWebpackPlugin {
42
+ private options;
43
+ constructor(options?: KnarrWebpackPluginOptions);
44
+ apply(compiler: Compiler): void;
45
+ }
46
+
47
+ export { KnarrWebpackPlugin, type KnarrWebpackPluginOptions, KnarrWebpackPlugin as default };
@@ -0,0 +1,143 @@
1
+ // src/webpack-plugin.ts
2
+ import { join, normalize } from "path";
3
+ import { readFileSync } from "fs";
4
+ function readLinkedPackagesSync(stateFile) {
5
+ try {
6
+ const content = readFileSync(stateFile, "utf-8");
7
+ const state = JSON.parse(content);
8
+ return Object.keys(state.links ?? {});
9
+ } catch {
10
+ return [];
11
+ }
12
+ }
13
+ var KnarrWebpackPlugin = class {
14
+ options;
15
+ constructor(options = {}) {
16
+ this.options = options;
17
+ }
18
+ apply(compiler) {
19
+ const root = this.options.root ?? compiler.options.context ?? process.cwd();
20
+ const stateFile = normalize(join(root, ".knarr", "state.json"));
21
+ const nodeModulesDir = join(root, "node_modules");
22
+ let watcher = null;
23
+ let pollTimer;
24
+ let debounceTimer = null;
25
+ let lastStateContent = "";
26
+ const watchedPackages = /* @__PURE__ */ new Set();
27
+ const invalidate = () => {
28
+ if (debounceTimer) clearTimeout(debounceTimer);
29
+ debounceTimer = setTimeout(() => {
30
+ debounceTimer = null;
31
+ if (compiler.watching) {
32
+ compiler.watching.invalidate();
33
+ }
34
+ }, 200);
35
+ };
36
+ const syncPackages = () => {
37
+ let changed = false;
38
+ for (const pkg of readLinkedPackagesSync(stateFile)) {
39
+ if (!watchedPackages.has(pkg)) {
40
+ watchedPackages.add(pkg);
41
+ changed = true;
42
+ }
43
+ }
44
+ return changed;
45
+ };
46
+ compiler.hooks.afterEnvironment.tap("KnarrWebpackPlugin", () => {
47
+ syncPackages();
48
+ if (watchedPackages.size === 0) return;
49
+ const snapshot = compiler.options.snapshot ??= {};
50
+ const managedPaths = snapshot.managedPaths ??= [];
51
+ const escaped = [...watchedPackages].sort((a, b) => b.length - a.length).map((p) => p.replace(/[/\\.*+?^${}()|[\]]/g, "\\$&")).join("|");
52
+ const excludeRegex = new RegExp(
53
+ `node_modules[\\\\/](?!(?:${escaped})(?:[\\\\/]|$))`
54
+ );
55
+ const filtered = managedPaths.filter((p) => {
56
+ if (typeof p === "string") return !p.includes("node_modules");
57
+ return !p.source?.includes("node_modules");
58
+ });
59
+ filtered.push(excludeRegex);
60
+ snapshot.managedPaths = filtered;
61
+ });
62
+ compiler.hooks.watchRun.tapPromise(
63
+ "KnarrWebpackPlugin",
64
+ async () => {
65
+ if (watcher) return;
66
+ const usePolling = !!process.versions?.webcontainer;
67
+ if (usePolling) {
68
+ try {
69
+ lastStateContent = readFileSync(stateFile, "utf-8");
70
+ } catch {
71
+ }
72
+ pollTimer = setInterval(() => {
73
+ try {
74
+ const content = readFileSync(stateFile, "utf-8");
75
+ if (lastStateContent && content !== lastStateContent) {
76
+ lastStateContent = content;
77
+ syncPackages();
78
+ invalidate();
79
+ }
80
+ if (!lastStateContent) lastStateContent = content;
81
+ } catch {
82
+ }
83
+ }, 1e3);
84
+ }
85
+ const { watch } = await import("chokidar");
86
+ const watchPaths = [stateFile];
87
+ for (const pkg of watchedPackages) {
88
+ watchPaths.push(join(nodeModulesDir, pkg));
89
+ }
90
+ const chokidarWatcher = watch(watchPaths, {
91
+ ignoreInitial: true,
92
+ ignored: [/[/\\]\.git[/\\]/],
93
+ usePolling,
94
+ ...usePolling && { interval: 1e3 }
95
+ });
96
+ chokidarWatcher.on("change", (changedPath) => {
97
+ const normalized = normalize(changedPath);
98
+ if (normalized === stateFile) {
99
+ const changed = syncPackages();
100
+ if (changed) {
101
+ for (const pkg of watchedPackages) {
102
+ chokidarWatcher.add(join(nodeModulesDir, pkg));
103
+ }
104
+ }
105
+ }
106
+ invalidate();
107
+ });
108
+ chokidarWatcher.on("add", () => invalidate());
109
+ chokidarWatcher.on("unlink", () => invalidate());
110
+ watcher = {
111
+ close: () => chokidarWatcher.close()
112
+ };
113
+ }
114
+ );
115
+ compiler.hooks.afterCompile.tapPromise(
116
+ "KnarrWebpackPlugin",
117
+ async (compilation) => {
118
+ for (const pkg of watchedPackages) {
119
+ compilation.contextDependencies.add(join(nodeModulesDir, pkg));
120
+ }
121
+ }
122
+ );
123
+ compiler.hooks.watchClose.tap("KnarrWebpackPlugin", () => {
124
+ if (debounceTimer) {
125
+ clearTimeout(debounceTimer);
126
+ debounceTimer = null;
127
+ }
128
+ if (pollTimer) {
129
+ clearInterval(pollTimer);
130
+ pollTimer = void 0;
131
+ }
132
+ if (watcher) {
133
+ watcher.close();
134
+ watcher = null;
135
+ }
136
+ });
137
+ }
138
+ };
139
+ var webpack_plugin_default = KnarrWebpackPlugin;
140
+ export {
141
+ KnarrWebpackPlugin,
142
+ webpack_plugin_default as default
143
+ };
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {createRequire}from'node:module';export{e as buildReverseAdjacency,d as buildWorkspaceGraph,c as findWorkspacePackages,a as findWorkspaceRoot,b as parseCatalogs}from'./chunk-2EZDTBUU.mjs';import'./chunk-3KNUBUPH.mjs';import'./chunk-23HXXAGG.mjs';import'./chunk-NBSJGM2X.mjs';import'./chunk-B3DZ5HVQ.mjs';import'./chunk-2VCW5RWI.mjs';globalThis.require=createRequire(import.meta.url);
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import {createRequire}from'node:module';import {a}from'./chunk-2VCW5RWI.mjs';globalThis.require=createRequire(import.meta.url);
3
+ var j=new Uint8Array([0,97,115,109,1,0,0,0,1,48,8,96,3,127,127,127,1,127,96,3,127,127,127,0,96,2,127,127,0,96,1,127,1,127,96,3,127,127,126,1,126,96,3,126,127,127,1,126,96,2,127,126,0,96,1,127,1,126,3,11,10,0,0,2,1,3,4,5,6,1,7,5,3,1,0,1,7,85,9,3,109,101,109,2,0,5,120,120,104,51,50,0,0,6,105,110,105,116,51,50,0,2,8,117,112,100,97,116,101,51,50,0,3,8,100,105,103,101,115,116,51,50,0,4,5,120,120,104,54,52,0,5,6,105,110,105,116,54,52,0,7,8,117,112,100,97,116,101,54,52,0,8,8,100,105,103,101,115,116,54,52,0,9,10,251,22,10,242,1,1,4,127,32,0,32,1,106,33,3,32,1,65,16,79,4,127,32,3,65,16,107,33,6,32,2,65,168,136,141,161,2,106,33,3,32,2,65,137,235,208,208,7,107,33,4,32,2,65,207,140,162,142,6,106,33,5,3,64,32,3,32,0,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,3,32,4,32,0,65,4,106,34,0,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,4,32,2,32,0,65,4,106,34,0,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,2,32,5,32,0,65,4,106,34,0,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,5,32,6,32,0,65,4,106,34,0,79,13,0,11,32,2,65,12,119,32,5,65,18,119,106,32,4,65,7,119,106,32,3,65,1,119,106,5,32,2,65,177,207,217,178,1,106,11,32,1,106,32,0,32,1,65,15,113,16,1,11,146,1,0,32,1,32,2,106,33,2,3,64,32,1,65,4,106,32,2,75,69,4,64,32,0,32,1,40,2,0,65,189,220,202,149,124,108,106,65,17,119,65,175,214,211,190,2,108,33,0,32,1,65,4,106,33,1,12,1,11,11,3,64,32,1,32,2,79,69,4,64,32,0,32,1,45,0,0,65,177,207,217,178,1,108,106,65,11,119,65,177,243,221,241,121,108,33,0,32,1,65,1,106,33,1,12,1,11,11,32,0,32,0,65,15,118,115,65,247,148,175,175,120,108,34,0,65,13,118,32,0,115,65,189,220,202,149,124,108,34,0,65,16,118,32,0,115,11,63,0,32,0,65,8,106,32,1,65,168,136,141,161,2,106,54,2,0,32,0,65,12,106,32,1,65,137,235,208,208,7,107,54,2,0,32,0,65,16,106,32,1,54,2,0,32,0,65,20,106,32,1,65,207,140,162,142,6,106,54,2,0,11,195,4,1,6,127,32,1,32,2,106,33,6,32,0,65,24,106,33,4,32,0,65,40,106,40,2,0,33,3,32,0,32,0,40,2,0,32,2,106,54,2,0,32,0,65,4,106,34,5,32,5,40,2,0,32,2,65,16,79,32,0,40,2,0,65,16,79,114,114,54,2,0,32,2,32,3,106,65,16,73,4,64,32,3,32,4,106,32,1,32,2,252,10,0,0,32,0,65,40,106,32,2,32,3,106,54,2,0,15,11,32,3,4,64,32,3,32,4,106,32,1,65,16,32,3,107,34,2,252,10,0,0,32,0,65,8,106,34,3,32,3,40,2,0,32,4,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,54,2,0,32,0,65,12,106,34,3,32,3,40,2,0,32,4,65,4,106,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,54,2,0,32,0,65,16,106,34,3,32,3,40,2,0,32,4,65,8,106,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,54,2,0,32,0,65,20,106,34,3,32,3,40,2,0,32,4,65,12,106,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,54,2,0,32,0,65,40,106,65,0,54,2,0,32,1,32,2,106,33,1,11,32,1,32,6,65,16,107,77,4,64,32,6,65,16,107,33,8,32,0,65,8,106,40,2,0,33,2,32,0,65,12,106,40,2,0,33,3,32,0,65,16,106,40,2,0,33,5,32,0,65,20,106,40,2,0,33,7,3,64,32,2,32,1,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,2,32,3,32,1,65,4,106,34,1,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,3,32,5,32,1,65,4,106,34,1,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,5,32,7,32,1,65,4,106,34,1,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,7,32,8,32,1,65,4,106,34,1,79,13,0,11,32,0,65,8,106,32,2,54,2,0,32,0,65,12,106,32,3,54,2,0,32,0,65,16,106,32,5,54,2,0,32,0,65,20,106,32,7,54,2,0,11,32,1,32,6,73,4,64,32,4,32,1,32,6,32,1,107,34,1,252,10,0,0,32,0,65,40,106,32,1,54,2,0,11,11,97,1,1,127,32,0,65,16,106,40,2,0,33,1,32,0,65,4,106,40,2,0,4,127,32,1,65,12,119,32,0,65,20,106,40,2,0,65,18,119,106,32,0,65,12,106,40,2,0,65,7,119,106,32,0,65,8,106,40,2,0,65,1,119,106,5,32,1,65,177,207,217,178,1,106,11,32,0,40,2,0,106,32,0,65,24,106,32,0,65,40,106,40,2,0,16,1,11,255,3,2,3,126,1,127,32,0,32,1,106,33,6,32,1,65,32,79,4,126,32,6,65,32,107,33,6,32,2,66,214,235,130,238,234,253,137,245,224,0,124,33,3,32,2,66,177,169,172,193,173,184,212,166,61,125,33,4,32,2,66,249,234,208,208,231,201,161,228,225,0,124,33,5,3,64,32,3,32,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,3,32,4,32,0,65,8,106,34,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,4,32,2,32,0,65,8,106,34,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,2,32,5,32,0,65,8,106,34,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,5,32,6,32,0,65,8,106,34,0,79,13,0,11,32,2,66,12,137,32,5,66,18,137,124,32,4,66,7,137,124,32,3,66,1,137,124,32,3,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,32,4,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,32,2,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,32,5,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,5,32,2,66,197,207,217,178,241,229,186,234,39,124,11,32,1,173,124,32,0,32,1,65,31,113,16,6,11,134,2,0,32,1,32,2,106,33,2,3,64,32,2,32,1,65,8,106,79,4,64,32,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,32,0,133,66,27,137,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,33,0,32,1,65,8,106,33,1,12,1,11,11,32,1,65,4,106,32,2,77,4,64,32,0,32,1,53,2,0,66,135,149,175,175,152,182,222,155,158,127,126,133,66,23,137,66,207,214,211,190,210,199,171,217,66,126,66,249,243,221,241,153,246,153,171,22,124,33,0,32,1,65,4,106,33,1,11,3,64,32,1,32,2,73,4,64,32,0,32,1,49,0,0,66,197,207,217,178,241,229,186,234,39,126,133,66,11,137,66,135,149,175,175,152,182,222,155,158,127,126,33,0,32,1,65,1,106,33,1,12,1,11,11,32,0,32,0,66,33,136,133,66,207,214,211,190,210,199,171,217,66,126,34,0,32,0,66,29,136,133,66,249,243,221,241,153,246,153,171,22,126,34,0,32,0,66,32,136,133,11,77,0,32,0,65,8,106,32,1,66,214,235,130,238,234,253,137,245,224,0,124,55,3,0,32,0,65,16,106,32,1,66,177,169,172,193,173,184,212,166,61,125,55,3,0,32,0,65,24,106,32,1,55,3,0,32,0,65,32,106,32,1,66,249,234,208,208,231,201,161,228,225,0,124,55,3,0,11,244,4,2,3,127,4,126,32,1,32,2,106,33,5,32,0,65,40,106,33,4,32,0,65,200,0,106,40,2,0,33,3,32,0,32,0,41,3,0,32,2,173,124,55,3,0,32,2,32,3,106,65,32,73,4,64,32,3,32,4,106,32,1,32,2,252,10,0,0,32,0,65,200,0,106,32,2,32,3,106,54,2,0,15,11,32,3,4,64,32,3,32,4,106,32,1,65,32,32,3,107,34,2,252,10,0,0,32,0,65,8,106,34,3,32,3,41,3,0,32,4,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,55,3,0,32,0,65,16,106,34,3,32,3,41,3,0,32,4,65,8,106,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,55,3,0,32,0,65,24,106,34,3,32,3,41,3,0,32,4,65,16,106,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,55,3,0,32,0,65,32,106,34,3,32,3,41,3,0,32,4,65,24,106,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,55,3,0,32,0,65,200,0,106,65,0,54,2,0,32,1,32,2,106,33,1,11,32,1,65,32,106,32,5,77,4,64,32,5,65,32,107,33,2,32,0,65,8,106,41,3,0,33,6,32,0,65,16,106,41,3,0,33,7,32,0,65,24,106,41,3,0,33,8,32,0,65,32,106,41,3,0,33,9,3,64,32,6,32,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,6,32,7,32,1,65,8,106,34,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,7,32,8,32,1,65,8,106,34,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,8,32,9,32,1,65,8,106,34,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,9,32,2,32,1,65,8,106,34,1,79,13,0,11,32,0,65,8,106,32,6,55,3,0,32,0,65,16,106,32,7,55,3,0,32,0,65,24,106,32,8,55,3,0,32,0,65,32,106,32,9,55,3,0,11,32,1,32,5,73,4,64,32,4,32,1,32,5,32,1,107,34,1,252,10,0,0,32,0,65,200,0,106,32,1,54,2,0,11,11,188,2,1,5,126,32,0,65,24,106,41,3,0,33,1,32,0,41,3,0,34,2,66,32,90,4,126,32,0,65,8,106,41,3,0,34,3,66,1,137,32,0,65,16,106,41,3,0,34,4,66,7,137,124,32,1,66,12,137,32,0,65,32,106,41,3,0,34,5,66,18,137,124,124,32,3,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,32,4,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,32,1,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,32,5,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,5,32,1,66,197,207,217,178,241,229,186,234,39,124,11,32,2,124,32,0,65,40,106,32,2,66,31,131,167,16,6,11]);async function k(){return (function(x){let{exports:{mem:o,xxh32:d,xxh64:w,init32:S,update32:A,digest32:U,init64:m,update64:I,digest64:T}}=x,r=new Uint8Array(o.buffer);function i(t,n){if(o.buffer.byteLength<t+n){let y=Math.ceil((t+n-o.buffer.byteLength)/65536);o.grow(y),r=new Uint8Array(o.buffer);}}a(i,"g");function l(t,n,y,E,M,W){i(t);let s=new Uint8Array(t);return r.set(s),y(0,n),s.set(r.subarray(0,t)),{update(a){let b;return r.set(s),typeof a=="string"?(i(3*a.length,t),b=f.encodeInto(a,r.subarray(t)).written):(i(a.byteLength,t),r.set(a,t),b=a.byteLength),E(0,t,b),s.set(r.subarray(0,t)),this},digest:a(()=>(r.set(s),W(M(0))),"digest")}}a(l,"f");function h(t){return t>>>0}a(h,"y");let R=2n**64n-1n;function g(t){return t&R}a(g,"d");let f=new TextEncoder,u=0,c=0n;function p(t,n=u){return i(3*t.length,0),h(d(0,f.encodeInto(t,r).written,n))}a(p,"x");function L(t,n=c){return i(3*t.length,0),g(w(0,f.encodeInto(t,r).written,n))}return a(L,"L"),{h32:p,h32ToString:a((t,n=u)=>p(t,n).toString(16).padStart(8,"0"),"h32ToString"),h32Raw:a((t,n=u)=>(i(t.byteLength,0),r.set(t),h(d(0,t.byteLength,n))),"h32Raw"),create32:a((t=u)=>l(48,t,S,A,U,h),"create32"),h64:L,h64ToString:a((t,n=c)=>L(t,n).toString(16).padStart(16,"0"),"h64ToString"),h64Raw:a((t,n=c)=>(i(t.byteLength,0),r.set(t),g(w(0,t.byteLength,n))),"h64Raw"),create64:a((t=c)=>l(88,t,m,I,T,g),"create64")}})((await WebAssembly.instantiate(j)).instance)}a(k,"e");export{k as default};