@drskillissue/ganko 0.3.2 → 0.3.3

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.cts CHANGED
@@ -1,7 +1,168 @@
1
1
  import ts from 'typescript';
2
- import { RuleOverrides, Logger, StringInterner, WorkspaceLayout } from '@drskillissue/ganko-shared';
2
+ import { R as RuleOverrides } from './rules-manifest-BvNUyXdr.cjs';
3
+ export { a as RULES, b as RULES_BY_CATEGORY, c as RuleEntry, g as getRule } from './rules-manifest-BvNUyXdr.cjs';
3
4
  import { Declaration, AtRule, Root, Rule } from 'postcss';
4
- export { RULES, RULES_BY_CATEGORY, RuleEntry, getRule } from './rules-manifest.cjs';
5
+
6
+ /**
7
+ * Resolved project root — a nominal wrapper that cannot be constructed
8
+ * from a raw string without going through a factory function.
9
+ *
10
+ * The `path` field is the canonical (realpath-resolved, absolute) directory.
11
+ * Use `.path` wherever a string is needed. The wrapper exists so that
12
+ * "project root" is a distinct type from "arbitrary string" in every
13
+ * function signature — you cannot accidentally pass a file path or URI.
14
+ */
15
+ declare class ProjectRoot {
16
+ readonly path: string;
17
+ /** @param canonical - Canonical absolute path */
18
+ private constructor();
19
+ /** String coercion returns the canonical path. */
20
+ toString(): string;
21
+ /** JSON serialization returns the canonical path. */
22
+ toJSON(): string;
23
+ /** @internal Factory — only used by the module-level factory functions below. */
24
+ static _create(canonical: string): ProjectRoot;
25
+ }
26
+
27
+ /** Canonical list of log level names, most verbose to least verbose. */
28
+ declare const LOG_LEVELS: readonly ["trace", "debug", "info", "warning", "error", "critical", "off"];
29
+ /** String log level name — used for configuration, parsing, and display. */
30
+ type LogLevel = (typeof LOG_LEVELS)[number];
31
+ /**
32
+ * Numeric log level constants for hot-path level checks.
33
+ *
34
+ * Lower numbers are more verbose. Use with `isLevelEnabled`:
35
+ *
36
+ * ```ts
37
+ * if (log.isLevelEnabled(Level.Debug)) log.debug(`rebuilt ${count} graphs`);
38
+ * ```
39
+ */
40
+ declare const Level: {
41
+ readonly Trace: 0;
42
+ readonly Debug: 1;
43
+ readonly Info: 2;
44
+ readonly Warning: 3;
45
+ readonly Error: 4;
46
+ readonly Critical: 5;
47
+ readonly Off: 6;
48
+ };
49
+ /** Numeric log level value (0–6). */
50
+ type LevelValue = (typeof Level)[keyof typeof Level];
51
+ /**
52
+ * Logger — shared logging interface for all packages.
53
+ *
54
+ * Levels match VS Code's LogLevel enum: Trace, Debug, Info, Warning, Error, Critical, Off.
55
+ *
56
+ * Backends are environment-specific (LSP connection, CLI stderr, noop for tests).
57
+ * The interface lives here so ganko and @drskillissue/ganko-shared consumers can log
58
+ * without depending on ganko.
59
+ *
60
+ * Use `isLevelEnabled` to guard expensive log argument computation:
61
+ *
62
+ * ```ts
63
+ * if (log.isLevelEnabled(Level.Debug)) log.debug(`rebuilt ${count} graphs in ${elapsed}ms`);
64
+ * ```
65
+ *
66
+ * This checks against the actual log level threshold — a single integer
67
+ * comparison with no lookup table. Template literals and function calls
68
+ * inside the guard are never evaluated when the level is disabled.
69
+ */
70
+ interface Logger {
71
+ /** The active log level threshold. Messages below this level are suppressed. */
72
+ readonly level: LogLevel;
73
+ /** Check whether a specific level would produce output at the current threshold. */
74
+ isLevelEnabled(level: LevelValue): boolean;
75
+ trace(message: string): void;
76
+ debug(message: string): void;
77
+ info(message: string): void;
78
+ warning(message: string): void;
79
+ error(message: string, err?: Error): void;
80
+ critical(message: string, err?: Error): void;
81
+ }
82
+
83
+ interface WorkspacePackage {
84
+ readonly path: string;
85
+ readonly name: string | null;
86
+ readonly dependencies: ReadonlySet<string>;
87
+ readonly packageJsonPath: string;
88
+ }
89
+ interface WorkspaceLayout {
90
+ readonly root: ProjectRoot;
91
+ readonly packages: readonly WorkspacePackage[];
92
+ readonly packagePaths: ReadonlySet<string>;
93
+ readonly allDependencyNames: ReadonlySet<string>;
94
+ readonly allPackageJsonPaths: readonly string[];
95
+ }
96
+
97
+ /**
98
+ * String Interning Utilities
99
+ *
100
+ * String interning stores a single copy of each unique string value
101
+ * and reuses that reference, reducing memory usage for frequently
102
+ * repeated strings.
103
+ */
104
+ /**
105
+ * A string interner that stores canonical string references.
106
+ *
107
+ * When the same string value is encountered multiple times, the interner
108
+ * returns the same reference, enabling reference equality comparisons
109
+ * and reducing memory usage.
110
+ *
111
+ * @example
112
+ * const interner = new StringInterner();
113
+ * const a = interner.intern("hello");
114
+ * const b = interner.intern("hello");
115
+ * console.log(a === b); // true (same reference)
116
+ */
117
+ declare class StringInterner {
118
+ private readonly table;
119
+ /**
120
+ * Intern a string, returning a canonical reference.
121
+ *
122
+ * If the string has been seen before, returns the existing reference.
123
+ * Otherwise, stores and returns the input string.
124
+ *
125
+ * @param s - The string to intern
126
+ * @returns The canonical interned string
127
+ */
128
+ intern(s: string): string;
129
+ /**
130
+ * Check if a string has been interned.
131
+ *
132
+ * @param s - The string to check
133
+ * @returns True if the string is already in the intern table
134
+ */
135
+ has(s: string): boolean;
136
+ /**
137
+ * Get the interned version of a string if it exists.
138
+ *
139
+ * @param s - The string to look up
140
+ * @returns The interned string or undefined
141
+ */
142
+ get(s: string): string | undefined;
143
+ /**
144
+ * Clear all interned strings.
145
+ */
146
+ clear(): void;
147
+ /**
148
+ * Get the number of interned strings.
149
+ *
150
+ * @returns The number of strings in the intern table
151
+ */
152
+ get size(): number;
153
+ /**
154
+ * Pre-intern a set of strings.
155
+ *
156
+ * @param strings - Array of strings to intern
157
+ */
158
+ internAll(strings: readonly string[]): void;
159
+ /**
160
+ * Pre-intern strings from an object's values.
161
+ *
162
+ * @param obj - Object whose string values should be interned
163
+ */
164
+ internFromObject(obj: Record<string, string>): void;
165
+ }
5
166
 
6
167
  type MessageId = string;
7
168
  type Message = string;
@@ -159,6 +320,12 @@ declare class TypeResolver {
159
320
  private typeCache;
160
321
  private solidSymbolCache;
161
322
  readonly logger: Logger;
323
+ /**
324
+ * Create a resolver backed by a TypeScript type checker.
325
+ *
326
+ * @param checker - Type checker used for all type queries
327
+ * @param logger - Optional logger for debug output
328
+ */
162
329
  constructor(checker: ts.TypeChecker, logger?: Logger);
163
330
  private isSymbolFromSolid;
164
331
  private isSolidSymbol;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,168 @@
1
1
  import ts from 'typescript';
2
- import { RuleOverrides, Logger, StringInterner, WorkspaceLayout } from '@drskillissue/ganko-shared';
2
+ import { R as RuleOverrides } from './rules-manifest-BvNUyXdr.js';
3
+ export { a as RULES, b as RULES_BY_CATEGORY, c as RuleEntry, g as getRule } from './rules-manifest-BvNUyXdr.js';
3
4
  import { Declaration, AtRule, Root, Rule } from 'postcss';
4
- export { RULES, RULES_BY_CATEGORY, RuleEntry, getRule } from './rules-manifest.js';
5
+
6
+ /**
7
+ * Resolved project root — a nominal wrapper that cannot be constructed
8
+ * from a raw string without going through a factory function.
9
+ *
10
+ * The `path` field is the canonical (realpath-resolved, absolute) directory.
11
+ * Use `.path` wherever a string is needed. The wrapper exists so that
12
+ * "project root" is a distinct type from "arbitrary string" in every
13
+ * function signature — you cannot accidentally pass a file path or URI.
14
+ */
15
+ declare class ProjectRoot {
16
+ readonly path: string;
17
+ /** @param canonical - Canonical absolute path */
18
+ private constructor();
19
+ /** String coercion returns the canonical path. */
20
+ toString(): string;
21
+ /** JSON serialization returns the canonical path. */
22
+ toJSON(): string;
23
+ /** @internal Factory — only used by the module-level factory functions below. */
24
+ static _create(canonical: string): ProjectRoot;
25
+ }
26
+
27
+ /** Canonical list of log level names, most verbose to least verbose. */
28
+ declare const LOG_LEVELS: readonly ["trace", "debug", "info", "warning", "error", "critical", "off"];
29
+ /** String log level name — used for configuration, parsing, and display. */
30
+ type LogLevel = (typeof LOG_LEVELS)[number];
31
+ /**
32
+ * Numeric log level constants for hot-path level checks.
33
+ *
34
+ * Lower numbers are more verbose. Use with `isLevelEnabled`:
35
+ *
36
+ * ```ts
37
+ * if (log.isLevelEnabled(Level.Debug)) log.debug(`rebuilt ${count} graphs`);
38
+ * ```
39
+ */
40
+ declare const Level: {
41
+ readonly Trace: 0;
42
+ readonly Debug: 1;
43
+ readonly Info: 2;
44
+ readonly Warning: 3;
45
+ readonly Error: 4;
46
+ readonly Critical: 5;
47
+ readonly Off: 6;
48
+ };
49
+ /** Numeric log level value (0–6). */
50
+ type LevelValue = (typeof Level)[keyof typeof Level];
51
+ /**
52
+ * Logger — shared logging interface for all packages.
53
+ *
54
+ * Levels match VS Code's LogLevel enum: Trace, Debug, Info, Warning, Error, Critical, Off.
55
+ *
56
+ * Backends are environment-specific (LSP connection, CLI stderr, noop for tests).
57
+ * The interface lives here so ganko and @drskillissue/ganko-shared consumers can log
58
+ * without depending on ganko.
59
+ *
60
+ * Use `isLevelEnabled` to guard expensive log argument computation:
61
+ *
62
+ * ```ts
63
+ * if (log.isLevelEnabled(Level.Debug)) log.debug(`rebuilt ${count} graphs in ${elapsed}ms`);
64
+ * ```
65
+ *
66
+ * This checks against the actual log level threshold — a single integer
67
+ * comparison with no lookup table. Template literals and function calls
68
+ * inside the guard are never evaluated when the level is disabled.
69
+ */
70
+ interface Logger {
71
+ /** The active log level threshold. Messages below this level are suppressed. */
72
+ readonly level: LogLevel;
73
+ /** Check whether a specific level would produce output at the current threshold. */
74
+ isLevelEnabled(level: LevelValue): boolean;
75
+ trace(message: string): void;
76
+ debug(message: string): void;
77
+ info(message: string): void;
78
+ warning(message: string): void;
79
+ error(message: string, err?: Error): void;
80
+ critical(message: string, err?: Error): void;
81
+ }
82
+
83
+ interface WorkspacePackage {
84
+ readonly path: string;
85
+ readonly name: string | null;
86
+ readonly dependencies: ReadonlySet<string>;
87
+ readonly packageJsonPath: string;
88
+ }
89
+ interface WorkspaceLayout {
90
+ readonly root: ProjectRoot;
91
+ readonly packages: readonly WorkspacePackage[];
92
+ readonly packagePaths: ReadonlySet<string>;
93
+ readonly allDependencyNames: ReadonlySet<string>;
94
+ readonly allPackageJsonPaths: readonly string[];
95
+ }
96
+
97
+ /**
98
+ * String Interning Utilities
99
+ *
100
+ * String interning stores a single copy of each unique string value
101
+ * and reuses that reference, reducing memory usage for frequently
102
+ * repeated strings.
103
+ */
104
+ /**
105
+ * A string interner that stores canonical string references.
106
+ *
107
+ * When the same string value is encountered multiple times, the interner
108
+ * returns the same reference, enabling reference equality comparisons
109
+ * and reducing memory usage.
110
+ *
111
+ * @example
112
+ * const interner = new StringInterner();
113
+ * const a = interner.intern("hello");
114
+ * const b = interner.intern("hello");
115
+ * console.log(a === b); // true (same reference)
116
+ */
117
+ declare class StringInterner {
118
+ private readonly table;
119
+ /**
120
+ * Intern a string, returning a canonical reference.
121
+ *
122
+ * If the string has been seen before, returns the existing reference.
123
+ * Otherwise, stores and returns the input string.
124
+ *
125
+ * @param s - The string to intern
126
+ * @returns The canonical interned string
127
+ */
128
+ intern(s: string): string;
129
+ /**
130
+ * Check if a string has been interned.
131
+ *
132
+ * @param s - The string to check
133
+ * @returns True if the string is already in the intern table
134
+ */
135
+ has(s: string): boolean;
136
+ /**
137
+ * Get the interned version of a string if it exists.
138
+ *
139
+ * @param s - The string to look up
140
+ * @returns The interned string or undefined
141
+ */
142
+ get(s: string): string | undefined;
143
+ /**
144
+ * Clear all interned strings.
145
+ */
146
+ clear(): void;
147
+ /**
148
+ * Get the number of interned strings.
149
+ *
150
+ * @returns The number of strings in the intern table
151
+ */
152
+ get size(): number;
153
+ /**
154
+ * Pre-intern a set of strings.
155
+ *
156
+ * @param strings - Array of strings to intern
157
+ */
158
+ internAll(strings: readonly string[]): void;
159
+ /**
160
+ * Pre-intern strings from an object's values.
161
+ *
162
+ * @param obj - Object whose string values should be interned
163
+ */
164
+ internFromObject(obj: Record<string, string>): void;
165
+ }
5
166
 
6
167
  type MessageId = string;
7
168
  type Message = string;
@@ -159,6 +320,12 @@ declare class TypeResolver {
159
320
  private typeCache;
160
321
  private solidSymbolCache;
161
322
  readonly logger: Logger;
323
+ /**
324
+ * Create a resolver backed by a TypeScript type checker.
325
+ *
326
+ * @param checker - Type checker used for all type queries
327
+ * @param logger - Optional logger for debug output
328
+ */
162
329
  constructor(checker: ts.TypeChecker, logger?: Logger);
163
330
  private isSymbolFromSolid;
164
331
  private isSolidSymbol;
package/dist/index.js CHANGED
@@ -24,6 +24,11 @@ import {
24
24
  SEL_HAS_ID,
25
25
  SEL_HAS_UNIVERSAL,
26
26
  SOLID_EXTENSIONS,
27
+ TS_ANY_OR_UNKNOWN,
28
+ TS_BOOLEAN_LIKE,
29
+ TS_NUMBER_LIKE,
30
+ TS_OBJECT_LIKE,
31
+ TS_STRING_LIKE,
27
32
  VAR_IS_GLOBAL,
28
33
  VAR_IS_SCSS,
29
34
  VAR_IS_USED,
@@ -83,8 +88,7 @@ import {
83
88
  splitTopLevelWhitespace,
84
89
  splitWhitespaceTokens,
85
90
  toKebabCase
86
- } from "./chunk-WJGGSO5O.js";
87
- import "./chunk-EGRHWZRV.js";
91
+ } from "./chunk-D2TKH7AJ.js";
88
92
 
89
93
  // src/runner.ts
90
94
  function createOverrideEmit(target, overrides) {
@@ -9016,11 +9020,6 @@ var cssNoUnreferencedComponentClass = defineAnalysisRule({
9016
9020
  import ts2 from "typescript";
9017
9021
 
9018
9022
  // src/solid/util/type-flags.ts
9019
- var TS_ANY_OR_UNKNOWN = 1 | 2;
9020
- var TS_BOOLEAN_LIKE = 528;
9021
- var TS_NUMBER_LIKE = 296;
9022
- var TS_STRING_LIKE = 402653316;
9023
- var TS_OBJECT_LIKE = 524288;
9024
9023
  function isBooleanType(solid, node) {
9025
9024
  const info = solid.typeResolver.getType(node);
9026
9025
  if (!info) return false;