Repository navigation
feat(oxlint-config)!: emit Vite declarations with tsrs - #278
Draft
jan-kubica wants to merge 2 commits into
Draft
jan-kubica wants to merge 2 commits into
jan-kubica wants to merge 2 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
The declaration-only Vite helper runs tsrs once after the bundle is written. It reads a generated config that extends the package tsconfig and emits declarations only into build.outDir. Consumers no longer install vite-plugin-dts, unplugin-dts or TypeScript 6.0.3. Because the helper no longer wraps a third-party plugin, the hook and context guards around it are deleted. The output check that leaves non-declaration files untouched stays. Options shrink to include, exclude, entryRoot and compilerOptions.declarationMap=false. compilerOptions.paths fails the build, because declarations keep import specifiers as written. The helper loads the tsrs API from tsrs/async, its current entry point.
tsdown's tsgo generator only falls back to a tsrs binary path when TypeScript 7.0 is installed, which came in through vite-plugin-dts. With that dependency gone the build selects the tsrs generator directly.
jan-kubica
force-pushed
the
feat/oxlint-config-declarations
branch
from
November 18, 2026 10:54
e6c6dc7 to
0743386
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Split out of #232, which carried this change after #233 was merged into its branch. Based on main, which now has #232's oxc-parser config reader.
declarationOnlyDtsemits declarations with tsrs (onetsrsrun after the bundle is written), replacingvite-plugin-dtsandunplugin-dts. Consumers no longer need TypeScript 6.0.3 for the helper.build.outDir. The hook and context guards around the old third-party plugin are removed; the output check that leaves non-declaration files untouched stays.include,exclude,entryRootandcompilerOptions.declarationMap: false.pathsToAliases,strictOutputanddeclarationOnlyare rejected; tsconfigpaths, compiler-option errors, inputs outsideentryRootand empty inputs fail the build.tsrs/async.tsrsdeclaration generator. Thetsgogenerator with a tsrs binary path only worked while TypeScript 7.0 came in throughvite-plugin-dts.@stll/oxlint-config.Review findings carried over from #232 (to address before merge)
publish-build-target-vite-dts-helper.ts:108Generated tsconfig under the system temp dir loses package-localtypesresolution (["node"]/["bun"]resolve from temp ancestors, degrading declarations toany).publish-build-target-vite-dts-helper.ts:108A package tsconfig withoutfiles/includerelies on the default**/*, which tsrs resolves from the temp dir, so valid packages fail with no inputs.publish-build-target-vite-dts-helper.ts:136A callerexcludereplaces the defaultoutDirexclusion, so Vite's written output (e.g.dist/index.jswithallowJs) becomes a declaration input.publish-build-target-vite-dts-helper.ts:158With an explicitentryRoot, an empty input set (files: []) is not rejected and the build succeeds without declarations.publish-build-target-vite-dts-helper.ts:157WithoutentryRoot,rootDirshould be derived from the source files the compiler emits, not from every parsed file name.publish-build-target-vite-dts-helper.ts:181Removing a leading CSS import shifts declaration lines while.d.ts.mapkeeps old positions; update the map or reject the combination.publish-build-target-vite-dts-helper.ts:247Theemittedflag is never reset, so a second build (or a retry after a failed emit) with the same plugin instance skips declarations.publish-build-target-vite-dts.ts:46The public option type droppedstringforinclude/excludealthough the runtime still normalises it; keepstring | readonly string[]at the boundary.publish-build-target-vite-dts.test.ts:211The outside-entryRoottest matches anyDeclaration emit failed; assert the specific error (TS6059and the file).scripts/check-publish-artifact-profiles.ts:86The profile check accepts any one JavaScript file; require bothindex.jsandindex.cjsplusindex.d.ts..changeset/declarations-with-tsrs.md:9The "accepts only" option list omits the requireddirectoryoption..changeset/declarations-with-tsrs.md:10Tell consumers to remove or empty-override inheritedpathsmappings, since the helper checks the effective map.