Skip to content

Commit fe24afe

Browse files
committed
perf(linter/plugins): apply replace globals TSDown plugin to JS files (#20305)
TSDown build uses a custom plugin to replace global property lookups e.g. `Object.assign` with top level vars e.g. `const ObjectAssign = Object.assign;`, and then replace the usages with those top-level vars. The plugin was only applied to `.ts` files. Broaden the filter to include `.js` files too, so it applies to the large generated files `deserialize.js` and `walk.js`.
1 parent c6cbe42 commit fe24afe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

apps/oxlint/tsdown_plugins/replace_globals.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ const availableGlobals = getAvailableGlobals(GLOBALS_PATH);
4747
const plugin: Plugin = {
4848
name: "replace-globals",
4949
transform: {
50-
// Only process TS files in `src-js` directory
51-
filter: { id: /\/src-js\/.+(?<!\.d)\.ts$/ },
50+
// Only process JS and TS files in `src-js` directory
51+
filter: { id: /\/src-js\/.+(?<!\.d)\.[jt]s$/ },
5252

5353
async handler(code, path, meta) {
5454
const magicString = meta.magicString!;

0 commit comments

Comments
 (0)