@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/dist/index.d.mts CHANGED
@@ -1,62 +1,20 @@
1
- import * as chokidar from "chokidar";
2
-
3
- //#region src/config.d.ts
4
- interface Config {
5
- /** Glob patterns for target files */
6
- include: string[];
7
- /** Exclusion patterns */
8
- exclude: string[];
9
- /** Output directory */
10
- outDir: string;
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
- * Generate and write a .d.ts file for a CSS Modules file.
36
- *
37
- * @param cssFilePath - Path to the source CSS Modules file
38
- * @param classNames - Array of extracted class names
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 writeDts(cssFilePath: string, classNames: string[], outDir: string, cwd?: string): Promise<string>;
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 Config, type UnusedClassWarning, defineConfig, extractClassNames, generateAll, generateDts, loadConfig, parseFile, scanUnusedClasses, startWatcher, writeDts };
20
+ export { type CheckResult, type Config, ConfigError, type Diagnostic, type GenerateResult, type ResolvedConfig, type RuleId, defineConfig, formatDiagnostic, formatGitHubAnnotation, generate, loadConfig };