bunup 0.3.34 → 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 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(`
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")},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(`
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 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.
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=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(`
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${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};
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.34",
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.34"
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
  }