Skip to content

Commit 90ddb64

Browse files
authored
Change createDts interface (#195)
* change `createDts` interface * generate `styles` for named exports in `createDts` * remove mapping from snapshot - Even looking at a snapshot of the mapping, it is difficult for humans to determine whether it is good or bad. - The correctness of mapping is checked by E2E testing. - Then, delete the snapshot of mapping. * add test cases * add changelog
1 parent bf01bee commit 90ddb64

6 files changed

Lines changed: 120 additions & 272 deletions

File tree

.changeset/tricky-apples-do.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@css-modules-kit/ts-plugin': patch
3+
'@css-modules-kit/codegen': patch
4+
'@css-modules-kit/core': patch
5+
---
6+
7+
chore!: change `createDts` interface

packages/codegen/src/runner.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,15 @@ async function parseCSSModuleByFileName(fileName: string): Promise<ParseCSSModul
4141
*/
4242
async function writeDtsByCSSModule(
4343
cssModule: CSSModule,
44-
{ dtsOutDir, basePath, arbitraryExtensions, namedExports }: CMKConfig,
44+
{ dtsOutDir, basePath, arbitraryExtensions, namedExports, prioritizeNamedImports }: CMKConfig,
4545
resolver: Resolver,
4646
matchesPattern: MatchesPattern,
4747
): Promise<void> {
48-
const dts = createDts(cssModule, { resolver, matchesPattern, namedExports });
48+
const dts = createDts(
49+
cssModule,
50+
{ resolver, matchesPattern },
51+
{ namedExports, prioritizeNamedImports, forTsPlugin: false },
52+
);
4953
await writeDtsFile(dts.text, cssModule.fileName, {
5054
outDir: dtsOutDir,
5155
basePath,

0 commit comments

Comments
 (0)