bunup 0.3.33 → 0.3.35

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/build/cli.mjs +9 -9
  2. package/package.json +5 -3
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 Hn}from"rolldown";import{dts as Un}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 M 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 w)s="BUILD ERROR";else if(n instanceof d)s="DTS ERROR";else if(n instanceof h)s="CLI ERROR";else if(n instanceof M)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")},Q=(n,t)=>{_(n,t),process.exit(1)};import X from"node:fs/promises";import kn from"node:path";var O={entry:[],format:["cjs"],outDir:"dist",target:"node",clean:!0};function Z(n,t){return{outdir:`${t}/${n.outDir}`,minify:Tn(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 Tn(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 q(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function F(n=8){return Math.random().toString(36).substring(2,2+n)}function V(n,t){switch(n){case"esm":return".mjs";case"cjs":return N(t)?".cjs":".js";case"iife":return".global.js"}}function nn(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 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 x(n,t=3){return n.split("/").slice(-t).join("/")}async function P(n,t){let e=kn.join(n,t);try{await X.rm(e,{recursive:!0,force:!0})}catch(r){throw new w(`Failed to clean output directory: ${r}`)}await X.mkdir(e,{recursive:!0})}function Y(n){return n||O.outDir}function rn(n){return n===void 0?O.clean:n}function sn(n){return n.map((t)=>typeof t==="string"?new RegExp(`^${q(t)}($|\\/|\\\\)`):t)}function k(n,t){return sn(n.external||[]).concat(tn(t).map((e)=>new RegExp(`^${q(e)}($|\\/|\\\\)`)))}function L(n){return sn(n.noExternal||[])}import Ln from"node:path";import{ResolverFactory as Dn}from"oxc-resolver";import C 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=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 an;function cn(n){return{name:"bunup:types-resolve",buildStart(){an||=new Dn({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 ln(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 Hn({input:i,onwarn(p,u){if(["UNRESOLVED_IMPORT","CIRCULAR_DEPENDENCY","EMPTY_BUNDLE"].includes(p.code??""))return;u(p)},plugins:[on(t),typeof e.dts==="object"&&"resolve"in e.dts&&cn(typeof e.dts.resolve==="boolean"?void 0:e.dts.resolve),Un()],external:(p)=>o.some((u)=>u.test(p))&&!a.some((u)=>u.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 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,...p]=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 ${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,u]of Object.entries(this.colors.progress))if(s.includes(p)){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 Wn=/(?:import|export)(?:[\s\n]*(?:type[\s\n]+)?(?:\*|\{[^}]*\}|[\w$]+)[\s\n]+from[\s\n]*|[\s\n]+)(["'`])([^'"]+)\1/g,Gn=/import\s*\(\s*(["'`])([^'"]+)\1\s*\)/g;async function un(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):Pn(f,s,i);if(!p)continue;let u=await qn(p);if(u&&!e.has(u))e.add(u),r.push(u)}}catch(a){l.warn(`Error processing ${o}: ${g(a)}`)}}return e}function _n(n){let t=new Set;for(let e of[Wn,Gn]){let r;while((r=e.exec(n))!==null)t.add(r[2])}return Array.from(t)}async function qn(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 Pn(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 Yn}from"oxc-transform";async function pn(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}=Yn(e,i);if(o)t.set(r,o)}catch(r){l.warn(`Failed to generate declaration for ${e}: ${g(r)}`)}})),t}import gn from"node:fs/promises";import J from"node:path";import{isolatedDeclaration as Jn}from"oxc-transform";async function mn(n,t){let e=J.resolve(n),r=J.resolve(e,t);if(!await gn.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(J.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}=Jn(r,s);i.forEach((o)=>{if(!t)console.log(`
6
+ `);let a=o.labels[0],c=a?zn(s,a.start):"",p=`${x(r)}${c}: ${Kn(o.message)}`;l.warn(p),t=!0})}catch{}})),t)l.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 Kn(n){return n.replace(" with --isolatedDeclarations","").replace(" with --isolatedDeclaration","")}async function hn(n,t,e,r,s){let{absoluteEntry:i}=await mn(n,t),o=await un(i,r),a=await pn(o);return ln(i,a,e,s)}function A(n){return n.split("/").pop()?.split(".").slice(0,-1).join(".")||""}function S(n){let t=[],e=new Set,r={};function s(i,o){if(e.has(i)){let a=F(),c=`${i}_${a}`;l.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.33";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=A(i);s(o,i)}else if(typeof n==="object")Object.entries(n).forEach(([i,o])=>{s(i,o)});else{let i=A(n);s(i,n)}return t}function wn(n,t){return`[dir]/${n}${t}`}import{loadTsConfig as Qn}from"load-tsconfig";function xn(n){try{return Qn(".",n)}catch(t){return l.warn(`Failed to load tsconfig: ${g(t)}`),{path:n,data:{},files:[]}}}import z from"node:path";async function yn(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 Zn(r,e);if(!i)continue;return{configs:Vn(i,n),configFilePath:r}}catch(s){throw new w(`Failed to load config from ${r}: ${g(s)}`)}}return{configs:[],configFilePath:""}}async function Zn(n,t){if(t===".json"||t===".jsonc")return Xn(n);return Fn(n)}async function Xn(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 Fn(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. ${g(t)}`)}}function Vn(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 l.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 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 bn(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=[$n(i,o)],c=S(n.entry),f=Z(n,t),p=n.format.flatMap((u)=>c.map((j)=>{return rt(n,t,j,u,s,a,f)}));if(await Promise.all(p),n.dts){let u=xn(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}),jn=typeof n.dts==="object"&&n.dts.entry?S(n.dts.entry):c;try{await Promise.all(jn.map(async(b)=>{let An=await hn(t,b.path,n,u,e);await Promise.all(j.map(async(Sn)=>{let Mn=nn(Sn,s),G=`${t}/${n.outDir}/${b.name}${Mn}`;await Bun.write(G,An);let Nn=Bun.file(G).size||0;l.progress("DTS",x(G),I(Nn),n.name)}))}))}catch(b){throw new d(g(b))}}}async function rt(n,t,e,r,s,i,o){let a=V(r,s),c=await Bun.build({...o,entrypoints:[`${t}/${e.path}`],format:r,naming:{entry:wn(e.name,a)},splitting:en(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}`,p=Bun.file(f).size||0;l.progress(r.toUpperCase(),x(f),I(p),n.name)}var H="0.3.35";var On="https://bun.sh/docs/installation",Cn="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 Bn(n){return(t,e)=>{if(typeof t==="string")e[n]=t.split(",");else throw new h(`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${Cn}\x1B[0m
26
+ `),process.exit(0)}function ot(){console.log(H),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 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:Bn("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:Bn("noExternal")}},ct={help:{flags:["h","help"],handler:()=>it()},version:{flags:["v","version"],handler:()=>ot()}},U={};for(let n of Object.values(at))if(n)for(let t of n.flags)U[t]=n.handler;for(let n of Object.values(ct))for(let t of n.flags)U[t]=n.handler;function En(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=A(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=A(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 `+On)})();import W from"node:path";import lt from"chokidar";async function vn(n,t){let e=new Set,r=S(n.entry);r.forEach((a)=>{let c=W.resolve(t,a.path),f=W.dirname(c);e.add(f)});let s=lt.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)}`);await K()}catch(c){_(c)}finally{i=!1}};s.on("change",(a)=>{let c=W.relative(t,a);l.cli(`File changed: ${c}`,{muted:!0}),o()}),s.on("error",(a)=>{throw new M(`Watcher error: ${g(a)}`)}),await o(!0)}async function ut(n=Bun.argv.slice(2)){let t=En(n),{configs:e,configFilePath:r}=await yn(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)P(c,Y(a.outDir));await Rn(a,c)}else{for(let{options:a,rootDir:c}of e)if(rn(a.clean))P(c,Y(a.outDir));await Promise.all(e.map(async({options:a,rootDir:c})=>{let f={...O,...a,...t};await Rn(f,c)}))}let i=performance.now()-s,o=T(i);if(l.cli(`\u26A1\uFE0F Build completed in ${o}`),await K(),t.watch)l.cli("\uD83D\uDC40 Watching for file changes");if(!t.watch)process.exit(0);l.dispose()}async function K(){if(B.size>0)await dn(B),B.clear()}async function Rn(n,t){if(n.watch)await vn(n,t);else await D(n,t),n.onBuildSuccess?.()}ut().catch((n)=>Q(n));export{K as validateDtsFiles,ut as main};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunup",
3
- "version": "0.3.33",
3
+ "version": "0.3.35",
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.33"
27
+ "create-bunup": "0.3.35"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "typescript": ">=4.5.0"
@@ -73,8 +73,10 @@
73
73
  "lint": "eslint src --fix",
74
74
  "format": "prettier --write .",
75
75
  "release": "bumpp -r --commit --push --tag",
76
+ "release:ci": "bumpp patch --commit --push --tag --yes",
76
77
  "publish:ci": "pnpm --filter bunup --filter create-bunup publish --access public --no-git-checks",
77
78
  "benchmark": "pnpm -C benchmarks benchmark",
78
- "upgrade-deps": "pnpx taze -r -w && pnpm install && git add . && git commit -m 'chore: upgrade deps' && pnpm release --yes"
79
+ "upgrade-deps": "pnpx taze -r -w && pnpm install && git add . && git commit -m 'chore: upgrade deps' && pnpm release:ci",
80
+ "update-create-bunup-starter-root-dev-dependencies": "pnpm -C create-bunup update-starter-root-dev-dependencies"
79
81
  }
80
82
  }