@visulima/packem 1.0.0-alpha.50 → 1.0.0-alpha.52

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 (29) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cli.mjs +46 -46
  3. package/dist/config.d.cts +2 -2
  4. package/dist/config.d.mts +2 -2
  5. package/dist/config.d.ts +2 -2
  6. package/dist/create-bundler.cjs +48 -48
  7. package/dist/create-bundler.d.cts +1 -1
  8. package/dist/create-bundler.d.mts +1 -1
  9. package/dist/create-bundler.d.ts +1 -1
  10. package/dist/create-bundler.mjs +46 -46
  11. package/dist/rollup/plugins/oxc/isolated-declarations-oxc-plugin.cjs +1 -0
  12. package/dist/rollup/plugins/oxc/isolated-declarations-oxc-plugin.d.cts +26 -0
  13. package/dist/rollup/plugins/oxc/isolated-declarations-oxc-plugin.d.mts +26 -0
  14. package/dist/rollup/plugins/oxc/isolated-declarations-oxc-plugin.d.ts +26 -0
  15. package/dist/rollup/plugins/oxc/isolated-declarations-oxc-plugin.mjs +9 -0
  16. package/dist/rollup/plugins/swc/isolated-declarations-swc-plugin.cjs +1 -0
  17. package/dist/rollup/plugins/swc/isolated-declarations-swc-plugin.d.cts +26 -0
  18. package/dist/rollup/plugins/swc/isolated-declarations-swc-plugin.d.mts +26 -0
  19. package/dist/rollup/plugins/swc/isolated-declarations-swc-plugin.d.ts +26 -0
  20. package/dist/rollup/plugins/swc/isolated-declarations-swc-plugin.mjs +9 -0
  21. package/dist/shared/{packem.Dyuh0rNc.d.mts → packem.CXBj45xL.d.mts} +13 -1
  22. package/dist/shared/{packem.7EZm-4xL.d.ts → packem.EAyscW7M.d.ts} +13 -1
  23. package/dist/shared/{packem.CvCdTosN.d.cts → packem.zptSY3F2.d.cts} +13 -1
  24. package/package.json +30 -5
  25. /package/dist/rollup/plugins/swc/{index.cjs → swc-plugin.cjs} +0 -0
  26. /package/dist/rollup/plugins/swc/{index.d.cts → swc-plugin.d.cts} +0 -0
  27. /package/dist/rollup/plugins/swc/{index.d.mts → swc-plugin.d.mts} +0 -0
  28. /package/dist/rollup/plugins/swc/{index.d.ts → swc-plugin.d.ts} +0 -0
  29. /package/dist/rollup/plugins/swc/{index.mjs → swc-plugin.mjs} +0 -0
package/dist/config.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as BuildConfig, a as BuildPreset } from './shared/packem.CvCdTosN.cjs';
2
- export { b as BuildHooks } from './shared/packem.CvCdTosN.cjs';
1
+ import { B as BuildConfig, a as BuildPreset } from './shared/packem.zptSY3F2.cjs';
2
+ export { b as BuildHooks } from './shared/packem.zptSY3F2.cjs';
3
3
  import '@rollup/plugin-alias';
4
4
  import '@rollup/plugin-commonjs';
5
5
  import '@rollup/plugin-json';
package/dist/config.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as BuildConfig, a as BuildPreset } from './shared/packem.Dyuh0rNc.mjs';
2
- export { b as BuildHooks } from './shared/packem.Dyuh0rNc.mjs';
1
+ import { B as BuildConfig, a as BuildPreset } from './shared/packem.CXBj45xL.mjs';
2
+ export { b as BuildHooks } from './shared/packem.CXBj45xL.mjs';
3
3
  import '@rollup/plugin-alias';
4
4
  import '@rollup/plugin-commonjs';
5
5
  import '@rollup/plugin-json';
package/dist/config.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as BuildConfig, a as BuildPreset } from './shared/packem.7EZm-4xL.js';
2
- export { b as BuildHooks } from './shared/packem.7EZm-4xL.js';
1
+ import { B as BuildConfig, a as BuildPreset } from './shared/packem.EAyscW7M.js';
2
+ export { b as BuildHooks } from './shared/packem.EAyscW7M.js';
3
3
  import '@rollup/plugin-alias';
4
4
  import '@rollup/plugin-commonjs';
5
5
  import '@rollup/plugin-json';
@@ -1,36 +1,36 @@
1
- "use strict";var st=Object.defineProperty;var f=(e,t)=>st(e,"name",{value:t,configurable:!0});const z=require("node:fs/promises"),it=require("node:module"),x=require("node:process"),g=require("@visulima/colorize"),v=require("@visulima/fs"),at=require("@visulima/fs/error"),_=require("@visulima/humanizer"),lt=require("@visulima/package/package-json"),m=require("@visulima/path"),le=require("@visulima/tsconfig"),ct=require("defu"),pt=require("hookable"),R=require("rollup"),S=require("./shared/packem.NVRVuzg1.cjs"),je=require("node:url"),J=require("mlly"),ut=require("magic-string"),dt=require("jiti"),U=require("node:fs"),mt=require("@rollup/plugin-alias"),ft=require("@rollup/plugin-commonjs"),gt=require("@rollup/plugin-dynamic-import-vars"),ke=require("@rollup/plugin-node-resolve"),ht=require("@rollup/plugin-replace"),yt=require("@rollup/plugin-wasm"),vt=require("rollup-plugin-polyfill-node"),bt=require("rollup-plugin-visualizer"),xe=require("semver"),$t=require("glob"),wt=require("glob-parent"),jt=require("@rollup/plugin-json"),T=require("@rollup/pluginutils"),kt=require("rollup-plugin-license"),xt=require("node:crypto"),Et=require("@babel/parser"),Ot=require("@visulima/find-cache-dir"),St=require("fastest-levenshtein");var ce=typeof document<"u"?document.currentScript:null;const O=f(e=>e&&typeof e=="object"&&"default"in e?e.default:e,"_interopDefaultCompat"),pe=O(it),N=O(ut),Ee=O(dt),Oe=O(mt),_t=O(ft),Dt=O(gt),Se=O(ht),Nt=O(vt),Pt=O(wt),Mt=O(jt),Ft=O(kt);var Ct=Object.defineProperty,H=f((e,t)=>Ct(e,"name",{value:t,configurable:!0}),"i$d");const te=/^#![^\n]*/,Q=H(async e=>{await z.chmod(e,493).catch(()=>{})},"makeExecutable"),It=H((e,t=`#!/usr/bin/env node
2
- `)=>({name:"packem:shebang",renderChunk:{handler(o,r,n){if(!r.isEntry||!r.facadeModuleId||o.startsWith("#")&&o[1]==="!")return null;if(e.includes(r.name)){const s=new N(o);return s.prepend(t),{code:s.toString(),map:n.sourcemap?s.generateMap({hires:!0}):void 0}}return null},order:"post"},async writeBundle(o,r){for(const[n,s]of Object.entries(r))if(s.type==="chunk"&&te.test(s.code)&&o.dir){const i=m.resolve(o.dir,n);await Q(i)}}}),"shebangPlugin"),Rt=H(()=>({name:"packem:remove-shebang",renderChunk(e){return e.replace(te,"")}}),"removeShebangPlugin"),Tt=H((e,t=`
3
- `)=>{const o=te.exec(e);return o?o+t:""},"getShebang");var At=Object.defineProperty,qt=f((e,t)=>At(e,"name",{value:t,configurable:!0}),"p$4");const oe=qt((e,t)=>{let o={};if(e.pkg.name&&(o[e.pkg.name]=e.options.rootDir),e.pkg.imports){const{imports:r}=e.pkg;for(const n in r){if(n.startsWith("#"))continue;const s=r[n];typeof s=="string"&&(o[n]=m.join(e.rootDir,s))}}return o={...o,...e.options.alias},e.options.rollup.alias&&(Array.isArray(e.options.rollup.alias.entries)?Object.assign(o,Object.fromEntries(e.options.rollup.alias.entries.map(r=>[r.find,r.replacement]))):Object.assign(o,e.options.rollup.alias.entries??e.options.rollup.alias)),e.logger.debug({message:"Resolved aliases: "+JSON.stringify(o),prefix:t}),o},"resolveAliases");var Lt=Object.defineProperty,Bt=f((e,t)=>Lt(e,"name",{value:t,configurable:!0}),"o$3");const Jt=Bt((e,t)=>{const o=Ee(t,{esmResolve:!0,interopDefault:!0});try{return o.resolve(e)}catch(r){if(r.code!=="MODULE_NOT_FOUND")throw new Error(`Error trying import ${e} from ${t}`,{cause:r});return e}},"tryResolve");var Wt=Object.defineProperty,zt=f((e,t)=>Wt(e,"name",{value:t,configurable:!0}),"r$a");const A=zt((e,t)=>{e.warnings.has(t)||e.warnings.add(t)},"warn");var Ut=Object.defineProperty,Ht=f((e,t)=>Ut(e,"name",{value:t,configurable:!0}),"u$8");const Vt=Ht(async e=>{const t=await J.resolvePath("jiti",{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:ce&&ce.src||new URL("create-bundler.cjs",document.baseURI).href}),o=JSON.stringify({...e.options.stubOptions.jiti,alias:{...oe(e,"jit"),...e.options.stubOptions.jiti.alias}},null,2);for(const r of e.options.entries){const n=m.resolve(e.options.rootDir,e.options.outDir,r.name),s=m.normalize(Jt(r.input,e.options.rootDir)||r.input),i=s.slice(0,Math.max(0,s.length-m.extname(s).length)),a=await v.readFile(s),l=Tt(a);e.options.emitCJS&&await v.writeFile(`${n}.cjs`,l+[`const jiti = require(${JSON.stringify(t)})`,"",`const _jiti = jiti(null, ${o})`,"",`/** @type {import(${JSON.stringify(i)})} */`,`module.exports = _jiti(${JSON.stringify(s)})`].join(`
4
- `));let c=[];try{c=await J.resolveModuleExportNames(s,{extensions:S.DEFAULT_EXTENSIONS})}catch(u){A(e,`Cannot analyze ${s} for exports: ${u.toString()}`);return}const p=c.includes("default")||c.length===0;await v.writeFile(`${n}.mjs`,l+[`import jiti from ${JSON.stringify(je.pathToFileURL(t).href)};`,"",`const _jiti = jiti(null, ${o})`,"",`/** @type {import(${JSON.stringify(s)})} */`,`const _module = await _jiti.import(${JSON.stringify(s)});`,p?`
1
+ "use strict";var it=Object.defineProperty;var f=(e,t)=>it(e,"name",{value:t,configurable:!0});const U=require("node:fs/promises"),at=require("node:module"),x=require("node:process"),g=require("@visulima/colorize"),v=require("@visulima/fs"),lt=require("@visulima/fs/error"),S=require("@visulima/humanizer"),ct=require("@visulima/package/package-json"),d=require("@visulima/path"),ce=require("@visulima/tsconfig"),pt=require("defu"),ut=require("hookable"),T=require("rollup"),D=require("./shared/packem.NVRVuzg1.cjs"),ke=require("node:url"),J=require("mlly"),dt=require("magic-string"),mt=require("jiti"),z=require("node:fs"),ft=require("@rollup/plugin-alias"),gt=require("@rollup/plugin-commonjs"),ht=require("@rollup/plugin-dynamic-import-vars"),xe=require("@rollup/plugin-node-resolve"),yt=require("@rollup/plugin-replace"),vt=require("@rollup/plugin-wasm"),bt=require("rollup-plugin-polyfill-node"),$t=require("rollup-plugin-visualizer"),Ee=require("semver"),jt=require("glob"),wt=require("glob-parent"),M=require("@rollup/pluginutils"),kt=require("@rollup/plugin-json"),xt=require("rollup-plugin-license"),Et=require("node:crypto"),Ot=require("@babel/parser"),Dt=require("@visulima/find-cache-dir"),St=require("fastest-levenshtein");var pe=typeof document<"u"?document.currentScript:null;const O=f(e=>e&&typeof e=="object"&&"default"in e?e.default:e,"_interopDefaultCompat"),ue=O(at),N=O(dt),Oe=O(mt),De=O(ft),_t=O(gt),Nt=O(ht),Se=O(yt),Pt=O(bt),Ft=O(wt),Mt=O(kt),Ct=O(xt);var It=Object.defineProperty,H=f((e,t)=>It(e,"name",{value:t,configurable:!0}),"i$d");const oe=/^#![^\n]*/,Q=H(async e=>{await U.chmod(e,493).catch(()=>{})},"makeExecutable"),Rt=H((e,t=`#!/usr/bin/env node
2
+ `)=>({name:"packem:shebang",renderChunk:{handler(o,n,r){if(!n.isEntry||!n.facadeModuleId||o.startsWith("#")&&o[1]==="!")return null;if(e.includes(n.name)){const s=new N(o);return s.prepend(t),{code:s.toString(),map:r.sourcemap?s.generateMap({hires:!0}):void 0}}return null},order:"post"},async writeBundle(o,n){for(const[r,s]of Object.entries(n))if(s.type==="chunk"&&oe.test(s.code)&&o.dir){const i=d.resolve(o.dir,r);await Q(i)}}}),"shebangPlugin"),Tt=H(()=>({name:"packem:remove-shebang",renderChunk(e){return e.replace(oe,"")}}),"removeShebangPlugin"),At=H((e,t=`
3
+ `)=>{const o=oe.exec(e);return o?o+t:""},"getShebang");var qt=Object.defineProperty,Lt=f((e,t)=>qt(e,"name",{value:t,configurable:!0}),"p$5");const ne=Lt((e,t)=>{let o={};if(e.pkg.name&&(o[e.pkg.name]=e.options.rootDir),e.pkg.imports){const{imports:n}=e.pkg;for(const r in n){if(r.startsWith("#"))continue;const s=n[r];typeof s=="string"&&(o[r]=d.join(e.rootDir,s))}}return o={...o,...e.options.alias},e.options.rollup.alias&&(Array.isArray(e.options.rollup.alias.entries)?Object.assign(o,Object.fromEntries(e.options.rollup.alias.entries.map(n=>[n.find,n.replacement]))):Object.assign(o,e.options.rollup.alias.entries??e.options.rollup.alias)),e.logger.debug({message:"Resolved aliases: "+JSON.stringify(o),prefix:t}),o},"resolveAliases");var Bt=Object.defineProperty,Jt=f((e,t)=>Bt(e,"name",{value:t,configurable:!0}),"o$3");const Wt=Jt((e,t)=>{const o=Oe(t,{esmResolve:!0,interopDefault:!0});try{return o.resolve(e)}catch(n){if(n.code!=="MODULE_NOT_FOUND")throw new Error(`Error trying import ${e} from ${t}`,{cause:n});return e}},"tryResolve");var Ut=Object.defineProperty,zt=f((e,t)=>Ut(e,"name",{value:t,configurable:!0}),"r$a");const A=zt((e,t)=>{e.warnings.has(t)||e.warnings.add(t)},"warn");var Ht=Object.defineProperty,Vt=f((e,t)=>Ht(e,"name",{value:t,configurable:!0}),"u$8");const Xt=Vt(async e=>{const t=await J.resolvePath("jiti",{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:pe&&pe.src||new URL("create-bundler.cjs",document.baseURI).href}),o=JSON.stringify({...e.options.stubOptions.jiti,alias:{...ne(e,"jit"),...e.options.stubOptions.jiti.alias}},null,2);for(const n of e.options.entries){const r=d.resolve(e.options.rootDir,e.options.outDir,n.name),s=d.normalize(Wt(n.input,e.options.rootDir)||n.input),i=s.slice(0,Math.max(0,s.length-d.extname(s).length)),l=await v.readFile(s),a=At(l);e.options.emitCJS&&await v.writeFile(`${r}.cjs`,a+[`const jiti = require(${JSON.stringify(t)})`,"",`const _jiti = jiti(null, ${o})`,"",`/** @type {import(${JSON.stringify(i)})} */`,`module.exports = _jiti(${JSON.stringify(s)})`].join(`
4
+ `));let c=[];try{c=await J.resolveModuleExportNames(s,{extensions:D.DEFAULT_EXTENSIONS})}catch(u){A(e,`Cannot analyze ${s} for exports: ${u.toString()}`);return}const p=c.includes("default")||c.length===0;await v.writeFile(`${r}.mjs`,a+[`import jiti from ${JSON.stringify(ke.pathToFileURL(t).href)};`,"",`const _jiti = jiti(null, ${o})`,"",`/** @type {import(${JSON.stringify(s)})} */`,`const _module = await _jiti.import(${JSON.stringify(s)});`,p?`
5
5
  export default _module;`:"",...c.filter(u=>u!=="default").map(u=>`export const ${u} = _module.${u};`)].join(`
6
- `)),await v.writeFile(`${n}.d.cts`,[`export * from ${JSON.stringify(i)};`,p?`export { default } from ${JSON.stringify(i)};`:""].join(`
7
- `)),await v.writeFile(`${n}.d.mts`,[`export * from ${JSON.stringify(s)};`,p?`export { default } from ${JSON.stringify(s)};`:""].join(`
8
- `)),l&&(await Q(`${n}.cjs`),await Q(`${n}.mjs`))}await e.hooks.callHook("rollup:done",e)},"createStub");var Xt=Object.defineProperty,Gt=f((e,t)=>Xt(e,"name",{value:t,configurable:!0}),"r$9");const _e=Gt((e,t)=>Ee(t,{esmResolve:!0,interopDefault:!0})(e),"tryRequire");var Yt=Object.defineProperty,De=f((e,t)=>Yt(e,"name",{value:t,configurable:!0}),"t$4");const W=De(e=>{if(e.endsWith(".mjs")||e.endsWith(".d.mts"))return"esm";if(e.endsWith(".cjs")||e.endsWith(".d.cts"))return"cjs"},"inferExportTypeFromFileName"),Ne=De((e,t,o,r)=>{if(o){const i=W(o);if(i)return i}if(e==="module"||e==="import")return"esm";if(e==="require")return"cjs";if(t.length===0)return r==="commonjs"?"cjs":"esm";const[n,...s]=t;return Ne(n,s,o,r)},"inferExportType");var Kt=Object.defineProperty,Qt=f((e,t)=>Kt(e,"name",{value:t,configurable:!0}),"n$a");const ne=Qt((e,t,o,r=[])=>{if(!e)return[];if(typeof e=="string"){const n=W(e),s=t==="module"?"esm":"cjs";if(n&&n!==s)throw new Error(`Exported file "${e}" has an extension that does not match the package.json type "${t}".`);return[{file:e,key:"exports",type:n??s}]}return Object.entries(e).filter(([n])=>!n.endsWith(".json")).flatMap(([n,s])=>n==="types"&&o===!1?[]:typeof s=="string"?{file:s,key:"exports",...["browser","default","deno","development","import","node","node-addons","production","require","types"].includes(n)?{subKey:n}:{},type:Ne(n,r,s,t)}:ne(s,t,o,[...r,n]))},"extractExportFilenames");var Zt=Object.defineProperty,re=f((e,t)=>Zt(e,"name",{value:t,configurable:!0}),"y$2");const eo=re(e=>{if(e.key==="exports"&&e.subKey==="production")return"production";if(e.key==="exports"&&e.subKey==="development")return"development";if(x.env.NODE_ENV){if(!x.env.NODE_ENV.includes("production")&&!x.env.NODE_ENV.includes("development"))throw new Error(`Invalid NODE_ENV value: ${x.env.NODE_ENV}, must be either "production" or "development".`);return x.env.NODE_ENV}return"production"},"getEnvironment"),q=re((e,t,o,r,n,s)=>{const i=e.find(a=>a.input===t)??e[e.push({input:t})-1];if(o&&(i.outDir=r),n.isExecutable)i.executable=!0,i.declaration=!1,n.type==="cjs"&&(i.cjs=!0),n.type==="esm"&&(i.esm=!0);else{/\.d\.[mc]?ts$/.test(n.file)&&s!==!1&&(i.declaration=s),n.type==="cjs"&&(i.cjs=!0),n.type==="esm"&&(i.esm=!0);for(const a of S.RUNTIME_EXPORT_CONVENTIONS)if(n.file.includes("."+a+".")){i.runtime=a;break}}i.runtime===void 0&&(i.runtime="node"),i.environment=eo(n)},"createOrUpdateEntry"),ue=/(?:\.d\.[mc]?ts|\.\w+)$/;let de=!1;const to=re((e,t,o)=>{const r=[];t.sort((a,l)=>a.split("/").length-l.split("/").length);const n=e.type==="module"?"esm":"cjs",s=ne(e.exports,e.type??"commonjs",o.options.declaration);if(e.bin){const a=(typeof e.bin=="string"?[e.bin]:Object.values(e.bin)).filter(Boolean);for(const l of a){const c=W(l);if(c&&c!==n)throw new Error(`Exported file "${l}" has an extension that does not match the package.json type "${e.type}".`);s.push({file:l,isExecutable:!0,key:"bin",type:c??n})}}e.main&&s.push({file:e.main,key:"main",type:W(e.main)??n}),e.module&&s.push({file:e.module,key:"module",type:"esm"}),o.options.declaration!==!1&&(e.types||e.typings)&&s.push({file:e.types??e.typings,key:"types"});const i=[];for(const a of s){const l=a.file.replace(/(?:\*[^/\\]|\.d\.[mc]?ts|\.\w+)$/,""),c=l.endsWith("/");if(c&&["./","/"].includes(l))continue;const p=l.replace(new RegExp("(./)?"+o.options.outDir),o.options.sourceDir).replace("./","");if(a.file.includes("/*")&&a.key==="exports"){de||(o.logger.debug("Private subfolders are not supported, if you need this feature please open an issue on GitHub."),de=!0);const y=[],h=new RegExp("(?<=/|$)"+p.replace("*","(.*)")+(c?"":"\\.\\w+"));for(const $ of t)h.test($)&&y.push($.replace(ue,""));if(y.length===0){r.push(`Could not find entrypoint for \`${a.file}\``);continue}for(const $ of y)q(i,$,c,l,a,o.options.declaration);continue}const u=new RegExp("(?<=/|$)"+p+(c?"":"\\.\\w+")),d=t.find(y=>u.test(y))?.replace(ue,"");if(!d){U.existsSync(m.resolve(o.options.rootDir,a.file))||r.push(`Could not find entrypoint for \`${a.file}\``);continue}v.isAccessibleSync(d+".cts")&&v.isAccessibleSync(d+".mts")?(q(i,d+".cts",c,l,{...a,type:"cjs"},o.options.declaration),q(i,d+".mts",c,l,{...a,type:"esm"},o.options.declaration)):q(i,d,c,l,a,o.options.declaration)}return{entries:i,warnings:r}},"inferEntries");var oo=Object.defineProperty,no=f((e,t)=>oo(e,"name",{value:t,configurable:!0}),"t$3");const ro=no((e,t)=>{const{publishConfig:o}=e;return o&&(o.bin&&(typeof o.bin=="object"||typeof o.bin=="string")&&(e.bin=o.bin),o.type&&typeof o.type=="string"&&o.type!==""&&(e.type=o.type),o.main&&typeof o.main=="string"&&o.main!==""&&(e.main=o.main),o.module&&typeof o.module=="string"&&o.module!==""&&(e.module=o.module),t===void 0&&o.types&&typeof o.types=="string"&&o.types!==""?e.types=o.types:t===void 0&&o.typings&&typeof o.typings=="string"&&o.typings!==""&&(e.typings=o.typings),o.exports&&typeof o.exports=="object"&&(e.exports=o.exports)),e},"overwriteWithPublishConfig");var so=Object.defineProperty,io=f((e,t)=>so(e,"name",{value:t,configurable:!0}),"n$8");const ao={hooks:{"build:prepare":io(function(e){if(e.options.entries.length>0)return;const t=m.join(e.options.rootDir,"src");if(!U.existsSync(t))throw new Error("No 'src' directory found. Please provide entries manually.");const o=v.collectSync(t,{extensions:[],includeDirs:!1,includeSymlinks:!1});if(o.length===0)throw new Error("No source files found in 'src' directory. Please provide entries manually.");let r={...e.pkg};r.publishConfig&&(r=ro(r,e.options.declaration));const n=to(r,o,e);for(const s of n.warnings)A(e,s);if(e.options.entries.push(...n.entries),e.options.entries.length===0)throw new Error("No entries detected. Please provide entries manually.");e.logger.info("Automatically detected entries:",g.cyan(e.options.entries.map(s=>g.bold(s.input.replace(`${e.options.rootDir}/`,"").replace(/\/$/,"/*"))).join(", ")),g.gray([e.options.emitESM&&"esm",e.options.emitCJS&&"cjs",e.options.declaration&&"dts"].filter(Boolean).map(s=>`[${s}]`).join(" ")))},"build:prepare")}};var lo=Object.defineProperty,co=f((e,t)=>lo(e,"name",{value:t,configurable:!0}),"t$2");const po=co((e,t)=>(e==="auto"?e=ao:typeof e=="string"&&(e=_e(e,t)),typeof e=="function"&&(e=e()),e),"resolvePreset");var uo=Object.defineProperty,mo=f((e,t)=>uo(e,"name",{value:t,configurable:!0}),"a$b");const Z=mo((e,t)=>e.some(o=>o instanceof RegExp?o.test(t):o===t),"arrayIncludes");var fo=Object.defineProperty,go=f((e,t)=>fo(e,"name",{value:t,configurable:!0}),"a$a");const V=go(e=>e===void 0?[]:Array.isArray(e)?e:[e],"arrayify");var ho=Object.defineProperty,yo=f((e,t)=>ho(e,"name",{value:t,configurable:!0}),"a$9");const ee=yo((e="")=>{const t=e.split("/");return t[0].startsWith("@")?t[0]+"/"+t[1]:t[0]},"getPackageName");var vo=Object.defineProperty,Pe=f((e,t)=>vo(e,"name",{value:t,configurable:!0}),"s$9");const bo=Pe((e,t,o)=>{const r=o??new Map;return(...n)=>{const s=t?typeof t=="function"?t(...n):t:JSON.stringify({args:n}),i=r.get(s);if(i!==void 0)return i;const a=e(...n);return r.set(s,a),a}},"memoize"),$o=Pe(e=>{const t=new Map;return o=>bo(e,o,t)},"memoizeByKey");var wo=Object.defineProperty,jo=f((e,t)=>wo(e,"name",{value:t,configurable:!0}),"m$5");const Me=jo(({addDefaultProperty:e=!1,logger:t,type:o})=>({name:"packem:cjs-interop",renderChunk(r,n,s){if(n.type!=="chunk"||!n.isEntry)return null;if(s.format==="cjs"&&s.exports==="auto"){const i=/(exports(?:\['default'\]|\.default)) = (.*);/i.exec(r);if(i===null||i.length<3)return null;const a=new N(r);a.replace("Object.defineProperty(exports, '__esModule', { value: true });",""),a.replaceAll(/exports\.(.*) = (.*);/g,"module.exports.$1 = $2;"),e&&a.append(`
9
- module.exports.default = `+i[2]+";");let l=a.toString();return l=l.replace(/(?:module\.)?exports(?:\['default'\]|\.default)/i,"module.exports"),t.debug({message:"Applied CommonJS interop to entry chunk "+n.fileName+".",prefix:"plugin:cjs-interop"}),{code:l,map:a.generateMap({hires:!0})}}if(s.format==="es"&&/\.d\.(?:ts|cts)$/.test(n.fileName)){if(o!=="commonjs"&&n.fileName.endsWith(".d.ts"))return null;const i=/export\s\{\s(.*)\s\}/i.exec(r);if(i===null||i.length<2)return null;const a=i[1].split(", "),l=[];let c="";for(const u of a)if(!u.includes("type"))if(u.includes("as")){const[d,y]=u.split(" as ");if(y==="default"&&(c=d,!e))continue;l.push(y+": typeof "+d+";")}else l.push(u+": typeof "+u+";");const p=new N(r);return p.replace(" "+c+" as default,",""),p.append(`
6
+ `)),await v.writeFile(`${r}.d.cts`,[`export * from ${JSON.stringify(i)};`,p?`export { default } from ${JSON.stringify(i)};`:""].join(`
7
+ `)),await v.writeFile(`${r}.d.mts`,[`export * from ${JSON.stringify(s)};`,p?`export { default } from ${JSON.stringify(s)};`:""].join(`
8
+ `)),a&&(await Q(`${r}.cjs`),await Q(`${r}.mjs`))}await e.hooks.callHook("rollup:done",e)},"createStub");var Gt=Object.defineProperty,Yt=f((e,t)=>Gt(e,"name",{value:t,configurable:!0}),"r$9");const _e=Yt((e,t)=>Oe(t,{esmResolve:!0,interopDefault:!0})(e),"tryRequire");var Kt=Object.defineProperty,Ne=f((e,t)=>Kt(e,"name",{value:t,configurable:!0}),"t$4");const W=Ne(e=>{if(e.endsWith(".mjs")||e.endsWith(".d.mts"))return"esm";if(e.endsWith(".cjs")||e.endsWith(".d.cts"))return"cjs"},"inferExportTypeFromFileName"),Pe=Ne((e,t,o,n)=>{if(o){const i=W(o);if(i)return i}if(e==="module"||e==="import")return"esm";if(e==="require")return"cjs";if(t.length===0)return n==="commonjs"?"cjs":"esm";const[r,...s]=t;return Pe(r,s,o,n)},"inferExportType");var Qt=Object.defineProperty,Zt=f((e,t)=>Qt(e,"name",{value:t,configurable:!0}),"n$a");const re=Zt((e,t,o,n=[])=>{if(!e)return[];if(typeof e=="string"){const r=W(e),s=t==="module"?"esm":"cjs";if(r&&r!==s)throw new Error(`Exported file "${e}" has an extension that does not match the package.json type "${t}".`);return[{file:e,key:"exports",type:r??s}]}return Object.entries(e).filter(([r])=>!r.endsWith(".json")).flatMap(([r,s])=>r==="types"&&o===!1?[]:typeof s=="string"?{file:s,key:"exports",...["browser","default","deno","development","import","node","node-addons","production","require","types"].includes(r)?{subKey:r}:{},type:Pe(r,n,s,t)}:re(s,t,o,[...n,r]))},"extractExportFilenames");var eo=Object.defineProperty,se=f((e,t)=>eo(e,"name",{value:t,configurable:!0}),"y$2");const to=se(e=>{if(e.key==="exports"&&e.subKey==="production")return"production";if(e.key==="exports"&&e.subKey==="development")return"development";if(x.env.NODE_ENV){if(!x.env.NODE_ENV.includes("production")&&!x.env.NODE_ENV.includes("development"))throw new Error(`Invalid NODE_ENV value: ${x.env.NODE_ENV}, must be either "production" or "development".`);return x.env.NODE_ENV}return"production"},"getEnvironment"),q=se((e,t,o,n,r,s)=>{const i=e.find(l=>l.input===t)??e[e.push({input:t})-1];if(o&&(i.outDir=n),r.isExecutable)i.executable=!0,i.declaration=!1,r.type==="cjs"&&(i.cjs=!0),r.type==="esm"&&(i.esm=!0);else{/\.d\.[mc]?ts$/.test(r.file)&&s!==!1&&(i.declaration=s),r.type==="cjs"&&(i.cjs=!0),r.type==="esm"&&(i.esm=!0);for(const l of D.RUNTIME_EXPORT_CONVENTIONS)if(r.file.includes("."+l+".")){i.runtime=l;break}}i.runtime===void 0&&(i.runtime="node"),i.environment=to(r)},"createOrUpdateEntry"),de=/(?:\.d\.[mc]?ts|\.\w+)$/;let me=!1;const oo=se((e,t,o)=>{const n=[];t.sort((l,a)=>l.split("/").length-a.split("/").length);const r=e.type==="module"?"esm":"cjs",s=re(e.exports,e.type??"commonjs",o.options.declaration);if(e.bin){const l=(typeof e.bin=="string"?[e.bin]:Object.values(e.bin)).filter(Boolean);for(const a of l){const c=W(a);if(c&&c!==r)throw new Error(`Exported file "${a}" has an extension that does not match the package.json type "${e.type}".`);s.push({file:a,isExecutable:!0,key:"bin",type:c??r})}}e.main&&s.push({file:e.main,key:"main",type:W(e.main)??r}),e.module&&s.push({file:e.module,key:"module",type:"esm"}),o.options.declaration!==!1&&(e.types||e.typings)&&s.push({file:e.types??e.typings,key:"types"});const i=[];for(const l of s){const a=l.file.replace(/(?:\*[^/\\]|\.d\.[mc]?ts|\.\w+)$/,""),c=a.endsWith("/");if(c&&["./","/"].includes(a))continue;const p=a.replace(new RegExp("(./)?"+o.options.outDir),o.options.sourceDir).replace("./","");if(l.file.includes("/*")&&l.key==="exports"){me||(o.logger.debug("Private subfolders are not supported, if you need this feature please open an issue on GitHub."),me=!0);const y=[],h=new RegExp("(?<=/|$)"+p.replace("*","(.*)")+(c?"":"\\.\\w+"));for(const $ of t)h.test($)&&y.push($.replace(de,""));if(y.length===0){n.push(`Could not find entrypoint for \`${l.file}\``);continue}for(const $ of y)q(i,$,c,a,l,o.options.declaration);continue}const u=new RegExp("(?<=/|$)"+p+(c?"":"\\.\\w+")),m=t.find(y=>u.test(y))?.replace(de,"");if(!m){z.existsSync(d.resolve(o.options.rootDir,l.file))||n.push(`Could not find entrypoint for \`${l.file}\``);continue}v.isAccessibleSync(m+".cts")&&v.isAccessibleSync(m+".mts")?(q(i,m+".cts",c,a,{...l,type:"cjs"},o.options.declaration),q(i,m+".mts",c,a,{...l,type:"esm"},o.options.declaration)):q(i,m,c,a,l,o.options.declaration)}return{entries:i,warnings:n}},"inferEntries");var no=Object.defineProperty,ro=f((e,t)=>no(e,"name",{value:t,configurable:!0}),"t$3");const so=ro((e,t)=>{const{publishConfig:o}=e;return o&&(o.bin&&(typeof o.bin=="object"||typeof o.bin=="string")&&(e.bin=o.bin),o.type&&typeof o.type=="string"&&o.type!==""&&(e.type=o.type),o.main&&typeof o.main=="string"&&o.main!==""&&(e.main=o.main),o.module&&typeof o.module=="string"&&o.module!==""&&(e.module=o.module),t===void 0&&o.types&&typeof o.types=="string"&&o.types!==""?e.types=o.types:t===void 0&&o.typings&&typeof o.typings=="string"&&o.typings!==""&&(e.typings=o.typings),o.exports&&typeof o.exports=="object"&&(e.exports=o.exports)),e},"overwriteWithPublishConfig");var io=Object.defineProperty,ao=f((e,t)=>io(e,"name",{value:t,configurable:!0}),"n$8");const lo={hooks:{"build:prepare":ao(function(e){if(e.options.entries.length>0)return;const t=d.join(e.options.rootDir,"src");if(!z.existsSync(t))throw new Error("No 'src' directory found. Please provide entries manually.");const o=v.collectSync(t,{extensions:[],includeDirs:!1,includeSymlinks:!1});if(o.length===0)throw new Error("No source files found in 'src' directory. Please provide entries manually.");let n={...e.pkg};n.publishConfig&&(n=so(n,e.options.declaration));const r=oo(n,o,e);for(const s of r.warnings)A(e,s);if(e.options.entries.push(...r.entries),e.options.entries.length===0)throw new Error("No entries detected. Please provide entries manually.");e.logger.info("Automatically detected entries:",g.cyan(e.options.entries.map(s=>g.bold(s.input.replace(`${e.options.rootDir}/`,"").replace(/\/$/,"/*"))).join(", ")),g.gray([e.options.emitESM&&"esm",e.options.emitCJS&&"cjs",e.options.declaration&&"dts"].filter(Boolean).map(s=>`[${s}]`).join(" ")))},"build:prepare")}};var co=Object.defineProperty,po=f((e,t)=>co(e,"name",{value:t,configurable:!0}),"t$2");const uo=po((e,t)=>(e==="auto"?e=lo:typeof e=="string"&&(e=_e(e,t)),typeof e=="function"&&(e=e()),e),"resolvePreset");var mo=Object.defineProperty,fo=f((e,t)=>mo(e,"name",{value:t,configurable:!0}),"a$b");const Z=fo((e,t)=>e.some(o=>o instanceof RegExp?o.test(t):o===t),"arrayIncludes");var go=Object.defineProperty,ho=f((e,t)=>go(e,"name",{value:t,configurable:!0}),"a$a");const V=ho(e=>e===void 0?[]:Array.isArray(e)?e:[e],"arrayify");var yo=Object.defineProperty,vo=f((e,t)=>yo(e,"name",{value:t,configurable:!0}),"a$9");const ee=vo((e="")=>{const t=e.split("/");return t[0].startsWith("@")?t[0]+"/"+t[1]:t[0]},"getPackageName");var bo=Object.defineProperty,Fe=f((e,t)=>bo(e,"name",{value:t,configurable:!0}),"s$9");const $o=Fe((e,t,o)=>{const n=o??new Map;return(...r)=>{const s=t?typeof t=="function"?t(...r):t:JSON.stringify({args:r}),i=n.get(s);if(i!==void 0)return i;const l=e(...r);return n.set(s,l),l}},"memoize"),jo=Fe(e=>{const t=new Map;return o=>$o(e,o,t)},"memoizeByKey");var wo=Object.defineProperty,ko=f((e,t)=>wo(e,"name",{value:t,configurable:!0}),"m$5");const Me=ko(({addDefaultProperty:e=!1,logger:t,type:o})=>({name:"packem:cjs-interop",renderChunk(n,r,s){if(r.type!=="chunk"||!r.isEntry)return null;if(s.format==="cjs"&&s.exports==="auto"){const i=/(exports(?:\['default'\]|\.default)) = (.*);/i.exec(n);if(i===null||i.length<3)return null;const l=new N(n);l.replace("Object.defineProperty(exports, '__esModule', { value: true });",""),l.replaceAll(/exports\.(.*) = (.*);/g,"module.exports.$1 = $2;"),e&&l.append(`
9
+ module.exports.default = `+i[2]+";");let a=l.toString();return a=a.replace(/(?:module\.)?exports(?:\['default'\]|\.default)/i,"module.exports"),t.debug({message:"Applied CommonJS interop to entry chunk "+r.fileName+".",prefix:"plugin:cjs-interop"}),{code:a,map:l.generateMap({hires:!0})}}if(s.format==="es"&&/\.d\.(?:ts|cts)$/.test(r.fileName)){if(o!=="commonjs"&&r.fileName.endsWith(".d.ts"))return null;const i=/export\s\{\s(.*)\s\}/i.exec(n);if(i===null||i.length<2)return null;const l=i[1].split(", "),a=[];let c="";for(const u of l)if(!u.includes("type"))if(u.includes("as")){const[m,y]=u.split(" as ");if(y==="default"&&(c=m,!e))continue;a.push(y+": typeof "+m+";")}else a.push(u+": typeof "+u+";");const p=new N(n);return p.replace(" "+c+" as default,",""),p.append(`
10
10
 
11
11
  declare const defaultExport: {
12
- `+(l.length>0?" ":"")+l.join(`
12
+ `+(a.length>0?" ":"")+a.join(`
13
13
  `)+`
14
14
  } & typeof `+c+`;
15
15
 
16
- export default defaultExport;`),t.debug({message:"Applied CommonJS interop to entry chunk "+n.fileName+".",prefix:"plugin:cjs-interop"}),{code:p.toString(),map:p.generateMap({hires:!0})}}return null}}),"cjsInterop");var ko=Object.defineProperty,xo=f((e,t)=>ko(e,"name",{value:t,configurable:!0}),"f$6");const Eo=xo((e,t)=>{const o=new Map,r={copyOnce:!0,exactFileNames:!0,flatten:!1,...e};let{targets:n}=r;return Array.isArray(n)?n=n.map(s=>{if(typeof s=="string")return{src:s};if(typeof s=="object"&&"src"in s)return s}).filter(Boolean):typeof n=="string"&&(n=[{src:n}]),{async buildStart(){const s=await Promise.all(n.flatMap(i=>Array.isArray(i.src)?i.src.map(a=>({...i,src:a})):i).map(async i=>await $t.glob(i.src,{ignore:i.exclude}).then(a=>({dest:i.dest??"",parent:Pt(i.src),src:a}))));for(const i of s)for(const a of i.src){let l;o.has(a)?l=o.get(a):(l={copied:[],dest:[],timestamp:0},o.set(a,l));const c=r.flatten?m.normalize(i.dest):m.join(i.dest,m.relative(i.parent,m.dirname(a)));l.dest.includes(c)||l.dest.push(c),this.addWatchFile(a)}t.info({message:"Copying files...",prefix:"plugin:copy"}),await Promise.all([...o].map(async([i,a])=>{let l;try{const c=await z.stat(i);if(!c.isFile())return;const p=c.mtime.getTime();p>a.timestamp&&(a.timestamp=p,a.copied=[]),l=await v.readFile(i,{buffer:!0})}catch(c){t.error({context:[c],message:`error reading file ${i}`,prefix:"plugin:copy"});return}for(const c of a.dest){if(r.copyOnce&&a.copied.includes(c))continue;const p=m.basename(i),u=m.join(c,p);try{this.emitFile({[r.exactFileNames?"fileName":"name"]:u,source:l,type:"asset"}),t.debug({message:`copied ${i} → ${u}`,prefix:"plugin:copy"}),a.copied.push(c)}catch(d){t.error({context:[d],message:`error copying file ${i} → ${u}`,prefix:"plugin:copy"})}}}))},name:"packem:copy"}},"copyPlugin");var Oo=Object.defineProperty,So=f((e,t)=>Oo(e,"name",{value:t,configurable:!0}),"n$4");const me="export default ",Fe=So(e=>{const t=Mt(e);return{...t,name:"packem:json",transform(o,r){const n=t.transform?.call(this,o,r);return n&&typeof n!="string"&&"code"in n&&n.code?.startsWith(me)&&(n.code=n.code.replace(me,"module.exports = ")),n}}},"JSONPlugin");class _o{static{f(this,"WalkerBase")}constructor(){this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:f(()=>this.should_skip=!0,"skip"),remove:f(()=>this.should_remove=!0,"remove"),replace:f(t=>this.replacement=t,"replace")}}replace(t,o,r,n){t&&o&&(r!=null?t[o][r]=n:t[o]=n)}remove(t,o,r){t&&o&&(r!=null?t[o].splice(r,1):delete t[o])}}class Do extends _o{static{f(this,"SyncWalker")}constructor(t,o){super(),this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:f(()=>this.should_skip=!0,"skip"),remove:f(()=>this.should_remove=!0,"remove"),replace:f(r=>this.replacement=r,"replace")},this.enter=t,this.leave=o}visit(t,o,r,n){if(t){if(this.enter){const i=this.should_skip,a=this.should_remove,l=this.replacement;this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.enter.call(this.context,t,o,r,n),this.replacement&&(t=this.replacement,this.replace(o,r,n,t)),this.should_remove&&this.remove(o,r,n);const c=this.should_skip,p=this.should_remove;if(this.should_skip=i,this.should_remove=a,this.replacement=l,c)return t;if(p)return null}let s;for(s in t){const i=t[s];if(i&&typeof i=="object")if(Array.isArray(i)){const a=i;for(let l=0;l<a.length;l+=1){const c=a[l];fe(c)&&(this.visit(c,t,s,l)||l--)}}else fe(i)&&this.visit(i,t,s,null)}if(this.leave){const i=this.replacement,a=this.should_remove;this.replacement=null,this.should_remove=!1,this.leave.call(this.context,t,o,r,n),this.replacement&&(t=this.replacement,this.replace(o,r,n,t)),this.should_remove&&this.remove(o,r,n);const l=this.should_remove;if(this.replacement=i,this.should_remove=a,l)return null}}return t}}function fe(e){return e!==null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"}f(fe,"isNode");function Ce(e,{enter:t,leave:o}){return new Do(t,o).visit(e,null)}f(Ce,"walk");var No=Object.defineProperty,Po=f((e,t)=>No(e,"name",{value:t,configurable:!0}),"u$6");const Mo=Po(({attributes:e,logger:t})=>{const o=T.createFilter([/\.[tj]sx$/],/node_modules/);if(!Array.isArray(e)||e.length===0)throw new Error("[packem:jsx-remove-attributes]: attributes must be a non-empty array of strings.");return{name:"packem:jsx-remove-attributes",transform(r,n){if(!o(n))return null;let s=null;try{s=this.parse(r,{allowReturnOutsideFunction:!0})}catch(l){return this.warn({code:"PARSE_ERROR",message:`[packem:jsx-remove-attributes]: failed to parse "${n}" and remove the jsx attribute.`}),t.warn(l),null}let i=!1;const a=new N(r);return Ce(s,{enter(l){if(l.type==="CallExpression"&&l.callee.type==="Identifier"&&l.callee.name==="jsx"){const c=l.arguments.filter(p=>p.type==="ObjectExpression"&&Array.isArray(p.properties));for(const p of c)for(const u of p.properties)u.type==="Property"&&u.key.type==="Literal"&&u.value.type==="Literal"&&e.includes(u.key.value)&&(a.overwrite(u.start-2,u.end,""),i=!0)}}}),i?{code:a.toString(),map:a.generateMap({hires:!0})}:null}}},"jsxRemoveAttributes");var Fo=Object.defineProperty,se=f((e,t)=>Fo(e,"name",{value:t,configurable:!0}),"p$2");const Co=se(e=>{const t=[],o=[];return e.forEach(r=>{r.startsWith("(")?t.push(r):o.push(r)}),[...o.sort(),...t.sort()]},"sortLicenses"),Io=se((e,t,o)=>{const r=new RegExp(`(<!-- ${t} -->)[\\s\\S]*?(<!-- ${t} -->)`,"g");if(r.test(e))return e.replace(r,`$1
16
+ export default defaultExport;`),t.debug({message:"Applied CommonJS interop to entry chunk "+r.fileName+".",prefix:"plugin:cjs-interop"}),{code:p.toString(),map:p.generateMap({hires:!0})}}return null}}),"cjsInterop");var xo=Object.defineProperty,Eo=f((e,t)=>xo(e,"name",{value:t,configurable:!0}),"f$6");const Oo=Eo((e,t)=>{const o=new Map,n={copyOnce:!0,exactFileNames:!0,flatten:!1,...e};let{targets:r}=n;return Array.isArray(r)?r=r.map(s=>{if(typeof s=="string")return{src:s};if(typeof s=="object"&&"src"in s)return s}).filter(Boolean):typeof r=="string"&&(r=[{src:r}]),{async buildStart(){const s=await Promise.all(r.flatMap(i=>Array.isArray(i.src)?i.src.map(l=>({...i,src:l})):i).map(async i=>await jt.glob(i.src,{ignore:i.exclude}).then(l=>({dest:i.dest??"",parent:Ft(i.src),src:l}))));for(const i of s)for(const l of i.src){let a;o.has(l)?a=o.get(l):(a={copied:[],dest:[],timestamp:0},o.set(l,a));const c=n.flatten?d.normalize(i.dest):d.join(i.dest,d.relative(i.parent,d.dirname(l)));a.dest.includes(c)||a.dest.push(c),this.addWatchFile(l)}t.info({message:"Copying files...",prefix:"plugin:copy"}),await Promise.all([...o].map(async([i,l])=>{let a;try{const c=await U.stat(i);if(!c.isFile())return;const p=c.mtime.getTime();p>l.timestamp&&(l.timestamp=p,l.copied=[]),a=await v.readFile(i,{buffer:!0})}catch(c){t.error({context:[c],message:`error reading file ${i}`,prefix:"plugin:copy"});return}for(const c of l.dest){if(n.copyOnce&&l.copied.includes(c))continue;const p=d.basename(i),u=d.join(c,p);try{this.emitFile({[n.exactFileNames?"fileName":"name"]:u,source:a,type:"asset"}),t.debug({message:`copied ${i} → ${u}`,prefix:"plugin:copy"}),l.copied.push(c)}catch(m){t.error({context:[m],message:`error copying file ${i} → ${u}`,prefix:"plugin:copy"})}}}))},name:"packem:copy"}},"copyPlugin");var Do=Object.defineProperty,te=f((e,t)=>Do(e,"name",{value:t,configurable:!0}),"l$5");const So=te((...e)=>{if(e.length===0)return"";if(e.length===1)return d.dirname(e[0]);const[t,...o]=e;let n=t.split(d.sep);for(const r of o){const s=r.split(d.sep,n.length);let i=0;for(const l of s)if(l===n[i])i+=1;else{n=n.slice(0,i);break}n=n.slice(0,i)}return n.length<=1&&n[0]===""?d.sep+n[0]:n.join(d.sep)},"lowestCommonAncestor"),_o=te((e,t={})=>{const o=M.createFilter(t.include,t.exclude),n={},r=te((s,i)=>{n[s.replace(/\..?[jt]s$/,"")]=i},"addOutput");return{name:"packem:isolated-declarations",renderStart(s,i){let l="",{input:a}=i;if(a=typeof a=="string"?[a]:a,Array.isArray(a)&&(l=So(...a)),typeof s.entryFileNames!="string")return this.error("entryFileNames must be a string");const c=s.entryFileNames.replace(/\.(.)?[jt]s$/,(p,u)=>`.d.${u||""}ts`);for(const[p,u]of Object.entries(n))this.emitFile({fileName:c.replace("[name]",d.relative(l,p)),source:u,type:"asset"})},async transform(s,i){if(!o(s))return;const l=await e(s,i),{errors:a,sourceText:c}=l;a.length>0?t.ignoreErrors?this.warn(a[0]):this.error(a[0]):r(s,c)}}},"isolatedDeclarationsPlugin");var No=Object.defineProperty,Po=f((e,t)=>No(e,"name",{value:t,configurable:!0}),"n$4");const fe="export default ",Ce=Po(e=>{const t=Mt(e);return{...t,name:"packem:json",transform(o,n){const r=t.transform?.call(this,o,n);return r&&typeof r!="string"&&"code"in r&&r.code?.startsWith(fe)&&(r.code=r.code.replace(fe,"module.exports = ")),r}}},"JSONPlugin");class Fo{static{f(this,"WalkerBase")}constructor(){this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:f(()=>this.should_skip=!0,"skip"),remove:f(()=>this.should_remove=!0,"remove"),replace:f(t=>this.replacement=t,"replace")}}replace(t,o,n,r){t&&o&&(n!=null?t[o][n]=r:t[o]=r)}remove(t,o,n){t&&o&&(n!=null?t[o].splice(n,1):delete t[o])}}class Mo extends Fo{static{f(this,"SyncWalker")}constructor(t,o){super(),this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:f(()=>this.should_skip=!0,"skip"),remove:f(()=>this.should_remove=!0,"remove"),replace:f(n=>this.replacement=n,"replace")},this.enter=t,this.leave=o}visit(t,o,n,r){if(t){if(this.enter){const i=this.should_skip,l=this.should_remove,a=this.replacement;this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.enter.call(this.context,t,o,n,r),this.replacement&&(t=this.replacement,this.replace(o,n,r,t)),this.should_remove&&this.remove(o,n,r);const c=this.should_skip,p=this.should_remove;if(this.should_skip=i,this.should_remove=l,this.replacement=a,c)return t;if(p)return null}let s;for(s in t){const i=t[s];if(i&&typeof i=="object")if(Array.isArray(i)){const l=i;for(let a=0;a<l.length;a+=1){const c=l[a];ge(c)&&(this.visit(c,t,s,a)||a--)}}else ge(i)&&this.visit(i,t,s,null)}if(this.leave){const i=this.replacement,l=this.should_remove;this.replacement=null,this.should_remove=!1,this.leave.call(this.context,t,o,n,r),this.replacement&&(t=this.replacement,this.replace(o,n,r,t)),this.should_remove&&this.remove(o,n,r);const a=this.should_remove;if(this.replacement=i,this.should_remove=l,a)return null}}return t}}function ge(e){return e!==null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"}f(ge,"isNode");function Ie(e,{enter:t,leave:o}){return new Mo(t,o).visit(e,null)}f(Ie,"walk");var Co=Object.defineProperty,Io=f((e,t)=>Co(e,"name",{value:t,configurable:!0}),"u$6");const Ro=Io(({attributes:e,logger:t})=>{const o=M.createFilter([/\.[tj]sx$/],/node_modules/);if(!Array.isArray(e)||e.length===0)throw new Error("[packem:jsx-remove-attributes]: attributes must be a non-empty array of strings.");return{name:"packem:jsx-remove-attributes",transform(n,r){if(!o(r))return null;let s=null;try{s=this.parse(n,{allowReturnOutsideFunction:!0})}catch(a){return this.warn({code:"PARSE_ERROR",message:`[packem:jsx-remove-attributes]: failed to parse "${r}" and remove the jsx attribute.`}),t.warn(a),null}let i=!1;const l=new N(n);return Ie(s,{enter(a){if(a.type==="CallExpression"&&a.callee.type==="Identifier"&&a.callee.name==="jsx"){const c=a.arguments.filter(p=>p.type==="ObjectExpression"&&Array.isArray(p.properties));for(const p of c)for(const u of p.properties)u.type==="Property"&&u.key.type==="Literal"&&u.value.type==="Literal"&&e.includes(u.key.value)&&(l.overwrite(u.start-2,u.end,""),i=!0)}}}),i?{code:l.toString(),map:l.generateMap({hires:!0})}:null}}},"jsxRemoveAttributes");var To=Object.defineProperty,ie=f((e,t)=>To(e,"name",{value:t,configurable:!0}),"p$2");const Ao=ie(e=>{const t=[],o=[];return e.forEach(n=>{n.startsWith("(")?t.push(n):o.push(n)}),[...o.sort(),...t.sort()]},"sortLicenses"),qo=ie((e,t,o)=>{const n=new RegExp(`(<!-- ${t} -->)[\\s\\S]*?(<!-- ${t} -->)`,"g");if(n.test(e))return e.replace(n,`$1
17
17
  ${o}
18
- $2`)},"replaceContentWithin"),Ie=se(({licenseFilePath:e,licenseTemplate:t,logger:o,marker:r,mode:n,packageName:s})=>Ft({thirdParty(i){const a=new Set,l=i.sort(({name:p},{name:u})=>(p||0)>(u||0)?1:(u||0)>(p||0)?-1:0).map(({author:p,contributors:u,license:d,licenseText:y,maintainers:h,name:$,repository:w})=>{let b="## "+$+`
19
- `;d&&(b+=`License: ${d}
20
- `);const F=new Set;for(const C of[p,...h,...u]){const ae=typeof C=="string"?C:C?.name;ae&&F.add(ae)}return F.size>0&&(b+=`By: ${[...F].join(", ")}
21
- `),w&&(b+=`Repository: ${typeof w=="string"?w:w.url}
18
+ $2`)},"replaceContentWithin"),Re=ie(({licenseFilePath:e,licenseTemplate:t,logger:o,marker:n,mode:r,packageName:s})=>Ct({thirdParty(i){const l=new Set,a=i.sort(({name:p},{name:u})=>(p||0)>(u||0)?1:(u||0)>(p||0)?-1:0).map(({author:p,contributors:u,license:m,licenseText:y,maintainers:h,name:$,repository:j})=>{let b="## "+$+`
19
+ `;m&&(b+=`License: ${m}
20
+ `);const C=new Set;for(const I of[p,...h,...u]){const le=typeof I=="string"?I:I?.name;le&&C.add(le)}return C.size>0&&(b+=`By: ${[...C].join(", ")}
21
+ `),j&&(b+=`Repository: ${typeof j=="string"?j:j.url}
22
22
  `),y&&(b+=`
23
23
  `+y.trim().replaceAll(/\r\n|\r/g,`
24
24
  `).split(`
25
- `).map(C=>`> ${C}`).join(`
25
+ `).map(I=>`> ${I}`).join(`
26
26
  `)+`
27
- `),d&&a.add(d),b}).join(`
27
+ `),m&&l.add(m),b}).join(`
28
28
  ---------------------------------------
29
29
 
30
- `);if(l===""){o.info({message:"No dependencies license information found.",prefix:"plugin:license:"+n});return}const c=t(Co(a),l,s);try{const p=v.readFileSync(e),u=Io(p,r,c);if(!u){o.error({message:`Could not find the license marker: <!-- ${r} --> in ${e}`,prefix:"plugin:license:"+n});return}p!==u&&(v.writeFileSync(e,u),o.info({message:`${e} updated.`,prefix:"plugin:license:"+n}))}catch(p){o.error(p)}}}),"license");var Ro=Object.defineProperty,To=f((e,t)=>Ro(e,"name",{value:t,configurable:!0}),"i$9");const Ao=To(e=>({async buildEnd(){const t=[];for(const r of this.getModuleIds()){const n=this.getModuleInfo(r);if(n!=null&&!n.isExternal)for(const s of n.importedIds)t.push({source:r,target:s})}if(Array.isArray(t)&&t.length===0)return;const o=m.resolve(e.rootDir,e.outDir,"graph.json");v.writeJsonSync(o,t)},name:"packem:metafile"}),"metafilePlugin");var qo=Object.defineProperty,Lo=f((e,t)=>qo(e,"name",{value:t,configurable:!0}),"r$6");const P=Lo(e=>{const t=xt.createHash("md5");return t.update(e),t.digest("hex")},"getHash");var Bo=Object.defineProperty,Re=f((e,t)=>Bo(e,"name",{value:t,configurable:!0}),"m$4");const I=Re(e=>e.handler||e,"getHandler"),E=Re((e,t)=>({...e,async buildEnd(o){e.buildEnd&&await I(e.buildEnd).call(this,o)},async buildStart(o){e.buildStart&&await I(e.buildStart).call(this,o)},async load(o){if(!e.load)return null;const r=m.join("load",P(o));if(t.has(r,e.name))return await t.get(r,e.name);const n=await I(e.load).call(this,o);return t.set(r,n,e.name),n},name:`cached(${e.name})`,async resolveId(o,r,n){if(!e.resolveId)return null;const s=m.join("resolveId",P(o),r?P(r):"",P(JSON.stringify(n)));if(t.has(s,e.name))return await t.get(s,e.name);const i=await I(e.resolveId).call(this,o,r,n);return t.set(s,i,e.name),i},async transform(o,r){if(!e.transform)return null;const n=m.join("transform",P(r),P(o));if(t.has(n,e.name))return await t.get(n,e.name);const s=await I(e.transform).call(this,o,r);return t.set(n,s,e.name),s}}),"cachingPlugin");var Jo=Object.defineProperty,Wo=f((e,t)=>Jo(e,"name",{value:t,configurable:!0}),"c$5");const zo=/\.(?:m|c)?(?:j|t)sx?$/,Uo=/^use \w+$/,Ho=Wo(e=>{const t={},o={};return{name:"packem:preserve-directives",onLog(r,n){return n.code==="MODULE_LEVEL_DIRECTIVE"&&r==="warn"?!1:null},renderChunk:{handler(r,n,{sourcemap:s}){const i=n.moduleIds.map(c=>t[c]?t[c]:null).reduce((c,p)=>(p&&p.forEach(u=>{c.add(u)}),c),new Set),a=new N(r);i.size>0&&(e.debug({message:`directives for chunk "${n.fileName}" are preserved.`,prefix:"plugin:preserve-directives"}),a.prepend(`${[...i].map(c=>`'${c}';`).join(`
30
+ `);if(a===""){o.info({message:"No dependencies license information found.",prefix:"plugin:license:"+r});return}const c=t(Ao(l),a,s);try{const p=v.readFileSync(e),u=qo(p,n,c);if(!u){o.error({message:`Could not find the license marker: <!-- ${n} --> in ${e}`,prefix:"plugin:license:"+r});return}p!==u&&(v.writeFileSync(e,u),o.info({message:`${e} updated.`,prefix:"plugin:license:"+r}))}catch(p){o.error(p)}}}),"license");var Lo=Object.defineProperty,Bo=f((e,t)=>Lo(e,"name",{value:t,configurable:!0}),"i$9");const Jo=Bo(e=>({async buildEnd(){const t=[];for(const n of this.getModuleIds()){const r=this.getModuleInfo(n);if(r!=null&&!r.isExternal)for(const s of r.importedIds)t.push({source:n,target:s})}if(Array.isArray(t)&&t.length===0)return;const o=d.resolve(e.rootDir,e.outDir,"graph.json");v.writeJsonSync(o,t)},name:"packem:metafile"}),"metafilePlugin");var Wo=Object.defineProperty,Uo=f((e,t)=>Wo(e,"name",{value:t,configurable:!0}),"r$6");const P=Uo(e=>{const t=Et.createHash("md5");return t.update(e),t.digest("hex")},"getHash");var zo=Object.defineProperty,Te=f((e,t)=>zo(e,"name",{value:t,configurable:!0}),"m$4");const R=Te(e=>e.handler||e,"getHandler"),E=Te((e,t)=>({...e,async buildEnd(o){e.buildEnd&&await R(e.buildEnd).call(this,o)},async buildStart(o){e.buildStart&&await R(e.buildStart).call(this,o)},async load(o){if(!e.load)return null;const n=d.join("load",P(o));if(t.has(n,e.name))return await t.get(n,e.name);const r=await R(e.load).call(this,o);return t.set(n,r,e.name),r},name:`cached(${e.name})`,async resolveId(o,n,r){if(!e.resolveId)return null;const s=d.join("resolveId",P(o),n?P(n):"",P(JSON.stringify(r)));if(t.has(s,e.name))return await t.get(s,e.name);const i=await R(e.resolveId).call(this,o,n,r);return t.set(s,i,e.name),i},async transform(o,n){if(!e.transform)return null;const r=d.join("transform",P(n),P(o));if(t.has(r,e.name))return await t.get(r,e.name);const s=await R(e.transform).call(this,o,n);return t.set(r,s,e.name),s}}),"cachingPlugin");var Ho=Object.defineProperty,Vo=f((e,t)=>Ho(e,"name",{value:t,configurable:!0}),"c$5");const Xo=/\.(?:m|c)?(?:j|t)sx?$/,Go=/^use \w+$/,Yo=Vo(e=>{const t={},o={};return{name:"packem:preserve-directives",onLog(n,r){return r.code==="MODULE_LEVEL_DIRECTIVE"&&n==="warn"?!1:null},renderChunk:{handler(n,r,{sourcemap:s}){const i=r.moduleIds.map(c=>t[c]?t[c]:null).reduce((c,p)=>(p&&p.forEach(u=>{c.add(u)}),c),new Set),l=new N(n);i.size>0&&(e.debug({message:`directives for chunk "${r.fileName}" are preserved.`,prefix:"plugin:preserve-directives"}),l.prepend(`${[...i].map(c=>`'${c}';`).join(`
31
31
  `)}
32
- `));let l=null;return n.facadeModuleId&&typeof o[n.facadeModuleId]=="string"&&(l=o[n.facadeModuleId]),l&&(e.debug({message:`shebang for chunk "${n.fileName}" is preserved.`,prefix:"plugin:preserve-directives"}),a.prepend(`${l}
33
- `)),i.size===0&&l===null?null:{code:a.toString(),map:s?a.generateMap({hires:!0}):null}},order:"post"},transform:{handler(r,n){const s=m.extname(n);if(!zo.test(s))return null;let i=!1;const a=new N(r);if(r.startsWith("#")&&r[1]==="!"){let c=0;for(let p=2,u=r.length;p<u;p++){const d=r.codePointAt(p);if(d===10||d===13||d===8232||d===8233){c=p;break}}c&&(o[n]=r.slice(0,c),a.remove(0,c+1),i=!0,e.debug({message:`shebang for module "${n}" is preserved.`,prefix:"plugin:preserve-directives"}))}let l=null;try{l=this.parse(a.toString(),{allowReturnOutsideFunction:!0})}catch(c){return this.warn({code:"PARSE_ERROR",message:`[packem:preserve-directives]: failed to parse "${n}" and extract the directives.`}),e.warn(c),null}if(l.type!=="Program")return null;for(const c of l.body.filter(Boolean)){if(c.type!=="ExpressionStatement")break;let p=null;"directive"in c?p=c.directive:c.expression.type==="Literal"&&typeof c.expression.value=="string"&&Uo.test(c.expression.value)&&(p=c.expression.value),p!=="use strict"&&p&&(t[n]||=new Set,t[n].add(p),"start"in c&&typeof c.start=="number"&&"end"in c&&typeof c.end=="number"&&(a.remove(c.start,c.end),i=!0),e.debug({message:`directive "${p}" for module "${n}" is preserved.`,prefix:"plugin:preserve-directives"}))}return i?{code:a.toString(),map:a.generateMap({hires:!0}),meta:{preserveDirectives:{directives:[...t[n]??[]],shebang:o[n]??null}}}:null},order:"post"}}},"preserveDirectives");var Vo=Object.defineProperty,Xo=f((e,t)=>Vo(e,"name",{value:t,configurable:!0}),"r$5");const Go={exclude:[],include:[/\.(md|txt|css|htm|html)$/]},Yo=Xo((e={})=>{e={...e,...Go};const t=T.createFilter(e.include,e.exclude);return{name:"packem:raw",transform(o,r){return t(r)?{code:`export default ${JSON.stringify(o)}`,map:null}:null}}},"rawPlugin");var Ko=Object.defineProperty,Qo=f((e,t)=>Ko(e,"name",{value:t,configurable:!0}),"l$3");const X="\0__file_url__",Te=Qo(()=>({async load(e){if(e.startsWith(X)){const t=je.fileURLToPath(e.slice(X.length));return await v.readFile(t)}},name:"packem:resolve-file-url",resolveId(e){if(e.startsWith("file://"))return`${X}${e}`}}),"resolveFileUrl");var Zo=Object.defineProperty,Ae=f((e,t)=>Zo(e,"name",{value:t,configurable:!0}),"i$5");const en=/__filename|__dirname|require\(|require\.resolve\(/,qe=`
32
+ `));let a=null;return r.facadeModuleId&&typeof o[r.facadeModuleId]=="string"&&(a=o[r.facadeModuleId]),a&&(e.debug({message:`shebang for chunk "${r.fileName}" is preserved.`,prefix:"plugin:preserve-directives"}),l.prepend(`${a}
33
+ `)),i.size===0&&a===null?null:{code:l.toString(),map:s?l.generateMap({hires:!0}):null}},order:"post"},transform:{handler(n,r){const s=d.extname(r);if(!Xo.test(s))return null;let i=!1;const l=new N(n);if(n.startsWith("#")&&n[1]==="!"){let c=0;for(let p=2,u=n.length;p<u;p++){const m=n.codePointAt(p);if(m===10||m===13||m===8232||m===8233){c=p;break}}c&&(o[r]=n.slice(0,c),l.remove(0,c+1),i=!0,e.debug({message:`shebang for module "${r}" is preserved.`,prefix:"plugin:preserve-directives"}))}let a=null;try{a=this.parse(l.toString(),{allowReturnOutsideFunction:!0})}catch(c){return this.warn({code:"PARSE_ERROR",message:`[packem:preserve-directives]: failed to parse "${r}" and extract the directives.`}),e.warn(c),null}if(a.type!=="Program")return null;for(const c of a.body.filter(Boolean)){if(c.type!=="ExpressionStatement")break;let p=null;"directive"in c?p=c.directive:c.expression.type==="Literal"&&typeof c.expression.value=="string"&&Go.test(c.expression.value)&&(p=c.expression.value),p!=="use strict"&&p&&(t[r]||=new Set,t[r].add(p),"start"in c&&typeof c.start=="number"&&"end"in c&&typeof c.end=="number"&&(l.remove(c.start,c.end),i=!0),e.debug({message:`directive "${p}" for module "${r}" is preserved.`,prefix:"plugin:preserve-directives"}))}return i?{code:l.toString(),map:l.generateMap({hires:!0}),meta:{preserveDirectives:{directives:[...t[r]??[]],shebang:o[r]??null}}}:null},order:"post"}}},"preserveDirectives");var Ko=Object.defineProperty,Qo=f((e,t)=>Ko(e,"name",{value:t,configurable:!0}),"r$5");const Zo={exclude:[],include:[/\.(md|txt|css|htm|html)$/]},en=Qo((e={})=>{e={...e,...Zo};const t=M.createFilter(e.include,e.exclude);return{name:"packem:raw",transform(o,n){return t(n)?{code:`export default ${JSON.stringify(o)}`,map:null}:null}}},"rawPlugin");var tn=Object.defineProperty,on=f((e,t)=>tn(e,"name",{value:t,configurable:!0}),"l$3");const X="\0__file_url__",Ae=on(()=>({async load(e){if(e.startsWith(X)){const t=ke.fileURLToPath(e.slice(X.length));return await v.readFile(t)}},name:"packem:resolve-file-url",resolveId(e){if(e.startsWith("file://"))return`${X}${e}`}}),"resolveFileUrl");var nn=Object.defineProperty,qe=f((e,t)=>nn(e,"name",{value:t,configurable:!0}),"i$5");const rn=/__filename|__dirname|require\(|require\.resolve\(/,Le=`
34
34
  // -- pack CommonJS Shims --
35
35
  import __cjs_url__ from "node:url";
36
36
  import __cjs_path__ from "node:path";
@@ -38,63 +38,63 @@ import __cjs_mod__ from "node:module";
38
38
  const __filename = __cjs_url__.fileURLToPath(import.meta.url);
39
39
  const __dirname = __cjs_path__.dirname(__filename);
40
40
  const require = __cjs_mod__.createRequire(import.meta.url);
41
- `,Le=`
41
+ `,Be=`
42
42
  // -- pack CommonJS Shims Node 20.11 --
43
43
  import __cjs_mod__ from "node:module";
44
44
  const __filename = import.meta.filename;
45
45
  const __dirname = import.meta.dirname;
46
46
  const require = __cjs_mod__.createRequire(import.meta.url);
47
- `,tn=Ae((e,t)=>{if(x.env.INTERNAL_PACKEM_BUILD!=="1"&&(e.includes(qe)||e.includes(Le)||!en.test(e)))return null;const o=J.findStaticImports(e).pop(),r=o?o.end:0,n=new N(e);return n.appendRight(r,t),{code:n.toString(),map:n.generateMap()}},"CJSToESM"),on=Ae(e=>({name:"packem:cjs",renderChunk(t,o,r){if(r.format==="es"){let n=qe;if(e.engines?.node){const s=xe.minVersion(e.engines.node);s&&s.major>=20&&s.minor>=11&&(n=Le)}return tn(t,n)}return null}}),"cjsPlugin");var nn=Object.defineProperty,M=f((e,t)=>nn(e,"name",{value:t,configurable:!0}),"r$4");const rn=/\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\//g,sn=/MIT License|MIT license|BSD license/,an=/\n{2,}/g,ln=/\b(\w+)\$\d+\b/g,cn=/[-/\\^$*+?.()|[\]{}]/g,pn=M(e=>e.replaceAll(cn,"\\$&"),"escapeRegex"),un=M(e=>[...new Set(e)],"unique"),dn=M(e=>e.replaceAll(rn,t=>sn.test(t)?"":t).replaceAll(an,`
47
+ `,sn=qe((e,t)=>{if(x.env.INTERNAL_PACKEM_BUILD!=="1"&&(e.includes(Le)||e.includes(Be)||!rn.test(e)))return null;const o=J.findStaticImports(e).pop(),n=o?o.end:0,r=new N(e);return r.appendRight(n,t),{code:r.toString(),map:r.generateMap()}},"CJSToESM"),an=qe(e=>({name:"packem:cjs",renderChunk(t,o,n){if(n.format==="es"){let r=Le;if(e.engines?.node){const s=Ee.minVersion(e.engines.node);s&&s.major>=20&&s.minor>=11&&(r=Be)}return sn(t,r)}return null}}),"cjsPlugin");var ln=Object.defineProperty,F=f((e,t)=>ln(e,"name",{value:t,configurable:!0}),"r$4");const cn=/\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\//g,pn=/MIT License|MIT license|BSD license/,un=/\n{2,}/g,dn=/\b(\w+)\$\d+\b/g,mn=/[-/\\^$*+?.()|[\]{}]/g,fn=F(e=>e.replaceAll(mn,"\\$&"),"escapeRegex"),gn=F(e=>[...new Set(e)],"unique"),hn=F(e=>e.replaceAll(cn,t=>pn.test(t)?"":t).replaceAll(un,`
48
48
 
49
- `),"cleanUnnecessaryComments"),ge=new Map;function Be(e,t,{identifierReplacements:o},r){const n=J.findStaticImports(e);for(const i in o){const a=n.find(c=>c.specifier===i&&c.imports.includes("{"));if(!a){this.warn(`${t.fileName} does not import "${i}" for replacement`),process.exitCode=1;continue}const l=o[i];for(const c in l){if(!a.imports.includes(c))throw new Error(`${t.fileName} does not import "${c}" from "${i}" for replacement`);const p=l[c],u=pn(c);p.includes(".")&&(e=e.replace(new RegExp(`\\b\\w+\\b as ${u},?\\s?`),"")),e=e.replaceAll(new RegExp(`\\b${u}\\b`,"g"),p)}}const s=un(Array.from(e.matchAll(ln),i=>i[0]));if(s.length>0){const i=s.map(l=>`
50
- - ${l}`).join(""),a=t.fileName.replace(/\.[^/.]+$/,"");ge.has(a)||r.warn({message:`${t.fileName} contains confusing identifier names${i}
49
+ `),"cleanUnnecessaryComments"),he=new Map;function Je(e,t,{identifierReplacements:o},n){const r=J.findStaticImports(e);for(const i in o){const l=r.find(c=>c.specifier===i&&c.imports.includes("{"));if(!l){this.warn(`${t.fileName} does not import "${i}" for replacement`),process.exitCode=1;continue}const a=o[i];for(const c in a){if(!l.imports.includes(c))throw new Error(`${t.fileName} does not import "${c}" from "${i}" for replacement`);const p=a[c],u=fn(c);p.includes(".")&&(e=e.replace(new RegExp(`\\b\\w+\\b as ${u},?\\s?`),"")),e=e.replaceAll(new RegExp(`\\b${u}\\b`,"g"),p)}}const s=gn(Array.from(e.matchAll(dn),i=>i[0]));if(s.length>0){const i=s.map(a=>`
50
+ - ${a}`).join(""),l=t.fileName.replace(/\.[^/.]+$/,"");he.has(l)||n.warn({message:`${t.fileName} contains confusing identifier names${i}
51
51
 
52
- To replace these, add them to the "rollup -> patchTypes -> identifierReplacements" option in your packem config.`,prefix:"plugin:patch-types"}),ge.set(a,!0)}return e}f(Be,"I");M(Be,"replaceConfusingTypeNames");function Je(e,t){if(t.leadingComments?.some(o=>o.type==="CommentBlock"&&o.value.includes("@internal"))){const o=e.original[t.end]===","?t.end+1:t.end;return e.remove(t.leadingComments[0].start,o),!0}return!1}f(Je,"N");M(Je,"removeInternal");function We(e,t){if(e.includes("@internal")){const o=new N(e),r=Et.parse(e,{plugins:["typescript"],sourceType:"module"});if(Ce(r,{enter(n){Je(o,n)&&this.skip()}}),e=o.toString(),e.includes("@internal"))throw new Error(`${t.fileName} has unhandled @internal declarations`)}return e}f(We,"S");M(We,"stripInternalTypes");const mn=M((e,t)=>({name:"packem:patch-types",renderChunk(o,r){return o=Be.call(this,o,r,e,t),o=We.call(this,o,r),o=dn(o),o},resolveId(o){return o.startsWith("types/")?{external:!0,id:"../../"+(o.endsWith(".js")?o:o+".js")}:null}}),"patchTypescriptTypes");var fn=Object.defineProperty,ze=f((e,t)=>fn(e,"name",{value:t,configurable:!0}),"u$4");const Ue=ze((e,t=!0)=>{if(!e)return null;const{config:o,path:r}=e;if(!o.compilerOptions)return null;const{baseUrl:n,paths:s}=o.compilerOptions;if(!n)return null;const i=m.resolve(m.dirname(r),n),a=[];if(s)for(const[l,c]of Object.entries(s)){const p=new RegExp(`^${[...l].map(d=>d==="*"?"(.+)":d.replace(/[\\^$*+?.()|[\]{}]/,"\\$&")).join("")}$`);let u=0;for(const d of c){const y=[...T.normalizePath(m.resolve(i,d))].map(h=>h==="*"?"$"+(++u+""):h==="$"?"$$":h).join("");a.push({find:p,replacement:y})}}return t&&a.push({find:/^(?!\.*\/|\.*$|\w:)(.+)$/,replacement:`${[...T.normalizePath(i)].map(l=>l==="$"?"$$":l).join("")}/$1`}),a},"getConfigAlias"),He=ze((e,t)=>{const o=Ue(e);return{name:"packem:resolve-tsconfig-paths",async resolveId(r,n,s){if(!o||r.includes("\0"))return null;for(const{find:i,replacement:a}of o)if(i.test(r)){const l=r.replace(i,a),c=await this.resolve(l,n,{skipSelf:!0,...s});if(c)return t.debug({message:`Resolved ${r} to ${c.id} using paths from tsconfig.json.`,prefix:"plugin:resolve-tsconfig-paths"}),c.id}return null}}},"resolveTsconfigPaths");var gn=Object.defineProperty,Ve=f((e,t)=>gn(e,"name",{value:t,configurable:!0}),"u$3");const hn=Ve((e,t)=>{if(!t)return null;const{config:o,path:r}=t;if(!o.compilerOptions)return null;const{rootDirs:n}=o.compilerOptions;if(!n)return null;const s=[];for(const i of n){if(i.startsWith("."))throw new Error(`Invalid rootDir value '.' in ${r}.`);if(i.startsWith(".."))throw new Error(`Invalid rootDir value '..' in ${r}.`);s.push(m.resolve(e,i))}return s},"getRootDirectories"),Xe=Ve((e,t,o)=>{const r=hn(e,o);return{name:"packem:resolve-tsconfig-root-dirs",async resolveId(n,s,i){if(r===null||r.length===0)return null;if(n.startsWith("."))for(const a of r){const l=m.join(a,n),c=await this.resolve(l,s,{skipSelf:!0,...i});if(c)return t.debug({message:`Resolved ${n} to ${c.id} using rootDirs from tsconfig.json.`,prefix:"plugin:resolve-tsconfig-root-dirs"}),c.id}return null}}},"resolveTsconfigRootDirectories");var yn=Object.defineProperty,vn=f((e,t)=>yn(e,"name",{value:t,configurable:!0}),"r$3");const Ge=vn(()=>{const e=/\.(?:[mc]?js|jsx)$/;return{name:"packem:resolve-typescript-mjs-cjs",async resolveId(t,o,r){return e.test(t)&&o?await this.resolve(t.replace(/js(x?)$/,"ts$1"),o,r):null}}},"resolveTypescriptMjsCts");var bn=Object.defineProperty,$n=f((e,t)=>bn(e,"name",{value:t,configurable:!0}),"s$5");const wn=$n(e=>{const t=m.basename(e).split(".");if(t.length>=2){const[o,r]=t.slice(-2),n=t[0],s=/^(\w+)-runtime$/.exec(o)?.[1];if(S.DEFAULT_EXTENSIONS.includes(r)&&s&&s.length>0)return n+"-"+s}},"getCustomModuleLayer");var jn=Object.defineProperty,kn=f((e,t)=>jn(e,"name",{value:t,configurable:!0}),"i$4");const G=kn(e=>(e.preserveDirectives||{directives:[]}).directives.map(t=>t.replace(/^use /,"")).find(t=>t!=="strict"),"getModuleLayer");var xn=Object.defineProperty,he=f((e,t)=>xn(e,"name",{value:t,configurable:!0}),"c$3");const ye=he((e,t)=>{const o=new Map;return he(function(r,n){const s=n.getModuleInfo(r);if(!s)return;const{isEntry:i}=s,a=s.meta,l=G(a);if(!i){const c=o.get(r);if(c)return c;const p=wn(r);if(p)return o.set(r,p),p}if(i){const c=n.getModuleIds();for(const p of c)n.getModuleInfo(p)&&G(a)===l&&(e.has(p)||e.set(p,new Set),e.get(p).add([r,l]))}if(l&&!i&&e.has(r)){const c=[...e.get(r)];if(c.some(([u])=>{if(t.some(d=>d.path===u)){const d=n.getModuleInfo(u);return G(d?d.meta:{})===l}return!1}))return;if(c.every(([,u])=>u===l))return o.has(r)?o.get(r):void 0;const p=`${m.basename(r,m.extname(r))}-${l}`;return o.set(r,p),p}},"splitChunks")},"createSplitChunks");var En=Object.defineProperty,On=f((e,t)=>En(e,"name",{value:t,configurable:!0}),"n$2");const D=On((e,t,o)=>t.isDynamicEntry?`chunks/[name].${o}`:`shared/${e.options.name}.[hash].${o}`,"getChunkFilename");var Sn=Object.defineProperty,_n=f((e,t)=>Sn(e,"name",{value:t,configurable:!0}),"s$3");const Dn=process.platform==="win32",ve=_n((e,t)=>{const o=Dn?"\\":"/";return e.name?.includes("node_modules"+o+".pnpm")?(e.name.replace("node_modules"+o+".pnpm","external")+"."+t).replace("node_modules"+o,""):e.name?.includes("node_modules")?e.name.replace("node_modules","external")+"."+t:"[name]."+t},"getEntryFileNames");var Nn=Object.defineProperty,j=f((e,t)=>Nn(e,"name",{value:t,configurable:!0}),"p$1");const Pn=j((e,t)=>{if(e==="esbuild"){if(!t.options.rollup.esbuild)throw new Error("No esbuild options found in your configuration.");t.tsconfig?.config.compilerOptions?.target?.toLowerCase()==="es3"&&(t.logger.warn(["ES3 target is not supported by esbuild, so ES5 will be used instead..","Please set 'target' option in tsconfig to at least ES5 to disable this error"].join(" ")),t.tsconfig.config.compilerOptions.target="es5",t.options.rollup.esbuild.target="es5");let o="node"+x.versions.node.split(".")[0];if(t.pkg.engines?.node){const r=xe.minVersion(t.pkg.engines.node);r&&(o="node"+r.major)}if(t.options.rollup.esbuild.target){const r=V(t.options.rollup.esbuild.target);r.some(n=>n.startsWith("node"))||(t.options.rollup.esbuild.target=[...new Set([...V(o),...r])])}else t.options.rollup.esbuild.target=V(o);return t.tsconfig?.config.compilerOptions?.target==="es5"&&(t.options.rollup.esbuild.keepNames=!1,t.logger.debug("Disabling keepNames because target is set to es5")),{minify:t.options.minify,sourceMap:t.options.sourcemap,...t.options.rollup.esbuild,logger:t.logger}}if(e==="swc"){if(!t.options.rollup.swc)throw new Error("No swc options found in your configuration.");return{minify:t.options.minify,...t.options.rollup.swc,jsc:{minify:{compress:{directives:!1},format:{comments:"some"},mangle:{toplevel:!0},sourceMap:t.options.sourcemap,toplevel:t.options.emitCJS??t.options.emitESM},...t.options.rollup.swc.jsc},sourceMaps:t.options.sourcemap}}if(e==="sucrase"){if(!t.options.rollup.sucrase)throw new Error("No sucrase options found in your configuration.");return{...t.options.rollup.sucrase}}throw new Error("A Unknown transformer was provided")},"getTransformerConfig"),Ye=j((e,t)=>{if(e.code==="CIRCULAR_DEPENDENCY"&&/Circular dependency:[\s\S]*node_modules/.test(e.message))return!0;if(e.code==="UNRESOLVED_IMPORT")throw new Error(`Failed to resolve the module "${e.exporter}" imported by "${g.cyan(m.relative(m.resolve(),e.id))}"
52
+ To replace these, add them to the "rollup -> patchTypes -> identifierReplacements" option in your packem config.`,prefix:"plugin:patch-types"}),he.set(l,!0)}return e}f(Je,"I");F(Je,"replaceConfusingTypeNames");function We(e,t){if(t.leadingComments?.some(o=>o.type==="CommentBlock"&&o.value.includes("@internal"))){const o=e.original[t.end]===","?t.end+1:t.end;return e.remove(t.leadingComments[0].start,o),!0}return!1}f(We,"N");F(We,"removeInternal");function Ue(e,t){if(e.includes("@internal")){const o=new N(e),n=Ot.parse(e,{plugins:["typescript"],sourceType:"module"});if(Ie(n,{enter(r){We(o,r)&&this.skip()}}),e=o.toString(),e.includes("@internal"))throw new Error(`${t.fileName} has unhandled @internal declarations`)}return e}f(Ue,"S");F(Ue,"stripInternalTypes");const yn=F((e,t)=>({name:"packem:patch-types",renderChunk(o,n){return o=Je.call(this,o,n,e,t),o=Ue.call(this,o,n),o=hn(o),o},resolveId(o){return o.startsWith("types/")?{external:!0,id:"../../"+(o.endsWith(".js")?o:o+".js")}:null}}),"patchTypescriptTypes");var vn=Object.defineProperty,ze=f((e,t)=>vn(e,"name",{value:t,configurable:!0}),"u$4");const He=ze((e,t=!0)=>{if(!e)return null;const{config:o,path:n}=e;if(!o.compilerOptions)return null;const{baseUrl:r,paths:s}=o.compilerOptions;if(!r)return null;const i=d.resolve(d.dirname(n),r),l=[];if(s)for(const[a,c]of Object.entries(s)){const p=new RegExp(`^${[...a].map(m=>m==="*"?"(.+)":m.replace(/[\\^$*+?.()|[\]{}]/,"\\$&")).join("")}$`);let u=0;for(const m of c){const y=[...M.normalizePath(d.resolve(i,m))].map(h=>h==="*"?"$"+(++u+""):h==="$"?"$$":h).join("");l.push({find:p,replacement:y})}}return t&&l.push({find:/^(?!\.*\/|\.*$|\w:)(.+)$/,replacement:`${[...M.normalizePath(i)].map(a=>a==="$"?"$$":a).join("")}/$1`}),l},"getConfigAlias"),Ve=ze((e,t)=>{const o=He(e);return{name:"packem:resolve-tsconfig-paths",async resolveId(n,r,s){if(!o||n.includes("\0"))return null;for(const{find:i,replacement:l}of o)if(i.test(n)){const a=n.replace(i,l),c=await this.resolve(a,r,{skipSelf:!0,...s});if(c)return t.debug({message:`Resolved ${n} to ${c.id} using paths from tsconfig.json.`,prefix:"plugin:resolve-tsconfig-paths"}),c.id}return null}}},"resolveTsconfigPaths");var bn=Object.defineProperty,Xe=f((e,t)=>bn(e,"name",{value:t,configurable:!0}),"u$3");const $n=Xe((e,t)=>{if(!t)return null;const{config:o,path:n}=t;if(!o.compilerOptions)return null;const{rootDirs:r}=o.compilerOptions;if(!r)return null;const s=[];for(const i of r){if(i.startsWith("."))throw new Error(`Invalid rootDir value '.' in ${n}.`);if(i.startsWith(".."))throw new Error(`Invalid rootDir value '..' in ${n}.`);s.push(d.resolve(e,i))}return s},"getRootDirectories"),Ge=Xe((e,t,o)=>{const n=$n(e,o);return{name:"packem:resolve-tsconfig-root-dirs",async resolveId(r,s,i){if(n===null||n.length===0)return null;if(r.startsWith("."))for(const l of n){const a=d.join(l,r),c=await this.resolve(a,s,{skipSelf:!0,...i});if(c)return t.debug({message:`Resolved ${r} to ${c.id} using rootDirs from tsconfig.json.`,prefix:"plugin:resolve-tsconfig-root-dirs"}),c.id}return null}}},"resolveTsconfigRootDirectories");var jn=Object.defineProperty,wn=f((e,t)=>jn(e,"name",{value:t,configurable:!0}),"r$3");const Ye=wn(()=>{const e=/\.(?:[mc]?js|jsx)$/;return{name:"packem:resolve-typescript-mjs-cjs",async resolveId(t,o,n){return e.test(t)&&o?await this.resolve(t.replace(/js(x?)$/,"ts$1"),o,n):null}}},"resolveTypescriptMjsCts");var kn=Object.defineProperty,xn=f((e,t)=>kn(e,"name",{value:t,configurable:!0}),"s$5");const En=xn(e=>{const t=d.basename(e).split(".");if(t.length>=2){const[o,n]=t.slice(-2),r=t[0],s=/^(\w+)-runtime$/.exec(o)?.[1];if(D.DEFAULT_EXTENSIONS.includes(n)&&s&&s.length>0)return r+"-"+s}},"getCustomModuleLayer");var On=Object.defineProperty,Dn=f((e,t)=>On(e,"name",{value:t,configurable:!0}),"i$4");const G=Dn(e=>(e.preserveDirectives||{directives:[]}).directives.map(t=>t.replace(/^use /,"")).find(t=>t!=="strict"),"getModuleLayer");var Sn=Object.defineProperty,ye=f((e,t)=>Sn(e,"name",{value:t,configurable:!0}),"c$3");const ve=ye((e,t)=>{const o=new Map;return ye(function(n,r){const s=r.getModuleInfo(n);if(!s)return;const{isEntry:i}=s,l=s.meta,a=G(l);if(!i){const c=o.get(n);if(c)return c;const p=En(n);if(p)return o.set(n,p),p}if(i){const c=r.getModuleIds();for(const p of c)r.getModuleInfo(p)&&G(l)===a&&(e.has(p)||e.set(p,new Set),e.get(p).add([n,a]))}if(a&&!i&&e.has(n)){const c=[...e.get(n)];if(c.some(([u])=>{if(t.some(m=>m.path===u)){const m=r.getModuleInfo(u);return G(m?m.meta:{})===a}return!1}))return;if(c.every(([,u])=>u===a))return o.has(n)?o.get(n):void 0;const p=`${d.basename(n,d.extname(n))}-${a}`;return o.set(n,p),p}},"splitChunks")},"createSplitChunks");var _n=Object.defineProperty,Nn=f((e,t)=>_n(e,"name",{value:t,configurable:!0}),"n$2");const _=Nn((e,t,o)=>t.isDynamicEntry?`chunks/[name].${o}`:`shared/${e.options.name}.[hash].${o}`,"getChunkFilename");var Pn=Object.defineProperty,Fn=f((e,t)=>Pn(e,"name",{value:t,configurable:!0}),"s$3");const Mn=process.platform==="win32",be=Fn((e,t)=>{const o=Mn?"\\":"/";return e.name?.includes("node_modules"+o+".pnpm")?(e.name.replace("node_modules"+o+".pnpm","external")+"."+t).replace("node_modules"+o,""):e.name?.includes("node_modules")?e.name.replace("node_modules","external")+"."+t:"[name]."+t},"getEntryFileNames");var Cn=Object.defineProperty,w=f((e,t)=>Cn(e,"name",{value:t,configurable:!0}),"p$1");const In=w((e,t)=>{if(e==="esbuild"){if(!t.options.rollup.esbuild)throw new Error("No esbuild options found in your configuration.");t.tsconfig?.config.compilerOptions?.target?.toLowerCase()==="es3"&&(t.logger.warn(["ES3 target is not supported by esbuild, so ES5 will be used instead..","Please set 'target' option in tsconfig to at least ES5 to disable this error"].join(" ")),t.tsconfig.config.compilerOptions.target="es5",t.options.rollup.esbuild.target="es5");let o="node"+x.versions.node.split(".")[0];if(t.pkg.engines?.node){const n=Ee.minVersion(t.pkg.engines.node);n&&(o="node"+n.major)}if(t.options.rollup.esbuild.target){const n=V(t.options.rollup.esbuild.target);n.some(r=>r.startsWith("node"))||(t.options.rollup.esbuild.target=[...new Set([...V(o),...n])])}else t.options.rollup.esbuild.target=V(o);return t.tsconfig?.config.compilerOptions?.target==="es5"&&(t.options.rollup.esbuild.keepNames=!1,t.logger.debug("Disabling keepNames because target is set to es5")),{minify:t.options.minify,sourceMap:t.options.sourcemap,...t.options.rollup.esbuild,logger:t.logger}}if(e==="swc"){if(!t.options.rollup.swc)throw new Error("No swc options found in your configuration.");return{minify:t.options.minify,...t.options.rollup.swc,jsc:{minify:{compress:{directives:!1},format:{comments:"some"},mangle:{toplevel:!0},sourceMap:t.options.sourcemap,toplevel:t.options.emitCJS??t.options.emitESM},...t.options.rollup.swc.jsc},sourceMaps:t.options.sourcemap}}if(e==="sucrase"){if(!t.options.rollup.sucrase)throw new Error("No sucrase options found in your configuration.");return{...t.options.rollup.sucrase}}throw new Error("A Unknown transformer was provided")},"getTransformerConfig"),Ke=w((e,t)=>{if(e.code==="CIRCULAR_DEPENDENCY"&&/Circular dependency:[\s\S]*node_modules/.test(e.message))return!0;if(e.code==="UNRESOLVED_IMPORT")throw new Error(`Failed to resolve the module "${e.exporter}" imported by "${g.cyan(d.relative(d.resolve(),e.id))}"
53
53
  Is the module installed? Note:
54
54
  ↳ to inline a module into your bundle, install it to "devDependencies".
55
- ↳ to depend on a module via import/require, install it to "dependencies".`);return e.code==="MIXED_EXPORTS"&&t.options.cjsInterop===!0},"sharedOnWarn"),be=new Map,Ke=j((e,t,o)=>{const r=j(s=>{for(const[i,a]of Object.entries(t))if(s.startsWith(i))return s.replace(i,a)},"findAlias"),n=Ue(e.tsconfig,!1);return{external(s){const i=r(s);i&&(s=i);const a=ee(s),l=Z(e.options.externals,a)||Z(e.options.externals,s);if(l)return!0;if(s.startsWith(".")||m.isAbsolute(s)||/src[/\\]/.test(s)||e.pkg.name&&s.startsWith(e.pkg.name))return!1;if(n){for(const{find:c}of n)if(c.test(s))return e.logger.debug({message:`Resolved alias ${s} to ${c.source}`,prefix:o}),!1}return!l&&!be.has(s)&&e.logger.info({message:'Inlined implicit external "'+g.cyan(s)+'". If this is incorrect, add it to the "externals" option.',prefix:o}),be.set(s,!0),l},input:Object.fromEntries(e.options.entries.map(s=>[s.name,m.resolve(e.options.rootDir,s.input)])),logLevel:e.options.debug?"debug":"info",onLog:j((s,i)=>{let a=i.message;switch(i.stack&&(a=`${a}
56
- ${i.stack}`),s){case"info":{e.logger.info({message:a,prefix:o+(i.plugin?":plugin:"+i.plugin:"")});return}case"warn":{e.logger.warn({message:a,prefix:o+(i.plugin?":plugin:"+i.plugin:"")});return}case"debug":e.logger.debug({message:a,prefix:o+(i.plugin?":plugin:"+i.plugin:"")})}},"onLog"),onwarn(s,i){Ye(s,e)||s.code||i(s)},watch:e.mode==="watch"?e.options.rollup.watch:!1}},"baseRollupOptions"),Qe=j(async(e,t)=>{const o=oe(e,"build");let r;return e.options.rollup.resolve&&(r=E(ke.nodeResolve({extensions:S.DEFAULT_EXTENSIONS,...e.options.rollup.resolve}),t)),{...Ke(e,o,"dependencies"),output:[e.options.emitCJS&&{chunkFileNames:j(n=>D(e,n,"cjs"),"chunkFileNames"),dir:m.resolve(e.options.rootDir,e.options.outDir),entryFileNames:j(n=>ve(n,"cjs"),"entryFileNames"),exports:"auto",externalLiveBindings:!1,format:"cjs",freeze:!1,generatedCode:{arrowFunctions:!0,constBindings:!0,objectShorthand:!0,preset:e.tsconfig?.config.compilerOptions?.target==="es5"?"es5":"es2015",reservedNamesAsProps:!0,symbols:!0},hoistTransitiveImports:!1,interop:"compat",sourcemap:e.options.sourcemap,validate:!0,...e.options.rollup.output,...e.options.rollup.output?.preserveModules?{preserveModules:!0,preserveModulesRoot:e.options.rollup.output.preserveModulesRoot??"src"}:{manualChunks:ye(e.dependencyGraphMap,e.buildEntries),preserveModules:!1}},e.options.emitESM&&{chunkFileNames:j(n=>D(e,n,"mjs"),"chunkFileNames"),dir:m.resolve(e.options.rootDir,e.options.outDir),entryFileNames:j(n=>ve(n,"mjs"),"entryFileNames"),exports:"auto",externalLiveBindings:!1,format:"esm",freeze:!1,generatedCode:{arrowFunctions:!0,constBindings:!0,objectShorthand:!0,preset:e.tsconfig?.config.compilerOptions?.target==="es5"?"es5":"es2015",reservedNamesAsProps:!0,symbols:!0},hoistTransitiveImports:!1,sourcemap:e.options.sourcemap,validate:!0,...e.options.rollup.output,...e.options.rollup.output?.preserveModules?{preserveModules:!0,preserveModulesRoot:e.options.rollup.output.preserveModulesRoot??"src"}:{manualChunks:ye(e.dependencyGraphMap,e.buildEntries),preserveModules:!1}}].filter(Boolean),plugins:[E(Te(),t),E(Ge(),t),e.tsconfig&&E(Xe(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&E(He(e.tsconfig,e.logger),t),e.options.rollup.replace&&Se({...e.options.rollup.replace,values:{...e.options.replace,...e.options.rollup.replace.values}}),e.options.rollup.alias&&Oe({customResolver:r?.resolveId,...e.options.rollup.alias,entries:o}),r,e.options.rollup.polyfillNode&&Nt({sourceMap:e.options.sourcemap,...e.options.rollup.polyfillNode}),e.options.rollup.json&&Fe({...e.options.rollup.json}),Ho(e.logger),It(e.options.entries.filter(n=>n.executable).map(n=>n.name).filter(Boolean)),e.options.rollup.wsam&&yt.wasm(e.options.rollup.wsam),e.options.transformer?.(Pn(e.options.transformerName,e)),e.options.cjsInterop&&e.options.emitCJS&&Me({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.dynamicVars&&Dt(e.options.rollup.dynamicVars),e.options.rollup.commonjs&&E(_t({extensions:S.DEFAULT_EXTENSIONS,sourceMap:e.options.sourcemap,...e.options.rollup.commonjs}),t),e.options.rollup.preserveDynamicImports&&{renderDynamicImport(){return{left:"import(",right:")"}}},e.options.rollup.shim&&on(e.pkg),e.options.rollup.raw&&Yo(e.options.rollup.raw),e.options.rollup.jsxRemoveAttributes&&Mo({attributes:e.options.rollup.jsxRemoveAttributes.attributes,logger:e.logger}),e.options.rollup.metafile&&Ao({outDir:m.resolve(e.options.rootDir,e.options.outDir),rootDir:e.options.rootDir}),e.options.rollup.copy&&Eo(e.options.rollup.copy,e.logger),e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dependenciesTemplate=="function"&&Ie({licenseFilePath:e.options.rollup.license.path,licenseTemplate:e.options.rollup.license.dependenciesTemplate,logger:e.logger,marker:e.options.rollup.license.dependenciesMarker??"DEPENDENCIES",mode:"dependencies",packageName:e.pkg.name}),e.options.rollup.visualizer&&bt.visualizer({brotliSize:!0,filename:"packem-bundle-analyze.html",gzipSize:!0,projectRoot:e.options.rootDir,sourcemap:e.options.sourcemap,title:"Packem Visualizer",...e.options.rollup.visualizer})].filter(Boolean)}},"getRollupOptions"),Mn=j(async e=>{const{dts:t}=require("rollup-plugin-dts");return t({compilerOptions:{...e.options.rollup.dts.compilerOptions,incremental:void 0,inlineSources:void 0,sourceMap:void 0,tsBuildInfoFile:void 0},respectExternal:e.options.rollup.dts.respectExternal,tsconfig:e.tsconfig?.path})},"createDtsPlugin"),Fn=$o(Mn),Ze=j(async(e,t)=>{const o=oe(e,"types"),r={load(a){return/\.(?:js|cjs|mjs|jsx|ts|tsx|mts|json)$/.test(a)?null:""},name:"packem:ignore-files"},n=e.tsconfig?.config.compilerOptions;delete n?.lib;let s;e.options.rollup.resolve&&(s=E(ke.nodeResolve({extensions:S.DEFAULT_EXTENSIONS,...e.options.rollup.resolve}),t));const i="dts-plugin:"+process.pid+e.tsconfig.path;return{...Ke(e,o,"dts"),onwarn(a,l){Ye(a,e)||a.code!=="EMPTY_BUNDLE"&&l(a)},output:[e.options.emitCJS&&{chunkFileNames:j(a=>D(e,a,"d.cts"),"chunkFileNames"),dir:m.resolve(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.cts",format:"cjs",sourcemap:e.options.sourcemap,...e.options.rollup.output},e.options.emitESM&&{chunkFileNames:j(a=>D(e,a,"d.mts"),"chunkFileNames"),dir:m.resolve(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.mts",format:"esm",sourcemap:e.options.sourcemap,...e.options.rollup.output},(e.options.declaration===!0||e.options.declaration==="compatible")&&{chunkFileNames:j(a=>D(e,a,"d.ts"),"chunkFileNames"),dir:m.resolve(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.ts",format:"cjs",sourcemap:e.options.sourcemap,...e.options.rollup.output}].filter(Boolean),plugins:[E(Te(),t),E(Ge(),t),e.options.rollup.json&&Fe({...e.options.rollup.json}),r,e.tsconfig&&E(Xe(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&E(He(e.tsconfig,e.logger),t),e.options.rollup.replace&&Se({...e.options.rollup.replace,values:{...e.options.replace,...e.options.rollup.replace.values}}),e.options.rollup.alias&&Oe({customResolver:s?.resolveId,...e.options.rollup.alias,entries:o}),s,await Fn(i)(e),e.options.cjsInterop&&e.options.emitCJS&&Me({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.patchTypes&&mn(e.options.rollup.patchTypes,e.logger),Rt(),e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dtsTemplate=="function"&&Ie({licenseFilePath:e.options.rollup.license.path,licenseTemplate:e.options.rollup.license.dtsTemplate,logger:e.logger,marker:e.options.rollup.license.dependenciesMarker??"TYPE_DEPENDENCIES",mode:"types",packageName:e.pkg.name})].filter(Boolean)}},"getRollupDtsOptions");var Cn=Object.defineProperty,In=f((e,t)=>Cn(e,"name",{value:t,configurable:!0}),"c$2");const Y=In(async(e,t)=>{const o=await Qe(e,t);if(await e.hooks.callHook("rollup:options",e,o),Object.keys(o.input).length===0)return;const r="rollup-build.json";o.cache=t.get(r);const n=await R.rollup(o);t.set(r,n.cache),await e.hooks.callHook("rollup:build",e,n);const s=o.output,i=new Map;for(const a of s){const{output:l}=await n.write(a),c=new Set,p=l.filter(d=>d.type==="chunk");for(const d of p){c.add(d.fileName);for(const y of d.imports)e.usedImports.add(y);d.isEntry&&e.buildEntries.push({bytes:Buffer.byteLength(d.code,"utf8"),chunks:d.imports.filter(y=>p.find(h=>h.fileName===y)),exports:d.exports,modules:Object.entries(d.modules).map(([y,h])=>({bytes:h.renderedLength,id:y})),path:d.fileName,type:"entry"})}const u=l.filter(d=>d.type==="asset");for(const d of u)i.has(d.fileName)||i.set(d.fileName,{bytes:Buffer.byteLength(d.source,"utf8"),path:d.fileName,type:"asset"});for(const d of c)e.usedImports.delete(d)}e.buildEntries.push(...i.values())},"build");var Rn=Object.defineProperty,L=f((e,t)=>Rn(e,"name",{value:t,configurable:!0}),"r$1");const K=L(async(e,t)=>{const o=await Ze(e,t);if(await e.hooks.callHook("rollup:dts:options",e,o),Object.keys(o.input).length===0)return;const r="rollup-dts.json";o.cache=t.get(r);const n=await R.rollup(o);t.set(r,n.cache),await e.hooks.callHook("rollup:dts:build",e,n),e.logger.info({message:"Building declaration files...",prefix:"dts"}),e.options.emitCJS&&await n.write({chunkFileNames:L(s=>D(e,s,"d.cts"),"chunkFileNames"),dir:m.resolve(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.cts"}),e.options.emitESM&&await n.write({chunkFileNames:L(s=>D(e,s,"d.mts"),"chunkFileNames"),dir:m.resolve(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.mts"}),(e.options.declaration===!0||e.options.declaration==="compatible")&&await n.write({chunkFileNames:L(s=>D(e,s,"d.ts"),"chunkFileNames"),dir:m.resolve(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.ts"}),await e.hooks.callHook("rollup:dts:done",e)},"buildTypes");var Tn=Object.defineProperty,ie=f((e,t)=>Tn(e,"name",{value:t,configurable:!0}),"i$2");const An=ie(e=>{const{message:t,name:o="Error",stack:r}=e;if(!r)return r;const n=`${o}: ${t}
57
- `;return r.startsWith(n)?r.slice(n.length):r},"extractStack"),qn=ie(e=>`
55
+ ↳ to depend on a module via import/require, install it to "dependencies".`);return e.code==="MIXED_EXPORTS"&&t.options.cjsInterop===!0},"sharedOnWarn"),$e=new Map,Qe=w((e,t,o)=>{const n=w(s=>{for(const[i,l]of Object.entries(t))if(s.startsWith(i))return s.replace(i,l)},"findAlias"),r=He(e.tsconfig,!1);return{external(s){const i=n(s);i&&(s=i);const l=ee(s),a=Z(e.options.externals,l)||Z(e.options.externals,s);if(a)return!0;const{pkg:c}=e,p=c.peerDependencies;if(p&&s in p&&!c.dependencies?.[s]&&!c.peerDependencies?.[s]&&!c.peerDependenciesMeta?.[s]?.optional)return!0;if(s.startsWith(".")||d.isAbsolute(s)||/src[/\\]/.test(s)||c.name&&s.startsWith(c.name))return!1;if(r){for(const{find:u}of r)if(u.test(s))return e.logger.debug({message:`Resolved alias ${s} to ${u.source}`,prefix:o}),!1}return!a&&!$e.has(s)&&e.logger.info({message:'Inlined implicit external "'+g.cyan(s)+'". If this is incorrect, add it to the "externals" option.',prefix:o}),$e.set(s,!0),a},input:Object.fromEntries(e.options.entries.map(s=>[s.name,d.resolve(e.options.rootDir,s.input)])),logLevel:e.options.debug?"debug":"info",onLog:w((s,i)=>{let l=i.message;switch(i.stack&&(l=`${l}
56
+ ${i.stack}`),s){case"info":{e.logger.info({message:l,prefix:o+(i.plugin?":plugin:"+i.plugin:"")});return}case"warn":{e.logger.warn({message:l,prefix:o+(i.plugin?":plugin:"+i.plugin:"")});return}case"debug":e.logger.debug({message:l,prefix:o+(i.plugin?":plugin:"+i.plugin:"")})}},"onLog"),onwarn(s,i){Ke(s,e)||s.code||i(s)},watch:e.mode==="watch"?e.options.rollup.watch:!1}},"baseRollupOptions"),Ze=w(async(e,t)=>{const o=ne(e,"build");let n;return e.options.rollup.resolve&&(n=E(xe.nodeResolve({extensions:D.DEFAULT_EXTENSIONS,...e.options.rollup.resolve}),t)),{...Qe(e,o,"dependencies"),output:[e.options.emitCJS&&{chunkFileNames:w(r=>_(e,r,"cjs"),"chunkFileNames"),dir:d.resolve(e.options.rootDir,e.options.outDir),entryFileNames:w(r=>be(r,"cjs"),"entryFileNames"),exports:"auto",externalLiveBindings:!1,format:"cjs",freeze:!1,generatedCode:{arrowFunctions:!0,constBindings:!0,objectShorthand:!0,preset:e.tsconfig?.config.compilerOptions?.target==="es5"?"es5":"es2015",reservedNamesAsProps:!0,symbols:!0},hoistTransitiveImports:!1,interop:"compat",sourcemap:e.options.sourcemap,validate:!0,...e.options.rollup.output,...e.options.rollup.output?.preserveModules?{preserveModules:!0,preserveModulesRoot:e.options.rollup.output.preserveModulesRoot??"src"}:{manualChunks:ve(e.dependencyGraphMap,e.buildEntries),preserveModules:!1}},e.options.emitESM&&{chunkFileNames:w(r=>_(e,r,"mjs"),"chunkFileNames"),dir:d.resolve(e.options.rootDir,e.options.outDir),entryFileNames:w(r=>be(r,"mjs"),"entryFileNames"),exports:"auto",externalLiveBindings:!1,format:"esm",freeze:!1,generatedCode:{arrowFunctions:!0,constBindings:!0,objectShorthand:!0,preset:e.tsconfig?.config.compilerOptions?.target==="es5"?"es5":"es2015",reservedNamesAsProps:!0,symbols:!0},hoistTransitiveImports:!1,sourcemap:e.options.sourcemap,validate:!0,...e.options.rollup.output,...e.options.rollup.output?.preserveModules?{preserveModules:!0,preserveModulesRoot:e.options.rollup.output.preserveModulesRoot??"src"}:{manualChunks:ve(e.dependencyGraphMap,e.buildEntries),preserveModules:!1}}].filter(Boolean),plugins:[E(Ae(),t),E(Ye(),t),e.tsconfig&&E(Ge(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&E(Ve(e.tsconfig,e.logger),t),e.options.rollup.replace&&Se({...e.options.rollup.replace,values:{...e.options.replace,...e.options.rollup.replace.values}}),e.options.rollup.alias&&De({customResolver:n?.resolveId,...e.options.rollup.alias,entries:o}),n,e.options.rollup.polyfillNode&&Pt({sourceMap:e.options.sourcemap,...e.options.rollup.polyfillNode}),e.options.rollup.json&&Ce({...e.options.rollup.json}),Yo(e.logger),Rt(e.options.entries.filter(r=>r.executable).map(r=>r.name).filter(Boolean)),e.options.rollup.wsam&&vt.wasm(e.options.rollup.wsam),e.options.transformer?.(In(e.options.transformerName,e)),e.options.cjsInterop&&e.options.emitCJS&&Me({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.dynamicVars&&Nt(e.options.rollup.dynamicVars),e.options.rollup.commonjs&&E(_t({extensions:D.DEFAULT_EXTENSIONS,sourceMap:e.options.sourcemap,...e.options.rollup.commonjs}),t),e.options.rollup.preserveDynamicImports&&{renderDynamicImport(){return{left:"import(",right:")"}}},e.options.rollup.shim&&an(e.pkg),e.options.rollup.raw&&en(e.options.rollup.raw),e.options.rollup.jsxRemoveAttributes&&Ro({attributes:e.options.rollup.jsxRemoveAttributes.attributes,logger:e.logger}),e.options.rollup.metafile&&Jo({outDir:d.resolve(e.options.rootDir,e.options.outDir),rootDir:e.options.rootDir}),e.options.rollup.copy&&Oo(e.options.rollup.copy,e.logger),e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dependenciesTemplate=="function"&&Re({licenseFilePath:e.options.rollup.license.path,licenseTemplate:e.options.rollup.license.dependenciesTemplate,logger:e.logger,marker:e.options.rollup.license.dependenciesMarker??"DEPENDENCIES",mode:"dependencies",packageName:e.pkg.name}),e.options.rollup.visualizer&&$t.visualizer({brotliSize:!0,filename:"packem-bundle-analyze.html",gzipSize:!0,projectRoot:e.options.rootDir,sourcemap:e.options.sourcemap,title:"Packem Visualizer",...e.options.rollup.visualizer})].filter(Boolean)}},"getRollupOptions"),Rn=w(async e=>{const{dts:t}=require("rollup-plugin-dts");return t({compilerOptions:{...e.options.rollup.dts.compilerOptions,incremental:void 0,inlineSources:void 0,sourceMap:void 0,tsBuildInfoFile:void 0},respectExternal:e.options.rollup.dts.respectExternal,tsconfig:e.tsconfig?.path})},"createDtsPlugin"),Tn=jo(Rn),et=w(async(e,t)=>{const o=ne(e,"types"),n={load(l){return/\.(?:js|cjs|mjs|jsx|ts|tsx|mts|json)$/.test(l)?null:""},name:"packem:ignore-files"},r=e.tsconfig?.config.compilerOptions;delete r?.lib;let s;e.options.rollup.resolve&&(s=E(xe.nodeResolve({extensions:D.DEFAULT_EXTENSIONS,...e.options.rollup.resolve}),t));const i="dts-plugin:"+process.pid+e.tsconfig.path;return{...Qe(e,o,"dts"),onwarn(l,a){Ke(l,e)||l.code!=="EMPTY_BUNDLE"&&a(l)},output:[e.options.emitCJS&&{chunkFileNames:w(l=>_(e,l,"d.cts"),"chunkFileNames"),dir:d.resolve(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.cts",format:"cjs",sourcemap:e.options.sourcemap,...e.options.rollup.output},e.options.emitESM&&{chunkFileNames:w(l=>_(e,l,"d.mts"),"chunkFileNames"),dir:d.resolve(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.mts",format:"esm",sourcemap:e.options.sourcemap,...e.options.rollup.output},(e.options.declaration===!0||e.options.declaration==="compatible")&&{chunkFileNames:w(l=>_(e,l,"d.ts"),"chunkFileNames"),dir:d.resolve(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.ts",format:"cjs",sourcemap:e.options.sourcemap,...e.options.rollup.output}].filter(Boolean),plugins:[E(Ae(),t),E(Ye(),t),e.options.rollup.json&&Ce({...e.options.rollup.json}),n,e.tsconfig&&E(Ge(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&E(Ve(e.tsconfig,e.logger),t),e.options.rollup.replace&&Se({...e.options.rollup.replace,values:{...e.options.replace,...e.options.rollup.replace.values}}),e.options.rollup.alias&&De({customResolver:s?.resolveId,...e.options.rollup.alias,entries:o}),s,e.options.rollup.isolatedDeclarations&&e.options.isolatedDeclarationTransformer?_o(e.options.isolatedDeclarationTransformer,e.options.rollup.isolatedDeclarations):await Tn(i)(e),e.options.cjsInterop&&e.options.emitCJS&&Me({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.patchTypes&&yn(e.options.rollup.patchTypes,e.logger),Tt(),e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dtsTemplate=="function"&&Re({licenseFilePath:e.options.rollup.license.path,licenseTemplate:e.options.rollup.license.dtsTemplate,logger:e.logger,marker:e.options.rollup.license.dependenciesMarker??"TYPE_DEPENDENCIES",mode:"types",packageName:e.pkg.name})].filter(Boolean)}},"getRollupDtsOptions");var An=Object.defineProperty,qn=f((e,t)=>An(e,"name",{value:t,configurable:!0}),"c$2");const Y=qn(async(e,t)=>{const o=await Ze(e,t);if(await e.hooks.callHook("rollup:options",e,o),Object.keys(o.input).length===0)return;const n="rollup-build.json";o.cache=t.get(n);const r=await T.rollup(o);t.set(n,r.cache),await e.hooks.callHook("rollup:build",e,r);const s=o.output,i=new Map;for(const l of s){const{output:a}=await r.write(l),c=new Set,p=a.filter(m=>m.type==="chunk");for(const m of p){c.add(m.fileName);for(const y of m.imports)e.usedImports.add(y);m.isEntry&&e.buildEntries.push({bytes:Buffer.byteLength(m.code,"utf8"),chunks:m.imports.filter(y=>p.find(h=>h.fileName===y)),exports:m.exports,modules:Object.entries(m.modules).map(([y,h])=>({bytes:h.renderedLength,id:y})),path:m.fileName,type:"entry"})}const u=a.filter(m=>m.type==="asset");for(const m of u)i.has(m.fileName)||i.set(m.fileName,{bytes:Buffer.byteLength(m.source,"utf8"),path:m.fileName,type:"asset"});for(const m of c)e.usedImports.delete(m)}e.buildEntries.push(...i.values())},"build");var Ln=Object.defineProperty,L=f((e,t)=>Ln(e,"name",{value:t,configurable:!0}),"r$1");const K=L(async(e,t)=>{const o=await et(e,t);if(await e.hooks.callHook("rollup:dts:options",e,o),Object.keys(o.input).length===0)return;const n="rollup-dts.json";o.cache=t.get(n);const r=await T.rollup(o);t.set(n,r.cache),await e.hooks.callHook("rollup:dts:build",e,r),e.logger.info({message:"Building declaration files...",prefix:"dts"}),e.options.emitCJS&&await r.write({chunkFileNames:L(s=>_(e,s,"d.cts"),"chunkFileNames"),dir:d.resolve(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.cts"}),e.options.emitESM&&await r.write({chunkFileNames:L(s=>_(e,s,"d.mts"),"chunkFileNames"),dir:d.resolve(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.mts"}),(e.options.declaration===!0||e.options.declaration==="compatible")&&await r.write({chunkFileNames:L(s=>_(e,s,"d.ts"),"chunkFileNames"),dir:d.resolve(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.ts"}),await e.hooks.callHook("rollup:dts:done",e)},"buildTypes");var Bn=Object.defineProperty,ae=f((e,t)=>Bn(e,"name",{value:t,configurable:!0}),"i$2");const Jn=ae(e=>{const{message:t,name:o="Error",stack:n}=e;if(!n)return n;const r=`${o}: ${t}
57
+ `;return n.startsWith(r)?n.slice(r.length):n},"extractStack"),Wn=ae(e=>`
58
58
  ${e.replaceAll(/^\n|\n$/g,"")}
59
- `,"normalizeCodeFrame"),et=ie(e=>{const t=An(e);let o=(e.plugin?`[${e.plugin}] `:"")+e.message;e.id&&(o+=`
59
+ `,"normalizeCodeFrame"),tt=ae(e=>{const t=Jn(e);let o=(e.plugin?`[${e.plugin}] `:"")+e.message;e.id&&(o+=`
60
60
  file: ${g.cyan(e.id+(e.loc?":"+e.loc.line+":"+e.loc.column:""))}`),e.frame&&(o+=`
61
- `+g.yellow(qn(e.frame))),e.message=o,t!==void 0&&(e.stack=`${e.message}
62
- ${t}`)},"enhanceRollupError");var Ln=Object.defineProperty,tt=f((e,t)=>Ln(e,"name",{value:t,configurable:!0}),"l$2");const $e=tt((e,t,o)=>{const r="watcher:"+t;e.on("change",(n,{event:s})=>{o.info({message:`${g.cyan(m.relative(".",n))} was ${s}d`,prefix:r})}),e.on("restart",()=>{o.info({message:"Rebuilding "+t+"...",prefix:r})}),e.on("event",async n=>{switch(n.code){case"END":{o.success({message:"Rebuild "+t+" finished",prefix:r});break}case"BUNDLE_START":{o.info({message:g.cyan("build started..."),prefix:r});break}case"BUNDLE_END":{await n.result.close(),o.info({message:g.cyan(`built in ${n.duration+""}ms.`),prefix:r});break}case"ERROR":{et(n.error),o.error({context:[n.error],message:"Rebuild "+t+" failed: "+n.error.message,prefix:r});break}}})},"watchHandler"),Bn=tt(async(e,t)=>{const o=await Qe(e,t);if(await e.hooks.callHook("rollup:options",e,o),Object.keys(o.input).length===0)return;o.cache=t.get("rollup-watch"),typeof o.watch=="object"&&o.watch.include===void 0&&(o.watch.include=[m.join(e.options.sourceDir,"**")],o.watch.chokidar={cwd:e.options.rootDir,...o.watch.chokidar});const r=R.watch(o);await e.hooks.callHook("rollup:watch",e,r);const n=[...Array.isArray(o.input)?o.input:typeof o.input=="string"?[o.input]:Object.keys(o.input??{})];let s="Starting watchers for entries:";for(const i of n)s+=g.gray(`
63
- └─ ${m.relative(process.cwd(),i)}`);if(e.logger.info(s),$e(r,"bundle",e.logger),e.options.declaration){const i=await Ze(e,t);await e.hooks.callHook("rollup:dts:options",e,i);const a=R.watch(i);await e.hooks.callHook("rollup:watch",e,a),$e(a,"types",e.logger)}},"watch");var Jn=Object.defineProperty,Wn=f((e,t)=>Jn(e,"name",{value:t,configurable:!0}),"i$1");const ot=Wn(e=>`{ ${Object.keys(e).map(t=>`${t}: ${JSON.stringify(e[t])}`).join(", ")} }`,"dumpObject");var zn=Object.defineProperty,Un=f((e,t)=>zn(e,"name",{value:t,configurable:!0}),"a$2");class Hn{static{f(this,"p")}static{Un(this,"FileCache")}#n;#e;#r;#t=!0;#o=new Map;#s;constructor(t,o,r){this.#n=t,this.#e=Ot.findCacheDirSync("@visulima/packem",{cwd:t}),this.#r=o,this.#s=r,this.#e===void 0?r.debug("Could not create cache directory."):r.debug(`Cache path is: ${this.#e}`)}set isEnabled(t){this.#t=t}get cachePath(){return this.#e}has(t,o){return!this.#t||this.#e===void 0?!1:v.isAccessibleSync(this.getFilePath(t,o))}get(t,o){if(!this.#t||this.#e===void 0)return;const r=this.getFilePath(t,o);if(this.#o.has(r))return this.#o.get(r);if(!v.isAccessibleSync(r))return;const n=v.readFileSync(r);try{const s=JSON.parse(n);return this.#o.set(r,s),s}catch{this.#s.warn(`Could not parse cache file: ${r}, deleting the broken cache file.`),this.#o.delete(r),U.rmSync(r,{force:!0});return}}set(t,o,r){if(!this.#t||this.#e===void 0||o===void 0)return;const n=this.getFilePath(t,r);typeof o=="object"&&(o=JSON.stringify(o)),v.writeFileSync(n,o,{overwrite:!0})}getFilePath(t,o){let r=t.replaceAll(m.toNamespacedPath(this.#n),"");return r=r.replaceAll(":","-"),m.join(this.#e,this.#r,o?.replaceAll(":","-")??"",m.toNamespacedPath(r))}}var Vn=Object.defineProperty,B=f((e,t)=>Vn(e,"name",{value:t,configurable:!0}),"l$1");const Xn=T.createFilter,Gn=B((e,t)=>{const{sideEffects:o}=t;let r;if(typeof o=="boolean")r=B(()=>o,"hasSideEffects");else if(Array.isArray(o))if(o.length<=0)r=B(()=>!1,"hasSideEffects");else{const n=o.map(s=>s.includes("/")?s:`**/${s}`);r=Xn(n,null,{resolve:e})}else r=B(()=>null,"hasSideEffects");return r},"getPackageSideEffect");var Yn=Object.defineProperty,Kn=f((e,t)=>Yn(e,"name",{value:t,configurable:!0}),"y");const Qn=Kn((e,t,o)=>e.reduce((r,n)=>{const s=n[t],i=n[o];return r[s]||(r[s]={}),r[s][i]||(r[s][i]=[]),r[s][i].push(n),r},{}),"groupByKeys");var Zn=Object.defineProperty,er=f((e,t)=>Zn(e,"name",{value:t,configurable:!0}),"o");const tr=er(e=>{const t=new Set,o=new Set(Object.keys(e.pkg.dependencies??{})),r=new Set;for(const n of e.usedImports)o.delete(n),t.add(n);if(Array.isArray(e.options.dependencies))for(const n of e.options.dependencies)o.delete(n);for(const n of t)!Z(e.options.externals,n)&&!n.startsWith("chunks/")&&!e.options.dependencies.includes(ee(n))&&!e.options.peerDependencies.includes(ee(n))&&r.add(n);o.size>0&&A(e,`Potential unused dependencies found: ${[...o].map(n=>g.cyan(n)).join(", ")}`),r.size>0&&A(e,`Potential implicit dependencies found: ${[...r].map(n=>g.cyan(n)).join(", ")}`)},"validateDependencies");var or=Object.defineProperty,nt=f((e,t)=>or(e,"name",{value:t,configurable:!0}),"i");const nr=nt((e,t)=>St.distance(e,t)<=e.length/3||t.includes(e),"isSimilar"),rr=nt((e,t)=>{const o=e.toLowerCase();return t.filter(r=>nr(r.toLowerCase(),o))},"findAlternatives");var sr=Object.defineProperty,we=f((e,t)=>sr(e,"name",{value:t,configurable:!0}),"n");const ir=we((e,t)=>{const o=new Set([...typeof e.bin=="string"?[e.bin]:Object.values(e.bin??{}),e.main,e.module,t.options.declaration?e.types:"",t.options.declaration?e.typings:"",...ne(e.exports,e.type??"commonjs",t.options.declaration).map(n=>n.file)].map(n=>n&&m.resolve(t.rootDir,n.replace(/\/[^*/]*\*[^\n\r/\u2028\u2029]*(?:[\n\r\u2028\u2029][^*/]*\*[^\n\r/\u2028\u2029]*)*(?:\/.*)?$/,"")))),r=[];for(const n of o)n&&!n.includes("*")&&!U.existsSync(n)&&r.push(n.replace(`${t.rootDir}/`,""));if(r.length>0){const n=we(a=>m.relative(t.rootDir,m.resolve(t.options.outDir,a)),"rPath"),s=t.buildEntries.filter(a=>!a.chunk).map(a=>n(a.path));let i="Potential missing or wrong package.json files:";for(const a of r){const l=rr(a,s);i+=`
64
- - `+g.cyan(a)+(l.length>0?g.grey` (did you mean ${l.map(c=>`"${c}"`).join(", ")}?)`:"")}A(t,i)}},"validatePackage");var ar=Object.defineProperty,k=f((e,t)=>ar(e,"name",{value:t,configurable:!0}),"h");const rt=k((e,t)=>{if(e.warnings.size>0&&(t&&e.logger.raw(`
61
+ `+g.yellow(Wn(e.frame))),e.message=o,t!==void 0&&(e.stack=`${e.message}
62
+ ${t}`)},"enhanceRollupError");var Un=Object.defineProperty,ot=f((e,t)=>Un(e,"name",{value:t,configurable:!0}),"l$2");const je=ot((e,t,o)=>{const n="watcher:"+t;e.on("change",(r,{event:s})=>{o.info({message:`${g.cyan(d.relative(".",r))} was ${s}d`,prefix:n})}),e.on("restart",()=>{o.info({message:"Rebuilding "+t+"...",prefix:n})}),e.on("event",async r=>{switch(r.code){case"END":{o.success({message:"Rebuild "+t+" finished",prefix:n});break}case"BUNDLE_START":{o.info({message:g.cyan("build started..."),prefix:n});break}case"BUNDLE_END":{await r.result.close(),o.info({message:g.cyan(`built in ${r.duration+""}ms.`),prefix:n});break}case"ERROR":{tt(r.error),o.error({context:[r.error],message:"Rebuild "+t+" failed: "+r.error.message,prefix:n});break}}})},"watchHandler"),zn=ot(async(e,t)=>{const o=await Ze(e,t);if(await e.hooks.callHook("rollup:options",e,o),Object.keys(o.input).length===0)return;o.cache=t.get("rollup-watch"),typeof o.watch=="object"&&o.watch.include===void 0&&(o.watch.include=[d.join(e.options.sourceDir,"**")],o.watch.chokidar={cwd:e.options.rootDir,...o.watch.chokidar});const n=T.watch(o);await e.hooks.callHook("rollup:watch",e,n);const r=[...Array.isArray(o.input)?o.input:typeof o.input=="string"?[o.input]:Object.keys(o.input??{})];let s="Starting watchers for entries:";for(const i of r)s+=g.gray(`
63
+ └─ ${d.relative(process.cwd(),i)}`);if(e.logger.info(s),je(n,"bundle",e.logger),e.options.declaration){const i=await et(e,t);await e.hooks.callHook("rollup:dts:options",e,i);const l=T.watch(i);await e.hooks.callHook("rollup:watch",e,l),je(l,"types",e.logger)}},"watch");var Hn=Object.defineProperty,Vn=f((e,t)=>Hn(e,"name",{value:t,configurable:!0}),"i$1");const nt=Vn(e=>`{ ${Object.keys(e).map(t=>`${t}: ${JSON.stringify(e[t])}`).join(", ")} }`,"dumpObject");var Xn=Object.defineProperty,Gn=f((e,t)=>Xn(e,"name",{value:t,configurable:!0}),"a$2");class Yn{static{f(this,"p")}static{Gn(this,"FileCache")}#n;#e;#r;#t=!0;#o=new Map;#s;constructor(t,o,n){this.#n=t,this.#e=Dt.findCacheDirSync("@visulima/packem",{cwd:t}),this.#r=o,this.#s=n,this.#e===void 0?n.debug("Could not create cache directory."):n.debug(`Cache path is: ${this.#e}`)}set isEnabled(t){this.#t=t}get cachePath(){return this.#e}has(t,o){return!this.#t||this.#e===void 0?!1:v.isAccessibleSync(this.getFilePath(t,o))}get(t,o){if(!this.#t||this.#e===void 0)return;const n=this.getFilePath(t,o);if(this.#o.has(n))return this.#o.get(n);if(!v.isAccessibleSync(n))return;const r=v.readFileSync(n);try{const s=JSON.parse(r);return this.#o.set(n,s),s}catch{this.#s.warn(`Could not parse cache file: ${n}, deleting the broken cache file.`),this.#o.delete(n),z.rmSync(n,{force:!0});return}}set(t,o,n){if(!this.#t||this.#e===void 0||o===void 0)return;const r=this.getFilePath(t,n);typeof o=="object"&&(o=JSON.stringify(o)),v.writeFileSync(r,o,{overwrite:!0})}getFilePath(t,o){let n=t.replaceAll(d.toNamespacedPath(this.#n),"");return n=n.replaceAll(":","-"),d.join(this.#e,this.#r,o?.replaceAll(":","-")??"",d.toNamespacedPath(n))}}var Kn=Object.defineProperty,B=f((e,t)=>Kn(e,"name",{value:t,configurable:!0}),"l$1");const Qn=M.createFilter,Zn=B((e,t)=>{const{sideEffects:o}=t;let n;if(typeof o=="boolean")n=B(()=>o,"hasSideEffects");else if(Array.isArray(o))if(o.length<=0)n=B(()=>!1,"hasSideEffects");else{const r=o.map(s=>s.includes("/")?s:`**/${s}`);n=Qn(r,null,{resolve:e})}else n=B(()=>null,"hasSideEffects");return n},"getPackageSideEffect");var er=Object.defineProperty,tr=f((e,t)=>er(e,"name",{value:t,configurable:!0}),"y");const or=tr((e,t,o)=>e.reduce((n,r)=>{const s=r[t],i=r[o];return n[s]||(n[s]={}),n[s][i]||(n[s][i]=[]),n[s][i].push(r),n},{}),"groupByKeys");var nr=Object.defineProperty,rr=f((e,t)=>nr(e,"name",{value:t,configurable:!0}),"o");const sr=rr(e=>{const t=new Set,o=new Set(Object.keys(e.pkg.dependencies??{})),n=new Set;for(const r of e.usedImports)o.delete(r),t.add(r);if(Array.isArray(e.options.dependencies))for(const r of e.options.dependencies)o.delete(r);for(const r of t)!Z(e.options.externals,r)&&!r.startsWith("chunks/")&&!e.options.dependencies.includes(ee(r))&&!e.options.peerDependencies.includes(ee(r))&&n.add(r);o.size>0&&A(e,`Potential unused dependencies found: ${[...o].map(r=>g.cyan(r)).join(", ")}`),n.size>0&&A(e,`Potential implicit dependencies found: ${[...n].map(r=>g.cyan(r)).join(", ")}`)},"validateDependencies");var ir=Object.defineProperty,rt=f((e,t)=>ir(e,"name",{value:t,configurable:!0}),"i");const ar=rt((e,t)=>St.distance(e,t)<=e.length/3||t.includes(e),"isSimilar"),lr=rt((e,t)=>{const o=e.toLowerCase();return t.filter(n=>ar(n.toLowerCase(),o))},"findAlternatives");var cr=Object.defineProperty,we=f((e,t)=>cr(e,"name",{value:t,configurable:!0}),"n");const pr=we((e,t)=>{const o=new Set([...typeof e.bin=="string"?[e.bin]:Object.values(e.bin??{}),e.main,e.module,t.options.declaration?e.types:"",t.options.declaration?e.typings:"",...re(e.exports,e.type??"commonjs",t.options.declaration).map(r=>r.file)].map(r=>r&&d.resolve(t.rootDir,r.replace(/\/[^*/]*\*[^\n\r/\u2028\u2029]*(?:[\n\r\u2028\u2029][^*/]*\*[^\n\r/\u2028\u2029]*)*(?:\/.*)?$/,"")))),n=[];for(const r of o)r&&!r.includes("*")&&!z.existsSync(r)&&n.push(r.replace(`${t.rootDir}/`,""));if(n.length>0){const r=we(l=>d.relative(t.rootDir,d.resolve(t.options.outDir,l)),"rPath"),s=t.buildEntries.filter(l=>!l.chunk).map(l=>r(l.path));let i="Potential missing or wrong package.json files:";for(const l of n){const a=lr(l,s);i+=`
64
+ - `+g.cyan(l)+(a.length>0?g.grey` (did you mean ${a.map(c=>`"${c}"`).join(", ")}?)`:"")}A(t,i)}},"validatePackage");var ur=Object.defineProperty,k=f((e,t)=>ur(e,"name",{value:t,configurable:!0}),"h");const st=k((e,t)=>{if(e.warnings.size>0&&(t&&e.logger.raw(`
65
65
  `),e.logger.warn(`Build is done with some warnings:
66
66
 
67
67
  ${[...e.warnings].map(o=>`- ${o}`).join(`
68
- `)}`),e.options.failOnWarn))throw new Error("Exiting with code (1). You can change this behavior by setting `failOnWarn: false`.")},"logErrors"),lr=k(e=>{switch(e){case"preserve":case"react-native":return"preserve";case"react":return"transform";case"react-jsx":case"react-jsxdev":return"automatic";default:return}},"resolveTsconfigJsxToJsxRuntime"),cr=k((e,t,o,r,n,s,i,a,l)=>{const c=lr(l?.config.compilerOptions?.jsx),p=ct.defu(s,n,i,{alias:{},clean:!0,debug:r,declaration:!0,dependencies:[],devDependencies:[],emitCJS:!0,emitESM:!0,entries:[],externals:[...pe.builtinModules,...pe.builtinModules.map(u=>`node:${u}`)],failOnWarn:!0,fileCache:!0,minify:x.env.NODE_ENV==="production",name:(a.name??"").split("/").pop()??"default",optionalDependencies:[],outDir:"dist",peerDependencies:[],replace:{},rollup:{alias:{},cjsInterop:{addDefaultProperty:!1},commonjs:{ignoreTryCatch:!0,preserveSymlinks:!0,transformMixedEsModules:!1},dts:{compilerOptions:{baseUrl:l?.config.compilerOptions?.baseUrl??".",checkJs:!1,composite:!1,declaration:!0,declarationMap:!1,emitDeclarationOnly:!0,incremental:!1,noEmit:!1,noEmitOnError:!0,preserveSymlinks:!1,skipLibCheck:!0,target:99},respectExternal:!0},dynamicVars:{errorWhenNoFilesFound:!0,include:/\bimport\s*[(/]/},esbuild:{charset:"utf8",include:/\.[jt]sx?$/,jsx:c,jsxDev:l?.config.compilerOptions?.jsx==="react-jsxdev",jsxFactory:l?.config.compilerOptions?.jsxFactory,jsxFragment:l?.config.compilerOptions?.jsxFragmentFactory,jsxImportSource:l?.config.compilerOptions?.jsxImportSource,jsxSideEffects:!0,keepNames:!0,minifyWhitespace:x.env.NODE_ENV==="production",sourcesContent:!1,target:l?.config.compilerOptions?.target,treeShaking:!0,tsconfigRaw:l?.config},json:{preferConst:!0},license:{dependenciesTemplate:k((u,d,y)=>`
68
+ `)}`),e.options.failOnWarn))throw new Error("Exiting with code (1). You can change this behavior by setting `failOnWarn: false`.")},"logErrors"),dr=k(e=>{switch(e){case"preserve":case"react-native":return"preserve";case"react":return"transform";case"react-jsx":case"react-jsxdev":return"automatic";default:return}},"resolveTsconfigJsxToJsxRuntime"),mr=k((e,t,o,n,r,s,i,l,a)=>{const c=dr(a?.config.compilerOptions?.jsx),p=pt.defu(s,r,i,{alias:{},clean:!0,debug:n,declaration:!0,dependencies:[],devDependencies:[],emitCJS:!0,emitESM:!0,entries:[],externals:[...ue.builtinModules,...ue.builtinModules.map(u=>`node:${u}`)],failOnWarn:!0,fileCache:!0,minify:x.env.NODE_ENV==="production",name:(l.name??"").split("/").pop()??"default",optionalDependencies:[],outDir:"dist",peerDependencies:[],replace:{},rollup:{alias:{},cjsInterop:{addDefaultProperty:!1},commonjs:{ignoreTryCatch:!0,preserveSymlinks:!0,transformMixedEsModules:!1},dts:{compilerOptions:{baseUrl:a?.config.compilerOptions?.baseUrl??".",checkJs:!1,composite:!1,declaration:!0,declarationMap:!1,emitDeclarationOnly:!0,incremental:!1,noEmit:!1,noEmitOnError:!0,preserveSymlinks:!1,skipLibCheck:!0,target:99},respectExternal:!0},dynamicVars:{errorWhenNoFilesFound:!0,include:/\bimport\s*[(/]/},esbuild:{charset:"utf8",include:/\.[jt]sx?$/,jsx:c,jsxDev:a?.config.compilerOptions?.jsx==="react-jsxdev",jsxFactory:a?.config.compilerOptions?.jsxFactory,jsxFragment:a?.config.compilerOptions?.jsxFragmentFactory,jsxImportSource:a?.config.compilerOptions?.jsxImportSource,jsxSideEffects:!0,keepNames:!0,minifyWhitespace:x.env.NODE_ENV==="production",sourcesContent:!1,target:a?.config.compilerOptions?.target,treeShaking:!0,tsconfigRaw:a?.config},isolatedDeclarations:{},json:{preferConst:!0},license:{dependenciesTemplate:k((u,m,y)=>`
69
69
  # Licenses of bundled dependencies
70
70
  The published ${y} artifact additionally contains code with the following licenses:
71
71
  ${u.join(", ")}
72
72
 
73
73
  # Bundled dependencies:
74
- `+d,"dependenciesTemplate"),dtsTemplate:k((u,d,y)=>`
74
+ `+m,"dependenciesTemplate"),dtsTemplate:k((u,m,y)=>`
75
75
  # Licenses of bundled types
76
76
  The published ${y} artifact additionally contains code with the following licenses:
77
77
  ${u.join(", ")}
78
78
 
79
79
  # Bundled types:
80
- `+d,"dtsTemplate")},patchTypes:{},polyfillNode:{},preserveDynamicImports:!0,raw:{exclude:S.EXCLUDE_REGEXP,include:["**/*.data","**/*.txt"]},replace:{objectGuards:!0,preventAssignment:!0},resolve:{allowExportsFolderMapping:!1,preferBuiltins:!1},shim:!0,sucrase:{disableESTransforms:!0,enableLegacyBabel5ModuleInterop:!1,enableLegacyTypeScriptModuleInterop:l?.config.compilerOptions?.esModuleInterop===!1,include:/\.[jt]sx?$/,injectCreateRequireForImportRequire:!1,preserveDynamicImport:!0,production:x.env.NODE_ENV==="production",...l?.config.compilerOptions?.jsx&&["react","react-jsx","react-jsxdev"].includes(l.config.compilerOptions.jsx)?{jsxFragmentPragma:l.config.compilerOptions.jsxFragmentFactory,jsxImportSource:l.config.compilerOptions.jsxImportSource,jsxPragma:l.config.compilerOptions.jsxFactory,jsxRuntime:c,transforms:["typescript","jsx",...l.config.compilerOptions.esModuleInterop?["imports"]:[]]}:{transforms:["typescript",...l?.config.compilerOptions?.esModuleInterop?["imports"]:[]]}},swc:{include:/\.[jt]sx?$/,inlineSourcesContent:!1,inputSourceMap:!1,isModule:!0,jsc:{experimental:{keepImportAttributes:!0},externalHelpers:!1,keepClassNames:!0,loose:!0,parser:{decorators:l?.config.compilerOptions?.experimentalDecorators,syntax:l?"typescript":"ecmascript",[l?"tsx":"jsx"]:!0},target:l?.config.compilerOptions?.target?.toLowerCase(),transform:{decoratorMetadata:l?.config.compilerOptions?.emitDecoratorMetadata,legacyDecorator:l?.config.compilerOptions?.experimentalDecorators,react:{development:x.env.NODE_ENV!=="production",pragma:l?.config.compilerOptions?.jsxFactory,pragmaFrag:l?.config.compilerOptions?.jsxFragmentFactory,runtime:c,throwIfNamespace:!0},treatConstEnumAsEnum:l?.config.compilerOptions?.preserveConstEnums,useDefineForClassFields:l?.config.compilerOptions?.useDefineForClassFields}},module:{ignoreDynamic:!0,importInterop:"none",preserveImportMeta:!0,strict:!1,strictMode:!1,type:"es6"}},treeshake:{moduleSideEffects:Gn(t,a),preset:"recommended"},watch:{chokidar:{ignoreInitial:!0,ignorePermissionErrors:!0},clearScreen:!0,exclude:S.EXCLUDE_REGEXP}},rootDir:t,sourceDir:"src",sourcemap:!1,stub:o==="jit",stubOptions:{jiti:{alias:{},esmResolve:!0,interopDefault:!0}},transformerName:void 0});if(!p.transformerName){const u=new Map([...Object.entries(a.dependencies??{}),...Object.entries(a.devDependencies??{})]);let d="0.0.0";if(u.has("esbuild"))p.transformerName="esbuild",d=u.get("esbuild");else if(u.has("@swc/core"))p.transformerName="swc",d=u.get("@swc/core");else if(u.has("sucrase"))p.transformerName="sucrase",d=u.get("sucrase");else throw new Error("Unknown transformer, check your transformer options or install one of the supported transformers: esbuild, swc, sucrase");e.info("Using "+g.cyan("rollup ")+R.VERSION),e.info({message:"Using "+g.cyan(p.transformerName)+" "+d,prefix:"transformer"})}return p.rollup.resolve&&p.rollup.resolve.preferBuiltins===!0&&(p.rollup.polyfillNode=!1,e.debug("Disabling polyfillNode because preferBuiltins is set to true")),l?.config.compilerOptions?.isolatedModules||e.warn(`'compilerOptions.isolatedModules' is not enabled in tsconfig.
80
+ `+m,"dtsTemplate")},patchTypes:{},polyfillNode:{},preserveDynamicImports:!0,raw:{exclude:D.EXCLUDE_REGEXP,include:["**/*.data","**/*.txt"]},replace:{objectGuards:!0,preventAssignment:!0},resolve:{allowExportsFolderMapping:!1,preferBuiltins:!1},shim:!0,sucrase:{disableESTransforms:!0,enableLegacyBabel5ModuleInterop:!1,enableLegacyTypeScriptModuleInterop:a?.config.compilerOptions?.esModuleInterop===!1,include:/\.[jt]sx?$/,injectCreateRequireForImportRequire:!1,preserveDynamicImport:!0,production:x.env.NODE_ENV==="production",...a?.config.compilerOptions?.jsx&&["react","react-jsx","react-jsxdev"].includes(a.config.compilerOptions.jsx)?{jsxFragmentPragma:a.config.compilerOptions.jsxFragmentFactory,jsxImportSource:a.config.compilerOptions.jsxImportSource,jsxPragma:a.config.compilerOptions.jsxFactory,jsxRuntime:c,transforms:["typescript","jsx",...a.config.compilerOptions.esModuleInterop?["imports"]:[]]}:{transforms:["typescript",...a?.config.compilerOptions?.esModuleInterop?["imports"]:[]]}},swc:{include:/\.[jt]sx?$/,inlineSourcesContent:!1,inputSourceMap:!1,isModule:!0,jsc:{experimental:{keepImportAttributes:!0},externalHelpers:!1,keepClassNames:!0,loose:!0,parser:{decorators:a?.config.compilerOptions?.experimentalDecorators,syntax:a?"typescript":"ecmascript",[a?"tsx":"jsx"]:!0},target:a?.config.compilerOptions?.target?.toLowerCase(),transform:{decoratorMetadata:a?.config.compilerOptions?.emitDecoratorMetadata,legacyDecorator:a?.config.compilerOptions?.experimentalDecorators,react:{development:x.env.NODE_ENV!=="production",pragma:a?.config.compilerOptions?.jsxFactory,pragmaFrag:a?.config.compilerOptions?.jsxFragmentFactory,runtime:c,throwIfNamespace:!0},treatConstEnumAsEnum:a?.config.compilerOptions?.preserveConstEnums,useDefineForClassFields:a?.config.compilerOptions?.useDefineForClassFields}},module:{ignoreDynamic:!0,importInterop:"none",preserveImportMeta:!0,strict:!1,strictMode:!1,type:"es6"},transform:{decoratorVersion:"2022-03"}},treeshake:{moduleSideEffects:Zn(t,l),preset:"recommended"},watch:{chokidar:{ignoreInitial:!0,ignorePermissionErrors:!0},clearScreen:!0,exclude:D.EXCLUDE_REGEXP}},rootDir:t,sourceDir:"src",sourcemap:!1,stub:o==="jit",stubOptions:{jiti:{alias:{},esmResolve:!0,interopDefault:!0}},transformerName:void 0});if(!p.transformerName){const u=new Map([...Object.entries(l.dependencies??{}),...Object.entries(l.devDependencies??{})]);let m="0.0.0";if(u.has("esbuild"))p.transformerName="esbuild",m=u.get("esbuild");else if(u.has("@swc/core"))p.transformerName="swc",m=u.get("@swc/core");else if(u.has("sucrase"))p.transformerName="sucrase",m=u.get("sucrase");else throw new Error("Unknown transformer, check your transformer options or install one of the supported transformers: esbuild, swc, sucrase");e.info("Using "+g.cyan("rollup ")+T.VERSION),e.info({message:"Using "+g.cyan(p.transformerName)+" "+m,prefix:"transformer"})}return p.rollup.resolve&&p.rollup.resolve.preferBuiltins===!0&&(p.rollup.polyfillNode=!1,e.debug("Disabling polyfillNode because preferBuiltins is set to true")),a?.config.compilerOptions?.isolatedModules||e.warn(`'compilerOptions.isolatedModules' is not enabled in tsconfig.
81
81
  Because none of the third-party transpiler, packem uses under the hood is type-aware, some techniques or features often used in TypeScript are not properly checked and can cause mis-compilation or even runtime errors.
82
- To mitigate this, you should set the isolatedModules option to true in tsconfig and let your IDE warn you when such incompatible constructs are used.`),p.dependencies=Object.keys(a.dependencies??{}),p.peerDependencies=Object.keys(a.peerDependencies??{}),p.devDependencies=Object.keys(a.devDependencies??{}),p.optionalDependencies=Object.keys(a.optionalDependencies??{}),p.externals.push(...p.dependencies,...p.peerDependencies,...p.optionalDependencies),p},"generateOptions"),pr=k(e=>e.replace(/\.(?:js|mjs|cjs|ts|mts|cts|json|jsx|tsx)$/,""),"removeExtension"),ur=k(async(e,t)=>{e.options.entries=e.options.entries.map(o=>typeof o=="string"?{input:o}:o);for await(const o of e.options.entries){if(typeof o.name!="string"){let r=m.isAbsolute(o.input)?m.relative(t,o.input):m.normalize(o.input);r.startsWith("./")&&(r=r.slice(2)),o.name=pr(r.replace(/^src\//,""))}if(!o.input)throw new Error(`Missing entry input: ${ot(o)}`);if(o.input=m.resolve(e.options.rootDir,o.input),!v.isAccessibleSync(o.input)){const r=new Set(await z.readdir(m.dirname(o.input)));let n=!1;for(const s of S.DEFAULT_EXTENSIONS)if(r.has(m.basename(o.input)+s)){n=!0;break}if(!n)throw new at.NotFoundError("Your configured entry: "+g.cyan(o.input)+" does not exist.")}o.outDir=m.resolve(e.options.rootDir,o.outDir??e.options.outDir)}},"prepareEntries"),dr=k((e,t,o)=>{const r=k(s=>m.relative(t.rootDir,m.resolve(t.options.outDir,s)),"rPath");let n=!1;for(const s of t.buildEntries.filter(i=>!i.chunk)){let i=s.bytes??0;for(const l of s.chunks??[])i+=t.buildEntries.find(c=>c.path===l)?.bytes??0;let a=` ${g.bold(r(s.path))} (${["total size: "+g.cyan(_.formatBytes(i)),s.type!=="asset"&&s.bytes&&"chunk size: "+g.cyan(_.formatBytes(s.bytes))].filter(Boolean).join(", ")})`;if(a+=s.exports?.length?`
83
- exports: `+g.gray(s.exports.join(", ")):"",s.chunks?.length&&(a+=`
84
- ${s.chunks.map(l=>{const c=t.buildEntries.find(p=>p.path===l)??{};return g.gray(" └─ "+r(l)+g.bold(c.bytes?" ("+_.formatBytes(c?.bytes)+")":""))}).join(`
85
- `)}`),s.modules&&s.modules.length>0){const l=s.modules.filter(c=>c.id.includes("node_modules")).sort((c,p)=>(p.bytes||0)-(c.bytes||0)).map(c=>g.gray(" 📦 "+r(c.id)+g.bold(c.bytes?" ("+_.formatBytes(c.bytes)+")":""))).join(`
86
- `);a+=l.length>0?`
82
+ To mitigate this, you should set the isolatedModules option to true in tsconfig and let your IDE warn you when such incompatible constructs are used.`),p.dependencies=Object.keys(l.dependencies??{}),p.peerDependencies=Object.keys(l.peerDependencies??{}),p.devDependencies=Object.keys(l.devDependencies??{}),p.optionalDependencies=Object.keys(l.optionalDependencies??{}),p.externals.push(...p.dependencies,...p.peerDependencies,...p.optionalDependencies),p},"generateOptions"),fr=k(e=>e.replace(/\.(?:js|mjs|cjs|ts|mts|cts|json|jsx|tsx)$/,""),"removeExtension"),gr=k(async(e,t)=>{e.options.entries=e.options.entries.map(o=>typeof o=="string"?{input:o}:o);for await(const o of e.options.entries){if(typeof o.name!="string"){let n=d.isAbsolute(o.input)?d.relative(t,o.input):d.normalize(o.input);n.startsWith("./")&&(n=n.slice(2)),o.name=fr(n.replace(/^src\//,""))}if(!o.input)throw new Error(`Missing entry input: ${nt(o)}`);if(o.input=d.resolve(e.options.rootDir,o.input),!v.isAccessibleSync(o.input)){const n=new Set(await U.readdir(d.dirname(o.input)));let r=!1;for(const s of D.DEFAULT_EXTENSIONS)if(n.has(d.basename(o.input)+s)){r=!0;break}if(!r)throw new lt.NotFoundError("Your configured entry: "+g.cyan(o.input)+" does not exist.")}o.outDir=d.resolve(e.options.rootDir,o.outDir??e.options.outDir)}},"prepareEntries"),hr=k((e,t,o)=>{const n=k(s=>d.relative(t.rootDir,d.resolve(t.options.outDir,s)),"rPath");let r=!1;for(const s of t.buildEntries.filter(i=>!i.chunk)){let i=s.bytes??0;for(const a of s.chunks??[])i+=t.buildEntries.find(c=>c.path===a)?.bytes??0;let l=` ${g.bold(n(s.path))} (${["total size: "+g.cyan(S.formatBytes(i)),s.type!=="asset"&&s.bytes&&"chunk size: "+g.cyan(S.formatBytes(s.bytes))].filter(Boolean).join(", ")})`;if(l+=s.exports?.length?`
83
+ exports: `+g.gray(s.exports.join(", ")):"",s.chunks?.length&&(l+=`
84
+ ${s.chunks.map(a=>{const c=t.buildEntries.find(p=>p.path===a)??{};return g.gray(" └─ "+n(a)+g.bold(c.bytes?" ("+S.formatBytes(c?.bytes)+")":""))}).join(`
85
+ `)}`),s.modules&&s.modules.length>0){const a=s.modules.filter(c=>c.id.includes("node_modules")).sort((c,p)=>(p.bytes||0)-(c.bytes||0)).map(c=>g.gray(" 📦 "+n(c.id)+g.bold(c.bytes?" ("+S.formatBytes(c.bytes)+")":""))).join(`
86
+ `);l+=a.length>0?`
87
87
  inlined modules:
88
- `+l:""}if(t.options.declaration&&s.type==="entry"){let l=s.path.replace(/\.js$/,".d.ts"),c="commonjs";s.path.endsWith(".cjs")?l=s.path.replace(/\.cjs$/,".d.cts"):s.path.endsWith(".mjs")&&(c="module",l=s.path.replace(/\.mjs$/,".d.mts"));const p=t.buildEntries.find(u=>u.path.endsWith(l));if(p){let u;(t.options.declaration===!0||t.options.declaration==="compatible")&&!l.includes(".d.ts")&&(l=l.replace(c==="commonjs"?".d.c":".d.m",".d."),u=t.buildEntries.find(d=>d.path.endsWith(l))),a+=u&&c===o.type?`
88
+ `+a:""}if(t.options.declaration&&s.type==="entry"){let a=s.path.replace(/\.js$/,".d.ts"),c="commonjs";s.path.endsWith(".cjs")?a=s.path.replace(/\.cjs$/,".d.cts"):s.path.endsWith(".mjs")&&(c="module",a=s.path.replace(/\.mjs$/,".d.mts"));const p=t.buildEntries.find(u=>u.path.endsWith(a));if(p){let u;(t.options.declaration===!0||t.options.declaration==="compatible")&&!a.includes(".d.ts")&&(a=a.replace(c==="commonjs"?".d.c":".d.m",".d."),u=t.buildEntries.find(m=>m.path.endsWith(a))),l+=u&&c===o.type?`
89
89
  types:
90
- `+[p,u].map(d=>g.gray(" └─ ")+g.bold(r(d.path))+" (total size: "+g.cyan(_.formatBytes(d.bytes??0))+")").join(`
90
+ `+[p,u].map(m=>g.gray(" └─ ")+g.bold(n(m.path))+" (total size: "+g.cyan(S.formatBytes(m.bytes??0))+")").join(`
91
91
  `):`
92
- types: `+g.bold(r(p.path))+" (total size: "+g.cyan(_.formatBytes(p.bytes??0))+")"}}n=!0,a+=`
92
+ types: `+g.bold(n(p.path))+" (total size: "+g.cyan(S.formatBytes(p.bytes??0))+")"}}r=!0,l+=`
93
93
 
94
- `,e.raw(s.chunk?g.gray(a):a)}return n&&e.raw("Σ Total dist size (byte size):",g.cyan(_.formatBytes(t.buildEntries.reduce((s,i)=>s+(i.bytes??0),0))),`
95
- `),n},"showSizeInformation"),mr=k(async(e,t,o,r,n,s,i,a)=>{const l=po(s.preset??n.preset??"auto",t),c=cr(e,t,o,r,n,s,l,i,a);v.ensureDirSync(m.join(c.rootDir,c.outDir));const p={buildEntries:[],dependencyGraphMap:new Map,hooks:pt.createHooks(),logger:e,mode:o,options:c,pkg:i,rootDir:t,tsconfig:a,usedImports:new Set,warnings:new Set};if(l.hooks&&p.hooks.addHooks(l.hooks),n.hooks&&p.hooks.addHooks(n.hooks),s.hooks&&p.hooks.addHooks(s.hooks),await p.hooks.callHook("build:prepare",p),!p.options.emitESM&&!p.options.emitCJS)throw new Error("Both emitESM and emitCJS are disabled. At least one of them must be enabled.");if(p.options.declaration&&a===void 0)throw new Error("Cannot build declaration files without a tsconfig.json");return p.options.emitESM===void 0&&p.logger.info("Emitting ESM bundles, is disabled."),p.options.emitCJS===void 0&&p.logger.info("Emitting CJS bundles, is disabled."),p.options.declaration||p.logger.info("Declaration files, are disabled."),p},"createContext"),fr=k(async e=>{const t=[];if(e.options.clean)for(const o of new Set(e.options.entries.map(r=>r.outDir).filter(Boolean).sort()))o===e.options.rootDir||e.options.rootDir.startsWith(o.endsWith("/")?o:`${o}/`)||t.some(r=>o.startsWith(r))||(t.push(o),e.logger.info(`Cleaning dist directory: \`./${m.relative(e.options.rootDir,o)}\``),await v.emptyDir(o))},"cleanDistributionDirectories"),gr=k(async(e,t,o)=>{await e.hooks.callHook("build:before",e);const r=Qn(e.options.entries,"environment","runtime"),n=[];for(const[i,a]of Object.entries(r))for(const[l,c]of Object.entries(a)){e.logger.info("Preparing build for "+g.cyan(i)+" environment with "+g.cyan(l)+" runtime"),e.options.rollup.replace?(e.options.rollup.replace.values={...e.options.rollup.replace.values,production:i},l==="edge-light"&&(e.options.rollup.replace.values.EdgeRuntime="edge-runtime")):e.logger.warn("'replace' plugin is disabled. You should enable it to replace 'process.env.*' environments.");const p=[],u=[],d=[];for(const h of c)h.cjs&&h.esm?p.push(h):h.cjs?d.push(h):h.esm&&u.push(h);const y=i!=="development"&&e.options.minify;if(p.length>0){const h={...e,options:{...e.options,emitCJS:!0,emitESM:!0,entries:p,minify:y}};n.push(Y(h,o));const $=h.options.entries.filter(w=>w.declaration);e.options.declaration&&$.length>0&&n.push(K({...h,options:{...h.options,entries:$}},o))}if(u.length>0){const h={...e,options:{...e.options,emitCJS:!1,emitESM:!0,entries:u,minify:y}};n.push(Y(h,o));const $=h.options.entries.filter(w=>w.declaration);e.options.declaration&&$.length>0&&n.push(K({...h,options:{...h.options,entries:$}},o))}if(d.length>0){const h={...e,options:{...e.options,emitCJS:!1,emitESM:!1,entries:d,minify:y}};n.push(Y(h,o));const $=h.options.entries.filter(w=>w.declaration);e.options.declaration&&$.length>0&&n.push(K({...h,options:{...h.options,entries:$}},o))}}await Promise.all(n),e.logger.success(g.green(`Build succeeded for ${e.options.name}`));for await(const i of v.walk(m.join(e.options.rootDir,e.options.outDir))){let a=e.buildEntries.find(l=>m.join(e.options.rootDir,e.options.outDir,l.path)===i.path);if(a||(a={chunk:!0,path:i.path},e.buildEntries.push(a)),!a.bytes){const l=await z.stat(m.resolve(e.options.rootDir,e.options.outDir,i.path));a.bytes=l.size}}const s=dr(e.logger,e,t);tr(e),ir(t,e),await e.hooks.callHook("build:done",e),rt(e,s)},"build"),hr=k(async(e,t,o,r={})=>{const{configPath:n,debug:s,tsconfigPath:i,...a}=r;o.wrapAll(),e=m.resolve(x.cwd(),e),o.debug("Root directory:",e);const l=m.join(e,"package.json"),c=lt.parsePackageJson(l);o.debug("Using package.json found at",l);let p;if(i){const u=m.join(e,i);if(!await v.isAccessible(u))throw new Error("tsconfig.json not found at "+u);p={config:le.readTsConfig(u),path:u},o.info("Using tsconfig settings at",u)}else try{p=await le.findTsConfig(e),o.debug("Using tsconfig settings found at",p.path)}catch{o.info("No tsconfig.json or jsconfig.json found.")}try{const u=n??"./packem.config.ts";if(!/\.(?:js|mjs|cjs|ts)$/.test(u))throw new Error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts extensions are allowed.");const d=_e(u,e);o.debug("Using packem config found at",m.join(e,u));const y=Date.now(),h=k(()=>_.duration(Math.floor(Date.now()-y)),"getDuration"),$=P(JSON.stringify({version:c.version,...c.dependencies,...c.devDependencies,browser:c.browser,eNode:c.engines?.node,exports:c.exports,main:c.main,module:c.module,type:c.type,types:c.types})),w=new Hn(e,$,o);w.cachePath&&!v.isAccessibleSync(m.join(w.cachePath,$))&&v.isAccessibleSync(w.cachePath)&&(o.info("Clearing file cache because the cache key has changed."),await v.emptyDir(w.cachePath));const b=await mr(o,e,t,s??!1,a,d,c,p);if(w.isEnabled=b.options.fileCache,await ur(b,e),b.logger.info(g.cyan((t==="watch"?"Watching":t==="jit"?"Stubbing":"Building")+" "+b.options.name)),b.logger.debug(`${g.bold("Root dir:")} ${b.options.rootDir}
94
+ `,e.raw(s.chunk?g.gray(l):l)}return r&&e.raw("Σ Total dist size (byte size):",g.cyan(S.formatBytes(t.buildEntries.reduce((s,i)=>s+(i.bytes??0),0))),`
95
+ `),r},"showSizeInformation"),yr=k(async(e,t,o,n,r,s,i,l)=>{const a=uo(s.preset??r.preset??"auto",t),c=mr(e,t,o,n,r,s,a,i,l);v.ensureDirSync(d.join(c.rootDir,c.outDir));const p={buildEntries:[],dependencyGraphMap:new Map,hooks:ut.createHooks(),logger:e,mode:o,options:c,pkg:i,rootDir:t,tsconfig:l,usedImports:new Set,warnings:new Set};if(a.hooks&&p.hooks.addHooks(a.hooks),r.hooks&&p.hooks.addHooks(r.hooks),s.hooks&&p.hooks.addHooks(s.hooks),await p.hooks.callHook("build:prepare",p),!p.options.emitESM&&!p.options.emitCJS)throw new Error("Both emitESM and emitCJS are disabled. At least one of them must be enabled.");if(p.options.declaration&&l===void 0)throw new Error("Cannot build declaration files without a tsconfig.json");return p.options.emitESM===void 0&&p.logger.info("Emitting ESM bundles, is disabled."),p.options.emitCJS===void 0&&p.logger.info("Emitting CJS bundles, is disabled."),p.options.declaration||p.logger.info("Declaration files, are disabled."),p},"createContext"),vr=k(async e=>{const t=[];if(e.options.clean)for(const o of new Set(e.options.entries.map(n=>n.outDir).filter(Boolean).sort()))o===e.options.rootDir||o===e.options.sourceDir||e.options.rootDir.startsWith(o.endsWith("/")?o:`${o}/`)||t.some(n=>o.startsWith(n))||(t.push(o),e.logger.info(`Cleaning dist directory: \`./${d.relative(e.options.rootDir,o)}\``),await v.emptyDir(o))},"cleanDistributionDirectories"),br=k(async(e,t,o)=>{await e.hooks.callHook("build:before",e);const n=or(e.options.entries,"environment","runtime"),r=[];for(const[i,l]of Object.entries(n))for(const[a,c]of Object.entries(l)){e.logger.info("Preparing build for "+g.cyan(i)+" environment with "+g.cyan(a)+" runtime"),e.options.rollup.replace?(e.options.rollup.replace.values={...e.options.rollup.replace.values,production:i},a==="edge-light"&&(e.options.rollup.replace.values.EdgeRuntime="edge-runtime")):e.logger.warn("'replace' plugin is disabled. You should enable it to replace 'process.env.*' environments.");const p=[],u=[],m=[];for(const h of c)h.cjs&&h.esm?p.push(h):h.cjs?m.push(h):h.esm&&u.push(h);const y=i!=="development"&&e.options.minify;if(p.length>0){const h={...e,options:{...e.options,emitCJS:!0,emitESM:!0,entries:p,minify:y}};r.push(Y(h,o));const $=h.options.entries.filter(j=>j.declaration);e.options.declaration&&$.length>0&&r.push(K({...h,options:{...h.options,entries:$}},o))}if(u.length>0){const h={...e,options:{...e.options,emitCJS:!1,emitESM:!0,entries:u,minify:y}};r.push(Y(h,o));const $=h.options.entries.filter(j=>j.declaration);e.options.declaration&&$.length>0&&r.push(K({...h,options:{...h.options,entries:$}},o))}if(m.length>0){const h={...e,options:{...e.options,emitCJS:!1,emitESM:!1,entries:m,minify:y}};r.push(Y(h,o));const $=h.options.entries.filter(j=>j.declaration);e.options.declaration&&$.length>0&&r.push(K({...h,options:{...h.options,entries:$}},o))}}await Promise.all(r),e.logger.success(g.green(`Build succeeded for ${e.options.name}`));for await(const i of v.walk(d.join(e.options.rootDir,e.options.outDir))){let l=e.buildEntries.find(a=>d.join(e.options.rootDir,e.options.outDir,a.path)===i.path);if(l||(l={chunk:!0,path:i.path},e.buildEntries.push(l)),!l.bytes){const a=await U.stat(d.resolve(e.options.rootDir,e.options.outDir,i.path));l.bytes=a.size}}const s=hr(e.logger,e,t);sr(e),pr(t,e),await e.hooks.callHook("build:done",e),st(e,s)},"build"),$r=k(async(e,t,o,n={})=>{const{configPath:r,debug:s,tsconfigPath:i,...l}=n;o.wrapAll(),e=d.resolve(x.cwd(),e),o.debug("Root directory:",e);const a=d.join(e,"package.json"),c=ct.parsePackageJson(a);o.debug("Using package.json found at",a);let p;if(i){const u=d.join(e,i);if(!await v.isAccessible(u))throw new Error("tsconfig.json not found at "+u);p={config:ce.readTsConfig(u),path:u},o.info("Using tsconfig settings at",u)}else try{p=await ce.findTsConfig(e),o.debug("Using tsconfig settings found at",p.path)}catch{o.info("No tsconfig.json or jsconfig.json found.")}try{const u=r??"./packem.config.ts";if(!/\.(?:js|mjs|cjs|ts)$/.test(u))throw new Error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts extensions are allowed.");const m=_e(u,e);o.debug("Using packem config found at",d.join(e,u));const y=Date.now(),h=k(()=>S.duration(Math.floor(Date.now()-y)),"getDuration"),$=P(JSON.stringify({version:c.version,...c.dependencies,...c.devDependencies,browser:c.browser,eNode:c.engines?.node,exports:c.exports,main:c.main,module:c.module,type:c.type,types:c.types})),j=new Yn(e,$,o);j.cachePath&&!v.isAccessibleSync(d.join(j.cachePath,$))&&v.isAccessibleSync(j.cachePath)&&(o.info("Clearing file cache because the cache key has changed."),await v.emptyDir(j.cachePath));const b=await yr(o,e,t,s??!1,l,m,c,p);if(j.isEnabled=b.options.fileCache,await gr(b,e),b.logger.info(g.cyan((t==="watch"?"Watching":t==="jit"?"Stubbing":"Building")+" "+b.options.name)),b.logger.debug(`${g.bold("Root dir:")} ${b.options.rootDir}
96
96
  ${g.bold("Entries:")}
97
- ${b.options.entries.map(F=>` ${ot(F)}`).join(`
98
- `)}`),await fr(b),b.options.stub){await Vt(b),await b.hooks.callHook("build:done",b);return}if(t==="watch"){if(b.options.rollup.watch===!1)throw new Error("Rollup watch is disabled. You should check your packem.config file.");await Bn(b,w),rt(b,!1);return}await gr(b,c,w),o.raw(`
97
+ ${b.options.entries.map(C=>` ${nt(C)}`).join(`
98
+ `)}`),await vr(b),b.options.stub){await Xt(b),await b.hooks.callHook("build:done",b);return}if(t==="watch"){if(b.options.rollup.watch===!1)throw new Error("Rollup watch is disabled. You should check your packem.config file.");await zn(b,j),st(b,!1);return}await br(b,c,j),o.raw(`
99
99
  ⚡️ Build run in `+h()),o.restoreAll()}catch(u){throw o.raw(`
100
- `),et(u),new Error("An error occurred while building",{cause:u})}},"createBundler");module.exports=hr;
100
+ `),tt(u),u}},"createBundler");module.exports=$r;
@@ -1,5 +1,5 @@
1
1
  import { Pail } from '@visulima/pail';
2
- import { M as Mode, B as BuildConfig } from './shared/packem.CvCdTosN.cjs';
2
+ import { M as Mode, B as BuildConfig } from './shared/packem.zptSY3F2.cjs';
3
3
  import '@rollup/plugin-alias';
4
4
  import '@rollup/plugin-commonjs';
5
5
  import '@rollup/plugin-json';
@@ -1,5 +1,5 @@
1
1
  import { Pail } from '@visulima/pail';
2
- import { M as Mode, B as BuildConfig } from './shared/packem.Dyuh0rNc.mjs';
2
+ import { M as Mode, B as BuildConfig } from './shared/packem.CXBj45xL.mjs';
3
3
  import '@rollup/plugin-alias';
4
4
  import '@rollup/plugin-commonjs';
5
5
  import '@rollup/plugin-json';