Commit Graph

8 Commits

Author SHA1 Message Date
Claude Bot
70f4fe90c5 feat(bundler): add CSS Module Scripts support
Implement CSS Module Scripts (https://web.dev/articles/css-module-scripts)
for Bun's bundler. When importing CSS with `{ type: 'css' }` attribute:

```javascript
import sheet from './styles.css' with { type: 'css' };
// or dynamically:
const module = await import('./styles.css', { with: { type: 'css' } });
```

The import now returns a CSSStyleSheet object that can be used with
`document.adoptedStyleSheets`, instead of the previous behavior of
returning an empty object or file path.

Changes:
- Add `__cssModuleScript` runtime helper that creates CSSStyleSheet
- Add `is_css_module_script` flag to ImportRecord
- Track CSS Module Script files in LinkerGraph
- Generate `__cssModuleScript(cssContent)` for CSS imports with type assertion
- Handle both static and dynamic imports correctly
- Preserve existing CSS Modules behavior (class name mappings) for
  imports without the type assertion

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 20:45:19 +00:00
robobun
066f706a99 Fix CSS view-transition pseudo-elements with class selectors (#23957) 2025-10-22 16:45:03 -07:00
Zack Radisic
39dd5002c3 Fix CSS error with printing :is(...) pseudo class (#21249)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2025-07-21 00:21:33 -07:00
Vladlen Grachev
317e9d23ab Fix CSS Modules when code splitting enabled (#18435)
Co-authored-by: Don Isaac <donald.isaac@gmail.com>
2025-03-26 21:45:22 -07:00
Don Isaac
d09e381cbc fix(css): :global in css modules (#18257) 2025-03-17 17:15:54 -07:00
Zack Radisic
321500c625 CSS stress tests, some fixes (#17131) 2025-02-10 20:56:30 -08:00
Meghan Denny
af79cebf9e unflag experimental css and html (#16561)
Co-authored-by: nektro <5464072+nektro@users.noreply.github.com>
Co-authored-by: Zack Radisic <56137411+zackradisic@users.noreply.github.com>
2025-01-21 06:44:54 -08:00
Zack Radisic
5502278f3e CSS: More stuff and tests (#14832)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-10-27 13:49:25 -07:00