@visulima/packem-rollup 1.0.0-alpha.68 → 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 +11 -0
- package/dist/index.d.ts +17 -1
- package/dist/plugins/preserve-directives.js +3 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
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
|
+
|
|
1
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)
|
|
2
13
|
|
|
3
14
|
### Features
|
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, "
|
|
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"> & {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
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
|
|
4
|
-
`)),!(
|
|
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.
|
|
3
|
+
"version": "1.0.0-alpha.69",
|
|
4
4
|
"description": "Rollup plugins for packem",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"visulima",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"@visulima/package": "5.0.0-alpha.23",
|
|
96
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.
|
|
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.
|
|
112
|
+
"rollup": ">=4.61.0",
|
|
113
113
|
"sucrase": "*"
|
|
114
114
|
},
|
|
115
115
|
"peerDependenciesMeta": {
|