rolldown-plugin-dts 0.16.5 → 0.16.7
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/{context-Digr9tkU.js → context-CzXq1eN7.js} +7 -3
- package/dist/filename.js +1 -1
- package/dist/index.js +17 -14
- package/dist/{tsc-DLbQk3B6.js → tsc-ExCTFf5T.js} +59 -53
- package/dist/tsc-context.js +1 -1
- package/dist/tsc-worker.js +2 -2
- package/dist/tsc.js +2 -2
- package/package.json +12 -10
- /package/dist/{filename-Dd76wOJT.js → filename-DCSs6tgU.js} +0 -0
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
2
|
|
|
3
|
+
//#region rolldown:runtime
|
|
4
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
3
7
|
//#region src/tsc/context.ts
|
|
4
|
-
const debug =
|
|
8
|
+
const debug = __require("debug")("rolldown-plugin-dts:tsc-context");
|
|
5
9
|
function createContext() {
|
|
6
10
|
return {
|
|
7
11
|
programs: [],
|
|
@@ -20,4 +24,4 @@ function invalidateContextFile(context, file) {
|
|
|
20
24
|
const globalContext = createContext();
|
|
21
25
|
|
|
22
26
|
//#endregion
|
|
23
|
-
export { createContext, globalContext, invalidateContextFile };
|
|
27
|
+
export { __require, createContext, globalContext, invalidateContextFile };
|
package/dist/filename.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts, replaceTemplateName, resolveTemplateFn } from "./filename-
|
|
1
|
+
import { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts, replaceTemplateName, resolveTemplateFn } from "./filename-DCSs6tgU.js";
|
|
2
2
|
|
|
3
3
|
export { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts, replaceTemplateName, resolveTemplateFn };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import Debug from "debug";
|
|
1
|
+
import { __require, createContext, globalContext, invalidateContextFile } from "./context-CzXq1eN7.js";
|
|
2
|
+
import { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts, replaceTemplateName, resolveTemplateFn } from "./filename-DCSs6tgU.js";
|
|
4
3
|
import MagicString from "magic-string";
|
|
5
|
-
import _generate from "@babel/generator";
|
|
6
|
-
import { parse } from "@babel/parser";
|
|
7
|
-
import * as t from "@babel/types";
|
|
8
4
|
import { isDeclarationType, isTypeOf, resolveString } from "ast-kit";
|
|
9
5
|
import { fork, spawn } from "node:child_process";
|
|
10
6
|
import { existsSync } from "node:fs";
|
|
@@ -268,7 +264,9 @@ function walk(ast, { enter, leave }) {
|
|
|
268
264
|
|
|
269
265
|
//#endregion
|
|
270
266
|
//#region src/fake-js.ts
|
|
271
|
-
const generate =
|
|
267
|
+
const { generate } = __require("@babel/generator");
|
|
268
|
+
const { parse } = __require("@babel/parser");
|
|
269
|
+
const t = __require("@babel/types");
|
|
272
270
|
function createFakeJsPlugin({ sourcemap, cjsDefault }) {
|
|
273
271
|
let symbolIdx = 0;
|
|
274
272
|
const identifierMap = Object.create(null);
|
|
@@ -694,7 +692,8 @@ function inheritNodeComments(oldNode, newNode) {
|
|
|
694
692
|
|
|
695
693
|
//#endregion
|
|
696
694
|
//#region src/generate.ts
|
|
697
|
-
const
|
|
695
|
+
const Debug$1 = __require("debug");
|
|
696
|
+
const debug$1 = Debug$1("rolldown-plugin-dts:generate");
|
|
698
697
|
const WORKER_URL = "./tsc-worker.js";
|
|
699
698
|
const spawnAsync = (...args) => new Promise((resolve, reject) => {
|
|
700
699
|
const child = spawn(...args);
|
|
@@ -963,7 +962,7 @@ function resolveOptions({ cwd = process.cwd(), dtsInput = false, emitDtsOnly = f
|
|
|
963
962
|
//#endregion
|
|
964
963
|
//#region src/resolver.ts
|
|
965
964
|
function createDtsResolvePlugin({ tsconfig, resolve }) {
|
|
966
|
-
const isSourceFile = (p) => RE_TS.test(p) || RE_VUE.test(p);
|
|
965
|
+
const isSourceFile = (p) => RE_TS.test(p) || RE_JS.test(p) || RE_VUE.test(p);
|
|
967
966
|
const shouldBundleNodeModule = (id) => {
|
|
968
967
|
if (typeof resolve === "boolean") return resolve;
|
|
969
968
|
return resolve.some((pattern) => typeof pattern === "string" ? id === pattern : pattern.test(id));
|
|
@@ -973,30 +972,30 @@ function createDtsResolvePlugin({ tsconfig, resolve }) {
|
|
|
973
972
|
resolveNodeModules: !!resolve,
|
|
974
973
|
ResolverFactory
|
|
975
974
|
});
|
|
976
|
-
|
|
975
|
+
function resolveDtsPath(id, importer, rolldownResolution) {
|
|
977
976
|
let dtsPath = baseDtsResolver(id, importer);
|
|
978
977
|
if (dtsPath) dtsPath = path.normalize(dtsPath);
|
|
979
978
|
if (!dtsPath || !isSourceFile(dtsPath)) {
|
|
980
|
-
if (rolldownResolution && isSourceFile(rolldownResolution.id)) return rolldownResolution.id;
|
|
979
|
+
if (rolldownResolution && isFilePath(rolldownResolution.id) && isSourceFile(rolldownResolution.id) && !rolldownResolution.external) return rolldownResolution.id;
|
|
981
980
|
return null;
|
|
982
981
|
}
|
|
983
982
|
return dtsPath;
|
|
984
|
-
}
|
|
983
|
+
}
|
|
985
984
|
return {
|
|
986
985
|
name: "rolldown-plugin-dts:resolver",
|
|
987
986
|
resolveId: {
|
|
988
987
|
order: "pre",
|
|
989
988
|
async handler(id, importer, options) {
|
|
989
|
+
if (!importer || !RE_DTS.test(importer)) return;
|
|
990
990
|
const external = {
|
|
991
991
|
id,
|
|
992
992
|
external: true,
|
|
993
993
|
moduleSideEffects: false
|
|
994
994
|
};
|
|
995
|
-
if (!importer || !RE_DTS.test(importer)) return;
|
|
996
995
|
if (RE_CSS.test(id)) return external;
|
|
997
996
|
const rolldownResolution = await this.resolve(id, importer, options);
|
|
998
997
|
const dtsResolution = resolveDtsPath(id, importer, rolldownResolution);
|
|
999
|
-
if (!dtsResolution) return
|
|
998
|
+
if (!dtsResolution) return isFilePath(id) ? null : external;
|
|
1000
999
|
if (RE_NODE_MODULES.test(dtsResolution) && !shouldBundleNodeModule(id) && (!RE_NODE_MODULES.test(importer) || rolldownResolution?.external)) return external;
|
|
1001
1000
|
if (RE_DTS.test(dtsResolution)) return dtsResolution;
|
|
1002
1001
|
if (isSourceFile(dtsResolution)) {
|
|
@@ -1007,9 +1006,13 @@ function createDtsResolvePlugin({ tsconfig, resolve }) {
|
|
|
1007
1006
|
}
|
|
1008
1007
|
};
|
|
1009
1008
|
}
|
|
1009
|
+
function isFilePath(id) {
|
|
1010
|
+
return id.startsWith(".") || path.isAbsolute(id);
|
|
1011
|
+
}
|
|
1010
1012
|
|
|
1011
1013
|
//#endregion
|
|
1012
1014
|
//#region src/index.ts
|
|
1015
|
+
const Debug = __require("debug");
|
|
1013
1016
|
const debug = Debug("rolldown-plugin-dts:options");
|
|
1014
1017
|
function dts(options = {}) {
|
|
1015
1018
|
debug("resolving dts options");
|
|
@@ -1,45 +1,44 @@
|
|
|
1
|
-
import { globalContext } from "./context-
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
|
-
import Debug from "debug";
|
|
1
|
+
import { __require, globalContext } from "./context-CzXq1eN7.js";
|
|
4
2
|
import path from "node:path";
|
|
5
|
-
import ts from "typescript";
|
|
6
3
|
import { pathToFileURL } from "node:url";
|
|
7
4
|
|
|
8
5
|
//#region src/tsc/system.ts
|
|
9
|
-
const
|
|
6
|
+
const Debug$4 = __require("debug");
|
|
7
|
+
const ts$4 = __require("typescript");
|
|
8
|
+
const debug$3 = Debug$4("rolldown-plugin-dts:tsc-system");
|
|
10
9
|
/**
|
|
11
10
|
* A system that writes files to both memory and disk. It will try read files
|
|
12
11
|
* from memory firstly and fallback to disk if not found.
|
|
13
12
|
*/
|
|
14
13
|
function createFsSystem(files) {
|
|
15
14
|
return {
|
|
16
|
-
...ts.sys,
|
|
15
|
+
...ts$4.sys,
|
|
17
16
|
write(message) {
|
|
18
17
|
debug$3(message);
|
|
19
18
|
},
|
|
20
19
|
resolvePath(path$1) {
|
|
21
20
|
if (files.has(path$1)) return path$1;
|
|
22
|
-
return ts.sys.resolvePath(path$1);
|
|
21
|
+
return ts$4.sys.resolvePath(path$1);
|
|
23
22
|
},
|
|
24
23
|
directoryExists(directory) {
|
|
25
24
|
if (Array.from(files.keys()).some((path$1) => path$1.startsWith(directory))) return true;
|
|
26
|
-
return ts.sys.directoryExists(directory);
|
|
25
|
+
return ts$4.sys.directoryExists(directory);
|
|
27
26
|
},
|
|
28
27
|
fileExists(fileName) {
|
|
29
28
|
if (files.has(fileName)) return true;
|
|
30
|
-
return ts.sys.fileExists(fileName);
|
|
29
|
+
return ts$4.sys.fileExists(fileName);
|
|
31
30
|
},
|
|
32
31
|
readFile(fileName, ...args) {
|
|
33
32
|
if (files.has(fileName)) return files.get(fileName);
|
|
34
|
-
return ts.sys.readFile(fileName, ...args);
|
|
33
|
+
return ts$4.sys.readFile(fileName, ...args);
|
|
35
34
|
},
|
|
36
35
|
writeFile(path$1, data, ...args) {
|
|
37
36
|
files.set(path$1, data);
|
|
38
|
-
ts.sys.writeFile(path$1, data, ...args);
|
|
37
|
+
ts$4.sys.writeFile(path$1, data, ...args);
|
|
39
38
|
},
|
|
40
39
|
deleteFile(fileName, ...args) {
|
|
41
40
|
files.delete(fileName);
|
|
42
|
-
ts.sys.deleteFile?.(fileName, ...args);
|
|
41
|
+
ts$4.sys.deleteFile?.(fileName, ...args);
|
|
43
42
|
}
|
|
44
43
|
};
|
|
45
44
|
}
|
|
@@ -57,17 +56,18 @@ function createMemorySystem(files) {
|
|
|
57
56
|
|
|
58
57
|
//#endregion
|
|
59
58
|
//#region src/tsc/utils.ts
|
|
59
|
+
const ts$3 = __require("typescript");
|
|
60
60
|
const formatHost = {
|
|
61
|
-
getCurrentDirectory: () => ts.sys.getCurrentDirectory(),
|
|
62
|
-
getNewLine: () => ts.sys.newLine,
|
|
63
|
-
getCanonicalFileName: ts.sys.useCaseSensitiveFileNames ? (f) => f : (f) => f.toLowerCase()
|
|
61
|
+
getCurrentDirectory: () => ts$3.sys.getCurrentDirectory(),
|
|
62
|
+
getNewLine: () => ts$3.sys.newLine,
|
|
63
|
+
getCanonicalFileName: ts$3.sys.useCaseSensitiveFileNames ? (f) => f : (f) => f.toLowerCase()
|
|
64
64
|
};
|
|
65
65
|
const stripPrivateFields = (ctx) => {
|
|
66
66
|
const visitor = (node) => {
|
|
67
|
-
if (ts.isPropertySignature(node) && ts.isPrivateIdentifier(node.name)) return ctx.factory.updatePropertySignature(node, node.modifiers, ctx.factory.createStringLiteral(node.name.text), node.questionToken, node.type);
|
|
68
|
-
return ts.visitEachChild(node, visitor, ctx);
|
|
67
|
+
if (ts$3.isPropertySignature(node) && ts$3.isPrivateIdentifier(node.name)) return ctx.factory.updatePropertySignature(node, node.modifiers, ctx.factory.createStringLiteral(node.name.text), node.questionToken, node.type);
|
|
68
|
+
return ts$3.visitEachChild(node, visitor, ctx);
|
|
69
69
|
};
|
|
70
|
-
return (sourceFile) => ts.visitNode(sourceFile, visitor, ts.isSourceFile) ?? sourceFile;
|
|
70
|
+
return (sourceFile) => ts$3.visitNode(sourceFile, visitor, ts$3.isSourceFile) ?? sourceFile;
|
|
71
71
|
};
|
|
72
72
|
const customTransformers = { afterDeclarations: [stripPrivateFields] };
|
|
73
73
|
function setSourceMapRoot(map, originalFilePath, finalFilePath) {
|
|
@@ -80,7 +80,9 @@ function setSourceMapRoot(map, originalFilePath, finalFilePath) {
|
|
|
80
80
|
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region src/tsc/emit-build.ts
|
|
83
|
-
const
|
|
83
|
+
const Debug$3 = __require("debug");
|
|
84
|
+
const ts$2 = __require("typescript");
|
|
85
|
+
const debug$2 = Debug$3("rolldown-plugin-dts:tsc-build");
|
|
84
86
|
function tscEmitBuild(tscOptions) {
|
|
85
87
|
const { id, tsconfig, incremental, context = globalContext, sourcemap } = tscOptions;
|
|
86
88
|
debug$2(`running tscEmitBuild id: ${id}, tsconfig: ${tsconfig}, incremental: ${incremental}`);
|
|
@@ -95,7 +97,7 @@ function tscEmitBuild(tscOptions) {
|
|
|
95
97
|
}
|
|
96
98
|
debug$2(`loaded project ${project.tsconfigPath} for ${id}`);
|
|
97
99
|
const ignoreCase = !fsSystem.useCaseSensitiveFileNames;
|
|
98
|
-
const outputFiles = ts.getOutputFileNames(project.parsedConfig, resolvedId, ignoreCase);
|
|
100
|
+
const outputFiles = ts$2.getOutputFileNames(project.parsedConfig, resolvedId, ignoreCase);
|
|
99
101
|
let code;
|
|
100
102
|
let map;
|
|
101
103
|
for (const outputFile of outputFiles) {
|
|
@@ -150,8 +152,8 @@ function buildProjects(fsSystem, tsconfig, force, sourcemap) {
|
|
|
150
152
|
debug$2(`start building projects for ${tsconfig}`);
|
|
151
153
|
const projects = collectProjectGraph(tsconfig, fsSystem, force, sourcemap);
|
|
152
154
|
debug$2("collected %d projects: %j", projects.length, projects.map((project) => project.tsconfigPath));
|
|
153
|
-
const host = ts.createSolutionBuilderHost(fsSystem, createProgramWithPatchedCompilerOptions);
|
|
154
|
-
const exitStatus = ts.createSolutionBuilder(host, [tsconfig], {
|
|
155
|
+
const host = ts$2.createSolutionBuilderHost(fsSystem, createProgramWithPatchedCompilerOptions);
|
|
156
|
+
const exitStatus = ts$2.createSolutionBuilder(host, [tsconfig], {
|
|
155
157
|
force,
|
|
156
158
|
verbose: true
|
|
157
159
|
}).build(void 0, void 0, void 0, (project) => {
|
|
@@ -186,19 +188,19 @@ function collectProjectGraph(rootTsconfigPath, fsSystem, force, sourcemap) {
|
|
|
186
188
|
tsconfigPath,
|
|
187
189
|
parsedConfig
|
|
188
190
|
});
|
|
189
|
-
for (const ref of parsedConfig.projectReferences ?? []) stack.push(ts.resolveProjectReferencePath(ref));
|
|
191
|
+
for (const ref of parsedConfig.projectReferences ?? []) stack.push(ts$2.resolveProjectReferencePath(ref));
|
|
190
192
|
}
|
|
191
193
|
return projects;
|
|
192
194
|
}
|
|
193
195
|
function parseTsconfig(tsconfigPath, fsSystem) {
|
|
194
196
|
const diagnostics = [];
|
|
195
|
-
const parsedConfig = ts.getParsedCommandLineOfConfigFile(tsconfigPath, void 0, {
|
|
197
|
+
const parsedConfig = ts$2.getParsedCommandLineOfConfigFile(tsconfigPath, void 0, {
|
|
196
198
|
...fsSystem,
|
|
197
199
|
onUnRecoverableConfigFileDiagnostic: (diagnostic) => {
|
|
198
200
|
diagnostics.push(diagnostic);
|
|
199
201
|
}
|
|
200
202
|
});
|
|
201
|
-
if (diagnostics.length) throw new Error(`[rolldown-plugin-dts] Unable to read ${tsconfigPath}: ${ts.formatDiagnostics(diagnostics, formatHost)}`);
|
|
203
|
+
if (diagnostics.length) throw new Error(`[rolldown-plugin-dts] Unable to read ${tsconfigPath}: ${ts$2.formatDiagnostics(diagnostics, formatHost)}`);
|
|
202
204
|
return parsedConfig;
|
|
203
205
|
}
|
|
204
206
|
function patchCompilerOptions(options, extraOptions) {
|
|
@@ -230,27 +232,27 @@ function patchCompilerOptions(options, extraOptions) {
|
|
|
230
232
|
return options;
|
|
231
233
|
}
|
|
232
234
|
const createProgramWithPatchedCompilerOptions = (rootNames, options, ...args) => {
|
|
233
|
-
return ts.createEmitAndSemanticDiagnosticsBuilderProgram(rootNames, patchCompilerOptions(options ?? {}, null), ...args);
|
|
235
|
+
return ts$2.createEmitAndSemanticDiagnosticsBuilderProgram(rootNames, patchCompilerOptions(options ?? {}, null), ...args);
|
|
234
236
|
};
|
|
235
237
|
|
|
236
238
|
//#endregion
|
|
237
239
|
//#region src/tsc/volar.ts
|
|
238
|
-
const
|
|
240
|
+
const Debug$2 = __require("debug");
|
|
239
241
|
function loadVueLanguageTools() {
|
|
240
|
-
const debug$4 = Debug("rolldown-plugin-dts:vue");
|
|
242
|
+
const debug$4 = Debug$2("rolldown-plugin-dts:vue");
|
|
241
243
|
debug$4("loading vue language tools");
|
|
242
244
|
try {
|
|
243
|
-
const vueTscPath =
|
|
244
|
-
const { proxyCreateProgram } =
|
|
245
|
-
const vue =
|
|
246
|
-
const getLanguagePlugin = (ts$
|
|
245
|
+
const vueTscPath = __require.resolve("vue-tsc");
|
|
246
|
+
const { proxyCreateProgram } = __require(__require.resolve("@volar/typescript", { paths: [vueTscPath] }));
|
|
247
|
+
const vue = __require(__require.resolve("@vue/language-core", { paths: [vueTscPath] }));
|
|
248
|
+
const getLanguagePlugin = (ts$5, options) => {
|
|
247
249
|
const $rootDir = options.options.$rootDir;
|
|
248
250
|
const $configRaw = options.options.$configRaw;
|
|
249
|
-
const resolver = new vue.CompilerOptionsResolver(ts$
|
|
251
|
+
const resolver = new vue.CompilerOptionsResolver(ts$5.sys.fileExists);
|
|
250
252
|
resolver.addConfig($configRaw?.vueCompilerOptions ?? {}, $rootDir);
|
|
251
253
|
const vueOptions = resolver.build();
|
|
252
|
-
vue.writeGlobalTypes(vueOptions, ts$
|
|
253
|
-
return vue.createVueLanguagePlugin(ts$
|
|
254
|
+
vue.writeGlobalTypes(vueOptions, ts$5.sys.writeFile);
|
|
255
|
+
return vue.createVueLanguagePlugin(ts$5, options.options, vueOptions, (id) => id);
|
|
254
256
|
};
|
|
255
257
|
return {
|
|
256
258
|
proxyCreateProgram,
|
|
@@ -262,16 +264,16 @@ function loadVueLanguageTools() {
|
|
|
262
264
|
}
|
|
263
265
|
}
|
|
264
266
|
function loadTsMacro() {
|
|
265
|
-
const debug$4 = Debug("rolldown-plugin-dts:ts-macro");
|
|
267
|
+
const debug$4 = Debug$2("rolldown-plugin-dts:ts-macro");
|
|
266
268
|
debug$4("loading ts-macro language tools");
|
|
267
269
|
try {
|
|
268
|
-
const tsMacroPath =
|
|
269
|
-
const { proxyCreateProgram } =
|
|
270
|
-
const tsMacro =
|
|
271
|
-
const { getOptions } =
|
|
272
|
-
const getLanguagePlugin = (ts$
|
|
270
|
+
const tsMacroPath = __require.resolve("@ts-macro/tsc");
|
|
271
|
+
const { proxyCreateProgram } = __require(__require.resolve("@volar/typescript", { paths: [tsMacroPath] }));
|
|
272
|
+
const tsMacro = __require(__require.resolve("@ts-macro/language-plugin", { paths: [tsMacroPath] }));
|
|
273
|
+
const { getOptions } = __require(__require.resolve("@ts-macro/language-plugin/options", { paths: [tsMacroPath] }));
|
|
274
|
+
const getLanguagePlugin = (ts$5, options) => {
|
|
273
275
|
const $rootDir = options.options.$rootDir;
|
|
274
|
-
return tsMacro.getLanguagePlugins(ts$
|
|
276
|
+
return tsMacro.getLanguagePlugins(ts$5, options.options, getOptions(ts$5, $rootDir))[0];
|
|
275
277
|
};
|
|
276
278
|
return {
|
|
277
279
|
proxyCreateProgram,
|
|
@@ -282,22 +284,24 @@ function loadTsMacro() {
|
|
|
282
284
|
throw new Error("Failed to load ts-macro language tools. Please manually install @ts-macro/tsc.");
|
|
283
285
|
}
|
|
284
286
|
}
|
|
285
|
-
function createProgramFactory(ts$
|
|
287
|
+
function createProgramFactory(ts$5, options) {
|
|
286
288
|
const vueLanguageTools = options.vue ? loadVueLanguageTools() : void 0;
|
|
287
289
|
const tsMacroLanguageTools = options.tsMacro ? loadTsMacro() : void 0;
|
|
288
290
|
const proxyCreateProgram = vueLanguageTools?.proxyCreateProgram || tsMacroLanguageTools?.proxyCreateProgram;
|
|
289
|
-
if (!proxyCreateProgram) return ts$
|
|
290
|
-
return proxyCreateProgram(ts$
|
|
291
|
+
if (!proxyCreateProgram) return ts$5.createProgram;
|
|
292
|
+
return proxyCreateProgram(ts$5, ts$5.createProgram, (ts$6, options$1) => {
|
|
291
293
|
const languagePlugins = [];
|
|
292
|
-
if (vueLanguageTools) languagePlugins.push(vueLanguageTools.getLanguagePlugin(ts$
|
|
293
|
-
if (tsMacroLanguageTools) languagePlugins.push(tsMacroLanguageTools.getLanguagePlugin(ts$
|
|
294
|
+
if (vueLanguageTools) languagePlugins.push(vueLanguageTools.getLanguagePlugin(ts$6, options$1));
|
|
295
|
+
if (tsMacroLanguageTools) languagePlugins.push(tsMacroLanguageTools.getLanguagePlugin(ts$6, options$1));
|
|
294
296
|
return { languagePlugins };
|
|
295
297
|
});
|
|
296
298
|
}
|
|
297
299
|
|
|
298
300
|
//#endregion
|
|
299
301
|
//#region src/tsc/emit-compiler.ts
|
|
300
|
-
const
|
|
302
|
+
const Debug$1 = __require("debug");
|
|
303
|
+
const ts$1 = __require("typescript");
|
|
304
|
+
const debug$1 = Debug$1("rolldown-plugin-dts:tsc-compiler");
|
|
301
305
|
const defaultCompilerOptions = {
|
|
302
306
|
declaration: true,
|
|
303
307
|
noEmit: false,
|
|
@@ -308,7 +312,7 @@ const defaultCompilerOptions = {
|
|
|
308
312
|
skipLibCheck: true,
|
|
309
313
|
target: 99,
|
|
310
314
|
resolveJsonModule: true,
|
|
311
|
-
moduleResolution: ts.ModuleResolutionKind.Bundler
|
|
315
|
+
moduleResolution: ts$1.ModuleResolutionKind.Bundler
|
|
312
316
|
};
|
|
313
317
|
function createOrGetTsModule(options) {
|
|
314
318
|
const { id, entries, context = globalContext } = options;
|
|
@@ -333,7 +337,7 @@ function createOrGetTsModule(options) {
|
|
|
333
337
|
function createTsProgram({ entries, id, tsconfig, tsconfigRaw, vue, tsMacro, cwd, context = globalContext }) {
|
|
334
338
|
const fsSystem = createFsSystem(context.files);
|
|
335
339
|
const baseDir = tsconfig ? path.dirname(tsconfig) : cwd;
|
|
336
|
-
const parsedConfig = ts.parseJsonConfigFileContent(tsconfigRaw, fsSystem, baseDir);
|
|
340
|
+
const parsedConfig = ts$1.parseJsonConfigFileContent(tsconfigRaw, fsSystem, baseDir);
|
|
337
341
|
debug$1(`Creating program for root project: ${baseDir}`);
|
|
338
342
|
return createTsProgramFromParsedConfig({
|
|
339
343
|
parsedConfig,
|
|
@@ -353,8 +357,8 @@ function createTsProgramFromParsedConfig({ parsedConfig, fsSystem, baseDir, id,
|
|
|
353
357
|
$rootDir: baseDir
|
|
354
358
|
};
|
|
355
359
|
const rootNames = [...new Set([id, ...entries || parsedConfig.fileNames].map((f) => fsSystem.resolvePath(f)))];
|
|
356
|
-
const host = ts.createCompilerHost(compilerOptions, true);
|
|
357
|
-
const program = createProgramFactory(ts, {
|
|
360
|
+
const host = ts$1.createCompilerHost(compilerOptions, true);
|
|
361
|
+
const program = createProgramFactory(ts$1, {
|
|
358
362
|
vue,
|
|
359
363
|
tsMacro
|
|
360
364
|
})({
|
|
@@ -396,7 +400,7 @@ function tscEmitCompiler(tscOptions) {
|
|
|
396
400
|
dtsCode = code;
|
|
397
401
|
}
|
|
398
402
|
}, void 0, true, customTransformers, true);
|
|
399
|
-
if (emitSkipped && diagnostics.length) return { error: ts.formatDiagnostics(diagnostics, formatHost) };
|
|
403
|
+
if (emitSkipped && diagnostics.length) return { error: ts$1.formatDiagnostics(diagnostics, formatHost) };
|
|
400
404
|
if (!dtsCode && file.isDeclarationFile) {
|
|
401
405
|
debug$1("nothing was emitted. fallback to sourceFile text.");
|
|
402
406
|
dtsCode = file.getFullText();
|
|
@@ -409,6 +413,8 @@ function tscEmitCompiler(tscOptions) {
|
|
|
409
413
|
|
|
410
414
|
//#endregion
|
|
411
415
|
//#region src/tsc/index.ts
|
|
416
|
+
const Debug = __require("debug");
|
|
417
|
+
const ts = __require("typescript");
|
|
412
418
|
const debug = Debug("rolldown-plugin-dts:tsc");
|
|
413
419
|
debug(`loaded typescript: ${ts.version}`);
|
|
414
420
|
function tscEmit(tscOptions) {
|
package/dist/tsc-context.js
CHANGED
package/dist/tsc-worker.js
CHANGED
package/dist/tsc.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rolldown-plugin-dts",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.7",
|
|
4
4
|
"description": "A Rolldown plugin to generate and bundle dts files.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@babel/types": "^7.28.4",
|
|
67
67
|
"ast-kit": "^2.1.2",
|
|
68
68
|
"birpc": "^2.5.0",
|
|
69
|
-
"debug": "^4.4.
|
|
69
|
+
"debug": "^4.4.3",
|
|
70
70
|
"dts-resolver": "^2.1.2",
|
|
71
71
|
"get-tsconfig": "^4.10.1",
|
|
72
72
|
"magic-string": "^0.30.19"
|
|
@@ -74,26 +74,28 @@
|
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@sxzz/eslint-config": "^7.1.4",
|
|
76
76
|
"@sxzz/prettier-config": "^2.2.4",
|
|
77
|
-
"@sxzz/test-utils": "^0.5.
|
|
77
|
+
"@sxzz/test-utils": "^0.5.11",
|
|
78
78
|
"@types/babel__generator": "^7.27.0",
|
|
79
79
|
"@types/debug": "^4.1.12",
|
|
80
|
-
"@types/node": "^24.
|
|
81
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
80
|
+
"@types/node": "^24.5.2",
|
|
81
|
+
"@typescript/native-preview": "7.0.0-dev.20250920.1",
|
|
82
82
|
"@volar/typescript": "^2.4.23",
|
|
83
|
-
"@vue/language-core": "^3.0.
|
|
83
|
+
"@vue/language-core": "^3.0.7",
|
|
84
|
+
"arktype": "^2.1.22",
|
|
84
85
|
"bumpp": "^10.2.3",
|
|
85
86
|
"diff": "^8.0.2",
|
|
86
|
-
"eslint": "^9.
|
|
87
|
+
"eslint": "^9.36.0",
|
|
87
88
|
"estree-walker": "^3.0.3",
|
|
88
89
|
"prettier": "^3.6.2",
|
|
89
|
-
"rolldown": "^1.0.0-beta.
|
|
90
|
+
"rolldown": "^1.0.0-beta.38",
|
|
91
|
+
"rolldown-plugin-require-cjs": "^0.1.4",
|
|
90
92
|
"rollup-plugin-dts": "^6.2.3",
|
|
91
93
|
"tinyglobby": "^0.2.15",
|
|
92
|
-
"tsdown": "^0.15.
|
|
94
|
+
"tsdown": "^0.15.3",
|
|
93
95
|
"typescript": "^5.9.2",
|
|
94
96
|
"vitest": "^3.2.4",
|
|
95
97
|
"vue": "^3.5.21",
|
|
96
|
-
"vue-tsc": "^3.0.
|
|
98
|
+
"vue-tsc": "^3.0.7"
|
|
97
99
|
},
|
|
98
100
|
"engines": {
|
|
99
101
|
"node": ">=20.18.0"
|
|
File without changes
|