Skip to content

Skip modules that mention ecij without importing from it - #134

Merged
nstepien merged 1 commit into
mainfrom
filter-ecij-imports
Nov 8, 2026
Merged

nstepien merged 1 commit into
mainfrom
filter-ecij-imports

Conversation

@nstepien

@nstepien nstepien commented Nov 8, 2026

Copy link
Copy Markdown
Owner

The code filter of transform matched any module that contains "ecij", so modules that only mention it were parsed for nothing:

  • ecij's own index.js, whose error message names the plugin, wherever it is not under node_modules, like in linked or workspace setups and in this repository's tests
  • test/fixtures/barrel.ts, which imports ./no-ecij.input
  • test/fixtures/no-ecij.input.ts, whose first comment mentions ecij

The filter now matches named imports from ecij, the only way to import css: ECIJ_IMPORT_REGEX = /\}\s*from\s*["']ecij["']/. It allows imports without spaces, like import{css}from"ecij" in minified code. Requiring spaces would skip those modules and leave css to throw at runtime. Rolldown evaluates the filter natively. Vitest's cache opt-out in configureVitest uses the same pattern, so modules that only mention ecij stay in its cache.

The only form it misses is a comment between the closing brace and from, like import { css } /* … */ from 'ecij'.

Verification

  • Tracing the calls to the transform handler in a Vite build, a plain Rolldown build, and the dev server showed the three modules above reaching it on main, and only the modules that import from ecij on this branch.
  • The new test, extract CSS from modules that import css without spaces, like minified ones, builds a .js fixture, as Vite reprints TypeScript before the plugin runs, and // oxfmt-ignore keeps its import compact. It fails when the pattern requires spaces.
  • Vite and plain Rolldown builds and cold dev transforms of react-data-grid, of 400 components interpolating tokens, and of 1,500 modules without ecij were all within noise, with identical outputs. None of these projects has a module that mentions ecij without importing from it, and real projects keep ecij's index.js under node_modules, so this is about precision more than speed.

Coverage is unchanged.

🤖 Generated with Claude Code

The code filter of `transform` matched any module containing "ecij", so
modules that only mention it, like ecij's own `index.js` outside of
`node_modules`, were parsed for nothing. It now matches named imports from
ecij, the only way to import `css`, with or without spaces, as minified code
has none. Vitest's cache opt-out uses the same pattern.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

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

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

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

@nstepien
nstepien marked this pull request as ready for review November 8, 2026 03:06
@nstepien
nstepien merged commit 4d10eb6 into main Nov 8, 2026
11 checks passed
@nstepien
nstepien deleted the filter-ecij-imports branch November 8, 2026 03:06
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