@visulima/packem-rollup 1.0.0-alpha.11 → 1.0.0-alpha.13
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 +24 -0
- package/README.md +35 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/cachingPlugin-TWoY5ZxV.mjs +1 -0
- package/dist/packem_shared/debarrelPlugin-xLofvCCp.mjs +2 -0
- package/dist/packem_shared/esbuildPlugin-CXr7ud3R.mjs +1 -0
- package/dist/packem_shared/{types-BKqesFEF.d.mts → types-CvP7QFax.d.mts} +9 -2
- package/dist/packem_shared/{types-BKqesFEF.d.ts → types-CvP7QFax.d.ts} +9 -2
- package/dist/plugins/esbuild/index.d.mts +2 -2
- package/dist/plugins/esbuild/index.d.ts +2 -2
- package/dist/plugins/esbuild/index.mjs +1 -1
- package/dist/plugins/oxc/index.d.mts +2 -2
- package/dist/plugins/oxc/index.d.ts +2 -2
- package/dist/plugins/sucrase/index.d.mts +1 -1
- package/dist/plugins/sucrase/index.d.ts +1 -1
- package/dist/plugins/swc/index.d.mts +2 -2
- package/dist/plugins/swc/index.d.ts +2 -2
- package/dist/plugins/typescript/index.d.mts +2 -2
- package/dist/plugins/typescript/index.d.ts +2 -2
- package/package.json +7 -7
- package/dist/packem_shared/cachingPlugin-D0BBFJPD.mjs +0 -1
- package/dist/packem_shared/esbuildPlugin-BAwyhG6L.mjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
## @visulima/packem-rollup [1.0.0-alpha.13](https://github.com/visulima/packem/compare/@visulima/packem-rollup@1.0.0-alpha.12...@visulima/packem-rollup@1.0.0-alpha.13) (2025-09-03)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* enhance integration tests for CSS and raw data handling ([67aecd3](https://github.com/visulima/packem/commit/67aecd337192d8ea284425db7230661e87de7ad5))
|
|
6
|
+
|
|
7
|
+
### Miscellaneous Chores
|
|
8
|
+
|
|
9
|
+
* update dependencies and versions in package.json and pnpm-lock.yaml ([df62809](https://github.com/visulima/packem/commit/df628094fc6fd5e79cbb939a61bab79d6c89b833))
|
|
10
|
+
* update dependencies and versions in package.json and pnpm-lock.yaml ([e6086fb](https://github.com/visulima/packem/commit/e6086fbd6ad21bbc35b8365b03e8a5d543354154))
|
|
11
|
+
|
|
12
|
+
## @visulima/packem-rollup [1.0.0-alpha.12](https://github.com/visulima/packem/compare/@visulima/packem-rollup@1.0.0-alpha.11...@visulima/packem-rollup@1.0.0-alpha.12) (2025-08-29)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* added the first migration for the rolldown-plugin-dts for rollup ([fb3321f](https://github.com/visulima/packem/commit/fb3321fedb5101368bdf8e711db30d00d9ef26f3))
|
|
17
|
+
* implement lazy barrel optimization in rollup-plugin ([2cdcb34](https://github.com/visulima/packem/commit/2cdcb342f41940b4b277698740153953b905acd0))
|
|
18
|
+
* introduce debarrel optimization for improved import handling ([129435e](https://github.com/visulima/packem/commit/129435ee941f2cd9f003046225e2a8862eb2cba7))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Dependencies
|
|
22
|
+
|
|
23
|
+
* **@visulima/packem-share:** upgraded to 1.0.0-alpha.9
|
|
24
|
+
|
|
1
25
|
## @visulima/packem-rollup [1.0.0-alpha.11](https://github.com/visulima/packem/compare/@visulima/packem-rollup@1.0.0-alpha.10...@visulima/packem-rollup@1.0.0-alpha.11) (2025-08-25)
|
|
2
26
|
|
|
3
27
|
### Features
|
package/README.md
CHANGED
|
@@ -78,6 +78,41 @@ import icon from './icon.svg?data-uri&srcset';
|
|
|
78
78
|
import icon from './icon.svg?data-uri&encoding=css&srcset';
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
+
### Lazy Barrel Plugin
|
|
82
|
+
|
|
83
|
+
The `lazyBarrelPlugin` implements lazy barrel optimization similar to Rspack's `lazyBarrel` experiment. It identifies side-effect-free barrel files and marks their re-export dependencies as lazy, only building them when their exports are actually requested.
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import { lazyBarrelPlugin } from "@visulima/packem-rollup";
|
|
87
|
+
|
|
88
|
+
export default {
|
|
89
|
+
plugins: [
|
|
90
|
+
lazyBarrelPlugin({
|
|
91
|
+
sideEffectsCheck: true,
|
|
92
|
+
lazyThreshold: 2,
|
|
93
|
+
include: [/\.ts$/, /\.js$/],
|
|
94
|
+
exclude: [/\.test\.ts$/]
|
|
95
|
+
})
|
|
96
|
+
]
|
|
97
|
+
};
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
#### Features
|
|
101
|
+
|
|
102
|
+
- **Barrel Detection**: Automatically identifies files with multiple re-exports
|
|
103
|
+
- **Side Effects Checking**: Reads package.json to check `sideEffects` field
|
|
104
|
+
- **Lazy Loading**: Generates lazy loading code for unused exports
|
|
105
|
+
- **Configurable Threshold**: Set minimum exports to consider a file as a barrel
|
|
106
|
+
- **Filtering**: Include/exclude specific file patterns
|
|
107
|
+
|
|
108
|
+
#### How It Works
|
|
109
|
+
|
|
110
|
+
1. **Analysis**: Parses module code to detect barrel export patterns
|
|
111
|
+
2. **Side Effects Check**: Verifies if the module is marked as side-effect-free
|
|
112
|
+
3. **Lazy Marking**: Marks re-export dependencies as lazy for deferred building
|
|
113
|
+
4. **Code Generation**: Creates lazy loading wrappers for unused exports
|
|
114
|
+
5. **Optimization**: Only builds modules when their exports are actually requested
|
|
115
|
+
|
|
81
116
|
### URL Plugin
|
|
82
117
|
|
|
83
118
|
The `urlPlugin` handles asset URLs, either inlining them as data URIs or copying them to a destination directory. SVG files are optimized using the shared `svgEncoder` utility before being base64 encoded.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plugin, RenderedChunk, GetManualChunk, CustomPluginOptions } from 'rollup';
|
|
2
|
-
import { P as PailServerType } from './packem_shared/types-
|
|
3
|
-
export { C as CJSInteropOptions, a as CopyPluginOptions, D as DataUriPluginOptions, E as EsmShimCjsSyntaxOptions, I as IsolatedDeclarationsOptions,
|
|
2
|
+
import { P as PailServerType } from './packem_shared/types-CvP7QFax.mjs';
|
|
3
|
+
export { C as CJSInteropOptions, a as CopyPluginOptions, D as DataUriPluginOptions, e as DebarrelPluginOptions, E as EsmShimCjsSyntaxOptions, I as IsolatedDeclarationsOptions, p as IsolatedDeclarationsResult, q as IsolatedDeclarationsTransformer, J as JSXRemoveAttributesPlugin, L as LicenseOptions, t as PackemRollupOptions, R as RawLoaderOptions, v as RollupPlugins, S as ShebangOptions, n as SourcemapsPluginOptions, T as TransformerFn, w as TransformerName, U as UrlOptions, c as cjsInteropPlugin, b as copyPlugin, d as dataUriPlugin, f as debarrelPlugin, g as esmShimCjsSyntaxPlugin, h as getShebang, i as isolatedDeclarationsPlugin, j as jsxRemoveAttributes, l as licensePlugin, m as makeExecutable, r as rawPlugin, k as removeShebangPlugin, s as shebangPlugin, o as sourcemapsPlugin, u as urlPlugin } from './packem_shared/types-CvP7QFax.mjs';
|
|
4
4
|
export { b as browserslistToEsbuild } from './packem_shared/browserslist-to-esbuild-DY9HwYtp.mjs';
|
|
5
5
|
import { RollupJsonOptions } from '@rollup/plugin-json';
|
|
6
6
|
import { FileCache } from '@visulima/packem-share/utils';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plugin, RenderedChunk, GetManualChunk, CustomPluginOptions } from 'rollup';
|
|
2
|
-
import { P as PailServerType } from './packem_shared/types-
|
|
3
|
-
export { C as CJSInteropOptions, a as CopyPluginOptions, D as DataUriPluginOptions, E as EsmShimCjsSyntaxOptions, I as IsolatedDeclarationsOptions,
|
|
2
|
+
import { P as PailServerType } from './packem_shared/types-CvP7QFax.js';
|
|
3
|
+
export { C as CJSInteropOptions, a as CopyPluginOptions, D as DataUriPluginOptions, e as DebarrelPluginOptions, E as EsmShimCjsSyntaxOptions, I as IsolatedDeclarationsOptions, p as IsolatedDeclarationsResult, q as IsolatedDeclarationsTransformer, J as JSXRemoveAttributesPlugin, L as LicenseOptions, t as PackemRollupOptions, R as RawLoaderOptions, v as RollupPlugins, S as ShebangOptions, n as SourcemapsPluginOptions, T as TransformerFn, w as TransformerName, U as UrlOptions, c as cjsInteropPlugin, b as copyPlugin, d as dataUriPlugin, f as debarrelPlugin, g as esmShimCjsSyntaxPlugin, h as getShebang, i as isolatedDeclarationsPlugin, j as jsxRemoveAttributes, l as licensePlugin, m as makeExecutable, r as rawPlugin, k as removeShebangPlugin, s as shebangPlugin, o as sourcemapsPlugin, u as urlPlugin } from './packem_shared/types-CvP7QFax.js';
|
|
4
4
|
export { b as browserslistToEsbuild } from './packem_shared/browserslist-to-esbuild-DY9HwYtp.js';
|
|
5
5
|
import { RollupJsonOptions } from '@rollup/plugin-json';
|
|
6
6
|
import { FileCache } from '@visulima/packem-share/utils';
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as o}from"./packem_shared/chunkSplitter-DWAy1JkE.mjs";import{cjsInteropPlugin as a}from"./packem_shared/cjsInteropPlugin-D5wyoQ_B.mjs";import{copyPlugin as f}from"./packem_shared/copyPlugin--6RITp1-.mjs";import{dataUriPlugin as u}from"./packem_shared/dataUriPlugin-CfKiUIP_.mjs";import{
|
|
1
|
+
import{default as o}from"./packem_shared/chunkSplitter-DWAy1JkE.mjs";import{cjsInteropPlugin as a}from"./packem_shared/cjsInteropPlugin-D5wyoQ_B.mjs";import{copyPlugin as f}from"./packem_shared/copyPlugin--6RITp1-.mjs";import{dataUriPlugin as u}from"./packem_shared/dataUriPlugin-CfKiUIP_.mjs";import{debarrelPlugin as p}from"./packem_shared/debarrelPlugin-xLofvCCp.mjs";import{default as x}from"./packem_shared/browserslistToEsbuild-C0IWmbNe.mjs";import{esmShimCjsSyntaxPlugin as d}from"./packem_shared/esmShimCjsSyntaxPlugin-DjKqX4DE.mjs";import{fixDtsDefaultCjsExportsPlugin as P}from"./packem_shared/fixDtsDefaultCjsExportsPlugin-Dp1UcHVR.mjs";import{default as b}from"./packem_shared/fixDynamicImportExtension-BBGNRniz.mjs";import{isolatedDeclarationsPlugin as j}from"./packem_shared/isolatedDeclarationsPlugin-B34s_qkE.mjs";import{default as y}from"./packem_shared/jsonPlugin-BAi3Da-h.mjs";import{jsxRemoveAttributes as D}from"./packem_shared/jsxRemoveAttributes-B1PLPffj.mjs";import{license as E}from"./packem_shared/licensePlugin-C5yzUqe-.mjs";import{default as w}from"./packem_shared/metafilePlugin-ObS4J7mO.mjs";import{default as L}from"./packem_shared/cachingPlugin-TWoY5ZxV.mjs";import{default as R}from"./packem_shared/preserveDirectivesPlugin-B49Cbykd.mjs";import{rawPlugin as z}from"./packem_shared/rawPlugin-DgRj14Xy.mjs";import{default as F}from"./packem_shared/resolveFileUrlPlugin-BkpjVHeK.mjs";import{getShebang as T,makeExecutable as V,removeShebangPlugin as q,shebangPlugin as B}from"./packem_shared/makeExecutable-6aOVHoJR.mjs";import{sourcemapsPlugin as H}from"./packem_shared/sourcemapsPlugin-B4W3J79w.mjs";import{urlPlugin as K}from"./packem_shared/urlPlugin-Bm2IE00y.mjs";import{default as Q}from"./packem_shared/createSplitChunks-CGDk55G3.mjs";import{default as X}from"./packem_shared/getCustomModuleLayer-d8i66lfh.mjs";import{default as Z}from"./packem_shared/getModuleLayer-rF9RxnJ5.mjs";import{default as $}from"@rollup/plugin-alias";import{default as re}from"@rollup/plugin-commonjs";import{default as te}from"@rollup/plugin-dynamic-import-vars";import{default as le}from"@rollup/plugin-inject";import{default as se}from"@rollup/plugin-node-resolve";import{default as me}from"@rollup/plugin-replace";import{default as ie}from"@rollup/plugin-wasm";import{default as ne}from"rollup-plugin-polyfill-node";import{PluginPure as ge}from"rollup-plugin-pure";import{default as ce}from"rollup-plugin-visualizer";export{$ as alias,x as browserslistToEsbuild,L as cachingPlugin,o as chunkSplitter,a as cjsInteropPlugin,re as commonjs,f as copyPlugin,Q as createSplitChunks,u as dataUriPlugin,p as debarrelPlugin,te as dynamicImportVars,d as esmShimCjsSyntaxPlugin,P as fixDtsDefaultCjsExportsPlugin,b as fixDynamicImportExtension,X as getCustomModuleLayer,Z as getModuleLayer,T as getShebang,le as inject,j as isolatedDeclarationsPlugin,y as jsonPlugin,D as jsxRemoveAttributes,E as licensePlugin,V as makeExecutable,w as metafilePlugin,se as nodeResolve,ne as polyfillNode,R as preserveDirectivesPlugin,ge as pure,z as rawPlugin,q as removeShebangPlugin,me as replace,F as resolveFileUrlPlugin,B as shebangPlugin,H as sourcemapsPlugin,K as urlPlugin,ce as visualizer,ie as wasm};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var w=Object.defineProperty;var m=(a,e)=>w(a,"name",{value:e,configurable:!0});import{isAccessibleSync as b,readFileSync as g}from"@visulima/fs";import{join as l}from"@visulima/path";import{getHash as o}from"@visulima/packem-share/utils";var _=Object.defineProperty,h=m((a,e)=>_(a,"name",{value:e,configurable:!0}),"f");const d=h(a=>a.handler||a,"getHandler"),f=h(a=>a&&typeof a=="object"&&a.__packem_cache_wrapped===!0?a.data:a,"unwrapCachedValue"),E=h((a,e,u="")=>({...a,async buildEnd(r){a.buildEnd&&await d(a.buildEnd).call(this,r)},async buildStart(r){a.buildStart&&await d(a.buildStart).call(this,r)},async load(r){if(!a.load)return;const t=l(u,a.name),n=r.includes("?")?r.split("?")[0]:r;let c="";try{if(n&&b(n)){const y=g(n);c=o(y)}}catch{}const s=l("load",o(r),c);if(e.has(s,t))return f(await e.get(s,t));const i=await d(a.load).call(this,r),p=i&&typeof i=="object"&&"code"in i?i:{__packem_cache_wrapped:!0,data:i};return e.set(s,p,t),i},name:`cached(${a.name})`,async resolveId(r,t,n){if(!a.resolveId)return;const c=l(u,a.name),s=l("resolveId",o(r),t?o(t):"",o(JSON.stringify(n)));if(e.has(s,c))return f(await e.get(s,c));const i=await d(a.resolveId).call(this,r,t,n);return e.set(s,i,c),i},async transform(r,t){if(!a.transform)return;const n=l(u,a.name),c=l("transform",o(t),o(r));if(e.has(c,n))return f(await e.get(c,n));const s=await d(a.transform).call(this,r,t);return e.set(c,s,n),s}}),"cachingPlugin");export{E as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var F=Object.defineProperty;var x=(e,t)=>F(e,"name",{value:t,configurable:!0});import I from"node:fs/promises";import{createFilter as M}from"@rollup/pluginutils";import j from"magic-string";import*as S from"rs-module-lexer";var B=Object.defineProperty,c=x((e,t)=>B(e,"name",{value:t,configurable:!0}),"c");const E=/\.[mc]?tsx?(?:\?.*)?$/,A=/(?:\.(?:[tj]s|[tj]sx)|\/index\.(?:[tj]s|[tj]sx))(?:\?.*)?$/,k=/^\s*export/,D={exports:[],facade:!1,imports:[]},$=c(e=>E.test(e),"isSourceFile"),y=c(e=>e.includes("/build/cache/vite/")||e.includes("/node_modules/"),"isIgnoredModule"),O=c((e,t)=>y(e)?!1:A.test(e)?!0:t.possibleBarrelFiles?t.possibleBarrelFiles.some(s=>e.match(s)):!1,"isPossibleBarrelSpecifier"),b=c(e=>k.test(e)?"export":"import","getDeclarationKind"),N=c(async(e,t)=>{try{const{output:s}=await S.parseAsync({input:[{code:t,filename:e}]});return s[0]}catch(s){return console.warn(`[packem:debarrel] Failed to parse ${e}:
|
|
2
|
+
${s instanceof Error?s.message:String(s)}`),D}},"safeParse"),_=c(async(e,t,s)=>{const o=e.parseCache.get(t);if(o!==void 0)return o;const a=await N(t,s);return e.parseCache.set(t,a),a},"parsePotentialBarrelFile"),R=c((e,t)=>{const s=e.fileCache.get(t);if(s!==void 0)return s;const o=I.readFile(t,"utf8");return e.fileCache.set(t,o),o},"readFileCached"),C=c(e=>{const t=/^(?:import|export)\s+([\w$]+)/,s=/([\w$]+)\s*,\s*\{|\}\s*,\s*([\w$]+)/,o=/[{,]\s*(type\s+)?([\w$]+)(?:\s+as\s+([\w$]+))?/gi;o.lastIndex=0;const a=[];if(e.includes("*"))return a;if(!e.includes("{")){const n=e.match(t);return n&&a.push({imported:"default",local:n[1]}),a}const i=e.match(s);i&&a.push({imported:"default",local:i[1]||i[2]});let r;for(;r=o.exec(e);)r[1]||r[2]&&a.push({imported:r[2],local:r[3]});return a},"getImportNames"),T=c((e,t,s)=>{let o=e.ln,a=t.find(i=>i.ss<e.s&&i.se>e.e&&i.d===-1);if(!a||!a.n){const i=o||s.slice(e.s).match(/default\s+([a-zA-Z_$][\w$]*)(?:;|\n|$)/)?.[1];i&&(a=t.find(r=>{const n=C(s.slice(r.ss,r.s)).find(p=>p.local===i);return n&&(o=n.imported),n}))}if(a&&!o){const i=s.slice(a.ss,e.s);if(!i.includes("*")){const r=i.match(/([\w$]+)\s*as\s*$/)?.[1];r&&(o=r)}}return{imp:a,localExportName:o}},"findMatchingImport"),v=c(async(e,t,s,o)=>{const{resolve:a}=e,i=await R(e,t),{exports:r,imports:n}=await _(e,t,i);for await(const l of r){const d=l.n;if(d!==s)continue;const u=T(l,n,i),{imp:f,localExportName:m}=u;if(!f||!f.n)return{exportName:s,id:t,resolved:!0};if(f.d>-1)return{exportName:s,id:t,resolved:!0};let h;const w=i.slice(f.ss,l.s);if(b(w)==="import"&&/\bas\b/.test(w)){const P=new RegExp(`(\\w+)\\s+as\\s+${s}(?!\\w)`);h=w.match(P)?.[0]}const g=(await a(f.n,t))?.id;return g?O(g,o)?v(e,g,m||d,o):{aliasedImportName:h,exportName:m||s,id:g,resolved:!1}:{aliasedImportName:h,exportName:m,id:t,resolved:!1}}const p=n.filter(l=>/^export\s+\*(?!\s+as)/.test(i.slice(l.ss,l.s)));if(p.length===1){const l=p[0]?.n,d=l?(await e.resolve(l,t))?.id:void 0;if(!d)return{exportName:s,id:t,resolved:!1};const u=await v(e,d,s,o);if(u.resolved)return u}else if(p.length>1){const l=(await Promise.all(p.map(async d=>{const u=d.n,f=u?(await e.resolve(u,t))?.id:void 0;if(f)return v(e,f,s,o)}))).find(d=>d?.resolved);if(l)return l}return{exportName:s,id:t,resolved:!1}},"resolveThroughBarrel"),z=c((e,t,s)=>{const{aliasedImportName:o,exportName:a}=e,i=t.local||t.imported;return o?`{${o}}`:a==="default"&&s!=="export"?i:`{${a!==i?`${a} as ${i}`:a}}`},"getDeclarationClause"),J=c(async(e,t,s,o)=>{const a=[],{imports:i}=await N(t,s);return await Promise.all(i.map(async r=>{if(!r.n||r.d!==-1)return;const n=s.slice(r.ss,r.s),p=C(n);if(p.length===0)return;const l=(await e.resolve(r.n,t))?.id;if(!l||!$(l)||y(l))return;const d=b(n);try{const u=await Promise.all(p.map(async f=>{const m=await v(e,l,f.imported,o);if(!m)return;const h=z(m,f,d),w=JSON.stringify(m.id);return`${d} ${h} from ${w}`}));if(u.includes(void 0))return;a.push([r.ss,r.se,u.join(";")])}catch(u){console.warn(u)}})),a},"getDebarrelModifications"),K=c((e,t,s,o)=>{if(s.length===0)return;const a=new j(t,{filename:e});for(const[i,r,n]of s)a.update(i,r,n);return{code:a.toString(),map:o?a.generateMap({file:e}):void 0}},"applyModifications"),G=c((e={})=>{const t=new Map,s=new Map,o=c(()=>{t.clear(),s.clear()},"purgeCaches"),a=e.include?M(e.include,[]):void 0;let i=!0;return{buildEnd:o,buildStart:o,async load(r){const n=t.get(r);if(n)return await n},name:"packem:debarrel",options(r){(r.output&&(Array.isArray(r.output)?r.output[0]?.sourcemap:r.output?.sourcemap))===!1&&(i=!1)},async transform(r,n){if(!$(n)||a&&!a(n))return;const p={fileCache:t,parseCache:s,resolve:this.resolve.bind(this)},l=await J(p,n,r,e);return K(n,r,l,i)},watchChange(r){t.delete(r),s.delete(r)}}},"debarrelPlugin");export{G as debarrelPlugin};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var j=Object.defineProperty;var u=(e,r)=>j(e,"name",{value:r,configurable:!0});import{createFilter as x}from"@rollup/pluginutils";import{DEFAULT_LOADERS as k}from"@visulima/packem-share/constants";import{join as O,extname as M}from"@visulima/path";import{formatMessages as E,transform as h,build as $}from"esbuild";import{findCacheDirSync as A}from"@visulima/find-cache-dir";import{readFileSync as P}from"@visulima/fs";import*as R from"rs-module-lexer";var S=Object.defineProperty,F=u((e,r)=>S(e,"name",{value:r,configurable:!0}),"n$1");const y=F(async(e,r)=>{r.length>0&&(await E(r,{color:!0,kind:"warning"})).forEach(s=>e.warn(s))},"warn");var C=Object.defineProperty,w=u((e,r)=>C(e,"name",{value:r,configurable:!0}),"t");const L=w(e=>{if(e==="es")return"esm";if(e==="cjs")return e},"getEsbuildFormat"),W=w(({sourceMap:e=!0,...r})=>async function(s,n,i){if(r.minify||r.minifyWhitespace||r.minifyIdentifiers||r.minifySyntax){const t=L(i.format),c=await h(s,{format:t,loader:"js",sourcemap:e,...r});if(await y(this,c.warnings),c.code)return{code:c.code,map:c.map||void 0}}},"getRenderChunk");var I=Object.defineProperty,D=u((e,r)=>I(e,"name",{value:r,configurable:!0}),"n");const b=D(e=>e.replaceAll("\\","/"),"slash"),T=D(async e=>{const r=A("@visulima/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 $({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(n){n.onResolve({filter:/.*/},async i=>{if(e.exclude?.includes(i.path))return{external:!0};if(!i.pluginData?.__resolving_dep_path__&&e.include.includes(i.path)){const t=await n.resolve(i.path,{kind:"import-statement",pluginData:{__resolving_dep_path__:!0},resolveDir:i.resolveDir});return t.errors.length>0||t.warnings.length>0?t:{namespace:"optimize-deps",path:i.path,pluginData:{absolute:t.path,resolveDir:i.resolveDir}}}}),n.onLoad({filter:/.*/,namespace:"optimize-deps"},async i=>{const{absolute:t,resolveDir:c}=i.pluginData,p=P(t),{output:g}=await R.parseAsync({input:[{code:p,filename:t}]});return{contents:(g[0]?.exports??[]).length>0?`export * from '${b(t)}'`:`module.exports = require('${b(t)}')`,resolveDir:c}})}},...e.esbuildOptions?.plugins??[]]});const s=new Map;for(const n of e.include)s.set(n,{file:O(r,`${n}.js`)});return{cacheDir:r,optimized:s}},"optimizeDeps");var q=Object.defineProperty,N=u((e,r)=>q(e,"name",{value:r,configurable:!0}),"g");const U=N(({exclude:e,include:r,loaders:s,logger:n,optimizeDeps:i,sourceMap:t,...c})=>{const p=k;if(s!==void 0)for(let[a,o]of Object.entries(s)){const d=a.startsWith(".")?a:`.${a}`;typeof o=="string"?p[d]=o:o||delete p[d]}const g=Object.keys(p),_=new RegExp(`\\.(${g.map(a=>a.slice(1)).join("|")})$`),z=x(r??_,e);let l,v=process.cwd();return{async buildStart(){!i||l||(l=await T({cwd:v,sourceMap:t??!1,...i}),n.debug("optimized %O",l.optimized))},name:"packem:esbuild",options({context:a}){a&&(v=a)},renderChunk:W({...c,sourceMap:t}),async resolveId(a){if(l?.optimized.has(a)){const o=l.optimized.get(a);if(o)return n.debug("resolved %s to %s",a,o.file),o.file}},async transform(a,o){if(!z(o)||l?.optimized.has(o))return;const d=M(o),m=p[d];if(n.debug("transforming %s with %s loader",o,m),!m)return;const f=await h(a,{format:["base64","binary","dataurl","text","json"].includes(m)?"esm":void 0,loader:m,sourcefile:o.replace(/\.[cm]ts/,".ts"),sourcemap:t,...c});if(await y(this,f.warnings),f.code)return{code:f.code,map:f.map||void 0}}}},"esbuildTransformer");U.NAME="esbuild";export{U as default};
|
|
@@ -295,6 +295,12 @@ type DataUriPluginOptions = {
|
|
|
295
295
|
};
|
|
296
296
|
declare const dataUriPlugin: (options?: DataUriPluginOptions) => Plugin$1;
|
|
297
297
|
|
|
298
|
+
interface DebarrelPluginOptions {
|
|
299
|
+
include?: FilterPattern;
|
|
300
|
+
possibleBarrelFiles?: (RegExp | string)[];
|
|
301
|
+
}
|
|
302
|
+
declare const debarrelPlugin: (options?: DebarrelPluginOptions) => Plugin$1;
|
|
303
|
+
|
|
298
304
|
interface EsmShimCjsSyntaxOptions {
|
|
299
305
|
exclude?: FilterPattern;
|
|
300
306
|
include?: FilterPattern;
|
|
@@ -4496,6 +4502,7 @@ interface PackemRollupOptions {
|
|
|
4496
4502
|
commonjs: RollupCommonJSOptions | false;
|
|
4497
4503
|
copy?: CopyPluginOptions | false;
|
|
4498
4504
|
dataUri?: DataUriPluginOptions | false;
|
|
4505
|
+
debarrel?: DebarrelPluginOptions | false;
|
|
4499
4506
|
dts: Options$3;
|
|
4500
4507
|
dynamicVars?: RollupDynamicImportVariablesOptions | false;
|
|
4501
4508
|
esbuild?: Options$1 | false;
|
|
@@ -4544,5 +4551,5 @@ type TransformerFn = ((config: EsbuildPluginConfig | InternalOXCTransformPluginC
|
|
|
4544
4551
|
};
|
|
4545
4552
|
type TransformerName = "esbuild" | "oxc" | "sucrase" | "swc";
|
|
4546
4553
|
|
|
4547
|
-
export { patchTypescriptTypes as
|
|
4548
|
-
export type {
|
|
4554
|
+
export { patchTypescriptTypes as H, resolveTsconfigPathsPlugin as M, sucrasePlugin as X, copyPlugin as b, cjsInteropPlugin as c, dataUriPlugin as d, debarrelPlugin as f, esmShimCjsSyntaxPlugin as g, getShebang as h, isolatedDeclarationsPlugin as i, jsxRemoveAttributes as j, removeShebangPlugin as k, license as l, makeExecutable as m, sourcemapsPlugin as o, rawPlugin as r, shebangPlugin as s, urlPlugin as u };
|
|
4555
|
+
export type { Options$1 as A, SwcPluginConfig as B, CJSInteropOptions as C, DataUriPluginOptions as D, EsmShimCjsSyntaxOptions as E, TsConfigResult as F, PatchTypesOptions as G, IsolatedDeclarationsOptions as I, JSXRemoveAttributesPlugin as J, TsconfigPathsPluginOptions as K, LicenseOptions as L, OxcResolveOptions as N, Optimized as O, PailServerType as P, InternalOXCTransformPluginConfig as Q, RawLoaderOptions as R, ShebangOptions as S, TransformerFn as T, UrlOptions as U, OXCTransformPluginConfig as V, SucrasePluginConfig as W, CopyPluginOptions as a, DebarrelPluginOptions as e, SourcemapsPluginOptions as n, IsolatedDeclarationsResult as p, IsolatedDeclarationsTransformer as q, PackemRollupOptions as t, RollupPlugins as v, TransformerName as w, EsbuildPluginConfig as x, OptimizeDepsOptions as y, OptimizeDepsResult as z };
|
|
@@ -295,6 +295,12 @@ type DataUriPluginOptions = {
|
|
|
295
295
|
};
|
|
296
296
|
declare const dataUriPlugin: (options?: DataUriPluginOptions) => Plugin$1;
|
|
297
297
|
|
|
298
|
+
interface DebarrelPluginOptions {
|
|
299
|
+
include?: FilterPattern;
|
|
300
|
+
possibleBarrelFiles?: (RegExp | string)[];
|
|
301
|
+
}
|
|
302
|
+
declare const debarrelPlugin: (options?: DebarrelPluginOptions) => Plugin$1;
|
|
303
|
+
|
|
298
304
|
interface EsmShimCjsSyntaxOptions {
|
|
299
305
|
exclude?: FilterPattern;
|
|
300
306
|
include?: FilterPattern;
|
|
@@ -4496,6 +4502,7 @@ interface PackemRollupOptions {
|
|
|
4496
4502
|
commonjs: RollupCommonJSOptions | false;
|
|
4497
4503
|
copy?: CopyPluginOptions | false;
|
|
4498
4504
|
dataUri?: DataUriPluginOptions | false;
|
|
4505
|
+
debarrel?: DebarrelPluginOptions | false;
|
|
4499
4506
|
dts: Options$3;
|
|
4500
4507
|
dynamicVars?: RollupDynamicImportVariablesOptions | false;
|
|
4501
4508
|
esbuild?: Options$1 | false;
|
|
@@ -4544,5 +4551,5 @@ type TransformerFn = ((config: EsbuildPluginConfig | InternalOXCTransformPluginC
|
|
|
4544
4551
|
};
|
|
4545
4552
|
type TransformerName = "esbuild" | "oxc" | "sucrase" | "swc";
|
|
4546
4553
|
|
|
4547
|
-
export { patchTypescriptTypes as
|
|
4548
|
-
export type {
|
|
4554
|
+
export { patchTypescriptTypes as H, resolveTsconfigPathsPlugin as M, sucrasePlugin as X, copyPlugin as b, cjsInteropPlugin as c, dataUriPlugin as d, debarrelPlugin as f, esmShimCjsSyntaxPlugin as g, getShebang as h, isolatedDeclarationsPlugin as i, jsxRemoveAttributes as j, removeShebangPlugin as k, license as l, makeExecutable as m, sourcemapsPlugin as o, rawPlugin as r, shebangPlugin as s, urlPlugin as u };
|
|
4555
|
+
export type { Options$1 as A, SwcPluginConfig as B, CJSInteropOptions as C, DataUriPluginOptions as D, EsmShimCjsSyntaxOptions as E, TsConfigResult as F, PatchTypesOptions as G, IsolatedDeclarationsOptions as I, JSXRemoveAttributesPlugin as J, TsconfigPathsPluginOptions as K, LicenseOptions as L, OxcResolveOptions as N, Optimized as O, PailServerType as P, InternalOXCTransformPluginConfig as Q, RawLoaderOptions as R, ShebangOptions as S, TransformerFn as T, UrlOptions as U, OXCTransformPluginConfig as V, SucrasePluginConfig as W, CopyPluginOptions as a, DebarrelPluginOptions as e, SourcemapsPluginOptions as n, IsolatedDeclarationsResult as p, IsolatedDeclarationsTransformer as q, PackemRollupOptions as t, RollupPlugins as v, TransformerName as w, EsbuildPluginConfig as x, OptimizeDepsOptions as y, OptimizeDepsResult as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { b as browserslistToEsbuild } from '../../packem_shared/browserslist-to-esbuild-DY9HwYtp.mjs';
|
|
2
|
-
import { T as TransformerFn } from '../../packem_shared/types-
|
|
3
|
-
export {
|
|
2
|
+
import { T as TransformerFn } from '../../packem_shared/types-CvP7QFax.mjs';
|
|
3
|
+
export { x as EsbuildPluginConfig, y as OptimizeDepsOptions, z as OptimizeDepsResult, O as Optimized, A as Options } from '../../packem_shared/types-CvP7QFax.mjs';
|
|
4
4
|
import '@rollup/plugin-alias';
|
|
5
5
|
import '@rollup/plugin-commonjs';
|
|
6
6
|
import '@rollup/plugin-json';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { b as browserslistToEsbuild } from '../../packem_shared/browserslist-to-esbuild-DY9HwYtp.js';
|
|
2
|
-
import { T as TransformerFn } from '../../packem_shared/types-
|
|
3
|
-
export {
|
|
2
|
+
import { T as TransformerFn } from '../../packem_shared/types-CvP7QFax.js';
|
|
3
|
+
export { x as EsbuildPluginConfig, y as OptimizeDepsOptions, z as OptimizeDepsResult, O as Optimized, A as Options } from '../../packem_shared/types-CvP7QFax.js';
|
|
4
4
|
import '@rollup/plugin-alias';
|
|
5
5
|
import '@rollup/plugin-commonjs';
|
|
6
6
|
import '@rollup/plugin-json';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as l}from"../../packem_shared/browserslistToEsbuild-C0IWmbNe.mjs";import{default as r}from"../../packem_shared/esbuildPlugin-
|
|
1
|
+
import{default as l}from"../../packem_shared/browserslistToEsbuild-C0IWmbNe.mjs";import{default as r}from"../../packem_shared/esbuildPlugin-CXr7ud3R.mjs";export{l as browserslistToEsbuild,r as esbuildPlugin};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IsolatedDeclarationsOptions } from 'oxc-transform';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { p as IsolatedDeclarationsResult, N as OxcResolveOptions, P as PailServerType, T as TransformerFn } from '../../packem_shared/types-CvP7QFax.mjs';
|
|
3
|
+
export { Q as InternalOXCTransformPluginConfig, V as OXCTransformPluginConfig } from '../../packem_shared/types-CvP7QFax.mjs';
|
|
4
4
|
import { Plugin } from 'rollup';
|
|
5
5
|
import '@rollup/plugin-alias';
|
|
6
6
|
import '@rollup/plugin-commonjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IsolatedDeclarationsOptions } from 'oxc-transform';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { p as IsolatedDeclarationsResult, N as OxcResolveOptions, P as PailServerType, T as TransformerFn } from '../../packem_shared/types-CvP7QFax.js';
|
|
3
|
+
export { Q as InternalOXCTransformPluginConfig, V as OXCTransformPluginConfig } from '../../packem_shared/types-CvP7QFax.js';
|
|
4
4
|
import { Plugin } from 'rollup';
|
|
5
5
|
import '@rollup/plugin-alias';
|
|
6
6
|
import '@rollup/plugin-commonjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '@rollup/pluginutils';
|
|
2
2
|
import 'sucrase';
|
|
3
|
-
export {
|
|
3
|
+
export { W as SucrasePluginConfig, X as sucrasePlugin } from '../../packem_shared/types-CvP7QFax.mjs';
|
|
4
4
|
import '@rollup/plugin-alias';
|
|
5
5
|
import '@rollup/plugin-commonjs';
|
|
6
6
|
import '@rollup/plugin-json';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '@rollup/pluginutils';
|
|
2
2
|
import 'sucrase';
|
|
3
|
-
export {
|
|
3
|
+
export { W as SucrasePluginConfig, X as sucrasePlugin } from '../../packem_shared/types-CvP7QFax.js';
|
|
4
4
|
import '@rollup/plugin-alias';
|
|
5
5
|
import '@rollup/plugin-commonjs';
|
|
6
6
|
import '@rollup/plugin-json';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { p as IsolatedDeclarationsResult, T as TransformerFn } from '../../packem_shared/types-CvP7QFax.mjs';
|
|
2
|
+
export { B as SwcPluginConfig } from '../../packem_shared/types-CvP7QFax.mjs';
|
|
3
3
|
import '@rollup/plugin-alias';
|
|
4
4
|
import '@rollup/plugin-commonjs';
|
|
5
5
|
import '@rollup/plugin-json';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { p as IsolatedDeclarationsResult, T as TransformerFn } from '../../packem_shared/types-CvP7QFax.js';
|
|
2
|
+
export { B as SwcPluginConfig } from '../../packem_shared/types-CvP7QFax.js';
|
|
3
3
|
import '@rollup/plugin-alias';
|
|
4
4
|
import '@rollup/plugin-commonjs';
|
|
5
5
|
import '@rollup/plugin-json';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TranspileOptions } from 'typescript';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { p as IsolatedDeclarationsResult, P as PailServerType, F as TsConfigResult } from '../../packem_shared/types-CvP7QFax.mjs';
|
|
3
|
+
export { G as PatchTypesOptions, K as TsconfigPathsPluginOptions, H as patchTypescriptTypes, H as patchTypescriptTypesPlugin, M as resolveTsconfigPathsPlugin } from '../../packem_shared/types-CvP7QFax.mjs';
|
|
4
4
|
import { Plugin } from 'rollup';
|
|
5
5
|
import '@rollup/plugin-alias';
|
|
6
6
|
import '@rollup/plugin-commonjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TranspileOptions } from 'typescript';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { p as IsolatedDeclarationsResult, P as PailServerType, F as TsConfigResult } from '../../packem_shared/types-CvP7QFax.js';
|
|
3
|
+
export { G as PatchTypesOptions, K as TsconfigPathsPluginOptions, H as patchTypescriptTypes, H as patchTypescriptTypesPlugin, M as resolveTsconfigPathsPlugin } from '../../packem_shared/types-CvP7QFax.js';
|
|
4
4
|
import { Plugin } from 'rollup';
|
|
5
5
|
import '@rollup/plugin-alias';
|
|
6
6
|
import '@rollup/plugin-commonjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/packem-rollup",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.13",
|
|
4
4
|
"description": "Rollup plugins for packem",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"visulima",
|
|
@@ -78,20 +78,20 @@
|
|
|
78
78
|
"@visulima/find-cache-dir": "1.0.31",
|
|
79
79
|
"@visulima/fs": "3.1.5",
|
|
80
80
|
"@visulima/package": "3.5.8",
|
|
81
|
-
"@visulima/packem-share": "1.0.0-alpha.
|
|
81
|
+
"@visulima/packem-share": "1.0.0-alpha.9",
|
|
82
82
|
"@visulima/path": "1.4.0",
|
|
83
83
|
"@visulima/source-map": "1.0.20",
|
|
84
|
-
"es-module-lexer": "1.7.0",
|
|
85
84
|
"glob-parent": "6.0.2",
|
|
86
|
-
"magic-string": "0.30.
|
|
87
|
-
"mlly": "1.
|
|
88
|
-
"oxc-parser": "0.
|
|
89
|
-
"oxc-resolver": "11.
|
|
85
|
+
"magic-string": "0.30.18",
|
|
86
|
+
"mlly": "1.8.0",
|
|
87
|
+
"oxc-parser": "0.86.0",
|
|
88
|
+
"oxc-resolver": "11.7.1",
|
|
90
89
|
"rollup-plugin-dts": "6.2.3",
|
|
91
90
|
"rollup-plugin-license": "3.6.0",
|
|
92
91
|
"rollup-plugin-polyfill-node": "0.13.0",
|
|
93
92
|
"rollup-plugin-pure": "^0.4.0",
|
|
94
93
|
"rollup-plugin-visualizer": "6.0.3",
|
|
94
|
+
"rs-module-lexer": "^2.5.1",
|
|
95
95
|
"semver": "7.7.2",
|
|
96
96
|
"tinyglobby": "0.2.14"
|
|
97
97
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var h=Object.defineProperty;var m=(a,r)=>h(a,"name",{value:r,configurable:!0});import{join as l}from"@visulima/path";import{getHash as o}from"@visulima/packem-share/utils";var g=Object.defineProperty,f=m((a,r)=>g(a,"name",{value:r,configurable:!0}),"m");const c=f(a=>a.handler||a,"getHandler"),v=f((a,r,d="")=>({...a,async buildEnd(n){a.buildEnd&&await c(a.buildEnd).call(this,n)},async buildStart(n){a.buildStart&&await c(a.buildStart).call(this,n)},async load(n){if(!a.load)return;const t=l(d,a.name),s=l("load",o(n));if(r.has(s,t))return await r.get(s,t);const e=await c(a.load).call(this,n);return r.set(s,e,t),e},name:`cached(${a.name})`,async resolveId(n,t,s){if(!a.resolveId)return;const e=l(d,a.name),i=l("resolveId",o(n),t?o(t):"",o(JSON.stringify(s)));if(r.has(i,e))return await r.get(i,e);const u=await c(a.resolveId).call(this,n,t,s);return r.set(i,u,e),u},async transform(n,t){if(!a.transform)return;const s=l(d,a.name),e=l("transform",o(t),o(n));if(r.has(e,s))return await r.get(e,s);const i=await c(a.transform).call(this,n,t);return r.set(e,i,s),i}}),"cachingPlugin");export{v as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var j=Object.defineProperty;var u=(e,r)=>j(e,"name",{value:r,configurable:!0});import{createFilter as x}from"@rollup/pluginutils";import{DEFAULT_LOADERS as k}from"@visulima/packem-share/constants";import{join as O,extname as $}from"@visulima/path";import{formatMessages as E,transform as b,build as M}from"esbuild";import{findCacheDirSync as A}from"@visulima/find-cache-dir";import{readFileSync as P}from"@visulima/fs";import{init as R,parse as S}from"es-module-lexer";var F=Object.defineProperty,C=u((e,r)=>F(e,"name",{value:r,configurable:!0}),"n$1");const h=C(async(e,r)=>{r.length>0&&(await E(r,{color:!0,kind:"warning"})).forEach(s=>e.warn(s))},"warn");var L=Object.defineProperty,w=u((e,r)=>L(e,"name",{value:r,configurable:!0}),"t");const W=w(e=>{if(e==="es")return"esm";if(e==="cjs")return e},"getEsbuildFormat"),I=w(({sourceMap:e=!0,...r})=>async function(s,n,t){if(r.minify||r.minifyWhitespace||r.minifyIdentifiers||r.minifySyntax){const i=W(t.format),c=await b(s,{format:i,loader:"js",sourcemap:e,...r});if(await h(this,c.warnings),c.code)return{code:c.code,map:c.map||void 0}}},"getRenderChunk");var T=Object.defineProperty,y=u((e,r)=>T(e,"name",{value:r,configurable:!0}),"n");const v=y(e=>e.replaceAll("\\","/"),"slash"),q=y(async e=>{const r=A("@visulima/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 R,await M({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(n){n.onResolve({filter:/.*/},async t=>{if(e.exclude?.includes(t.path))return{external:!0};if(!t.pluginData?.__resolving_dep_path__&&e.include.includes(t.path)){const i=await n.resolve(t.path,{kind:"import-statement",pluginData:{__resolving_dep_path__:!0},resolveDir:t.resolveDir});return i.errors.length>0||i.warnings.length>0?i:{namespace:"optimize-deps",path:t.path,pluginData:{absolute:i.path,resolveDir:t.resolveDir}}}}),n.onLoad({filter:/.*/,namespace:"optimize-deps"},async t=>{const{absolute:i,resolveDir:c}=t.pluginData,[,p]=S(P(i));return{contents:p.length>0?`export * from '${v(i)}'`:`module.exports = require('${v(i)}')`,resolveDir:c}})}},...e.esbuildOptions?.plugins??[]]});const s=new Map;for(const n of e.include)s.set(n,{file:O(r,`${n}.js`)});return{cacheDir:r,optimized:s}},"optimizeDeps");var N=Object.defineProperty,U=u((e,r)=>N(e,"name",{value:r,configurable:!0}),"g");const B=U(({exclude:e,include:r,loaders:s,logger:n,optimizeDeps:t,sourceMap:i,...c})=>{const p=k;if(s!==void 0)for(let[a,o]of Object.entries(s)){const d=a.startsWith(".")?a:`.${a}`;typeof o=="string"?p[d]=o:o||delete p[d]}const D=Object.keys(p),_=new RegExp(`\\.(${D.map(a=>a.slice(1)).join("|")})$`),z=x(r??_,e);let l,g=process.cwd();return{async buildStart(){!t||l||(l=await q({cwd:g,sourceMap:i??!1,...t}),n.debug("optimized %O",l.optimized))},name:"packem:esbuild",options({context:a}){a&&(g=a)},renderChunk:I({...c,sourceMap:i}),async resolveId(a){if(l?.optimized.has(a)){const o=l.optimized.get(a);if(o)return n.debug("resolved %s to %s",a,o.file),o.file}},async transform(a,o){if(!z(o)||l?.optimized.has(o))return;const d=$(o),m=p[d];if(n.debug("transforming %s with %s loader",o,m),!m)return;const f=await b(a,{format:["base64","binary","dataurl","text","json"].includes(m)?"esm":void 0,loader:m,sourcefile:o.replace(/\.[cm]ts/,".ts"),sourcemap:i,...c});if(await h(this,f.warnings),f.code)return{code:f.code,map:f.map||void 0}}}},"esbuildTransformer");B.NAME="esbuild";export{B as default};
|