Skip to content

fix(core): posix paths, diamond imports, comment safety#923

Merged
miguel-heygen merged 1 commit into
mainfrom
fix/css-import-review-fixes
May 17, 2026
Merged

fix(core): posix paths, diamond imports, comment safety#923
miguel-heygen merged 1 commit into
mainfrom
fix/css-import-review-fixes

Conversation

@miguel-heygen
Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #922 addressing review feedback (#4306329284):

  • Posix path regression (blocker): path.relative() emits \ on Windows. Normalized output with .split(sep).join("/") to match the posix-path convention established in rewriteSubCompPaths.ts:15-19.
  • Diamond import leak (important): When the same CSS file is reached via two parent stylesheets, the second visit now returns empty string instead of the original @import statement, which would have caused a 404 after bundling.
  • Comment safety (nit): CSS block comments are stripped before @import matching so /* @import url(...) */ is preserved as-is, not resolved.

Re: dist/ deletion

The packages/producer/dist/ deletion in #922 was a separate cleanup — those files were force-committed despite the root .gitignore already having dist/. No other package had dist tracked. The .gitignore already covers it, no additional entry needed.

Re: sub-composition @import gap

Sub-composition <style> blocks not getting @import resolution is a pre-existing gap. Filed as a follow-up.

Test plan

  • 2 new test cases: diamond import deduplication, commented-out @import preservation
  • All 30 bundler tests pass
  • Pre-commit hooks pass (oxlint, oxfmt, typecheck, commitlint)
  • windows-latest CI job should now pass — url() paths use / regardless of platform

…t safety

Fixes from review #4306329284 on hf#922:

- Normalize path.relative() output with .split(sep).join("/") so
  rebased url() paths use forward slashes on Windows, matching the
  posix-path convention in rewriteSubCompPaths.ts.

- Return empty string (not the original @import statement) when the
  visited set detects a diamond import. Previously the stale @import
  leaked through and caused a 404 after bundling.

- Strip CSS block comments before @import matching so commented-out
  imports (/* @import url(...) */) are not resolved. Comments are
  restored after processing via placeholder substitution.
@miguel-heygen miguel-heygen changed the title fix(core): address #922 review — posix paths, diamond imports, comment safety fix(core): posix paths, diamond imports, comment safety May 17, 2026
@miguel-heygen miguel-heygen merged commit d343e9c into main May 17, 2026
30 of 42 checks passed
@miguel-heygen miguel-heygen deleted the fix/css-import-review-fixes branch May 17, 2026 21:38
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