bunup 0.3.32 → 0.3.34

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
@@ -94,7 +94,7 @@ For complete documentation, visit [the full documentation](https://bunup.arshady
94
94
 
95
95
  ## ⚡️ Create TypeScript Libraries Faster
96
96
 
97
- Quickly scaffold modern TypeScript library in 10 seconds. Powered by bunup - the fastest TypeScript bundler available ⚡️.
97
+ Quickly scaffold modern TypeScript library in 10 seconds. Powered by bunup.
98
98
 
99
99
  ```bash
100
100
  # Using bun
package/build/cli.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- import{rolldown as Dn}from"rolldown";import{dts as Hn}from"rolldown-plugin-dts";class $ extends Error{constructor(n){super(n);this.name="BunupError"}}class w extends ${constructor(n){super(n);this.name="BunupBuildError"}}class d extends ${constructor(n){super(n);this.name="BunupDTSBuildError"}}class h extends ${constructor(n){super(n);this.name="BunupCLIError"}}class A extends ${constructor(n){super(n);this.name="BunupWatchError"}}var p=(n)=>{if(n instanceof Error)return n.message;return String(n)},Mn=(n,t)=>{let e=p(n),r=t?`[${t}] `:"",s="ERROR";if(n instanceof w)s="BUILD ERROR";else if(n instanceof d)s="DTS ERROR";else if(n instanceof h)s="CLI ERROR";else if(n instanceof A)s="WATCH ERROR";else if(n instanceof $)s="BUNUP ERROR";if(console.error(`\x1B[31m${s}\x1B[0m ${r}${e}`),n instanceof Error&&n.stack)console.error("\x1B[2m"+n.stack.split(`
3
+ import{rolldown as Tn}from"rolldown";import{dts as Gn}from"rolldown-plugin-dts";class $ extends Error{constructor(n){super(n);this.name="BunupError"}}class y extends ${constructor(n){super(n);this.name="BunupBuildError"}}class d extends ${constructor(n){super(n);this.name="BunupDTSBuildError"}}class x extends ${constructor(n){super(n);this.name="BunupCLIError"}}class A extends ${constructor(n){super(n);this.name="BunupWatchError"}}var g=(n)=>{if(n instanceof Error)return n.message;return String(n)},_=(n,t)=>{let e=g(n),r=t?`[${t}] `:"",s="ERROR";if(n instanceof y)s="BUILD ERROR";else if(n instanceof d)s="DTS ERROR";else if(n instanceof x)s="CLI ERROR";else if(n instanceof A)s="WATCH ERROR";else if(n instanceof $)s="BUNUP ERROR";if(console.error(`\x1B[31m${s}\x1B[0m ${r}${e}`),n instanceof Error&&n.stack)console.error("\x1B[2m"+n.stack.split(`
4
4
  `).slice(1).join(`
5
- `)+"\x1B[0m")},z=(n,t)=>{Mn(n,t),process.exit(1)};import Q from"node:fs/promises";import Tn from"node:path";var O={entry:[],format:["cjs"],outDir:"dist",target:"node",clean:!0};function K(n,t){return{outdir:`${t}/${n.outDir}`,minify:Nn(n),target:n.target,splitting:n.splitting,sourcemap:n.sourcemap,define:n.define,loader:n.loader,drop:n.drop,banner:n.banner,footer:n.footer}}function Nn(n){let{minify:t,minifyWhitespace:e,minifyIdentifiers:r,minifySyntax:s}=n,i=t===!0;return{whitespace:e??i,identifiers:r??i,syntax:s??i}}function _(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Z(n=8){return Math.random().toString(36).substring(2,2+n)}function X(n,t){switch(n){case"esm":return".mjs";case"cjs":return N(t)?".cjs":".js";case"iife":return".global.js"}}function F(n,t){switch(n){case"esm":return".d.mts";case"cjs":return N(t)?".d.cts":".d.ts";case"iife":return".d.ts"}}function N(n){return n==="module"}function T(n){return n>=1000?`${(n/1000).toFixed(2)}s`:`${Math.round(n)}ms`}function V(n){if(!n)return[];return Array.from(new Set([...Object.keys(n.dependencies||{}),...Object.keys(n.peerDependencies||{})]))}function nn(n,t){return n===void 0?t==="esm":n}function q(n){if(n===0)return"0 B";let t=["B","KB","MB","GB"],e=Math.floor(Math.log(n)/Math.log(1024));if(e===0)return`${n} ${t[e]}`;return`${(n/Math.pow(1024,e)).toFixed(2)} ${t[e]}`}function x(n,t=3){return n.split("/").slice(-t).join("/")}async function I(n,t){let e=Tn.join(n,t);try{await Q.rm(e,{recursive:!0,force:!0})}catch(r){throw new w(`Failed to clean output directory: ${r}`)}await Q.mkdir(e,{recursive:!0})}function P(n){return n||O.outDir}function tn(n){return n===void 0?O.clean:n}function en(n){return n.map((t)=>typeof t==="string"?new RegExp(`^${_(t)}($|\\/|\\\\)`):t)}function k(n,t){return en(n.external||[]).concat(V(t).map((e)=>new RegExp(`^${_(e)}($|\\/|\\\\)`)))}function L(n){return en(n.noExternal||[])}import kn from"node:path";import{ResolverFactory as Ln}from"oxc-resolver";import C from"path";var m="\x00virtual:",rn=(n)=>{return{name:"bunup:virtual-dts",resolveId(t,e){if(t.startsWith(m))return t;if(!e?.startsWith(m)||!t.startsWith("."))return null;let r=e.slice(m.length),s=C.resolve(C.dirname(r),t);if(t==="."){let o=C.join(C.dirname(r),"index.d.ts");if(n.has(o))return`${m}${o}`;s=C.dirname(r)}if(n.has(s))return`${m}${s}`;let i=`${s}.d.ts`;if(n.has(i))return`${m}${i}`;if(t.startsWith(".")){let o=C.join(s,"index.d.ts");if(n.has(o))return`${m}${o}`}return null},load(t){if(t.startsWith(m)){let e=t.slice(m.length),r=n.get(e);if(r)return B.add(e),r}return null}}};var sn;function on(n){return{name:"bunup:types-resolve",buildStart(){sn||=new Ln({mainFields:["types"],conditionNames:["types","typings","import","require"],extensions:[".d.ts",".ts"],modules:["node_modules","node_modules/@types"]})},async resolveId(t,e){if(e=e?.replace(m,""),/\0/.test(t))return;if(n){if(!n.some((o)=>{let a=!1;if(typeof o==="string")a=o===t||!!(e&&e.includes(o));else a=o.test(t)||!!(e&&o.test(e));return a}))return}let r=e?kn.dirname(e):process.cwd(),{path:s}=await sn.async(r,t);if(!s)return;if(/[cm]?jsx?$/.test(s)){let i=s.replace(/\.([cm]?)jsx?$/,".d.$1ts");return await Bun.file(i).exists()?i:void 0}return s}}}async function an(n,t,e,r){let s=n.replace(/\.tsx?$/,".d.ts"),i=`${m}${s}`,o=k(e,r),a=L(e),c;try{c=await Dn({input:i,onwarn(g,u){if(["UNRESOLVED_IMPORT","CIRCULAR_DEPENDENCY","EMPTY_BUNDLE"].includes(g.code??""))return;u(g)},plugins:[rn(t),typeof e.dts==="object"&&"resolve"in e.dts&&on(typeof e.dts.resolve==="boolean"?void 0:e.dts.resolve),Hn()],external:(g)=>o.some((u)=>u.test(g))&&!a.some((u)=>u.test(g))});let{output:f}=await c.generate({});if(!f[0]?.code)throw new d("Generated bundle is empty");return f[0].code}catch(f){throw new d(`DTS bundling failed: ${p(f)}`)}finally{if(c)await c.close()}}import v from"node:path";class E{static instance;loggedOnceMessages=new Set;MAX_LABEL_LENGTH=3;MAX_MESSAGE_LENGTH=25;colors={cli:"147",info:"245",warn:"179",error:"174",progress:{ESM:"172",CJS:"108",IIFE:"146",DTS:"110"},default:"252",size:"65"};labels={cli:"CLI",info:"INFO",warn:"WARN",error:"ERROR"};constructor(){}static getInstance(){if(!E.instance)E.instance=new E;return E.instance}dispose(){this.loggedOnceMessages.clear()}shouldLog(n){if(!n?.once)return!0;if(this.loggedOnceMessages.has(n.once))return!1;return this.loggedOnceMessages.add(n.once),!0}formatMessage({colorCode:n,label:t,message:e,size:r,identifier:s,muted:i}){let o=" ".repeat(Math.max(0,this.MAX_LABEL_LENGTH-t.length)),a=i?`\x1B[38;5;${this.colors.info}m${e}\x1B[0m`:e;if(r){let[f,...g]=a.split(" "),u=" ".repeat(Math.max(0,this.MAX_MESSAGE_LENGTH-f.length)),j=s?` \x1B[48;5;${n};38;5;0m ${s} \x1B[0m`:"";return`\x1B[38;5;${n}m${t}\x1B[0m ${o}${f}${u} \x1B[38;5;${this.colors.size}m${r}\x1B[0m ${g.join(" ")}${j}`}let c=s?` \x1B[48;5;${n};38;5;0m ${s} \x1B[0m`:"";return`\x1B[38;5;${n}m${t}\x1B[0m ${o}${a}${c}`}output(n,t={},e=console.log){if(!this.shouldLog(t))return;if(t.verticalSpace)console.log("");if(e(n),t.verticalSpace)console.log("")}cli(n,t={}){let e=this.formatMessage({colorCode:this.colors.cli,label:this.labels.cli,message:n,identifier:t.identifier,muted:t.muted});this.output(e,t)}info(n,t={}){let e=this.formatMessage({colorCode:this.colors.info,label:this.labels.info,message:n,identifier:t.identifier,muted:t.muted});this.output(e,t)}warn(n,t={}){let e=this.formatMessage({colorCode:this.colors.warn,label:this.labels.warn,message:n,identifier:t.identifier,muted:t.muted});this.output(e,t,console.warn)}error(n,t={}){let e=this.formatMessage({colorCode:this.colors.error,label:this.labels.error,message:n,identifier:t.identifier,muted:t.muted});this.output(e,t,console.error)}progress(n,t,e,r){let s=String(n),i=this.colors.default,o,a,c={};if(typeof e==="string")o=e,a=r;else if(e)o=e.size,a=e.identifier,c=e;for(let[g,u]of Object.entries(this.colors.progress))if(s.includes(g)){i=u;break}let f=this.formatMessage({colorCode:i,label:s,message:t,size:o,identifier:a,muted:c.muted});this.output(f,c)}}var l=E.getInstance();var Un=/(?:import|export)(?:[\s\n]*(?:type[\s\n]+)?(?:\*|\{[^}]*\}|[\w$]+)[\s\n]+from[\s\n]*|[\s\n]+)(["'`])([^'"]+)\1/g,Wn=/import\s*\(\s*(["'`])([^'"]+)\1\s*\)/g;async function cn(n,t){let e=new Set([n]),r=[n],s=qn(t),i=ln(t);while(r.length){let o=r.pop();if(!o)continue;try{let a=await Bun.file(o).text(),c=Gn(a);for(let f of c){let g=f.startsWith(".")?v.resolve(v.dirname(o),f):In(f,s,i);if(!g)continue;let u=await _n(g);if(u&&!e.has(u))e.add(u),r.push(u)}}catch(a){l.warn(`Error processing ${o}: ${p(a)}`)}}return e}function Gn(n){let t=new Set;for(let e of[Un,Wn]){let r;while((r=e.exec(n))!==null)t.add(r[2])}return Array.from(t)}async function _n(n){let t=["",".ts",".tsx","/index.ts","/index.tsx"];for(let e of t){let r=`${n}${e}`;if(await Bun.file(r).exists()&&(r.endsWith(".ts")||r.endsWith(".tsx")))return r}return null}function ln(n){let t=v.dirname(n.path||"");return n.data?.compilerOptions?.baseUrl?v.resolve(t,n.data.compilerOptions.baseUrl):t}function qn(n){let t=new Map,e=n.data?.compilerOptions?.paths;if(!e)return t;let r=ln(n);for(let[s,i]of Object.entries(e))if(Array.isArray(i)&&i.length){let o=s.replace(/\*/g,"(.*)"),a=i[0].replace(/\*/g,"$1");t.set(`^${o}$`,v.join(r,a))}return t}function In(n,t,e){for(let[r,s]of t){let i=new RegExp(r),o=n.match(i);if(o)return s.replace("$1",o[1]||"")}return e?v.join(e,n):null}import{isolatedDeclaration as Pn}from"oxc-transform";async function un(n){let t=new Map;return await Promise.all([...n].map(async(e)=>{try{let r=e.replace(/\.tsx?$/,".d.ts");if(!await Bun.file(e).exists())return;let i=await Bun.file(e).text(),{code:o}=Pn(e,i);if(o)t.set(r,o)}catch(r){l.warn(`Failed to generate declaration for ${e}: ${p(r)}`)}})),t}import fn from"node:fs/promises";import Y from"node:path";import{isolatedDeclaration as Yn}from"oxc-transform";async function pn(n,t){let e=Y.resolve(n),r=Y.resolve(e,t);if(!await fn.exists(e))throw new d(`Root directory does not exist: ${e}`);if(!await Bun.file(r).exists())throw new d(`Entry file does not exist: ${r}`);if(!r.endsWith(".ts"))throw new d(`Entry file must be a TypeScript file (.ts): ${r}`);if(Y.relative(e,r).startsWith(".."))throw new d(`Entry file must be within rootDir: ${r}`);return{absoluteRootDir:e,absoluteEntry:r}}async function gn(n){let t=!1;if(await Promise.all([...n].map(async(e)=>{try{let r=e.replace(/\.d\.ts$/,".ts"),s=await Bun.file(r).text(),{errors:i}=Yn(r,s);i.forEach((o)=>{if(!t)console.log(`
6
- `);let a=o.labels[0],c=a?Jn(s,a.start):"",g=`${x(r)}${c}: ${zn(o.message)}`;l.warn(g),t=!0})}catch{}})),t)l.info(`
5
+ `)+"\x1B[0m")},P=(n,t)=>{_(n,t),process.exit(1)};import V from"node:fs/promises";import Hn from"node:path";var C={entry:[],format:["cjs"],outDir:"dist",target:"node",clean:!0};function X(n,t){return{outdir:`${t}/${n.outDir}`,minify:kn(n),target:n.target,splitting:n.splitting,sourcemap:n.sourcemap,define:n.define,loader:n.loader,drop:n.drop,banner:n.banner,footer:n.footer}}function kn(n){let{minify:t,minifyWhitespace:e,minifyIdentifiers:r,minifySyntax:s}=n,i=t===!0;return{whitespace:e??i,identifiers:r??i,syntax:s??i}}function U(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function D(n=8){return Math.random().toString(36).substring(2,2+n)}function F(n,t){switch(n){case"esm":return".mjs";case"cjs":return S(t)?".cjs":".js";case"iife":return".global.js"}}function nn(n,t){switch(n){case"esm":return".d.mts";case"cjs":return S(t)?".d.cts":".d.ts";case"iife":return".d.ts"}}function S(n){return n==="module"}function k(n){return n>=1000?`${(n/1000).toFixed(2)}s`:`${Math.round(n)}ms`}function tn(n){if(!n)return[];return Array.from(new Set([...Object.keys(n.dependencies||{}),...Object.keys(n.peerDependencies||{})]))}function en(n,t){return n===void 0?t==="esm":n}function I(n){if(n===0)return"0 B";let t=["B","KB","MB","GB"],e=Math.floor(Math.log(n)/Math.log(1024));if(e===0)return`${n} ${t[e]}`;return`${(n/Math.pow(1024,e)).toFixed(2)} ${t[e]}`}function h(n,t=3){return n.split("/").slice(-t).join("/")}async function J(n,t){let e=Hn.join(n,t);try{await V.rm(e,{recursive:!0,force:!0})}catch(r){throw new y(`Failed to clean output directory: ${r}`)}await V.mkdir(e,{recursive:!0})}function K(n){return n||C.outDir}function rn(n){return n===void 0?C.clean:n}function sn(n){return n.map((t)=>typeof t==="string"?new RegExp(`^${U(t)}($|\\/|\\\\)`):t)}function H(n,t){return sn(n.external||[]).concat(tn(t).map((e)=>new RegExp(`^${U(e)}($|\\/|\\\\)`)))}function L(n){return sn(n.noExternal||[])}import Ln from"node:path";import{ResolverFactory as Wn}from"oxc-resolver";import E from"path";var m="\x00virtual:",on=(n)=>{return{name:"bunup:virtual-dts",resolveId(t,e){if(t.startsWith(m))return t;if(!e?.startsWith(m)||!t.startsWith("."))return null;let r=e.slice(m.length),s=E.resolve(E.dirname(r),t);if(t==="."){let o=E.join(E.dirname(r),"index.d.ts");if(n.has(o))return`${m}${o}`;s=E.dirname(r)}if(n.has(s))return`${m}${s}`;let i=`${s}.d.ts`;if(n.has(i))return`${m}${i}`;if(t.startsWith(".")){let o=E.join(s,"index.d.ts");if(n.has(o))return`${m}${o}`}return null},load(t){if(t.startsWith(m)){let e=t.slice(m.length),r=n.get(e);if(r)return O.add(e),r}return null}}};var an;function cn(n){return{name:"bunup:types-resolve",buildStart(){an||=new Wn({mainFields:["types"],conditionNames:["types","typings","import","require"],extensions:[".d.ts",".ts"],modules:["node_modules","node_modules/@types"]})},async resolveId(t,e){if(e=e?.replace(m,""),/\0/.test(t))return;if(n){if(!n.some((o)=>{let a=!1;if(typeof o==="string")a=o===t||!!(e&&e.includes(o));else a=o.test(t)||!!(e&&o.test(e));return a}))return}let r=e?Ln.dirname(e):process.cwd(),{path:s}=await an.async(r,t);if(!s)return;if(/[cm]?jsx?$/.test(s)){let i=s.replace(/\.([cm]?)jsx?$/,".d.$1ts");return await Bun.file(i).exists()?i:void 0}return s}}}async function un(n,t,e,r){let s=n.replace(/\.tsx?$/,".d.ts"),i=`${m}${s}`,o=H(e,r),a=L(e),c;try{c=await Tn({input:i,onwarn(p,l){if(["UNRESOLVED_IMPORT","CIRCULAR_DEPENDENCY","EMPTY_BUNDLE"].includes(p.code??""))return;l(p)},plugins:[on(t),typeof e.dts==="object"&&"resolve"in e.dts&&cn(typeof e.dts.resolve==="boolean"?void 0:e.dts.resolve),Gn()],external:(p)=>o.some((l)=>l.test(p))&&!a.some((l)=>l.test(p))});let{output:f}=await c.generate({});if(!f[0]?.code)throw new d("Generated bundle is empty");return f[0].code}catch(f){throw new d(`DTS bundling failed: ${g(f)}`)}finally{if(c)await c.close()}}import v from"node:path";class B{static instance;loggedOnceMessages=new Set;MAX_LABEL_LENGTH=3;MAX_MESSAGE_LENGTH=25;colors={cli:"147",info:"245",warn:"179",error:"174",progress:{ESM:"172",CJS:"108",IIFE:"146",DTS:"110"},default:"252",size:"65"};labels={cli:"CLI",info:"INFO",warn:"WARN",error:"ERROR"};constructor(){}static getInstance(){if(!B.instance)B.instance=new B;return B.instance}dispose(){this.loggedOnceMessages.clear()}shouldLog(n){if(!n?.once)return!0;if(this.loggedOnceMessages.has(n.once))return!1;return this.loggedOnceMessages.add(n.once),!0}formatMessage({colorCode:n,label:t,message:e,size:r,identifier:s,muted:i}){let o=" ".repeat(Math.max(0,this.MAX_LABEL_LENGTH-t.length)),a=i?`\x1B[38;5;${this.colors.info}m${e}\x1B[0m`:e;if(r){let[f,...p]=a.split(" "),l=" ".repeat(Math.max(0,this.MAX_MESSAGE_LENGTH-f.length)),j=s?` \x1B[48;5;${n};38;5;0m ${s} \x1B[0m`:"";return`\x1B[38;5;${n}m${t}\x1B[0m ${o}${f}${l} \x1B[38;5;${this.colors.size}m${r}\x1B[0m ${p.join(" ")}${j}`}let c=s?` \x1B[48;5;${n};38;5;0m ${s} \x1B[0m`:"";return`\x1B[38;5;${n}m${t}\x1B[0m ${o}${a}${c}`}output(n,t={},e=console.log){if(!this.shouldLog(t))return;if(t.verticalSpace)console.log("");if(e(n),t.verticalSpace)console.log("")}cli(n,t={}){let e=this.formatMessage({colorCode:this.colors.cli,label:this.labels.cli,message:n,identifier:t.identifier,muted:t.muted});this.output(e,t)}info(n,t={}){let e=this.formatMessage({colorCode:this.colors.info,label:this.labels.info,message:n,identifier:t.identifier,muted:t.muted});this.output(e,t)}warn(n,t={}){let e=this.formatMessage({colorCode:this.colors.warn,label:this.labels.warn,message:n,identifier:t.identifier,muted:t.muted});this.output(e,t,console.warn)}error(n,t={}){let e=this.formatMessage({colorCode:this.colors.error,label:this.labels.error,message:n,identifier:t.identifier,muted:t.muted});this.output(e,t,console.error)}progress(n,t,e,r){let s=String(n),i=this.colors.default,o,a,c={};if(typeof e==="string")o=e,a=r;else if(e)o=e.size,a=e.identifier,c=e;for(let[p,l]of Object.entries(this.colors.progress))if(s.includes(p)){i=l;break}let f=this.formatMessage({colorCode:i,label:s,message:t,size:o,identifier:a,muted:c.muted});this.output(f,c)}}var u=B.getInstance();var qn=/(?:import|export)(?:[\s\n]*(?:type[\s\n]+)?(?:\*|\{[^}]*\}|[\w$]+)[\s\n]+from[\s\n]*|[\s\n]+)(["'`])([^'"]+)\1/g,Yn=/import\s*\(\s*(["'`])([^'"]+)\1\s*\)/g;async function ln(n,t){let e=new Set([n]),r=[n],s=In(t),i=fn(t);while(r.length){let o=r.pop();if(!o)continue;try{let a=await Bun.file(o).text(),c=_n(a);for(let f of c){let p=f.startsWith(".")?v.resolve(v.dirname(o),f):Jn(f,s,i);if(!p)continue;let l=await Un(p);if(l&&!e.has(l))e.add(l),r.push(l)}}catch(a){u.warn(`Error processing ${o}: ${g(a)}`)}}return e}function _n(n){let t=new Set;for(let e of[qn,Yn]){let r;while((r=e.exec(n))!==null)t.add(r[2])}return Array.from(t)}async function Un(n){let t=["",".ts",".tsx","/index.ts","/index.tsx"];for(let e of t){let r=`${n}${e}`;if(await Bun.file(r).exists()&&(r.endsWith(".ts")||r.endsWith(".tsx")))return r}return null}function fn(n){let t=v.dirname(n.path||"");return n.data?.compilerOptions?.baseUrl?v.resolve(t,n.data.compilerOptions.baseUrl):t}function In(n){let t=new Map,e=n.data?.compilerOptions?.paths;if(!e)return t;let r=fn(n);for(let[s,i]of Object.entries(e))if(Array.isArray(i)&&i.length){let o=s.replace(/\*/g,"(.*)"),a=i[0].replace(/\*/g,"$1");t.set(`^${o}$`,v.join(r,a))}return t}function Jn(n,t,e){for(let[r,s]of t){let i=new RegExp(r),o=n.match(i);if(o)return s.replace("$1",o[1]||"")}return e?v.join(e,n):null}import{isolatedDeclaration as Kn}from"oxc-transform";async function gn(n){let t=new Map;return await Promise.all([...n].map(async(e)=>{try{let r=e.replace(/\.tsx?$/,".d.ts");if(!await Bun.file(e).exists())return;let i=await Bun.file(e).text(),{code:o}=Kn(e,i);if(o)t.set(r,o)}catch(r){u.warn(`Failed to generate declaration for ${e}: ${g(r)}`)}})),t}import pn from"node:fs/promises";import Q from"node:path";import{isolatedDeclaration as Qn}from"oxc-transform";async function mn(n,t){let e=Q.resolve(n),r=Q.resolve(e,t);if(!await pn.exists(e))throw new d(`Root directory does not exist: ${e}`);if(!await Bun.file(r).exists())throw new d(`Entry file does not exist: ${r}`);if(!r.endsWith(".ts"))throw new d(`Entry file must be a TypeScript file (.ts): ${r}`);if(Q.relative(e,r).startsWith(".."))throw new d(`Entry file must be within rootDir: ${r}`);return{absoluteRootDir:e,absoluteEntry:r}}async function dn(n){let t=!1;if(await Promise.all([...n].map(async(e)=>{try{let r=e.replace(/\.d\.ts$/,".ts"),s=await Bun.file(r).text(),{errors:i}=Qn(r,s);i.forEach((o)=>{if(!t)console.log(`
6
+ `);let a=o.labels[0],c=a?Zn(s,a.start):"",p=`${h(r)}${c}: ${zn(o.message)}`;u.warn(p),t=!0})}catch{}})),t)u.info(`
7
7
  You may have noticed some TypeScript warnings above related to missing type annotations. This is because Bunup uses TypeScript's "isolatedDeclarations" approach for generating declaration files. This modern approach requires explicit type annotations on exports for better, more accurate type declarations. Other bundlers might not show these warnings because they use different, potentially less precise methods. Adding the suggested type annotations will not only silence these warnings but also improve the quality of your published type definitions, making your library more reliable for consumers.
8
- `)}function Jn(n,t){if(t===void 0)return"";let e=n.slice(0,t).split(`
9
- `),r=e.length,s=e[e.length-1].length+1;return` (${r}:${s})`}function zn(n){return n.replace(" with --isolatedDeclarations","").replace(" with --isolatedDeclaration","")}async function mn(n,t,e,r,s){let{absoluteEntry:i}=await pn(n,t),o=await cn(i,r),a=await un(o);return an(i,a,e,s)}function S(n){return n.split("/").pop()?.split(".").slice(0,-1).join(".")||""}function M(n){let t=[],e=new Set,r={};function s(i,o){if(e.has(i)){let a=Z(),c=`${i}_${a}`;l.warn(`Output name conflict: "${i}" is used by multiple files.
8
+ `)}function Zn(n,t){if(t===void 0)return"";let e=n.slice(0,t).split(`
9
+ `),r=e.length,s=e[e.length-1].length+1;return` (${r}:${s})`}function zn(n){return n.replace(" with --isolatedDeclarations","").replace(" with --isolatedDeclaration","")}async function xn(n,t,e,r,s){let{absoluteEntry:i}=await mn(n,t),o=await ln(i,r),a=await gn(o);return un(i,a,e,s)}function M(n){return n.split("/").pop()?.split(".").slice(0,-1).join(".")||""}function N(n){let t=[],e=new Set,r={};function s(i,o){if(e.has(i)){let a=D(),c=`${i}_${a}`;u.warn(`Output name conflict: "${i}" is used by multiple files.
10
10
  Bunup uses filenames without extensions as output names by default.
11
11
 
12
12
  ${r[i]} -> ${i}.js
@@ -20,8 +20,8 @@ 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:c,path:o})}else t.push({name:i,path:o}),e.add(i),r[i]=o}if(Array.isArray(n))for(let i of n){let o=S(i);s(o,i)}else if(typeof n==="object")Object.entries(n).forEach(([i,o])=>{s(i,o)});else{let i=S(n);s(i,n)}return t}function dn(n,t){return`[dir]/${n}${t}`}import{loadTsConfig as Kn}from"load-tsconfig";function hn(n){try{return Kn(".",n)}catch(t){return l.warn(`Failed to load tsconfig: ${p(t)}`),{path:n,data:{},files:[]}}}import J from"node:path";async function wn(n){let t=[".ts",".js",".mjs",".cjs",".mts",".cts",".json",".jsonc"];for(let e of t){let r=J.join(n,`bunup.config${e}`);try{if(!await Bun.file(r).exists())continue;let i=await Qn(r,e);if(!i)continue;return{configs:Fn(i,n),configFilePath:r}}catch(s){throw new w(`Failed to load config from ${r}: ${p(s)}`)}}return{configs:[],configFilePath:""}}async function Qn(n,t){if(t===".json"||t===".jsonc")return Zn(n);return Xn(n)}async function Zn(n){try{let t=await Bun.file(n).text(),e=JSON.parse(t);return e.bunup||e}catch(t){throw new Error(`Invalid JSON in config file. ${p(t)}`)}}async function Xn(n){try{let t=await import(`file://${n}`),e=t.default||t;if(!e)return l.warn(`No export found in ${n}. Make sure you're exporting your configuration.`),{};return e}catch(t){throw new Error(`Failed to import config file. ${p(t)}`)}}function Fn(n,t){let e=[];if(Vn(n))nt(n,t,e);else if(Array.isArray(n))tt(n,t,e);else if(n&&typeof n==="object")e.push({options:n,rootDir:t});else throw new Error("Invalid configuration format. Expected an object, array, or workspace configuration.");return e}function Vn(n){return Array.isArray(n)&&n.length>0&&n.every((t)=>typeof t==="object"&&t!==null&&("name"in t)&&("root"in t)&&("config"in t))}function nt(n,t,e){for(let r of n){let s=J.resolve(t,r.root);if(Array.isArray(r.config))for(let i of r.config)e.push({options:{name:r.name,...i},rootDir:s});else e.push({options:{name:r.name,...r.config},rootDir:s})}}function tt(n,t,e){for(let r of n){if(!r||typeof r!=="object")throw new Error("Invalid configuration item. Expected an object.");e.push({options:r,rootDir:t})}}async function xn(n){let t=J.join(n,"package.json");try{if(!await Bun.file(t).exists())return{packageJson:null,path:t};let r=await Bun.file(t).text();return{packageJson:JSON.parse(r),path:t}}catch(e){return l.warn(`Failed to load package.json at ${t}: ${p(e)}`),{packageJson:null,path:t}}}function yn(n,t){return{name:"bunup:external-plugin",setup(e){e.onResolve({filter:/.*/},(r)=>{let s=r.path;if(n.some((o)=>o.test(s))&&!t.some((o)=>o.test(s)))return{path:s,external:!0};return null})}}}var B=new Set;async function D(n,t){if(!n.entry||n.entry.length===0||!n.outDir)throw new w("Nothing to build. Please make sure you have provided a proper bunup configuration or cli arguments.");let{packageJson:e,path:r}=await xn(t);if(e)l.cli(`Using package.json: ${x(r,2)}`,{muted:!0,once:r,identifier:n.name});let s=e?.type,i=k(n,e),o=L(n),a=[yn(i,o)],c=M(n.entry),f=K(n,t),g=n.format.flatMap((u)=>c.map((j)=>{return et(n,t,j,u,s,a,f)}));if(await Promise.all(g),n.dts){let u=hn(n.preferredTsconfigPath);if(u.path)l.cli(`Using tsconfig: ${x(u.path,2)}`,{muted:!0,once:u.path,identifier:n.name});let j=n.format.filter((b)=>{if(b==="iife"&&!N(s)&&n.format.includes("cjs"))return!1;return!0}),vn=typeof n.dts==="object"&&n.dts.entry?M(n.dts.entry):c;try{await Promise.all(vn.map(async(b)=>{let Rn=await mn(t,b.path,n,u,e);await Promise.all(j.map(async(jn)=>{let An=F(jn,s),G=`${t}/${n.outDir}/${b.name}${An}`;await Bun.write(G,Rn);let Sn=Bun.file(G).size||0;l.progress("DTS",x(G),q(Sn),n.name)}))}))}catch(b){throw new d(p(b))}}}async function et(n,t,e,r,s,i,o){let a=X(r,s),c=await Bun.build({...o,entrypoints:[`${t}/${e.path}`],format:r,naming:{entry:dn(e.name,a)},splitting:nn(n.splitting,r),plugins:i,throw:!1});if(!c.success)c.logs.forEach((u)=>{if(u.level==="error")throw new w(u.message);else if(u.level==="warning")l.warn(u.message);else if(u.level==="info")l.info(u.message)});let f=`${t}/${n.outDir}/${e.name}${a}`,g=Bun.file(f).size||0;l.progress(r.toUpperCase(),x(f),q(g),n.name)}var H="0.3.32";var bn="https://bun.sh/docs/installation",$n="https://bunup.arshadyaseen.com/#cli-options";function y(n){return(t,e)=>{e[n]=t===!0?!0:t==="true"}}function R(n){return(t,e)=>{if(typeof t==="string")e[n]=t;else throw new h(`Option --${n} requires a string value`)}}function On(n){return(t,e)=>{if(typeof t==="string")e[n]=t.split(",");else throw new h(`Option --${n} requires a string value`)}}function st(){console.log(`
23
+ See: https://bunup.arshadyaseen.com/#named-entries`,{muted:!0,verticalSpace:!0}),t.push({name:c,path:o})}else t.push({name:i,path:o}),e.add(i),r[i]=o}if(Array.isArray(n))for(let i of n){let o=M(i);s(o,i)}else if(typeof n==="object")Object.entries(n).forEach(([i,o])=>{s(i,o)});else{let i=M(n);s(i,n)}return t}function yn(n,t){return`[dir]/${n}${t}`}import{loadTsConfig as Pn}from"load-tsconfig";function hn(n){try{return Pn(".",n)}catch(t){return u.warn(`Failed to load tsconfig: ${g(t)}`),{path:n,data:{},files:[]}}}import Z from"node:path";async function wn(n){let t=[".ts",".js",".mjs",".cjs",".mts",".cts",".json",".jsonc"];for(let e of t){let r=Z.join(n,`bunup.config${e}`);try{if(!await Bun.file(r).exists())continue;let i=await Xn(r,e);if(!i)continue;return{configs:Fn(i,n),configFilePath:r}}catch(s){throw new y(`Failed to load config from ${r}: ${g(s)}`)}}return{configs:[],configFilePath:""}}async function Xn(n,t){if(t===".json"||t===".jsonc")return Vn(n);return Dn(n)}async function Vn(n){try{let t=await Bun.file(n).text(),e=JSON.parse(t);return e.bunup||e}catch(t){throw new Error(`Invalid JSON in config file. ${g(t)}`)}}async function Dn(n){try{let t=await import(`file://${n}`),e=t.default||t;if(!e)return u.warn(`No export found in ${n}. Make sure you're exporting your configuration.`),{};return e}catch(t){throw new Error(`Failed to import config file. ${g(t)}`)}}function Fn(n,t){let e=[];if(nt(n))tt(n,t,e);else if(Array.isArray(n))et(n,t,e);else if(n&&typeof n==="object")e.push({options:n,rootDir:t});else throw new Error("Invalid configuration format. Expected an object, array, or workspace configuration.");return e}function nt(n){return Array.isArray(n)&&n.length>0&&n.every((t)=>typeof t==="object"&&t!==null&&("name"in t)&&("root"in t)&&("config"in t))}function tt(n,t,e){for(let r of n){let s=Z.resolve(t,r.root);if(Array.isArray(r.config))for(let i of r.config)e.push({options:{name:r.name,...i},rootDir:s});else e.push({options:{name:r.name,...r.config},rootDir:s})}}function et(n,t,e){for(let r of n){if(!r||typeof r!=="object")throw new Error("Invalid configuration item. Expected an object.");e.push({options:r,rootDir:t})}}async function bn(n){let t=Z.join(n,"package.json");try{if(!await Bun.file(t).exists())return{packageJson:null,path:t};let r=await Bun.file(t).text();return{packageJson:JSON.parse(r),path:t}}catch(e){return u.warn(`Failed to load package.json at ${t}: ${g(e)}`),{packageJson:null,path:t}}}function $n(n,t){return{name:"bunup:external-plugin",setup(e){e.onResolve({filter:/.*/},(r)=>{let s=r.path;if(n.some((o)=>o.test(s))&&!t.some((o)=>o.test(s)))return{path:s,external:!0};return null})}}}var O=new Set;async function W(n,t){if(!n.entry||n.entry.length===0||!n.outDir)throw new y("Nothing to build. Please make sure you have provided a proper bunup configuration or cli arguments.");let{packageJson:e,path:r}=await bn(t);if(e)u.cli(`Using package.json: ${h(r,2)}`,{muted:!0,once:r,identifier:n.name});let s=e?.type,i=H(n,e),o=L(n),a=[$n(i,o)],c=N(n.entry),f=X(n,t),p=n.format.flatMap((l)=>c.map((j)=>{return rt(n,t,j,l,s,a,f)}));if(await Promise.all(p),n.dts){let l=hn(n.preferredTsconfigPath);if(l.path)u.cli(`Using tsconfig: ${h(l.path,2)}`,{muted:!0,once:l.path,identifier:n.name});let j=n.format.filter((b)=>{if(b==="iife"&&!S(s)&&n.format.includes("cjs"))return!1;return!0}),jn=typeof n.dts==="object"&&n.dts.entry?N(n.dts.entry):c;try{await Promise.all(jn.map(async(b)=>{let An=await xn(t,b.path,n,l,e);await Promise.all(j.map(async(Mn)=>{let Nn=nn(Mn,s),Y=`${t}/${n.outDir}/${b.name}${Nn}`;await Bun.write(Y,An);let Sn=Bun.file(Y).size||0;u.progress("DTS",h(Y),I(Sn),n.name)}))}))}catch(b){throw new d(g(b))}}}async function rt(n,t,e,r,s,i,o){let a=F(r,s),c=await Bun.build({...o,entrypoints:[`${t}/${e.path}`],format:r,naming:{entry:yn(e.name,a)},splitting:en(n.splitting,r),plugins:i,throw:!1});if(!c.success)c.logs.forEach((l)=>{if(l.level==="error")throw new y(l.message);else if(l.level==="warning")u.warn(l.message);else if(l.level==="info")u.info(l.message)});let f=`${t}/${n.outDir}/${e.name}${a}`,p=Bun.file(f).size||0;u.progress(r.toUpperCase(),h(f),I(p),n.name)}var T="0.3.34";var Cn="https://bun.sh/docs/installation",En="https://bunup.arshadyaseen.com/#cli-options";function w(n){return(t,e)=>{e[n]=t===!0?!0:t==="true"}}function R(n){return(t,e)=>{if(typeof t==="string")e[n]=t;else throw new x(`Option --${n} requires a string value`)}}function On(n){return(t,e)=>{if(typeof t==="string")e[n]=t.split(",");else throw new x(`Option --${n} requires a string value`)}}function it(){console.log(`
24
24
  Bunup - An extremely fast, zero-config bundler for JavaScript and TypeScript, powered by Bun.
25
- `),console.log("For more information on available options, visit:"),console.log(`\x1B[36m\x1B[4m${$n}\x1B[0m
26
- `),process.exit(0)}function it(){console.log(H),process.exit(0)}var ot={name:{flags:["n","name"],handler:R("name")},format:{flags:["f","format"],handler:(n,t)=>{if(typeof n==="string")t.format=n.split(",");else throw new h("Option --format requires a string value")}},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:["b","banner"],handler:R("banner")},footer:{flags:["f","footer"],handler:R("footer")},external:{flags:["e","external"],handler:On("external")},sourcemap:{flags:["sm","sourcemap"],handler:R("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:On("noExternal")}},at={help:{flags:["h","help"],handler:()=>st()},version:{flags:["v","version"],handler:()=>it()}},U={};for(let n of Object.values(ot))if(n)for(let t of n.flags)U[t]=n.handler;for(let n of Object.values(at))for(let t of n.flags)U[t]=n.handler;function Cn(n){let t={},e={},r=0;while(r<n.length){let s=n[r];if(s.startsWith("--")){let i,o;if(s.includes("=")){let[a,c]=s.slice(2).split("=",2);i=a,o=c}else{i=s.slice(2);let a=n[r+1];if(o=a&&!a.startsWith("-")?a:!0,typeof o==="string")r++}if(i==="entry")if(typeof o==="string"){let a=S(o);if(e[a])l.warn(`Duplicate entry name '${a}' derived from '${o}'. Overwriting previous entry.`);e[a]=o}else throw new h("Option --entry requires a string value");else if(i.startsWith("entry.")){let a=i.slice(6);if(typeof o==="string"){if(e[a])l.warn(`Duplicate entry name '${a}' provided via --entry.${a}. Overwriting previous entry.`);e[a]=o}else throw new h(`Option --entry.${a} requires a string value`)}else{let a=U[i];if(a)a(o,t);else throw new h(`Unknown option: --${i}`)}}else if(s.startsWith("-")){let i=s.slice(1),o=n[r+1],a=o&&!o.startsWith("-")?o:!0;if(typeof a==="string")r++;let c=U[i];if(c)c(a,t);else throw new h(`Unknown option: -${i}`)}else{let i=S(s);if(e[i])l.warn(`Duplicate entry name '${i}' derived from positional argument '${s}'. Overwriting previous entry.`);e[i]=s}r++}if(Object.keys(e).length>0)t.entry=e;return t}(()=>{if(typeof Bun==="undefined")throw new h(`Bunup requires Bun to run.
27
- To install Bun, visit `+bn)})();import W from"node:path";import ct from"chokidar";async function Bn(n,t){let e=new Set,r=M(n.entry);r.forEach((a)=>{let c=W.resolve(t,a.path),f=W.dirname(c);e.add(f)});let s=ct.watch(Array.from(e),{persistent:!0,awaitWriteFinish:{stabilityThreshold:100,pollInterval:50},ignoreInitial:!0,atomic:!0,ignorePermissionErrors:!0,ignored:[/[\\/]\.git[\\/]/,/[\\/]node_modules[\\/]/,W.join(t,n.outDir)]}),i=!1,o=async(a=!1)=>{if(i)return;i=!0;try{let c=performance.now();if(await D({...n,entry:r.map((f)=>f.path),clean:!1},t),n.onBuildSuccess?.(),!a)l.cli(`\uD83D\uDCE6 Rebuild finished in ${T(performance.now()-c)}`)}catch(c){throw new A(`Build failed: ${p(c)}`)}finally{i=!1}};s.on("change",(a)=>{let c=W.relative(t,a);l.cli(`File changed: ${c}`),o()}),s.on("error",(a)=>{throw new A(`Watcher error: ${p(a)}`)}),await o(!0)}async function lt(n=Bun.argv.slice(2)){let t=Cn(n),{configs:e,configFilePath:r}=await wn(process.cwd());if(l.cli(`Using bunup v${H} and bun v${Bun.version}`,{muted:!0}),r)l.cli(`Using config file: ${x(r,2)}`,{muted:!0});let s=performance.now();if(l.cli("Build started"),e.length===0){let a={...O,...t},c=process.cwd();if(a.clean)I(c,P(a.outDir));await En(a,c)}else{for(let{options:a,rootDir:c}of e)if(tn(a.clean))I(c,P(a.outDir));await Promise.all(e.map(async({options:a,rootDir:c})=>{let f={...O,...a,...t};await En(f,c)}))}let i=performance.now()-s,o=T(i);if(l.cli(`\u26A1\uFE0F Build completed in ${o}`),B.size>0)await gn(B),B.clear();if(t.watch)l.cli("\uD83D\uDC40 Watching for file changes");if(!t.watch)process.exit(0);l.dispose()}async function En(n,t){if(n.watch)await Bn(n,t);else await D(n,t),n.onBuildSuccess?.()}lt().catch((n)=>z(n));export{lt as main};
25
+ `),console.log("For more information on available options, visit:"),console.log(`\x1B[36m\x1B[4m${En}\x1B[0m
26
+ `),process.exit(0)}function ot(){console.log(T),process.exit(0)}var at={name:{flags:["n","name"],handler:R("name")},format:{flags:["f","format"],handler:(n,t)=>{if(typeof n==="string")t.format=n.split(",");else throw new x("Option --format requires a string value")}},outDir:{flags:["o","out-dir"],handler:R("outDir")},minify:{flags:["m","minify"],handler:w("minify")},watch:{flags:["w","watch"],handler:w("watch")},dts:{flags:["d","dts"],handler:w("dts")},banner:{flags:["b","banner"],handler:R("banner")},footer:{flags:["f","footer"],handler:R("footer")},external:{flags:["e","external"],handler:On("external")},sourcemap:{flags:["sm","sourcemap"],handler:R("sourcemap")},target:{flags:["t","target"],handler:R("target")},minifyWhitespace:{flags:["mw","minify-whitespace"],handler:w("minifyWhitespace")},minifyIdentifiers:{flags:["mi","minify-identifiers"],handler:w("minifyIdentifiers")},minifySyntax:{flags:["ms","minify-syntax"],handler:w("minifySyntax")},clean:{flags:["c","clean"],handler:w("clean")},splitting:{flags:["s","splitting"],handler:w("splitting")},noExternal:{flags:["ne","no-external"],handler:On("noExternal")}},ct={help:{flags:["h","help"],handler:()=>it()},version:{flags:["v","version"],handler:()=>ot()}},G={};for(let n of Object.values(at))if(n)for(let t of n.flags)G[t]=n.handler;for(let n of Object.values(ct))for(let t of n.flags)G[t]=n.handler;function Bn(n){let t={},e={},r=0;while(r<n.length){let s=n[r];if(s.startsWith("--")){let i,o;if(s.includes("=")){let[a,c]=s.slice(2).split("=",2);i=a,o=c}else{i=s.slice(2);let a=n[r+1];if(o=a&&!a.startsWith("-")?a:!0,typeof o==="string")r++}if(i==="entry")if(typeof o==="string"){let a=M(o);if(e[a])u.warn(`Duplicate entry name '${a}' derived from '${o}'. Overwriting previous entry.`);e[a]=o}else throw new x("Option --entry requires a string value");else if(i.startsWith("entry.")){let a=i.slice(6);if(typeof o==="string"){if(e[a])u.warn(`Duplicate entry name '${a}' provided via --entry.${a}. Overwriting previous entry.`);e[a]=o}else throw new x(`Option --entry.${a} requires a string value`)}else{let a=G[i];if(a)a(o,t);else throw new x(`Unknown option: --${i}`)}}else if(s.startsWith("-")){let i=s.slice(1),o=n[r+1],a=o&&!o.startsWith("-")?o:!0;if(typeof a==="string")r++;let c=G[i];if(c)c(a,t);else throw new x(`Unknown option: -${i}`)}else{let i=M(s);if(e[i])u.warn(`Duplicate entry name '${i}' derived from positional argument '${s}'. Overwriting previous entry.`);e[i]=s}r++}if(Object.keys(e).length>0)t.entry=e;return t}(()=>{if(typeof Bun==="undefined")throw new x(`Bunup requires Bun to run.
27
+ To install Bun, visit `+Cn)})();import q from"node:path";import ut from"chokidar";async function vn(n,t){let e=new Set,r=N(n.entry);r.forEach((a)=>{let c=q.resolve(t,a.path),f=q.dirname(c);e.add(f)});let s=ut.watch(Array.from(e),{persistent:!0,awaitWriteFinish:{stabilityThreshold:100,pollInterval:50},ignoreInitial:!0,atomic:!0,ignorePermissionErrors:!0,ignored:[/[\\/]\.git[\\/]/,/[\\/]node_modules[\\/]/,q.join(t,n.outDir)]}),i=!1,o=async(a=!1)=>{if(i)return;i=!0;try{let c=performance.now();if(await W({...n,entry:r.map((f)=>f.path),clean:!1},t),n.onBuildSuccess?.(),!a)u.cli(`\uD83D\uDCE6 Rebuild finished in ${k(performance.now()-c)}`);await z()}catch(c){throw new A(`Build failed: ${g(c)}`)}finally{i=!1}};s.on("change",(a)=>{let c=q.relative(t,a);u.cli(`File changed: ${c}`,{muted:!0}),o()}),s.on("error",(a)=>{throw new A(`Watcher error: ${g(a)}`)}),await o(!0)}async function lt(n=Bun.argv.slice(2)){let t=Bn(n),{configs:e,configFilePath:r}=await wn(process.cwd());if(u.cli(`Using bunup v${T} and bun v${Bun.version}`,{muted:!0}),r)u.cli(`Using config file: ${h(r,2)}`,{muted:!0});let s=performance.now();if(u.cli("Build started"),e.length===0){let a={...C,...t},c=process.cwd();if(a.clean)J(c,K(a.outDir));await Rn(a,c)}else{for(let{options:a,rootDir:c}of e)if(rn(a.clean))J(c,K(a.outDir));await Promise.all(e.map(async({options:a,rootDir:c})=>{let f={...C,...a,...t};await Rn(f,c)}))}let i=performance.now()-s,o=k(i);if(u.cli(`\u26A1\uFE0F Build completed in ${o}`),await z(),t.watch)u.cli("\uD83D\uDC40 Watching for file changes");if(!t.watch)process.exit(0);u.dispose()}async function z(){if(O.size>0)await dn(O),O.clear()}async function Rn(n,t){if(n.watch)try{await vn(n,t)}catch(e){_(e)}else await W(n,t),n.onBuildSuccess?.()}lt().catch((n)=>P(n));export{z as validateDtsFiles,lt as main};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunup",
3
- "version": "0.3.32",
3
+ "version": "0.3.34",
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",
@@ -24,7 +24,7 @@
24
24
  "prettier": "^3.5.3",
25
25
  "typescript": "^5.8.2",
26
26
  "vitest": "^2.1.9",
27
- "create-bunup": "0.3.32"
27
+ "create-bunup": "0.3.34"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "typescript": ">=4.5.0"