@visulima/packem-rollup 1.0.0-alpha.7 → 1.0.0-alpha.71

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 (85) hide show
  1. package/CHANGELOG.md +704 -0
  2. package/LICENSE.md +8 -791
  3. package/README.md +89 -2
  4. package/dist/index.d.ts +752 -51
  5. package/dist/index.js +1 -0
  6. package/dist/packem_shared/browserslistToEsbuild-HD6SaWPt.js +1 -0
  7. package/dist/packem_shared/esbuildPlugin-BStpbA6S.js +1 -0
  8. package/dist/packem_shared/swcPlugin-DBBN5mct.js +1 -0
  9. package/dist/packem_shared/types.d-Dmpk2asd.d.ts +7 -0
  10. package/dist/packem_shared/types.d-DrgzeMBs.d-CG9J1x6q.d.ts +6 -0
  11. package/dist/packem_shared/types.d-KBgVO47q.d.ts +658 -0
  12. package/dist/plugins/chunk-splitter/index.d.ts +3 -0
  13. package/dist/plugins/chunk-splitter/index.js +1 -0
  14. package/dist/plugins/cjs-interop.d.ts +11 -0
  15. package/dist/plugins/cjs-interop.js +2 -0
  16. package/dist/plugins/esbuild/index.d.ts +9 -23
  17. package/dist/plugins/esbuild/index.js +1 -0
  18. package/dist/plugins/json.d.ts +5 -0
  19. package/dist/plugins/json.js +1 -0
  20. package/dist/plugins/jsx-remove-attributes.d.ts +11 -0
  21. package/dist/plugins/jsx-remove-attributes.js +1 -0
  22. package/dist/plugins/preserve-directives.d.ts +15 -0
  23. package/dist/plugins/preserve-directives.js +4 -0
  24. package/dist/plugins/pure-new-expression-plugin.d.ts +12 -0
  25. package/dist/plugins/pure-new-expression-plugin.js +1 -0
  26. package/dist/plugins/sucrase/index.d.ts +100 -17
  27. package/dist/plugins/sucrase/index.js +1 -0
  28. package/dist/plugins/swc/index.d.ts +9 -24
  29. package/dist/plugins/swc/index.js +1 -0
  30. package/package.json +52 -53
  31. package/dist/index.d.mts +0 -56
  32. package/dist/index.mjs +0 -1
  33. package/dist/packem_shared/browserslist-to-esbuild-DY9HwYtp.d.mts +0 -3
  34. package/dist/packem_shared/browserslist-to-esbuild-DY9HwYtp.d.ts +0 -3
  35. package/dist/packem_shared/browserslistToEsbuild-C0IWmbNe.mjs +0 -1
  36. package/dist/packem_shared/cachingPlugin-D0BBFJPD.mjs +0 -1
  37. package/dist/packem_shared/chunkSplitter-DWAy1JkE.mjs +0 -1
  38. package/dist/packem_shared/cjsInteropPlugin-D5wyoQ_B.mjs +0 -2
  39. package/dist/packem_shared/copyPlugin--6RITp1-.mjs +0 -1
  40. package/dist/packem_shared/createSplitChunks-CGDk55G3.mjs +0 -1
  41. package/dist/packem_shared/dataUriPlugin-BOjv6O2O.mjs +0 -1
  42. package/dist/packem_shared/esbuildPlugin-BAwyhG6L.mjs +0 -1
  43. package/dist/packem_shared/esmShimCjsSyntaxPlugin-DjKqX4DE.mjs +0 -11
  44. package/dist/packem_shared/fix-dts-default-cjs-exports-BQc0nwIG.mjs +0 -26
  45. package/dist/packem_shared/fixDtsDefaultCjsExportsPlugin-Dp1UcHVR.mjs +0 -1
  46. package/dist/packem_shared/fixDynamicImportExtension-BBGNRniz.mjs +0 -1
  47. package/dist/packem_shared/getCustomModuleLayer-d8i66lfh.mjs +0 -1
  48. package/dist/packem_shared/getModuleLayer-rF9RxnJ5.mjs +0 -1
  49. package/dist/packem_shared/index-Cj1Okk1t.mjs +0 -1
  50. package/dist/packem_shared/isolatedDeclarationsOxcTransformer-WbfE6cGu.mjs +0 -1
  51. package/dist/packem_shared/isolatedDeclarationsPlugin-A0wmmw3Y.mjs +0 -3
  52. package/dist/packem_shared/isolatedDeclarationsSwcTransformer-Ch2AgtWC.mjs +0 -1
  53. package/dist/packem_shared/isolatedDeclarationsTypescriptTransformer-DkuEkofo.mjs +0 -3
  54. package/dist/packem_shared/jsonPlugin-BAi3Da-h.mjs +0 -1
  55. package/dist/packem_shared/jsxRemoveAttributes-B1PLPffj.mjs +0 -1
  56. package/dist/packem_shared/licensePlugin-C5yzUqe-.mjs +0 -13
  57. package/dist/packem_shared/makeExecutable-6aOVHoJR.mjs +0 -4
  58. package/dist/packem_shared/metafilePlugin-ObS4J7mO.mjs +0 -1
  59. package/dist/packem_shared/oxcResolvePlugin-BJpi-eSG.mjs +0 -1
  60. package/dist/packem_shared/oxcTransformPlugin-DfVQouIB.mjs +0 -4
  61. package/dist/packem_shared/patchTypescriptTypes-BEdkvKxL.mjs +0 -6
  62. package/dist/packem_shared/preserveDirectivesPlugin-B49Cbykd.mjs +0 -4
  63. package/dist/packem_shared/rawPlugin-BqlR6ZOI.mjs +0 -1
  64. package/dist/packem_shared/resolveFileUrlPlugin-BkpjVHeK.mjs +0 -1
  65. package/dist/packem_shared/resolveTsconfigPathsPlugin-Crf4lzxq.mjs +0 -1
  66. package/dist/packem_shared/resolveTsconfigRootDirectoriesPlugin-_93afm2q.mjs +0 -1
  67. package/dist/packem_shared/resolveTypescriptMjsCtsPlugin-DcZrZTmM.mjs +0 -1
  68. package/dist/packem_shared/sourcemapsPlugin-B4W3J79w.mjs +0 -1
  69. package/dist/packem_shared/swcPlugin-Boip4lWG.mjs +0 -1
  70. package/dist/packem_shared/types-BKqesFEF.d.mts +0 -4548
  71. package/dist/packem_shared/types-BKqesFEF.d.ts +0 -4548
  72. package/dist/packem_shared/urlPlugin-Bm2IE00y.mjs +0 -1
  73. package/dist/plugins/esbuild/index.d.mts +0 -25
  74. package/dist/plugins/esbuild/index.mjs +0 -1
  75. package/dist/plugins/oxc/index.d.mts +0 -28
  76. package/dist/plugins/oxc/index.d.ts +0 -28
  77. package/dist/plugins/oxc/index.mjs +0 -1
  78. package/dist/plugins/sucrase/index.d.mts +0 -19
  79. package/dist/plugins/sucrase/index.mjs +0 -1
  80. package/dist/plugins/swc/index.d.mts +0 -26
  81. package/dist/plugins/swc/index.mjs +0 -1
  82. package/dist/plugins/typescript/index.d.mts +0 -29
  83. package/dist/plugins/typescript/index.d.ts +0 -29
  84. package/dist/plugins/typescript/index.mjs +0 -1
  85. /package/dist/packem_shared/{index-Dq8IUFTs.mjs → index-Dq8IUFTs.js} +0 -0
@@ -1,25 +1,11 @@
1
- export { b as browserslistToEsbuild } from '../../packem_shared/browserslist-to-esbuild-DY9HwYtp.js';
2
- import { T as TransformerFn } from '../../packem_shared/types-BKqesFEF.js';
3
- export { v as EsbuildPluginConfig, w as OptimizeDepsOptions, x as OptimizeDepsResult, O as Optimized, y as Options } from '../../packem_shared/types-BKqesFEF.js';
4
- import '@rollup/plugin-alias';
5
- import '@rollup/plugin-commonjs';
6
- import '@rollup/plugin-json';
7
- import '@rollup/plugin-node-resolve';
8
- import '@rollup/plugin-replace';
9
- import '@rollup/plugin-wasm';
10
- import '@rollup/pluginutils';
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';
11
4
  import 'rollup';
12
- import 'rollup-plugin-dts';
13
- import 'rollup-plugin-polyfill-node';
14
- import 'rollup-plugin-pure';
15
- import 'rollup-plugin-visualizer';
16
- import 'esbuild';
17
- import '@visulima/package';
5
+ import { T as TransformerFn } from "../../packem_shared/types.d-DrgzeMBs.d-CG9J1x6q.js";
18
6
  import '@visulima/packem-share/types';
19
- import 'oxc-resolver';
20
- import 'oxc-transform';
21
- import 'sucrase';
22
-
23
- declare const _default: TransformerFn;
24
-
25
- export { _default as esbuildPlugin };
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 };
@@ -0,0 +1 @@
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};
@@ -0,0 +1,5 @@
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 };
@@ -0,0 +1 @@
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};
@@ -0,0 +1,11 @@
1
+ import { Plugin } from 'rollup';
2
+ type JSXRemoveAttributesPlugin = {
3
+ attributes: string[];
4
+ };
5
+ declare const jsxRemoveAttributes: ({
6
+ attributes,
7
+ logger
8
+ }: JSXRemoveAttributesPlugin & {
9
+ logger: Console;
10
+ }) => Plugin;
11
+ export { JSXRemoveAttributesPlugin, jsxRemoveAttributes };
@@ -0,0 +1 @@
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};
@@ -0,0 +1,15 @@
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;
8
+ };
9
+ declare const preserveDirectivesPlugin: ({
10
+ directiveRegex,
11
+ exclude,
12
+ include,
13
+ logger
14
+ }: PreserveDirectivesPluginOptions) => Plugin;
15
+ export { PreserveDirectivesPluginOptions, preserveDirectivesPlugin };
@@ -0,0 +1,4 @@
1
+ var y=Object.defineProperty;var v=(a,c)=>y(a,"name",{value:c,configurable:!0});import{createFilter as I}from"@rollup/pluginutils";import g from"magic-string";var w=Object.defineProperty,m=v((a,c)=>w(a,"name",{value:c,configurable:!0}),"l");const S=m(({directiveRegex:a,exclude:c=[],include:h=[],logger:p})=>{const f={},l={},b=I(h,c);return{name:"packem:preserve-directives",onLog(n,i){if(i.code==="MODULE_LEVEL_DIRECTIVE"&&n==="warn")return!1},renderChunk:{handler(n,i,{sourcemap:u}){const o=m(r=>{const s=this.getModuleInfo(r)?.meta?.preserveDirectives?.directives;return s&&s.length>0?new Set(s):f[r]},"directivesForId"),d=i.moduleIds.map(r=>o(r)).reduce((r,s)=>(s&&s.forEach(x=>{r.add(x)}),r),new Set),e=new g(n);d.size>0&&(p.debug({message:`directives for chunk "${i.fileName}" are preserved.`,prefix:"plugin:preserve-directives"}),e.prepend(`${Array.from(d,r=>`'${r}';`).join(`
2
+ `)}
3
+ `));let t;if(i.facadeModuleId){const r=this.getModuleInfo(i.facadeModuleId)?.meta?.preserveDirectives?.shebang;typeof r=="string"?t=r:typeof l[i.facadeModuleId]=="string"&&(t=l[i.facadeModuleId])}if(t&&(p.debug({message:`shebang for chunk "${i.fileName}" is preserved.`,prefix:"plugin:preserve-directives"}),e.prepend(`${t}
4
+ `)),!(d.size===0&&t===void 0))return{code:e.toString(),map:u?e.generateMap({hires:!0}):void 0}},order:"post"},transform(n,i){if(!b(i))return;let u=!1;const o=new g(n);if(n.startsWith("#")&&n[1]==="!"){let e=0;for(let t=n.length,r=2;r<t;r+=1){const s=n.codePointAt(r);if(s===10||s===13||s===8232||s===8233){e=r;break}}e&&(l[i]=n.slice(0,e),o.remove(0,e+1),u=!0,p.debug({message:`shebang for module "${i}" is preserved.`,prefix:"plugin:preserve-directives"}))}let d;try{d=this.parse(o.toString(),{allowReturnOutsideFunction:!0})}catch(e){this.warn({code:"PARSE_ERROR",message:`failed to parse "${i}" and extract the directives.`}),p.warn(e);return}for(const e of d.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 r=f[i];r?r.add(t):f[i]=new Set([t]),"start"in e&&typeof e.start=="number"&&"end"in e&&typeof e.end=="number"&&(o.remove(e.start,e.end),u=!0),p.debug({message:`directive "${t}" for module "${i}" is preserved.`,prefix:"plugin:preserve-directives"})}}if(u)return{code:o.toString(),map:o.generateMap({hires:!0}),meta:{preserveDirectives:{directives:[...f[i]??[]],shebang:l[i]??void 0}}}}}},"preserveDirectivesPlugin");export{S as preserveDirectivesPlugin};
@@ -0,0 +1,12 @@
1
+ import { Plugin } from 'rollup';
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
+ declare const pureNewExpressionPlugin: (options: {
9
+ constructors: string[];
10
+ sourcemap?: boolean;
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,19 +1,102 @@
1
- import '@rollup/pluginutils';
2
- import 'sucrase';
3
- export { Q as SucrasePluginConfig, V as sucrasePlugin } from '../../packem_shared/types-BKqesFEF.js';
4
- import '@rollup/plugin-alias';
5
- import '@rollup/plugin-commonjs';
6
- import '@rollup/plugin-json';
7
- import '@rollup/plugin-node-resolve';
8
- import '@rollup/plugin-replace';
9
- import '@rollup/plugin-wasm';
1
+ import { FilterPattern } from '@rollup/pluginutils';
2
+ import '@visulima/packem-share/utils';
10
3
  import 'rollup';
11
- import 'rollup-plugin-dts';
12
- import 'rollup-plugin-polyfill-node';
13
- import 'rollup-plugin-pure';
14
- import 'rollup-plugin-visualizer';
15
- import 'esbuild';
16
- import '@visulima/package';
4
+ import { T as TransformerFn } from "../../packem_shared/types.d-DrgzeMBs.d-CG9J1x6q.js";
17
5
  import '@visulima/packem-share/types';
18
- import 'oxc-resolver';
19
- import 'oxc-transform';
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;
15
+ }
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 };
@@ -0,0 +1 @@
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,26 +1,11 @@
1
- import { n as IsolatedDeclarationsResult, T as TransformerFn } from '../../packem_shared/types-BKqesFEF.js';
2
- export { z as SwcPluginConfig } from '../../packem_shared/types-BKqesFEF.js';
3
- import '@rollup/plugin-alias';
4
- import '@rollup/plugin-commonjs';
5
- import '@rollup/plugin-json';
6
- import '@rollup/plugin-node-resolve';
7
- import '@rollup/plugin-replace';
8
- import '@rollup/plugin-wasm';
9
- import '@rollup/pluginutils';
1
+ import '@visulima/packem-share/utils';
10
2
  import 'rollup';
11
- import 'rollup-plugin-dts';
12
- import 'rollup-plugin-polyfill-node';
13
- import 'rollup-plugin-pure';
14
- import 'rollup-plugin-visualizer';
15
- import 'esbuild';
16
- import '@visulima/package';
3
+ import { T as TransformerFn } from "../../packem_shared/types.d-DrgzeMBs.d-CG9J1x6q.js";
17
4
  import '@visulima/packem-share/types';
18
- import 'oxc-resolver';
19
- import 'oxc-transform';
20
- import 'sucrase';
21
-
22
- declare const isolatedDeclarationsSwcTransformer: (id: string, code: string, sourceMap?: boolean) => Promise<IsolatedDeclarationsResult>;
23
-
24
- declare const _default: TransformerFn;
25
-
26
- export { isolatedDeclarationsSwcTransformer, _default as swcPlugin };
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 };
@@ -0,0 +1 @@
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.7",
3
+ "version": "1.0.0-alpha.71",
4
4
  "description": "Rollup plugins for packem",
5
5
  "keywords": [
6
6
  "visulima",
@@ -34,28 +34,44 @@
34
34
  "type": "module",
35
35
  "exports": {
36
36
  ".": {
37
- "types": "./dist/index.d.mts",
38
- "default": "./dist/index.mjs"
37
+ "types": "./dist/index.d.ts",
38
+ "default": "./dist/index.js"
39
39
  },
40
40
  "./esbuild": {
41
- "types": "./dist/plugins/esbuild/index.d.mts",
42
- "default": "./dist/plugins/esbuild/index.mjs"
41
+ "types": "./dist/plugins/esbuild/index.d.ts",
42
+ "default": "./dist/plugins/esbuild/index.js"
43
43
  },
44
44
  "./swc": {
45
- "types": "./dist/plugins/swc/index.d.mts",
46
- "default": "./dist/plugins/swc/index.mjs"
45
+ "types": "./dist/plugins/swc/index.d.ts",
46
+ "default": "./dist/plugins/swc/index.js"
47
47
  },
48
- "./typescript": {
49
- "types": "./dist/plugins/typescript/index.d.mts",
50
- "default": "./dist/plugins/typescript/index.mjs"
48
+ "./sucrase": {
49
+ "types": "./dist/plugins/sucrase/index.d.ts",
50
+ "default": "./dist/plugins/sucrase/index.js"
51
51
  },
52
- "./oxc": {
53
- "types": "./dist/plugins/oxc/index.d.mts",
54
- "default": "./dist/plugins/oxc/index.mjs"
52
+ "./plugin/chunk-splitter": {
53
+ "types": "./dist/plugins/chunk-splitter/index.d.ts",
54
+ "default": "./dist/plugins/chunk-splitter/index.js"
55
55
  },
56
- "./sucrase": {
57
- "types": "./dist/plugins/sucrase/index.d.mts",
58
- "default": "./dist/plugins/sucrase/index.mjs"
56
+ "./plugin/cjs-interop": {
57
+ "types": "./dist/plugins/cjs-interop.d.ts",
58
+ "default": "./dist/plugins/cjs-interop.js"
59
+ },
60
+ "./plugin/json": {
61
+ "types": "./dist/plugins/json.d.ts",
62
+ "default": "./dist/plugins/json.js"
63
+ },
64
+ "./plugin/jsx-remove-attributes": {
65
+ "types": "./dist/plugins/jsx-remove-attributes.d.ts",
66
+ "default": "./dist/plugins/jsx-remove-attributes.js"
67
+ },
68
+ "./plugin/preserve-directives": {
69
+ "types": "./dist/plugins/preserve-directives.d.ts",
70
+ "default": "./dist/plugins/preserve-directives.js"
71
+ },
72
+ "./plugin/pure-new-expression": {
73
+ "types": "./dist/plugins/pure-new-expression-plugin.d.ts",
74
+ "default": "./dist/plugins/pure-new-expression-plugin.js"
59
75
  },
60
76
  "./package.json": "./package.json"
61
77
  },
@@ -65,43 +81,35 @@
65
81
  "dist"
66
82
  ],
67
83
  "dependencies": {
68
- "@babel/parser": "7.28.3",
69
- "@rollup/plugin-alias": "5.1.1",
70
- "@rollup/plugin-commonjs": "28.0.6",
84
+ "@rollup/plugin-alias": "6.0.0",
85
+ "@rollup/plugin-commonjs": "29.0.3",
71
86
  "@rollup/plugin-dynamic-import-vars": "2.1.5",
72
87
  "@rollup/plugin-inject": "5.0.5",
73
88
  "@rollup/plugin-json": "6.1.0",
74
- "@rollup/plugin-node-resolve": "16.0.1",
75
- "@rollup/plugin-replace": "6.0.2",
89
+ "@rollup/plugin-replace": "6.0.3",
76
90
  "@rollup/plugin-wasm": "6.2.2",
77
- "@rollup/pluginutils": "5.2.0",
78
- "@visulima/find-cache-dir": "1.0.31",
79
- "@visulima/fs": "3.1.5",
80
- "@visulima/package": "3.5.8",
81
- "@visulima/packem-share": "1.0.0-alpha.6",
82
- "@visulima/path": "1.4.0",
83
- "@visulima/source-map": "1.0.20",
84
- "es-module-lexer": "1.7.0",
85
- "glob-parent": "6.0.2",
86
- "magic-string": "0.30.17",
87
- "mlly": "1.7.4",
88
- "oxc-parser": "0.82.2",
89
- "oxc-resolver": "11.6.1",
90
- "rollup-plugin-dts": "6.2.3",
91
- "rollup-plugin-license": "3.6.0",
91
+ "@rollup/pluginutils": "5.4.0",
92
+ "@visulima/find-cache-dir": "3.0.0-alpha.9",
93
+ "@visulima/fs": "5.0.0-alpha.24",
94
+ "@visulima/package": "5.0.0-alpha.23",
95
+ "@visulima/packem-share": "1.0.0-alpha.48",
96
+ "@visulima/path": "3.0.0-alpha.10",
97
+ "@visulima/rollup-plugin-dts": "1.0.0-alpha.32",
98
+ "clean-css": "^5.3.3",
99
+ "html-minifier-next": "6.2.7",
100
+ "magic-string": "0.30.21",
101
+ "oxc-resolver": "11.20.0",
102
+ "rollup-plugin-import-trace": "1.0.1",
92
103
  "rollup-plugin-polyfill-node": "0.13.0",
93
104
  "rollup-plugin-pure": "^0.4.0",
94
- "rollup-plugin-visualizer": "6.0.3",
95
- "semver": "7.7.2",
96
- "tinyglobby": "0.2.14"
105
+ "rollup-plugin-visualizer": "7.0.1",
106
+ "rs-module-lexer": "2.8.0"
97
107
  },
98
108
  "peerDependencies": {
99
109
  "@swc/core": "*",
100
110
  "esbuild": "*",
101
- "oxc-transform": "*",
102
- "rollup": ">=4",
103
- "sucrase": "*",
104
- "typescript": "*"
111
+ "rollup": ">=4.61.0",
112
+ "sucrase": "*"
105
113
  },
106
114
  "peerDependenciesMeta": {
107
115
  "@swc/core": {
@@ -110,21 +118,12 @@
110
118
  "esbuild": {
111
119
  "optional": true
112
120
  },
113
- "oxc-transform": {
114
- "optional": true
115
- },
116
- "p-queue": {
117
- "optional": true
118
- },
119
121
  "sucrase": {
120
122
  "optional": true
121
- },
122
- "typescript": {
123
- "optional": true
124
123
  }
125
124
  },
126
125
  "engines": {
127
- "node": ">=18.* <=24.*"
126
+ "node": "^22.14.0 || >= 24.10.0"
128
127
  },
129
128
  "publishConfig": {
130
129
  "access": "public",
package/dist/index.d.mts DELETED
@@ -1,56 +0,0 @@
1
- import { Plugin, RenderedChunk, GetManualChunk, CustomPluginOptions } from 'rollup';
2
- import { P as PailServerType } from './packem_shared/types-BKqesFEF.mjs';
3
- export { C as CJSInteropOptions, a as CopyPluginOptions, D as DataUriPluginOptions, E as EsmShimCjsSyntaxOptions, I as IsolatedDeclarationsOptions, n as IsolatedDeclarationsResult, o as IsolatedDeclarationsTransformer, J as JSXRemoveAttributesPlugin, L as LicenseOptions, p as PackemRollupOptions, R as RawLoaderOptions, q as RollupPlugins, S as ShebangOptions, h as SourcemapsPluginOptions, T as TransformerFn, t as TransformerName, U as UrlOptions, c as cjsInteropPlugin, b as copyPlugin, d as dataUriPlugin, e as esmShimCjsSyntaxPlugin, g as getShebang, i as isolatedDeclarationsPlugin, j as jsxRemoveAttributes, l as licensePlugin, m as makeExecutable, r as rawPlugin, f as removeShebangPlugin, s as shebangPlugin, k as sourcemapsPlugin, u as urlPlugin } from './packem_shared/types-BKqesFEF.mjs';
4
- export { b as browserslistToEsbuild } from './packem_shared/browserslist-to-esbuild-DY9HwYtp.mjs';
5
- import { RollupJsonOptions } from '@rollup/plugin-json';
6
- import { FileCache } from '@visulima/packem-share/utils';
7
- import { FilterPattern } from '@rollup/pluginutils';
8
- import { BuildContextBuildAssetAndChunk, BuildContextBuildEntry } from '@visulima/packem-share/types';
9
- export { Alias, ResolverObject as AliasResolverObject, ResolvedAlias, RollupAliasOptions, default as alias } from '@rollup/plugin-alias';
10
- export { RollupCommonJSOptions, default as commonjs } from '@rollup/plugin-commonjs';
11
- export { RollupDynamicImportVariablesOptions, default as dynamicImportVars } from '@rollup/plugin-dynamic-import-vars';
12
- export { RollupInjectOptions, default as inject } from '@rollup/plugin-inject';
13
- export { RollupNodeResolveOptions, default as nodeResolve } from '@rollup/plugin-node-resolve';
14
- export { RollupReplaceOptions, default as replace } from '@rollup/plugin-replace';
15
- export { RollupWasmOptions, default as wasm } from '@rollup/plugin-wasm';
16
- export { NodePolyfillsOptions as RollupNodePolyfillsOptions, default as polyfillNode } from 'rollup-plugin-polyfill-node';
17
- export { PureAnnotationsOptions as RollupPureAnnotationsOptions, PluginPure as pure } from 'rollup-plugin-pure';
18
- export { PluginVisualizerOptions as RollupPluginVisualizerOptions, default as visualizer } from 'rollup-plugin-visualizer';
19
- import 'rollup-plugin-dts';
20
- import 'esbuild';
21
- import '@visulima/package';
22
- import 'oxc-resolver';
23
- import 'oxc-transform';
24
- import 'sucrase';
25
-
26
- declare const chunkSplitter: () => Plugin;
27
-
28
- type FixDtsDefaultCjsExportsPluginOptions = {
29
- matcher?: (info: RenderedChunk) => boolean;
30
- };
31
- declare const fixDtsDefaultCjsExportsPlugin: (options?: FixDtsDefaultCjsExportsPluginOptions) => Plugin;
32
-
33
- declare const fixDynamicImportExtension: () => Plugin;
34
-
35
- declare const JSONPlugin: (options: RollupJsonOptions) => Plugin;
36
-
37
- declare const metafilePlugin: () => Plugin;
38
-
39
- declare const cachingPlugin: (plugin: Plugin, cache: FileCache, subDirectory?: string) => Plugin;
40
-
41
- declare const preserveDirectives: ({ directiveRegex, exclude, include, logger, }: {
42
- directiveRegex: RegExp;
43
- exclude?: FilterPattern;
44
- include?: FilterPattern;
45
- logger: PailServerType;
46
- }) => Plugin;
47
-
48
- declare const resolveFileUrl: () => Plugin;
49
-
50
- declare const createSplitChunks: (dependencyGraphMap: Map<string, Set<[string, string]>>, entryFiles: (BuildContextBuildAssetAndChunk | BuildContextBuildEntry)[]) => GetManualChunk;
51
-
52
- declare const getCustomModuleLayer: (moduleId: string) => string | undefined;
53
-
54
- declare const getModuleLayer: (moduleMeta: CustomPluginOptions) => any;
55
-
56
- export { cachingPlugin, chunkSplitter, createSplitChunks, fixDtsDefaultCjsExportsPlugin, fixDynamicImportExtension, getCustomModuleLayer, getModuleLayer, JSONPlugin as jsonPlugin, metafilePlugin, preserveDirectives as preserveDirectivesPlugin, resolveFileUrl as resolveFileUrlPlugin };
package/dist/index.mjs DELETED
@@ -1 +0,0 @@
1
- import{default as o}from"./packem_shared/chunkSplitter-DWAy1JkE.mjs";import{cjsInteropPlugin as a}from"./packem_shared/cjsInteropPlugin-D5wyoQ_B.mjs";import{copyPlugin as f}from"./packem_shared/copyPlugin--6RITp1-.mjs";import{dataUriPlugin as u}from"./packem_shared/dataUriPlugin-BOjv6O2O.mjs";import{default as p}from"./packem_shared/browserslistToEsbuild-C0IWmbNe.mjs";import{esmShimCjsSyntaxPlugin as x}from"./packem_shared/esmShimCjsSyntaxPlugin-DjKqX4DE.mjs";import{fixDtsDefaultCjsExportsPlugin as d}from"./packem_shared/fixDtsDefaultCjsExportsPlugin-Dp1UcHVR.mjs";import{default as P}from"./packem_shared/fixDynamicImportExtension-BBGNRniz.mjs";import{isolatedDeclarationsPlugin as b}from"./packem_shared/isolatedDeclarationsPlugin-A0wmmw3Y.mjs";import{default as j}from"./packem_shared/jsonPlugin-BAi3Da-h.mjs";import{jsxRemoveAttributes as y}from"./packem_shared/jsxRemoveAttributes-B1PLPffj.mjs";import{license as D}from"./packem_shared/licensePlugin-C5yzUqe-.mjs";import{default as E}from"./packem_shared/metafilePlugin-ObS4J7mO.mjs";import{default as w}from"./packem_shared/cachingPlugin-D0BBFJPD.mjs";import{default as L}from"./packem_shared/preserveDirectivesPlugin-B49Cbykd.mjs";import{rawPlugin as R}from"./packem_shared/rawPlugin-BqlR6ZOI.mjs";import{default as z}from"./packem_shared/resolveFileUrlPlugin-BkpjVHeK.mjs";import{getShebang as F,makeExecutable as N,removeShebangPlugin as T,shebangPlugin as V}from"./packem_shared/makeExecutable-6aOVHoJR.mjs";import{sourcemapsPlugin as B}from"./packem_shared/sourcemapsPlugin-B4W3J79w.mjs";import{urlPlugin as H}from"./packem_shared/urlPlugin-Bm2IE00y.mjs";import{default as K}from"./packem_shared/createSplitChunks-CGDk55G3.mjs";import{default as Q}from"./packem_shared/getCustomModuleLayer-d8i66lfh.mjs";import{default as X}from"./packem_shared/getModuleLayer-rF9RxnJ5.mjs";import{default as Z}from"@rollup/plugin-alias";import{default as $}from"@rollup/plugin-commonjs";import{default as re}from"@rollup/plugin-dynamic-import-vars";import{default as te}from"@rollup/plugin-inject";import{default as le}from"@rollup/plugin-node-resolve";import{default as se}from"@rollup/plugin-replace";import{default as me}from"@rollup/plugin-wasm";import{default as ie}from"rollup-plugin-polyfill-node";import{PluginPure as ne}from"rollup-plugin-pure";import{default as ge}from"rollup-plugin-visualizer";export{Z as alias,p as browserslistToEsbuild,w as cachingPlugin,o as chunkSplitter,a as cjsInteropPlugin,$ as commonjs,f as copyPlugin,K as createSplitChunks,u as dataUriPlugin,re as dynamicImportVars,x as esmShimCjsSyntaxPlugin,d as fixDtsDefaultCjsExportsPlugin,P as fixDynamicImportExtension,Q as getCustomModuleLayer,X as getModuleLayer,F as getShebang,te as inject,b as isolatedDeclarationsPlugin,j as jsonPlugin,y as jsxRemoveAttributes,D as licensePlugin,N as makeExecutable,E as metafilePlugin,le as nodeResolve,ie as polyfillNode,L as preserveDirectivesPlugin,ne as pure,R as rawPlugin,T as removeShebangPlugin,se as replace,z as resolveFileUrlPlugin,V as shebangPlugin,B as sourcemapsPlugin,H as urlPlugin,ge as visualizer,me as wasm};
@@ -1,3 +0,0 @@
1
- declare const browserslistToEsbuild: (browserList: string[]) => string[];
2
-
3
- export { browserslistToEsbuild as b };
@@ -1,3 +0,0 @@
1
- declare const browserslistToEsbuild: (browserList: string[]) => string[];
2
-
3
- export { browserslistToEsbuild as b };
@@ -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 h=Object.defineProperty;var m=(a,r)=>h(a,"name",{value:r,configurable:!0});import{join as l}from"@visulima/path";import{getHash as o}from"@visulima/packem-share/utils";var g=Object.defineProperty,f=m((a,r)=>g(a,"name",{value:r,configurable:!0}),"m");const c=f(a=>a.handler||a,"getHandler"),v=f((a,r,d="")=>({...a,async buildEnd(n){a.buildEnd&&await c(a.buildEnd).call(this,n)},async buildStart(n){a.buildStart&&await c(a.buildStart).call(this,n)},async load(n){if(!a.load)return;const t=l(d,a.name),s=l("load",o(n));if(r.has(s,t))return await r.get(s,t);const e=await c(a.load).call(this,n);return r.set(s,e,t),e},name:`cached(${a.name})`,async resolveId(n,t,s){if(!a.resolveId)return;const e=l(d,a.name),i=l("resolveId",o(n),t?o(t):"",o(JSON.stringify(s)));if(r.has(i,e))return await r.get(i,e);const u=await c(a.resolveId).call(this,n,t,s);return r.set(i,u,e),u},async transform(n,t){if(!a.transform)return;const s=l(d,a.name),e=l("transform",o(t),o(n));if(r.has(e,s))return await r.get(e,s);const i=await c(a.transform).call(this,n,t);return r.set(e,i,s),i}}),"cachingPlugin");export{v as default};
@@ -1 +0,0 @@
1
- var 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,2 +0,0 @@
1
- var i=Object.defineProperty;var a=(e,r)=>i(e,"name",{value:r,configurable:!0});import c from"magic-string";var d=Object.defineProperty,s=a((e,r)=>d(e,"name",{value:r,configurable:!0}),"i");const g=s(({addDefaultProperty:e=!1,logger:r})=>({name:"packem:cjs-interop",renderChunk:s(async(l,o,u)=>{if(!(o.type!=="chunk"||!o.isEntry)&&u.format==="cjs"&&u.exports==="auto"){const n=/(exports(?:\['default'\]|\.default)) = (.*);/i.exec(l);if(n===null||n.length<3)return;const t=new c(l);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 +0,0 @@
1
- var g=Object.defineProperty;var l=(c,i)=>g(c,"name",{value:i,configurable:!0});import{stat as x}from"node:fs/promises";import{readFile as h}from"@visulima/fs";import{arrayify as u}from"@visulima/packem-share/utils";import{normalize as b,join as y,relative as w,dirname as F,basename as P}from"@visulima/path";import $ from"glob-parent";import{glob as v}from"tinyglobby";var A=Object.defineProperty,j=l((c,i)=>A(c,"name",{value:i,configurable:!0}),"f");const C=j((c,i)=>{const n=new Map,p={copyOnce:!0,exactFileNames:!0,flatten:!1,...c};let{targets:o}=p;return Array.isArray(o)?o=o.map(s=>{if(typeof s=="string")return{src:s};if(typeof s=="object"&&"src"in s)return s}).filter(Boolean):typeof o=="string"&&(o=[{src:o}]),{async buildStart(){const s=await Promise.all(o.flatMap(e=>Array.isArray(e.src)?e.src.map(r=>({...e,src:r})):e).map(async e=>await v(u(e.src),{ignore:u(e.exclude).filter(Boolean)}).then(r=>({dest:e.dest??"",parent:$(e.src),src:r}))));for(const e of s)for(const r of e.src){let a;n.has(r)?a=n.get(r):(a={copied:[],dest:[],timestamp:0},n.set(r,a));const t=p.flatten?b(e.dest):y(e.dest,w(e.parent,F(r)));a.dest.includes(t)||a.dest.push(t),this.addWatchFile(r)}i.info({message:"Copying files...",prefix:"plugin:copy"}),await Promise.all([...n].map(async([e,r])=>{let a;try{const t=await x(e);if(!t.isFile())return;const m=t.mtime.getTime();m>r.timestamp&&(r.timestamp=m,r.copied=[]),a=await h(e,{buffer:!0})}catch(t){i.error({context:[t],message:`error reading file ${e}`,prefix:"plugin:copy"});return}for(const t of r.dest){if(p.copyOnce&&r.copied.includes(t))continue;const m=P(e),f=y(t,m);try{this.emitFile({[p.exactFileNames?"fileName":"name"]:f,source:a,type:"asset"}),i.debug({message:`copied ${e} → ${f}`,prefix:"plugin:copy"}),r.copied.push(t)}catch(d){i.error({context:[d],message:`error copying file ${e} → ${f}`,prefix:"plugin:copy"})}}}))},name:"packem:copy"}},"copyPlugin");export{C as copyPlugin};
@@ -1 +0,0 @@
1
- var I=Object.defineProperty;var p=(t,n)=>I(t,"name",{value:n,configurable:!0});import{memoize as y}from"@visulima/packem-share/utils";import{basename as b,extname as w}from"@visulima/path";import S from"./getCustomModuleLayer-d8i66lfh.mjs";import l from"./getModuleLayer-rF9RxnJ5.mjs";var $=Object.defineProperty,h=p((t,n)=>$(t,"name",{value:n,configurable:!0}),"d");const M=y(t=>{let n=0;for(let r=0;r<t.length;r+=1)n=(n<<5)-n+t.codePointAt(r);return(n>>>0).toString(36).slice(0,3)}),j=h((t,n)=>{const r=new Map;return h(function(e,u){if(/[\\/]node_modules[\\/]@swc[\\/]helper/.test(e))return"cc";const c=u.getModuleInfo(e);if(!c)return;const{isEntry:m}=c,d=c.meta;let s=l(d);if(s&&(s=M(s)),!m){const f=r.get(e);if(f)return f;const o=S(e);if(o)return r.set(e,o),o}if(m){const f=u.getModuleIds();for(const o of f)u.getModuleInfo(o)&&l(d)===s&&(t.has(o)||t.set(o,new Set),t.get(o).add([e,s]))}if(s&&!m&&t.has(e)){const f=[...t.get(e)];if(f.some(([i])=>{if(n.some(a=>a.path===i)){const a=u.getModuleInfo(i);return l(a?a.meta:{})===s}return!1}))return;if(f.every(([,i])=>i===s))return r.has(e)?r.get(e):void 0;const o=b(e,w(e)),v=M(s),g=`${o}-${v}`;return r.set(e,g),g}},"splitChunks")},"createSplitChunks");export{j as default};
@@ -1 +0,0 @@
1
- var f=Object.defineProperty;var o=(e,a)=>f(e,"name",{value:a,configurable:!0});import{createFilter as m}from"@rollup/pluginutils";import{readFile as n}from"@visulima/fs";import{R as g}from"./index-Cj1Okk1t.mjs";var h=Object.defineProperty,r=o((e,a)=>h(e,"name",{value:a,configurable:!0}),"e");const l={quotes:/"/g,urlHexPairs:/%[\dA-F]{2}/g,whitespace:/\s+/g},x=r(e=>{switch(e){case"%2F":return"/";case"%3A":return":";case"%3D":return"=";case"%20":return" ";default:return e.toLowerCase()}},"specialHexEncode"),$=r(e=>e.trim().replaceAll(l.whitespace," "),"collapseWhitespace"),F=r(e=>encodeURIComponent(e).replaceAll(l.urlHexPairs,x),"dataUriPayload"),b=r(e=>e.replaceAll(/<!--[\s\S]*?-->/g,""),"stripSvgComments"),u=r(e=>{const a=e.startsWith("\uFEFF")?e.slice(1):e,s=b(a),t=$(s).replaceAll(l.quotes,"'");return`data:image/svg+xml,${F(t)}`},"svgToTinyDataUri"),y=r((e={})=>{const a=m(e.include??[/\?data-uri$/],e.exclude);return{async load(s){if(!a(s)||!s.endsWith("?data-uri"))return;const t=s.replace(/\?data-uri$/,"");this.addWatchFile(t);const i=g.getType(t)||"application/octet-stream";if(i==="image/svg+xml"){const c=await n(t,{buffer:!1});return`export default "${e.srcset?u(c).replaceAll(" ","%20"):u(c)}"`}const d=await n(t,{buffer:!0}),p=Buffer.from(d).toString("base64");return`export default "${`${i.startsWith("text/")?`data:${i};charset=utf-8;base64,`:`data:${i};base64,`}${p}`}"`},name:"packem:data-uri"}},"dataUriPlugin");export{y as dataUriPlugin,y as default};
@@ -1 +0,0 @@
1
- var j=Object.defineProperty;var u=(e,r)=>j(e,"name",{value:r,configurable:!0});import{createFilter as x}from"@rollup/pluginutils";import{DEFAULT_LOADERS as k}from"@visulima/packem-share/constants";import{join as O,extname as $}from"@visulima/path";import{formatMessages as E,transform as b,build as M}from"esbuild";import{findCacheDirSync as A}from"@visulima/find-cache-dir";import{readFileSync as P}from"@visulima/fs";import{init as R,parse as S}from"es-module-lexer";var F=Object.defineProperty,C=u((e,r)=>F(e,"name",{value:r,configurable:!0}),"n$1");const h=C(async(e,r)=>{r.length>0&&(await E(r,{color:!0,kind:"warning"})).forEach(s=>e.warn(s))},"warn");var L=Object.defineProperty,w=u((e,r)=>L(e,"name",{value:r,configurable:!0}),"t");const W=w(e=>{if(e==="es")return"esm";if(e==="cjs")return e},"getEsbuildFormat"),I=w(({sourceMap:e=!0,...r})=>async function(s,n,t){if(r.minify||r.minifyWhitespace||r.minifyIdentifiers||r.minifySyntax){const i=W(t.format),c=await b(s,{format:i,loader:"js",sourcemap:e,...r});if(await h(this,c.warnings),c.code)return{code:c.code,map:c.map||void 0}}},"getRenderChunk");var T=Object.defineProperty,y=u((e,r)=>T(e,"name",{value:r,configurable:!0}),"n");const v=y(e=>e.replaceAll("\\","/"),"slash"),q=y(async e=>{const r=A("@visulima/packem/optimize-deps",{create:!0,cwd:e.cwd});if(!r)throw new Error('[packem:optimize-deps]: failed to find or create cache directory "node_modules/.cache/packem/optimize_deps".');await R,await M({absWorkingDir:e.cwd,bundle:!0,entryPoints:e.include,format:"esm",ignoreAnnotations:!0,metafile:!0,outdir:r,sourcemap:e.sourceMap,splitting:!0,...e.esbuildOptions,plugins:[{name:"optimize-deps",async setup(n){n.onResolve({filter:/.*/},async t=>{if(e.exclude?.includes(t.path))return{external:!0};if(!t.pluginData?.__resolving_dep_path__&&e.include.includes(t.path)){const i=await n.resolve(t.path,{kind:"import-statement",pluginData:{__resolving_dep_path__:!0},resolveDir:t.resolveDir});return i.errors.length>0||i.warnings.length>0?i:{namespace:"optimize-deps",path:t.path,pluginData:{absolute:i.path,resolveDir:t.resolveDir}}}}),n.onLoad({filter:/.*/,namespace:"optimize-deps"},async t=>{const{absolute:i,resolveDir:c}=t.pluginData,[,p]=S(P(i));return{contents:p.length>0?`export * from '${v(i)}'`:`module.exports = require('${v(i)}')`,resolveDir:c}})}},...e.esbuildOptions?.plugins??[]]});const s=new Map;for(const n of e.include)s.set(n,{file:O(r,`${n}.js`)});return{cacheDir:r,optimized:s}},"optimizeDeps");var N=Object.defineProperty,U=u((e,r)=>N(e,"name",{value:r,configurable:!0}),"g");const B=U(({exclude:e,include:r,loaders:s,logger:n,optimizeDeps:t,sourceMap:i,...c})=>{const p=k;if(s!==void 0)for(let[a,o]of Object.entries(s)){const d=a.startsWith(".")?a:`.${a}`;typeof o=="string"?p[d]=o:o||delete p[d]}const D=Object.keys(p),_=new RegExp(`\\.(${D.map(a=>a.slice(1)).join("|")})$`),z=x(r??_,e);let l,g=process.cwd();return{async buildStart(){!t||l||(l=await q({cwd:g,sourceMap:i??!1,...t}),n.debug("optimized %O",l.optimized))},name:"packem:esbuild",options({context:a}){a&&(g=a)},renderChunk:I({...c,sourceMap:i}),async resolveId(a){if(l?.optimized.has(a)){const o=l.optimized.get(a);if(o)return n.debug("resolved %s to %s",a,o.file),o.file}},async transform(a,o){if(!z(o)||l?.optimized.has(o))return;const d=$(o),m=p[d];if(n.debug("transforming %s with %s loader",o,m),!m)return;const f=await b(a,{format:["base64","binary","dataurl","text","json"].includes(m)?"esm":void 0,loader:m,sourcefile:o.replace(/\.[cm]ts/,".ts"),sourcemap:i,...c});if(await h(this,f.warnings),f.code)return{code:f.code,map:f.map||void 0}}}},"esbuildTransformer");B.NAME="esbuild";export{B as default};
@@ -1,11 +0,0 @@
1
- var c=Object.defineProperty;var s=(e,r)=>c(e,"name",{value:r,configurable:!0});import{env as u}from"node:process";import{createFilter as l}from"@rollup/pluginutils";import p from"magic-string";import{findStaticImports as d}from"mlly";import{minVersion as f}from"semver";var S=Object.defineProperty,a=s((e,r)=>S(e,"name",{value:r,configurable:!0}),"t");const h=/(?:^|[^.\w'"`])require(\.resolve)?\(\s*([\w'"`])/,C=a((e,r)=>{if(u.INTERNAL_PACKEM_BUILD!=="1"&&(e.includes("// -- packem CommonJS __filename shim")||e.includes("// -- packem CommonJS __dirname shim")||e.includes("// -- packem CommonJS require shim")))return;let o=!1,m=!1,n=!1;if(e.includes("__filename")&&(o=!0),e.includes("__dirname")&&(m=!0),h.test(e)&&(n=!0),!o&&!m&&!n)return;const t=d(e).pop(),_=t?t.end:0,i=new p(e);return i.appendRight(_,r(o,m,n)),{code:i.toString(),map:i.generateMap()}},"CJSToESM"),j=a((e,r,o)=>{let m="";return(e||r)&&(m+=`import __cjs_url__ from "node:url"; // -- packem CommonJS __filename shim --
2
- `),r&&(m+=`import __cjs_path__ from "node:path"; // -- packem CommonJS __dirname shim --
3
- `),o&&(m+=`import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
4
- `),(e||r)&&(m+=`const __filename = __cjs_url__.fileURLToPath(import.meta.url);
5
- `),r&&(m+=`const __dirname = __cjs_path__.dirname(__filename);
6
- `),o&&(m+=`const require = __cjs_mod__.createRequire(import.meta.url);
7
- `),m},"generateCJSShim"),J=a((e,r,o)=>{let m="";return o&&(m+=`import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
8
- `),e&&(m+=`const __filename = import.meta.filename; // -- packem CommonJS __filename shim --
9
- `),r&&(m+=`const __dirname = import.meta.dirname; // -- packem CommonJS __dirname shim --
10
- `),o&&(m+=`const require = __cjs_mod__.createRequire(import.meta.url);
11
- `),m},"generateCJSShimNode20_11"),x=a((e,r)=>{const o=l(r.include,r.exclude);return{name:"packem:esm-shim-cjs-syntax",renderChunk(m,n,t){if(t.format==="es"&&o(n.fileName)){let _=j;if(e.engines?.node){const i=f(e.engines.node);i&&i.major>=20&&i.minor>=11&&(_=J)}return C(m,_)}}}},"esmShimCjsSyntaxPlugin");export{h as GLOBAL_REQUIRE_REGEX,x as esmShimCjsSyntaxPlugin};