tailwind-styled-v4 5.0.36 → 5.0.37
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/analyzer.d.mts +152 -5
- package/dist/analyzer.d.ts +152 -5
- package/dist/animate.d.mts +30 -3
- package/dist/animate.d.ts +30 -3
- package/dist/compiler.d.mts +5 -0
- package/dist/compiler.d.ts +5 -0
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs.map +1 -1
- package/dist/devtools.d.mts +88 -2
- package/dist/devtools.d.ts +88 -2
- package/dist/engine.d.mts +557 -6
- package/dist/engine.d.ts +557 -6
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs.map +1 -1
- package/dist/index.d.mts +236 -9
- package/dist/index.d.ts +236 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/next.js.map +1 -1
- package/dist/next.mjs.map +1 -1
- package/dist/plugin-api.d.mts +4 -2
- package/dist/plugin-api.d.ts +4 -2
- package/dist/plugin-registry.js +39 -25
- package/dist/plugin-registry.js.map +1 -1
- package/dist/plugin-registry.mjs +39 -25
- package/dist/plugin-registry.mjs.map +1 -1
- package/dist/plugin.d.mts +165 -5
- package/dist/plugin.d.ts +165 -5
- package/dist/plugin.js +17 -0
- package/dist/plugin.js.map +1 -1
- package/dist/plugin.mjs +15 -1
- package/dist/plugin.mjs.map +1 -1
- package/dist/runtime.d.mts +38 -3
- package/dist/runtime.d.ts +38 -3
- package/dist/scanner.d.mts +58 -4
- package/dist/scanner.d.ts +58 -4
- package/dist/shared.d.mts +185 -3
- package/dist/shared.d.ts +185 -3
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs.map +1 -1
- package/dist/storybook-addon.d.mts +2 -2
- package/dist/storybook-addon.d.ts +2 -2
- package/dist/svelte.d.mts +2 -1
- package/dist/svelte.d.ts +2 -1
- package/dist/theme.d.mts +38 -3
- package/dist/theme.d.ts +38 -3
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.d.mts +4 -1
- package/dist/vue.d.ts +4 -1
- package/native/tailwind-styled-native.linux-x64-gnu.node +0 -0
- package/native/tailwind-styled-native.node +0 -0
- package/package.json +1 -1
- package/dist/analyzeWorkspace-B1_XRfdl.d.ts +0 -134
- package/dist/analyzeWorkspace-hYfu4Hg3.d.mts +0 -134
- package/dist/index-DQI6O24n.d.mts +0 -464
- package/dist/index-NDINUhLN.d.mts +0 -90
- package/dist/index-NDINUhLN.d.ts +0 -90
- package/dist/index-UkYbyBkR.d.ts +0 -464
- package/dist/liveTokenEngine-CN9ian1R.d.ts +0 -38
- package/dist/liveTokenEngine-DKoWRtqH.d.mts +0 -38
- package/dist/schemas-DR-SLxZZ.d.mts +0 -59
- package/dist/schemas-DR-SLxZZ.d.ts +0 -59
- package/dist/trace-Dz4vmZdy.d.mts +0 -96
- package/dist/trace-Dz4vmZdy.d.ts +0 -96
- package/dist/types-DXr2PmGP.d.mts +0 -31
- package/dist/types-DXr2PmGP.d.ts +0 -31
package/dist/engine.d.ts
CHANGED
|
@@ -1,9 +1,407 @@
|
|
|
1
|
-
import { S as SourceLocation, R as RuleIR, a as RuleId, E as EnginePlugin } from './index-UkYbyBkR.js';
|
|
2
|
-
export { B as BuildResult, C as CascadeResolutionIR, b as CascadeResolutionId, c as CascadeResolver, d as CascadeStage, e as ConditionIR, f as ConditionId, g as ConditionResult, h as ConflictTrace, i as EngineMetricsCollector, j as EngineMetricsSnapshot, k as EngineOptions, l as EnginePluginContext, m as EngineWatchContext, n as EngineWatchEvent, o as EngineWatchOptions, F as FinalComputedStyleIR, p as FinalStyleProperty, I as Importance, q as InspectionReport, L as LayerId, O as Origin, P as PropertyBucketIR, r as PropertyId, s as ResolutionCause, t as ResolutionReason, u as RuleTrace, v as SelectorIR, w as SelectorId, x as StyleGraphIR, T as TailwindStyledEngine, y as TraceResult, V as ValueId, z as VariantChainIR, A as VariantChainId, D as VariantTrace, G as analyzeWorkspace, H as build, J as buildProvenanceChain, K as createEngine, M as createFingerprint, N as createResolutionReason, Q as generateSafelist, U as inspectClass, W as runAfterBuild, X as runAfterScan, Y as runAfterWatch, Z as runBeforeBuild, _ as runBeforeScan, $ as runBeforeWatch, a0 as runOnError, a1 as runTransformClasses, a2 as scanWorkspace, a3 as trace, a4 as traceClass, a5 as traceClasses } from './index-UkYbyBkR.js';
|
|
3
1
|
import { z } from 'zod';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
|
|
3
|
+
declare class RuleId {
|
|
4
|
+
readonly value: number;
|
|
5
|
+
constructor(value: number);
|
|
6
|
+
toString(): string;
|
|
7
|
+
}
|
|
8
|
+
declare class SelectorId {
|
|
9
|
+
readonly value: number;
|
|
10
|
+
constructor(value: number);
|
|
11
|
+
toString(): string;
|
|
12
|
+
}
|
|
13
|
+
declare class VariantChainId {
|
|
14
|
+
readonly value: number;
|
|
15
|
+
constructor(value: number);
|
|
16
|
+
toString(): string;
|
|
17
|
+
}
|
|
18
|
+
declare class PropertyId {
|
|
19
|
+
readonly value: number;
|
|
20
|
+
readonly name?: string | undefined;
|
|
21
|
+
constructor(value: number, name?: string | undefined);
|
|
22
|
+
toString(): string;
|
|
23
|
+
}
|
|
24
|
+
declare class ValueId {
|
|
25
|
+
readonly value: number;
|
|
26
|
+
readonly name?: string | undefined;
|
|
27
|
+
constructor(value: number, name?: string | undefined);
|
|
28
|
+
toString(): string;
|
|
29
|
+
}
|
|
30
|
+
declare class LayerId {
|
|
31
|
+
readonly value: number;
|
|
32
|
+
constructor(value: number);
|
|
33
|
+
toString(): string;
|
|
34
|
+
}
|
|
35
|
+
declare class ConditionId {
|
|
36
|
+
readonly value: number;
|
|
37
|
+
constructor(value: number);
|
|
38
|
+
toString(): string;
|
|
39
|
+
}
|
|
40
|
+
declare class CascadeResolutionId {
|
|
41
|
+
readonly value: number;
|
|
42
|
+
constructor(value: number);
|
|
43
|
+
toString(): string;
|
|
44
|
+
}
|
|
45
|
+
declare enum Origin {
|
|
46
|
+
UserAgent = 0,
|
|
47
|
+
UserNormal = 1,
|
|
48
|
+
AuthorNormal = 2,
|
|
49
|
+
AuthorImportant = 3,
|
|
50
|
+
UserImportant = 4
|
|
51
|
+
}
|
|
52
|
+
declare enum Importance {
|
|
53
|
+
Normal = 0,
|
|
54
|
+
Important = 1
|
|
55
|
+
}
|
|
56
|
+
declare enum ConditionResult {
|
|
57
|
+
Active = 0,
|
|
58
|
+
Inactive = 1,
|
|
59
|
+
Unknown = 2
|
|
60
|
+
}
|
|
61
|
+
declare enum CascadeStage {
|
|
62
|
+
Origin = 0,
|
|
63
|
+
Layer = 1,
|
|
64
|
+
Importance = 2,
|
|
65
|
+
Specificity = 3,
|
|
66
|
+
Order = 4
|
|
67
|
+
}
|
|
68
|
+
type ResolutionCause = {
|
|
69
|
+
type: "LowerOrigin";
|
|
70
|
+
winnerOrigin: Origin;
|
|
71
|
+
loserOrigin: Origin;
|
|
72
|
+
} | {
|
|
73
|
+
type: "LowerLayer";
|
|
74
|
+
winnerLayer: string;
|
|
75
|
+
loserLayer: string;
|
|
76
|
+
} | {
|
|
77
|
+
type: "LowerImportance";
|
|
78
|
+
} | {
|
|
79
|
+
type: "LowerSpecificity";
|
|
80
|
+
delta: number;
|
|
81
|
+
} | {
|
|
82
|
+
type: "EarlierOrder";
|
|
83
|
+
delta: number;
|
|
84
|
+
} | {
|
|
85
|
+
type: "InactiveCondition";
|
|
86
|
+
condition: string;
|
|
87
|
+
};
|
|
88
|
+
interface ResolutionReason {
|
|
89
|
+
causes: readonly ResolutionCause[];
|
|
90
|
+
finalDecision: string;
|
|
91
|
+
}
|
|
92
|
+
interface SelectorIR {
|
|
93
|
+
id: SelectorId;
|
|
94
|
+
normalized: string;
|
|
95
|
+
specificity: number;
|
|
96
|
+
parts: readonly string[];
|
|
97
|
+
}
|
|
98
|
+
interface VariantChainIR {
|
|
99
|
+
id: VariantChainId;
|
|
100
|
+
chain: readonly VariantChainId[];
|
|
101
|
+
conditionGraphId: number | null;
|
|
102
|
+
}
|
|
103
|
+
interface ConditionIR {
|
|
104
|
+
id: ConditionId;
|
|
105
|
+
conditionType: string;
|
|
106
|
+
expression: string;
|
|
107
|
+
}
|
|
108
|
+
interface RuleIR {
|
|
109
|
+
id: RuleId;
|
|
110
|
+
selector: SelectorId;
|
|
111
|
+
variantChain: VariantChainId;
|
|
112
|
+
property: PropertyId;
|
|
113
|
+
value: ValueId;
|
|
114
|
+
origin: Origin;
|
|
115
|
+
importance: Importance;
|
|
116
|
+
layer: LayerId | null;
|
|
117
|
+
layerOrder: number;
|
|
118
|
+
specificity: number;
|
|
119
|
+
condition: ConditionId | null;
|
|
120
|
+
conditionResult: ConditionResult;
|
|
121
|
+
insertionOrder: number;
|
|
122
|
+
fingerprint: string;
|
|
123
|
+
source: SourceLocation;
|
|
124
|
+
}
|
|
125
|
+
interface PropertyBucketIR {
|
|
126
|
+
property: PropertyId;
|
|
127
|
+
rules: readonly RuleId[];
|
|
128
|
+
}
|
|
129
|
+
interface CascadeResolutionIR {
|
|
130
|
+
id: CascadeResolutionId;
|
|
131
|
+
property: PropertyId;
|
|
132
|
+
winner: RuleId;
|
|
133
|
+
losers: readonly RuleId[];
|
|
134
|
+
reason: ResolutionReason;
|
|
135
|
+
stage: CascadeStage;
|
|
136
|
+
}
|
|
137
|
+
interface StyleGraphIR {
|
|
138
|
+
ruleConflicts: Map<RuleId, readonly RuleId[]>;
|
|
139
|
+
}
|
|
140
|
+
interface FinalComputedStyleIR {
|
|
141
|
+
className: string;
|
|
142
|
+
resolvedProperties: Map<PropertyId, CascadeResolutionId>;
|
|
143
|
+
}
|
|
144
|
+
interface SourceLocation {
|
|
145
|
+
file: string;
|
|
146
|
+
line: number;
|
|
147
|
+
column: number;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Generate a short fingerprint string from a list of ordered parts.
|
|
151
|
+
* Native-only: delegates to Rust `create_fingerprint()` (FNV-1a, base-36 output).
|
|
152
|
+
*/
|
|
153
|
+
declare function createFingerprint(parts: string[]): string;
|
|
154
|
+
declare function createResolutionReason(causes: ResolutionCause[], finalDecision: string): ResolutionReason;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* tailwind-styled-v4 — Cascade Resolver
|
|
158
|
+
*
|
|
159
|
+
* JS layer: state management (rule collection, class registration).
|
|
160
|
+
* Rust layer: cascade algorithm (sort, compare, resolve winner/loser).
|
|
161
|
+
*
|
|
162
|
+
* Moved to native: compareCascade, resolveProperty, buildResolutionReason,
|
|
163
|
+
* determineCascadeStage — all pure computation, zero browser API.
|
|
164
|
+
*
|
|
165
|
+
* Rust #[napi] fn: resolve_cascade(rules_json: String) -> String
|
|
166
|
+
*/
|
|
167
|
+
|
|
168
|
+
declare class CascadeResolver {
|
|
169
|
+
private readonly rules;
|
|
170
|
+
private readonly classRules;
|
|
171
|
+
private readonly styleGraph;
|
|
172
|
+
addRule(rule: RuleIR): void;
|
|
173
|
+
addRules(rules: RuleIR[]): void;
|
|
174
|
+
registerClass(className: string, ruleIds: RuleId[]): void;
|
|
175
|
+
getRule(ruleId: RuleId): RuleIR | undefined;
|
|
176
|
+
getClassRules(className: string): RuleId[] | undefined;
|
|
177
|
+
getStyleGraph(): StyleGraphIR;
|
|
178
|
+
/**
|
|
179
|
+
* Resolve cascade for a specific class.
|
|
180
|
+
* Delegates sort + winner selection to Rust.
|
|
181
|
+
*/
|
|
182
|
+
resolveByClassName(className: string): {
|
|
183
|
+
resolvedProperties: Map<PropertyId, CascadeResolutionIR>;
|
|
184
|
+
} | null;
|
|
185
|
+
/**
|
|
186
|
+
* Resolve cascade for all rules.
|
|
187
|
+
* Delegates sort + winner selection to Rust.
|
|
188
|
+
*/
|
|
189
|
+
resolveAllProperties(): Map<PropertyId, CascadeResolutionIR>;
|
|
190
|
+
/**
|
|
191
|
+
* Resolve cascade for a specific set of rule IDs.
|
|
192
|
+
*/
|
|
193
|
+
resolveForClass(classRuleIds: RuleId[]): Map<PropertyId, CascadeResolutionIR>;
|
|
194
|
+
/**
|
|
195
|
+
* Resolve cascade for a single property bucket.
|
|
196
|
+
*/
|
|
197
|
+
resolveProperty(property: PropertyId): CascadeResolutionIR | null;
|
|
198
|
+
getResolution(_id: CascadeResolutionId): CascadeResolutionIR | undefined;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* tailwind-styled-v4 — Cascade Tracer
|
|
203
|
+
*
|
|
204
|
+
* Delegates cascade resolution to CascadeResolver (Rust-backed).
|
|
205
|
+
* JS layer: format trace output only.
|
|
206
|
+
*
|
|
207
|
+
* Removed from JS: resolvePropertyTraced, compareCascadeTraced,
|
|
208
|
+
* buildResolutionReasonTraced, determineCascadeStageTraced.
|
|
209
|
+
*/
|
|
210
|
+
|
|
211
|
+
interface VariantTrace {
|
|
212
|
+
name: string;
|
|
213
|
+
value: string;
|
|
214
|
+
source: SourceLocation;
|
|
215
|
+
}
|
|
216
|
+
interface RuleTrace {
|
|
217
|
+
property: string;
|
|
218
|
+
value: string;
|
|
219
|
+
applied: boolean;
|
|
220
|
+
reason: string | null;
|
|
221
|
+
source: SourceLocation;
|
|
222
|
+
specificity: number;
|
|
223
|
+
}
|
|
224
|
+
interface ConflictTrace {
|
|
225
|
+
property: string;
|
|
226
|
+
winner: string;
|
|
227
|
+
loser: string;
|
|
228
|
+
stage: string;
|
|
229
|
+
causes: string[];
|
|
230
|
+
}
|
|
231
|
+
interface FinalStyleProperty {
|
|
232
|
+
property: string;
|
|
233
|
+
value: string;
|
|
234
|
+
}
|
|
235
|
+
interface TraceResult {
|
|
236
|
+
class: string;
|
|
237
|
+
definedAt: SourceLocation;
|
|
238
|
+
variants: VariantTrace[];
|
|
239
|
+
rules: RuleTrace[];
|
|
240
|
+
conflicts: ConflictTrace[];
|
|
241
|
+
finalStyle: FinalStyleProperty[];
|
|
242
|
+
}
|
|
243
|
+
interface ProvenanceData {
|
|
244
|
+
className: string;
|
|
245
|
+
source: SourceLocation;
|
|
246
|
+
variants: Map<string, VariantTrace>;
|
|
247
|
+
rules: Map<string, RuleIR[]>;
|
|
248
|
+
}
|
|
249
|
+
declare function buildProvenanceChain(className: string): ProvenanceData;
|
|
250
|
+
declare function trace(className: string, resolver: CascadeResolver): TraceResult;
|
|
251
|
+
|
|
252
|
+
declare const ScanWorkspaceOptionsSchema: z.ZodObject<{
|
|
253
|
+
includeExtensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
254
|
+
ignoreDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
255
|
+
useCache: z.ZodOptional<z.ZodBoolean>;
|
|
256
|
+
cacheDir: z.ZodOptional<z.ZodString>;
|
|
257
|
+
smartInvalidation: z.ZodOptional<z.ZodBoolean>;
|
|
258
|
+
}, z.core.$strip>;
|
|
259
|
+
type ScanWorkspaceOptions = z.infer<typeof ScanWorkspaceOptionsSchema>;
|
|
260
|
+
declare const ScanFileResultSchema: z.ZodObject<{
|
|
261
|
+
file: z.ZodString;
|
|
262
|
+
classes: z.ZodArray<z.ZodString>;
|
|
263
|
+
hash: z.ZodOptional<z.ZodString>;
|
|
264
|
+
}, z.core.$strip>;
|
|
265
|
+
type ScanFileResult = z.infer<typeof ScanFileResultSchema>;
|
|
266
|
+
declare const ScanWorkspaceResultSchema: z.ZodObject<{
|
|
267
|
+
files: z.ZodArray<z.ZodObject<{
|
|
268
|
+
file: z.ZodString;
|
|
269
|
+
classes: z.ZodArray<z.ZodString>;
|
|
270
|
+
hash: z.ZodOptional<z.ZodString>;
|
|
271
|
+
}, z.core.$strip>>;
|
|
272
|
+
totalFiles: z.ZodNumber;
|
|
273
|
+
uniqueClasses: z.ZodArray<z.ZodString>;
|
|
274
|
+
}, z.core.$strip>;
|
|
275
|
+
type ScanWorkspaceResult = z.infer<typeof ScanWorkspaceResultSchema>;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Public type contracts for @tailwind-styled/analyzer.
|
|
279
|
+
* Keep this file aligned with the runtime report shape exposed by src/index.ts.
|
|
280
|
+
*/
|
|
281
|
+
|
|
282
|
+
interface ClassUsage$1 {
|
|
283
|
+
readonly name: string;
|
|
284
|
+
readonly count: number;
|
|
285
|
+
readonly isUnused?: boolean;
|
|
286
|
+
readonly isConflict?: boolean;
|
|
287
|
+
}
|
|
288
|
+
interface ClassConflict {
|
|
289
|
+
readonly className: string;
|
|
290
|
+
readonly variants: readonly string[];
|
|
291
|
+
readonly classes: readonly string[];
|
|
292
|
+
readonly message: string;
|
|
293
|
+
}
|
|
294
|
+
interface AnalyzerClassStats {
|
|
295
|
+
readonly all: readonly ClassUsage$1[];
|
|
296
|
+
readonly top: readonly ClassUsage$1[];
|
|
297
|
+
readonly frequent: readonly ClassUsage$1[];
|
|
298
|
+
readonly unique: readonly ClassUsage$1[];
|
|
299
|
+
readonly distribution: Readonly<Record<string, number>>;
|
|
300
|
+
}
|
|
301
|
+
interface TailwindConfigSummary {
|
|
302
|
+
readonly path: string;
|
|
303
|
+
readonly loaded: boolean;
|
|
304
|
+
readonly safelistCount: number;
|
|
305
|
+
readonly customUtilityCount: number;
|
|
306
|
+
readonly warning?: string;
|
|
307
|
+
}
|
|
308
|
+
interface AnalyzerSemanticReport {
|
|
309
|
+
readonly unusedClasses: readonly ClassUsage$1[];
|
|
310
|
+
readonly unknownClasses: readonly ClassUsage$1[];
|
|
311
|
+
readonly conflicts: readonly ClassConflict[];
|
|
312
|
+
readonly tailwindConfig?: TailwindConfigSummary;
|
|
313
|
+
}
|
|
314
|
+
interface AnalyzerReport {
|
|
315
|
+
readonly root: string;
|
|
316
|
+
readonly totalFiles: number;
|
|
317
|
+
readonly uniqueClassCount: number;
|
|
318
|
+
readonly totalClassOccurrences: number;
|
|
319
|
+
readonly classStats: AnalyzerClassStats;
|
|
320
|
+
/** Alias for classStats.top — backward compat & test contract */
|
|
321
|
+
readonly topClasses: readonly ClassUsage$1[];
|
|
322
|
+
readonly safelist: readonly string[];
|
|
323
|
+
readonly semantic?: AnalyzerSemanticReport;
|
|
324
|
+
}
|
|
325
|
+
interface AnalyzerOptions {
|
|
326
|
+
readonly scanner?: ScanWorkspaceOptions;
|
|
327
|
+
readonly classStats?: {
|
|
328
|
+
readonly top?: number;
|
|
329
|
+
readonly frequentThreshold?: number;
|
|
330
|
+
};
|
|
331
|
+
readonly includeClass?: (className: string) => boolean;
|
|
332
|
+
readonly semantic?: boolean | {
|
|
333
|
+
readonly tailwindConfigPath?: string;
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Analyze Tailwind class usage in a workspace and return usage statistics.
|
|
339
|
+
* Set `semantic.tailwindConfigPath` to override Tailwind config lookup.
|
|
340
|
+
* @example
|
|
341
|
+
* const report = await analyzeWorkspace("./src", {
|
|
342
|
+
* classStats: { top: 20, frequentThreshold: 2 },
|
|
343
|
+
* semantic: { tailwindConfigPath: "tailwind.config.js" },
|
|
344
|
+
* })
|
|
345
|
+
*/
|
|
346
|
+
declare function analyzeWorkspace$1(root: string, options?: AnalyzerOptions): Promise<AnalyzerReport>;
|
|
347
|
+
|
|
348
|
+
interface EngineMetricsSnapshot {
|
|
349
|
+
eventsReceived: number;
|
|
350
|
+
eventsProcessed: number;
|
|
351
|
+
batchesProcessed: number;
|
|
352
|
+
incrementalUpdates: number;
|
|
353
|
+
fullRescans: number;
|
|
354
|
+
skippedLargeFiles: number;
|
|
355
|
+
queueMaxSize: number;
|
|
356
|
+
lastBuildMs: number;
|
|
357
|
+
avgBuildMs: number;
|
|
358
|
+
}
|
|
359
|
+
declare class EngineMetricsCollector {
|
|
360
|
+
private eventsReceived;
|
|
361
|
+
private eventsProcessed;
|
|
362
|
+
private batchesProcessed;
|
|
363
|
+
private incrementalUpdates;
|
|
364
|
+
private fullRescans;
|
|
365
|
+
private skippedLargeFiles;
|
|
366
|
+
private queueMaxSize;
|
|
367
|
+
private lastBuildMs;
|
|
368
|
+
private totalBuildMs;
|
|
369
|
+
markEventReceived(queueSize: number): void;
|
|
370
|
+
markBatchProcessed(batchSize: number): void;
|
|
371
|
+
markIncremental(): void;
|
|
372
|
+
markFullRescan(): void;
|
|
373
|
+
markSkippedLargeFile(): void;
|
|
374
|
+
markBuildDuration(ms: number): void;
|
|
375
|
+
snapshot(): EngineMetricsSnapshot;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
interface EnginePluginContext {
|
|
379
|
+
root: string;
|
|
380
|
+
timestamp: number;
|
|
381
|
+
}
|
|
382
|
+
interface EngineWatchContext {
|
|
383
|
+
root: string;
|
|
384
|
+
timestamp: number;
|
|
385
|
+
}
|
|
386
|
+
interface EnginePlugin {
|
|
387
|
+
name: string;
|
|
388
|
+
beforeScan?(context: EnginePluginContext): void | Promise<void>;
|
|
389
|
+
afterScan?(scan: ScanWorkspaceResult, context: EnginePluginContext): ScanWorkspaceResult | undefined | Promise<ScanWorkspaceResult | undefined>;
|
|
390
|
+
transformClasses?(classes: string[], context: EnginePluginContext): string[] | undefined | Promise<string[] | undefined>;
|
|
391
|
+
beforeBuild?(scan: ScanWorkspaceResult, context: EnginePluginContext): void | Promise<void>;
|
|
392
|
+
afterBuild?(result: BuildResult, context: EnginePluginContext): BuildResult | undefined | Promise<BuildResult | undefined>;
|
|
393
|
+
onError?(error: Error, context: EnginePluginContext): void | Promise<void>;
|
|
394
|
+
beforeWatch?(context: EngineWatchContext): void | Promise<void>;
|
|
395
|
+
afterWatch?(context: EngineWatchContext): void | Promise<void>;
|
|
396
|
+
}
|
|
397
|
+
declare function runBeforeScan(plugins: EnginePlugin[], context: EnginePluginContext): Promise<void>;
|
|
398
|
+
declare function runAfterScan(plugins: EnginePlugin[], scan: ScanWorkspaceResult, context: EnginePluginContext): Promise<ScanWorkspaceResult>;
|
|
399
|
+
declare function runTransformClasses(plugins: EnginePlugin[], classes: string[], context: EnginePluginContext): Promise<string[]>;
|
|
400
|
+
declare function runBeforeBuild(plugins: EnginePlugin[], scan: ScanWorkspaceResult, context: EnginePluginContext): Promise<void>;
|
|
401
|
+
declare function runAfterBuild(plugins: EnginePlugin[], result: BuildResult, context: EnginePluginContext): Promise<BuildResult>;
|
|
402
|
+
declare function runOnError(plugins: EnginePlugin[], error: Error, context: EnginePluginContext): Promise<void>;
|
|
403
|
+
declare function runBeforeWatch(plugins: EnginePlugin[], context: EngineWatchContext): Promise<void>;
|
|
404
|
+
declare function runAfterWatch(plugins: EnginePlugin[], context: EngineWatchContext): Promise<void>;
|
|
7
405
|
|
|
8
406
|
interface ClassBundleInfo {
|
|
9
407
|
className: string;
|
|
@@ -274,4 +672,157 @@ declare const parseEngineWatchOptions: (options: unknown) => {
|
|
|
274
672
|
largeFileThreshold?: number | undefined;
|
|
275
673
|
};
|
|
276
674
|
|
|
277
|
-
|
|
675
|
+
interface EngineOptions {
|
|
676
|
+
root?: string;
|
|
677
|
+
scanner?: ScanWorkspaceOptions;
|
|
678
|
+
compileCss?: boolean;
|
|
679
|
+
tailwindConfigPath?: string;
|
|
680
|
+
plugins?: EnginePlugin[];
|
|
681
|
+
/** Enable analyzer integration - provides semantic report (unused classes, conflicts). Default: false */
|
|
682
|
+
analyze?: boolean;
|
|
683
|
+
}
|
|
684
|
+
interface EngineWatchOptions {
|
|
685
|
+
debounceMs?: number;
|
|
686
|
+
maxEventsPerFlush?: number;
|
|
687
|
+
largeFileThreshold?: number;
|
|
688
|
+
}
|
|
689
|
+
interface BuildResult {
|
|
690
|
+
scan: ScanWorkspaceResult;
|
|
691
|
+
mergedClassList: string;
|
|
692
|
+
css: string;
|
|
693
|
+
/** Analyzer semantic report - present when analyze: true in options */
|
|
694
|
+
analysis?: {
|
|
695
|
+
unusedClasses: string[];
|
|
696
|
+
classConflicts: Array<{
|
|
697
|
+
className: string;
|
|
698
|
+
files: string[];
|
|
699
|
+
classes?: string[];
|
|
700
|
+
message?: string;
|
|
701
|
+
}>;
|
|
702
|
+
classUsage: Record<string, number>;
|
|
703
|
+
semantic?: AnalyzerSemanticReport;
|
|
704
|
+
report: AnalyzerReport;
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
type EngineBuildWatchEventType = "initial" | "change" | "unlink" | "full-rescan";
|
|
708
|
+
type EngineWatchEvent = {
|
|
709
|
+
type: EngineBuildWatchEventType;
|
|
710
|
+
filePath?: string;
|
|
711
|
+
result: BuildResult;
|
|
712
|
+
metrics?: EngineMetricsSnapshot;
|
|
713
|
+
} | {
|
|
714
|
+
type: "error";
|
|
715
|
+
filePath?: string;
|
|
716
|
+
error: string;
|
|
717
|
+
metrics?: EngineMetricsSnapshot;
|
|
718
|
+
};
|
|
719
|
+
interface TailwindStyledEngine {
|
|
720
|
+
scan(): Promise<ScanWorkspaceResult>;
|
|
721
|
+
scanWorkspace(): Promise<ScanWorkspaceResult>;
|
|
722
|
+
analyzeWorkspace(): Promise<Awaited<ReturnType<typeof analyzeWorkspace$1>>>;
|
|
723
|
+
generateSafelist(): Promise<string[]>;
|
|
724
|
+
build(): Promise<BuildResult>;
|
|
725
|
+
watch(onEvent: (event: EngineWatchEvent) => void, options?: EngineWatchOptions): Promise<{
|
|
726
|
+
close(): void;
|
|
727
|
+
}>;
|
|
728
|
+
}
|
|
729
|
+
declare function createEngine(rawOptions?: EngineOptions): Promise<TailwindStyledEngine>;
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* Scan workspace dan return hasil scan.
|
|
733
|
+
* Facade tipis di atas scanWorkspaceAsync dari @tailwind-styled/scanner.
|
|
734
|
+
*
|
|
735
|
+
* @example
|
|
736
|
+
* const result = await scanWorkspace({ root: "./src" })
|
|
737
|
+
* console.log(result.uniqueClasses)
|
|
738
|
+
*/
|
|
739
|
+
declare function scanWorkspace(opts?: {
|
|
740
|
+
root?: string;
|
|
741
|
+
extensions?: string[];
|
|
742
|
+
ignoreDirectories?: string[];
|
|
743
|
+
}): Promise<ScanWorkspaceResult>;
|
|
744
|
+
/**
|
|
745
|
+
* Analyze workspace — scan + analyze classes.
|
|
746
|
+
* Facade di atas runWorkspaceAnalysis.
|
|
747
|
+
*
|
|
748
|
+
* @example
|
|
749
|
+
* const report = await analyzeWorkspace({ root: "./src" })
|
|
750
|
+
* console.log(report.topClasses)
|
|
751
|
+
*/
|
|
752
|
+
declare function analyzeWorkspace(opts?: {
|
|
753
|
+
root?: string;
|
|
754
|
+
top?: number;
|
|
755
|
+
}): Promise<Awaited<ReturnType<typeof analyzeWorkspace$1>>>;
|
|
756
|
+
/**
|
|
757
|
+
* Generate safelist dari scan result.
|
|
758
|
+
* Berguna untuk Tailwind config safelist generation.
|
|
759
|
+
*
|
|
760
|
+
* @example
|
|
761
|
+
* const safelist = await generateSafelist({ root: "./src" })
|
|
762
|
+
* // Pakai di tailwind.config.ts: { safelist }
|
|
763
|
+
*/
|
|
764
|
+
declare function generateSafelist(opts?: {
|
|
765
|
+
root?: string;
|
|
766
|
+
}): Promise<string[]>;
|
|
767
|
+
/**
|
|
768
|
+
* Build CSS dari scan result.
|
|
769
|
+
* One-shot build tanpa watch mode.
|
|
770
|
+
*
|
|
771
|
+
* @example
|
|
772
|
+
* const result = await build({ root: "./src" })
|
|
773
|
+
* fs.writeFileSync("dist/tailwind.css", result.css)
|
|
774
|
+
*/
|
|
775
|
+
declare function build(opts?: EngineOptions): Promise<{
|
|
776
|
+
css: string;
|
|
777
|
+
classes: string[];
|
|
778
|
+
totalFiles: number;
|
|
779
|
+
}>;
|
|
780
|
+
|
|
781
|
+
/**
|
|
782
|
+
* High-level trace API — satu entry point untuk semua tooling.
|
|
783
|
+
*
|
|
784
|
+
* Dipakai oleh:
|
|
785
|
+
* - CLI: `tw trace <class>`
|
|
786
|
+
* - DevTools: TracePanel fetch
|
|
787
|
+
* - Dashboard: trace endpoint
|
|
788
|
+
*
|
|
789
|
+
* @example
|
|
790
|
+
* const result = await traceClass("flex", scanResult, cssString)
|
|
791
|
+
* console.log(result.finalStyle) // [{ property: "display", value: "flex" }]
|
|
792
|
+
*/
|
|
793
|
+
declare function traceClass(className: string, scanResult: ScanWorkspaceResult, css: string): Promise<TraceResult | null>;
|
|
794
|
+
/**
|
|
795
|
+
* Trace multiple classes at once — for batch inspection.
|
|
796
|
+
*/
|
|
797
|
+
declare function traceClasses(classNames: string[], scanResult: ScanWorkspaceResult, css: string): Promise<Map<string, TraceResult>>;
|
|
798
|
+
interface InspectionReport {
|
|
799
|
+
className: string;
|
|
800
|
+
/** CSS rules yang dihasilkan */
|
|
801
|
+
css: string;
|
|
802
|
+
/** Properties yang di-set */
|
|
803
|
+
properties: Array<{
|
|
804
|
+
property: string;
|
|
805
|
+
value: string;
|
|
806
|
+
}>;
|
|
807
|
+
/** Classes yang berkonflik dengan ini */
|
|
808
|
+
conflicts: string[];
|
|
809
|
+
/** Files yang menggunakan class ini */
|
|
810
|
+
usedIn: string[];
|
|
811
|
+
/** Risk level untuk removal */
|
|
812
|
+
risk: "low" | "medium" | "high";
|
|
813
|
+
/** Estimated bundle contribution */
|
|
814
|
+
bundleBytes: number;
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Inspect a single class — gabungan trace + impact + usage.
|
|
818
|
+
* Reusable surface untuk CLI (`tw why`), DevTools panel, dashboard endpoint.
|
|
819
|
+
*
|
|
820
|
+
* @example
|
|
821
|
+
* const report = await inspectClass("flex", scanResult, cssString)
|
|
822
|
+
* console.log(report.properties) // [{ property: "display", value: "flex" }]
|
|
823
|
+
* console.log(report.usedIn) // ["src/Button.tsx", "src/Card.tsx"]
|
|
824
|
+
* console.log(report.risk) // "low"
|
|
825
|
+
*/
|
|
826
|
+
declare function inspectClass(className: string, scanResult: ScanWorkspaceResult, css?: string): Promise<InspectionReport>;
|
|
827
|
+
|
|
828
|
+
export { type BuildResult, type BuildResultInput, BuildResultSchema, type BundleAnalysisResult, BundleAnalyzer, type CascadeResolutionIR, CascadeResolutionId, CascadeResolver, CascadeStage, type ClassBundleInfo, type ClassUsage, type ComponentImpact, type ConditionIR, ConditionId, ConditionResult, type ConflictTrace, EngineMetricsCollector, type EngineMetricsSnapshot, type EngineOptions, type EngineOptionsInput, EngineOptionsSchema, type EnginePlugin, type EnginePluginContext, type EngineWatchContext, type EngineWatchEvent, type EngineWatchOptions, type EngineWatchOptionsInput, EngineWatchOptionsSchema, type FinalComputedStyleIR, type FinalStyleProperty, type ImpactReport, ImpactTracker, Importance, type InspectionReport, LayerId, Origin, type PropertyBucketIR, PropertyId, type ResolutionCause, type ResolutionReason, ReverseLookup, type ReverseLookupResult, type RuleIR, RuleId, type RuleTrace, type ScanFileResult, type ScanWorkspaceOptions, type ScanWorkspaceResult, type SelectorIR, SelectorId, type SourceLocation, type StyleGraphIR, type TailwindStyledEngine, type TraceResult, ValueId, type VariantChainIR, VariantChainId, type VariantTrace, type WatchCallback, type WatchEvent, type WatchEventKind, type WatchHandle, type WorkspaceWatcher, analyzeWorkspace, applyIncrementalChange, build, buildProvenanceChain, createEngine, createFingerprint, createResolutionReason, generateSafelist, inspectClass, parseCssToIr, parseEngineOptions, parseEngineWatchOptions, runAfterBuild, runAfterScan, runAfterWatch, runBeforeBuild, runBeforeScan, runBeforeWatch, runOnError, runTransformClasses, scanWorkspace, trace, traceClass, traceClasses, watchWorkspace$1 as watchWorkspaceLegacy, watchWorkspace as watchWorkspaceNative };
|