@visulima/packem 1.0.0-alpha.40 → 1.0.0-alpha.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/create-bundler.cjs +36 -36
- package/dist/create-bundler.mjs +24 -24
- package/dist/rollup/plugins/esbuild/index.cjs +1 -1
- package/dist/rollup/plugins/esbuild/index.mjs +2 -2
- package/dist/rollup/plugins/sucrase/index.cjs +1 -1
- package/dist/rollup/plugins/sucrase/index.mjs +2 -2
- package/dist/rollup/plugins/swc/index.cjs +1 -1
- package/dist/rollup/plugins/swc/index.mjs +2 -2
- package/dist/shared/{packem.BAcY88If.mjs → packem.0q8RrsjT.mjs} +2 -2
- package/dist/shared/packem.DUZi_m4G.cjs +1 -0
- package/package.json +3 -3
- package/dist/shared/packem.CEXB7aOL.cjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## @visulima/packem [1.0.0-alpha.41](https://github.com/visulima/packem/compare/@visulima/packem@1.0.0-alpha.40...@visulima/packem@1.0.0-alpha.41) (2024-06-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* improved caching ([a56b5cb](https://github.com/visulima/packem/commit/a56b5cb1a1ebcb5ed4afffef73dea273f8c8c73a))
|
|
7
|
+
|
|
1
8
|
## @visulima/packem [1.0.0-alpha.40](https://github.com/visulima/packem/compare/@visulima/packem@1.0.0-alpha.39...@visulima/packem@1.0.0-alpha.40) (2024-06-04)
|
|
2
9
|
|
|
3
10
|
|
package/dist/cli.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var v=Object.defineProperty;var r=(n,e)=>v(n,"name",{value:e,configurable:!0});const k=require("@visulima/cerebro"),b=require("./create-bundler.cjs"),s=require("node:process"),h=require("@antfu/install-pkg"),i=require("@clack/prompts"),c=require("@visulima/fs"),j=require("@visulima/package/package-json"),l=require("@visulima/path"),w=r(n=>n&&typeof n=="object"&&"default"in n?n.default:n,"_interopDefaultCompat"),x=w(k),C="@visulima/packem",P="1.0.0-alpha.
|
|
2
|
+
"use strict";var v=Object.defineProperty;var r=(n,e)=>v(n,"name",{value:e,configurable:!0});const k=require("@visulima/cerebro"),b=require("./create-bundler.cjs"),s=require("node:process"),h=require("@antfu/install-pkg"),i=require("@clack/prompts"),c=require("@visulima/fs"),j=require("@visulima/package/package-json"),l=require("@visulima/path"),w=r(n=>n&&typeof n=="object"&&"default"in n?n.default:n,"_interopDefaultCompat"),x=w(k),C="@visulima/packem",P="1.0.0-alpha.40";var S=Object.defineProperty,p=r((n,e)=>S(n,"name",{value:e,configurable:!0}),"n");const q=p(n=>{n.addCommand({description:"Demonstrate options required",execute:p(async({options:e})=>{let t="build";e.watch?t="watch":e.jit&&(t="jit");const a={};if(e.env)for(const o of e.env)a[o.key]=o.value;await b(e.dir,t,{cjsInterop:e.cjsInterop,configPath:e.config??void 0,debug:e.debug,minify:e.minify,replace:{...a},rollup:{esbuild:{target:e.target},license:{path:e.license},metafile:e.metafile,...e.analyze?{visualizer:{}}:{visualizer:!1}},sourcemap:e.sourcemap,tsconfigPath:e.tsconfig??void 0})},"execute"),name:"build",options:[{defaultValue:".",description:"The directory to build",name:"dir",type:String},{alias:"t",description:"Environments to support. `target` in tsconfig.json is automatically added. Defaults to the current Node.js version.",name:"target"},{description:"Use a custom config file",name:"config",type:String},{description:"Path to the tsconfig.json file",name:"tsconfig",type:String},{description:"Minify the output",name:"minify",type:Boolean},{description:"Generate sourcemaps (experimental)",name:"sourcemap",type:Boolean},{description:"Watch for changes",name:"watch",type:Boolean},{description:"Stub the package for JIT compilation",name:"jit",type:Boolean},{description:"Compile-time environment variables (eg. --env.NODE_ENV=production)",multiple:!0,name:"env",type:p(e=>{const[t,a]=e.split("=");return{key:t,value:a}},"type")},{defaultValue:!1,description:"Generate meta file (experimental)",name:"metafile",type:Boolean},{description:"Path to the license file",name:"license",type:String},{description:"Visualize and analyze the bundle",name:"analyze",type:Boolean},{description:"CJS interop mode, can export default and named export, (experimental).",name:"cjsInterop",type:Boolean}]})},"createBuildCommand");var z=Object.defineProperty,g=r((n,e)=>z(n,"name",{value:e,configurable:!0}),"i");const B=g(n=>{n.addCommand({description:"Initialize packem configuration",execute:g(async({logger:e,options:t})=>{if(i.intro("Welcome to packem setup"),c.isAccessibleSync(l.join(t.dir,"packem.config.ts")))return e.info("Packem project already initialized, you can use `packem build` to build your project"),s.exit(0);if(i.isCancel(t.transformer))return i.cancel("Operation cancelled"),s.exit(0);if(t.transformer===void 0){const u=l.join(t.dir,"package.json");if(!c.isAccessibleSync(u))return e.error("No package.json found in the directory"),s.exit(1);const d=j.parsePackageJson(u),y=[...Object.keys(d.dependencies??{}),...Object.keys(d.devDependencies??{})];if(t.transformer=await i.select({message:"Pick a transformer",options:[{label:"esbuild",value:"esbuild"},{label:"swc",value:"swc"},{label:"Sucrase",value:"sucrase"}]}),!y.includes(t.transformer)&&await i.confirm({message:"Do you want to install "+t.transformer+"?"})){const f=i.spinner();f.start("Installing "+t.transformer),await h.installPackage(t.transformer==="swc"?"@swc/core":t.transformer,{cwd:t.dir,dev:!0,silent:!0}),f.stop("")}}const a=`import { defineConfig } from "@visulima/packem/config";
|
|
3
3
|
import transformer from "@visulima/packem/transformer/${t.transformer}";
|
|
4
4
|
|
|
5
5
|
export default defineConfig({
|
package/dist/cli.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import __cjs_mod__ from "node:module";
|
|
|
7
7
|
const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
8
8
|
const __dirname = __cjs_path__.dirname(__filename);
|
|
9
9
|
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
10
|
-
const I="@visulima/packem",N="1.0.0-alpha.
|
|
10
|
+
const I="@visulima/packem",N="1.0.0-alpha.40";var O=Object.defineProperty,c=r((i,e)=>O(i,"name",{value:e,configurable:!0}),"n");const V=c(i=>{i.addCommand({description:"Demonstrate options required",execute:c(async({options:e})=>{let t="build";e.watch?t="watch":e.jit&&(t="jit");const n={};if(e.env)for(const o of e.env)n[o.key]=o.value;await b(e.dir,t,{cjsInterop:e.cjsInterop,configPath:e.config??void 0,debug:e.debug,minify:e.minify,replace:{...n},rollup:{esbuild:{target:e.target},license:{path:e.license},metafile:e.metafile,...e.analyze?{visualizer:{}}:{visualizer:!1}},sourcemap:e.sourcemap,tsconfigPath:e.tsconfig??void 0})},"execute"),name:"build",options:[{defaultValue:".",description:"The directory to build",name:"dir",type:String},{alias:"t",description:"Environments to support. `target` in tsconfig.json is automatically added. Defaults to the current Node.js version.",name:"target"},{description:"Use a custom config file",name:"config",type:String},{description:"Path to the tsconfig.json file",name:"tsconfig",type:String},{description:"Minify the output",name:"minify",type:Boolean},{description:"Generate sourcemaps (experimental)",name:"sourcemap",type:Boolean},{description:"Watch for changes",name:"watch",type:Boolean},{description:"Stub the package for JIT compilation",name:"jit",type:Boolean},{description:"Compile-time environment variables (eg. --env.NODE_ENV=production)",multiple:!0,name:"env",type:c(e=>{const[t,n]=e.split("=");return{key:t,value:n}},"type")},{defaultValue:!1,description:"Generate meta file (experimental)",name:"metafile",type:Boolean},{description:"Path to the license file",name:"license",type:String},{description:"Visualize and analyze the bundle",name:"analyze",type:Boolean},{description:"CJS interop mode, can export default and named export, (experimental).",name:"cjsInterop",type:Boolean}]})},"createBuildCommand");var D=Object.defineProperty,g=r((i,e)=>D(i,"name",{value:e,configurable:!0}),"i");const E=g(i=>{i.addCommand({description:"Initialize packem configuration",execute:g(async({logger:e,options:t})=>{if(j("Welcome to packem setup"),u(s(t.dir,"packem.config.ts")))return e.info("Packem project already initialized, you can use `packem build` to build your project"),a(0);if(w(t.transformer))return C("Operation cancelled"),a(0);if(t.transformer===void 0){const p=s(t.dir,"package.json");if(!u(p))return e.error("No package.json found in the directory"),a(1);const l=B(p),y=[...Object.keys(l.dependencies??{}),...Object.keys(l.devDependencies??{})];if(t.transformer=await x({message:"Pick a transformer",options:[{label:"esbuild",value:"esbuild"},{label:"swc",value:"swc"},{label:"Sucrase",value:"sucrase"}]}),!y.includes(t.transformer)&&await P({message:"Do you want to install "+t.transformer+"?"})){const d=f();d.start("Installing "+t.transformer),await h(t.transformer==="swc"?"@swc/core":t.transformer,{cwd:t.dir,dev:!0,silent:!0}),d.stop("")}}const n=`import { defineConfig } from "@visulima/packem/config";
|
|
11
11
|
import transformer from "@visulima/packem/transformer/${t.transformer}";
|
|
12
12
|
|
|
13
13
|
export default defineConfig({
|
package/dist/create-bundler.cjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`)=>({name:"packem:shebang",renderChunk:{handler(o,n
|
|
3
|
-
`)=>{const o=Z.exec(e);return o?o+t:""},"getShebang");var Tt=Object.defineProperty,At=f((e,t)=>Tt(e,"name",{value:t,configurable:!0}),"p$
|
|
4
|
-
`));let c=[];try{c=await L.resolveModuleExportNames(s,{extensions:O.DEFAULT_EXTENSIONS})}catch(u){A(e,`Cannot analyze ${s} for exports:${u}`);return}const p=c.includes("default")||c.length===0;await y.writeFile(`${
|
|
1
|
+
"use strict";var rt=Object.defineProperty;var f=(e,t)=>rt(e,"name",{value:t,configurable:!0});const W=require("node:fs/promises"),st=require("node:module"),b=require("node:process"),g=require("@visulima/colorize"),y=require("@visulima/fs"),it=require("@visulima/fs/error"),S=require("@visulima/humanizer"),G=require("@visulima/package"),at=require("@visulima/package/package-json"),lt=require("@visulima/pail"),U=require("@visulima/pail/processor"),m=require("@visulima/path"),ct=require("defu"),pt=require("hookable"),R=require("rollup"),O=require("./shared/packem.NVRVuzg1.cjs"),je=require("node:url"),L=require("mlly"),ut=require("magic-string"),dt=require("jiti"),J=require("node:fs"),mt=require("@rollup/plugin-alias"),ft=require("@rollup/plugin-commonjs"),gt=require("@rollup/plugin-dynamic-import-vars"),we=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"),ke=require("semver"),$t=require("glob"),jt=require("glob-parent"),wt=require("@rollup/plugin-json"),T=require("@rollup/pluginutils"),kt=require("rollup-plugin-license"),xt=require("node:crypto"),Et=require("@babel/parser"),Ot=require("fastest-levenshtein");var ae=typeof document<"u"?document.currentScript:null;const E=f(e=>e&&typeof e=="object"&&"default"in e?e.default:e,"_interopDefaultCompat"),le=E(st),N=E(ut),xe=E(dt),Ee=E(mt),_t=E(ft),St=E(gt),Oe=E(ht),Dt=E(vt),Nt=E(jt),Pt=E(wt),Ft=E(kt);var Mt=Object.defineProperty,z=f((e,t)=>Mt(e,"name",{value:t,configurable:!0}),"i$d");const Z=/^#![^\n]*/,Y=z(async e=>{await W.chmod(e,493).catch(()=>{})},"makeExecutable"),Ct=z((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"&&Z.test(s.code)&&o.dir){const l=m.resolve(o.dir,n);await Y(l)}}}),"shebangPlugin"),It=z(()=>({name:"packem:remove-shebang",renderChunk(e){return e.replace(Z,"")}}),"removeShebangPlugin"),Rt=z((e,t=`
|
|
3
|
+
`)=>{const o=Z.exec(e);return o?o+t:""},"getShebang");var Tt=Object.defineProperty,At=f((e,t)=>Tt(e,"name",{value:t,configurable:!0}),"p$4");const ee=At((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 qt=Object.defineProperty,Bt=f((e,t)=>qt(e,"name",{value:t,configurable:!0}),"o$4");const Lt=Bt((e,t)=>{const o=xe(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,Jt=f((e,t)=>Wt(e,"name",{value:t,configurable:!0}),"r$9");const A=Jt((e,t)=>{e.warnings.has(t)||e.warnings.add(t)},"warn");var zt=Object.defineProperty,Ut=f((e,t)=>zt(e,"name",{value:t,configurable:!0}),"u$7");const Ht=Ut(async e=>{const t=await L.resolvePath("jiti",{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:ae&&ae.src||new URL("create-bundler.cjs",document.baseURI).href}),o=JSON.stringify({...e.options.stubOptions.jiti,alias:{...ee(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(Lt(r.input,e.options.rootDir)||r.input),l=s.slice(0,Math.max(0,s.length-m.extname(s).length)),a=await y.readFile(s),i=Rt(a);e.options.emitCJS&&await y.writeFile(`${n}.cjs`,i+[`const jiti = require(${JSON.stringify(t)})`,"",`const _jiti = jiti(null, ${o})`,"",`/** @type {import(${JSON.stringify(l)})} */`,`module.exports = _jiti(${JSON.stringify(s)})`].join(`
|
|
4
|
+
`));let c=[];try{c=await L.resolveModuleExportNames(s,{extensions:O.DEFAULT_EXTENSIONS})}catch(u){A(e,`Cannot analyze ${s} for exports:${u}`);return}const p=c.includes("default")||c.length===0;await y.writeFile(`${n}.mjs`,i+[`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?`
|
|
5
5
|
export default _module;`:"",...c.filter(u=>u!=="default").map(u=>`export const ${u} = _module.${u};`)].join(`
|
|
6
|
-
`)),await y.writeFile(`${
|
|
7
|
-
`)),await y.writeFile(`${
|
|
8
|
-
`)),i&&(await
|
|
9
|
-
module.exports.default = `+l[2]+";");let i=a.toString();return i=i.replace(/(?:module\.)?exports(?:\['default'\]|\.default)/i,"module.exports"),t.debug({message:"Applied CommonJS interop to entry chunk "+
|
|
6
|
+
`)),await y.writeFile(`${n}.d.cts`,[`export * from ${JSON.stringify(l)};`,p?`export { default } from ${JSON.stringify(l)};`:""].join(`
|
|
7
|
+
`)),await y.writeFile(`${n}.d.mts`,[`export * from ${JSON.stringify(s)};`,p?`export { default } from ${JSON.stringify(s)};`:""].join(`
|
|
8
|
+
`)),i&&(await Y(`${n}.cjs`),await Y(`${n}.mjs`))}await e.hooks.callHook("rollup:done",e)},"createStub");var Vt=Object.defineProperty,Xt=f((e,t)=>Vt(e,"name",{value:t,configurable:!0}),"r$8");const _e=Xt((e,t)=>xe(t,{esmResolve:!0,interopDefault:!0})(e),"tryRequire");var Gt=Object.defineProperty,Se=f((e,t)=>Gt(e,"name",{value:t,configurable:!0}),"t$4");const te=Se(e=>{if(e.endsWith(".mjs")||e.endsWith(".d.mts"))return"esm";if(e.endsWith(".cjs")||e.endsWith(".d.cts"))return"cjs"},"inferExportTypeFromFileName"),De=Se((e,t,o,r)=>{if(o){const l=te(o);if(l)return l}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 De(n,s,o,r)},"inferExportType");var Yt=Object.defineProperty,Kt=f((e,t)=>Yt(e,"name",{value:t,configurable:!0}),"o$3");const oe=Kt((e,t,o,r=[])=>{if(!e)return[];if(typeof e=="string"){const n=te(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",subKey:n,type:De(n,r,s,t)}:oe(s,t,o,[...r,n]))},"extractExportFilenames");var Qt=Object.defineProperty,ne=f((e,t)=>Qt(e,"name",{value:t,configurable:!0}),"c$7");const Zt=ne(e=>{if(e.key==="exports"&&e.subKey==="production")return"production";if(e.key==="exports"&&e.subKey==="development")return"development";if(b.env.NODE_ENV){if(!b.env.NODE_ENV.includes("production")&&!b.env.NODE_ENV.includes("development"))throw new Error(`Invalid NODE_ENV value: ${b.env.NODE_ENV}, must be either "production" or "development".`);return b.env.NODE_ENV}return"production"},"getEnvironment"),ce=ne((e,t,o,r,n,s,l)=>{const a=e.find(i=>i.input===t)??e[e.push({input:t})-1];if(o&&(a.outDir=r),n.isExecutable)a.executable=!0,a.declaration=!1,a.cjs=s.type==="commonjs",a.esm=s.type==="module";else{/\.d\.[mc]?ts$/.test(n.file)&&l!==!1&&(a.declaration=l),n.type==="cjs"&&(a.cjs=!0),n.type==="esm"&&(a.esm=!0);for(const i of O.RUNTIME_EXPORT_CONVENTIONS)if(n.file.includes(i+".")){a.runtime=i;break}}a.runtime===void 0&&(a.runtime="node"),a.environment=Zt(n)},"createOrUpdateEntry"),pe=/(?:\.d\.[mc]?ts|\.\w+)$/;let ue=!1;const eo=ne((e,t,o)=>{const r=[];t.sort((a,i)=>a.split("/").length-i.split("/").length);const n=oe(e.exports,e.type??"commonjs",o.options.declaration);if(e.bin){const a=typeof e.bin=="string"?[e.bin]:Object.values(e.bin);for(const i of a)n.push({file:i,isExecutable:!0,key:"bin"})}e.main&&n.push({file:e.main,key:"main",type:te(e.main)??(e.type==="module"?"esm":"cjs")}),e.module&&n.push({file:e.module,key:"module",type:"esm"}),o.options.declaration!==!1&&(e.types||e.typings)&&n.push({file:e.types??e.typings,key:"types"});const s=e.type==="module";for(const a of n.filter(i=>!i.type)){const i=a.file.endsWith(".js");s&&i||a.file.endsWith(".mjs")?a.type="esm":(!s&&i||a.file.endsWith(".cjs"))&&(a.type="cjs")}const l=[];for(const a of n){const i=a.file.replace(/(?:\*[^/\\]|\.d\.[mc]?ts|\.\w+)$/,""),c=i.endsWith("/");if(c&&["./","/"].includes(i))continue;const p=i.replace(new RegExp("(./)?"+o.options.outDir),o.options.sourceDir);if(a.file.includes("/*")&&a.key==="exports"){ue||(o.logger.debug("Private subfolders are not supported, if you need this feature please open an issue on GitHub."),ue=!0);const h=[],w=new RegExp("(?<=/|$)"+p.replace("*","(.*)")+(c?"":"\\.\\w+"));for(const _ of t)w.test(_)&&h.push(_.replace(pe,""));if(h.length===0){r.push(`Could not find entrypoints for \`${a.file}\``);continue}for(const _ of h)ce(l,_,c,i,a,e,o.options.declaration);continue}const u=new RegExp("(?<=/|$)"+p+(c?"":"\\.\\w+")),d=t.find(h=>u.test(h))?.replace(pe,"");if(!d){J.existsSync(m.resolve(o.options.rootDir,a.file))||r.push(`Could not find entrypoint for \`${a.file}\``);continue}ce(l,d,c,i,a,e,o.options.declaration)}return{entries:l,warnings:r}},"inferEntries");var to=Object.defineProperty,oo=f((e,t)=>to(e,"name",{value:t,configurable:!0}),"t$3");const no=oo((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 ro=Object.defineProperty,so=f((e,t)=>ro(e,"name",{value:t,configurable:!0}),"n$8");const io={hooks:{"build:prepare":so(function(e){if(e.options.entries.length>0)return;const t=m.join(e.options.rootDir,"src");if(!J.existsSync(t))throw new Error("No 'src' directory found. Please provide entries manually.");const o=y.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=no(r,e.options.declaration));const n=eo(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 ao=Object.defineProperty,lo=f((e,t)=>ao(e,"name",{value:t,configurable:!0}),"t$2");const co=lo((e,t)=>(e==="auto"?e=io:typeof e=="string"&&(e=_e(e,t)),typeof e=="function"&&(e=e()),e),"resolvePreset");var po=Object.defineProperty,uo=f((e,t)=>po(e,"name",{value:t,configurable:!0}),"a$b");const K=uo((e,t)=>e.some(o=>o instanceof RegExp?o.test(t):o===t),"arrayIncludes");var mo=Object.defineProperty,fo=f((e,t)=>mo(e,"name",{value:t,configurable:!0}),"a$a");const H=fo(e=>e===void 0?[]:Array.isArray(e)?e:[e],"arrayify");var go=Object.defineProperty,ho=f((e,t)=>go(e,"name",{value:t,configurable:!0}),"a$9");const Q=ho((e="")=>{const t=e.split("/");return t[0].startsWith("@")?t[0]+"/"+t[1]:t[0]},"getPackageName");var yo=Object.defineProperty,Ne=f((e,t)=>yo(e,"name",{value:t,configurable:!0}),"s$a");const vo=Ne((e,t,o)=>{const r=o??new Map;return(...n)=>{const s=t?typeof t=="function"?t(...n):t:JSON.stringify({args:n}),l=r.get(s);if(l!==void 0)return l;const a=e(...n);return r.set(s,a),a}},"memoize"),bo=Ne(e=>{const t=new Map;return o=>vo(e,o,t)},"memoizeByKey");var $o=Object.defineProperty,jo=f((e,t)=>$o(e,"name",{value:t,configurable:!0}),"m$5");const Pe=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 l=/(exports(?:\['default'\]|\.default)) = (.*);/i.exec(r);if(l===null||l.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 = `+l[2]+";");let i=a.toString();return i=i.replace(/(?:module\.)?exports(?:\['default'\]|\.default)/i,"module.exports"),t.debug({message:"Applied CommonJS interop to entry chunk "+n.fileName+".",prefix:"plugin:cjs-interop"}),{code:i,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 l=/export\s\{\s(.*)\s\}/i.exec(r);if(l===null||l.length<2)return null;const a=l[1].split(", "),i=[];let c="";for(const u of a)if(!u.includes("type"))if(u.includes("as")){const[d,h]=u.split(" as ");if(h==="default"&&(c=d,!e))continue;i.push(h+": typeof "+d+";")}else i.push(u+": typeof "+u+";");const p=new N(r);return p.replace(" "+c+" as default,",""),p.append(`
|
|
10
10
|
|
|
11
11
|
declare const defaultExport: {
|
|
12
12
|
`+(i.length>0?" ":"")+i.join(`
|
|
13
13
|
`)+`
|
|
14
14
|
} & typeof `+c+`;
|
|
15
15
|
|
|
16
|
-
export default defaultExport;`),t.debug({message:"Applied CommonJS interop to entry chunk "+
|
|
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 wo=Object.defineProperty,ko=f((e,t)=>wo(e,"name",{value:t,configurable:!0}),"f$7");const xo=ko((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(l=>Array.isArray(l.src)?l.src.map(a=>({...l,src:a})):l).map(async l=>await $t.glob(l.src,{ignore:l.exclude}).then(a=>({dest:l.dest??"",parent:Nt(l.src),src:a}))));for(const l of s)for(const a of l.src){let i;o.has(a)?i=o.get(a):(i={copied:[],dest:[],timestamp:0},o.set(a,i));const c=r.flatten?m.normalize(l.dest):m.join(l.dest,m.relative(l.parent,m.dirname(a)));i.dest.includes(c)||i.dest.push(c),this.addWatchFile(a)}t.info({message:"Copying files...",prefix:"plugin:copy"}),await Promise.all([...o].map(async([l,a])=>{let i;try{const c=await W.stat(l);if(!c.isFile())return;const p=c.mtime.getTime();p>a.timestamp&&(a.timestamp=p,a.copied=[]),i=await y.readFile(l,{buffer:!0})}catch(c){t.error({context:[c],message:`error reading file ${l}`,prefix:"plugin:copy"});return}for(const c of a.dest){if(r.copyOnce&&a.copied.includes(c))continue;const p=m.basename(l),u=m.join(c,p);try{this.emitFile({[r.exactFileNames?"fileName":"name"]:u,source:i,type:"asset"}),t.debug({message:`copied ${l} → ${u}`,prefix:"plugin:copy"}),a.copied.push(c)}catch(d){t.error({context:[d],message:`error copying file ${l} → ${u}`,prefix:"plugin:copy"})}}}))},name:"packem:copy"}},"copyPlugin");var Eo=Object.defineProperty,Oo=f((e,t)=>Eo(e,"name",{value:t,configurable:!0}),"n$4");const de="export default ",Fe=Oo(e=>{const t=Pt(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(de)&&(n.code=n.code.replace(de,"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 So 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 l=this.should_skip,a=this.should_remove,i=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=l,this.should_remove=a,this.replacement=i,c)return t;if(p)return null}let s;for(s in t){const l=t[s];if(l&&typeof l=="object")if(Array.isArray(l)){const a=l;for(let i=0;i<a.length;i+=1){const c=a[i];me(c)&&(this.visit(c,t,s,i)||i--)}}else me(l)&&this.visit(l,t,s,null)}if(this.leave){const l=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 i=this.should_remove;if(this.replacement=l,this.should_remove=a,i)return null}}return t}}function me(e){return e!==null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"}f(me,"isNode");function Me(e,{enter:t,leave:o}){return new So(t,o).visit(e,null)}f(Me,"walk");var Do=Object.defineProperty,No=f((e,t)=>Do(e,"name",{value:t,configurable:!0}),"u$5");const Po=No(({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(i){return this.warn({code:"PARSE_ERROR",message:`[packem:jsx-remove-attributes]: failed to parse "${n}" and remove the jsx attribute.`}),t.warn(i),null}let l=!1;const a=new N(r);return Me(s,{enter(i){if(i.type==="CallExpression"&&i.callee.type==="Identifier"&&i.callee.name==="jsx"){const c=i.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,""),l=!0)}}}),l?{code:a.toString(),map:a.generateMap({hires:!0})}:null}}},"jsxRemoveAttributes");var Fo=Object.defineProperty,re=f((e,t)=>Fo(e,"name",{value:t,configurable:!0}),"p$2");const Mo=re(e=>{const t=[],o=[];return e.forEach(r=>{r.startsWith("(")?t.push(r):o.push(r)}),[...o.sort(),...t.sort()]},"sortLicenses"),Co=re((e,t,o)=>{const r=new RegExp(`(<!-- ${t} -->)[\\s\\S]*?(<!-- ${t} -->)`,"g");if(r.test(e))return e.replace(r,`$1
|
|
17
17
|
${o}
|
|
18
|
-
$2`)},"replaceContentWithin"),Ce=
|
|
18
|
+
$2`)},"replaceContentWithin"),Ce=re(({licenseFilePath:e,licenseTemplate:t,logger:o,marker:r,mode:n,packageName:s})=>Ft({thirdParty(l){const a=new Set,i=l.sort(({name:p},{name:u})=>(p||0)>(u||0)?1:(u||0)>(p||0)?-1:0).map(({author:p,contributors:u,license:d,licenseText:h,maintainers:w,name:_,repository:P})=>{let k="## "+_+`
|
|
19
19
|
`;d&&(k+=`License: ${d}
|
|
20
20
|
`);const v=new Set;for(const F of[p,...w,...u]){const ie=typeof F=="string"?F:F?.name;ie&&v.add(ie)}return v.size>0&&(k+=`By: ${[...v].join(", ")}
|
|
21
21
|
`),P&&(k+=`Repository: ${typeof P=="string"?P:P.url}
|
|
@@ -27,10 +27,10 @@ $2`)},"replaceContentWithin"),Ce=ne(({licenseFilePath:e,licenseTemplate:t,logger
|
|
|
27
27
|
`),d&&a.add(d),k}).join(`
|
|
28
28
|
---------------------------------------
|
|
29
29
|
|
|
30
|
-
`);if(i===""){o.info({message:"No dependencies license information found.",prefix:"plugin:license:"+
|
|
30
|
+
`);if(i===""){o.info({message:"No dependencies license information found.",prefix:"plugin:license:"+n});return}const c=t(Mo(a),i,s);try{const p=y.readFileSync(e),u=Co(p,r,c);if(!u){o.error({message:`Could not find the license marker: <!-- ${r} --> in ${e}`,prefix:"plugin:license:"+n});return}p!==u&&(y.writeFileSync(e,u),o.info({message:`${e} updated.`,prefix:"plugin:license:"+n}))}catch(p){o.error(p)}}}),"license");var Io=Object.defineProperty,Ro=f((e,t)=>Io(e,"name",{value:t,configurable:!0}),"i$9");const To=Ro(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");y.writeJsonSync(o,t)},name:"packem:metafile"}),"metafilePlugin");var Ao=Object.defineProperty,qo=f((e,t)=>Ao(e,"name",{value:t,configurable:!0}),"r$5");const M=qo(e=>{const t=xt.createHash("md5");return t.update(e),t.digest("hex")},"getHash");var Bo=Object.defineProperty,Ie=f((e,t)=>Bo(e,"name",{value:t,configurable:!0}),"m$4");const I=Ie(e=>e.handler||e,"getHandler"),x=Ie((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",M(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",M(o),r?M(r):"",M(JSON.stringify(n)));if(t.has(s,e.name))return await t.get(s,e.name);const l=await I(e.resolveId).call(this,o,r,n);return t.set(s,l,e.name),l},async transform(o,r){if(!e.transform)return null;const n=m.join("transform",M(r),M(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 Lo=Object.defineProperty,Wo=f((e,t)=>Lo(e,"name",{value:t,configurable:!0}),"c$6");const Jo=/\.(?:m|c)?(?:j|t)sx?$/,zo=/^use \w+$/,Uo=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 l=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);l.size>0&&(e.debug({message:`directives for chunk "${n.fileName}" are preserved.`,prefix:"plugin:preserve-directives"}),a.prepend(`${[...l].map(c=>`'${c}';`).join(`
|
|
31
31
|
`)}
|
|
32
|
-
`));let i=null;return
|
|
33
|
-
`)),l.size===0&&i===null?null:{code:a.toString(),map:s?a.generateMap({hires:!0}):null}},order:"post"},transform:{handler(n
|
|
32
|
+
`));let i=null;return n.facadeModuleId&&typeof o[n.facadeModuleId]=="string"&&(i=o[n.facadeModuleId]),i&&(e.debug({message:`shebang for chunk "${n.fileName}" is preserved.`,prefix:"plugin:preserve-directives"}),a.prepend(`${i}
|
|
33
|
+
`)),l.size===0&&i===null?null:{code:a.toString(),map:s?a.generateMap({hires:!0}):null}},order:"post"},transform:{handler(r,n){const s=m.extname(n);if(!Jo.test(s))return null;let l=!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),l=!0,e.debug({message:`shebang for module "${n}" is preserved.`,prefix:"plugin:preserve-directives"}))}let i=null;try{i=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(i.type!=="Program")return null;for(const c of i.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"&&zo.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),l=!0),e.debug({message:`directive "${p}" for module "${n}" is preserved.`,prefix:"plugin:preserve-directives"}))}return l?{code:a.toString(),map:a.generateMap({hires:!0}),meta:{preserveDirectives:{directives:[...t[n]??[]],shebang:o[n]??null}}}:null},order:"post"}}},"preserveDirectives");var Ho=Object.defineProperty,Vo=f((e,t)=>Ho(e,"name",{value:t,configurable:!0}),"r$4");const Xo={exclude:[],include:[/\.(md|txt|css|htm|html)$/]},Go=Vo((e={})=>{e={...e,...Xo};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 Yo=Object.defineProperty,Ko=f((e,t)=>Yo(e,"name",{value:t,configurable:!0}),"l$3");const V="\0__file_url__",Re=Ko(()=>({async load(e){if(e.startsWith(V)){const t=je.fileURLToPath(e.slice(V.length));return await y.readFile(t)}},name:"packem:resolve-file-url",resolveId(e){if(e.startsWith("file://"))return`${V}${e}`}}),"resolveFileUrl");var Qo=Object.defineProperty,Te=f((e,t)=>Qo(e,"name",{value:t,configurable:!0}),"i$5");const Zo=/__filename|__dirname|require\(|require\.resolve\(/,Ae=`
|
|
34
34
|
// -- pack CommonJS Shims --
|
|
35
35
|
import __cjs_url__ from "node:url";
|
|
36
36
|
import __cjs_path__ from "node:path";
|
|
@@ -44,28 +44,28 @@ 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
|
-
`,
|
|
47
|
+
`,en=Te((e,t)=>{if(b.env.INTERNAL_PACKEM_BUILD!=="1"&&(e.includes(Ae)||e.includes(qe)||!Zo.test(e)))return null;const o=L.findStaticImports(e).pop(),r=o?o.end:0,n=new N(e);return n.appendRight(r,t),{code:n.toString(),map:n.generateMap()}},"CJSToESM"),tn=Te(e=>({name:"packem:cjs",renderChunk(t,o,r){if(r.format==="es"){let n=Ae;if(e.engines?.node){const s=ke.minVersion(e.engines.node);s&&s.major>=20&&s.minor>=11&&(n=qe)}return en(t,n)}return null}}),"cjsPlugin");var on=Object.defineProperty,C=f((e,t)=>on(e,"name",{value:t,configurable:!0}),"s$6");const nn=/\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\//g,rn=/MIT License|MIT license|BSD license/,sn=/\n{2,}/g,an=/\b(\w+)\$\d+\b/g,ln=/[-/\\^$*+?.()|[\]{}]/g,cn=C(e=>e.replaceAll(ln,"\\$&"),"escapeRegex"),pn=C(e=>[...new Set(e)],"unique"),un=C(e=>e.replaceAll(nn,t=>rn.test(t)?"":t).replaceAll(sn,`
|
|
48
48
|
|
|
49
|
-
`),"cleanUnnecessaryComments"),fe=new Map;function Be(e,t,{identifierReplacements:o},
|
|
50
|
-
- ${i}`).join(""),a=t.fileName.replace(/\.[^/.]+$/,"");fe.has(a)||
|
|
49
|
+
`),"cleanUnnecessaryComments"),fe=new Map;function Be(e,t,{identifierReplacements:o},r){const n=L.findStaticImports(e);for(const l in o){const a=n.find(c=>c.specifier===l&&c.imports.includes("{"));if(!a){this.warn(`${t.fileName} does not import "${l}" for replacement`),process.exitCode=1;continue}const i=o[l];for(const c in i){a.imports.includes(c)||(this.warn(`${t.fileName} does not import "${c}" from "${l}" for replacement`),b.exit(1));const p=i[c],u=cn(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=pn(Array.from(e.matchAll(an),l=>l[0]));if(s.length>0){const l=s.map(i=>`
|
|
50
|
+
- ${i}`).join(""),a=t.fileName.replace(/\.[^/.]+$/,"");fe.has(a)||r.warn({message:`${t.fileName} contains confusing identifier names${l}
|
|
51
51
|
|
|
52
|
-
To replace these, add them to the "rollup -> patchTypes -> identifierReplacements" option in your packem config.`,prefix:"plugin:patch-types"}),fe.set(a,!0)}return e}f(Be,"v$1");C(Be,"replaceConfusingTypeNames");function Le(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(Le,"N$1");C(Le,"removeInternal");function We(e,t){if(e.includes("@internal")){const o=new N(e),
|
|
52
|
+
To replace these, add them to the "rollup -> patchTypes -> identifierReplacements" option in your packem config.`,prefix:"plugin:patch-types"}),fe.set(a,!0)}return e}f(Be,"v$1");C(Be,"replaceConfusingTypeNames");function Le(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(Le,"N$1");C(Le,"removeInternal");function We(e,t){if(e.includes("@internal")){const o=new N(e),r=Et.parse(e,{plugins:["typescript"],sourceType:"module"});Me(r,{enter(n){Le(o,n)&&this.skip()}}),e=o.toString(),e.includes("@internal")&&(this.warn(`${t.fileName} has unhandled @internal declarations`),b.exit(1))}return e}f(We,"S");C(We,"stripInternalTypes");const dn=C((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=un(o),o},resolveId(o){return o.startsWith("types/")?{external:!0,id:"../../"+(o.endsWith(".js")?o:o+".js")}:null}}),"patchTypescriptTypes");var mn=Object.defineProperty,Je=f((e,t)=>mn(e,"name",{value:t,configurable:!0}),"u$3");const ze=Je((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 l=m.resolve(m.dirname(r),n),a=[];if(s)for(const[i,c]of Object.entries(s)){const p=new RegExp(`^${[...i].map(d=>d==="*"?"(.+)":d.replace(/[\\^$*+?.()|[\]{}]/,"\\$&")).join("")}$`);let u=0;for(const d of c){const h=[...T.normalizePath(m.resolve(l,d))].map(w=>w==="*"?`$${++u}`:w==="$"?"$$":w).join("");a.push({find:p,replacement:h})}}return t&&a.push({find:/^(?!\.*\/|\.*$|\w:)(.+)$/,replacement:`${[...T.normalizePath(l)].map(i=>i==="$"?"$$":i).join("")}/$1`}),a},"getConfigAlias"),Ue=Je((e,t)=>{const o=ze(e);return{name:"packem:resolve-tsconfig-paths",async resolveId(r,n,s){if(!o||r.includes("\0"))return null;for(const{find:l,replacement:a}of o)if(l.test(r)){const i=r.replace(l,a),c=await this.resolve(i,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 fn=Object.defineProperty,He=f((e,t)=>fn(e,"name",{value:t,configurable:!0}),"u$2");const gn=He((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 l of n){if(l.startsWith("."))throw new Error(`Invalid rootDir value '.' in ${r}.`);if(l.startsWith(".."))throw new Error(`Invalid rootDir value '..' in ${r}.`);s.push(m.resolve(e,l))}return s},"getRootDirectories"),Ve=He((e,t,o)=>{const r=gn(e,o);return{name:"packem:resolve-tsconfig-root-dirs",async resolveId(n,s,l){if(r===null||r.length===0)return null;if(n.startsWith("."))for(const a of r){const i=m.join(a,n),c=await this.resolve(i,s,{skipSelf:!0,...l});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 hn=Object.defineProperty,yn=f((e,t)=>hn(e,"name",{value:t,configurable:!0}),"r$3");const Xe=yn(()=>{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 vn=Object.defineProperty,bn=f((e,t)=>vn(e,"name",{value:t,configurable:!0}),"s$5");const $n=bn(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(O.DEFAULT_EXTENSIONS.includes(r)&&s&&s.length>0)return n+"-"+s}},"getCustomModuleLayer");var jn=Object.defineProperty,wn=f((e,t)=>jn(e,"name",{value:t,configurable:!0}),"i$4");const X=wn(e=>(e.preserveDirectives||{directives:[]}).directives.map(t=>t.replace(/^use /,"")).find(t=>t!=="strict"),"getModuleLayer");var kn=Object.defineProperty,ge=f((e,t)=>kn(e,"name",{value:t,configurable:!0}),"c$4");const he=ge((e,t)=>{const o=new Map;return ge(function(r,n){const s=n.getModuleInfo(r);if(!s)return;const{isEntry:l}=s,a=s.meta,i=X(a);if(!l){const c=o.get(r);if(c)return c;const p=$n(r);if(p)return o.set(r,p),p}if(l){const c=n.getModuleIds();for(const p of c)n.getModuleInfo(p)&&X(a)===i&&(e.has(p)||e.set(p,new Set),e.get(p).add([r,i]))}if(i&&!l&&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 X(d?d.meta:{})===i}return!1}))return;if(c.every(([,u])=>u===i))return o.has(r)?o.get(r):void 0;const p=`${m.basename(r,m.extname(r))}-${i}`;return o.set(r,p),p}},"splitChunks")},"createSplitChunks");var xn=Object.defineProperty,En=f((e,t)=>xn(e,"name",{value:t,configurable:!0}),"n$2");const D=En((e,t,o)=>t.isDynamicEntry?`chunks/[name].${o}`:`shared/${e.options.name}.[hash].${o}`,"getChunkFilename");var On=Object.defineProperty,_n=f((e,t)=>On(e,"name",{value:t,configurable:!0}),"s$3");const Sn=process.platform==="win32",ye=_n((e,t)=>{const o=Sn?"\\":"/";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 Dn=Object.defineProperty,$=f((e,t)=>Dn(e,"name",{value:t,configurable:!0}),"p$1");const Nn=$((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"+b.versions.node.split(".")[0];if(t.pkg.engines?.node){const r=ke.minVersion(t.pkg.engines.node);r&&(o="node"+r.major)}if(t.options.rollup.esbuild.target){const r=H(t.options.rollup.esbuild.target);r.some(n=>n.startsWith("node"))||(t.options.rollup.esbuild.target=[...new Set([...H(o),...r])])}else t.options.rollup.esbuild.target=H(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"),Ge=$((e,t)=>e.code==="CIRCULAR_DEPENDENCY"&&/Circular dependency:[\s\S]*node_modules/.test(e.message)?!0:e.code==="UNRESOLVED_IMPORT"?(t.logger.error(`Failed to resolve the module "${e.exporter}" imported by "${g.cyan(m.relative(m.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".`),process.exitCode=1,!0):e.code==="MIXED_EXPORTS"&&t.options.cjsInterop===!0,"sharedOnWarn"),ve=new Map,Ye=$((e,t,o)=>{const
|
|
56
|
-
${l.stack}`),s){case"info":{e.logger.info({message:a,prefix:o+(l.plugin?":plugin:"+l.plugin:"")});return}case"warn":{e.logger.warn({message:a,prefix:o+(l.plugin?":plugin:"+l.plugin:"")});return}case"debug":e.logger.debug({message:a,prefix:o+(l.plugin?":plugin:"+l.plugin:"")})}},"onLog"),onwarn(s,l){Ge(s,e)||s.code||l(s)},watch:e.mode==="watch"?e.options.rollup.watch:!1}},"baseRollupOptions"),Ke=$(async(e,t)=>{const o=ee(e,"build");let
|
|
57
|
-
`;return
|
|
55
|
+
↳ to depend on a module via import/require, install it to "dependencies".`),process.exitCode=1,!0):e.code==="MIXED_EXPORTS"&&t.options.cjsInterop===!0,"sharedOnWarn"),ve=new Map,Ye=$((e,t,o)=>{const r=$(s=>{for(const[l,a]of Object.entries(t))if(s.startsWith(l))return s.replace(l,a)},"findAlias"),n=ze(e.tsconfig,!1);return{external(s){const l=r(s);l&&(s=l);const a=Q(s),i=K(e.options.externals,a)||K(e.options.externals,s);if(i)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!i&&!ve.has(s)&&e.logger.info({message:'Inlined implicit external "'+g.cyan(s)+'". If this is incorrect, add it to the "externals" option.',prefix:o}),ve.set(s,!0),i},input:Object.fromEntries(e.options.entries.map(s=>[s.name,m.resolve(e.options.rootDir,s.input)])),logLevel:e.options.debug?"debug":"info",onLog:$((s,l)=>{let a=l.message;switch(l.stack&&(a=`${a}
|
|
56
|
+
${l.stack}`),s){case"info":{e.logger.info({message:a,prefix:o+(l.plugin?":plugin:"+l.plugin:"")});return}case"warn":{e.logger.warn({message:a,prefix:o+(l.plugin?":plugin:"+l.plugin:"")});return}case"debug":e.logger.debug({message:a,prefix:o+(l.plugin?":plugin:"+l.plugin:"")})}},"onLog"),onwarn(s,l){Ge(s,e)||s.code||l(s)},watch:e.mode==="watch"?e.options.rollup.watch:!1}},"baseRollupOptions"),Ke=$(async(e,t)=>{const o=ee(e,"build");let r;return e.options.rollup.resolve&&(r=x(we.nodeResolve({extensions:O.DEFAULT_EXTENSIONS,...e.options.rollup.resolve}),t)),{...Ye(e,o,"dependencies"),output:[e.options.emitCJS&&{chunkFileNames:$(n=>D(e,n,"cjs"),"chunkFileNames"),dir:m.resolve(e.options.rootDir,e.options.outDir),entryFileNames:$(n=>ye(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:he(e.dependencyGraphMap,e.buildEntries),preserveModules:!1}},e.options.emitESM&&{chunkFileNames:$(n=>D(e,n,"mjs"),"chunkFileNames"),dir:m.resolve(e.options.rootDir,e.options.outDir),entryFileNames:$(n=>ye(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:he(e.dependencyGraphMap,e.buildEntries),preserveModules:!1}}].filter(Boolean),plugins:[x(Re(),t),x(Xe(),t),e.tsconfig&&x(Ve(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&x(Ue(e.tsconfig,e.logger),t),e.options.rollup.replace&&Oe({...e.options.rollup.replace,values:{...e.options.replace,...e.options.rollup.replace.values}}),e.options.rollup.alias&&Ee({customResolver:r?.resolveId,...e.options.rollup.alias,entries:o}),r,e.options.rollup.polyfillNode&&Dt({sourceMap:e.options.sourcemap,...e.options.rollup.polyfillNode}),e.options.rollup.json&&Fe({...e.options.rollup.json}),Uo(e.logger),Ct(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?.(Nn(e.options.transformerName,e)),e.options.cjsInterop&&e.options.emitCJS&&Pe({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.dynamicVars&&St(e.options.rollup.dynamicVars),e.options.rollup.commonjs&&x(_t({extensions:O.DEFAULT_EXTENSIONS,sourceMap:e.options.sourcemap,...e.options.rollup.commonjs}),t),e.options.rollup.preserveDynamicImports&&{renderDynamicImport(){return{left:"import(",right:")"}}},e.options.rollup.shim&&tn(e.pkg),e.options.rollup.raw&&Go(e.options.rollup.raw),e.options.rollup.jsxRemoveAttributes&&Po({attributes:e.options.rollup.jsxRemoveAttributes.attributes,logger:e.logger}),e.options.rollup.metafile&&To({outDir:m.resolve(e.options.rootDir,e.options.outDir),rootDir:e.options.rootDir}),e.options.rollup.copy&&xo(e.options.rollup.copy,e.logger),e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dependenciesTemplate=="function"&&Ce({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"),Pn=$(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=bo(Pn),Qe=$(async(e,t)=>{const o=ee(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=x(we.nodeResolve({extensions:O.DEFAULT_EXTENSIONS,...e.options.rollup.resolve}),t));const l="dts-plugin:"+process.pid+e.tsconfig.path;return{...Ye(e,o,"dts"),onwarn(a,i){Ge(a,e)||a.code!=="EMPTY_BUNDLE"&&i(a)},output:[e.options.emitCJS&&{chunkFileNames:$(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},{chunkFileNames:$(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:$(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:[x(Re(),t),x(Xe(),t),e.options.rollup.json&&Fe({...e.options.rollup.json}),r,e.tsconfig&&x(Ve(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&x(Ue(e.tsconfig,e.logger),t),e.options.rollup.replace&&Oe({...e.options.rollup.replace,values:{...e.options.replace,...e.options.rollup.replace.values}}),e.options.rollup.alias&&Ee({customResolver:s?.resolveId,...e.options.rollup.alias,entries:o}),s,await Fn(l)(e),e.options.cjsInterop&&e.options.emitCJS&&Pe({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.patchTypes&&dn(e.options.rollup.patchTypes,e.logger),It(),e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dtsTemplate=="function"&&Ce({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 Mn=Object.defineProperty,Cn=f((e,t)=>Mn(e,"name",{value:t,configurable:!0}),"c$3");const In=Cn(async(e,t)=>{const o=await Ke(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,l=new Map;for(const a of s){const{output:i}=await n.write(a),c=new Set,p=i.filter(d=>d.type==="chunk");for(const d of p){c.add(d.fileName);for(const h of d.imports)e.usedImports.add(h);d.isEntry&&e.buildEntries.push({bytes:Buffer.byteLength(d.code,"utf8"),chunks:d.imports.filter(h=>p.find(w=>w.fileName===h)),exports:d.exports,modules:Object.entries(d.modules).map(([h,w])=>({bytes:w.renderedLength,id:h})),path:d.fileName,type:"entry"})}const u=i.filter(d=>d.type==="asset");for(const d of u)l.has(d.fileName)||l.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(...l.values())},"build");var Rn=Object.defineProperty,q=f((e,t)=>Rn(e,"name",{value:t,configurable:!0}),"r$1");const Tn=q(async(e,t)=>{const o=await Qe(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:q(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:q(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:q(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 An=Object.defineProperty,se=f((e,t)=>An(e,"name",{value:t,configurable:!0}),"i$2");const qn=se(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"),Bn=se(e=>`
|
|
58
58
|
${e.replaceAll(/^\n|\n$/g,"")}
|
|
59
|
-
`,"normalizeCodeFrame"),Ze=se(e=>{const t=
|
|
59
|
+
`,"normalizeCodeFrame"),Ze=se(e=>{const t=qn(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(
|
|
62
|
-
${t}`)},"enhanceRollupError");var
|
|
63
|
-
└─ ${m.relative(process.cwd(),l)}`);if(e.logger.info(s),be(
|
|
64
|
-
- `+g.cyan(a)+(i.length>0?g.grey` (did you mean ${i.map(c=>`"${c}"`).join(", ")}?)`:"")}A(t,l)}},"validatePackage");var
|
|
61
|
+
`+g.yellow(Bn(e.frame))),e.message=o,t!==void 0&&(e.stack=`${e.message}
|
|
62
|
+
${t}`)},"enhanceRollupError");var Ln=Object.defineProperty,et=f((e,t)=>Ln(e,"name",{value:t,configurable:!0}),"l$2");const be=et((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",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":{n.result.close(),o.info({message:g.cyan(`built in ${n.duration}ms.`),prefix:r});break}case"ERROR":{Ze(n.error),o.error({context:[n.error],message:"Rebuild "+t+" failed: "+n.error.message,prefix:r});break}}})},"watchHandler"),Wn=et(async(e,t)=>{const o=await Ke(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=await 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 l of n)s+=g.gray(`
|
|
63
|
+
└─ ${m.relative(process.cwd(),l)}`);if(e.logger.info(s),be(r,"bundle",e.logger),e.options.declaration){const l=await Qe(e,t);await e.hooks.callHook("rollup:dts:options",e,l);const a=R.watch(l);await e.hooks.callHook("rollup:watch",e,a),be(a,"types",e.logger)}},"watch");var Jn=Object.defineProperty,zn=f((e,t)=>Jn(e,"name",{value:t,configurable:!0}),"i$1");const tt=zn(e=>`{ ${Object.keys(e).map(t=>`${t}: ${JSON.stringify(e[t])}`).join(", ")} }`,"dumpObject");var Un=Object.defineProperty,Hn=f((e,t)=>Un(e,"name",{value:t,configurable:!0}),"a$2");class Vn{static{f(this,"p")}static{Hn(this,"FileCache")}#n;#e;#r;#t=!0;#o=new Map;#s;constructor(t,o,r){this.#n=t,this.#e=G.findCacheDirectorySync("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:y.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(!y.isAccessibleSync(r))return;const n=y.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),J.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)),y.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 Xn=Object.defineProperty,B=f((e,t)=>Xn(e,"name",{value:t,configurable:!0}),"l$1");const Gn=T.createFilter,Yn=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=Gn(n,null,{resolve:e})}else r=B(()=>null,"hasSideEffects");return r},"getPackageSideEffect");var Kn=Object.defineProperty,Qn=f((e,t)=>Kn(e,"name",{value:t,configurable:!0}),"y");const Zn=Qn((e,t,o)=>e.reduce((r,n)=>{const s=n[t],l=n[o];return r[s]||(r[s]={}),r[s][l]||(r[s][l]=[]),r[s][l].push(n),r},{}),"groupByKeys");var er=Object.defineProperty,tr=f((e,t)=>er(e,"name",{value:t,configurable:!0}),"o");const or=tr(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)!K(e.options.externals,n)&&!n.startsWith("chunks/")&&!e.options.dependencies.includes(Q(n))&&!e.options.peerDependencies.includes(Q(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 nr=Object.defineProperty,ot=f((e,t)=>nr(e,"name",{value:t,configurable:!0}),"i");const rr=ot((e,t)=>Ot.distance(e,t)<=e.length/3||t.includes(e),"isSimilar"),sr=ot((e,t)=>{const o=e.toLowerCase();return t.filter(r=>rr(r.toLowerCase(),o))},"findAlternatives");var ir=Object.defineProperty,$e=f((e,t)=>ir(e,"name",{value:t,configurable:!0}),"n");const ar=$e((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:"",...oe(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("*")&&!J.existsSync(n)&&r.push(n.replace(`${t.rootDir}/`,""));if(r.length>0){const n=$e(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 l="Potential missing or wrong package.json files:";for(const a of r){const i=sr(a,s);l+=`
|
|
64
|
+
- `+g.cyan(a)+(i.length>0?g.grey` (did you mean ${i.map(c=>`"${c}"`).join(", ")}?)`:"")}A(t,l)}},"validatePackage");var lr=Object.defineProperty,j=f((e,t)=>lr(e,"name",{value:t,configurable:!0}),"f");const nt=j((e,t)=>{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&&(e.logger.error("Exiting with code (1). You can change this behavior by setting `failOnWarn: false`."),b.exit(1)))},"logErrors"),
|
|
68
|
+
`)}`),e.options.failOnWarn&&(e.logger.error("Exiting with code (1). You can change this behavior by setting `failOnWarn: false`."),b.exit(1)))},"logErrors"),cr=j(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"),pr=j((e,t,o,r,n,s,l,a,i)=>{const c=cr(i?.config.compilerOptions?.jsx),p=ct.defu(s,n,l,{alias:{},clean:!0,debug:r,declaration:!0,dependencies:[],devDependencies:[],emitCJS:!0,emitESM:!0,entries:[],externals:[...le.builtinModules,...le.builtinModules.map(u=>`node:${u}`)],failOnWarn:!0,fileCache:!0,minify:b.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:i?.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:i?.config.compilerOptions?.jsx==="react-jsxdev",jsxFactory:i?.config.compilerOptions?.jsxFactory,jsxFragment:i?.config.compilerOptions?.jsxFragmentFactory,jsxImportSource:i?.config.compilerOptions?.jsxImportSource,jsxSideEffects:!0,keepNames:!0,minifyWhitespace:b.env.NODE_ENV==="production",sourcesContent:!1,target:i?.config.compilerOptions?.target,treeShaking:!0,tsconfigRaw:i?.config},json:{preferConst:!0},license:{dependenciesTemplate:j((u,d,h)=>`
|
|
69
69
|
# Licenses of bundled dependencies
|
|
70
70
|
The published ${h} artifact additionally contains code with the following licenses:
|
|
71
71
|
${u.join(", ")}
|
|
@@ -77,24 +77,24 @@ The published ${h} artifact additionally contains code with the following licens
|
|
|
77
77
|
${u.join(", ")}
|
|
78
78
|
|
|
79
79
|
# Bundled types:
|
|
80
|
-
`+d,"dtsTemplate")},patchTypes:{},polyfillNode:{},preserveDynamicImports:!0,raw:{exclude:O.EXCLUDE_REGEXP,include:["**/*.data","**/*.txt"]},replace:{objectGuards:!0,preventAssignment:!0},resolve:{allowExportsFolderMapping:!1,preferBuiltins:!1},shim:!0,sucrase:{disableESTransforms:!0,enableLegacyBabel5ModuleInterop:!1,enableLegacyTypeScriptModuleInterop:i?.config.compilerOptions?.esModuleInterop===!1,include:/\.[jt]sx?$/,injectCreateRequireForImportRequire:!1,preserveDynamicImport:!0,production:b.env.NODE_ENV==="production",...i?.config.compilerOptions?.jsx&&["react","react-jsx","react-jsxdev"].includes(i.config.compilerOptions.jsx)?{jsxFragmentPragma:i.config.compilerOptions.jsxFragmentFactory,jsxImportSource:i.config.compilerOptions.jsxImportSource,jsxPragma:i.config.compilerOptions.jsxFactory,jsxRuntime:c,transforms:["typescript","jsx",...i.config.compilerOptions.esModuleInterop?["imports"]:[]]}:{transforms:["typescript",...i?.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:i?.config.compilerOptions?.experimentalDecorators,syntax:i?"typescript":"ecmascript",[i?"tsx":"jsx"]:!0},target:i?.config.compilerOptions?.target?.toLowerCase(),transform:{decoratorMetadata:i?.config.compilerOptions?.emitDecoratorMetadata,legacyDecorator:i?.config.compilerOptions?.experimentalDecorators,react:{development:b.env.NODE_ENV!=="production",pragma:i?.config.compilerOptions?.jsxFactory,pragmaFrag:i?.config.compilerOptions?.jsxFragmentFactory,runtime:c,throwIfNamespace:!0},treatConstEnumAsEnum:i?.config.compilerOptions?.preserveConstEnums,useDefineForClassFields:i?.config.compilerOptions?.useDefineForClassFields}},module:{ignoreDynamic:!0,importInterop:"none",preserveImportMeta:!0,strict:!1,strictMode:!1,type:"es6"}},treeshake:{moduleSideEffects:
|
|
80
|
+
`+d,"dtsTemplate")},patchTypes:{},polyfillNode:{},preserveDynamicImports:!0,raw:{exclude:O.EXCLUDE_REGEXP,include:["**/*.data","**/*.txt"]},replace:{objectGuards:!0,preventAssignment:!0},resolve:{allowExportsFolderMapping:!1,preferBuiltins:!1},shim:!0,sucrase:{disableESTransforms:!0,enableLegacyBabel5ModuleInterop:!1,enableLegacyTypeScriptModuleInterop:i?.config.compilerOptions?.esModuleInterop===!1,include:/\.[jt]sx?$/,injectCreateRequireForImportRequire:!1,preserveDynamicImport:!0,production:b.env.NODE_ENV==="production",...i?.config.compilerOptions?.jsx&&["react","react-jsx","react-jsxdev"].includes(i.config.compilerOptions.jsx)?{jsxFragmentPragma:i.config.compilerOptions.jsxFragmentFactory,jsxImportSource:i.config.compilerOptions.jsxImportSource,jsxPragma:i.config.compilerOptions.jsxFactory,jsxRuntime:c,transforms:["typescript","jsx",...i.config.compilerOptions.esModuleInterop?["imports"]:[]]}:{transforms:["typescript",...i?.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:i?.config.compilerOptions?.experimentalDecorators,syntax:i?"typescript":"ecmascript",[i?"tsx":"jsx"]:!0},target:i?.config.compilerOptions?.target?.toLowerCase(),transform:{decoratorMetadata:i?.config.compilerOptions?.emitDecoratorMetadata,legacyDecorator:i?.config.compilerOptions?.experimentalDecorators,react:{development:b.env.NODE_ENV!=="production",pragma:i?.config.compilerOptions?.jsxFactory,pragmaFrag:i?.config.compilerOptions?.jsxFragmentFactory,runtime:c,throwIfNamespace:!0},treatConstEnumAsEnum:i?.config.compilerOptions?.preserveConstEnums,useDefineForClassFields:i?.config.compilerOptions?.useDefineForClassFields}},module:{ignoreDynamic:!0,importInterop:"none",preserveImportMeta:!0,strict:!1,strictMode:!1,type:"es6"}},treeshake:{moduleSideEffects:Yn(t,a),preset:"recommended"},watch:{chokidar:{ignoreInitial:!0,ignorePermissionErrors:!0},clearScreen:!0,exclude:O.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,"Using "+g.cyan(p.transformerName)+" "+d+" as transformer"].join(`
|
|
81
81
|
`))}return p.rollup.resolve&&p.rollup.resolve.preferBuiltins===!0&&(p.rollup.polyfillNode=!1,e.debug("Disabling polyfillNode because preferBuiltins is set to true")),i?.config.compilerOptions?.isolatedModules||e.warn(`'compilerOptions.isolatedModules' is not enabled in tsconfig.
|
|
82
82
|
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.
|
|
83
|
-
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"),
|
|
83
|
+
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"),ur=j(e=>e.replace(/\.(?:js|mjs|cjs|ts|mts|cts|json|jsx|tsx)$/,""),"removeExtension"),dr=j(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=ur(r.replace(/^src\//,""))}if(!o.input)throw new Error(`Missing entry input: ${tt(o)}`);if(o.input=m.resolve(e.options.rootDir,o.input),!y.isAccessibleSync(o.input)){const r=new Set(await W.readdir(m.dirname(o.input)));let n=!1;for(const s of O.DEFAULT_EXTENSIONS)if(r.has(m.basename(o.input)+s)){n=!0;break}if(!n)throw new it.NotFoundError("Your configured entry: "+g.cyan(o.input)+" does not exist.")}o.outDir=m.resolve(e.options.rootDir,o.outDir??e.options.outDir)}},"prepareEntries"),mr=j((e,t,o)=>{const r=j(s=>m.relative(t.rootDir,m.resolve(t.options.outDir,s)),"rPath");let n=!1;for(const s of t.buildEntries.filter(l=>!l.chunk)){let l=s.bytes??0;for(const i of s.chunks??[])l+=t.buildEntries.find(c=>c.path===i)?.bytes??0;let a=` ${g.bold(r(s.path))} (${["total size: "+g.cyan(S.formatBytes(l)),s.type!=="asset"&&s.bytes&&"chunk size: "+g.cyan(S.formatBytes(s.bytes))].filter(Boolean).join(", ")})`;if(a+=s.exports?.length?`
|
|
84
84
|
exports: `+g.gray(s.exports.join(", ")):"",s.chunks?.length&&(a+=`
|
|
85
|
-
${s.chunks.map(i=>{const c=t.buildEntries.find(p=>p.path===i)??{};return g.gray(" └─ "+
|
|
86
|
-
`)}`),s.modules&&s.modules.length>0){const i=s.modules.filter(c=>c.id.includes("node_modules")).sort((c,p)=>(p.bytes||0)-(c.bytes||0)).map(c=>g.gray(" 📦 "+
|
|
85
|
+
${s.chunks.map(i=>{const c=t.buildEntries.find(p=>p.path===i)??{};return g.gray(" └─ "+r(i)+g.bold(c.bytes?" ("+S.formatBytes(c?.bytes)+")":""))}).join(`
|
|
86
|
+
`)}`),s.modules&&s.modules.length>0){const i=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?" ("+S.formatBytes(c.bytes)+")":""))).join(`
|
|
87
87
|
`);a+=i.length>0?`
|
|
88
88
|
inlined modules:
|
|
89
89
|
`+i:""}if(t.options.declaration&&s.type==="entry"){let i=s.path.replace(/\.js$/,".d.ts"),c="commonjs";s.path.endsWith(".cjs")?i=s.path.replace(/\.cjs$/,".d.cts"):s.path.endsWith(".mjs")&&(c="module",i=s.path.replace(/\.mjs$/,".d.mts"));const p=t.buildEntries.find(u=>u.path.endsWith(i));if(p){let u;(t.options.declaration===!0||t.options.declaration==="compatible")&&!i.includes(".d.ts")&&(i=i.replace(c==="commonjs"?".d.c":".d.m",".d."),u=t.buildEntries.find(d=>d.path.endsWith(i))),a+=u&&c===o.type?`
|
|
90
90
|
types:
|
|
91
|
-
`+[p,u].map(d=>g.gray(" └─ ")+g.bold(
|
|
91
|
+
`+[p,u].map(d=>g.gray(" └─ ")+g.bold(r(d.path))+" (total size: "+g.cyan(S.formatBytes(d.bytes??0))+")").join(`
|
|
92
92
|
`):`
|
|
93
|
-
types: `+g.bold(
|
|
93
|
+
types: `+g.bold(r(p.path))+" (total size: "+g.cyan(S.formatBytes(p.bytes??0))+")"}}n=!0,a+=`
|
|
94
94
|
|
|
95
|
-
`,e.raw(s.chunk?g.gray(a):a)}return
|
|
96
|
-
`),
|
|
95
|
+
`,e.raw(s.chunk?g.gray(a):a)}return n&&e.raw("Σ Total dist size (byte size):",g.cyan(S.formatBytes(t.buildEntries.reduce((s,l)=>s+(l.bytes??0),0))),`
|
|
96
|
+
`),n},"showSizeInformation"),fr=j(async(e,t,o,r,n,s,l,a)=>{const i=co(s.preset??n.preset??"auto",t),c=pr(e,t,o,r,n,s,i,l,a);y.ensureDirSync(m.join(c.rootDir,c.outDir));const p={buildEntries:[],dependencyGraphMap:new Map,hooks:pt.createHooks(),logger:e,mode:o,options:c,pkg:l,rootDir:t,tsconfig:a,usedImports:new Set,warnings:new Set};if(i.hooks&&p.hooks.addHooks(i.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"),gr=j(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 y.emptyDir(o))},"cleanDistributionDirectories"),hr=j(async(e,t,o)=>{await e.hooks.callHook("build:before",e);const r=Zn(e.options.entries,"environment","runtime"),n=[],s=[];for(const[a,i]of Object.entries(r))for(const[c,p]of Object.entries(i)){s.push(...p.filter(d=>d.declaration));const u={...e};a==="development"&&(u.options.minify=!1),e.options.rollup.replace?(e.options.rollup.replace.values={...e.options.rollup.replace.values,production:a},c==="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."),u.options.entries=p,n.push(In(u,o))}if(e.options.declaration){const a={...e};a.options.entries=s,n.push(Tn(a,o))}await Promise.all(n),e.logger.success(g.green(`Build succeeded for ${e.options.name}`));for await(const a of y.walk(m.join(e.options.rootDir,e.options.outDir))){let i=e.buildEntries.find(c=>m.join(e.options.rootDir,e.options.outDir,c.path)===a.path);if(i||(i={chunk:!0,path:a.path},e.buildEntries.push(i)),!i.bytes){const c=await W.stat(m.resolve(e.options.rootDir,e.options.outDir,a.path));i.bytes=c.size}}const l=mr(e.logger,e,t);or(e),ar(t,e),await e.hooks.callHook("build:done",e),nt(e,l)},"build"),yr=j(async(e,t,o={})=>{const{configPath:r,debug:n,tsconfigPath:s,...l}=o,a=[new U.MessageFormatterProcessor,new U.ErrorProcessor];n&&a.push(new U.CallerProcessor);const i=lt.createPail({logLevel:n?"debug":"informational",processors:a,scope:"packem"});e=m.resolve(b.cwd(),e),i.debug("Root directory:",e);const c=m.join(e,"package.json"),p=at.parsePackageJson(c);i.debug("Using package.json found at",c);let u;if(s){const d=m.join(e,s);await y.isAccessible(d)||(i.error("tsconfig.json not found at",d),b.exit(1)),u={config:G.readTsConfig(d),path:d},i.info("Using tsconfig settings at",d)}else try{u=await G.findTSConfig(e),i.debug("Using tsconfig settings found at",u.path)}catch{i.info("No tsconfig.json or jsconfig.json found.")}try{const d=r??"./packem.config.ts";/\.(?:js|mjs|cjs|ts)$/.test(d)||(i.error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts extensions are allowed."),b.exit(1));const h=_e(d,e);i.debug("Using packem config found at",m.join(e,d));const w=Date.now(),_=j(()=>S.duration(Math.floor(Date.now()-w)),"getDuration"),P=M(JSON.stringify({version:p.version,...p.dependencies,...p.devDependencies,browser:p.browser,eNode:p.engines?.node,exports:p.exports,main:p.main,module:p.module,type:p.type,types:p.types})),k=new Vn(e,P,i);k.cachePath&&!y.isAccessibleSync(m.join(k.cachePath,P))&&y.isAccessibleSync(k.cachePath)&&(i.info("Clearing file cache because the cache key has changed."),await y.emptyDir(k.cachePath));const v=await fr(i,e,t,n??!1,l,h,p,u);if(k.isEnabled=v.options.fileCache,await dr(v,e),v.logger.info(g.cyan((t==="watch"?"Watching":t==="jit"?"Stubbing":"Building")+" "+v.options.name)),v.logger.debug(`${g.bold("Root dir:")} ${v.options.rootDir}
|
|
97
97
|
${g.bold("Entries:")}
|
|
98
98
|
${v.options.entries.map(F=>` ${tt(F)}`).join(`
|
|
99
|
-
`)}`),await
|
|
100
|
-
⚡️ Build run in `+_()),i.restoreAll(),b.exit(0)}catch(d){Ze(d),i.error("An error occurred while building",d),b.exit(1)}},"createBundler");module.exports=
|
|
99
|
+
`)}`),await gr(v),v.options.stub){await Ht(v),await v.hooks.callHook("build:done",v);return}if(t==="watch"){if(v.options.rollup.watch===!1)throw new Error("Rollup watch is disabled. You should check your packem.config file.");await Wn(v,k),nt(v,!1);return}await hr(v,p,k),i.raw(`
|
|
100
|
+
⚡️ Build run in `+_()),i.restoreAll(),b.exit(0)}catch(d){Ze(d),i.error("An error occurred while building",d),b.exit(1)}},"createBundler");module.exports=yr;
|
package/dist/create-bundler.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var vt=Object.defineProperty;var m=(e,t)=>vt(e,"name",{value:t,configurable:!0});import{chmod as bt,stat as Se,readdir as $t}from"node:fs/promises";import de from"node:module";import{env as x,exit as I,versions as jt,cwd as wt}from"node:process";import{cyan as y,bold as O,gray as F,yellow as kt,grey as xt,green as Et}from"@visulima/colorize";import{readFile as Q,writeFile as J,collectSync as Ot,readFileSync as _e,writeFileSync as Pe,writeJsonSync as Dt,isAccessibleSync as W,ensureDirSync as Nt,emptyDir as Me,walk as St,isAccessible as _t}from"@visulima/fs";import{NotFoundError as Pt}from"@visulima/fs/error";import{formatBytes as M,duration as Mt}from"@visulima/humanizer";import{findCacheDirectorySync as Ct,readTsConfig as Ft,findTSConfig as It}from"@visulima/package";import{parsePackageJson as Rt}from"@visulima/package/package-json";import{createPail as Tt}from"@visulima/pail";import{MessageFormatterProcessor as At,ErrorProcessor as Wt,CallerProcessor as Bt}from"@visulima/pail/processor";import{resolve as g,join as v,normalize as Z,extname as ee,relative as S,dirname as te,basename as U,isAbsolute as Ce,toNamespacedPath as me}from"@visulima/path";import{defu as Jt}from"defu";import{createHooks as Lt}from"hookable";import{rollup as Fe,watch as fe,VERSION as zt}from"rollup";import{a as T,R as Ut,E as ge}from"./shared/packem.HRXF255z.mjs";import{pathToFileURL as Ht,fileURLToPath as Vt}from"node:url";import{resolvePath as qt,resolveModuleExportNames as Yt,findStaticImports as Ie}from"mlly";import N from"magic-string";import Re from"jiti";import{existsSync as oe}from"node:fs";import Te from"@rollup/plugin-alias";import
|
|
1
|
+
var vt=Object.defineProperty;var m=(e,t)=>vt(e,"name",{value:t,configurable:!0});import{chmod as bt,stat as Se,readdir as $t}from"node:fs/promises";import de from"node:module";import{env as x,exit as I,versions as jt,cwd as wt}from"node:process";import{cyan as y,bold as O,gray as F,yellow as kt,grey as xt,green as Et}from"@visulima/colorize";import{readFile as Q,writeFile as J,collectSync as Ot,readFileSync as _e,writeFileSync as Pe,writeJsonSync as Dt,isAccessibleSync as W,ensureDirSync as Nt,emptyDir as Me,walk as St,isAccessible as _t}from"@visulima/fs";import{NotFoundError as Pt}from"@visulima/fs/error";import{formatBytes as M,duration as Mt}from"@visulima/humanizer";import{findCacheDirectorySync as Ct,readTsConfig as Ft,findTSConfig as It}from"@visulima/package";import{parsePackageJson as Rt}from"@visulima/package/package-json";import{createPail as Tt}from"@visulima/pail";import{MessageFormatterProcessor as At,ErrorProcessor as Wt,CallerProcessor as Bt}from"@visulima/pail/processor";import{resolve as g,join as v,normalize as Z,extname as ee,relative as S,dirname as te,basename as U,isAbsolute as Ce,toNamespacedPath as me}from"@visulima/path";import{defu as Jt}from"defu";import{createHooks as Lt}from"hookable";import{rollup as Fe,watch as fe,VERSION as zt}from"rollup";import{a as T,R as Ut,E as ge}from"./shared/packem.HRXF255z.mjs";import{pathToFileURL as Ht,fileURLToPath as Vt}from"node:url";import{resolvePath as qt,resolveModuleExportNames as Yt,findStaticImports as Ie}from"mlly";import N from"magic-string";import Re from"jiti";import{existsSync as oe,rmSync as Gt}from"node:fs";import Te from"@rollup/plugin-alias";import Kt from"@rollup/plugin-commonjs";import Xt from"@rollup/plugin-dynamic-import-vars";import{nodeResolve as Ae}from"@rollup/plugin-node-resolve";import We from"@rollup/plugin-replace";import{wasm as Qt}from"@rollup/plugin-wasm";import Zt from"rollup-plugin-polyfill-node";import{visualizer as eo}from"rollup-plugin-visualizer";import{minVersion as Be}from"semver";import{glob as to}from"glob";import oo from"glob-parent";import ro from"@rollup/plugin-json";import{createFilter as re,normalizePath as he}from"@rollup/pluginutils";import no from"rollup-plugin-license";import{createHash as so}from"node:crypto";import{parse as io}from"@babel/parser";import{distance as ao}from"fastest-levenshtein";
|
|
2
2
|
// -- pack CommonJS Shims --
|
|
3
3
|
import __cjs_url__ from "node:url";
|
|
4
4
|
import __cjs_path__ from "node:path";
|
|
@@ -6,14 +6,14 @@ import __cjs_mod__ from "node:module";
|
|
|
6
6
|
const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __cjs_path__.dirname(__filename);
|
|
8
8
|
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
9
|
-
var
|
|
10
|
-
`)=>({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"&&ne.test(s.code)&&o.dir){const l=g(o.dir,r);await G(l)}}}),"shebangPlugin"),
|
|
11
|
-
`)=>{const o=ne.exec(e);return o?o+t:""},"getShebang");var
|
|
9
|
+
var lo=Object.defineProperty,H=m((e,t)=>lo(e,"name",{value:t,configurable:!0}),"i$d");const ne=/^#![^\n]*/,G=H(async e=>{await bt(e,493).catch(()=>{})},"makeExecutable"),co=H((e,t=`#!/usr/bin/env node
|
|
10
|
+
`)=>({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"&&ne.test(s.code)&&o.dir){const l=g(o.dir,r);await G(l)}}}),"shebangPlugin"),po=H(()=>({name:"packem:remove-shebang",renderChunk(e){return e.replace(ne,"")}}),"removeShebangPlugin"),uo=H((e,t=`
|
|
11
|
+
`)=>{const o=ne.exec(e);return o?o+t:""},"getShebang");var mo=Object.defineProperty,fo=m((e,t)=>mo(e,"name",{value:t,configurable:!0}),"p$4");const se=fo((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]=v(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 go=Object.defineProperty,ho=m((e,t)=>go(e,"name",{value:t,configurable:!0}),"o$4");const yo=ho((e,t)=>{const o=Re(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 vo=Object.defineProperty,bo=m((e,t)=>vo(e,"name",{value:t,configurable:!0}),"r$9");const B=bo((e,t)=>{e.warnings.has(t)||e.warnings.add(t)},"warn");var $o=Object.defineProperty,jo=m((e,t)=>$o(e,"name",{value:t,configurable:!0}),"u$7");const wo=jo(async e=>{const t=await qt("jiti",{url:import.meta.url}),o=JSON.stringify({...e.options.stubOptions.jiti,alias:{...se(e,"jit"),...e.options.stubOptions.jiti.alias}},null,2);for(const n of e.options.entries){const r=g(e.options.rootDir,e.options.outDir,n.name),s=Z(yo(n.input,e.options.rootDir)||n.input),l=s.slice(0,Math.max(0,s.length-ee(s).length)),a=await Q(s),i=uo(a);e.options.emitCJS&&await J(`${r}.cjs`,i+[`const jiti = require(${JSON.stringify(t)})`,"",`const _jiti = jiti(null, ${o})`,"",`/** @type {import(${JSON.stringify(l)})} */`,`module.exports = _jiti(${JSON.stringify(s)})`].join(`
|
|
12
12
|
`));let c=[];try{c=await Yt(s,{extensions:T})}catch(u){B(e,`Cannot analyze ${s} for exports:${u}`);return}const p=c.includes("default")||c.length===0;await J(`${r}.mjs`,i+[`import jiti from ${JSON.stringify(Ht(t).href)};`,"",`const _jiti = jiti(null, ${o})`,"",`/** @type {import(${JSON.stringify(s)})} */`,`const _module = await _jiti.import(${JSON.stringify(s)});`,p?`
|
|
13
13
|
export default _module;`:"",...c.filter(u=>u!=="default").map(u=>`export const ${u} = _module.${u};`)].join(`
|
|
14
14
|
`)),await J(`${r}.d.cts`,[`export * from ${JSON.stringify(l)};`,p?`export { default } from ${JSON.stringify(l)};`:""].join(`
|
|
15
15
|
`)),await J(`${r}.d.mts`,[`export * from ${JSON.stringify(s)};`,p?`export { default } from ${JSON.stringify(s)};`:""].join(`
|
|
16
|
-
`)),i&&(await G(`${r}.cjs`),await G(`${r}.mjs`))}await e.hooks.callHook("rollup:done",e)},"createStub");var
|
|
16
|
+
`)),i&&(await G(`${r}.cjs`),await G(`${r}.mjs`))}await e.hooks.callHook("rollup:done",e)},"createStub");var ko=Object.defineProperty,xo=m((e,t)=>ko(e,"name",{value:t,configurable:!0}),"r$8");const Je=xo((e,t)=>Re(t,{esmResolve:!0,interopDefault:!0})(e),"tryRequire");var Eo=Object.defineProperty,Le=m((e,t)=>Eo(e,"name",{value:t,configurable:!0}),"t$4");const ie=Le(e=>{if(e.endsWith(".mjs")||e.endsWith(".d.mts"))return"esm";if(e.endsWith(".cjs")||e.endsWith(".d.cts"))return"cjs"},"inferExportTypeFromFileName"),ze=Le((e,t,o,n)=>{if(o){const l=ie(o);if(l)return l}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 ze(r,s,o,n)},"inferExportType");var Oo=Object.defineProperty,Do=m((e,t)=>Oo(e,"name",{value:t,configurable:!0}),"o$3");const ae=Do((e,t,o,n=[])=>{if(!e)return[];if(typeof e=="string"){const r=ie(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",subKey:r,type:ze(r,n,s,t)}:ae(s,t,o,[...n,r]))},"extractExportFilenames");var No=Object.defineProperty,le=m((e,t)=>No(e,"name",{value:t,configurable:!0}),"c$7");const So=le(e=>{if(e.key==="exports"&&e.subKey==="production")return"production";if(e.key==="exports"&&e.subKey==="development")return"development";if(x.NODE_ENV){if(!x.NODE_ENV.includes("production")&&!x.NODE_ENV.includes("development"))throw new Error(`Invalid NODE_ENV value: ${x.NODE_ENV}, must be either "production" or "development".`);return x.NODE_ENV}return"production"},"getEnvironment"),ye=le((e,t,o,n,r,s,l)=>{const a=e.find(i=>i.input===t)??e[e.push({input:t})-1];if(o&&(a.outDir=n),r.isExecutable)a.executable=!0,a.declaration=!1,a.cjs=s.type==="commonjs",a.esm=s.type==="module";else{/\.d\.[mc]?ts$/.test(r.file)&&l!==!1&&(a.declaration=l),r.type==="cjs"&&(a.cjs=!0),r.type==="esm"&&(a.esm=!0);for(const i of Ut)if(r.file.includes(i+".")){a.runtime=i;break}}a.runtime===void 0&&(a.runtime="node"),a.environment=So(r)},"createOrUpdateEntry"),ve=/(?:\.d\.[mc]?ts|\.\w+)$/;let be=!1;const _o=le((e,t,o)=>{const n=[];t.sort((a,i)=>a.split("/").length-i.split("/").length);const r=ae(e.exports,e.type??"commonjs",o.options.declaration);if(e.bin){const a=typeof e.bin=="string"?[e.bin]:Object.values(e.bin);for(const i of a)r.push({file:i,isExecutable:!0,key:"bin"})}e.main&&r.push({file:e.main,key:"main",type:ie(e.main)??(e.type==="module"?"esm":"cjs")}),e.module&&r.push({file:e.module,key:"module",type:"esm"}),o.options.declaration!==!1&&(e.types||e.typings)&&r.push({file:e.types??e.typings,key:"types"});const s=e.type==="module";for(const a of r.filter(i=>!i.type)){const i=a.file.endsWith(".js");s&&i||a.file.endsWith(".mjs")?a.type="esm":(!s&&i||a.file.endsWith(".cjs"))&&(a.type="cjs")}const l=[];for(const a of r){const i=a.file.replace(/(?:\*[^/\\]|\.d\.[mc]?ts|\.\w+)$/,""),c=i.endsWith("/");if(c&&["./","/"].includes(i))continue;const p=i.replace(new RegExp("(./)?"+o.options.outDir),o.options.sourceDir);if(a.file.includes("/*")&&a.key==="exports"){be||(o.logger.debug("Private subfolders are not supported, if you need this feature please open an issue on GitHub."),be=!0);const f=[],j=new RegExp("(?<=/|$)"+p.replace("*","(.*)")+(c?"":"\\.\\w+"));for(const E of t)j.test(E)&&f.push(E.replace(ve,""));if(f.length===0){n.push(`Could not find entrypoints for \`${a.file}\``);continue}for(const E of f)ye(l,E,c,i,a,e,o.options.declaration);continue}const u=new RegExp("(?<=/|$)"+p+(c?"":"\\.\\w+")),d=t.find(f=>u.test(f))?.replace(ve,"");if(!d){oe(g(o.options.rootDir,a.file))||n.push(`Could not find entrypoint for \`${a.file}\``);continue}ye(l,d,c,i,a,e,o.options.declaration)}return{entries:l,warnings:n}},"inferEntries");var Po=Object.defineProperty,Mo=m((e,t)=>Po(e,"name",{value:t,configurable:!0}),"t$3");const Co=Mo((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 Fo=Object.defineProperty,Io=m((e,t)=>Fo(e,"name",{value:t,configurable:!0}),"n$8");const Ro={hooks:{"build:prepare":Io(function(e){if(e.options.entries.length>0)return;const t=v(e.options.rootDir,"src");if(!oe(t))throw new Error("No 'src' directory found. Please provide entries manually.");const o=Ot(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=Co(n,e.options.declaration));const r=_o(n,o,e);for(const s of r.warnings)B(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:",y(e.options.entries.map(s=>O(s.input.replace(`${e.options.rootDir}/`,"").replace(/\/$/,"/*"))).join(", ")),F([e.options.emitESM&&"esm",e.options.emitCJS&&"cjs",e.options.declaration&&"dts"].filter(Boolean).map(s=>`[${s}]`).join(" ")))},"build:prepare")}};var To=Object.defineProperty,Ao=m((e,t)=>To(e,"name",{value:t,configurable:!0}),"t$2");const Wo=Ao((e,t)=>(e==="auto"?e=Ro:typeof e=="string"&&(e=Je(e,t)),typeof e=="function"&&(e=e()),e),"resolvePreset");var Bo=Object.defineProperty,Jo=m((e,t)=>Bo(e,"name",{value:t,configurable:!0}),"a$b");const K=Jo((e,t)=>e.some(o=>o instanceof RegExp?o.test(t):o===t),"arrayIncludes");var Lo=Object.defineProperty,zo=m((e,t)=>Lo(e,"name",{value:t,configurable:!0}),"a$a");const V=zo(e=>e===void 0?[]:Array.isArray(e)?e:[e],"arrayify");var Uo=Object.defineProperty,Ho=m((e,t)=>Uo(e,"name",{value:t,configurable:!0}),"a$9");const X=Ho((e="")=>{const t=e.split("/");return t[0].startsWith("@")?t[0]+"/"+t[1]:t[0]},"getPackageName");var Vo=Object.defineProperty,Ue=m((e,t)=>Vo(e,"name",{value:t,configurable:!0}),"s$a");const qo=Ue((e,t,o)=>{const n=o??new Map;return(...r)=>{const s=t?typeof t=="function"?t(...r):t:JSON.stringify({args:r}),l=n.get(s);if(l!==void 0)return l;const a=e(...r);return n.set(s,a),a}},"memoize"),Yo=Ue(e=>{const t=new Map;return o=>qo(e,o,t)},"memoizeByKey");var Go=Object.defineProperty,Ko=m((e,t)=>Go(e,"name",{value:t,configurable:!0}),"m$5");const He=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 l=/(exports(?:\['default'\]|\.default)) = (.*);/i.exec(n);if(l===null||l.length<3)return null;const a=new N(n);a.replace("Object.defineProperty(exports, '__esModule', { value: true });",""),a.replaceAll(/exports\.(.*) = (.*);/g,"module.exports.$1 = $2;"),e&&a.append(`
|
|
17
17
|
module.exports.default = `+l[2]+";");let i=a.toString();return i=i.replace(/(?:module\.)?exports(?:\['default'\]|\.default)/i,"module.exports"),t.debug({message:"Applied CommonJS interop to entry chunk "+r.fileName+".",prefix:"plugin:cjs-interop"}),{code:i,map:a.generateMap({hires:!0})}}if(s.format==="es"&&/\.d\.(?:ts|cts)$/.test(r.fileName)){if(o!=="commonjs"&&r.fileName.endsWith(".d.ts"))return null;const l=/export\s\{\s(.*)\s\}/i.exec(n);if(l===null||l.length<2)return null;const a=l[1].split(", "),i=[];let c="";for(const u of a)if(!u.includes("type"))if(u.includes("as")){const[d,f]=u.split(" as ");if(f==="default"&&(c=d,!e))continue;i.push(f+": typeof "+d+";")}else i.push(u+": typeof "+u+";");const p=new N(n);return p.replace(" "+c+" as default,",""),p.append(`
|
|
18
18
|
|
|
19
19
|
declare const defaultExport: {
|
|
@@ -21,9 +21,9 @@ declare const defaultExport: {
|
|
|
21
21
|
`)+`
|
|
22
22
|
} & typeof `+c+`;
|
|
23
23
|
|
|
24
|
-
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
|
|
24
|
+
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,Qo=m((e,t)=>Xo(e,"name",{value:t,configurable:!0}),"f$7");const Zo=Qo((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(l=>Array.isArray(l.src)?l.src.map(a=>({...l,src:a})):l).map(async l=>await to(l.src,{ignore:l.exclude}).then(a=>({dest:l.dest??"",parent:oo(l.src),src:a}))));for(const l of s)for(const a of l.src){let i;o.has(a)?i=o.get(a):(i={copied:[],dest:[],timestamp:0},o.set(a,i));const c=n.flatten?Z(l.dest):v(l.dest,S(l.parent,te(a)));i.dest.includes(c)||i.dest.push(c),this.addWatchFile(a)}t.info({message:"Copying files...",prefix:"plugin:copy"}),await Promise.all([...o].map(async([l,a])=>{let i;try{const c=await Se(l);if(!c.isFile())return;const p=c.mtime.getTime();p>a.timestamp&&(a.timestamp=p,a.copied=[]),i=await Q(l,{buffer:!0})}catch(c){t.error({context:[c],message:`error reading file ${l}`,prefix:"plugin:copy"});return}for(const c of a.dest){if(n.copyOnce&&a.copied.includes(c))continue;const p=U(l),u=v(c,p);try{this.emitFile({[n.exactFileNames?"fileName":"name"]:u,source:i,type:"asset"}),t.debug({message:`copied ${l} → ${u}`,prefix:"plugin:copy"}),a.copied.push(c)}catch(d){t.error({context:[d],message:`error copying file ${l} → ${u}`,prefix:"plugin:copy"})}}}))},name:"packem:copy"}},"copyPlugin");var er=Object.defineProperty,tr=m((e,t)=>er(e,"name",{value:t,configurable:!0}),"n$4");const $e="export default ",Ve=tr(e=>{const t=ro(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($e)&&(r.code=r.code.replace($e,"module.exports = ")),r}}},"JSONPlugin");class or{static{m(this,"WalkerBase")}constructor(){this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:m(()=>this.should_skip=!0,"skip"),remove:m(()=>this.should_remove=!0,"remove"),replace:m(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 rr extends or{static{m(this,"SyncWalker")}constructor(t,o){super(),this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:m(()=>this.should_skip=!0,"skip"),remove:m(()=>this.should_remove=!0,"remove"),replace:m(n=>this.replacement=n,"replace")},this.enter=t,this.leave=o}visit(t,o,n,r){if(t){if(this.enter){const l=this.should_skip,a=this.should_remove,i=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=l,this.should_remove=a,this.replacement=i,c)return t;if(p)return null}let s;for(s in t){const l=t[s];if(l&&typeof l=="object")if(Array.isArray(l)){const a=l;for(let i=0;i<a.length;i+=1){const c=a[i];je(c)&&(this.visit(c,t,s,i)||i--)}}else je(l)&&this.visit(l,t,s,null)}if(this.leave){const l=this.replacement,a=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 i=this.should_remove;if(this.replacement=l,this.should_remove=a,i)return null}}return t}}function je(e){return e!==null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"}m(je,"isNode");function qe(e,{enter:t,leave:o}){return new rr(t,o).visit(e,null)}m(qe,"walk");var nr=Object.defineProperty,sr=m((e,t)=>nr(e,"name",{value:t,configurable:!0}),"u$5");const ir=sr(({attributes:e,logger:t})=>{const o=re([/\.[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(i){return this.warn({code:"PARSE_ERROR",message:`[packem:jsx-remove-attributes]: failed to parse "${r}" and remove the jsx attribute.`}),t.warn(i),null}let l=!1;const a=new N(n);return qe(s,{enter(i){if(i.type==="CallExpression"&&i.callee.type==="Identifier"&&i.callee.name==="jsx"){const c=i.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,""),l=!0)}}}),l?{code:a.toString(),map:a.generateMap({hires:!0})}:null}}},"jsxRemoveAttributes");var ar=Object.defineProperty,ce=m((e,t)=>ar(e,"name",{value:t,configurable:!0}),"p$2");const lr=ce(e=>{const t=[],o=[];return e.forEach(n=>{n.startsWith("(")?t.push(n):o.push(n)}),[...o.sort(),...t.sort()]},"sortLicenses"),cr=ce((e,t,o)=>{const n=new RegExp(`(<!-- ${t} -->)[\\s\\S]*?(<!-- ${t} -->)`,"g");if(n.test(e))return e.replace(n,`$1
|
|
25
25
|
${o}
|
|
26
|
-
$2`)},"replaceContentWithin"),Ye=ce(({licenseFilePath:e,licenseTemplate:t,logger:o,marker:n,mode:r,packageName:s})=>
|
|
26
|
+
$2`)},"replaceContentWithin"),Ye=ce(({licenseFilePath:e,licenseTemplate:t,logger:o,marker:n,mode:r,packageName:s})=>no({thirdParty(l){const a=new Set,i=l.sort(({name:p},{name:u})=>(p||0)>(u||0)?1:(u||0)>(p||0)?-1:0).map(({author:p,contributors:u,license:d,licenseText:f,maintainers:j,name:E,repository:_})=>{let w="## "+E+`
|
|
27
27
|
`;d&&(w+=`License: ${d}
|
|
28
28
|
`);const h=new Set;for(const P of[p,...j,...u]){const ue=typeof P=="string"?P:P?.name;ue&&h.add(ue)}return h.size>0&&(w+=`By: ${[...h].join(", ")}
|
|
29
29
|
`),_&&(w+=`Repository: ${typeof _=="string"?_:_.url}
|
|
@@ -35,10 +35,10 @@ $2`)},"replaceContentWithin"),Ye=ce(({licenseFilePath:e,licenseTemplate:t,logger
|
|
|
35
35
|
`),d&&a.add(d),w}).join(`
|
|
36
36
|
---------------------------------------
|
|
37
37
|
|
|
38
|
-
`);if(i===""){o.info({message:"No dependencies license information found.",prefix:"plugin:license:"+r});return}const c=t(
|
|
38
|
+
`);if(i===""){o.info({message:"No dependencies license information found.",prefix:"plugin:license:"+r});return}const c=t(lr(a),i,s);try{const p=_e(e),u=cr(p,n,c);if(!u){o.error({message:`Could not find the license marker: <!-- ${n} --> in ${e}`,prefix:"plugin:license:"+r});return}p!==u&&(Pe(e,u),o.info({message:`${e} updated.`,prefix:"plugin:license:"+r}))}catch(p){o.error(p)}}}),"license");var pr=Object.defineProperty,ur=m((e,t)=>pr(e,"name",{value:t,configurable:!0}),"i$9");const dr=ur(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=g(e.rootDir,e.outDir,"graph.json");Dt(o,t)},name:"packem:metafile"}),"metafilePlugin");var mr=Object.defineProperty,fr=m((e,t)=>mr(e,"name",{value:t,configurable:!0}),"r$5");const C=fr(e=>{const t=so("md5");return t.update(e),t.digest("hex")},"getHash");var gr=Object.defineProperty,Ge=m((e,t)=>gr(e,"name",{value:t,configurable:!0}),"m$4");const A=Ge(e=>e.handler||e,"getHandler"),k=Ge((e,t)=>({...e,async buildEnd(o){e.buildEnd&&await A(e.buildEnd).call(this,o)},async buildStart(o){e.buildStart&&await A(e.buildStart).call(this,o)},async load(o){if(!e.load)return null;const n=v("load",C(o));if(t.has(n,e.name))return await t.get(n,e.name);const r=await A(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=v("resolveId",C(o),n?C(n):"",C(JSON.stringify(r)));if(t.has(s,e.name))return await t.get(s,e.name);const l=await A(e.resolveId).call(this,o,n,r);return t.set(s,l,e.name),l},async transform(o,n){if(!e.transform)return null;const r=v("transform",C(n),C(o));if(t.has(r,e.name))return await t.get(r,e.name);const s=await A(e.transform).call(this,o,n);return t.set(r,s,e.name),s}}),"cachingPlugin");var hr=Object.defineProperty,yr=m((e,t)=>hr(e,"name",{value:t,configurable:!0}),"c$6");const vr=/\.(?:m|c)?(?:j|t)sx?$/,br=/^use \w+$/,$r=yr(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 l=r.moduleIds.map(c=>t[c]?t[c]:null).reduce((c,p)=>(p&&p.forEach(u=>{c.add(u)}),c),new Set),a=new N(n);l.size>0&&(e.debug({message:`directives for chunk "${r.fileName}" are preserved.`,prefix:"plugin:preserve-directives"}),a.prepend(`${[...l].map(c=>`'${c}';`).join(`
|
|
39
39
|
`)}
|
|
40
40
|
`));let i=null;return r.facadeModuleId&&typeof o[r.facadeModuleId]=="string"&&(i=o[r.facadeModuleId]),i&&(e.debug({message:`shebang for chunk "${r.fileName}" is preserved.`,prefix:"plugin:preserve-directives"}),a.prepend(`${i}
|
|
41
|
-
`)),l.size===0&&i===null?null:{code:a.toString(),map:s?a.generateMap({hires:!0}):null}},order:"post"},transform:{handler(n,r){const s=ee(r);if(!
|
|
41
|
+
`)),l.size===0&&i===null?null:{code:a.toString(),map:s?a.generateMap({hires:!0}):null}},order:"post"},transform:{handler(n,r){const s=ee(r);if(!vr.test(s))return null;let l=!1;const a=new N(n);if(n.startsWith("#")&&n[1]==="!"){let c=0;for(let p=2,u=n.length;p<u;p++){const d=n.codePointAt(p);if(d===10||d===13||d===8232||d===8233){c=p;break}}c&&(o[r]=n.slice(0,c),a.remove(0,c+1),l=!0,e.debug({message:`shebang for module "${r}" is preserved.`,prefix:"plugin:preserve-directives"}))}let i=null;try{i=this.parse(a.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(i.type!=="Program")return null;for(const c of i.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"&&br.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"&&(a.remove(c.start,c.end),l=!0),e.debug({message:`directive "${p}" for module "${r}" is preserved.`,prefix:"plugin:preserve-directives"}))}return l?{code:a.toString(),map:a.generateMap({hires:!0}),meta:{preserveDirectives:{directives:[...t[r]??[]],shebang:o[r]??null}}}:null},order:"post"}}},"preserveDirectives");var jr=Object.defineProperty,wr=m((e,t)=>jr(e,"name",{value:t,configurable:!0}),"r$4");const kr={exclude:[],include:[/\.(md|txt|css|htm|html)$/]},xr=wr((e={})=>{e={...e,...kr};const t=re(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 Er=Object.defineProperty,Or=m((e,t)=>Er(e,"name",{value:t,configurable:!0}),"l$3");const q="\0__file_url__",Ke=Or(()=>({async load(e){if(e.startsWith(q)){const t=Vt(e.slice(q.length));return await Q(t)}},name:"packem:resolve-file-url",resolveId(e){if(e.startsWith("file://"))return`${q}${e}`}}),"resolveFileUrl");var Dr=Object.defineProperty,Xe=m((e,t)=>Dr(e,"name",{value:t,configurable:!0}),"i$5");const Nr=/__filename|__dirname|require\(|require\.resolve\(/,Qe=`
|
|
42
42
|
// -- pack CommonJS Shims --
|
|
43
43
|
import __cjs_url__ from "node:url";
|
|
44
44
|
import __cjs_path__ from "node:path";
|
|
@@ -52,28 +52,28 @@ import __cjs_mod__ from "node:module";
|
|
|
52
52
|
const __filename = import.meta.filename;
|
|
53
53
|
const __dirname = import.meta.dirname;
|
|
54
54
|
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
55
|
-
`,
|
|
55
|
+
`,Sr=Xe((e,t)=>{if(x.INTERNAL_PACKEM_BUILD!=="1"&&(e.includes(Qe)||e.includes(Ze)||!Nr.test(e)))return null;const o=Ie(e).pop(),n=o?o.end:0,r=new N(e);return r.appendRight(n,t),{code:r.toString(),map:r.generateMap()}},"CJSToESM"),_r=Xe(e=>({name:"packem:cjs",renderChunk(t,o,n){if(n.format==="es"){let r=Qe;if(e.engines?.node){const s=Be(e.engines.node);s&&s.major>=20&&s.minor>=11&&(r=Ze)}return Sr(t,r)}return null}}),"cjsPlugin");var Pr=Object.defineProperty,R=m((e,t)=>Pr(e,"name",{value:t,configurable:!0}),"s$6");const Mr=/\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\//g,Cr=/MIT License|MIT license|BSD license/,Fr=/\n{2,}/g,Ir=/\b(\w+)\$\d+\b/g,Rr=/[-/\\^$*+?.()|[\]{}]/g,Tr=R(e=>e.replaceAll(Rr,"\\$&"),"escapeRegex"),Ar=R(e=>[...new Set(e)],"unique"),Wr=R(e=>e.replaceAll(Mr,t=>Cr.test(t)?"":t).replaceAll(Fr,`
|
|
56
56
|
|
|
57
|
-
`),"cleanUnnecessaryComments"),we=new Map;function et(e,t,{identifierReplacements:o},n){const r=Ie(e);for(const l in o){const a=r.find(c=>c.specifier===l&&c.imports.includes("{"));if(!a){this.warn(`${t.fileName} does not import "${l}" for replacement`),process.exitCode=1;continue}const i=o[l];for(const c in i){a.imports.includes(c)||(this.warn(`${t.fileName} does not import "${c}" from "${l}" for replacement`),I(1));const p=i[c],u=
|
|
57
|
+
`),"cleanUnnecessaryComments"),we=new Map;function et(e,t,{identifierReplacements:o},n){const r=Ie(e);for(const l in o){const a=r.find(c=>c.specifier===l&&c.imports.includes("{"));if(!a){this.warn(`${t.fileName} does not import "${l}" for replacement`),process.exitCode=1;continue}const i=o[l];for(const c in i){a.imports.includes(c)||(this.warn(`${t.fileName} does not import "${c}" from "${l}" for replacement`),I(1));const p=i[c],u=Tr(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=Ar(Array.from(e.matchAll(Ir),l=>l[0]));if(s.length>0){const l=s.map(i=>`
|
|
58
58
|
- ${i}`).join(""),a=t.fileName.replace(/\.[^/.]+$/,"");we.has(a)||n.warn({message:`${t.fileName} contains confusing identifier names${l}
|
|
59
59
|
|
|
60
|
-
To replace these, add them to the "rollup -> patchTypes -> identifierReplacements" option in your packem config.`,prefix:"plugin:patch-types"}),we.set(a,!0)}return e}m(et,"v$1");R(et,"replaceConfusingTypeNames");function tt(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}m(tt,"N$1");R(tt,"removeInternal");function ot(e,t){if(e.includes("@internal")){const o=new N(e),n=
|
|
60
|
+
To replace these, add them to the "rollup -> patchTypes -> identifierReplacements" option in your packem config.`,prefix:"plugin:patch-types"}),we.set(a,!0)}return e}m(et,"v$1");R(et,"replaceConfusingTypeNames");function tt(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}m(tt,"N$1");R(tt,"removeInternal");function ot(e,t){if(e.includes("@internal")){const o=new N(e),n=io(e,{plugins:["typescript"],sourceType:"module"});qe(n,{enter(r){tt(o,r)&&this.skip()}}),e=o.toString(),e.includes("@internal")&&(this.warn(`${t.fileName} has unhandled @internal declarations`),I(1))}return e}m(ot,"S");R(ot,"stripInternalTypes");const Br=R((e,t)=>({name:"packem:patch-types",renderChunk(o,n){return o=et.call(this,o,n,e,t),o=ot.call(this,o,n),o=Wr(o),o},resolveId(o){return o.startsWith("types/")?{external:!0,id:"../../"+(o.endsWith(".js")?o:o+".js")}:null}}),"patchTypescriptTypes");var Jr=Object.defineProperty,rt=m((e,t)=>Jr(e,"name",{value:t,configurable:!0}),"u$3");const nt=rt((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 l=g(te(n),r),a=[];if(s)for(const[i,c]of Object.entries(s)){const p=new RegExp(`^${[...i].map(d=>d==="*"?"(.+)":d.replace(/[\\^$*+?.()|[\]{}]/,"\\$&")).join("")}$`);let u=0;for(const d of c){const f=[...he(g(l,d))].map(j=>j==="*"?`$${++u}`:j==="$"?"$$":j).join("");a.push({find:p,replacement:f})}}return t&&a.push({find:/^(?!\.*\/|\.*$|\w:)(.+)$/,replacement:`${[...he(l)].map(i=>i==="$"?"$$":i).join("")}/$1`}),a},"getConfigAlias"),st=rt((e,t)=>{const o=nt(e);return{name:"packem:resolve-tsconfig-paths",async resolveId(n,r,s){if(!o||n.includes("\0"))return null;for(const{find:l,replacement:a}of o)if(l.test(n)){const i=n.replace(l,a),c=await this.resolve(i,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 Lr=Object.defineProperty,it=m((e,t)=>Lr(e,"name",{value:t,configurable:!0}),"u$2");const zr=it((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 l of r){if(l.startsWith("."))throw new Error(`Invalid rootDir value '.' in ${n}.`);if(l.startsWith(".."))throw new Error(`Invalid rootDir value '..' in ${n}.`);s.push(g(e,l))}return s},"getRootDirectories"),at=it((e,t,o)=>{const n=zr(e,o);return{name:"packem:resolve-tsconfig-root-dirs",async resolveId(r,s,l){if(n===null||n.length===0)return null;if(r.startsWith("."))for(const a of n){const i=v(a,r),c=await this.resolve(i,s,{skipSelf:!0,...l});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 Ur=Object.defineProperty,Hr=m((e,t)=>Ur(e,"name",{value:t,configurable:!0}),"r$3");const lt=Hr(()=>{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 Vr=Object.defineProperty,qr=m((e,t)=>Vr(e,"name",{value:t,configurable:!0}),"s$5");const Yr=qr(e=>{const t=U(e).split(".");if(t.length>=2){const[o,n]=t.slice(-2),r=t[0],s=/^(\w+)-runtime$/.exec(o)?.[1];if(T.includes(n)&&s&&s.length>0)return r+"-"+s}},"getCustomModuleLayer");var Gr=Object.defineProperty,Kr=m((e,t)=>Gr(e,"name",{value:t,configurable:!0}),"i$4");const Y=Kr(e=>(e.preserveDirectives||{directives:[]}).directives.map(t=>t.replace(/^use /,"")).find(t=>t!=="strict"),"getModuleLayer");var Xr=Object.defineProperty,ke=m((e,t)=>Xr(e,"name",{value:t,configurable:!0}),"c$4");const xe=ke((e,t)=>{const o=new Map;return ke(function(n,r){const s=r.getModuleInfo(n);if(!s)return;const{isEntry:l}=s,a=s.meta,i=Y(a);if(!l){const c=o.get(n);if(c)return c;const p=Yr(n);if(p)return o.set(n,p),p}if(l){const c=r.getModuleIds();for(const p of c)r.getModuleInfo(p)&&Y(a)===i&&(e.has(p)||e.set(p,new Set),e.get(p).add([n,i]))}if(i&&!l&&e.has(n)){const c=[...e.get(n)];if(c.some(([u])=>{if(t.some(d=>d.path===u)){const d=r.getModuleInfo(u);return Y(d?d.meta:{})===i}return!1}))return;if(c.every(([,u])=>u===i))return o.has(n)?o.get(n):void 0;const p=`${U(n,ee(n))}-${i}`;return o.set(n,p),p}},"splitChunks")},"createSplitChunks");var Qr=Object.defineProperty,Zr=m((e,t)=>Qr(e,"name",{value:t,configurable:!0}),"n$2");const D=Zr((e,t,o)=>t.isDynamicEntry?`chunks/[name].${o}`:`shared/${e.options.name}.[hash].${o}`,"getChunkFilename");var en=Object.defineProperty,tn=m((e,t)=>en(e,"name",{value:t,configurable:!0}),"s$3");const on=process.platform==="win32",Ee=tn((e,t)=>{const o=on?"\\":"/";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 rn=Object.defineProperty,b=m((e,t)=>rn(e,"name",{value:t,configurable:!0}),"p$1");const nn=b((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"+jt.node.split(".")[0];if(t.pkg.engines?.node){const n=Be(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"),ct=b((e,t)=>e.code==="CIRCULAR_DEPENDENCY"&&/Circular dependency:[\s\S]*node_modules/.test(e.message)?!0:e.code==="UNRESOLVED_IMPORT"?(t.logger.error(`Failed to resolve the module "${e.exporter}" imported by "${y(S(g(),e.id))}"
|
|
61
61
|
Is the module installed? Note:
|
|
62
62
|
↳ to inline a module into your bundle, install it to "devDependencies".
|
|
63
63
|
↳ to depend on a module via import/require, install it to "dependencies".`),process.exitCode=1,!0):e.code==="MIXED_EXPORTS"&&t.options.cjsInterop===!0,"sharedOnWarn"),Oe=new Map,pt=b((e,t,o)=>{const n=b(s=>{for(const[l,a]of Object.entries(t))if(s.startsWith(l))return s.replace(l,a)},"findAlias"),r=nt(e.tsconfig,!1);return{external(s){const l=n(s);l&&(s=l);const a=X(s),i=K(e.options.externals,a)||K(e.options.externals,s);if(i)return!0;if(s.startsWith(".")||Ce(s)||/src[/\\]/.test(s)||e.pkg.name&&s.startsWith(e.pkg.name))return!1;if(r){for(const{find:c}of r)if(c.test(s))return e.logger.debug({message:`Resolved alias ${s} to ${c.source}`,prefix:o}),!1}return!i&&!Oe.has(s)&&e.logger.info({message:'Inlined implicit external "'+y(s)+'". If this is incorrect, add it to the "externals" option.',prefix:o}),Oe.set(s,!0),i},input:Object.fromEntries(e.options.entries.map(s=>[s.name,g(e.options.rootDir,s.input)])),logLevel:e.options.debug?"debug":"info",onLog:b((s,l)=>{let a=l.message;switch(l.stack&&(a=`${a}
|
|
64
|
-
${l.stack}`),s){case"info":{e.logger.info({message:a,prefix:o+(l.plugin?":plugin:"+l.plugin:"")});return}case"warn":{e.logger.warn({message:a,prefix:o+(l.plugin?":plugin:"+l.plugin:"")});return}case"debug":e.logger.debug({message:a,prefix:o+(l.plugin?":plugin:"+l.plugin:"")})}},"onLog"),onwarn(s,l){ct(s,e)||s.code||l(s)},watch:e.mode==="watch"?e.options.rollup.watch:!1}},"baseRollupOptions"),ut=b(async(e,t)=>{const o=se(e,"build");let n;return e.options.rollup.resolve&&(n=k(Ae({extensions:T,...e.options.rollup.resolve}),t)),{...pt(e,o,"dependencies"),output:[e.options.emitCJS&&{chunkFileNames:b(r=>D(e,r,"cjs"),"chunkFileNames"),dir:g(e.options.rootDir,e.options.outDir),entryFileNames:b(r=>Ee(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:xe(e.dependencyGraphMap,e.buildEntries),preserveModules:!1}},e.options.emitESM&&{chunkFileNames:b(r=>D(e,r,"mjs"),"chunkFileNames"),dir:g(e.options.rootDir,e.options.outDir),entryFileNames:b(r=>Ee(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:xe(e.dependencyGraphMap,e.buildEntries),preserveModules:!1}}].filter(Boolean),plugins:[k(Ke(),t),k(lt(),t),e.tsconfig&&k(at(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&k(st(e.tsconfig,e.logger),t),e.options.rollup.replace&&We({...e.options.rollup.replace,values:{...e.options.replace,...e.options.rollup.replace.values}}),e.options.rollup.alias&&Te({customResolver:n?.resolveId,...e.options.rollup.alias,entries:o}),n,e.options.rollup.polyfillNode&&
|
|
65
|
-
`;return n.startsWith(r)?n.slice(r.length):n},"extractStack"),
|
|
64
|
+
${l.stack}`),s){case"info":{e.logger.info({message:a,prefix:o+(l.plugin?":plugin:"+l.plugin:"")});return}case"warn":{e.logger.warn({message:a,prefix:o+(l.plugin?":plugin:"+l.plugin:"")});return}case"debug":e.logger.debug({message:a,prefix:o+(l.plugin?":plugin:"+l.plugin:"")})}},"onLog"),onwarn(s,l){ct(s,e)||s.code||l(s)},watch:e.mode==="watch"?e.options.rollup.watch:!1}},"baseRollupOptions"),ut=b(async(e,t)=>{const o=se(e,"build");let n;return e.options.rollup.resolve&&(n=k(Ae({extensions:T,...e.options.rollup.resolve}),t)),{...pt(e,o,"dependencies"),output:[e.options.emitCJS&&{chunkFileNames:b(r=>D(e,r,"cjs"),"chunkFileNames"),dir:g(e.options.rootDir,e.options.outDir),entryFileNames:b(r=>Ee(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:xe(e.dependencyGraphMap,e.buildEntries),preserveModules:!1}},e.options.emitESM&&{chunkFileNames:b(r=>D(e,r,"mjs"),"chunkFileNames"),dir:g(e.options.rootDir,e.options.outDir),entryFileNames:b(r=>Ee(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:xe(e.dependencyGraphMap,e.buildEntries),preserveModules:!1}}].filter(Boolean),plugins:[k(Ke(),t),k(lt(),t),e.tsconfig&&k(at(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&k(st(e.tsconfig,e.logger),t),e.options.rollup.replace&&We({...e.options.rollup.replace,values:{...e.options.replace,...e.options.rollup.replace.values}}),e.options.rollup.alias&&Te({customResolver:n?.resolveId,...e.options.rollup.alias,entries:o}),n,e.options.rollup.polyfillNode&&Zt({sourceMap:e.options.sourcemap,...e.options.rollup.polyfillNode}),e.options.rollup.json&&Ve({...e.options.rollup.json}),$r(e.logger),co(e.options.entries.filter(r=>r.executable).map(r=>r.name).filter(Boolean)),e.options.rollup.wsam&&Qt(e.options.rollup.wsam),e.options.transformer?.(nn(e.options.transformerName,e)),e.options.cjsInterop&&e.options.emitCJS&&He({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.dynamicVars&&Xt(e.options.rollup.dynamicVars),e.options.rollup.commonjs&&k(Kt({extensions:T,sourceMap:e.options.sourcemap,...e.options.rollup.commonjs}),t),e.options.rollup.preserveDynamicImports&&{renderDynamicImport(){return{left:"import(",right:")"}}},e.options.rollup.shim&&_r(e.pkg),e.options.rollup.raw&&xr(e.options.rollup.raw),e.options.rollup.jsxRemoveAttributes&&ir({attributes:e.options.rollup.jsxRemoveAttributes.attributes,logger:e.logger}),e.options.rollup.metafile&&dr({outDir:g(e.options.rootDir,e.options.outDir),rootDir:e.options.rootDir}),e.options.rollup.copy&&Zo(e.options.rollup.copy,e.logger),e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dependenciesTemplate=="function"&&Ye({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&&eo({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"),sn=b(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"),an=Yo(sn),dt=b(async(e,t)=>{const o=se(e,"types"),n={load(a){return/\.(?:js|cjs|mjs|jsx|ts|tsx|mts|json)$/.test(a)?null:""},name:"packem:ignore-files"},r=e.tsconfig?.config.compilerOptions;delete r?.lib;let s;e.options.rollup.resolve&&(s=k(Ae({extensions:T,...e.options.rollup.resolve}),t));const l="dts-plugin:"+process.pid+e.tsconfig.path;return{...pt(e,o,"dts"),onwarn(a,i){ct(a,e)||a.code!=="EMPTY_BUNDLE"&&i(a)},output:[e.options.emitCJS&&{chunkFileNames:b(a=>D(e,a,"d.cts"),"chunkFileNames"),dir:g(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.cts",format:"cjs",sourcemap:e.options.sourcemap,...e.options.rollup.output},{chunkFileNames:b(a=>D(e,a,"d.mts"),"chunkFileNames"),dir:g(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:b(a=>D(e,a,"d.ts"),"chunkFileNames"),dir:g(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.ts",format:"cjs",sourcemap:e.options.sourcemap,...e.options.rollup.output}].filter(Boolean),plugins:[k(Ke(),t),k(lt(),t),e.options.rollup.json&&Ve({...e.options.rollup.json}),n,e.tsconfig&&k(at(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&k(st(e.tsconfig,e.logger),t),e.options.rollup.replace&&We({...e.options.rollup.replace,values:{...e.options.replace,...e.options.rollup.replace.values}}),e.options.rollup.alias&&Te({customResolver:s?.resolveId,...e.options.rollup.alias,entries:o}),s,await an(l)(e),e.options.cjsInterop&&e.options.emitCJS&&He({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.patchTypes&&Br(e.options.rollup.patchTypes,e.logger),po(),e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dtsTemplate=="function"&&Ye({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 ln=Object.defineProperty,cn=m((e,t)=>ln(e,"name",{value:t,configurable:!0}),"c$3");const pn=cn(async(e,t)=>{const o=await ut(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 Fe(o);t.set(n,r.cache),await e.hooks.callHook("rollup:build",e,r);const s=o.output,l=new Map;for(const a of s){const{output:i}=await r.write(a),c=new Set,p=i.filter(d=>d.type==="chunk");for(const d of p){c.add(d.fileName);for(const f of d.imports)e.usedImports.add(f);d.isEntry&&e.buildEntries.push({bytes:Buffer.byteLength(d.code,"utf8"),chunks:d.imports.filter(f=>p.find(j=>j.fileName===f)),exports:d.exports,modules:Object.entries(d.modules).map(([f,j])=>({bytes:j.renderedLength,id:f})),path:d.fileName,type:"entry"})}const u=i.filter(d=>d.type==="asset");for(const d of u)l.has(d.fileName)||l.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(...l.values())},"build");var un=Object.defineProperty,L=m((e,t)=>un(e,"name",{value:t,configurable:!0}),"r$1");const dn=L(async(e,t)=>{const o=await dt(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 Fe(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=>D(e,s,"d.cts"),"chunkFileNames"),dir:g(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.cts"}),e.options.emitESM&&await r.write({chunkFileNames:L(s=>D(e,s,"d.mts"),"chunkFileNames"),dir:g(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.mts"}),(e.options.declaration===!0||e.options.declaration==="compatible")&&await r.write({chunkFileNames:L(s=>D(e,s,"d.ts"),"chunkFileNames"),dir:g(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.ts"}),await e.hooks.callHook("rollup:dts:done",e)},"buildTypes");var mn=Object.defineProperty,pe=m((e,t)=>mn(e,"name",{value:t,configurable:!0}),"i$2");const fn=pe(e=>{const{message:t,name:o="Error",stack:n}=e;if(!n)return n;const r=`${o}: ${t}
|
|
65
|
+
`;return n.startsWith(r)?n.slice(r.length):n},"extractStack"),gn=pe(e=>`
|
|
66
66
|
${e.replaceAll(/^\n|\n$/g,"")}
|
|
67
|
-
`,"normalizeCodeFrame"),mt=pe(e=>{const t=
|
|
67
|
+
`,"normalizeCodeFrame"),mt=pe(e=>{const t=fn(e);let o=(e.plugin?`[${e.plugin}] `:"")+e.message;e.id&&(o+=`
|
|
68
68
|
file: ${y(e.id+(e.loc?":"+e.loc.line+":"+e.loc.column:""))}`),e.frame&&(o+=`
|
|
69
|
-
`+kt(
|
|
70
|
-
${t}`)},"enhanceRollupError");var
|
|
71
|
-
└─ ${S(process.cwd(),l)}`);if(e.logger.info(s),De(n,"bundle",e.logger),e.options.declaration){const l=await dt(e,t);await e.hooks.callHook("rollup:dts:options",e,l);const a=fe(l);await e.hooks.callHook("rollup:watch",e,a),De(a,"types",e.logger)}},"watch");var
|
|
72
|
-
- `+y(a)+(i.length>0?xt` (did you mean ${i.map(c=>`"${c}"`).join(", ")}?)`:"")}B(t,l)}},"validatePackage");var
|
|
69
|
+
`+kt(gn(e.frame))),e.message=o,t!==void 0&&(e.stack=`${e.message}
|
|
70
|
+
${t}`)},"enhanceRollupError");var hn=Object.defineProperty,ft=m((e,t)=>hn(e,"name",{value:t,configurable:!0}),"l$2");const De=ft((e,t,o)=>{const n="watcher:"+t;e.on("change",(r,{event:s})=>{o.info({message:`${y(S(".",r))} was ${s}d`,prefix:n})}),e.on("restart",()=>{o.info({message:"Rebuilding "+t+"...",prefix:n})}),e.on("event",r=>{switch(r.code){case"END":{o.success({message:"Rebuild "+t+" finished",prefix:n});break}case"BUNDLE_START":{o.info({message:y("build started..."),prefix:n});break}case"BUNDLE_END":{r.result.close(),o.info({message:y(`built in ${r.duration}ms.`),prefix:n});break}case"ERROR":{mt(r.error),o.error({context:[r.error],message:"Rebuild "+t+" failed: "+r.error.message,prefix:n});break}}})},"watchHandler"),yn=ft(async(e,t)=>{const o=await ut(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=[v(e.options.sourceDir,"**")],o.watch.chokidar={cwd:e.options.rootDir,...o.watch.chokidar});const n=await fe(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 l of r)s+=F(`
|
|
71
|
+
└─ ${S(process.cwd(),l)}`);if(e.logger.info(s),De(n,"bundle",e.logger),e.options.declaration){const l=await dt(e,t);await e.hooks.callHook("rollup:dts:options",e,l);const a=fe(l);await e.hooks.callHook("rollup:watch",e,a),De(a,"types",e.logger)}},"watch");var vn=Object.defineProperty,bn=m((e,t)=>vn(e,"name",{value:t,configurable:!0}),"i$1");const gt=bn(e=>`{ ${Object.keys(e).map(t=>`${t}: ${JSON.stringify(e[t])}`).join(", ")} }`,"dumpObject");var $n=Object.defineProperty,jn=m((e,t)=>$n(e,"name",{value:t,configurable:!0}),"a$2");class wn{static{m(this,"p")}static{jn(this,"FileCache")}#r;#e;#n;#t=!0;#o=new Map;#s;constructor(t,o,n){this.#r=t,this.#e=Ct("visulima-packem",{cwd:t}),this.#n=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:W(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(!W(n))return;const r=_e(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),Gt(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)),Pe(r,o,{overwrite:!0})}getFilePath(t,o){let n=t.replaceAll(me(this.#r),"");return n=n.replaceAll(":","-"),v(this.#e,this.#n,o?.replaceAll(":","-")??"",me(n))}}var kn=Object.defineProperty,z=m((e,t)=>kn(e,"name",{value:t,configurable:!0}),"l$1");const xn=re,En=z((e,t)=>{const{sideEffects:o}=t;let n;if(typeof o=="boolean")n=z(()=>o,"hasSideEffects");else if(Array.isArray(o))if(o.length<=0)n=z(()=>!1,"hasSideEffects");else{const r=o.map(s=>s.includes("/")?s:`**/${s}`);n=xn(r,null,{resolve:e})}else n=z(()=>null,"hasSideEffects");return n},"getPackageSideEffect");var On=Object.defineProperty,Dn=m((e,t)=>On(e,"name",{value:t,configurable:!0}),"y");const Nn=Dn((e,t,o)=>e.reduce((n,r)=>{const s=r[t],l=r[o];return n[s]||(n[s]={}),n[s][l]||(n[s][l]=[]),n[s][l].push(r),n},{}),"groupByKeys");var Sn=Object.defineProperty,_n=m((e,t)=>Sn(e,"name",{value:t,configurable:!0}),"o");const Pn=_n(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)!K(e.options.externals,r)&&!r.startsWith("chunks/")&&!e.options.dependencies.includes(X(r))&&!e.options.peerDependencies.includes(X(r))&&n.add(r);o.size>0&&B(e,`Potential unused dependencies found: ${[...o].map(r=>y(r)).join(", ")}`),n.size>0&&B(e,`Potential implicit dependencies found: ${[...n].map(r=>y(r)).join(", ")}`)},"validateDependencies");var Mn=Object.defineProperty,ht=m((e,t)=>Mn(e,"name",{value:t,configurable:!0}),"i");const Cn=ht((e,t)=>ao(e,t)<=e.length/3||t.includes(e),"isSimilar"),Fn=ht((e,t)=>{const o=e.toLowerCase();return t.filter(n=>Cn(n.toLowerCase(),o))},"findAlternatives");var In=Object.defineProperty,Ne=m((e,t)=>In(e,"name",{value:t,configurable:!0}),"n");const Rn=Ne((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:"",...ae(e.exports,e.type??"commonjs",t.options.declaration).map(r=>r.file)].map(r=>r&&g(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("*")&&!oe(r)&&n.push(r.replace(`${t.rootDir}/`,""));if(n.length>0){const r=Ne(a=>S(t.rootDir,g(t.options.outDir,a)),"rPath"),s=t.buildEntries.filter(a=>!a.chunk).map(a=>r(a.path));let l="Potential missing or wrong package.json files:";for(const a of n){const i=Fn(a,s);l+=`
|
|
72
|
+
- `+y(a)+(i.length>0?xt` (did you mean ${i.map(c=>`"${c}"`).join(", ")}?)`:"")}B(t,l)}},"validatePackage");var Tn=Object.defineProperty,$=m((e,t)=>Tn(e,"name",{value:t,configurable:!0}),"f");const yt=$((e,t)=>{e.warnings.size>0&&(t&&e.logger.raw(`
|
|
73
73
|
`),e.logger.warn(`Build is done with some warnings:
|
|
74
74
|
|
|
75
75
|
${[...e.warnings].map(o=>`- ${o}`).join(`
|
|
76
|
-
`)}`),e.options.failOnWarn&&(e.logger.error("Exiting with code (1). You can change this behavior by setting `failOnWarn: false`."),I(1)))},"logErrors"),
|
|
76
|
+
`)}`),e.options.failOnWarn&&(e.logger.error("Exiting with code (1). You can change this behavior by setting `failOnWarn: false`."),I(1)))},"logErrors"),An=$(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"),Wn=$((e,t,o,n,r,s,l,a,i)=>{const c=An(i?.config.compilerOptions?.jsx),p=Jt(s,r,l,{alias:{},clean:!0,debug:n,declaration:!0,dependencies:[],devDependencies:[],emitCJS:!0,emitESM:!0,entries:[],externals:[...de.builtinModules,...de.builtinModules.map(u=>`node:${u}`)],failOnWarn:!0,fileCache:!0,minify:x.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:i?.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:i?.config.compilerOptions?.jsx==="react-jsxdev",jsxFactory:i?.config.compilerOptions?.jsxFactory,jsxFragment:i?.config.compilerOptions?.jsxFragmentFactory,jsxImportSource:i?.config.compilerOptions?.jsxImportSource,jsxSideEffects:!0,keepNames:!0,minifyWhitespace:x.NODE_ENV==="production",sourcesContent:!1,target:i?.config.compilerOptions?.target,treeShaking:!0,tsconfigRaw:i?.config},json:{preferConst:!0},license:{dependenciesTemplate:$((u,d,f)=>`
|
|
77
77
|
# Licenses of bundled dependencies
|
|
78
78
|
The published ${f} artifact additionally contains code with the following licenses:
|
|
79
79
|
${u.join(", ")}
|
|
@@ -85,10 +85,10 @@ The published ${f} artifact additionally contains code with the following licens
|
|
|
85
85
|
${u.join(", ")}
|
|
86
86
|
|
|
87
87
|
# Bundled types:
|
|
88
|
-
`+d,"dtsTemplate")},patchTypes:{},polyfillNode:{},preserveDynamicImports:!0,raw:{exclude:ge,include:["**/*.data","**/*.txt"]},replace:{objectGuards:!0,preventAssignment:!0},resolve:{allowExportsFolderMapping:!1,preferBuiltins:!1},shim:!0,sucrase:{disableESTransforms:!0,enableLegacyBabel5ModuleInterop:!1,enableLegacyTypeScriptModuleInterop:i?.config.compilerOptions?.esModuleInterop===!1,include:/\.[jt]sx?$/,injectCreateRequireForImportRequire:!1,preserveDynamicImport:!0,production:x.NODE_ENV==="production",...i?.config.compilerOptions?.jsx&&["react","react-jsx","react-jsxdev"].includes(i.config.compilerOptions.jsx)?{jsxFragmentPragma:i.config.compilerOptions.jsxFragmentFactory,jsxImportSource:i.config.compilerOptions.jsxImportSource,jsxPragma:i.config.compilerOptions.jsxFactory,jsxRuntime:c,transforms:["typescript","jsx",...i.config.compilerOptions.esModuleInterop?["imports"]:[]]}:{transforms:["typescript",...i?.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:i?.config.compilerOptions?.experimentalDecorators,syntax:i?"typescript":"ecmascript",[i?"tsx":"jsx"]:!0},target:i?.config.compilerOptions?.target?.toLowerCase(),transform:{decoratorMetadata:i?.config.compilerOptions?.emitDecoratorMetadata,legacyDecorator:i?.config.compilerOptions?.experimentalDecorators,react:{development:x.NODE_ENV!=="production",pragma:i?.config.compilerOptions?.jsxFactory,pragmaFrag:i?.config.compilerOptions?.jsxFragmentFactory,runtime:c,throwIfNamespace:!0},treatConstEnumAsEnum:i?.config.compilerOptions?.preserveConstEnums,useDefineForClassFields:i?.config.compilerOptions?.useDefineForClassFields}},module:{ignoreDynamic:!0,importInterop:"none",preserveImportMeta:!0,strict:!1,strictMode:!1,type:"es6"}},treeshake:{moduleSideEffects:
|
|
88
|
+
`+d,"dtsTemplate")},patchTypes:{},polyfillNode:{},preserveDynamicImports:!0,raw:{exclude:ge,include:["**/*.data","**/*.txt"]},replace:{objectGuards:!0,preventAssignment:!0},resolve:{allowExportsFolderMapping:!1,preferBuiltins:!1},shim:!0,sucrase:{disableESTransforms:!0,enableLegacyBabel5ModuleInterop:!1,enableLegacyTypeScriptModuleInterop:i?.config.compilerOptions?.esModuleInterop===!1,include:/\.[jt]sx?$/,injectCreateRequireForImportRequire:!1,preserveDynamicImport:!0,production:x.NODE_ENV==="production",...i?.config.compilerOptions?.jsx&&["react","react-jsx","react-jsxdev"].includes(i.config.compilerOptions.jsx)?{jsxFragmentPragma:i.config.compilerOptions.jsxFragmentFactory,jsxImportSource:i.config.compilerOptions.jsxImportSource,jsxPragma:i.config.compilerOptions.jsxFactory,jsxRuntime:c,transforms:["typescript","jsx",...i.config.compilerOptions.esModuleInterop?["imports"]:[]]}:{transforms:["typescript",...i?.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:i?.config.compilerOptions?.experimentalDecorators,syntax:i?"typescript":"ecmascript",[i?"tsx":"jsx"]:!0},target:i?.config.compilerOptions?.target?.toLowerCase(),transform:{decoratorMetadata:i?.config.compilerOptions?.emitDecoratorMetadata,legacyDecorator:i?.config.compilerOptions?.experimentalDecorators,react:{development:x.NODE_ENV!=="production",pragma:i?.config.compilerOptions?.jsxFactory,pragmaFrag:i?.config.compilerOptions?.jsxFragmentFactory,runtime:c,throwIfNamespace:!0},treatConstEnumAsEnum:i?.config.compilerOptions?.preserveConstEnums,useDefineForClassFields:i?.config.compilerOptions?.useDefineForClassFields}},module:{ignoreDynamic:!0,importInterop:"none",preserveImportMeta:!0,strict:!1,strictMode:!1,type:"es6"}},treeshake:{moduleSideEffects:En(t,a),preset:"recommended"},watch:{chokidar:{ignoreInitial:!0,ignorePermissionErrors:!0},clearScreen:!0,exclude:ge}},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 "+y("rollup ")+zt,"Using "+y(p.transformerName)+" "+d+" as transformer"].join(`
|
|
89
89
|
`))}return p.rollup.resolve&&p.rollup.resolve.preferBuiltins===!0&&(p.rollup.polyfillNode=!1,e.debug("Disabling polyfillNode because preferBuiltins is set to true")),i?.config.compilerOptions?.isolatedModules||e.warn(`'compilerOptions.isolatedModules' is not enabled in tsconfig.
|
|
90
90
|
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.
|
|
91
|
-
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"),
|
|
91
|
+
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"),Bn=$(e=>e.replace(/\.(?:js|mjs|cjs|ts|mts|cts|json|jsx|tsx)$/,""),"removeExtension"),Jn=$(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=Ce(o.input)?S(t,o.input):Z(o.input);n.startsWith("./")&&(n=n.slice(2)),o.name=Bn(n.replace(/^src\//,""))}if(!o.input)throw new Error(`Missing entry input: ${gt(o)}`);if(o.input=g(e.options.rootDir,o.input),!W(o.input)){const n=new Set(await $t(te(o.input)));let r=!1;for(const s of T)if(n.has(U(o.input)+s)){r=!0;break}if(!r)throw new Pt("Your configured entry: "+y(o.input)+" does not exist.")}o.outDir=g(e.options.rootDir,o.outDir??e.options.outDir)}},"prepareEntries"),Ln=$((e,t,o)=>{const n=$(s=>S(t.rootDir,g(t.options.outDir,s)),"rPath");let r=!1;for(const s of t.buildEntries.filter(l=>!l.chunk)){let l=s.bytes??0;for(const i of s.chunks??[])l+=t.buildEntries.find(c=>c.path===i)?.bytes??0;let a=` ${O(n(s.path))} (${["total size: "+y(M(l)),s.type!=="asset"&&s.bytes&&"chunk size: "+y(M(s.bytes))].filter(Boolean).join(", ")})`;if(a+=s.exports?.length?`
|
|
92
92
|
exports: `+F(s.exports.join(", ")):"",s.chunks?.length&&(a+=`
|
|
93
93
|
${s.chunks.map(i=>{const c=t.buildEntries.find(p=>p.path===i)??{};return F(" └─ "+n(i)+O(c.bytes?" ("+M(c?.bytes)+")":""))}).join(`
|
|
94
94
|
`)}`),s.modules&&s.modules.length>0){const i=s.modules.filter(c=>c.id.includes("node_modules")).sort((c,p)=>(p.bytes||0)-(c.bytes||0)).map(c=>F(" 📦 "+n(c.id)+O(c.bytes?" ("+M(c.bytes)+")":""))).join(`
|
|
@@ -101,8 +101,8 @@ ${s.chunks.map(i=>{const c=t.buildEntries.find(p=>p.path===i)??{};return F("
|
|
|
101
101
|
types: `+O(n(p.path))+" (total size: "+y(M(p.bytes??0))+")"}}r=!0,a+=`
|
|
102
102
|
|
|
103
103
|
`,e.raw(s.chunk?F(a):a)}return r&&e.raw("Σ Total dist size (byte size):",y(M(t.buildEntries.reduce((s,l)=>s+(l.bytes??0),0))),`
|
|
104
|
-
`),r},"showSizeInformation"),
|
|
104
|
+
`),r},"showSizeInformation"),zn=$(async(e,t,o,n,r,s,l,a)=>{const i=Wo(s.preset??r.preset??"auto",t),c=Wn(e,t,o,n,r,s,i,l,a);Nt(v(c.rootDir,c.outDir));const p={buildEntries:[],dependencyGraphMap:new Map,hooks:Lt(),logger:e,mode:o,options:c,pkg:l,rootDir:t,tsconfig:a,usedImports:new Set,warnings:new Set};if(i.hooks&&p.hooks.addHooks(i.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&&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"),Un=$(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||e.options.rootDir.startsWith(o.endsWith("/")?o:`${o}/`)||t.some(n=>o.startsWith(n))||(t.push(o),e.logger.info(`Cleaning dist directory: \`./${S(e.options.rootDir,o)}\``),await Me(o))},"cleanDistributionDirectories"),Hn=$(async(e,t,o)=>{await e.hooks.callHook("build:before",e);const n=Nn(e.options.entries,"environment","runtime"),r=[],s=[];for(const[a,i]of Object.entries(n))for(const[c,p]of Object.entries(i)){s.push(...p.filter(d=>d.declaration));const u={...e};a==="development"&&(u.options.minify=!1),e.options.rollup.replace?(e.options.rollup.replace.values={...e.options.rollup.replace.values,production:a},c==="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."),u.options.entries=p,r.push(pn(u,o))}if(e.options.declaration){const a={...e};a.options.entries=s,r.push(dn(a,o))}await Promise.all(r),e.logger.success(Et(`Build succeeded for ${e.options.name}`));for await(const a of St(v(e.options.rootDir,e.options.outDir))){let i=e.buildEntries.find(c=>v(e.options.rootDir,e.options.outDir,c.path)===a.path);if(i||(i={chunk:!0,path:a.path},e.buildEntries.push(i)),!i.bytes){const c=await Se(g(e.options.rootDir,e.options.outDir,a.path));i.bytes=c.size}}const l=Ln(e.logger,e,t);Pn(e),Rn(t,e),await e.hooks.callHook("build:done",e),yt(e,l)},"build"),Ps=$(async(e,t,o={})=>{const{configPath:n,debug:r,tsconfigPath:s,...l}=o,a=[new At,new Wt];r&&a.push(new Bt);const i=Tt({logLevel:r?"debug":"informational",processors:a,scope:"packem"});e=g(wt(),e),i.debug("Root directory:",e);const c=v(e,"package.json"),p=Rt(c);i.debug("Using package.json found at",c);let u;if(s){const d=v(e,s);await _t(d)||(i.error("tsconfig.json not found at",d),I(1)),u={config:Ft(d),path:d},i.info("Using tsconfig settings at",d)}else try{u=await It(e),i.debug("Using tsconfig settings found at",u.path)}catch{i.info("No tsconfig.json or jsconfig.json found.")}try{const d=n??"./packem.config.ts";/\.(?:js|mjs|cjs|ts)$/.test(d)||(i.error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts extensions are allowed."),I(1));const f=Je(d,e);i.debug("Using packem config found at",v(e,d));const j=Date.now(),E=$(()=>Mt(Math.floor(Date.now()-j)),"getDuration"),_=C(JSON.stringify({version:p.version,...p.dependencies,...p.devDependencies,browser:p.browser,eNode:p.engines?.node,exports:p.exports,main:p.main,module:p.module,type:p.type,types:p.types})),w=new wn(e,_,i);w.cachePath&&!W(v(w.cachePath,_))&&W(w.cachePath)&&(i.info("Clearing file cache because the cache key has changed."),await Me(w.cachePath));const h=await zn(i,e,t,r??!1,l,f,p,u);if(w.isEnabled=h.options.fileCache,await Jn(h,e),h.logger.info(y((t==="watch"?"Watching":t==="jit"?"Stubbing":"Building")+" "+h.options.name)),h.logger.debug(`${O("Root dir:")} ${h.options.rootDir}
|
|
105
105
|
${O("Entries:")}
|
|
106
106
|
${h.options.entries.map(P=>` ${gt(P)}`).join(`
|
|
107
|
-
`)}`),await
|
|
107
|
+
`)}`),await Un(h),h.options.stub){await wo(h),await h.hooks.callHook("build:done",h);return}if(t==="watch"){if(h.options.rollup.watch===!1)throw new Error("Rollup watch is disabled. You should check your packem.config file.");await yn(h,w),yt(h,!1);return}await Hn(h,p,w),i.raw(`
|
|
108
108
|
⚡️ Build run in `+E()),i.restoreAll(),I(0)}catch(d){mt(d),i.error("An error occurred while building",d),I(1)}},"createBundler");export{Ps as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var $=Object.defineProperty;var g=(e,r)=>$(e,"name",{value:r,configurable:!0});const _=require("node:fs"),P=require("@rollup/pluginutils"),h=require("@visulima/path"),v=require("esbuild"),
|
|
1
|
+
"use strict";var $=Object.defineProperty;var g=(e,r)=>$(e,"name",{value:r,configurable:!0});const _=require("node:fs"),P=require("@rollup/pluginutils"),h=require("@visulima/path"),v=require("esbuild"),z=require("../../../shared/packem.NVRVuzg1.cjs"),x=require("../../../shared/packem.DUZi_m4G.cjs"),R=require("node:fs/promises"),F=require("@visulima/package"),j=require("es-module-lexer");var L=Object.defineProperty,S=g((e,r)=>L(e,"name",{value:r,configurable:!0}),"t$1");const k=S(async(e,r)=>{r.length>0&&(await v.formatMessages(r,{color:!0,kind:"warning"})).forEach(c=>e.warn(c))},"warn");var W=Object.defineProperty,q=g((e,r)=>W(e,"name",{value:r,configurable:!0}),"t");const A=q(e=>{if(e==="es")return"esm";if(e==="cjs")return e},"getEsbuildFormat"),C=q(({sourceMap:e=!0,...r})=>async function(c,o,i){if(r.minify||r.minifyWhitespace||r.minifyIdentifiers||r.minifySyntax){const n=A(i.format),l=await v.transform(c,{format:n,loader:"js",sourcemap:e,...r});if(await k(this,l.warnings),l.code)return{code:l.code,map:l.map||null}}return null},"getRenderChunk");var I=Object.defineProperty,O=g((e,r)=>I(e,"name",{value:r,configurable:!0}),"o");const E=O(e=>e.replaceAll("\\","/"),"slash"),U=O(async e=>{const r=await F.findCacheDirectory("packem/optimize_deps",{create:!0,cwd:e.cwd});if(!r)throw new Error('[packem:optimize-deps]: failed to find or create cache directory "node_modules/.cache/packem/optimize_deps".');await j.init,await v.build({absWorkingDir:e.cwd,bundle:!0,entryPoints:e.include,format:"esm",ignoreAnnotations:!0,metafile:!0,outdir:r,sourcemap:e.sourceMap,splitting:!0,...e.esbuildOptions,plugins:[{name:"optimize-deps",async setup(o){o.onResolve({filter:/.*/},async i=>{if(e.exclude?.includes(i.path))return{external:!0};if(i.pluginData?.__resolving_dep_path__)return null;if(e.include.includes(i.path)){const n=await o.resolve(i.path,{kind:"import-statement",pluginData:{__resolving_dep_path__:!0},resolveDir:i.resolveDir});return n.errors.length>0||n.warnings.length>0?n:{namespace:"optimize-deps",path:i.path,pluginData:{absolute:n.path,resolveDir:i.resolveDir}}}return null}),o.onLoad({filter:/.*/,namespace:"optimize-deps"},async i=>{const{absolute:n,resolveDir:l}=i.pluginData,p=await R.readFile(n,"utf8"),[,f]=j.parse(p);return{contents:f.length>0?`export * from '${E(n)}'`:`module.exports = require('${E(n)}')`,resolveDir:l}})}},...e.esbuildOptions?.plugins??[]]});const c=new Map;for(const o of e.include)c.set(o,{file:h.join(r,`${o}.js`)});return{cacheDir:r,optimized:c}},"optimizeDeps");var X=Object.defineProperty,G=g((e,r)=>X(e,"name",{value:r,configurable:!0}),"w");const T=G(({exclude:e,include:r,loaders:c,logger:o,optimizeDeps:i,sourceMap:n=!0,...l})=>{const p=z.DEFAULT_LOADERS;if(c!==void 0)for(let[t,s]of Object.entries(c))t=t.startsWith(".")?t:`.${t}`,typeof s=="string"?p[t]=s:s||delete p[t];const f=Object.keys(p),M=new RegExp(`\\.(${f.map(t=>t.slice(1)).join("|")})$`),y=P.createFilter(r??M,e??z.EXCLUDE_REGEXP);let d,D=process.cwd();const w=new Map;return{async buildStart(){!i||d||(d=await U({cwd:D,sourceMap:n,...i}),o.debug("optimized %O",d.optimized))},name:"esbuild",options({context:t}){return t&&(D=t),null},renderChunk:C({...l,sourceMap:n}),async resolveId(t,s,{isEntry:b}){if(!s||b||!y(t)||t.startsWith("\0"))return null;if(d?.optimized.has(t)){const a=d.optimized.get(t);if(a)return o.debug("resolved %s to %s",t,a.file),a.file}const u=w.get(t);if(u!==void 0)return u;if(s&&t.startsWith(".")){const a=h.resolve(s?h.dirname(s):process.cwd(),t);let m=x.u(f,a);if(m||!m&&_.existsSync(a)&&_.statSync(a).isDirectory()&&(m=x.u(f,a,!0),m))return w.set(t,m),m}return w.set(t,null),null},async transform(t,s){if(!y(s)||d?.optimized.has(s))return null;const b=h.extname(s),u=p[b];if(o.debug("transforming %s with %s loader",s,u),!u)return null;const a=await v.transform(t,{format:["base64","binary","dataurl","text","json"].includes(u)?"esm":void 0,loader:u,sourcefile:s.replace(/\.[cm]ts/,".ts"),sourcemap:n,...l});return await k(this,a.warnings),a.code?{code:a.code,map:a.map||null}:null}}},"default");module.exports=T;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var O=Object.defineProperty;var g=(e,r)=>O(e,"name",{value:r,configurable:!0});import{existsSync as k,statSync as M}from"node:fs";import{createFilter as $}from"@rollup/pluginutils";import{join as P,resolve as R,dirname as S,extname as W}from"@visulima/path";import{formatMessages as A,transform as _,build as C}from"esbuild";import{E as F,D as L}from"../../../shared/packem.HRXF255z.mjs";import{
|
|
1
|
+
var O=Object.defineProperty;var g=(e,r)=>O(e,"name",{value:r,configurable:!0});import{existsSync as k,statSync as M}from"node:fs";import{createFilter as $}from"@rollup/pluginutils";import{join as P,resolve as R,dirname as S,extname as W}from"@visulima/path";import{formatMessages as A,transform as _,build as C}from"esbuild";import{E as F,D as L}from"../../../shared/packem.HRXF255z.mjs";import{u as b}from"../../../shared/packem.0q8RrsjT.mjs";import{readFile as I}from"node:fs/promises";import{findCacheDirectory as U}from"@visulima/package";import{init as X,parse as q}from"es-module-lexer";
|
|
2
2
|
// -- pack CommonJS Shims --
|
|
3
3
|
import __cjs_url__ from "node:url";
|
|
4
4
|
import __cjs_path__ from "node:path";
|
|
@@ -6,4 +6,4 @@ import __cjs_mod__ from "node:module";
|
|
|
6
6
|
const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __cjs_path__.dirname(__filename);
|
|
8
8
|
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
9
|
-
var G=Object.defineProperty,T=g((e,r)=>G(e,"name",{value:r,configurable:!0}),"t$1");const z=T(async(e,r)=>{r.length>0&&(await A(r,{color:!0,kind:"warning"})).forEach(l=>e.warn(l))},"warn");var B=Object.defineProperty,x=g((e,r)=>B(e,"name",{value:r,configurable:!0}),"t");const H=x(e=>{if(e==="es")return"esm";if(e==="cjs")return e},"getEsbuildFormat"),J=x(({sourceMap:e=!0,...r})=>async function(l,s,i){if(r.minify||r.minifyWhitespace||r.minifyIdentifiers||r.minifySyntax){const n=H(i.format),c=await _(l,{format:n,loader:"js",sourcemap:e,...r});if(await z(this,c.warnings),c.code)return{code:c.code,map:c.map||null}}return null},"getRenderChunk");var K=Object.defineProperty,E=g((e,r)=>K(e,"name",{value:r,configurable:!0}),"o");const D=E(e=>e.replaceAll("\\","/"),"slash"),N=E(async e=>{const r=await U("packem/optimize_deps",{create:!0,cwd:e.cwd});if(!r)throw new Error('[packem:optimize-deps]: failed to find or create cache directory "node_modules/.cache/packem/optimize_deps".');await X,await C({absWorkingDir:e.cwd,bundle:!0,entryPoints:e.include,format:"esm",ignoreAnnotations:!0,metafile:!0,outdir:r,sourcemap:e.sourceMap,splitting:!0,...e.esbuildOptions,plugins:[{name:"optimize-deps",async setup(s){s.onResolve({filter:/.*/},async i=>{if(e.exclude?.includes(i.path))return{external:!0};if(i.pluginData?.__resolving_dep_path__)return null;if(e.include.includes(i.path)){const n=await s.resolve(i.path,{kind:"import-statement",pluginData:{__resolving_dep_path__:!0},resolveDir:i.resolveDir});return n.errors.length>0||n.warnings.length>0?n:{namespace:"optimize-deps",path:i.path,pluginData:{absolute:n.path,resolveDir:i.resolveDir}}}return null}),s.onLoad({filter:/.*/,namespace:"optimize-deps"},async i=>{const{absolute:n,resolveDir:c}=i.pluginData,u=await I(n,"utf8"),[,f]=q(u);return{contents:f.length>0?`export * from '${D(n)}'`:`module.exports = require('${D(n)}')`,resolveDir:c}})}},...e.esbuildOptions?.plugins
|
|
9
|
+
var G=Object.defineProperty,T=g((e,r)=>G(e,"name",{value:r,configurable:!0}),"t$1");const z=T(async(e,r)=>{r.length>0&&(await A(r,{color:!0,kind:"warning"})).forEach(l=>e.warn(l))},"warn");var B=Object.defineProperty,x=g((e,r)=>B(e,"name",{value:r,configurable:!0}),"t");const H=x(e=>{if(e==="es")return"esm";if(e==="cjs")return e},"getEsbuildFormat"),J=x(({sourceMap:e=!0,...r})=>async function(l,s,i){if(r.minify||r.minifyWhitespace||r.minifyIdentifiers||r.minifySyntax){const n=H(i.format),c=await _(l,{format:n,loader:"js",sourcemap:e,...r});if(await z(this,c.warnings),c.code)return{code:c.code,map:c.map||null}}return null},"getRenderChunk");var K=Object.defineProperty,E=g((e,r)=>K(e,"name",{value:r,configurable:!0}),"o");const D=E(e=>e.replaceAll("\\","/"),"slash"),N=E(async e=>{const r=await U("packem/optimize_deps",{create:!0,cwd:e.cwd});if(!r)throw new Error('[packem:optimize-deps]: failed to find or create cache directory "node_modules/.cache/packem/optimize_deps".');await X,await C({absWorkingDir:e.cwd,bundle:!0,entryPoints:e.include,format:"esm",ignoreAnnotations:!0,metafile:!0,outdir:r,sourcemap:e.sourceMap,splitting:!0,...e.esbuildOptions,plugins:[{name:"optimize-deps",async setup(s){s.onResolve({filter:/.*/},async i=>{if(e.exclude?.includes(i.path))return{external:!0};if(i.pluginData?.__resolving_dep_path__)return null;if(e.include.includes(i.path)){const n=await s.resolve(i.path,{kind:"import-statement",pluginData:{__resolving_dep_path__:!0},resolveDir:i.resolveDir});return n.errors.length>0||n.warnings.length>0?n:{namespace:"optimize-deps",path:i.path,pluginData:{absolute:n.path,resolveDir:i.resolveDir}}}return null}),s.onLoad({filter:/.*/,namespace:"optimize-deps"},async i=>{const{absolute:n,resolveDir:c}=i.pluginData,u=await I(n,"utf8"),[,f]=q(u);return{contents:f.length>0?`export * from '${D(n)}'`:`module.exports = require('${D(n)}')`,resolveDir:c}})}},...e.esbuildOptions?.plugins??[]]});const l=new Map;for(const s of e.include)l.set(s,{file:P(r,`${s}.js`)});return{cacheDir:r,optimized:l}},"optimizeDeps");var Q=Object.defineProperty,V=g((e,r)=>Q(e,"name",{value:r,configurable:!0}),"w");const le=V(({exclude:e,include:r,loaders:l,logger:s,optimizeDeps:i,sourceMap:n=!0,...c})=>{const u=L;if(l!==void 0)for(let[t,a]of Object.entries(l))t=t.startsWith(".")?t:`.${t}`,typeof a=="string"?u[t]=a:a||delete u[t];const f=Object.keys(u),j=new RegExp(`\\.(${f.map(t=>t.slice(1)).join("|")})$`),v=$(r??j,e??F);let d,y=process.cwd();const h=new Map;return{async buildStart(){!i||d||(d=await N({cwd:y,sourceMap:n,...i}),s.debug("optimized %O",d.optimized))},name:"esbuild",options({context:t}){return t&&(y=t),null},renderChunk:J({...c,sourceMap:n}),async resolveId(t,a,{isEntry:w}){if(!a||w||!v(t)||t.startsWith("\0"))return null;if(d?.optimized.has(t)){const o=d.optimized.get(t);if(o)return s.debug("resolved %s to %s",t,o.file),o.file}const p=h.get(t);if(p!==void 0)return p;if(a&&t.startsWith(".")){const o=R(a?S(a):process.cwd(),t);let m=b(f,o);if(m||!m&&k(o)&&M(o).isDirectory()&&(m=b(f,o,!0),m))return h.set(t,m),m}return h.set(t,null),null},async transform(t,a){if(!v(a)||d?.optimized.has(a))return null;const w=W(a),p=u[w];if(s.debug("transforming %s with %s loader",a,p),!p)return null;const o=await _(t,{format:["base64","binary","dataurl","text","json"].includes(p)?"esm":void 0,loader:p,sourcefile:a.replace(/\.[cm]ts/,".ts"),sourcemap:n,...c});return await z(this,o.warnings),o.code?{code:o.code,map:o.map||null}:null}}},"default");export{le as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var y=Object.defineProperty;var l=(n,r)=>y(n,"name",{value:r,configurable:!0});const f=require("node:fs"),q=require("@rollup/pluginutils"),d=require("@visulima/path"),
|
|
1
|
+
"use strict";var y=Object.defineProperty;var l=(n,r)=>y(n,"name",{value:r,configurable:!0});const f=require("node:fs"),q=require("@rollup/pluginutils"),d=require("@visulima/path"),g=require("sucrase"),p=require("../../../shared/packem.NVRVuzg1.cjs"),E=require("../../../shared/packem.DUZi_m4G.cjs");var h=Object.defineProperty,x=l((n,r)=>h(n,"name",{value:r,configurable:!0}),"f");const F=x(({exclude:n,extensions:r=p.DEFAULT_EXTENSIONS,include:m,...v})=>{const a=q.createFilter(m,n??p.EXCLUDE_REGEXP),c=new Map;return{async resolveId(e,t,{isEntry:u}){if(!t||u||!a(e)||e.startsWith("\0"))return null;const i=c.get(e);if(i!==void 0)return i;if(t&&e.startsWith(".")){const o=d.resolve(t?d.dirname(t):process.cwd(),e);let s=E.u(r,o);if(s||!s&&f.existsSync(o)&&f.statSync(o).isDirectory()&&(s=E.u(r,o,!0),s))return c.set(e,s),s}return c.set(e,null),null},async transform(e,t){if(!a(t))return null;const{code:u,sourceMap:i}=g.transform(e,{...v,filePath:t,sourceMapOptions:{compiledFilename:t}});return{code:u,map:i}}}},"sucrasePlugin");module.exports=F;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var d=Object.defineProperty;var u=(n,e)=>d(n,"name",{value:e,configurable:!0});import{existsSync as E,statSync as y}from"node:fs";import{createFilter as v}from"@rollup/pluginutils";import{resolve as
|
|
1
|
+
var d=Object.defineProperty;var u=(n,e)=>d(n,"name",{value:e,configurable:!0});import{existsSync as E,statSync as y}from"node:fs";import{createFilter as v}from"@rollup/pluginutils";import{resolve as g,dirname as x}from"@visulima/path";import{transform as P}from"sucrase";import{E as S,a as h}from"../../../shared/packem.HRXF255z.mjs";import{u as m}from"../../../shared/packem.0q8RrsjT.mjs";
|
|
2
2
|
// -- pack CommonJS Shims --
|
|
3
3
|
import __cjs_url__ from "node:url";
|
|
4
4
|
import __cjs_path__ from "node:path";
|
|
@@ -6,4 +6,4 @@ import __cjs_mod__ from "node:module";
|
|
|
6
6
|
const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __cjs_path__.dirname(__filename);
|
|
8
8
|
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
9
|
-
var D=Object.defineProperty,F=u((n,e)=>D(n,"name",{value:e,configurable:!0}),"f");const N=F(({exclude:n,extensions:e=h,include:f,...p})=>{const l=v(f,n??S),a=new Map;return{async resolveId(t,r,{isEntry:c}){if(!r||c||!l(t)||t.startsWith("\0"))return null;const s=a.get(t);if(s!==void 0)return s;if(r&&t.startsWith(".")){const i=
|
|
9
|
+
var D=Object.defineProperty,F=u((n,e)=>D(n,"name",{value:e,configurable:!0}),"f");const N=F(({exclude:n,extensions:e=h,include:f,...p})=>{const l=v(f,n??S),a=new Map;return{async resolveId(t,r,{isEntry:c}){if(!r||c||!l(t)||t.startsWith("\0"))return null;const s=a.get(t);if(s!==void 0)return s;if(r&&t.startsWith(".")){const i=g(r?x(r):process.cwd(),t);let o=m(e,i);if(o||!o&&E(i)&&y(i).isDirectory()&&(o=m(e,i,!0),o))return a.set(t,o),o}return a.set(t,null),null},async transform(t,r){if(!l(r))return null;const{code:c,sourceMap:s}=P(t,{...p,filePath:r,sourceMapOptions:{compiledFilename:r}});return{code:c,map:s}}}},"sucrasePlugin");export{N as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var y=Object.defineProperty;var a=(s,r)=>y(s,"name",{value:r,configurable:!0});const f=require("node:fs"),q=require("@rollup/pluginutils"),
|
|
1
|
+
"use strict";var y=Object.defineProperty;var a=(s,r)=>y(s,"name",{value:r,configurable:!0});const f=require("node:fs"),q=require("@rollup/pluginutils"),g=require("@swc/core"),d=require("@visulima/path"),p=require("../../../shared/packem.NVRVuzg1.cjs"),E=require("../../../shared/packem.DUZi_m4G.cjs");var w=Object.defineProperty,x=a((s,r)=>w(s,"name",{value:r,configurable:!0}),"a");const F=x(({exclude:s,extensions:r=p.DEFAULT_EXTENSIONS,include:m,...v})=>{const l=q.createFilter(m,s??p.EXCLUDE_REGEXP),o=new Map;return{async resolveId(e,t,{isEntry:u}){if(!t||u||!l(e)||e.startsWith("\0"))return null;const i=o.get(e);if(i!==void 0)return i;if(t&&e.startsWith(".")){const c=d.resolve(t?d.dirname(t):process.cwd(),e);let n=E.u(r,c);if(n||!n&&f.existsSync(c)&&f.statSync(c).isDirectory()&&(n=E.u(r,c,!0),n))return o.set(e,n),n}return o.set(e,null),null},async transform(e,t){if(!l(t))return null;const{code:u,map:i}=await g.transform(e,{...v,configFile:!1,filename:t,swcrc:!1});return{code:u,map:i}}}},"swcPlugin");module.exports=F;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var d=Object.defineProperty;var f=(o,e)=>d(o,"name",{value:e,configurable:!0});import{existsSync as E,statSync as y}from"node:fs";import{createFilter as v}from"@rollup/pluginutils";import{transform as w}from"@swc/core";import{resolve as
|
|
1
|
+
var d=Object.defineProperty;var f=(o,e)=>d(o,"name",{value:e,configurable:!0});import{existsSync as E,statSync as y}from"node:fs";import{createFilter as v}from"@rollup/pluginutils";import{transform as w}from"@swc/core";import{resolve as g,dirname as x}from"@visulima/path";import{E as S,a as D}from"../../../shared/packem.HRXF255z.mjs";import{u as m}from"../../../shared/packem.0q8RrsjT.mjs";
|
|
2
2
|
// -- pack CommonJS Shims --
|
|
3
3
|
import __cjs_url__ from "node:url";
|
|
4
4
|
import __cjs_path__ from "node:path";
|
|
@@ -6,4 +6,4 @@ import __cjs_mod__ from "node:module";
|
|
|
6
6
|
const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __cjs_path__.dirname(__filename);
|
|
8
8
|
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
9
|
-
var F=Object.defineProperty,I=f((o,e)=>F(o,"name",{value:e,configurable:!0}),"a");const T=I(({exclude:o,extensions:e=D,include:u,...p})=>{const l=v(u,o??S),a=new Map;return{async resolveId(t,r,{isEntry:c}){if(!r||c||!l(t)||t.startsWith("\0"))return null;const s=a.get(t);if(s!==void 0)return s;if(r&&t.startsWith(".")){const i=
|
|
9
|
+
var F=Object.defineProperty,I=f((o,e)=>F(o,"name",{value:e,configurable:!0}),"a");const T=I(({exclude:o,extensions:e=D,include:u,...p})=>{const l=v(u,o??S),a=new Map;return{async resolveId(t,r,{isEntry:c}){if(!r||c||!l(t)||t.startsWith("\0"))return null;const s=a.get(t);if(s!==void 0)return s;if(r&&t.startsWith(".")){const i=g(r?x(r):process.cwd(),t);let n=m(e,i);if(n||!n&&E(i)&&y(i).isDirectory()&&(n=m(e,i,!0),n))return a.set(t,n),n}return a.set(t,null),null},async transform(t,r){if(!l(r))return null;const{code:c,map:s}=await w(t,{...p,configFile:!1,filename:r,swcrc:!1});return{code:c,map:s}}}},"swcPlugin");export{T as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var c=Object.defineProperty;var t=(r,e)=>c(r,"name",{value:e,configurable:!0});import{existsSync as
|
|
1
|
+
var c=Object.defineProperty;var t=(r,e)=>c(r,"name",{value:e,configurable:!0});import{existsSync as l}from"node:fs";import{join as f}from"@visulima/path";
|
|
2
2
|
// -- pack CommonJS Shims --
|
|
3
3
|
import __cjs_url__ from "node:url";
|
|
4
4
|
import __cjs_path__ from "node:path";
|
|
@@ -6,4 +6,4 @@ import __cjs_mod__ from "node:module";
|
|
|
6
6
|
const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __cjs_path__.dirname(__filename);
|
|
8
8
|
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
9
|
-
var a=Object.defineProperty,
|
|
9
|
+
var a=Object.defineProperty,u=t((r,e)=>a(r,"name",{value:e,configurable:!0}),"o");const x=u((r,e,i=!1)=>{const s=e.replace(/\.[jt]sx?$/,"");for(const o of r){const n=i?f(e,`index${o}`):`${s}${o}`;if(l(n))return n}return null},"resolveFile");export{x as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var i=Object.defineProperty;var s=(r,e)=>i(r,"name",{value:e,configurable:!0});const u=require("node:fs"),l=require("@visulima/path");var a=Object.defineProperty,f=s((r,e)=>a(r,"name",{value:e,configurable:!0}),"o");const v=f((r,e,t=!1)=>{const c=e.replace(/\.[jt]sx?$/,"");for(const n of r){const o=t?l.join(e,`index${n}`):`${c}${n}`;if(u.existsSync(o))return o}return null},"resolveFile");exports.u=v;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/packem",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.41",
|
|
4
4
|
"description": "A fast and modern bundler for Node.js and TypeScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -168,12 +168,12 @@
|
|
|
168
168
|
"@vitest/ui": "^1.6.0",
|
|
169
169
|
"cross-env": "^7.0.3",
|
|
170
170
|
"esbuild": "^0.21.4",
|
|
171
|
-
"eslint": "^
|
|
171
|
+
"eslint": "^8.6.0",
|
|
172
172
|
"eslint-plugin-deprecation": "^3.0.0",
|
|
173
173
|
"eslint-plugin-etc": "^2.0.3",
|
|
174
174
|
"eslint-plugin-import": "npm:eslint-plugin-i@^2.29.1",
|
|
175
175
|
"eslint-plugin-mdx": "^3.1.5",
|
|
176
|
-
"eslint-plugin-vitest": "^0.
|
|
176
|
+
"eslint-plugin-vitest": "^0.4.1",
|
|
177
177
|
"eslint-plugin-vitest-globals": "^1.5.0",
|
|
178
178
|
"estree-walker": "^3.0.3",
|
|
179
179
|
"execa": "^9.1.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var i=Object.defineProperty;var s=(r,e)=>i(r,"name",{value:e,configurable:!0});const u=require("node:fs"),a=require("@visulima/path");var f=Object.defineProperty,l=s((r,e)=>f(r,"name",{value:e,configurable:!0}),"o");const x=l((r,e,t=!1)=>{const c=e.replace(/\.[jt]sx?$/,"");for(const n of r){const o=t?a.join(e,`index${n}`):`${c}${n}`;if(u.existsSync(o))return o}return null},"resolveFile");exports.x=x;
|