bunup 0.7.3 → 0.7.4

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.
Files changed (2) hide show
  1. package/dist/cli.js +1 -1
  2. package/package.json +18 -8
package/dist/cli.js CHANGED
@@ -51,7 +51,7 @@ export default defineWorkspace([
51
51
  ${b}
52
52
  ]);
53
53
  `;await j.writeFile(o,p)}function lt(e,t){return t.filter((r)=>e.includes(r.value)).map((r)=>r.configGenerator?r.configGenerator():`${r.value}()`).join(", ")}async function Xt(e,t){let r=e.scripts||{},i=!1;for(let[n,s]of[["build","bunup"],["dev","bunup --watch"]])if(!r[n]||await F({message:`Script '${n}' exists. Replace with '${s}'?`,initialValue:!0}))r[n]=s,i=!0;if(i)e.scripts=r,await j.writeFile(t,JSON.stringify(e,null,2))}async function Qt(e,t){if(e.dependencies?.bunup||e.devDependencies?.bunup){B.info(`Bunup is already installed
54
- `);return}let i={bun:"-d",npm:"-D",pnpm:"-D",yarn:"-D"},n=xe(t.agent,"add",[i[t.agent]||"-D","bunup"]);if(!n)throw new Error("Failed to resolve install command");await Ut(we(n),[],{nodeOptions:{shell:!0,stdio:"pipe"}})}function we(e){if(!e)return"";return`${e.command} ${e.args.join(" ")}`}async function Zt(){let e={},t=!1,r=L.join(process.cwd(),"tsconfig.json");try{let{config:n,filepath:s}=await he({name:"tsconfig",cwd:process.cwd(),extensions:[".json"]});if(n&&s)e=n,t=!0,r=s}catch{}if(e.compilerOptions?.isolatedDeclarations!==!0){B.info(`${m.default.cyan("About isolatedDeclarations:")} ${m.default.gray(`A ${m.default.bold("modern TypeScript feature")} for library authors`)}`),B.info(m.default.gray(`Benefits: ${m.default.bold("faster builds")}, ${m.default.bold("more reliable API types")}, and ${m.default.bold("better editor support")} to catch issues during development`));let n=await F({message:"Enable isolatedDeclarations in tsconfig.json? (recommended but optional)",initialValue:!0});if(h(n))return;if(n){if(e.compilerOptions=e.compilerOptions||{},e.compilerOptions.isolatedDeclarations=!0,e.compilerOptions.declaration=!0,"allowJs"in e.compilerOptions)e.compilerOptions.allowJs=null;if(e.exclude=e.exclude||[],!e.exclude.includes("bunup.config.ts"))e.exclude.push("bunup.config.ts");await j.writeFile(r,JSON.stringify(e,null,2)),B.success("Updated tsconfig.json with isolatedDeclarations")}}else if(t){if(e.exclude=e.exclude||[],!e.exclude.includes("bunup.config.ts"))e.exclude.push("bunup.config.ts"),await j.writeFile(r,JSON.stringify(e,null,2))}}var m;var gt=S(()=>{m=A(G(),1)});import{exec as Pt}from"tinyexec";var Z="0.7.2";D();z();var le=A(G(),1);var Me="https://bunup.dev/docs/guide/cli-options";D();z();W();function y(e){return(t,r)=>{r[e]=t===!0||t==="true"}}function R(e){return(t,r)=>{if(typeof t==="string")r[e]=t;else throw new M(`Option --${e} requires a string value`)}}function re(e){return(t,r)=>{if(typeof t==="string")r[e]=t.split(",");else throw new M(`Option --${e} requires a string value`)}}function St(e){return(t,r)=>{if(typeof t==="boolean")r[e]=t;else if(typeof t==="string")if(t.toLowerCase()==="true"||t.toLowerCase()==="false")r[e]=t.toLowerCase()==="true";else r[e]=t;else throw new M(`Option --${e} requires a boolean or string value`)}}function Mt(){console.log(`
54
+ `);return}let i={bun:"-d",npm:"-D",pnpm:"-D",yarn:"-D"},n=xe(t.agent,"add",[i[t.agent]||"-D","bunup"]);if(!n)throw new Error("Failed to resolve install command");await Ut(we(n),[],{nodeOptions:{shell:!0,stdio:"pipe"}})}function we(e){if(!e)return"";return`${e.command} ${e.args.join(" ")}`}async function Zt(){let e={},t=!1,r=L.join(process.cwd(),"tsconfig.json");try{let{config:n,filepath:s}=await he({name:"tsconfig",cwd:process.cwd(),extensions:[".json"]});if(n&&s)e=n,t=!0,r=s}catch{}if(e.compilerOptions?.isolatedDeclarations!==!0){B.info(`${m.default.cyan("About isolatedDeclarations:")} ${m.default.gray(`A ${m.default.bold("modern TypeScript feature")} for library authors`)}`),B.info(m.default.gray(`Benefits: ${m.default.bold("faster builds")}, ${m.default.bold("more reliable API types")}, and ${m.default.bold("better editor support")} to catch issues during development`));let n=await F({message:"Enable isolatedDeclarations in tsconfig.json? (recommended but optional)",initialValue:!0});if(h(n))return;if(n){if(e.compilerOptions=e.compilerOptions||{},e.compilerOptions.isolatedDeclarations=!0,e.compilerOptions.declaration=!0,"allowJs"in e.compilerOptions)e.compilerOptions.allowJs=null;if(e.exclude=e.exclude||[],!e.exclude.includes("bunup.config.ts"))e.exclude.push("bunup.config.ts");await j.writeFile(r,JSON.stringify(e,null,2)),B.success("Updated tsconfig.json with isolatedDeclarations")}}else if(t){if(e.exclude=e.exclude||[],!e.exclude.includes("bunup.config.ts"))e.exclude.push("bunup.config.ts"),await j.writeFile(r,JSON.stringify(e,null,2))}}var m;var gt=S(()=>{m=A(G(),1)});import{exec as Pt}from"tinyexec";var Z="0.7.4";D();z();var le=A(G(),1);var Me="https://bunup.dev/docs/guide/cli-options";D();z();W();function y(e){return(t,r)=>{r[e]=t===!0||t==="true"}}function R(e){return(t,r)=>{if(typeof t==="string")r[e]=t;else throw new M(`Option --${e} requires a string value`)}}function re(e){return(t,r)=>{if(typeof t==="string")r[e]=t.split(",");else throw new M(`Option --${e} requires a string value`)}}function St(e){return(t,r)=>{if(typeof t==="boolean")r[e]=t;else if(typeof t==="string")if(t.toLowerCase()==="true"||t.toLowerCase()==="false")r[e]=t.toLowerCase()==="true";else r[e]=t;else throw new M(`Option --${e} requires a boolean or string value`)}}function Mt(){console.log(`
55
55
  Bunup - \u26A1\uFE0F A blazing-fast build tool for your libraries built with Bun.
56
56
  `),console.log("For more information on available options, visit:"),console.log(`${le.default.cyan(le.default.underline(Me))}
57
57
  `),process.exit(0)}function Rt(){console.log(Z),process.exit(0)}var Ye={name:{flags:["n","name"],handler:R("name")},format:{flags:["f","format"],handler:re("format")},outDir:{flags:["o","out-dir"],handler:R("outDir")},minify:{flags:["m","minify"],handler:y("minify")},watch:{flags:["w","watch"],handler:y("watch")},dts:{flags:["d","dts"],handler:y("dts")},banner:{flags:["bn","banner"],handler:R("banner")},footer:{flags:["ft","footer"],handler:R("footer")},external:{flags:["e","external"],handler:re("external")},sourcemap:{flags:["sm","sourcemap"],handler:St("sourcemap")},target:{flags:["t","target"],handler:R("target")},minifyWhitespace:{flags:["mw","minify-whitespace"],handler:y("minifyWhitespace")},minifyIdentifiers:{flags:["mi","minify-identifiers"],handler:y("minifyIdentifiers")},minifySyntax:{flags:["ms","minify-syntax"],handler:y("minifySyntax")},clean:{flags:["c","clean"],handler:y("clean")},splitting:{flags:["s","splitting"],handler:y("splitting")},noExternal:{flags:["ne","no-external"],handler:re("noExternal")},preferredTsconfigPath:{flags:["tsconfig","preferred-tsconfig-path"],handler:R("preferredTsconfigPath")},bytecode:{flags:["bc","bytecode"],handler:y("bytecode")},silent:{flags:["silent"],handler:y("silent")},config:{flags:["config"],handler:R("config")},publicPath:{flags:["pp","public-path"],handler:R("publicPath")},env:{flags:["env"],handler:R("env")},onSuccess:{flags:["onSuccess"],handler:R("onSuccess")},filter:{flags:["filter"],handler:re("filter")},init:{flags:["init"],handler:y("init")},dtsOnly:{flags:["dts-only"],handler:y("dtsOnly")},entry:{flags:["entry"],handler:(e,t,r)=>{if(typeof e!=="string")throw new M(`Entry${r?` --entry.${r}`:""} requires a string value`);let i=t.entry||{};if(r){if(i[r])l.warn(`Duplicate entry name '${r}' provided via --entry.${r}. Overwriting previous entry.`);i[r]=e}else{let n=Fe(e);if(i[n])l.warn(`Duplicate entry name '${n}' derived from '${e}'. Overwriting previous entry.`);i[n]=e}t.entry=i}},resolveDts:{flags:["rd","resolve-dts"],handler:(e,t)=>{if(!t.dts)t.dts={};if(typeof t.dts==="boolean")t.dts={};if(typeof e==="string")if(e==="true"||e==="false")t.dts.resolve=e==="true";else t.dts.resolve=e.split(",");else t.dts.resolve=!0}},help:{flags:["h","help"],handler:()=>Mt()},version:{flags:["v","version"],handler:()=>Rt()}},ne={};for(let e of Object.values(Ye))for(let t of e.flags)ne[t]=e.handler;function ze(e){let t={};for(let r=0;r<e.length;r++){let i=e[r];if(i.startsWith("--")){let n,s;if(i.includes("=")){let[o,a]=i.slice(2).split("=",2);n=o,s=a}else{n=i.slice(2);let o=e[r+1];if(s=o&&!o.startsWith("-")?o:!0,typeof s==="string")r++}if(n.includes(".")){let[o,a]=n.split(".",2),b=ne[o];if(b)b(s,t,a);else throw new M(`Unknown option: --${n}`)}else{let o=ne[n];if(o)o(s,t);else throw new M(`Unknown option: --${n}`)}}else if(i.startsWith("-")){let n=i.slice(1),s=e[r+1],o=s&&!s.startsWith("-")?s:!0;if(typeof o==="string")r++;let a=ne[n];if(a)a(o,t);else throw new M(`Unknown option: -${n}`)}else Ye.entry.handler(i,t,void 0)}return t}var ft=A(G(),1);me();W();import{loadConfig as Nt}from"coffi";var ct=A(G(),1);be();D();ge();z();fe();W();import oe from"path";async function at(e,t){let r=new Set,i=se(e),n=typeof i.dts==="object"&&"entry"in i.dts?i.dts.entry:void 0,s=n?K(n):[],o=K(i.entry),a=new Set([...s.map(({entry:d})=>d),...o.map(({entry:d})=>d)]);for(let d of a){let g=oe.resolve(t,d),C=oe.dirname(g);r.add(C)}let p=(await import("chokidar")).watch(Array.from(r),{persistent:!0,ignoreInitial:!0,atomic:!0,ignorePermissionErrors:!0,ignored:[/[\\/]\.git[\\/]/,/[\\/]node_modules[\\/]/,oe.join(t,i.outDir)]}),c=!1,x=async(d=!1)=>{if(c)return;c=!0;try{let g=performance.now();if(await pe(i,t),!d)l.cli(`\uD83D\uDCE6 Rebuild finished in ${ct.default.green(te(performance.now()-g))}`)}catch(g){ue(g)}finally{c=!1}};p.on("change",(d)=>{let g=oe.relative(t,d);l.cli(`File changed: ${g}`,{muted:!0,once:g}),x()}),p.on("error",(d)=>{throw new v(`Watcher error: ${de(d)}`)}),await x(!0)}async function Jt(e=Bun.argv.slice(2)){let t=ze(e);if(t.init){let{init:c}=await Promise.resolve().then(() => (gt(),mt));await c();return}J(t.silent);let r=process.cwd(),{config:i,filepath:n}=await Nt({name:"bunup.config",extensions:[".ts",".js",".mjs",".cjs"],maxDepth:1,preferredPath:t.config,packageJsonProperty:"bunup"}),s=!i?[{rootDir:r,options:t}]:await Ve(i,r,t.filter);if(l.cli(`Using bunup v${Z} and bun v${Bun.version}`,{muted:!0}),n)l.cli(`Using ${ie(n,2)}`,{muted:!0});let o=performance.now();l.cli("Build started");let{build:a}=await Promise.resolve().then(() => (be(),ot));await Promise.all(s.flatMap(({options:c,rootDir:x})=>{return Ie(c).map(async(g)=>{let C={...g,...vt(t)};if(C.watch)await at(C,x);else await a(C,x)})}));let b=performance.now()-o,p=te(b);if(l.cli(`\u26A1\uFE0F Build completed in ${ft.default.green(p)}`),t.watch)l.cli("\uD83D\uDC40 Watching for file changes");if(t.onSuccess)l.cli(`Running command: ${t.onSuccess}`,{muted:!0}),await Pt(t.onSuccess,[],{nodeOptions:{shell:!0,stdio:"inherit"}});if(!t.watch)process.exit(process.exitCode??0)}function vt(e){return{...e,onSuccess:void 0,config:void 0,filter:void 0,init:void 0}}Jt().catch((e)=>Se(e));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bunup",
3
3
  "description": "⚡ A blazing-fast build tool for your libraries built with Bun.",
4
- "version": "0.7.3",
4
+ "version": "0.7.4",
5
5
  "license": "MIT",
6
6
  "author": "Arshad Yaseen <m@arshadyaseen.com> (https://arshadyaseen.com)",
7
7
  "maintainers": [
@@ -17,9 +17,16 @@
17
17
  },
18
18
  "funding": "https://github.com/sponsors/arshad-yaseen",
19
19
  "homepage": "https://bunup.dev",
20
- "keywords": ["bun", "bunup", "bun-bundler"],
20
+ "keywords": [
21
+ "bun",
22
+ "bunup",
23
+ "bun-bundler"
24
+ ],
21
25
  "type": "module",
22
- "files": ["dist", "bin"],
26
+ "files": [
27
+ "dist",
28
+ "bin"
29
+ ],
23
30
  "bin": {
24
31
  "bunup": "bin/bunup.mjs"
25
32
  },
@@ -67,20 +74,23 @@
67
74
  "*": "bun run format:fix && git add .",
68
75
  "src/**/*.(m|c)?(j|t)s": "bun run tsc"
69
76
  },
70
- "workspaces": ["docs", "tests"],
77
+ "workspaces": [
78
+ "docs",
79
+ "tests"
80
+ ],
71
81
  "import": "./dist/index.js",
72
82
  "require": "./dist/index.cjs",
73
83
  "types": "./dist/index.d.cts",
74
84
  "exports": {
75
85
  ".": {
76
- "types": "./dist/index.d.cts",
77
86
  "import": "./dist/index.js",
78
- "require": "./dist/index.cjs"
87
+ "require": "./dist/index.cjs",
88
+ "types": "./dist/index.d.cts"
79
89
  },
80
90
  "./plugins": {
81
- "types": "./dist/plugins.d.cts",
82
91
  "import": "./dist/plugins.js",
83
- "require": "./dist/plugins.cjs"
92
+ "require": "./dist/plugins.cjs",
93
+ "types": "./dist/plugins.d.cts"
84
94
  }
85
95
  }
86
96
  }