You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d351b43
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: AGENTS.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -181,7 +181,7 @@ Public plugin exports in `src/plugins.ts`: `DepsPlugin`, `NodeProtocolPlugin`, `
181
181
182
182
### Key Architectural Patterns
183
183
184
-
1.**Multi-format builds:** Single config produces ESM + CJS + types. ES format handles types via dts plugin; CJS format has separate dts pass with `emitDtsOnly: true`
184
+
1.**Multi-format builds:** Single config produces ESM + CJS + types. ES format handles types via dts plugin; CJS format has separate dts pass with `dtsOnly: true`
Copy file name to clipboardExpand all lines: docs/options/dts.md
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,3 +98,20 @@ If `isolatedDeclarations` is not enabled, `tsdown` will fall back to using the T
98
98
## Advanced Options
99
99
100
100
`rolldown-plugin-dts` provides several advanced options to customize `.d.ts` generation. For a detailed explanation of these options, refer to the [plugin's documentation](https://github.com/sxzz/rolldown-plugin-dts#options).
101
+
102
+
### Filtering Entries
103
+
104
+
By default, every entry gets a declaration file. Use `dts.entry` to emit declarations only for some entries:
105
+
106
+
```ts [tsdown.config.ts]
107
+
import { defineConfig } from'tsdown'
108
+
109
+
exportdefaultdefineConfig({
110
+
entry: ['src/index.ts', 'src/cli.ts'],
111
+
dts: {
112
+
entry: ['src/**/*.ts', '!src/cli.ts'],
113
+
},
114
+
})
115
+
```
116
+
117
+
`dts.entry` only filters entries: a file that is not an entry never gets its own declaration file, even if it matches.
"description": "Glob pattern(s) that select source files for declaration generation.\n\nPatterns are relative to {@link cwd} and may be negated with `!`. Matching\nfiles are emitted even when they are not Rolldown entry points."
4957
+
"description": "Glob pattern(s) that filter which Rolldown entries emit declarations.\n\nPatterns are relative to {@link cwd} and may be negated with `!`. Only\nRolldown entries are matched; other files never emit declarations.\n\nCannot be combined with {@link dtsOnly}; set Rolldown's `input` instead."
4958
4958
},
4959
4959
"cwd": {
4960
4960
"type": "string",
4961
4961
"description": "Base directory for config discovery, glob matching, and relative paths."
4962
4962
},
4963
-
"dtsInput": {
4963
+
"dtsOnly": {
4964
4964
"anyOf": [{ "const": false }, { "const": true }],
4965
-
"description": "Treats entry files as existing declarations instead of source files.",
4966
-
"default": false
4967
-
},
4968
-
"emitDtsOnly": {
4969
-
"anyOf": [{ "const": false }, { "const": true }],
4970
-
"description": "Removes non-declaration chunks from the output.",
4965
+
"description": "Builds declarations only. Each entry resolves to its declaration, so the\nbuild emits no JavaScript. Entries may be source files or existing\ndeclaration files.",
4971
4966
"default": false
4972
4967
},
4973
4968
"tsconfig": {
@@ -5034,6 +5029,16 @@
5034
5029
"items": { "$ref": "#/$defs/CustomLanguage" },
5035
5030
"description": "Registers non-standard source languages such as Vue or Astro.\n\nIf a language is supported via {@link https://volarjs.dev Volar},\n{@link CustomLanguage.volarTypeScript} and\n{@link CustomLanguage.createVolarPlugins} are both required. Volar\nlanguages require `tsc`. Non-Volar languages can use `tsgo` together\nwith {@link TsgoOptions.vfs`tsgo.vfs`}, or `tsrs` with\n{@link TsrsOptions.vfs`tsrs.vfs`}."
5036
5031
},
5032
+
"dtsInput": {
5033
+
"anyOf": [{ "const": false }, { "const": true }],
5034
+
"description": "Deprecated: Use `dtsOnly` instead.",
5035
+
"deprecated": true
5036
+
},
5037
+
"emitDtsOnly": {
5038
+
"anyOf": [{ "const": false }, { "const": true }],
5039
+
"description": "Deprecated: Use `dtsOnly` instead.",
5040
+
"deprecated": true
5041
+
},
5037
5042
"build": {
5038
5043
"anyOf": [{ "const": false }, { "const": true }],
5039
5044
"description": "Deprecated: Use `tsc.build` instead.",
0 commit comments