@olegkuibar/plunk 0.3.1 → 0.4.0-canary.07cb6c1
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 +8 -0
- package/dist/add-UE37EMV5.mjs +14 -0
- package/dist/{chunk-ZAUWE3N7.mjs → chunk-2RFNVPZR.mjs} +1 -1
- package/dist/chunk-JCRGRXVS.mjs +3 -0
- package/dist/cli.mjs +10 -2
- package/dist/{dev-NCLIWE2E.mjs → dev-VQPGPB5A.mjs} +1 -1
- package/dist/index.mjs +45 -37
- package/dist/{init-TZ76GAWN.mjs → init-EL2DWYNJ.mjs} +1 -1
- package/dist/{push-M4RSFETI.mjs → push-G3UXBB6E.mjs} +1 -1
- package/package.json +1 -1
- package/dist/add-4LHIITHV.mjs +0 -14
- package/dist/chunk-ZIXSXQRE.mjs +0 -3
package/README.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
|
+
<a href="https://plunk-playground.vercel.app"><img src="https://img.shields.io/badge/Try_in_Browser-Playground-58a6ff?style=flat&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZmlsbD0id2hpdGUiIGQ9Ik0xMiAyQzYuNDggMiAyIDYuNDggMiAxMnM0LjQ4IDEwIDEwIDEwIDEwLTQuNDggMTAtMTBTMTcuNTIgMiAxMiAyem0tMiAxNWwtNS01IDEuNDEtMS40MUwxMCAxNC4xN2w3LjU5LTcuNTlMMTkgOGwtOSA5eiIvPjwvc3ZnPg==" alt="Playground" /></a>
|
|
6
7
|
<a href="https://www.npmjs.com/package/@olegkuibar/plunk"><img src="https://img.shields.io/npm/v/@olegkuibar/plunk?color=blue" alt="npm version" /></a>
|
|
7
8
|
<a href="https://www.npmjs.com/package/@olegkuibar/plunk"><img src="https://img.shields.io/npm/dm/@olegkuibar/plunk" alt="npm downloads" /></a>
|
|
8
9
|
<a href="https://github.com/oleg-kuibar/plunk/actions/workflows/ci.yml"><img src="https://github.com/oleg-kuibar/plunk/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
|
|
@@ -86,6 +87,12 @@ pnpm add -g plunk # or npm, yarn, bun
|
|
|
86
87
|
npx plunk init # set up a consumer project
|
|
87
88
|
```
|
|
88
89
|
|
|
90
|
+
## Try it online
|
|
91
|
+
|
|
92
|
+
Experience plunk directly in your browser with our interactive playground:
|
|
93
|
+
|
|
94
|
+
**[Open Playground](https://plunk-playground.vercel.app)** — Run real `plunk publish`, `plunk add`, and `plunk push` commands with live HMR preview.
|
|
95
|
+
|
|
89
96
|
## Documentation
|
|
90
97
|
|
|
91
98
|
| | |
|
|
@@ -96,6 +103,7 @@ npx plunk init # set up a consumer project
|
|
|
96
103
|
| [Bundler Guide](docs/bundlers.md) | Vite, Webpack, esbuild, Turbopack setup |
|
|
97
104
|
| [Comparison](docs/comparison.md) | npm link vs yalc vs plunk |
|
|
98
105
|
| [Examples](examples/) | Try it yourself with real packages |
|
|
106
|
+
| [Playground](playground/) | Interactive browser-based playground |
|
|
99
107
|
| [Contributing](CONTRIBUTING.md) | Dev setup and guidelines |
|
|
100
108
|
|
|
101
109
|
## License
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {createRequire}from'node:module';import {c as c$1}from'./chunk-2RFNVPZR.mjs';import {a as a$2}from'./chunk-4TNTNSAB.mjs';import {c}from'./chunk-UAGG5WMD.mjs';import'./chunk-HW7AEGI3.mjs';import {a as a$6}from'./chunk-UDONDVIM.mjs';import {b as b$3,a as a$5,e}from'./chunk-4QWBGXB5.mjs';import {a as a$4,b as b$2,c as c$2,d}from'./chunk-LI4HG26F.mjs';import {c as c$3,g}from'./chunk-QUI5JAIH.mjs';import {a as a$3}from'./chunk-ZJMZKJNW.mjs';import {a as a$1}from'./chunk-MBKCCWSD.mjs';import {i}from'./chunk-KVVUZ6KL.mjs';import {b as b$1,a as a$7}from'./chunk-RITKSDMP.mjs';import'./chunk-OL7SNXMX.mjs';import {j}from'./chunk-6YX2BGO2.mjs';import {b,e as e$1,f}from'./chunk-AR7AKSKG.mjs';import {a}from'./chunk-2VCW5RWI.mjs';import {readFile}from'fs/promises';import {spawn}from'child_process';import {platform}from'os';import {join,resolve,basename}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
+
var yn={meta:{name:"add",description:"Link a package from the plunk 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:r}){b$1();let s=new a$1,n=resolve("."),i$1=r.package;if(r.from){let t=resolve(r.from);b.info(`Publishing from ${t}...`),await a$2(t);}let a=await c(i$1);a||(a$3(`Package "${i$1}" not found in store. Run 'plunk publish' in the package directory first, or use --from <path>.`),process.exit(1));let p=!await j(i(n)),o=await a$4(n);if(p&&(await c$1(n,o),b.success("Auto-initialized plunk (consumer mode)")),b.info(`Detected package manager: ${o}`),o==="yarn"){let t=await b$2(n);(t==="pnp"||t===null&&await c$2(n))&&(b.error(`Yarn PnP mode is not compatible with plunk.
|
|
4
|
+
|
|
5
|
+
plunk works by copying files into node_modules/, but PnP eliminates
|
|
6
|
+
node_modules/ entirely. To use plunk with Yarn Berry, add this to
|
|
7
|
+
.yarnrc.yml:
|
|
8
|
+
|
|
9
|
+
nodeLinker: node-modules
|
|
10
|
+
|
|
11
|
+
Then run: yarn install`),process.exit(1));}let u=await b$3(n,i$1,o);u&&b.info(`Backed up existing ${i$1} installation`);let c$4=await a$5(a,n,o);b.success(`Linked ${i$1}@${a.version} \u2192 node_modules/${i$1} (${c$4.copied} files copied, ${c$4.skipped} unchanged)`),c$4.binLinks>0&&b.info(`Created ${c$4.binLinks} bin link(s)`);let J={version:a.version,contentHash:a.meta.contentHash,linkedAt:new Date().toISOString(),sourcePath:a.meta.sourcePath,backupExists:u,packageManager:o,buildId:a.meta.buildId??""};await c$3(n,i$1,J),await g(i$1,n),await Q(n,i$1,a.version);let l=await e(a,n);if(l.length>0)if(e$1())f(`[add] Missing transitive deps (json mode): ${l.join(", ")}`);else if(r.yes){let t=y(o,l);b.info(`Installing missing dependencies: ${l.join(", ")}`),await h(t,n)?b.success("Installed missing dependencies"):b.warn(`Install failed. Run manually: ${t}`);}else if(await b.prompt(`Install ${l.length} missing dependencies? (${l.join(", ")})`,{type:"confirm",initial:true})){let m=y(o,l);await h(m,n)?b.success("Installed missing dependencies"):b.warn(`Install failed. Run manually: ${m}`);}else b.warn(`Missing transitive dependencies: ${l.join(", ")}
|
|
12
|
+
Run: ${y(o,l)}`);let d$1=await d(n);if(d$1.type==="next"&&d$1.configFile){let t=await a$6(d$1.configFile,i$1);t.modified?b.success(`Added ${i$1} to transpilePackages in ${basename(d$1.configFile)}`):t.error&&b.info(`Add to next.config manually: transpilePackages: ['${i$1}']`);}else if(d$1.type==="vite"&&d$1.configFile){let{addPlunkVitePlugin:t}=await import('./vite-config-ZMDIOTXC.mjs'),m=await t(d$1.configFile);if(m.modified){b.success(`Added plunk plugin to ${basename(d$1.configFile)}`);let k=N(o,"@olegkuibar/plunk");b.info("Installing @olegkuibar/plunk as devDependency..."),await h(k,n)?b.success("Installed @olegkuibar/plunk"):b.warn(`Install failed. Run manually: ${k}`);}else m.error&&b.info(`Add manually:
|
|
13
|
+
import plunk from "@olegkuibar/plunk/vite"
|
|
14
|
+
plugins: [plunk()]`);}let{findTailwindCss:V,addTailwindSource:W}=await import('./tailwind-source-VPNLLSRJ.mjs'),g$1=await V(n);if(g$1){let t=await W(g$1,i$1,n);t.modified?b.success(`Added @source for ${i$1} to ${basename(g$1)}`):t.error&&b.info(`Add to your CSS manually: @source "../node_modules/${i$1}";`);}b.info(`Done in ${s.elapsed()}`),a$7({package:i$1,version:a.version,copied:c$4.copied,skipped:c$4.skipped,binLinks:c$4.binLinks,elapsed:s.elapsedMs()});}};function y(r,s){let n=s.join(" ");switch(r){case "pnpm":return `pnpm add ${n}`;case "yarn":return `yarn add ${n}`;case "bun":return `bun add ${n}`;default:return `npm install ${n}`}}a(y,"buildInstallCommand");function N(r,s){switch(r){case "pnpm":return `pnpm add -D ${s}`;case "yarn":return `yarn add -D ${s}`;case "bun":return `bun add -d ${s}`;default:return `npm install -D ${s}`}}a(N,"buildDevInstallCommand");function h(r,s){return new Promise(n=>{let i=platform()==="win32",o=spawn(i?"cmd":"sh",[i?"/c":"-c",r],{cwd:s,stdio:"inherit"});o.on("close",u=>n(u===0)),o.on("error",()=>n(false));})}a(h,"runInstallCommand");async function Q(r,s,n){try{let i=await readFile(join(r,"package.json"),"utf-8"),a=JSON.parse(i),p=a.dependencies?.[s]??a.devDependencies?.[s]??a.peerDependencies?.[s];if(!p||/^(workspace:|catalog:|\*)/.test(p))return;let o=p.match(/(\d+)\.\d+\.\d+/);if(!o)return;let u=parseInt(o[1],10),c=parseInt(n.split(".")[0],10);u!==c&&b.warn(`Version mismatch: store has ${s}@${n} but your package.json declares "${p}". Consider updating your dependency range.`);}catch{}}a(Q,"warnVersionMismatch");export{yn as default};
|
|
@@ -8,5 +8,5 @@ var y=c(a(),1);async function x(t){let n="";try{n=await readFile(t,"utf-8");}cat
|
|
|
8
8
|
.plunk/
|
|
9
9
|
`:`# plunk local links
|
|
10
10
|
.plunk/
|
|
11
|
-
`;return await writeFile(t,n+o+r),true}a$1(x,"ensureGitignore");async function C(t){let n=await readFile(t,"utf-8"),e=JSON.parse(n);if(e.scripts?.postinstall)return e.scripts.postinstall.includes("plunk")||b.warn(`Existing postinstall script found. Add ${y.default.cyan("plunk restore")} manually if needed.`),false;e.scripts||(e.scripts={}),e.scripts.postinstall="plunk restore || true";let s=n.match(/^(\s+)"/m)?.[1]||" ";return await writeFile(t,JSON.stringify(e,null,s)+`
|
|
11
|
+
`;return await writeFile(t,n+o+r),true}a$1(x,"ensureGitignore");async function C(t){let n=await readFile(t,"utf-8"),e=JSON.parse(n);if(e.scripts?.postinstall)return e.scripts.postinstall.includes("plunk")||b.warn(`Existing postinstall script found. Add ${y.default.cyan("npx @olegkuibar/plunk restore")} manually if needed.`),false;e.scripts||(e.scripts={}),e.scripts.postinstall="npx @olegkuibar/plunk restore || true";let s=n.match(/^(\s+)"/m)?.[1]||" ";return await writeFile(t,JSON.stringify(e,null,s)+`
|
|
12
12
|
`),true}a$1(C,"addPostinstall");async function J(t,n){let e=h(t),s=i(t);if(!await j(s))await h$1(e),await b$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 b$1(t,a));}let o=join(t,".gitignore");await x(o);let r=join(t,"package.json");await j(r)&&await C(r);}a$1(J,"ensureConsumerInit");export{x as a,C as b,J as c};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {createRequire}from'node:module';import {a as a$8}from'./chunk-7JG555TZ.mjs';import {a as a$3}from'./chunk-4TNTNSAB.mjs';import {b as b$1}from'./chunk-UAGG5WMD.mjs';import {a as a$5}from'./chunk-4QWBGXB5.mjs';import {a as a$7}from'./chunk-LI4HG26F.mjs';import {i,e,c}from'./chunk-QUI5JAIH.mjs';import {a as a$4}from'./chunk-ZJMZKJNW.mjs';import {a as a$2}from'./chunk-MBKCCWSD.mjs';import {a as a$6}from'./chunk-RITKSDMP.mjs';import {a}from'./chunk-6YX2BGO2.mjs';import {b,f}from'./chunk-AR7AKSKG.mjs';import {a as a$1}from'./chunk-2VCW5RWI.mjs';import {readFile}from'fs/promises';import {join}from'path';import {spawn}from'child_process';import {platform}from'os';globalThis.require=createRequire(import.meta.url);
|
|
3
|
+
var G=a(4);async function re(s,o={}){let r=new a$2,e$1=await a$3(s,{runScripts:o.runScripts});if(e$1.skipped){b.info("No changes to push");return}let t=await b$1(e$1.name,e$1.version);if(!t){a$4(`Failed to read store entry for ${e$1.name}@${e$1.version} after publish`);return}let u=await i(e$1.name);if(u.length===0){b.info("No consumers registered. Use 'plunk add' in a consumer project first.");return}let m=0,a=0,d=0,b$2=await Promise.all(u.map(n=>G(async()=>{let f$1=await e(n,e$1.name);if(!f$1)return f(`[push] No link found for ${e$1.name} in ${n}, skipping`),null;try{let p=await a$5(t,n,f$1.packageManager);return await c(n,e$1.name,{...f$1,contentHash:t.meta.contentHash,linkedAt:new Date().toISOString(),buildId:t.meta.buildId??""}),p}catch(p){return b.warn(`Failed to push to ${n}: ${p instanceof Error?p.message:String(p)}`),null}})));for(let n of b$2)n&&(m+=n.copied,a+=n.skipped,d++);let h=e$1.buildId?` [${e$1.buildId}]`:"";b.success(`Pushed ${e$1.name}@${e$1.version}${h} to ${d} consumer(s) in ${r.elapsed()} (${m} files changed, ${a} unchanged)`),a$6({name:e$1.name,version:e$1.version,buildId:e$1.buildId,consumers:d,copied:m,skipped:a,elapsed:r.elapsedMs()});}a$1(re,"doPush");async function se(s,o){let r=o.build,e;if(!o.build){if(!o["skip-build"]){let t=await a$7(s),u=await a$8(s,t);u&&(r=u,b.info(`Auto-detected build command: ${u}`));}}if(r)e=["src","lib"],f(`[watch] Using source patterns with build command: ${e.join(", ")}`);else try{let t=JSON.parse(await readFile(join(s,"package.json"),"utf-8"));t.files&&t.files.length>0&&(e=t.files,f(`[watch] Using package.json files field: ${e.join(", ")}`));}catch(t){f(`[watch] Could not read package.json: ${t instanceof Error?t.message:String(t)}`);}return {buildCmd:r,patterns:e}}a$1(se,"resolveWatchConfig");var g=null;function U(){g&&!g.killed&&(g.kill("SIGTERM"),g=null);}a$1(U,"killActiveBuild");async function me(s,o,r){let {watch:e}=await import('./chokidar-LVDD2IK4.mjs'),t=o.patterns??["src","lib"],u=t.map(l=>l.startsWith("/")||l.includes(":")?l:`${s}/${l}`),m=o.debounce??500,a=2e3,d=null,b$1=false,h=false,n=0,p=a$1(async()=>{if(b$1||h)return;let l=Date.now()-n;if(!(n>0&&l<a)){h=true;try{if(o.buildCmd&&!await D(o.buildCmd,s)){b.warn("Build failed (see output above), skipping push");return}await r();}catch(w){b.error(`Push failed: ${w instanceof Error?w.message:String(w)}`);}finally{h=false,n=Date.now();}}},"doBuild"),y=a$1(l=>{if(b$1)return;if(h){return}let w=Date.now()-n;if(n>0&&w<a){return}d&&clearTimeout(d),d=setTimeout(()=>{d=null,p();},m);},"onFileEvent"),N=o.buildCmd?false:o.awaitWriteFinish??{stabilityThreshold:200,pollInterval:50},$=e(u,{ignoreInitial:true,ignored:["**/node_modules/**","**/.git/**","**/.plunk/**"],awaitWriteFinish:N});$.on("change",y),$.on("add",y),$.on("unlink",y),$.on("error",l=>{b.error(`Watcher error: ${l instanceof Error?l.message:String(l)}`);});let S={close:a$1(async()=>{b$1=true,d&&clearTimeout(d),U(),await $.close();},"close")};let C=a$1(async()=>{b.info("Stopping watcher..."),await S.close(),process.exit(0);},"cleanup");return process.once("SIGINT",C),process.once("SIGTERM",C),b.info(`Watching for changes in: ${t.join(", ")}`),S}a$1(me,"startWatcher");function D(s,o){return new Promise(r=>{let e=platform()==="win32",t=e?"cmd":"sh",u=e?"/c":"-c";b.start(`Running: ${s}`);let m=spawn(t,[u,s],{cwd:o,stdio:"inherit"});g=m,m.on("close",a=>{g=null,a===0?(b.success("Build succeeded"),r(true)):(b.error(`Build failed with code ${a}`),r(false));}),m.on("error",a=>{g=null,b.error(`Build error: ${a.message}`),r(false);});})}a$1(D,"runBuildCommand");export{re as a,se as b,me as c};
|
package/dist/cli.mjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$
|
|
3
|
-
|
|
2
|
+
import {createRequire}from'node:module';import {a as a$2}from'./chunk-OL7SNXMX.mjs';import {a,c as c$1}from'./chunk-AR7AKSKG.mjs';import {c,a as a$1}from'./chunk-2VCW5RWI.mjs';import {availableParallelism}from'os';globalThis.require=createRequire(import.meta.url);
|
|
3
|
+
var o=c(a(),1);var s=`
|
|
4
|
+
\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557
|
|
5
|
+
\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u255D
|
|
6
|
+
\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2554\u255D
|
|
7
|
+
\u2588\u2588\u2554\u2550\u2550\u2550\u255D \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2588\u2588\u2557
|
|
8
|
+
\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2557
|
|
9
|
+
\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D
|
|
10
|
+
`;function i(){console.log(o.default.yellow(s)),console.log(o.default.cyan(" \u{1F4E6} Modern local package development tool")),console.log(o.default.dim(` Smart file copying for node_modules injection
|
|
11
|
+
`));}a$1(i,"showBanner");process.env.UV_THREADPOOL_SIZE??=String(Math.max(availableParallelism(),8));c$1();var m=process.argv.slice(2),p=m.some(e=>!e.startsWith("-")&&["init","publish","add","remove","push","dev","restore","list","status","update","clean","gc","doctor","migrate"].includes(e));p||i();var u={meta:{name:"plunk",version:"0.1.0",description:""},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$1(()=>import('./init-EL2DWYNJ.mjs').then(e=>e.default),"init"),publish:a$1(()=>import('./publish-4TDT6TTS.mjs').then(e=>e.default),"publish"),add:a$1(()=>import('./add-UE37EMV5.mjs').then(e=>e.default),"add"),remove:a$1(()=>import('./remove-R55FIXPL.mjs').then(e=>e.default),"remove"),push:a$1(()=>import('./push-G3UXBB6E.mjs').then(e=>e.default),"push"),dev:a$1(()=>import('./dev-VQPGPB5A.mjs').then(e=>e.default),"dev"),restore:a$1(()=>import('./restore-XBFOHISI.mjs').then(e=>e.default),"restore"),list:a$1(()=>import('./list-CCR7QD7N.mjs').then(e=>e.default),"list"),status:a$1(()=>import('./status-GCATYK2I.mjs').then(e=>e.default),"status"),update:a$1(()=>import('./update-6PLGM37S.mjs').then(e=>e.default),"update"),clean:a$1(()=>import('./clean-EWBL6FW2.mjs').then(e=>e.default),"clean"),gc:a$1(()=>import('./clean-EWBL6FW2.mjs').then(e=>e.default),"gc"),doctor:a$1(()=>import('./doctor-PXC45S34.mjs').then(e=>e.default),"doctor"),migrate:a$1(()=>import('./migrate-6RZ3SEU5.mjs').then(e=>e.default),"migrate")}};a$2(u);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$1,b as b$1,c}from'./chunk-
|
|
2
|
+
import {createRequire}from'node:module';import {a as a$1,b as b$1,c}from'./chunk-JCRGRXVS.mjs';import'./chunk-7JG555TZ.mjs';import'./chunk-4TNTNSAB.mjs';import'./chunk-UAGG5WMD.mjs';import'./chunk-HW7AEGI3.mjs';import'./chunk-4QWBGXB5.mjs';import'./chunk-LI4HG26F.mjs';import'./chunk-QUI5JAIH.mjs';import'./chunk-ZJMZKJNW.mjs';import'./chunk-MBKCCWSD.mjs';import'./chunk-KVVUZ6KL.mjs';import {b}from'./chunk-RITKSDMP.mjs';import'./chunk-OL7SNXMX.mjs';import'./chunk-6YX2BGO2.mjs';import'./chunk-AR7AKSKG.mjs';import {a}from'./chunk-2VCW5RWI.mjs';import {resolve}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
3
|
var h={meta:{name:"dev",description:"Watch, rebuild, and push to all consumers. Auto-detects build command."},args:{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: 100)"},"no-scripts":{type:"boolean",description:"Skip prepack/postpack lifecycle hooks",default:false}},async run({args:e}){b();let t=resolve("."),o=a(()=>a$1(t,{runScripts:!e["no-scripts"]}),"push"),{buildCmd:r,patterns:p}=await b$1(t,e);await o(),await c(t,{patterns:p,buildCmd:r,debounce:e.debounce&&Number.isFinite(parseInt(e.debounce,10))?parseInt(e.debounce,10):void 0},o),await new Promise(i=>{process.once("SIGINT",i),process.once("SIGTERM",i);});}};export{h as default};
|
package/dist/index.mjs
CHANGED
|
@@ -1841,51 +1841,59 @@ function killActiveBuild() {
|
|
|
1841
1841
|
}
|
|
1842
1842
|
async function startWatcher(watchDir, options, onChange) {
|
|
1843
1843
|
const { watch } = await import("chokidar");
|
|
1844
|
-
const patterns = options.patterns ?? ["src", "lib"
|
|
1844
|
+
const patterns = options.patterns ?? ["src", "lib"];
|
|
1845
1845
|
const watchPaths = patterns.map(
|
|
1846
1846
|
(p) => p.startsWith("/") || p.includes(":") ? p : `${watchDir}/${p}`
|
|
1847
1847
|
);
|
|
1848
|
-
const debounceMs = options.debounce ??
|
|
1849
|
-
|
|
1848
|
+
const debounceMs = options.debounce ?? 500;
|
|
1849
|
+
const cooldownMs = 2e3;
|
|
1850
|
+
let debounceTimer = null;
|
|
1850
1851
|
let closed = false;
|
|
1851
1852
|
let running = false;
|
|
1852
|
-
let
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
return;
|
|
1869
|
-
}
|
|
1870
|
-
}
|
|
1871
|
-
await onChange();
|
|
1872
|
-
} catch (err) {
|
|
1873
|
-
consola.error(`Push failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1874
|
-
} finally {
|
|
1875
|
-
running = false;
|
|
1876
|
-
if (pendingWhileRunning) {
|
|
1877
|
-
pendingWhileRunning = false;
|
|
1878
|
-
scheduleFlush();
|
|
1853
|
+
let lastBuildEndTime = 0;
|
|
1854
|
+
let hasPendingChanges = false;
|
|
1855
|
+
const doBuild = async () => {
|
|
1856
|
+
if (closed || running) return;
|
|
1857
|
+
const timeSinceLastBuild = Date.now() - lastBuildEndTime;
|
|
1858
|
+
if (lastBuildEndTime > 0 && timeSinceLastBuild < cooldownMs) {
|
|
1859
|
+
return;
|
|
1860
|
+
}
|
|
1861
|
+
running = true;
|
|
1862
|
+
hasPendingChanges = false;
|
|
1863
|
+
try {
|
|
1864
|
+
if (options.buildCmd) {
|
|
1865
|
+
const success = await runBuildCommand(options.buildCmd, watchDir);
|
|
1866
|
+
if (!success) {
|
|
1867
|
+
consola.warn("Build failed (see output above), skipping push");
|
|
1868
|
+
return;
|
|
1879
1869
|
}
|
|
1880
1870
|
}
|
|
1881
|
-
|
|
1871
|
+
await onChange();
|
|
1872
|
+
} catch (err) {
|
|
1873
|
+
consola.error(`Push failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1874
|
+
} finally {
|
|
1875
|
+
running = false;
|
|
1876
|
+
lastBuildEndTime = Date.now();
|
|
1877
|
+
}
|
|
1882
1878
|
};
|
|
1883
|
-
const onFileEvent = (
|
|
1884
|
-
if (
|
|
1885
|
-
|
|
1886
|
-
|
|
1879
|
+
const onFileEvent = (path) => {
|
|
1880
|
+
if (closed) return;
|
|
1881
|
+
if (running) {
|
|
1882
|
+
hasPendingChanges = true;
|
|
1883
|
+
return;
|
|
1887
1884
|
}
|
|
1888
|
-
|
|
1885
|
+
const timeSinceLastBuild = Date.now() - lastBuildEndTime;
|
|
1886
|
+
if (lastBuildEndTime > 0 && timeSinceLastBuild < cooldownMs) {
|
|
1887
|
+
hasPendingChanges = true;
|
|
1888
|
+
return;
|
|
1889
|
+
}
|
|
1890
|
+
if (debounceTimer) {
|
|
1891
|
+
clearTimeout(debounceTimer);
|
|
1892
|
+
}
|
|
1893
|
+
debounceTimer = setTimeout(() => {
|
|
1894
|
+
debounceTimer = null;
|
|
1895
|
+
doBuild();
|
|
1896
|
+
}, debounceMs);
|
|
1889
1897
|
};
|
|
1890
1898
|
const awfOption = options.buildCmd ? false : options.awaitWriteFinish ?? {
|
|
1891
1899
|
stabilityThreshold: 200,
|
|
@@ -1909,7 +1917,7 @@ async function startWatcher(watchDir, options, onChange) {
|
|
|
1909
1917
|
const watcherHandle = {
|
|
1910
1918
|
close: async () => {
|
|
1911
1919
|
closed = true;
|
|
1912
|
-
if (
|
|
1920
|
+
if (debounceTimer) clearTimeout(debounceTimer);
|
|
1913
1921
|
killActiveBuild();
|
|
1914
1922
|
await watcher.close();
|
|
1915
1923
|
activeWatcher = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$2}from'./chunk-7JG555TZ.mjs';import {a as a$5,b as b$2}from'./chunk-
|
|
2
|
+
import {createRequire}from'node:module';import {a as a$2}from'./chunk-7JG555TZ.mjs';import {a as a$5,b as b$2}from'./chunk-2RFNVPZR.mjs';import {a as a$4,d}from'./chunk-LI4HG26F.mjs';import {a as a$6,b as b$3}from'./chunk-QUI5JAIH.mjs';import {a as a$3}from'./chunk-MBKCCWSD.mjs';import'./chunk-KVVUZ6KL.mjs';import {b as b$1,a as a$7}from'./chunk-RITKSDMP.mjs';import'./chunk-OL7SNXMX.mjs';import {j,h}from'./chunk-6YX2BGO2.mjs';import {a,b}from'./chunk-AR7AKSKG.mjs';import {c,a as a$1}from'./chunk-2VCW5RWI.mjs';import {join,resolve,basename}from'path';import {readFile,writeFile}from'fs/promises';globalThis.require=createRequire(import.meta.url);
|
|
3
3
|
var n=c(a(),1);var ee={meta:{name:"init",description:"Set up plunk 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:a}){b$1();let o=new a$3,s=resolve("."),p=a.yes;b.info(`Initializing plunk in ${n.default.cyan(s)}
|
|
4
4
|
`);let i=await a$4(s),d$1={pnpm:"pnpm-lock.yaml",bun:"bun.lockb",yarn:"yarn.lock",npm:"package-lock.json"};b.success(`Detected package manager: ${n.default.cyan(i)}`+(d$1[i]?` (from ${d$1[i]})`:""));let l=i;if(!p&&await b.prompt(`Use ${i}?`,{type:"confirm",initial:true})===false){let c=["npm","pnpm","yarn","bun"].filter(u=>u!==i),f=await b.prompt("Select package manager:",{type:"select",options:c.map(u=>({label:u,value:u}))});typeof f=="string"&&(l=f);}let r="consumer";a.role==="consumer"||a.role==="library"?r=a.role:p||await b.prompt("How will you use plunk in this project?",{type:"select",options:[{label:"Consumer (app) \u2014 I want to link packages INTO this project",value:"consumer"},{label:"Library (package) \u2014 I want to publish this package FOR other projects",value:"library"}]})==="library"&&(r="library"),b.success(`Project role: ${n.default.cyan(r)}`);let R=join(s,".gitignore");await a$5(R)&&b.success("Added .plunk/ to .gitignore");let m=join(s,"package.json");if(await j(m))if(r==="consumer"){await b$2(m)&&b.success('Added "postinstall": "plunk restore" to package.json scripts');let c="{package-name}";if(!p){let u=await b.prompt("Package name to link (leave blank to skip):",{type:"text",default:""});typeof u=="string"&&u.trim()&&(c=u.trim());}await $(m,"plunk:add",`plunk add ${c}`)&&b.success(`Added "plunk:add": "plunk add ${c}" to package.json scripts`);}else {await T(m,l,p);let t=await V(m);for(let c of t)b.success(`Added "${c}" script to package.json`);}let y=join(s,".plunk");if(!await j(y))await h(y),await writeFile(join(y,"state.json"),JSON.stringify({version:"1",packageManager:l,role:r,links:{}},null,2)),b.success("Created .plunk/ state directory");else {let t=await a$6(s);t.packageManager=l,t.role=r,await b$3(s,t);}if(r==="consumer"){let t=await d(s);if(t.type==="vite"&&t.configFile){b.success(`Detected bundler: ${n.default.cyan("Vite")} (${basename(t.configFile)})`);let{addPlunkVitePlugin:c}=await import('./vite-config-ZMDIOTXC.mjs'),f=await c(t.configFile);f.modified?b.success(`Added plunk plugin to ${basename(t.configFile)}`):f.error&&b.info(`Add the Vite plugin for automatic dev server restarts:
|
|
5
5
|
${n.default.cyan('import plunk from "@olegkuibar/plunk/vite"')}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$1,b as b$2,c}from'./chunk-
|
|
2
|
+
import {createRequire}from'node:module';import {a as a$1,b as b$2,c}from'./chunk-JCRGRXVS.mjs';import'./chunk-7JG555TZ.mjs';import'./chunk-4TNTNSAB.mjs';import'./chunk-UAGG5WMD.mjs';import'./chunk-HW7AEGI3.mjs';import'./chunk-4QWBGXB5.mjs';import'./chunk-LI4HG26F.mjs';import'./chunk-QUI5JAIH.mjs';import'./chunk-ZJMZKJNW.mjs';import'./chunk-MBKCCWSD.mjs';import'./chunk-KVVUZ6KL.mjs';import {b as b$1}from'./chunk-RITKSDMP.mjs';import'./chunk-OL7SNXMX.mjs';import'./chunk-6YX2BGO2.mjs';import'./chunk-AR7AKSKG.mjs';import {a}from'./chunk-2VCW5RWI.mjs';import {resolve}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
3
|
var b={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},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: 300)"},"no-scripts":{type:"boolean",description:"Skip prepack/postpack lifecycle hooks",default:false}},async run({args:e}){b$1();let o=resolve("."),t=a(()=>a$1(o,{runScripts:!e["no-scripts"]}),"push");if(await t(),e.watch){let{buildCmd:d,patterns:r}=await b$2(o,e);await c(o,{patterns:r,buildCmd:d,debounce:e.debounce&&Number.isFinite(parseInt(e.debounce,10))?parseInt(e.debounce,10):void 0},t),await new Promise(i=>{process.once("SIGINT",i),process.once("SIGTERM",i);});}}};export{b as default};
|
package/package.json
CHANGED
package/dist/add-4LHIITHV.mjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {c as c$1}from'./chunk-ZAUWE3N7.mjs';import {a as a$2}from'./chunk-4TNTNSAB.mjs';import {c}from'./chunk-UAGG5WMD.mjs';import'./chunk-HW7AEGI3.mjs';import {a as a$6}from'./chunk-UDONDVIM.mjs';import {b as b$3,a as a$5,e}from'./chunk-4QWBGXB5.mjs';import {a as a$4,b as b$2,c as c$2,d}from'./chunk-LI4HG26F.mjs';import {c as c$3,g}from'./chunk-QUI5JAIH.mjs';import {a as a$3}from'./chunk-ZJMZKJNW.mjs';import {a as a$1}from'./chunk-MBKCCWSD.mjs';import {i}from'./chunk-KVVUZ6KL.mjs';import {b as b$1,a as a$7}from'./chunk-RITKSDMP.mjs';import'./chunk-OL7SNXMX.mjs';import {j}from'./chunk-6YX2BGO2.mjs';import {b,e as e$1,f}from'./chunk-AR7AKSKG.mjs';import {a}from'./chunk-2VCW5RWI.mjs';import {readFile}from'fs/promises';import {spawn}from'child_process';import {platform}from'os';import {join,resolve,basename}from'path';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var kn={meta:{name:"add",description:"Link a package from the plunk 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:r}){b$1();let a=new a$1,n=resolve("."),i$1=r.package;if(r.from){let t=resolve(r.from);b.info(`Publishing from ${t}...`),await a$2(t);}let s=await c(i$1);s||(a$3(`Package "${i$1}" not found in store. Run 'plunk publish' in the package directory first, or use --from <path>.`),process.exit(1));let p=!await j(i(n)),o=await a$4(n);if(p&&(await c$1(n,o),b.success("Auto-initialized plunk (consumer mode)")),b.info(`Detected package manager: ${o}`),o==="yarn"){let t=await b$2(n);(t==="pnp"||t===null&&await c$2(n))&&(b.error(`Yarn PnP mode is not compatible with plunk.
|
|
4
|
-
|
|
5
|
-
plunk works by copying files into node_modules/, but PnP eliminates
|
|
6
|
-
node_modules/ entirely. To use plunk 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=await b$3(n,i$1,o);m&&b.info(`Backed up existing ${i$1} installation`);let c$4=await a$5(s,n,o);b.success(`Linked ${i$1}@${s.version} \u2192 node_modules/${i$1} (${c$4.copied} files copied, ${c$4.skipped} unchanged)`),c$4.binLinks>0&&b.info(`Created ${c$4.binLinks} bin link(s)`);let H={version:s.version,contentHash:s.meta.contentHash,linkedAt:new Date().toISOString(),sourcePath:s.meta.sourcePath,backupExists:m,packageManager:o,buildId:s.meta.buildId??""};await c$3(n,i$1,H),await g(i$1,n),await K(n,i$1,s.version);let d$1=await e(s,n);if(d$1.length>0)if(e$1())f(`[add] Missing transitive deps (json mode): ${d$1.join(", ")}`);else if(r.yes){let t=w(o,d$1);b.info(`Installing missing dependencies: ${d$1.join(", ")}`),await _(t,n)?b.success("Installed missing dependencies"):b.warn(`Install failed. Run manually: ${t}`);}else if(await b.prompt(`Install ${d$1.length} missing dependencies? (${d$1.join(", ")})`,{type:"confirm",initial:true})){let u=w(o,d$1);await _(u,n)?b.success("Installed missing dependencies"):b.warn(`Install failed. Run manually: ${u}`);}else b.warn(`Missing transitive dependencies: ${d$1.join(", ")}
|
|
12
|
-
Run: ${w(o,d$1)}`);let l=await d(n);if(l.type==="next"&&l.configFile){let t=await a$6(l.configFile,i$1);t.modified?b.success(`Added ${i$1} to transpilePackages in ${basename(l.configFile)}`):t.error&&b.info(`Add to next.config manually: transpilePackages: ['${i$1}']`);}else if(l.type==="vite"&&l.configFile){let{addPlunkVitePlugin:t}=await import('./vite-config-ZMDIOTXC.mjs'),u=await t(l.configFile);u.modified?b.success(`Added plunk plugin to ${basename(l.configFile)}`):u.error&&b.info(`Add manually:
|
|
13
|
-
import plunk from "@olegkuibar/plunk/vite"
|
|
14
|
-
plugins: [plunk()]`);}let{findTailwindCss:J,addTailwindSource:V}=await import('./tailwind-source-VPNLLSRJ.mjs'),g$1=await J(n);if(g$1){let t=await V(g$1,i$1,n);t.modified?b.success(`Added @source for ${i$1} to ${basename(g$1)}`):t.error&&b.info(`Add to your CSS manually: @source "../node_modules/${i$1}";`);}b.info(`Done in ${a.elapsed()}`),a$7({package:i$1,version:s.version,copied:c$4.copied,skipped:c$4.skipped,binLinks:c$4.binLinks,elapsed:a.elapsedMs()});}};function w(r,a){let n=a.join(" ");switch(r){case "pnpm":return `pnpm add ${n}`;case "yarn":return `yarn add ${n}`;case "bun":return `bun add ${n}`;default:return `npm install ${n}`}}a(w,"buildInstallCommand");function _(r,a){return new Promise(n=>{let i=platform()==="win32",o=spawn(i?"cmd":"sh",[i?"/c":"-c",r],{cwd:a,stdio:"inherit"});o.on("close",m=>n(m===0)),o.on("error",()=>n(false));})}a(_,"runInstallCommand");async function K(r,a,n){try{let i=await readFile(join(r,"package.json"),"utf-8"),s=JSON.parse(i),p=s.dependencies?.[a]??s.devDependencies?.[a]??s.peerDependencies?.[a];if(!p||/^(workspace:|catalog:|\*)/.test(p))return;let o=p.match(/(\d+)\.\d+\.\d+/);if(!o)return;let m=parseInt(o[1],10),c=parseInt(n.split(".")[0],10);m!==c&&b.warn(`Version mismatch: store has ${a}@${n} but your package.json declares "${p}". Consider updating your dependency range.`);}catch{}}a(K,"warnVersionMismatch");export{kn as default};
|
package/dist/chunk-ZIXSXQRE.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {createRequire}from'node:module';import {a as a$8}from'./chunk-7JG555TZ.mjs';import {a as a$3}from'./chunk-4TNTNSAB.mjs';import {b as b$1}from'./chunk-UAGG5WMD.mjs';import {a as a$5}from'./chunk-4QWBGXB5.mjs';import {a as a$7}from'./chunk-LI4HG26F.mjs';import {i,e,c}from'./chunk-QUI5JAIH.mjs';import {a as a$4}from'./chunk-ZJMZKJNW.mjs';import {a as a$2}from'./chunk-MBKCCWSD.mjs';import {a as a$6}from'./chunk-RITKSDMP.mjs';import {a}from'./chunk-6YX2BGO2.mjs';import {b,f}from'./chunk-AR7AKSKG.mjs';import {a as a$1}from'./chunk-2VCW5RWI.mjs';import {readFile}from'fs/promises';import {join}from'path';import {spawn}from'child_process';import {platform}from'os';globalThis.require=createRequire(import.meta.url);
|
|
3
|
-
var N=a(4);async function ie(l,r={}){let s=new a$2,e$1=await a$3(l,{runScripts:r.runScripts});if(e$1.skipped){b.info("No changes to push");return}let t=await b$1(e$1.name,e$1.version);if(!t){a$4(`Failed to read store entry for ${e$1.name}@${e$1.version} after publish`);return}let u=await i(e$1.name);if(u.length===0){b.info("No consumers registered. Use 'plunk add' in a consumer project first.");return}let d=0,i$1=0,g=0,h=await Promise.all(u.map(a=>N(async()=>{let f$1=await e(a,e$1.name);if(!f$1)return f(`[push] No link found for ${e$1.name} in ${a}, skipping`),null;try{let m=await a$5(t,a,f$1.packageManager);return (m.copied>0||m.removed>0)&&await c(a,e$1.name,{...f$1,contentHash:t.meta.contentHash,linkedAt:new Date().toISOString(),buildId:t.meta.buildId??""}),m}catch(m){return b.warn(`Failed to push to ${a}: ${m instanceof Error?m.message:String(m)}`),null}})));for(let a of h)a&&(d+=a.copied,i$1+=a.skipped,g++);let w=e$1.buildId?` [${e$1.buildId}]`:"";b.success(`Pushed ${e$1.name}@${e$1.version}${w} to ${g} consumer(s) in ${s.elapsed()} (${d} files changed, ${i$1} unchanged)`),a$6({name:e$1.name,version:e$1.version,buildId:e$1.buildId,consumers:g,copied:d,skipped:i$1,elapsed:s.elapsedMs()});}a$1(ie,"doPush");async function ne(l,r){let s=r.build,e;if(!r.build){if(!r["skip-build"]){let t=await a$7(l),u=await a$8(l,t);u&&(s=u,b.info(`Auto-detected build command: ${u}`));}}if(!s)try{let t=JSON.parse(await readFile(join(l,"package.json"),"utf-8"));t.files&&t.files.length>0&&(e=t.files,f(`[watch] Using package.json files field: ${e.join(", ")}`));}catch(t){f(`[watch] Could not read package.json: ${t instanceof Error?t.message:String(t)}`);}return {buildCmd:s,patterns:e}}a$1(ne,"resolveWatchConfig");var p=null;function G(){p&&!p.killed&&(p.kill("SIGTERM"),p=null);}a$1(G,"killActiveBuild");async function ce(l,r,s){let{watch:e}=await import('./chokidar-LVDD2IK4.mjs'),t=r.patterns??["src","lib","dist"],u=t.map(o=>o.startsWith("/")||o.includes(":")?o:`${l}/${o}`),d=r.debounce??100,i=null,g=false,h=false,w=false,a=a$1(()=>{i||(i=setTimeout(async()=>{if(i=null,!g){if(h){w=true;return}h=true;try{if(r.buildCmd&&!await H(r.buildCmd,l)){b.warn("Build failed (see output above), skipping push");return}await s();}catch(o){b.error(`Push failed: ${o instanceof Error?o.message:String(o)}`);}finally{h=false,w&&(w=false,a());}}},d));},"scheduleFlush"),f=a$1(o=>{i&&(clearTimeout(i),i=null),a();},"onFileEvent"),m=r.buildCmd?false:r.awaitWriteFinish??{stabilityThreshold:200,pollInterval:50},b$1=e(u,{ignoreInitial:true,ignored:["**/node_modules/**","**/.git/**","**/.plunk/**"],awaitWriteFinish:m});b$1.on("change",f),b$1.on("add",f),b$1.on("unlink",f),b$1.on("error",o=>{b.error(`Watcher error: ${o instanceof Error?o.message:String(o)}`);});let $={close:a$1(async()=>{g=true,i&&clearTimeout(i),G(),await b$1.close();},"close")};let y=a$1(async()=>{b.info("Stopping watcher..."),await $.close(),process.exit(0);},"cleanup");return process.once("SIGINT",y),process.once("SIGTERM",y),b.info(`Watching for changes in: ${t.join(", ")}`),$}a$1(ce,"startWatcher");function H(l,r){return new Promise(s=>{let e=platform()==="win32",t=e?"cmd":"sh",u=e?"/c":"-c";b.start(`Running: ${l}`);let d=spawn(t,[u,l],{cwd:r,stdio:"inherit"});p=d,d.on("close",i=>{p=null,i===0?(b.success("Build succeeded"),s(true)):(b.error(`Build failed with code ${i}`),s(false));}),d.on("error",i=>{p=null,b.error(`Build error: ${i.message}`),s(false);});})}a$1(H,"runBuildCommand");export{ie as a,ne as b,ce as c};
|