rolldown-plugin-dts 0.22.5 → 0.23.1
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 +1 -1
- package/dist/{filename.mjs → filename-DQnUJlio.mjs} +1 -1
- package/dist/{index-lpAqB_wE.d.mts → index-DAUYR4Qd.d.mts} +1 -1
- package/dist/index.mjs +21 -11
- package/dist/{filename.d.mts → internal.d.mts} +2 -1
- package/dist/internal.mjs +3 -0
- package/dist/{tsc-Dh95OfBG.mjs → tsc-8hYVvCE4.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 +24 -24
- /package/dist/{context-Cc-Tkynb.d.mts → context-3rlTPR48.d.mts} +0 -0
- /package/dist/{resolver-BUWpVKW_.mjs → resolver-DkvdaW3s.mjs} +0 -0
package/README.md
CHANGED
|
@@ -26,4 +26,4 @@ function replaceTemplateName(template, name) {
|
|
|
26
26
|
return template.replaceAll("[name]", name);
|
|
27
27
|
}
|
|
28
28
|
//#endregion
|
|
29
|
-
export {
|
|
29
|
+
export { RE_JSON as a, RE_TS as c, filename_js_to_dts as d, filename_to_dts as f, RE_JS as i, RE_VUE as l, resolveTemplateFn as m, RE_DTS as n, RE_NODE_MODULES as o, replaceTemplateName as p, RE_DTS_MAP as r, RE_ROLLDOWN_RUNTIME as s, RE_CSS as t, filename_dts_to as u };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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-DQnUJlio.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";
|
|
@@ -94,12 +94,17 @@ function createFakeJsPlugin({ sourcemap, cjsDefault, sideEffects }) {
|
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
function transform(code, id) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
let file;
|
|
98
|
+
try {
|
|
99
|
+
file = parse(code, {
|
|
100
|
+
plugins: [["typescript", { dts: true }], "decoratorAutoAccessors"],
|
|
101
|
+
sourceType: "module",
|
|
102
|
+
errorRecovery: true,
|
|
103
|
+
createParenthesizedExpressions: true
|
|
104
|
+
});
|
|
105
|
+
} catch (error) {
|
|
106
|
+
throw new Error(`Failed to parse ${id}. 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/sxzz/rolldown-plugin-dts\n${error}`, { cause: error });
|
|
107
|
+
}
|
|
103
108
|
const { program, comments } = file;
|
|
104
109
|
const typeOnlyIds = [];
|
|
105
110
|
const identifierMap = Object.create(null);
|
|
@@ -216,7 +221,12 @@ function createFakeJsPlugin({ sourcemap, cjsDefault, sideEffects }) {
|
|
|
216
221
|
const ids = typeOnlyMap.get(module);
|
|
217
222
|
if (ids) typeOnlyIds.push(...ids);
|
|
218
223
|
}
|
|
219
|
-
|
|
224
|
+
let file;
|
|
225
|
+
try {
|
|
226
|
+
file = parse(code, { sourceType: "module" });
|
|
227
|
+
} catch (error) {
|
|
228
|
+
throw new Error(`Failed to parse generated code for chunk ${chunk.fileName}. This may be caused by a bug in the plugin. Please report this issue to https://github.com/sxzz/rolldown-plugin-dts\n${error}`, { cause: error });
|
|
229
|
+
}
|
|
220
230
|
const { program } = file;
|
|
221
231
|
program.body = patchTsNamespace(program.body);
|
|
222
232
|
program.body = patchReExport(program.body);
|
|
@@ -391,7 +401,7 @@ function createFakeJsPlugin({ sourcemap, cjsDefault, sideEffects }) {
|
|
|
391
401
|
}
|
|
392
402
|
function importNamespace(node, imported, source, namespaceStmts, identifierMap) {
|
|
393
403
|
const sourceText = source.value.replaceAll(/\W/g, "_");
|
|
394
|
-
const localName = isIdentifierName(source.value) ? source.value : `${sourceText}${getIdentifierIndex(identifierMap, sourceText)}`;
|
|
404
|
+
const localName = `_$${isIdentifierName(source.value) ? source.value : `${sourceText}${getIdentifierIndex(identifierMap, sourceText)}`}`;
|
|
395
405
|
let local = t.identifier(localName);
|
|
396
406
|
if (namespaceStmts.has(source.value)) local = namespaceStmts.get(source.value).local;
|
|
397
407
|
else namespaceStmts.set(source.value, {
|
|
@@ -1010,7 +1020,7 @@ function createDtsResolvePlugin({ cwd, tsconfig, tsconfigRaw, resolver, sideEffe
|
|
|
1010
1020
|
debug$1("Rolldown resolution for dts import %O from %O: %O", id, importer, rolldownResolution);
|
|
1011
1021
|
if (rolldownResolution?.external) {
|
|
1012
1022
|
debug$1("Rolldown marked dts import as external:", id);
|
|
1013
|
-
return
|
|
1023
|
+
return rolldownResolution;
|
|
1014
1024
|
}
|
|
1015
1025
|
const dtsResolution = await resolveDtsPath(id, importer, rolldownResolution);
|
|
1016
1026
|
debug$1("Dts resolution for dts import %O from %O: %O", id, importer, dtsResolution);
|
|
@@ -1043,7 +1053,7 @@ function createDtsResolvePlugin({ cwd, tsconfig, tsconfigRaw, resolver, sideEffe
|
|
|
1043
1053
|
async function resolveDtsPath(id, importer, rolldownResolution) {
|
|
1044
1054
|
let dtsPath;
|
|
1045
1055
|
if (resolver === "tsc") {
|
|
1046
|
-
const { tscResolve } = await import("./resolver-
|
|
1056
|
+
const { tscResolve } = await import("./resolver-DkvdaW3s.mjs");
|
|
1047
1057
|
dtsPath = tscResolve(id, importer, cwd, tsconfig, tsconfigRaw);
|
|
1048
1058
|
} else dtsPath = baseDtsResolver(id, importer);
|
|
1049
1059
|
debug$1("Using %s for dts import: %O -> %O", resolver, id, dtsPath);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ChunkFileNamesFunction, PreRenderedChunk } from "rolldown";
|
|
2
|
+
import { parseTsconfig } from "get-tsconfig";
|
|
2
3
|
|
|
3
4
|
//#region src/filename.d.ts
|
|
4
5
|
declare const RE_JS: RegExp;
|
|
@@ -16,4 +17,4 @@ declare function filename_dts_to(id: string, ext: "js" | "ts"): string;
|
|
|
16
17
|
declare function resolveTemplateFn(fn: string | ChunkFileNamesFunction, chunk: PreRenderedChunk): string;
|
|
17
18
|
declare function replaceTemplateName(template: string, name: string): string;
|
|
18
19
|
//#endregion
|
|
19
|
-
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, replaceTemplateName, resolveTemplateFn };
|
|
20
|
+
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, parseTsconfig, replaceTemplateName, resolveTemplateFn };
|
|
@@ -0,0 +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-DQnUJlio.mjs";
|
|
2
|
+
import { parseTsconfig } from "get-tsconfig";
|
|
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, parseTsconfig, 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 { RE_DTS, RE_DTS_MAP } from "./filename.mjs";
|
|
3
|
+
import { n as RE_DTS, r as RE_DTS_MAP } from "./filename-DQnUJlio.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-3rlTPR48.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-DAUYR4Qd.mjs";
|
|
2
2
|
export { TscModule, TscOptions, 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-8hYVvCE4.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.23.1",
|
|
5
5
|
"description": "A Rolldown plugin to generate and bundle dts files.",
|
|
6
6
|
"author": "Kevin Deng <sxzz@sxzz.moe>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
],
|
|
25
25
|
"exports": {
|
|
26
26
|
".": "./dist/index.mjs",
|
|
27
|
-
"./
|
|
27
|
+
"./internal": "./dist/internal.mjs",
|
|
28
28
|
"./tsc": "./dist/tsc.mjs",
|
|
29
29
|
"./tsc-context": "./dist/tsc-context.mjs",
|
|
30
30
|
"./tsc-worker": "./dist/tsc-worker.mjs",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@ts-macro/tsc": "^0.3.6",
|
|
45
|
-
"@typescript/native-preview": ">=7.0.0-dev.
|
|
46
|
-
"rolldown": "^1.0.0-rc.
|
|
47
|
-
"typescript": "^5.0.0 || ^6.0.0
|
|
45
|
+
"@typescript/native-preview": ">=7.0.0-dev.20260325.1",
|
|
46
|
+
"rolldown": "^1.0.0-rc.12",
|
|
47
|
+
"typescript": "^5.0.0 || ^6.0.0",
|
|
48
48
|
"vue-tsc": "~3.2.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependenciesMeta": {
|
|
@@ -62,14 +62,14 @@
|
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@babel/generator": "8.0.0-rc.
|
|
66
|
-
"@babel/helper-validator-identifier": "8.0.0-rc.
|
|
67
|
-
"@babel/parser": "8.0.0-rc.
|
|
68
|
-
"@babel/types": "8.0.0-rc.
|
|
65
|
+
"@babel/generator": "8.0.0-rc.3",
|
|
66
|
+
"@babel/helper-validator-identifier": "8.0.0-rc.3",
|
|
67
|
+
"@babel/parser": "8.0.0-rc.3",
|
|
68
|
+
"@babel/types": "8.0.0-rc.3",
|
|
69
69
|
"ast-kit": "^3.0.0-beta.1",
|
|
70
70
|
"birpc": "^4.0.0",
|
|
71
71
|
"dts-resolver": "^2.1.3",
|
|
72
|
-
"get-tsconfig": "^4.13.
|
|
72
|
+
"get-tsconfig": "^4.13.7",
|
|
73
73
|
"obug": "^2.1.1"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
@@ -77,29 +77,29 @@
|
|
|
77
77
|
"@sxzz/eslint-config": "^7.8.3",
|
|
78
78
|
"@sxzz/prettier-config": "^2.3.1",
|
|
79
79
|
"@sxzz/test-utils": "^0.5.15",
|
|
80
|
-
"@types/node": "^25.
|
|
81
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
80
|
+
"@types/node": "^25.5.0",
|
|
81
|
+
"@typescript/native-preview": "7.0.0-dev.20260325.1",
|
|
82
82
|
"@volar/typescript": "^2.4.28",
|
|
83
|
-
"@vue/language-core": "^3.2.
|
|
83
|
+
"@vue/language-core": "^3.2.6",
|
|
84
84
|
"arktype": "^2.2.0",
|
|
85
|
-
"bumpp": "^
|
|
86
|
-
"diff": "^8.0.
|
|
87
|
-
"eslint": "^10.0
|
|
85
|
+
"bumpp": "^11.0.1",
|
|
86
|
+
"diff": "^8.0.4",
|
|
87
|
+
"eslint": "^10.1.0",
|
|
88
88
|
"prettier": "^3.8.1",
|
|
89
|
-
"rolldown": "^1.0.0-rc.
|
|
89
|
+
"rolldown": "^1.0.0-rc.12",
|
|
90
90
|
"rolldown-plugin-dts-snapshot": "^0.4.0",
|
|
91
91
|
"rolldown-plugin-require-cjs": "^0.4.0",
|
|
92
|
-
"rollup-plugin-dts": "^6.
|
|
92
|
+
"rollup-plugin-dts": "^6.4.1",
|
|
93
93
|
"tinyglobby": "^0.2.15",
|
|
94
|
-
"tsdown": "^0.21.
|
|
95
|
-
"typescript": "6.0.
|
|
96
|
-
"vitest": "^4.
|
|
97
|
-
"vue": "^3.5.
|
|
98
|
-
"vue-tsc": "^3.2.
|
|
94
|
+
"tsdown": "^0.21.5",
|
|
95
|
+
"typescript": "^6.0.2",
|
|
96
|
+
"vitest": "^4.1.1",
|
|
97
|
+
"vue": "^3.5.31",
|
|
98
|
+
"vue-tsc": "^3.2.6",
|
|
99
99
|
"zod": "^4.3.6"
|
|
100
100
|
},
|
|
101
101
|
"resolutions": {
|
|
102
|
-
"rolldown": "^1.0.0-rc.
|
|
102
|
+
"rolldown": "^1.0.0-rc.12"
|
|
103
103
|
},
|
|
104
104
|
"prettier": "@sxzz/prettier-config",
|
|
105
105
|
"scripts": {
|
|
File without changes
|
|
File without changes
|