@visulima/rollup-plugin-dts 1.0.0-alpha.3 → 1.0.0-alpha.30
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 +153 -0
- package/dist/filename.d.ts +2 -17
- package/dist/filename.js +1 -1
- package/dist/index.d.ts +98 -43
- package/dist/index.js +3 -3
- package/dist/packem_chunks/index.js +1 -1
- package/dist/packem_chunks/resolver.js +1 -1
- package/dist/packem_shared/createFakeJsPlugin-BmWTsDfe.js +3 -0
- package/dist/packem_shared/createGeneratePlugin-B0-c7yPx.js +1 -0
- package/dist/packem_shared/filename.d-BqANlmrG.d.ts +833 -0
- package/dist/packem_shared/generate-JArF6z_0.js +9 -0
- package/dist/packem_shared/resolveOptions-xvkhsYiy.js +1 -0
- package/package.json +16 -14
- package/dist/packem_shared/createFakeJsPlugin-C_PkEz9j.js +0 -1
- package/dist/packem_shared/createGeneratePlugin-BgPgGC2n.js +0 -1
- package/dist/packem_shared/generate-CxhgFvNH.js +0 -9
- package/dist/packem_shared/resolveOptions-CpYBT-5y.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,156 @@
|
|
|
1
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.30](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.29...@visulima/rollup-plugin-dts@1.0.0-alpha.30) (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
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.29](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.28...@visulima/rollup-plugin-dts@1.0.0-alpha.29) (2026-06-02)
|
|
8
|
+
|
|
9
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.28](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.27...@visulima/rollup-plugin-dts@1.0.0-alpha.28) (2026-06-01)
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **rollup-plugin-dts:** port missing features from rolldown-plugin-dts (≤ v0.25.2) ([f5185a4](https://github.com/visulima/packem/commit/f5185a4cb6f13ef8612cbcf3b520be66a25d144e)), closes [#242](https://github.com/visulima/packem/issues/242) [#243](https://github.com/visulima/packem/issues/243) [#246](https://github.com/visulima/packem/issues/246)
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **rollup-plugin-dts:** address code-review findings on the dts feature port ([64e4dab](https://github.com/visulima/packem/commit/64e4dabefba939d6a16067e4e3706ff7e5790373))
|
|
18
|
+
* **rollup-plugin-dts:** resolve remaining review findings ([7b60046](https://github.com/visulima/packem/commit/7b600469721655181677157e2c81d89910d7fb0a))
|
|
19
|
+
|
|
20
|
+
### Miscellaneous Chores
|
|
21
|
+
|
|
22
|
+
* **benchmarks:** port build-tool benchmark suite onto the 2.0 codebase ([#201](https://github.com/visulima/packem/issues/201)) ([8abdf09](https://github.com/visulima/packem/commit/8abdf0938bb7c5b2b7baabbb6d2698c73dba5d55))
|
|
23
|
+
|
|
24
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.27](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.26...@visulima/rollup-plugin-dts@1.0.0-alpha.27) (2026-05-28)
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
* rolldown ([#196](https://github.com/visulima/packem/issues/196)) ([197d465](https://github.com/visulima/packem/commit/197d465c2465993a17039319f8ede13398e00def))
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* **release:** break multi-semantic-release dependency cycle ([1443e4c](https://github.com/visulima/packem/commit/1443e4ca7bad413e52ea61a68f360dd5d355c570))
|
|
33
|
+
|
|
34
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.26](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.25...@visulima/rollup-plugin-dts@1.0.0-alpha.26) (2026-05-07)
|
|
35
|
+
|
|
36
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.25](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.24...@visulima/rollup-plugin-dts@1.0.0-alpha.25) (2026-04-27)
|
|
37
|
+
|
|
38
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.24](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.23...@visulima/rollup-plugin-dts@1.0.0-alpha.24) (2026-04-24)
|
|
39
|
+
|
|
40
|
+
### Bug Fixes
|
|
41
|
+
|
|
42
|
+
* **rollup-plugin-dts:** map cached `.d.ts` entries back to all source extensions ([5d8f670](https://github.com/visulima/packem/commit/5d8f670954806c6111eb90cff42e0faeef59dea1))
|
|
43
|
+
|
|
44
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.23](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.22...@visulima/rollup-plugin-dts@1.0.0-alpha.23) (2026-04-24)
|
|
45
|
+
|
|
46
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.22](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.21...@visulima/rollup-plugin-dts@1.0.0-alpha.22) (2026-04-24)
|
|
47
|
+
|
|
48
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.21](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.20...@visulima/rollup-plugin-dts@1.0.0-alpha.21) (2026-04-24)
|
|
49
|
+
|
|
50
|
+
### Bug Fixes
|
|
51
|
+
|
|
52
|
+
* **rollup-plugin-dts:** force re-transform for node_modules .d.ts too ([c93d34e](https://github.com/visulima/packem/commit/c93d34e588956920f9cc5958dcffe7eb0ffb3ee9))
|
|
53
|
+
|
|
54
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.20](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.19...@visulima/rollup-plugin-dts@1.0.0-alpha.20) (2026-04-24)
|
|
55
|
+
|
|
56
|
+
### Code Refactoring
|
|
57
|
+
|
|
58
|
+
* **rollup-plugin-dts:** improve sibling-dts fallback helper ([1df7353](https://github.com/visulima/packem/commit/1df735325914ced9ab7e2b73d6980e3243a43838))
|
|
59
|
+
|
|
60
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.19](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.18...@visulima/rollup-plugin-dts@1.0.0-alpha.19) (2026-04-24)
|
|
61
|
+
|
|
62
|
+
### Bug Fixes
|
|
63
|
+
|
|
64
|
+
* **rollup-plugin-dts:** sibling .d.ts fallback for string-form exports ([2a26b69](https://github.com/visulima/packem/commit/2a26b69b322375061cdcd55a14c72301085606ef))
|
|
65
|
+
|
|
66
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.18](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.17...@visulima/rollup-plugin-dts@1.0.0-alpha.18) (2026-04-24)
|
|
67
|
+
|
|
68
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.17](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.16...@visulima/rollup-plugin-dts@1.0.0-alpha.17) (2026-04-24)
|
|
69
|
+
|
|
70
|
+
### Bug Fixes
|
|
71
|
+
|
|
72
|
+
* correctly handle peer-dep/types-only/merged-declaration edge cases in DTS ([42b6f7c](https://github.com/visulima/packem/commit/42b6f7c0888b6e51f7755a1afca5954b1e8ba1d3))
|
|
73
|
+
|
|
74
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.16](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.15...@visulima/rollup-plugin-dts@1.0.0-alpha.16) (2026-04-24)
|
|
75
|
+
|
|
76
|
+
### Bug Fixes
|
|
77
|
+
|
|
78
|
+
* **rollup-plugin-dts:** inline bundled-package types in emitted .d.ts ([ce4c00d](https://github.com/visulima/packem/commit/ce4c00d24ebf14b25c799dc51f3b5f8939a9fae3))
|
|
79
|
+
|
|
80
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.15](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.14...@visulima/rollup-plugin-dts@1.0.0-alpha.15) (2026-04-24)
|
|
81
|
+
|
|
82
|
+
### Bug Fixes
|
|
83
|
+
|
|
84
|
+
* **rollup-plugin-dts:** don't force disk-mode for composite-only projects ([a2498f7](https://github.com/visulima/packem/commit/a2498f722ed30369ecb715381bed5ad607274967))
|
|
85
|
+
|
|
86
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.14](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.13...@visulima/rollup-plugin-dts@1.0.0-alpha.14) (2026-04-23)
|
|
87
|
+
|
|
88
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.13](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.12...@visulima/rollup-plugin-dts@1.0.0-alpha.13) (2026-04-23)
|
|
89
|
+
|
|
90
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.12](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.11...@visulima/rollup-plugin-dts@1.0.0-alpha.12) (2026-04-23)
|
|
91
|
+
|
|
92
|
+
### Bug Fixes
|
|
93
|
+
|
|
94
|
+
* **rollup-plugin-dts:** sync fixes from upstream rolldown-plugin-dts ([449794f](https://github.com/visulima/packem/commit/449794ff6b57e71957c8647c09c7d9145a07f3d0)), closes [sxzz/rolldown-plugin-dts#191](https://github.com/sxzz/rolldown-plugin-dts/issues/191)
|
|
95
|
+
|
|
96
|
+
### Miscellaneous Chores
|
|
97
|
+
|
|
98
|
+
* **rollup-plugin-dts:** restore isolatedDeclarationTransformer in build config ([46d54f4](https://github.com/visulima/packem/commit/46d54f4f590529abd88b998ab2ade4cd4a861571))
|
|
99
|
+
|
|
100
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.11](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.10...@visulima/rollup-plugin-dts@1.0.0-alpha.11) (2026-04-18)
|
|
101
|
+
|
|
102
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.10](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.9...@visulima/rollup-plugin-dts@1.0.0-alpha.10) (2026-04-16)
|
|
103
|
+
|
|
104
|
+
### Miscellaneous Chores
|
|
105
|
+
|
|
106
|
+
* bump node engines to ^22.14.0 || >=24.10.0 ([32f705a](https://github.com/visulima/packem/commit/32f705aa866f9daea6a094df74ef66aa8088e2c6))
|
|
107
|
+
|
|
108
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.9](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.8...@visulima/rollup-plugin-dts@1.0.0-alpha.9) (2026-03-28)
|
|
109
|
+
|
|
110
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.8](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.7...@visulima/rollup-plugin-dts@1.0.0-alpha.8) (2026-03-24)
|
|
111
|
+
|
|
112
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.7](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.6...@visulima/rollup-plugin-dts@1.0.0-alpha.7) (2026-03-24)
|
|
113
|
+
|
|
114
|
+
### Miscellaneous Chores
|
|
115
|
+
|
|
116
|
+
* allow typescript 5 and 6 in peerDependencies and examples ([de6362d](https://github.com/visulima/packem/commit/de6362d402f593c11a9eedd04d756d69bade4ac5))
|
|
117
|
+
|
|
118
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.6](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.5...@visulima/rollup-plugin-dts@1.0.0-alpha.6) (2026-03-24)
|
|
119
|
+
|
|
120
|
+
### Bug Fixes
|
|
121
|
+
|
|
122
|
+
* **rollup-plugin-dts:** only add export {} for declare module augmentations, not declare global ([c53e3db](https://github.com/visulima/packem/commit/c53e3dbce725ac2579eaa0fdca30e52fc8b43b89))
|
|
123
|
+
* **rollup-plugin-dts:** preserve export {} in module augmentation files ([43c7975](https://github.com/visulima/packem/commit/43c7975cdf1300fbd0e0c949f6b5c3851e5a937c))
|
|
124
|
+
* **rollup-plugin-dts:** preserve JSDoc comment positioning in type aliases ([436f8dc](https://github.com/visulima/packem/commit/436f8dcb4a6ce025a2eb7b537ee7f868f4bbed01))
|
|
125
|
+
|
|
126
|
+
### Tests
|
|
127
|
+
|
|
128
|
+
* **rollup-plugin-dts:** add triple-slash directive preservation test ([eacac81](https://github.com/visulima/packem/commit/eacac81d49d7ef5917cd7aaf10762dfdac040a0d))
|
|
129
|
+
|
|
130
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.5](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.4...@visulima/rollup-plugin-dts@1.0.0-alpha.5) (2026-03-24)
|
|
131
|
+
|
|
132
|
+
### Features
|
|
133
|
+
|
|
134
|
+
* **rollup-plugin-dts:** add include/exclude filter support ([5d76867](https://github.com/visulima/packem/commit/5d76867939d95c1d75469f85a59b9504f3c3f1e4))
|
|
135
|
+
|
|
136
|
+
### Bug Fixes
|
|
137
|
+
|
|
138
|
+
* **rollup-plugin-dts:** externalize scss/sass/less/styl/stylus imports ([183ff0b](https://github.com/visulima/packem/commit/183ff0b0e58c11d7ee0d11b6ab69b493f01f3b75))
|
|
139
|
+
* **rollup-plugin-dts:** handle function overloads in .d.ts bundling ([afe77ab](https://github.com/visulima/packem/commit/afe77ab941fc51d024c49fea58086d7a6b81073f))
|
|
140
|
+
* **rollup-plugin-dts:** support decorator auto-accessors in .d.ts parsing ([154795a](https://github.com/visulima/packem/commit/154795aa6f5d0f9b39c8ea39c18356bf285c15d4))
|
|
141
|
+
* updated deps ([a50675d](https://github.com/visulima/packem/commit/a50675d7f9a98236edd89bc39bc35b8cb4db1565))
|
|
142
|
+
|
|
143
|
+
### Miscellaneous Chores
|
|
144
|
+
|
|
145
|
+
* **rollup-plugin-dts:** add explicit return type to loadVueLanguageTools ([cf47a3c](https://github.com/visulima/packem/commit/cf47a3c60fe2c7931d23dedc4162789ce3a8b5c0))
|
|
146
|
+
|
|
147
|
+
### Tests
|
|
148
|
+
|
|
149
|
+
* **rollup-plugin-dts:** add regression tests for type modifier preservation through export * ([ca9fe87](https://github.com/visulima/packem/commit/ca9fe87b05f37afe6b80263d94b855ef69143ee3)), closes [#225](https://github.com/visulima/packem/issues/225)
|
|
150
|
+
* **rollup-plugin-dts:** add tests for overloads, scss, decorators, infer renaming ([36e0987](https://github.com/visulima/packem/commit/36e09874d3aba9b8f5361dd8899d56865d00bf0b))
|
|
151
|
+
|
|
152
|
+
## @visulima/rollup-plugin-dts [1.0.0-alpha.4](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.3...@visulima/rollup-plugin-dts@1.0.0-alpha.4) (2026-03-16)
|
|
153
|
+
|
|
1
154
|
## @visulima/rollup-plugin-dts [1.0.0-alpha.3](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.2...@visulima/rollup-plugin-dts@1.0.0-alpha.3) (2026-03-14)
|
|
2
155
|
|
|
3
156
|
## @visulima/rollup-plugin-dts [1.0.0-alpha.2](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-dts@1.0.0-alpha.1...@visulima/rollup-plugin-dts@1.0.0-alpha.2) (2026-03-06)
|
package/dist/filename.d.ts
CHANGED
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare const RE_JS: RegExp;
|
|
4
|
-
declare const RE_TS: RegExp;
|
|
5
|
-
declare const RE_DTS: RegExp;
|
|
6
|
-
declare const RE_DTS_MAP: RegExp;
|
|
7
|
-
declare const RE_NODE_MODULES: RegExp;
|
|
8
|
-
declare const RE_CSS: RegExp;
|
|
9
|
-
declare const RE_VUE: RegExp;
|
|
10
|
-
declare const RE_JSON: RegExp;
|
|
11
|
-
declare const filename_js_to_dts: (id: string) => string;
|
|
12
|
-
declare const filename_to_dts: (id: string) => string;
|
|
13
|
-
declare const filename_dts_to: (id: string, extension: "js" | "ts") => string;
|
|
14
|
-
declare const resolveTemplateFn: (function_: ((chunk: PreRenderedChunk) => string) | string, chunk: PreRenderedChunk) => string;
|
|
15
|
-
declare const replaceTemplateName: (template: string, name: string) => string;
|
|
16
|
-
|
|
17
|
-
export { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_JSON, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts, replaceTemplateName, resolveTemplateFn };
|
|
1
|
+
export { a as RE_CSS, b as RE_DTS, c as RE_DTS_MAP, d as RE_JS, e as RE_JSON, f as RE_NODE_MODULES, g as RE_TS, h as RE_VUE, i as filenameDtsTo, j as filenameJsToDts, k as filenameToDts, r as replaceTemplateName, l as resolveTemplateFunction } from "./packem_shared/filename.d-BqANlmrG.js";
|
|
2
|
+
import 'estree';
|
package/dist/filename.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var c=Object.defineProperty;var a=(e,s)=>c(e,"name",{value:s,configurable:!0});var m=Object.defineProperty,t=a((e,s)=>m(e,"name",{value:s,configurable:!0}),"t");const l=/\.([cm]?)jsx?$/,n=/\.([cm]?)tsx?$/,o=/\.d\.([cm]?)ts$/,$=/\.d\.([cm]?)ts\.map$/,i=/[\\/]node_modules[\\/]/,E=/\.(?:css|scss|sass|less|styl|stylus)$/,r=/\.vue$/,p=/\.json$/,_=t(e=>e.replace(l,".d.$1ts"),"filenameJsToDts"),f=t(e=>e.replace(r,".vue.ts").replace(n,".d.$1ts").replace(l,".d.$1ts").replace(p,".json.d.ts"),"filenameToDts"),u=t((e,s)=>e.replace(o,`.$1${s}`),"filenameDtsTo"),D=t((e,s)=>typeof e=="function"?e(s):e,"resolveTemplateFunction"),d=t((e,s)=>e.replaceAll("[name]",s),"replaceTemplateName");export{E as RE_CSS,o as RE_DTS,$ as RE_DTS_MAP,l as RE_JS,p as RE_JSON,i as RE_NODE_MODULES,n as RE_TS,r as RE_VUE,u as filenameDtsTo,_ as filenameJsToDts,f as filenameToDts,d as replaceTemplateName,D as resolveTemplateFunction};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,56 +1,111 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { R as RenderedChunk, P as Plugin } from "./packem_shared/filename.d-BqANlmrG.js";
|
|
2
|
+
export { a as RE_CSS, b as RE_DTS, c as RE_DTS_MAP, d as RE_JS, e as RE_JSON, f as RE_NODE_MODULES, g as RE_TS, h as RE_VUE } from "./packem_shared/filename.d-BqANlmrG.js";
|
|
2
3
|
import { TsConfigJson } from '@visulima/tsconfig';
|
|
3
4
|
import { IsolatedDeclarationsOptions } from 'oxc-transform';
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
import 'estree';
|
|
6
|
+
type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
|
|
7
|
+
type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | undefined;
|
|
8
|
+
interface TsgoOptions {
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
path?: string;
|
|
11
|
+
}
|
|
6
12
|
interface GeneralOptions {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
cjsDefault?: boolean;
|
|
14
|
+
compilerOptions?: TsConfigJson.CompilerOptions;
|
|
15
|
+
cwd?: string;
|
|
16
|
+
dtsInput?: boolean;
|
|
17
|
+
emitDtsOnly?: boolean;
|
|
18
|
+
entry?: string | string[];
|
|
19
|
+
exclude?: FilterPattern;
|
|
20
|
+
include?: FilterPattern;
|
|
21
|
+
resolve?: boolean | (string | RegExp)[];
|
|
22
|
+
resolver?: "oxc" | "tsc";
|
|
23
|
+
sideEffects?: boolean;
|
|
24
|
+
sourcemap?: boolean;
|
|
25
|
+
tsconfig?: string | boolean;
|
|
26
|
+
tsconfigRaw?: Omit<TsConfigJson, "compilerOptions">;
|
|
18
27
|
}
|
|
19
28
|
interface TscOptions {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
banner?: string | Promise<string> | AddonFunction;
|
|
30
|
+
build?: boolean;
|
|
31
|
+
eager?: boolean;
|
|
32
|
+
emitJs?: boolean;
|
|
33
|
+
footer?: string | Promise<string> | AddonFunction;
|
|
34
|
+
incremental?: boolean;
|
|
35
|
+
newContext?: boolean;
|
|
36
|
+
parallel?: boolean;
|
|
37
|
+
tsMacro?: boolean;
|
|
38
|
+
vue?: boolean;
|
|
30
39
|
}
|
|
31
40
|
interface Options extends GeneralOptions, TscOptions {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
path?: string;
|
|
35
|
-
};
|
|
41
|
+
oxc?: boolean | Omit<IsolatedDeclarationsOptions, "sourcemap">;
|
|
42
|
+
tsgo?: boolean | TsgoOptions;
|
|
36
43
|
}
|
|
37
44
|
type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
38
45
|
type MarkPartial<T, K extends keyof T> = Omit<Required<T>, K> & Partial<Pick<T, K>>;
|
|
39
46
|
type OptionsResolved = Overwrite<MarkPartial<Omit<Options, "compilerOptions">, "banner" | "footer">, {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
entry?: string[];
|
|
48
|
+
exclude: FilterPattern;
|
|
49
|
+
include: FilterPattern;
|
|
50
|
+
oxc: IsolatedDeclarationsOptions | false;
|
|
51
|
+
tsconfig?: string;
|
|
52
|
+
tsconfigRaw: TsConfigJson;
|
|
53
|
+
tsgo: {
|
|
54
|
+
path?: string;
|
|
55
|
+
} | false;
|
|
46
56
|
}>;
|
|
47
|
-
declare const resolveOptions: ({
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
declare const resolveOptions: ({
|
|
58
|
+
banner,
|
|
59
|
+
build,
|
|
60
|
+
cjsDefault,
|
|
61
|
+
compilerOptions: userCompilerOptions,
|
|
62
|
+
cwd,
|
|
63
|
+
dtsInput,
|
|
64
|
+
eager,
|
|
65
|
+
emitDtsOnly,
|
|
66
|
+
emitJs: emitJsOption,
|
|
67
|
+
entry,
|
|
68
|
+
exclude,
|
|
69
|
+
footer,
|
|
70
|
+
include,
|
|
71
|
+
incremental: incrementalOption,
|
|
72
|
+
newContext,
|
|
73
|
+
oxc: oxcOption,
|
|
74
|
+
parallel,
|
|
75
|
+
resolve,
|
|
76
|
+
resolver,
|
|
77
|
+
sideEffects,
|
|
78
|
+
sourcemap: sourcemapOption,
|
|
79
|
+
tsconfig: tsconfigOption,
|
|
80
|
+
tsconfigRaw: overriddenTsconfigRaw,
|
|
81
|
+
tsgo: tsgoOption,
|
|
82
|
+
tsMacro,
|
|
83
|
+
vue
|
|
84
|
+
}: Options) => OptionsResolved;
|
|
85
|
+
declare const createFakeJsPlugin: ({
|
|
86
|
+
cjsDefault,
|
|
87
|
+
sideEffects,
|
|
88
|
+
sourcemap
|
|
89
|
+
}: Pick<OptionsResolved, "sourcemap" | "cjsDefault" | "sideEffects">) => Plugin;
|
|
90
|
+
declare const createGeneratePlugin: ({
|
|
91
|
+
build,
|
|
92
|
+
cwd,
|
|
93
|
+
eager,
|
|
94
|
+
emitDtsOnly,
|
|
95
|
+
emitJs,
|
|
96
|
+
entry,
|
|
97
|
+
exclude,
|
|
98
|
+
include,
|
|
99
|
+
incremental,
|
|
100
|
+
newContext,
|
|
101
|
+
oxc,
|
|
102
|
+
parallel,
|
|
103
|
+
sourcemap,
|
|
104
|
+
tsconfig,
|
|
105
|
+
tsconfigRaw,
|
|
106
|
+
tsgo,
|
|
107
|
+
tsMacro,
|
|
108
|
+
vue
|
|
109
|
+
}: Pick<OptionsResolved, "cwd" | "tsconfig" | "tsconfigRaw" | "build" | "incremental" | "oxc" | "emitDtsOnly" | "vue" | "tsMacro" | "parallel" | "eager" | "tsgo" | "newContext" | "emitJs" | "sourcemap" | "include" | "exclude" | "entry">) => Plugin;
|
|
53
110
|
declare const dts: (options?: Options) => Plugin[];
|
|
54
|
-
|
|
55
|
-
export { createFakeJsPlugin, createGeneratePlugin, dts, resolveOptions };
|
|
56
|
-
export type { Options };
|
|
111
|
+
export { type FilterPattern, type Options, createFakeJsPlugin, createGeneratePlugin, dts, resolveOptions };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)}if(e){const l=await(typeof e=="function"?e(
|
|
3
|
-
${l}`)}return{code:
|
|
1
|
+
var T=Object.defineProperty;var p=(t,e)=>T(t,"name",{value:e,configurable:!0});import{createDebug as j}from"obug";import I from"magic-string";import{RE_DTS as g,resolveTemplateFunction as J,replaceTemplateName as _,RE_TS as A,RE_VUE as C,RE_JSON as M,RE_CSS as W,filenameToDts as D,RE_NODE_MODULES as P,RE_JS as B,filenameJsToDts as U}from"./filename.js";import{RE_DTS_MAP as ye}from"./filename.js";import q from"./packem_shared/createFakeJsPlugin-BmWTsDfe.js";import{c as z}from"./packem_shared/generate-JArF6z_0.js";import{resolveOptions as G}from"./packem_shared/resolveOptions-xvkhsYiy.js";import{existsSync as $,readFileSync as L}from"node:fs";import h from"node:path";import{ResolverFactory as V}from"oxc-resolver";var H=Object.defineProperty,K=p((t,e)=>H(t,"name",{value:e,configurable:!0}),"o$2");const Q=K(({banner:t,footer:e})=>({name:"rollup-plugin-dts:banner",async renderChunk(n,i){if(!g.test(i.fileName))return;const a=new I(n);if(t){const l=await(typeof t=="function"?t(i):t);l&&a.prepend(`${l}
|
|
2
|
+
`)}if(e){const l=await(typeof e=="function"?e(i):e);l&&a.append(`
|
|
3
|
+
${l}`)}return{code:a.toString(),get map(){return a.generateMap({hires:"boundary",includeContent:!0,source:i.fileName})}}}}),"createBannerPlugin");var X=Object.defineProperty,Y=p((t,e)=>X(t,"name",{value:e,configurable:!0}),"o$1");const Z=Y(({entry:t,sideEffects:e})=>({buildStart(){t&&this.warn("The `entry` option has no effect in `dtsInput` mode; control which declaration files are emitted via the plugin's input list instead.")},name:"rollup-plugin-dts:dts-input",options:e?void 0:n=>({treeshake:n.treeshake===!1?!1:{...typeof n.treeshake=="object"?n.treeshake:{},moduleSideEffects:!1},...n}),outputOptions(n){return{...n,entryFileNames(i){const{entryFileNames:a}=n;if(a){const l=J(a,i),b=_(l,i.name);if(g.test(b))return l;const m=_(l,`${i.name}.d`);if(g.test(m))return m}return g.test(i.name)?i.name:i.name.endsWith(".d")?"[name].ts":"[name].d.ts"}}}}),"createDtsInputPlugin");var ee=Object.defineProperty,E=p((t,e)=>ee(t,"name",{value:e,configurable:!0}),"c");const v=E(t=>A.test(t)||C.test(t)||M.test(t),"isSourceFile"),te=E(({cwd:t,resolve:e,resolver:n,sideEffects:i,tsconfig:a,tsconfigRaw:l})=>{const b=new V({conditionNames:["types","typings","import","require"],mainFields:["types","typings","module","main"],tsconfig:a?{configFile:a,references:"auto"}:void 0}),m=i?!0:null;return{name:"rollup-plugin-dts:resolver",resolveId:{async handler(s,o,c){if(!o||!g.test(o))return;const r={external:!0,id:s,moduleSideEffects:i};if(W.test(s))return r;if(!y(s)&&w(s)){const u=await F(s,o,null);if(u&&g.test(u))return{id:u,moduleSideEffects:m};if(u&&v(u))return await this.load({id:u}),{id:D(u),moduleSideEffects:m}}const f=await this.resolve(s,o,c);if(f?.external)return r;const d=await F(s,o,f);return d?P.test(d)&&!w(s)&&!(y(s)&&P.test(o)&&k(o))?r:g.test(d)?{id:d,moduleSideEffects:m}:v(d)?(await this.load({id:d}),{id:D(d),moduleSideEffects:m}):null:y(s)?null:r},order:"pre"}};function w(s){return typeof e=="boolean"?e:e.some(o=>typeof o=="string"?s===o:o.test(s))}function k(s){const o=s.replaceAll("\\","/"),c="/node_modules/",r=o.lastIndexOf(c);if(r===-1)return!1;const f=o.slice(r+c.length),d=f.indexOf("/");let u=d===-1?f:f.slice(0,d);if(u.startsWith("@")){const O=f.slice(u.length+1),R=O.indexOf("/"),N=R===-1?O:O.slice(0,R);u=`${u}/${N}`}return w(u)}async function F(s,o,c){let r;if(n==="tsc"){const{default:f}=await import("./packem_chunks/resolver.js");r=f(s,o,t,a,l)}else r=b.resolveDtsSync(o,s).path;if(r&&(r=h.normalize(r)),r&&B.test(r)&&ne(r)){const f=U(r);if($(f))return f}return!r||!v(r)?c&&y(c.id)&&v(c.id)&&!c.external?c.id:null:r}},"createDtsResolvePlugin"),y=E(t=>t.startsWith(".")||h.isAbsolute(t),"isFilePath"),S=new Map,ne=E(t=>{const e=h.dirname(t);if(S.has(e))return S.get(e);let n=e;for(;n!==h.dirname(n);){const i=h.join(n,"package.json");if($(i)){let a=!1;try{const{exports:l}=JSON.parse(L(i,"utf8"));a=l===void 0||typeof l=="string"}catch{}return S.set(e,a),a}n=h.dirname(n)}return S.set(e,!1),!1},"canFallBackToSiblingDts");var re=Object.defineProperty,se=p((t,e)=>re(t,"name",{value:e,configurable:!0}),"o");const x=j("rollup-plugin-dts:options"),ge=se((t={})=>{x("resolving dts options");const e=G(t);x("resolved dts options %o",e);const n=[];return t.dtsInput?n.push(Z(e)):n.push(z(e)),n.push(te(e),q(e)),(t.banner||t.footer)&&n.push(Q(e)),n},"dts");export{W as RE_CSS,g as RE_DTS,ye as RE_DTS_MAP,B as RE_JS,M as RE_JSON,P as RE_NODE_MODULES,A as RE_TS,C as RE_VUE,q as createFakeJsPlugin,z as createGeneratePlugin,ge as dts,G as resolveOptions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var q=Object.defineProperty;var h=(e,t)=>q(e,"name",{value:t,configurable:!0});import{createDebug as P}from"obug";import u from"typescript";import{g as F
|
|
1
|
+
var q=Object.defineProperty;var h=(e,t)=>q(e,"name",{value:t,configurable:!0});import{createDebug as P}from"obug";import u from"typescript";import{g as F}from"../packem_shared/generate-JArF6z_0.js";import{posix as w}from"node:path";import{pathToFileURL as j}from"node:url";import{dirname as N}from"@visulima/path";var T=Object.defineProperty,S=h((e,t)=>T(e,"name",{value:t,configurable:!0}),"i");const U=P("rollup-plugin-dts:tsc-system"),x=S(e=>({...u.sys,deleteFile(t,...r){e.delete(t),u.sys.deleteFile?.(t,...r)},directoryExists(t){return[...e.keys()].some(r=>r.startsWith(t))?!0:u.sys.directoryExists(t)},fileExists(t){return e.has(t)?!0:u.sys.fileExists(t)},readFile(t,...r){return e.has(t)?e.get(t):u.sys.readFile(t,...r)},resolvePath(t){return e.has(t)?t:u.sys.resolvePath(t)},write(t){U(t)},writeFile(t,r,...o){e.set(t,r),u.sys.writeFile(t,r,...o)}}),"createFsSystem"),B=S(e=>({...x(e),deleteFile(t){e.delete(t)},writeFile(t,r){e.set(t,r)}}),"createMemorySystem");var J=Object.defineProperty,$=h((e,t)=>J(e,"name",{value:t,configurable:!0}),"o$1");const W=$(e=>{const t=$(r=>u.isPropertySignature(r)&&u.isPrivateIdentifier(r.name)?e.factory.updatePropertySignature(r,r.modifiers,e.factory.createStringLiteral(r.name.text),r.questionToken,r.type):u.visitEachChild(r,t,e),"visitor");return r=>u.visitNode(r,t,u.isSourceFile)},"stripPrivateFields"),M={getCanonicalFileName:u.sys.useCaseSensitiveFileNames?e=>e:e=>e.toLowerCase(),getCurrentDirectory:$(()=>u.sys.getCurrentDirectory(),"getCurrentDirectory"),getNewLine:$(()=>u.sys.newLine,"getNewLine")},O={afterDeclarations:[W]},R=$((e,t,r)=>{if(!e||e.sourceRoot)return;const o=w.dirname(j(t).pathname),s=w.dirname(j(r).pathname);o!==s&&(e.sourceRoot=w.relative(s,o))},"setSourceMapRoot");var z=Object.defineProperty,m=h((e,t)=>z(e,"name",{value:t,configurable:!0}),"f$1");const g=P("rollup-plugin-dts:tsc-build"),H=m((e,t,r,o,s)=>{let i=e.projects.get(r);return i?(g(`skip building projects for ${r}`),i):(i=G(t,r,o,s),e.projects.set(r,i),i)},"getOrBuildProjects"),G=m((e,t,r,o)=>{g(`start building projects for ${t}`);const s=V(t,e,r,o);g("collected %d projects: %j",s.length,s.map(n=>n.tsconfigPath));const i=u.createSolutionBuilderHost(e,I),l=u.createSolutionBuilder(i,[t],{force:r,verbose:!0}).build(void 0,void 0,void 0,n=>(g(`transforming project ${n}`),O));g(`built solution for ${t} with exit status ${l}`);const a=new Map;for(const n of s)for(const c of n.parsedConfig.fileNames)a.set(e.resolvePath(c),n);return a},"buildProjects"),V=m((e,t,r,o)=>{const s=new Set,i=[],l=[t.resolvePath(e)];for(;;){const a=l.pop();if(!a)break;if(s.has(a))continue;s.add(a);const n=A(a,t);if(n){n.options=D(n.options,{force:r,sourcemap:o,tsconfigPath:a}),i.push({parsedConfig:n,tsconfigPath:a});for(const c of n.projectReferences??[])l.push(u.resolveProjectReferencePath(c))}}return i},"collectProjectGraph"),A=m((e,t)=>{const r=[],o=u.getParsedCommandLineOfConfigFile(e,void 0,{...t,onUnRecoverableConfigFileDiagnostic:m(s=>{r.push(s)},"onUnRecoverableConfigFileDiagnostic")});if(r.length>0)throw new Error(`[rollup-plugin-dts] Unable to read ${e}: ${u.formatDiagnostics(r,M)}`);return o},"parseTsconfig"),D=m((e,t)=>{const r=e.noEmit??!1,o=e.declaration??!!e.composite,s=e.declarationMap??!1,i=t?.tsconfigPath&&!t.force;return r&&(e={...e,noEmit:!1},i&&console.warn(`[rollup-plugin-dts] ${t.tsconfigPath} has "noEmit" set to true. Please set it to false to generate declaration files.`)),o||(e={...e,declaration:!0},i&&console.warn(`[rollup-plugin-dts] ${t.tsconfigPath} has "declaration" set to false. Please set it to true to generate declaration files.`)),!s&&t?.sourcemap&&(e={...e,declarationMap:!0},i&&console.warn(`[rollup-plugin-dts] ${t.tsconfigPath} has "declarationMap" set to false. Please set it to true if you want to generate source maps for declaration files.`)),e},"patchCompilerOptions"),I=m((e,t,...r)=>u.createEmitAndSemanticDiagnosticsBuilderProgram(e,D(t??{},null),...r),"createProgramWithPatchedCompilerOptions"),L=m(e=>{const{context:t=F,id:r,incremental:o,sourcemap:s,tsconfig:i}=e;if(g(`running tscEmitBuild id: ${r}, tsconfig: ${i}, incremental: ${o}`),!i)return{error:"[rollup-plugin-dts] build mode requires a tsconfig path"};const l=(o?x:B)(t.files),a=l.resolvePath(r);a!==r&&g(`resolved id from ${r} to ${a}`);const n=H(t,l,i,!o,s).get(a);if(!n)return g(`unable to locate a project containing ${a}`),{error:`Unable to locate ${r} from the given tsconfig file ${i}`};g(`loaded project ${n.tsconfigPath} for ${r}`);const c=!l.useCaseSensitiveFileNames,f=u.getOutputFileNames(n.parsedConfig,a,c);let v,y;for(const d of f){if(d.endsWith(".d.ts")){if(!l.fileExists(d)){console.warn(`[rollup-plugin-dts] Unable to read file ${d}`);continue}v=l.readFile(d);continue}if(d.endsWith(".d.ts.map")){if(!l.fileExists(d))continue;const E=l.readFile(d);if(!E){console.warn(`[rollup-plugin-dts] Unexpected sourcemap ${d}`);continue}y=JSON.parse(E),R(y,d,a)}}return v?{code:v,map:y}:o?(g("incremental build failed"),L({...e,incremental:!1})):(g(`unable to build .d.ts file for ${r}`),n.parsedConfig.options.declaration!==!0?{error:`Unable to build .d.ts file for ${r}; Make sure the "declaration" option is set to true in ${n.tsconfigPath}`}:{error:`Unable to build .d.ts file for ${r}; This seems like a bug of rollup-plugin-dts. Please report this issue to https://github.com/sxzz/rollup-plugin-dts/issues`})},"tscEmitBuild");var K=Object.defineProperty,b=h((e,t)=>K(e,"name",{value:t,configurable:!0}),"g");const Y=b(()=>{const e=P("rollup-plugin-dts:vue");e("loading vue language tools");try{const t=require.resolve("vue-tsc"),{proxyCreateProgram:r}=require(require.resolve("@volar/typescript",{paths:[t]})),o=require(require.resolve("@vue/language-core",{paths:[t]}));return{getLanguagePlugin:b((s,i)=>{const l=i.options.$rootDir,a=i.options.$configRaw,n=new o.CompilerOptionsResolver(s,s.sys.readFile);n.addConfig(a?.vueCompilerOptions??{},l);const c=n.build();return o.createVueLanguagePlugin(s,i.options,c,f=>f)},"getLanguagePlugin"),proxyCreateProgram:r}}catch(t){throw e("vue language tools not found",t),new Error("Failed to load vue language tools. Please manually install vue-tsc.")}},"loadVueLanguageTools"),Q=b(()=>{const e=P("rollup-plugin-dts:ts-macro");e("loading ts-macro language tools");try{const t=require.resolve("@ts-macro/tsc"),{proxyCreateProgram:r}=require(require.resolve("@volar/typescript",{paths:[t]})),o=require(require.resolve("@ts-macro/language-plugin",{paths:[t]})),{getOptions:s}=require(require.resolve("@ts-macro/language-plugin/options",{paths:[t]}));return{getLanguagePlugin:b((i,l)=>{const a=l.options.$rootDir;return o.getLanguagePlugins(i,l.options,s(i,a))[0]},"getLanguagePlugin"),proxyCreateProgram:r}}catch(t){throw e("ts-macro language tools not found",t),new Error("Failed to load ts-macro language tools. Please manually install @ts-macro/tsc.")}},"loadTsMacro"),X=b((e,t)=>{const r=t.vue?Y():void 0,o=t.tsMacro?Q():void 0,s=r?.proxyCreateProgram||o?.proxyCreateProgram;return s?s(e,e.createProgram,(i,l)=>{const a=[];return r&&a.push(r.getLanguagePlugin(i,l)),o&&a.push(o.getLanguagePlugin(i,l)),{languagePlugins:a}}):e.createProgram},"createProgramFactory");var Z=Object.defineProperty,C=h((e,t)=>Z(e,"name",{value:t,configurable:!0}),"m");const p=P("rollup-plugin-dts:tsc-compiler"),_={checkJs:!1,declaration:!0,declarationMap:!1,emitDeclarationOnly:!0,moduleResolution:u.ModuleResolutionKind.Bundler,noEmit:!1,noEmitOnError:!0,resolveJsonModule:!0,skipLibCheck:!0,target:99},ee=C(({baseDirectory:e,entries:t,fsSystem:r,id:o,parsedConfig:s,tsMacro:i,vue:l})=>{const a={..._,...s.options,$configRaw:s.raw,$rootDir:e},n=[...new Set([o,...t??s.fileNames].map(y=>r.resolvePath(y)))],c=u.createCompilerHost(a,!0),f=X(u,{tsMacro:i,vue:l})({host:c,options:a,projectReferences:s.projectReferences,rootNames:n}),v=f.getSourceFile(o);if(!v)throw p(`source file not found in program: ${o}`),s.projectReferences?.length?new Error(`[rollup-plugin-dts] Unable to load ${o}; You have "references" in your tsconfig file. Perhaps you want to add \`dts: { build: true }\` in your config?`):r.fileExists(o)?(p(`File ${o} exists on disk.`),new Error(`Unable to load file ${o} from the program. This seems like a bug of rollup-plugin-dts. Please report this issue to https://github.com/sxzz/rollup-plugin-dts/issues`)):(p(`File ${o} does not exist on disk.`),new Error(`Source file not found: ${o}`));return{file:v,program:f}},"createTsProgramFromParsedConfig"),te=C(({context:e=F,cwd:t,entries:r,id:o,tsconfig:s,tsconfigRaw:i,tsMacro:l,vue:a})=>{const n=x(e.files),c=s?N(s):t,f=u.parseJsonConfigFileContent(i,n,c);return p(`Creating program for root project: ${c}`),ee({baseDirectory:c,entries:r,fsSystem:n,id:o,parsedConfig:f,tsMacro:l,vue:a})},"createTsProgram"),re=C(e=>{const{context:t=F,entries:r,id:o}=e,s=t.programs.find(l=>{const a=l.getRootFileNames();return r?r.every(n=>a.includes(n)):a.includes(o)});if(s){const l=s.getSourceFile(o);if(l)return{file:l,program:s}}p(`create program for module: ${o}`);const i=te(e);return p(`created program for module: ${o}`),t.programs.push(i.program),i},"createOrGetTsModule"),oe=C(e=>{p(`running tscEmitCompiler ${e.id}`);const t=re(e),{file:r,program:o}=t;p(`got source file: ${r.fileName}`);let s,i;const{diagnostics:l,emitSkipped:a}=o.emit(r,(n,c)=>{n.endsWith(".map")?(p(`emit dts sourcemap: ${n}`),i=JSON.parse(c),R(i,n,e.id)):(p(`emit dts: ${n}`),s=c)},void 0,!0,O,!0);return a&&l.length>0?{error:u.formatDiagnostics(l,M)}:(!s&&r.isDeclarationFile&&(p("nothing was emitted. fallback to sourceFile text."),s=r.getFullText()),{code:s,map:i})},"tscEmitCompiler");var se=Object.defineProperty,ie=h((e,t)=>se(e,"name",{value:t,configurable:!0}),"r");const k=P("rollup-plugin-dts:tsc");k(`loaded typescript: ${u.version}`);const de=ie(e=>(k(`running tscEmit ${e.id}`),e.build?L(e):oe(e)),"tscEmit");export{de as tscEmit};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var m=Object.defineProperty;var l=(e,o)=>m(e,"name",{value:o,configurable:!0});import p from"node:path";import{createDebug as v}from"obug";import r from"typescript";var c=Object.defineProperty,f=l((e,o)=>c(e,"name",{value:o,configurable:!0}),"t");const g=v("rollup-plugin-dts:tsc-resolver"),F=f((e,o,n,s,i,
|
|
1
|
+
var m=Object.defineProperty;var l=(e,o)=>m(e,"name",{value:o,configurable:!0});import p from"node:path";import{createDebug as v}from"obug";import r from"typescript";var c=Object.defineProperty,f=l((e,o)=>c(e,"name",{value:o,configurable:!0}),"t");const g=v("rollup-plugin-dts:tsc-resolver"),F=f((e,o,n,s,i,d)=>{const u=s?p.dirname(s):n,a=r.parseJsonConfigFileContent(i,r.sys,u),t=r.bundlerModuleNameResolver(e,o,a.options,r.sys,void 0,d);return g('tsc resolving id "%s" from "%s" -> %O',e,o,t.resolvedModule),t.resolvedModule?.resolvedFileName},"tscResolve");export{F as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var De=Object.defineProperty;var j=(e,t)=>De(e,"name",{value:t,configurable:!0});import ie from"node:path";import{generate as ae}from"@babel/generator";import{isIdentifierName as ve}from"@babel/helper-validator-identifier";import{parse as se}from"@babel/parser";import x from"@babel/types";import{isTypeOf as J,isDeclarationType as Te,walkAST as q,walkASTAsync as Ie,isIdentifierOf as ee,resolveString as Q,extractIdentifiers as Ne}from"ast-kit";import{RE_DTS as $,resolveTemplateFunction as we,filenameJsToDts as le,replaceTemplateName as pe,filenameDtsTo as de,RE_DTS_MAP as Oe,RE_NODE_MODULES as Ce,filenameToDts as Me}from"../filename.js";var Ae=Object.defineProperty,d=j((e,t)=>Ae(e,"name",{value:t,configurable:!0}),"o");const X="__rollup_dts_resolve__:",st=d(({cjsDefault:e,sideEffects:t,sourcemap:i})=>{let r=0;const m=new Map,b=new Map,v=new Map,C=new Set;let O;return{generateBundle(u,a){const S=new Map;for(const o of Object.values(a))if(o.type==="chunk")for(const h of o.moduleIds)S.set(h,o.fileName);const y=new RegExp(`"${X}(.+?)"`,"g");for(const o of Object.values(a))o.type!=="chunk"||!$.test(o.fileName)||o.code.includes(X)&&(o.code=o.code.replaceAll(y,(h,_)=>{const k=S.get(_);if(!k)return h;let N=ie.posix.relative(ie.posix.dirname(o.fileName),k);return N.startsWith(".")||(N=`./${N}`),N=de(N,"js"),JSON.stringify(N)}));for(const o of Object.values(a))if(Oe.test(o.fileName))if(i){if(o.type==="chunk"||typeof o.source!="string")continue;const h=JSON.parse(o.source);h.sourcesContent=void 0,o.source=JSON.stringify(h)}else delete a[o.fileName]},name:"rollup-plugin-dts:fake-js",outputOptions(u){const{chunkFileNames:a,entryFileNames:S}=u;return(u.format==="cjs"||u.format==="commonjs")&&(u={...u,format:"es"}),{...u,chunkFileNames(y){const o=we(y.isEntry?S||"[name].js":a||"[name]-[hash].js",y);if(y.name.endsWith(".d")){const h=le(pe(o,y.name.slice(0,-2)));if($.test(h))return h;const _=le(pe(o,y.name));if($.test(_))return _}return o},sourcemap:u.sourcemap||i}},renderChunk:P,renderStart(){O=void 0},async transform(u,a){if($.test(a))return F.call(this,u,a)}};async function F(u,a){const S=Object.create(null);let y;try{y=se(u,{createParenthesizedExpressions:!0,errorRecovery:!0,plugins:[["typescript",{dts:!0}],"decoratorAutoAccessors"],sourceType:"module"})}catch(g){throw new Error(`Failed to parse ${a}. This may be caused by a syntax error in the declaration file or a bug in the plugin. Please report this issue to https://github.com/visulima/packem
|
|
2
|
+
${g}`,{cause:g})}const{comments:o,program:h}=y;if(!C.has(a)&&h.body.some(g=>ke(g))&&(C.add(a),this.warn(Ce.test(a)?`${a} uses CommonJS dts syntax. CommonJS dts modules cannot be reliably bundled by @visulima/rollup-plugin-dts. Please mark this module as external in your Rollup config.`:`${a} uses CommonJS dts syntax. @visulima/rollup-plugin-dts does not support reliably bundling CommonJS dts input.`)),v.set(a,await Ke(this,h.body,a)),o){const g=ye(o);b.set(a,g)}const _=[],k=new Map,N=new Map,p=new Set;for(const[g,s]of h.body.entries()){const T=d(f=>h.body[g]=f,"setStmt");if(Xe(s,T))continue;if(s.type==="TSNamespaceExportDeclaration"){p.add(g);continue}const n=s.type==="TSModuleDeclaration"&&s.kind!=="namespace";let R;if(n&&s.id.type==="StringLiteral"){const f=await this.resolve(s.id.value,a);f&&!f.external?R=$.test(f.id)?f.id:Me(f.id):s.id.value[0]==="."&&this.warn(`\`declare module ${JSON.stringify(s.id.value)}\` will be kept as-is in the output. Relative module declaration may cause unexpected issues. Found in ${a}.`)}if(n&&a.endsWith(".vue.d.ts")&&u.slice(s.start,s.end).includes("__VLS_"))continue;const c=s.type==="ExportDefaultDeclaration",L=J(s,["ExportNamedDeclaration","ExportDefaultDeclaration"])&&s.declaration,I=L?s.declaration:s,H=L?f=>s.declaration=f:T;if(I.type!=="TSDeclareFunction"&&!Te(I))continue;J(I,["TSEnumDeclaration","ClassDeclaration","FunctionDeclaration","TSDeclareFunction","TSModuleDeclaration","VariableDeclaration"])&&(I.declare=!0);const M=[];if(I.type==="VariableDeclaration")M.push(...I.declarations.map(f=>f.id));else if("id"in I&&I.id){let f=I.id;f.type==="TSQualifiedName"&&(f=G(f)),f=n&&f.type!=="Identifier"?x.identifier(`_${W(S,"")}`):f,M.push(f)}else{const f=x.identifier("export_default");M.push(f),I.id=f}const K=he(I),z=new Set,l=await Ee(this,I,a,k,z,S),D=[...z].filter(f=>M.every(A=>f!==A));if(I!==s&&(I.leadingComments=s.leadingComments),M.length===1&&N.has(M[0].name)){const f=N.get(M[0].name),A=te(f);A.overloads||(A.overloads=[],A.primaryDepsCount=A.deps.length,A.primaryParamsCount=A.params.length,A.primaryChildrenCount=A.children.length),A.overloads.push({children:D,childrenOffset:A.children.length,decl:I,deps:l,depsOffset:A.deps.length,params:K,paramsOffset:A.params.length}),A.deps.push(...l),A.params.push(...K),A.children.push(...D),p.add(g);continue}const E=xe({bindings:M,children:D,decl:I,deps:l,params:K,resolvedModuleId:R});M.length===1&&N.set(M[0].name,E);const w=x.numericLiteral(E),U=x.arrowFunctionExpression(K.map(({name:f})=>x.identifier(f)),x.arrayExpression(l)),re=x.arrayExpression(D.map(f=>({end:f.end,loc:f.loc,start:f.start,type:"StringLiteral",value:""}))),ne=n&&x.callExpression(x.identifier("sideEffect"),[M[0]]),be=Qe(ne?[w,U,re,ne]:[w,U,re]),oe={declarations:[{id:{...M[0],typeAnnotation:null},init:be,type:"VariableDeclarator"},...M.slice(1).map(f=>({id:{...f,typeAnnotation:null},type:"VariableDeclarator"}))],kind:"var",type:"VariableDeclaration"};c?(_.push(x.exportNamedDeclaration(null,[x.exportSpecifier(M[0],x.identifier("default"))])),T(oe)):H(oe)}return t&&_.push(x.expressionStatement(x.callExpression(x.identifier("sideEffect"),[]))),h.body=[...Array.from(k.values(),({stmt:g})=>g),...h.body.filter((g,s)=>!p.has(s)),..._],ae(y,{comments:!1,sourceFileName:a,sourceMaps:i})}function P(u,a){if(!$.test(a.fileName))return;O??=Le(v);const S=Ve(a,v,O);let y;try{y=se(u,{sourceType:"module"})}catch(p){throw new Error(`Failed to parse generated code for chunk ${a.fileName}. This may be caused by a bug in the plugin. Please report this issue to https://github.com/visulima/packem
|
|
3
|
+
${p}`,{cause:p})}const{program:o}=y;if(o.body=Ge(o.body),o.body=He(o.body),o.body=o.body.flatMap(p=>{if(Ue(p))return[];if(p.type==="ExpressionStatement")return[];const g=qe(p,S,e);if(g===!1)return[];if(g)return[g];if(p.type!=="VariableDeclaration")return[p];if(!Je(p))return[];const[s,T,n]=p.declarations[0].init.elements,R=s.value,c=te(R);q(c.decl,{enter(l){l.type!=="CommentBlock"&&(l.leadingComments?.length||delete l.loc)}});for(const[l,D]of p.declarations.entries()){const E={...D.id,typeAnnotation:c.bindings[l].typeAnnotation};V(c.bindings[l],E)}const L=c.primaryChildrenCount??c.children.length,I=c.primaryParamsCount??c.params.length,H=c.primaryDepsCount??c.deps.length;for(let l=0;l<L;l++){const D=n.elements[l];Object.assign(c.children[l],{loc:D.loc})}const M=T.params;for(let l=0;l<I;l++){const D=M[l].name;for(const E of c.params[l].typeParams)E.name=D}const K=T.body.elements;for(let l=0;l<H;l++){const D=c.deps[l];let E=K[l];E&&E.type==="UnaryExpression"&&E.operator==="void"?E={...x.identifier("undefined"),end:E.end,loc:E.loc,start:E.start}:Z(E)&&(E.name="__Infer"),D.replace?D.replace(E):Object.assign(D,E)}c.decl.type==="TSModuleDeclaration"&&c.resolvedModuleId&&(c.decl.id.value=X+c.resolvedModuleId);const z=[];if(c.overloads)for(const l of c.overloads){q(l.decl,{enter(D){D.type!=="CommentBlock"&&delete D.loc}}),"id"in l.decl&&l.decl.id&&V(l.decl.id,{...c.bindings[0]});for(const[D,E]of l.children.entries()){const w=n.elements[l.childrenOffset+D];w&&Object.assign(E,{loc:w.loc})}for(const[D,E]of l.params.entries()){const w=M[l.paramsOffset+D];if(w)for(const U of E.typeParams)U.name=w.name}for(const[D,E]of l.deps.entries()){let w=K[l.depsOffset+D];w&&(w.type==="UnaryExpression"&&w.operator==="void"?w={...x.identifier("undefined"),end:w.end,loc:w.loc,start:w.start}:Z(w)&&(w.name="__Infer"),E.replace?E.replace(w):Object.assign(E,w))}z.push(l.decl)}return[Ye(p,c.decl),...z]}).filter(p=>!!p),o.body.length===0)return"export { };";const h=o.body.some(p=>p.type==="ExportNamedDeclaration"||p.type==="ExportDefaultDeclaration"||p.type==="ExportAllDeclaration"),_=o.body.some(p=>p.type==="TSModuleDeclaration"&&p.id.type==="StringLiteral");!h&&_&&o.body.push({declaration:null,source:null,specifiers:[],type:"ExportNamedDeclaration"});const k=new Set,N=new Set;for(const p of a.moduleIds){const g=b.get(p);g&&(g.forEach(s=>{const T=s.type+s.value;N.has(T)||(N.add(T),k.add(s))}),b.delete(p))}return k.size>0&&(o.body[0].leadingComments||=[],o.body[0].leadingComments.unshift(...k)),ae(y,{comments:!0,sourceFileName:a.fileName,sourceMaps:i})}function W(u,a){return a in u?u[a]++:u[a]=0}function xe(u){const a=r++;return m.set(a,u),a}function te(u){return m.get(u)}function he(u){const a=[];q(u,{leave(y){"typeParameters"in y&&y.typeParameters?.type==="TSTypeParameterDeclaration"&&a.push(...y.typeParameters.params)}});const S=new Map;for(const y of a){const{name:o}=y,h=S.get(o);h?h.push(y):S.set(o,[y])}return Array.from(S.entries(),([y,o])=>({name:y,typeParams:o}))}function ge(u){const a=[];return q(u,{enter(S){S.type==="TSInferType"&&S.typeParameter&&a.push(S.typeParameter.name)}}),a}async function Ee(u,a,S,y,o,h){const _=new Set,k=new Set,N=new Map,p=[];let g=new Set;function s(n){return n.type==="Identifier"&&g.has(n.name)}return j(s,"f"),d(s,"isInferred"),await Ie(a,{enter(n){if(n.type==="TSConditionalType"){const R=ge(n.extendsType);p.push(R)}return Promise.resolve()},async leave(n,R){if(n.type==="TSConditionalType")p.pop();else if(R?.type==="TSConditionalType"){const c=R.trueType===n;g=new Set((c?p:p.slice(0,-1)).flat())}else g=new Set;if(n.type==="ExportNamedDeclaration")for(const c of n.specifiers)c.type==="ExportSpecifier"&&T(c.local);else if(n.type==="TSInterfaceDeclaration"&&n.extends)for(const c of n.extends||[])T(B(c.expression));else if(n.type==="ClassDeclaration"){if(n.superClass&&T(n.superClass),n.implements)for(const c of n.implements)c.type!=="ClassImplements"&&T(B(c.expression))}else if(J(n,["ObjectMethod","ObjectProperty","ClassProperty","TSPropertySignature","TSDeclareMethod","TSMethodSignature"]))n.computed&&fe(n.key)&&T(n.key),"value"in n&&fe(n.value)&&T(n.value);else switch(n.type){case"TSImportType":{k.add(n);const c=n.argument,L=n.qualifier,I=await Se(u,S,n,L,c,y,h,N);I&&T(I);break}case"TSTypeQuery":{if(k.has(n.exprName))return;if(n.exprName.type==="TSImportType")break;T(B(n.exprName));break}case"TSTypeReference":{T(B(n.typeName));break}}R&&!_.has(n)&&ue(n,R)&&o.add(n)}}),[..._];function T(n){me(n)||s(n)||_.add(n)}j(T,"l")}async function Se(u,a,S,y,o,h,_,k){let N=k.get(o.value);if(N===void 0){const n=await u.resolve(o.value,a);N=!n||!!n.external,k.set(o.value,N)}if(N)return;const p=o.value.replaceAll(/\W/g,"_"),g=`_$${ve(o.value)?o.value:`${p}${W(_,p)}`}`;let s=x.identifier(g);if(h.has(o.value)?s=h.get(o.value).local:h.set(o.value,{local:s,stmt:x.importDeclaration([x.importNamespaceSpecifier(s)],o)}),y){const n=G(y);V(n,x.tsQualifiedName(s,{...n})),s=y}let T=S;return S.typeParameters?(V(S,x.tsTypeReference(s,S.typeParameters)),T=s):V(S,s),{...B(s),replace(n){V(T,n)}}}},"createFakeJsPlugin");function ue(e,t){return!!(e.type==="Identifier"||J(t,["TSPropertySignature","TSMethodSignature"])&&t.key===e)}j(ue,"Pe");d(ue,"isChildSymbol");const _e=/\/\s*<reference\s+(?:path|types)=/,ye=d((e,t=!1)=>e.filter(i=>_e.test(i.value)!==t),"collectReferenceDirectives"),ke=d(e=>e.type==="TSExportAssignment"||e.type==="TSImportEqualsDeclaration"&&e.moduleReference.type==="TSExternalModuleReference","isCjsDtsInputSyntax"),je=d((e,t)=>{if(e.type==="ImportDeclaration")for(const i of e.specifiers)(e.importKind==="type"||"importKind"in i&&i.importKind==="type")&&t.add(i.local.name)},"collectTypeOnlyLocals"),Re=d(e=>{if(e.type==="VariableDeclaration")return e.declarations.flatMap(t=>Ne(t.id).map(i=>i.name));if("id"in e&&e.id){const t=e.id;if(t.type!=="Identifier"&&t.type!=="TSQualifiedName")return[];const i=G(t);return i.type==="Identifier"?[i.name]:[]}return[]},"collectDeclarationNames"),Pe=d((e,t)=>e.exportKind==="type"||"exportKind"in t&&t.exportKind==="type","isTypeOnlyExport"),ce=d(async(e,t,i)=>{if(!t)return;const r=await e.resolve(t.value,i);if(!(!r||r.external))return r.id},"resolveExportSource"),Fe=d(async(e,t,i,r)=>{if(t.type==="ExportNamedDeclaration"){if(t.declaration){for(const b of Re(t.declaration))r.exports.set(b,!1);return}const m=await ce(e,t.source,i);for(const b of t.specifiers){const v=Pe(t,b);if(b.type==="ExportSpecifier"){const C=Q(b.exported),O=Q(b.local);m?r.reExports.push({exported:C,local:O,source:m,typeOnly:v}):r.exports.set(C,v||r.typeOnlyLocals.has(O))}else r.exports.set(Q(b.exported),v)}return}if(t.type==="ExportDefaultDeclaration"){r.exports.set("default",!1);return}t.type==="ExportAllDeclaration"&&r.exportAlls.push({rawSource:t.source.value,source:await ce(e,t.source,i),typeOnly:t.exportKind==="type"})},"collectExportInfo"),Ke=d(async(e,t,i)=>{const r={exportAlls:[],exports:new Map,reExports:[],typeOnlyLocals:new Set};for(const m of t)je(m,r.typeOnlyLocals);for(const m of t)await Fe(e,m,i,r);return r},"collectModuleExports"),Y=d((e,t,i)=>{const r=e.get(t);return r===!1||r===i?!1:r===void 0||!i?(e.set(t,i),!0):!1},"setExportTypeOnly"),$e=d((e,t)=>{if(e.size!==t.size)return!1;for(const[i,r]of e)if(t.get(i)!==r)return!1;return!0},"exportsEqual"),Le=d(e=>{const t=new Map;for(const[r,m]of e)t.set(r,new Map(m.exports));let i=!0;for(;i;){i=!1;for(const[r,m]of e){const b=new Map(m.exports);for(const v of m.reExports){const C=(v.source?t.get(v.source):void 0)?.get(v.local)??!1;Y(b,v.exported,v.typeOnly||C)}for(const v of m.exportAlls){if(!v.source)continue;const C=t.get(v.source);if(C)for(const[O,F]of C)O!=="default"&&Y(b,O,v.typeOnly||F)}$e(t.get(r),b)||(t.set(r,b),i=!0)}}return t},"resolveAllModuleExports"),Ve=d((e,t,i)=>{const r=e.facadeModuleId&&t.has(e.facadeModuleId)?[e.facadeModuleId]:e.moduleIds,m=new Map,b=new Set;for(const C of r){const O=i.get(C);if(O)for(const[P,W]of O)Y(m,P,W);const F=t.get(C);if(F)for(const P of F.exportAlls)!P.typeOnly||P.source||b.add(P.rawSource)}const v=new Set;for(const[C,O]of m)O&&v.add(C);return{typeOnlyExportAllSources:b,typeOnlyNames:v}},"collectChunkExportInfo"),Be=d(e=>{if(!(e.declaration||e.specifiers.length===0)){for(const t of e.specifiers)if(t.type!=="ExportSpecifier"||t.exportKind!=="type")return;e.exportKind="type";for(const t of e.specifiers)t.type==="ExportSpecifier"&&(t.exportKind="value")}},"normalizeTypeOnlyExport"),Je=d(e=>x.isVariableDeclaration(e)&&e.declarations.length>0&&x.isVariableDeclarator(e.declarations[0])&&ze(e.declarations[0].init),"isRuntimeBindingVariableDeclaration"),ze=d(e=>x.isArrayExpression(e)&&We(e.elements),"isRuntimeBindingArrayExpression"),Qe=d(e=>x.arrayExpression(e),"runtimeBindingArrayExpression"),We=d(e=>{const[t,i,r,m]=e;return t?.type==="NumericLiteral"&&i?.type==="ArrowFunctionExpression"&&r?.type==="ArrayExpression"&&(!m||m.type==="CallExpression")},"isRuntimeBindingArrayElements"),Z=d(e=>ee(e,"infer"),"isInfer"),me=d(e=>ee(e,"this")||e.type==="ThisExpression"||e.type==="MemberExpression"&&me(e.object),"isThisExpression"),B=d(e=>{if(e.type==="Identifier")return e;const t=B(e.left);return Object.assign(e,x.memberExpression(t,e.right))},"TSEntityNameToRuntime"),G=d(e=>e.type==="Identifier"?e:G(e.left),"getIdFromTSEntityName"),fe=d(e=>J(e,["Identifier","MemberExpression"]),"isReferenceId"),Ue=d(e=>e.type==="ImportDeclaration"&&e.specifiers.length===1&&e.specifiers.every(t=>t.type==="ImportSpecifier"&&t.imported.type==="Identifier"&&["__export","__reExport"].includes(t.local.name)),"isHelperImport"),qe=d((e,t,i)=>{if(e.type==="ExportNamedDeclaration"&&!e.declaration&&!e.source&&e.specifiers.length===0&&!e.attributes?.length)return!1;if(e.type==="ImportDeclaration"&&e.specifiers.length>0)for(const r of e.specifiers)Z(r.local)&&(r.local.name="__Infer");if(J(e,["ImportDeclaration","ExportAllDeclaration","ExportNamedDeclaration"])){if(e.type==="ExportAllDeclaration"&&e.source&&t.typeOnlyExportAllSources.has(e.source.value)&&(e.exportKind="type"),e.type==="ExportNamedDeclaration"&&t.typeOnlyNames.size>0){for(const r of e.specifiers){const m=Q(r.exported);t.typeOnlyNames.has(m)&&(r.type==="ExportSpecifier"?r.exportKind="type":e.exportKind="type")}Be(e)}if(e.source?.value&&$.test(e.source.value))return e.source.value=de(e.source.value,"js"),e;if(i&&e.type==="ExportNamedDeclaration"&&!e.source&&e.specifiers.length===1&&e.specifiers[0].type==="ExportSpecifier"&&Q(e.specifiers[0].exported)==="default")return{expression:e.specifiers[0].local,type:"TSExportAssignment"}}},"patchImportExport"),Ge=d(e=>{const t=new Set;for(const[r,m]of e.entries()){const b=i(m);if(!b)continue;const[v,C]=b;C.properties.length!==0&&(e[r]={body:{body:[{declaration:null,source:null,specifiers:C.properties.filter(O=>O.type==="ObjectProperty").map(O=>{const F=O.value.body,P=O.key;return x.exportSpecifier(F,P)}),type:"ExportNamedDeclaration"}],type:"TSModuleBlock"},declare:!0,id:v,kind:"namespace",type:"TSModuleDeclaration"})}return e.filter(r=>!t.has(r));function i(r){if(r.type!=="VariableDeclaration"||r.declarations.length!==1||r.declarations[0].id.type!=="Identifier"||r.declarations[0].init?.type!=="CallExpression"||r.declarations[0].init.callee.type!=="Identifier"||r.declarations[0].init.callee.name!=="__export"||r.declarations[0].init.arguments.length!==1||r.declarations[0].init.arguments[0].type!=="ObjectExpression")return!1;const m=r.declarations[0].id,b=r.declarations[0].init.arguments[0];return[m,b]}},"patchTsNamespace"),He=d(e=>{const t=new Map;for(const[i,r]of e.entries())if(r.type==="ImportDeclaration"&&r.specifiers.length===1&&r.specifiers[0].type==="ImportSpecifier"&&r.specifiers[0].local.type==="Identifier"&&r.specifiers[0].local.name.endsWith("_exports"))t.set(r.specifiers[0].local.name,r.specifiers[0].local.name);else if(r.type==="ExpressionStatement"&&r.expression.type==="CallExpression"&&ee(r.expression.callee,"__reExport")){const m=r.expression.arguments;t.set(m[0].name,m[1].name)}else r.type==="VariableDeclaration"&&r.declarations.length===1&&r.declarations[0].init?.type==="MemberExpression"&&r.declarations[0].init.object.type==="Identifier"&&t.has(r.declarations[0].init.object.name)?e[i]={id:{name:r.declarations[0].id.name,type:"Identifier"},type:"TSTypeAliasDeclaration",typeAnnotation:{type:"TSTypeReference",typeName:{left:{name:t.get(r.declarations[0].init.object.name),type:"Identifier"},right:{name:r.declarations[0].init.property.name,type:"Identifier"},type:"TSQualifiedName"}}}:r.type==="ExportNamedDeclaration"&&r.specifiers.length===1&&r.specifiers[0].type==="ExportSpecifier"&&r.specifiers[0].local.type==="Identifier"&&t.has(r.specifiers[0].local.name)&&(r.specifiers[0].local.name=t.get(r.specifiers[0].local.name));return e},"patchReExport"),Xe=d((e,t)=>{if(e.type==="ImportDeclaration"||e.type==="ExportNamedDeclaration"&&!e.declaration){for(const i of e.specifiers)i.type==="ImportSpecifier"?i.importKind="value":i.type==="ExportSpecifier"&&(i.exportKind="value");return e.type==="ImportDeclaration"?e.importKind="value":e.type==="ExportNamedDeclaration"&&(e.exportKind="value"),!0}return e.type==="ExportAllDeclaration"?(e.exportKind="value",!0):e.type==="TSImportEqualsDeclaration"?(e.moduleReference.type==="TSExternalModuleReference"&&t({source:e.moduleReference.expression,specifiers:[{local:e.id,type:"ImportDefaultSpecifier"}],type:"ImportDeclaration"}),!0):e.type==="TSExportAssignment"&&e.expression.type==="Identifier"?(t({specifiers:[{exported:{name:"default",type:"Identifier"},local:e.expression,type:"ExportSpecifier"}],type:"ExportNamedDeclaration"}),!0):e.type==="ExportDefaultDeclaration"&&e.declaration.type==="Identifier"?(t({specifiers:[{exported:x.identifier("default"),local:e.declaration,type:"ExportSpecifier"}],type:"ExportNamedDeclaration"}),!0):!1},"rewriteImportExport"),V=d((e,t)=>{for(const i of Object.keys(e))delete e[i];return Object.assign(e,t),e},"overwriteNode"),Ye=d((e,t)=>{t.leadingComments||=[];const i=e.leadingComments?.filter(r=>r.value.startsWith("#"));return i&&t.leadingComments.unshift(...i),t.leadingComments=ye(t.leadingComments,!0),t},"inheritNodeComments");export{st as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"node:child_process";import"node:fs";import"node:fs/promises";import"node:path";import"@babel/parser";import"@rollup/pluginutils";import"obug";import"oxc-transform";import"../filename.js";import{c as g}from"./generate-JArF6z_0.js";export{g as createGeneratePlugin};
|