rolldown-plugin-dts 0.23.1 → 0.24.0-beta.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 +12 -0
- package/dist/{index-DAUYR4Qd.d.mts → index-CJhxyVA1.d.mts} +2 -2
- package/dist/index.d.mts +22 -5
- package/dist/index.mjs +11 -5
- package/dist/internal.d.mts +2 -2
- package/dist/internal.mjs +2 -2
- package/dist/tsc-worker.d.mts +1 -1
- package/dist/tsc.d.mts +1 -1
- package/package.json +24 -22
package/README.md
CHANGED
|
@@ -40,6 +40,18 @@ Configuration options for the plugin.
|
|
|
40
40
|
|
|
41
41
|
### General Options
|
|
42
42
|
|
|
43
|
+
#### `entry`
|
|
44
|
+
|
|
45
|
+
Glob pattern(s) to filter which files get `.d.ts` generation.
|
|
46
|
+
|
|
47
|
+
When specified, only files matching these patterns will emit `.d.ts` chunks — even if they are not Rolldown entry points. Supports negation patterns for exclusion. Patterns are matched against file paths relative to `cwd`.
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
dts({
|
|
51
|
+
entry: ['src/**/*.ts', '!src/icons/**'],
|
|
52
|
+
})
|
|
53
|
+
```
|
|
54
|
+
|
|
43
55
|
#### `cwd`
|
|
44
56
|
|
|
45
57
|
The directory in which the plugin will search for the `tsconfig.json` file.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as TscContext } from "./context-3rlTPR48.mjs";
|
|
2
2
|
import { SourceMapInput } from "rolldown";
|
|
3
|
-
import {
|
|
3
|
+
import { TsconfigJson } from "get-tsconfig";
|
|
4
4
|
import ts from "typescript";
|
|
5
5
|
|
|
6
6
|
//#region src/tsc/types.d.ts
|
|
@@ -10,7 +10,7 @@ interface TscModule {
|
|
|
10
10
|
}
|
|
11
11
|
interface TscOptions {
|
|
12
12
|
tsconfig?: string;
|
|
13
|
-
tsconfigRaw:
|
|
13
|
+
tsconfigRaw: TsconfigJson;
|
|
14
14
|
cwd: string;
|
|
15
15
|
build: boolean;
|
|
16
16
|
incremental: boolean;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import { Plugin } from "rolldown";
|
|
2
2
|
import { IsolatedDeclarationsOptions } from "rolldown/experimental";
|
|
3
|
-
import {
|
|
3
|
+
import { TsconfigJson } from "get-tsconfig";
|
|
4
4
|
|
|
5
5
|
//#region src/options.d.ts
|
|
6
6
|
interface GeneralOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Glob pattern(s) to filter which entry files get `.d.ts` generation.
|
|
9
|
+
*
|
|
10
|
+
* When specified, only entry files matching these patterns will emit `.d.ts` chunks.
|
|
11
|
+
* When not specified, all entries get `.d.ts` generation.
|
|
12
|
+
*
|
|
13
|
+
* Supports negation patterns (e.g., `['**', '!src/icons/**']`) for exclusion.
|
|
14
|
+
* Patterns are matched against file paths relative to `cwd`.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* entry: 'src/index.ts'
|
|
18
|
+
* entry: ['src/*.ts', '!src/internal/**']
|
|
19
|
+
*/
|
|
20
|
+
entry?: string | string[];
|
|
7
21
|
/**
|
|
8
22
|
* The directory in which the plugin will search for the `tsconfig.json` file.
|
|
9
23
|
*/
|
|
@@ -34,13 +48,13 @@ interface GeneralOptions {
|
|
|
34
48
|
*
|
|
35
49
|
* @see https://www.typescriptlang.org/tsconfig
|
|
36
50
|
*/
|
|
37
|
-
tsconfigRaw?: Omit<
|
|
51
|
+
tsconfigRaw?: Omit<TsconfigJson, "compilerOptions">;
|
|
38
52
|
/**
|
|
39
53
|
* Override the `compilerOptions` specified in `tsconfig.json`.
|
|
40
54
|
*
|
|
41
55
|
* @see https://www.typescriptlang.org/tsconfig/#compilerOptions
|
|
42
56
|
*/
|
|
43
|
-
compilerOptions?:
|
|
57
|
+
compilerOptions?: TsconfigJson.CompilerOptions;
|
|
44
58
|
/**
|
|
45
59
|
* If `true`, the plugin will generate declaration maps (`.d.ts.map`) for `.d.ts` files.
|
|
46
60
|
*/
|
|
@@ -188,12 +202,14 @@ interface TsgoOptions {
|
|
|
188
202
|
}
|
|
189
203
|
type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
190
204
|
type OptionsResolved = Overwrite<Required<Omit<Options, "compilerOptions">>, {
|
|
205
|
+
entry?: string[];
|
|
191
206
|
tsconfig?: string;
|
|
192
207
|
oxc: IsolatedDeclarationsOptions | false;
|
|
193
|
-
tsconfigRaw:
|
|
208
|
+
tsconfigRaw: TsconfigJson;
|
|
194
209
|
tsgo: Omit<TsgoOptions, "enabled"> | false;
|
|
195
210
|
}>;
|
|
196
211
|
declare function resolveOptions({
|
|
212
|
+
entry,
|
|
197
213
|
cwd,
|
|
198
214
|
dtsInput,
|
|
199
215
|
emitDtsOnly,
|
|
@@ -225,6 +241,7 @@ declare function createFakeJsPlugin({
|
|
|
225
241
|
//#endregion
|
|
226
242
|
//#region src/generate.d.ts
|
|
227
243
|
declare function createGeneratePlugin({
|
|
244
|
+
entry,
|
|
228
245
|
tsconfig,
|
|
229
246
|
tsconfigRaw,
|
|
230
247
|
build,
|
|
@@ -240,7 +257,7 @@ declare function createGeneratePlugin({
|
|
|
240
257
|
newContext,
|
|
241
258
|
emitJs,
|
|
242
259
|
sourcemap
|
|
243
|
-
}: Pick<OptionsResolved, "cwd" | "tsconfig" | "tsconfigRaw" | "build" | "incremental" | "oxc" | "emitDtsOnly" | "vue" | "tsMacro" | "parallel" | "eager" | "tsgo" | "newContext" | "emitJs" | "sourcemap">): Plugin;
|
|
260
|
+
}: Pick<OptionsResolved, "entry" | "cwd" | "tsconfig" | "tsconfigRaw" | "build" | "incremental" | "oxc" | "emitDtsOnly" | "vue" | "tsMacro" | "parallel" | "eager" | "tsgo" | "newContext" | "emitJs" | "sourcemap">): Plugin;
|
|
244
261
|
//#endregion
|
|
245
262
|
//#region src/index.d.ts
|
|
246
263
|
declare function dts(options?: Options): Plugin[];
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { createRequire as __cjs_createRequire } from "node:module";
|
|
2
|
+
const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
1
3
|
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
4
|
import { createContext, globalContext, invalidateContextFile } from "./tsc-context.mjs";
|
|
3
5
|
import { createDebug } from "obug";
|
|
@@ -11,10 +13,11 @@ import { fork, spawn } from "node:child_process";
|
|
|
11
13
|
import { existsSync } from "node:fs";
|
|
12
14
|
import { mkdtemp, readFile, rm } from "node:fs/promises";
|
|
13
15
|
import path from "node:path";
|
|
16
|
+
const picomatch = __cjs_require("picomatch");
|
|
14
17
|
import { ResolverFactory, isolatedDeclarationSync } from "rolldown/experimental";
|
|
15
18
|
import { tmpdir } from "node:os";
|
|
16
19
|
import process from "node:process";
|
|
17
|
-
import { getTsconfig,
|
|
20
|
+
import { getTsconfig, readTsconfig } from "get-tsconfig";
|
|
18
21
|
import { createResolver } from "dts-resolver";
|
|
19
22
|
//#region src/dts-input.ts
|
|
20
23
|
function createDtsInputPlugin({ sideEffects }) {
|
|
@@ -690,7 +693,8 @@ async function runTsgo(rootDir, tsconfig, sourcemap, tsgoPath) {
|
|
|
690
693
|
//#region src/generate.ts
|
|
691
694
|
const debug$2 = createDebug("rolldown-plugin-dts:generate");
|
|
692
695
|
const WORKER_URL = "./tsc-worker.mjs";
|
|
693
|
-
function createGeneratePlugin({ tsconfig, tsconfigRaw, build, incremental, cwd, oxc, emitDtsOnly, vue, tsMacro, parallel, eager, tsgo, newContext, emitJs, sourcemap }) {
|
|
696
|
+
function createGeneratePlugin({ entry, tsconfig, tsconfigRaw, build, incremental, cwd, oxc, emitDtsOnly, vue, tsMacro, parallel, eager, tsgo, newContext, emitJs, sourcemap }) {
|
|
697
|
+
const entryMatcher = entry ? picomatch(entry, { ignore: entry.filter((p) => p.startsWith("!")).map((p) => p.slice(1)) }) : void 0;
|
|
694
698
|
const dtsMap = /* @__PURE__ */ new Map();
|
|
695
699
|
/**
|
|
696
700
|
* A map of input id to output file name
|
|
@@ -768,7 +772,8 @@ function createGeneratePlugin({ tsconfig, tsconfigRaw, build, incremental, cwd,
|
|
|
768
772
|
} },
|
|
769
773
|
handler(code, id) {
|
|
770
774
|
if (!RE_JS.test(id) || emitJs) {
|
|
771
|
-
const
|
|
775
|
+
const mod = this.getModuleInfo(id);
|
|
776
|
+
const isEntry = entryMatcher ? entryMatcher(path.relative(cwd, id)) : !!mod?.isEntry;
|
|
772
777
|
const dtsId = filename_to_dts(id);
|
|
773
778
|
dtsMap.set(dtsId, {
|
|
774
779
|
code,
|
|
@@ -927,7 +932,7 @@ function collectJsonExports(code) {
|
|
|
927
932
|
//#endregion
|
|
928
933
|
//#region src/options.ts
|
|
929
934
|
let warnedTsgo = false;
|
|
930
|
-
function resolveOptions({ cwd = process.cwd(), dtsInput = false, emitDtsOnly = false, tsconfig, tsconfigRaw: overriddenTsconfigRaw = {}, compilerOptions = {}, sourcemap, resolver = "oxc", cjsDefault = false, sideEffects = false, build = false, incremental = false, vue = false, tsMacro = false, parallel = false, eager = false, newContext = false, emitJs, oxc, tsgo = false }) {
|
|
935
|
+
function resolveOptions({ entry, cwd = process.cwd(), dtsInput = false, emitDtsOnly = false, tsconfig, tsconfigRaw: overriddenTsconfigRaw = {}, compilerOptions = {}, sourcemap, resolver = "oxc", cjsDefault = false, sideEffects = false, build = false, incremental = false, vue = false, tsMacro = false, parallel = false, eager = false, newContext = false, emitJs, oxc, tsgo = false }) {
|
|
931
936
|
if (tsgo === true) tsgo = {};
|
|
932
937
|
else if (typeof tsgo === "object" && tsgo.enabled === false) tsgo = false;
|
|
933
938
|
let resolvedTsconfig;
|
|
@@ -937,7 +942,7 @@ function resolveOptions({ cwd = process.cwd(), dtsInput = false, emitDtsOnly = f
|
|
|
937
942
|
resolvedTsconfig = config;
|
|
938
943
|
} else if (typeof tsconfig === "string") {
|
|
939
944
|
tsconfig = path.resolve(cwd || process.cwd(), tsconfig);
|
|
940
|
-
resolvedTsconfig =
|
|
945
|
+
resolvedTsconfig = readTsconfig(tsconfig).config;
|
|
941
946
|
} else tsconfig = void 0;
|
|
942
947
|
compilerOptions = {
|
|
943
948
|
...resolvedTsconfig?.compilerOptions,
|
|
@@ -970,6 +975,7 @@ function resolveOptions({ cwd = process.cwd(), dtsInput = false, emitDtsOnly = f
|
|
|
970
975
|
warnedTsgo = true;
|
|
971
976
|
}
|
|
972
977
|
return {
|
|
978
|
+
entry: entry ? Array.isArray(entry) ? entry : [entry] : void 0,
|
|
973
979
|
cwd,
|
|
974
980
|
dtsInput,
|
|
975
981
|
emitDtsOnly,
|
package/dist/internal.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChunkFileNamesFunction, PreRenderedChunk } from "rolldown";
|
|
2
|
-
import {
|
|
2
|
+
import { readTsconfig } from "get-tsconfig";
|
|
3
3
|
|
|
4
4
|
//#region src/filename.d.ts
|
|
5
5
|
declare const RE_JS: RegExp;
|
|
@@ -17,4 +17,4 @@ declare function filename_dts_to(id: string, ext: "js" | "ts"): string;
|
|
|
17
17
|
declare function resolveTemplateFn(fn: string | ChunkFileNamesFunction, chunk: PreRenderedChunk): string;
|
|
18
18
|
declare function replaceTemplateName(template: string, name: string): string;
|
|
19
19
|
//#endregion
|
|
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,
|
|
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, readTsconfig, replaceTemplateName, resolveTemplateFn };
|
package/dist/internal.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
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 {
|
|
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,
|
|
2
|
+
import { readTsconfig } 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, readTsconfig, replaceTemplateName, resolveTemplateFn };
|
package/dist/tsc-worker.d.mts
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-CJhxyVA1.mjs";
|
|
2
2
|
export { TscModule, TscOptions, TscResult, 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.24.0-beta.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",
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"engines": {
|
|
41
|
-
"node": ">=
|
|
41
|
+
"node": ">=22.18.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-rc.12",
|
|
47
|
-
"typescript": "^
|
|
47
|
+
"typescript": "^6.0.0",
|
|
48
48
|
"vue-tsc": "~3.2.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependenciesMeta": {
|
|
@@ -69,37 +69,39 @@
|
|
|
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": "^
|
|
73
|
-
"obug": "^2.1.1"
|
|
72
|
+
"get-tsconfig": "^5.0.0-beta.4",
|
|
73
|
+
"obug": "^2.1.1",
|
|
74
|
+
"picomatch": "^4.0.4"
|
|
74
75
|
},
|
|
75
76
|
"devDependencies": {
|
|
76
77
|
"@jridgewell/source-map": "^0.3.11",
|
|
77
|
-
"@sxzz/eslint-config": "^7.8.
|
|
78
|
+
"@sxzz/eslint-config": "^7.8.4",
|
|
78
79
|
"@sxzz/prettier-config": "^2.3.1",
|
|
79
|
-
"@sxzz/test-utils": "^0.5.
|
|
80
|
-
"@types/node": "^25.
|
|
81
|
-
"@
|
|
80
|
+
"@sxzz/test-utils": "^0.5.18",
|
|
81
|
+
"@types/node": "^25.6.0",
|
|
82
|
+
"@types/picomatch": "^4.0.3",
|
|
83
|
+
"@typescript/native-preview": "7.0.0-dev.20260427.1",
|
|
82
84
|
"@volar/typescript": "^2.4.28",
|
|
83
|
-
"@vue/language-core": "^3.2.
|
|
85
|
+
"@vue/language-core": "^3.2.7",
|
|
84
86
|
"arktype": "^2.2.0",
|
|
85
87
|
"bumpp": "^11.0.1",
|
|
86
|
-
"diff": "^
|
|
87
|
-
"eslint": "^10.1
|
|
88
|
-
"prettier": "^3.8.
|
|
89
|
-
"rolldown": "^1.0.0-rc.
|
|
90
|
-
"rolldown-plugin-dts-snapshot": "^0.4.0",
|
|
88
|
+
"diff": "^9.0.0",
|
|
89
|
+
"eslint": "^10.2.1",
|
|
90
|
+
"prettier": "^3.8.3",
|
|
91
|
+
"rolldown": "^1.0.0-rc.17",
|
|
91
92
|
"rolldown-plugin-require-cjs": "^0.4.0",
|
|
92
93
|
"rollup-plugin-dts": "^6.4.1",
|
|
93
|
-
"tinyglobby": "^0.2.
|
|
94
|
-
"tsdown": "^0.
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"vue
|
|
94
|
+
"tinyglobby": "^0.2.16",
|
|
95
|
+
"tsdown": "^0.22.0-beta.1",
|
|
96
|
+
"tsnapi": "^0.3.2",
|
|
97
|
+
"typescript": "^6.0.3",
|
|
98
|
+
"vitest": "^4.1.5",
|
|
99
|
+
"vue": "^3.5.33",
|
|
100
|
+
"vue-tsc": "^3.2.7",
|
|
99
101
|
"zod": "^4.3.6"
|
|
100
102
|
},
|
|
101
103
|
"resolutions": {
|
|
102
|
-
"rolldown": "^1.0.0-rc.
|
|
104
|
+
"rolldown": "^1.0.0-rc.17"
|
|
103
105
|
},
|
|
104
106
|
"prettier": "@sxzz/prettier-config",
|
|
105
107
|
"scripts": {
|