From 8bb626cce5e50d819a0859bbce14732e9711b582 Mon Sep 17 00:00:00 2001 From: Michael Tran <560721+psychobolt@users.noreply.github.com> Date: Tue, 14 Nov 2023 09:10:35 -0800 Subject: [PATCH 1/3] Add type `exportGlobals` to CSSModulesOptions interface --- packages/vite/src/node/plugins/css.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index c7c5bd4bf9cacd..57a8c5242ff9c2 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -115,6 +115,7 @@ export interface CSSModulesOptions { ) => void scopeBehaviour?: 'global' | 'local' globalModulePaths?: RegExp[] + exportGlobals?: boolean generateScopedName?: | string | ((name: string, filename: string, css: string) => string) From a29ae1f62d2c6b72fa93b16eb08aef92b0ef224e Mon Sep 17 00:00:00 2001 From: Michael Tran <560721+psychobolt@users.noreply.github.com> Date: Wed, 15 Nov 2023 07:33:14 -0800 Subject: [PATCH 2/3] Update shared-options.md --- docs/config/shared-options.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/config/shared-options.md b/docs/config/shared-options.md index 4c74725c308521..0112587e8610e9 100644 --- a/docs/config/shared-options.md +++ b/docs/config/shared-options.md @@ -170,6 +170,7 @@ Enabling this setting causes vite to determine file identity by the original fil interface CSSModulesOptions { scopeBehaviour?: 'global' | 'local' globalModulePaths?: RegExp[] + exportGlobals: boolean generateScopedName?: | string | ((name: string, filename: string, css: string) => string) From 68b2a6a56fae0fd72b7e409c3406861c34308029 Mon Sep 17 00:00:00 2001 From: bluwy Date: Thu, 16 Nov 2023 16:49:20 +0800 Subject: [PATCH 3/3] chore: update docs --- docs/config/shared-options.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/config/shared-options.md b/docs/config/shared-options.md index 0112587e8610e9..e6ac34f36e2ef5 100644 --- a/docs/config/shared-options.md +++ b/docs/config/shared-options.md @@ -168,22 +168,31 @@ Enabling this setting causes vite to determine file identity by the original fil - **Type:** ```ts interface CSSModulesOptions { + getJSON?: ( + cssFileName: string, + json: Record, + outputFileName: string, + ) => void scopeBehaviour?: 'global' | 'local' globalModulePaths?: RegExp[] - exportGlobals: boolean + exportGlobals?: boolean generateScopedName?: | string | ((name: string, filename: string, css: string) => string) hashPrefix?: string /** - * default: null + * default: undefined */ localsConvention?: | 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly' - | null + | (( + originalClassName: string, + generatedClassName: string, + inputFile: string, + ) => string) } ```