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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,26 @@
1
+ ## @visulima/packem-rollup [1.0.0-alpha.69](https://github.com/visulima/packem/compare/@visulima/packem-rollup@1.0.0-alpha.68...@visulima/packem-rollup@1.0.0-alpha.69) (2026-06-02)
2
+
3
+ ### Features
4
+
5
+ * **babel:** add parallel worker-pool transforms ([#204](https://github.com/visulima/packem/issues/204)) ([7a5444c](https://github.com/visulima/packem/commit/7a5444c4a17c464b4809323374b1244701425f4b))
6
+
7
+
8
+ ### Dependencies
9
+
10
+ * **@visulima/rollup-plugin-dts:** upgraded to 1.0.0-alpha.30
11
+
12
+ ## @visulima/packem-rollup [1.0.0-alpha.68](https://github.com/visulima/packem/compare/@visulima/packem-rollup@1.0.0-alpha.67...@visulima/packem-rollup@1.0.0-alpha.68) (2026-06-02)
13
+
14
+ ### Features
15
+
16
+ * add duplicated package detector ([#203](https://github.com/visulima/packem/issues/203)) ([2b29466](https://github.com/visulima/packem/commit/2b29466bc7980477fe0e2a500feba2487dd7758a))
17
+
18
+
19
+ ### Dependencies
20
+
21
+ * **@visulima/packem-share:** upgraded to 1.0.0-alpha.48
22
+ * **@visulima/rollup-plugin-dts:** upgraded to 1.0.0-alpha.29
23
+
1
24
  ## @visulima/packem-rollup [1.0.0-alpha.67](https://github.com/visulima/packem/compare/@visulima/packem-rollup@1.0.0-alpha.66...@visulima/packem-rollup@1.0.0-alpha.67) (2026-06-01)
2
25
 
3
26
  ### Miscellaneous Chores
package/dist/index.d.ts CHANGED
@@ -42,10 +42,26 @@ export { importTrace, patchErrorWithTrace } from 'rollup-plugin-import-trace';
42
42
  import '@visulima/packem-share/utils';
43
43
  import "./packem_shared/types.d-DrgzeMBs.d-CG9J1x6q.js";
44
44
  import '@swc/types';
45
- interface BabelPluginConfig extends Omit<TransformOptions, "filename" | "sourceFileName" | "exclude" | "include"> {
45
+ interface BabelPluginConfig extends Omit<TransformOptions, "exclude" | "filename" | "include" | "sourceFileName"> {
46
46
  exclude?: FilterPattern;
47
47
  filename?: string;
48
48
  include?: FilterPattern;
49
+ /**
50
+ * Run Babel transforms in parallel across a worker pool.
51
+ * `false` always transforms in-process; `true`/`undefined` auto-enables workers
52
+ * once the build crosses `parallelThreshold` matched files (so small builds never
53
+ * pay the worker startup cost); a number caps the worker count (default min(cpus, 4)).
54
+ * Parallel mode requires fully serializable Babel options — when a non-serializable
55
+ * option is present (e.g. a function plugin, or a `babel` config supplied as a
56
+ * function) the plugin silently falls back to in-process transforms.
57
+ * @default true
58
+ */
59
+ parallel?: boolean | number;
60
+ /**
61
+ * Minimum number of matched files before the worker pool is created.
62
+ * @default 20
63
+ */
64
+ parallelThreshold?: number;
49
65
  sourceFileName?: string;
50
66
  }
51
67
  type OXCTransformPluginConfig = Omit<TransformOptions$1, "cwd" | "sourcemap" | "target" | "typescript"> & {
@@ -102,6 +118,40 @@ interface DebarrelPluginOptions {
102
118
  include?: FilterPattern;
103
119
  possibleBarrelFiles?: (RegExp | string)[];
104
120
  }
121
+ /**
122
+ * Collected duplicated-package information, keyed by package name, then version,
123
+ * then the resolved package directory, with the set of importers as the leaf value.
124
+ *
125
+ * ```plaintext
126
+ * Map {
127
+ * "axios" => Map {
128
+ * "1.4.0" => Map { "[dir]" => Set { "packages/pkg2/index.js" } },
129
+ * "0.27.2" => Map { "[dir]" => Set { "packages/pkg1/index.js" } }
130
+ * }
131
+ * }
132
+ * ```
133
+ */
134
+ type PackagesInfo = Map<string, Map<string, Map<string, Set<string>>>>;
135
+ interface DetectDuplicatedPluginOptions {
136
+ /** Build a custom message from the collected duplicates instead of the default report. */
137
+ customErrorMessage?: (packageToVersionsMap: PackagesInfo) => string;
138
+ /**
139
+ * Whether to report duplicated deps that are pulled in transitively by another dep under node_modules.
140
+ * When `false`, only duplicates imported directly by your own source are reported.
141
+ * @default true
142
+ */
143
+ deep?: boolean;
144
+ /**
145
+ * Duplicated dependencies to ignore. Pass `*` as a version to ignore all versions, e.g. `{ axios: ["0.17.4", "1.4.0"] }`.
146
+ * @default {} (ignore nothing)
147
+ */
148
+ ignore?: Record<string, string[]>;
149
+ /**
150
+ * Make the build fail when duplicated deps exist.
151
+ * @default false
152
+ */
153
+ throwErrorWhenDuplicated?: boolean;
154
+ }
105
155
  interface EsmShimCjsSyntaxOptions {
106
156
  exclude?: FilterPattern;
107
157
  include?: FilterPattern;
@@ -631,6 +681,12 @@ interface PackemRollupOptions {
631
681
  copy?: CopyPluginOptions | false;
632
682
  dataUri?: DataUriPluginOptions | false;
633
683
  debarrel?: DebarrelPluginOptions | false;
684
+ /**
685
+ * Detect dependencies that get bundled more than once (multiple versions, or
686
+ * the same version from multiple directories) and report them. Enabled by
687
+ * default; set to `false` to disable, or pass options to configure.
688
+ */
689
+ detectDuplicated?: DetectDuplicatedPluginOptions | false;
634
690
  dts?: Options$2;
635
691
  dynamicVars?: RollupDynamicImportVariablesOptions | false;
636
692
  esbuild?: Options$3 | false;
@@ -1,4 +1,4 @@
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(`
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
2
  `)}
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};
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/packem-rollup",
3
- "version": "1.0.0-alpha.67",
3
+ "version": "1.0.0-alpha.69",
4
4
  "description": "Rollup plugins for packem",
5
5
  "keywords": [
6
6
  "visulima",
@@ -93,9 +93,9 @@
93
93
  "@visulima/find-cache-dir": "3.0.0-alpha.9",
94
94
  "@visulima/fs": "5.0.0-alpha.24",
95
95
  "@visulima/package": "5.0.0-alpha.23",
96
- "@visulima/packem-share": "1.0.0-alpha.47",
96
+ "@visulima/packem-share": "1.0.0-alpha.48",
97
97
  "@visulima/path": "3.0.0-alpha.10",
98
- "@visulima/rollup-plugin-dts": "1.0.0-alpha.28",
98
+ "@visulima/rollup-plugin-dts": "1.0.0-alpha.30",
99
99
  "clean-css": "^5.3.3",
100
100
  "html-minifier-next": "6.2.7",
101
101
  "magic-string": "0.30.21",
@@ -109,7 +109,7 @@
109
109
  "peerDependencies": {
110
110
  "@swc/core": "*",
111
111
  "esbuild": "*",
112
- "rollup": ">=4.60.4",
112
+ "rollup": ">=4.61.0",
113
113
  "sucrase": "*"
114
114
  },
115
115
  "peerDependenciesMeta": {