rolldown-plugin-dts 0.25.1 → 0.26.0
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 -1
- package/dist/{index-CJhxyVA1.d.mts → index-DFO9SbW-.d.mts} +1 -1
- package/dist/index.mjs +34 -17
- package/dist/internal.mjs +1 -1
- package/dist/{tsc-8hYVvCE4.mjs → tsc-DBLgyoBn.mjs} +1 -1
- package/dist/tsc-context.d.mts +1 -1
- package/dist/tsc-worker.d.mts +1 -1
- package/dist/tsc-worker.mjs +1 -1
- package/dist/tsc.d.mts +1 -1
- package/dist/tsc.mjs +1 -1
- package/package.json +21 -21
- /package/dist/{context-3rlTPR48.d.mts → context-_3g_7Eca.d.mts} +0 -0
- /package/dist/{filename-DQnUJlio.mjs → filename-BR9JpwkC.mjs} +0 -0
- /package/dist/{resolver-DkvdaW3s.mjs → resolver-DtsKFXi2.mjs} +0 -0
package/README.md
CHANGED
|
@@ -41,7 +41,9 @@ transformation to avoid processing generated outputs. Since `oxc.exclude`
|
|
|
41
41
|
overrides the default exclude list, include JavaScript files as well:
|
|
42
42
|
|
|
43
43
|
```ts
|
|
44
|
-
|
|
44
|
+
// vite.config.ts
|
|
45
|
+
|
|
46
|
+
export default defineConfig({
|
|
45
47
|
oxc: {
|
|
46
48
|
exclude: [/\.js$/, /\.d\.[cm]?ts$/],
|
|
47
49
|
},
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as RE_JSON, c as RE_TS, d as filename_js_to_dts, f as filename_to_dts, i as RE_JS, l as RE_VUE, m as resolveTemplateFn, n as RE_DTS, o as RE_NODE_MODULES, p as replaceTemplateName, r as RE_DTS_MAP, s as RE_ROLLDOWN_RUNTIME, t as RE_CSS, u as filename_dts_to } from "./filename-
|
|
1
|
+
import { a as RE_JSON, c as RE_TS, d as filename_js_to_dts, f as filename_to_dts, i as RE_JS, l as RE_VUE, m as resolveTemplateFn, n as RE_DTS, o as RE_NODE_MODULES, p as replaceTemplateName, r as RE_DTS_MAP, s as RE_ROLLDOWN_RUNTIME, t as RE_CSS, u as filename_dts_to } from "./filename-BR9JpwkC.mjs";
|
|
2
2
|
import { createContext, globalContext, invalidateContextFile } from "./tsc-context.mjs";
|
|
3
3
|
import { createDebug } from "obug";
|
|
4
4
|
import { importerId, include } from "rolldown/filter";
|
|
@@ -8,7 +8,7 @@ import { parse } from "@babel/parser";
|
|
|
8
8
|
import { isDeclarationType, isIdentifierOf, isTypeOf, resolveString, walkAST, walkASTAsync } from "ast-kit";
|
|
9
9
|
import { fork, spawn } from "node:child_process";
|
|
10
10
|
import { existsSync } from "node:fs";
|
|
11
|
-
import { mkdtemp, readFile, rm } from "node:fs/promises";
|
|
11
|
+
import { access, mkdtemp, readFile, rm } from "node:fs/promises";
|
|
12
12
|
import path from "node:path";
|
|
13
13
|
import { ResolverFactory, isolatedDeclarationSync } from "rolldown/experimental";
|
|
14
14
|
import { tmpdir } from "node:os";
|
|
@@ -563,7 +563,8 @@ async function collectDependencies(context, node, importer, namespaceStmts, chil
|
|
|
563
563
|
"ObjectProperty",
|
|
564
564
|
"ClassProperty",
|
|
565
565
|
"TSPropertySignature",
|
|
566
|
-
"TSDeclareMethod"
|
|
566
|
+
"TSDeclareMethod",
|
|
567
|
+
"TSMethodSignature"
|
|
567
568
|
])) {
|
|
568
569
|
if (node.computed && isReferenceId(node.key)) addDependency(node.key);
|
|
569
570
|
if ("value" in node && isReferenceId(node.value)) addDependency(node.value);
|
|
@@ -929,7 +930,19 @@ async function runTsgo(rootDir, tsconfig, sourcemap, tsgoPath) {
|
|
|
929
930
|
];
|
|
930
931
|
debug$3("[tsgo] args %o", args);
|
|
931
932
|
await spawnAsync(tsgo, args, { stdio: "inherit" });
|
|
932
|
-
return
|
|
933
|
+
return {
|
|
934
|
+
path: tsgoDist,
|
|
935
|
+
async dispose() {
|
|
936
|
+
if (debug$3.enabled) debug$3("[tsgo] skip cleanup of tsgoDist", tsgoDist);
|
|
937
|
+
else {
|
|
938
|
+
debug$3("[tsgo] disposing tsgoDist", tsgoDist);
|
|
939
|
+
await rm(tsgoDist, {
|
|
940
|
+
recursive: true,
|
|
941
|
+
force: true
|
|
942
|
+
}).catch(() => {});
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
};
|
|
933
946
|
}
|
|
934
947
|
//#endregion
|
|
935
948
|
//#region src/generate.ts
|
|
@@ -954,12 +967,12 @@ function createGeneratePlugin({ entry, tsconfig, tsconfigRaw, build, incremental
|
|
|
954
967
|
let rpc;
|
|
955
968
|
let tscModule;
|
|
956
969
|
let tscContext;
|
|
957
|
-
let
|
|
970
|
+
let tsgoContext;
|
|
958
971
|
const rootDir = tsconfig ? path.dirname(tsconfig) : cwd;
|
|
959
972
|
return {
|
|
960
973
|
name: "rolldown-plugin-dts:generate",
|
|
961
974
|
async buildStart(options) {
|
|
962
|
-
if (tsgo)
|
|
975
|
+
if (tsgo) tsgoContext = await runTsgo(rootDir, tsconfig, sourcemap, tsgo.path);
|
|
963
976
|
else if (!oxc) if (parallel) {
|
|
964
977
|
childProcess = fork(new URL(WORKER_URL, import.meta.url), { stdio: "inherit" });
|
|
965
978
|
rpc = (await import("birpc")).createBirpc({}, {
|
|
@@ -1015,14 +1028,16 @@ function createGeneratePlugin({ entry, tsconfig, tsconfigRaw, build, incremental
|
|
|
1015
1028
|
]
|
|
1016
1029
|
} },
|
|
1017
1030
|
handler(code, id) {
|
|
1018
|
-
|
|
1031
|
+
const jsFile = RE_JS.test(id);
|
|
1032
|
+
if (!jsFile || emitJs) {
|
|
1019
1033
|
const mod = this.getModuleInfo(id);
|
|
1020
1034
|
const isEntry = entryMatcher ? entryMatcher(path.relative(cwd, id)) : !!mod?.isEntry;
|
|
1021
1035
|
const dtsId = filename_to_dts(id);
|
|
1022
1036
|
dtsMap.set(dtsId, {
|
|
1023
1037
|
code,
|
|
1024
1038
|
id,
|
|
1025
|
-
isEntry
|
|
1039
|
+
isEntry,
|
|
1040
|
+
jsFile
|
|
1026
1041
|
});
|
|
1027
1042
|
debug$2("register dts source: %s", id);
|
|
1028
1043
|
if (isEntry) {
|
|
@@ -1046,14 +1061,19 @@ function createGeneratePlugin({ entry, tsconfig, tsconfigRaw, build, incremental
|
|
|
1046
1061
|
exclude: [RE_NODE_MODULES]
|
|
1047
1062
|
} },
|
|
1048
1063
|
async handler(dtsId) {
|
|
1049
|
-
|
|
1050
|
-
|
|
1064
|
+
const module = dtsMap.get(dtsId);
|
|
1065
|
+
if (!module) return;
|
|
1066
|
+
const { code, id, jsFile } = module;
|
|
1067
|
+
if (jsFile && await access(dtsId).then(() => true).catch(() => false)) {
|
|
1068
|
+
debug$2("dts file already exists for %s, skipping generation", id);
|
|
1069
|
+
return;
|
|
1070
|
+
}
|
|
1051
1071
|
let dtsCode;
|
|
1052
1072
|
let map;
|
|
1053
1073
|
debug$2("generate dts %s from %s", dtsId, id);
|
|
1054
1074
|
if (tsgo) {
|
|
1055
1075
|
if (RE_VUE.test(id)) throw new Error("tsgo does not support Vue files.");
|
|
1056
|
-
const dtsPath = path.resolve(
|
|
1076
|
+
const dtsPath = path.resolve(tsgoContext.path, path.relative(path.resolve(rootDir), filename_to_dts(id)));
|
|
1057
1077
|
if (!existsSync(dtsPath)) {
|
|
1058
1078
|
debug$2("[tsgo]", dtsPath, "is missing");
|
|
1059
1079
|
throw new Error(`tsgo did not generate dts file for ${id}, please check your tsconfig.`);
|
|
@@ -1131,11 +1151,8 @@ export { __json_default_export as default }`;
|
|
|
1131
1151
|
} : void 0,
|
|
1132
1152
|
async buildEnd() {
|
|
1133
1153
|
childProcess?.kill();
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
force: true
|
|
1137
|
-
}).catch(() => {});
|
|
1138
|
-
tsgoDist = void 0;
|
|
1154
|
+
await tsgoContext?.dispose();
|
|
1155
|
+
tsgoContext = void 0;
|
|
1139
1156
|
if (newContext) tscContext = void 0;
|
|
1140
1157
|
},
|
|
1141
1158
|
watchChange(id) {
|
|
@@ -1303,7 +1320,7 @@ function createDtsResolvePlugin({ cwd, tsconfig, tsconfigRaw, resolver, sideEffe
|
|
|
1303
1320
|
async function resolveDtsPath(id, importer, rolldownResolution) {
|
|
1304
1321
|
let dtsPath;
|
|
1305
1322
|
if (resolver === "tsc") {
|
|
1306
|
-
const { tscResolve } = await import("./resolver-
|
|
1323
|
+
const { tscResolve } = await import("./resolver-DtsKFXi2.mjs");
|
|
1307
1324
|
dtsPath = tscResolve(id, importer, cwd, tsconfig, tsconfigRaw);
|
|
1308
1325
|
} else dtsPath = baseDtsResolver(id, importer);
|
|
1309
1326
|
debug$1("Using %s for dts import: %O -> %O", resolver, id, dtsPath);
|
package/dist/internal.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as RE_JSON, c as RE_TS, d as filename_js_to_dts, f as filename_to_dts, i as RE_JS, l as RE_VUE, m as resolveTemplateFn, n as RE_DTS, o as RE_NODE_MODULES, p as replaceTemplateName, r as RE_DTS_MAP, s as RE_ROLLDOWN_RUNTIME, t as RE_CSS, u as filename_dts_to } from "./filename-
|
|
1
|
+
import { a as RE_JSON, c as RE_TS, d as filename_js_to_dts, f as filename_to_dts, i as RE_JS, l as RE_VUE, m as resolveTemplateFn, n as RE_DTS, o as RE_NODE_MODULES, p as replaceTemplateName, r as RE_DTS_MAP, s as RE_ROLLDOWN_RUNTIME, t as RE_CSS, u as filename_dts_to } from "./filename-BR9JpwkC.mjs";
|
|
2
2
|
import { readTsconfig } from "get-tsconfig";
|
|
3
3
|
export { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_JSON, RE_NODE_MODULES, RE_ROLLDOWN_RUNTIME, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts, readTsconfig, replaceTemplateName, resolveTemplateFn };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __cjs_createRequire } from "node:module";
|
|
2
2
|
const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
3
|
-
import { n as RE_DTS, r as RE_DTS_MAP } from "./filename-
|
|
3
|
+
import { n as RE_DTS, r as RE_DTS_MAP } from "./filename-BR9JpwkC.mjs";
|
|
4
4
|
import { globalContext } from "./tsc-context.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import { createDebug } from "obug";
|
package/dist/tsc-context.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as globalContext, i as createContext, n as SourceFileToProjectMap, o as invalidateContextFile, r as TscContext, t as ParsedProject } from "./context-
|
|
1
|
+
import { a as globalContext, i as createContext, n as SourceFileToProjectMap, o as invalidateContextFile, r as TscContext, t as ParsedProject } from "./context-_3g_7Eca.mjs";
|
|
2
2
|
export { ParsedProject, SourceFileToProjectMap, TscContext, createContext, globalContext, invalidateContextFile };
|
package/dist/tsc-worker.d.mts
CHANGED
package/dist/tsc-worker.mjs
CHANGED
package/dist/tsc.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as TscResult, n as TscModule, r as TscOptions, t as tscEmit } from "./index-
|
|
1
|
+
import { i as TscResult, n as TscModule, r as TscOptions, t as tscEmit } from "./index-DFO9SbW-.mjs";
|
|
2
2
|
export { type TscModule, type TscOptions, type TscResult, tscEmit };
|
package/dist/tsc.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as tscEmit } from "./tsc-
|
|
1
|
+
import { t as tscEmit } from "./tsc-DBLgyoBn.mjs";
|
|
2
2
|
export { tscEmit };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rolldown-plugin-dts",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.26.0",
|
|
5
5
|
"description": "A Rolldown plugin to generate and bundle dts files.",
|
|
6
6
|
"author": "Kevin Deng <sxzz@sxzz.moe>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"engines": {
|
|
41
|
-
"node": "^22.18.0 || >=24.
|
|
41
|
+
"node": "^22.18.0 || >=24.11.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@ts-macro/tsc": "^0.3.6",
|
|
45
45
|
"@typescript/native-preview": ">=7.0.0-dev.20260325.1",
|
|
46
46
|
"rolldown": "^1.0.0",
|
|
47
47
|
"typescript": "^5.0.0 || ^6.0.0",
|
|
48
|
-
"vue-tsc": "~3.2.0"
|
|
48
|
+
"vue-tsc": "~3.2.0 || ~3.3.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependenciesMeta": {
|
|
51
51
|
"@ts-macro/tsc": {
|
|
@@ -62,39 +62,39 @@
|
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@babel/generator": "8.0.0
|
|
66
|
-
"@babel/helper-validator-identifier": "8.0.0
|
|
67
|
-
"@babel/parser": "8.0.0
|
|
68
|
-
"ast-kit": "^3.0.0
|
|
65
|
+
"@babel/generator": "^8.0.0",
|
|
66
|
+
"@babel/helper-validator-identifier": "^8.0.0",
|
|
67
|
+
"@babel/parser": "^8.0.0",
|
|
68
|
+
"ast-kit": "^3.0.0",
|
|
69
69
|
"birpc": "^4.0.0",
|
|
70
70
|
"dts-resolver": "^3.0.0",
|
|
71
71
|
"get-tsconfig": "5.0.0-beta.5",
|
|
72
|
-
"obug": "^2.1.
|
|
72
|
+
"obug": "^2.1.3"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@babel/types": "^8.0.0
|
|
75
|
+
"@babel/types": "^8.0.0",
|
|
76
76
|
"@jridgewell/source-map": "^0.3.11",
|
|
77
|
-
"@sxzz/eslint-config": "^8.
|
|
77
|
+
"@sxzz/eslint-config": "^8.2.0",
|
|
78
78
|
"@sxzz/prettier-config": "^2.3.1",
|
|
79
79
|
"@sxzz/test-utils": "^0.5.18",
|
|
80
|
-
"@types/node": "^25.
|
|
81
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
80
|
+
"@types/node": "^25.9.3",
|
|
81
|
+
"@typescript/native-preview": "7.0.0-dev.20260616.1",
|
|
82
82
|
"@volar/typescript": "^2.4.28",
|
|
83
|
-
"@vue/language-core": "^3.
|
|
83
|
+
"@vue/language-core": "^3.3.5",
|
|
84
84
|
"arktype": "^2.2.0",
|
|
85
85
|
"bumpp": "^11.1.0",
|
|
86
86
|
"diff": "^9.0.0",
|
|
87
|
-
"eslint": "^10.
|
|
88
|
-
"prettier": "^3.8.
|
|
89
|
-
"rolldown": "^1.
|
|
90
|
-
"rolldown-plugin-require-cjs": "^0.4.
|
|
87
|
+
"eslint": "^10.5.0",
|
|
88
|
+
"prettier": "^3.8.4",
|
|
89
|
+
"rolldown": "^1.1.1",
|
|
90
|
+
"rolldown-plugin-require-cjs": "^0.4.1",
|
|
91
91
|
"rollup-plugin-dts": "^6.4.1",
|
|
92
|
-
"tsdown": "^0.22.
|
|
92
|
+
"tsdown": "^0.22.2",
|
|
93
93
|
"tsnapi": "^0.3.3",
|
|
94
94
|
"typescript": "^6.0.3",
|
|
95
|
-
"vitest": "^4.1.
|
|
96
|
-
"vue": "^3.5.
|
|
97
|
-
"vue-tsc": "^3.
|
|
95
|
+
"vitest": "^4.1.9",
|
|
96
|
+
"vue": "^3.5.38",
|
|
97
|
+
"vue-tsc": "^3.3.5",
|
|
98
98
|
"zod": "^4.4.3"
|
|
99
99
|
},
|
|
100
100
|
"prettier": "@sxzz/prettier-config",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|