Skip to content

feat(oxlint-config)!: emit Vite declarations with tsrs - #233

Merged
jan-kubica merged 1 commit into
feat/publish-oxc-parsefrom
feat/dts-without-typescript
Oct 26, 2026
Merged

jan-kubica merged 1 commit into
feat/publish-oxc-parsefrom
feat/dts-without-typescript

Conversation

@jan-kubica

@jan-kubica jan-kubica commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #232.

Summary

  • declarationOnlyDts emits declarations with tsrs, which is already a dependency of @stll/oxlint-config. It runs once in writeBundle (post), using 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.
  • Consumers no longer install vite-plugin-dts 5.1.2, unplugin-dts 1.1.2 or TypeScript 6.0.3. They also leave this package's devDependencies, which removes typescript@7.0.2 from the lockfile.
  • The helper no longer wraps a third-party plugin, so the hook guards, context proxy and emission ledger are deleted. The output check stays: every non-declaration file in build.outDir must be byte-identical after the emit.
  • Same handling as before: side-effect imports are dropped from declarations, and type errors are warnings (declarations are still written). Compiler-option errors (TS5xxx), inputs outside entryRoot, no inputs, and compilerOptions.paths fail the build.
  • Options are now include, exclude, entryRoot and compilerOptions.declarationMap: false. The CI profile fixture installs Vite only and checks that no TypeScript or declaration plugin is resolvable.

Declaration parity

I built five corpora with the old helper (vite-plugin-dts + TypeScript 6.0.3) and the new one, then diffed the emitted .d.ts files: a probe package plus this repo's time, test-kit, oxlint-plugin and oxlint-config sources. 122 declaration files exist in both builds: 65 are byte-identical and 57 differ. The new build adds 2 files. Every difference falls into one of these groups:

  • Import and export lines reprinted by vite-plugin-dts: single quotes, type modifiers dropped, { default as x }. tsrs keeps TypeScript's own form.
  • Quote style inside import("...") types.
  • Order of union members and inferred properties: TypeScript 7's deterministic type printer.
  • Two new files: declarations for allowJs JavaScript fixtures inside include. vite-plugin-dts skipped these.

Doc comments are kept, and no declared type changes.

Checks

  • bun test on publish-build-target-vite-dts.test.ts (real tsrs emits), publish-build-target-vite.test.ts and entry-graph.test.ts
  • bun check for the package, check:publish-contract, check:toolchain, oxlint, bun fmt --check on the changed files

Changeset: major. Configs that set pathsToAliases, strictOutput or declarationOnly now fail, configs with tsconfig paths now fail, and the declaration text changes as listed above.

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.
@coderabbitai

coderabbitai Bot commented Oct 26, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T20:14:43.864880Z 72f46b3 PR opened
🔒 Security Review ✅ Completed 2026-10-26T20:16:58.438046Z 72f46b3 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jan-kubica
jan-kubica merged commit df2287f into feat/publish-oxc-parse Oct 26, 2026
11 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 72f46b332b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +107 to +108
const scratch = mkdtempSync(path.join(tmpdir(), "stll-declarations-"));
const config = path.join(scratch, "tsconfig.json");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve package-local type resolution in the generated config

When the package tsconfig specifies compilerOptions.types without explicit typeRoots (for example, types: ["node"]), placing the generated config in a separate temporary directory changes where those type packages are resolved: resolution starts from the temporary config rather than the package. Extending the original config does not preserve that lookup location. A package-local ambient type fixture emits the correct structural type with its original config but reports missing type definitions and emits any through the temporary extending config. Since type diagnostics become warnings here, this can silently publish degraded declarations. Keep the generated config package-local or explicitly preserve the original type-resolution roots.

Useful? React with 👍 / 👎.

jan-kubica added a commit that referenced this pull request Nov 18, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant