rolldown-plugin-dts 0.22.3 → 0.22.5
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/dist/filename.mjs +2 -4
- package/dist/index.mjs +9 -28
- package/dist/{resolver-Ds-R63_O.mjs → resolver-BUWpVKW_.mjs} +4 -5
- package/dist/{tsc-GSZeR8WO.mjs → tsc-Dh95OfBG.mjs} +6 -17
- package/dist/tsc-context.mjs +2 -4
- package/dist/tsc-worker.mjs +3 -5
- package/dist/tsc.mjs +2 -3
- package/package.json +11 -11
package/dist/filename.mjs
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { RUNTIME_MODULE_ID } from "rolldown";
|
|
2
2
|
import { exactRegex } from "rolldown/filter";
|
|
3
|
-
|
|
4
3
|
//#region src/filename.ts
|
|
5
4
|
const RE_JS = /\.([cm]?)jsx?$/;
|
|
6
5
|
const RE_TS = /\.([cm]?)tsx?$/;
|
|
7
6
|
const RE_DTS = /\.d\.([cm]?)ts$/;
|
|
8
7
|
const RE_DTS_MAP = /\.d\.([cm]?)ts\.map$/;
|
|
9
8
|
const RE_NODE_MODULES = /[\\/]node_modules[\\/]/;
|
|
10
|
-
const RE_CSS = /\.css$/;
|
|
9
|
+
const RE_CSS = /\.(?:css|scss|sass|less|styl|stylus)$/;
|
|
11
10
|
const RE_VUE = /\.vue$/;
|
|
12
11
|
const RE_JSON = /\.json$/;
|
|
13
12
|
const RE_ROLLDOWN_RUNTIME = exactRegex(RUNTIME_MODULE_ID);
|
|
@@ -26,6 +25,5 @@ function resolveTemplateFn(fn, chunk) {
|
|
|
26
25
|
function replaceTemplateName(template, name) {
|
|
27
26
|
return template.replaceAll("[name]", name);
|
|
28
27
|
}
|
|
29
|
-
|
|
30
28
|
//#endregion
|
|
31
|
-
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 };
|
|
29
|
+
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 };
|
package/dist/index.mjs
CHANGED
|
@@ -7,27 +7,15 @@ import { isIdentifierName } from "@babel/helper-validator-identifier";
|
|
|
7
7
|
import { parse } from "@babel/parser";
|
|
8
8
|
import * as t from "@babel/types";
|
|
9
9
|
import { isDeclarationType, isIdentifierOf, isTypeOf, resolveString, walkAST } from "ast-kit";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const {
|
|
15
|
-
existsSync
|
|
16
|
-
} = globalThis.process.getBuiltinModule("node:fs");
|
|
17
|
-
const {
|
|
18
|
-
mkdtemp,
|
|
19
|
-
readFile,
|
|
20
|
-
rm
|
|
21
|
-
} = globalThis.process.getBuiltinModule("node:fs/promises");
|
|
22
|
-
const path = globalThis.process.getBuiltinModule("node:path");
|
|
10
|
+
import { fork, spawn } from "node:child_process";
|
|
11
|
+
import { existsSync } from "node:fs";
|
|
12
|
+
import { mkdtemp, readFile, rm } from "node:fs/promises";
|
|
13
|
+
import path from "node:path";
|
|
23
14
|
import { ResolverFactory, isolatedDeclarationSync } from "rolldown/experimental";
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} = globalThis.process.getBuiltinModule("node:os");
|
|
27
|
-
const process = globalThis.process;
|
|
15
|
+
import { tmpdir } from "node:os";
|
|
16
|
+
import process from "node:process";
|
|
28
17
|
import { getTsconfig, parseTsconfig } from "get-tsconfig";
|
|
29
18
|
import { createResolver } from "dts-resolver";
|
|
30
|
-
|
|
31
19
|
//#region src/dts-input.ts
|
|
32
20
|
function createDtsInputPlugin({ sideEffects }) {
|
|
33
21
|
return {
|
|
@@ -61,7 +49,6 @@ function createDtsInputPlugin({ sideEffects }) {
|
|
|
61
49
|
}
|
|
62
50
|
};
|
|
63
51
|
}
|
|
64
|
-
|
|
65
52
|
//#endregion
|
|
66
53
|
//#region src/fake-js.ts
|
|
67
54
|
function createFakeJsPlugin({ sourcemap, cjsDefault, sideEffects }) {
|
|
@@ -108,7 +95,7 @@ function createFakeJsPlugin({ sourcemap, cjsDefault, sideEffects }) {
|
|
|
108
95
|
};
|
|
109
96
|
function transform(code, id) {
|
|
110
97
|
const file = parse(code, {
|
|
111
|
-
plugins: [["typescript", { dts: true }]],
|
|
98
|
+
plugins: [["typescript", { dts: true }], "decoratorAutoAccessors"],
|
|
112
99
|
sourceType: "module",
|
|
113
100
|
errorRecovery: true,
|
|
114
101
|
createParenthesizedExpressions: true
|
|
@@ -647,7 +634,6 @@ function inheritNodeComments(oldNode, newNode) {
|
|
|
647
634
|
newNode.leadingComments = collectReferenceDirectives(newNode.leadingComments, true);
|
|
648
635
|
return newNode;
|
|
649
636
|
}
|
|
650
|
-
|
|
651
637
|
//#endregion
|
|
652
638
|
//#region src/tsgo.ts
|
|
653
639
|
const debug$3 = createDebug("rolldown-plugin-dts:tsgo");
|
|
@@ -690,7 +676,6 @@ async function runTsgo(rootDir, tsconfig, sourcemap, tsgoPath) {
|
|
|
690
676
|
await spawnAsync(tsgo, args, { stdio: "inherit" });
|
|
691
677
|
return tsgoDist;
|
|
692
678
|
}
|
|
693
|
-
|
|
694
679
|
//#endregion
|
|
695
680
|
//#region src/generate.ts
|
|
696
681
|
const debug$2 = createDebug("rolldown-plugin-dts:generate");
|
|
@@ -929,7 +914,6 @@ function collectJsonExports(code) {
|
|
|
929
914
|
else if (member.key.type === "StringLiteral") exports.push(member.key.value);
|
|
930
915
|
return exports;
|
|
931
916
|
}
|
|
932
|
-
|
|
933
917
|
//#endregion
|
|
934
918
|
//#region src/options.ts
|
|
935
919
|
let warnedTsgo = false;
|
|
@@ -997,7 +981,6 @@ function resolveOptions({ cwd = process.cwd(), dtsInput = false, emitDtsOnly = f
|
|
|
997
981
|
tsgo
|
|
998
982
|
};
|
|
999
983
|
}
|
|
1000
|
-
|
|
1001
984
|
//#endregion
|
|
1002
985
|
//#region src/resolver.ts
|
|
1003
986
|
const debug$1 = createDebug("rolldown-plugin-dts:resolver");
|
|
@@ -1060,7 +1043,7 @@ function createDtsResolvePlugin({ cwd, tsconfig, tsconfigRaw, resolver, sideEffe
|
|
|
1060
1043
|
async function resolveDtsPath(id, importer, rolldownResolution) {
|
|
1061
1044
|
let dtsPath;
|
|
1062
1045
|
if (resolver === "tsc") {
|
|
1063
|
-
const { tscResolve } = await import("./resolver-
|
|
1046
|
+
const { tscResolve } = await import("./resolver-BUWpVKW_.mjs");
|
|
1064
1047
|
dtsPath = tscResolve(id, importer, cwd, tsconfig, tsconfigRaw);
|
|
1065
1048
|
} else dtsPath = baseDtsResolver(id, importer);
|
|
1066
1049
|
debug$1("Using %s for dts import: %O -> %O", resolver, id, dtsPath);
|
|
@@ -1075,7 +1058,6 @@ function createDtsResolvePlugin({ cwd, tsconfig, tsconfigRaw, resolver, sideEffe
|
|
|
1075
1058
|
function isFilePath(id) {
|
|
1076
1059
|
return id.startsWith(".") || path.isAbsolute(id);
|
|
1077
1060
|
}
|
|
1078
|
-
|
|
1079
1061
|
//#endregion
|
|
1080
1062
|
//#region src/index.ts
|
|
1081
1063
|
const debug = createDebug("rolldown-plugin-dts:options");
|
|
@@ -1089,6 +1071,5 @@ function dts(options = {}) {
|
|
|
1089
1071
|
plugins.push(createDtsResolvePlugin(resolved), createFakeJsPlugin(resolved));
|
|
1090
1072
|
return plugins;
|
|
1091
1073
|
}
|
|
1092
|
-
|
|
1093
1074
|
//#endregion
|
|
1094
|
-
export { createFakeJsPlugin, createGeneratePlugin, dts, resolveOptions };
|
|
1075
|
+
export { createFakeJsPlugin, createGeneratePlugin, dts, resolveOptions };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { createRequire as __cjs_createRequire } from "node:module";
|
|
2
|
+
const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
2
3
|
import { createDebug } from "obug";
|
|
3
|
-
|
|
4
|
+
import path from "node:path";
|
|
4
5
|
const ts = __cjs_require("typescript");
|
|
5
|
-
|
|
6
6
|
//#region src/tsc/resolver.ts
|
|
7
7
|
const debug = createDebug("rolldown-plugin-dts:tsc-resolver");
|
|
8
8
|
function tscResolve(id, importer, cwd, tsconfig, tsconfigRaw, reference) {
|
|
@@ -15,6 +15,5 @@ function tscResolve(id, importer, cwd, tsconfig, tsconfigRaw, reference) {
|
|
|
15
15
|
debug(`tsc resolving id "%s" from "%s" -> %O`, id, importer, resolved.resolvedModule);
|
|
16
16
|
return resolved.resolvedModule?.resolvedFileName;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
18
|
//#endregion
|
|
20
|
-
export { tscResolve };
|
|
19
|
+
export { tscResolve };
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { createRequire as __cjs_createRequire } from "node:module";
|
|
2
|
+
const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
2
3
|
import { RE_DTS, RE_DTS_MAP } from "./filename.mjs";
|
|
3
4
|
import { globalContext } from "./tsc-context.mjs";
|
|
4
|
-
|
|
5
|
-
createRequire
|
|
6
|
-
} = globalThis.process.getBuiltinModule("node:module");
|
|
5
|
+
import { createRequire } from "node:module";
|
|
7
6
|
import { createDebug } from "obug";
|
|
8
|
-
|
|
7
|
+
import path from "node:path";
|
|
9
8
|
const ts = __cjs_require("typescript");
|
|
10
|
-
|
|
11
|
-
pathToFileURL
|
|
12
|
-
} = globalThis.process.getBuiltinModule("node:url");
|
|
13
|
-
|
|
9
|
+
import { pathToFileURL } from "node:url";
|
|
14
10
|
//#region \0rolldown/runtime.js
|
|
15
11
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
16
|
-
|
|
17
12
|
//#endregion
|
|
18
13
|
//#region src/tsc/system.ts
|
|
19
14
|
const debug$4 = createDebug("rolldown-plugin-dts:tsc-system");
|
|
@@ -64,7 +59,6 @@ function createMemorySystem(files) {
|
|
|
64
59
|
}
|
|
65
60
|
};
|
|
66
61
|
}
|
|
67
|
-
|
|
68
62
|
//#endregion
|
|
69
63
|
//#region src/tsc/utils.ts
|
|
70
64
|
const formatHost = {
|
|
@@ -87,7 +81,6 @@ function setSourceMapRoot(map, originalFilePath, finalFilePath) {
|
|
|
87
81
|
const finalDir = path.posix.dirname(pathToFileURL(finalFilePath).pathname);
|
|
88
82
|
if (originalDir !== finalDir) map.sourceRoot = path.posix.relative(finalDir, originalDir);
|
|
89
83
|
}
|
|
90
|
-
|
|
91
84
|
//#endregion
|
|
92
85
|
//#region src/tsc/emit-build.ts
|
|
93
86
|
const debug$3 = createDebug("rolldown-plugin-dts:tsc-build");
|
|
@@ -241,7 +234,6 @@ function patchCompilerOptions(options, extraOptions) {
|
|
|
241
234
|
const createProgramWithPatchedCompilerOptions = (rootNames, options, ...args) => {
|
|
242
235
|
return ts.createEmitAndSemanticDiagnosticsBuilderProgram(rootNames, patchCompilerOptions(options ?? {}, null), ...args);
|
|
243
236
|
};
|
|
244
|
-
|
|
245
237
|
//#endregion
|
|
246
238
|
//#region src/tsc/volar.ts
|
|
247
239
|
const debug$2 = createDebug("rolldown-plugin-dts:volar");
|
|
@@ -306,7 +298,6 @@ function createProgramFactory(ts, options) {
|
|
|
306
298
|
return { languagePlugins };
|
|
307
299
|
});
|
|
308
300
|
}
|
|
309
|
-
|
|
310
301
|
//#endregion
|
|
311
302
|
//#region src/tsc/emit-compiler.ts
|
|
312
303
|
const debug$1 = createDebug("rolldown-plugin-dts:tsc-compiler");
|
|
@@ -425,7 +416,6 @@ function tscEmitCompiler(tscOptions) {
|
|
|
425
416
|
map
|
|
426
417
|
};
|
|
427
418
|
}
|
|
428
|
-
|
|
429
419
|
//#endregion
|
|
430
420
|
//#region src/tsc/index.ts
|
|
431
421
|
const debug = createDebug("rolldown-plugin-dts:tsc");
|
|
@@ -435,6 +425,5 @@ function tscEmit(tscOptions) {
|
|
|
435
425
|
if (tscOptions.build) return tscEmitBuild(tscOptions);
|
|
436
426
|
else return tscEmitCompiler(tscOptions);
|
|
437
427
|
}
|
|
438
|
-
|
|
439
428
|
//#endregion
|
|
440
|
-
export { tscEmit as t };
|
|
429
|
+
export { tscEmit as t };
|
package/dist/tsc-context.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createDebug } from "obug";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import path from "node:path";
|
|
4
3
|
//#region src/tsc/context.ts
|
|
5
4
|
const debug = createDebug("rolldown-plugin-dts:tsc-context");
|
|
6
5
|
function createContext() {
|
|
@@ -20,6 +19,5 @@ function invalidateContextFile(context, file) {
|
|
|
20
19
|
context.projects.clear();
|
|
21
20
|
}
|
|
22
21
|
const globalContext = createContext();
|
|
23
|
-
|
|
24
22
|
//#endregion
|
|
25
|
-
export { createContext, globalContext, invalidateContextFile };
|
|
23
|
+
export { createContext, globalContext, invalidateContextFile };
|
package/dist/tsc-worker.mjs
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { t as tscEmit } from "./tsc-
|
|
2
|
-
|
|
1
|
+
import { t as tscEmit } from "./tsc-Dh95OfBG.mjs";
|
|
2
|
+
import process from "node:process";
|
|
3
3
|
import { createBirpc } from "birpc";
|
|
4
|
-
|
|
5
4
|
//#region src/tsc/worker.ts
|
|
6
5
|
createBirpc({ tscEmit }, {
|
|
7
6
|
post: (data) => process.send(data),
|
|
8
7
|
on: (fn) => process.on("message", fn)
|
|
9
8
|
});
|
|
10
|
-
|
|
11
9
|
//#endregion
|
|
12
|
-
export {
|
|
10
|
+
export {};
|
package/dist/tsc.mjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { t as tscEmit } from "./tsc-
|
|
2
|
-
|
|
3
|
-
export { tscEmit };
|
|
1
|
+
import { t as tscEmit } from "./tsc-Dh95OfBG.mjs";
|
|
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.22.
|
|
4
|
+
"version": "0.22.5",
|
|
5
5
|
"description": "A Rolldown plugin to generate and bundle dts files.",
|
|
6
6
|
"author": "Kevin Deng <sxzz@sxzz.moe>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -74,32 +74,32 @@
|
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@jridgewell/source-map": "^0.3.11",
|
|
77
|
-
"@sxzz/eslint-config": "^7.8.
|
|
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.4.0",
|
|
81
|
+
"@typescript/native-preview": "7.0.0-dev.20260311.1",
|
|
82
82
|
"@volar/typescript": "^2.4.28",
|
|
83
83
|
"@vue/language-core": "^3.2.5",
|
|
84
|
-
"arktype": "^2.
|
|
84
|
+
"arktype": "^2.2.0",
|
|
85
85
|
"bumpp": "^10.4.1",
|
|
86
86
|
"diff": "^8.0.3",
|
|
87
|
-
"eslint": "^10.0.
|
|
87
|
+
"eslint": "^10.0.3",
|
|
88
88
|
"prettier": "^3.8.1",
|
|
89
|
-
"rolldown": "^1.0.0-rc.
|
|
89
|
+
"rolldown": "^1.0.0-rc.9",
|
|
90
90
|
"rolldown-plugin-dts-snapshot": "^0.4.0",
|
|
91
|
-
"rolldown-plugin-require-cjs": "^0.
|
|
91
|
+
"rolldown-plugin-require-cjs": "^0.4.0",
|
|
92
92
|
"rollup-plugin-dts": "^6.3.0",
|
|
93
93
|
"tinyglobby": "^0.2.15",
|
|
94
|
-
"tsdown": "^0.21.
|
|
94
|
+
"tsdown": "^0.21.1",
|
|
95
95
|
"typescript": "6.0.0-dev.20260301",
|
|
96
96
|
"vitest": "^4.0.18",
|
|
97
|
-
"vue": "^3.5.
|
|
97
|
+
"vue": "^3.5.30",
|
|
98
98
|
"vue-tsc": "^3.2.5",
|
|
99
99
|
"zod": "^4.3.6"
|
|
100
100
|
},
|
|
101
101
|
"resolutions": {
|
|
102
|
-
"rolldown": "^1.0.0-rc.
|
|
102
|
+
"rolldown": "^1.0.0-rc.9"
|
|
103
103
|
},
|
|
104
104
|
"prettier": "@sxzz/prettier-config",
|
|
105
105
|
"scripts": {
|