Commit 665e5ac
authored
* feat(plugin): add `tsdownConfig` and `tsdownConfigResolved` plugin hooks
Introduce two tsdown-specific per-plugin lifecycle hooks modeled on Vite's
`config` and `configResolved`:
- `tsdownConfig(config, env)` — called before the user config is resolved.
May mutate in place or return a partial `UserConfig` to be deep-merged.
- `tsdownConfigResolved(resolvedConfig)` — read-only notification fired once
per produced `ResolvedConfig` (per output format).
Both hooks are detected on user plugins via duck-typing, so existing
Rolldown plugins continue to work unchanged. A `TsdownPlugin` interface,
`TsdownConfigEnv` interface, and `flattenPlugins` helper are exported
from `tsdown/plugins`.
* refactor
* refactor(plugin): simplify `TsdownConfigEnv` to only `inlineConfig`
`watch` and `cwd` are already reachable via the first `config` argument
passed to `tsdownConfig`, so keeping them in env duplicates data and risks
going stale. Drop both — `inlineConfig` remains because it is the only
piece of context that cannot be derived from `UserConfig`.
* refactor(plugin): replace `TsdownConfigEnv` with `InlineConfig`
The env object only wrapped a single `inlineConfig` field, so pass the
`InlineConfig` directly as the second argument instead. Drops the
`TsdownConfigEnv` interface and its re-exports.
* feat(plugin): add `TsdownPluginOption` type
Mirrors Rolldown's `RolldownPluginOption` but with `TsdownPlugin` as the
atom, so that `UserConfig.plugins` entries get proper type-checking for
the new `tsdownConfig` / `tsdownConfigResolved` hooks.
* fix
* update
* refactor
1 parent e6021f5 commit 665e5ac
File tree
6 files changed
+421
-4
lines changed- __snapshots__/tsnapi
- src
- config
- features
6 files changed
+421
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
128 | 132 | | |
129 | 133 | | |
130 | 134 | | |
| |||
148 | 152 | | |
149 | 153 | | |
150 | 154 | | |
151 | | - | |
| 155 | + | |
152 | 156 | | |
153 | 157 | | |
154 | 158 | | |
| |||
244 | 248 | | |
245 | 249 | | |
246 | 250 | | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
247 | 254 | | |
248 | 255 | | |
249 | 256 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
47 | 61 | | |
48 | 62 | | |
49 | 63 | | |
| |||
323 | 337 | | |
324 | 338 | | |
325 | 339 | | |
326 | | - | |
| 340 | + | |
327 | 341 | | |
328 | 342 | | |
329 | 343 | | |
| |||
336 | 350 | | |
337 | 351 | | |
338 | 352 | | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
339 | 365 | | |
340 | 366 | | |
341 | 367 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
118 | 119 | | |
119 | 120 | | |
120 | 121 | | |
| 122 | + | |
| 123 | + | |
121 | 124 | | |
122 | 125 | | |
123 | 126 | | |
| |||
328 | 331 | | |
329 | 332 | | |
330 | 333 | | |
331 | | - | |
| 334 | + | |
332 | 335 | | |
333 | 336 | | |
334 | 337 | | |
| |||
0 commit comments