rolldown-plugin-dts 0.19.1 → 0.20.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/dist/filename.d.mts +17 -1
- package/dist/filename.mjs +25 -1
- package/dist/{index-BgDOofjd.d.mts → index-DWPGYc3m.d.mts} +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +6 -6
- package/dist/{tsc-Cn0kGE1h.mjs → tsc-CG1xgNuJ.mjs} +2 -3
- package/dist/tsc-context.d.mts +1 -1
- package/dist/tsc-context.mjs +1 -1
- package/dist/tsc-worker.d.mts +2 -2
- package/dist/tsc-worker.mjs +2 -2
- package/dist/tsc.d.mts +2 -2
- package/dist/tsc.mjs +2 -2
- package/package.json +10 -10
- package/dist/filename-Cqnsj8Gp.mjs +0 -27
- package/dist/filename-Dn8CLu7g.d.mts +0 -18
- /package/dist/{context-EuY-ImLj.mjs → context-9CkpILzL.mjs} +0 -0
- /package/dist/{context-Cy_-BMX4.d.mts → context-Dt8gPoCq.d.mts} +0 -0
- /package/dist/{resolver-DksQRwY1.mjs → resolver-CyVXxlZv.mjs} +0 -0
package/dist/filename.d.mts
CHANGED
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChunkFileNamesFunction, PreRenderedChunk } from "rolldown";
|
|
2
|
+
|
|
3
|
+
//#region src/filename.d.ts
|
|
4
|
+
declare const RE_JS: RegExp;
|
|
5
|
+
declare const RE_TS: RegExp;
|
|
6
|
+
declare const RE_DTS: RegExp;
|
|
7
|
+
declare const RE_DTS_MAP: RegExp;
|
|
8
|
+
declare const RE_NODE_MODULES: RegExp;
|
|
9
|
+
declare const RE_CSS: RegExp;
|
|
10
|
+
declare const RE_VUE: RegExp;
|
|
11
|
+
declare const RE_JSON: RegExp;
|
|
12
|
+
declare function filename_js_to_dts(id: string): string;
|
|
13
|
+
declare function filename_to_dts(id: string): string;
|
|
14
|
+
declare function filename_dts_to(id: string, ext: "js" | "ts"): string;
|
|
15
|
+
declare function resolveTemplateFn(fn: string | ChunkFileNamesFunction, chunk: PreRenderedChunk): string;
|
|
16
|
+
declare function replaceTemplateName(template: string, name: string): string;
|
|
17
|
+
//#endregion
|
|
2
18
|
export { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_JSON, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts, replaceTemplateName, resolveTemplateFn };
|
package/dist/filename.mjs
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/filename.ts
|
|
2
|
+
const RE_JS = /\.([cm]?)jsx?$/;
|
|
3
|
+
const RE_TS = /\.([cm]?)tsx?$/;
|
|
4
|
+
const RE_DTS = /\.d\.([cm]?)ts$/;
|
|
5
|
+
const RE_DTS_MAP = /\.d\.([cm]?)ts\.map$/;
|
|
6
|
+
const RE_NODE_MODULES = /[\\/]node_modules[\\/]/;
|
|
7
|
+
const RE_CSS = /\.css$/;
|
|
8
|
+
const RE_VUE = /\.vue$/;
|
|
9
|
+
const RE_JSON = /\.json$/;
|
|
10
|
+
function filename_js_to_dts(id) {
|
|
11
|
+
return id.replace(RE_JS, ".d.$1ts");
|
|
12
|
+
}
|
|
13
|
+
function filename_to_dts(id) {
|
|
14
|
+
return id.replace(RE_VUE, ".vue.ts").replace(RE_TS, ".d.$1ts").replace(RE_JS, ".d.$1ts").replace(RE_JSON, ".d.ts");
|
|
15
|
+
}
|
|
16
|
+
function filename_dts_to(id, ext) {
|
|
17
|
+
return id.replace(RE_DTS, `.$1${ext}`);
|
|
18
|
+
}
|
|
19
|
+
function resolveTemplateFn(fn, chunk) {
|
|
20
|
+
return typeof fn === "function" ? fn(chunk) : fn;
|
|
21
|
+
}
|
|
22
|
+
function replaceTemplateName(template, name) {
|
|
23
|
+
return template.replaceAll("[name]", name);
|
|
24
|
+
}
|
|
2
25
|
|
|
26
|
+
//#endregion
|
|
3
27
|
export { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_JSON, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts, replaceTemplateName, resolveTemplateFn };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_JSON, RE_NODE_MODULES, RE_TS, RE_VUE } from "./filename.mjs";
|
|
2
2
|
import { IsolatedDeclarationsOptions } from "rolldown/experimental";
|
|
3
3
|
import { TsConfigJson } from "get-tsconfig";
|
|
4
4
|
import { Plugin } from "rolldown";
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const __cjs_require = globalThis.process.getBuiltinModule("module").createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
import { n as globalContext, r as invalidateContextFile, t as createContext } from "./context-
|
|
2
|
+
import { RE_CSS, RE_DTS, RE_DTS_MAP, RE_JS, RE_JSON, RE_NODE_MODULES, RE_TS, RE_VUE, filename_dts_to, filename_js_to_dts, filename_to_dts, replaceTemplateName, resolveTemplateFn } from "./filename.mjs";
|
|
3
|
+
import { n as globalContext, r as invalidateContextFile, t as createContext } from "./context-9CkpILzL.mjs";
|
|
4
4
|
import { createDebug } from "obug";
|
|
5
5
|
const {
|
|
6
6
|
generate
|
|
@@ -438,7 +438,7 @@ function isReferenceId(node) {
|
|
|
438
438
|
return isTypeOf(node, ["Identifier", "MemberExpression"]);
|
|
439
439
|
}
|
|
440
440
|
function isHelperImport(node) {
|
|
441
|
-
return node.type === "ImportDeclaration" && node.specifiers.length === 1 && node.specifiers.every((spec) => spec.type === "ImportSpecifier" && spec.imported.type === "Identifier" && ["
|
|
441
|
+
return node.type === "ImportDeclaration" && node.specifiers.length === 1 && node.specifiers.every((spec) => spec.type === "ImportSpecifier" && spec.imported.type === "Identifier" && ["__exportAll", "__reExport"].includes(spec.local.name));
|
|
442
442
|
}
|
|
443
443
|
/**
|
|
444
444
|
* patch `.d.ts` suffix in import source to `.js`
|
|
@@ -466,7 +466,7 @@ function patchImportExport(node, typeOnlyIds, cjsDefault) {
|
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
468
|
/**
|
|
469
|
-
* Handle `
|
|
469
|
+
* Handle `__exportAll` call
|
|
470
470
|
*/
|
|
471
471
|
function patchTsNamespace(nodes) {
|
|
472
472
|
const removed = /* @__PURE__ */ new Set();
|
|
@@ -496,7 +496,7 @@ function patchTsNamespace(nodes) {
|
|
|
496
496
|
}
|
|
497
497
|
return nodes.filter((node) => !removed.has(node));
|
|
498
498
|
function handleExport(node) {
|
|
499
|
-
if (node.type !== "VariableDeclaration" || node.declarations.length !== 1 || node.declarations[0].id.type !== "Identifier" || node.declarations[0].init?.type !== "CallExpression" || node.declarations[0].init.callee.type !== "Identifier" || node.declarations[0].init.callee.name !== "
|
|
499
|
+
if (node.type !== "VariableDeclaration" || node.declarations.length !== 1 || node.declarations[0].id.type !== "Identifier" || node.declarations[0].init?.type !== "CallExpression" || node.declarations[0].init.callee.type !== "Identifier" || node.declarations[0].init.callee.name !== "__exportAll" || node.declarations[0].init.arguments.length !== 1 || node.declarations[0].init.arguments[0].type !== "ObjectExpression") return false;
|
|
500
500
|
return [node.declarations[0].id, node.declarations[0].init.arguments[0]];
|
|
501
501
|
}
|
|
502
502
|
}
|
|
@@ -980,7 +980,7 @@ function createDtsResolvePlugin({ cwd, tsconfig, tsconfigRaw, resolve, resolver,
|
|
|
980
980
|
async function resolveDtsPath(id, importer, rolldownResolution) {
|
|
981
981
|
let dtsPath;
|
|
982
982
|
if (resolver === "tsc") {
|
|
983
|
-
const { tscResolve } = await import("./resolver-
|
|
983
|
+
const { tscResolve } = await import("./resolver-CyVXxlZv.mjs");
|
|
984
984
|
dtsPath = tscResolve(id, importer, cwd, tsconfig, tsconfigRaw);
|
|
985
985
|
} else dtsPath = baseDtsResolver(id, importer);
|
|
986
986
|
debug$1("Using %s for dts import: %O -> %O", resolver, id, dtsPath);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __cjs_require = globalThis.process.getBuiltinModule("module").createRequire(import.meta.url);
|
|
2
|
-
import { n as globalContext } from "./context-
|
|
2
|
+
import { n as globalContext } from "./context-9CkpILzL.mjs";
|
|
3
3
|
const {
|
|
4
4
|
createRequire
|
|
5
5
|
} = globalThis.process.getBuiltinModule("node:module");
|
|
@@ -253,10 +253,9 @@ function loadVueLanguageTools() {
|
|
|
253
253
|
const getLanguagePlugin = (ts$1, options) => {
|
|
254
254
|
const $rootDir = options.options.$rootDir;
|
|
255
255
|
const $configRaw = options.options.$configRaw;
|
|
256
|
-
const resolver = new vue.CompilerOptionsResolver(ts$1.sys.
|
|
256
|
+
const resolver = new vue.CompilerOptionsResolver(ts$1, ts$1.sys.readFile);
|
|
257
257
|
resolver.addConfig($configRaw?.vueCompilerOptions ?? {}, $rootDir);
|
|
258
258
|
const vueOptions = resolver.build();
|
|
259
|
-
vue.writeGlobalTypes(vueOptions, ts$1.sys.writeFile);
|
|
260
259
|
return vue.createVueLanguagePlugin(ts$1, options.options, vueOptions, (id) => id);
|
|
261
260
|
};
|
|
262
261
|
return {
|
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-Dt8gPoCq.mjs";
|
|
2
2
|
export { ParsedProject, SourceFileToProjectMap, TscContext, createContext, globalContext, invalidateContextFile };
|
package/dist/tsc-context.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as globalContext, r as invalidateContextFile, t as createContext } from "./context-
|
|
1
|
+
import { n as globalContext, r as invalidateContextFile, t as createContext } from "./context-9CkpILzL.mjs";
|
|
2
2
|
|
|
3
3
|
export { createContext, globalContext, invalidateContextFile };
|
package/dist/tsc-worker.d.mts
CHANGED
package/dist/tsc-worker.mjs
CHANGED
package/dist/tsc.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "./context-
|
|
2
|
-
import { i as TscResult, n as TscModule, r as TscOptions, t as tscEmit } from "./index-
|
|
1
|
+
import "./context-Dt8gPoCq.mjs";
|
|
2
|
+
import { i as TscResult, n as TscModule, r as TscOptions, t as tscEmit } from "./index-DWPGYc3m.mjs";
|
|
3
3
|
export { TscModule, TscOptions, TscResult, tscEmit };
|
package/dist/tsc.mjs
CHANGED
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.20.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",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@ts-macro/tsc": "^0.3.6",
|
|
47
47
|
"@typescript/native-preview": ">=7.0.0-dev.20250601.1",
|
|
48
|
-
"rolldown": "^1.0.0-beta.
|
|
48
|
+
"rolldown": "^1.0.0-beta.57",
|
|
49
49
|
"typescript": "^5.0.0",
|
|
50
|
-
"vue-tsc": "~3.
|
|
50
|
+
"vue-tsc": "~3.2.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependenciesMeta": {
|
|
53
53
|
"@ts-macro/tsc": {
|
|
@@ -74,28 +74,28 @@
|
|
|
74
74
|
"obug": "^2.1.1"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@sxzz/eslint-config": "^7.4.
|
|
77
|
+
"@sxzz/eslint-config": "^7.4.4",
|
|
78
78
|
"@sxzz/prettier-config": "^2.2.6",
|
|
79
79
|
"@sxzz/test-utils": "^0.5.15",
|
|
80
80
|
"@types/babel__generator": "^7.27.0",
|
|
81
81
|
"@types/node": "^25.0.3",
|
|
82
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
82
|
+
"@typescript/native-preview": "7.0.0-dev.20251223.1",
|
|
83
83
|
"@volar/typescript": "^2.4.27",
|
|
84
|
-
"@vue/language-core": "^3.1
|
|
84
|
+
"@vue/language-core": "^3.2.1",
|
|
85
85
|
"arktype": "^2.1.29",
|
|
86
86
|
"bumpp": "^10.3.2",
|
|
87
87
|
"diff": "^8.0.2",
|
|
88
88
|
"eslint": "^9.39.2",
|
|
89
89
|
"prettier": "^3.7.4",
|
|
90
|
-
"rolldown": "^1.0.0-beta.
|
|
90
|
+
"rolldown": "^1.0.0-beta.57",
|
|
91
91
|
"rolldown-plugin-require-cjs": "^0.3.3",
|
|
92
92
|
"rollup-plugin-dts": "^6.3.0",
|
|
93
93
|
"tinyglobby": "^0.2.15",
|
|
94
|
-
"tsdown": "^0.18.
|
|
94
|
+
"tsdown": "^0.18.2",
|
|
95
95
|
"typescript": "^5.9.3",
|
|
96
96
|
"vitest": "^4.0.16",
|
|
97
|
-
"vue": "^3.5.
|
|
98
|
-
"vue-tsc": "^3.1
|
|
97
|
+
"vue": "^3.5.26",
|
|
98
|
+
"vue-tsc": "^3.2.1"
|
|
99
99
|
},
|
|
100
100
|
"prettier": "@sxzz/prettier-config",
|
|
101
101
|
"scripts": {
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
//#region src/filename.ts
|
|
2
|
-
const RE_JS = /\.([cm]?)jsx?$/;
|
|
3
|
-
const RE_TS = /\.([cm]?)tsx?$/;
|
|
4
|
-
const RE_DTS = /\.d\.([cm]?)ts$/;
|
|
5
|
-
const RE_DTS_MAP = /\.d\.([cm]?)ts\.map$/;
|
|
6
|
-
const RE_NODE_MODULES = /[\\/]node_modules[\\/]/;
|
|
7
|
-
const RE_CSS = /\.css$/;
|
|
8
|
-
const RE_VUE = /\.vue$/;
|
|
9
|
-
const RE_JSON = /\.json$/;
|
|
10
|
-
function filename_js_to_dts(id) {
|
|
11
|
-
return id.replace(RE_JS, ".d.$1ts");
|
|
12
|
-
}
|
|
13
|
-
function filename_to_dts(id) {
|
|
14
|
-
return id.replace(RE_VUE, ".vue.ts").replace(RE_TS, ".d.$1ts").replace(RE_JS, ".d.$1ts").replace(RE_JSON, ".d.ts");
|
|
15
|
-
}
|
|
16
|
-
function filename_dts_to(id, ext) {
|
|
17
|
-
return id.replace(RE_DTS, `.$1${ext}`);
|
|
18
|
-
}
|
|
19
|
-
function resolveTemplateFn(fn, chunk) {
|
|
20
|
-
return typeof fn === "function" ? fn(chunk) : fn;
|
|
21
|
-
}
|
|
22
|
-
function replaceTemplateName(template, name) {
|
|
23
|
-
return template.replaceAll("[name]", name);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
27
|
-
export { RE_JSON as a, RE_VUE as c, filename_to_dts as d, replaceTemplateName as f, RE_JS as i, filename_dts_to as l, RE_DTS as n, RE_NODE_MODULES as o, resolveTemplateFn as p, RE_DTS_MAP as r, RE_TS as s, RE_CSS as t, filename_js_to_dts as u };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ChunkFileNamesFunction, PreRenderedChunk } from "rolldown";
|
|
2
|
-
|
|
3
|
-
//#region src/filename.d.ts
|
|
4
|
-
declare const RE_JS: RegExp;
|
|
5
|
-
declare const RE_TS: RegExp;
|
|
6
|
-
declare const RE_DTS: RegExp;
|
|
7
|
-
declare const RE_DTS_MAP: RegExp;
|
|
8
|
-
declare const RE_NODE_MODULES: RegExp;
|
|
9
|
-
declare const RE_CSS: RegExp;
|
|
10
|
-
declare const RE_VUE: RegExp;
|
|
11
|
-
declare const RE_JSON: RegExp;
|
|
12
|
-
declare function filename_js_to_dts(id: string): string;
|
|
13
|
-
declare function filename_to_dts(id: string): string;
|
|
14
|
-
declare function filename_dts_to(id: string, ext: "js" | "ts"): string;
|
|
15
|
-
declare function resolveTemplateFn(fn: string | ChunkFileNamesFunction, chunk: PreRenderedChunk): string;
|
|
16
|
-
declare function replaceTemplateName(template: string, name: string): string;
|
|
17
|
-
//#endregion
|
|
18
|
-
export { RE_JSON as a, RE_VUE as c, filename_to_dts as d, replaceTemplateName as f, RE_JS as i, filename_dts_to as l, RE_DTS as n, RE_NODE_MODULES as o, resolveTemplateFn as p, RE_DTS_MAP as r, RE_TS as s, RE_CSS as t, filename_js_to_dts as u };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|