knarr 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -20
- package/dist/{add-ODK52RZI.mjs → add-LZ6CZTHG.mjs} +1 -1
- package/dist/bell-YD6IWNXO.mjs +0 -0
- package/dist/check-YVEJEI2G.mjs +0 -0
- package/dist/chokidar-LVDD2IK4.mjs +0 -0
- package/dist/chunk-2GDRDQA5.mjs +0 -0
- package/dist/chunk-2VCW5RWI.mjs +0 -0
- package/dist/chunk-37AAX47E.mjs +19 -0
- package/dist/chunk-3KNUBUPH.mjs +0 -0
- package/dist/{chunk-7DZPDPP6.mjs → chunk-5BZD55UB.mjs} +1 -1
- package/dist/chunk-7HVPEBK5.mjs +0 -0
- package/dist/chunk-7JG555TZ.mjs +0 -0
- package/dist/chunk-7SDPRKFT.mjs +13 -0
- package/dist/chunk-B3DZ5HVQ.mjs +0 -0
- package/dist/chunk-BS4VKVYH.mjs +0 -0
- package/dist/chunk-CTJF2EWO.mjs +3 -0
- package/dist/{chunk-HQ7NKBQW.mjs → chunk-EE2UYGFD.mjs} +2 -2
- package/dist/chunk-GO6F6AGH.mjs +3 -0
- package/dist/chunk-GQYG5FCW.mjs +5 -0
- package/dist/chunk-HEDVIVEO.mjs +14 -0
- package/dist/chunk-KOHUNKHP.mjs +3 -0
- package/dist/{chunk-U5ZZAYNU.mjs → chunk-LXGALE74.mjs} +2 -2
- package/dist/chunk-MBKCCWSD.mjs +0 -0
- package/dist/chunk-NBSJGM2X.mjs +0 -0
- package/dist/chunk-OPLSUHCD.mjs +4 -0
- package/dist/chunk-QGLOGD5G.mjs +3 -0
- package/dist/chunk-SFLWVTJC.mjs +0 -0
- package/dist/{chunk-XQVMCMO7.mjs → chunk-SN4TOUQW.mjs} +3 -3
- package/dist/chunk-SYADAYF4.mjs +0 -0
- package/dist/chunk-TEFMLGCB.mjs +0 -0
- package/dist/{chunk-2EZDTBUU.mjs → chunk-UBGMLVMB.mjs} +2 -2
- package/dist/{chunk-FU7FCNTW.mjs → chunk-XKO24LUM.mjs} +2 -2
- package/dist/chunk-XQPVRRTN.mjs +0 -0
- package/dist/{chunk-FUINO5RD.mjs → chunk-ZJEEAMB3.mjs} +2 -2
- package/dist/clean-ZD5GPGXQ.mjs +3 -0
- package/dist/cli.mjs +1 -1
- package/dist/{dev-7L35BV6M.mjs → dev-TMWMIT7W.mjs} +2 -2
- package/dist/doctor-AXP7GVBM.mjs +4 -0
- package/dist/fs-2NITBGIO.mjs +2 -0
- package/dist/{history-XUZSDCNE.mjs → history-SKKGT225.mjs} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +239 -140
- package/dist/{init-OBJFQ6OB.mjs → init-XK4B7XYG.mjs} +4 -4
- package/dist/{list-AQKUBZ2I.mjs → list-GLSA6I67.mjs} +2 -2
- package/dist/migrate-MW4BVLL2.mjs +8 -0
- package/dist/preflight-TVJFHRI2.mjs +0 -0
- package/dist/publish-TAWTHPSD.mjs +3 -0
- package/dist/{push-NHCPN6MO.mjs → push-65ZZFZJY.mjs} +2 -2
- package/dist/remove-LOBXHBMC.mjs +2 -0
- package/dist/reset-EAN5NVGM.mjs +3 -0
- package/dist/{restore-YGPO42W4.mjs → restore-YHZYT54B.mjs} +3 -3
- package/dist/rollback-U3LQTWH5.mjs +3 -0
- package/dist/{status-3VUPPR5D.mjs → status-FA6UEHEF.mjs} +3 -3
- package/dist/tailwind-source-RIWWXW2Y.mjs +5 -0
- package/dist/topo-sort-WEIVPJKN.mjs +0 -0
- package/dist/{tracker-R4ZZIDJV.mjs → tracker-JJEYXX45.mjs} +1 -1
- package/dist/update-VOUKMOLK.mjs +3 -0
- package/dist/{use-NKLXGPIZ.mjs → use-BXAZ5OP3.mjs} +1 -1
- package/dist/{vite-config-URP2SYRQ.mjs → vite-config-UWCLPTOZ.mjs} +1 -1
- package/dist/watch-orchestrator-I2623SMT.mjs +3 -0
- package/dist/watcher-PTPUN2HE.mjs +0 -0
- package/dist/{workspace-L5CGPK7U.mjs → workspace-S3TAUSS3.mjs} +1 -1
- package/dist/xxhash-wasm-DTW44IIQ.mjs +0 -0
- package/package.json +7 -4
- package/dist/chunk-23HXXAGG.mjs +0 -5
- package/dist/chunk-2QPLXLJW.mjs +0 -3
- package/dist/chunk-IM555H3S.mjs +0 -4
- package/dist/chunk-KXLQGVT2.mjs +0 -13
- package/dist/chunk-OLUZ7T7G.mjs +0 -3
- package/dist/chunk-OXI2KGCW.mjs +0 -14
- package/dist/chunk-V2ED74ZQ.mjs +0 -3
- package/dist/chunk-YZCBBQCH.mjs +0 -19
- package/dist/chunk-Z22BYXWQ.mjs +0 -3
- package/dist/clean-XMLDIZDZ.mjs +0 -3
- package/dist/doctor-4TTAYNGW.mjs +0 -4
- package/dist/fs-35635IS7.mjs +0 -2
- package/dist/migrate-7B7ACQHY.mjs +0 -8
- package/dist/publish-Q4JYQPQP.mjs +0 -3
- package/dist/remove-PDERBH66.mjs +0 -2
- package/dist/reset-3FXWAAPQ.mjs +0 -3
- package/dist/rollback-FKNGLGFC.mjs +0 -3
- package/dist/tailwind-source-ND5FE6PQ.mjs +0 -5
- package/dist/update-QPBWYDSG.mjs +0 -3
- package/dist/watch-orchestrator-F6S5WQQX.mjs +0 -3
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
3
|
Copyright (c) 2026 Knarr contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -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-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
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
CHANGED
|
File without changes
|
package/dist/check-YVEJEI2G.mjs
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/chunk-2GDRDQA5.mjs
CHANGED
|
File without changes
|
package/dist/chunk-2VCW5RWI.mjs
CHANGED
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
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-3KNUBUPH.mjs
CHANGED
|
File without changes
|
|
@@ -1,3 +1,3 @@
|
|
|
1
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-
|
|
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
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-7HVPEBK5.mjs
CHANGED
|
File without changes
|
package/dist/chunk-7JG555TZ.mjs
CHANGED
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
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-B3DZ5HVQ.mjs
CHANGED
|
File without changes
|
package/dist/chunk-BS4VKVYH.mjs
CHANGED
|
File without changes
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {createRequire}from'node:module';import {n,d,z,m,H,h,j as j$1,k,E,l}from'./chunk-GQYG5FCW.mjs';import {b}from'./chunk-B3DZ5HVQ.mjs';import {a}from'./chunk-2VCW5RWI.mjs';import {readFile,readdir}from'fs/promises';import'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
+
async function y(t,r){let s=n(t,r);try{let a=await readFile(s,"utf-8"),e=JSON.parse(a);return d(e)?e:(b.warn(`Invalid metadata for ${t}@${r}, ignoring`),null)}catch(a){return z(a)&&a.code!=="ENOENT"&&b.warn(`Failed to read metadata for ${t}@${r}: ${a instanceof Error?a.message:String(a)}`),null}}a(y,"readMeta");async function j(t,r){let s=m(t,r),a=await y(t,r);return !a||!await H(s)?null:{name:t,version:r,packageDir:s,meta:a}}a(j,"getStoreEntry");async function A(t){let r=h();if(!await H(r))return null;let s=j$1(t)+"@",e=(await readdir(r,{withFileTypes:true})).filter(n=>n.isDirectory()&&n.name.startsWith(s)),u=(await Promise.all(e.map(async n=>{let i=n.name.slice(s.length),c=await y(t,i);return c?{name:t,version:i,packageDir:m(t,i),meta:c}:null}))).filter(n=>n!==null);return u.length===0?null:u.reduce((n,i)=>new Date(i.meta.publishedAt).getTime()>new Date(n.meta.publishedAt).getTime()?i:n)}a(A,"findStoreEntry");async function J(){let t=h();if(!await H(t))return [];let s=(await readdir(t,{withFileTypes:true})).filter(e=>e.isDirectory()?e.name.lastIndexOf("@")>0:false);return (await Promise.all(s.map(async e=>{let l=e.name.lastIndexOf("@"),u=e.name.slice(0,l),n=e.name.slice(l+1),i=k(u),c=await y(i,n);return c?{name:i,version:n,packageDir:m(i,n),meta:c}:null}))).filter(e=>e!==null)}a(J,"listStoreEntries");async function W(t,r){await E(l(t,r));}a(W,"removeStoreEntry");export{y as a,j as b,A as c,J as d,W as e};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {
|
|
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
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
|
|
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};
|
|
@@ -0,0 +1,3 @@
|
|
|
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};
|
|
@@ -0,0 +1,5 @@
|
|
|
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};
|
|
@@ -0,0 +1,14 @@
|
|
|
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};
|
|
@@ -0,0 +1,3 @@
|
|
|
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};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {
|
|
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
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
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
5
|
${n.map(l=>`${i}${i}${l},`).join(`
|
|
@@ -10,4 +10,4 @@ ${i}]`}a(h,"formatPlugins");function x(n){let o=/plugins\s*:\s*\[/g.exec(n);if(!
|
|
|
10
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
11
|
`,s=y(i);return s>0?i=i.slice(0,s)+`
|
|
12
12
|
`+e+i.slice(s):i=e+`
|
|
13
|
-
`+i,await
|
|
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-MBKCCWSD.mjs
CHANGED
|
File without changes
|
package/dist/chunk-NBSJGM2X.mjs
CHANGED
|
File without changes
|
|
@@ -0,0 +1,4 @@
|
|
|
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};
|
|
@@ -0,0 +1,3 @@
|
|
|
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};
|
package/dist/chunk-SFLWVTJC.mjs
CHANGED
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$1}from'./chunk-
|
|
2
|
+
import {createRequire}from'node:module';import {a as a$1}from'./chunk-LXGALE74.mjs';import {I}from'./chunk-GQYG5FCW.mjs';import {a}from'./chunk-2VCW5RWI.mjs';import {readFile}from'fs/promises';globalThis.require=createRequire(import.meta.url);
|
|
3
3
|
function g(e){return e.match(/^(\s+)\S/m)?.[1]||" "}a(g,"detectIndent");function x(e){let r=[],t=/['"]([^'"]*)['"]/g,n;for(;(n=t.exec(e))!==null;)r.push(n[1]);return r}a(x,"parseArrayItems");function w(e,r){return e.length===0?"[]":e.length<=3?`[${e.map(n=>`'${n}'`).join(", ")}]`:`[
|
|
4
4
|
${e.map(n=>`${r}${r}'${n}',`).join(`
|
|
5
5
|
`)}
|
|
6
|
-
${r}]`}a(w,"formatArray");function y(e){let r=a$1(e);return r.complex?r:/(?:module\.exports\s*=\s*|export\s+default\s+)[\w.]+\s*\(\s*\{/.test(e)?{complex:true,reason:"wrapper function pattern"}:/\w+\s*\(\s*\w+\s*\(/.test(e)&&e.includes("module.exports")?{complex:true,reason:"chained wrapper functions"}:{complex:false}}a(y,"isComplexNextConfig");async function b(e,r){let t;try{t=await readFile(e,"utf-8");}catch{return {modified:false,error:"could not read config file"}}let n=y(t);if(n.complex)return {modified:false,error:`config too complex (${n.reason})`};let c=g(t),l=/transpilePackages\s*:\s*\[([^\]]*)\]/s,f=l.exec(t);if(f){let s=x(f[1]);if(s.includes(r))return {modified:false};s.push(r);let i=w(s,c),a=t.replace(l,`transpilePackages: ${i}`);return await
|
|
7
|
-
${c}transpilePackages: ['${r}'],`,$=t.slice(0,a)+h+t.slice(a);return await
|
|
6
|
+
${r}]`}a(w,"formatArray");function y(e){let r=a$1(e);return r.complex?r:/(?:module\.exports\s*=\s*|export\s+default\s+)[\w.]+\s*\(\s*\{/.test(e)?{complex:true,reason:"wrapper function pattern"}:/\w+\s*\(\s*\w+\s*\(/.test(e)&&e.includes("module.exports")?{complex:true,reason:"chained wrapper functions"}:{complex:false}}a(y,"isComplexNextConfig");async function b(e,r){let t;try{t=await readFile(e,"utf-8");}catch{return {modified:false,error:"could not read config file"}}let n=y(t);if(n.complex)return {modified:false,error:`config too complex (${n.reason})`};let c=g(t),l=/transpilePackages\s*:\s*\[([^\]]*)\]/s,f=l.exec(t);if(f){let s=x(f[1]);if(s.includes(r))return {modified:false};s.push(r);let i=w(s,c),a=t.replace(l,`transpilePackages: ${i}`);return await I(e,a),{modified:true}}let p=[/module\.exports\s*=\s*\{/,/export\s+default\s+\{/,/(?:const|let|var)\s+\w*[Cc]onfig\w*\s*=\s*\{/];for(let s of p){let i=s.exec(t);if(i){let a=i.index+i[0].length,h=`
|
|
7
|
+
${c}transpilePackages: ['${r}'],`,$=t.slice(0,a)+h+t.slice(a);return await I(e,$),{modified:true}}}return {modified:false,error:"unrecognized config pattern"}}a(b,"addToTranspilePackages");async function A(e,r){let t;try{t=await readFile(e,"utf-8");}catch{return {modified:false}}let n=g(t),c=/transpilePackages\s*:\s*\[([^\]]*)\]/s,l=c.exec(t);if(!l)return {modified:false};let f=x(l[1]),p=f.filter(a=>a!==r);if(p.length===f.length)return {modified:false};let s=w(p,n),i=t.replace(c,`transpilePackages: ${s}`);return await I(e,i),{modified:true}}a(A,"removeFromTranspilePackages");export{b as a,A as b};
|
package/dist/chunk-SYADAYF4.mjs
CHANGED
|
File without changes
|
package/dist/chunk-TEFMLGCB.mjs
CHANGED
|
File without changes
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a}from'./chunk-3KNUBUPH.mjs';import {
|
|
3
|
-
var w=c(a(),1);async function N(o){let t=o;for(;;){if(await
|
|
2
|
+
import {createRequire}from'node:module';import {a}from'./chunk-3KNUBUPH.mjs';import {H,t}from'./chunk-GQYG5FCW.mjs';import {c,a as a$1}from'./chunk-2VCW5RWI.mjs';import {readFile,readdir}from'fs/promises';import {join,dirname,relative,resolve}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
+
var w=c(a(),1);async function N(o){let t=o;for(;;){if(await H(join(t,"pnpm-workspace.yaml")))return t;let s=dirname(t);if(s===t)return null;t=s;}}a$1(N,"findWorkspaceRoot");async function $(o){let t={default:{},named:{}},s=join(o,"pnpm-workspace.yaml"),i;try{i=await readFile(s,"utf-8");}catch{return t}let r=i.split(/\r?\n/),e="top",n="";for(let a of r){if(a.trim()===""||a.trim().startsWith("#"))continue;let f=a.length-a.trimStart().length;if(f===0){if(a.startsWith("catalog:")){e="default-catalog";continue}if(a.startsWith("catalogs:")){e="named-catalogs";continue}e="top";continue}if(e==="default-catalog"&&f>=2){let c=S(a);c&&(t.default[c[0]]=c[1]);continue}if(e==="named-catalogs"&&f>=2&&f<4){let c=a.trim();c.endsWith(":")&&(n=c.slice(0,-1),t.named[n]={},e="named-catalog-entries");continue}if(e==="named-catalog-entries"&&f>=4){let c=S(a);c&&n&&(t.named[n][c[0]]=c[1]);continue}if(e==="named-catalog-entries"&&f>=2&&f<4){let c=a.trim();c.endsWith(":")?(n=c.slice(0,-1),t.named[n]={}):e="named-catalogs";continue}}return t}a$1($,"parseCatalogs");async function C(o){let t=await N(o);if(t){let i=await G(t),r=i.filter(n=>!n.startsWith("!")),e=i.filter(n=>n.startsWith("!")).map(n=>n.slice(1));if(r.length>0)return W(t,r,e)}let s=t??await O(o);if(!s)return [];try{let i=JSON.parse(await readFile(join(s,"package.json"),"utf-8")),r=Array.isArray(i.workspaces)?i.workspaces:i.workspaces?.packages??[];if(r.length===0)return [];let e=r.filter(a=>!a.startsWith("!")),n=r.filter(a=>a.startsWith("!")).map(a=>a.slice(1));return W(s,e,n)}catch{return []}}a$1(C,"findWorkspacePackages");async function G(o){let t=join(o,"pnpm-workspace.yaml"),s;try{s=await readFile(t,"utf-8");}catch{return []}let i=[],r=false;for(let e of s.split(/\r?\n/)){let n=e.trim();if(n===""||n.startsWith("#"))continue;let a=e.length-e.trimStart().length;if(a===0){r=n==="packages:";continue}if(r&&a>=2){let f=n.match(/^-\s+["']?([^"']+)["']?$/);f&&i.push(f[1]);}}return i}a$1(G,"parsePnpmWorkspacePackages");async function O(o){let t=o;for(;;){try{if(JSON.parse(await readFile(join(t,"package.json"),"utf-8")).workspaces)return t}catch{}let s=dirname(t);if(s===t)return null;t=s;}}a$1(O,"findPackageJsonWorkspaceRoot");async function W(o,t$1,s=[]){let i=[];for(let n of t$1)if(n.includes("*")){let a=n.split("/"),f=o,c=[],y=false;for(let g of a)y||g.includes("*")?(y=true,c.push(g)):f=join(f,g);if(c.length===1&&c[0]==="*")try{let g=await readdir(f,{withFileTypes:!0});for(let k of g)if(k.isDirectory()){let u=join(f,k.name);await H(join(u,"package.json"))&&i.push(u);}}catch{}else {let g=(0, w.default)(n),k=await j(o,8);for(let u of k){let b=t(relative(o,u));g(b)&&await H(join(u,"package.json"))&&i.push(u);}}}else {let a=resolve(o,n);await H(join(a,"package.json"))&&i.push(a);}let r=[...new Set(i)];if(s.length===0)return r;let e=(0, w.default)(s);return r.filter(n=>{let a=t(relative(o,n));return !e(a)})}a$1(W,"resolveWorkspaceGlobs");async function j(o,t){if(t<=0)return [];let s=[];try{let i=await readdir(o,{withFileTypes:!0});for(let r of i){if(!r.isDirectory()||r.name==="node_modules"||r.name===".git")continue;let e=join(o,r.name);s.push(e),s.push(...await j(e,t-1));}}catch{}return s}a$1(j,"collectDirs");async function z(o){let t=await C(o),s=[];for(let e of t)try{let n=JSON.parse(await readFile(join(e,"package.json"),"utf-8"));n.name&&n.version&&s.push({name:n.name,version:n.version,dir:e,pkg:n});}catch{}let i=new Set(s.map(e=>e.name)),r=new Map;for(let e of s){let n=new Set;for(let a of ["dependencies","devDependencies"]){let f=e.pkg[a];if(f)for(let c of Object.keys(f))i.has(c)&&n.add(c);}r.set(e.name,n);}return {packages:s,adjacency:r}}a$1(z,"buildWorkspaceGraph");function D(o){let t=new Map;for(let s of o.keys())t.set(s,new Set);for(let[s,i]of o)for(let r of i){let e=t.get(r);e||(e=new Set,t.set(r,e)),e.add(s);}return t}a$1(D,"buildReverseAdjacency");function S(o){let t=o.trim(),s=t.indexOf(":");if(s<=0)return null;let i=t.slice(0,s).trim(),r=t.slice(s+1).trim();if(!i||!r)return null;let e=r.replace(/^["']|["']$/g,"");return [i,e]}a$1(S,"parseKeyValue");export{N as a,$ as b,C as c,z as d,D as e};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$2}from'./chunk-
|
|
3
|
-
async function L(n){try{let i=await readFile(join(n,"package.json"),"utf-8"),t=JSON.parse(i).knarr;if(!t||typeof t!="object")return {};let o={},e=t;return typeof e.buildCmd=="string"&&(o.buildCmd=e.buildCmd),Array.isArray(e.watchPatterns)&&(o.watchPatterns=e.watchPatterns.filter(r=>typeof r=="string")),typeof e.debounce=="number"&&Number.isFinite(e.debounce)&&(o.debounce=e.debounce),typeof e.cooldown=="number"&&Number.isFinite(e.cooldown)&&(o.cooldown=e.cooldown),typeof e.historyLimit=="number"&&Number.isFinite(e.historyLimit)&&(o.historyLimit=Math.max(0,Math.floor(e.historyLimit))),typeof e.notify=="boolean"&&(o.notify=e.notify),d(`[config] Loaded knarr config from package.json: ${JSON.stringify(o)}`),o}catch{return {}}}a(L,"loadKnarrConfig");var K=
|
|
2
|
+
import {createRequire}from'node:module';import {a as a$2}from'./chunk-OPLSUHCD.mjs';import {b as b$1}from'./chunk-CTJF2EWO.mjs';import {a as a$5}from'./chunk-37AAX47E.mjs';import {a as a$3}from'./chunk-TEFMLGCB.mjs';import {a as a$7}from'./chunk-7JG555TZ.mjs';import {a as a$6}from'./chunk-EE2UYGFD.mjs';import {a as a$1}from'./chunk-MBKCCWSD.mjs';import {a as a$4}from'./chunk-BS4VKVYH.mjs';import {j,f,d as d$1}from'./chunk-KOHUNKHP.mjs';import {v}from'./chunk-GQYG5FCW.mjs';import {d}from'./chunk-NBSJGM2X.mjs';import {b}from'./chunk-B3DZ5HVQ.mjs';import {a}from'./chunk-2VCW5RWI.mjs';import {readFile}from'fs/promises';import {join}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
+
async function L(n){try{let i=await readFile(join(n,"package.json"),"utf-8"),t=JSON.parse(i).knarr;if(!t||typeof t!="object")return {};let o={},e=t;return typeof e.buildCmd=="string"&&(o.buildCmd=e.buildCmd),Array.isArray(e.watchPatterns)&&(o.watchPatterns=e.watchPatterns.filter(r=>typeof r=="string")),typeof e.debounce=="number"&&Number.isFinite(e.debounce)&&(o.debounce=e.debounce),typeof e.cooldown=="number"&&Number.isFinite(e.cooldown)&&(o.cooldown=e.cooldown),typeof e.historyLimit=="number"&&Number.isFinite(e.historyLimit)&&(o.historyLimit=Math.max(0,Math.floor(e.historyLimit))),typeof e.notify=="boolean"&&(o.notify=e.notify),d(`[config] Loaded knarr config from package.json: ${JSON.stringify(o)}`),o}catch{return {}}}a(L,"loadKnarrConfig");var K=v(4);async function nt(n,i={}){let s=new a$1,t=await a$2(n,{runScripts:i.runScripts,force:i.force,historyLimit:i.historyLimit});if(t.skipped){b.info("No changes to push");return}let o=await b$1(t.name,t.version);if(!o){a$3(`Failed to read store entry for ${t.name}@${t.version} after publish`);return}let e=await j(t.name);if(e.length===0){b.success(`Published ${t.name}@${t.version} to store`),b.info("No consumers registered yet. Run 'knarr add "+t.name+"' in a consumer project to start receiving pushes."),a$4({name:t.name,version:t.version,buildId:t.buildId,consumers:0,failedConsumers:0,copied:0,skipped:0,elapsed:s.elapsedMs()});return}let r=0,f$1=0,a=0,p=0,b$2=await Promise.all(e.map(d$2=>K(async()=>{let g=await f(d$2,t.name);if(!g)return d(`[push] No link found for ${t.name} in ${d$2}, skipping`),null;try{let l=await a$5(o,d$2,g.packageManager,{force:i.force});return await d$1(d$2,t.name,{...g,contentHash:o.meta.contentHash,linkedAt:new Date().toISOString(),buildId:o.meta.buildId??""}),l}catch(l){return b.warn(`Failed to push to ${d$2}: ${l instanceof Error?l.message:String(l)}`),null}})));for(let d of b$2)d?(r+=d.copied,f$1+=d.skipped,a++):p++;let M=t.buildId?` [${t.buildId}]`:"";b.success(`Pushed ${t.name}@${t.version}${M} to ${a} consumer(s) in ${s.elapsed()} (${r} files changed, ${f$1} unchanged)`),a$4({name:t.name,version:t.version,buildId:t.buildId,consumers:a,failedConsumers:p,copied:r,skipped:f$1,elapsed:s.elapsedMs()});}a(nt,"doPush");function W(n){if(!n)return;let i=parseInt(n,10);return Number.isFinite(i)?i:void 0}a(W,"parseMs");async function rt(n,i,s){let{startWatcher:t}=await import('./watcher-PTPUN2HE.mjs'),o=await L(n),{buildCmd:e,patterns:r}=await J(n,i,o),f=i.notify??o.notify??false,a$1=await t(n,{patterns:r,buildCmd:e,debounce:W(i.debounce)??o.debounce,cooldown:W(i.cooldown)??o.cooldown,notify:f},s);await new Promise(p=>{let b$1=a(async()=>{b.info("Stopping watcher..."),await a$1.close(),p();},"cleanup");process.once("SIGINT",b$1),process.once("SIGTERM",b$1);});}a(rt,"startWatchMode");async function J(n,i,s){let t=i.build,o=s?.watchPatterns;if(!i.build){if(!i["skip-build"])if(s?.buildCmd)t=s.buildCmd,b.info(`Using build command from config: ${t}`);else {let e=await a$6(n),r=await a$7(n,e);r&&(t=r,b.info(`Auto-detected build command: ${r}`));}}if(t){let{exists:e}=await import('./fs-2NITBGIO.mjs'),r=["src","lib","source","app","pages","components"],f=(await Promise.all(r.map(async a=>({dir:a,exists:await e(join(n,a))})))).filter(a=>a.exists).map(a=>a.dir);o=f.length>0?f:["src","lib"],d(`[watch] Using source patterns with build command: ${o.join(", ")}`);}else {b.info("No build command detected \u2014 watching output directories directly");try{let e=JSON.parse(await readFile(join(n,"package.json"),"utf-8"));e.files&&e.files.length>0?(o=e.files,b.info(`Watching from package.json "files": ${o.join(", ")}`)):b.warn('No "files" field in package.json \u2014 falling back to watching src/ and lib/. Add a "files" field or use --build to specify a build command.');}catch(e){d(`[watch] Could not read package.json: ${e instanceof Error?e.message:String(e)}`);}}return {buildCmd:t,patterns:o}}a(J,"resolveWatchConfig");async function st(n,i,s){let t=!i["no-cascade"],{WatchOrchestrator:o}=await import('./watch-orchestrator-I2623SMT.mjs');await new o(t).start(n,i,s);}a(st,"startMultiWatchMode");export{L as a,nt as b,rt as c,J as d,st as e};
|
package/dist/chunk-XQPVRRTN.mjs
CHANGED
|
File without changes
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {b as b$1}from'./chunk-
|
|
3
|
-
var z={meta:{name:"remove",description:"Remove a Knarr-linked package and restore the original"},args:{package:{type:"positional",description:"Package name to remove",required:false},all:{type:"boolean",description:"Remove all linked packages",default:false},force:{type:"boolean",description:"Skip error checking",default:false},yes:{type:"boolean",alias:"y",description:"Skip confirmation prompts",default:false}},async run({args:i}){b$2();let e=new a$2,n=resolve(".");if(i.all){let u=await a$1(n),a=Object.entries(u.links);if(a.length===0){b.info("No linked packages to remove"),a$3({removed:0});return}if(!i.yes){let l=a.map(([m])=>m).join(", "),d=await b.prompt(`Remove ${a.length} linked package(s)? (${l})`,{type:"confirm"});if(!d||typeof d=="symbol"){b.info("Cancelled");return}}let r=0,s=0;for(let[l,d]of a)try{await E(n,l,d),r++;}catch(m){s++,b.warn(`Failed to remove ${l}: ${m instanceof Error?m.message:String(m)}`);}b.success(`Removed ${r} Knarr link(s)${s>0?`, ${s} failed`:""} in ${e.elapsed()}`),a$3({removed:r,failed:s,elapsed:e.elapsedMs()});return}let o=i.package;o||(a$4("Package name required. Use --all to remove all linked packages."),process.exit(1));let p=await f(n,o);if(!p){if(i.force){b.warn(`Package "${o}" is not linked, skipping`),a$3({removed:0});return}a$4(`Package "${o}" is not linked in this project`),process.exit(1);}await E(n,o,p),b.success(`Removed Knarr link for ${o} in ${e.elapsed()}`),a$3({removed:1,package:o,elapsed:e.elapsedMs()}),b$3()&&
|
|
2
|
+
import {createRequire}from'node:module';import {b as b$1}from'./chunk-SN4TOUQW.mjs';import {d as d$1,c}from'./chunk-37AAX47E.mjs';import {a as a$4}from'./chunk-TEFMLGCB.mjs';import {d as d$2}from'./chunk-EE2UYGFD.mjs';import {a as a$2}from'./chunk-MBKCCWSD.mjs';import {b as b$2,a as a$3}from'./chunk-BS4VKVYH.mjs';import {e,i,a as a$1,f}from'./chunk-KOHUNKHP.mjs';import {y}from'./chunk-GQYG5FCW.mjs';import {d,b as b$3}from'./chunk-NBSJGM2X.mjs';import {b}from'./chunk-B3DZ5HVQ.mjs';import {a}from'./chunk-2VCW5RWI.mjs';import {basename,resolve}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
+
var z={meta:{name:"remove",description:"Remove a Knarr-linked package and restore the original"},args:{package:{type:"positional",description:"Package name to remove",required:false},all:{type:"boolean",description:"Remove all linked packages",default:false},force:{type:"boolean",description:"Skip error checking",default:false},yes:{type:"boolean",alias:"y",description:"Skip confirmation prompts",default:false}},async run({args:i}){b$2();let e=new a$2,n=resolve(".");if(i.all){let u=await a$1(n),a=Object.entries(u.links);if(a.length===0){b.info("No linked packages to remove"),a$3({removed:0});return}if(!i.yes){let l=a.map(([m])=>m).join(", "),d=await b.prompt(`Remove ${a.length} linked package(s)? (${l})`,{type:"confirm"});if(!d||typeof d=="symbol"){b.info("Cancelled");return}}let r=0,s=0;for(let[l,d]of a)try{await E(n,l,d),r++;}catch(m){s++,b.warn(`Failed to remove ${l}: ${m instanceof Error?m.message:String(m)}`);}b.success(`Removed ${r} Knarr link(s)${s>0?`, ${s} failed`:""} in ${e.elapsed()}`),a$3({removed:r,failed:s,elapsed:e.elapsedMs()});return}let o=i.package;o||(a$4("Package name required. Use --all to remove all linked packages."),process.exit(1));let p=await f(n,o);if(!p){if(i.force){b.warn(`Package "${o}" is not linked, skipping`),a$3({removed:0});return}a$4(`Package "${o}" is not linked in this project`),process.exit(1);}await E(n,o,p),b.success(`Removed Knarr link for ${o} in ${e.elapsed()}`),a$3({removed:1,package:o,elapsed:e.elapsedMs()}),b$3()&&y();}};async function E(i$1,e$1,n){if(d(`[remove] Removing ${e$1}`),await d$1(i$1,e$1,n.packageManager),n.backupExists)try{await c(i$1,e$1,n.packageManager)&&b.success(`Restored original ${e$1} from backup`);}catch(r){b.warn(`Failed to restore backup for ${e$1}: ${r instanceof Error?r.message:String(r)}. Run your package manager's install command to restore it.`);}let o=await d$2(i$1);o.type==="next"&&o.configFile&&(await b$1(o.configFile,e$1)).modified&&d(`[remove] Removed ${e$1} from ${basename(o.configFile)}`);let{findTailwindCss:p,removeTailwindSource:u}=await import('./tailwind-source-RIWWXW2Y.mjs'),a=await p(i$1);if(a&&(await u(a,e$1)).modified&&d(`[remove] Removed @source for ${e$1} from ${basename(a)}`),await e(i$1,e$1),await i(e$1,i$1),o.type==="vite"&&o.configFile){let r=await a$1(i$1);if(Object.keys(r.links).length===0){let{removeFromViteConfig:s}=await import('./vite-config-UWCLPTOZ.mjs');(await s(o.configFile)).modified&&d(`[remove] Removed Knarr plugin from ${basename(o.configFile)}`);}}}a(E,"removeSinglePackage");export{z as a,E as b};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {createRequire}from'node:module';import {a as a$1}from'./chunk-2GDRDQA5.mjs';import {d as d$1,e}from'./chunk-CTJF2EWO.mjs';import {a}from'./chunk-MBKCCWSD.mjs';import {b,a as a$2}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import {k,g,b as b$2}from'./chunk-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import {t,h,H,J,E,y}from'./chunk-GQYG5FCW.mjs';import {d,b as b$3}from'./chunk-NBSJGM2X.mjs';import {b as b$1}from'./chunk-B3DZ5HVQ.mjs';import'./chunk-2VCW5RWI.mjs';import {readdir}from'fs/promises';import {join}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
+
var ne={meta:{name:"clean",description:"Remove unreferenced store entries and stale consumer registrations"},args:{yes:{type:"boolean",alias:"y",description:"Skip confirmation prompts",default:false}},async run({args:A}){b();let y$1=new a;b$1.start("Checking consumer registrations...");let{removedConsumers:l,removedPackages:v}=await k();l>0&&b$1.success(`Removed ${l} stale consumer registration(s) across ${v} package(s)`);let $=await g(),f=new Set,F=[...new Set(Object.values($).flat())],w=await Promise.all(F.map(async e=>{let{state:t,reliable:o}=await b$2(e);return {path:e,state:t,reliable:o}}));for(let{state:e,reliable:t}of w)if(t)for(let[o,g]of Object.entries(e.links))f.add(`${o}@${g.version}`);let d$2=new Set,u=w.filter(e=>!e.reliable);if(u.length>0){b$1.warn(`${u.length} consumer(s) have corrupt state; their store entries will be preserved`);let e=new Set(u.map(t$1=>t(t$1.path)));for(let[t,o]of Object.entries($))o.some(g=>e.has(g))&&d$2.add(t);d(`[clean] Protected packages (corrupt state): ${[...d$2].join(", ")}`);}d(`[clean] Referenced entries: ${[...f].join(", ")||"(none)"}`);let H$1=await d$1(),s=[];for(let e of H$1){let t=`${e.name}@${e.version}`;if(!f.has(t)){if(d$2.has(e.name)){d(`[clean] Preserving ${t} (consumer state unreadable)`);continue}let o=Date.now()-new Date(e.meta.publishedAt).getTime();if(o<300*1e3){d(`[clean] Skipping recently published entry: ${t} (${Math.round(o/1e3)}s old)`);continue}s.push(e);}}let n=[],p=h();if(await H(p)){let e=await readdir(p,{withFileTypes:true});for(let t of e)t.isDirectory()&&(t.name.includes(".tmp-")||t.name.includes(".old-"))&&n.push(t.name);}if(s.length+n.length>0&&!A.yes){let e=[];s.length>0&&e.push(`${s.length} unreferenced store entry(ies)`),n.length>0&&e.push(`${n.length} orphaned temp directory(ies)`);let t=await b$1.prompt(`Remove ${e.join(" and ")}?`,{type:"confirm"});if(!t||typeof t=="symbol"){b$1.info("Cancelled");return}}let a$3=0,q=await Promise.all(s.map(e=>J(e.packageDir))),G=await Promise.all(n.map(e=>J(join(p,e)))),m=0;for(let e$1=0;e$1<s.length;e$1++){let t=s[e$1];d(`[clean] Removing unreferenced store entry: ${t.name}@${t.version}`),await e(t.name,t.version),a$3+=q[e$1],m++;}m>0&&b$1.success(`Removed ${m} unreferenced store entry(ies)`);let c=0;for(let e=0;e<n.length;e++)d(`[clean] Removing orphaned directory: ${n[e]}`),await E(join(p,n[e])),a$3+=G[e],c++;c>0&&b$1.success(`Removed ${c} orphaned temp directory(ies)`),l===0&&m===0&&c===0&&b$1.info("Store is clean; no stale entries or registrations found");let I=a$3>0?` (reclaimed ${a$1(a$3)})`:"";b$1.info(`Clean complete in ${y$1.elapsed()}${I}`),a$2({removedConsumers:l,removedPackages:v,removedEntries:m,removedOrphans:c,reclaimedBytes:a$3,elapsed:y$1.elapsedMs()}),b$3()&&y();}};export{ne as default};
|
package/dist/cli.mjs
CHANGED
|
@@ -7,4 +7,4 @@ var o=c(a$1(),1);var _=`
|
|
|
7
7
|
| . \\| | | | (_| | | | |
|
|
8
8
|
|_|\\_\\_| |_|\\__,_|_| |_|
|
|
9
9
|
`;function s(){console.log(o.default.yellow(_)),console.log(o.default.cyan(" Local npm package development without symlinks")),console.log(o.default.dim(` Copies built files into consumer node_modules with incremental sync
|
|
10
|
-
`));}a$2(s,"showBanner");process.env.UV_THREADPOOL_SIZE??=String(Math.max(availableParallelism(),8));a$3();var a=process.argv.slice(2),b=["init","publish","add","use","remove","push","dev","restore","list","status","update","clean","gc","doctor","migrate","reset","rollback","check"],u=a.some(e=>!e.startsWith("-")&&b.includes(e)),v=a.includes("--help")||a.includes("-h")||a.includes("--version");if(!u&&!v&&process.stdin.isTTY){s();let e=await g();e&&process.argv.splice(2,0,e);}else u||s();async function g(){try{let{readConsumerStateSafe:c}=await import('./tracker-
|
|
10
|
+
`));}a$2(s,"showBanner");process.env.UV_THREADPOOL_SIZE??=String(Math.max(availableParallelism(),8));a$3();var a=process.argv.slice(2),b=["init","publish","add","use","remove","push","dev","restore","list","status","update","clean","gc","doctor","migrate","reset","rollback","check"],u=a.some(e=>!e.startsWith("-")&&b.includes(e)),v=a.includes("--help")||a.includes("-h")||a.includes("--version");if(!u&&!v&&process.stdin.isTTY){s();let e=await g();e&&process.argv.splice(2,0,e);}else u||s();async function g(){try{let{readConsumerStateSafe:c}=await import('./tracker-JJEYXX45.mjs'),{resolve:p}=await import('path'),{state:d}=await c(p(".")),n=Object.keys(d.links).length;n>0&&b$1.info(`${n} package(s) linked in this project`);}catch{}return await b$1.prompt("What would you like to do?",{type:"select",options:[{label:"init - Set up knarr in this project",value:"init"},{label:"publish - Publish package to the knarr store",value:"publish"},{label:"add - Link a package from the store",value:"add"},{label:"use - Link a local package path",value:"use"},{label:"push - Publish and push to all consumers",value:"push"},{label:"dev - Watch, rebuild, and push continuously",value:"dev"},{label:"list - Show linked packages",value:"list"},{label:"status - Show project status",value:"status"},{label:"help - Show help",value:"--help"}]})||null}a$2(g,"showInteractiveMenu");var k={meta:{name:"knarr",version:"0.0.3",description:"Local npm package development - copies built files into consumer node_modules"},args:{verbose:{type:"boolean",alias:"v",description:"Enable verbose debug logging",default:false},"dry-run":{type:"boolean",description:"Preview changes without writing files",default:false},json:{type:"boolean",description:"Output machine-readable JSON",default:false}},subCommands:{init:a$2(()=>import('./init-XK4B7XYG.mjs').then(e=>e.default),"init"),publish:a$2(()=>import('./publish-TAWTHPSD.mjs').then(e=>e.default),"publish"),add:a$2(()=>import('./add-LZ6CZTHG.mjs').then(e=>e.default),"add"),use:a$2(()=>import('./use-BXAZ5OP3.mjs').then(e=>e.default),"use"),remove:a$2(()=>import('./remove-LOBXHBMC.mjs').then(e=>e.default),"remove"),push:a$2(()=>import('./push-65ZZFZJY.mjs').then(e=>e.default),"push"),dev:a$2(()=>import('./dev-TMWMIT7W.mjs').then(e=>e.default),"dev"),restore:a$2(()=>import('./restore-YHZYT54B.mjs').then(e=>e.default),"restore"),list:a$2(()=>import('./list-GLSA6I67.mjs').then(e=>e.default),"list"),status:a$2(()=>import('./status-FA6UEHEF.mjs').then(e=>e.default),"status"),update:a$2(()=>import('./update-VOUKMOLK.mjs').then(e=>e.default),"update"),clean:a$2(()=>import('./clean-ZD5GPGXQ.mjs').then(e=>e.default),"clean"),gc:a$2(()=>import('./clean-ZD5GPGXQ.mjs').then(e=>e.default),"gc"),doctor:a$2(()=>import('./doctor-AXP7GVBM.mjs').then(e=>e.default),"doctor"),migrate:a$2(()=>import('./migrate-MW4BVLL2.mjs').then(e=>e.default),"migrate"),reset:a$2(()=>import('./reset-EAN5NVGM.mjs').then(e=>e.default),"reset"),rollback:a$2(()=>import('./rollback-U3LQTWH5.mjs').then(e=>e.default),"rollback"),check:a$2(()=>import('./check-YVEJEI2G.mjs').then(e=>e.default),"check")}};a$4(k);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$1}from'./chunk-
|
|
3
|
-
var W={meta:{name:"dev",description:"Watch, rebuild, and push to all consumers. Auto-detects build command."},args:{all:{type:"boolean",description:"Watch all workspace packages in dependency order",default:false},build:{type:"string",description:"Override build command (default: auto-detect from package.json)"},"skip-build":{type:"boolean",description:"Watch output dirs directly, skip build command detection",default:false},debounce:{type:"string",description:"Debounce delay in ms (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",default:false},"no-cascade":{type:"boolean",description:"Disable cascading rebuilds in --all mode",default:false}},async run({args:e$1}){b();let o=resolve("."),m=await a(o),t={runScripts:!e$1["no-scripts"],force:e$1.force,historyLimit:m.historyLimit};if(e$1.all)await a$1(o,t),await e(o,e$1,t);else {let i=a$2(()=>b$1(o,t),"push");if(await i(),b$2()){
|
|
2
|
+
import {createRequire}from'node:module';import {a as a$1}from'./chunk-5BZD55UB.mjs';import'./chunk-SYADAYF4.mjs';import {a,e,b as b$1,c}from'./chunk-XKO24LUM.mjs';import'./chunk-OPLSUHCD.mjs';import'./chunk-CTJF2EWO.mjs';import'./chunk-37AAX47E.mjs';import'./chunk-TEFMLGCB.mjs';import'./chunk-7JG555TZ.mjs';import'./chunk-EE2UYGFD.mjs';import'./chunk-MBKCCWSD.mjs';import {b}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import'./chunk-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import'./chunk-UBGMLVMB.mjs';import'./chunk-3KNUBUPH.mjs';import {y}from'./chunk-GQYG5FCW.mjs';import {b as b$2}from'./chunk-NBSJGM2X.mjs';import'./chunk-B3DZ5HVQ.mjs';import {a as a$2}from'./chunk-2VCW5RWI.mjs';import {resolve}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
+
var W={meta:{name:"dev",description:"Watch, rebuild, and push to all consumers. Auto-detects build command."},args:{all:{type:"boolean",description:"Watch all workspace packages in dependency order",default:false},build:{type:"string",description:"Override build command (default: auto-detect from package.json)"},"skip-build":{type:"boolean",description:"Watch output dirs directly, skip build command detection",default:false},debounce:{type:"string",description:"Debounce delay in ms (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",default:false},"no-cascade":{type:"boolean",description:"Disable cascading rebuilds in --all mode",default:false}},async run({args:e$1}){b();let o=resolve("."),m=await a(o),t={runScripts:!e$1["no-scripts"],force:e$1.force,historyLimit:m.historyLimit};if(e$1.all)await a$1(o,t),await e(o,e$1,t);else {let i=a$2(()=>b$1(o,t),"push");if(await i(),b$2()){y();return}await c(o,e$1,i);}}};export{W as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {createRequire}from'node:module';import {d,b as b$3}from'./chunk-CTJF2EWO.mjs';import {a as a$1,b as b$4,c as c$1,d as d$1}from'./chunk-EE2UYGFD.mjs';import {b,a as a$2}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import {g,b as b$2}from'./chunk-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import {h,H,i}from'./chunk-GQYG5FCW.mjs';import'./chunk-NBSJGM2X.mjs';import {a,b as b$1}from'./chunk-B3DZ5HVQ.mjs';import {c}from'./chunk-2VCW5RWI.mjs';import {resolve,join}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
+
var o=c(a(),1);var z={meta:{name:"doctor",description:"Run diagnostic checks on your Knarr setup"},async run(){b();let n=resolve("."),s=[];b$1.info(`Running Knarr diagnostics...
|
|
4
|
+
`);let m=h();if(await H(m)){let e=await d();s.push({name:"Store directory",status:"pass",message:`${e.length} entries in ${m}`});}else s.push({name:"Store directory",status:"warn",message:`Store not found at ${m}. Run 'knarr publish' to create it.`});let _=i();if(await H(_)){let e=await g(),a=Object.values(e).flat().length;s.push({name:"Global registry",status:"pass",message:`${Object.keys(e).length} packages, ${a} consumer registrations`});}else s.push({name:"Global registry",status:"warn",message:"No consumers registered yet. Use 'knarr add' to link packages."});let{state:x,reliable:A}=await b$2(n);A||s.push({name:"Consumer state",status:"fail",message:"state.json is corrupt or unreadable. Delete .knarr/state.json and re-run 'knarr add' for each package."});let l=Object.entries(x.links);if(l.length>0){s.push({name:"Consumer state",status:"pass",message:`${l.length} linked package(s)`});for(let[e,a]of l){let u=await b$3(e,a.version);u?u.meta.contentHash!==a.contentHash?s.push({name:`Store: ${e}`,status:"warn",message:"Store has newer content. Run 'knarr update' to sync."}):s.push({name:`Store: ${e}`,status:"pass",message:`${e}@${a.version} in sync`}):s.push({name:`Store: ${e}`,status:"fail",message:`Store entry missing for ${e}@${a.version}. Re-publish it.`});let k=join(n,"node_modules",e);if(!await H(k))s.push({name:`node_modules: ${e}`,status:"fail",message:"Missing from node_modules. Run 'knarr restore'."});else try{let{readFile:F}=await import('fs/promises'),d=JSON.parse(await F(join(k,"package.json"),"utf-8"));d.version&&d.version!==a.version&&s.push({name:`node_modules: ${e}`,status:"warn",message:`node_modules has v${d.version} but Knarr linked v${a.version}. Run 'knarr restore'.`});}catch{}}}else s.push({name:"Consumer state",status:"warn",message:"No packages linked. Use 'knarr add' to link a package."});let f=await a$1(n);if(s.push({name:"Package manager",status:"pass",message:f}),f==="yarn"){let e=await b$4(n);await c$1(n)?e==="node-modules"?s.push({name:"Yarn linker",status:"pass",message:"Yarn Berry with node-modules linker"}):e==="pnpm"?s.push({name:"Yarn linker",status:"pass",message:"Yarn pnpm linker mode (Knarr handles this)"}):e==="pnp"?s.push({name:"Yarn linker",status:"fail",message:"Yarn PnP is not compatible. Set `nodeLinker: node-modules` in .yarnrc.yml"}):s.push({name:"Yarn linker",status:"warn",message:"Yarn Berry defaults to PnP. Add `nodeLinker: node-modules` to .yarnrc.yml"}):s.push({name:"Yarn linker",status:"pass",message:"Yarn Classic, node_modules mode"});}let i$1=await d$1(n);i$1.type?s.push({name:"Bundler",status:"pass",message:`${i$1.type}${i$1.configFile?` (${i$1.configFile})`:""}`}):s.push({name:"Bundler",status:"warn",message:"No bundler config detected"});let h$1=join(n,".gitignore");if(await H(h$1)){let{readFile:e}=await import('fs/promises');(await e(h$1,"utf-8")).includes(".knarr")?s.push({name:".gitignore",status:"pass",message:".knarr/ is ignored"}):s.push({name:".gitignore",status:"warn",message:".knarr/ not in .gitignore. Run 'knarr init' to fix."});}parseInt(process.versions.node.split(".")[0],10)>=22?s.push({name:"Node.js version",status:"pass",message:`v${process.versions.node}`}):s.push({name:"Node.js version",status:"fail",message:`v${process.versions.node}; Knarr requires Node.js >= 22`});let B={pass:o.default.green("PASS"),fail:o.default.red("FAIL"),warn:o.default.yellow("WARN")};for(let e of s)b$1.log(` ${B[e.status]} ${e.name}: ${o.default.dim(e.message)}`);let c=s.filter(e=>e.status==="fail").length,p=s.filter(e=>e.status==="warn").length;b$1.log(""),c>0?b$1.error(`${c} issue(s) found that need attention`):p>0?b$1.warn(`${p} warning(s), but no critical issues`):b$1.success("All checks passed!"),a$2({results:s.map(({name:e,status:a,message:u})=>({name:e,status:a,message:u})),failures:c,warnings:p});}};export{z as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {createRequire}from'node:module';export{I as atomicWriteFile,B as collectFiles,K as copyDir,A as copyWithCoW,J as dirSize,F as ensureDir,G as ensurePrivateDir,H as exists,C as incrementalCopy,z as isNodeError,D as moveDir,E as removeDir}from'./chunk-GQYG5FCW.mjs';import'./chunk-NBSJGM2X.mjs';import'./chunk-B3DZ5HVQ.mjs';import'./chunk-2VCW5RWI.mjs';globalThis.require=createRequire(import.meta.url);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';export{a as captureHistory,f as clearHistory,c as getHistoryEntry,b as listHistory,e as pruneHistory,g as resolveHistoryLimit,d as restoreHistoryEntry}from'./chunk-
|
|
2
|
+
import {createRequire}from'node:module';export{a as captureHistory,f as clearHistory,c as getHistoryEntry,b as listHistory,e as pruneHistory,g as resolveHistoryLimit,d as restoreHistoryEntry}from'./chunk-QGLOGD5G.mjs';import'./chunk-GQYG5FCW.mjs';import'./chunk-NBSJGM2X.mjs';import'./chunk-B3DZ5HVQ.mjs';import'./chunk-2VCW5RWI.mjs';globalThis.require=createRequire(import.meta.url);
|
package/dist/index.d.ts
CHANGED
|
@@ -408,7 +408,7 @@ declare function isNodeError(err: unknown): err is NodeJS.ErrnoException;
|
|
|
408
408
|
/** Normalize a file path to use forward slashes (for cross-platform consistency). */
|
|
409
409
|
declare function normalizePath(p: string): string;
|
|
410
410
|
|
|
411
|
-
type MutationType = "copy" | "remove" | "move" | "mkdir" | "write" | "bin-link" | "bin-unlink" | "cache-invalidate" | "lock-skip" | "lifecycle-skip";
|
|
411
|
+
type MutationType = "copy" | "remove" | "move" | "mkdir" | "write" | "bin-link" | "bin-unlink" | "cache-invalidate" | "lock-skip" | "lifecycle-skip" | "command-skip";
|
|
412
412
|
interface DryRunMutation {
|
|
413
413
|
type: MutationType;
|
|
414
414
|
path: string;
|