@csszyx/compiler 0.8.0 → 0.9.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 +12 -8
- package/dist/color-var.cjs +1 -0
- package/dist/color-var.mjs +1 -0
- package/dist/index.cjs +1109 -44
- package/dist/index.d.cts +184 -38
- package/dist/index.d.mts +184 -38
- package/dist/index.mjs +1107 -47
- package/dist/shared/{compiler.BIUVmI0H.mjs → compiler.CIBwOKUt.mjs} +70 -15
- package/dist/shared/{compiler.C6jT0mcT.cjs → compiler.DItEsgH4.cjs} +70 -15
- package/dist/transform-core.cjs +1 -1
- package/dist/transform-core.mjs +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -308,6 +308,62 @@ interface TransformSourceCodeOptions {
|
|
|
308
308
|
* are still safe to transform.
|
|
309
309
|
*/
|
|
310
310
|
astBudget?: number;
|
|
311
|
+
/**
|
|
312
|
+
* Opt into tiered CSS custom property names for parser paths that support
|
|
313
|
+
* the CSS variable system. Unsupported parser paths must preserve existing
|
|
314
|
+
* `--_sz-*` output until they explicitly port this option.
|
|
315
|
+
*
|
|
316
|
+
* @default false
|
|
317
|
+
*/
|
|
318
|
+
mangleVars?: boolean;
|
|
319
|
+
/**
|
|
320
|
+
* Maximum cascade depth for component-tier CSS variable hoisting.
|
|
321
|
+
*
|
|
322
|
+
* Only used when `mangleVars` is enabled. Defaults to 5 to keep the
|
|
323
|
+
* invalidation surface bounded.
|
|
324
|
+
*/
|
|
325
|
+
mangleVarHoistMaxDepth?: number;
|
|
326
|
+
/**
|
|
327
|
+
* Explicit app-owned global CSS custom-property aliases. Parser paths that
|
|
328
|
+
* support Phase H rewrite exact static sz string values from original
|
|
329
|
+
* token names to aliases, for example `--brand-primary` -> `---gz`.
|
|
330
|
+
*/
|
|
331
|
+
globalVarAliases?: GlobalVarAliasTableInput;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Accepted input shapes for global CSS custom-property alias tables.
|
|
335
|
+
*/
|
|
336
|
+
type GlobalVarAliasTableInput = ReadonlyMap<string, string> | ReadonlyArray<readonly [string, string]> | Readonly<Record<string, string>>;
|
|
337
|
+
/**
|
|
338
|
+
* CSS custom-property mangle metadata. Most originals map to one mangled name,
|
|
339
|
+
* but the same original can legitimately appear in both scoped and hoisted
|
|
340
|
+
* tiers in one build, e.g. `--_sz-p` -> `--sz` and `--cz`.
|
|
341
|
+
*/
|
|
342
|
+
type CssVariableMangleValue = string | string[];
|
|
343
|
+
/**
|
|
344
|
+
* Source transform result shared by the Babel and oxc parser paths.
|
|
345
|
+
*/
|
|
346
|
+
interface SourceTransformResult {
|
|
347
|
+
/** Rewritten source code. */
|
|
348
|
+
code: string;
|
|
349
|
+
/** Whether csszyx changed the source. */
|
|
350
|
+
transformed: boolean;
|
|
351
|
+
/** Whether the source needs the _sz runtime helper. */
|
|
352
|
+
usesRuntime: boolean;
|
|
353
|
+
/** Whether the source needs the _szMerge runtime helper. */
|
|
354
|
+
usesMerge: boolean;
|
|
355
|
+
/** Whether the source needs the color-var runtime helper. */
|
|
356
|
+
usesColorVar: boolean;
|
|
357
|
+
/** Classes generated from sz syntax. */
|
|
358
|
+
classes: Set<string>;
|
|
359
|
+
/** Raw className/class strings collected for Tailwind discovery only. */
|
|
360
|
+
rawClassNames: Set<string>;
|
|
361
|
+
/** Compiler diagnostics to emit in development. */
|
|
362
|
+
diagnostics: string[];
|
|
363
|
+
/** Recovery tokens emitted by szRecover attributes. */
|
|
364
|
+
recoveryTokens: Map<string, TokenData>;
|
|
365
|
+
/** CSS custom property original-to-mangled names emitted by mangleVars. */
|
|
366
|
+
cssVariableMap: Map<string, CssVariableMangleValue>;
|
|
311
367
|
}
|
|
312
368
|
/**
|
|
313
369
|
* Transforms all sz props in a source code string into Tailwind classNames.
|
|
@@ -321,17 +377,7 @@ interface TransformSourceCodeOptions {
|
|
|
321
377
|
* @throws {ASTBudgetExceededError} when the file's AST exceeds the
|
|
322
378
|
* effective budget (`options.astBudget` or {@link AST_BUDGET}).
|
|
323
379
|
*/
|
|
324
|
-
declare function transformSourceCode(source: string, filename?: string, options?: TransformSourceCodeOptions):
|
|
325
|
-
code: string;
|
|
326
|
-
transformed: boolean;
|
|
327
|
-
usesRuntime: boolean;
|
|
328
|
-
usesMerge: boolean;
|
|
329
|
-
usesColorVar: boolean;
|
|
330
|
-
classes: Set<string>;
|
|
331
|
-
rawClassNames: Set<string>;
|
|
332
|
-
diagnostics: string[];
|
|
333
|
-
recoveryTokens: Map<string, TokenData>;
|
|
334
|
-
};
|
|
380
|
+
declare function transformSourceCode(source: string, filename?: string, options?: TransformSourceCodeOptions): SourceTransformResult;
|
|
335
381
|
|
|
336
382
|
/**
|
|
337
383
|
* Core Compiler class for csszyx.
|
|
@@ -393,6 +439,44 @@ declare class CsszyxCompiler {
|
|
|
393
439
|
}): string;
|
|
394
440
|
}
|
|
395
441
|
|
|
442
|
+
/** Kind of out-of-band global custom-property usage. */
|
|
443
|
+
type GlobalVarUsageKind = 'style-set-property' | 'style-get-property' | 'style-remove-property' | 'jsx-style-key' | 'class-string-var-reference';
|
|
444
|
+
/** Source location for one out-of-band usage. */
|
|
445
|
+
interface GlobalVarUsageLocation {
|
|
446
|
+
/** Source file path. */
|
|
447
|
+
filePath: string;
|
|
448
|
+
/** 1-based source line. */
|
|
449
|
+
line: number;
|
|
450
|
+
/** 1-based source column. */
|
|
451
|
+
column: number;
|
|
452
|
+
}
|
|
453
|
+
/** One out-of-band global custom-property usage diagnostic. */
|
|
454
|
+
interface GlobalVarUsageDiagnostic {
|
|
455
|
+
/** Usage kind. */
|
|
456
|
+
kind: GlobalVarUsageKind;
|
|
457
|
+
/** Custom-property name including leading `--`. */
|
|
458
|
+
name: string;
|
|
459
|
+
/** Source location. */
|
|
460
|
+
location: GlobalVarUsageLocation;
|
|
461
|
+
/** Human-readable message. */
|
|
462
|
+
message: string;
|
|
463
|
+
}
|
|
464
|
+
/** Options for JS/JSX global variable usage scanning. */
|
|
465
|
+
interface ScanGlobalVarUsagesOptions {
|
|
466
|
+
/** Candidate tokens to report. Undefined reports every concrete token. */
|
|
467
|
+
tokens?: Iterable<string>;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Scans JS/TS/JSX/TSX source for global custom-property usages csszyx does not
|
|
471
|
+
* currently rewrite.
|
|
472
|
+
*
|
|
473
|
+
* @param source Source text.
|
|
474
|
+
* @param filename Source filename.
|
|
475
|
+
* @param options Scanner options.
|
|
476
|
+
* @returns Out-of-band usage diagnostics.
|
|
477
|
+
*/
|
|
478
|
+
declare function scanGlobalVarUsages(source: string, filename?: string, options?: ScanGlobalVarUsagesOptions): GlobalVarUsageDiagnostic[];
|
|
479
|
+
|
|
396
480
|
/**
|
|
397
481
|
* CSS Variable Hoisting — deduplicates identical CSS variables across sibling elements.
|
|
398
482
|
*
|
|
@@ -516,31 +600,8 @@ declare function getCSSVariableName(property: string, variantPrefix?: string): s
|
|
|
516
600
|
* API mapping referenced throughout this file.
|
|
517
601
|
*/
|
|
518
602
|
|
|
519
|
-
/**
|
|
520
|
-
|
|
521
|
-
* future `transformOxc`. Kept in lock-step so the parity harness can
|
|
522
|
-
* diff results without conditional logic.
|
|
523
|
-
*/
|
|
524
|
-
interface TransformOxcResult {
|
|
525
|
-
/** Rewritten source — equal to input when `transformed === false`. */
|
|
526
|
-
code: string;
|
|
527
|
-
/** True when at least one sz/szRecover/_sz mutation was applied. */
|
|
528
|
-
transformed: boolean;
|
|
529
|
-
/** Did the file pull in `_sz` runtime helper? */
|
|
530
|
-
usesRuntime: boolean;
|
|
531
|
-
/** Did the file pull in `_szMerge` runtime helper? */
|
|
532
|
-
usesMerge: boolean;
|
|
533
|
-
/** Did the file use color-var helpers? */
|
|
534
|
-
usesColorVar: boolean;
|
|
535
|
-
/** Class names emitted by the compiler — drives the mangle map. */
|
|
536
|
-
classes: Set<string>;
|
|
537
|
-
/** Hand-written `className="..."` strings — TW JIT safelist only. */
|
|
538
|
-
rawClassNames: Set<string>;
|
|
539
|
-
/** Dev-mode warnings emitted during transform. */
|
|
540
|
-
diagnostics: string[];
|
|
541
|
-
/** Recovery tokens emitted by szRecover attributes. */
|
|
542
|
-
recoveryTokens: Map<string, TokenData>;
|
|
543
|
-
}
|
|
603
|
+
/** Result shape returned by the oxc parser path. */
|
|
604
|
+
type TransformOxcResult = SourceTransformResult;
|
|
544
605
|
/**
|
|
545
606
|
* Thrown when a caller hits a code path the current slice does not yet
|
|
546
607
|
* implement. The parity harness catches this and reports the fixture
|
|
@@ -564,6 +625,62 @@ declare class OxcNotImplementedError extends Error {
|
|
|
564
625
|
*/
|
|
565
626
|
declare function transformOxc(source: string, filename?: string, options?: TransformSourceCodeOptions): TransformOxcResult;
|
|
566
627
|
|
|
628
|
+
/**
|
|
629
|
+
* Source file passed to the Rust native batch transform.
|
|
630
|
+
*/
|
|
631
|
+
interface TransformRustFile {
|
|
632
|
+
/** Source filename for diagnostics and recovery-token stability. */
|
|
633
|
+
filename?: string;
|
|
634
|
+
/** Source module contents. */
|
|
635
|
+
source: string;
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Thrown when the Rust native transform cannot execute for the current host.
|
|
639
|
+
*
|
|
640
|
+
* The class name is kept for compatibility with earlier scaffold-era callers.
|
|
641
|
+
*/
|
|
642
|
+
declare class OxcRustNotImplementedError extends Error {
|
|
643
|
+
/**
|
|
644
|
+
* @param detail Native loader or transform failure detail.
|
|
645
|
+
*/
|
|
646
|
+
constructor(detail: string);
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Transform source through the Rust native engine.
|
|
650
|
+
*
|
|
651
|
+
* @param source Source module contents.
|
|
652
|
+
* @param filename Source filename for diagnostics.
|
|
653
|
+
* @param options Compiler options.
|
|
654
|
+
* @returns Transform result.
|
|
655
|
+
* @throws {OxcRustNotImplementedError} when the native addon is unavailable.
|
|
656
|
+
*/
|
|
657
|
+
declare function transformRust(source: string, filename?: string, options?: TransformSourceCodeOptions): SourceTransformResult;
|
|
658
|
+
/**
|
|
659
|
+
* Verify that the native Rust transform binding can be loaded.
|
|
660
|
+
*
|
|
661
|
+
* This is intentionally separate from `transformRust()` so build integrations
|
|
662
|
+
* can validate the explicit `rust` parser contract before serving cached
|
|
663
|
+
* output. If the native addon is missing, `rust` must fail loudly instead of
|
|
664
|
+
* returning a stale cache entry.
|
|
665
|
+
*
|
|
666
|
+
* @throws {OxcRustNotImplementedError} when the native addon is unavailable.
|
|
667
|
+
*/
|
|
668
|
+
declare function ensureRustTransformAvailable(): void;
|
|
669
|
+
/**
|
|
670
|
+
* Transform a batch of files through the Rust native engine in one napi call.
|
|
671
|
+
*
|
|
672
|
+
* This is the compiler-level wrapper around `@csszyx/core/native`'s batch API.
|
|
673
|
+
* It keeps JS callers on the normal `SourceTransformResult` contract while
|
|
674
|
+
* preserving the Rust core's FFI amortization for benchmarks and future build
|
|
675
|
+
* integrations.
|
|
676
|
+
*
|
|
677
|
+
* @param files Source files to transform.
|
|
678
|
+
* @param options Compiler options reserved for future native config plumbing.
|
|
679
|
+
* @returns One transform result per input file, in input order.
|
|
680
|
+
* @throws {OxcRustNotImplementedError} when the native addon is unavailable.
|
|
681
|
+
*/
|
|
682
|
+
declare function transformRustBatch(files: readonly TransformRustFile[], options?: TransformSourceCodeOptions): SourceTransformResult[];
|
|
683
|
+
|
|
567
684
|
interface StandardLonghandProperties<TLength = (string & {}) | 0, TTime = string & {}> {
|
|
568
685
|
/**
|
|
569
686
|
* This feature is not Baseline because it does not work in some of the most widely-used browsers.
|
|
@@ -13267,6 +13384,18 @@ interface InteractivityProps {
|
|
|
13267
13384
|
select?: 'none' | 'text' | 'all' | 'auto';
|
|
13268
13385
|
/** @see https://tailwindcss.com/docs/will-change */
|
|
13269
13386
|
willChange?: 'auto' | 'scroll' | 'contents' | 'transform' | (string & {});
|
|
13387
|
+
/** @see https://tailwindcss.com/docs/scrollbar-width */
|
|
13388
|
+
scrollbar?: 'auto' | 'thin' | 'none';
|
|
13389
|
+
/** @see https://tailwindcss.com/docs/scrollbar-color */
|
|
13390
|
+
scrollbarThumb?: ColorPropValue;
|
|
13391
|
+
/** @see https://tailwindcss.com/docs/scrollbar-color */
|
|
13392
|
+
scrollbarTrack?: ColorPropValue;
|
|
13393
|
+
/** @see https://tailwindcss.com/docs/scrollbar-gutter */
|
|
13394
|
+
scrollbarGutter?: 'auto' | 'stable' | 'both';
|
|
13395
|
+
/** @see https://tailwindcss.com/docs/zoom */
|
|
13396
|
+
zoom?: number | (string & {});
|
|
13397
|
+
/** @see https://tailwindcss.com/docs/tab-size */
|
|
13398
|
+
tabSize?: number | (string & {});
|
|
13270
13399
|
}
|
|
13271
13400
|
/**
|
|
13272
13401
|
*
|
|
@@ -13308,6 +13437,12 @@ interface MaskProps {
|
|
|
13308
13437
|
maskRepeat?: 'repeat' | 'no-repeat' | 'repeat-x' | 'repeat-y' | 'round' | 'space';
|
|
13309
13438
|
/** CSS mask-type (shape-rendering) */
|
|
13310
13439
|
maskShape?: 'alpha' | 'luminance';
|
|
13440
|
+
/** Mask gradient from color stop (v4.1) */
|
|
13441
|
+
maskFrom?: ColorPropValue;
|
|
13442
|
+
/** Mask gradient via color stop (v4.1) */
|
|
13443
|
+
maskVia?: ColorPropValue;
|
|
13444
|
+
/** Mask gradient to color stop (v4.1) */
|
|
13445
|
+
maskTo?: ColorPropValue;
|
|
13311
13446
|
}
|
|
13312
13447
|
/**
|
|
13313
13448
|
* Variant modifiers for pseudo-classes, breakpoints, and states.
|
|
@@ -13368,6 +13503,17 @@ interface VariantModifiers {
|
|
|
13368
13503
|
motionSafe?: SzPropsBase;
|
|
13369
13504
|
contrastMore?: SzPropsBase;
|
|
13370
13505
|
contrastLess?: SzPropsBase;
|
|
13506
|
+
pointerFine?: SzPropsBase;
|
|
13507
|
+
pointerCoarse?: SzPropsBase;
|
|
13508
|
+
pointerNone?: SzPropsBase;
|
|
13509
|
+
anyPointerFine?: SzPropsBase;
|
|
13510
|
+
anyPointerCoarse?: SzPropsBase;
|
|
13511
|
+
anyPointerNone?: SzPropsBase;
|
|
13512
|
+
userValid?: SzPropsBase;
|
|
13513
|
+
userInvalid?: SzPropsBase;
|
|
13514
|
+
detailsContent?: SzPropsBase;
|
|
13515
|
+
invertedColors?: SzPropsBase;
|
|
13516
|
+
noscript?: SzPropsBase;
|
|
13371
13517
|
print?: SzPropsBase;
|
|
13372
13518
|
portrait?: SzPropsBase;
|
|
13373
13519
|
landscape?: SzPropsBase;
|
|
@@ -13480,5 +13626,5 @@ declare const DEFAULT_COMPILER_OPTIONS: Required<CompilerOptions>;
|
|
|
13480
13626
|
*/
|
|
13481
13627
|
declare function mergeOptions(options?: Partial<CompilerOptions>): Required<CompilerOptions>;
|
|
13482
13628
|
|
|
13483
|
-
export { COLOR_PROPERTIES, CsszyxCompiler, DEFAULT_COMPILER_OPTIONS, ManifestBuilder, OxcNotImplementedError, PROPERTY_CATEGORY_MAP, PropertyCategory, SzObject, VERSION, buildParentMap, createRecoveryToken, generateRecoveryToken, getCSSVariableName, getPropertyCategory, hoistCSSVariables, injectRecoveryToken, isValidRecoveryMode, mergeOptions, parseManifest, serializeManifest, transformOxc, transformSourceCode, validateManifest, validateSzRecover };
|
|
13484
|
-
export type { BackgroundProps, BorderProps, BorderRadiusValue, CSSVarUsage, ColorName, ColorObjectValue, ColorPropValue, ColorShade, ColorValue, CompilerOptions, ContainerSize, CustomTheme, EffectsProps, FilterProps, FlexboxGridProps, FractionValue, InteractivityProps, LayoutProps, NegativeSpacingValue, RecoveryManifest, RecoveryMode, RecoveryToken, ShadowValue, SizingProps, SpacingProps, SpacingScale, SpacingValue, SvgProps, SzPropValue, SzProps, SzPropsBase, TableProps, TokenData, TokenMetadata, TransformOxcResult, TransformProps, TransitionAnimationProps, TypographyProps, VariantModifiers };
|
|
13629
|
+
export { COLOR_PROPERTIES, CsszyxCompiler, DEFAULT_COMPILER_OPTIONS, ManifestBuilder, OxcNotImplementedError, OxcRustNotImplementedError, PROPERTY_CATEGORY_MAP, PropertyCategory, SzObject, VERSION, buildParentMap, createRecoveryToken, ensureRustTransformAvailable, generateRecoveryToken, getCSSVariableName, getPropertyCategory, hoistCSSVariables, injectRecoveryToken, isValidRecoveryMode, mergeOptions, parseManifest, scanGlobalVarUsages, serializeManifest, transformOxc, transformRust, transformRustBatch, transformSourceCode, validateManifest, validateSzRecover };
|
|
13630
|
+
export type { BackgroundProps, BorderProps, BorderRadiusValue, CSSVarUsage, ColorName, ColorObjectValue, ColorPropValue, ColorShade, ColorValue, CompilerOptions, ContainerSize, CssVariableMangleValue, CustomTheme, EffectsProps, FilterProps, FlexboxGridProps, FractionValue, GlobalVarAliasTableInput, GlobalVarUsageDiagnostic, GlobalVarUsageKind, GlobalVarUsageLocation, InteractivityProps, LayoutProps, NegativeSpacingValue, RecoveryManifest, RecoveryMode, RecoveryToken, ScanGlobalVarUsagesOptions, ShadowValue, SizingProps, SourceTransformResult, SpacingProps, SpacingScale, SpacingValue, SvgProps, SzPropValue, SzProps, SzPropsBase, TableProps, TokenData, TokenMetadata, TransformOxcResult, TransformProps, TransformRustFile, TransformSourceCodeOptions, TransitionAnimationProps, TypographyProps, VariantModifiers };
|
package/dist/index.d.mts
CHANGED
|
@@ -308,6 +308,62 @@ interface TransformSourceCodeOptions {
|
|
|
308
308
|
* are still safe to transform.
|
|
309
309
|
*/
|
|
310
310
|
astBudget?: number;
|
|
311
|
+
/**
|
|
312
|
+
* Opt into tiered CSS custom property names for parser paths that support
|
|
313
|
+
* the CSS variable system. Unsupported parser paths must preserve existing
|
|
314
|
+
* `--_sz-*` output until they explicitly port this option.
|
|
315
|
+
*
|
|
316
|
+
* @default false
|
|
317
|
+
*/
|
|
318
|
+
mangleVars?: boolean;
|
|
319
|
+
/**
|
|
320
|
+
* Maximum cascade depth for component-tier CSS variable hoisting.
|
|
321
|
+
*
|
|
322
|
+
* Only used when `mangleVars` is enabled. Defaults to 5 to keep the
|
|
323
|
+
* invalidation surface bounded.
|
|
324
|
+
*/
|
|
325
|
+
mangleVarHoistMaxDepth?: number;
|
|
326
|
+
/**
|
|
327
|
+
* Explicit app-owned global CSS custom-property aliases. Parser paths that
|
|
328
|
+
* support Phase H rewrite exact static sz string values from original
|
|
329
|
+
* token names to aliases, for example `--brand-primary` -> `---gz`.
|
|
330
|
+
*/
|
|
331
|
+
globalVarAliases?: GlobalVarAliasTableInput;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Accepted input shapes for global CSS custom-property alias tables.
|
|
335
|
+
*/
|
|
336
|
+
type GlobalVarAliasTableInput = ReadonlyMap<string, string> | ReadonlyArray<readonly [string, string]> | Readonly<Record<string, string>>;
|
|
337
|
+
/**
|
|
338
|
+
* CSS custom-property mangle metadata. Most originals map to one mangled name,
|
|
339
|
+
* but the same original can legitimately appear in both scoped and hoisted
|
|
340
|
+
* tiers in one build, e.g. `--_sz-p` -> `--sz` and `--cz`.
|
|
341
|
+
*/
|
|
342
|
+
type CssVariableMangleValue = string | string[];
|
|
343
|
+
/**
|
|
344
|
+
* Source transform result shared by the Babel and oxc parser paths.
|
|
345
|
+
*/
|
|
346
|
+
interface SourceTransformResult {
|
|
347
|
+
/** Rewritten source code. */
|
|
348
|
+
code: string;
|
|
349
|
+
/** Whether csszyx changed the source. */
|
|
350
|
+
transformed: boolean;
|
|
351
|
+
/** Whether the source needs the _sz runtime helper. */
|
|
352
|
+
usesRuntime: boolean;
|
|
353
|
+
/** Whether the source needs the _szMerge runtime helper. */
|
|
354
|
+
usesMerge: boolean;
|
|
355
|
+
/** Whether the source needs the color-var runtime helper. */
|
|
356
|
+
usesColorVar: boolean;
|
|
357
|
+
/** Classes generated from sz syntax. */
|
|
358
|
+
classes: Set<string>;
|
|
359
|
+
/** Raw className/class strings collected for Tailwind discovery only. */
|
|
360
|
+
rawClassNames: Set<string>;
|
|
361
|
+
/** Compiler diagnostics to emit in development. */
|
|
362
|
+
diagnostics: string[];
|
|
363
|
+
/** Recovery tokens emitted by szRecover attributes. */
|
|
364
|
+
recoveryTokens: Map<string, TokenData>;
|
|
365
|
+
/** CSS custom property original-to-mangled names emitted by mangleVars. */
|
|
366
|
+
cssVariableMap: Map<string, CssVariableMangleValue>;
|
|
311
367
|
}
|
|
312
368
|
/**
|
|
313
369
|
* Transforms all sz props in a source code string into Tailwind classNames.
|
|
@@ -321,17 +377,7 @@ interface TransformSourceCodeOptions {
|
|
|
321
377
|
* @throws {ASTBudgetExceededError} when the file's AST exceeds the
|
|
322
378
|
* effective budget (`options.astBudget` or {@link AST_BUDGET}).
|
|
323
379
|
*/
|
|
324
|
-
declare function transformSourceCode(source: string, filename?: string, options?: TransformSourceCodeOptions):
|
|
325
|
-
code: string;
|
|
326
|
-
transformed: boolean;
|
|
327
|
-
usesRuntime: boolean;
|
|
328
|
-
usesMerge: boolean;
|
|
329
|
-
usesColorVar: boolean;
|
|
330
|
-
classes: Set<string>;
|
|
331
|
-
rawClassNames: Set<string>;
|
|
332
|
-
diagnostics: string[];
|
|
333
|
-
recoveryTokens: Map<string, TokenData>;
|
|
334
|
-
};
|
|
380
|
+
declare function transformSourceCode(source: string, filename?: string, options?: TransformSourceCodeOptions): SourceTransformResult;
|
|
335
381
|
|
|
336
382
|
/**
|
|
337
383
|
* Core Compiler class for csszyx.
|
|
@@ -393,6 +439,44 @@ declare class CsszyxCompiler {
|
|
|
393
439
|
}): string;
|
|
394
440
|
}
|
|
395
441
|
|
|
442
|
+
/** Kind of out-of-band global custom-property usage. */
|
|
443
|
+
type GlobalVarUsageKind = 'style-set-property' | 'style-get-property' | 'style-remove-property' | 'jsx-style-key' | 'class-string-var-reference';
|
|
444
|
+
/** Source location for one out-of-band usage. */
|
|
445
|
+
interface GlobalVarUsageLocation {
|
|
446
|
+
/** Source file path. */
|
|
447
|
+
filePath: string;
|
|
448
|
+
/** 1-based source line. */
|
|
449
|
+
line: number;
|
|
450
|
+
/** 1-based source column. */
|
|
451
|
+
column: number;
|
|
452
|
+
}
|
|
453
|
+
/** One out-of-band global custom-property usage diagnostic. */
|
|
454
|
+
interface GlobalVarUsageDiagnostic {
|
|
455
|
+
/** Usage kind. */
|
|
456
|
+
kind: GlobalVarUsageKind;
|
|
457
|
+
/** Custom-property name including leading `--`. */
|
|
458
|
+
name: string;
|
|
459
|
+
/** Source location. */
|
|
460
|
+
location: GlobalVarUsageLocation;
|
|
461
|
+
/** Human-readable message. */
|
|
462
|
+
message: string;
|
|
463
|
+
}
|
|
464
|
+
/** Options for JS/JSX global variable usage scanning. */
|
|
465
|
+
interface ScanGlobalVarUsagesOptions {
|
|
466
|
+
/** Candidate tokens to report. Undefined reports every concrete token. */
|
|
467
|
+
tokens?: Iterable<string>;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Scans JS/TS/JSX/TSX source for global custom-property usages csszyx does not
|
|
471
|
+
* currently rewrite.
|
|
472
|
+
*
|
|
473
|
+
* @param source Source text.
|
|
474
|
+
* @param filename Source filename.
|
|
475
|
+
* @param options Scanner options.
|
|
476
|
+
* @returns Out-of-band usage diagnostics.
|
|
477
|
+
*/
|
|
478
|
+
declare function scanGlobalVarUsages(source: string, filename?: string, options?: ScanGlobalVarUsagesOptions): GlobalVarUsageDiagnostic[];
|
|
479
|
+
|
|
396
480
|
/**
|
|
397
481
|
* CSS Variable Hoisting — deduplicates identical CSS variables across sibling elements.
|
|
398
482
|
*
|
|
@@ -516,31 +600,8 @@ declare function getCSSVariableName(property: string, variantPrefix?: string): s
|
|
|
516
600
|
* API mapping referenced throughout this file.
|
|
517
601
|
*/
|
|
518
602
|
|
|
519
|
-
/**
|
|
520
|
-
|
|
521
|
-
* future `transformOxc`. Kept in lock-step so the parity harness can
|
|
522
|
-
* diff results without conditional logic.
|
|
523
|
-
*/
|
|
524
|
-
interface TransformOxcResult {
|
|
525
|
-
/** Rewritten source — equal to input when `transformed === false`. */
|
|
526
|
-
code: string;
|
|
527
|
-
/** True when at least one sz/szRecover/_sz mutation was applied. */
|
|
528
|
-
transformed: boolean;
|
|
529
|
-
/** Did the file pull in `_sz` runtime helper? */
|
|
530
|
-
usesRuntime: boolean;
|
|
531
|
-
/** Did the file pull in `_szMerge` runtime helper? */
|
|
532
|
-
usesMerge: boolean;
|
|
533
|
-
/** Did the file use color-var helpers? */
|
|
534
|
-
usesColorVar: boolean;
|
|
535
|
-
/** Class names emitted by the compiler — drives the mangle map. */
|
|
536
|
-
classes: Set<string>;
|
|
537
|
-
/** Hand-written `className="..."` strings — TW JIT safelist only. */
|
|
538
|
-
rawClassNames: Set<string>;
|
|
539
|
-
/** Dev-mode warnings emitted during transform. */
|
|
540
|
-
diagnostics: string[];
|
|
541
|
-
/** Recovery tokens emitted by szRecover attributes. */
|
|
542
|
-
recoveryTokens: Map<string, TokenData>;
|
|
543
|
-
}
|
|
603
|
+
/** Result shape returned by the oxc parser path. */
|
|
604
|
+
type TransformOxcResult = SourceTransformResult;
|
|
544
605
|
/**
|
|
545
606
|
* Thrown when a caller hits a code path the current slice does not yet
|
|
546
607
|
* implement. The parity harness catches this and reports the fixture
|
|
@@ -564,6 +625,62 @@ declare class OxcNotImplementedError extends Error {
|
|
|
564
625
|
*/
|
|
565
626
|
declare function transformOxc(source: string, filename?: string, options?: TransformSourceCodeOptions): TransformOxcResult;
|
|
566
627
|
|
|
628
|
+
/**
|
|
629
|
+
* Source file passed to the Rust native batch transform.
|
|
630
|
+
*/
|
|
631
|
+
interface TransformRustFile {
|
|
632
|
+
/** Source filename for diagnostics and recovery-token stability. */
|
|
633
|
+
filename?: string;
|
|
634
|
+
/** Source module contents. */
|
|
635
|
+
source: string;
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Thrown when the Rust native transform cannot execute for the current host.
|
|
639
|
+
*
|
|
640
|
+
* The class name is kept for compatibility with earlier scaffold-era callers.
|
|
641
|
+
*/
|
|
642
|
+
declare class OxcRustNotImplementedError extends Error {
|
|
643
|
+
/**
|
|
644
|
+
* @param detail Native loader or transform failure detail.
|
|
645
|
+
*/
|
|
646
|
+
constructor(detail: string);
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Transform source through the Rust native engine.
|
|
650
|
+
*
|
|
651
|
+
* @param source Source module contents.
|
|
652
|
+
* @param filename Source filename for diagnostics.
|
|
653
|
+
* @param options Compiler options.
|
|
654
|
+
* @returns Transform result.
|
|
655
|
+
* @throws {OxcRustNotImplementedError} when the native addon is unavailable.
|
|
656
|
+
*/
|
|
657
|
+
declare function transformRust(source: string, filename?: string, options?: TransformSourceCodeOptions): SourceTransformResult;
|
|
658
|
+
/**
|
|
659
|
+
* Verify that the native Rust transform binding can be loaded.
|
|
660
|
+
*
|
|
661
|
+
* This is intentionally separate from `transformRust()` so build integrations
|
|
662
|
+
* can validate the explicit `rust` parser contract before serving cached
|
|
663
|
+
* output. If the native addon is missing, `rust` must fail loudly instead of
|
|
664
|
+
* returning a stale cache entry.
|
|
665
|
+
*
|
|
666
|
+
* @throws {OxcRustNotImplementedError} when the native addon is unavailable.
|
|
667
|
+
*/
|
|
668
|
+
declare function ensureRustTransformAvailable(): void;
|
|
669
|
+
/**
|
|
670
|
+
* Transform a batch of files through the Rust native engine in one napi call.
|
|
671
|
+
*
|
|
672
|
+
* This is the compiler-level wrapper around `@csszyx/core/native`'s batch API.
|
|
673
|
+
* It keeps JS callers on the normal `SourceTransformResult` contract while
|
|
674
|
+
* preserving the Rust core's FFI amortization for benchmarks and future build
|
|
675
|
+
* integrations.
|
|
676
|
+
*
|
|
677
|
+
* @param files Source files to transform.
|
|
678
|
+
* @param options Compiler options reserved for future native config plumbing.
|
|
679
|
+
* @returns One transform result per input file, in input order.
|
|
680
|
+
* @throws {OxcRustNotImplementedError} when the native addon is unavailable.
|
|
681
|
+
*/
|
|
682
|
+
declare function transformRustBatch(files: readonly TransformRustFile[], options?: TransformSourceCodeOptions): SourceTransformResult[];
|
|
683
|
+
|
|
567
684
|
interface StandardLonghandProperties<TLength = (string & {}) | 0, TTime = string & {}> {
|
|
568
685
|
/**
|
|
569
686
|
* This feature is not Baseline because it does not work in some of the most widely-used browsers.
|
|
@@ -13267,6 +13384,18 @@ interface InteractivityProps {
|
|
|
13267
13384
|
select?: 'none' | 'text' | 'all' | 'auto';
|
|
13268
13385
|
/** @see https://tailwindcss.com/docs/will-change */
|
|
13269
13386
|
willChange?: 'auto' | 'scroll' | 'contents' | 'transform' | (string & {});
|
|
13387
|
+
/** @see https://tailwindcss.com/docs/scrollbar-width */
|
|
13388
|
+
scrollbar?: 'auto' | 'thin' | 'none';
|
|
13389
|
+
/** @see https://tailwindcss.com/docs/scrollbar-color */
|
|
13390
|
+
scrollbarThumb?: ColorPropValue;
|
|
13391
|
+
/** @see https://tailwindcss.com/docs/scrollbar-color */
|
|
13392
|
+
scrollbarTrack?: ColorPropValue;
|
|
13393
|
+
/** @see https://tailwindcss.com/docs/scrollbar-gutter */
|
|
13394
|
+
scrollbarGutter?: 'auto' | 'stable' | 'both';
|
|
13395
|
+
/** @see https://tailwindcss.com/docs/zoom */
|
|
13396
|
+
zoom?: number | (string & {});
|
|
13397
|
+
/** @see https://tailwindcss.com/docs/tab-size */
|
|
13398
|
+
tabSize?: number | (string & {});
|
|
13270
13399
|
}
|
|
13271
13400
|
/**
|
|
13272
13401
|
*
|
|
@@ -13308,6 +13437,12 @@ interface MaskProps {
|
|
|
13308
13437
|
maskRepeat?: 'repeat' | 'no-repeat' | 'repeat-x' | 'repeat-y' | 'round' | 'space';
|
|
13309
13438
|
/** CSS mask-type (shape-rendering) */
|
|
13310
13439
|
maskShape?: 'alpha' | 'luminance';
|
|
13440
|
+
/** Mask gradient from color stop (v4.1) */
|
|
13441
|
+
maskFrom?: ColorPropValue;
|
|
13442
|
+
/** Mask gradient via color stop (v4.1) */
|
|
13443
|
+
maskVia?: ColorPropValue;
|
|
13444
|
+
/** Mask gradient to color stop (v4.1) */
|
|
13445
|
+
maskTo?: ColorPropValue;
|
|
13311
13446
|
}
|
|
13312
13447
|
/**
|
|
13313
13448
|
* Variant modifiers for pseudo-classes, breakpoints, and states.
|
|
@@ -13368,6 +13503,17 @@ interface VariantModifiers {
|
|
|
13368
13503
|
motionSafe?: SzPropsBase;
|
|
13369
13504
|
contrastMore?: SzPropsBase;
|
|
13370
13505
|
contrastLess?: SzPropsBase;
|
|
13506
|
+
pointerFine?: SzPropsBase;
|
|
13507
|
+
pointerCoarse?: SzPropsBase;
|
|
13508
|
+
pointerNone?: SzPropsBase;
|
|
13509
|
+
anyPointerFine?: SzPropsBase;
|
|
13510
|
+
anyPointerCoarse?: SzPropsBase;
|
|
13511
|
+
anyPointerNone?: SzPropsBase;
|
|
13512
|
+
userValid?: SzPropsBase;
|
|
13513
|
+
userInvalid?: SzPropsBase;
|
|
13514
|
+
detailsContent?: SzPropsBase;
|
|
13515
|
+
invertedColors?: SzPropsBase;
|
|
13516
|
+
noscript?: SzPropsBase;
|
|
13371
13517
|
print?: SzPropsBase;
|
|
13372
13518
|
portrait?: SzPropsBase;
|
|
13373
13519
|
landscape?: SzPropsBase;
|
|
@@ -13480,5 +13626,5 @@ declare const DEFAULT_COMPILER_OPTIONS: Required<CompilerOptions>;
|
|
|
13480
13626
|
*/
|
|
13481
13627
|
declare function mergeOptions(options?: Partial<CompilerOptions>): Required<CompilerOptions>;
|
|
13482
13628
|
|
|
13483
|
-
export { COLOR_PROPERTIES, CsszyxCompiler, DEFAULT_COMPILER_OPTIONS, ManifestBuilder, OxcNotImplementedError, PROPERTY_CATEGORY_MAP, PropertyCategory, SzObject, VERSION, buildParentMap, createRecoveryToken, generateRecoveryToken, getCSSVariableName, getPropertyCategory, hoistCSSVariables, injectRecoveryToken, isValidRecoveryMode, mergeOptions, parseManifest, serializeManifest, transformOxc, transformSourceCode, validateManifest, validateSzRecover };
|
|
13484
|
-
export type { BackgroundProps, BorderProps, BorderRadiusValue, CSSVarUsage, ColorName, ColorObjectValue, ColorPropValue, ColorShade, ColorValue, CompilerOptions, ContainerSize, CustomTheme, EffectsProps, FilterProps, FlexboxGridProps, FractionValue, InteractivityProps, LayoutProps, NegativeSpacingValue, RecoveryManifest, RecoveryMode, RecoveryToken, ShadowValue, SizingProps, SpacingProps, SpacingScale, SpacingValue, SvgProps, SzPropValue, SzProps, SzPropsBase, TableProps, TokenData, TokenMetadata, TransformOxcResult, TransformProps, TransitionAnimationProps, TypographyProps, VariantModifiers };
|
|
13629
|
+
export { COLOR_PROPERTIES, CsszyxCompiler, DEFAULT_COMPILER_OPTIONS, ManifestBuilder, OxcNotImplementedError, OxcRustNotImplementedError, PROPERTY_CATEGORY_MAP, PropertyCategory, SzObject, VERSION, buildParentMap, createRecoveryToken, ensureRustTransformAvailable, generateRecoveryToken, getCSSVariableName, getPropertyCategory, hoistCSSVariables, injectRecoveryToken, isValidRecoveryMode, mergeOptions, parseManifest, scanGlobalVarUsages, serializeManifest, transformOxc, transformRust, transformRustBatch, transformSourceCode, validateManifest, validateSzRecover };
|
|
13630
|
+
export type { BackgroundProps, BorderProps, BorderRadiusValue, CSSVarUsage, ColorName, ColorObjectValue, ColorPropValue, ColorShade, ColorValue, CompilerOptions, ContainerSize, CssVariableMangleValue, CustomTheme, EffectsProps, FilterProps, FlexboxGridProps, FractionValue, GlobalVarAliasTableInput, GlobalVarUsageDiagnostic, GlobalVarUsageKind, GlobalVarUsageLocation, InteractivityProps, LayoutProps, NegativeSpacingValue, RecoveryManifest, RecoveryMode, RecoveryToken, ScanGlobalVarUsagesOptions, ShadowValue, SizingProps, SourceTransformResult, SpacingProps, SpacingScale, SpacingValue, SvgProps, SzPropValue, SzProps, SzPropsBase, TableProps, TokenData, TokenMetadata, TransformOxcResult, TransformProps, TransformRustFile, TransformSourceCodeOptions, TransitionAnimationProps, TypographyProps, VariantModifiers };
|