rolldown-plugin-dts 0.13.9 → 0.13.11
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/README.md +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +28 -18
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -149,9 +149,9 @@ This is especially useful when you have a single `tsconfig.json` for multiple pr
|
|
|
149
149
|
|
|
150
150
|
**[Experimental]** Enables DTS generation using [`tsgo`](https://github.com/microsoft/typescript-go).
|
|
151
151
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
To use this option, ensure that `@typescript/native-preview` is installed as a dependency.
|
|
153
|
+
|
|
154
|
+
`tsconfigRaw` and `isolatedDeclarations` options will be ignored when this option is enabled.
|
|
155
155
|
|
|
156
156
|
> [!WARNING]
|
|
157
157
|
> This option is experimental and not yet recommended for production environments.
|
package/dist/index.d.ts
CHANGED
|
@@ -108,8 +108,9 @@ interface Options {
|
|
|
108
108
|
* To use this option, make sure `@typescript/native-preview` is installed as a dependency.
|
|
109
109
|
*
|
|
110
110
|
* **Note:** This option is not yet recommended for production environments.
|
|
111
|
+
* `tsconfigRaw` and `isolatedDeclarations` options will be ignored when this option is enabled.
|
|
111
112
|
*/
|
|
112
|
-
tsgo?: boolean
|
|
113
|
+
tsgo?: boolean;
|
|
113
114
|
}
|
|
114
115
|
type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
115
116
|
type OptionsResolved = Overwrite<Required<Omit<Options, "compilerOptions">>, {
|
package/dist/index.js
CHANGED
|
@@ -643,21 +643,8 @@ function createGeneratePlugin({ tsconfig, tsconfigRaw, incremental, cwd, isolate
|
|
|
643
643
|
return {
|
|
644
644
|
name: "rolldown-plugin-dts:generate",
|
|
645
645
|
async buildStart(options) {
|
|
646
|
-
if (tsgo)
|
|
647
|
-
|
|
648
|
-
const { default: getExePath } = await import(new URL("./lib/getExePath.js", tsgoPkg).href);
|
|
649
|
-
const tsgo$1 = getExePath();
|
|
650
|
-
tsgoDist = await mkdtemp(path.join(tmpdir(), "rolldown-plugin-dts-"));
|
|
651
|
-
await spawnAsync(tsgo$1, [
|
|
652
|
-
"--noEmit",
|
|
653
|
-
"false",
|
|
654
|
-
"--declaration",
|
|
655
|
-
"--emitDeclarationOnly",
|
|
656
|
-
...tsconfig ? ["-p", tsconfig] : [],
|
|
657
|
-
"--outDir",
|
|
658
|
-
tsgoDist
|
|
659
|
-
], { stdio: "inherit" });
|
|
660
|
-
} else if (!parallel && (!isolatedDeclarations || vue)) {
|
|
646
|
+
if (tsgo) tsgoDist = await runTsgo(cwd, tsconfig);
|
|
647
|
+
else if (!parallel && (!isolatedDeclarations || vue)) {
|
|
661
648
|
tscModule = await import("./tsc-CJ55BCXi.js");
|
|
662
649
|
tscContext = eager ? void 0 : tscModule.createContext();
|
|
663
650
|
}
|
|
@@ -727,9 +714,12 @@ function createGeneratePlugin({ tsconfig, tsconfigRaw, incremental, cwd, isolate
|
|
|
727
714
|
debug$1("generate dts %s from %s", dtsId, id);
|
|
728
715
|
if (tsgo) {
|
|
729
716
|
if (RE_VUE.test(id)) throw new Error("tsgo does not support Vue files.");
|
|
730
|
-
const dtsPath = path.resolve(tsgoDist, path.relative(path.resolve(
|
|
717
|
+
const dtsPath = path.resolve(tsgoDist, path.relative(path.resolve(cwd), filename_ts_to_dts(id)));
|
|
731
718
|
if (existsSync(dtsPath)) dtsCode = await readFile(dtsPath, "utf8");
|
|
732
|
-
else
|
|
719
|
+
else {
|
|
720
|
+
debug$1("[tsgo]", dtsPath, "is missing");
|
|
721
|
+
throw new Error(`tsgo did not generate dts file for ${id}, please check your tsconfig.`);
|
|
722
|
+
}
|
|
733
723
|
} else if (isolatedDeclarations && !RE_VUE.test(id)) {
|
|
734
724
|
const result = isolatedDeclaration(id, code, isolatedDeclarations);
|
|
735
725
|
if (result.errors.length) {
|
|
@@ -775,7 +765,7 @@ function createGeneratePlugin({ tsconfig, tsconfigRaw, incremental, cwd, isolate
|
|
|
775
765
|
} : void 0,
|
|
776
766
|
async buildEnd() {
|
|
777
767
|
childProcess?.kill();
|
|
778
|
-
if (tsgoDist) await rm(tsgoDist, {
|
|
768
|
+
if (!debug$1.enabled && tsgoDist) await rm(tsgoDist, {
|
|
779
769
|
recursive: true,
|
|
780
770
|
force: true
|
|
781
771
|
}).catch(() => {});
|
|
@@ -783,6 +773,26 @@ function createGeneratePlugin({ tsconfig, tsconfigRaw, incremental, cwd, isolate
|
|
|
783
773
|
}
|
|
784
774
|
};
|
|
785
775
|
}
|
|
776
|
+
async function runTsgo(root, tsconfig) {
|
|
777
|
+
const tsgoPkg = import.meta.resolve("@typescript/native-preview/package.json");
|
|
778
|
+
const { default: getExePath } = await import(new URL("./lib/getExePath.js", tsgoPkg).href);
|
|
779
|
+
const tsgo = getExePath();
|
|
780
|
+
const tsgoDist = await mkdtemp(path.join(tmpdir(), "rolldown-plugin-dts-"));
|
|
781
|
+
debug$1("[tsgo] tsgoDist", tsgoDist);
|
|
782
|
+
await spawnAsync(tsgo, [
|
|
783
|
+
"--noEmit",
|
|
784
|
+
"false",
|
|
785
|
+
"--declaration",
|
|
786
|
+
"--emitDeclarationOnly",
|
|
787
|
+
...tsconfig ? ["-p", tsconfig] : [],
|
|
788
|
+
"--outDir",
|
|
789
|
+
tsgoDist,
|
|
790
|
+
"--rootDir",
|
|
791
|
+
root,
|
|
792
|
+
"--noCheck"
|
|
793
|
+
], { stdio: "inherit" });
|
|
794
|
+
return tsgoDist;
|
|
795
|
+
}
|
|
786
796
|
|
|
787
797
|
//#endregion
|
|
788
798
|
//#region src/options.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rolldown-plugin-dts",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.11",
|
|
4
4
|
"description": "A Rolldown plugin to bundle dts files",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"@sxzz/test-utils": "^0.5.6",
|
|
62
62
|
"@types/babel__generator": "^7.27.0",
|
|
63
63
|
"@types/debug": "^4.1.12",
|
|
64
|
-
"@types/node": "^
|
|
65
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
64
|
+
"@types/node": "^24.0.0",
|
|
65
|
+
"@typescript/native-preview": "7.0.0-dev.20250611.1",
|
|
66
66
|
"@volar/typescript": "^2.4.14",
|
|
67
67
|
"@vue/language-core": "^2.2.10",
|
|
68
68
|
"bumpp": "^10.1.1",
|
|
@@ -70,13 +70,13 @@
|
|
|
70
70
|
"eslint": "^9.28.0",
|
|
71
71
|
"estree-walker": "^3.0.3",
|
|
72
72
|
"prettier": "^3.5.3",
|
|
73
|
-
"rolldown": "1.0.0-beta.
|
|
73
|
+
"rolldown": "1.0.0-beta.14",
|
|
74
74
|
"rollup-plugin-dts": "^6.2.1",
|
|
75
75
|
"tinyglobby": "^0.2.14",
|
|
76
76
|
"tsdown": "^0.12.7",
|
|
77
|
-
"tsx": "^4.
|
|
77
|
+
"tsx": "^4.20.0",
|
|
78
78
|
"typescript": "^5.8.3",
|
|
79
|
-
"vitest": "^3.2.
|
|
79
|
+
"vitest": "^3.2.3",
|
|
80
80
|
"vue": "^3.5.16",
|
|
81
81
|
"vue-tsc": "^2.2.10"
|
|
82
82
|
},
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"node": ">=20.18.0"
|
|
85
85
|
},
|
|
86
86
|
"resolutions": {
|
|
87
|
-
"rolldown": "1.0.0-beta.
|
|
87
|
+
"rolldown": "1.0.0-beta.14"
|
|
88
88
|
},
|
|
89
89
|
"prettier": "@sxzz/prettier-config",
|
|
90
90
|
"scripts": {
|