build(linter/plugins): simplify TSDown config#15948
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
5d340df to
ba7b9b6
Compare
75bcbdb to
5633be4
Compare
ba7b9b6 to
dacaaf2
Compare
5633be4 to
f1a8cbc
Compare
f1a8cbc to
cda76ed
Compare
dacaaf2 to
152e5de
Compare
cda76ed to
ad43f29
Compare
ad43f29 to
2a9ead3
Compare
2a9ead3 to
72da02e
Compare
72da02e to
d6d14a3
Compare
There was a problem hiding this comment.
Pull request overview
This PR simplifies the TSDown build configuration for the oxlint package by consolidating two separate build configurations into a single build with multiple entry points. This change is made possible by a previous fix (#15946) that resolved issues with assert* functions ending up in shared chunks.
Key changes:
- Merged separate
cli.tsandindex.tsbuilds into a single config with two entry points - Added post-build cleanup to remove unwanted
cli.d.tsdeclaration files - Updated debug config generation to use object spread from the main config
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| apps/oxlint/tsdown.config.ts | Consolidated two separate TSDown configs into one with multiple entry points; simplified debug config creation |
| apps/oxlint/scripts/build.ts | Added rmSync import and logic to delete generated cli.d.ts files from both dist and debug directories |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d6d14a3 to
9c002a1
Compare
Merge activity
|
#15946 means we can now simplify the TSDown build config. Previously we had to have 2 separate builds for `index.ts` and `cli.ts`, to avoid `assert*` functions ending up in a shared chunk, and not getting removed by minifier. Now that problem is solved, so we can switch to a single build with 2 entry points. TSDown does create a small extra chunk for its `__toESM` and `__commonJSMin` functions, but I think that's fine. Annoyingly it doesn't seem to be possible to tell TSDown to generate `.d.ts` files only for the `index.js` chunk, so have to delete this pointless files in build script. The point of all this is that `RuleTester` needs to use a ton of code from `plugins.ts`, and we wouldn't want all that code duplicated in both `index` and `plugins` chunks (especially once we're bundling TS-ESlint's parser #15861). Now that code will be shared between the two entry points in a shared chunk, not duplicated.
9c002a1 to
8b3fd1c
Compare
oxc-project#15946 means we can now simplify the TSDown build config. Previously we had to have 2 separate builds for `index.ts` and `cli.ts`, to avoid `assert*` functions ending up in a shared chunk, and not getting removed by minifier. Now that problem is solved, so we can switch to a single build with 2 entry points. TSDown does create a small extra chunk for its `__toESM` and `__commonJSMin` functions, but I think that's fine. Annoyingly it doesn't seem to be possible to tell TSDown to generate `.d.ts` files only for the `index.js` chunk, so have to delete this pointless files in build script. The point of all this is that `RuleTester` needs to use a ton of code from `plugins.ts`, and we wouldn't want all that code duplicated in both `index` and `plugins` chunks (especially once we're bundling TS-ESlint's parser oxc-project#15861). Now that code will be shared between the two entry points in a shared chunk, not duplicated.

#15946 means we can now simplify the TSDown build config.
Previously we had to have 2 separate builds for
index.tsandcli.ts, to avoidassert*functions ending up in a shared chunk, and not getting removed by minifier. Now that problem is solved, so we can switch to a single build with 2 entry points.TSDown does create a small extra chunk for its
__toESMand__commonJSMinfunctions, but I think that's fine.Annoyingly it doesn't seem to be possible to tell TSDown to generate
.d.tsfiles only for theindex.jschunk, so have to delete this pointless files in build script.The point of all this is that
RuleTesterneeds to use a ton of code fromplugins.ts, and we wouldn't want all that code duplicated in bothindexandpluginschunks (especially once we're bundling TS-ESlint's parser #15861). Now that code will be shared between the two entry points in a shared chunk, not duplicated.