@c4a/extract-style 0.7.10-alpha.1 → 0.7.10

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.
Files changed (2) hide show
  1. package/index.d.ts +584 -0
  2. package/package.json +5 -3
package/index.d.ts ADDED
@@ -0,0 +1,584 @@
1
+ import { z } from 'zod';
2
+
3
+ export interface StyleLocator {
4
+ path: string;
5
+ line: number;
6
+ end_line?: number;
7
+ column: number;
8
+ qualified_item_path: string;
9
+ }
10
+ export interface StyleImport {
11
+ import_ref: string;
12
+ kind: "import" | "use" | "forward";
13
+ specifier: string | null;
14
+ specifier_digest: string;
15
+ resolution: "registered" | "external" | "builtin" | "package-or-load-path" | "unresolved";
16
+ resolved_path: string | null;
17
+ locator: StyleLocator;
18
+ }
19
+ export interface StyleToken {
20
+ token_ref: string;
21
+ name: string;
22
+ syntax: "custom-property" | "scss-variable" | "property-rule";
23
+ configurable: boolean;
24
+ value_digest: string | null;
25
+ locator: StyleLocator;
26
+ }
27
+ export interface StyleTokenReference {
28
+ reference_ref: string;
29
+ name: string;
30
+ owner_qualified_item_path: string;
31
+ locator: StyleLocator;
32
+ }
33
+ export interface StyleSelector {
34
+ selector_ref: string;
35
+ selector_digest: string;
36
+ class_names: string[];
37
+ id_names: string[];
38
+ type_names: string[];
39
+ pseudo_classes: string[];
40
+ attribute_names: string[];
41
+ locator: StyleLocator;
42
+ }
43
+ export interface StyleVariantState {
44
+ evidence_ref: string;
45
+ selector_ref: string;
46
+ evidence_kind: "pseudo-class" | "state-attribute" | "class-modifier";
47
+ name: string;
48
+ locator: StyleLocator;
49
+ }
50
+ export interface StyleComponentCandidate {
51
+ candidate_ref: string;
52
+ name: string;
53
+ basis: "module-file" | "class-root";
54
+ selector_ref: string | null;
55
+ locator: StyleLocator;
56
+ }
57
+ export interface StyleDiagnostic {
58
+ code: "style-import-dynamic-unsupported" | "style-import-unresolved" | "style-selector-dynamic-identity-omitted" | "style-selector-unsupported" | "style-source-unsupported";
59
+ severity: "warning" | "error";
60
+ locator: StyleLocator;
61
+ detail: string;
62
+ }
63
+ export interface StyleDocumentCatalog {
64
+ path: string;
65
+ lines?: number;
66
+ syntax: "css" | "scss" | "excluded";
67
+ disposition: "analyzed" | "unsupported" | "excluded";
68
+ imports: StyleImport[];
69
+ tokens: StyleToken[];
70
+ token_references: StyleTokenReference[];
71
+ selectors: StyleSelector[];
72
+ variants_and_states: StyleVariantState[];
73
+ component_candidates: StyleComponentCandidate[];
74
+ diagnostics: StyleDiagnostic[];
75
+ }
76
+ /** Parses only caller-registered CSS/SCSS sources without compiling them. */
77
+ export declare function parseStyleSources(files: Readonly<Record<string, string>>): StyleDocumentCatalog[];
78
+ declare const indexerEvidenceAdapterResultSchema: z.ZodEffects<z.ZodObject<{
79
+ protocol: z.ZodLiteral<"context.indexer.evidence-adapter-result/v1">;
80
+ adapter: z.ZodObject<{
81
+ id: z.ZodEffects<z.ZodString, string, string>;
82
+ package: z.ZodString;
83
+ export: z.ZodString;
84
+ version: z.ZodString;
85
+ digest: z.ZodString;
86
+ }, "strict", z.ZodTypeAny, {
87
+ package: string;
88
+ id: string;
89
+ version: string;
90
+ digest: string;
91
+ export: string;
92
+ }, {
93
+ package: string;
94
+ id: string;
95
+ version: string;
96
+ digest: string;
97
+ export: string;
98
+ }>;
99
+ authorized_scope: z.ZodObject<{
100
+ source_ref: z.ZodString;
101
+ module_refs: z.ZodArray<z.ZodString, "many">;
102
+ scope_digest: z.ZodString;
103
+ }, "strict", z.ZodTypeAny, {
104
+ source_ref: string;
105
+ module_refs: string[];
106
+ scope_digest: string;
107
+ }, {
108
+ source_ref: string;
109
+ module_refs: string[];
110
+ scope_digest: string;
111
+ }>;
112
+ input_digest: z.ZodString;
113
+ precedence: z.ZodNumber;
114
+ files: z.ZodArray<z.ZodEffects<z.ZodObject<{
115
+ file_ref: z.ZodString;
116
+ source_ref: z.ZodString;
117
+ module_ref: z.ZodNullable<z.ZodString>;
118
+ normalized_path: z.ZodEffects<z.ZodString, string, string>;
119
+ role: z.ZodEnum<[
120
+ "primary-owner",
121
+ "enricher"
122
+ ]>;
123
+ coverage_tier: z.ZodEnum<[
124
+ "ast-catalog",
125
+ "lightweight-evidence"
126
+ ]>;
127
+ disposition: z.ZodEnum<[
128
+ "analyzed",
129
+ "unsupported",
130
+ "excluded"
131
+ ]>;
132
+ facts: z.ZodArray<z.ZodObject<{
133
+ fact_ref: z.ZodString;
134
+ kind: z.ZodEffects<z.ZodString, string, string>;
135
+ locator: z.ZodObject<{
136
+ source_ref: z.ZodString;
137
+ module_ref: z.ZodNullable<z.ZodString>;
138
+ normalized_path: z.ZodEffects<z.ZodString, string, string>;
139
+ qualified_item_path: z.ZodString;
140
+ signature_digest: z.ZodString;
141
+ }, "strict", z.ZodTypeAny, {
142
+ source_ref: string;
143
+ module_ref: string | null;
144
+ normalized_path: string;
145
+ qualified_item_path: string;
146
+ signature_digest: string;
147
+ }, {
148
+ source_ref: string;
149
+ module_ref: string | null;
150
+ normalized_path: string;
151
+ qualified_item_path: string;
152
+ signature_digest: string;
153
+ }>;
154
+ payload_digest: z.ZodString;
155
+ denominator: z.ZodEnum<[
156
+ "none",
157
+ "eligible-file",
158
+ "loc",
159
+ "symbol",
160
+ "protocol-item"
161
+ ]>;
162
+ }, "strict", z.ZodTypeAny, {
163
+ kind: string;
164
+ fact_ref: string;
165
+ locator: {
166
+ source_ref: string;
167
+ module_ref: string | null;
168
+ normalized_path: string;
169
+ qualified_item_path: string;
170
+ signature_digest: string;
171
+ };
172
+ payload_digest: string;
173
+ denominator: "symbol" | "none" | "eligible-file" | "loc" | "protocol-item";
174
+ }, {
175
+ kind: string;
176
+ fact_ref: string;
177
+ locator: {
178
+ source_ref: string;
179
+ module_ref: string | null;
180
+ normalized_path: string;
181
+ qualified_item_path: string;
182
+ signature_digest: string;
183
+ };
184
+ payload_digest: string;
185
+ denominator: "symbol" | "none" | "eligible-file" | "loc" | "protocol-item";
186
+ }>, "many">;
187
+ }, "strict", z.ZodTypeAny, {
188
+ source_ref: string;
189
+ module_ref: string | null;
190
+ normalized_path: string;
191
+ file_ref: string;
192
+ role: "primary-owner" | "enricher";
193
+ coverage_tier: "ast-catalog" | "lightweight-evidence";
194
+ disposition: "analyzed" | "unsupported" | "excluded";
195
+ facts: {
196
+ kind: string;
197
+ fact_ref: string;
198
+ locator: {
199
+ source_ref: string;
200
+ module_ref: string | null;
201
+ normalized_path: string;
202
+ qualified_item_path: string;
203
+ signature_digest: string;
204
+ };
205
+ payload_digest: string;
206
+ denominator: "symbol" | "none" | "eligible-file" | "loc" | "protocol-item";
207
+ }[];
208
+ }, {
209
+ source_ref: string;
210
+ module_ref: string | null;
211
+ normalized_path: string;
212
+ file_ref: string;
213
+ role: "primary-owner" | "enricher";
214
+ coverage_tier: "ast-catalog" | "lightweight-evidence";
215
+ disposition: "analyzed" | "unsupported" | "excluded";
216
+ facts: {
217
+ kind: string;
218
+ fact_ref: string;
219
+ locator: {
220
+ source_ref: string;
221
+ module_ref: string | null;
222
+ normalized_path: string;
223
+ qualified_item_path: string;
224
+ signature_digest: string;
225
+ };
226
+ payload_digest: string;
227
+ denominator: "symbol" | "none" | "eligible-file" | "loc" | "protocol-item";
228
+ }[];
229
+ }>, {
230
+ source_ref: string;
231
+ module_ref: string | null;
232
+ normalized_path: string;
233
+ file_ref: string;
234
+ role: "primary-owner" | "enricher";
235
+ coverage_tier: "ast-catalog" | "lightweight-evidence";
236
+ disposition: "analyzed" | "unsupported" | "excluded";
237
+ facts: {
238
+ kind: string;
239
+ fact_ref: string;
240
+ locator: {
241
+ source_ref: string;
242
+ module_ref: string | null;
243
+ normalized_path: string;
244
+ qualified_item_path: string;
245
+ signature_digest: string;
246
+ };
247
+ payload_digest: string;
248
+ denominator: "symbol" | "none" | "eligible-file" | "loc" | "protocol-item";
249
+ }[];
250
+ }, {
251
+ source_ref: string;
252
+ module_ref: string | null;
253
+ normalized_path: string;
254
+ file_ref: string;
255
+ role: "primary-owner" | "enricher";
256
+ coverage_tier: "ast-catalog" | "lightweight-evidence";
257
+ disposition: "analyzed" | "unsupported" | "excluded";
258
+ facts: {
259
+ kind: string;
260
+ fact_ref: string;
261
+ locator: {
262
+ source_ref: string;
263
+ module_ref: string | null;
264
+ normalized_path: string;
265
+ qualified_item_path: string;
266
+ signature_digest: string;
267
+ };
268
+ payload_digest: string;
269
+ denominator: "symbol" | "none" | "eligible-file" | "loc" | "protocol-item";
270
+ }[];
271
+ }>, "many">;
272
+ diagnostics: z.ZodArray<z.ZodObject<{
273
+ code: z.ZodEffects<z.ZodString, string, string>;
274
+ fact_ref: z.ZodOptional<z.ZodString>;
275
+ severity: z.ZodEnum<[
276
+ "info",
277
+ "warning",
278
+ "error"
279
+ ]>;
280
+ detail_digest: z.ZodString;
281
+ }, "strict", z.ZodTypeAny, {
282
+ code: string;
283
+ severity: "warning" | "info" | "error";
284
+ detail_digest: string;
285
+ fact_ref?: string | undefined;
286
+ }, {
287
+ code: string;
288
+ severity: "warning" | "info" | "error";
289
+ detail_digest: string;
290
+ fact_ref?: string | undefined;
291
+ }>, "many">;
292
+ toolchain: z.ZodArray<z.ZodEffects<z.ZodObject<{
293
+ step: z.ZodEffects<z.ZodString, string, string>;
294
+ package: z.ZodString;
295
+ export: z.ZodString;
296
+ version: z.ZodString;
297
+ digest: z.ZodString;
298
+ capabilities: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
299
+ input_digest: z.ZodString;
300
+ output_digest: z.ZodString;
301
+ }, "strict", z.ZodTypeAny, {
302
+ package: string;
303
+ version: string;
304
+ digest: string;
305
+ export: string;
306
+ step: string;
307
+ capabilities: string[];
308
+ input_digest: string;
309
+ output_digest: string;
310
+ }, {
311
+ package: string;
312
+ version: string;
313
+ digest: string;
314
+ export: string;
315
+ step: string;
316
+ capabilities: string[];
317
+ input_digest: string;
318
+ output_digest: string;
319
+ }>, {
320
+ package: string;
321
+ version: string;
322
+ digest: string;
323
+ export: string;
324
+ step: string;
325
+ capabilities: string[];
326
+ input_digest: string;
327
+ output_digest: string;
328
+ }, {
329
+ package: string;
330
+ version: string;
331
+ digest: string;
332
+ export: string;
333
+ step: string;
334
+ capabilities: string[];
335
+ input_digest: string;
336
+ output_digest: string;
337
+ }>, "many">;
338
+ output_digest: z.ZodString;
339
+ }, "strict", z.ZodTypeAny, {
340
+ input_digest: string;
341
+ output_digest: string;
342
+ protocol: "context.indexer.evidence-adapter-result/v1";
343
+ adapter: {
344
+ package: string;
345
+ id: string;
346
+ version: string;
347
+ digest: string;
348
+ export: string;
349
+ };
350
+ authorized_scope: {
351
+ source_ref: string;
352
+ module_refs: string[];
353
+ scope_digest: string;
354
+ };
355
+ precedence: number;
356
+ files: {
357
+ source_ref: string;
358
+ module_ref: string | null;
359
+ normalized_path: string;
360
+ file_ref: string;
361
+ role: "primary-owner" | "enricher";
362
+ coverage_tier: "ast-catalog" | "lightweight-evidence";
363
+ disposition: "analyzed" | "unsupported" | "excluded";
364
+ facts: {
365
+ kind: string;
366
+ fact_ref: string;
367
+ locator: {
368
+ source_ref: string;
369
+ module_ref: string | null;
370
+ normalized_path: string;
371
+ qualified_item_path: string;
372
+ signature_digest: string;
373
+ };
374
+ payload_digest: string;
375
+ denominator: "symbol" | "none" | "eligible-file" | "loc" | "protocol-item";
376
+ }[];
377
+ }[];
378
+ diagnostics: {
379
+ code: string;
380
+ severity: "warning" | "info" | "error";
381
+ detail_digest: string;
382
+ fact_ref?: string | undefined;
383
+ }[];
384
+ toolchain: {
385
+ package: string;
386
+ version: string;
387
+ digest: string;
388
+ export: string;
389
+ step: string;
390
+ capabilities: string[];
391
+ input_digest: string;
392
+ output_digest: string;
393
+ }[];
394
+ }, {
395
+ input_digest: string;
396
+ output_digest: string;
397
+ protocol: "context.indexer.evidence-adapter-result/v1";
398
+ adapter: {
399
+ package: string;
400
+ id: string;
401
+ version: string;
402
+ digest: string;
403
+ export: string;
404
+ };
405
+ authorized_scope: {
406
+ source_ref: string;
407
+ module_refs: string[];
408
+ scope_digest: string;
409
+ };
410
+ precedence: number;
411
+ files: {
412
+ source_ref: string;
413
+ module_ref: string | null;
414
+ normalized_path: string;
415
+ file_ref: string;
416
+ role: "primary-owner" | "enricher";
417
+ coverage_tier: "ast-catalog" | "lightweight-evidence";
418
+ disposition: "analyzed" | "unsupported" | "excluded";
419
+ facts: {
420
+ kind: string;
421
+ fact_ref: string;
422
+ locator: {
423
+ source_ref: string;
424
+ module_ref: string | null;
425
+ normalized_path: string;
426
+ qualified_item_path: string;
427
+ signature_digest: string;
428
+ };
429
+ payload_digest: string;
430
+ denominator: "symbol" | "none" | "eligible-file" | "loc" | "protocol-item";
431
+ }[];
432
+ }[];
433
+ diagnostics: {
434
+ code: string;
435
+ severity: "warning" | "info" | "error";
436
+ detail_digest: string;
437
+ fact_ref?: string | undefined;
438
+ }[];
439
+ toolchain: {
440
+ package: string;
441
+ version: string;
442
+ digest: string;
443
+ export: string;
444
+ step: string;
445
+ capabilities: string[];
446
+ input_digest: string;
447
+ output_digest: string;
448
+ }[];
449
+ }>, {
450
+ input_digest: string;
451
+ output_digest: string;
452
+ protocol: "context.indexer.evidence-adapter-result/v1";
453
+ adapter: {
454
+ package: string;
455
+ id: string;
456
+ version: string;
457
+ digest: string;
458
+ export: string;
459
+ };
460
+ authorized_scope: {
461
+ source_ref: string;
462
+ module_refs: string[];
463
+ scope_digest: string;
464
+ };
465
+ precedence: number;
466
+ files: {
467
+ source_ref: string;
468
+ module_ref: string | null;
469
+ normalized_path: string;
470
+ file_ref: string;
471
+ role: "primary-owner" | "enricher";
472
+ coverage_tier: "ast-catalog" | "lightweight-evidence";
473
+ disposition: "analyzed" | "unsupported" | "excluded";
474
+ facts: {
475
+ kind: string;
476
+ fact_ref: string;
477
+ locator: {
478
+ source_ref: string;
479
+ module_ref: string | null;
480
+ normalized_path: string;
481
+ qualified_item_path: string;
482
+ signature_digest: string;
483
+ };
484
+ payload_digest: string;
485
+ denominator: "symbol" | "none" | "eligible-file" | "loc" | "protocol-item";
486
+ }[];
487
+ }[];
488
+ diagnostics: {
489
+ code: string;
490
+ severity: "warning" | "info" | "error";
491
+ detail_digest: string;
492
+ fact_ref?: string | undefined;
493
+ }[];
494
+ toolchain: {
495
+ package: string;
496
+ version: string;
497
+ digest: string;
498
+ export: string;
499
+ step: string;
500
+ capabilities: string[];
501
+ input_digest: string;
502
+ output_digest: string;
503
+ }[];
504
+ }, {
505
+ input_digest: string;
506
+ output_digest: string;
507
+ protocol: "context.indexer.evidence-adapter-result/v1";
508
+ adapter: {
509
+ package: string;
510
+ id: string;
511
+ version: string;
512
+ digest: string;
513
+ export: string;
514
+ };
515
+ authorized_scope: {
516
+ source_ref: string;
517
+ module_refs: string[];
518
+ scope_digest: string;
519
+ };
520
+ precedence: number;
521
+ files: {
522
+ source_ref: string;
523
+ module_ref: string | null;
524
+ normalized_path: string;
525
+ file_ref: string;
526
+ role: "primary-owner" | "enricher";
527
+ coverage_tier: "ast-catalog" | "lightweight-evidence";
528
+ disposition: "analyzed" | "unsupported" | "excluded";
529
+ facts: {
530
+ kind: string;
531
+ fact_ref: string;
532
+ locator: {
533
+ source_ref: string;
534
+ module_ref: string | null;
535
+ normalized_path: string;
536
+ qualified_item_path: string;
537
+ signature_digest: string;
538
+ };
539
+ payload_digest: string;
540
+ denominator: "symbol" | "none" | "eligible-file" | "loc" | "protocol-item";
541
+ }[];
542
+ }[];
543
+ diagnostics: {
544
+ code: string;
545
+ severity: "warning" | "info" | "error";
546
+ detail_digest: string;
547
+ fact_ref?: string | undefined;
548
+ }[];
549
+ toolchain: {
550
+ package: string;
551
+ version: string;
552
+ digest: string;
553
+ export: string;
554
+ step: string;
555
+ capabilities: string[];
556
+ input_digest: string;
557
+ output_digest: string;
558
+ }[];
559
+ }>;
560
+ type IndexerEvidenceAdapterResult = z.infer<typeof indexerEvidenceAdapterResultSchema>;
561
+ type IndexerEvidenceAdapterFactPayloadValue = null | boolean | number | string | IndexerEvidenceAdapterFactPayloadValue[] | {
562
+ [key: string]: IndexerEvidenceAdapterFactPayloadValue;
563
+ };
564
+ interface IndexerEvidenceAdapterFactPayload {
565
+ fact_ref: string;
566
+ payload: IndexerEvidenceAdapterFactPayloadValue;
567
+ }
568
+ interface IndexerEvidenceAdapterMaterialization {
569
+ result: IndexerEvidenceAdapterResult;
570
+ fact_payloads: IndexerEvidenceAdapterFactPayload[];
571
+ }
572
+ export interface StyleEvidenceAdapterInvocation {
573
+ adapter: IndexerEvidenceAdapterResult["adapter"];
574
+ authorized_scope: IndexerEvidenceAdapterResult["authorized_scope"];
575
+ input_digest: string;
576
+ precedence: number;
577
+ module_refs?: Readonly<Record<string, string | null>>;
578
+ role?: "primary-owner" | "enricher";
579
+ }
580
+ export declare function styleSourcesToEvidenceAdapterResult(files: Readonly<Record<string, string>>, invocation: StyleEvidenceAdapterInvocation): IndexerEvidenceAdapterResult;
581
+ export declare function styleSourcesToEvidenceAdapterMaterialization(files: Readonly<Record<string, string>>, invocation: StyleEvidenceAdapterInvocation): IndexerEvidenceAdapterMaterialization;
582
+ export declare const STYLE_EVIDENCE_ADAPTER_EXPORT = "styleSourcesToEvidenceAdapterMaterialization";
583
+
584
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c4a/extract-style",
3
- "version": "0.7.10-alpha.1",
3
+ "version": "0.7.10",
4
4
  "type": "module",
5
5
  "description": "Lightweight CSS and SCSS evidence adapter for Context",
6
6
  "license": "MIT",
@@ -22,7 +22,9 @@
22
22
  "postcss": "^8.5.26",
23
23
  "postcss-scss": "^4.0.9",
24
24
  "postcss-selector-parser": "^7.1.5",
25
- "postcss-value-parser": "^4.2.0"
25
+ "postcss-value-parser": "^4.2.0",
26
+ "zod": "^3.23.8"
26
27
  },
27
- "main": "./index.js"
28
+ "main": "./index.js",
29
+ "types": "./index.d.ts"
28
30
  }