Skip to content

Do the plugin's work in fewer passes - #114

Merged
nstepien merged 1 commit into
mainfrom
fewer-passes
Oct 19, 2026
Merged

nstepien merged 1 commit into
mainfrom
fewer-passes

Conversation

@nstepien

Copy link
Copy Markdown
Owner
  • extractCssFromCode replaces each template and appends its CSS as soon as its interpolations resolve, instead of collecting the extractions and walking them twice. The magic string is still only created for the first extraction.
  • transform builds its import statements as one string instead of joining an array.
  • Map lookups that called has() before get() now call get() once.
  • hotUpdate returns early when no CSS depends on the edited module. Vite treats a missing return value as "unchanged", so it keeps its own list of modules instead of receiving a copy that it has to reconcile with the list it keeps for handleHotUpdate plugins. A new dev server test edits a module that nothing interpolates, which covers that path. The getCode and getStylesheets helpers moved to module level so both dev server tests share them.

The build output is unchanged, and no snapshots changed.

🤖 Generated with Claude Code

- `extractCssFromCode` replaces each template and appends its CSS as soon as its interpolations resolve, instead of collecting the extractions and walking them twice. The magic string is still only created for the first extraction.
- `transform` builds its import statements as one string instead of joining an array.
- Map lookups that called `has()` before `get()` now call `get()` once.
- `hotUpdate` returns early when no CSS depends on the edited module, so Vite keeps its own list of modules instead of receiving a copy that it has to reconcile. A new dev server test edits a module that nothing interpolates, which covers that path.

The build output is unchanged, and no snapshots changed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

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

⚙️ Run configuration
  • Configuration used: Repository: nstepien/ecij/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 391e71e6-d6ea-477b-aaa9-7553268e5eb7
  • 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.

Comment thread src/index.ts Dismissed
@nstepien
nstepien merged commit 0ae7155 into main Oct 19, 2026
9 checks passed
@nstepien
nstepien deleted the fewer-passes branch October 19, 2026 03:11
nstepien added a commit that referenced this pull request Nov 4, 2026
main reshaped the code this branch builds on since the last merge, so
the merge ports the branch onto main's design again:

- The scope visitor is shared across parses (#109), so the callbacks
  for raw TypeScript bindings and `export default` join it, and the
  default export is recorded through its visit state.
- Imported modules are resolved, loaded, and parsed once per transform
  through main's loadImportedModule (#124), which now also skips
  external modules, keys modules by moduleKey, and records dependencies
  by file.
- Modules are parsed as the language the bundler assigned them through
  main's parseLangOf (#125), which this branch had too.
- extractCssFromCode keeps main's single pass (#114), and hotUpdate its
  early return, with this branch's handling of query variants.
- readModuleCode moved to module level, as consistent-function-scoping
  is on since #109.

Tests: the inline snapshots of this branch's tests follow Rolldown's new
module comments (`// path` instead of `//#region path` and
`//#endregion`), with no other change. The dev server test of virtual
modules uses main's shared getCode and getStylesheets helpers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

2 participants