@visulima/packem-rollup 1.0.0-alpha.65 → 1.0.0-alpha.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/LICENSE.md +9 -534
  3. package/dist/index.d.ts +680 -25
  4. package/dist/index.js +1 -1
  5. package/dist/packem_shared/browserslistToEsbuild-HD6SaWPt.js +1 -0
  6. package/dist/packem_shared/esbuildPlugin-BStpbA6S.js +1 -0
  7. package/dist/packem_shared/swcPlugin-DBBN5mct.js +1 -0
  8. package/dist/packem_shared/types.d-Dmpk2asd.d.ts +7 -0
  9. package/dist/packem_shared/types.d-DrgzeMBs.d-CG9J1x6q.d.ts +6 -0
  10. package/dist/packem_shared/types.d-KBgVO47q.d.ts +658 -0
  11. package/dist/plugins/chunk-splitter/index.d.ts +2 -5
  12. package/dist/plugins/chunk-splitter/index.js +1 -0
  13. package/dist/plugins/cjs-interop.d.ts +9 -5
  14. package/dist/plugins/cjs-interop.js +2 -2
  15. package/dist/plugins/esbuild/index.d.ts +11 -3
  16. package/dist/plugins/esbuild/index.js +1 -1
  17. package/dist/plugins/json.d.ts +5 -4
  18. package/dist/plugins/json.js +1 -1
  19. package/dist/plugins/jsx-remove-attributes.d.ts +9 -5
  20. package/dist/plugins/jsx-remove-attributes.js +1 -1
  21. package/dist/plugins/preserve-directives.d.ts +14 -15
  22. package/dist/plugins/preserve-directives.js +3 -3
  23. package/dist/plugins/pure-new-expression-plugin.d.ts +10 -9
  24. package/dist/plugins/pure-new-expression-plugin.js +1 -0
  25. package/dist/plugins/sucrase/index.d.ts +101 -7
  26. package/dist/plugins/sucrase/index.js +1 -1
  27. package/dist/plugins/swc/index.d.ts +11 -2
  28. package/dist/plugins/swc/index.js +1 -1
  29. package/package.json +22 -105
  30. package/dist/packem_shared/browserslistToEsbuild-C0IWmbNe.js +0 -1
  31. package/dist/packem_shared/cachingPlugin-DLKoeQeF.js +0 -1
  32. package/dist/packem_shared/chunkSplitter-DWAy1JkE.js +0 -1
  33. package/dist/packem_shared/createSplitChunks-BrEBZq7d.js +0 -1
  34. package/dist/packem_shared/esbuildPlugin-C5x4_cXf.js +0 -1
  35. package/dist/packem_shared/fixDynamicImportExtension-BBGNRniz.js +0 -1
  36. package/dist/packem_shared/getCustomModuleLayer-d8i66lfh.js +0 -1
  37. package/dist/packem_shared/getModuleLayer-rF9RxnJ5.js +0 -1
  38. package/dist/packem_shared/index-QEzU3Fey.js +0 -1
  39. package/dist/packem_shared/metafilePlugin-CVcqFpPJ.js +0 -1
  40. package/dist/packem_shared/oxcResolvePlugin-SH1JFonc.js +0 -1
  41. package/dist/packem_shared/oxcTransformPlugin-BGmQroQ4.js +0 -4
  42. package/dist/packem_shared/patchTypescriptTypes-CZ4v3hr9.js +0 -6
  43. package/dist/packem_shared/pureNewExpressionPlugin-DX9yMcH2.js +0 -1
  44. package/dist/packem_shared/resolveFileUrlPlugin-BkpjVHeK.js +0 -1
  45. package/dist/packem_shared/resolveTsconfigPathsPlugin-CEasmDpi.js +0 -1
  46. package/dist/packem_shared/resolveTsconfigRootDirectoriesPlugin-Cwj3tqCJ.js +0 -1
  47. package/dist/packem_shared/resolveTypescriptMjsCtsPlugin-DX9at4BX.js +0 -1
  48. package/dist/packem_shared/swcPlugin-Boip4lWG.js +0 -1
  49. package/dist/plugins/babel/index.d.ts +0 -10
  50. package/dist/plugins/babel/index.js +0 -1
  51. package/dist/plugins/cache-plugin.d.ts +0 -11
  52. package/dist/plugins/chunk-splitter/gather.d.ts +0 -8
  53. package/dist/plugins/chunk-splitter/parse/index.d.ts +0 -4
  54. package/dist/plugins/chunk-splitter/parse/types.d.ts +0 -24
  55. package/dist/plugins/copy.d.ts +0 -23
  56. package/dist/plugins/copy.js +0 -1
  57. package/dist/plugins/data-uri.d.ts +0 -25
  58. package/dist/plugins/data-uri.js +0 -1
  59. package/dist/plugins/debarrel.d.ts +0 -7
  60. package/dist/plugins/debarrel.js +0 -2
  61. package/dist/plugins/esbuild/browserslist-to-esbuild.d.ts +0 -2
  62. package/dist/plugins/esbuild/esbuild-plugin.d.ts +0 -3
  63. package/dist/plugins/esbuild/types.d.ts +0 -39
  64. package/dist/plugins/esbuild/utils/get-render-chunk.d.ts +0 -14
  65. package/dist/plugins/esbuild/utils/optimize-deps.d.ts +0 -3
  66. package/dist/plugins/esbuild/utils/warn.d.ts +0 -4
  67. package/dist/plugins/esm-shim-cjs-syntax.d.ts +0 -9
  68. package/dist/plugins/esm-shim-cjs-syntax.js +0 -11
  69. package/dist/plugins/fix-dts-default-cjs-exports-util.d.ts +0 -35
  70. package/dist/plugins/fix-dts-default-cjs-exports.d.ts +0 -26
  71. package/dist/plugins/fix-dts-default-cjs-exports.js +0 -26
  72. package/dist/plugins/fix-dynamic-import-extension.d.ts +0 -3
  73. package/dist/plugins/import-attributes.d.ts +0 -2
  74. package/dist/plugins/import-attributes.js +0 -1
  75. package/dist/plugins/license.d.ts +0 -17
  76. package/dist/plugins/license.js +0 -13
  77. package/dist/plugins/metafile.d.ts +0 -3
  78. package/dist/plugins/minify-html-literals/index.d.ts +0 -41
  79. package/dist/plugins/minify-html-literals/index.js +0 -3
  80. package/dist/plugins/minify-html-literals/lib/minify-html-literals.d.ts +0 -200
  81. package/dist/plugins/minify-html-literals/lib/models.d.ts +0 -25
  82. package/dist/plugins/minify-html-literals/lib/parse-literals.d.ts +0 -13
  83. package/dist/plugins/minify-html-literals/lib/strategy.d.ts +0 -69
  84. package/dist/plugins/minify-html-literals/lib/typescript.d.ts +0 -23
  85. package/dist/plugins/native-modules-plugin.d.ts +0 -14
  86. package/dist/plugins/native-modules-plugin.js +0 -1
  87. package/dist/plugins/oxc/index.d.ts +0 -3
  88. package/dist/plugins/oxc/index.js +0 -1
  89. package/dist/plugins/oxc/oxc-resolve-plugin.d.ts +0 -4
  90. package/dist/plugins/oxc/oxc-transformer-plugin.d.ts +0 -3
  91. package/dist/plugins/oxc/types.d.ts +0 -16
  92. package/dist/plugins/raw.d.ts +0 -7
  93. package/dist/plugins/raw.js +0 -6
  94. package/dist/plugins/require-cjs-transformer.d.ts +0 -43
  95. package/dist/plugins/require-cjs-transformer.js +0 -21
  96. package/dist/plugins/resolve-file-url.d.ts +0 -3
  97. package/dist/plugins/shebang.d.ts +0 -9
  98. package/dist/plugins/shebang.js +0 -4
  99. package/dist/plugins/source-maps.d.ts +0 -7
  100. package/dist/plugins/source-maps.js +0 -1
  101. package/dist/plugins/swc/swc-plugin.d.ts +0 -3
  102. package/dist/plugins/swc/types.d.ts +0 -6
  103. package/dist/plugins/typescript/index.d.ts +0 -7
  104. package/dist/plugins/typescript/index.js +0 -1
  105. package/dist/plugins/typescript/patch-typescript-types.d.ts +0 -13
  106. package/dist/plugins/typescript/resolve-tsconfig-paths-plugin.d.ts +0 -11
  107. package/dist/plugins/typescript/resolve-tsconfig-root-dirs.d.ts +0 -24
  108. package/dist/plugins/typescript/resolve-typescript-mjs-cjs.d.ts +0 -3
  109. package/dist/plugins/url.d.ts +0 -72
  110. package/dist/plugins/url.js +0 -1
  111. package/dist/types.d.ts +0 -127
  112. package/dist/utils/chunks/create-split-chunks.d.ts +0 -11
  113. package/dist/utils/chunks/get-custom-module-layer.d.ts +0 -2
  114. package/dist/utils/chunks/get-module-layer.d.ts +0 -10
  115. package/dist/utils/index.d.ts +0 -4
  116. package/dist/utils/is-pure-cjs.d.ts +0 -9
@@ -1,2 +1,2 @@
1
- var c=Object.defineProperty;var l=(e,r)=>c(e,"name",{value:r,configurable:!0});import d from"magic-string";var i=Object.defineProperty,s=l((e,r)=>i(e,"name",{value:r,configurable:!0}),"u");const g=s(({addDefaultProperty:e=!1,logger:r})=>({name:"packem:cjs-interop",renderChunk:s(async(u,o,a)=>{if(!(o.type!=="chunk"||!o.isEntry)&&a.format==="cjs"&&a.exports==="auto"){const n=/(exports(?:\['default'\]|\.default)) = (.*);/i.exec(u);if(n===null||n.length<3)return;const t=new d(u);t.replace("Object.defineProperty(exports, '__esModule', { value: true });",""),t.replaceAll(/exports\.(.*) = (.*);/g,"module.exports.$1 = $2;"),e&&t.append(`
2
- module.exports.default = ${n[2]};`);let p=t.toString();return p=p.replace(/(?:module\.)?exports(?:\['default'\]|\.default)/i,"module.exports"),r.debug({message:`Applied CommonJS interop to entry chunk ${o.fileName}.`,prefix:"plugin:cjs-interop"}),{code:p,map:t.generateMap({hires:!0})}}},"renderChunk")}),"cjsInteropPlugin");export{g as cjsInteropPlugin};
1
+ var d=Object.defineProperty;var u=(e,r)=>d(e,"name",{value:r,configurable:!0});import c from"magic-string";var i=Object.defineProperty,s=u((e,r)=>i(e,"name",{value:r,configurable:!0}),"p");const f=/(exports(?:\['default'\]|\.default)) = (.*);/i,m=/(?:module\.)?exports(?:\['default'\]|\.default)/i,j=s(({addDefaultProperty:e=!1,logger:r})=>({name:"packem:cjs-interop",renderChunk:s((p,l,a)=>{if(l.isEntry&&a.format==="cjs"&&a.exports==="auto"){const o=f.exec(p);if(o===null||o.length<3)return;const t=new c(p);t.replace("Object.defineProperty(exports, '__esModule', { value: true });",""),t.replaceAll(/exports\.(.*) = (.*);/g,"module.exports.$1 = $2;"),e&&t.append(`
2
+ module.exports.default = ${o[2]};`);let n=t.toString();return n=n.replace(m,"module.exports"),r.debug({message:`Applied CommonJS interop to entry chunk ${l.fileName}.`,prefix:"plugin:cjs-interop"}),{code:n,map:t.generateMap({hires:!0})}}},"renderChunk")}),"cjsInteropPlugin");export{j as cjsInteropPlugin};
@@ -1,3 +1,11 @@
1
- export { default as browserslistToEsbuild } from "./browserslist-to-esbuild.d.ts";
2
- export { default as esbuildPlugin } from "./esbuild-plugin.d.ts";
3
- export type * from "./types.d.ts";
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";
3
+ import '@visulima/packem-share/utils';
4
+ import 'rollup';
5
+ import { T as TransformerFn } from "../../packem_shared/types.d-DrgzeMBs.d-CG9J1x6q.js";
6
+ import '@visulima/packem-share/types';
7
+ import '@rollup/plugin-alias';
8
+ import '@visulima/package';
9
+ import '@rollup/pluginutils';
10
+ declare const _default: TransformerFn<EsbuildPluginConfig>;
11
+ export { EsbuildPluginConfig, _default as esbuildPlugin };
@@ -1 +1 @@
1
- import{default as l}from"../../packem_shared/browserslistToEsbuild-C0IWmbNe.js";import{default as r}from"../../packem_shared/esbuildPlugin-C5x4_cXf.js";export{l as browserslistToEsbuild,r as esbuildPlugin};
1
+ import{default as l}from"../../packem_shared/browserslistToEsbuild-HD6SaWPt.js";import{default as r}from"../../packem_shared/esbuildPlugin-BStpbA6S.js";export{l as browserslistToEsbuild,r as esbuildPlugin};
@@ -1,4 +1,5 @@
1
- import type { RollupJsonOptions } from "@rollup/plugin-json";
2
- import type { Plugin } from "rollup";
3
- export type { RollupJsonOptions } from "@rollup/plugin-json";
4
- export declare const JsonPlugin: (options: RollupJsonOptions) => Plugin;
1
+ import { RollupJsonOptions } from '@rollup/plugin-json';
2
+ export { type RollupJsonOptions } from '@rollup/plugin-json';
3
+ import { Plugin } from 'rollup';
4
+ declare const JsonPlugin: (options: RollupJsonOptions) => Plugin;
5
+ export { JsonPlugin };
@@ -1 +1 @@
1
- var c=Object.defineProperty;var t=(o,r)=>c(o,"name",{value:r,configurable:!0});import i from"@rollup/plugin-json";var l=Object.defineProperty,d=t((o,r)=>l(o,"name",{value:r,configurable:!0}),"t");const n="export default ",m=d(o=>{const r=i(o);return{...r,name:"packem:json",transform:{filter:{id:/\.json$/},handler(s,a){const e=r.transform?.call(this,s,a);return e&&typeof e!="string"&&"code"in e&&e.code?.startsWith(n)&&(e.code=e.code.replace(n,"module.exports = ")),e}}}},"JsonPlugin");export{m as JsonPlugin};
1
+ var c=Object.defineProperty;var t=(r,o)=>c(r,"name",{value:o,configurable:!0});import i from"@rollup/plugin-json";var l=Object.defineProperty,u=t((r,o)=>l(r,"name",{value:o,configurable:!0}),"t");const n="export default ",d=/\.json$/,m=u(r=>{const o=i(r);return{...o,name:"packem:json",transform:{filter:{id:d},handler(s,a){const e=o.transform?.call(this,s,a);return e&&typeof e!="string"&&"code"in e&&e.code?.startsWith(n)&&(e.code=e.code.replace(n,"module.exports = ")),e}}}},"JsonPlugin");export{m as JsonPlugin};
@@ -1,7 +1,11 @@
1
- import type { Plugin } from "rollup";
2
- export type JSXRemoveAttributesPlugin = {
3
- attributes: string[];
1
+ import { Plugin } from 'rollup';
2
+ type JSXRemoveAttributesPlugin = {
3
+ attributes: string[];
4
4
  };
5
- export declare const jsxRemoveAttributes: ({ attributes, logger }: JSXRemoveAttributesPlugin & {
6
- logger: Console;
5
+ declare const jsxRemoveAttributes: ({
6
+ attributes,
7
+ logger
8
+ }: JSXRemoveAttributesPlugin & {
9
+ logger: Console;
7
10
  }) => Plugin;
11
+ export { JSXRemoveAttributesPlugin, jsxRemoveAttributes };
@@ -1 +1 @@
1
- var c=Object.defineProperty;var p=(e,a)=>c(e,"name",{value:a,configurable:!0});import{w as y}from"../packem_shared/index-Dq8IUFTs.js";import f from"magic-string";var b=Object.defineProperty,v=p((e,a)=>b(e,"name",{value:a,configurable:!0}),"l");const g=v(({attributes:e,logger:a})=>{if(!Array.isArray(e)||e.length===0)throw new Error("[packem:jsx-remove-attributes]: attributes must be a non-empty array of strings.");return{name:"packem:jsx-remove-attributes",transform:{filter:{id:/\.[tj]sx$/},async handler(i,u){let n;try{n=this.parse(i,{allowReturnOutsideFunction:!0})}catch(r){this.warn({code:"PARSE_ERROR",message:`[packem:jsx-remove-attributes]: failed to parse "${u}" and remove the jsx attribute.`}),a.warn(r);return}let l=!1;const o=new f(i);if(y(n,{enter(r){if(r.type==="CallExpression"&&r.callee.type==="Identifier"&&r.callee.name==="jsx"){const m=r.arguments.filter(s=>s.type==="ObjectExpression"&&Array.isArray(s.properties));for(const s of m)for(const t of s.properties)t.type==="Property"&&t.key.type==="Literal"&&t.value.type==="Literal"&&e.includes(t.key.value)&&(o.overwrite(t.start-2,t.end,""),l=!0)}}}),!!l)return{code:o.toString(),map:o.generateMap({hires:!0})}}}}},"jsxRemoveAttributes");export{g as jsxRemoveAttributes};
1
+ var c=Object.defineProperty;var l=(e,a)=>c(e,"name",{value:a,configurable:!0});import{w as y}from"../packem_shared/index-Dq8IUFTs.js";import f from"magic-string";var v=Object.defineProperty,b=l((e,a)=>v(e,"name",{value:a,configurable:!0}),"l");const d=/\.[jt]sx$/,w=b(({attributes:e,logger:a})=>{if(!Array.isArray(e)||e.length===0)throw new Error("[packem:jsx-remove-attributes]: attributes must be a non-empty array of strings.");return{name:"packem:jsx-remove-attributes",transform:{filter:{id:d},handler(o,u){let i;try{i=this.parse(o,{allowReturnOutsideFunction:!0})}catch(r){this.warn({code:"PARSE_ERROR",message:`[packem:jsx-remove-attributes]: failed to parse "${u}" and remove the jsx attribute.`}),a.warn(r);return}const n=new f(o);y(i,{enter(r){if(r.type==="CallExpression"&&r.callee.type==="Identifier"&&r.callee.name==="jsx"){const m=r.arguments.filter(s=>s.type==="ObjectExpression"&&Array.isArray(s.properties));for(const s of m)for(const t of s.properties)t.type==="Property"&&t.key.type==="Literal"&&t.value.type==="Literal"&&e.includes(t.key.value)&&n.overwrite(t.start-2,t.end,"")}}});const p=n.toString();if(p!==o)return{code:p,map:n.generateMap({hires:!0})}}}}},"jsxRemoveAttributes");export{w as jsxRemoveAttributes};
@@ -1,16 +1,15 @@
1
- /**
2
- * Modified copy of https://github.com/huozhi/rollup-preserve-directives/blob/main/src/index.ts
3
- *
4
- * The MIT License (MIT)
5
- *
6
- * Copyright (c) 2018 these people -> https://github.com/huozhi/rollup-preserve-directives/graphs/contributors
7
- */
8
- import type { FilterPattern } from "@rollup/pluginutils";
9
- import type { Plugin } from "rollup";
10
- export type PreserveDirectivesPluginOptions = {
11
- directiveRegex: RegExp;
12
- exclude?: FilterPattern;
13
- include?: FilterPattern;
14
- logger: Console;
1
+ import { FilterPattern } from '@rollup/pluginutils';
2
+ import { Plugin } from 'rollup';
3
+ type PreserveDirectivesPluginOptions = {
4
+ directiveRegex: RegExp;
5
+ exclude?: FilterPattern;
6
+ include?: FilterPattern;
7
+ logger: Console;
15
8
  };
16
- export declare const preserveDirectivesPlugin: ({ directiveRegex, exclude, include, logger }: PreserveDirectivesPluginOptions) => Plugin;
9
+ declare const preserveDirectivesPlugin: ({
10
+ directiveRegex,
11
+ exclude,
12
+ include,
13
+ logger
14
+ }: PreserveDirectivesPluginOptions) => Plugin;
15
+ export { PreserveDirectivesPluginOptions, preserveDirectivesPlugin };
@@ -1,4 +1,4 @@
1
- var b=Object.defineProperty;var v=(d,o)=>b(d,"name",{value:o,configurable:!0});import{createFilter as x}from"@rollup/pluginutils";import g from"magic-string";var y=Object.defineProperty,$=v((d,o)=>y(d,"name",{value:o,configurable:!0}),"l");const S=$(({directiveRegex:d,exclude:o=[],include:m=[],logger:p})=>{const u={},f={},h=x(m,o);return{name:"packem:preserve-directives",onLog(i,t){if(t.code==="MODULE_LEVEL_DIRECTIVE"&&i==="warn")return!1},renderChunk:{handler(i,t,{sourcemap:c}){const s=t.moduleIds.map(r=>{if(u[r])return u[r]}).reduce((r,l)=>(l&&l.forEach(a=>{r.add(a)}),r),new Set),n=new g(i);s.size>0&&(p.debug({message:`directives for chunk "${t.fileName}" are preserved.`,prefix:"plugin:preserve-directives"}),n.prepend(`${Array.from(s,r=>`'${r}';`).join(`
1
+ var b=Object.defineProperty;var v=(a,p)=>b(a,"name",{value:p,configurable:!0});import{createFilter as x}from"@rollup/pluginutils";import g from"magic-string";var y=Object.defineProperty,E=v((a,p)=>y(a,"name",{value:p,configurable:!0}),"l");const S=E(({directiveRegex:a,exclude:p=[],include:m=[],logger:u})=>{const c={},l={},h=x(m,p);return{name:"packem:preserve-directives",onLog(i,r){if(r.code==="MODULE_LEVEL_DIRECTIVE"&&i==="warn")return!1},renderChunk:{handler(i,r,{sourcemap:f}){const n=r.moduleIds.map(t=>{if(c[t])return c[t]}).reduce((t,s)=>(s&&s.forEach(d=>{t.add(d)}),t),new Set),o=new g(i);n.size>0&&(u.debug({message:`directives for chunk "${r.fileName}" are preserved.`,prefix:"plugin:preserve-directives"}),o.prepend(`${Array.from(n,t=>`'${t}';`).join(`
2
2
  `)}
3
- `));let e;if(t.facadeModuleId&&typeof f[t.facadeModuleId]=="string"&&(e=f[t.facadeModuleId]),e&&(p.debug({message:`shebang for chunk "${t.fileName}" is preserved.`,prefix:"plugin:preserve-directives"}),n.prepend(`${e}
4
- `)),!(s.size===0&&e===void 0))return{code:n.toString(),map:c?n.generateMap({hires:!0}):void 0}},order:"post"},transform(i,t){if(!h(t))return;let c=!1;const s=new g(i);if(i.startsWith("#")&&i[1]==="!"){let e=0;for(let r=2,l=i.length;r<l;r++){const a=i.codePointAt(r);if(a===10||a===13||a===8232||a===8233){e=r;break}}e&&(f[t]=i.slice(0,e),s.remove(0,e+1),c=!0,p.debug({message:`shebang for module "${t}" is preserved.`,prefix:"plugin:preserve-directives"}))}let n;try{n=this.parse(s.toString(),{allowReturnOutsideFunction:!0})}catch(e){this.warn({code:"PARSE_ERROR",message:`failed to parse "${t}" and extract the directives.`}),p.warn(e);return}if(n.type==="Program"){for(const e of n.body.filter(Boolean)){if(e.type!=="ExpressionStatement")break;let r;"directive"in e?r=e.directive:e.expression.type==="Literal"&&typeof e.expression.value=="string"&&d.test(e.expression.value)&&(r=e.expression.value),r!=="use strict"&&r&&(u[t]||=new Set,u[t].add(r),"start"in e&&typeof e.start=="number"&&"end"in e&&typeof e.end=="number"&&(s.remove(e.start,e.end),c=!0),p.debug({message:`directive "${r}" for module "${t}" is preserved.`,prefix:"plugin:preserve-directives"}))}if(c)return{code:s.toString(),map:s.generateMap({hires:!0}),meta:{preserveDirectives:{directives:[...u[t]??[]],shebang:f[t]??void 0}}}}}}},"preserveDirectivesPlugin");export{S as preserveDirectivesPlugin};
3
+ `));let e;if(r.facadeModuleId&&typeof l[r.facadeModuleId]=="string"&&(e=l[r.facadeModuleId]),e&&(u.debug({message:`shebang for chunk "${r.fileName}" is preserved.`,prefix:"plugin:preserve-directives"}),o.prepend(`${e}
4
+ `)),!(n.size===0&&e===void 0))return{code:o.toString(),map:f?o.generateMap({hires:!0}):void 0}},order:"post"},transform(i,r){if(!h(r))return;let f=!1;const n=new g(i);if(i.startsWith("#")&&i[1]==="!"){let e=0;for(let t=i.length,s=2;s<t;s+=1){const d=i.codePointAt(s);if(d===10||d===13||d===8232||d===8233){e=s;break}}e&&(l[r]=i.slice(0,e),n.remove(0,e+1),f=!0,u.debug({message:`shebang for module "${r}" is preserved.`,prefix:"plugin:preserve-directives"}))}let o;try{o=this.parse(n.toString(),{allowReturnOutsideFunction:!0})}catch(e){this.warn({code:"PARSE_ERROR",message:`failed to parse "${r}" and extract the directives.`}),u.warn(e);return}for(const e of o.body.filter(Boolean)){if(e.type!=="ExpressionStatement")break;let t;if("directive"in e?t=e.directive:e.expression.type==="Literal"&&typeof e.expression.value=="string"&&a.test(e.expression.value)&&(t=e.expression.value),t!=="use strict"&&t){const s=c[r];s?s.add(t):c[r]=new Set([t]),"start"in e&&typeof e.start=="number"&&"end"in e&&typeof e.end=="number"&&(n.remove(e.start,e.end),f=!0),u.debug({message:`directive "${t}" for module "${r}" is preserved.`,prefix:"plugin:preserve-directives"})}}if(f)return{code:n.toString(),map:n.generateMap({hires:!0}),meta:{preserveDirectives:{directives:[...c[r]??[]],shebang:l[r]??void 0}}}}}},"preserveDirectivesPlugin");export{S as preserveDirectivesPlugin};
@@ -1,11 +1,12 @@
1
- import type { Plugin } from "rollup";
1
+ import { Plugin } from 'rollup';
2
2
  /**
3
- * A Rollup plugin that adds `/*@__PURE__*\/` annotations before `new Constructor(...)` expressions
4
- * for a given list of constructor names. This allows tree-shaking of unused instantiations.
5
- *
6
- * `rollup-plugin-pure` only handles `CallExpression` nodes; this plugin handles `NewExpression`.
7
- */
8
- export declare const pureNewExpressionPlugin: (options: {
9
- constructors: string[];
10
- sourcemap?: boolean;
3
+ * A Rollup plugin that adds `/*@__PURE__*\/` annotations before `new Constructor(...)` expressions
4
+ * for a given list of constructor names. This allows tree-shaking of unused instantiations.
5
+ *
6
+ * `rollup-plugin-pure` only handles `CallExpression` nodes; this plugin handles `NewExpression`.
7
+ */
8
+ declare const pureNewExpressionPlugin: (options: {
9
+ constructors: string[];
10
+ sourcemap?: boolean;
11
11
  }) => Plugin;
12
+ export { pureNewExpressionPlugin };
@@ -0,0 +1 @@
1
+ var m=Object.defineProperty;var c=(r,e)=>m(r,"name",{value:e,configurable:!0});import{w as d}from"../packem_shared/index-Dq8IUFTs.js";import w from"magic-string";var y=Object.defineProperty,g=c((r,e)=>y(r,"name",{value:e,configurable:!0}),"l");const _=g(r=>{const e=new Set(r.constructors.filter(t=>!t.includes(".")));return{name:"packem:pure-new-expression",transform:{handler(t){if(e.size===0)return;let a=!1;for(const o of e)if(t.includes(o)){a=!0;break}if(!a)return;let i;try{i=this.parse(t)}catch{return}const s=new w(t);d(i,{enter(o){const n=o,u=n.callee?.name,l=o._rollupAnnotations;n.type==="NewExpression"&&n.callee?.type==="Identifier"&&typeof u=="string"&&e.has(u)&&!l?.some(f=>f.type==="pure")&&typeof n.start=="number"&&s.prependLeft(n.start,"/* @__PURE__ */ ")}});const p=s.toString();if(p!==t)return{code:p,map:r.sourcemap?s.generateMap({hires:!0}):void 0}},order:"post"}}},"pureNewExpressionPlugin");export{_ as pureNewExpressionPlugin};
@@ -1,8 +1,102 @@
1
- import type { FilterPattern } from "@rollup/pluginutils";
2
- import type { Options } from "sucrase";
3
- import type { TransformerFn as TransformerFunction } from "../../types.d.ts";
4
- export interface SucrasePluginConfig extends Options {
5
- exclude?: FilterPattern;
6
- include?: FilterPattern;
1
+ import { FilterPattern } from '@rollup/pluginutils';
2
+ import '@visulima/packem-share/utils';
3
+ import 'rollup';
4
+ import { T as TransformerFn } from "../../packem_shared/types.d-DrgzeMBs.d-CG9J1x6q.js";
5
+ import '@visulima/packem-share/types';
6
+ import '@rollup/plugin-alias';
7
+ import '@visulima/package';
8
+ type Transform = "jsx" | "typescript" | "flow" | "imports" | "react-hot-loader" | "jest";
9
+ interface SourceMapOptions {
10
+ /**
11
+ * The name to use in the "file" field of the source map. This should be the name of the compiled
12
+ * file.
13
+ */
14
+ compiledFilename: string;
7
15
  }
8
- export declare const sucrasePlugin: TransformerFunction;
16
+ interface Options {
17
+ /**
18
+ * Unordered array of transform names describing both the allowed syntax
19
+ * (where applicable) and the transformation behavior.
20
+ */
21
+ transforms: Array<Transform>;
22
+ /**
23
+ * Opts out of all ES syntax transformations: optional chaining, nullish
24
+ * coalescing, class fields, numeric separators, optional catch binding.
25
+ */
26
+ disableESTransforms?: boolean;
27
+ /**
28
+ * Transformation mode for the JSX transform.
29
+ * - "classic" refers to the original behavior using `React.createElement`.
30
+ * - "automatic" refers to the transform behavior released with React 17,
31
+ * where the `jsx` function (or a variation) is automatically imported.
32
+ * - "preserve" leaves the JSX as-is.
33
+ *
34
+ * Default value: "classic".
35
+ */
36
+ jsxRuntime?: "classic" | "automatic" | "preserve";
37
+ /**
38
+ * Compile code for production use. Currently only applies to the JSX
39
+ * transform.
40
+ */
41
+ production?: boolean;
42
+ /**
43
+ * If specified, import path prefix to use in place of "react" when compiling
44
+ * JSX with the automatic runtime.
45
+ */
46
+ jsxImportSource?: string;
47
+ /**
48
+ * If specified, function name to use in place of React.createClass when
49
+ * compiling JSX with the classic runtime.
50
+ */
51
+ jsxPragma?: string;
52
+ /**
53
+ * If specified, function name to use in place of React.Fragment when
54
+ * compiling JSX with the classic runtime.
55
+ */
56
+ jsxFragmentPragma?: string;
57
+ /**
58
+ * If specified, disable automatic removal of type-only import and export
59
+ * statements and names. Only statements and names that explicitly use the
60
+ * `type` keyword are removed.
61
+ */
62
+ keepUnusedImports?: boolean;
63
+ /**
64
+ * If specified, the imports transform does not attempt to change dynamic
65
+ * import() expressions into require() calls.
66
+ */
67
+ preserveDynamicImport?: boolean;
68
+ /**
69
+ * Only relevant when targeting ESM (i.e. when the imports transform is *not*
70
+ * specified). This flag changes the behavior of TS require imports:
71
+ *
72
+ * import Foo = require("foo");
73
+ *
74
+ * to import createRequire, create a require function, and use that function.
75
+ * This is the TS behavior with module: nodenext and makes it easier for the
76
+ * same code to target ESM and CJS.
77
+ */
78
+ injectCreateRequireForImportRequire?: boolean;
79
+ /**
80
+ * If true, replicate the import behavior of TypeScript's esModuleInterop: false.
81
+ */
82
+ enableLegacyTypeScriptModuleInterop?: boolean;
83
+ /**
84
+ * If true, replicate the import behavior Babel 5 and babel-plugin-add-module-exports.
85
+ */
86
+ enableLegacyBabel5ModuleInterop?: boolean;
87
+ /**
88
+ * If specified, we also return a RawSourceMap object alongside the code.
89
+ * filePath must be specified if this option is enabled.
90
+ */
91
+ sourceMapOptions?: SourceMapOptions;
92
+ /**
93
+ * File path to use in error messages, React display names, and source maps.
94
+ */
95
+ filePath?: string;
96
+ }
97
+ interface SucrasePluginConfig extends Options {
98
+ exclude?: FilterPattern;
99
+ include?: FilterPattern;
100
+ }
101
+ declare const sucrasePlugin: TransformerFn<SucrasePluginConfig>;
102
+ export { SucrasePluginConfig, sucrasePlugin };
@@ -1 +1 @@
1
- var i=Object.defineProperty;var a=(r,e)=>i(r,"name",{value:e,configurable:!0});import{createFilter as p}from"@rollup/pluginutils";import{EXCLUDE_REGEXP as f}from"@visulima/packem-share/constants";import{transform as l}from"sucrase";var d=Object.defineProperty,E=a((r,e)=>d(r,"name",{value:e,configurable:!0}),"n");const n=E(({exclude:r,include:e,...c})=>{const s=p(e,r??f);return{name:"packem:sucrase",async transform(t,o){if(!s(o))return;const{code:u,sourceMap:m}=l(t,{...c,filePath:o,sourceMapOptions:{compiledFilename:o}});return{code:u,map:m}}}},"sucraseTransformPlugin");n.NAME="sucrase";const b=n;export{b as sucrasePlugin};
1
+ var i=Object.defineProperty;var t=(r,e)=>i(r,"name",{value:e,configurable:!0});import{createFilter as l}from"@rollup/pluginutils";import{EXCLUDE_REGEXP as p}from"@visulima/packem-share/constants";import{transform as f}from"sucrase";var d=Object.defineProperty,E=t((r,e)=>d(r,"name",{value:e,configurable:!0}),"t");const a=E(({exclude:r,include:e,...c})=>{const s=l(e,r??p);return{name:"packem:sucrase",transform(n,o){if(!s(o))return;const{code:u,sourceMap:m}=f(n,{...c,filePath:o,sourceMapOptions:{compiledFilename:o}});return{code:u,map:m}}}},"sucraseTransformPlugin");a.NAME="sucrase";const b=a;export{b as sucrasePlugin};
@@ -1,2 +1,11 @@
1
- export { default as swcPlugin } from "./swc-plugin.d.ts";
2
- export type * from "./types.d.ts";
1
+ import '@visulima/packem-share/utils';
2
+ import 'rollup';
3
+ import { T as TransformerFn } from "../../packem_shared/types.d-DrgzeMBs.d-CG9J1x6q.js";
4
+ import '@visulima/packem-share/types';
5
+ import '@rollup/plugin-alias';
6
+ import '@visulima/package';
7
+ import { S as SwcPluginConfig } from "../../packem_shared/types.d-Dmpk2asd.js";
8
+ import '@rollup/pluginutils';
9
+ import '@swc/types';
10
+ declare const _default: TransformerFn<SwcPluginConfig>;
11
+ export { SwcPluginConfig, _default as swcPlugin };
@@ -1 +1 @@
1
- import{default as f}from"../../packem_shared/swcPlugin-Boip4lWG.js";export{f as swcPlugin};
1
+ import{default as f}from"../../packem_shared/swcPlugin-DBBN5mct.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.65",
3
+ "version": "1.0.0-alpha.67",
4
4
  "description": "Rollup plugins for packem",
5
5
  "keywords": [
6
6
  "visulima",
@@ -37,10 +37,6 @@
37
37
  "types": "./dist/index.d.ts",
38
38
  "default": "./dist/index.js"
39
39
  },
40
- "./babel": {
41
- "types": "./dist/plugins/babel/index.d.ts",
42
- "default": "./dist/plugins/babel/index.js"
43
- },
44
40
  "./esbuild": {
45
41
  "types": "./dist/plugins/esbuild/index.d.ts",
46
42
  "default": "./dist/plugins/esbuild/index.js"
@@ -49,89 +45,33 @@
49
45
  "types": "./dist/plugins/swc/index.d.ts",
50
46
  "default": "./dist/plugins/swc/index.js"
51
47
  },
52
- "./typescript": {
53
- "types": "./dist/plugins/typescript/index.d.ts",
54
- "default": "./dist/plugins/typescript/index.js"
55
- },
56
- "./oxc": {
57
- "types": "./dist/plugins/oxc/index.d.ts",
58
- "default": "./dist/plugins/oxc/index.js"
59
- },
60
48
  "./sucrase": {
61
49
  "types": "./dist/plugins/sucrase/index.d.ts",
62
50
  "default": "./dist/plugins/sucrase/index.js"
63
51
  },
64
- "./plugin/minify-html-literals": {
65
- "types": "./dist/plugins/minify-html-literals/index.d.ts",
66
- "default": "./dist/plugins/minify-html-literals/index.js"
67
- },
68
- "./plugin/require-cjs-transformer": {
69
- "types": "./dist/plugins/require-cjs-transformer.d.ts",
70
- "default": "./dist/plugins/require-cjs-transformer.js"
52
+ "./plugin/chunk-splitter": {
53
+ "types": "./dist/plugins/chunk-splitter/index.d.ts",
54
+ "default": "./dist/plugins/chunk-splitter/index.js"
71
55
  },
72
56
  "./plugin/cjs-interop": {
73
57
  "types": "./dist/plugins/cjs-interop.d.ts",
74
58
  "default": "./dist/plugins/cjs-interop.js"
75
59
  },
76
- "./plugin/copy": {
77
- "types": "./dist/plugins/copy.d.ts",
78
- "default": "./dist/plugins/copy.js"
79
- },
80
- "./plugin/data-uri": {
81
- "types": "./dist/plugins/data-uri.d.ts",
82
- "default": "./dist/plugins/data-uri.js"
83
- },
84
- "./plugin/debarrel": {
85
- "types": "./dist/plugins/debarrel.d.ts",
86
- "default": "./dist/plugins/debarrel.js"
87
- },
88
- "./plugin/esm-shim-cjs-syntax": {
89
- "types": "./dist/plugins/esm-shim-cjs-syntax.d.ts",
90
- "default": "./dist/plugins/esm-shim-cjs-syntax.js"
91
- },
92
- "./plugin/fix-dts-default-cjs-exports": {
93
- "types": "./dist/plugins/fix-dts-default-cjs-exports.d.ts",
94
- "default": "./dist/plugins/fix-dts-default-cjs-exports.js"
60
+ "./plugin/json": {
61
+ "types": "./dist/plugins/json.d.ts",
62
+ "default": "./dist/plugins/json.js"
95
63
  },
96
64
  "./plugin/jsx-remove-attributes": {
97
65
  "types": "./dist/plugins/jsx-remove-attributes.d.ts",
98
66
  "default": "./dist/plugins/jsx-remove-attributes.js"
99
67
  },
100
- "./plugin/license": {
101
- "types": "./dist/plugins/license.d.ts",
102
- "default": "./dist/plugins/license.js"
103
- },
104
- "./plugin/native-modules": {
105
- "types": "./dist/plugins/native-modules-plugin.d.ts",
106
- "default": "./dist/plugins/native-modules-plugin.js"
107
- },
108
68
  "./plugin/preserve-directives": {
109
69
  "types": "./dist/plugins/preserve-directives.d.ts",
110
70
  "default": "./dist/plugins/preserve-directives.js"
111
71
  },
112
- "./plugin/raw": {
113
- "types": "./dist/plugins/raw.d.ts",
114
- "default": "./dist/plugins/raw.js"
115
- },
116
- "./plugin/shebang": {
117
- "types": "./dist/plugins/shebang.d.ts",
118
- "default": "./dist/plugins/shebang.js"
119
- },
120
- "./plugin/source-maps": {
121
- "types": "./dist/plugins/source-maps.d.ts",
122
- "default": "./dist/plugins/source-maps.js"
123
- },
124
- "./plugin/url": {
125
- "types": "./dist/plugins/url.d.ts",
126
- "default": "./dist/plugins/url.js"
127
- },
128
- "./plugin/import-attributes": {
129
- "types": "./dist/plugins/import-attributes.d.ts",
130
- "default": "./dist/plugins/import-attributes.js"
131
- },
132
- "./plugin/json": {
133
- "types": "./dist/plugins/json.d.ts",
134
- "default": "./dist/plugins/json.js"
72
+ "./plugin/pure-new-expression": {
73
+ "types": "./dist/plugins/pure-new-expression-plugin.d.ts",
74
+ "default": "./dist/plugins/pure-new-expression-plugin.js"
135
75
  },
136
76
  "./package.json": "./package.json"
137
77
  },
@@ -141,69 +81,46 @@
141
81
  "dist"
142
82
  ],
143
83
  "dependencies": {
144
- "@babel/parser": "7.29.2",
145
84
  "@rollup/plugin-alias": "6.0.0",
146
- "@rollup/plugin-commonjs": "29.0.2",
85
+ "@rollup/plugin-commonjs": "29.0.3",
147
86
  "@rollup/plugin-dynamic-import-vars": "2.1.5",
148
87
  "@rollup/plugin-inject": "5.0.5",
149
88
  "@rollup/plugin-json": "6.1.0",
150
89
  "@rollup/plugin-node-resolve": "16.0.3",
151
90
  "@rollup/plugin-replace": "6.0.3",
152
91
  "@rollup/plugin-wasm": "6.2.2",
153
- "@rollup/pluginutils": "5.3.0",
92
+ "@rollup/pluginutils": "5.4.0",
154
93
  "@visulima/find-cache-dir": "3.0.0-alpha.9",
155
- "@visulima/fs": "5.0.0-alpha.12",
156
- "@visulima/package": "5.0.0-alpha.11",
157
- "@visulima/packem-share": "1.0.0-alpha.46",
94
+ "@visulima/fs": "5.0.0-alpha.24",
95
+ "@visulima/package": "5.0.0-alpha.23",
96
+ "@visulima/packem-share": "1.0.0-alpha.47",
158
97
  "@visulima/path": "3.0.0-alpha.10",
159
- "@visulima/rollup-plugin-dts": "1.0.0-alpha.26",
160
- "@visulima/source-map": "3.0.0-alpha.9",
161
- "cjs-module-lexer": "2.2.0",
98
+ "@visulima/rollup-plugin-dts": "1.0.0-alpha.28",
162
99
  "clean-css": "^5.3.3",
163
- "glob-parent": "6.0.2",
164
- "html-minifier-next": "6.1.2",
100
+ "html-minifier-next": "6.2.7",
165
101
  "magic-string": "0.30.21",
166
- "mlly": "1.8.2",
167
- "oxc-parser": "0.127.0",
168
- "oxc-resolver": "11.19.1",
169
- "rollup-plugin-license": "3.7.1",
102
+ "oxc-resolver": "11.20.0",
103
+ "rollup-plugin-import-trace": "1.0.1",
170
104
  "rollup-plugin-polyfill-node": "0.13.0",
171
105
  "rollup-plugin-pure": "^0.4.0",
172
106
  "rollup-plugin-visualizer": "7.0.1",
173
- "rs-module-lexer": "2.8.0",
174
- "semver": "7.7.4",
175
- "tinyglobby": "0.2.16"
107
+ "rs-module-lexer": "2.8.0"
176
108
  },
177
109
  "peerDependencies": {
178
- "@babel/core": "*",
179
110
  "@swc/core": "*",
180
111
  "esbuild": "*",
181
- "oxc-transform": "*",
182
- "rollup": ">=4",
183
- "sucrase": "*",
184
- "typescript": "^5.0.0 || ^6.0.0"
112
+ "rollup": ">=4.60.4",
113
+ "sucrase": "*"
185
114
  },
186
115
  "peerDependenciesMeta": {
187
- "@babel/core": {
188
- "optional": true
189
- },
190
116
  "@swc/core": {
191
117
  "optional": true
192
118
  },
193
119
  "esbuild": {
194
120
  "optional": true
195
121
  },
196
- "oxc-transform": {
197
- "optional": true
198
- },
199
- "p-queue": {
200
- "optional": true
201
- },
202
122
  "sucrase": {
203
123
  "optional": true
204
- },
205
- "typescript": {
206
- "optional": true
207
124
  }
208
125
  },
209
126
  "engines": {
@@ -1 +0,0 @@
1
- var o=Object.defineProperty;var a=(s,i)=>o(s,"name",{value:i,configurable:!0});var t=Object.defineProperty,d=a((s,i)=>t(s,"name",{value:i,configurable:!0}),"r");const n=new Set(["chrome","edge","es","firefox","ie","ios","node","opera","safari"]),l=["android 4"],f={android:"chrome",ios_saf:"ios"},c=" ",p=d(s=>{let i=s.filter(e=>!l.some(r=>e.startsWith(r))).map(e=>e.split(c)).map(([e,r])=>[f[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])=>/^\d+(?:\.\d+)*$/.test(e)).filter(([e])=>n.has(e));return i=Object.entries(Object.fromEntries(i)),i.map(([e,r])=>`${e}${r}`)},"browserslistToEsbuild");export{p as default};
@@ -1 +0,0 @@
1
- var S=Object.defineProperty;var v=(e,t)=>S(e,"name",{value:t,configurable:!0});import{isAccessibleSync as k,readFileSync as j}from"@visulima/fs";import{join as d}from"@visulima/path";import{getHash as o}from"@visulima/packem-share/utils";var F=Object.defineProperty,b=v((e,t)=>F(e,"name",{value:t,configurable:!0}),"_");const h=b(e=>e.handler||e,"getHandler"),m=b(e=>e&&typeof e=="object"&&e.__packem_cache_wrapped===!0?e.data:e,"unwrapCachedValue"),W=b((e,t,p="")=>({...e,async buildEnd(a){e.buildEnd&&await h(e.buildEnd).call(this,a)},async buildStart(a){e.buildStart&&await h(e.buildStart).call(this,a)},async load(a){if(!e.load)return;const i=d(p,e.name),r=a.includes("?")?a.split("?")[0]:a;let n="";try{if(r&&k(r)){const u=j(r);n=o(u)}}catch{}const c=d("load",o(a),n);if(t.has(c,i))return m(await t.get(c,i));const s=await h(e.load).call(this,a),_=s&&typeof s=="object"&&"code"in s?s:{__packem_cache_wrapped:!0,data:s};return t.set(c,_,i),s},name:`cached(${e.name})`,async resolveId(a,i,r){if(!e.resolveId)return;const n=d(p,e.name),c=d("resolveId",o(a),i?o(i):"",o(JSON.stringify(r)));if(t.has(c,n))return m(await t.get(c,n));const s=await h(e.resolveId).call(this,a,i,r);return t.set(c,s,n),s},async transform(a,i){if(!e.transform)return;const r=d(p,e.name),n=d("transform",o(i),o(a));if(t.has(n,r)){const l=m(await t.get(n,r));if(l!==null&&typeof l=="object"&&Array.isArray(l.__packem_watch_files)){const f=l;for(const w of f.__packem_watch_files)this.addWatchFile(w);return m(f.result)}return l}const c=[],s=this,_=new Proxy(this,{get(l,f,w){if(f==="addWatchFile")return g=>{c.push(g),s.addWatchFile(g)};const y=Reflect.get(l,f,w);return typeof y=="function"?y.bind(l):y}}),u=await h(e.transform).call(_,a,i);return c.length>0?t.set(n,{__packem_watch_files:c,result:u},r):t.set(n,u,r),u}}),"cachePlugin");export{W as default};
@@ -1 +0,0 @@
1
- var m=Object.defineProperty;var d=(e,a)=>m(e,"name",{value:a,configurable:!0});import c from"node:assert/strict";import{extractAssignedNames as u}from"@rollup/pluginutils";var y=Object.defineProperty,n=d((e,a)=>y(e,"name",{value:a,configurable:!0}),"r$1");const x=n(function*(e){switch(e.declaration?.type){case"ClassDeclaration":case"FunctionDeclaration":{const{id:a}=e.declaration;c.ok(a,"Expected class/function to have a name"),yield a.name;break}case"VariableDeclaration":{for(const a of e.declaration.declarations)for(const o of u(a.id))yield o;break}}},"exportName"),N=n(function*(e){if(e.declaration)for(const a of x(e))yield{exportedName:a,from:"self",type:"named"};else if(e.source)yield{bindings:e.specifiers.map(a=>({exportedName:a.exported.name,importedName:a.local.name})),from:"other",source:e.source.value,type:"named"};else for(const a of e.specifiers)yield{exportedName:a.exported.name,from:"self",type:"named"}},"parseExportNamed"),b=n(function*(e){e.exported?yield{exportedName:e.exported.name,from:"self",type:"named"}:yield{from:"other",source:e.source.value,type:"barrel"}},"parseExportAll"),h=n(function*(){yield{exportedName:"default",from:"self",type:"named"}},"parseExportDefault"),v=n(function*(e,a){c.ok(a.code!=null,`Module ${a.id} doesn't have associated code`);const o=e.parse(a.code);for(const r of o.body)switch(r.type){case"ExportAllDeclaration":{yield*b(r);break}case"ExportDefaultDeclaration":{yield*h();break}case"ExportNamedDeclaration":{yield*N(r);break}}},"parseExports");var g=Object.defineProperty,i=d((e,a)=>g(e,"name",{value:a,configurable:!0}),"n$1");const f=i(async function(e,a,o){const r=await e.resolve(a,o.id);if(c.ok(r,`Rollup can't resolve ${a} from ${o.id}`),r.external)return;const s=await e.load(r);return c.ok(s,`Rollup doesn't have a module for id ${r.id}`),s},"getImportedModule"),k=i(async function*(e,a,o){const r=await f(e,a.source,o);r&&(yield*l(e,r))},"gatherBarrelReExports"),E=i(async function*(e,a,o){const r=await f(e,a.source,o);if(!r)return;const s=new Map(a.bindings.map(t=>[t.importedName,t]));for await(const t of l(e,r)){const p=s.get(t.exportedName);p&&(yield{...t,exportedName:p.exportedName})}},"gatherNamedReExports"),$=i(async function*(e,a){yield{exportedName:a.exportedName,id:e.id,sourceName:a.exportedName}},"gatherNamedSelfExports"),l=i(async function*(e,a){for(const o of v(e,a))o.from==="self"?yield*$(a,o):o.type==="barrel"?yield*k(e,o,a):yield*E(e,o,a)},"gatherExports");var w=Object.defineProperty,D=d((e,a)=>w(e,"name",{value:a,configurable:!0}),"r");const A=D(()=>({moduleParsed:{async handler(e){if(e.isEntry)for await(const a of l(this,e))a.id!==e.id&&this.emitFile({id:a.id,name:a.exportedName,preserveSignature:"exports-only",type:"chunk"})},order:"post"},name:"packem:chunk-splitter"}),"chunkSplitter");export{A as default};
@@ -1 +0,0 @@
1
- var y=Object.defineProperty;var w=(e,n)=>y(e,"name",{value:n,configurable:!0});import{memoize as b}from"@visulima/packem-share/utils";import{basename as M,extname as I}from"@visulima/path";import k from"./getCustomModuleLayer-d8i66lfh.js";import d from"./getModuleLayer-rF9RxnJ5.js";var x=Object.defineProperty,p=w((e,n)=>x(e,"name",{value:n,configurable:!0}),"c");const S=b(e=>{let n=0;for(let o=0;o<e.length;o+=1)n=(n<<5)-n+e.codePointAt(o);return(n>>>0).toString(36).slice(0,3)}),v=p((e,n,o=new Set)=>{if(o.has(e))return;o.add(e);const t=n(e);if(!t)return;const s=d(t.meta);if(s)return s;for(const u of t.importers){const f=v(u,n,o);if(f)return f}},"getEffectiveModuleLayer"),E=p((e,n)=>{const o=n(e);if(!o)return new Set;const t=new Set;for(const s of o.importers){const u=n(s);if(!u)continue;const f=d(u.meta);if(f)t.add(f);else{const a=v(s,n,new Set([e]));a&&t.add(a)}}return t},"getImporterLayers"),A=p((e,n)=>{const o=new Map;return p(function(t,s){if(/[\\/]node_modules[\\/]@swc[\\/]helper/.test(t))return"cc";const u=s.getModuleInfo(t);if(!u)return;const{isEntry:f}=u,a=u.meta;let i=d(a);if(i&&(i=S(i)),!f){const c=o.get(t);if(c)return c;const r=k(t);if(r)return o.set(t,r),r}if(f){const c=s.getModuleIds();for(const r of c)s.getModuleInfo(r)&&d(a)===i&&(e.has(r)||e.set(r,new Set),e.get(r).add([t,i]))}if(!i&&!f){const c=E(t,s.getModuleInfo);if(c.size>1){if(o.has(t))return o.get(t);const r=M(t,I(t)),h=[...c].toSorted().join("-"),m=`${r}-${S(h)}`;return o.set(t,m),m}}if(i&&!f&&e.has(t)){const c=[...e.get(t)];if(c.some(([l])=>{if(n.some(g=>g.path===l)){const g=s.getModuleInfo(l);return d(g?g.meta:{})===i}return!1}))return;if(c.every(([,l])=>l===i))return o.has(t)?o.get(t):void 0;const r=M(t,I(t)),h=S(i),m=`${r}-${h}`;return o.set(t,m),m}},"splitChunks")},"createSplitChunks");export{A as default};
@@ -1 +0,0 @@
1
- var j=Object.defineProperty;var d=(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 E}from"@visulima/path";import{formatMessages as M,transform as y,build as A}from"esbuild";import{findCacheDirSync as S}from"@visulima/find-cache-dir";import{readFileSync as $}from"@visulima/fs";import*as P from"rs-module-lexer";var R=Object.defineProperty,F=d((e,r)=>R(e,"name",{value:r,configurable:!0}),"n$1");const D=F(async(e,r)=>{r.length>0&&(await M(r,{color:!0,kind:"warning"})).forEach(s=>e.warn(s))},"warn");var C=Object.defineProperty,_=d((e,r)=>C(e,"name",{value:r,configurable:!0}),"t");const L=_(e=>{if(e==="es")return"esm";if(e==="cjs")return e},"getEsbuildFormat"),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 y(s,{format:t,loader:"js",sourcemap:e,...r});if(await D(this,c.warnings),c.code)return{code:c.code,map:c.map||void 0}}},"getRenderChunk");var I=Object.defineProperty,z=d((e,r)=>I(e,"name",{value:r,configurable:!0}),"n");const w=z(e=>e.replaceAll("\\","/"),"slash"),{parseAsync:T}=P,q=z(async e=>{const r=S("@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 A({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=$(t),{output:g}=await T({input:[{code:p,filename:t}]});return{contents:(g[0]?.exports??[]).length>0?`export * from '${w(t)}'`:`module.exports = require('${w(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 N=Object.defineProperty,U=d((e,r)=>N(e,"name",{value:r,configurable:!0}),"b");const B=U(({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 u=a.startsWith(".")?a:`.${a}`;typeof o=="string"?p[u]=o:o||delete p[u]}const g=Object.keys(p),v=new RegExp(String.raw`\.(${g.map(a=>a.slice(1)).join("|")})$`),h=r||e?x(r??v,e):void 0;let l,b=process.cwd();return{async buildStart(){!i||l||(l=await q({cwd:b,sourceMap:t??!1,...i}),n.debug("optimized %O",l.optimized))},name:"packem:esbuild",options({context:a}){a&&(b=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}},transform:{filter:{id:v},async handler(a,o){if(h&&!h(o)||l?.optimized.has(o))return;const u=E(o),m=p[u];if(n.debug("transforming %s with %s loader",o,m),!m)return;const f=await y(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 D(this,f.warnings),f.code)return{code:f.code,map:f.map||void 0}}}}},"esbuildTransformer");B.NAME="esbuild";export{B as default};
@@ -1 +0,0 @@
1
- var u=Object.defineProperty;var c=(e,t)=>u(e,"name",{value:t,configurable:!0});import d from"magic-string";var g=Object.defineProperty,x=c((e,t)=>g(e,"name",{value:t,configurable:!0}),"c");const j=x(()=>({name:"packem:fix-dynamic-import-extension",renderChunk(e,t,r){if(r.format==="es"||r.format==="cjs"){const o=new d(e),f=r.format==="es"?"mjs":"cjs",l=/(import\(.*?)(?<!\.d)(\.ts)(?=['´"`]\))/g;let a=!1,n;for(;(n=l.exec(e))!==null;){const[,i,m]=n;if(i&&m){const s=n.index+i.length,p=s+m.length;o.overwrite(s,p,`.${f}`),a=!0}}if(a)return{code:o.toString(),map:r.sourcemap?o.generateMap({hires:!0}):void 0}}}}),"fixDynamicImportExtension");export{j as default};
@@ -1 +0,0 @@
1
- var s=Object.defineProperty;var n=(t,e)=>s(t,"name",{value:e,configurable:!0});import{DEFAULT_EXTENSIONS as l}from"@visulima/packem-share/constants";import{basename as u}from"@visulima/path";var c=Object.defineProperty,m=n((t,e)=>c(t,"name",{value:e,configurable:!0}),"s");const d=m(t=>{const e=u(t).split(".");if(e.length>=2){const[o,a]=e.slice(-2),i=e[0],r=/^(\w+)-runtime$/.exec(o)?.[1];if(l.includes(a)&&r&&r.length>0)return`${i}-${r}`}},"getCustomModuleLayer");export{d as default};
@@ -1 +0,0 @@
1
- var i=Object.defineProperty;var t=(r,e)=>i(r,"name",{value:e,configurable:!0});var a=Object.defineProperty,s=t((r,e)=>a(r,"name",{value:e,configurable:!0}),"i");const v=s(r=>(r.preserveDirectives||{directives:[]}).directives.map(e=>e.replace(/^use /,"")).find(e=>e!=="strict"),"getModuleLayer");export{v as default};