@better-css-modules/core 0.1.3 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -45
- package/dist/dts-BLFmeUu6.d.mts +276 -0
- package/dist/dts-YHloeOKZ.mjs +1524 -0
- package/dist/index.d.mts +16 -58
- package/dist/index.mjs +2416 -85
- package/dist/internal.d.mts +23 -0
- package/dist/internal.mjs +95 -0
- package/package.json +31 -20
- package/dist/generator-BlFEyanZ.mjs +0 -105
- package/dist/generator-Dy0W5B1c.cjs +0 -179
- package/dist/index.cjs +0 -130
- package/dist/index.d.cts +0 -62
- package/dist/loader.cjs +0 -16
- package/dist/loader.d.cts +0 -3
- package/dist/loader.d.mts +0 -4
- package/dist/loader.mjs +0 -16
package/dist/index.d.mts
CHANGED
|
@@ -1,62 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
//#region src/
|
|
4
|
-
interface
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
/** Watch mode (for CLI) */
|
|
12
|
-
watch: boolean;
|
|
13
|
-
/** Suppress console output */
|
|
14
|
-
silent: boolean;
|
|
1
|
+
import { a as Diagnostic, c as RuleId, d as ConfigError, f as ResolvedConfig, l as TokenCategory, m as loadConfig, n as generate, o as formatDiagnostic, p as defineConfig, s as formatGitHubAnnotation, t as GenerateResult, u as Config } from "./dts-BLFmeUu6.mjs";
|
|
2
|
+
import "postcss";
|
|
3
|
+
//#region src/check.d.ts
|
|
4
|
+
interface CheckResult {
|
|
5
|
+
/** The problems found, sorted. */
|
|
6
|
+
diagnostics: Diagnostic[];
|
|
7
|
+
/** How many CSS Modules files were checked. */
|
|
8
|
+
modules: number;
|
|
9
|
+
/** The token categories the global CSS declares, which are restricted. */
|
|
10
|
+
tokens: TokenCategory[];
|
|
15
11
|
}
|
|
16
|
-
declare function defineConfig(config: Partial<Config>): Config;
|
|
17
|
-
declare function loadConfig(cwd?: string): Promise<Config>;
|
|
18
|
-
//#endregion
|
|
19
|
-
//#region src/parser.d.ts
|
|
20
|
-
/**
|
|
21
|
-
* Extract class names from CSS file contents.
|
|
22
|
-
*/
|
|
23
|
-
declare function extractClassNames(css: string): string[];
|
|
24
|
-
/**
|
|
25
|
-
* Read a CSS Modules file and extract class names.
|
|
26
|
-
*/
|
|
27
|
-
declare function parseFile(filePath: string): Promise<string[]>;
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/generator.d.ts
|
|
30
|
-
/**
|
|
31
|
-
* Generate .d.ts content from an array of class names.
|
|
32
|
-
*/
|
|
33
|
-
declare function generateDts(classNames: string[]): string;
|
|
34
12
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* @param outDir - Output directory
|
|
40
|
-
* @param cwd - Working directory
|
|
13
|
+
* Check the project: every CSS Modules file the config includes, how the
|
|
14
|
+
* sources use them, and the project's own global CSS. Throws ConfigError when
|
|
15
|
+
* include matches no file, the global CSS cannot be read, or it does not
|
|
16
|
+
* declare the layer.
|
|
41
17
|
*/
|
|
42
|
-
declare function
|
|
43
|
-
/**
|
|
44
|
-
* Batch-generate .d.ts files for all CSS Modules files based on the config.
|
|
45
|
-
*/
|
|
46
|
-
declare function generateAll(config: Config, cwd?: string): Promise<string[]>;
|
|
47
|
-
//#endregion
|
|
48
|
-
//#region src/scanner.d.ts
|
|
49
|
-
interface UnusedClassWarning {
|
|
50
|
-
cssFile: string;
|
|
51
|
-
className: string;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Scan TS/TSX files under the specified directory
|
|
55
|
-
* and detect unused CSS Modules class names.
|
|
56
|
-
*/
|
|
57
|
-
declare function scanUnusedClasses(cwd: string): Promise<UnusedClassWarning[]>;
|
|
58
|
-
//#endregion
|
|
59
|
-
//#region src/watcher.d.ts
|
|
60
|
-
declare function startWatcher(config: Config, cwd?: string): chokidar.FSWatcher;
|
|
18
|
+
export declare function check(config: ResolvedConfig): Promise<CheckResult>;
|
|
61
19
|
//#endregion
|
|
62
|
-
export { type
|
|
20
|
+
export { type CheckResult, type Config, ConfigError, type Diagnostic, type GenerateResult, type ResolvedConfig, type RuleId, defineConfig, formatDiagnostic, formatGitHubAnnotation, generate, loadConfig };
|