Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/declarations-with-tsrs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@stll/oxlint-config": major
---

The `declaration-only-dts` Vite helper emits declarations with tsrs, which `@stll/oxlint-config` already depends on. Consumers no longer install `vite-plugin-dts`, `unplugin-dts` or TypeScript 6.0.3 for it, and can remove them.

Breaking changes:

- The helper accepts only `include`, `exclude`, `entryRoot` and `compilerOptions.declarationMap: false`. `pathsToAliases`, `strictOutput` and `declarationOnly` were vite-plugin-dts settings and are now rejected; remove them from the config.
- A package tsconfig with `compilerOptions.paths` fails the build, because declarations keep import specifiers as written. Use package imports or relative paths instead.
- Declarations are TypeScript 7's own output. Import lines keep their `type` modifiers and double quotes, and union members and inferred properties can appear in a different order. Doc comments are kept, and side-effect imports are still dropped. With `allowJs`, JavaScript inputs inside `include` now get declarations too.
110 changes: 0 additions & 110 deletions bun.lock

Large diffs are not rendered by default.

24 changes: 15 additions & 9 deletions packages/oxlint-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -740,19 +740,25 @@ export default {
};
```

This adapter requires consumer-installed `vite-plugin-dts` 5.1.2 and its
`unplugin-dts` 1.1.2 implementation. Its dependency scope must provide TypeScript
6.0.3 as `typescript` or the plugin's `@typescript/typescript6` fallback.
Unsupported versions fail explicitly.
The helper emits declarations with the tsrs that `@stll/oxlint-config` already
depends on; the consumer installs neither TypeScript nor a declaration plugin.
After the bundle is written, it runs `tsrs -p` once on a generated config that
extends the package `tsconfig.json` with `emitDeclarationOnly`, `outDir` set to
`build.outDir`, the helper's include/exclude, and `rootDir` set to `entryRoot`
(or the common directory of the inputs).
Doc comments are kept. Side-effect imports such as `import "./styles.css"` are
dropped from the declarations. Type errors are reported as warnings, and
declarations are still written. Option errors, inputs outside `entryRoot`, and
`compilerOptions.paths` aliases fail the build, because declarations keep
import specifiers exactly as written.
The resolver proves a direct helper import and call in a literal plugin array;
raw declaration plugins, opaque plugin arrays, and additional emitters fail.
It reads the config with oxc-parser and ignores TypeScript-only syntax, so a
TypeScript config needs no compiler; any value import of a raw emitter fails.
Options are closed and static: include/exclude, entryRoot, pathsToAliases,
compilerOptions.declarationMap=false, strictOutput=true, and declarationOnly=false. Hooks may
emit only `.d.ts`, `.d.mts`, `.d.cts`, and their maps. Bundle and on-disk non-declaration
bytes must remain unchanged across each declaration hook; this is checked during
the actual build, without a comparison build.
Options are closed and static: include/exclude, entryRoot, and
compilerOptions.declarationMap=false. The emit may add or change only `.d.ts`,
`.d.mts`, `.d.cts`, and their maps. Every other file in the output directory
must stay byte-identical, and this is checked during the actual build.

Nuxt modules can set both emitted targets without replacing the builder's entries:

Expand Down
4 changes: 1 addition & 3 deletions packages/oxlint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,7 @@
"@types/picomatch": "4.0.3",
"@types/semver": "7.8.0",
"oxlint": "1.87.0",
"unplugin-dts": "1.1.2",
"vite": "8.3.5",
"vite-plugin-dts": "5.1.2"
"vite": "8.3.5"
},
"peerDependencies": {
"oxlint": ">=1.87.0 <2",
Expand Down
Loading
Loading