@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 CHANGED
@@ -95,20 +95,24 @@ runtime consumers like `@csszyx/dynamic`.
95
95
 
96
96
  Babel-based source transform. Parses TSX/JSX, walks the AST, rewrites
97
97
  `sz`/`szRecover`/`_sz` constructs, emits the new source via Babel's
98
- code generator. Source of truth before v0.8.0; retained as the fallback
99
- path in v0.8.0+.
98
+ code generator. Retained as the final compatibility fallback.
100
99
 
101
100
  #### `transformOxc(source: string, filename?: string, options?: TransformSourceCodeOptions): TransformOxcResult` _(since v0.8.0)_
102
101
 
103
102
  oxc-parser + magic-string source transform. Same return shape as
104
103
  `transformSourceCode` so consumers (and the parity harness) can diff
105
- both implementations cleanly. Throws `OxcNotImplementedError` only for
106
- patterns that fall outside the curated Phase D coverage; the unplugin
107
- catches that error and routes to `transformSourceCode` as the fallback.
104
+ both implementations cleanly. JavaScript fallback when the native Rust
105
+ engine is unavailable (e.g. unsupported platform). Set
106
+ `build.parser: 'oxc'` to use this path.
108
107
 
109
- Surgical edits preserve every byte the user wrote outside the touched
110
- `sz`/`szRecover` ranges — Babel's pretty-printer would have collapsed
111
- or expanded surrounding whitespace.
108
+ #### `transformRust(source: string, filename?: string, options?: TransformSourceCodeOptions): TransformRustResult` _(default since v0.9.0)_
109
+
110
+ Native Rust engine via napi-rs. Fastest parser path. Requires the
111
+ matching optional `@csszyx/core-*` platform package. Missing native
112
+ packages surface `CsszyxNativeUnavailableError`.
113
+
114
+ All three transform paths preserve every byte the user wrote outside the
115
+ touched `sz`/`szRecover` ranges.
112
116
 
113
117
  #### `isValidSzProp(szProp: unknown): boolean`
114
118
 
@@ -7,6 +7,7 @@ function __szColorVar(v) {
7
7
  if (v.startsWith("--")) {
8
8
  return `var(${v})`;
9
9
  }
10
+ if (/[);\s\\]/.test(v)) return v;
10
11
  return `var(--color-${v})`;
11
12
  }
12
13
 
@@ -5,6 +5,7 @@ function __szColorVar(v) {
5
5
  if (v.startsWith("--")) {
6
6
  return `var(${v})`;
7
7
  }
8
+ if (/[);\s\\]/.test(v)) return v;
8
9
  return `var(--color-${v})`;
9
10
  }
10
11