Skip to content

feat(core, ts-plugin, codegen, vscode): support scoping container names via cmkOptions.container#437

Merged
mizdra merged 3 commits into
mainfrom
feat/container-option
Jul 5, 2026
Merged

feat(core, ts-plugin, codegen, vscode): support scoping container names via cmkOptions.container#437
mizdra merged 3 commits into
mainfrom
feat/container-option

Conversation

@mizdra

@mizdra mizdra commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Summary

This PR adds a new option cmkOptions.container (default: false), inspired by the container option of lightningcss's CSS Modules support.

When enabled, container names are treated as tokens:

  • Names declared with container-name: foo or container: foo / inline-size are added to the generated .d.ts file.
  • The name in @container foo (...) is treated as a usage of that token. Language features such as Go to Definition, Find All References, and Rename work across them, and an error is reported if the referenced name is not declared.

Following lightningcss and css-conditional-5, the keywords none / and / not / or, the CSS-wide keywords, and default are not treated as container names. See docs/design.md for why local(...) / global(...) are not interpreted.

How to verify

Open examples/1-basic (where cmkOptions.container is enabled) in an editor and try Go to Definition / Find All References / Rename on the container names in src/a.module.css:

:root {
  container-name: container;
}
@container container (width > 400px) {}

🤖 Generated with Claude Code

@mizdra mizdra added the Type: Feature New Feature label Jul 5, 2026
@changeset-bot

changeset-bot Bot commented Jul 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7d32920

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@css-modules-kit/core Minor
@css-modules-kit/ts-plugin Minor
@css-modules-kit/codegen Minor
css-modules-kit-vscode Minor
@css-modules-kit/eslint-plugin Minor
@css-modules-kit/stylelint-plugin Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mizdra
mizdra marked this pull request as ready for review July 5, 2026 15:30
@mizdra
mizdra merged commit c2ce4f3 into main Jul 5, 2026
16 checks passed
@mizdra
mizdra deleted the feat/container-option branch July 5, 2026 15:30
@github-actions github-actions Bot mentioned this pull request Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Feature New Feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant