Skip to content

Commit bf1881c

Browse files
Version Packages (#385)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent ad81574 commit bf1881c

19 files changed

Lines changed: 136 additions & 81 deletions

.changeset/codegen-omit-token-references.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

.changeset/drop-readonly-string-cast.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

.changeset/file-rename-from-css-import-specifier.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

.changeset/fix-aliased-reexport-in-export-record.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

.changeset/keyframes-references.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

.changeset/named-exports-dts-as-module.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

.changeset/rename-token-importer-types.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/codegen/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# @css-modules-kit/codegen
22

3+
## 1.2.0
4+
5+
### Patch Changes
6+
7+
- [#399](https://github.com/mizdra/css-modules-kit/pull/399) [`f758c23`](https://github.com/mizdra/css-modules-kit/commit/f758c23836878624553dcd44a920a76c5505b4d6) - refactor(core, codegen): do not emit token reference statements in generated `.d.ts` files
8+
9+
Statements like `styles['a_1'];` and `__self['a_1'];` (emitted for `animation-name` references to `@keyframes`) used to appear in the `.d.ts` files written by codegen. These statements exist solely to wire up editor language features such as Go to Definition, Find All References, and Rename, and are not needed at compile time. The visible types exported by these files are unchanged, but codegen output is no longer cluttered with statements that look meaningless to a reader of the type definition file. The statements are still emitted by the TS plugin, where the language features are actually served.
10+
11+
- Updated dependencies [[`f758c23`](https://github.com/mizdra/css-modules-kit/commit/f758c23836878624553dcd44a920a76c5505b4d6), [`2d672a6`](https://github.com/mizdra/css-modules-kit/commit/2d672a68296d88922d1294268cee2eddcb62115b), [`bf028b1`](https://github.com/mizdra/css-modules-kit/commit/bf028b15fd2503fa3596fb079755ea0138406e97), [`ab602bf`](https://github.com/mizdra/css-modules-kit/commit/ab602bf9f4b8e82bcaf3d951b0cb7bb94719ee83), [`feff13f`](https://github.com/mizdra/css-modules-kit/commit/feff13f30419511dc736594269425d2924c189f4), [`d0c1750`](https://github.com/mizdra/css-modules-kit/commit/d0c17500bf51450a3d722b13b0159a96890c786d)]:
12+
- @css-modules-kit/core@1.2.0
13+
314
## 1.1.0
415

516
### Patch Changes

packages/codegen/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@css-modules-kit/codegen",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"private": false,
55
"description": "A tool for generating `*.d.ts` files for `*.module.css`.",
66
"keywords": [

packages/core/CHANGELOG.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,52 @@
11
# @css-modules-kit/core
22

3+
## 1.2.0
4+
5+
### Minor Changes
6+
7+
- [#389](https://github.com/mizdra/css-modules-kit/pull/389) [`ab602bf`](https://github.com/mizdra/css-modules-kit/commit/ab602bf9f4b8e82bcaf3d951b0cb7bb94719ee83) - feat(core, ts-plugin, eslint-plugin, stylelint-plugin): support animation-name property
8+
9+
`animation-name: foo;` is now linked back to the `@keyframes foo {...}` declaration. Go to Definition jumps from a reference to the declaration, Find All References lists every reference site, and Rename updates the declaration and every reference together. Comma-separated names (`animation-name: foo, bar;`), `local()` / `global()` notation, and vendor prefixes (`-webkit-animation-name`) are all supported. References to `@keyframes` defined in another file via `@import` are resolved as well.
10+
11+
Two diagnostics are also emitted for invalid usage:
12+
- Parse phase: malformed `local(...)` calls (empty, multiple identifiers, or non-identifier nodes such as a nested function) are reported.
13+
- Check phase: token references that resolve to neither a locally defined token nor an imported token are reported as `Cannot find token '<name>'.`.
14+
15+
The `no-unused-class-names` rule in eslint-plugin and stylelint-plugin now treats names referenced via `animation-name` from within the same CSS as used, so they are no longer reported as unused.
16+
17+
### Patch Changes
18+
19+
- [#399](https://github.com/mizdra/css-modules-kit/pull/399) [`f758c23`](https://github.com/mizdra/css-modules-kit/commit/f758c23836878624553dcd44a920a76c5505b4d6) - refactor(core, codegen): do not emit token reference statements in generated `.d.ts` files
20+
21+
Statements like `styles['a_1'];` and `__self['a_1'];` (emitted for `animation-name` references to `@keyframes`) used to appear in the `.d.ts` files written by codegen. These statements exist solely to wire up editor language features such as Go to Definition, Find All References, and Rename, and are not needed at compile time. The visible types exported by these files are unchanged, but codegen output is no longer cluttered with statements that look meaningless to a reader of the type definition file. The statements are still emitted by the TS plugin, where the language features are actually served.
22+
23+
- [#395](https://github.com/mizdra/css-modules-kit/pull/395) [`2d672a6`](https://github.com/mizdra/css-modules-kit/commit/2d672a68296d88922d1294268cee2eddcb62115b) - fix(core): make default-export `styles` type-readonly via `as const`
24+
25+
The default-export `.d.ts` previously emitted each token as `'<name>': '' as readonly string,`. The `readonly` modifier is only valid on array/tuple types, so this was a TypeScript syntax error silently suppressed by `@ts-nocheck``styles` was not actually readonly and writes like `styles.foo = '...'` were accepted by `tsc`. The generator now emits `'<name>': '' as string,` per token and closes the object literal with `} as const`, so `typeof styles` is `Readonly<{ ... }>` and writes to it are now correctly reported as type errors.
26+
27+
- [#386](https://github.com/mizdra/css-modules-kit/pull/386) [`bf028b1`](https://github.com/mizdra/css-modules-kit/commit/bf028b15fd2503fa3596fb079755ea0138406e97) - fix(core): use the alias name when collecting re-exported tokens via `@value ... as ... from ...`
28+
29+
`createExportBuilder` was recording the source-side name (`entry.name`) into the importing module's `ExportRecord` instead of the alias the importing module actually exposes (`entry.localName`). This caused downstream consumers to look up the wrong name, e.g. `checkCSSModule` would emit a false "no exported token" diagnostic for an aliased token re-imported from another module.
30+
31+
- [#390](https://github.com/mizdra/css-modules-kit/pull/390) [`feff13f`](https://github.com/mizdra/css-modules-kit/commit/feff13f30419511dc736594269425d2924c189f4) - fix(core): ensure the `.d.ts` generated in named exports mode is always treated as a module
32+
33+
When a CSS Module file had no exported tokens or importers (e.g. an empty file), the generated `.d.ts` in named exports mode contained no top-level `export`/`import`, so TypeScript treated it as a global script and reported `TS2306` on `import * as styles from './a.module.css'`. The generator now appends `export {};` whenever it does not emit any other top-level `export` / `import`, so the generated `.d.ts` is always treated as a module.
34+
35+
- [#384](https://github.com/mizdra/css-modules-kit/pull/384) [`d0c1750`](https://github.com/mizdra/css-modules-kit/commit/d0c17500bf51450a3d722b13b0159a96890c786d) - refactor(core): rename TokenImporter variants to ESTree-style names
36+
37+
Rename the public types so they describe the abstract shape of the import
38+
(matching ESTree's `ExportAllDeclaration` / `ExportNamedDeclaration`)
39+
rather than the CSS syntax that produced them:
40+
- `AtImportTokenImporter``AllTokenImporter` (`type: 'all'`)
41+
- `AtValueTokenImporter``NamedTokenImporter` (`type: 'named'`)
42+
- `AtValueTokenImporterValue``NamedTokenImporterEntry`
43+
- `NamedTokenImporter.values``NamedTokenImporter.entries`
44+
45+
The `core` package is an internal building block — end users interact
46+
with CSS Modules Kit through `ts-plugin`, `codegen`, `eslint-plugin`,
47+
and `stylelint-plugin`, none of which reference the renamed names. This
48+
change is therefore released as a patch.
49+
350
## 1.1.0
451

552
### Minor Changes

0 commit comments

Comments
 (0)