@visulima/packem 1.0.0-alpha.41 → 1.0.0-alpha.42
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 +10 -0
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +3 -3
- package/dist/config.d.cts +3 -3
- package/dist/config.d.mts +3 -3
- package/dist/config.d.ts +3 -3
- package/dist/create-bundler.cjs +24 -25
- package/dist/create-bundler.d.cts +2 -2
- package/dist/create-bundler.d.mts +2 -2
- package/dist/create-bundler.d.ts +2 -2
- package/dist/create-bundler.mjs +26 -27
- package/dist/rollup/plugins/swc/index.d.cts +1 -1
- package/dist/rollup/plugins/swc/index.d.mts +1 -1
- package/dist/rollup/plugins/swc/index.d.ts +1 -1
- package/dist/shared/{packem.ClcPYkxx.d.cts → packem.B7AccwPt.d.cts} +1 -1
- package/dist/shared/{packem.BBXO6_87.d.mts → packem.CYNT7oiH.d.mts} +1 -1
- package/dist/shared/{packem.DtAA_1Hu.d.ts → packem.DVd8fi9i.d.ts} +1 -1
- package/dist/shared/{packem.aYVbzCkK.d.mts → packem.sjPZM5Ke.d.cts} +1 -1
- package/dist/shared/{packem.aYVbzCkK.d.ts → packem.sjPZM5Ke.d.mts} +1 -1
- package/dist/shared/{packem.aYVbzCkK.d.cts → packem.sjPZM5Ke.d.ts} +1 -1
- package/package.json +22 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## @visulima/packem [1.0.0-alpha.42](https://github.com/visulima/packem/compare/@visulima/packem@1.0.0-alpha.41...@visulima/packem@1.0.0-alpha.42) (2024-06-14)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* updated [@visulima](https://github.com/visulima) packages inside packem ([2225974](https://github.com/visulima/packem/commit/2225974a1f186c54669971269c8dafe331d03a8c))
|
|
6
|
+
|
|
7
|
+
### Miscellaneous Chores
|
|
8
|
+
|
|
9
|
+
* added conventional-changelog-conventionalcommits as dev dep ([9e462a2](https://github.com/visulima/packem/commit/9e462a24766313e49ed25ecde8eb64ddc978b60b))
|
|
10
|
+
|
|
1
11
|
## @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
12
|
|
|
3
13
|
|
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.41";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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var v=Object.defineProperty;var r=(i,e)=>v(i,"name",{value:e,configurable:!0});import k from"@visulima/cerebro";import b from"./create-bundler.mjs";import{exit as a}from"node:process";import{installPackage as h}from"@antfu/install-pkg";import{intro as j,isCancel as w,cancel as C,select as
|
|
2
|
+
var v=Object.defineProperty;var r=(i,e)=>v(i,"name",{value:e,configurable:!0});import k from"@visulima/cerebro";import b from"./create-bundler.mjs";import{exit as a}from"node:process";import{installPackage as h}from"@antfu/install-pkg";import{intro as j,isCancel as w,cancel as C,select as S,confirm as x,spinner as f,outro as P}from"@clack/prompts";import{isAccessibleSync as u,writeFileSync as z}from"@visulima/fs";import{parsePackageJson as B}from"@visulima/package/package-json";import{join as s}from"@visulima/path";
|
|
3
3
|
// -- pack CommonJS Shims --
|
|
4
4
|
import __cjs_url__ from "node:url";
|
|
5
5
|
import __cjs_path__ from "node:path";
|
|
@@ -7,10 +7,10 @@ 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.41";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 S({message:"Pick a transformer",options:[{label:"esbuild",value:"esbuild"},{label:"swc",value:"swc"},{label:"Sucrase",value:"sucrase"}]}),!y.includes(t.transformer)&&await x({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({
|
|
14
14
|
transformer
|
|
15
15
|
});
|
|
16
|
-
`,o=f();return o.start("Creating packem.config.ts"),z(s(t.dir,"packem.config.ts"),n),o.stop("Created packem.config.ts"),
|
|
16
|
+
`,o=f();return o.start("Creating packem.config.ts"),z(s(t.dir,"packem.config.ts"),n),o.stop("Created packem.config.ts"),P("Now you can run `packem build` to build your project"),a(0)},"execute"),name:"init",options:[{defaultValue:".",description:"The directory to initialize",name:"dir",type:String},{description:"Choose a transformer to use for packem",name:"transformer",type:String}]})},"createInitCommand"),m=new k("packem",{packageName:I,packageVersion:N});E(m);V(m);m.run();
|
package/dist/config.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BuildConfig, a as BuildPreset } from './shared/packem.
|
|
2
|
-
export { b as BuildHooks } from './shared/packem.
|
|
1
|
+
import { B as BuildConfig, a as BuildPreset } from './shared/packem.B7AccwPt.cjs';
|
|
2
|
+
export { b as BuildHooks } from './shared/packem.B7AccwPt.cjs';
|
|
3
3
|
import '@rollup/plugin-alias';
|
|
4
4
|
import '@rollup/plugin-commonjs';
|
|
5
5
|
import '@rollup/plugin-json';
|
|
@@ -19,7 +19,7 @@ import './shared/packem.D09xRBAa.cjs';
|
|
|
19
19
|
import 'esbuild';
|
|
20
20
|
import './shared/packem.DvWhOdt5.cjs';
|
|
21
21
|
import 'sucrase';
|
|
22
|
-
import './shared/packem.
|
|
22
|
+
import './shared/packem.sjPZM5Ke.cjs';
|
|
23
23
|
|
|
24
24
|
declare const defineConfig: (config: BuildConfig) => BuildConfig;
|
|
25
25
|
declare const definePreset: (preset: BuildPreset) => BuildPreset;
|
package/dist/config.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BuildConfig, a as BuildPreset } from './shared/packem.
|
|
2
|
-
export { b as BuildHooks } from './shared/packem.
|
|
1
|
+
import { B as BuildConfig, a as BuildPreset } from './shared/packem.CYNT7oiH.mjs';
|
|
2
|
+
export { b as BuildHooks } from './shared/packem.CYNT7oiH.mjs';
|
|
3
3
|
import '@rollup/plugin-alias';
|
|
4
4
|
import '@rollup/plugin-commonjs';
|
|
5
5
|
import '@rollup/plugin-json';
|
|
@@ -19,7 +19,7 @@ import './shared/packem.D09xRBAa.mjs';
|
|
|
19
19
|
import 'esbuild';
|
|
20
20
|
import './shared/packem.DvWhOdt5.mjs';
|
|
21
21
|
import 'sucrase';
|
|
22
|
-
import './shared/packem.
|
|
22
|
+
import './shared/packem.sjPZM5Ke.mjs';
|
|
23
23
|
|
|
24
24
|
declare const defineConfig: (config: BuildConfig) => BuildConfig;
|
|
25
25
|
declare const definePreset: (preset: BuildPreset) => BuildPreset;
|
package/dist/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BuildConfig, a as BuildPreset } from './shared/packem.
|
|
2
|
-
export { b as BuildHooks } from './shared/packem.
|
|
1
|
+
import { B as BuildConfig, a as BuildPreset } from './shared/packem.DVd8fi9i.js';
|
|
2
|
+
export { b as BuildHooks } from './shared/packem.DVd8fi9i.js';
|
|
3
3
|
import '@rollup/plugin-alias';
|
|
4
4
|
import '@rollup/plugin-commonjs';
|
|
5
5
|
import '@rollup/plugin-json';
|
|
@@ -19,7 +19,7 @@ import './shared/packem.D09xRBAa.js';
|
|
|
19
19
|
import 'esbuild';
|
|
20
20
|
import './shared/packem.DvWhOdt5.js';
|
|
21
21
|
import 'sucrase';
|
|
22
|
-
import './shared/packem.
|
|
22
|
+
import './shared/packem.sjPZM5Ke.js';
|
|
23
23
|
|
|
24
24
|
declare const defineConfig: (config: BuildConfig) => BuildConfig;
|
|
25
25
|
declare const definePreset: (preset: BuildPreset) => BuildPreset;
|
package/dist/create-bundler.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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"),
|
|
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"),
|
|
3
|
-
`)=>{const o=Z.exec(e);return o?o+t:""},"getShebang");var
|
|
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"),ct=require("@visulima/pail/reporter"),m=require("@visulima/path"),pt=require("defu"),ut=require("hookable"),R=require("rollup"),O=require("./shared/packem.NVRVuzg1.cjs"),je=require("node:url"),L=require("mlly"),dt=require("magic-string"),mt=require("jiti"),J=require("node:fs"),ft=require("@rollup/plugin-alias"),gt=require("@rollup/plugin-commonjs"),ht=require("@rollup/plugin-dynamic-import-vars"),we=require("@rollup/plugin-node-resolve"),yt=require("@rollup/plugin-replace"),vt=require("@rollup/plugin-wasm"),bt=require("rollup-plugin-polyfill-node"),$t=require("rollup-plugin-visualizer"),ke=require("semver"),jt=require("glob"),wt=require("glob-parent"),kt=require("@rollup/plugin-json"),T=require("@rollup/pluginutils"),xt=require("rollup-plugin-license"),Et=require("node:crypto"),Ot=require("@babel/parser"),_t=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(dt),xe=E(mt),Ee=E(ft),St=E(gt),Dt=E(ht),Oe=E(yt),Nt=E(bt),Pt=E(wt),Ft=E(kt),Mt=E(xt);var Ct=Object.defineProperty,z=f((e,t)=>Ct(e,"name",{value:t,configurable:!0}),"i$d");const Z=/^#![^\n]*/,Y=z(async e=>{await W.chmod(e,493).catch(()=>{})},"makeExecutable"),It=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"),Rt=z(()=>({name:"packem:remove-shebang",renderChunk(e){return e.replace(Z,"")}}),"removeShebangPlugin"),Tt=z((e,t=`
|
|
3
|
+
`)=>{const o=Z.exec(e);return o?o+t:""},"getShebang");var At=Object.defineProperty,qt=f((e,t)=>At(e,"name",{value:t,configurable:!0}),"p$4");const ee=qt((e,t)=>{let o={};if(e.pkg.name&&(o[e.pkg.name]=e.options.rootDir),e.pkg.imports){const{imports:r}=e.pkg;for(const n in r){if(n.startsWith("#"))continue;const s=r[n];typeof s=="string"&&(o[n]=m.join(e.rootDir,s))}}return o={...o,...e.options.alias},e.options.rollup.alias&&(Array.isArray(e.options.rollup.alias.entries)?Object.assign(o,Object.fromEntries(e.options.rollup.alias.entries.map(r=>[r.find,r.replacement]))):Object.assign(o,e.options.rollup.alias.entries??e.options.rollup.alias)),e.logger.debug({message:"Resolved aliases: "+JSON.stringify(o),prefix:t}),o},"resolveAliases");var Bt=Object.defineProperty,Lt=f((e,t)=>Bt(e,"name",{value:t,configurable:!0}),"o$4");const Wt=Lt((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 Jt=Object.defineProperty,zt=f((e,t)=>Jt(e,"name",{value:t,configurable:!0}),"r$9");const A=zt((e,t)=>{e.warnings.has(t)||e.warnings.add(t)},"warn");var Ut=Object.defineProperty,Ht=f((e,t)=>Ut(e,"name",{value:t,configurable:!0}),"u$7");const Vt=Ht(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(Wt(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=Tt(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
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
6
|
`)),await y.writeFile(`${n}.d.cts`,[`export * from ${JSON.stringify(l)};`,p?`export { default } from ${JSON.stringify(l)};`:""].join(`
|
|
7
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
|
|
8
|
+
`)),i&&(await Y(`${n}.cjs`),await Y(`${n}.mjs`))}await e.hooks.callHook("rollup:done",e)},"createStub");var Xt=Object.defineProperty,Gt=f((e,t)=>Xt(e,"name",{value:t,configurable:!0}),"r$8");const _e=Gt((e,t)=>xe(t,{esmResolve:!0,interopDefault:!0})(e),"tryRequire");var Yt=Object.defineProperty,Se=f((e,t)=>Yt(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 Kt=Object.defineProperty,Qt=f((e,t)=>Kt(e,"name",{value:t,configurable:!0}),"o$3");const oe=Qt((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 Zt=Object.defineProperty,ne=f((e,t)=>Zt(e,"name",{value:t,configurable:!0}),"c$7");const eo=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=eo(n)},"createOrUpdateEntry"),pe=/(?:\.d\.[mc]?ts|\.\w+)$/;let ue=!1;const to=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 oo=Object.defineProperty,no=f((e,t)=>oo(e,"name",{value:t,configurable:!0}),"t$3");const ro=no((e,t)=>{const{publishConfig:o}=e;return o&&(o.bin&&(typeof o.bin=="object"||typeof o.bin=="string")&&(e.bin=o.bin),o.type&&typeof o.type=="string"&&o.type!==""&&(e.type=o.type),o.main&&typeof o.main=="string"&&o.main!==""&&(e.main=o.main),o.module&&typeof o.module=="string"&&o.module!==""&&(e.module=o.module),t===void 0&&o.types&&typeof o.types=="string"&&o.types!==""?e.types=o.types:t===void 0&&o.typings&&typeof o.typings=="string"&&o.typings!==""&&(e.typings=o.typings),o.exports&&typeof o.exports=="object"&&(e.exports=o.exports)),e},"overwriteWithPublishConfig");var so=Object.defineProperty,io=f((e,t)=>so(e,"name",{value:t,configurable:!0}),"n$8");const ao={hooks:{"build:prepare":io(function(e){if(e.options.entries.length>0)return;const t=m.join(e.options.rootDir,"src");if(!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=ro(r,e.options.declaration));const n=to(r,o,e);for(const s of n.warnings)A(e,s);if(e.options.entries.push(...n.entries),e.options.entries.length===0)throw new Error("No entries detected. Please provide entries manually.");e.logger.info("Automatically detected entries:",g.cyan(e.options.entries.map(s=>g.bold(s.input.replace(`${e.options.rootDir}/`,"").replace(/\/$/,"/*"))).join(", ")),g.gray([e.options.emitESM&&"esm",e.options.emitCJS&&"cjs",e.options.declaration&&"dts"].filter(Boolean).map(s=>`[${s}]`).join(" ")))},"build:prepare")}};var lo=Object.defineProperty,co=f((e,t)=>lo(e,"name",{value:t,configurable:!0}),"t$2");const po=co((e,t)=>(e==="auto"?e=ao:typeof e=="string"&&(e=_e(e,t)),typeof e=="function"&&(e=e()),e),"resolvePreset");var uo=Object.defineProperty,mo=f((e,t)=>uo(e,"name",{value:t,configurable:!0}),"a$b");const K=mo((e,t)=>e.some(o=>o instanceof RegExp?o.test(t):o===t),"arrayIncludes");var fo=Object.defineProperty,go=f((e,t)=>fo(e,"name",{value:t,configurable:!0}),"a$a");const H=go(e=>e===void 0?[]:Array.isArray(e)?e:[e],"arrayify");var ho=Object.defineProperty,yo=f((e,t)=>ho(e,"name",{value:t,configurable:!0}),"a$9");const Q=yo((e="")=>{const t=e.split("/");return t[0].startsWith("@")?t[0]+"/"+t[1]:t[0]},"getPackageName");var vo=Object.defineProperty,Ne=f((e,t)=>vo(e,"name",{value:t,configurable:!0}),"s$a");const bo=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"),$o=Ne(e=>{const t=new Map;return o=>bo(e,o,t)},"memoizeByKey");var jo=Object.defineProperty,wo=f((e,t)=>jo(e,"name",{value:t,configurable:!0}),"m$5");const Pe=wo(({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
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: {
|
|
@@ -13,9 +13,9 @@ declare const defaultExport: {
|
|
|
13
13
|
`)+`
|
|
14
14
|
} & typeof `+c+`;
|
|
15
15
|
|
|
16
|
-
export default defaultExport;`),t.debug({message:"Applied CommonJS interop to entry chunk "+n.fileName+".",prefix:"plugin:cjs-interop"}),{code:p.toString(),map:p.generateMap({hires:!0})}}return null}}),"cjsInterop");var
|
|
16
|
+
export default defaultExport;`),t.debug({message:"Applied CommonJS interop to entry chunk "+n.fileName+".",prefix:"plugin:cjs-interop"}),{code:p.toString(),map:p.generateMap({hires:!0})}}return null}}),"cjsInterop");var ko=Object.defineProperty,xo=f((e,t)=>ko(e,"name",{value:t,configurable:!0}),"f$7");const Eo=xo((e,t)=>{const o=new Map,r={copyOnce:!0,exactFileNames:!0,flatten:!1,...e};let{targets:n}=r;return Array.isArray(n)?n=n.map(s=>{if(typeof s=="string")return{src:s};if(typeof s=="object"&&"src"in s)return s}).filter(Boolean):typeof n=="string"&&(n=[{src:n}]),{async buildStart(){const s=await Promise.all(n.flatMap(l=>Array.isArray(l.src)?l.src.map(a=>({...l,src:a})):l).map(async l=>await jt.glob(l.src,{ignore:l.exclude}).then(a=>({dest:l.dest??"",parent:Pt(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 Oo=Object.defineProperty,_o=f((e,t)=>Oo(e,"name",{value:t,configurable:!0}),"n$4");const de="export default ",Fe=_o(e=>{const t=Ft(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 So{static{f(this,"WalkerBase")}constructor(){this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:f(()=>this.should_skip=!0,"skip"),remove:f(()=>this.should_remove=!0,"remove"),replace:f(t=>this.replacement=t,"replace")}}replace(t,o,r,n){t&&o&&(r!=null?t[o][r]=n:t[o]=n)}remove(t,o,r){t&&o&&(r!=null?t[o].splice(r,1):delete t[o])}}class Do extends So{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 Do(t,o).visit(e,null)}f(Me,"walk");var No=Object.defineProperty,Po=f((e,t)=>No(e,"name",{value:t,configurable:!0}),"u$5");const Fo=Po(({attributes:e,logger:t})=>{const o=T.createFilter([/\.[tj]sx$/],/node_modules/);if(!Array.isArray(e)||e.length===0)throw new Error("[packem:jsx-remove-attributes]: attributes must be a non-empty array of strings.");return{name:"packem:jsx-remove-attributes",transform(r,n){if(!o(n))return null;let s=null;try{s=this.parse(r,{allowReturnOutsideFunction:!0})}catch(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 Mo=Object.defineProperty,re=f((e,t)=>Mo(e,"name",{value:t,configurable:!0}),"p$2");const Co=re(e=>{const t=[],o=[];return e.forEach(r=>{r.startsWith("(")?t.push(r):o.push(r)}),[...o.sort(),...t.sort()]},"sortLicenses"),Io=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=re(({licenseFilePath:e,licenseTemplate:t,logger:o,marker:r,mode:n,packageName:s})=>
|
|
18
|
+
$2`)},"replaceContentWithin"),Ce=re(({licenseFilePath:e,licenseTemplate:t,logger:o,marker:r,mode:n,packageName:s})=>Mt({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=re(({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:"+n});return}const c=t(
|
|
30
|
+
`);if(i===""){o.info({message:"No dependencies license information found.",prefix:"plugin:license:"+n});return}const c=t(Co(a),i,s);try{const p=y.readFileSync(e),u=Io(p,r,c);if(!u){o.error({message:`Could not find the license marker: <!-- ${r} --> in ${e}`,prefix:"plugin:license:"+n});return}p!==u&&(y.writeFileSync(e,u),o.info({message:`${e} updated.`,prefix:"plugin:license:"+n}))}catch(p){o.error(p)}}}),"license");var Ro=Object.defineProperty,To=f((e,t)=>Ro(e,"name",{value:t,configurable:!0}),"i$9");const Ao=To(e=>({async buildEnd(){const t=[];for(const r of this.getModuleIds()){const n=this.getModuleInfo(r);if(n!=null&&!n.isExternal)for(const s of n.importedIds)t.push({source:r,target:s})}if(Array.isArray(t)&&t.length===0)return;const o=m.resolve(e.rootDir,e.outDir,"graph.json");y.writeJsonSync(o,t)},name:"packem:metafile"}),"metafilePlugin");var qo=Object.defineProperty,Bo=f((e,t)=>qo(e,"name",{value:t,configurable:!0}),"r$5");const M=Bo(e=>{const t=Et.createHash("md5");return t.update(e),t.digest("hex")},"getHash");var Lo=Object.defineProperty,Ie=f((e,t)=>Lo(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 Wo=Object.defineProperty,Jo=f((e,t)=>Wo(e,"name",{value:t,configurable:!0}),"c$6");const zo=/\.(?:m|c)?(?:j|t)sx?$/,Uo=/^use \w+$/,Ho=Jo(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
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(!
|
|
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(!zo.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"&&Uo.test(c.expression.value)&&(p=c.expression.value),p!=="use strict"&&p&&(t[n]||=new Set,t[n].add(p),"start"in c&&typeof c.start=="number"&&"end"in c&&typeof c.end=="number"&&(a.remove(c.start,c.end),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 Vo=Object.defineProperty,Xo=f((e,t)=>Vo(e,"name",{value:t,configurable:!0}),"r$4");const Go={exclude:[],include:[/\.(md|txt|css|htm|html)$/]},Yo=Xo((e={})=>{e={...e,...Go};const t=T.createFilter(e.include,e.exclude);return{name:"packem:raw",transform(o,r){return t(r)?{code:`export default ${JSON.stringify(o)}`,map:null}:null}}},"rawPlugin");var Ko=Object.defineProperty,Qo=f((e,t)=>Ko(e,"name",{value:t,configurable:!0}),"l$3");const V="\0__file_url__",Re=Qo(()=>({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 Zo=Object.defineProperty,Te=f((e,t)=>Zo(e,"name",{value:t,configurable:!0}),"i$5");const en=/__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
|
+
`,tn=Te((e,t)=>{if(b.env.INTERNAL_PACKEM_BUILD!=="1"&&(e.includes(Ae)||e.includes(qe)||!en.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"),on=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 tn(t,n)}return null}}),"cjsPlugin");var nn=Object.defineProperty,C=f((e,t)=>nn(e,"name",{value:t,configurable:!0}),"s$6");const rn=/\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\//g,sn=/MIT License|MIT license|BSD license/,an=/\n{2,}/g,ln=/\b(\w+)\$\d+\b/g,cn=/[-/\\^$*+?.()|[\]{}]/g,pn=C(e=>e.replaceAll(cn,"\\$&"),"escapeRegex"),un=C(e=>[...new Set(e)],"unique"),dn=C(e=>e.replaceAll(rn,t=>sn.test(t)?"":t).replaceAll(an,`
|
|
48
48
|
|
|
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=
|
|
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=pn(c);p.includes(".")&&(e=e.replace(new RegExp(`\\b\\w+\\b as ${u},?\\s?`),"")),e=e.replaceAll(new RegExp(`\\b${u}\\b`,"g"),p)}}const s=un(Array.from(e.matchAll(ln),l=>l[0]));if(s.length>0){const l=s.map(i=>`
|
|
50
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),r=
|
|
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=Ot.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 mn=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=dn(o),o},resolveId(o){return o.startsWith("types/")?{external:!0,id:"../../"+(o.endsWith(".js")?o:o+".js")}:null}}),"patchTypescriptTypes");var fn=Object.defineProperty,Je=f((e,t)=>fn(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 gn=Object.defineProperty,He=f((e,t)=>gn(e,"name",{value:t,configurable:!0}),"u$2");const hn=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=hn(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 yn=Object.defineProperty,vn=f((e,t)=>yn(e,"name",{value:t,configurable:!0}),"r$3");const Xe=vn(()=>{const e=/\.(?:[mc]?js|jsx)$/;return{name:"packem:resolve-typescript-mjs-cjs",async resolveId(t,o,r){return e.test(t)&&o?await this.resolve(t.replace(/js(x?)$/,"ts$1"),o,r):null}}},"resolveTypescriptMjsCts");var bn=Object.defineProperty,$n=f((e,t)=>bn(e,"name",{value:t,configurable:!0}),"s$5");const jn=$n(e=>{const t=m.basename(e).split(".");if(t.length>=2){const[o,r]=t.slice(-2),n=t[0],s=/^(\w+)-runtime$/.exec(o)?.[1];if(O.DEFAULT_EXTENSIONS.includes(r)&&s&&s.length>0)return n+"-"+s}},"getCustomModuleLayer");var wn=Object.defineProperty,kn=f((e,t)=>wn(e,"name",{value:t,configurable:!0}),"i$4");const X=kn(e=>(e.preserveDirectives||{directives:[]}).directives.map(t=>t.replace(/^use /,"")).find(t=>t!=="strict"),"getModuleLayer");var xn=Object.defineProperty,ge=f((e,t)=>xn(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=jn(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 En=Object.defineProperty,On=f((e,t)=>En(e,"name",{value:t,configurable:!0}),"n$2");const D=On((e,t,o)=>t.isDynamicEntry?`chunks/[name].${o}`:`shared/${e.options.name}.[hash].${o}`,"getChunkFilename");var _n=Object.defineProperty,Sn=f((e,t)=>_n(e,"name",{value:t,configurable:!0}),"s$3");const Dn=process.platform==="win32",ye=Sn((e,t)=>{const o=Dn?"\\":"/";return e.name?.includes("node_modules"+o+".pnpm")?(e.name.replace("node_modules"+o+".pnpm","external")+"."+t).replace("node_modules"+o,""):e.name?.includes("node_modules")?e.name.replace("node_modules","external")+"."+t:"[name]."+t},"getEntryFileNames");var Nn=Object.defineProperty,$=f((e,t)=>Nn(e,"name",{value:t,configurable:!0}),"p$1");const Pn=$((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
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&&
|
|
57
|
-
`;return r.startsWith(n)?r.slice(n.length):r},"extractStack"),
|
|
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&&Nt({sourceMap:e.options.sourcemap,...e.options.rollup.polyfillNode}),e.options.rollup.json&&Fe({...e.options.rollup.json}),Ho(e.logger),It(e.options.entries.filter(n=>n.executable).map(n=>n.name).filter(Boolean)),e.options.rollup.wsam&&vt.wasm(e.options.rollup.wsam),e.options.transformer?.(Pn(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&&Dt(e.options.rollup.dynamicVars),e.options.rollup.commonjs&&x(St({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&&on(e.pkg),e.options.rollup.raw&&Yo(e.options.rollup.raw),e.options.rollup.jsxRemoveAttributes&&Fo({attributes:e.options.rollup.jsxRemoveAttributes.attributes,logger:e.logger}),e.options.rollup.metafile&&Ao({outDir:m.resolve(e.options.rootDir,e.options.outDir),rootDir:e.options.rootDir}),e.options.rollup.copy&&Eo(e.options.rollup.copy,e.logger),e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dependenciesTemplate=="function"&&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&&$t.visualizer({brotliSize:!0,filename:"packem-bundle-analyze.html",gzipSize:!0,projectRoot:e.options.rootDir,sourcemap:e.options.sourcemap,title:"Packem Visualizer",...e.options.rollup.visualizer})].filter(Boolean)}},"getRollupOptions"),Fn=$(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"),Mn=$o(Fn),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 Mn(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&&mn(e.options.rollup.patchTypes,e.logger),Rt(),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 Cn=Object.defineProperty,In=f((e,t)=>Cn(e,"name",{value:t,configurable:!0}),"c$3");const Rn=In(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 Tn=Object.defineProperty,q=f((e,t)=>Tn(e,"name",{value:t,configurable:!0}),"r$1");const An=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 qn=Object.defineProperty,se=f((e,t)=>qn(e,"name",{value:t,configurable:!0}),"i$2");const Bn=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"),Ln=se(e=>`
|
|
58
58
|
${e.replaceAll(/^\n|\n$/g,"")}
|
|
59
|
-
`,"normalizeCodeFrame"),Ze=se(e=>{const t=
|
|
59
|
+
`,"normalizeCodeFrame"),Ze=se(e=>{const t=Bn(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(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
|
|
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(Ln(e.frame))),e.message=o,t!==void 0&&(e.stack=`${e.message}
|
|
62
|
+
${t}`)},"enhanceRollupError");var Wn=Object.defineProperty,et=f((e,t)=>Wn(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"),Jn=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 zn=Object.defineProperty,Un=f((e,t)=>zn(e,"name",{value:t,configurable:!0}),"i$1");const tt=Un(e=>`{ ${Object.keys(e).map(t=>`${t}: ${JSON.stringify(e[t])}`).join(", ")} }`,"dumpObject");var Hn=Object.defineProperty,Vn=f((e,t)=>Hn(e,"name",{value:t,configurable:!0}),"a$2");class Xn{static{f(this,"p")}static{Vn(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 Gn=Object.defineProperty,B=f((e,t)=>Gn(e,"name",{value:t,configurable:!0}),"l$1");const Yn=T.createFilter,Kn=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=Yn(n,null,{resolve:e})}else r=B(()=>null,"hasSideEffects");return r},"getPackageSideEffect");var Qn=Object.defineProperty,Zn=f((e,t)=>Qn(e,"name",{value:t,configurable:!0}),"y");const er=Zn((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 tr=Object.defineProperty,or=f((e,t)=>tr(e,"name",{value:t,configurable:!0}),"o");const nr=or(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 rr=Object.defineProperty,ot=f((e,t)=>rr(e,"name",{value:t,configurable:!0}),"i");const sr=ot((e,t)=>_t.distance(e,t)<=e.length/3||t.includes(e),"isSimilar"),ir=ot((e,t)=>{const o=e.toLowerCase();return t.filter(r=>sr(r.toLowerCase(),o))},"findAlternatives");var ar=Object.defineProperty,$e=f((e,t)=>ar(e,"name",{value:t,configurable:!0}),"n");const lr=$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=ir(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 cr=Object.defineProperty,j=f((e,t)=>cr(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"),pr=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"),ur=j((e,t,o,r,n,s,l,a,i)=>{const c=pr(i?.config.compilerOptions?.jsx),p=pt.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,10 +77,9 @@ 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:
|
|
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.
|
|
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:Kn(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),e.info({message:"Using "+g.cyan(p.transformerName)+" "+d,prefix:"transformer"})}return p.rollup.resolve&&p.rollup.resolve.preferBuiltins===!0&&(p.rollup.polyfillNode=!1,e.debug("Disabling polyfillNode because preferBuiltins is set to true")),i?.config.compilerOptions?.isolatedModules||e.warn(`'compilerOptions.isolatedModules' is not enabled in tsconfig.
|
|
82
81
|
Because none of the third-party transpiler, packem uses under the hood is type-aware, some techniques or features often used in TypeScript are not properly checked and can cause mis-compilation or even runtime errors.
|
|
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"),
|
|
82
|
+
To mitigate this, you should set the isolatedModules option to true in tsconfig and let your IDE warn you when such incompatible constructs are used.`),p.dependencies=Object.keys(a.dependencies??{}),p.peerDependencies=Object.keys(a.peerDependencies??{}),p.devDependencies=Object.keys(a.devDependencies??{}),p.optionalDependencies=Object.keys(a.optionalDependencies??{}),p.externals.push(...p.dependencies,...p.peerDependencies,...p.optionalDependencies),p},"generateOptions"),dr=j(e=>e.replace(/\.(?:js|mjs|cjs|ts|mts|cts|json|jsx|tsx)$/,""),"removeExtension"),mr=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=dr(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"),fr=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
83
|
exports: `+g.gray(s.exports.join(", ")):"",s.chunks?.length&&(a+=`
|
|
85
84
|
${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
85
|
`)}`),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(`
|
|
@@ -93,8 +92,8 @@ ${s.chunks.map(i=>{const c=t.buildEntries.find(p=>p.path===i)??{};return g.gray(
|
|
|
93
92
|
types: `+g.bold(r(p.path))+" (total size: "+g.cyan(S.formatBytes(p.bytes??0))+")"}}n=!0,a+=`
|
|
94
93
|
|
|
95
94
|
`,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"),
|
|
95
|
+
`),n},"showSizeInformation"),gr=j(async(e,t,o,r,n,s,l,a)=>{const i=po(s.preset??n.preset??"auto",t),c=ur(e,t,o,r,n,s,i,l,a);y.ensureDirSync(m.join(c.rootDir,c.outDir));const p={buildEntries:[],dependencyGraphMap:new Map,hooks:ut.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"),hr=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"),yr=j(async(e,t,o)=>{await e.hooks.callHook("build:before",e);const r=er(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(Rn(u,o))}if(e.options.declaration){const a={...e};a.options.entries=s,n.push(An(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=fr(e.logger,e,t);nr(e),lr(t,e),await e.hooks.callHook("build:done",e),nt(e,l)},"build"),vr=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,reporters:[new ct.SimpleReporter],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 Xn(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 gr(i,e,t,n??!1,l,h,p,u);if(k.isEnabled=v.options.fileCache,await mr(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
96
|
${g.bold("Entries:")}
|
|
98
97
|
${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=
|
|
98
|
+
`)}`),await hr(v),v.options.stub){await Vt(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 Jn(v,k),nt(v,!1);return}await yr(v,p,k),i.raw(`
|
|
99
|
+
⚡️ 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=vr;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as Mode, B as BuildConfig } from './shared/packem.
|
|
1
|
+
import { M as Mode, B as BuildConfig } from './shared/packem.B7AccwPt.cjs';
|
|
2
2
|
import '@rollup/plugin-alias';
|
|
3
3
|
import '@rollup/plugin-commonjs';
|
|
4
4
|
import '@rollup/plugin-json';
|
|
@@ -18,7 +18,7 @@ import './shared/packem.D09xRBAa.cjs';
|
|
|
18
18
|
import 'esbuild';
|
|
19
19
|
import './shared/packem.DvWhOdt5.cjs';
|
|
20
20
|
import 'sucrase';
|
|
21
|
-
import './shared/packem.
|
|
21
|
+
import './shared/packem.sjPZM5Ke.cjs';
|
|
22
22
|
|
|
23
23
|
declare const createBundler: (rootDirectory: string, mode: Mode, inputConfig?: {
|
|
24
24
|
configPath?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as Mode, B as BuildConfig } from './shared/packem.
|
|
1
|
+
import { M as Mode, B as BuildConfig } from './shared/packem.CYNT7oiH.mjs';
|
|
2
2
|
import '@rollup/plugin-alias';
|
|
3
3
|
import '@rollup/plugin-commonjs';
|
|
4
4
|
import '@rollup/plugin-json';
|
|
@@ -18,7 +18,7 @@ import './shared/packem.D09xRBAa.mjs';
|
|
|
18
18
|
import 'esbuild';
|
|
19
19
|
import './shared/packem.DvWhOdt5.mjs';
|
|
20
20
|
import 'sucrase';
|
|
21
|
-
import './shared/packem.
|
|
21
|
+
import './shared/packem.sjPZM5Ke.mjs';
|
|
22
22
|
|
|
23
23
|
declare const createBundler: (rootDirectory: string, mode: Mode, inputConfig?: {
|
|
24
24
|
configPath?: string;
|