knarr 0.0.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/add-4Z3V5722.mjs +3 -0
- package/dist/bell-SIN4ERLS.mjs +2 -0
- package/dist/{check-YVEJEI2G.mjs → check-7CJHAF6Y.mjs} +1 -1
- package/dist/{chokidar-LVDD2IK4.mjs → chokidar-2G63V464.mjs} +1 -1
- package/dist/chunk-3SXN6MQL.mjs +4 -0
- package/dist/chunk-7GCKCCHU.mjs +3 -0
- package/dist/chunk-7ROQJISX.mjs +15 -0
- package/dist/chunk-AA43FODB.mjs +3 -0
- package/dist/chunk-ABG6UD3X.mjs +22 -0
- package/dist/chunk-BH2WXCLS.mjs +4 -0
- package/dist/chunk-COI7GWH3.mjs +4 -0
- package/dist/chunk-E3HZCU3S.mjs +5 -0
- package/dist/chunk-FSVETLZK.mjs +4 -0
- package/dist/{chunk-3KNUBUPH.mjs → chunk-G7HFTV5Y.mjs} +1 -1
- package/dist/chunk-GAWQLCRB.mjs +3 -0
- package/dist/{chunk-MBKCCWSD.mjs → chunk-HVN6HBWZ.mjs} +1 -1
- package/dist/{chunk-SYADAYF4.mjs → chunk-ICU4V73X.mjs} +1 -1
- package/dist/{chunk-XQPVRRTN.mjs → chunk-IP5ROSRE.mjs} +1 -1
- package/dist/chunk-J6HZHQVL.mjs +3 -0
- package/dist/chunk-L7O2RSTN.mjs +3 -0
- package/dist/chunk-M3TRMEJV.mjs +3 -0
- package/dist/chunk-MN4DV2NO.mjs +3 -0
- package/dist/chunk-N3B2JO4H.mjs +13 -0
- package/dist/{chunk-7HVPEBK5.mjs → chunk-NGPAGRK4.mjs} +1 -1
- package/dist/{chunk-B3DZ5HVQ.mjs → chunk-OQDZJP55.mjs} +1 -1
- package/dist/chunk-QEH5VHRO.mjs +13 -0
- package/dist/chunk-QFHYSC3K.mjs +3 -0
- package/dist/{chunk-CTJF2EWO.mjs → chunk-QHNHLR6T.mjs} +2 -2
- package/dist/chunk-RJSBXX2Q.mjs +3 -0
- package/dist/{chunk-NBSJGM2X.mjs → chunk-SPHWZS5P.mjs} +1 -1
- package/dist/chunk-U6O35NZ7.mjs +3 -0
- package/dist/chunk-UCSYKFEZ.mjs +3 -0
- package/dist/chunk-W2MMKBWU.mjs +3 -0
- package/dist/chunk-WBTSRLB6.mjs +7 -0
- package/dist/chunk-WN3DOKIM.mjs +3 -0
- package/dist/{chunk-TEFMLGCB.mjs → chunk-XDWZZBCM.mjs} +1 -1
- package/dist/{chunk-2GDRDQA5.mjs → chunk-Z5K6DFA6.mjs} +1 -1
- package/dist/clean-EJIYYQZM.mjs +3 -0
- package/dist/cli.mjs +4 -4
- package/dist/dev-PUNHH4MS.mjs +3 -0
- package/dist/doctor-ZK4OPSD4.mjs +6 -0
- package/dist/explain-BDTONX7H.mjs +5 -0
- package/dist/fs-NU36NNEG.mjs +2 -0
- package/dist/history-MLJHRV3Q.mjs +2 -0
- package/dist/index.d.ts +79 -18
- package/dist/index.mjs +1524 -443
- package/dist/init-X4F3XKVC.mjs +16 -0
- package/dist/{list-GLSA6I67.mjs → list-4PTHMIQ4.mjs} +2 -2
- package/dist/migrate-VHDLW6I7.mjs +8 -0
- package/dist/nextjs-config-T5D6LOJE.mjs +2 -0
- package/dist/preflight-IXICTR6G.mjs +2 -0
- package/dist/{publish-TAWTHPSD.mjs → publish-UGDDG6OT.mjs} +2 -2
- package/dist/push-V575ASM4.mjs +3 -0
- package/dist/remove-EPVDMWCS.mjs +2 -0
- package/dist/reset-5M6AU4FU.mjs +3 -0
- package/dist/restore-QPISOGEK.mjs +12 -0
- package/dist/rollback-CTGK7SXG.mjs +3 -0
- package/dist/{status-FA6UEHEF.mjs → status-3ZXM3CRH.mjs} +2 -2
- package/dist/{tailwind-source-RIWWXW2Y.mjs → tailwind-source-HCTY2XDU.mjs} +2 -2
- package/dist/topo-sort-ZNGR6D7M.mjs +2 -0
- package/dist/{tracker-JJEYXX45.mjs → tracker-QAKEXYUJ.mjs} +1 -1
- package/dist/update-RSPDDAJK.mjs +12 -0
- package/dist/use-LZ2GIXYZ.mjs +3 -0
- package/dist/vite-config-XOGAKYGQ.mjs +2 -0
- package/dist/watch-orchestrator-N6HZUDS3.mjs +3 -0
- package/dist/watcher-KOLIXRUG.mjs +3 -0
- package/dist/workspace-T6PNO4L3.mjs +2 -0
- package/dist/{xxhash-wasm-DTW44IIQ.mjs → xxhash-wasm-I6Q3T2SL.mjs} +1 -1
- package/package.json +4 -1
- package/dist/add-LZ6CZTHG.mjs +0 -3
- package/dist/bell-YD6IWNXO.mjs +0 -2
- package/dist/chunk-2VCW5RWI.mjs +0 -3
- package/dist/chunk-37AAX47E.mjs +0 -19
- package/dist/chunk-5BZD55UB.mjs +0 -3
- package/dist/chunk-7JG555TZ.mjs +0 -3
- package/dist/chunk-7SDPRKFT.mjs +0 -13
- package/dist/chunk-BS4VKVYH.mjs +0 -3
- package/dist/chunk-EE2UYGFD.mjs +0 -4
- package/dist/chunk-GO6F6AGH.mjs +0 -3
- package/dist/chunk-GQYG5FCW.mjs +0 -5
- package/dist/chunk-HEDVIVEO.mjs +0 -14
- package/dist/chunk-KOHUNKHP.mjs +0 -3
- package/dist/chunk-LXGALE74.mjs +0 -13
- package/dist/chunk-OPLSUHCD.mjs +0 -4
- package/dist/chunk-QGLOGD5G.mjs +0 -3
- package/dist/chunk-SFLWVTJC.mjs +0 -3
- package/dist/chunk-SN4TOUQW.mjs +0 -7
- package/dist/chunk-UBGMLVMB.mjs +0 -3
- package/dist/chunk-XKO24LUM.mjs +0 -3
- package/dist/chunk-ZJEEAMB3.mjs +0 -3
- package/dist/clean-ZD5GPGXQ.mjs +0 -3
- package/dist/dev-TMWMIT7W.mjs +0 -3
- package/dist/doctor-AXP7GVBM.mjs +0 -4
- package/dist/fs-2NITBGIO.mjs +0 -2
- package/dist/history-SKKGT225.mjs +0 -2
- package/dist/init-XK4B7XYG.mjs +0 -7
- package/dist/migrate-MW4BVLL2.mjs +0 -8
- package/dist/preflight-TVJFHRI2.mjs +0 -2
- package/dist/push-65ZZFZJY.mjs +0 -3
- package/dist/remove-LOBXHBMC.mjs +0 -2
- package/dist/reset-EAN5NVGM.mjs +0 -3
- package/dist/restore-YHZYT54B.mjs +0 -11
- package/dist/rollback-U3LQTWH5.mjs +0 -3
- package/dist/topo-sort-WEIVPJKN.mjs +0 -2
- package/dist/update-VOUKMOLK.mjs +0 -3
- package/dist/use-BXAZ5OP3.mjs +0 -3
- package/dist/vite-config-UWCLPTOZ.mjs +0 -2
- package/dist/watch-orchestrator-I2623SMT.mjs +0 -3
- package/dist/watcher-PTPUN2HE.mjs +0 -3
- package/dist/workspace-S3TAUSS3.mjs +0 -2
package/dist/chunk-SFLWVTJC.mjs
DELETED
package/dist/chunk-SN4TOUQW.mjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
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
|
-
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
|
-
${e.map(n=>`${r}${r}'${n}',`).join(`
|
|
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 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-UBGMLVMB.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
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};
|
package/dist/chunk-XKO24LUM.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
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-ZJEEAMB3.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
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};
|
package/dist/clean-ZD5GPGXQ.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
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/dev-TMWMIT7W.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
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};
|
package/dist/doctor-AXP7GVBM.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
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};
|
package/dist/fs-2NITBGIO.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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-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/init-XK4B7XYG.mjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$2}from'./chunk-7JG555TZ.mjs';import {a as a$5,b as b$2}from'./chunk-7SDPRKFT.mjs';import {a as a$4,d}from'./chunk-EE2UYGFD.mjs';import {a as a$3}from'./chunk-MBKCCWSD.mjs';import {b as b$1,a as a$7}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import {a as a$6,c as c$1}from'./chunk-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import {I,H as H$1,F,y}from'./chunk-GQYG5FCW.mjs';import {b as b$3}from'./chunk-NBSJGM2X.mjs';import {a,b}from'./chunk-B3DZ5HVQ.mjs';import {c,a as a$1}from'./chunk-2VCW5RWI.mjs';import {join,resolve,basename}from'path';import {readFile}from'fs/promises';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var r=c(a(),1);var ae={meta:{name:"init",description:"Set up knarr in the current project"},args:{yes:{type:"boolean",alias:"y",description:"Skip confirmation prompts",default:false},role:{type:"string",description:'Project role: "consumer" or "library"'}},async run({args:o}){b$1();let n=new a$3,i=resolve("."),p=o.yes;b.info(`Initializing knarr in ${r.default.cyan(i)}
|
|
4
|
-
`);let a=await a$4(i),u={pnpm:"pnpm-lock.yaml",bun:"bun.lockb",yarn:"yarn.lock",npm:"package-lock.json"};b.success(`Detected package manager: ${r.default.cyan(a)}`+(u[a]?` (from ${u[a]})`:""));let l=a;if(!p&&await b.prompt(`Use ${a}?`,{type:"confirm",initial:true})===false){let c=["npm","pnpm","yarn","bun"].filter(f=>f!==a),d=await b.prompt("Select package manager:",{type:"select",options:c.map(f=>({label:f,value:f}))});typeof d=="string"&&(l=d);}let s="consumer";o.role==="consumer"||o.role==="library"?s=o.role:p||await b.prompt("How will you use knarr in this project?",{type:"select",options:[{label:"Consumer (app) - I want to link packages INTO this project",value:"consumer"},{label:"Library (package) - I want to publish this package FOR other projects",value:"library"}]})==="library"&&(s="library"),b.success(`Project role: ${r.default.cyan(s)}`);let B=join(i,".gitignore");await a$5(B)&&b.success("Added .knarr/ to .gitignore");let m=join(i,"package.json");if(await H$1(m))if(s==="consumer"){if(await b$2(m)&&b.success('Added "postinstall": "knarr restore" to package.json scripts'),!p){let c=await b.prompt("Package name to link (leave blank to skip):",{type:"text",default:""});if(typeof c=="string"&&c.trim()){let d=c.trim();await h(m,"knarr:add",`knarr add ${d}`)&&b.success(`Added "knarr:add": "knarr add ${d}" to package.json scripts`);}}}else {await H(m,l,p);let t=await L(m);for(let c of t)b.success(`Added "${c}" script to package.json`);}let y$1=join(i,".knarr");if(!await H$1(y$1))await F(y$1),await I(join(y$1,"state.json"),JSON.stringify({version:"1",packageManager:l,role:s,links:{}},null,2)),b.success("Created .knarr/ state directory");else {let t=await a$6(i);t.packageManager=l,t.role=s,await c$1(i,t);}if(s==="consumer"){let t=await d(i);if(t.type==="vite"&&t.configFile){b.success(`Detected bundler: ${r.default.cyan("Vite")} (${basename(t.configFile)})`);let{addKnarrVitePlugin:c}=await import('./vite-config-UWCLPTOZ.mjs'),d=await c(t.configFile);d.modified?b.success(`Added knarr plugin to ${basename(t.configFile)}`):d.error&&b.info(`Add the Vite plugin for automatic dev server restarts:
|
|
5
|
-
${r.default.cyan('import knarr from "knarr/vite"')}
|
|
6
|
-
${r.default.cyan("plugins: [knarr()]")}`);}else if(t.type==="next"&&t.configFile)b.success(`Detected bundler: ${r.default.cyan("Next.js")} (${basename(t.configFile)})`),b.info(`Next.js transpilePackages will be auto-configured when you run ${r.default.cyan("knarr add")}`);else if(t.type){let c={webpack:"Webpack",turbo:"Turbopack",rollup:"Rollup"};b.success(`Detected bundler: ${r.default.cyan(c[t.type]||t.type)} - no config needed, works out of the box`);}b.log(""),b.info(`${r.default.bold("Next steps:")}`),b.log(` 1. ${r.default.cyan("knarr use ../my-lib")} <- publish + link a local package`),b.log(` 2. ${r.default.cyan("cd ../my-lib && knarr dev")} <- watch + rebuild + auto-push`);}else b.log(""),b.info(`${r.default.bold("Next steps:")}`),b.log(` 1. ${r.default.cyan("knarr publish")} <- copy built files to knarr store`),b.log(` 2. ${r.default.cyan(`${l} run knarr:dev`)} <- watch + rebuild + auto-push to consumers`),b.log(` 3. In consumer project: ${r.default.cyan("knarr use "+i)}`);b.info(`Done in ${n.elapsed()}`),a$7({packageManager:l,role:s,elapsed:n.elapsedMs()}),b$3()&&y();}};async function h(o,n,i){let p=await readFile(o,"utf-8"),a=JSON.parse(p);if(a.scripts?.[n])return false;a.scripts||(a.scripts={}),a.scripts[n]=i;let u=p.match(/^(\s+)"/m)?.[1]||" ";return await I(o,JSON.stringify(a,null,u)+`
|
|
7
|
-
`),true}a$1(h,"addScript");async function H(o,n,i){let p=join(o,".."),a=await a$2(p,n);if(a)return b.success(`Detected build script: ${r.default.cyan(a)}`),a;let u=n==="npm"?"npm run ":`${n} `;if(!i){b.warn("No build script found in package.json");let s=await b.prompt("Build command (e.g. tsc, tsup, rollup -c):",{type:"text",default:""});if(typeof s=="string"&&s.trim())return s.trim()}let l=`${u}build`;return b.warn(`Using ${r.default.cyan(l)} as placeholder - add a "build" script to package.json`),l}a$1(H,"detectBuildCommand");async function L(o){let n=[];return await h(o,"knarr:publish","knarr publish")&&n.push("knarr:publish"),await h(o,"knarr:dev","knarr dev")&&n.push("knarr:dev"),n}a$1(L,"addLibraryScripts");export{ae as default};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$1}from'./chunk-MBKCCWSD.mjs';import {b,a as a$2}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import {H as H$1,I,E,x,y}from'./chunk-GQYG5FCW.mjs';import {b as b$2}from'./chunk-NBSJGM2X.mjs';import {a,b as b$1}from'./chunk-B3DZ5HVQ.mjs';import {c}from'./chunk-2VCW5RWI.mjs';import {resolve,join}from'path';import {readFile}from'fs/promises';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var t=c(a(),1);var H={meta:{name:"migrate",description:"Migrate from yalc to Knarr"},args:{yes:{type:"boolean",alias:"y",description:"Skip confirmation prompts",default:false}},async run({args:L}){b();let u=new a$1,s=resolve(".");b$1.info(`Checking for yalc usage...
|
|
4
|
-
`);let k=join(s,".yalc"),r=join(s,"yalc.lock"),l=join(s,"package.json"),h=await H$1(k),p=await H$1(r);if(!h&&!p){b$1.info("No yalc usage detected in this project."),a$2({migrated:false,packages:[]});return}if(!L.yes){let o=await b$1.prompt("Migrate from yalc to Knarr? This will modify package.json and remove .yalc/ and yalc.lock.",{type:"confirm"});if(!o||typeof o=="symbol"){b$1.info("Cancelled");return}}let a=[];if(p)try{let o=await readFile(r,"utf-8"),n=JSON.parse(o);n.packages&&(a.push(...Object.keys(n.packages)),b$1.info(`Found ${a.length} yalc-linked package(s): ${a.map(i=>t.default.cyan(i)).join(", ")}`));}catch{b$1.warn("Could not parse yalc.lock \u2014 the file may be corrupted. Continuing with cleanup.");}if(await H$1(l))try{let o=await readFile(l,"utf-8"),n=JSON.parse(o),i=!1;for(let f of ["dependencies","devDependencies","peerDependencies"]){let m=n[f];if(m)for(let[w,v]of Object.entries(m))typeof v=="string"&&v.includes(".yalc/")&&(delete m[w],i=!0,b$1.info(`Removed file:.yalc/ reference for ${t.default.cyan(w)}`));}if(i){let f=o.match(/^(\s+)"/m)?.[1]||" ";await I(l,JSON.stringify(n,null,f)+`
|
|
5
|
-
`),b$1.success("Cleaned up package.json");}}catch(o){b$1.warn(`Could not clean package.json: ${o instanceof Error?o.message:String(o)}. You may need to manually remove file:.yalc/ references.`);}if(h&&(await E(k),b$1.success("Removed .yalc/ directory")),p){if(b$2())x({type:"remove",path:r});else {let{rm:o}=await import('fs/promises');await o(r,{force:true});}b$1.success("Removed yalc.lock");}if(b$1.log(""),b$1.info(`${t.default.bold("Migration complete!")} Next steps:
|
|
6
|
-
`),b$1.log(` 1. ${t.default.cyan("knarr init")}`),a.length>0)for(let o of a)b$1.log(` 2. ${t.default.cyan(`knarr add ${o} --from <path-to-${o}>`)}`);b$1.log(`
|
|
7
|
-
Run ${t.default.cyan("knarr doctor")} to verify your setup.
|
|
8
|
-
`),b$1.info(`Migrated in ${u.elapsed()}`),a$2({migrated:true,packages:a,elapsed:u.elapsedMs()}),b$2()&&y();}};export{H as default};
|
package/dist/push-65ZZFZJY.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$1}from'./chunk-5BZD55UB.mjs';import'./chunk-SYADAYF4.mjs';import {a,e,b as b$1,c}from'./chunk-XKO24LUM.mjs';import'./chunk-OPLSUHCD.mjs';import'./chunk-CTJF2EWO.mjs';import'./chunk-37AAX47E.mjs';import'./chunk-TEFMLGCB.mjs';import'./chunk-7JG555TZ.mjs';import'./chunk-EE2UYGFD.mjs';import'./chunk-MBKCCWSD.mjs';import {b}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import'./chunk-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import'./chunk-UBGMLVMB.mjs';import'./chunk-3KNUBUPH.mjs';import {y}from'./chunk-GQYG5FCW.mjs';import {b as b$2}from'./chunk-NBSJGM2X.mjs';import'./chunk-B3DZ5HVQ.mjs';import {a as a$2}from'./chunk-2VCW5RWI.mjs';import {resolve}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var M={meta:{name:"push",description:"Publish and push to all consumers. Use --watch for continuous mode."},args:{watch:{type:"boolean",description:"Watch for changes and auto-push",default:false},all:{type:"boolean",description:"Push all workspace packages in dependency order",default:false},build:{type:"string",description:"Build command to run before publishing (watch mode)"},"skip-build":{type:"boolean",description:"Watch output dirs directly, skip build command detection",default:false},debounce:{type:"string",description:"Debounce delay in ms for watch mode (default: 500)"},cooldown:{type:"string",description:"Minimum time between builds in ms (default: 500)"},"no-scripts":{type:"boolean",description:"Skip prepack/postpack lifecycle hooks",default:false},force:{type:"boolean",alias:"f",description:"Force copy all files, bypassing hash comparison",default:false},notify:{type:"boolean",description:"Ring terminal bell on push completion (watch mode)",default:false},"no-cascade":{type:"boolean",description:"Disable cascading rebuilds in --all watch mode",default:false}},async run({args:o}){b();let e$1=resolve("."),f=await a(e$1),t={runScripts:!o["no-scripts"],force:o.force,historyLimit:f.historyLimit};if(o.all)await a$1(e$1,t),o.watch&&await e(e$1,o,t);else {let i=a$2(()=>b$1(e$1,t),"push");await i(),o.watch&&await c(e$1,o,i);}b$2()&&y();}};export{M as default};
|
package/dist/remove-LOBXHBMC.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';export{a as default,b as removeSinglePackage}from'./chunk-ZJEEAMB3.mjs';import'./chunk-SN4TOUQW.mjs';import'./chunk-37AAX47E.mjs';import'./chunk-TEFMLGCB.mjs';import'./chunk-LXGALE74.mjs';import'./chunk-EE2UYGFD.mjs';import'./chunk-MBKCCWSD.mjs';import'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import'./chunk-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import'./chunk-GQYG5FCW.mjs';import'./chunk-NBSJGM2X.mjs';import'./chunk-B3DZ5HVQ.mjs';import'./chunk-2VCW5RWI.mjs';globalThis.require=createRequire(import.meta.url);
|
package/dist/reset-EAN5NVGM.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {b as b$2}from'./chunk-ZJEEAMB3.mjs';import'./chunk-SN4TOUQW.mjs';import'./chunk-37AAX47E.mjs';import'./chunk-TEFMLGCB.mjs';import'./chunk-LXGALE74.mjs';import {c}from'./chunk-7SDPRKFT.mjs';import'./chunk-EE2UYGFD.mjs';import {a}from'./chunk-MBKCCWSD.mjs';import {b,a as a$1}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import {a as a$2}from'./chunk-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import {q,H,E,y}from'./chunk-GQYG5FCW.mjs';import {d,b as b$3}from'./chunk-NBSJGM2X.mjs';import {b as b$1}from'./chunk-B3DZ5HVQ.mjs';import'./chunk-2VCW5RWI.mjs';import {resolve,join}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var M={meta:{name:"reset",description:"Remove all Knarr links and teardown Knarr from this project"},args:{yes:{type:"boolean",alias:"y",description:"Skip confirmation prompts",default:false}},async run({args:$}){b();let p=new a,o=resolve("."),c$1=q(o);if(!await H(c$1)){b$1.info("No Knarr setup found in this project"),a$1({reset:false});return}let j=await a$2(o),t=Object.entries(j.links);if(!$.yes){let r=[];t.length>0&&r.push(`remove ${t.length} linked package(s)`),r.push("delete .knarr/ directory","remove postinstall hook");let s=await b$1.prompt(`Reset Knarr? This will ${r.join(", ")}.`,{type:"confirm"});if(!s||typeof s=="symbol"){b$1.info("Cancelled");return}}d(`[reset] Removing ${t.length} linked package(s) from ${o}`);let a$3=0;for(let[r,s]of t)try{await b$2(o,r,s),a$3++;}catch(i){b$1.warn(`Failed to remove ${r}: ${i instanceof Error?i.message:String(i)}`);}await E(c$1),b$1.success("Removed .knarr/ directory");let l=join(o,"package.json");await H(l)&&await c(l)&&b$1.success("Removed postinstall hook from package.json"),b$1.success(`Reset complete: ${a$3} package(s) restored in ${p.elapsed()}`),a$1({reset:true,removed:a$3,elapsed:p.elapsedMs()}),b$3()&&y();}};export{M as default};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {b as b$3}from'./chunk-CTJF2EWO.mjs';import {a as a$4}from'./chunk-37AAX47E.mjs';import {a as a$2,b as b$1,c}from'./chunk-EE2UYGFD.mjs';import {a}from'./chunk-MBKCCWSD.mjs';import {b,a as a$3}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import {a as a$1,d}from'./chunk-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import {v,y}from'./chunk-GQYG5FCW.mjs';import {d as d$1,b as b$4}from'./chunk-NBSJGM2X.mjs';import {b as b$2}from'./chunk-B3DZ5HVQ.mjs';import'./chunk-2VCW5RWI.mjs';import {resolve}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var D=v(4),F={meta:{name:"restore",description:"Re-inject all linked packages (use after npm install wipes overrides)"},args:{silent:{type:"boolean",description:"Suppress output when no packages are linked (for postinstall scripts)",default:false}},async run({args:v}){b();let c$1=new a,t=resolve("."),L=await a$1(t);if(await a$2(t)==="yarn"){let e=await b$1(t);(e==="pnp"||e===null&&await c(t))&&(b$2.error(`Yarn PnP mode is not compatible with Knarr.
|
|
4
|
-
|
|
5
|
-
Knarr works by copying files into node_modules/, but PnP eliminates
|
|
6
|
-
node_modules/ entirely. To use Knarr with Yarn Berry, add this to
|
|
7
|
-
.yarnrc.yml:
|
|
8
|
-
|
|
9
|
-
nodeLinker: node-modules
|
|
10
|
-
|
|
11
|
-
Then run: yarn install`),process.exit(1));}let m=Object.entries(L.links);if(m.length===0){v.silent||b$2.info("No linked packages in this project"),a$3({restored:0,failed:0});return}let i=0,a$5=0,Y=await Promise.all(m.map(([e,n])=>D(async()=>{let o=await b$3(e,n.version);if(!o)return b$2.warn(`Store entry missing for ${e}@${n.version}. Re-publish it.`),{packageName:e,success:false};try{let s=await a$4(o,t,n.packageManager);return await d(t,e,{...n,contentHash:o.meta.contentHash,buildId:o.meta.buildId??"",linkedAt:new Date().toISOString()}),d$1(`[restore] ${e}@${n.version}: ${s.copied} files`),{packageName:e,success:!0,copied:s.copied}}catch(s){return b$2.error(`Failed to restore ${e}: ${s instanceof Error?s.message:String(s)}`),{packageName:e,success:false}}}))),p=[];for(let e of Y)e.success?(b$2.success(`Restored ${e.packageName} (${e.copied} files)`),i++):(a$5++,p.push(e.packageName));b$2.info(`Restore complete: ${i} restored, ${a$5} failed in ${c$1.elapsed()}`),a$3({restored:i,failed:a$5,failedPackages:p,elapsed:c$1.elapsedMs()}),b$4()&&y();}};export{F as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$3,b as b$3}from'./chunk-XKO24LUM.mjs';import'./chunk-OPLSUHCD.mjs';import'./chunk-CTJF2EWO.mjs';import'./chunk-37AAX47E.mjs';import {a as a$1}from'./chunk-TEFMLGCB.mjs';import'./chunk-7JG555TZ.mjs';import'./chunk-EE2UYGFD.mjs';import'./chunk-MBKCCWSD.mjs';import {b,a as a$2}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import'./chunk-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import {b as b$1,g,d}from'./chunk-QGLOGD5G.mjs';import'./chunk-3KNUBUPH.mjs';import {y}from'./chunk-GQYG5FCW.mjs';import {b as b$4}from'./chunk-NBSJGM2X.mjs';import {a,b as b$2}from'./chunk-B3DZ5HVQ.mjs';import {c}from'./chunk-2VCW5RWI.mjs';import {resolve}from'path';import {readFile}from'fs/promises';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var f=c(a(),1);var F={meta:{name:"rollback",description:"Restore a previous build from history"},args:{"build-id":{type:"string",description:"Specific build ID to restore (default: previous build)"},yes:{type:"boolean",alias:"y",description:"Skip confirmation prompts",default:false}},async run({args:a}){b();let l=resolve("."),i;try{i=JSON.parse(await readFile(resolve(l,"package.json"),"utf-8"));}catch{a$1("No package.json found in current directory"),process.exit(1);}(!i.name||!i.version)&&(a$1("package.json missing name or version field"),process.exit(1));let t=await b$1(i.name,i.version);if(t.length===0){b$2.info("No build history available"),a$2({rolledBack:false});return}let r;if(a["build-id"]){if(r=a["build-id"],!t.find(n=>n.buildId===r)){b$2.error(`Build ${r} not found in history`),b$2.info("Available builds:");for(let n of t)b$2.log(` ${f.default.cyan(n.buildId)} ${f.default.dim(n.publishedAt)}`);a$2({rolledBack:false});return}}else r=t[0].buildId;let v=t.find(e=>e.buildId===r);if(!a.yes){let e=await b$2.prompt(`Restore build ${r} (published ${v.publishedAt})?`,{type:"confirm"});if(!e||typeof e=="symbol"){b$2.info("Cancelled");return}}let $=await a$3(l),w=g($.historyLimit);if(!await d(i.name,i.version,r,w)){b$2.error(`Failed to restore build ${r}`),a$2({rolledBack:false});return}b$2.success(`Restored ${i.name}@${i.version} to build ${r}`);try{await b$3(l,{force:!0});}catch(e){b$2.warn(`Push after rollback failed: ${e instanceof Error?e.message:String(e)}`);}a$2({rolledBack:true,buildId:r}),b$4()&&y();}};export{F as default};
|
package/dist/update-VOUKMOLK.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {c}from'./chunk-CTJF2EWO.mjs';import {a as a$4}from'./chunk-37AAX47E.mjs';import {a as a$3}from'./chunk-TEFMLGCB.mjs';import'./chunk-EE2UYGFD.mjs';import {a}from'./chunk-MBKCCWSD.mjs';import {b,a as a$2}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import {a as a$1,d as d$1}from'./chunk-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import {v,f}from'./chunk-GQYG5FCW.mjs';import {d}from'./chunk-NBSJGM2X.mjs';import {b as b$1}from'./chunk-B3DZ5HVQ.mjs';import'./chunk-2VCW5RWI.mjs';import {resolve}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var M=v(4),z={meta:{name:"update",description:"Pull latest versions from the store for linked packages"},args:{package:{type:"positional",description:"Package name to update (default: all linked)",required:false}},async run({args:n}){b();let f$1=new a,r=resolve("."),E=await a$1(r),p=Object.entries(E.links);if(p.length===0){b$1.info("No linked packages in this project"),a$2({updated:0,skipped:0});return}let k=n.package?p.filter(([t])=>t===n.package):p;n.package&&k.length===0&&(a$3(`Package "${n.package}" is not linked in this project. Run 'knarr list' to see linked packages.`),process.exit(1));let d$2=0,c$1=0,o=0,a$5=0,H=await Promise.all(k.map(([t,l])=>M(async()=>{let e=await c(t);if(!e)return b$1.warn(`Store entry missing for ${t}. Re-publish it.`),"missing";if(e.meta.contentHash===l.contentHash)return d(`[update] ${t}@${e.version} already up to date`),"skipped";try{let s=await a$4(e,r,l.packageManager),P={...l,version:e.version,contentHash:e.meta.contentHash,buildId:e.meta.buildId??"",linkedAt:new Date().toISOString()};return await d$1(r,t,P),await f(r,t,e.version),b$1.success(`Updated ${t}@${e.version} (${s.copied} files changed)`),"updated"}catch(s){return b$1.warn(`Failed to update ${t}: ${s instanceof Error?s.message:String(s)}`),"failed"}})));for(let t of H)t==="updated"?d$2++:t==="skipped"?c$1++:t==="missing"?o++:a$5++;let m=[`${d$2} updated`,`${c$1} unchanged`];o>0&&m.push(`${o} missing`),a$5>0&&m.push(`${a$5} failed`),b$1.info(`Update complete: ${m.join(", ")} in ${f$1.elapsed()}`),a$2({updated:d$2,skipped:c$1,missing:o,failed:a$5,elapsed:f$1.elapsedMs()});}};export{z as default};
|
package/dist/use-BXAZ5OP3.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {b as b$1,a as a$1}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}from'./chunk-MBKCCWSD.mjs';import {b}from'./chunk-BS4VKVYH.mjs';import'./chunk-7HVPEBK5.mjs';import'./chunk-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import'./chunk-3KNUBUPH.mjs';import'./chunk-GQYG5FCW.mjs';import'./chunk-NBSJGM2X.mjs';import'./chunk-B3DZ5HVQ.mjs';import'./chunk-2VCW5RWI.mjs';import {resolve}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var d={meta:{name:"use",description:"Publish a local package path and link it into this project"},args:{path:{type:"positional",description:"Path to the local package source",required:true},yes:{type:"boolean",alias:"y",description:"Auto-accept prompts (install missing deps, etc.)",default:false}},async run({args:e}){b();let p=new a,a$2=resolve(e.path),s=await b$1(a$2);await a$1({packageArg:s,from:a$2,yes:e.yes,timer:p});}};export{d as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';export{b as addKnarrVitePlugin,a as isComplexConfig,c as removeFromViteConfig}from'./chunk-LXGALE74.mjs';import'./chunk-GQYG5FCW.mjs';import'./chunk-NBSJGM2X.mjs';import'./chunk-B3DZ5HVQ.mjs';import'./chunk-2VCW5RWI.mjs';globalThis.require=createRequire(import.meta.url);
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$1,d,b as b$2}from'./chunk-XKO24LUM.mjs';import'./chunk-OPLSUHCD.mjs';import'./chunk-CTJF2EWO.mjs';import'./chunk-37AAX47E.mjs';import'./chunk-TEFMLGCB.mjs';import'./chunk-7JG555TZ.mjs';import'./chunk-EE2UYGFD.mjs';import'./chunk-MBKCCWSD.mjs';import'./chunk-BS4VKVYH.mjs';import'./chunk-KOHUNKHP.mjs';import'./chunk-GO6F6AGH.mjs';import'./chunk-3KNUBUPH.mjs';import {v}from'./chunk-GQYG5FCW.mjs';import {d as d$1}from'./chunk-NBSJGM2X.mjs';import {b as b$1}from'./chunk-B3DZ5HVQ.mjs';import {a}from'./chunk-2VCW5RWI.mjs';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var M=v(2),b=class{static{a(this,"WatchOrchestrator");}packages=new Map;dependents=new Map;cascade;pushOptions={};constructor(t){this.cascade=t;}async start(t,e,a$2){this.pushOptions=a$2;let{buildWorkspaceGraph:c,buildReverseAdjacency:y}=await import('./workspace-S3TAUSS3.mjs'),{topoSort:v,CycleError:C}=await import('./topo-sort-WEIVPJKN.mjs'),{startWatcher:$}=await import('./watcher-PTPUN2HE.mjs'),d$1=await c(t);if(d$1.packages.length===0){b$1.warn("No workspace packages found");return}let g;try{g=v(d$1.adjacency);}catch(s){if(s instanceof C){b$1.error(`Cannot watch: ${s.message}`);return}throw s}this.cascade&&(this.dependents=y(d$1.adjacency),b$1.info("Cascade mode enabled"));let q=new Map(d$1.packages.map(s=>[s.name,s.dir]));for(let s of g){let i=q.get(s);if(!i)continue;let p=await a$1(i),{buildCmd:l,patterns:S}=await d(i,e,p),R=e.notify??p.notify??false,j=a(async()=>{await b$2(i,a$2),await this.onPackagePushed(s);},"wrappedOnChange"),h=a(f=>{if(!f)return;let w=parseInt(f,10);return Number.isFinite(w)?w:void 0},"parseMs"),E=await $(i,{patterns:S,buildCmd:l,debounce:h(e.debounce)??p.debounce,cooldown:h(e.cooldown)??p.cooldown,notify:R},j);this.packages.set(s,{dir:i,buildCmd:l,state:"idle",watcher:E});}b$1.info(`Watching ${this.packages.size} workspace packages`),await new Promise(s=>{let i=a(async()=>{b$1.info("Stopping watchers..."),await this.close(),s();},"cleanup");process.once("SIGINT",i),process.once("SIGTERM",i);});}async onPackagePushed(t){if(!this.cascade)return;let e=this.dependents.get(t);if(!e||e.size===0)return;d$1(`[cascade] ${t} pushed, triggering dependents: ${[...e].join(", ")}`);let a=[...e].map(c=>M(()=>this.requestRebuild(c)));await Promise.all(a);}async requestRebuild(t){let e=this.packages.get(t);if(e){if(e.state==="queued"){d$1(`[cascade] ${t} already queued, skipping`);return}if(e.state==="building"){d$1(`[cascade] ${t} is building, marking as queued`),e.state="queued";return}e.state="building",d$1(`[cascade] Rebuilding ${t}`);try{if(e.buildCmd){let{runBuildCommand:a}=await import('./watcher-PTPUN2HE.mjs');if(!await a(e.buildCmd,e.dir)){b$1.warn(`[cascade] Build failed for ${t}, skipping dependents`),e.state="idle";return}}await b$2(e.dir,this.pushOptions),await this.onPackagePushed(t);}catch(a){b$1.warn(`[cascade] Push failed for ${t}: ${a instanceof Error?a.message:String(a)}`);}finally{let a=e.state==="queued";e.state="idle",a&&await this.requestRebuild(t);}}}async close(){await Promise.all([...this.packages.values()].map(t=>t.watcher.close())),this.packages.clear();}};export{b as WatchOrchestrator};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$1}from'./chunk-SFLWVTJC.mjs';import {b}from'./chunk-B3DZ5HVQ.mjs';import {a}from'./chunk-2VCW5RWI.mjs';import {spawn}from'child_process';import {readdir,stat}from'fs/promises';import {platform}from'os';import {join}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var d=null;function x(){d&&!d.killed&&(d.kill("SIGTERM"),d=null);}a(x,"killActiveBuild");var _=new Set(["node_modules",".git",".knarr"]);async function $(o,t){let r;try{r=await readdir(o,{withFileTypes:!0});}catch{return}for(let s of r){if(_.has(s.name))continue;let f=join(o,s.name);if(s.isDirectory())await $(f,t);else try{let m=await stat(f);t.set(f,m.mtimeMs);}catch{}}}a($,"walkDir");async function S(o){let t=new Map;for(let r of o)try{let s=await stat(r);s.isDirectory()?await $(r,t):t.set(r,s.mtimeMs);}catch{}return t}a(S,"buildSnapshot");async function J(o,t,r){let{watch:s}=await import('./chokidar-LVDD2IK4.mjs'),f=t.patterns??["src","lib"],m=f.map(n=>n.startsWith("/")||n.includes(":")?n:`${o}/${n}`),h=t.debounce??500,l=t.cooldown??500,e=null,w=false,b$1=false,g=0,v=false,T=a(async()=>{if(w||b$1)return;let n=Date.now()-g;if(g>0&&n<l){let i=l-n;e&&clearTimeout(e),e=setTimeout(()=>{e=null,T();},i);return}b$1=true,v=false;try{if(t.buildCmd&&!await G(t.buildCmd,o)){if(b.warn("Build failed (see output above), skipping push"),t.notify){let{ringBell:a}=await import('./bell-YD6IWNXO.mjs');a(!0);}return}await r(),t.notify&&a$1(!0);}catch(i){b.error(`Push failed: ${i instanceof Error?i.message:String(i)}`),t.notify&&a$1(true);}finally{b$1=false,g=Date.now(),v&&!w&&(v=false,e=setTimeout(()=>{e=null,T();},l));}},"doBuild"),p=a(n=>{if(w)return;if(b$1){v=true;return}let i=Date.now()-g;if(g>0&&i<l){e&&clearTimeout(e);let a=l-i;e=setTimeout(()=>{e=null,T();},a+h);return}e&&clearTimeout(e),e=setTimeout(()=>{e=null,T();},h);},"onFileEvent"),D=t.buildCmd?false:t.awaitWriteFinish??{stabilityThreshold:200,pollInterval:50},P=!!process.versions?.webcontainer,y=s(m,{ignoreInitial:true,ignored:[/[/\\]node_modules[/\\]/,/[/\\]\.git[/\\]/,/[/\\]\.knarr[/\\]/],awaitWriteFinish:D,usePolling:P,...P&&{interval:1e3}});y.on("change",p),y.on("add",p),y.on("unlink",p),y.on("error",n=>{b.error(`Watcher error: ${n instanceof Error?n.message:String(n)}`);});let B=null;if(P){let n=await S(m);B=setInterval(async()=>{if(!w)try{let i=await S(m);for(let[a,E]of i){let C=n.get(a);if(C===void 0||C!==E){p(a);break}}if(!w){for(let a of n.keys())if(!i.has(a)){p(a);break}}n=i;}catch{}},1e3);}let W={close:a(async()=>{w=true,B&&clearInterval(B),e&&clearTimeout(e),x(),await y.close();},"close")};return b.info(`Watching for changes in: ${f.join(", ")}`),W}a(J,"startWatcher");function G(o,t){return new Promise(r=>{let s=platform()==="win32",f=s?"cmd":"sh",m=s?"/c":"-c";b.start(`Running: ${o}`);let h=spawn(f,[m,o],{cwd:t,stdio:"inherit"});d=h,h.on("close",l=>{d=null,l===0?(b.success("Build succeeded"),r(true)):(b.error(`Build failed with code ${l}`),r(false));}),h.on("error",l=>{d=null,b.error(`Build error: ${l.message}`),r(false);});})}a(G,"runBuildCommand");export{x as killActiveBuild,G as runBuildCommand,J as startWatcher};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';export{e as buildReverseAdjacency,d as buildWorkspaceGraph,c as findWorkspacePackages,a as findWorkspaceRoot,b as parseCatalogs}from'./chunk-UBGMLVMB.mjs';import'./chunk-3KNUBUPH.mjs';import'./chunk-GQYG5FCW.mjs';import'./chunk-NBSJGM2X.mjs';import'./chunk-B3DZ5HVQ.mjs';import'./chunk-2VCW5RWI.mjs';globalThis.require=createRequire(import.meta.url);
|