@visulima/packem-rollup 1.0.0-alpha.77 → 1.0.0-alpha.78

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/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{default as o}from"./plugins/chunk-splitter/index.js";import{default as a}from"./packem_shared/browserslistToEsbuild-HD6SaWPt.js";import{jsxRemoveAttributes as s}from"./plugins/jsx-remove-attributes.js";import{preserveDirectivesPlugin as l}from"./plugins/preserve-directives.js";import{pureNewExpressionPlugin as u}from"./plugins/pure-new-expression-plugin.js";import{default as x}from"@rollup/plugin-alias";import{default as c}from"@rollup/plugin-commonjs";import{default as P}from"@rollup/plugin-dynamic-import-vars";import{default as v}from"@rollup/plugin-inject";import{default as h}from"@rollup/plugin-replace";import{default as w}from"@rollup/plugin-wasm";import{importTrace as T,patchErrorWithTrace as y}from"rollup-plugin-import-trace";import{default as k}from"rollup-plugin-polyfill-node";import{PluginPure as A}from"rollup-plugin-pure";import{default as I}from"rollup-plugin-visualizer";export{x as alias,a as browserslistToEsbuild,o as chunkSplitter,c as commonjs,P as dynamicImportVars,T as importTrace,v as inject,s as jsxRemoveAttributes,y as patchErrorWithTrace,k as polyfillNode,l as preserveDirectivesPlugin,u as pureNewExpressionPlugin,A as purePlugin,h as replace,I as visualizer,w as wasm};
1
+ import{default as o}from"./plugins/chunk-splitter/index.js";import{default as a}from"./packem_shared/browserslistToEsbuild-DeJ4xoII.js";import{jsxRemoveAttributes as s}from"./plugins/jsx-remove-attributes.js";import{preserveDirectivesPlugin as l}from"./plugins/preserve-directives.js";import{pureNewExpressionPlugin as u}from"./plugins/pure-new-expression-plugin.js";import{default as x}from"@rollup/plugin-alias";import{default as c}from"@rollup/plugin-commonjs";import{default as P}from"@rollup/plugin-dynamic-import-vars";import{default as v}from"@rollup/plugin-inject";import{default as h}from"@rollup/plugin-replace";import{default as w}from"@rollup/plugin-wasm";import{importTrace as T,patchErrorWithTrace as y}from"rollup-plugin-import-trace";import{default as k}from"rollup-plugin-polyfill-node";import{PluginPure as A}from"rollup-plugin-pure";import{default as I}from"rollup-plugin-visualizer";export{x as alias,a as browserslistToEsbuild,o as chunkSplitter,c as commonjs,P as dynamicImportVars,T as importTrace,v as inject,s as jsxRemoveAttributes,y as patchErrorWithTrace,k as polyfillNode,l as preserveDirectivesPlugin,u as pureNewExpressionPlugin,A as purePlugin,h as replace,I as visualizer,w as wasm};
@@ -0,0 +1 @@
1
+ const a=new Set(["chrome","edge","es","firefox","ie","ios","node","opera","safari"]),o=["android 4"],r={android:"chrome",ios_saf:"ios"},n=" ",d=/^\d+(?:\.\d+)*$/,c=s=>{let i=s.filter(e=>!o.some(t=>e.startsWith(t))).map(e=>{const t=e.split(n);return[t[0]??"",t[1]??""]}).map(([e,t])=>[Object.hasOwn(r,e)?r[e]:e,t]).map(([e,t])=>[e,t.includes("-")?t.slice(0,t.indexOf("-")):t]).map(([e,t])=>[e,t.endsWith(".0")?t.slice(0,-2):t]).filter(([,e])=>d.test(e)).filter(([e])=>a.has(e));return i=Object.entries(Object.fromEntries(i)),i.map(([e,t])=>`${e}${t}`)};export{c as default};
@@ -0,0 +1 @@
1
+ import{createFilter as _}from"@rollup/pluginutils";import{DEFAULT_LOADERS as z}from"@visulima/packem-share/constants";import{join as x,extname as k}from"@visulima/path";import{formatMessages as j,transform as b,build as M}from"esbuild";import{findCacheDirSync as O}from"@visulima/find-cache-dir";import{readFile as S}from"@visulima/fs";import*as A from"rs-module-lexer";const v=async(e,t)=>{t.length>0&&(await j(t,{color:!0,kind:"warning"})).forEach(n=>{e.warn(n)})},E=e=>{if(e==="es")return"esm";if(e==="cjs")return e},$=({sourceMap:e=!0,...t})=>async function(n,a,i){if(t.minify||t.minifyWhitespace||t.minifyIdentifiers||t.minifySyntax){const r=E(i.format),c=await b(n,{format:r,loader:"js",sourcemap:e,...t});if(await v(this,c.warnings),c.code)return{code:c.code,map:c.map||void 0}}},R=e=>e.replaceAll("\\","/"),{parseAsync:C}=A,y=/.*/,F=async e=>{const t=O("@visulima/packem/optimize-deps",{create:!0,cwd:e.cwd});if(!t)throw new Error('[packem:optimize-deps]: failed to find or create cache directory "node_modules/.cache/packem/optimize_deps".');await M({absWorkingDir:e.cwd,bundle:!0,entryPoints:e.include,format:"esm",ignoreAnnotations:!0,metafile:!0,outdir:t,sourcemap:e.sourceMap,splitting:!0,...e.esbuildOptions,plugins:[{name:"optimize-deps",setup(a){a.onResolve({filter:y},async i=>{if(e.exclude?.includes(i.path))return{external:!0};if(!i.pluginData?.__resolving_dep_path__&&e.include.includes(i.path)){const r=await a.resolve(i.path,{kind:"import-statement",pluginData:{__resolving_dep_path__:!0},resolveDir:i.resolveDir});return r.errors.length>0||r.warnings.length>0?r:{namespace:"optimize-deps",path:i.path,pluginData:{absolute:r.path,resolveDir:i.resolveDir}}}}),a.onLoad({filter:y,namespace:"optimize-deps"},async i=>{const{absolute:r,resolveDir:c}=i.pluginData,p=await S(r),{output:u}=await C({input:[{code:p,filename:r}]}),h=u[0]?.exports??[],l=JSON.stringify(R(r));return{contents:h.length>0?`export * from ${l}`:`module.exports = require(${l})`,resolveDir:c}})}},...e.esbuildOptions?.plugins??[]]});const n=new Map;for(const a of e.include)n.set(a,{file:x(t,`${a}.js`)});return{cacheDir:t,optimized:n}},L=/\.[cm]ts/,W=new Set(["base64","binary","dataurl","json","text"]),I=({exclude:e,include:t,loaders:n,logger:a,optimizeDeps:i,sourceMap:r,...c})=>{const p={...z};if(n!==void 0)for(const[o,s]of Object.entries(n)){const m=o.startsWith(".")?o:`.${o}`;typeof s=="string"?p[m]=s:delete p[m]}const u=Object.keys(p),h=o=>o.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),l=new RegExp(String.raw`\.(${u.map(o=>h(o.slice(1))).join("|")})$`),w=t||e?_(t??l,e):void 0;t&&a.debug("`include` is constrained to files matching a configured loader extension (%O)",u);let d;const D=process.cwd();return{async buildStart(){!i||d||(d=await F({cwd:D,sourceMap:r??!1,...i}),a.debug("optimized %O",d.optimized))},name:"packem:esbuild",renderChunk:$({...c,sourceMap:r}),resolveId(o){if(d?.optimized.has(o)){const s=d.optimized.get(o);if(s)return a.debug("resolved %s to %s",o,s.file),s.file}},transform:{filter:{id:l},async handler(o,s){if(w&&!w(s)||d?.optimized.has(s))return;const m=k(s),f=p[m];if(a.debug("transforming %s with %s loader",s,f),!f)return;const g=await b(o,{format:W.has(f)?"esm":void 0,loader:f,sourcefile:s.replace(L,".ts"),sourcemap:r,...c});if(await v(this,g.warnings),g.code)return{code:g.code,map:g.map||void 0}}}}};I.NAME="esbuild";export{I as default};
@@ -0,0 +1 @@
1
+ class p{constructor(){this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:()=>this.should_skip=!0,remove:()=>this.should_remove=!0,replace:e=>this.replacement=e}}replace(e,t,s,i){e&&t&&(s!=null?e[t][s]=i:e[t]=i)}remove(e,t,s){e&&t&&(s!=null?e[t].splice(s,1):delete e[t])}}class m extends p{constructor(e,t){super(),this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:()=>this.should_skip=!0,remove:()=>this.should_remove=!0,replace:s=>this.replacement=s},this.enter=e,this.leave=t}visit(e,t,s,i){if(e){if(this.enter){const l=this.should_skip,o=this.should_remove,r=this.replacement;this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.enter.call(this.context,e,t,s,i),this.replacement&&(e=this.replacement,this.replace(t,s,i,e)),this.should_remove&&this.remove(t,s,i);const u=this.should_skip,a=this.should_remove;if(this.should_skip=l,this.should_remove=o,this.replacement=r,u)return e;if(a)return null}let n;for(n in e){const l=e[n];if(l&&typeof l=="object")if(Array.isArray(l)){const o=l;for(let r=0;r<o.length;r+=1){const u=o[r];c(u)&&(this.visit(u,e,n,r)||r--)}}else c(l)&&this.visit(l,e,n,null)}if(this.leave){const l=this.replacement,o=this.should_remove;this.replacement=null,this.should_remove=!1,this.leave.call(this.context,e,t,s,i),this.replacement&&(e=this.replacement,this.replace(t,s,i,e)),this.should_remove&&this.remove(t,s,i);const r=this.should_remove;if(this.replacement=l,this.should_remove=o,r)return null}}return e}}function c(h){return h!==null&&typeof h=="object"&&"type"in h&&typeof h.type=="string"}function v(h,{enter:e,leave:t}){return new m(e,t).visit(h,null)}export{v as w};
@@ -0,0 +1 @@
1
+ import{createFilter as m}from"@rollup/pluginutils";import{transform as s}from"@swc/core";import{EXCLUDE_REGEXP as c}from"@visulima/packem-share/constants";const l=({exclude:e,include:r,...t})=>{const n=m(r,e??c);return{name:"packem:swc",transform:{filter:{id:{exclude:e??c,include:r}},async handler(o,a){if(!n(a))return;const{code:f,map:i}=await s(o,{...t,configFile:!1,filename:a,swcrc:!1});return{code:f,map:i}}}}};l.NAME="swc";export{l as default};
@@ -16,7 +16,6 @@ interface CommonOptions {
16
16
  sourceRoot?: string;
17
17
  /** Documentation: https://esbuild.github.io/api/#sources-content */
18
18
  sourcesContent?: boolean;
19
-
20
19
  /** Documentation: https://esbuild.github.io/api/#format */
21
20
  format?: Format;
22
21
  /** Documentation: https://esbuild.github.io/api/#global-name */
@@ -27,7 +26,6 @@ interface CommonOptions {
27
26
  supported?: Record<string, boolean>;
28
27
  /** Documentation: https://esbuild.github.io/api/#platform */
29
28
  platform?: Platform;
30
-
31
29
  /** Documentation: https://esbuild.github.io/api/#mangle-props */
32
30
  mangleProps?: RegExp;
33
31
  /** Documentation: https://esbuild.github.io/api/#mangle-props */
@@ -56,7 +54,6 @@ interface CommonOptions {
56
54
  treeShaking?: boolean;
57
55
  /** Documentation: https://esbuild.github.io/api/#ignore-annotations */
58
56
  ignoreAnnotations?: boolean;
59
-
60
57
  /** Documentation: https://esbuild.github.io/api/#jsx */
61
58
  jsx?: 'transform' | 'preserve' | 'automatic';
62
59
  /** Documentation: https://esbuild.github.io/api/#jsx-factory */
@@ -69,7 +66,6 @@ interface CommonOptions {
69
66
  jsxDev?: boolean;
70
67
  /** Documentation: https://esbuild.github.io/api/#jsx-side-effects */
71
68
  jsxSideEffects?: boolean;
72
-
73
69
  /** Documentation: https://esbuild.github.io/api/#define */
74
70
  define?: {
75
71
  [key: string]: string;
@@ -78,7 +74,6 @@ interface CommonOptions {
78
74
  pure?: string[];
79
75
  /** Documentation: https://esbuild.github.io/api/#keep-names */
80
76
  keepNames?: boolean;
81
-
82
77
  /** Documentation: https://esbuild.github.io/api/#abs-paths */
83
78
  absPaths?: AbsPaths[];
84
79
  /** Documentation: https://esbuild.github.io/api/#color */
@@ -89,7 +84,6 @@ interface CommonOptions {
89
84
  logLimit?: number;
90
85
  /** Documentation: https://esbuild.github.io/api/#log-override */
91
86
  logOverride?: Record<string, LogLevel>;
92
-
93
87
  /** Documentation: https://esbuild.github.io/api/#tsconfig-raw */
94
88
  tsconfigRaw?: string | TsconfigRaw;
95
89
  }
@@ -289,24 +283,19 @@ interface Plugin {
289
283
  interface PluginBuild {
290
284
  /** Documentation: https://esbuild.github.io/plugins/#build-options */
291
285
  initialOptions: BuildOptions;
292
-
293
286
  /** Documentation: https://esbuild.github.io/plugins/#resolve */
294
287
  resolve(path: string, options?: ResolveOptions): Promise<ResolveResult>;
295
-
296
288
  /** Documentation: https://esbuild.github.io/plugins/#on-start */
297
289
  onStart(callback: () => (OnStartResult | null | void | Promise<OnStartResult | null | void>)): void;
298
-
299
290
  /** Documentation: https://esbuild.github.io/plugins/#on-end */
300
291
  onEnd(callback: (result: BuildResult) => (OnEndResult | null | void | Promise<OnEndResult | null | void>)): void;
301
-
302
292
  /** Documentation: https://esbuild.github.io/plugins/#on-resolve */
303
293
  onResolve(options: OnResolveOptions, callback: (args: OnResolveArgs) => (OnResolveResult | null | undefined | Promise<OnResolveResult | null | undefined>)): void;
304
-
305
294
  /** Documentation: https://esbuild.github.io/plugins/#on-load */
306
295
  onLoad(options: OnLoadOptions, callback: (args: OnLoadArgs) => (OnLoadResult | null | undefined | Promise<OnLoadResult | null | undefined>)): void;
307
-
308
296
  /** Documentation: https://esbuild.github.io/plugins/#on-dispose */
309
- onDispose(callback: () => void): void; // This is a full copy of the esbuild library in case you need it
297
+ onDispose(callback: () => void): void;
298
+ // This is a full copy of the esbuild library in case you need it
310
299
  esbuild: {
311
300
  context: typeof context;
312
301
  build: typeof build;
@@ -365,9 +354,11 @@ interface OnResolveArgs {
365
354
  pluginData: any;
366
355
  with: Record<string, string>;
367
356
  }
368
- type ImportKind = 'entry-point' // JS
369
- | 'import-statement' | 'require-call' | 'dynamic-import' | 'require-resolve' // CSS
370
- | 'import-rule' | 'composes-from' | 'url-token';
357
+ type ImportKind = 'entry-point' |
358
+ // JS
359
+ 'import-statement' | 'require-call' | 'dynamic-import' | 'require-resolve' |
360
+ // CSS
361
+ 'import-rule' | 'composes-from' | 'url-token';
371
362
  /** Documentation: https://esbuild.github.io/plugins/#on-resolve-results */
372
363
  interface OnResolveResult {
373
364
  pluginName?: string;
@@ -470,10 +461,8 @@ interface WatchOptions {
470
461
  interface BuildContext<ProvidedOptions extends BuildOptions = BuildOptions> {
471
462
  /** Documentation: https://esbuild.github.io/api/#rebuild */
472
463
  rebuild(): Promise<BuildResult<ProvidedOptions>>;
473
-
474
464
  /** Documentation: https://esbuild.github.io/api/#watch */
475
465
  watch(options?: WatchOptions): Promise<void>;
476
-
477
466
  /** Documentation: https://esbuild.github.io/api/#serve */
478
467
  serve(options?: ServeOptions): Promise<ServeResult>;
479
468
  cancel(): Promise<void>;
@@ -482,8 +471,7 @@ interface BuildContext<ProvidedOptions extends BuildOptions = BuildOptions> {
482
471
  // This is a TypeScript type-level function which replaces any keys in "In"
483
472
  // that aren't in "Out" with "never". We use this to reject properties with
484
473
  // typos in object literals. See: https://stackoverflow.com/questions/49580725
485
- type SameShape<Out, In extends Out> = In & { [Key in Exclude<keyof In, keyof Out>]: never };
486
-
474
+ type SameShape<Out, In extends Out> = In & { [Key in Exclude<keyof In, keyof Out>]: never; };
487
475
  /**
488
476
  * This function invokes the "esbuild" command-line tool for you. It returns a
489
477
  * promise that either resolves with a "BuildResult" object or rejects with a
@@ -588,7 +576,6 @@ interface InitializeOptions {
588
576
  * esbuild in the browser.
589
577
  */
590
578
  wasmURL?: string | URL;
591
-
592
579
  /**
593
580
  * The result of calling "new WebAssembly.Module(buffer)" where "buffer"
594
581
  * is a typed array or ArrayBuffer containing the binary code of the
@@ -598,7 +585,6 @@ interface InitializeOptions {
598
585
  * not possible to download the WebAssembly module.
599
586
  */
600
587
  wasmModule?: WebAssembly.Module;
601
-
602
588
  /**
603
589
  * By default esbuild runs the WebAssembly-based browser API in a web worker
604
590
  * to avoid blocking the UI thread. This can be disabled by setting "worker"
@@ -648,9 +634,9 @@ type Options = Omit<TransformOptions, "loader" | "sourcemap"> & {
648
634
  exclude?: FilterPattern;
649
635
  include?: FilterPattern;
650
636
  /**
651
- * Map extension to esbuild loader
652
- * Note that each entry (the extension) needs to start with a dot
653
- */
637
+ * Map extension to esbuild loader
638
+ * Note that each entry (the extension) needs to start with a dot
639
+ */
654
640
  loaders?: Record<string, Loader | false>;
655
641
  optimizeDeps?: MarkOptional<OptimizeDepsOptions, "cwd" | "sourceMap">;
656
642
  sourceMap?: boolean;
@@ -1 +1 @@
1
- var x=Object.defineProperty;var d=(t,e)=>x(t,"name",{value:e,configurable:!0});import c from"node:assert/strict";import{extractAssignedNames as y}from"@rollup/pluginutils";var h=Object.defineProperty,n=d((t,e)=>h(t,"name",{value:e,configurable:!0}),"t");const v=n(function*(t){switch(t.declaration?.type){case"ClassDeclaration":case"FunctionDeclaration":{const{id:e}=t.declaration;c.ok(e,"Expected class/function to have a name"),yield e.name;break}case"VariableDeclaration":{for(const e of t.declaration.declarations)for(const a of y(e.id))yield a;break}}},"exportName"),N=n(function*(t){if(t.declaration)for(const e of v(t))yield{exportedName:e,from:"self",type:"named"};else if(t.source)yield{bindings:t.specifiers.map(e=>({exportedName:e.exported.name,importedName:e.local.name})),from:"other",source:t.source.value,type:"named"};else for(const e of t.specifiers)yield{exportedName:e.exported.name,from:"self",type:"named"}},"parseExportNamed"),g=n(function*(t){t.exported?yield{exportedName:t.exported.name,from:"self",type:"named"}:yield{from:"other",source:t.source.value,type:"barrel"}},"parseExportAll"),b=n(function*(){yield{exportedName:"default",from:"self",type:"named"}},"parseExportDefault"),E=/\.tsx$/,k=/\.[cm]?ts$/,$=/\.jsx$/,w=n(t=>E.test(t)?"tsx":k.test(t)?"ts":$.test(t)?"jsx":"js","langForId"),f=n(function(t,e){c.ok(e.code!==null,`Module ${e.id} doesn't have associated code`);let a;try{a=t.parse(e.code,{lang:w(e.id)})}catch{return[]}const r=[];for(const o of a.body)switch(o.type){case"ExportAllDeclaration":{r.push(...g(o));break}case"ExportDefaultDeclaration":{r.push(...b());break}case"ExportNamedDeclaration":{r.push(...N(o));break}}return r},"collectExports"),D=n(function(t,e,a){if(!a)return f(t,e);const r=a.get(e.id);if(r!==void 0)return r;const o=f(t,e);return a.set(e.id,o),o},"parseExports");var j=Object.defineProperty,i=d((t,e)=>j(t,"name",{value:e,configurable:!0}),"i");const m=i(async function(t,e,a){const r=await t.resolve(e,a.id);if(c.ok(r,`Rollup can't resolve ${e} from ${a.id}`),r.external)return;const o=await t.load(r);return c.ok(o,`Rollup doesn't have a module for id ${r.id}`),o},"getImportedModule"),S=i(async function*(t,e,a,r){const o=await m(t,e.source,a);o&&(yield*l(t,o,r))},"gatherBarrelReExports"),M=i(async function*(t,e,a,r){const o=await m(t,e.source,a);if(!o)return;const u=new Map(e.bindings.map(s=>[s.importedName,s]));for await(const s of l(t,o,r)){const p=u.get(s.exportedName);p&&(yield{...s,exportedName:p.exportedName})}},"gatherNamedReExports"),P=i(function*(t,e){yield{exportedName:e.exportedName,id:t.id,sourceName:e.exportedName}},"gatherNamedSelfExports"),l=i(async function*(t,e,a){if(!a.visited.has(e.id)){a.visited.add(e.id);try{for(const r of D(t,e,a.parseCache))r.from==="self"?yield*P(e,r):r.type==="barrel"?yield*S(t,r,e,a):yield*M(t,r,e,a)}finally{a.visited.delete(e.id)}}},"gatherExportsWithState"),R=i(function(t,e){return l(t,e,{parseCache:new Map,visited:new Set})},"gatherExports");var A=Object.defineProperty,C=d((t,e)=>A(t,"name",{value:e,configurable:!0}),"r");const B=C(()=>({moduleParsed:{async handler(t){if(t.isEntry)for await(const e of R(this,t))e.id!==t.id&&this.emitFile({id:e.id,name:e.exportedName,preserveSignature:"exports-only",type:"chunk"})},order:"post"},name:"packem:chunk-splitter"}),"chunkSplitter");export{B as default};
1
+ import i from"node:assert/strict";import{extractAssignedNames as p}from"@rollup/pluginutils";const m=function*(t){switch(t.declaration?.type){case"ClassDeclaration":case"FunctionDeclaration":{const{id:e}=t.declaration;i.ok(e,"Expected class/function to have a name"),yield e.name;break}case"VariableDeclaration":{for(const e of t.declaration.declarations)for(const o of p(e.id))yield o;break}}},u=function*(t){if(t.declaration)for(const e of m(t))yield{exportedName:e,from:"self",type:"named"};else if(t.source)yield{bindings:t.specifiers.map(e=>({exportedName:e.exported.name,importedName:e.local.name})),from:"other",source:t.source.value,type:"named"};else for(const e of t.specifiers)yield{exportedName:e.exported.name,from:"self",type:"named"}},y=function*(t){t.exported?yield{exportedName:t.exported.name,from:"self",type:"named"}:yield{from:"other",source:t.source.value,type:"barrel"}},x=function*(){yield{exportedName:"default",from:"self",type:"named"}},h=/\.tsx$/,N=/\.[cm]?ts$/,v=/\.jsx$/,k=t=>h.test(t)?"tsx":N.test(t)?"ts":v.test(t)?"jsx":"js",c=function(t,e){i.ok(e.code!==null,`Module ${e.id} doesn't have associated code`);let o;try{o=t.parse(e.code,{lang:k(e.id)})}catch{return[]}const a=[];for(const n of o.body)switch(n.type){case"ExportAllDeclaration":{a.push(...y(n));break}case"ExportDefaultDeclaration":{a.push(...x());break}case"ExportNamedDeclaration":{a.push(...u(n));break}}return a},$=function(t,e,o){if(!o)return c(t,e);const a=o.get(e.id);if(a!==void 0)return a;const n=c(t,e);return o.set(e.id,n),n},l=async function(t,e,o){const a=await t.resolve(e,o.id);if(i.ok(a,`Rollup can't resolve ${e} from ${o.id}`),a.external)return;const n=await t.load(a);return i.ok(n,`Rollup doesn't have a module for id ${a.id}`),n},b=async function*(t,e,o,a){const n=await l(t,e.source,o);n&&(yield*s(t,n,a))},w=async function*(t,e,o,a){const n=await l(t,e.source,o);if(!n)return;const f=new Map(e.bindings.map(r=>[r.importedName,r]));for await(const r of s(t,n,a)){const d=f.get(r.exportedName);d&&(yield{...r,exportedName:d.exportedName})}},g=function*(t,e){yield{exportedName:e.exportedName,id:t.id,sourceName:e.exportedName}},s=async function*(t,e,o){if(!o.visited.has(e.id)){o.visited.add(e.id);try{for(const a of $(t,e,o.parseCache))a.from==="self"?yield*g(e,a):a.type==="barrel"?yield*b(t,a,e,o):yield*w(t,a,e,o)}finally{o.visited.delete(e.id)}}},D=function(t,e){return s(t,e,{parseCache:new Map,visited:new Set})},C=()=>({moduleParsed:{async handler(t){if(t.isEntry)for await(const e of D(this,t))e.id!==t.id&&this.emitFile({id:e.id,name:e.exportedName,preserveSignature:"exports-only",type:"chunk"})},order:"post"},name:"packem:chunk-splitter"});export{C as default};
@@ -2,10 +2,7 @@ import { Plugin } from 'rollup';
2
2
  interface CJSInteropOptions {
3
3
  addDefaultProperty?: boolean;
4
4
  }
5
- declare const cjsInteropPlugin: ({
6
- addDefaultProperty,
7
- logger
8
- }: CJSInteropOptions & {
5
+ declare const cjsInteropPlugin: ({ addDefaultProperty, logger }: CJSInteropOptions & {
9
6
  logger: Console;
10
7
  }) => Plugin;
11
8
  export { CJSInteropOptions, cjsInteropPlugin };
@@ -1,2 +1,2 @@
1
- var c=Object.defineProperty;var l=(e,t)=>c(e,"name",{value:t,configurable:!0});import m from"magic-string";var g=Object.defineProperty,p=l((e,t)=>g(e,"name",{value:t,configurable:!0}),"s");const y=/\bexports\b/,x=p(e=>{if(e?.type==="Identifier")return e.name;if(e?.type==="Literal"&&typeof e.value=="string")return e.value},"staticPropertyName"),b=p(e=>{if(e?.type!=="MemberExpression"||e.object===void 0)return;const t=x(e.property);if(t!==void 0){if(e.object.type==="Identifier"&&e.object.name==="module"&&t==="exports")return{kind:"module"};if(e.object.type==="Identifier"&&e.object.name==="exports")return{kind:"exports",name:t}}},"resolveExportTarget"),j=p((e,t)=>{const n={changed:!1,sawDefault:!1};if(t.type!=="ExpressionStatement")return n;const{expression:o}=t;if(o?.type!=="AssignmentExpression"||o.operator!=="=")return n;const s=b(o.left);if(s===void 0||s.kind==="module")return n;const r=o.left;return typeof r.start!="number"||typeof r.end!="number"?n:s.name==="default"?(e.overwrite(r.start,r.end,"module.exports"),{changed:!0,sawDefault:!0}):(e.overwrite(r.start,r.end,`module.exports.${s.name??""}`),{changed:!0,sawDefault:!1})},"rewriteExportAssignment"),w=p(({addDefaultProperty:e=!1,logger:t})=>({name:"packem:cjs-interop",renderChunk(n,o,s){if(!o.isEntry||s.format!=="cjs"||s.exports!=="auto"||!y.test(n))return;let r;try{r=this.parse(n)}catch{return}const a=new m(n);let i=!1,u=!1;for(const d of r.body){const f=j(a,d);i=i||f.changed,u=u||f.sawDefault}if(u&&(e&&(a.append(`
2
- module.exports.default = module.exports;`),i=!0),!!i))return t.debug({message:`Applied CommonJS interop to entry chunk ${o.fileName}.`,prefix:"plugin:cjs-interop"}),{code:a.toString(),map:a.generateMap({hires:!0})}}}),"cjsInteropPlugin");export{w as cjsInteropPlugin};
1
+ import d from"magic-string";const l=/\bexports\b/,c=e=>{if(e?.type==="Identifier")return e.name;if(e?.type==="Literal"&&typeof e.value=="string")return e.value},m=e=>{if(e?.type!=="MemberExpression"||e.object===void 0)return;const r=c(e.property);if(r!==void 0){if(e.object.type==="Identifier"&&e.object.name==="module"&&r==="exports")return{kind:"module"};if(e.object.type==="Identifier"&&e.object.name==="exports")return{kind:"exports",name:r}}},y=(e,r)=>{const n={changed:!1,sawDefault:!1};if(r.type!=="ExpressionStatement")return n;const{expression:o}=r;if(o?.type!=="AssignmentExpression"||o.operator!=="=")return n;const s=m(o.left);if(s===void 0||s.kind==="module")return n;const t=o.left;return typeof t.start!="number"||typeof t.end!="number"?n:s.name==="default"?(e.overwrite(t.start,t.end,"module.exports"),{changed:!0,sawDefault:!0}):(e.overwrite(t.start,t.end,`module.exports.${s.name??""}`),{changed:!0,sawDefault:!1})},x=({addDefaultProperty:e=!1,logger:r})=>({name:"packem:cjs-interop",renderChunk(n,o,s){if(!o.isEntry||s.format!=="cjs"||s.exports!=="auto"||!l.test(n))return;let t;try{t=this.parse(n)}catch{return}const a=new d(n);let i=!1,p=!1;for(const f of t.body){const u=y(a,f);i=i||u.changed,p=p||u.sawDefault}if(p&&(e&&(a.append(`
2
+ module.exports.default = module.exports;`),i=!0),!!i))return r.debug({message:`Applied CommonJS interop to entry chunk ${o.fileName}.`,prefix:"plugin:cjs-interop"}),{code:a.toString(),map:a.generateMap({hires:!0})}}});export{x as cjsInteropPlugin};
@@ -1,5 +1,5 @@
1
- import { E as EsbuildPluginConfig } from "../../packem_shared/types.d-KBgVO47q.js";
2
- export { O as OptimizeDepsOptions, a as OptimizeDepsResult, b as Optimized, c as Options, d as browserslistToEsbuild } from "../../packem_shared/types.d-KBgVO47q.js";
1
+ import { E as EsbuildPluginConfig } from "../../packem_shared/types.d-DxoG2D8r.js";
2
+ export { type O as OptimizeDepsOptions, type a as OptimizeDepsResult, type b as Optimized, type c as Options, d as browserslistToEsbuild } from "../../packem_shared/types.d-DxoG2D8r.js";
3
3
  import '@visulima/packem-share/utils';
4
4
  import 'rollup';
5
5
  import { T as TransformerFn } from "../../packem_shared/types.d-DrgzeMBs.d-CG9J1x6q.js";
@@ -8,4 +8,4 @@ import '@rollup/plugin-alias';
8
8
  import '@visulima/package';
9
9
  import '@rollup/pluginutils';
10
10
  declare const _default: TransformerFn<EsbuildPluginConfig>;
11
- export { EsbuildPluginConfig, _default as esbuildPlugin };
11
+ export { type EsbuildPluginConfig, _default as esbuildPlugin };
@@ -1 +1 @@
1
- import{default as l}from"../../packem_shared/browserslistToEsbuild-HD6SaWPt.js";import{default as r}from"../../packem_shared/esbuildPlugin-D_vSjXWg.js";export{l as browserslistToEsbuild,r as esbuildPlugin};
1
+ import{default as l}from"../../packem_shared/browserslistToEsbuild-DeJ4xoII.js";import{default as r}from"../../packem_shared/esbuildPlugin-CE9hQxBf.js";export{l as browserslistToEsbuild,r as esbuildPlugin};
@@ -1,5 +1,5 @@
1
1
  import { RollupJsonOptions } from '@rollup/plugin-json';
2
- export { type RollupJsonOptions } from '@rollup/plugin-json';
2
+ export type { RollupJsonOptions } from '@rollup/plugin-json';
3
3
  import { Plugin } from 'rollup';
4
4
  declare const JsonPlugin: (options: RollupJsonOptions) => Plugin;
5
5
  export { JsonPlugin };
@@ -1 +1 @@
1
- var l=Object.defineProperty;var r=(t,o)=>l(t,"name",{value:o,configurable:!0});import i from"@rollup/plugin-json";var u=Object.defineProperty,d=r((t,o)=>u(t,"name",{value:o,configurable:!0}),"s");const a="export default ",f=/\.json$/,g=d(t=>{const o=i(t);return{...o,name:"packem:json",transform:{filter:{id:f},handler(s,c){const n=o.transform,e=(typeof n=="function"?n:n?.handler)?.call(this,s,c);return e&&typeof e!="string"&&"code"in e&&e.code?.startsWith(a)&&(e.code=e.code.replace(a,"module.exports = ")),e}}}},"JsonPlugin");export{g as JsonPlugin};
1
+ import a from"@rollup/plugin-json";const n="export default ",i=/\.json$/,l=r=>{const e=a(r);return{...e,name:"packem:json",transform:{filter:{id:i},handler(s,c){const t=e.transform,o=(typeof t=="function"?t:t?.handler)?.call(this,s,c);return o&&typeof o!="string"&&"code"in o&&o.code?.startsWith(n)&&(o.code=o.code.replace(n,"module.exports = ")),o}}}};export{l as JsonPlugin};
@@ -3,23 +3,18 @@ type JSXRemoveAttributesPlugin = {
3
3
  attributes: string[];
4
4
  };
5
5
  /**
6
- * Remove JSX attributes (e.g. `data-testid`) from automatic-runtime JSX calls.
7
- *
8
- * Two modes, because the bundlers run their JSX transform at different times.
9
- * `"transform"` (rollup): packem's transformer adapter runs as an earlier
10
- * transform plugin, so by the time this transform hook runs the per-module
11
- * source already contains `jsx(...)` calls and `this.parse` sees plain JS.
12
- * `"renderChunk"` (rolldown): rolldown's native oxc transform runs AFTER
13
- * plugin transform hooks, so a transform hook would see raw JSX and
14
- * `this.parse` would throw. The emitted chunk, however, is fully transpiled —
15
- * so the same AST walk runs there instead.
16
- */
17
- declare const jsxRemoveAttributes: ({
18
- attributes,
19
- logger,
20
- mode,
21
- sourcemap
22
- }: JSXRemoveAttributesPlugin & {
6
+ * Remove JSX attributes (e.g. `data-testid`) from automatic-runtime JSX calls.
7
+ *
8
+ * Two modes, because the bundlers run their JSX transform at different times.
9
+ * `"transform"` (rollup): packem's transformer adapter runs as an earlier
10
+ * transform plugin, so by the time this transform hook runs the per-module
11
+ * source already contains `jsx(...)` calls and `this.parse` sees plain JS.
12
+ * `"renderChunk"` (rolldown): rolldown's native oxc transform runs AFTER
13
+ * plugin transform hooks, so a transform hook would see raw JSX and
14
+ * `this.parse` would throw. The emitted chunk, however, is fully transpiled —
15
+ * so the same AST walk runs there instead.
16
+ */
17
+ declare const jsxRemoveAttributes: ({ attributes, logger, mode, sourcemap }: JSXRemoveAttributesPlugin & {
23
18
  logger: Console;
24
19
  mode?: "renderChunk" | "transform";
25
20
  sourcemap?: boolean;
@@ -1 +1 @@
1
- var b=Object.defineProperty;var c=(e,t)=>b(e,"name",{value:t,configurable:!0});import{w as g}from"../packem_shared/index-Dq8IUFTs.js";import h from"magic-string";var j=Object.defineProperty,p=c((e,t)=>j(e,"name",{value:t,configurable:!0}),"p");const k=/\.[jt]sx$/,v=/\s/,w=new Set(["jsx","jsxDEV","jsxs"]),d=p((e,t)=>{let r=t;for(;r<e.length&&v.test(e[r]);)r+=1;return e[r]===","&&(r+=1),r},"scanPastTrailingComma"),R=p((e,t,r,n,s)=>{if(s){e.remove(r,d(t,n));return}let a=r;for(;a>0&&v.test(t[a-1]);)a-=1;if(t[a-1]===","){e.remove(a-1,n);return}e.remove(r,d(t,n))},"removeProperty"),f=p((e,t,r,n,s)=>{const a=new h(t);let u=!1;return g(e,{enter(i){if(i.type==="CallExpression"&&i.callee.type==="Identifier"&&w.has(i.callee.name)){const l=i.arguments.filter(o=>o.type==="ObjectExpression"&&Array.isArray(o.properties));for(const o of l)for(const m of o.properties){if(m.type!=="Property"||m.key.type!=="Literal"||!r.includes(m.key.value))continue;if(m.value.type!=="Literal"){s.debug({message:`skipping attribute "${String(m.key.value)}": value is "${m.value.type}", not a literal.`,prefix:"plugin:jsx-remove-attributes"});continue}const{end:y,start:x}=m;R(a,t,x,y,n),u=!0}}}}),u?a:void 0},"stripAttributes"),O=p(({attributes:e,logger:t,mode:r="transform",sourcemap:n=!0})=>{if(!Array.isArray(e)||e.length===0)throw new Error("[packem:jsx-remove-attributes]: attributes must be a non-empty array of strings.");return r==="renderChunk"?{name:"packem:jsx-remove-attributes",renderChunk:{handler(s,a,{sourcemap:u}){if(!(s.includes("jsx(")||s.includes("jsxs(")||s.includes("jsxDEV("))||!e.some(o=>s.includes(o)))return;let i;try{i=this.parse(s,{allowReturnOutsideFunction:!0})}catch(o){this.warn({code:"PARSE_ERROR",message:`[packem:jsx-remove-attributes]: failed to parse chunk "${a.fileName}" and remove the jsx attribute.`}),t.warn(o);return}const l=f(i,s,e,!0,t);if(l!==void 0)return{code:l.toString(),map:u?l.generateMap({hires:!0}):void 0}},order:"post"}}:{name:"packem:jsx-remove-attributes",transform:{filter:{id:k},handler(s,a){let u;try{u=this.parse(s,{allowReturnOutsideFunction:!0})}catch(l){this.warn({code:"PARSE_ERROR",message:`[packem:jsx-remove-attributes]: failed to parse "${a}" and remove the jsx attribute.`}),t.warn(l);return}const i=f(u,s,e,!1,t);if(i!==void 0)return{code:i.toString(),map:n?i.generateMap({hires:!0}):void 0}}}}},"jsxRemoveAttributes");export{O as jsxRemoveAttributes};
1
+ import{w as h}from"../packem_shared/index-NTDZLUEE.js";import x from"magic-string";const y=/\.[jt]sx$/,d=/\s/,g=new Set(["jsx","jsxDEV","jsxs"]),p=(e,t)=>{let r=t;for(;r<e.length&&d.test(e[r]);)r+=1;return e[r]===","&&(r+=1),r},j=(e,t,r,o,s)=>{if(s){e.remove(r,p(t,o));return}let a=r;for(;a>0&&d.test(t[a-1]);)a-=1;if(t[a-1]===","){e.remove(a-1,o);return}e.remove(r,p(t,o))},c=(e,t,r,o,s)=>{const a=new x(t);let u=!1;return h(e,{enter(i){if(i.type==="CallExpression"&&i.callee.type==="Identifier"&&g.has(i.callee.name)){const l=i.arguments.filter(n=>n.type==="ObjectExpression"&&Array.isArray(n.properties));for(const n of l)for(const m of n.properties){if(m.type!=="Property"||m.key.type!=="Literal"||!r.includes(m.key.value))continue;if(m.value.type!=="Literal"){s.debug({message:`skipping attribute "${String(m.key.value)}": value is "${m.value.type}", not a literal.`,prefix:"plugin:jsx-remove-attributes"});continue}const{end:f,start:v}=m;j(a,t,v,f,o),u=!0}}}}),u?a:void 0},w=({attributes:e,logger:t,mode:r="transform",sourcemap:o=!0})=>{if(!Array.isArray(e)||e.length===0)throw new Error("[packem:jsx-remove-attributes]: attributes must be a non-empty array of strings.");return r==="renderChunk"?{name:"packem:jsx-remove-attributes",renderChunk:{handler(s,a,{sourcemap:u}){if(!(s.includes("jsx(")||s.includes("jsxs(")||s.includes("jsxDEV("))||!e.some(n=>s.includes(n)))return;let i;try{i=this.parse(s,{allowReturnOutsideFunction:!0})}catch(n){this.warn({code:"PARSE_ERROR",message:`[packem:jsx-remove-attributes]: failed to parse chunk "${a.fileName}" and remove the jsx attribute.`}),t.warn(n);return}const l=c(i,s,e,!0,t);if(l!==void 0)return{code:l.toString(),map:u?l.generateMap({hires:!0}):void 0}},order:"post"}}:{name:"packem:jsx-remove-attributes",transform:{filter:{id:y},handler(s,a){let u;try{u=this.parse(s,{allowReturnOutsideFunction:!0})}catch(l){this.warn({code:"PARSE_ERROR",message:`[packem:jsx-remove-attributes]: failed to parse "${a}" and remove the jsx attribute.`}),t.warn(l);return}const i=c(u,s,e,!1,t);if(i!==void 0)return{code:i.toString(),map:o?i.generateMap({hires:!0}):void 0}}}}};export{w as jsxRemoveAttributes};
@@ -6,10 +6,5 @@ type PreserveDirectivesPluginOptions = {
6
6
  include?: FilterPattern;
7
7
  logger: Console;
8
8
  };
9
- declare const preserveDirectivesPlugin: ({
10
- directiveRegex,
11
- exclude,
12
- include,
13
- logger
14
- }: PreserveDirectivesPluginOptions) => Plugin;
9
+ declare const preserveDirectivesPlugin: ({ directiveRegex, exclude, include, logger }: PreserveDirectivesPluginOptions) => Plugin;
15
10
  export { type PreserveDirectivesPluginOptions, preserveDirectivesPlugin };
@@ -1,5 +1,5 @@
1
- var M=Object.defineProperty;var k=(i,u)=>M(i,"name",{value:u,configurable:!0});import{createFilter as S}from"@rollup/pluginutils";import b from"magic-string";var $=Object.defineProperty,h=k((i,u)=>$(i,"name",{value:u,configurable:!0}),"m");const D=new Set([" "," ","\f","\v"," ","\uFEFF"]),m=new Set([`
2
- `,"\r","\u2028","\u2029"]),x=/"([^"]*)"|'([^']*)'/,w=h(i=>{const u=[],{length:v}=i;let e=0;const g=h(a=>{for(;e<v;){const f=i[e];if(D.has(f))e+=1;else if(m.has(f)){if(!a)return;e+=1}else if(f==="/"&&i[e+1]==="/")for(e+=2;e<v&&!m.has(i[e]);)e+=1;else if(f==="/"&&i[e+1]==="*"){for(e+=2;e<v&&!(i[e]==="*"&&i[e+1]==="/");)e+=1;e+=2}else return}},"skipTrivia");for(;e<v&&(g(!0),!(e>=v));){const a=i[e];if(a!=='"'&&a!=="'")break;const f=e;e+=1;let n=!1;for(;e<v;){const l=i[e];if(l==="\\"){e+=2;continue}if(l===a){e+=1,n=!0;break}if(m.has(l))break;e+=1}if(!n)break;const t=e,c=i.slice(f+1,t-1);g(!1);const s=i[e];if(s===";"){e+=1,u.push({end:e,start:f,value:c});continue}if(e>=v||m.has(s)||s==="}"){u.push({end:t,start:f,value:c});continue}break}return u},"scanLeadingDirectives"),y=h(({directiveRegex:i,exclude:u=[],include:v=[],logger:e})=>{const g={},a={},f=S(v,u);return{name:"packem:preserve-directives",onLog(n,t){if(t.code==="MODULE_LEVEL_DIRECTIVE"&&n==="warn"){const c=x.exec(t.message),s=c?.[1]??c?.[2];if(s!==void 0&&i.test(`"${s}"`))return!1}},renderChunk:{handler(n,t,{sourcemap:c}){const s=h(r=>{const o=this.getModuleInfo(r)?.meta?.preserveDirectives?.directives;return o&&o.length>0?new Set(o):g[r]},"directivesForId"),l=t.moduleIds.map(r=>s(r)).reduce((r,o)=>(o&&o.forEach(I=>{r.add(I)}),r),new Set),d=new b(n);for(const{value:r}of w(n))l.delete(r);l.size>0&&(e.debug({message:`directives for chunk "${t.fileName}" are preserved.`,prefix:"plugin:preserve-directives"}),d.prepend(`${Array.from(l,r=>`'${r.replaceAll("\\",String.raw`\\`).replaceAll("'",String.raw`\'`)}';`).join(`
1
+ import{createFilter as S}from"@rollup/pluginutils";import h from"magic-string";const k=new Set([" "," ","\f","\v"," ","\uFEFF"]),m=new Set([`
2
+ `,"\r","\u2028","\u2029"]),M=/"([^"]*)"|'([^']*)'/,b=i=>{const g=[],{length:u}=i;let e=0;const v=a=>{for(;e<u;){const f=i[e];if(k.has(f))e+=1;else if(m.has(f)){if(!a)return;e+=1}else if(f==="/"&&i[e+1]==="/")for(e+=2;e<u&&!m.has(i[e]);)e+=1;else if(f==="/"&&i[e+1]==="*"){for(e+=2;e<u&&!(i[e]==="*"&&i[e+1]==="/");)e+=1;e+=2}else return}};for(;e<u&&(v(!0),!(e>=u));){const a=i[e];if(a!=='"'&&a!=="'")break;const f=e;e+=1;let n=!1;for(;e<u;){const l=i[e];if(l==="\\"){e+=2;continue}if(l===a){e+=1,n=!0;break}if(m.has(l))break;e+=1}if(!n)break;const t=e,d=i.slice(f+1,t-1);v(!1);const s=i[e];if(s===";"){e+=1,g.push({end:e,start:f,value:d});continue}if(e>=u||m.has(s)||s==="}"){g.push({end:t,start:f,value:d});continue}break}return g},x=({directiveRegex:i,exclude:g=[],include:u=[],logger:e})=>{const v={},a={},f=S(u,g);return{name:"packem:preserve-directives",onLog(n,t){if(t.code==="MODULE_LEVEL_DIRECTIVE"&&n==="warn"){const d=M.exec(t.message),s=d?.[1]??d?.[2];if(s!==void 0&&i.test(`"${s}"`))return!1}},renderChunk:{handler(n,t,{sourcemap:d}){const s=r=>{const o=this.getModuleInfo(r)?.meta?.preserveDirectives?.directives;return o&&o.length>0?new Set(o):v[r]},l=t.moduleIds.map(r=>s(r)).reduce((r,o)=>(o&&o.forEach(w=>{r.add(w)}),r),new Set),c=new h(n);for(const{value:r}of b(n))l.delete(r);l.size>0&&(e.debug({message:`directives for chunk "${t.fileName}" are preserved.`,prefix:"plugin:preserve-directives"}),c.prepend(`${Array.from(l,r=>`'${r.replaceAll("\\",String.raw`\\`).replaceAll("'",String.raw`\'`)}';`).join(`
3
3
  `)}
4
- `));let p;if(t.facadeModuleId){const r=this.getModuleInfo(t.facadeModuleId)?.meta?.preserveDirectives?.shebang;typeof r=="string"?p=r:typeof a[t.facadeModuleId]=="string"&&(p=a[t.facadeModuleId])}if(p&&(e.debug({message:`shebang for chunk "${t.fileName}" is preserved.`,prefix:"plugin:preserve-directives"}),d.prepend(`${p}
5
- `)),!(l.size===0&&p===void 0))return{code:d.toString(),map:c?d.generateMap({hires:!0}):void 0}},order:"post"},transform(n,t){if(!f(t))return;delete g[t],delete a[t];let c=!1,s;if(n.startsWith("#")&&n[1]==="!"){let d=n.length;for(let p=n.length,r=2;r<p;r+=1){const o=n.codePointAt(r);if(o===10||o===13||o===8232||o===8233){d=r;break}}d>0&&(a[t]=n.slice(0,d),s=new b(n),s.remove(0,Math.min(d+1,n.length)),c=!0,e.debug({message:`shebang for module "${t}" is preserved.`,prefix:"plugin:preserve-directives"}))}const l=s===void 0?n:s.toString();for(const{end:d,start:p,value:r}of w(l)){if(r==="use strict"||!i.test(`"${r}"`))continue;const o=g[t];o?o.add(r):g[t]=new Set([r]),s??=new b(n),s.remove(p,d),c=!0,e.debug({message:`directive "${r}" for module "${t}" is preserved.`,prefix:"plugin:preserve-directives"})}if(!(!c||s===void 0))return{code:s.toString(),map:s.generateMap({hires:!0}),meta:{preserveDirectives:{directives:[...g[t]??[]],shebang:a[t]??void 0}}}}}},"preserveDirectivesPlugin");export{y as preserveDirectivesPlugin};
4
+ `));let p;if(t.facadeModuleId){const r=this.getModuleInfo(t.facadeModuleId)?.meta?.preserveDirectives?.shebang;typeof r=="string"?p=r:typeof a[t.facadeModuleId]=="string"&&(p=a[t.facadeModuleId])}if(p&&(e.debug({message:`shebang for chunk "${t.fileName}" is preserved.`,prefix:"plugin:preserve-directives"}),c.prepend(`${p}
5
+ `)),!(l.size===0&&p===void 0))return{code:c.toString(),map:d?c.generateMap({hires:!0}):void 0}},order:"post"},transform(n,t){if(!f(t))return;delete v[t],delete a[t];let d=!1,s;if(n.startsWith("#")&&n[1]==="!"){let c=n.length;for(let p=n.length,r=2;r<p;r+=1){const o=n.codePointAt(r);if(o===10||o===13||o===8232||o===8233){c=r;break}}c>0&&(a[t]=n.slice(0,c),s=new h(n),s.remove(0,Math.min(c+1,n.length)),d=!0,e.debug({message:`shebang for module "${t}" is preserved.`,prefix:"plugin:preserve-directives"}))}const l=s===void 0?n:s.toString();for(const{end:c,start:p,value:r}of b(l)){if(r==="use strict"||!i.test(`"${r}"`))continue;const o=v[t];o?o.add(r):v[t]=new Set([r]),s??=new h(n),s.remove(p,c),d=!0,e.debug({message:`directive "${r}" for module "${t}" is preserved.`,prefix:"plugin:preserve-directives"})}if(!(!d||s===void 0))return{code:s.toString(),map:s.generateMap({hires:!0}),meta:{preserveDirectives:{directives:[...v[t]??[]],shebang:a[t]??void 0}}}}}};export{x as preserveDirectivesPlugin};
@@ -1,17 +1,17 @@
1
1
  import { Plugin } from 'rollup';
2
2
  /**
3
- * A plugin that adds `/* \@__PURE__ * /` annotations so consumers can tree-shake
4
- * unused calls/instantiations.
5
- *
6
- * Two modes, because rolldown and rollup expose pure-annotation timing differently.
7
- * `"transform"` (rollup, default): annotates `new Constructor(...)`
8
- * (`NewExpression`) only — `rollup-plugin-pure` handles the `CallExpression`
9
- * side separately. Runs `order: "post"` so `this.parse` sees transpiled JS.
10
- * `"renderChunk"` (rolldown): `rollup-plugin-pure` is transform-only and can't
11
- * run under rolldown (its native oxc transform runs after plugin transforms),
12
- * so this single renderChunk pass annotates BOTH `NewExpression` (constructors)
13
- * and `CallExpression` (functions) on the final transpiled chunk.
14
- */
3
+ * A plugin that adds `/* \@__PURE__ * /` annotations so consumers can tree-shake
4
+ * unused calls/instantiations.
5
+ *
6
+ * Two modes, because rolldown and rollup expose pure-annotation timing differently.
7
+ * `"transform"` (rollup, default): annotates `new Constructor(...)`
8
+ * (`NewExpression`) only — `rollup-plugin-pure` handles the `CallExpression`
9
+ * side separately. Runs `order: "post"` so `this.parse` sees transpiled JS.
10
+ * `"renderChunk"` (rolldown): `rollup-plugin-pure` is transform-only and can't
11
+ * run under rolldown (its native oxc transform runs after plugin transforms),
12
+ * so this single renderChunk pass annotates BOTH `NewExpression` (constructors)
13
+ * and `CallExpression` (functions) on the final transpiled chunk.
14
+ */
15
15
  declare const pureNewExpressionPlugin: (options: {
16
16
  constructors: string[];
17
17
  functions?: (RegExp | string)[];
@@ -1 +1 @@
1
- var b=Object.defineProperty;var x=(e,r)=>b(e,"name",{value:r,configurable:!0});import{w as E}from"../packem_shared/index-Dq8IUFTs.js";import _ from"magic-string";var R=Object.defineProperty,u=x((e,r)=>R(e,"name",{value:r,configurable:!0}),"p");const k=24,v=u(e=>{if(e){if(e.type==="Identifier")return e.name;if(e.type==="MemberExpression"&&!e.computed&&e.property?.type==="Identifier"){const r=v(e.object),o=e.property.name;return r===void 0||o===void 0?void 0:`${r}.${o}`}}},"calleeToName"),P=u((e,r)=>e.slice(Math.max(0,r-k),r).includes("__PURE__"),"isAlreadyPure"),I=u(e=>{const r=e.constructors.filter(t=>t.includes(".")),o=(e.functions??[]).filter(t=>t instanceof RegExp);(r.length>0||o.length>0)&&e.logger&&e.logger.warn({message:`ignoring unsupported entries — dotted constructor names (${r.join(", ")||"none"}) and ${String(o.length)} RegExp function/constructor matchers are not supported and were skipped.`,prefix:"plugin:pure-new-expression"});const l=new Set(e.constructors.filter(t=>!t.includes("."))),h=new Set((e.functions??[]).filter(t=>typeof t=="string")),S=u(t=>t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),"escapeForRegExp"),f=new Set(l);for(const t of h)f.add(t.split(".")[0]);const d=f.size>0?new RegExp(String.raw`\b(?:${[...f].map(t=>S(t)).join("|")})\b`):void 0;return e.mode==="renderChunk"?{name:"packem:pure-new-expression",renderChunk:{handler(t,m,{sourcemap:i}){if(!d?.test(t))return;let p;try{p=this.parse(t)}catch{return}const a=new _(t);let s=!1;if(E(p,{enter(c,g){const n=c;if(typeof n.start!="number"||g?.type==="ExpressionStatement")return;let y=!1;if(n.type==="NewExpression"&&n.callee?.type==="Identifier"&&typeof n.callee.name=="string"&&l.has(n.callee.name))y=!0;else if(n.type==="CallExpression"){const w=v(n.callee);w!==void 0&&h.has(w)&&(y=!0)}y&&!P(t,n.start)&&(a.prependLeft(n.start,"/* @__PURE__ */ "),s=!0)}}),!!s)return{code:a.toString(),map:i?a.generateMap({hires:!0}):void 0}},order:"post"}}:{name:"packem:pure-new-expression",transform:{handler(t){if(l.size===0||d===void 0||!d.test(t))return;let m;try{m=this.parse(t)}catch{return}const i=new _(t);let p=!1;if(E(m,{enter(a){const s=a,c=s.callee?.name,g=s._rollupAnnotations;s.type==="NewExpression"&&s.callee?.type==="Identifier"&&typeof c=="string"&&l.has(c)&&!g?.some(n=>n.type==="pure")&&typeof s.start=="number"&&(i.prependLeft(s.start,"/* @__PURE__ */ "),p=!0)}}),!!p)return{code:i.toString(),map:e.sourcemap?i.generateMap({hires:!0}):void 0}},order:"post"}}},"pureNewExpressionPlugin");export{I as pureNewExpressionPlugin};
1
+ import{w}from"../packem_shared/index-NTDZLUEE.js";import x from"magic-string";const S=24,_=t=>{if(t){if(t.type==="Identifier")return t.name;if(t.type==="MemberExpression"&&!t.computed&&t.property?.type==="Identifier"){const s=_(t.object),o=t.property.name;return s===void 0||o===void 0?void 0:`${s}.${o}`}}},v=(t,s)=>t.slice(Math.max(0,s-S),s).includes("__PURE__"),b=t=>{const s=t.constructors.filter(e=>e.includes(".")),o=(t.functions??[]).filter(e=>e instanceof RegExp);(s.length>0||o.length>0)&&t.logger&&t.logger.warn({message:`ignoring unsupported entries — dotted constructor names (${s.join(", ")||"none"}) and ${String(o.length)} RegExp function/constructor matchers are not supported and were skipped.`,prefix:"plugin:pure-new-expression"});const c=new Set(t.constructors.filter(e=>!e.includes("."))),h=new Set((t.functions??[]).filter(e=>typeof e=="string")),E=e=>e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),u=new Set(c);for(const e of h)u.add(e.split(".")[0]);const f=u.size>0?new RegExp(String.raw`\b(?:${[...u].map(e=>E(e)).join("|")})\b`):void 0;return t.mode==="renderChunk"?{name:"packem:pure-new-expression",renderChunk:{handler(e,d,{sourcemap:i}){if(!f?.test(e))return;let p;try{p=this.parse(e)}catch{return}const a=new x(e);let n=!1;if(w(p,{enter(l,m){const r=l;if(typeof r.start!="number"||m?.type==="ExpressionStatement")return;let g=!1;if(r.type==="NewExpression"&&r.callee?.type==="Identifier"&&typeof r.callee.name=="string"&&c.has(r.callee.name))g=!0;else if(r.type==="CallExpression"){const y=_(r.callee);y!==void 0&&h.has(y)&&(g=!0)}g&&!v(e,r.start)&&(a.prependLeft(r.start,"/* @__PURE__ */ "),n=!0)}}),!!n)return{code:a.toString(),map:i?a.generateMap({hires:!0}):void 0}},order:"post"}}:{name:"packem:pure-new-expression",transform:{handler(e){if(c.size===0||f===void 0||!f.test(e))return;let d;try{d=this.parse(e)}catch{return}const i=new x(e);let p=!1;if(w(d,{enter(a){const n=a,l=n.callee?.name,m=n._rollupAnnotations;n.type==="NewExpression"&&n.callee?.type==="Identifier"&&typeof l=="string"&&c.has(l)&&!m?.some(r=>r.type==="pure")&&typeof n.start=="number"&&(i.prependLeft(n.start,"/* @__PURE__ */ "),p=!0)}}),!!p)return{code:i.toString(),map:t.sourcemap?i.generateMap({hires:!0}):void 0}},order:"post"}}};export{b as pureNewExpressionPlugin};
@@ -1 +1 @@
1
- var l=Object.defineProperty;var o=(e,r)=>l(e,"name",{value:r,configurable:!0});import{createFilter as p}from"@rollup/pluginutils";import{EXCLUDE_REGEXP as t}from"@visulima/packem-share/constants";import{transform as f}from"sucrase";var d=Object.defineProperty,E=o((e,r)=>d(e,"name",{value:r,configurable:!0}),"t");const c=E(({exclude:e,include:r,...n})=>{const i=p(r,e??t);return{name:"packem:sucrase",transform:{filter:{id:{exclude:e??t,include:r}},handler(s,a){if(!i(a))return;const{code:u,sourceMap:m}=f(s,{...n,filePath:a,sourceMapOptions:{compiledFilename:a}});return{code:u,map:m}}}}},"sucraseTransformPlugin");c.NAME="sucrase";const M=c;export{M as sucrasePlugin};
1
+ import{createFilter as u}from"@rollup/pluginutils";import{EXCLUDE_REGEXP as c}from"@visulima/packem-share/constants";import{transform as l}from"sucrase";const t=({exclude:r,include:o,...s})=>{const n=u(o,r??c);return{name:"packem:sucrase",transform:{filter:{id:{exclude:r??c,include:o}},handler(a,e){if(!n(e))return;const{code:i,sourceMap:m}=l(a,{...s,filePath:e,sourceMapOptions:{compiledFilename:e}});return{code:i,map:m}}}}};t.NAME="sucrase";const E=t;export{E as sucrasePlugin};
@@ -8,4 +8,4 @@ import { S as SwcPluginConfig } from "../../packem_shared/types.d-DukC_8rF.js";
8
8
  import '@rollup/pluginutils';
9
9
  import '@swc/types';
10
10
  declare const _default: TransformerFn<SwcPluginConfig>;
11
- export { SwcPluginConfig, _default as swcPlugin };
11
+ export { type SwcPluginConfig, _default as swcPlugin };
@@ -1 +1 @@
1
- import{default as f}from"../../packem_shared/swcPlugin-BdHPQBN4.js";export{f as swcPlugin};
1
+ import{default as f}from"../../packem_shared/swcPlugin-C-UrDd9t.js";export{f as swcPlugin};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/packem-rollup",
3
- "version": "1.0.0-alpha.77",
3
+ "version": "1.0.0-alpha.78",
4
4
  "description": "Rollup plugins for packem",
5
5
  "keywords": [
6
6
  "visulima",
@@ -92,11 +92,11 @@
92
92
  "@rollup/pluginutils": "5.4.0",
93
93
  "@swc/types": "0.1.27",
94
94
  "@visulima/find-cache-dir": "3.0.0",
95
- "@visulima/fs": "5.0.0",
96
- "@visulima/package": "5.0.0",
97
- "@visulima/packem-share": "1.0.0-alpha.52",
95
+ "@visulima/fs": "5.0.2",
96
+ "@visulima/package": "5.0.2",
97
+ "@visulima/packem-share": "1.0.0-alpha.53",
98
98
  "@visulima/path": "3.0.0",
99
- "@visulima/rollup-plugin-dts": "1.0.0-alpha.37",
99
+ "@visulima/rollup-plugin-dts": "1.0.0-alpha.38",
100
100
  "clean-css": "^5.3.3",
101
101
  "html-minifier-next": "7.2.0",
102
102
  "magic-string": "0.30.21",
@@ -1 +0,0 @@
1
- var o=Object.defineProperty;var a=(t,i)=>o(t,"name",{value:i,configurable:!0});var n=Object.defineProperty,d=a((t,i)=>n(t,"name",{value:i,configurable:!0}),"i");const l=new Set(["chrome","edge","es","firefox","ie","ios","node","opera","safari"]),c=["android 4"],s={android:"chrome",ios_saf:"ios"},f=" ",m=/^\d+(?:\.\d+)*$/,u=d(t=>{let i=t.filter(e=>!c.some(r=>e.startsWith(r))).map(e=>{const r=e.split(f);return[r[0]??"",r[1]??""]}).map(([e,r])=>[Object.hasOwn(s,e)?s[e]:e,r]).map(([e,r])=>[e,r.includes("-")?r.slice(0,r.indexOf("-")):r]).map(([e,r])=>[e,r.endsWith(".0")?r.slice(0,-2):r]).filter(([,e])=>m.test(e)).filter(([e])=>l.has(e));return i=Object.entries(Object.fromEntries(i)),i.map(([e,r])=>`${e}${r}`)},"browserslistToEsbuild");export{u as default};
@@ -1 +0,0 @@
1
- var j=Object.defineProperty;var d=(e,t)=>j(e,"name",{value:t,configurable:!0});import{createFilter as $}from"@rollup/pluginutils";import{DEFAULT_LOADERS as k}from"@visulima/packem-share/constants";import{join as E,extname as M}from"@visulima/path";import{formatMessages as S,transform as D,build as A}from"esbuild";import{findCacheDirSync as P}from"@visulima/find-cache-dir";import{readFile as R}from"@visulima/fs";import*as F from"rs-module-lexer";var L=Object.defineProperty,C=d((e,t)=>L(e,"name",{value:t,configurable:!0}),"n");const _=C(async(e,t)=>{t.length>0&&(await S(t,{color:!0,kind:"warning"})).forEach(s=>{e.warn(s)})},"warn");var W=Object.defineProperty,z=d((e,t)=>W(e,"name",{value:t,configurable:!0}),"t");const I=z(e=>{if(e==="es")return"esm";if(e==="cjs")return e},"getEsbuildFormat"),N=z(({sourceMap:e=!0,...t})=>async function(s,o,r){if(t.minify||t.minifyWhitespace||t.minifyIdentifiers||t.minifySyntax){const i=I(r.format),c=await D(s,{format:i,loader:"js",sourcemap:e,...t});if(await _(this,c.warnings),c.code)return{code:c.code,map:c.map||void 0}}},"getRenderChunk");var T=Object.defineProperty,x=d((e,t)=>T(e,"name",{value:t,configurable:!0}),"o");const q=x(e=>e.replaceAll("\\","/"),"slash"),{parseAsync:J}=F,b=/.*/,U=x(async e=>{const t=P("@visulima/packem/optimize-deps",{create:!0,cwd:e.cwd});if(!t)throw new Error('[packem:optimize-deps]: failed to find or create cache directory "node_modules/.cache/packem/optimize_deps".');await A({absWorkingDir:e.cwd,bundle:!0,entryPoints:e.include,format:"esm",ignoreAnnotations:!0,metafile:!0,outdir:t,sourcemap:e.sourceMap,splitting:!0,...e.esbuildOptions,plugins:[{name:"optimize-deps",setup(o){o.onResolve({filter:b},async r=>{if(e.exclude?.includes(r.path))return{external:!0};if(!r.pluginData?.__resolving_dep_path__&&e.include.includes(r.path)){const i=await o.resolve(r.path,{kind:"import-statement",pluginData:{__resolving_dep_path__:!0},resolveDir:r.resolveDir});return i.errors.length>0||i.warnings.length>0?i:{namespace:"optimize-deps",path:r.path,pluginData:{absolute:i.path,resolveDir:r.resolveDir}}}}),o.onLoad({filter:b,namespace:"optimize-deps"},async r=>{const{absolute:i,resolveDir:c}=r.pluginData,l=await R(i),{output:m}=await J({input:[{code:l,filename:i}]}),v=m[0]?.exports??[],u=JSON.stringify(q(i));return{contents:v.length>0?`export * from ${u}`:`module.exports = require(${u})`,resolveDir:c}})}},...e.esbuildOptions?.plugins??[]]});const s=new Map;for(const o of e.include)s.set(o,{file:E(t,`${o}.js`)});return{cacheDir:t,optimized:s}},"optimizeDeps");var B=Object.defineProperty,y=d((e,t)=>B(e,"name",{value:t,configurable:!0}),"m");const G=/\.[cm]ts/,H=new Set(["base64","binary","dataurl","json","text"]),K=y(({exclude:e,include:t,loaders:s,logger:o,optimizeDeps:r,sourceMap:i,...c})=>{const l={...k};if(s!==void 0)for(const[a,n]of Object.entries(s)){const f=a.startsWith(".")?a:`.${a}`;typeof n=="string"?l[f]=n:delete l[f]}const m=Object.keys(l),v=y(a=>a.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),"escapeForRegExp"),u=new RegExp(String.raw`\.(${m.map(a=>v(a.slice(1))).join("|")})$`),w=t||e?$(t??u,e):void 0;t&&o.debug("`include` is constrained to files matching a configured loader extension (%O)",m);let p;const O=process.cwd();return{async buildStart(){!r||p||(p=await U({cwd:O,sourceMap:i??!1,...r}),o.debug("optimized %O",p.optimized))},name:"packem:esbuild",renderChunk:N({...c,sourceMap:i}),resolveId(a){if(p?.optimized.has(a)){const n=p.optimized.get(a);if(n)return o.debug("resolved %s to %s",a,n.file),n.file}},transform:{filter:{id:u},async handler(a,n){if(w&&!w(n)||p?.optimized.has(n))return;const f=M(n),g=l[f];if(o.debug("transforming %s with %s loader",n,g),!g)return;const h=await D(a,{format:H.has(g)?"esm":void 0,loader:g,sourcefile:n.replace(G,".ts"),sourcemap:i,...c});if(await _(this,h.warnings),h.code)return{code:h.code,map:h.map||void 0}}}}},"esbuildTransformer");K.NAME="esbuild";export{K as default};
@@ -1 +0,0 @@
1
- var y=Object.defineProperty;var n=(s,e)=>y(s,"name",{value:e,configurable:!0});var b=Object.defineProperty,m=n((s,e)=>b(s,"name",{value:e,configurable:!0}),"i");class _{static{n(this,"WalkerBase")}static{m(this,"WalkerBase")}constructor(){this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:m(()=>this.should_skip=!0,"skip"),remove:m(()=>this.should_remove=!0,"remove"),replace:m(e=>this.replacement=e,"replace")}}replace(e,t,i,o){e&&t&&(i!=null?e[t][i]=o:e[t]=o)}remove(e,t,i){e&&t&&(i!=null?e[t].splice(i,1):delete e[t])}}var w=Object.defineProperty,c=n((s,e)=>w(s,"name",{value:e,configurable:!0}),"c$1");class x extends _{static{n(this,"SyncWalker")}static{c(this,"SyncWalker")}constructor(e,t){super(),this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:c(()=>this.should_skip=!0,"skip"),remove:c(()=>this.should_remove=!0,"remove"),replace:c(i=>this.replacement=i,"replace")},this.enter=e,this.leave=t}visit(e,t,i,o){if(e){if(this.enter){const l=this.should_skip,h=this.should_remove,r=this.replacement;this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.enter.call(this.context,e,t,i,o),this.replacement&&(e=this.replacement,this.replace(t,i,o,e)),this.should_remove&&this.remove(t,i,o);const u=this.should_skip,v=this.should_remove;if(this.should_skip=l,this.should_remove=h,this.replacement=r,u)return e;if(v)return null}let a;for(a in e){const l=e[a];if(l&&typeof l=="object")if(Array.isArray(l)){const h=l;for(let r=0;r<h.length;r+=1){const u=h[r];f(u)&&(this.visit(u,e,a,r)||r--)}}else f(l)&&this.visit(l,e,a,null)}if(this.leave){const l=this.replacement,h=this.should_remove;this.replacement=null,this.should_remove=!1,this.leave.call(this.context,e,t,i,o),this.replacement&&(e=this.replacement,this.replace(t,i,o,e)),this.should_remove&&this.remove(t,i,o);const r=this.should_remove;if(this.replacement=l,this.should_remove=h,r)return null}}return e}}function f(s){return s!==null&&typeof s=="object"&&"type"in s&&typeof s.type=="string"}n(f,"n");c(f,"isNode");var g=Object.defineProperty,p=n((s,e)=>g(s,"name",{value:e,configurable:!0}),"c");class j extends _{static{n(this,"AsyncWalker")}static{p(this,"AsyncWalker")}constructor(e,t){super(),this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:p(()=>this.should_skip=!0,"skip"),remove:p(()=>this.should_remove=!0,"remove"),replace:p(i=>this.replacement=i,"replace")},this.enter=e,this.leave=t}async visit(e,t,i,o){if(e){if(this.enter){const l=this.should_skip,h=this.should_remove,r=this.replacement;this.should_skip=!1,this.should_remove=!1,this.replacement=null,await this.enter.call(this.context,e,t,i,o),this.replacement&&(e=this.replacement,this.replace(t,i,o,e)),this.should_remove&&this.remove(t,i,o);const u=this.should_skip,v=this.should_remove;if(this.should_skip=l,this.should_remove=h,this.replacement=r,u)return e;if(v)return null}let a;for(a in e){const l=e[a];if(l&&typeof l=="object")if(Array.isArray(l)){const h=l;for(let r=0;r<h.length;r+=1){const u=h[r];d(u)&&(await this.visit(u,e,a,r)||r--)}}else d(l)&&await this.visit(l,e,a,null)}if(this.leave){const l=this.replacement,h=this.should_remove;this.replacement=null,this.should_remove=!1,await this.leave.call(this.context,e,t,i,o),this.replacement&&(e=this.replacement,this.replace(t,i,o,e)),this.should_remove&&this.remove(t,i,o);const r=this.should_remove;if(this.replacement=l,this.should_remove=h,r)return null}}return e}}function d(s){return s!==null&&typeof s=="object"&&"type"in s&&typeof s.type=="string"}n(d,"a$1");p(d,"isNode");var W=Object.defineProperty,k=n((s,e)=>W(s,"name",{value:e,configurable:!0}),"a");function A(s,{enter:e,leave:t}){return new x(e,t).visit(s,null)}n(A,"walk");k(A,"walk");async function O(s,{enter:e,leave:t}){return await new j(e,t).visit(s,null)}n(O,"asyncWalk");k(O,"asyncWalk");export{A as w};
@@ -1 +0,0 @@
1
- var f=Object.defineProperty;var c=(e,r)=>f(e,"name",{value:r,configurable:!0});import{createFilter as s}from"@rollup/pluginutils";import{transform as u}from"@swc/core";import{EXCLUDE_REGEXP as t}from"@visulima/packem-share/constants";var d=Object.defineProperty,p=c((e,r)=>d(e,"name",{value:r,configurable:!0}),"i");const w=p(({exclude:e,include:r,...n})=>{const i=s(r,e??t);return{name:"packem:swc",transform:{filter:{id:{exclude:e??t,include:r}},async handler(l,a){if(!i(a))return;const{code:o,map:m}=await u(l,{...n,configFile:!1,filename:a,swcrc:!1});return{code:o,map:m}}}}},"swcPlugin");w.NAME="swc";export{w as default};