rolldown-plugin-dts 0.23.1 → 0.23.2
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/index.d.mts +18 -1
- package/dist/index.mjs +9 -3
- package/package.json +9 -7
package/dist/index.d.mts
CHANGED
|
@@ -4,6 +4,20 @@ 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
|
*/
|
|
@@ -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
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,6 +13,7 @@ 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";
|
|
@@ -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;
|
|
@@ -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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rolldown-plugin-dts",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.23.
|
|
4
|
+
"version": "0.23.2",
|
|
5
5
|
"description": "A Rolldown plugin to generate and bundle dts files.",
|
|
6
6
|
"author": "Kevin Deng <sxzz@sxzz.moe>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -70,15 +70,17 @@
|
|
|
70
70
|
"birpc": "^4.0.0",
|
|
71
71
|
"dts-resolver": "^2.1.3",
|
|
72
72
|
"get-tsconfig": "^4.13.7",
|
|
73
|
-
"obug": "^2.1.1"
|
|
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
|
+
"@sxzz/test-utils": "^0.5.16",
|
|
80
81
|
"@types/node": "^25.5.0",
|
|
81
|
-
"@
|
|
82
|
+
"@types/picomatch": "^4.0.2",
|
|
83
|
+
"@typescript/native-preview": "7.0.0-dev.20260328.1",
|
|
82
84
|
"@volar/typescript": "^2.4.28",
|
|
83
85
|
"@vue/language-core": "^3.2.6",
|
|
84
86
|
"arktype": "^2.2.0",
|
|
@@ -91,9 +93,9 @@
|
|
|
91
93
|
"rolldown-plugin-require-cjs": "^0.4.0",
|
|
92
94
|
"rollup-plugin-dts": "^6.4.1",
|
|
93
95
|
"tinyglobby": "^0.2.15",
|
|
94
|
-
"tsdown": "^0.21.
|
|
96
|
+
"tsdown": "^0.21.6",
|
|
95
97
|
"typescript": "^6.0.2",
|
|
96
|
-
"vitest": "^4.1.
|
|
98
|
+
"vitest": "^4.1.2",
|
|
97
99
|
"vue": "^3.5.31",
|
|
98
100
|
"vue-tsc": "^3.2.6",
|
|
99
101
|
"zod": "^4.3.6"
|