knarr 0.0.3 → 0.1.0
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/README.md +1 -0
- package/dist/add-4Z3V5722.mjs +3 -0
- package/dist/bell-SIN4ERLS.mjs +2 -0
- package/dist/{check-YVEJEI2G.mjs → check-7CJHAF6Y.mjs} +1 -1
- package/dist/{chokidar-LVDD2IK4.mjs → chokidar-2G63V464.mjs} +1 -1
- package/dist/chunk-3SXN6MQL.mjs +4 -0
- package/dist/chunk-7GCKCCHU.mjs +3 -0
- package/dist/chunk-7ROQJISX.mjs +15 -0
- package/dist/chunk-AA43FODB.mjs +3 -0
- package/dist/chunk-ABG6UD3X.mjs +22 -0
- package/dist/chunk-BH2WXCLS.mjs +4 -0
- package/dist/chunk-COI7GWH3.mjs +4 -0
- package/dist/chunk-E3HZCU3S.mjs +5 -0
- package/dist/chunk-FSVETLZK.mjs +4 -0
- package/dist/{chunk-3KNUBUPH.mjs → chunk-G7HFTV5Y.mjs} +1 -1
- package/dist/chunk-GAWQLCRB.mjs +3 -0
- package/dist/{chunk-MBKCCWSD.mjs → chunk-HVN6HBWZ.mjs} +1 -1
- package/dist/{chunk-SYADAYF4.mjs → chunk-ICU4V73X.mjs} +1 -1
- package/dist/{chunk-XQPVRRTN.mjs → chunk-IP5ROSRE.mjs} +1 -1
- package/dist/chunk-J6HZHQVL.mjs +3 -0
- package/dist/chunk-L7O2RSTN.mjs +3 -0
- package/dist/chunk-M3TRMEJV.mjs +3 -0
- package/dist/chunk-MN4DV2NO.mjs +3 -0
- package/dist/chunk-N3B2JO4H.mjs +13 -0
- package/dist/{chunk-7HVPEBK5.mjs → chunk-NGPAGRK4.mjs} +1 -1
- package/dist/{chunk-B3DZ5HVQ.mjs → chunk-OQDZJP55.mjs} +1 -1
- package/dist/chunk-QEH5VHRO.mjs +13 -0
- package/dist/chunk-QFHYSC3K.mjs +3 -0
- package/dist/{chunk-CTJF2EWO.mjs → chunk-QHNHLR6T.mjs} +2 -2
- package/dist/chunk-RJSBXX2Q.mjs +3 -0
- package/dist/{chunk-NBSJGM2X.mjs → chunk-SPHWZS5P.mjs} +1 -1
- package/dist/chunk-U6O35NZ7.mjs +3 -0
- package/dist/chunk-UCSYKFEZ.mjs +3 -0
- package/dist/chunk-W2MMKBWU.mjs +3 -0
- package/dist/chunk-WBTSRLB6.mjs +7 -0
- package/dist/chunk-WN3DOKIM.mjs +3 -0
- package/dist/{chunk-TEFMLGCB.mjs → chunk-XDWZZBCM.mjs} +1 -1
- package/dist/{chunk-2GDRDQA5.mjs → chunk-Z5K6DFA6.mjs} +1 -1
- package/dist/clean-EJIYYQZM.mjs +3 -0
- package/dist/cli.mjs +4 -4
- package/dist/dev-PUNHH4MS.mjs +3 -0
- package/dist/doctor-ZK4OPSD4.mjs +6 -0
- package/dist/explain-BDTONX7H.mjs +5 -0
- package/dist/fs-NU36NNEG.mjs +2 -0
- package/dist/history-MLJHRV3Q.mjs +2 -0
- package/dist/index.d.ts +79 -18
- package/dist/index.mjs +1524 -443
- package/dist/init-X4F3XKVC.mjs +16 -0
- package/dist/{list-GLSA6I67.mjs → list-4PTHMIQ4.mjs} +2 -2
- package/dist/migrate-VHDLW6I7.mjs +8 -0
- package/dist/nextjs-config-T5D6LOJE.mjs +2 -0
- package/dist/preflight-IXICTR6G.mjs +2 -0
- package/dist/{publish-TAWTHPSD.mjs → publish-UGDDG6OT.mjs} +2 -2
- package/dist/push-V575ASM4.mjs +3 -0
- package/dist/remove-EPVDMWCS.mjs +2 -0
- package/dist/reset-5M6AU4FU.mjs +3 -0
- package/dist/restore-QPISOGEK.mjs +12 -0
- package/dist/rollback-CTGK7SXG.mjs +3 -0
- package/dist/{status-FA6UEHEF.mjs → status-3ZXM3CRH.mjs} +2 -2
- package/dist/{tailwind-source-RIWWXW2Y.mjs → tailwind-source-HCTY2XDU.mjs} +2 -2
- package/dist/topo-sort-ZNGR6D7M.mjs +2 -0
- package/dist/{tracker-JJEYXX45.mjs → tracker-QAKEXYUJ.mjs} +1 -1
- package/dist/update-RSPDDAJK.mjs +12 -0
- package/dist/use-LZ2GIXYZ.mjs +3 -0
- package/dist/vite-config-XOGAKYGQ.mjs +2 -0
- package/dist/watch-orchestrator-N6HZUDS3.mjs +3 -0
- package/dist/watcher-KOLIXRUG.mjs +3 -0
- package/dist/workspace-T6PNO4L3.mjs +2 -0
- package/dist/{xxhash-wasm-DTW44IIQ.mjs → xxhash-wasm-I6Q3T2SL.mjs} +1 -1
- package/package.json +4 -1
- package/dist/add-LZ6CZTHG.mjs +0 -3
- package/dist/bell-YD6IWNXO.mjs +0 -2
- package/dist/chunk-2VCW5RWI.mjs +0 -3
- package/dist/chunk-37AAX47E.mjs +0 -19
- package/dist/chunk-5BZD55UB.mjs +0 -3
- package/dist/chunk-7JG555TZ.mjs +0 -3
- package/dist/chunk-7SDPRKFT.mjs +0 -13
- package/dist/chunk-BS4VKVYH.mjs +0 -3
- package/dist/chunk-EE2UYGFD.mjs +0 -4
- package/dist/chunk-GO6F6AGH.mjs +0 -3
- package/dist/chunk-GQYG5FCW.mjs +0 -5
- package/dist/chunk-HEDVIVEO.mjs +0 -14
- package/dist/chunk-KOHUNKHP.mjs +0 -3
- package/dist/chunk-LXGALE74.mjs +0 -13
- package/dist/chunk-OPLSUHCD.mjs +0 -4
- package/dist/chunk-QGLOGD5G.mjs +0 -3
- package/dist/chunk-SFLWVTJC.mjs +0 -3
- package/dist/chunk-SN4TOUQW.mjs +0 -7
- package/dist/chunk-UBGMLVMB.mjs +0 -3
- package/dist/chunk-XKO24LUM.mjs +0 -3
- package/dist/chunk-ZJEEAMB3.mjs +0 -3
- package/dist/clean-ZD5GPGXQ.mjs +0 -3
- package/dist/dev-TMWMIT7W.mjs +0 -3
- package/dist/doctor-AXP7GVBM.mjs +0 -4
- package/dist/fs-2NITBGIO.mjs +0 -2
- package/dist/history-SKKGT225.mjs +0 -2
- package/dist/init-XK4B7XYG.mjs +0 -7
- package/dist/migrate-MW4BVLL2.mjs +0 -8
- package/dist/preflight-TVJFHRI2.mjs +0 -2
- package/dist/push-65ZZFZJY.mjs +0 -3
- package/dist/remove-LOBXHBMC.mjs +0 -2
- package/dist/reset-EAN5NVGM.mjs +0 -3
- package/dist/restore-YHZYT54B.mjs +0 -11
- package/dist/rollback-U3LQTWH5.mjs +0 -3
- package/dist/topo-sort-WEIVPJKN.mjs +0 -2
- package/dist/update-VOUKMOLK.mjs +0 -3
- package/dist/use-BXAZ5OP3.mjs +0 -3
- package/dist/vite-config-UWCLPTOZ.mjs +0 -2
- package/dist/watch-orchestrator-I2623SMT.mjs +0 -3
- package/dist/watcher-PTPUN2HE.mjs +0 -3
- package/dist/workspace-S3TAUSS3.mjs +0 -2
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {createRequire}from'node:module';import {b as b$2}from'./chunk-3SXN6MQL.mjs';import {c as c$2,a as a$8,d as d$1}from'./chunk-UCSYKFEZ.mjs';import {d,e,a as a$5}from'./chunk-N3B2JO4H.mjs';import {a as a$2}from'./chunk-WN3DOKIM.mjs';import {a as a$7}from'./chunk-MN4DV2NO.mjs';import {a as a$3}from'./chunk-HVN6HBWZ.mjs';import {a as a$4,g,h}from'./chunk-FSVETLZK.mjs';import {b as b$1,a as a$9}from'./chunk-U6O35NZ7.mjs';import'./chunk-NGPAGRK4.mjs';import {a as a$6,c as c$1}from'./chunk-QFHYSC3K.mjs';import'./chunk-W2MMKBWU.mjs';import {G,F,D}from'./chunk-BH2WXCLS.mjs';import {d as d$2}from'./chunk-E3HZCU3S.mjs';import {b as b$3}from'./chunk-SPHWZS5P.mjs';import {a,b}from'./chunk-OQDZJP55.mjs';import {c,a as a$1}from'./chunk-L7O2RSTN.mjs';import {join,resolve,basename}from'path';import {readFile}from'fs/promises';globalThis.require=createRequire(import.meta.url);
|
|
3
|
+
var n=c(a(),1);var ge={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 s=new a$3,a=resolve("."),l=o.yes,i=false,r=[];b.info(`Initializing knarr in ${n.default.cyan(a)}
|
|
4
|
+
`);let k=await a$4(a);b.success(`Detected package manager: ${n.default.cyan(k)}`);let p=k;if(!l&&await b.prompt(`Use ${k}?`,{type:"confirm",initial:true})===false){let c=["npm","pnpm","yarn","bun"].filter(m=>m!==k),u=await b.prompt("Select package manager:",{type:"select",options:c.map(m=>({label:m,value:m}))});typeof u=="string"&&(p=u);}let d$3="consumer";o.role==="consumer"||o.role==="library"?d$3=o.role:l||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"&&(d$3="library"),b.success(`Project role: ${n.default.cyan(d$3)}`),d$3==="consumer"&&(await g(a)||p==="yarn"&&await h(a))&&(b.error(`Yarn PnP mode is not compatible with Knarr.
|
|
5
|
+
|
|
6
|
+
Knarr works by copying files into node_modules/, but PnP eliminates
|
|
7
|
+
node_modules/ entirely. To use Knarr with Yarn Berry, add one of these
|
|
8
|
+
to .yarnrc.yml:
|
|
9
|
+
|
|
10
|
+
nodeLinker: node-modules
|
|
11
|
+
nodeLinker: pnpm
|
|
12
|
+
|
|
13
|
+
Then run: yarn install`),process.exit(1));let W=join(a,".gitignore");await d(W)&&b.success("Added .knarr/ to .gitignore");let f=join(a,"package.json"),y;if(await F(f))if(d$3==="consumer"){if(await e(f)&&b.success(`Added "postinstall": "${a$5}" to package.json scripts`),!l){let c=await b.prompt("Package name to link (leave blank to skip):",{type:"text",default:""});if(typeof c=="string"&&c.trim()){let u=c.trim();await v(f,"knarr:add",`knarr add ${u}`)&&b.success(`Added "knarr:add": "knarr add ${u}" to package.json scripts`);}}}else {y=await Q(f,p,l),i=await b$2(f,y),i&&y&&b.success("Saved build command to package.json#knarr.buildCmd");let t=await X(f);for(let c of t)b.success(`Added "${c}" script to package.json`);}let h$1=join(a,".knarr");if(!await F(h$1))await D(h$1),await G(join(h$1,"state.json"),JSON.stringify({version:"1",packageManager:p,role:d$3,links:{}},null,2)),b.success("Created .knarr/ state directory");else {let t=await a$6(a);t.packageManager=p,t.role=d$3,await c$1(a,t);}if(d$3==="consumer"){let t=await a$7(a);if(t.type==="vite"&&t.configFile){b.success(`Detected bundler: ${n.default.cyan("Vite")} (${basename(t.configFile)})`);let{addKnarrVitePlugin:c}=await import('./vite-config-XOGAKYGQ.mjs'),u=await c(t.configFile);if(u.modified){b.success(`Added knarr plugin to ${basename(t.configFile)}`);let m=c$2(p,"knarr"),E=a$8(m);b.info(b$3()?"[dry-run] Would install knarr as devDependency":"Installing knarr as devDependency...");let C=await d$1(m,a);C&&!b$3()?b.success("Installed knarr"):C||b.warn(`Install failed. Run manually: ${E}`);}else u.error&&b.info(`Add the Vite plugin for automatic dev server restarts:
|
|
14
|
+
${n.default.cyan('import knarr from "knarr/vite"')}
|
|
15
|
+
${n.default.cyan("plugins: [knarr()]")}`);}else if(t.type==="next"&&t.configFile)b.success(`Detected bundler: ${n.default.cyan("Next.js")} (${basename(t.configFile)})`),b.info(`Next.js transpilePackages will be auto-configured when you run ${n.default.cyan("knarr add")}`);else if(t.type){let c={webpack:"Webpack",turbo:"Turbopack",rollup:"Rollup"};b.success(`Detected bundler: ${n.default.cyan(c[t.type]||t.type)} - no config needed, works out of the box`);}b.log(""),b.info(`${n.default.bold("Next steps:")}`),r.push("knarr use ../my-lib"),r.push("cd ../my-lib && knarr dev"),b.log(` 1. ${n.default.cyan(r[0])} <- publish + link a local package`),b.log(` 2. ${n.default.cyan(r[1])} <- watch + rebuild + auto-push`);}else b.log(""),b.info(`${n.default.bold("Next steps:")}`),r.push("knarr publish"),r.push(`${p} run knarr:dev`),r.push(`knarr use ${a}`),b.log(` 1. ${n.default.cyan(r[0])} <- copy built files to knarr store`),b.log(` 2. ${n.default.cyan(r[1])} <- watch + rebuild + auto-push to consumers`),b.log(` 3. In consumer project: ${n.default.cyan(r[2])}`);b.info(`Done in ${s.elapsed()}`),a$9({packageManager:p,role:d$3,buildCmd:y??null,configUpdated:i,nextSteps:r,elapsed:s.elapsedMs()}),b$3()&&d$2();}};async function v(o,s,a){let l=await readFile(o,"utf-8"),i=JSON.parse(l);if(i.scripts?.[s])return false;i.scripts||(i.scripts={}),i.scripts[s]=a;let r=l.match(/^(\s+)"/m)?.[1]||" ";return await G(o,JSON.stringify(i,null,r)+`
|
|
16
|
+
`),true}a$1(v,"addScript");async function Q(o,s,a){let l=join(o,".."),i=await a$2(l,s);if(i)return b.success(`Detected build script: ${n.default.cyan(i)}`),i;if(!a){b.warn("No build script found in package.json");let r=await b.prompt("Build command (e.g. tsc, tsup, rollup -c):",{type:"text",default:""});if(typeof r=="string"&&r.trim())return r.trim()}b.warn('No build command saved - add a "build" script to package.json or configure package.json#knarr.buildCmd');}a$1(Q,"detectBuildCommand");async function X(o){let s=[];return await v(o,"knarr:publish","knarr publish")&&s.push("knarr:publish"),await v(o,"knarr:dev","knarr dev")&&s.push("knarr:dev"),s}a$1(X,"addLibraryScripts");export{ge 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-
|
|
2
|
+
import {createRequire}from'node:module';import {a as a$4}from'./chunk-Z5K6DFA6.mjs';import {b as b$1,d}from'./chunk-QHNHLR6T.mjs';import {a as a$3,b as b$3}from'./chunk-U6O35NZ7.mjs';import'./chunk-NGPAGRK4.mjs';import {a as a$2,g}from'./chunk-QFHYSC3K.mjs';import'./chunk-W2MMKBWU.mjs';import {b as b$2}from'./chunk-M3TRMEJV.mjs';import {v,H}from'./chunk-BH2WXCLS.mjs';import'./chunk-E3HZCU3S.mjs';import'./chunk-SPHWZS5P.mjs';import {a,b}from'./chunk-OQDZJP55.mjs';import {c,a as a$1}from'./chunk-L7O2RSTN.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=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(()=>
|
|
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(()=>H(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$5,b as b$2}from'./chunk-7ROQJISX.mjs';import'./chunk-COI7GWH3.mjs';import'./chunk-QHNHLR6T.mjs';import'./chunk-ABG6UD3X.mjs';import'./chunk-XDWZZBCM.mjs';import'./chunk-WBTSRLB6.mjs';import'./chunk-QEH5VHRO.mjs';import'./chunk-UCSYKFEZ.mjs';import'./chunk-N3B2JO4H.mjs';import'./chunk-WN3DOKIM.mjs';import'./chunk-MN4DV2NO.mjs';import {a as a$2}from'./chunk-HVN6HBWZ.mjs';import'./chunk-FSVETLZK.mjs';import {a as a$3,b as b$3}from'./chunk-U6O35NZ7.mjs';import'./chunk-NGPAGRK4.mjs';import'./chunk-QFHYSC3K.mjs';import'./chunk-W2MMKBWU.mjs';import'./chunk-G7HFTV5Y.mjs';import {F,C,G}from'./chunk-BH2WXCLS.mjs';import {a as a$4,d}from'./chunk-E3HZCU3S.mjs';import {b as b$1,c as c$1}from'./chunk-SPHWZS5P.mjs';import {a,b}from'./chunk-OQDZJP55.mjs';import {c,a as a$1}from'./chunk-L7O2RSTN.mjs';import {resolve,join}from'path';import {readFile}from'fs/promises';globalThis.require=createRequire(import.meta.url);
|
|
3
|
+
var l=c(a(),1);var X={meta:{name:"migrate",description:"Migrate from yalc to Knarr"},args:{from:{type:"string",description:"Path to a local package source to publish and link after cleanup"},yes:{type:"boolean",alias:"y",description:"Skip confirmation prompts",default:false}},async run({args:a}){b$3(),await E({yes:a.yes,from:a.from});}};async function E(a={}){let n=new a$2,i=resolve(".");b.info(`Checking for yalc usage...
|
|
4
|
+
`);let o=join(i,".yalc"),r=join(i,"yalc.lock"),c=join(i,"package.json"),s=await F(o),m=await F(r);if(!s&&!m){b.info("No yalc usage detected in this project.");let t={migrated:false,packages:[],linkedPackages:[],plannedLinks:[],elapsed:n.elapsedMs()};return a$3(t),t}let f=await T(r,m);if(!a.yes){let t=await b.prompt("Migrate from yalc to Knarr? This will modify package.json and remove .yalc/ and yalc.lock.",{type:"confirm"});if(!t||typeof t=="symbol"){b.info("Cancelled");let p={migrated:false,packages:f,linkedPackages:[],plannedLinks:[],elapsed:n.elapsedMs()};return a$3(p),p}}if(f.length>0&&b.info(`Found ${f.length} yalc-linked package(s): ${f.map(t=>l.default.cyan(t)).join(", ")}`),await K(c),s&&(await C(o),b.success("Removed .yalc/ directory")),m){if(b$1())a$4({type:"remove",path:r});else {let{rm:t}=await import('fs/promises');await t(r,{force:true});}b.success("Removed yalc.lock");}let u=await H(f,a),b$2=[],d$1=[];if(u.length>0)for(let t of u){let p=`knarr add ${t.packageName} --from ${t.sourcePath}`;if(b$1()){a$4({type:"command-skip",path:i,detail:p}),d$1.push(p);continue}await a$5({packageArg:t.packageName,from:t.sourcePath,yes:a.yes??false,emitOutput:false}),b$2.push(t.packageName);}if(b.log(""),b.info(`${l.default.bold("Migration complete!")} Next steps:
|
|
5
|
+
`),u.length===0||d$1.length>0){b.log(` 1. ${l.default.cyan("knarr init")}`);let t=f.length>0?f:["<package>"],p=2;for(let w of t){let Y=d$1.find(F=>F.includes(` ${w} `))??`knarr add ${w} --from <path-to-${w}>`;b.log(` ${p}. ${l.default.cyan(Y)}`),p++;}}else {b.log(` 1. ${l.default.cyan("knarr doctor --fix")}`);for(let t of u)b.log(` 2. ${l.default.cyan(`cd ${t.sourcePath} && knarr dev`)}`);}b.log(`
|
|
6
|
+
Run ${l.default.cyan("knarr doctor")} to verify your setup.
|
|
7
|
+
`),b.info(`Migrated in ${n.elapsed()}`);let O={migrated:true,packages:f,linkedPackages:b$2,plannedLinks:d$1,elapsed:n.elapsedMs()};return a$3(O),b$1()&&d(),O}a$1(E,"runMigrate");async function T(a,n){if(!n)return [];try{let i=await readFile(a,"utf-8"),o=JSON.parse(i);return o.packages?Object.keys(o.packages):[]}catch{return b.warn("Could not parse yalc.lock - the file may be corrupted. Continuing with cleanup."),[]}}a$1(T,"readYalcPackages");async function K(a){if(await F(a))try{let n=await readFile(a,"utf-8"),i=JSON.parse(n),o=!1;for(let r of ["dependencies","devDependencies","peerDependencies"]){let c=i[r];if(c)for(let[s,m]of Object.entries(c))typeof m=="string"&&m.includes(".yalc/")&&(delete c[s],o=!0,b.info(`Removed file:.yalc/ reference for ${l.default.cyan(s)}`));}if(o){let r=n.match(/^(\s+)"/m)?.[1]||" ";await G(a,JSON.stringify(i,null,r)+`
|
|
8
|
+
`),b.success("Cleaned up package.json");}}catch(n){b.warn(`Could not clean package.json: ${n instanceof Error?n.message:String(n)}. You may need to manually remove file:.yalc/ references.`);}}a$1(K,"cleanupPackageJson");async function H(a,n){if(n.from)if(a.length>1){if(b.warn("--from is only used for one-package migrations; source paths are needed per package."),n.yes||c$1())return []}else {let o=resolve(n.from),r=await b$2(o);return a.length===1&&a[0]!==r&&b.warn(`yalc.lock lists ${a[0]}, but ${o} is ${r}; linking ${r}.`),[{packageName:r,sourcePath:o}]}if(a.length<=1||n.yes||c$1())return [];let i=[];for(let o of a){let r=await b.prompt(`Source path for ${o} (leave blank to skip):`,{type:"text",default:""});if(typeof r!="string"||!r.trim())continue;let c=resolve(r.trim()),s=await b$2(c);s!==o&&b.warn(`yalc.lock lists ${o}, but ${c} is ${s}; linking ${s}.`),i.push({packageName:s,sourcePath:c});}return i}a$1(H,"resolveMigrationSources");export{X as default,E as runMigrate};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {createRequire}from'node:module';export{b as addToTranspilePackages,a as hasTranspilePackage,c as removeFromTranspilePackages}from'./chunk-WBTSRLB6.mjs';import'./chunk-QEH5VHRO.mjs';import'./chunk-BH2WXCLS.mjs';import'./chunk-E3HZCU3S.mjs';import'./chunk-SPHWZS5P.mjs';import'./chunk-OQDZJP55.mjs';import'./chunk-L7O2RSTN.mjs';globalThis.require=createRequire(import.meta.url);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$2}from'./chunk-
|
|
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-
|
|
2
|
+
import {createRequire}from'node:module';import {a as a$2}from'./chunk-COI7GWH3.mjs';import'./chunk-QHNHLR6T.mjs';import {a as a$1}from'./chunk-XDWZZBCM.mjs';import {a}from'./chunk-HVN6HBWZ.mjs';import'./chunk-FSVETLZK.mjs';import {b,a as a$3}from'./chunk-U6O35NZ7.mjs';import'./chunk-NGPAGRK4.mjs';import'./chunk-W2MMKBWU.mjs';import'./chunk-G7HFTV5Y.mjs';import {v}from'./chunk-BH2WXCLS.mjs';import {d as d$1}from'./chunk-E3HZCU3S.mjs';import {d,b as b$2}from'./chunk-SPHWZS5P.mjs';import {b as b$1}from'./chunk-OQDZJP55.mjs';import'./chunk-L7O2RSTN.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-IXICTR6G.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-T6PNO4L3.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()&&d$1();}};export{O as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {createRequire}from'node:module';import {a as a$1}from'./chunk-GAWQLCRB.mjs';import'./chunk-ICU4V73X.mjs';import {e,g,a as a$3,d as d$1,c}from'./chunk-AA43FODB.mjs';import'./chunk-COI7GWH3.mjs';import'./chunk-QHNHLR6T.mjs';import'./chunk-ABG6UD3X.mjs';import'./chunk-XDWZZBCM.mjs';import {a}from'./chunk-3SXN6MQL.mjs';import'./chunk-WN3DOKIM.mjs';import'./chunk-MN4DV2NO.mjs';import'./chunk-HVN6HBWZ.mjs';import'./chunk-FSVETLZK.mjs';import {b}from'./chunk-U6O35NZ7.mjs';import'./chunk-NGPAGRK4.mjs';import'./chunk-QFHYSC3K.mjs';import'./chunk-W2MMKBWU.mjs';import'./chunk-7GCKCCHU.mjs';import'./chunk-G7HFTV5Y.mjs';import'./chunk-BH2WXCLS.mjs';import {d}from'./chunk-E3HZCU3S.mjs';import {b as b$1}from'./chunk-SPHWZS5P.mjs';import'./chunk-OQDZJP55.mjs';import {a as a$2}from'./chunk-L7O2RSTN.mjs';import {resolve}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
+
var S={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:i}){b();let e$1=resolve("."),s=await a(e$1),o={runScripts:!i["no-scripts"],force:i.force,historyLimit:s.historyLimit};if(i.all){let t=i.watch?await e(e$1,i):{canPush:true,failedPackages:new Set,skippedPackages:new Set},c=new Set([...t.failedPackages,...t.skippedPackages]);if(t.canPush&&await a$1(e$1,{...o,skipPackages:c}),b$1()){d();return}i.watch&&await g(e$1,i,o);}else {let t=a$2(()=>a$3(e$1,o),"push");if((!i.watch||await d$1(e$1,i,s))&&await t(),b$1()){d();return}i.watch&&await c(e$1,i,t);}}};export{S 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-RJSBXX2Q.mjs';import'./chunk-ABG6UD3X.mjs';import'./chunk-XDWZZBCM.mjs';import'./chunk-WBTSRLB6.mjs';import'./chunk-QEH5VHRO.mjs';import'./chunk-MN4DV2NO.mjs';import'./chunk-HVN6HBWZ.mjs';import'./chunk-FSVETLZK.mjs';import'./chunk-U6O35NZ7.mjs';import'./chunk-NGPAGRK4.mjs';import'./chunk-QFHYSC3K.mjs';import'./chunk-W2MMKBWU.mjs';import'./chunk-BH2WXCLS.mjs';import'./chunk-E3HZCU3S.mjs';import'./chunk-SPHWZS5P.mjs';import'./chunk-OQDZJP55.mjs';import'./chunk-L7O2RSTN.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-RJSBXX2Q.mjs';import'./chunk-ABG6UD3X.mjs';import'./chunk-XDWZZBCM.mjs';import'./chunk-WBTSRLB6.mjs';import'./chunk-QEH5VHRO.mjs';import {f}from'./chunk-N3B2JO4H.mjs';import'./chunk-MN4DV2NO.mjs';import {a}from'./chunk-HVN6HBWZ.mjs';import'./chunk-FSVETLZK.mjs';import {b,a as a$1}from'./chunk-U6O35NZ7.mjs';import'./chunk-NGPAGRK4.mjs';import {a as a$2}from'./chunk-QFHYSC3K.mjs';import'./chunk-W2MMKBWU.mjs';import {q,F,C}from'./chunk-BH2WXCLS.mjs';import {d as d$1}from'./chunk-E3HZCU3S.mjs';import {d,b as b$3}from'./chunk-SPHWZS5P.mjs';import {b as b$1}from'./chunk-OQDZJP55.mjs';import'./chunk-L7O2RSTN.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=q(o);if(!await F(c)){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 C(c),b$1.success("Removed .knarr/ directory");let l=join(o,"package.json");await F(l)&&await f(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()&&d$1();}};export{M as default};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {createRequire}from'node:module';import {b as b$3}from'./chunk-QHNHLR6T.mjs';import {a as a$3}from'./chunk-ABG6UD3X.mjs';import'./chunk-MN4DV2NO.mjs';import {a}from'./chunk-HVN6HBWZ.mjs';import {b as b$1,g,h}from'./chunk-FSVETLZK.mjs';import {b,a as a$2}from'./chunk-U6O35NZ7.mjs';import'./chunk-NGPAGRK4.mjs';import {a as a$1,d}from'./chunk-QFHYSC3K.mjs';import'./chunk-W2MMKBWU.mjs';import {v}from'./chunk-BH2WXCLS.mjs';import {d as d$2}from'./chunk-E3HZCU3S.mjs';import {d as d$1,b as b$4}from'./chunk-SPHWZS5P.mjs';import {b as b$2}from'./chunk-OQDZJP55.mjs';import'./chunk-L7O2RSTN.mjs';import {resolve}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
+
var D=v(4),q={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:j}){b();let l=new a,t=resolve("."),L=await a$1(t),i=await b$1(t);(await g(t)||i.packageManager==="yarn"&&await h(t))&&(b$2.error(`Yarn PnP mode is not compatible with Knarr.
|
|
4
|
+
|
|
5
|
+
Knarr works by copying files into node_modules/, but PnP eliminates
|
|
6
|
+
node_modules/ entirely. To use Knarr with Yarn Berry, add one of these
|
|
7
|
+
to .yarnrc.yml:
|
|
8
|
+
|
|
9
|
+
nodeLinker: node-modules
|
|
10
|
+
nodeLinker: pnpm
|
|
11
|
+
|
|
12
|
+
Then run: yarn install`),process.exit(1));let d$3=Object.entries(L.links);if(d$3.length===0){j.silent||b$2.info("No linked packages in this project"),a$2({restored:0,failed:0});return}let a$4=0,c=0,I=await Promise.all(d$3.map(([e,s])=>D(async()=>{let o=await b$3(e,s.version);if(!o)return b$2.warn(`Store entry missing for ${e}@${s.version}. Re-publish it.`),{packageName:e,success:false};try{let n=i.source==="default"?s.packageManager:i.packageManager,u=await a$3(o,t,n);return await d(t,e,{...s,contentHash:o.meta.contentHash,buildId:o.meta.buildId??"",linkedAt:new Date().toISOString(),packageManager:n}),d$1(`[restore] ${e}@${s.version}: ${u.copied} files`),{packageName:e,success:!0,copied:u.copied}}catch(n){return b$2.error(`Failed to restore ${e}: ${n instanceof Error?n.message:String(n)}`),{packageName:e,success:false}}}))),m=[];for(let e of I)e.success?(b$2.success(`Restored ${e.packageName} (${e.copied} files)`),a$4++):(c++,m.push(e.packageName));b$2.info(`Restore complete: ${a$4} restored, ${c} failed in ${l.elapsed()}`),a$2({restored:a$4,failed:c,failedPackages:m,elapsed:l.elapsedMs()}),b$4()&&d$2();}};export{q as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {createRequire}from'node:module';import {b as b$4}from'./chunk-AA43FODB.mjs';import'./chunk-COI7GWH3.mjs';import {b as b$3}from'./chunk-QHNHLR6T.mjs';import'./chunk-ABG6UD3X.mjs';import {a as a$4}from'./chunk-XDWZZBCM.mjs';import {a as a$5}from'./chunk-3SXN6MQL.mjs';import'./chunk-WN3DOKIM.mjs';import'./chunk-MN4DV2NO.mjs';import'./chunk-HVN6HBWZ.mjs';import'./chunk-FSVETLZK.mjs';import {a as a$3,b}from'./chunk-U6O35NZ7.mjs';import'./chunk-NGPAGRK4.mjs';import'./chunk-QFHYSC3K.mjs';import'./chunk-W2MMKBWU.mjs';import {b as b$1,g,d}from'./chunk-M3TRMEJV.mjs';import'./chunk-G7HFTV5Y.mjs';import'./chunk-BH2WXCLS.mjs';import {d as d$1}from'./chunk-E3HZCU3S.mjs';import {b as b$5}from'./chunk-SPHWZS5P.mjs';import {a as a$1,b as b$2}from'./chunk-OQDZJP55.mjs';import {c,a as a$2}from'./chunk-L7O2RSTN.mjs';import {resolve}from'path';import {readFile}from'fs/promises';globalThis.require=createRequire(import.meta.url);
|
|
3
|
+
var m=c(a$1(),1);function a(t){a$3({rolledBack:t.rolledBack??false,buildId:t.buildId??null,pushed:t.pushed??false,pushSummary:t.pushSummary??null,pushError:t.pushError??null});}a$2(a,"outputRollback");var z={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:t}){b();let p=resolve("."),r;try{r=JSON.parse(await readFile(resolve(p,"package.json"),"utf-8"));}catch{a$4("No package.json found in current directory"),process.exit(1);}(!r.name||!r.version)&&(a$4("package.json missing name or version field"),process.exit(1));let s=await b$1(r.name,r.version);if(s.length===0){b$2.info("No build history available"),a({rolledBack:false});return}let e;if(t["build-id"]){if(e=t["build-id"],!s.find(u=>u.buildId===e)){b$2.error(`Build ${e} not found in history`),b$2.info("Available builds:");for(let u of s)b$2.log(` ${m.default.cyan(u.buildId)} ${m.default.dim(u.publishedAt)}`);a({rolledBack:false});return}}else e=s[0].buildId;let w=s.find(o=>o.buildId===e);if(!t.yes){let o=await b$2.prompt(`Restore build ${e} (published ${w.publishedAt})?`,{type:"confirm"});if(!o||typeof o=="symbol"){b$2.info("Cancelled"),a({rolledBack:false,buildId:e});return}}let R=await a$5(p),C=g(R.historyLimit);if(!await d(r.name,r.version,e,C)){b$2.error(`Failed to restore build ${e}`),a({rolledBack:false,buildId:e});return}b$2.success(`Restored ${r.name}@${r.version} to build ${e}`);let l=null,n;try{let o=await b$3(r.name,r.version);o?(l=await b$4(o,{force:!0,emitOutput:!1}),l.failedConsumers>0&&(process.exitCode=1)):(n=`Store entry missing after rollback for ${r.name}@${r.version}`,b$2.warn(n),process.exitCode=1);}catch(o){n=o instanceof Error?o.message:String(o),b$2.warn(`Push after rollback failed: ${n}`),process.exitCode=1;}a({rolledBack:true,buildId:e,pushed:l?l.failedConsumers===0:false,pushSummary:l,pushError:n}),b$5()&&d$1();}};export{z 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-
|
|
2
|
+
import {createRequire}from'node:module';import {b as b$2}from'./chunk-QHNHLR6T.mjs';import {b,a as a$2}from'./chunk-U6O35NZ7.mjs';import'./chunk-NGPAGRK4.mjs';import {a as a$1}from'./chunk-QFHYSC3K.mjs';import'./chunk-W2MMKBWU.mjs';import {v,F}from'./chunk-BH2WXCLS.mjs';import'./chunk-E3HZCU3S.mjs';import'./chunk-SPHWZS5P.mjs';import {a,b as b$1}from'./chunk-OQDZJP55.mjs';import {c}from'./chunk-L7O2RSTN.mjs';import {resolve,join}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
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
|
|
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 F(f)||e.push("missing from node_modules (run knarr restore)"),await F(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};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {t,
|
|
2
|
+
import {createRequire}from'node:module';import {t,G}from'./chunk-BH2WXCLS.mjs';import'./chunk-E3HZCU3S.mjs';import'./chunk-SPHWZS5P.mjs';import'./chunk-OQDZJP55.mjs';import {a}from'./chunk-L7O2RSTN.mjs';import {readdir,readFile}from'fs/promises';import {join,dirname,relative}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
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
4
|
`+f+e.slice(m);}else e=f+`
|
|
5
|
-
`+e;return await
|
|
5
|
+
`+e;return await G(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 G(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};
|
|
@@ -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-QFHYSC3K.mjs';import'./chunk-W2MMKBWU.mjs';import'./chunk-BH2WXCLS.mjs';import'./chunk-E3HZCU3S.mjs';import'./chunk-SPHWZS5P.mjs';import'./chunk-OQDZJP55.mjs';import'./chunk-L7O2RSTN.mjs';globalThis.require=createRequire(import.meta.url);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {createRequire}from'node:module';import {c}from'./chunk-QHNHLR6T.mjs';import {a as a$4}from'./chunk-ABG6UD3X.mjs';import {a as a$3}from'./chunk-XDWZZBCM.mjs';import'./chunk-MN4DV2NO.mjs';import {a}from'./chunk-HVN6HBWZ.mjs';import {b as b$1,g,h}from'./chunk-FSVETLZK.mjs';import {b,a as a$2}from'./chunk-U6O35NZ7.mjs';import'./chunk-NGPAGRK4.mjs';import {a as a$1,d as d$1}from'./chunk-QFHYSC3K.mjs';import'./chunk-W2MMKBWU.mjs';import {v,f}from'./chunk-BH2WXCLS.mjs';import'./chunk-E3HZCU3S.mjs';import {d}from'./chunk-SPHWZS5P.mjs';import {b as b$2}from'./chunk-OQDZJP55.mjs';import'./chunk-L7O2RSTN.mjs';import {resolve}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
+
var T=v(4),Q={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:i}){b();let k=new a,n=resolve("."),Y=await a$1(n),d$2=await b$1(n);(await g(n)||d$2.packageManager==="yarn"&&await h(n))&&(b$2.error(`Yarn PnP mode is not compatible with Knarr.
|
|
4
|
+
|
|
5
|
+
Knarr works by copying files into node_modules/, but PnP eliminates
|
|
6
|
+
node_modules/ entirely. To use Knarr with Yarn Berry, add one of these
|
|
7
|
+
to .yarnrc.yml:
|
|
8
|
+
|
|
9
|
+
nodeLinker: node-modules
|
|
10
|
+
nodeLinker: pnpm
|
|
11
|
+
|
|
12
|
+
Then run: yarn install`),process.exit(1));let c$1=Object.entries(Y.links);if(c$1.length===0){b$2.info("No linked packages in this project"),a$2({updated:0,skipped:0});return}let h$1=i.package?c$1.filter(([e])=>e===i.package):c$1;i.package&&h$1.length===0&&(a$3(`Package "${i.package}" is not linked in this project. Run 'knarr list' to see linked packages.`),process.exit(1));let m=0,l=0,o=0,s=0,x=await Promise.all(h$1.map(([e,p])=>T(async()=>{let t=await c(e);if(!t)return b$2.warn(`Store entry missing for ${e}. Re-publish it.`),"missing";let f$1=d$2.source==="default"?p.packageManager:d$2.packageManager,C=f$1!==p.packageManager;if(t.meta.contentHash===p.contentHash&&!C)return d(`[update] ${e}@${t.version} already up to date`),"skipped";try{let a=await a$4(t,n,f$1),K={...p,version:t.version,contentHash:t.meta.contentHash,buildId:t.meta.buildId??"",linkedAt:new Date().toISOString(),packageManager:f$1};return await d$1(n,e,K),await f(n,e,t.version),b$2.success(`Updated ${e}@${t.version} (${a.copied} files changed)`),"updated"}catch(a){return b$2.warn(`Failed to update ${e}: ${a instanceof Error?a.message:String(a)}`),"failed"}})));for(let e of x)e==="updated"?m++:e==="skipped"?l++:e==="missing"?o++:s++;let u=[`${m} updated`,`${l} unchanged`];o>0&&u.push(`${o} missing`),s>0&&u.push(`${s} failed`),b$2.info(`Update complete: ${u.join(", ")} in ${k.elapsed()}`),a$2({updated:m,skipped:l,missing:o,failed:s,elapsed:k.elapsedMs()});}};export{Q as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {createRequire}from'node:module';import {b as b$1,a as a$1}from'./chunk-7ROQJISX.mjs';import'./chunk-COI7GWH3.mjs';import'./chunk-QHNHLR6T.mjs';import'./chunk-ABG6UD3X.mjs';import'./chunk-XDWZZBCM.mjs';import'./chunk-WBTSRLB6.mjs';import'./chunk-QEH5VHRO.mjs';import'./chunk-UCSYKFEZ.mjs';import'./chunk-N3B2JO4H.mjs';import'./chunk-WN3DOKIM.mjs';import'./chunk-MN4DV2NO.mjs';import {a}from'./chunk-HVN6HBWZ.mjs';import'./chunk-FSVETLZK.mjs';import {b}from'./chunk-U6O35NZ7.mjs';import'./chunk-NGPAGRK4.mjs';import'./chunk-QFHYSC3K.mjs';import'./chunk-W2MMKBWU.mjs';import'./chunk-G7HFTV5Y.mjs';import'./chunk-BH2WXCLS.mjs';import'./chunk-E3HZCU3S.mjs';import'./chunk-SPHWZS5P.mjs';import'./chunk-OQDZJP55.mjs';import'./chunk-L7O2RSTN.mjs';import {resolve}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
+
var c={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},build:{type:"string",description:"Build command to run before publishing"},"skip-build":{type:"boolean",description:"Skip build detection before publishing",default:false},yes:{type:"boolean",alias:"y",description:"Auto-accept prompts (install missing deps, etc.)",default:false}},async run({args:e}){b();let r=new a,i=resolve(e.path),s=await b$1(i);await a$1({packageArg:s,from:i,build:e.build,skipBuild:e["skip-build"],yes:e.yes,timer:r});}};export{c as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {createRequire}from'node:module';export{c as addKnarrVitePlugin,a as hasKnarrVitePlugin,b as isComplexConfig,d as removeFromViteConfig}from'./chunk-QEH5VHRO.mjs';import'./chunk-BH2WXCLS.mjs';import'./chunk-E3HZCU3S.mjs';import'./chunk-SPHWZS5P.mjs';import'./chunk-OQDZJP55.mjs';import'./chunk-L7O2RSTN.mjs';globalThis.require=createRequire(import.meta.url);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {createRequire}from'node:module';import {f,a as a$2}from'./chunk-AA43FODB.mjs';import'./chunk-COI7GWH3.mjs';import'./chunk-QHNHLR6T.mjs';import'./chunk-ABG6UD3X.mjs';import'./chunk-XDWZZBCM.mjs';import {a as a$1}from'./chunk-3SXN6MQL.mjs';import'./chunk-WN3DOKIM.mjs';import'./chunk-MN4DV2NO.mjs';import'./chunk-HVN6HBWZ.mjs';import'./chunk-FSVETLZK.mjs';import'./chunk-U6O35NZ7.mjs';import'./chunk-QFHYSC3K.mjs';import'./chunk-W2MMKBWU.mjs';import'./chunk-G7HFTV5Y.mjs';import'./chunk-BH2WXCLS.mjs';import'./chunk-E3HZCU3S.mjs';import {d}from'./chunk-SPHWZS5P.mjs';import {b}from'./chunk-OQDZJP55.mjs';import {a}from'./chunk-L7O2RSTN.mjs';globalThis.require=createRequire(import.meta.url);
|
|
3
|
+
var S=class{static{a(this,"WatchOrchestrator");}packages=new Map;dependents=new Map;cascade;pushOptions={};constructor(e){this.cascade=e;}async start(e,a$3,s){this.pushOptions=s;let{buildWorkspaceGraph:o,buildReverseAdjacency:h,filterPublishableWorkspaceGraph:E}=await import('./workspace-T6PNO4L3.mjs'),{topoSort:q,CycleError:R}=await import('./topo-sort-ZNGR6D7M.mjs'),{startWatcher:W}=await import('./watcher-KOLIXRUG.mjs'),f$1=await o(e),c=E(f$1);if(c.packages.length===0){b.warn("No publishable workspace packages found");return}let w=f$1.packages.length-c.packages.length;w>0&&b.info(`Skipping ${w} private workspace package(s)`);let m;try{m=q(c.adjacency);}catch(t){if(t instanceof R){b.error(`Cannot watch: ${t.message}`);return}throw t}this.cascade&&(this.dependents=h(c.adjacency),b.info("Cascade mode enabled"));let j=new Map(c.packages.map(t=>[t.name,t.dir]));for(let t of m){let i=j.get(t);if(!i)continue;let u=await a$1(i),{buildCmd:k,patterns:M}=await f(i,a$3,u),O=a$3.notify??u.notify??false,x=a(async()=>{await this.runExclusive(t,async()=>{let p=await a$2(i,s);$(p,t),await this.onPackagePushed(t);});},"wrappedOnChange"),P=a(p=>{if(!p)return;let b=parseInt(p,10);return Number.isFinite(b)?b:void 0},"parseMs"),y={dir:i,buildCmd:k,state:"idle",watcher:{close:a(async()=>{},"close")}};this.packages.set(t,y);let G=await W(i,{patterns:M,buildCmd:k,debounce:P(a$3.debounce)??u.debounce,cooldown:P(a$3.cooldown)??u.cooldown,notify:O},x);y.watcher=G;}b.info(`Watching ${this.packages.size} workspace packages`),await new Promise(t=>{let i=a(async()=>{b.info("Stopping watchers..."),await this.close(),t();},"cleanup");process.once("SIGINT",i),process.once("SIGTERM",i);});}async onPackagePushed(e){if(!this.cascade)return;let a=this.dependents.get(e);if(!(!a||a.size===0)){d(`[cascade] ${e} pushed, triggering dependents: ${[...a].join(", ")}`);for(let s of a)await this.requestRebuild(s);}}async runExclusive(e,a){let s=this.packages.get(e);if(s){if(s.state==="queued"){d(`[cascade] ${e} already queued, skipping`);return}if(s.state==="building"){d(`[cascade] ${e} is building, marking as queued`),s.state="queued";return}s.state="building";try{await a(s);}finally{let o=s.state==="queued";s.state="idle",o&&await this.requestRebuild(e);}}}async requestRebuild(e){await this.runExclusive(e,async a=>{if(d(`[cascade] Rebuilding ${e}`),a.buildCmd){let{runBuildCommand:o}=await import('./watcher-KOLIXRUG.mjs');if(!await o(a.buildCmd,a.dir)){b.warn(`[cascade] Build failed for ${e}, skipping dependents`);return}}let s=await a$2(a.dir,this.pushOptions);$(s,e),await this.onPackagePushed(e);}).catch(a=>{b.warn(`[cascade] Push failed for ${e}: ${a instanceof Error?a.message:String(a)}`);});}async close(){await Promise.all([...this.packages.values()].map(e=>e.watcher.close())),this.packages.clear();}};function $(g,e){if(g.failedConsumers!==0)throw new Error(`Push for ${e} failed for ${g.failedConsumers} consumer(s)`)}a($,"assertPushSucceeded");export{S as WatchOrchestrator};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {createRequire}from'node:module';import {a as a$1}from'./chunk-J6HZHQVL.mjs';import {b}from'./chunk-OQDZJP55.mjs';import {a}from'./chunk-L7O2RSTN.mjs';import {spawn}from'child_process';import {readdir,stat}from'fs/promises';import {platform}from'os';import {join}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
+
var y=new Set;function _(){for(let i of y)i.killed||i.kill("SIGTERM");y.clear();}a(_,"killActiveBuild");var G=new Set(["node_modules",".git",".knarr"]);async function E(i,e){let s;try{s=await readdir(i,{withFileTypes:!0});}catch{return}for(let o of s){if(G.has(o.name))continue;let f=join(i,o.name);if(o.isDirectory())await E(f,e);else try{let m=await stat(f);e.set(f,m.mtimeMs);}catch{}}}a(E,"walkDir");async function I(i){let e=new Map;for(let s of i)try{let o=await stat(s);o.isDirectory()?await E(s,e):e.set(s,o.mtimeMs);}catch{}return e}a(I,"buildSnapshot");async function Q(i,e,s){let{watch:o}=await import('./chokidar-2G63V464.mjs'),f=e.patterns??["src","lib"],m=f.map(n=>n.startsWith("/")||n.includes(":")?n:`${i}/${n}`),d=e.debounce??500,a$2=e.cooldown??500,t=null,h=false,b$1=false,w=0,C=0,P=null,T=false,v=a(async()=>{if(h||b$1)return;let n=Date.now()-w;if(w>0&&n<a$2){let r=a$2-n;t&&clearTimeout(t),t=setTimeout(()=>{t=null,v();},r);return}b$1=true,T=false,C++;try{if(b.info(`Change cycle #${C} started`),e.buildCmd&&!await N(e.buildCmd,i)){if(b.warn("Build failed (see output above), skipping push"+(P?`. Last successful push: ${P.toLocaleTimeString()}`:". No successful push yet.")),e.notify){let{ringBell:c}=await import('./bell-SIN4ERLS.mjs');c(!0);}return}await s(),P=new Date,e.notify&&a$1(!0);}catch(r){b.error(`Push failed: ${r instanceof Error?r.message:String(r)}`),e.notify&&a$1(true);}finally{b$1=false,w=Date.now(),T&&!h&&(T=false,t=setTimeout(()=>{t=null,v();},a$2));}},"doBuild"),g=a(n=>{if(h)return;if(b$1){T=true;return}let r=Date.now()-w;if(w>0&&r<a$2){t&&clearTimeout(t);let c=a$2-r;t=setTimeout(()=>{t=null,v();},c+d);return}t&&clearTimeout(t),t=setTimeout(()=>{t=null,v();},d);},"onFileEvent"),R=e.buildCmd?false:e.awaitWriteFinish??{stabilityThreshold:200,pollInterval:50},B=!!process.versions?.webcontainer,p=o(m,{ignoreInitial:true,ignored:[/[/\\]node_modules[/\\]/,/[/\\]\.git[/\\]/,/[/\\]\.knarr[/\\]/],awaitWriteFinish:R,usePolling:B,...B&&{interval:1e3}});p.on("change",g),p.on("add",g),p.on("unlink",g),p.on("error",n=>{b.error(`Watcher error: ${n instanceof Error?n.message:String(n)}`);});let S=null;if(B){let n=await I(m);S=setInterval(async()=>{if(!h)try{let r=await I(m);for(let[c,F]of r){let $=n.get(c);if($===void 0||$!==F){g(c);break}}if(!h){for(let c of n.keys())if(!r.has(c)){g(c);break}}n=r;}catch{}},1e3);}let W={close:a(async()=>{h=true,S&&clearInterval(S),t&&clearTimeout(t),_(),await p.close();},"close")};return b.info(`Watching for changes in: ${f.join(", ")}`),W}a(Q,"startWatcher");function N(i,e){return new Promise(s=>{let o=platform()==="win32",f=o?"cmd":"sh",m=o?"/c":"-c";b.start(`Running: ${i}`);let d=spawn(f,[m,i],{cwd:e,stdio:"inherit"});y.add(d),d.on("close",a=>{y.delete(d),a===0?(b.success("Build succeeded"),s(true)):(b.error(`Build failed with code ${a}`),s(false));}),d.on("error",a=>{y.delete(d),b.error(`Build error: ${a.message}`),s(false);});})}a(N,"runBuildCommand");export{_ as killActiveBuild,N as runBuildCommand,Q as startWatcher};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {createRequire}from'node:module';export{g as buildReverseAdjacency,e as buildWorkspaceGraph,f as filterPublishableWorkspaceGraph,b as findWorkspacePackageRoot,d as findWorkspacePackages,a as findWorkspaceRoot,c as parseCatalogs}from'./chunk-7GCKCCHU.mjs';import'./chunk-G7HFTV5Y.mjs';import'./chunk-BH2WXCLS.mjs';import'./chunk-E3HZCU3S.mjs';import'./chunk-SPHWZS5P.mjs';import'./chunk-OQDZJP55.mjs';import'./chunk-L7O2RSTN.mjs';globalThis.require=createRequire(import.meta.url);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a}from'./chunk-
|
|
2
|
+
import {createRequire}from'node:module';import {a}from'./chunk-L7O2RSTN.mjs';globalThis.require=createRequire(import.meta.url);
|
|
3
3
|
var j=new Uint8Array([0,97,115,109,1,0,0,0,1,48,8,96,3,127,127,127,1,127,96,3,127,127,127,0,96,2,127,127,0,96,1,127,1,127,96,3,127,127,126,1,126,96,3,126,127,127,1,126,96,2,127,126,0,96,1,127,1,126,3,11,10,0,0,2,1,3,4,5,6,1,7,5,3,1,0,1,7,85,9,3,109,101,109,2,0,5,120,120,104,51,50,0,0,6,105,110,105,116,51,50,0,2,8,117,112,100,97,116,101,51,50,0,3,8,100,105,103,101,115,116,51,50,0,4,5,120,120,104,54,52,0,5,6,105,110,105,116,54,52,0,7,8,117,112,100,97,116,101,54,52,0,8,8,100,105,103,101,115,116,54,52,0,9,10,251,22,10,242,1,1,4,127,32,0,32,1,106,33,3,32,1,65,16,79,4,127,32,3,65,16,107,33,6,32,2,65,168,136,141,161,2,106,33,3,32,2,65,137,235,208,208,7,107,33,4,32,2,65,207,140,162,142,6,106,33,5,3,64,32,3,32,0,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,3,32,4,32,0,65,4,106,34,0,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,4,32,2,32,0,65,4,106,34,0,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,2,32,5,32,0,65,4,106,34,0,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,5,32,6,32,0,65,4,106,34,0,79,13,0,11,32,2,65,12,119,32,5,65,18,119,106,32,4,65,7,119,106,32,3,65,1,119,106,5,32,2,65,177,207,217,178,1,106,11,32,1,106,32,0,32,1,65,15,113,16,1,11,146,1,0,32,1,32,2,106,33,2,3,64,32,1,65,4,106,32,2,75,69,4,64,32,0,32,1,40,2,0,65,189,220,202,149,124,108,106,65,17,119,65,175,214,211,190,2,108,33,0,32,1,65,4,106,33,1,12,1,11,11,3,64,32,1,32,2,79,69,4,64,32,0,32,1,45,0,0,65,177,207,217,178,1,108,106,65,11,119,65,177,243,221,241,121,108,33,0,32,1,65,1,106,33,1,12,1,11,11,32,0,32,0,65,15,118,115,65,247,148,175,175,120,108,34,0,65,13,118,32,0,115,65,189,220,202,149,124,108,34,0,65,16,118,32,0,115,11,63,0,32,0,65,8,106,32,1,65,168,136,141,161,2,106,54,2,0,32,0,65,12,106,32,1,65,137,235,208,208,7,107,54,2,0,32,0,65,16,106,32,1,54,2,0,32,0,65,20,106,32,1,65,207,140,162,142,6,106,54,2,0,11,195,4,1,6,127,32,1,32,2,106,33,6,32,0,65,24,106,33,4,32,0,65,40,106,40,2,0,33,3,32,0,32,0,40,2,0,32,2,106,54,2,0,32,0,65,4,106,34,5,32,5,40,2,0,32,2,65,16,79,32,0,40,2,0,65,16,79,114,114,54,2,0,32,2,32,3,106,65,16,73,4,64,32,3,32,4,106,32,1,32,2,252,10,0,0,32,0,65,40,106,32,2,32,3,106,54,2,0,15,11,32,3,4,64,32,3,32,4,106,32,1,65,16,32,3,107,34,2,252,10,0,0,32,0,65,8,106,34,3,32,3,40,2,0,32,4,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,54,2,0,32,0,65,12,106,34,3,32,3,40,2,0,32,4,65,4,106,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,54,2,0,32,0,65,16,106,34,3,32,3,40,2,0,32,4,65,8,106,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,54,2,0,32,0,65,20,106,34,3,32,3,40,2,0,32,4,65,12,106,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,54,2,0,32,0,65,40,106,65,0,54,2,0,32,1,32,2,106,33,1,11,32,1,32,6,65,16,107,77,4,64,32,6,65,16,107,33,8,32,0,65,8,106,40,2,0,33,2,32,0,65,12,106,40,2,0,33,3,32,0,65,16,106,40,2,0,33,5,32,0,65,20,106,40,2,0,33,7,3,64,32,2,32,1,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,2,32,3,32,1,65,4,106,34,1,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,3,32,5,32,1,65,4,106,34,1,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,5,32,7,32,1,65,4,106,34,1,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,7,32,8,32,1,65,4,106,34,1,79,13,0,11,32,0,65,8,106,32,2,54,2,0,32,0,65,12,106,32,3,54,2,0,32,0,65,16,106,32,5,54,2,0,32,0,65,20,106,32,7,54,2,0,11,32,1,32,6,73,4,64,32,4,32,1,32,6,32,1,107,34,1,252,10,0,0,32,0,65,40,106,32,1,54,2,0,11,11,97,1,1,127,32,0,65,16,106,40,2,0,33,1,32,0,65,4,106,40,2,0,4,127,32,1,65,12,119,32,0,65,20,106,40,2,0,65,18,119,106,32,0,65,12,106,40,2,0,65,7,119,106,32,0,65,8,106,40,2,0,65,1,119,106,5,32,1,65,177,207,217,178,1,106,11,32,0,40,2,0,106,32,0,65,24,106,32,0,65,40,106,40,2,0,16,1,11,255,3,2,3,126,1,127,32,0,32,1,106,33,6,32,1,65,32,79,4,126,32,6,65,32,107,33,6,32,2,66,214,235,130,238,234,253,137,245,224,0,124,33,3,32,2,66,177,169,172,193,173,184,212,166,61,125,33,4,32,2,66,249,234,208,208,231,201,161,228,225,0,124,33,5,3,64,32,3,32,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,3,32,4,32,0,65,8,106,34,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,4,32,2,32,0,65,8,106,34,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,2,32,5,32,0,65,8,106,34,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,5,32,6,32,0,65,8,106,34,0,79,13,0,11,32,2,66,12,137,32,5,66,18,137,124,32,4,66,7,137,124,32,3,66,1,137,124,32,3,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,32,4,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,32,2,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,32,5,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,5,32,2,66,197,207,217,178,241,229,186,234,39,124,11,32,1,173,124,32,0,32,1,65,31,113,16,6,11,134,2,0,32,1,32,2,106,33,2,3,64,32,2,32,1,65,8,106,79,4,64,32,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,32,0,133,66,27,137,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,33,0,32,1,65,8,106,33,1,12,1,11,11,32,1,65,4,106,32,2,77,4,64,32,0,32,1,53,2,0,66,135,149,175,175,152,182,222,155,158,127,126,133,66,23,137,66,207,214,211,190,210,199,171,217,66,126,66,249,243,221,241,153,246,153,171,22,124,33,0,32,1,65,4,106,33,1,11,3,64,32,1,32,2,73,4,64,32,0,32,1,49,0,0,66,197,207,217,178,241,229,186,234,39,126,133,66,11,137,66,135,149,175,175,152,182,222,155,158,127,126,33,0,32,1,65,1,106,33,1,12,1,11,11,32,0,32,0,66,33,136,133,66,207,214,211,190,210,199,171,217,66,126,34,0,32,0,66,29,136,133,66,249,243,221,241,153,246,153,171,22,126,34,0,32,0,66,32,136,133,11,77,0,32,0,65,8,106,32,1,66,214,235,130,238,234,253,137,245,224,0,124,55,3,0,32,0,65,16,106,32,1,66,177,169,172,193,173,184,212,166,61,125,55,3,0,32,0,65,24,106,32,1,55,3,0,32,0,65,32,106,32,1,66,249,234,208,208,231,201,161,228,225,0,124,55,3,0,11,244,4,2,3,127,4,126,32,1,32,2,106,33,5,32,0,65,40,106,33,4,32,0,65,200,0,106,40,2,0,33,3,32,0,32,0,41,3,0,32,2,173,124,55,3,0,32,2,32,3,106,65,32,73,4,64,32,3,32,4,106,32,1,32,2,252,10,0,0,32,0,65,200,0,106,32,2,32,3,106,54,2,0,15,11,32,3,4,64,32,3,32,4,106,32,1,65,32,32,3,107,34,2,252,10,0,0,32,0,65,8,106,34,3,32,3,41,3,0,32,4,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,55,3,0,32,0,65,16,106,34,3,32,3,41,3,0,32,4,65,8,106,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,55,3,0,32,0,65,24,106,34,3,32,3,41,3,0,32,4,65,16,106,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,55,3,0,32,0,65,32,106,34,3,32,3,41,3,0,32,4,65,24,106,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,55,3,0,32,0,65,200,0,106,65,0,54,2,0,32,1,32,2,106,33,1,11,32,1,65,32,106,32,5,77,4,64,32,5,65,32,107,33,2,32,0,65,8,106,41,3,0,33,6,32,0,65,16,106,41,3,0,33,7,32,0,65,24,106,41,3,0,33,8,32,0,65,32,106,41,3,0,33,9,3,64,32,6,32,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,6,32,7,32,1,65,8,106,34,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,7,32,8,32,1,65,8,106,34,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,8,32,9,32,1,65,8,106,34,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,9,32,2,32,1,65,8,106,34,1,79,13,0,11,32,0,65,8,106,32,6,55,3,0,32,0,65,16,106,32,7,55,3,0,32,0,65,24,106,32,8,55,3,0,32,0,65,32,106,32,9,55,3,0,11,32,1,32,5,73,4,64,32,4,32,1,32,5,32,1,107,34,1,252,10,0,0,32,0,65,200,0,106,32,1,54,2,0,11,11,188,2,1,5,126,32,0,65,24,106,41,3,0,33,1,32,0,41,3,0,34,2,66,32,90,4,126,32,0,65,8,106,41,3,0,34,3,66,1,137,32,0,65,16,106,41,3,0,34,4,66,7,137,124,32,1,66,12,137,32,0,65,32,106,41,3,0,34,5,66,18,137,124,124,32,3,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,32,4,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,32,1,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,32,5,66,207,214,211,190,210,199,171,217,66,126,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,157,163,181,234,131,177,141,138,250,0,125,5,32,1,66,197,207,217,178,241,229,186,234,39,124,11,32,2,124,32,0,65,40,106,32,2,66,31,131,167,16,6,11]);async function k(){return (function(x){let{exports:{mem:o,xxh32:d,xxh64:w,init32:S,update32:A,digest32:U,init64:m,update64:I,digest64:T}}=x,r=new Uint8Array(o.buffer);function i(t,n){if(o.buffer.byteLength<t+n){let y=Math.ceil((t+n-o.buffer.byteLength)/65536);o.grow(y),r=new Uint8Array(o.buffer);}}a(i,"g");function l(t,n,y,E,M,W){i(t);let s=new Uint8Array(t);return r.set(s),y(0,n),s.set(r.subarray(0,t)),{update(a){let b;return r.set(s),typeof a=="string"?(i(3*a.length,t),b=f.encodeInto(a,r.subarray(t)).written):(i(a.byteLength,t),r.set(a,t),b=a.byteLength),E(0,t,b),s.set(r.subarray(0,t)),this},digest:a(()=>(r.set(s),W(M(0))),"digest")}}a(l,"f");function h(t){return t>>>0}a(h,"y");let R=2n**64n-1n;function g(t){return t&R}a(g,"d");let f=new TextEncoder,u=0,c=0n;function p(t,n=u){return i(3*t.length,0),h(d(0,f.encodeInto(t,r).written,n))}a(p,"x");function L(t,n=c){return i(3*t.length,0),g(w(0,f.encodeInto(t,r).written,n))}return a(L,"L"),{h32:p,h32ToString:a((t,n=u)=>p(t,n).toString(16).padStart(8,"0"),"h32ToString"),h32Raw:a((t,n=u)=>(i(t.byteLength,0),r.set(t),h(d(0,t.byteLength,n))),"h32Raw"),create32:a((t=u)=>l(48,t,S,A,U,h),"create32"),h64:L,h64ToString:a((t,n=c)=>L(t,n).toString(16).padStart(16,"0"),"h64ToString"),h64Raw:a((t,n=c)=>(i(t.byteLength,0),r.set(t),g(w(0,t.byteLength,n))),"h64Raw"),create64:a((t=c)=>l(88,t,m,I,T,g),"create64")}})((await WebAssembly.instantiate(j)).instance)}a(k,"e");export{k as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knarr",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Copy local npm package builds into consumer node_modules with incremental sync and watch mode.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"dev": "tsup --watch",
|
|
44
44
|
"test": "vitest run",
|
|
45
45
|
"test:watch": "vitest",
|
|
46
|
+
"compat:smoke": "node scripts/compat-smoke.mjs",
|
|
46
47
|
"bench": "vitest bench",
|
|
47
48
|
"lint": "tsc --noEmit",
|
|
48
49
|
"prepublishOnly": "pnpm build"
|
|
@@ -118,6 +119,8 @@
|
|
|
118
119
|
"pnpm": {
|
|
119
120
|
"overrides": {
|
|
120
121
|
"dompurify": "^3.4.1",
|
|
122
|
+
"esbuild": "^0.28.1",
|
|
123
|
+
"fast-uri": "^3.1.2",
|
|
121
124
|
"picomatch": "^4.0.4",
|
|
122
125
|
"postcss": "^8.5.10",
|
|
123
126
|
"rollup": "^4.59.0"
|
package/dist/add-LZ6CZTHG.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a}from'./chunk-HEDVIVEO.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 as a$1}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';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var s={meta:{name:"add",description:"Link a package from the Knarr store into this project"},args:{package:{type:"positional",description:"Package name to add",required:true},from:{type:"string",description:"Path to package source (will publish first)"},yes:{type:"boolean",alias:"y",description:"Auto-accept prompts (install missing deps, etc.)",default:false}},async run({args:e}){b(),await a({packageArg:e.package,from:e.from,yes:e.yes,timer:new a$1});}};export{s as default};
|
package/dist/bell-YD6IWNXO.mjs
DELETED
package/dist/chunk-2VCW5RWI.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var g=Object.create;var e=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(b,a)=>e(b,"name",{value:a,configurable:true});var n=(b,a)=>()=>(a||b((a={exports:{}}).exports,a),a.exports);var l=(b,a,c,f)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of i(a))!k.call(b,d)&&d!==c&&e(b,d,{get:()=>a[d],enumerable:!(f=h(a,d))||f.enumerable});return b};var o=(b,a,c)=>(c=b!=null?g(j(b)):{},l(a||!b||!b.__esModule?e(c,"default",{value:b,enumerable:true}):c,b));export{m as a,n as b,o as c};
|
package/dist/chunk-37AAX47E.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-EE2UYGFD.mjs';import {x as x$1,t,z as z$1,H as H$1,E,F as F$1,C,s,K,u}from'./chunk-GQYG5FCW.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))x$1({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$1=join(e,"node_modules",".bin");await mkdir(t$1,{recursive:true});let s=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 $=t(relative(t$1,f));if(s){let b=join(t$1,`${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
|
-
node "%dp0%\\${$.replace(/\//g,"\\")}" %*\r
|
|
11
|
-
`;await writeFile(b,O);let Y=join(t$1,`${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$1,o),Q=`#!/bin/sh
|
|
16
|
-
exec node "${$}" "$@"
|
|
17
|
-
`;await writeFile(K,Q);}else {let b=join(t$1,o);try{await rm(b,{force:!0});}catch{}try{await symlink($,b),await chmod(f,493);}catch(w){if(z$1(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))x$1({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}`),x$1({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 H$1(s))try{await E(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 F$1(t);let{copied:s,removed:a,skipped:o}=await C(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 H$1(r))return false;let t=s(e,n);return await E(t),await K(r,t),true}a(Ne,"backupExisting");async function Te(e,n,i){let r=s(e,n);if(!await H$1(r))return false;let t=await x(e,n,i);return await E(t),await K(r,t),await E(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 E(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 H$1(join(n,"node_modules",a))})))).filter(a=>!a.installed).map(a=>a.dep)}a(Je,"checkMissingDeps");async function x(e,n,i,r){let t=u(e,n);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){z$1(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 H$1(a)){d(`[inject] pnpm: scanning .pnpm/ for ${n}`);let o=n.replaceAll("/","+");if(r){let l=`${o}@${r}`,f=join(a,l,"node_modules",n);if(await H$1(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);if(await H$1(f))return d(`[inject] pnpm: found in .pnpm/ \u2192 ${f}`),f}}return b$1.warn(`pnpm: Could not find ${n} 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(z$1(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 z$1(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-5BZD55UB.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {b as b$1,a as a$2}from'./chunk-SYADAYF4.mjs';import {b as b$2}from'./chunk-XKO24LUM.mjs';import {a as a$1}from'./chunk-MBKCCWSD.mjs';import {d}from'./chunk-UBGMLVMB.mjs';import {d as d$1}from'./chunk-NBSJGM2X.mjs';import {b}from'./chunk-B3DZ5HVQ.mjs';import {a}from'./chunk-2VCW5RWI.mjs';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
async function v(g,l={}){let $=new a$1,n=await d(g);if(n.packages.length===0){b.warn("No workspace packages found");return}let o;try{o=b$1(n.adjacency);}catch(r){if(r instanceof a$2){b.error(`Cannot push: ${r.message}`);return}throw r}let w=new Map(n.packages.map(r=>[r.name,r.dir]));b.info(`Pushing ${o.length} packages in dependency order`),d$1(`[batch-push] Order: ${o.join(" \u2192 ")}`);let a=0,t=0;for(let r of o){let i=w.get(r);if(i)try{await b$2(i,l),a++;}catch(s){b.warn(`Failed to push ${r}: ${s instanceof Error?s.message:String(s)}`),t++;}}b.success(`Pushed ${a}/${o.length} packages in ${$.elapsed()}${t>0?` (${t} failed)`:""}`);}a(v,"doPushAll");export{v as a};
|
package/dist/chunk-7JG555TZ.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a}from'./chunk-2VCW5RWI.mjs';import {readFile}from'fs/promises';import {join}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
async function u(e,r){let o=r==="npm"?"npm run ":`${r} `;try{let a=JSON.parse(await readFile(join(e,"package.json"),"utf-8")).scripts||{};for(let n of ["build","compile","bundle","tsc"])if(a[n])return `${o}${n}`}catch{}return null}a(u,"detectBuildCommand");export{u as a};
|
package/dist/chunk-7SDPRKFT.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-KOHUNKHP.mjs';import {I as I$1,q,r,H,F}from'./chunk-GQYG5FCW.mjs';import {a,b}from'./chunk-B3DZ5HVQ.mjs';import {c,a as a$1}from'./chunk-2VCW5RWI.mjs';import {readFile}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 l=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 I$1(t,n+l+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 I$1(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 I$1(t,JSON.stringify(r,null,s)+`
|
|
13
|
-
`),true}a$1(v,"removePostinstall");async function I(t,n){let r$1=q(t),s=r(t);if(!await H(s))await F(r$1),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 l=join(t,".gitignore");await x(l);let i=join(t,"package.json");await H(i)&&await S(i);}a$1(I,"ensureConsumerInit");export{x as a,S as b,v as c,I as d};
|
package/dist/chunk-BS4VKVYH.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {c}from'./chunk-NBSJGM2X.mjs';import {b}from'./chunk-B3DZ5HVQ.mjs';import {a}from'./chunk-2VCW5RWI.mjs';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
function r(u){c()&&console.log(JSON.stringify(u,null,2));}a(r,"output");function s(){c()&&(b.level=-1);}a(s,"suppressHumanOutput");export{r as a,s as b};
|
package/dist/chunk-EE2UYGFD.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {H}from'./chunk-GQYG5FCW.mjs';import {a}from'./chunk-2VCW5RWI.mjs';import {readFile,stat}from'fs/promises';import {join,dirname}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var y=new Set(["npm","pnpm","yarn","bun"]),k=[["pnpm-lock.yaml","pnpm"],["bun.lockb","bun"],["bun.lock","bun"],["yarn.lock","yarn"],["package-lock.json","npm"]];async function P(r){try{let n=await readFile(join(r,"package.json"),"utf-8"),e=JSON.parse(n);if(typeof e.packageManager!="string")return null;let t=e.packageManager.split("@")[0];return y.has(t)?t:null}catch{return null}}a(P,"readPackageManagerField");async function x(r){let n=r;for(;;){let e=await P(n);if(e)return e;let o=(await Promise.all(k.map(async([a,s])=>{try{return await stat(join(n,a)),s}catch{return null}}))).find(a=>a!==null);if(o)return o;let i=dirname(n);if(i===n)return "npm";n=i;}}a(x,"detectPackageManager");async function h(r){let n=r;for(;;){let e;try{e=await readFile(join(n,".yarnrc.yml"),"utf-8");}catch{let t=dirname(n);if(t===n)return null;n=t;continue}for(let t of e.split(`
|
|
4
|
-
`)){let o=t.trim();if(o.startsWith("#")||!o.includes("nodeLinker"))continue;let i=o.match(/^nodeLinker:\s*(.+)$/);if(i){let a=i[1].trim().replace(/^["']|["']$/g,"");if(a==="node-modules"||a==="pnpm"||a==="pnp")return a}}return null}}a(h,"detectYarnNodeLinker");async function j(r){let n=r;for(;;)try{return await stat(join(n,".yarnrc.yml")),!0}catch{let e=dirname(n);if(e===n)return false;n=e;}}a(j,"hasYarnrcYml");var d=[["vite",["vite.config.ts","vite.config.js","vite.config.mts","vite.config.mjs"]],["next",["next.config.js","next.config.ts","next.config.mjs"]],["webpack",["webpack.config.js","webpack.config.ts"]],["turbo",["turbo.json"]],["rollup",["rollup.config.js","rollup.config.ts","rollup.config.mjs"]]];async function v(r){for(let[n,e]of d)for(let t of e){let o=join(r,t);if(await H(o))return {type:n,configFile:o}}return {type:null,configFile:null}}a(v,"detectBundler");async function I(r){let n=d.flatMap(([i,a])=>a.map(async s=>({type:i,configFile:join(r,s),found:await H(join(r,s))}))),e=await Promise.all(n),t=new Set,o=[];for(let{type:i,configFile:a,found:s}of e)s&&!t.has(i)&&(t.add(i),o.push({type:i,configFile:a}));return o}a(I,"detectAllBundlers");export{x as a,h as b,j as c,v as d,I as e};
|
package/dist/chunk-GO6F6AGH.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {x,z}from'./chunk-GQYG5FCW.mjs';import {b}from'./chunk-NBSJGM2X.mjs';import {a}from'./chunk-2VCW5RWI.mjs';import {mkdir,stat,rm}from'fs/promises';import {dirname}from'path';import {setTimeout}from'timers/promises';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var r={retries:5,minTimeout:100,maxTimeout:1e3,factor:2,stale:3e4};async function F(i,s,w){if(b())return x({type:"lock-skip",path:i}),s();await mkdir(dirname(i),{recursive:true});let t=i+".lk",d=w?.stale??r.stale,m=false;for(let e=0;e<=r.retries;e++)try{await mkdir(t),m=!0;break}catch(o){if(z(o)&&o.code==="EEXIST"){try{let a=await stat(t);if(Date.now()-a.mtimeMs>d){await rm(t,{recursive:!0,force:!0});continue}}catch{continue}if(e<r.retries){let a=Math.min(r.minTimeout*r.factor**e,r.maxTimeout);await setTimeout(a);}}else throw o}if(!m)throw new Error(`Failed to acquire lock after ${r.retries} attempts. Another Knarr process may be running. If this persists, delete ${t} and retry.`);try{return await s()}finally{await rm(t,{recursive:true,force:true});}}a(F,"withFileLock");export{F as a};
|
package/dist/chunk-GQYG5FCW.mjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {d,c,b as b$2}from'./chunk-NBSJGM2X.mjs';import {b as b$1}from'./chunk-B3DZ5HVQ.mjs';import {a}from'./chunk-2VCW5RWI.mjs';import {readFile,stat,mkdir,copyFile,constants,readdir,utimes,rm,rename,cp,writeFile}from'fs/promises';import {join,resolve,relative,isAbsolute,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,r=[],o=0,i=a(()=>{o<r.length&&e<t&&(e++,r[o++]()),o>0&&o===r.length&&(r.length=0,o=0);},"next");return a$1=>new Promise((p,f)=>{let g=a(()=>{a$1().then(c=>{e--,p(c),i();},c=>{e--,f(c),i();});},"run");e<t?(e++,g()):r.push(g);})}a($,"pLimit");var at=/^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*$/,ct=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,V=/[\x00-\x1F\x7F]/;function b(t){if(!t||t.length>214||V.test(t)||t.includes("\\")||t.includes("//")||t.split("/").some(e=>e==="."||e==="..")||!at.test(t))throw new Error(`Invalid package name "${t}"`)}a(b,"validatePackageName");function ut(t){if(!t||V.test(t)||t.includes("/")||t.includes("\\")||t.includes("..")||!ct.test(t))throw new Error(`Invalid package version "${t}"`)}a(ut,"validatePackageVersion");function W(t,e){b(t),ut(e);}a(W,"validatePackageIdentity");function Ot(t){if(typeof t!="object"||t===null)return false;let e=t;return typeof e.contentHash=="string"&&typeof e.publishedAt=="string"&&typeof e.sourcePath=="string"&&(e.buildId===void 0||typeof e.buildId=="string")&&(e.schemaVersion===void 0||typeof e.schemaVersion=="number")}a(Ot,"isKnarrMeta");function pt(t){if(typeof t!="object"||t===null)return false;let e=t;return typeof e.version=="string"&&typeof e.contentHash=="string"&&typeof e.linkedAt=="string"&&typeof e.sourcePath=="string"&&typeof e.backupExists=="boolean"&&typeof e.packageManager=="string"&&["npm","pnpm","yarn","bun"].includes(e.packageManager)&&(e.buildId===void 0||typeof e.buildId=="string")}a(pt,"isLinkEntry");function Ft(t){if(typeof t!="object"||t===null)return false;let e=t;if(e.version!=="1"||typeof e.links!="object"||e.links===null)return false;let r=e.links;for(let o of Object.values(r))if(!pt(o))return false;return true}a(Ft,"isConsumerState");async function Tt(t,e,r){try{let o=await readFile(join(t,"package.json"),"utf-8"),i=JSON.parse(o),a=i.dependencies?.[e]??i.devDependencies?.[e]??i.peerDependencies?.[e];if(!a||/^(workspace:|catalog:|\*)/.test(a))return;let p=a.match(/(\d+)\.\d+\.\d+/);if(!p)return;let f=parseInt(p[1],10),g=parseInt(r.split(".")[0],10);f!==g&&b$1.warn(`Version mismatch: store has ${e}@${r} but your package.json declares "${a}". Consider updating your dependency range.`);}catch{}}a(Tt,"warnVersionMismatch");function _t(t){if(typeof t!="object"||t===null)return false;let e=t;for(let r of Object.values(e)){if(!Array.isArray(r))return false;for(let o of r)if(typeof o!="string")return false}return true}a(_t,"isConsumersRegistry");function O(t,e,r){let o=resolve(t),i=resolve(e),a=relative(o,i);if(!(a===""||!a.startsWith("..")&&!isAbsolute(a)))throw new Error(`${r} escapes expected directory: ${e}`)}a(O,"assertInside");function Z(){return process.env.KNARR_HOME||join(homedir(),".knarr")}a(Z,"getKnarrHome");function gt(){return join(Z(),"store")}a(gt,"getStorePath");function Kt(){return join(Z(),"consumers.json")}a(Kt,"getConsumersPath");function Y(t){return b(t),t.replace(/\//g,"+")}a(Y,"encodePackageName");function Vt(t){if(t.startsWith("@")){let e=t.indexOf("+");if(e!==-1)return t.slice(0,e)+"/"+t.slice(e+1)}return t}a(Vt,"decodePackageName");function F(t,e){W(t,e);let r=gt(),o=join(r,`${Y(t)}@${e}`);return O(r,o,"Store entry path"),o}a(F,"getStoreEntryPath");function Wt(t,e){return join(F(t,e),"package")}a(Wt,"getStorePackagePath");function Jt(t,e){return join(F(t,e),".knarr-meta.json")}a(Jt,"getStoreMetaPath");function dt(t,e){return join(F(t,e),"history")}a(dt,"getStoreHistoryPath");function Zt(t,e,r){if(!/^[a-f0-9]{8,64}$/i.test(r))throw new Error(`Invalid build id "${r}"`);return join(dt(t,e),r)}a(Zt,"getHistoryEntryPath");function Yt(t){return join(t,".knarr")}a(Yt,"getConsumerKnarrDir");function qt(t){return join(t,".knarr","state.json")}a(qt,"getConsumerStatePath");function Gt(t,e){b(e);let r=join(t,".knarr","backups"),o=join(r,Y(e));return O(r,o,"Backup path"),o}a(Gt,"getConsumerBackupPath");function S(t){return t.replace(/\\/g,"/")}a(S,"normalizePath");function Ut(t,e){b(e);let r=join(t,"node_modules"),o=join(r,e);return O(r,o,"node_modules package path"),o}a(Ut,"getNodeModulesPackagePath");var z=null;function wt(){return z||(z=import('./xxhash-wasm-DTW44IIQ.mjs').then(t=>t.default()).catch(t=>{throw z=null,t})),z}a(wt,"getXXHash");var kt=1024*1024,vt=$(Math.max(availableParallelism(),8)),I=new Map;async function ce(t,e){let r=[...t].sort((c,d)=>{let k=S(relative(e,c)),h=S(relative(e,d));return k.localeCompare(h)}),o=new Set(r),i=0,a=await Promise.all(r.map(c=>vt(async()=>{let d=S(relative(e,c)),k=await stat(c),h=I.get(c);if(h&&h.mtimeMs===k.mtimeMs&&h.size===k.size)return i++,{rel:d,content:h.content};let s=await readFile(c);return I.set(c,{mtimeMs:k.mtimeMs,size:k.size,content:s}),{rel:d,content:s}})));for(let c of I.keys())o.has(c)||I.delete(c);d(`[hash] Computing content hash for ${t.length} files (${i} cached)`);let p=createHash("sha256"),f=Buffer.alloc(4);for(let{rel:c,content:d}of a)p.update(c),p.update("\0"),f.writeUInt32LE(d.length),p.update(f),p.update(d);let g="sha256v2:"+p.digest("hex");return d(`[hash] Result: ${g.slice(0,20)}...`),g}a(ce,"computeContentHash");async function _(t,e){let r=e??(await stat(t)).size,o=await wt();if(r>kt)return xt(t,o);let i=await readFile(t);return o.h64Raw(i).toString(16)}a(_,"hashFile");async function xt(t,e){let{createReadStream:r}=await import('fs'),o=e.create64();return new Promise((i,a)=>{let p=r(t);p.on("data",f=>o.update(f)),p.on("end",()=>i(o.digest().toString(16))),p.on("error",a);})}a(xt,"hashFileStream");var R=[];function w(t){R.push(t);}a(w,"recordMutation");function fe(){if(R.length===0){b$1.info("[dry-run] No mutations would be performed");return}if(c()){console.log(JSON.stringify({dryRun:true,mutations:R},null,2));return}let t=new Map;for(let r of R){let o=t.get(r.type);o||(o=[],t.set(r.type,o)),o.push(r);}b$1.info(`
|
|
4
|
-
[dry-run] ${R.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","command-skip":"Skip command"};for(let[r,o]of t){b$1.info(` ${e[r]} (${o.length}):`);for(let i of o.slice(0,20)){let a=i.dest?` \u2192 ${i.dest}`:"",p=i.detail?` (${i.detail})`:"";b$1.info(` ${i.path}${a}${p}`);}o.length>20&&b$1.info(` ... and ${o.length-20} more`);}}a(fe,"printDryRunReport");var Q=$(Math.max(availableParallelism(),8));function N(t){return t instanceof Error&&"code"in t}a(N,"isNodeError");var L=new Map;function Ct(t){let{root:e}=parse(t);return e||"/"}a(Ct,"volumeRoot");async function St(t,e,r){if(b$2()){d(`[dry-run] would copy ${t} \u2192 ${e}`),w({type:"copy",path:t,dest:e});return}r?.ensureParent!==false&&await mkdir(dirname(e),{recursive:true});let o=Ct(e),i=L.get(o);if(i===false){await copyFile(t,e);return}if(i===true){await copyFile(t,e,constants.COPYFILE_FICLONE);return}try{await copyFile(t,e,constants.COPYFILE_FICLONE_FORCE),L.set(o,!0);}catch{L.set(o,false),d(`[copy] reflink not supported on ${o}, using plain copy`),await copyFile(t,e);}}a(St,"copyWithCoW");async function D(t){return (await readdir(t,{recursive:true,withFileTypes:true})).filter(r=>r.isFile()).map(r=>join(r.parentPath,r.name))}a(D,"collectFiles");async function be(t,e,r={}){let o=D(t),i=D(e).catch(s=>{if(N(s)&&s.code==="ENOENT")return [];throw s}),[a,p]=await Promise.all([o,i]),f=0,g=0,c=0,d$1=await Promise.all(a.map(s=>Q(async()=>{let x=relative(t,s),M=join(e,x),H=true,P=null;if(r.force)d(`[copy] ${x} (forced)`);else try{let[m,C]=await Promise.all([stat(s),stat(M)]);if(P={atime:m.atime,mtime:m.mtime},m.size!==C.size)d(`[copy] ${x} (size differs: ${m.size} vs ${C.size})`);else if(m.mtimeMs===C.mtimeMs)H=!1,d(`[skip] ${x} (size+mtime match)`);else {let[nt,ot]=await Promise.all([_(s,m.size),_(M,C.size)]);nt===ot?(H=!1,d(`[skip] ${x} (unchanged)`)):d(`[copy] ${x} (hash differs)`);}}catch(m){if(N(m)&&m.code==="ENOENT")d(`[copy] ${x} (new file)`);else throw m}if(H){if(await St(s,M),!P){let m=await stat(s);P={atime:m.atime,mtime:m.mtime};}return await utimes(M,P.atime,P.mtime),"copied"}return "skipped"})));for(let s of d$1)s==="copied"?f++:c++;let k=new Set(a.map(s=>relative(t,s))),h=p.filter(s=>!k.has(relative(e,s)));return await Promise.all(h.map(s=>Q(async()=>{d(`[remove] ${relative(e,s)} (no longer in source)`),b$2()?w({type:"remove",path:s}):await rm(s);}))),g=h.length,{copied:f,removed:g,skipped:c}}a(be,"incrementalCopy");async function Re(t,e){if(b$2()){d(`[dry-run] would move ${t} \u2192 ${e}`),w({type:"move",path:t,dest:e});return}try{await rename(t,e);}catch(r){if(N(r)&&r.code==="EXDEV")await cp(t,e,{recursive:true}),await rm(t,{recursive:true,force:true});else throw r}}a(Re,"moveDir");async function Ee(t){if(b$2()){d(`[dry-run] would remove ${t}`),w({type:"remove",path:t});return}await rm(t,{recursive:true,force:true});}a(Ee,"removeDir");async function Me(t){if(b$2()){d(`[dry-run] would ensure dir ${t}`),w({type:"mkdir",path:t});return}await mkdir(t,{recursive:true});}a(Me,"ensureDir");async function Ce(t){if(b$2()){d(`[dry-run] would ensure private dir ${t}`),w({type:"mkdir",path:t});return}await mkdir(t,{recursive:true,mode:448});}a(Ce,"ensurePrivateDir");async function Se(t){try{return await stat(t),!0}catch{return false}}a(Se,"exists");async function ze(t,e){if(b$2()){d(`[dry-run] would write ${t}`),w({type:"write",path:t});return}let r=t+`.tmp-${process.pid}-${Date.now()}`;await writeFile(r,e),await rename(r,t);}a(ze,"atomicWriteFile");async function Ie(t){try{let e=await D(t);return (await Promise.all(e.map(o=>stat(o).then(i=>i.size).catch(()=>0)))).reduce((o,i)=>o+i,0)}catch{return 0}}a(Ie,"dirSize");async function Ae(t,e){if(b$2()){d(`[dry-run] would copy directory ${t} \u2192 ${e}`),w({type:"copy",path:t,dest:e});return}await cp(t,e,{recursive:true});}a(Ae,"copyDir");export{St as A,D as B,be as C,Re as D,Ee as E,Me as F,Ce as G,Se as H,ze as I,Ie as J,Ae as K,b as a,ut as b,W as c,Ot as d,Ft as e,Tt as f,_t as g,gt as h,Kt as i,Y as j,Vt as k,F as l,Wt as m,Jt as n,dt as o,Zt as p,Yt as q,qt as r,Gt as s,S as t,Ut as u,$ as v,ce as w,w as x,fe as y,N as z};
|
package/dist/chunk-HEDVIVEO.mjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$3}from'./chunk-OPLSUHCD.mjs';import {b as b$2,c}from'./chunk-CTJF2EWO.mjs';import {a as a$8}from'./chunk-SN4TOUQW.mjs';import {b as b$4,a as a$5,e}from'./chunk-37AAX47E.mjs';import {a as a$2}from'./chunk-TEFMLGCB.mjs';import {d}from'./chunk-7SDPRKFT.mjs';import {a as a$4,b as b$3,c as c$1,d as d$3}from'./chunk-EE2UYGFD.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 as h$1}from'./chunk-KOHUNKHP.mjs';import {b,H,r,f as f$1,y,a as a$7,x}from'./chunk-GQYG5FCW.mjs';import {b as b$5,c as c$2,d as d$2}from'./chunk-NBSJGM2X.mjs';import {b as b$1}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 In(i){let a=i.timer??new a$1,e=resolve("."),{name:n,version:r$1}=X(i.packageArg);if(J(n,i.packageArg),r$1)try{b(r$1);}catch{a$2(`Invalid package version "${r$1}" in "${i.packageArg}".`),process.exit(1);}if(i.from){let u=resolve(i.from);b$1.info(`Publishing from ${u}...`),await a$3(u);}let o=r$1?await b$2(n,r$1):await c(n);if(!o){let u=r$1?`@${r$1}`:"";a$2(`Package "${n}${u}" not found in store. Run 'knarr publish' in the package directory first, or use --from <path>.`),process.exit(1);}let c$2=!await H(r(e)),s=await a$4(e);if(c$2&&(await d(e,s),b$1.success("Auto-initialized knarr (consumer mode)")),b$1.info(`Detected package manager: ${s}`),s==="yarn"){let u=await b$3(e);(u==="pnp"||u===null&&await c$1(e))&&(b$1.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 p=await f(e,n);p&&(p.version===o.version?b$1.info(`Updating ${n}@${o.version} (already linked)`):b$1.info(`Updating ${n}: ${p.version} -> ${o.version}`));let g=await b$4(e,n,s);g&&b$1.info(`Backed up existing ${n} installation`),await f$1(e,n,o.version),await nn(e,n,s),await Z(o,e,s,i.yes??false);let d$2=await a$5(o,e,s);b$1.success(`Linked ${n}@${o.version} -> node_modules/${n} (${d$2.copied} files copied, ${d$2.skipped} unchanged)`),d$2.binLinks>0&&b$1.info(`Created ${d$2.binLinks} bin link(s)`);let z={version:o.version,contentHash:o.meta.contentHash,linkedAt:new Date().toISOString(),sourcePath:o.meta.sourcePath,backupExists:g,packageManager:s,buildId:o.meta.buildId??""};await d$1(e,n,z),await h$1(n,e),b$1.info(`Done in ${a.elapsed()}`),a$6({package:n,version:o.version,copied:d$2.copied,skipped:d$2.skipped,binLinks:d$2.binLinks,elapsed:a.elapsedMs()}),b$5()&&y();}a(In,"addPackageToConsumer");async function An(i){let a=resolve(i);await H(a)||(a$2(`Source path not found: ${a}`),process.exit(1));let e=join(a,"package.json");await H(e)||(a$2(`No package.json found at ${e}. Pass a package directory to 'knarr use'.`),process.exit(1));let n;try{n=JSON.parse(await readFile(e,"utf-8"));}catch(o){a$2(`Could not read package.json at ${e}: ${o instanceof Error?o.message:String(o)}`),process.exit(1);}(!n||typeof n!="object"||typeof n.name!="string")&&(a$2(`package.json at ${e} must include a package name for 'knarr use'.`),process.exit(1));let r=n.name.trim();return J(r,r),r}a(An,"readPackageNameFromSource");function X(i){if(i.startsWith("@")){let e=i.indexOf("/");if(e>0){let n=i.indexOf("@",e);if(n>e)return {name:i.slice(0,n),version:i.slice(n+1)}}return {name:i,version:null}}let a=i.lastIndexOf("@");return a>0?{name:i.slice(0,a),version:i.slice(a+1)}:{name:i,version:null}}a(X,"parsePackageArg");function J(i,a){try{a$7(i);}catch{a$2(`Invalid package name "${a}". Use format: package-name or @scope/package-name.`),process.exit(1);}}a(J,"validatePackageNameArg");async function Z(i,a,e$1,n){let r=await e(i,a);if(r.length===0)return;if(c$2()){d$2(`[add] Missing transitive deps (json mode): ${r.join(", ")}`);return}if(n){let c=$(e$1,r);b$1.info(b$5()?`[dry-run] Would install missing dependencies: ${r.join(", ")}`:`Installing missing dependencies: ${r.join(", ")}`);let s=await h(c,a);s&&!b$5()?b$1.success("Installed missing dependencies"):s||b$1.warn(`Install failed. Run manually: ${c}`);return}if(await b$1.prompt(`Install ${r.length} missing dependencies? (${r.join(", ")})`,{type:"confirm",initial:true})){let c=$(e$1,r),s=await h(c,a);s&&!b$5()?b$1.success("Installed missing dependencies"):s||b$1.warn(`Install failed. Run manually: ${c}`);}else b$1.warn(`Missing transitive dependencies: ${r.join(", ")}
|
|
12
|
-
Run: ${$(e$1,r)}`);}a(Z,"handleMissingDeps");async function nn(i,a,e){let n=await d$3(i);if(n.type==="next"&&n.configFile){let s=await a$8(n.configFile,a);s.modified?b$1.success(`Added ${a} to transpilePackages in ${basename(n.configFile)}`):s.error&&b$1.info(`Add to next.config manually: transpilePackages: ['${a}']`);}else if(n.type==="vite"&&n.configFile){let{addKnarrVitePlugin:s}=await import('./vite-config-UWCLPTOZ.mjs'),p=await s(n.configFile);if(p.modified){b$1.success(`Added knarr plugin to ${basename(n.configFile)}`);let g=en(e,"knarr");b$1.info(b$5()?"[dry-run] Would install knarr as devDependency":"Installing knarr as devDependency...");let d=await h(g,i);d&&!b$5()?b$1.success("Installed knarr"):d||b$1.warn(`Install failed. Run manually: ${g}`);}else p.error&&b$1.info(`Add manually:
|
|
13
|
-
import knarr from "knarr/vite"
|
|
14
|
-
plugins: [knarr()]`);}let{findTailwindCss:r,addTailwindSource:o}=await import('./tailwind-source-RIWWXW2Y.mjs'),c=await r(i);if(c){let s=await o(c,a,i);s.modified?b$1.success(`Added @source for ${a} to ${basename(c)}`):s.error&&b$1.info(`Add to your CSS manually: @source "../node_modules/${a}";`);}}a(nn,"configureBundler");function $(i,a){for(let n of a)a$7(n);let e=a.join(" ");switch(i){case "pnpm":return `pnpm add ${e}`;case "yarn":return `yarn add ${e}`;case "bun":return `bun add ${e}`;default:return `npm install ${e}`}}a($,"buildInstallCommand");function en(i,a){switch(i){case "pnpm":return `pnpm add -D ${a}`;case "yarn":return `yarn add -D ${a}`;case "bun":return `bun add -d ${a}`;default:return `npm install -D ${a}`}}a(en,"buildDevInstallCommand");function h(i,a){return b$5()?(x({type:"command-skip",path:a,detail:i}),Promise.resolve(true)):new Promise(e=>{let n=platform()==="win32",c=spawn(n?"cmd":"sh",[n?"/c":"-c",i],{cwd:a,stdio:"inherit"});c.on("close",s=>e(s===0)),c.on("error",()=>e(false));})}a(h,"runInstallCommand");export{In as a,An as b};
|
package/dist/chunk-KOHUNKHP.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$1}from'./chunk-GO6F6AGH.mjs';import {r,e,z,F,q as q$1,I,i,g as g$1,G,t,H}from'./chunk-GQYG5FCW.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$1=r(t);try{let e$1=await readFile(r$1,"utf-8"),s=JSON.parse(e$1);return e(s)?{state:s,reliable:!0}:(b.warn(`Invalid consumer state in ${r$1}, using defaults`),{state:{version:"1",links:{}},reliable:!1})}catch(e){return z(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$1){await F(q$1(t));let e=r(t);await I(e,JSON.stringify(r$1,null,2));}a(L,"writeConsumerState");async function T(t,r$1,e){let s=r(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$1]=e,await L(t,i);});}a(T,"addLink");async function K(t,r$1){let e=r(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$1],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=i();try{let r=await readFile(t,"utf-8"),e=JSON.parse(r);return g$1(e)?e:(b.warn("Invalid consumers registry, using empty registry"),{})}catch(r){return z(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=i();await G(dirname(i())),await I(r,JSON.stringify(t,null,2));}a(C,"writeConsumersRegistry");async function W(t$1,r){let e=i();await a$1(e,async()=>{let s=await g();s[t$1]||(s[t$1]=[]);let i=t(r);s[t$1].includes(i)||s[t$1].push(i),await C(s);});}a(W,"registerConsumer");async function q(t$1,r){let e=i();await a$1(e,async()=>{let s=await g();if(!s[t$1])return;let i=t(r);s[t$1]=s[t$1].filter(c=>c!==i),s[t$1].length===0&&delete s[t$1],await C(s);});}a(q,"unregisterConsumer");async function A(t){return (await g())[t]??[]}a(A,"getConsumers");async function B(){let t=i(),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 H(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-LXGALE74.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {I}from'./chunk-GQYG5FCW.mjs';import {a}from'./chunk-2VCW5RWI.mjs';import {readFile}from'fs/promises';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
function d(n){return n.match(/^(\s+)\S/m)?.[1]||" "}a(d,"detectIndent");function m(n){return n.includes("knarr/vite")||n.includes("vite-plugin-knarr")}a(m,"hasKnarrPlugin");function w(n){let i=/(^|[^A-Za-z0-9_$])defineConfig\s*\(/g,o;for(;(o=i.exec(n))!==null;){let l=o.index+o[0].length-1,r=1,e=l+1,s=false,f=false;for(;e<n.length&&r>0;){let t=n[e];if(f){f=false,e++;continue}if(t==="\\"){f=true,e++;continue}if(s){t===s&&(s=false),e++;continue}if(t==='"'||t==="'"||t==="`"){s=t,e++;continue}if(t==="/"&&n[e+1]==="/"){let c=n.indexOf(`
|
|
4
|
-
`,e);e=c===-1?n.length:c+1;continue}if(t==="/"&&n[e+1]==="*"){let c=n.indexOf("*/",e+2);e=c===-1?n.length:c+2;continue}if(t==="?"){let c=n[e+1];if(c==="."||c==="?"){e+=2;continue}return true}t==="("&&r++,t===")"&&r--,e++;}i.lastIndex=e;}return false}a(w,"defineConfigUsesTernary");function p(n){let i=[],o="",l=0;for(let e of n)if(e==="("&&l++,e===")"&&l--,e===","&&l===0){let s=o.trim();s&&i.push(s),o="";}else o+=e;let r=o.trim();return r&&i.push(r),i}a(p,"parsePluginItems");function h(n,i){return n.length===0?"[]":n.length===1?`[${n[0]}]`:`[
|
|
5
|
-
${n.map(l=>`${i}${i}${l},`).join(`
|
|
6
|
-
`)}
|
|
7
|
-
${i}]`}a(h,"formatPlugins");function x(n){let o=/plugins\s*:\s*\[/g.exec(n);if(!o)return null;let l=o.index+o[0].length-1,r=1,e=l+1,s=false,f=false;for(;e<n.length&&r>0;){let t=n[e];if(f){f=false,e++;continue}if(t==="\\"){f=true,e++;continue}if(s){t===s&&(s=false),e++;continue}if(t==='"'||t==="'"||t==="`"){s=t,e++;continue}if(t==="/"&&n[e+1]==="/"){let c=n.indexOf(`
|
|
8
|
-
`,e);e=c===-1?n.length:c+1;continue}if(t==="/"&&n[e+1]==="*"){let c=n.indexOf("*/",e+2);e=c===-1?n.length:c+2;continue}(t==="["||t==="("||t==="{")&&r++,(t==="]"||t===")"||t==="}")&&r--,e++;}return r!==0?null:{start:l,end:e,inner:n.slice(l+1,e-1)}}a(x,"findPluginsArray");function y(n){let i=0,o=/^import\s/gm,l;for(;(l=o.exec(n))!==null;){let r=l.index,e=r+l[0].length,s=false,f=0;for(;e<n.length;){let t=n[e];if(s){t===s&&(s=false),e++;continue}if(t==='"'||t==="'"||t==="`"){s=t,e++;continue}if(t==="{"&&f++,t==="}"&&f--,t===";"&&f<=0){e++;break}if(t===`
|
|
9
|
-
`&&f<=0){let c=n.slice(r,e).trimEnd();if(c.endsWith('"')||c.endsWith("'"))break}e++;}i=e;}return i}a(y,"findLastImportEnd");function k(n){return w(n)?{complex:true,reason:"conditional defineConfig"}:/export\s+default\s+function/.test(n)?{complex:true,reason:"dynamic export (function)"}:/plugins\s*:\s*\[\s*\.\.\./.test(n)?{complex:true,reason:"spread operator in plugins array"}:/defineConfig\s*\(\s*async/.test(n)||/mergeConfig\s*\(/.test(n)?{complex:true,reason:"async or merged config"}:{complex:false}}a(k,"isComplexConfig");async function P(n){let i;try{i=await readFile(n,"utf-8");}catch{return {modified:false,error:"could not read config file"}}if(m(i))return {modified:false};let o=k(i);if(o.complex)return {modified:false,error:`config too complex (${o.reason})`};let l=d(i),r=x(i);if(r){let f=p(r.inner);f.push("knarr()");let t=h(f,l);i=i.slice(0,r.start)+t+i.slice(r.end);}else {let t=/(?:defineConfig\s*\(\s*\{|export\s+default\s+\{)/.exec(i);if(t){let c=t.index+t[0].length,b=`
|
|
10
|
-
${l}plugins: [knarr()],`;i=i.slice(0,c)+b+i.slice(c);}else return {modified:false,error:"unrecognized Vite config pattern"}}let e=`import knarr from "knarr/vite";
|
|
11
|
-
`,s=y(i);return s>0?i=i.slice(0,s)+`
|
|
12
|
-
`+e+i.slice(s):i=e+`
|
|
13
|
-
`+i,await I(n,i),{modified:true}}a(P,"addKnarrVitePlugin");async function R(n){let i;try{i=await readFile(n,"utf-8");}catch{return {modified:false}}if(!m(i))return {modified:false};let o=false,l=/^import\s+\w+\s+from\s+["']knarr\/vite["'];?\s*\n?/m;l.test(i)&&(i=i.replace(l,""),o=true);let r=x(i);if(r){let e=p(r.inner),s=e.filter(f=>!f.startsWith("knarr("));if(s.length!==e.length){let f=d(i),t=h(s,f);i=i.slice(0,r.start)+t+i.slice(r.end),o=true;}}return o&&await I(n,i),{modified:o}}a(R,"removeFromViteConfig");export{k as a,P as b,R as c};
|
package/dist/chunk-OPLSUHCD.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$2}from'./chunk-CTJF2EWO.mjs';import {a as a$3}from'./chunk-GO6F6AGH.mjs';import {a}from'./chunk-3KNUBUPH.mjs';import {v,t,z,c as c$1,w,l,G,F,I,A,H,D as D$1,E as E$1,x}from'./chunk-GQYG5FCW.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}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 k=c(a(),1);async function tt(s,n){let i=[],e=resolve(s);i.push(join(e,"package.json"));let t$1=await et(e,e),o=t$1.map(a=>t(relative(e,a)));if(n.files&&n.files.length>0)for(let a of n.files){let r=join(e,a),u=resolve(r);if(!u.startsWith(e+sep)&&u!==e){b.warn(`files pattern "${a}" escapes package directory, skipping`);continue}let c=false;try{if((await stat(r)).isDirectory()){let v=t(relative(e,r))+"/";for(let f=0;f<o.length;f++)o[f].startsWith(v)&&i.push(t$1[f]);c=!0;}else i.push(r),c=!0;}catch(d){if(z(d)&&d.code!=="ENOENT")throw d}if(!c){let d=(0, k.default)(a,{dot:true}),v=0;for(let f=0;f<o.length;f++)if(d(o[f])){let C=resolve(t$1[f]);if(!C.startsWith(e+sep)&&C!==e)continue;i.push(t$1[f]),v++;}v===0&&b.warn(`files pattern "${a}" matched no files`);}}else {let a=await dt(e);for(let r=0;r<o.length;r++)mt(o[r],a)||i.push(t$1[r]);}let p=new Set(i),l=new Set(t$1);for(let a of ["README.md","README","LICENSE","LICENCE","CHANGELOG.md"]){let r=join(e,a);p.has(r)||l.has(r)&&(i.push(r),p.add(r));}return [...p]}a$1(tt,"resolvePackFiles");var pt=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 mt(s,n){for(let e of n.negations)if(e(s))return false;let i=s.split(/[\\/]/);for(let e of i)if(pt.has(e)||n.literals.has(e))return true;if(n.literals.has(s))return true;for(let e of n.patterns)if(e(s))return true;return false}a$1(mt,"shouldIgnore");async function dt(s){let n={literals:new Set,patterns:[],negations:[]};try{let i=await readFile(join(s,".npmignore"),"utf-8");for(let e of i.split(`
|
|
4
|
-
`)){let t=e.trim();if(!(!t||t.startsWith("#")))if(t.startsWith("!")){let o=t.slice(1);Z(o)?n.negations.push((0,k.default)(o,{dot:!0})):n.negations.push((0,k.default)(o,{dot:!0}));}else Z(t)?n.patterns.push((0,k.default)(t,{dot:!0})):n.literals.add(t.replace(/\/$/,""));}}catch(i){if(z(i)&&i.code!=="ENOENT")throw i}return n}a$1(dt,"loadNpmIgnore");function Z(s){return /[*?[\]{}()]/.test(s)}a$1(Z,"hasGlobChars");async function et(s,n){let i=[];try{let e=await readdir(s,{withFileTypes:!0});for(let t of e){let o=join(s,t.name);if(t.isDirectory()){if(t.name===".git"||s===n&&t.name==="node_modules"||t.isSymbolicLink())continue;i.push(...await et(o,n));}else t.isSymbolicLink()||i.push(o);}}catch(e){if(z(e)&&e.code==="ENOENT")return [];throw e}return i}a$1(et,"collectAllFiles");var bt=v(Math.max(availableParallelism(),8));async function Zt(s,n={}){let i=join(s,"package.json"),e;try{e=await readFile(i,"utf-8");}catch{throw new Error(`No package.json found in ${s}`)}let t=JSON.parse(e);if(!t.name)throw new Error("package.json missing 'name' field");if(!t.version)throw new Error("package.json missing 'version' field");if(c$1(t.name,t.version),t.private&&!n.allowPrivate)throw new Error(`Package "${t.name}" is private. Use --private flag to publish private packages.`);await R(s,t,"preknarr"),n.runScripts!==false&&await R(s,t,"prepack");let o=s;if(t.publishConfig?.directory){o=resolve(s,t.publishConfig.directory);try{if(!(await stat(o)).isDirectory())throw new Error(`publishConfig.directory "${t.publishConfig.directory}" is not a directory`)}catch(c){throw c instanceof Error&&"code"in c&&c.code==="ENOENT"?new Error(`publishConfig.directory "${t.publishConfig.directory}" does not exist`):c}d(`[publish] Using publishConfig.directory: ${o}`);}let p=o!==s?JSON.parse(await readFile(join(o,"package.json"),"utf-8").catch(()=>JSON.stringify(t))):t,l$1=await tt(o,p);if(l$1.length===0)throw new Error("No publishable files found");d(`[publish] Resolved ${l$1.length} files for ${t.name}@${t.version}`);let a=await w(l$1,o);if(await $t(t,s),await Mt(t,s),!n.force){let c=await a$2(t.name,t.version);if(c&&c.contentHash===a)return b.info(`${t.name}@${t.version} already up to date (no changes since last publish)`),{name:t.name,version:t.version,fileCount:l$1.length,skipped:true,contentHash:a,buildId:c.buildId??""}}let r=l(t.name,t.version),u=await a$3(r+".lock",async()=>{if(!n.force){let f=await a$2(t.name,t.version);if(f&&f.contentHash===a)return b.info(`${t.name}@${t.version} already up to date (no changes since last publish)`),{name:t.name,version:t.version,fileCount:l$1.length,skipped:true,contentHash:a,buildId:f.buildId??""}}let c=r+`.tmp-${process.pid}-${Date.now()}`,d$1=join(c,"package"),v=a.slice(9,17);try{await G(d$1);let f=Et(t);f=kt(f),d("[publish] Copying files to temp store...");let C=new Set(l$1.map(g=>dirname(join(d$1,relative(o,g)))));await Promise.all([...C].map(g=>F(g))),await Promise.all(l$1.map(g=>bt(async()=>{let H=relative(o,g),x=join(d$1,H);H==="package.json"&&f!==t?await I(x,JSON.stringify(f,null,2)):await A(g,x,{ensureParent:!1});}))),o!==s&&await I(join(d$1,"package.json"),JSON.stringify(f,null,2));let ot={schemaVersion:1,contentHash:a,publishedAt:new Date().toISOString(),sourcePath:s,buildId:v};await I(join(c,".knarr-meta.json"),JSON.stringify(ot,null,2));let T=await H(r),b=r+".old-"+Date.now(),L=!1;try{T&&(await D$1(r,b),L=!b$1()),await D$1(c,r);}catch(g){throw L&&await H(b)&&(await H(r)&&await E$1(r),await D$1(b,r)),g}if(T&&!b$1()){try{let{captureHistory:g}=await import('./history-SKKGT225.mjs');await g(t.name,t.version,b,n.historyLimit);}catch(g){d(`[publish] History capture failed: ${g instanceof Error?g.message:String(g)}`);}await E$1(b);}d(`[publish] Stored at ${r}`);}catch(f){throw await E$1(c),f}return {name:t.name,version:t.version,fileCount:l$1.length,skipped:false,contentHash:a,buildId:v}},{stale:6e4});return u.skipped||(n.runScripts!==false&&await R(s,t,"postpack"),await R(s,t,"postknarr"),b.success(`Published ${t.name}@${t.version} (${l$1.length} files) [${u.buildId}]`)),u}a$1(Zt,"publish");var nt=parseInt(process.env.KNARR_HOOK_TIMEOUT??"30000",10);async function R(s,n,i){let e=n.scripts?.[i];if(e){if(b$1()){x({type:"lifecycle-skip",path:s,detail:`${i}: ${e}`});return}return d(`[lifecycle] Running ${i}: ${e}`),new Promise((t,o)=>{let p=platform()==="win32",r=spawn(p?"cmd":"sh",[p?"/c":"-c",e],{cwd:s,stdio:"inherit"}),u=setTimeout(()=>{r.kill("SIGTERM"),o(new Error(`${i} script timed out after ${nt/1e3}s. Increase KNARR_HOOK_TIMEOUT env var if the script needs more time.`));},nt);r.on("close",c=>{clearTimeout(u),c===0?t():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(R,"runLifecycleHook");var Pt=["main","module","exports","types","typings","browser","bin"];function kt(s){if(!s.publishConfig)return s;let n={...s};for(let i of Pt)i in s.publishConfig&&(n[i]=s.publishConfig[i]);return delete n.publishConfig,n}a$1(kt,"applyPublishConfig");function Et(s){let n=false,i={...s},e=null,t=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=N?.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(t||(e=St(),t=true),e){let c=Ct(u,r,e);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(Et,"rewriteProtocolVersions");function Ct(s,n,i){let e=s.slice(8);return e===""||e==="default"?i.default[n]??null:i.named[e]?.[n]??null}a$1(Ct,"resolveCatalogVersion");var D=null;async function rt(s){if(D?.dir===s)return D.root;let{findWorkspaceRoot:n}=await import('./workspace-S3TAUSS3.mjs'),i=await n(s);return D={dir:s,root:i},i}a$1(rt,"getWorkspaceRoot");var N=null;async function $t(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 e=await rt(n);if(!e){N=null;return}if(N?.root===e)return;let{findWorkspacePackages:t}=await import('./workspace-S3TAUSS3.mjs'),o=await t(e),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{}})),N={root:e,versions:p};}a$1($t,"preloadWorkspaceVersions");var E=null;function St(){return E?.catalogs??null}a$1(St,"loadCatalogsFromCache");async function Mt(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 e=await rt(n);if(!e){E=null;return}let t=join(e,"pnpm-workspace.yaml"),o=(await stat(t).catch(()=>null))?.mtimeMs??0;if(E?.root===e&&E.mtimeMs===o)return;let{parseCatalogs:p}=await import('./workspace-S3TAUSS3.mjs'),l=await p(e);E={root:e,mtimeMs:o,catalogs:l};}a$1(Mt,"preloadCatalogs");export{Zt as a};
|
package/dist/chunk-QGLOGD5G.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {o,p,H,F,D,I,E,l}from'./chunk-GQYG5FCW.mjs';import {d}from'./chunk-NBSJGM2X.mjs';import {a}from'./chunk-2VCW5RWI.mjs';import {readFile,readdir}from'fs/promises';import {join}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var S=3;async function O(i,a,t,s){let o$1=join(t,".knarr-meta.json"),r;try{r=JSON.parse(await readFile(o$1,"utf-8"));}catch{d(`[history] Could not read meta from ${o$1}, skipping history capture`);return}let e=r.buildId;if(!e){d("[history] No buildId in meta, skipping history capture");return}let p$1=o(i,a),y=p(i,a,e);if(await H(y)){d(`[history] Build ${e} already in history, skipping`);return}await F(p$1);let d$1=y+`.tmp-${process.pid}`;try{await F(d$1);let l=join(t,"package");await H(l)&&await D(l,join(d$1,"package")),await I(join(d$1,".knarr-meta.json"),JSON.stringify(r,null,2)),await D(d$1,y),d(`[history] Captured build ${e} to history`);}catch(l){d(`[history] Failed to capture history: ${l instanceof Error?l.message:String(l)}`),await E(d$1);}await C(i,a,s??S);}a(O,"captureHistory");async function T(i,a){let t=o(i,a);if(!await H(t))return [];let s;try{s=await readdir(t);}catch{return []}let o$1=[];for(let r of s){let e=join(t,r),p=join(e,".knarr-meta.json");try{let y=JSON.parse(await readFile(p,"utf-8"));o$1.push({buildId:y.buildId??r,contentHash:y.contentHash,publishedAt:y.publishedAt,sourcePath:y.sourcePath,packageDir:join(e,"package")});}catch{}}return o$1.sort((r,e)=>new Date(e.publishedAt).getTime()-new Date(r.publishedAt).getTime()),o$1}a(T,"listHistory");async function N(i,a,t){let s=p(i,a,t),o=join(s,".knarr-meta.json");try{let r=JSON.parse(await readFile(o,"utf-8"));return {buildId:r.buildId??t,contentHash:r.contentHash,publishedAt:r.publishedAt,sourcePath:r.sourcePath,packageDir:join(s,"package")}}catch{return null}}a(N,"getHistoryEntry");async function R(i,a,t,s){let o=await N(i,a,t);if(!o)return null;let r=l(i,a),e=p(i,a,t),p$1=join(e,"package"),y=join(e,".knarr-meta.json"),d$1=await readFile(y,"utf-8"),u=join(r,"package"),l$1=join(r,".knarr-meta.json");if(!await H(p$1))throw new Error(`History entry ${t} is missing its package directory`);let k=await readFile(l$1,"utf-8").catch(()=>null),g=r+`.restore-old-${process.pid}-${Date.now()}`,j=join(g,"package"),E$1=false,I$1=false;try{if((await H(u)||k)&&(await F(g),await H(u)&&await D(u,j),k&&await I(join(g,".knarr-meta.json"),k),E$1=!0),await D(p$1,u),I$1=!0,await I(l$1,d$1),await E(e),E$1)try{await O(i,a,g,s);}finally{await E(g);}}catch(x){throw I$1&&await H(u)?(await F(e),await D(u,p$1)):E$1&&await H(u)&&await E(u),E$1&&await H(j)&&await D(j,u),k&&await I(l$1,k),await E(g),x}return d(`[history] Restored build ${t} as current`),o}a(R,"restoreHistoryEntry");async function C(i,a,t){if(t<0)return 0;let s=await T(i,a);if(s.length<=t)return 0;let o=s.slice(t),r=0;for(let e of o){let p$1=p(i,a,e.buildId);try{await E(p$1),r++,d(`[history] Pruned old build ${e.buildId}`);}catch{}}return r}a(C,"pruneHistory");async function _(i,a){let t=o(i,a);await H(t)&&await E(t);}a(_,"clearHistory");function B(i){return i??S}a(B,"resolveHistoryLimit");export{O as a,T as b,N as c,R as d,C as e,_ as f,B as g};
|