bunup 0.3.82 → 0.3.86

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 CHANGED
@@ -16,7 +16,15 @@ _Lower build time is better. Benchmark run on the same code with identical outpu
16
16
 
17
17
  To run the benchmarks yourself, clone this repo and run `pnpm benchmark` and check `results.md` in the benchmarks folder.
18
18
 
19
- ## 🚀 Quick Start
19
+ ## Key Features
20
+
21
+ - 🔄 **Tsup-Compatible CLI & Config**
22
+ - ⚡ **Ultra-Fast Builds Powered by Bun & oxc**
23
+ - 🚀 **Bytecode Generation for Lightning-Fast Startups**
24
+ - 📦 **Workspace/Monorepo Support Out of the Box**
25
+ - 🎯 **Bun-Specific Targeting**
26
+
27
+ ## Quick Start
20
28
 
21
29
  ### Installations
22
30
 
package/build/cli.mjs CHANGED
@@ -20,7 +20,7 @@ To fix this, use named entries in your configuration:
20
20
  }
21
21
  }
22
22
 
23
- See: https://bunup.arshadyaseen.com/#named-entries`,{muted:!0,verticalSpace:!0}),t.push({name:l,path:o})}else t.push({name:s,path:o}),n.add(s),r[s]=o}if(Array.isArray(e))for(let s of e){let o=L(s);i(o,s)}else if(typeof e==="object")for(let[s,o]of Object.entries(e))i(s,o);else{let s=L(e);i(s,e)}return t}function Oe(e,t){return`[dir]/${e}${t}`}import{loadConfig as Be}from"coffi";async function ve(e,t){return Array.isArray(e)&&"root"in e[0]?e.map((n)=>({rootDir:n.root,options:re(n.config,"name",n.name)})):[{rootDir:t,options:e}]}async function Pe(e){let{config:t,filepath:n}=await Be({name:"package",cwd:e,extensions:[".json"],maxDepth:1});return{packageJson:t,path:n}}async function Te(e,t){let{config:n,filepath:r}=await Be({name:"tsconfig",cwd:e,extensions:[".json"],preferredPath:t,maxDepth:3});return{tsconfig:n,path:r}}function Le(e,t){return{name:"bunup:external-plugin",setup(n){n.onResolve({filter:/.*/},(r)=>{let i=r.path;if(e.some((o)=>o.test(i))&&!t.some((o)=>o.test(i)))return{path:i,external:!0};return null})}}}var C=new Set;async function W(e,t){if(!e.entry||e.entry.length===0||!e.outDir)throw new y("Nothing to build. Please make sure you have provided a proper bunup configuration or cli arguments.");let{packageJson:n,path:r}=await Pe(t);if(n&&r)c.cli(`Using package.json: ${x(r,2)}`,{muted:!0,identifier:e.name,once:`${r}:${e.name}`});let i=n?.type,s=U(e,n),o=_(e),a=[Le(s,o)],l=A(e.entry),u=ee(e,t),p=e.format.flatMap((f)=>l.map((m)=>{return at(e,t,m,f,i,a,u)}));if(await Promise.all(p),e.dts){let f=await Te(t,e.preferredTsconfigPath);if(f.path)c.cli(`Using tsconfig: ${x(f.path,2)}`,{muted:!0,identifier:e.name,once:`${f.path}:${e.name}`});let m=e.format.filter((E)=>{if(E==="iife"&&!M(i)&&e.format.includes("cjs"))return!1;return!0}),F=typeof e.dts==="object"&&e.dts.entry?A(e.dts.entry):l;try{await Promise.all(F.map(async(E)=>{let Ue=await Ce(t,E.path,e,f,n);await Promise.all(m.map(async(_e)=>{let Ne=ie(_e,i),q=`${t}/${e.outDir}/${E.name}${Ne}`;await Bun.write(q,Ue);let ke=Bun.file(q).size||0;c.progress("DTS",x(q),Y(ke),e.name)}))}))}catch(E){throw new g(h(E))}}}async function at(e,t,n,r,i,s,o){let a=se(r,i),l=await Bun.build({...o,entrypoints:[`${t}/${n.path}`],format:r,naming:{entry:Oe(n.name,a)},splitting:ae(e.splitting,r),bytecode:fe(e.bytecode,r),plugins:s,throw:!1});if(!l.success)for(let f of l.logs){if(f.level==="error")throw new y(f.message);if(f.level==="warning")c.warn(f.message);else if(f.level==="info")c.info(f.message)}let u=`${t}/${e.outDir}/${n.name}${a}`,p=Bun.file(u).size||0;c.progress(r.toUpperCase(),x(u),Y(p),e.name)}var j="0.3.82";var Ae="https://bun.sh/docs/installation",Se="https://bunup.arshadyaseen.com/#cli-options";function b(e){return(t,n)=>{n[e]=t===!0?!0:t==="true"}}function w(e){return(t,n)=>{if(typeof t==="string")n[e]=t;else throw new d(`Option --${e} requires a string value`)}}function De(e){return(t,n)=>{if(typeof t==="string")n[e]=t.split(",");else throw new d(`Option --${e} requires a string value`)}}function ct(){console.log(`
23
+ See: https://bunup.arshadyaseen.com/#named-entries`,{muted:!0,verticalSpace:!0}),t.push({name:l,path:o})}else t.push({name:s,path:o}),n.add(s),r[s]=o}if(Array.isArray(e))for(let s of e){let o=L(s);i(o,s)}else if(typeof e==="object")for(let[s,o]of Object.entries(e))i(s,o);else{let s=L(e);i(s,e)}return t}function Oe(e,t){return`[dir]/${e}${t}`}import{loadConfig as Be}from"coffi";async function ve(e,t){return Array.isArray(e)&&"root"in e[0]?e.map((n)=>({rootDir:n.root,options:re(n.config,"name",n.name)})):[{rootDir:t,options:e}]}async function Pe(e){let{config:t,filepath:n}=await Be({name:"package",cwd:e,extensions:[".json"],maxDepth:1});return{packageJson:t,path:n}}async function Te(e,t){let{config:n,filepath:r}=await Be({name:"tsconfig",cwd:e,extensions:[".json"],preferredPath:t,maxDepth:3});return{tsconfig:n,path:r}}function Le(e,t){return{name:"bunup:external-plugin",setup(n){n.onResolve({filter:/.*/},(r)=>{let i=r.path;if(e.some((o)=>o.test(i))&&!t.some((o)=>o.test(i)))return{path:i,external:!0};return null})}}}var C=new Set;async function W(e,t){if(!e.entry||e.entry.length===0||!e.outDir)throw new y("Nothing to build. Please make sure you have provided a proper bunup configuration or cli arguments.");let{packageJson:n,path:r}=await Pe(t);if(n&&r)c.cli(`Using package.json: ${x(r,2)}`,{muted:!0,identifier:e.name,once:`${r}:${e.name}`});let i=n?.type,s=U(e,n),o=_(e),a=[Le(s,o)],l=A(e.entry),u=ee(e,t),p=e.format.flatMap((f)=>l.map((m)=>{return at(e,t,m,f,i,a,u)}));if(await Promise.all(p),e.dts){let f=await Te(t,e.preferredTsconfigPath);if(f.path)c.cli(`Using tsconfig: ${x(f.path,2)}`,{muted:!0,identifier:e.name,once:`${f.path}:${e.name}`});let m=e.format.filter((E)=>{if(E==="iife"&&!M(i)&&e.format.includes("cjs"))return!1;return!0}),F=typeof e.dts==="object"&&e.dts.entry?A(e.dts.entry):l;try{await Promise.all(F.map(async(E)=>{let Ue=await Ce(t,E.path,e,f,n);await Promise.all(m.map(async(_e)=>{let Ne=ie(_e,i),q=`${t}/${e.outDir}/${E.name}${Ne}`;await Bun.write(q,Ue);let ke=Bun.file(q).size||0;c.progress("DTS",x(q),Y(ke),e.name)}))}))}catch(E){throw new g(h(E))}}}async function at(e,t,n,r,i,s,o){let a=se(r,i),l=await Bun.build({...o,entrypoints:[`${t}/${n.path}`],format:r,naming:{entry:Oe(n.name,a)},splitting:ae(e.splitting,r),bytecode:fe(e.bytecode,r),plugins:s,throw:!1});if(!l.success)for(let f of l.logs){if(f.level==="error")throw new y(f.message);if(f.level==="warning")c.warn(f.message);else if(f.level==="info")c.info(f.message)}let u=`${t}/${e.outDir}/${n.name}${a}`,p=Bun.file(u).size||0;c.progress(r.toUpperCase(),x(u),Y(p),e.name)}var j="0.3.86";var Ae="https://bun.sh/docs/installation",Se="https://bunup.arshadyaseen.com/#cli-options";function b(e){return(t,n)=>{n[e]=t===!0?!0:t==="true"}}function w(e){return(t,n)=>{if(typeof t==="string")n[e]=t;else throw new d(`Option --${e} requires a string value`)}}function De(e){return(t,n)=>{if(typeof t==="string")n[e]=t.split(",");else throw new d(`Option --${e} requires a string value`)}}function ct(){console.log(`
24
24
  Bunup - An extremely fast, zero-config bundler for JavaScript and TypeScript, powered by Bun.
25
25
  `),console.log("For more information on available options, visit:"),console.log(`\x1B[36m\x1B[4m${Se}\x1B[0m
26
26
  `),process.exit(0)}function ut(){console.log(j),process.exit(0)}var ft={name:{flags:["n","name"],handler:w("name")},format:{flags:["f","format"],handler:(e,t)=>{if(typeof e==="string")t.format=e.split(",");else throw new d("Option --format requires a string value")}},outDir:{flags:["o","out-dir"],handler:w("outDir")},minify:{flags:["m","minify"],handler:b("minify")},watch:{flags:["w","watch"],handler:b("watch")},dts:{flags:["d","dts"],handler:b("dts")},banner:{flags:["b","banner"],handler:w("banner")},footer:{flags:["f","footer"],handler:w("footer")},external:{flags:["e","external"],handler:De("external")},sourcemap:{flags:["sm","sourcemap"],handler:w("sourcemap")},target:{flags:["t","target"],handler:w("target")},minifyWhitespace:{flags:["mw","minify-whitespace"],handler:b("minifyWhitespace")},minifyIdentifiers:{flags:["mi","minify-identifiers"],handler:b("minifyIdentifiers")},minifySyntax:{flags:["ms","minify-syntax"],handler:b("minifySyntax")},clean:{flags:["c","clean"],handler:b("clean")},splitting:{flags:["s","splitting"],handler:b("splitting")},noExternal:{flags:["ne","no-external"],handler:De("noExternal")},preferredTsconfigPath:{flags:["tsconfig","preferred-tsconfig-path"],handler:w("preferredTsconfigPath")},bytecode:{flags:["bc","bytecode"],handler:b("bytecode")}},pt={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}}},mt={help:{flags:["h","help"],handler:()=>ct()},version:{flags:["v","version"],handler:()=>ut()}},S={};for(let e of Object.values(ft))if(e)for(let t of e.flags)S[t]=e.handler;for(let e of Object.values(pt))for(let t of e.flags)S[t]=e.handler;for(let e of Object.values(mt))for(let t of e.flags)S[t]=e.handler;function Me(e){let t={},n={},r=0;while(r<e.length){let i=e[r];if(i.startsWith("--")){let s,o;if(i.includes("=")){let[a,l]=i.slice(2).split("=",2);s=a,o=l}else{s=i.slice(2);let a=e[r+1];if(o=a&&!a.startsWith("-")?a:!0,typeof o==="string")r++}if(s==="entry")if(typeof o==="string"){let a=L(o);if(n[a])c.warn(`Duplicate entry name '${a}' derived from '${o}'. Overwriting previous entry.`);n[a]=o}else throw new d("Option --entry requires a string value");else if(s.startsWith("entry.")){let a=s.slice(6);if(typeof o==="string"){if(n[a])c.warn(`Duplicate entry name '${a}' provided via --entry.${a}. Overwriting previous entry.`);n[a]=o}else throw new d(`Option --entry.${a} requires a string value`)}else{let a=S[s];if(a)a(o,t);else throw new d(`Unknown option: --${s}`)}}else if(i.startsWith("-")){let s=i.slice(1),o=e[r+1],a=o&&!o.startsWith("-")?o:!0;if(typeof a==="string")r++;let l=S[s];if(l)l(a,t);else throw new d(`Unknown option: -${s}`)}else{let s=L(i);if(n[s])c.warn(`Duplicate entry name '${s}' derived from positional argument '${i}'. Overwriting previous entry.`);n[s]=i}r++}if(Object.keys(n).length>0)t.entry=n;return t}(()=>{if(typeof Bun==="undefined")throw new d(`Bunup requires Bun to run.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunup",
3
- "version": "0.3.82",
3
+ "version": "0.3.86",
4
4
  "description": "An extremely fast, zero-config bundler for TypeScript & JavaScript, powered by Bun.",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -21,7 +21,7 @@
21
21
  "husky": "^9.1.7",
22
22
  "typescript": "^5.8.3",
23
23
  "vitest": "^2.1.9",
24
- "create-bunup": "0.3.82"
24
+ "create-bunup": "0.3.86"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "typescript": ">=4.5.0"