Skip to content

Commit

Permalink
chore(vite): fix regex and typo
Browse files Browse the repository at this point in the history
  • Loading branch information
zyishai committed Apr 3, 2024
1 parent e98642c commit dfead1f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/vite-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function MyCustomButton() {
```

**Important note**
This plugin only supports importing from **CSS modules.** So make sure your files ends with `.module.css` or `.module.scss`.
This plugin only supports importing from **CSS modules.** So make sure your files end with `.module.css` or `.module.scss`.

## Typescript Support
This plugin comes with support for Typescript built-in! Modify your `vite.config.ts` as follows:
Expand All @@ -43,7 +43,7 @@ export default defineConfig({
});
```

This plugin detects files that ends with `.module.css` or `.module.scss` in your project and creates matching `.d.ts` files alongside them. For example, if your source code directory has this structure:
This plugin detects files that end with `.module.css` or `.module.scss` in your project and creates matching `.d.ts` files alongside them. For example, if your source code directory has this structure:
```
|-- src
|-- components
Expand Down
2 changes: 1 addition & 1 deletion packages/vite-plugin/src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ function parseComments(text: string): MSA[] {

function extractClassNames(code: string): Record<string, string> {
const reDefaultExportClassNames = /['"]([\w-]+)['"]:\s+['"]([\w-]+)['"]/gs
const reNamedExportsClassNames = /export const (\w*) = ['"]([\w-]*)['"];/g
const reNamedExportsClassNames = /export const (\w+) = ['"]([\w-]+)['"];/g

const match: (re: RegExp) => Record<string, string> = (re: RegExp) => {
const matches = re.exec(code)
Expand Down

0 comments on commit dfead1f

Please sign in to comment.