knarr 0.0.1 → 0.0.2
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/LICENSE +20 -20
- package/dist/{add-ODK52RZI.mjs → add-S4U56IVA.mjs} +1 -1
- package/dist/bell-YD6IWNXO.mjs +0 -0
- package/dist/check-YVEJEI2G.mjs +0 -0
- package/dist/chokidar-LVDD2IK4.mjs +0 -0
- package/dist/chunk-2GDRDQA5.mjs +0 -0
- package/dist/chunk-2VCW5RWI.mjs +0 -0
- package/dist/chunk-37AAX47E.mjs +19 -0
- package/dist/chunk-3KNUBUPH.mjs +0 -0
- package/dist/{chunk-7DZPDPP6.mjs → chunk-5BZD55UB.mjs} +1 -1
- package/dist/chunk-6QHABEBL.mjs +14 -0
- package/dist/chunk-7HVPEBK5.mjs +0 -0
- package/dist/chunk-7JG555TZ.mjs +0 -0
- package/dist/chunk-7SDPRKFT.mjs +13 -0
- package/dist/chunk-B3DZ5HVQ.mjs +0 -0
- package/dist/chunk-BS4VKVYH.mjs +0 -0
- package/dist/chunk-CTJF2EWO.mjs +3 -0
- package/dist/{chunk-HQ7NKBQW.mjs → chunk-EE2UYGFD.mjs} +2 -2
- package/dist/chunk-GO6F6AGH.mjs +3 -0
- package/dist/chunk-GQYG5FCW.mjs +5 -0
- package/dist/chunk-KOHUNKHP.mjs +3 -0
- package/dist/{chunk-U5ZZAYNU.mjs → chunk-LXGALE74.mjs} +2 -2
- package/dist/chunk-MBKCCWSD.mjs +0 -0
- package/dist/chunk-NBSJGM2X.mjs +0 -0
- package/dist/chunk-OPLSUHCD.mjs +4 -0
- package/dist/chunk-QGLOGD5G.mjs +3 -0
- package/dist/chunk-SFLWVTJC.mjs +0 -0
- package/dist/{chunk-XQVMCMO7.mjs → chunk-SN4TOUQW.mjs} +3 -3
- package/dist/chunk-SYADAYF4.mjs +0 -0
- package/dist/chunk-TEFMLGCB.mjs +0 -0
- package/dist/{chunk-2EZDTBUU.mjs → chunk-UBGMLVMB.mjs} +2 -2
- package/dist/{chunk-FU7FCNTW.mjs → chunk-XKO24LUM.mjs} +2 -2
- package/dist/chunk-XQPVRRTN.mjs +0 -0
- package/dist/{chunk-FUINO5RD.mjs → chunk-ZJEEAMB3.mjs} +2 -2
- package/dist/clean-ZD5GPGXQ.mjs +3 -0
- package/dist/cli.mjs +1 -1
- package/dist/{dev-7L35BV6M.mjs → dev-TMWMIT7W.mjs} +2 -2
- package/dist/doctor-AXP7GVBM.mjs +4 -0
- package/dist/fs-2NITBGIO.mjs +2 -0
- package/dist/{history-XUZSDCNE.mjs → history-SKKGT225.mjs} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +239 -140
- package/dist/{init-OBJFQ6OB.mjs → init-XK4B7XYG.mjs} +4 -4
- package/dist/{list-AQKUBZ2I.mjs → list-GLSA6I67.mjs} +2 -2
- package/dist/migrate-MW4BVLL2.mjs +8 -0
- package/dist/preflight-TVJFHRI2.mjs +0 -0
- package/dist/publish-TAWTHPSD.mjs +3 -0
- package/dist/{push-NHCPN6MO.mjs → push-65ZZFZJY.mjs} +2 -2
- package/dist/remove-LOBXHBMC.mjs +2 -0
- package/dist/reset-EAN5NVGM.mjs +3 -0
- package/dist/{restore-YGPO42W4.mjs → restore-YHZYT54B.mjs} +3 -3
- package/dist/rollback-U3LQTWH5.mjs +3 -0
- package/dist/{status-3VUPPR5D.mjs → status-FA6UEHEF.mjs} +3 -3
- package/dist/tailwind-source-RIWWXW2Y.mjs +5 -0
- package/dist/topo-sort-WEIVPJKN.mjs +0 -0
- package/dist/{tracker-R4ZZIDJV.mjs → tracker-JJEYXX45.mjs} +1 -1
- package/dist/update-VOUKMOLK.mjs +3 -0
- package/dist/{use-NKLXGPIZ.mjs → use-DUZYEUVU.mjs} +1 -1
- package/dist/{vite-config-URP2SYRQ.mjs → vite-config-UWCLPTOZ.mjs} +1 -1
- package/dist/watch-orchestrator-I2623SMT.mjs +3 -0
- package/dist/watcher-PTPUN2HE.mjs +0 -0
- package/dist/{workspace-L5CGPK7U.mjs → workspace-S3TAUSS3.mjs} +1 -1
- package/dist/xxhash-wasm-DTW44IIQ.mjs +0 -0
- package/package.json +1 -1
- package/dist/chunk-23HXXAGG.mjs +0 -5
- package/dist/chunk-2QPLXLJW.mjs +0 -3
- package/dist/chunk-IM555H3S.mjs +0 -4
- package/dist/chunk-KXLQGVT2.mjs +0 -13
- package/dist/chunk-OLUZ7T7G.mjs +0 -3
- package/dist/chunk-OXI2KGCW.mjs +0 -14
- package/dist/chunk-V2ED74ZQ.mjs +0 -3
- package/dist/chunk-YZCBBQCH.mjs +0 -19
- package/dist/chunk-Z22BYXWQ.mjs +0 -3
- package/dist/clean-XMLDIZDZ.mjs +0 -3
- package/dist/doctor-4TTAYNGW.mjs +0 -4
- package/dist/fs-35635IS7.mjs +0 -2
- package/dist/migrate-7B7ACQHY.mjs +0 -8
- package/dist/publish-Q4JYQPQP.mjs +0 -3
- package/dist/remove-PDERBH66.mjs +0 -2
- package/dist/reset-3FXWAAPQ.mjs +0 -3
- package/dist/rollback-FKNGLGFC.mjs +0 -3
- package/dist/tailwind-source-ND5FE6PQ.mjs +0 -5
- package/dist/update-QPBWYDSG.mjs +0 -3
- package/dist/watch-orchestrator-F6S5WQQX.mjs +0 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
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-
|
|
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-7SDPRKFT.mjs';import {a as a$4,d}from'./chunk-EE2UYGFD.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-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import {I,H as H$1,F,y}from'./chunk-GQYG5FCW.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}from'fs/promises';globalThis.require=createRequire(import.meta.url);
|
|
3
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
|
|
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 H$1(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 h(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 H$1(y$1))await F(y$1),await I(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-UWCLPTOZ.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
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()&&
|
|
7
|
-
`),true}a$1(
|
|
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()&&y();}};async function h(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 I(o,JSON.stringify(a,null,u)+`
|
|
7
|
+
`),true}a$1(h,"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 h(o,"knarr:publish","knarr publish")&&n.push("knarr:publish"),await h(o,"knarr:dev","knarr dev")&&n.push("knarr:dev"),n}a$1(L,"addLibraryScripts");export{ae as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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-
|
|
2
|
+
import {createRequire}from'node:module';import {a as a$4}from'./chunk-2GDRDQA5.mjs';import {b as b$1,d}from'./chunk-CTJF2EWO.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-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import {b as b$2}from'./chunk-QGLOGD5G.mjs';import {v,J}from'./chunk-GQYG5FCW.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
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=
|
|
4
|
+
`);let c=v(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=v(8),r=await Promise.all(n.map(t=>c(()=>J(t.packageDir)))),e=r.reduce((t,o)=>t+o,0);b.info(`Store entries (${n.length}, ${a$4(e)} total):
|
|
5
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 {H as H$1,I,E,x,y}from'./chunk-GQYG5FCW.mjs';import {b as b$2}from'./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}from'fs/promises';globalThis.require=createRequire(import.meta.url);
|
|
3
|
+
var t=c(a(),1);var H={meta:{name:"migrate",description:"Migrate from yalc to Knarr"},args:{yes:{type:"boolean",alias:"y",description:"Skip confirmation prompts",default:false}},async run({args:L}){b();let u=new a$1,s=resolve(".");b$1.info(`Checking for yalc usage...
|
|
4
|
+
`);let k=join(s,".yalc"),r=join(s,"yalc.lock"),l=join(s,"package.json"),h=await H$1(k),p=await H$1(r);if(!h&&!p){b$1.info("No yalc usage detected in this project."),a$2({migrated:false,packages:[]});return}if(!L.yes){let o=await b$1.prompt("Migrate from yalc to Knarr? This will modify package.json and remove .yalc/ and yalc.lock.",{type:"confirm"});if(!o||typeof o=="symbol"){b$1.info("Cancelled");return}}let a=[];if(p)try{let o=await readFile(r,"utf-8"),n=JSON.parse(o);n.packages&&(a.push(...Object.keys(n.packages)),b$1.info(`Found ${a.length} yalc-linked package(s): ${a.map(i=>t.default.cyan(i)).join(", ")}`));}catch{b$1.warn("Could not parse yalc.lock \u2014 the file may be corrupted. Continuing with cleanup.");}if(await H$1(l))try{let o=await readFile(l,"utf-8"),n=JSON.parse(o),i=!1;for(let f of ["dependencies","devDependencies","peerDependencies"]){let m=n[f];if(m)for(let[w,v]of Object.entries(m))typeof v=="string"&&v.includes(".yalc/")&&(delete m[w],i=!0,b$1.info(`Removed file:.yalc/ reference for ${t.default.cyan(w)}`));}if(i){let f=o.match(/^(\s+)"/m)?.[1]||" ";await I(l,JSON.stringify(n,null,f)+`
|
|
5
|
+
`),b$1.success("Cleaned up package.json");}}catch(o){b$1.warn(`Could not clean package.json: ${o instanceof Error?o.message:String(o)}. You may need to manually remove file:.yalc/ references.`);}if(h&&(await E(k),b$1.success("Removed .yalc/ directory")),p){if(b$2())x({type:"remove",path:r});else {let{rm:o}=await import('fs/promises');await o(r,{force:true});}b$1.success("Removed yalc.lock");}if(b$1.log(""),b$1.info(`${t.default.bold("Migration complete!")} Next steps:
|
|
6
|
+
`),b$1.log(` 1. ${t.default.cyan("knarr init")}`),a.length>0)for(let o of a)b$1.log(` 2. ${t.default.cyan(`knarr add ${o} --from <path-to-${o}>`)}`);b$1.log(`
|
|
7
|
+
Run ${t.default.cyan("knarr doctor")} to verify your setup.
|
|
8
|
+
`),b$1.info(`Migrated in ${u.elapsed()}`),a$2({migrated:true,packages:a,elapsed:u.elapsedMs()}),b$2()&&y();}};export{H as default};
|
|
File without changes
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {createRequire}from'node:module';import {a as a$2}from'./chunk-OPLSUHCD.mjs';import'./chunk-CTJF2EWO.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-GO6F6AGH.mjs';import'./chunk-3KNUBUPH.mjs';import {v,y}from'./chunk-GQYG5FCW.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=v(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}){b();let m=new a,i=resolve(r.dir||"."),h={allowPrivate:r.private,runScripts:!r["no-scripts"]};if(!r["no-check"]&&!r.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.recursive){d(`[publish] Discovering workspace packages from ${i}`);let{findWorkspacePackages:e}=await import('./workspace-S3TAUSS3.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()&&y();}};export{O as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$1}from'./chunk-
|
|
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()&&
|
|
2
|
+
import {createRequire}from'node:module';import {a as a$1}from'./chunk-5BZD55UB.mjs';import'./chunk-SYADAYF4.mjs';import {a,e,b as b$1,c}from'./chunk-XKO24LUM.mjs';import'./chunk-OPLSUHCD.mjs';import'./chunk-CTJF2EWO.mjs';import'./chunk-37AAX47E.mjs';import'./chunk-TEFMLGCB.mjs';import'./chunk-7JG555TZ.mjs';import'./chunk-EE2UYGFD.mjs';import'./chunk-MBKCCWSD.mjs';import {b}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import'./chunk-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import'./chunk-UBGMLVMB.mjs';import'./chunk-3KNUBUPH.mjs';import {y}from'./chunk-GQYG5FCW.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()&&y();}};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-ZJEEAMB3.mjs';import'./chunk-SN4TOUQW.mjs';import'./chunk-37AAX47E.mjs';import'./chunk-TEFMLGCB.mjs';import'./chunk-LXGALE74.mjs';import'./chunk-EE2UYGFD.mjs';import'./chunk-MBKCCWSD.mjs';import'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import'./chunk-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import'./chunk-GQYG5FCW.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-ZJEEAMB3.mjs';import'./chunk-SN4TOUQW.mjs';import'./chunk-37AAX47E.mjs';import'./chunk-TEFMLGCB.mjs';import'./chunk-LXGALE74.mjs';import {c}from'./chunk-7SDPRKFT.mjs';import'./chunk-EE2UYGFD.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-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import {q,H,E,y}from'./chunk-GQYG5FCW.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=q(o);if(!await H(c$1)){b$1.info("No Knarr setup found in this project"),a$1({reset:false});return}let j=await a$2(o),t=Object.entries(j.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 E(c$1),b$1.success("Removed .knarr/ directory");let l=join(o,"package.json");await H(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()&&y();}};export{M as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {b as b$3}from'./chunk-
|
|
3
|
-
var D=
|
|
2
|
+
import {createRequire}from'node:module';import {b as b$3}from'./chunk-CTJF2EWO.mjs';import {a as a$4}from'./chunk-37AAX47E.mjs';import {a as a$2,b as b$1,c}from'./chunk-EE2UYGFD.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-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import {v,y}from'./chunk-GQYG5FCW.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=v(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
4
|
|
|
5
5
|
Knarr works by copying files into node_modules/, but PnP eliminates
|
|
6
6
|
node_modules/ entirely. To use Knarr with Yarn Berry, add this to
|
|
@@ -8,4 +8,4 @@ node_modules/ entirely. To use Knarr with Yarn Berry, add this to
|
|
|
8
8
|
|
|
9
9
|
nodeLinker: node-modules
|
|
10
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()&&
|
|
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()&&y();}};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-XKO24LUM.mjs';import'./chunk-OPLSUHCD.mjs';import'./chunk-CTJF2EWO.mjs';import'./chunk-37AAX47E.mjs';import {a as a$1}from'./chunk-TEFMLGCB.mjs';import'./chunk-7JG555TZ.mjs';import'./chunk-EE2UYGFD.mjs';import'./chunk-MBKCCWSD.mjs';import {b,a as a$2}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import'./chunk-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import {b as b$1,g,d}from'./chunk-QGLOGD5G.mjs';import'./chunk-3KNUBUPH.mjs';import {y}from'./chunk-GQYG5FCW.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;if(a["build-id"]){if(r=a["build-id"],!t.find(n=>n.buildId===r)){b$2.error(`Build ${r} 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=t[0].buildId;let v=t.find(e=>e.buildId===r);if(!a.yes){let e=await b$2.prompt(`Restore build ${r} (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,w)){b$2.error(`Failed to restore build ${r}`),a$2({rolledBack:false});return}b$2.success(`Restored ${i.name}@${i.version} to build ${r}`);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}),b$4()&&y();}};export{F as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {b as b$2}from'./chunk-
|
|
3
|
-
var o=c(a(),1);var y=
|
|
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
|
|
2
|
+
import {createRequire}from'node:module';import {b as b$2}from'./chunk-CTJF2EWO.mjs';import {b,a as a$2}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import {a as a$1}from'./chunk-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import {v,H}from'./chunk-GQYG5FCW.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=v(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 H(f)||e.push("missing from node_modules (run knarr restore)"),await H(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 {t,I}from'./chunk-GQYG5FCW.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$1){let n;try{n=await readdir(t$1,{recursive:!0,encoding:"utf-8"});}catch{return null}let r=n.filter(e=>e.endsWith(".css")?!t(e).split("/").some(c=>x.has(c)):false).map(e=>join(t$1,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 I(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 I(t,r),{modified:true}):{modified:false}}a(v,"removeTailwindSource");function y(t$1,n,r){let e=dirname(t$1),i=join(r,"node_modules",n);return t(relative(e,i))}a(y,"computeSourcePath");export{_ as addTailwindSource,P as findTailwindCss,v as removeTailwindSource};
|
|
File without changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
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-
|
|
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-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import'./chunk-GQYG5FCW.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-CTJF2EWO.mjs';import {a as a$4}from'./chunk-37AAX47E.mjs';import {a as a$3}from'./chunk-TEFMLGCB.mjs';import'./chunk-EE2UYGFD.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-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import {v,f}from'./chunk-GQYG5FCW.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=v(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$1=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$2=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 f(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$2++:t==="skipped"?c$1++:t==="missing"?o++:a$5++;let m=[`${d$2} 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$1.elapsed()}`),a$2({updated:d$2,skipped:c$1,missing:o,failed:a$5,elapsed:f$1.elapsedMs()});}};export{z as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {b as b$1,a as a$1}from'./chunk-
|
|
2
|
+
import {createRequire}from'node:module';import {b as b$1,a as a$1}from'./chunk-6QHABEBL.mjs';import'./chunk-OPLSUHCD.mjs';import'./chunk-CTJF2EWO.mjs';import'./chunk-SN4TOUQW.mjs';import'./chunk-37AAX47E.mjs';import'./chunk-TEFMLGCB.mjs';import'./chunk-LXGALE74.mjs';import'./chunk-7SDPRKFT.mjs';import'./chunk-EE2UYGFD.mjs';import {a}from'./chunk-MBKCCWSD.mjs';import {b}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import'./chunk-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import'./chunk-3KNUBUPH.mjs';import'./chunk-GQYG5FCW.mjs';import'./chunk-NBSJGM2X.mjs';import'./chunk-B3DZ5HVQ.mjs';import'./chunk-2VCW5RWI.mjs';import {resolve}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';export{b as addKnarrVitePlugin,a as isComplexConfig,c as removeFromViteConfig}from'./chunk-
|
|
2
|
+
import {createRequire}from'node:module';export{b as addKnarrVitePlugin,a as isComplexConfig,c as removeFromViteConfig}from'./chunk-LXGALE74.mjs';import'./chunk-GQYG5FCW.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$1,d,b as b$2}from'./chunk-XKO24LUM.mjs';import'./chunk-OPLSUHCD.mjs';import'./chunk-CTJF2EWO.mjs';import'./chunk-37AAX47E.mjs';import'./chunk-TEFMLGCB.mjs';import'./chunk-7JG555TZ.mjs';import'./chunk-EE2UYGFD.mjs';import'./chunk-MBKCCWSD.mjs';import'./chunk-BS4VKVYH.mjs';import'./chunk-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import'./chunk-3KNUBUPH.mjs';import {v}from'./chunk-GQYG5FCW.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=v(2),b=class{static{a(this,"WatchOrchestrator");}packages=new Map;dependents=new Map;cascade;pushOptions={};constructor(t){this.cascade=t;}async start(t,e,a$2){this.pushOptions=a$2;let{buildWorkspaceGraph:c,buildReverseAdjacency:y}=await import('./workspace-S3TAUSS3.mjs'),{topoSort:v,CycleError:C}=await import('./topo-sort-WEIVPJKN.mjs'),{startWatcher:$}=await import('./watcher-PTPUN2HE.mjs'),d$1=await c(t);if(d$1.packages.length===0){b$1.warn("No workspace packages found");return}let g;try{g=v(d$1.adjacency);}catch(s){if(s instanceof C){b$1.error(`Cannot watch: ${s.message}`);return}throw s}this.cascade&&(this.dependents=y(d$1.adjacency),b$1.info("Cascade mode enabled"));let q=new Map(d$1.packages.map(s=>[s.name,s.dir]));for(let s of g){let i=q.get(s);if(!i)continue;let p=await a$1(i),{buildCmd:l,patterns:S}=await d(i,e,p),R=e.notify??p.notify??false,j=a(async()=>{await b$2(i,a$2),await this.onPackagePushed(s);},"wrappedOnChange"),h=a(f=>{if(!f)return;let w=parseInt(f,10);return Number.isFinite(w)?w:void 0},"parseMs"),E=await $(i,{patterns:S,buildCmd:l,debounce:h(e.debounce)??p.debounce,cooldown:h(e.cooldown)??p.cooldown,notify:R},j);this.packages.set(s,{dir:i,buildCmd:l,state:"idle",watcher:E});}b$1.info(`Watching ${this.packages.size} workspace packages`),await new Promise(s=>{let i=a(async()=>{b$1.info("Stopping watchers..."),await this.close(),s();},"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 a=[...e].map(c=>M(()=>this.requestRebuild(c)));await Promise.all(a);}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{if(e.buildCmd){let{runBuildCommand:a}=await import('./watcher-PTPUN2HE.mjs');if(!await a(e.buildCmd,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(a){b$1.warn(`[cascade] Push failed for ${t}: ${a instanceof Error?a.message:String(a)}`);}finally{let a=e.state==="queued";e.state="idle",a&&await this.requestRebuild(t);}}}async close(){await Promise.all([...this.packages.values()].map(t=>t.watcher.close())),this.packages.clear();}};export{b as WatchOrchestrator};
|
|
File without changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
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-
|
|
2
|
+
import {createRequire}from'node:module';export{e as buildReverseAdjacency,d as buildWorkspaceGraph,c as findWorkspacePackages,a as findWorkspaceRoot,b as parseCatalogs}from'./chunk-UBGMLVMB.mjs';import'./chunk-3KNUBUPH.mjs';import'./chunk-GQYG5FCW.mjs';import'./chunk-NBSJGM2X.mjs';import'./chunk-B3DZ5HVQ.mjs';import'./chunk-2VCW5RWI.mjs';globalThis.require=createRequire(import.meta.url);
|
|
File without changes
|
package/package.json
CHANGED
package/dist/chunk-23HXXAGG.mjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {d,c,b as b$1}from'./chunk-NBSJGM2X.mjs';import {b}from'./chunk-B3DZ5HVQ.mjs';import {a}from'./chunk-2VCW5RWI.mjs';import {stat,readFile,mkdir,copyFile,constants,readdir,utimes,rm,rename,cp,writeFile}from'fs/promises';import {join,relative,parse,dirname}from'path';import {availableParallelism,homedir}from'os';import {createHash}from'crypto';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
function $(t){let e=0,n=[],i=0,o=a(()=>{i<n.length&&e<t&&(e++,n[i++]()),i>0&&i===n.length&&(n.length=0,i=0);},"next");return l=>new Promise((u,f)=>{let y=a(()=>{l().then(a=>{e--,u(a),o();},a=>{e--,f(a),o();});},"run");e<t?(e++,y()):n.push(y);})}a($,"pLimit");function B(){return process.env.KNARR_HOME||join(homedir(),".knarr")}a(B,"getKnarrHome");function et(){return join(B(),"store")}a(et,"getStorePath");function vt(){return join(B(),"consumers.json")}a(vt,"getConsumersPath");function W(t){return t.replace(/\//g,"+")}a(W,"encodePackageName");function kt(t){if(t.startsWith("@")){let e=t.indexOf("+");if(e!==-1)return t.slice(0,e)+"/"+t.slice(e+1)}return t}a(kt,"decodePackageName");function I(t,e){return join(et(),`${W(t)}@${e}`)}a(I,"getStoreEntryPath");function $t(t,e){return join(I(t,e),"package")}a($t,"getStorePackagePath");function Mt(t,e){return join(I(t,e),".knarr-meta.json")}a(Mt,"getStoreMetaPath");function rt(t,e){return join(I(t,e),"history")}a(rt,"getStoreHistoryPath");function Ct(t,e,n){return join(rt(t,e),n)}a(Ct,"getHistoryEntryPath");function bt(t){return join(t,".knarr")}a(bt,"getConsumerKnarrDir");function Rt(t){return join(t,".knarr","state.json")}a(Rt,"getConsumerStatePath");function Et(t,e){return join(t,".knarr","backups",W(e))}a(Et,"getConsumerBackupPath");function E(t){return t.replace(/\\/g,"/")}a(E,"normalizePath");function St(t,e){return join(t,"node_modules",e)}a(St,"getNodeModulesPackagePath");var S=null;function ot(){return S||(S=import('./xxhash-wasm-DTW44IIQ.mjs').then(t=>t.default()).catch(t=>{throw S=null,t})),S}a(ot,"getXXHash");var st=1024*1024,at=$(Math.max(availableParallelism(),8)),z=new Map;async function Lt(t,e){let n=[...t].sort((a,g)=>{let d=E(relative(e,a)),h=E(relative(e,g));return d.localeCompare(h)}),i=new Set(n),o=0,l=await Promise.all(n.map(a=>at(async()=>{let g=E(relative(e,a)),d=await stat(a),h=z.get(a);if(h&&h.mtimeMs===d.mtimeMs&&h.size===d.size)return o++,{rel:g,content:h.content};let s=await readFile(a);return z.set(a,{mtimeMs:d.mtimeMs,size:d.size,content:s}),{rel:g,content:s}})));for(let a of z.keys())i.has(a)||z.delete(a);d(`[hash] Computing content hash for ${t.length} files (${o} cached)`);let u=createHash("sha256"),f=Buffer.alloc(4);for(let{rel:a,content:g}of l)u.update(a),u.update("\0"),f.writeUInt32LE(g.length),u.update(f),u.update(g);let y="sha256v2:"+u.digest("hex");return d(`[hash] Result: ${y.slice(0,20)}...`),y}a(Lt,"computeContentHash");async function O(t,e){let n=e??(await stat(t)).size,i=await ot();if(n>st)return ct(t,i);let o=await readFile(t);return i.h64Raw(o).toString(16)}a(O,"hashFile");async function ct(t,e){let{createReadStream:n}=await import('fs'),i=e.create64();return new Promise((o,l)=>{let u=n(t);u.on("data",f=>i.update(f)),u.on("end",()=>o(i.digest().toString(16))),u.on("error",l);})}a(ct,"hashFileStream");var M=[];function P(t){M.push(t);}a(P,"recordMutation");function Wt(){if(M.length===0){b.info("[dry-run] No mutations would be performed");return}if(c()){console.log(JSON.stringify({dryRun:true,mutations:M},null,2));return}let t=new Map;for(let n of M){let i=t.get(n.type);i||(i=[],t.set(n.type,i)),i.push(n);}b.info(`
|
|
4
|
-
[dry-run] ${M.length} mutation(s) would be performed:
|
|
5
|
-
`);let e={copy:"Copy",remove:"Remove",move:"Move",mkdir:"Create directory",write:"Write file","bin-link":"Create bin link","bin-unlink":"Remove bin link","cache-invalidate":"Invalidate cache","lock-skip":"Skip lock","lifecycle-skip":"Skip lifecycle hook"};for(let[n,i]of t){b.info(` ${e[n]} (${i.length}):`);for(let o of i.slice(0,20)){let l=o.dest?` \u2192 ${o.dest}`:"",u=o.detail?` (${o.detail})`:"";b.info(` ${o.path}${l}${u}`);}i.length>20&&b.info(` ... and ${i.length-20} more`);}}a(Wt,"printDryRunReport");var q=$(Math.max(availableParallelism(),8));function D(t){return t instanceof Error&&"code"in t}a(D,"isNodeError");var X=new Map;function ht(t){let{root:e}=parse(t);return e||"/"}a(ht,"volumeRoot");async function yt(t,e,n){if(b$1()){d(`[dry-run] would copy ${t} \u2192 ${e}`),P({type:"copy",path:t,dest:e});return}n?.ensureParent!==false&&await mkdir(dirname(e),{recursive:true});let i=ht(e),o=X.get(i);if(o===false){await copyFile(t,e);return}if(o===true){await copyFile(t,e,constants.COPYFILE_FICLONE);return}try{await copyFile(t,e,constants.COPYFILE_FICLONE_FORCE),X.set(i,!0);}catch{X.set(i,false),d(`[copy] reflink not supported on ${i}, using plain copy`),await copyFile(t,e);}}a(yt,"copyWithCoW");async function L(t){return (await readdir(t,{recursive:true,withFileTypes:true})).filter(n=>n.isFile()).map(n=>join(n.parentPath,n.name))}a(L,"collectFiles");async function ee(t,e,n={}){let i=L(t),o=L(e).catch(s=>{if(D(s)&&s.code==="ENOENT")return [];throw s}),[l,u]=await Promise.all([i,o]),f=0,y=0,a=0,g=await Promise.all(l.map(s=>q(async()=>{let x=relative(t,s),b=join(e,x),F=true,k=null;if(n.force)d(`[copy] ${x} (forced)`);else try{let[m,R]=await Promise.all([stat(s),stat(b)]);if(k={atime:m.atime,mtime:m.mtime},m.size!==R.size)d(`[copy] ${x} (size differs: ${m.size} vs ${R.size})`);else if(m.mtimeMs===R.mtimeMs)F=!1,d(`[skip] ${x} (size+mtime match)`);else {let[Q,Z]=await Promise.all([O(s,m.size),O(b,R.size)]);Q===Z?(F=!1,d(`[skip] ${x} (unchanged)`)):d(`[copy] ${x} (hash differs)`);}}catch(m){if(D(m)&&m.code==="ENOENT")d(`[copy] ${x} (new file)`);else throw m}if(F){if(await yt(s,b),!k){let m=await stat(s);k={atime:m.atime,mtime:m.mtime};}return await utimes(b,k.atime,k.mtime),"copied"}return "skipped"})));for(let s of g)s==="copied"?f++:a++;let d$1=new Set(l.map(s=>relative(t,s))),h=u.filter(s=>!d$1.has(relative(e,s)));return await Promise.all(h.map(s=>q(async()=>{d(`[remove] ${relative(e,s)} (no longer in source)`),b$1()?P({type:"remove",path:s}):await rm(s);}))),y=h.length,{copied:f,removed:y,skipped:a}}a(ee,"incrementalCopy");async function re(t,e){if(b$1()){d(`[dry-run] would move ${t} \u2192 ${e}`),P({type:"move",path:t,dest:e});return}try{await rename(t,e);}catch(n){if(D(n)&&n.code==="EXDEV")await cp(t,e,{recursive:true}),await rm(t,{recursive:true,force:true});else throw n}}a(re,"moveDir");async function ne(t){if(b$1()){d(`[dry-run] would remove ${t}`),P({type:"remove",path:t});return}await rm(t,{recursive:true,force:true});}a(ne,"removeDir");async function ie(t){if(b$1()){d(`[dry-run] would ensure dir ${t}`),P({type:"mkdir",path:t});return}await mkdir(t,{recursive:true});}a(ie,"ensureDir");async function oe(t){if(b$1()){d(`[dry-run] would ensure private dir ${t}`),P({type:"mkdir",path:t});return}await mkdir(t,{recursive:true,mode:448});}a(oe,"ensurePrivateDir");async function se(t){try{return await stat(t),!0}catch{return false}}a(se,"exists");async function ae(t,e){if(b$1()){d(`[dry-run] would write ${t}`),P({type:"write",path:t});return}let n=t+`.tmp-${process.pid}-${Date.now()}`;await writeFile(n,e),await rename(n,t);}a(ae,"atomicWriteFile");async function ce(t){try{let e=await L(t);return (await Promise.all(e.map(i=>stat(i).then(o=>o.size).catch(()=>0)))).reduce((i,o)=>i+o,0)}catch{return 0}}a(ce,"dirSize");async function ue(t,e){await cp(t,e,{recursive:true});}a(ue,"copyDir");export{se as A,ae as B,ce as C,ue as D,et as a,vt as b,W as c,kt as d,I as e,$t as f,Mt as g,rt as h,Ct as i,bt as j,Rt as k,Et as l,E as m,St as n,$ as o,Lt as p,P as q,Wt as r,D as s,yt as t,L as u,ee as v,re as w,ne as x,ie as y,oe as z};
|
package/dist/chunk-2QPLXLJW.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {h,i,A as A$1,y,w,x as x$1,e}from'./chunk-23HXXAGG.mjs';import {d}from'./chunk-NBSJGM2X.mjs';import {a}from'./chunk-2VCW5RWI.mjs';import {readFile,writeFile,rename,readdir}from'fs/promises';import {join}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var E=3;async function x(i$1,a,r,o){let n=join(r,".knarr-meta.json"),t;try{t=JSON.parse(await readFile(n,"utf-8"));}catch{d(`[history] Could not read meta from ${n}, skipping history capture`);return}let e=t.buildId;if(!e){d("[history] No buildId in meta, skipping history capture");return}let u=h(i$1,a),c=i(i$1,a,e);if(await A$1(c)){d(`[history] Build ${e} already in history, skipping`);return}await y(u);let l=c+`.tmp-${process.pid}`;try{await y(l);let y$1=join(r,"package");await A$1(y$1)&&await w(y$1,join(l,"package")),await writeFile(join(l,".knarr-meta.json"),JSON.stringify(t,null,2)),await rename(l,c),d(`[history] Captured build ${e} to history`);}catch(y){d(`[history] Failed to capture history: ${y instanceof Error?y.message:String(y)}`),await x$1(l);}await M(i$1,a,o??E);}a(x,"captureHistory");async function S(i,a){let r=h(i,a);if(!await A$1(r))return [];let o;try{o=await readdir(r);}catch{return []}let n=[];for(let t of o){let e=join(r,t),u=join(e,".knarr-meta.json");try{let c=JSON.parse(await readFile(u,"utf-8"));n.push({buildId:c.buildId??t,contentHash:c.contentHash,publishedAt:c.publishedAt,sourcePath:c.sourcePath,packageDir:join(e,"package")});}catch{}}return n.sort((t,e)=>new Date(e.publishedAt).getTime()-new Date(t.publishedAt).getTime()),n}a(S,"listHistory");async function A(i$1,a,r){let o=i(i$1,a,r),n=join(o,".knarr-meta.json");try{let t=JSON.parse(await readFile(n,"utf-8"));return {buildId:t.buildId??r,contentHash:t.contentHash,publishedAt:t.publishedAt,sourcePath:t.sourcePath,packageDir:join(o,"package")}}catch{return null}}a(A,"getHistoryEntry");async function J(i$1,a,r,o){let n=await A(i$1,a,r);if(!n)return null;let t=e(i$1,a),e$1=i(i$1,a,r),u=join(e$1,"package"),c=join(e$1,".knarr-meta.json"),l=await readFile(c,"utf-8");await A$1(t)&&await x(i$1,a,t,o);let f=join(t,"package"),y=join(t,".knarr-meta.json");return await A$1(f)&&await x$1(f),await A$1(u)&&await w(u,f),await writeFile(y,l),await x$1(e$1),d(`[history] Restored build ${r} as current`),n}a(J,"restoreHistoryEntry");async function M(i$1,a,r){if(r<0)return 0;let o=await S(i$1,a);if(o.length<=r)return 0;let n=o.slice(r),t=0;for(let e of n){let u=i(i$1,a,e.buildId);try{await x$1(u),t++,d(`[history] Pruned old build ${e.buildId}`);}catch{}}return t}a(M,"pruneHistory");async function K(i,a){let r=h(i,a);await A$1(r)&&await x$1(r);}a(K,"clearHistory");function C(i){return i??E}a(C,"resolveHistoryLimit");export{x as a,S as b,A as c,J as d,M as e,K as f,C as g};
|
package/dist/chunk-IM555H3S.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$2}from'./chunk-V2ED74ZQ.mjs';import {a as a$3}from'./chunk-Z22BYXWQ.mjs';import {a}from'./chunk-3KNUBUPH.mjs';import {o,m,s,p,e,z,y,t,A,w,x,q}from'./chunk-23HXXAGG.mjs';import {d,b as b$1}from'./chunk-NBSJGM2X.mjs';import {b}from'./chunk-B3DZ5HVQ.mjs';import {c,a as a$1}from'./chunk-2VCW5RWI.mjs';import {stat,readFile,readdir,writeFile,rename}from'fs/promises';import {resolve,join,relative,sep,dirname}from'path';import {spawn}from'child_process';import {availableParallelism,platform}from'os';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var P=c(a(),1);async function Y(s$1,n){let i=[],t=resolve(s$1);i.push(join(t,"package.json"));let e=await Z(t,t),o=e.map(a=>m(relative(t,a)));if(n.files&&n.files.length>0)for(let a of n.files){let r=join(t,a),u=resolve(r);if(!u.startsWith(t+sep)&&u!==t){b.warn(`files pattern "${a}" escapes package directory, skipping`);continue}let c=false;try{if((await stat(r)).isDirectory()){let b=m(relative(t,r))+"/";for(let f=0;f<o.length;f++)o[f].startsWith(b)&&i.push(e[f]);c=!0;}else i.push(r),c=!0;}catch(d){if(s(d)&&d.code!=="ENOENT")throw d}if(!c){let d=(0, P.default)(a,{dot:true}),b$1=0;for(let f=0;f<o.length;f++)if(d(o[f])){let E=resolve(e[f]);if(!E.startsWith(t+sep)&&E!==t)continue;i.push(e[f]),b$1++;}b$1===0&&b.warn(`files pattern "${a}" matched no files`);}}else {let a=await pe(t);for(let r=0;r<o.length;r++)ue(o[r],a)||i.push(e[r]);}let p=new Set(i),l=new Set(e);for(let a of ["README.md","README","LICENSE","LICENCE","CHANGELOG.md"]){let r=join(t,a);p.has(r)||l.has(r)&&(i.push(r),p.add(r));}return [...p]}a$1(Y,"resolvePackFiles");var fe=new Set(["node_modules",".git",".svn",".hg",".DS_Store",".npmrc",".knarr","test","tests","__tests__",".github",".vscode",".idea","coverage",".nyc_output","tsconfig.json","tsconfig.build.json",".eslintrc",".eslintrc.js",".eslintrc.json",".prettierrc",".prettierrc.js","jest.config.js","jest.config.ts","vitest.config.ts","vitest.config.js"]);function ue(s,n){for(let t of n.negations)if(t(s))return false;let i=s.split(/[\\/]/);for(let t of i)if(fe.has(t)||n.literals.has(t))return true;if(n.literals.has(s))return true;for(let t of n.patterns)if(t(s))return true;return false}a$1(ue,"shouldIgnore");async function pe(s$1){let n={literals:new Set,patterns:[],negations:[]};try{let i=await readFile(join(s$1,".npmignore"),"utf-8");for(let t of i.split(`
|
|
4
|
-
`)){let e=t.trim();if(!(!e||e.startsWith("#")))if(e.startsWith("!")){let o=e.slice(1);X(o)?n.negations.push((0,P.default)(o,{dot:!0})):n.negations.push((0,P.default)(o,{dot:!0}));}else X(e)?n.patterns.push((0,P.default)(e,{dot:!0})):n.literals.add(e.replace(/\/$/,""));}}catch(i){if(s(i)&&i.code!=="ENOENT")throw i}return n}a$1(pe,"loadNpmIgnore");function X(s){return /[*?[\]{}()]/.test(s)}a$1(X,"hasGlobChars");async function Z(s$1,n){let i=[];try{let t=await readdir(s$1,{withFileTypes:!0});for(let e of t){let o=join(s$1,e.name);if(e.isDirectory()){if(e.name===".git"||s$1===n&&e.name==="node_modules"||e.isSymbolicLink())continue;i.push(...await Z(o,n));}else e.isSymbolicLink()||i.push(o);}}catch(t){if(s(t)&&t.code==="ENOENT")return [];throw t}return i}a$1(Z,"collectAllFiles");var be=o(Math.max(availableParallelism(),8));async function Xe(s,n={}){let i=join(s,"package.json"),t$1;try{t$1=await readFile(i,"utf-8");}catch{throw new Error(`No package.json found in ${s}`)}let e$1=JSON.parse(t$1);if(!e$1.name)throw new Error("package.json missing 'name' field");if(!e$1.version)throw new Error("package.json missing 'version' field");if(e$1.private&&!n.allowPrivate)throw new Error(`Package "${e$1.name}" is private. Use --private flag to publish private packages.`);await $(s,e$1,"preknarr"),n.runScripts!==false&&await $(s,e$1,"prepack");let o=s;if(e$1.publishConfig?.directory){o=resolve(s,e$1.publishConfig.directory);try{if(!(await stat(o)).isDirectory())throw new Error(`publishConfig.directory "${e$1.publishConfig.directory}" is not a directory`)}catch(c){throw c instanceof Error&&"code"in c&&c.code==="ENOENT"?new Error(`publishConfig.directory "${e$1.publishConfig.directory}" does not exist`):c}d(`[publish] Using publishConfig.directory: ${o}`);}let p$1=o!==s?JSON.parse(await readFile(join(o,"package.json"),"utf-8").catch(()=>JSON.stringify(e$1))):e$1,l=await Y(o,p$1);if(l.length===0)throw new Error("No publishable files found");d(`[publish] Resolved ${l.length} files for ${e$1.name}@${e$1.version}`);let a=await p(l,o);if(await Ce(e$1,s),await Se(e$1,s),!n.force){let c=await a$2(e$1.name,e$1.version);if(c&&c.contentHash===a)return b.info(`${e$1.name}@${e$1.version} already up to date (no changes since last publish)`),{name:e$1.name,version:e$1.version,fileCount:l.length,skipped:true,contentHash:a,buildId:c.buildId??""}}let r=e(e$1.name,e$1.version),u=await a$3(r+".lock",async()=>{if(!n.force){let f=await a$2(e$1.name,e$1.version);if(f&&f.contentHash===a)return b.info(`${e$1.name}@${e$1.version} already up to date (no changes since last publish)`),{name:e$1.name,version:e$1.version,fileCount:l.length,skipped:true,contentHash:a,buildId:f.buildId??""}}let c=r+`.tmp-${process.pid}-${Date.now()}`,d$1=join(c,"package"),b$1=a.slice(9,17);try{await z(d$1);let f=ke(e$1);f=Pe(f),d("[publish] Copying files to temp store...");let E=new Set(l.map(g=>dirname(join(d$1,relative(o,g)))));await Promise.all([...E].map(g=>y(g))),await Promise.all(l.map(g=>be(async()=>{let D=relative(o,g),F=join(d$1,D);D==="package.json"&&f!==e$1?await writeFile(F,JSON.stringify(f,null,2)):await t(g,F,{ensureParent:!1});}))),o!==s&&await writeFile(join(d$1,"package.json"),JSON.stringify(f,null,2));let ie={schemaVersion:1,contentHash:a,publishedAt:new Date().toISOString(),sourcePath:s,buildId:b$1};await writeFile(join(c,".knarr-meta.json"),JSON.stringify(ie,null,2));let _=await A(r),O=r+".old-"+Date.now();if(_&&await rename(r,O),await w(c,r),_){try{let{captureHistory:g}=await import('./history-XUZSDCNE.mjs');await g(e$1.name,e$1.version,O,n.historyLimit);}catch(g){d(`[publish] History capture failed: ${g instanceof Error?g.message:String(g)}`);}await x(O);}d(`[publish] Stored at ${r}`);}catch(f){throw await x(c),f}return {name:e$1.name,version:e$1.version,fileCount:l.length,skipped:false,contentHash:a,buildId:b$1}},{stale:6e4});return u.skipped||(n.runScripts!==false&&await $(s,e$1,"postpack"),await $(s,e$1,"postknarr"),b.success(`Published ${e$1.name}@${e$1.version} (${l.length} files) [${u.buildId}]`)),u}a$1(Xe,"publish");var te=parseInt(process.env.KNARR_HOOK_TIMEOUT??"30000",10);async function $(s,n,i){let t=n.scripts?.[i];if(t){if(b$1()){q({type:"lifecycle-skip",path:s,detail:`${i}: ${t}`});return}return d(`[lifecycle] Running ${i}: ${t}`),new Promise((e,o)=>{let p=platform()==="win32",r=spawn(p?"cmd":"sh",[p?"/c":"-c",t],{cwd:s,stdio:"inherit"}),u=setTimeout(()=>{r.kill("SIGTERM"),o(new Error(`${i} script timed out after ${te/1e3}s. Increase KNARR_HOOK_TIMEOUT env var if the script needs more time.`));},te);r.on("close",c=>{clearTimeout(u),c===0?e():o(new Error(`${i} script failed with exit code ${c}`));}),r.on("error",c=>{clearTimeout(u),o(new Error(`${i} script error: ${c.message}`));});})}}a$1($,"runLifecycleHook");var ve=["main","module","exports","types","typings","browser","bin"];function Pe(s){if(!s.publishConfig)return s;let n={...s};for(let i of ve)i in s.publishConfig&&(n[i]=s.publishConfig[i]);return delete n.publishConfig,n}a$1(Pe,"applyPublishConfig");function ke(s){let n=false,i={...s},t=null,e=false;for(let o of ["dependencies","devDependencies","peerDependencies","optionalDependencies"]){let p=s[o];if(!p)continue;let l=false,a={...p};for(let[r,u]of Object.entries(p))if(u.startsWith("workspace:")){let c=u.slice(10);if(c==="*"||c==="^"||c==="~"){let d=S?.versions.get(r)??s.version;a[r]=c==="*"?d:c+d;}else a[r]=c;l=true,n=true;}else if(u.startsWith("catalog:"))if(e||(t=$e(),e=true),t){let c=Ee(u,r,t);c?(a[r]=c,l=true,n=true):b.warn(`catalog: specifier for "${r}" could not be resolved \u2014 published package.json will contain "${u}" which may cause install failures`);}else d(`[publish] No pnpm-workspace.yaml found, cannot resolve catalog: for "${r}"`);l&&(i[o]=a);}return n?i:s}a$1(ke,"rewriteProtocolVersions");function Ee(s,n,i){let t=s.slice(8);return t===""||t==="default"?i.default[n]??null:i.named[t]?.[n]??null}a$1(Ee,"resolveCatalogVersion");var J=null;async function ne(s){if(J?.dir===s)return J.root;let{findWorkspaceRoot:n}=await import('./workspace-L5CGPK7U.mjs'),i=await n(s);return J={dir:s,root:i},i}a$1(ne,"getWorkspaceRoot");var S=null;async function Ce(s,n){if(!["dependencies","devDependencies","peerDependencies","optionalDependencies"].some(l=>{let a=s[l];return a&&Object.values(a).some(r=>r.startsWith("workspace:"))}))return;let t=await ne(n);if(!t){S=null;return}if(S?.root===t)return;let{findWorkspacePackages:e}=await import('./workspace-L5CGPK7U.mjs'),o=await e(t),p=new Map;await Promise.all(o.map(async l=>{try{let a=JSON.parse(await readFile(join(l,"package.json"),"utf-8"));a.name&&a.version&&p.set(a.name,a.version);}catch{}})),S={root:t,versions:p};}a$1(Ce,"preloadWorkspaceVersions");var k=null;function $e(){return k?.catalogs??null}a$1($e,"loadCatalogsFromCache");async function Se(s,n){if(!["dependencies","devDependencies","peerDependencies","optionalDependencies"].some(a=>{let r=s[a];return r&&Object.values(r).some(u=>u.startsWith("catalog:"))}))return;let t=await ne(n);if(!t){k=null;return}let e=join(t,"pnpm-workspace.yaml"),o=(await stat(e).catch(()=>null))?.mtimeMs??0;if(k?.root===t&&k.mtimeMs===o)return;let{parseCatalogs:p}=await import('./workspace-L5CGPK7U.mjs'),l=await p(t);k={root:t,mtimeMs:o,catalogs:l};}a$1(Se,"preloadCatalogs");export{Xe as a};
|
package/dist/chunk-KXLQGVT2.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {c as c$1,a as a$2}from'./chunk-OLUZ7T7G.mjs';import {j,k,A,y as y$1}from'./chunk-23HXXAGG.mjs';import {a,b}from'./chunk-B3DZ5HVQ.mjs';import {c,a as a$1}from'./chunk-2VCW5RWI.mjs';import {readFile,writeFile}from'fs/promises';import {join}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var y=c(a(),1);async function x(t){let n="";try{n=await readFile(t,"utf-8");}catch{}if(n.split(`
|
|
4
|
-
`).some(a=>a.trim()===".knarr/"||a.trim()===".knarr"||a.trim()==="/.knarr/"||a.trim()==="/.knarr"))return false;let o=n.length>0&&!n.endsWith(`
|
|
5
|
-
`)?`
|
|
6
|
-
`:"",i=n.length>0?`
|
|
7
|
-
# knarr local links
|
|
8
|
-
.knarr/
|
|
9
|
-
`:`# knarr local links
|
|
10
|
-
.knarr/
|
|
11
|
-
`;return await writeFile(t,n+o+i),true}a$1(x,"ensureGitignore");async function S(t){let n=await readFile(t,"utf-8"),r=JSON.parse(n);if(r.scripts?.postinstall)return r.scripts.postinstall.includes("knarr")||b.warn(`Existing postinstall script found. Add ${y.default.cyan("npx knarr restore")} manually if needed.`),false;r.scripts||(r.scripts={}),r.scripts.postinstall="npx knarr restore || true";let s=n.match(/^(\s+)"/m)?.[1]||" ";return await writeFile(t,JSON.stringify(r,null,s)+`
|
|
12
|
-
`),true}a$1(S,"addPostinstall");async function v(t){let n;try{n=await readFile(t,"utf-8");}catch{return false}let r=JSON.parse(n);if(!r.scripts?.postinstall?.includes("knarr"))return false;delete r.scripts.postinstall,Object.keys(r.scripts).length===0&&delete r.scripts;let s=n.match(/^(\s+)"/m)?.[1]||" ";return await writeFile(t,JSON.stringify(r,null,s)+`
|
|
13
|
-
`),true}a$1(v,"removePostinstall");async function I(t,n){let r=j(t),s=k(t);if(!await A(s))await y$1(r),await c$1(t,{version:"1",packageManager:n,role:"consumer",links:{}});else {let a=await a$2(t);a.packageManager||(a.packageManager=n,a.role=a.role??"consumer",await c$1(t,a));}let o=join(t,".gitignore");await x(o);let i=join(t,"package.json");await A(i)&&await S(i);}a$1(I,"ensureConsumerInit");export{x as a,S as b,v as c,I as d};
|
package/dist/chunk-OLUZ7T7G.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {c,a as a$1,e}from'./chunk-Z22BYXWQ.mjs';import {k,s,y,j,B as B$1,b as b$1,z,m,A as A$1}from'./chunk-23HXXAGG.mjs';import {b}from'./chunk-B3DZ5HVQ.mjs';import {a}from'./chunk-2VCW5RWI.mjs';import {readFile}from'fs/promises';import {dirname}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
async function R(t){let{state:r}=await p(t);return r}a(R,"readConsumerState");async function p(t){let r=k(t);try{let e=await readFile(r,"utf-8"),s=JSON.parse(e);return c(s)?{state:s,reliable:!0}:(b.warn(`Invalid consumer state in ${r}, using defaults`),{state:{version:"1",links:{}},reliable:!1})}catch(e){return s(e)&&e.code==="ENOENT"?{state:{version:"1",links:{}},reliable:true}:(b.warn(`Failed to read consumer state: ${e instanceof Error?e.message:String(e)}`),{state:{version:"1",links:{}},reliable:false})}}a(p,"readConsumerStateSafe");async function L(t,r){await y(j(t));let e=k(t);await B$1(e,JSON.stringify(r,null,2));}a(L,"writeConsumerState");async function T(t,r,e){let s=k(t);await a$1(s,async()=>{let{state:i,reliable:c}=await p(t);if(!c)throw new Error(`Consumer state in ${s} is corrupt \u2014 refusing to write to avoid destroying existing links. Delete .knarr/state.json and re-run 'knarr add' for each package.`);i.links[r]=e,await L(t,i);});}a(T,"addLink");async function K(t,r){let e=k(t);await a$1(e,async()=>{let{state:s,reliable:i}=await p(t);if(!i)throw new Error(`Consumer state in ${e} is corrupt \u2014 refusing to write to avoid destroying existing links. Delete .knarr/state.json and re-run 'knarr add' for each package.`);delete s.links[r],await L(t,s);});}a(K,"removeLink");async function M(t,r){return (await R(t)).links[r]??null}a(M,"getLink");async function g(){let t=b$1();try{let r=await readFile(t,"utf-8"),e$1=JSON.parse(r);return e(e$1)?e$1:(b.warn("Invalid consumers registry, using empty registry"),{})}catch(r){return s(r)&&r.code!=="ENOENT"&&b.warn(`Failed to read consumers registry: ${r instanceof Error?r.message:String(r)}`),{}}}a(g,"readConsumersRegistry");async function C(t){let r=b$1();await z(dirname(b$1())),await B$1(r,JSON.stringify(t,null,2));}a(C,"writeConsumersRegistry");async function W(t,r){let e=b$1();await a$1(e,async()=>{let s=await g();s[t]||(s[t]=[]);let i=m(r);s[t].includes(i)||s[t].push(i),await C(s);});}a(W,"registerConsumer");async function q(t,r){let e=b$1();await a$1(e,async()=>{let s=await g();if(!s[t])return;let i=m(r);s[t]=s[t].filter(c=>c!==i),s[t].length===0&&delete s[t],await C(s);});}a(q,"unregisterConsumer");async function A(t){return (await g())[t]??[]}a(A,"getConsumers");async function B(){let t=b$1(),r=0,e=0;return await a$1(t,async()=>{let s=await g(),i={};for(let[c,P]of Object.entries(s)){let d=(await Promise.all(P.map(async o=>({consumerPath:o,valid:await A$1(o)})))).filter(o=>o.valid).map(o=>o.consumerPath);r+=P.length-d.length,d.length>0?i[c]=d:e++;}await C(i);}),{removedConsumers:r,removedPackages:e}}a(B,"cleanStaleConsumers");export{R as a,p as b,L as c,T as d,K as e,M as f,g,W as h,q as i,A as j,B as k};
|
package/dist/chunk-OXI2KGCW.mjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$2}from'./chunk-IM555H3S.mjs';import {b as b$1,c}from'./chunk-V2ED74ZQ.mjs';import {a as a$7}from'./chunk-XQVMCMO7.mjs';import {b as b$3,a as a$5,e}from'./chunk-YZCBBQCH.mjs';import {a as a$3}from'./chunk-TEFMLGCB.mjs';import {d}from'./chunk-KXLQGVT2.mjs';import {a as a$4,b as b$2,c as c$1,d as d$4}from'./chunk-HQ7NKBQW.mjs';import {a as a$1}from'./chunk-MBKCCWSD.mjs';import {a as a$6}from'./chunk-BS4VKVYH.mjs';import {f,d as d$1,h}from'./chunk-OLUZ7T7G.mjs';import {d as d$2}from'./chunk-Z22BYXWQ.mjs';import {A,k,r}from'./chunk-23HXXAGG.mjs';import {b as b$4,c as c$2,d as d$3}from'./chunk-NBSJGM2X.mjs';import {b}from'./chunk-B3DZ5HVQ.mjs';import {a}from'./chunk-2VCW5RWI.mjs';import {spawn}from'child_process';import {platform}from'os';import {resolve,join,basename}from'path';import {readFile}from'fs/promises';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
async function vn(e){let t=e.timer??new a$1,i=resolve("."),{name:n,version:r$1}=G(e.packageArg);if(U(n,e.packageArg),e.from){let m=resolve(e.from);b.info(`Publishing from ${m}...`),await a$2(m);}let a=r$1?await b$1(n,r$1):await c(n);if(!a){let m=r$1?`@${r$1}`:"";a$3(`Package "${n}${m}" not found in store. Run 'knarr publish' in the package directory first, or use --from <path>.`),process.exit(1);}let c$2=!await A(k(i)),o=await a$4(i);if(c$2&&(await d(i,o),b.success("Auto-initialized knarr (consumer mode)")),b.info(`Detected package manager: ${o}`),o==="yarn"){let m=await b$2(i);(m==="pnp"||m===null&&await c$1(i))&&(b.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 u=await f(i,n);u&&(u.version===a.version?b.info(`Updating ${n}@${a.version} (already linked)`):b.info(`Updating ${n}: ${u.version} -> ${a.version}`));let p=await b$3(i,n,o);p&&b.info(`Backed up existing ${n} installation`);let l=await a$5(a,i,o);b.success(`Linked ${n}@${a.version} -> node_modules/${n} (${l.copied} files copied, ${l.skipped} unchanged)`),l.binLinks>0&&b.info(`Created ${l.binLinks} bin link(s)`);let V={version:a.version,contentHash:a.meta.contentHash,linkedAt:new Date().toISOString(),sourcePath:a.meta.sourcePath,backupExists:p,packageManager:o,buildId:a.meta.buildId??""};await d$1(i,n,V),await h(n,i),await d$2(i,n,a.version),await N(a,i,o,e.yes??false),await Q(i,n,o),b.info(`Done in ${t.elapsed()}`),a$6({package:n,version:a.version,copied:l.copied,skipped:l.skipped,binLinks:l.binLinks,elapsed:t.elapsedMs()}),b$4()&&r();}a(vn,"addPackageToConsumer");async function Pn(e){let t=resolve(e);await A(t)||(a$3(`Source path not found: ${t}`),process.exit(1));let i=join(t,"package.json");await A(i)||(a$3(`No package.json found at ${i}. Pass a package directory to 'knarr use'.`),process.exit(1));let n;try{n=JSON.parse(await readFile(i,"utf-8"));}catch(a){a$3(`Could not read package.json at ${i}: ${a instanceof Error?a.message:String(a)}`),process.exit(1);}(!n||typeof n!="object"||typeof n.name!="string")&&(a$3(`package.json at ${i} must include a package name for 'knarr use'.`),process.exit(1));let r=n.name.trim();return U(r,r),r}a(Pn,"readPackageNameFromSource");function G(e){if(e.startsWith("@")){let i=e.indexOf("/");if(i>0){let n=e.indexOf("@",i);if(n>i)return {name:e.slice(0,n),version:e.slice(n+1)}}return {name:e,version:null}}let t=e.lastIndexOf("@");return t>0?{name:e.slice(0,t),version:e.slice(t+1)}:{name:e,version:null}}a(G,"parsePackageArg");function U(e,t){(!e||e==="@"||e.startsWith("@")&&!e.includes("/"))&&(a$3(`Invalid package name "${t}". Use format: package-name or @scope/package-name.`),process.exit(1));}a(U,"validatePackageName");async function N(e$1,t,i,n){let r=await e(e$1,t);if(r.length===0)return;if(c$2()){d$3(`[add] Missing transitive deps (json mode): ${r.join(", ")}`);return}if(n){let c=w(i,r);b.info(`Installing missing dependencies: ${r.join(", ")}`),await $(c,t)?b.success("Installed missing dependencies"):b.warn(`Install failed. Run manually: ${c}`);return}if(await b.prompt(`Install ${r.length} missing dependencies? (${r.join(", ")})`,{type:"confirm",initial:true})){let c=w(i,r);await $(c,t)?b.success("Installed missing dependencies"):b.warn(`Install failed. Run manually: ${c}`);}else b.warn(`Missing transitive dependencies: ${r.join(", ")}
|
|
12
|
-
Run: ${w(i,r)}`);}a(N,"handleMissingDeps");async function Q(e,t,i){let n=await d$4(e);if(n.type==="next"&&n.configFile){let o=await a$7(n.configFile,t);o.modified?b.success(`Added ${t} to transpilePackages in ${basename(n.configFile)}`):o.error&&b.info(`Add to next.config manually: transpilePackages: ['${t}']`);}else if(n.type==="vite"&&n.configFile){let{addKnarrVitePlugin:o}=await import('./vite-config-URP2SYRQ.mjs'),u=await o(n.configFile);if(u.modified){b.success(`Added knarr plugin to ${basename(n.configFile)}`);let p=X(i,"knarr");b.info("Installing knarr as devDependency..."),await $(p,e)?b.success("Installed knarr"):b.warn(`Install failed. Run manually: ${p}`);}else u.error&&b.info(`Add manually:
|
|
13
|
-
import knarr from "knarr/vite"
|
|
14
|
-
plugins: [knarr()]`);}let{findTailwindCss:r,addTailwindSource:a}=await import('./tailwind-source-ND5FE6PQ.mjs'),c=await r(e);if(c){let o=await a(c,t,e);o.modified?b.success(`Added @source for ${t} to ${basename(c)}`):o.error&&b.info(`Add to your CSS manually: @source "../node_modules/${t}";`);}}a(Q,"configureBundler");function w(e,t){let i=t.join(" ");switch(e){case "pnpm":return `pnpm add ${i}`;case "yarn":return `yarn add ${i}`;case "bun":return `bun add ${i}`;default:return `npm install ${i}`}}a(w,"buildInstallCommand");function X(e,t){switch(e){case "pnpm":return `pnpm add -D ${t}`;case "yarn":return `yarn add -D ${t}`;case "bun":return `bun add -d ${t}`;default:return `npm install -D ${t}`}}a(X,"buildDevInstallCommand");function $(e,t){return new Promise(i=>{let n=platform()==="win32",c=spawn(n?"cmd":"sh",[n?"/c":"-c",e],{cwd:t,stdio:"inherit"});c.on("close",o=>i(o===0)),c.on("error",()=>i(false));})}a($,"runInstallCommand");export{vn as a,Pn as b};
|
package/dist/chunk-V2ED74ZQ.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {b}from'./chunk-Z22BYXWQ.mjs';import {g,s,f,A as A$1,a as a$1,c,d,x,e}from'./chunk-23HXXAGG.mjs';import {b as b$1}from'./chunk-B3DZ5HVQ.mjs';import {a}from'./chunk-2VCW5RWI.mjs';import {readFile,readdir}from'fs/promises';import'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
async function y(t,r){let s$1=g(t,r);try{let a=await readFile(s$1,"utf-8"),e=JSON.parse(a);return b(e)?e:(b$1.warn(`Invalid metadata for ${t}@${r}, ignoring`),null)}catch(a){return s(a)&&a.code!=="ENOENT"&&b$1.warn(`Failed to read metadata for ${t}@${r}: ${a instanceof Error?a.message:String(a)}`),null}}a(y,"readMeta");async function j(t,r){let s=f(t,r),a=await y(t,r);return !a||!await A$1(s)?null:{name:t,version:r,packageDir:s,meta:a}}a(j,"getStoreEntry");async function A(t){let r=a$1();if(!await A$1(r))return null;let s=c(t)+"@",e=(await readdir(r,{withFileTypes:true})).filter(n=>n.isDirectory()&&n.name.startsWith(s)),u=(await Promise.all(e.map(async n=>{let i=n.name.slice(s.length),c=await y(t,i);return c?{name:t,version:i,packageDir:f(t,i),meta:c}:null}))).filter(n=>n!==null);return u.length===0?null:u.reduce((n,i)=>new Date(i.meta.publishedAt).getTime()>new Date(n.meta.publishedAt).getTime()?i:n)}a(A,"findStoreEntry");async function J(){let t=a$1();if(!await A$1(t))return [];let s=(await readdir(t,{withFileTypes:true})).filter(e=>e.isDirectory()?e.name.lastIndexOf("@")>0:false);return (await Promise.all(s.map(async e=>{let l=e.name.lastIndexOf("@"),u=e.name.slice(0,l),n=e.name.slice(l+1),i=d(u),c=await y(i,n);return c?{name:i,version:n,packageDir:f(i,n),meta:c}:null}))).filter(e=>e!==null)}a(J,"listStoreEntries");async function W(t,r){await x(e(t,r));}a(W,"removeStoreEntry");export{y as a,j as b,A as c,J as d,W as e};
|
package/dist/chunk-YZCBBQCH.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {e,b as b$2}from'./chunk-HQ7NKBQW.mjs';import {q,m,s,A,x as x$1,y,v,l,D,n}from'./chunk-23HXXAGG.mjs';import {b,d}from'./chunk-NBSJGM2X.mjs';import {b as b$1}from'./chunk-B3DZ5HVQ.mjs';import {a}from'./chunk-2VCW5RWI.mjs';import {mkdir,writeFile,rm,symlink,chmod,readdir,stat,realpath,readFile}from'fs/promises';import {join,resolve,sep,relative}from'path';import {platform}from'os';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
function W(e){return e.bin?typeof e.bin=="string"?{[e.name.startsWith("@")?e.name.split("/")[1]:e.name]:e.bin}:e.bin:{}}a(W,"resolveBinEntries");async function F(e,n,i){let r=W(i);if(Object.keys(r).length===0)return 0;if(b()){for(let o of Object.keys(r))q({type:"bin-link",path:join(e,"node_modules",".bin",o),detail:n});return d(`[dry-run] would create ${Object.keys(r).length} bin link(s) for ${n}`),Object.keys(r).length}let t=join(e,"node_modules",".bin");await mkdir(t,{recursive:true});let s$1=platform()==="win32",a=0;for(let[o,g]of Object.entries(r)){let l=join(e,"node_modules",n),f=join(l,g),R=resolve(f);if(!R.startsWith(resolve(l)+sep)&&R!==resolve(l)){b$1.warn(`bin "${o}" points outside package directory, skipping`);continue}let $=m(relative(t,f));if(s$1){let b=join(t,`${o}.cmd`),O=`@ECHO off\r
|
|
4
|
-
GOTO start\r
|
|
5
|
-
:find_dp0\r
|
|
6
|
-
SET dp0=%~dp0\r
|
|
7
|
-
EXIT /b\r
|
|
8
|
-
:start\r
|
|
9
|
-
CALL :find_dp0\r
|
|
10
|
-
"%dp0%\\${$.replace(/\//g,"\\")}" %*\r
|
|
11
|
-
`;await writeFile(b,O);let Y=join(t,`${o}.ps1`),q=`#!/usr/bin/env pwsh
|
|
12
|
-
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
|
13
|
-
& node "$basedir/${$}" $args
|
|
14
|
-
exit $LASTEXITCODE
|
|
15
|
-
`;await writeFile(Y,q);let K=join(t,o),Q=`#!/bin/sh
|
|
16
|
-
exec node "${$}" "$@"
|
|
17
|
-
`;await writeFile(K,Q);}else {let b=join(t,o);try{await rm(b,{force:!0});}catch{}try{await symlink($,b),await chmod(f,493);}catch(w){if(s(w)&&(w.code==="EPERM"||w.code==="EACCES")){d(`[bin-linker] Symlink failed (${w.code}), using shell wrapper for ${o}`);let O=`#!/bin/sh
|
|
18
|
-
exec node "${$}" "$@"
|
|
19
|
-
`;await writeFile(b,O),await chmod(b,493);}else throw w}}a++;}return a}a(F,"createBinLinks");async function H(e,n){let i=W(n);if(b()){for(let s of Object.keys(i))q({type:"bin-unlink",path:join(e,"node_modules",".bin",s)});d(`[dry-run] would remove ${Object.keys(i).length} bin link(s)`);return}let r=join(e,"node_modules",".bin"),t=platform()==="win32";for(let s of Object.keys(i))try{await rm(join(r,s),{force:!0}),t&&(await rm(join(r,`${s}.cmd`),{force:!0}),await rm(join(r,`${s}.ps1`),{force:!0}));}catch{}}a(H,"removeBinLinks");var te={next:[".next/cache"],webpack:["node_modules/.cache"]},X=new Map;async function z(e$1){if(b()){d(`[dry-run] would invalidate bundler caches for ${e$1}`),q({type:"cache-invalidate",path:e$1});return}let n=X.get(e$1);n||(n=await e(e$1),X.set(e$1,n));for(let i of n){if(!i.type)continue;let r=te[i.type];if(r)for(let t of r){let s=join(e$1,t);if(await A(s))try{await x$1(s),d(`[inject] Invalidated ${i.type} cache: ${t}`);}catch{d(`[inject] Could not clear ${i.type} cache: ${t} (locked?)`);}}}}a(z,"invalidateBundlerCache");async function Ie(e,n,i,r={}){let t=await x(n,e.name,i,e.version);d(`[inject] ${e.name}@${e.version} \u2192 ${t}`),await y(t);let{copied:s,removed:a,skipped:o}=await v(e.packageDir,t,{force:r.force});d(`[inject] ${s} copied, ${a} removed, ${o} skipped`),(s>0||a>0)&&await z(n);let g=await M(e.packageDir),l=g?await F(n,e.name,g):0;return l>0&&d(`[inject] Created ${l} bin link(s)`),{copied:s,removed:a,skipped:o,binLinks:l}}a(Ie,"inject");async function Ne(e,n,i){let r=await x(e,n,i);if(!await A(r))return false;let t=l(e,n);return await x$1(t),await D(r,t),true}a(Ne,"backupExisting");async function Te(e,n,i){let r=l(e,n);if(!await A(r))return false;let t=await x(e,n,i);return await x$1(t),await D(r,t),await x$1(r),true}a(Te,"restoreBackup");async function Le(e,n,i){let r=await x(e,n,i),t=await M(r);t&&await H(e,t),await x$1(r);}a(Le,"removeInjected");async function Je(e,n){let i=await M(e.packageDir);if(!i)return [];let r={...i.dependencies,...Object.fromEntries(Object.entries(i.peerDependencies??{}).filter(([a])=>!i.peerDependenciesMeta?.[a]?.optional))};if(Object.keys(r).length===0)return [];let t=Object.keys(r);return (await Promise.all(t.map(async a=>({dep:a,installed:await A(join(n,"node_modules",a))})))).filter(a=>!a.installed).map(a=>a.dep)}a(Je,"checkMissingDeps");async function x(e,n$1,i,r){let t=n(e,n$1);if(!(i==="pnpm"||i==="yarn"&&await b$2(e)==="pnpm"))return t;try{let o=await se(t);if(o!==resolve(t))return d(`[inject] pnpm: resolved symlink \u2192 ${o}`),o}catch(o){s(o)&&o.code!=="ENOENT"&&b$1.debug(`pnpm symlink resolution error: ${o instanceof Error?o.message:String(o)}`);}let a=join(e,"node_modules",".pnpm");if(await A(a)){d(`[inject] pnpm: scanning .pnpm/ for ${n$1}`);let o=n$1.replaceAll("/","+");if(r){let l=`${o}@${r}`,f=join(a,l,"node_modules",n$1);if(await A(f))return d(`[inject] pnpm: exact version match in .pnpm/ \u2192 ${f}`),f}let g=await readdir(a);for(let l of g)if(l.startsWith(o+"@")){let f=join(a,l,"node_modules",n$1);if(await A(f))return d(`[inject] pnpm: found in .pnpm/ \u2192 ${f}`),f}}return b$1.warn(`pnpm: Could not find ${n$1} in .pnpm/ virtual store, using direct node_modules path. If this causes issues, run 'pnpm install' to rebuild the virtual store, then 'knarr add' again.`),t}a(x,"resolveTargetDir");async function se(e){try{return await stat(e),await realpath(e)}catch(n){if(s(n)&&n.code==="ENOENT")return resolve(e);throw n}}a(se,"resolveRealPath");async function M(e){try{let n=await readFile(join(e,"package.json"),"utf-8");return JSON.parse(n)}catch(n){return s(n)&&n.code!=="ENOENT"&&b$1.warn(`Failed to read package.json in ${e}: ${n instanceof Error?n.message:String(n)}`),null}}a(M,"readPackageJson");export{Ie as a,Ne as b,Te as c,Le as d,Je as e};
|
package/dist/chunk-Z22BYXWQ.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {q,s}from'./chunk-23HXXAGG.mjs';import {b}from'./chunk-NBSJGM2X.mjs';import {b as b$1}from'./chunk-B3DZ5HVQ.mjs';import {a as a$1}from'./chunk-2VCW5RWI.mjs';import {mkdir,stat,rm,readFile}from'fs/promises';import {dirname,join}from'path';import {setTimeout}from'timers/promises';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var a={retries:5,minTimeout:100,maxTimeout:1e3,factor:2,stale:3e4};async function C(r,t,n){if(b())return q({type:"lock-skip",path:r}),t();await mkdir(dirname(r),{recursive:true});let e=r+".lk",c=n?.stale??a.stale,s$1=false;for(let i=0;i<=a.retries;i++)try{await mkdir(e),s$1=!0;break}catch(u){if(s(u)&&u.code==="EEXIST"){try{let f=await stat(e);if(Date.now()-f.mtimeMs>c){await rm(e,{recursive:!0,force:!0});continue}}catch{continue}if(i<a.retries){let f=Math.min(a.minTimeout*a.factor**i,a.maxTimeout);await setTimeout(f);}}else throw u}if(!s$1)throw new Error(`Failed to acquire lock after ${a.retries} attempts. Another Knarr process may be running. If this persists, delete ${e} and retry.`);try{return await t()}finally{await rm(e,{recursive:true,force:true});}}a$1(C,"withFileLock");function F(r){if(typeof r!="object"||r===null)return false;let t=r;return typeof t.contentHash=="string"&&typeof t.publishedAt=="string"&&typeof t.sourcePath=="string"&&(t.buildId===void 0||typeof t.buildId=="string")&&(t.schemaVersion===void 0||typeof t.schemaVersion=="number")}a$1(F,"isKnarrMeta");function M(r){if(typeof r!="object"||r===null)return false;let t=r;return typeof t.version=="string"&&typeof t.contentHash=="string"&&typeof t.linkedAt=="string"&&typeof t.sourcePath=="string"&&typeof t.backupExists=="boolean"&&typeof t.packageManager=="string"&&["npm","pnpm","yarn","bun"].includes(t.packageManager)&&(t.buildId===void 0||typeof t.buildId=="string")}a$1(M,"isLinkEntry");function K(r){if(typeof r!="object"||r===null)return false;let t=r;if(t.version!=="1"||typeof t.links!="object"||t.links===null)return false;let n=t.links;for(let e of Object.values(n))if(!M(e))return false;return true}a$1(K,"isConsumerState");async function O(r,t,n){try{let e=await readFile(join(r,"package.json"),"utf-8"),c=JSON.parse(e),s=c.dependencies?.[t]??c.devDependencies?.[t]??c.peerDependencies?.[t];if(!s||/^(workspace:|catalog:|\*)/.test(s))return;let i=s.match(/(\d+)\.\d+\.\d+/);if(!i)return;let u=parseInt(i[1],10),f=parseInt(n.split(".")[0],10);u!==f&&b$1.warn(`Version mismatch: store has ${t}@${n} but your package.json declares "${s}". Consider updating your dependency range.`);}catch{}}a$1(O,"warnVersionMismatch");function P(r){if(typeof r!="object"||r===null)return false;let t=r;for(let n of Object.values(t)){if(!Array.isArray(n))return false;for(let e of n)if(typeof e!="string")return false}return true}a$1(P,"isConsumersRegistry");export{C as a,F as b,K as c,O as d,P as e};
|
package/dist/clean-XMLDIZDZ.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$2}from'./chunk-2GDRDQA5.mjs';import {d as d$1,e}from'./chunk-V2ED74ZQ.mjs';import {a}from'./chunk-MBKCCWSD.mjs';import {b,a as a$3}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import {k,g,b as b$2}from'./chunk-OLUZ7T7G.mjs';import'./chunk-Z22BYXWQ.mjs';import {m,a as a$1,A,C,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 {readdir}from'fs/promises';import {join}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var ne={meta:{name:"clean",description:"Remove unreferenced store entries and stale consumer registrations"},args:{yes:{type:"boolean",alias:"y",description:"Skip confirmation prompts",default:false}},async run({args:A$1}){b();let y=new a;b$1.start("Checking consumer registrations...");let{removedConsumers:l,removedPackages:v}=await k();l>0&&b$1.success(`Removed ${l} stale consumer registration(s) across ${v} package(s)`);let $=await g(),f=new Set,F=[...new Set(Object.values($).flat())],w=await Promise.all(F.map(async e=>{let{state:t,reliable:o}=await b$2(e);return {path:e,state:t,reliable:o}}));for(let{state:e,reliable:t}of w)if(t)for(let[o,g]of Object.entries(e.links))f.add(`${o}@${g.version}`);let d$2=new Set,u=w.filter(e=>!e.reliable);if(u.length>0){b$1.warn(`${u.length} consumer(s) have corrupt state; their store entries will be preserved`);let e=new Set(u.map(t=>m(t.path)));for(let[t,o]of Object.entries($))o.some(g=>e.has(g))&&d$2.add(t);d(`[clean] Protected packages (corrupt state): ${[...d$2].join(", ")}`);}d(`[clean] Referenced entries: ${[...f].join(", ")||"(none)"}`);let H=await d$1(),s=[];for(let e of H){let t=`${e.name}@${e.version}`;if(!f.has(t)){if(d$2.has(e.name)){d(`[clean] Preserving ${t} (consumer state unreadable)`);continue}let o=Date.now()-new Date(e.meta.publishedAt).getTime();if(o<300*1e3){d(`[clean] Skipping recently published entry: ${t} (${Math.round(o/1e3)}s old)`);continue}s.push(e);}}let n=[],p=a$1();if(await A(p)){let e=await readdir(p,{withFileTypes:true});for(let t of e)t.isDirectory()&&(t.name.includes(".tmp-")||t.name.includes(".old-"))&&n.push(t.name);}if(s.length+n.length>0&&!A$1.yes){let e=[];s.length>0&&e.push(`${s.length} unreferenced store entry(ies)`),n.length>0&&e.push(`${n.length} orphaned temp directory(ies)`);let t=await b$1.prompt(`Remove ${e.join(" and ")}?`,{type:"confirm"});if(!t||typeof t=="symbol"){b$1.info("Cancelled");return}}let a$4=0,q=await Promise.all(s.map(e=>C(e.packageDir))),G=await Promise.all(n.map(e=>C(join(p,e)))),m$1=0;for(let e$1=0;e$1<s.length;e$1++){let t=s[e$1];d(`[clean] Removing unreferenced store entry: ${t.name}@${t.version}`),await e(t.name,t.version),a$4+=q[e$1],m$1++;}m$1>0&&b$1.success(`Removed ${m$1} unreferenced store entry(ies)`);let c=0;for(let e=0;e<n.length;e++)d(`[clean] Removing orphaned directory: ${n[e]}`),await x(join(p,n[e])),a$4+=G[e],c++;c>0&&b$1.success(`Removed ${c} orphaned temp directory(ies)`),l===0&&m$1===0&&c===0&&b$1.info("Store is clean; no stale entries or registrations found");let I=a$4>0?` (reclaimed ${a$2(a$4)})`:"";b$1.info(`Clean complete in ${y.elapsed()}${I}`),a$3({removedConsumers:l,removedPackages:v,removedEntries:m$1,removedOrphans:c,reclaimedBytes:a$4,elapsed:y.elapsedMs()}),b$3()&&r();}};export{ne as default};
|
package/dist/doctor-4TTAYNGW.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {d,b as b$4}from'./chunk-V2ED74ZQ.mjs';import {a as a$2,b as b$5,c as c$1,d as d$1}from'./chunk-HQ7NKBQW.mjs';import {b,a as a$3}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import {g,b as b$3}from'./chunk-OLUZ7T7G.mjs';import'./chunk-Z22BYXWQ.mjs';import {a as a$1,A,b as b$2}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 z={meta:{name:"doctor",description:"Run diagnostic checks on your Knarr setup"},async run(){b();let n=resolve("."),s=[];b$1.info(`Running Knarr diagnostics...
|
|
4
|
-
`);let m=a$1();if(await A(m)){let e=await d();s.push({name:"Store directory",status:"pass",message:`${e.length} entries in ${m}`});}else s.push({name:"Store directory",status:"warn",message:`Store not found at ${m}. Run 'knarr publish' to create it.`});let _=b$2();if(await A(_)){let e=await g(),a=Object.values(e).flat().length;s.push({name:"Global registry",status:"pass",message:`${Object.keys(e).length} packages, ${a} consumer registrations`});}else s.push({name:"Global registry",status:"warn",message:"No consumers registered yet. Use 'knarr add' to link packages."});let{state:x,reliable:A$1}=await b$3(n);A$1||s.push({name:"Consumer state",status:"fail",message:"state.json is corrupt or unreadable. Delete .knarr/state.json and re-run 'knarr add' for each package."});let l=Object.entries(x.links);if(l.length>0){s.push({name:"Consumer state",status:"pass",message:`${l.length} linked package(s)`});for(let[e,a]of l){let u=await b$4(e,a.version);u?u.meta.contentHash!==a.contentHash?s.push({name:`Store: ${e}`,status:"warn",message:"Store has newer content. Run 'knarr update' to sync."}):s.push({name:`Store: ${e}`,status:"pass",message:`${e}@${a.version} in sync`}):s.push({name:`Store: ${e}`,status:"fail",message:`Store entry missing for ${e}@${a.version}. Re-publish it.`});let k=join(n,"node_modules",e);if(!await A(k))s.push({name:`node_modules: ${e}`,status:"fail",message:"Missing from node_modules. Run 'knarr restore'."});else try{let{readFile:F}=await import('fs/promises'),d=JSON.parse(await F(join(k,"package.json"),"utf-8"));d.version&&d.version!==a.version&&s.push({name:`node_modules: ${e}`,status:"warn",message:`node_modules has v${d.version} but Knarr linked v${a.version}. Run 'knarr restore'.`});}catch{}}}else s.push({name:"Consumer state",status:"warn",message:"No packages linked. Use 'knarr add' to link a package."});let f=await a$2(n);if(s.push({name:"Package manager",status:"pass",message:f}),f==="yarn"){let e=await b$5(n);await c$1(n)?e==="node-modules"?s.push({name:"Yarn linker",status:"pass",message:"Yarn Berry with node-modules linker"}):e==="pnpm"?s.push({name:"Yarn linker",status:"pass",message:"Yarn pnpm linker mode (Knarr handles this)"}):e==="pnp"?s.push({name:"Yarn linker",status:"fail",message:"Yarn PnP is not compatible. Set `nodeLinker: node-modules` in .yarnrc.yml"}):s.push({name:"Yarn linker",status:"warn",message:"Yarn Berry defaults to PnP. Add `nodeLinker: node-modules` to .yarnrc.yml"}):s.push({name:"Yarn linker",status:"pass",message:"Yarn Classic, node_modules mode"});}let i=await d$1(n);i.type?s.push({name:"Bundler",status:"pass",message:`${i.type}${i.configFile?` (${i.configFile})`:""}`}):s.push({name:"Bundler",status:"warn",message:"No bundler config detected"});let h=join(n,".gitignore");if(await A(h)){let{readFile:e}=await import('fs/promises');(await e(h,"utf-8")).includes(".knarr")?s.push({name:".gitignore",status:"pass",message:".knarr/ is ignored"}):s.push({name:".gitignore",status:"warn",message:".knarr/ not in .gitignore. Run 'knarr init' to fix."});}parseInt(process.versions.node.split(".")[0],10)>=22?s.push({name:"Node.js version",status:"pass",message:`v${process.versions.node}`}):s.push({name:"Node.js version",status:"fail",message:`v${process.versions.node}; Knarr requires Node.js >= 22`});let B={pass:o.default.green("PASS"),fail:o.default.red("FAIL"),warn:o.default.yellow("WARN")};for(let e of s)b$1.log(` ${B[e.status]} ${e.name}: ${o.default.dim(e.message)}`);let c=s.filter(e=>e.status==="fail").length,p=s.filter(e=>e.status==="warn").length;b$1.log(""),c>0?b$1.error(`${c} issue(s) found that need attention`):p>0?b$1.warn(`${p} warning(s), but no critical issues`):b$1.success("All checks passed!"),a$3({results:s.map(({name:e,status:a,message:u})=>({name:e,status:a,message:u})),failures:c,warnings:p});}};export{z as default};
|
package/dist/fs-35635IS7.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';export{B as atomicWriteFile,u as collectFiles,D as copyDir,t as copyWithCoW,C as dirSize,y as ensureDir,z as ensurePrivateDir,A as exists,v as incrementalCopy,s as isNodeError,w as moveDir,x as removeDir}from'./chunk-23HXXAGG.mjs';import'./chunk-NBSJGM2X.mjs';import'./chunk-B3DZ5HVQ.mjs';import'./chunk-2VCW5RWI.mjs';globalThis.require=createRequire(import.meta.url);
|
|
@@ -1,8 +0,0 @@
|
|
|
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};
|
|
@@ -1,3 +0,0 @@
|
|
|
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};
|
package/dist/remove-PDERBH66.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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);
|
package/dist/reset-3FXWAAPQ.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
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};
|
|
@@ -1,3 +0,0 @@
|
|
|
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};
|
|
@@ -1,5 +0,0 @@
|
|
|
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};
|
package/dist/update-QPBWYDSG.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
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};
|
|
@@ -1,3 +0,0 @@
|
|
|
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};
|