@csszyx/compiler 0.10.5 → 0.10.6

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.cjs CHANGED
@@ -4261,6 +4261,18 @@ function ensureRustTransformAvailable() {
4261
4261
  throw err;
4262
4262
  }
4263
4263
  }
4264
+ let rustAvailability;
4265
+ function isRustTransformAvailable() {
4266
+ if (rustAvailability === void 0) {
4267
+ try {
4268
+ ensureRustTransformAvailable();
4269
+ rustAvailability = true;
4270
+ } catch {
4271
+ rustAvailability = false;
4272
+ }
4273
+ }
4274
+ return rustAvailability;
4275
+ }
4264
4276
  function transformRustBatch(files, options) {
4265
4277
  try {
4266
4278
  return native.transformBatch(
@@ -4371,6 +4383,7 @@ exports.ensureRustTransformAvailable = ensureRustTransformAvailable;
4371
4383
  exports.generateRecoveryToken = generateRecoveryToken;
4372
4384
  exports.hoistCSSVariables = hoistCSSVariables;
4373
4385
  exports.injectRecoveryToken = injectRecoveryToken;
4386
+ exports.isRustTransformAvailable = isRustTransformAvailable;
4374
4387
  exports.isValidRecoveryMode = isValidRecoveryMode;
4375
4388
  exports.mergeOptions = mergeOptions;
4376
4389
  exports.parseManifest = parseManifest;
package/dist/index.d.cts CHANGED
@@ -666,6 +666,18 @@ declare function transformRust(source: string, filename?: string, options?: Tran
666
666
  * @throws {OxcRustNotImplementedError} when the native addon is unavailable.
667
667
  */
668
668
  declare function ensureRustTransformAvailable(): void;
669
+ /**
670
+ * Non-throwing companion to {@link ensureRustTransformAvailable}: returns whether
671
+ * the native Rust addon can be loaded on the current host. Build integrations use
672
+ * it to gracefully degrade the DEFAULT `rust` parser to `oxc` when no prebuilt
673
+ * binary is installed for the platform (unsupported arch, optional deps omitted,
674
+ * or a cross-platform frozen lockfile) — instead of hard-failing a build the user
675
+ * never explicitly opted into `rust` for. An EXPLICIT `rust` choice must still use
676
+ * {@link ensureRustTransformAvailable} so it fails loudly.
677
+ *
678
+ * @returns true when the native transform is usable, false otherwise.
679
+ */
680
+ declare function isRustTransformAvailable(): boolean;
669
681
  /**
670
682
  * Transform a batch of files through the Rust native engine in one napi call.
671
683
  *
@@ -13621,5 +13633,5 @@ declare const DEFAULT_COMPILER_OPTIONS: Required<CompilerOptions>;
13621
13633
  */
13622
13634
  declare function mergeOptions(options?: Partial<CompilerOptions>): Required<CompilerOptions>;
13623
13635
 
13624
- 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 };
13636
+ export { COLOR_PROPERTIES, CsszyxCompiler, DEFAULT_COMPILER_OPTIONS, ManifestBuilder, OxcNotImplementedError, OxcRustNotImplementedError, PROPERTY_CATEGORY_MAP, PropertyCategory, SzObject, VERSION, buildParentMap, createRecoveryToken, ensureRustTransformAvailable, generateRecoveryToken, getCSSVariableName, getPropertyCategory, hoistCSSVariables, injectRecoveryToken, isRustTransformAvailable, isValidRecoveryMode, mergeOptions, parseManifest, scanGlobalVarUsages, serializeManifest, transformOxc, transformRust, transformRustBatch, transformSourceCode, validateManifest, validateSzRecover };
13625
13637
  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
@@ -666,6 +666,18 @@ declare function transformRust(source: string, filename?: string, options?: Tran
666
666
  * @throws {OxcRustNotImplementedError} when the native addon is unavailable.
667
667
  */
668
668
  declare function ensureRustTransformAvailable(): void;
669
+ /**
670
+ * Non-throwing companion to {@link ensureRustTransformAvailable}: returns whether
671
+ * the native Rust addon can be loaded on the current host. Build integrations use
672
+ * it to gracefully degrade the DEFAULT `rust` parser to `oxc` when no prebuilt
673
+ * binary is installed for the platform (unsupported arch, optional deps omitted,
674
+ * or a cross-platform frozen lockfile) — instead of hard-failing a build the user
675
+ * never explicitly opted into `rust` for. An EXPLICIT `rust` choice must still use
676
+ * {@link ensureRustTransformAvailable} so it fails loudly.
677
+ *
678
+ * @returns true when the native transform is usable, false otherwise.
679
+ */
680
+ declare function isRustTransformAvailable(): boolean;
669
681
  /**
670
682
  * Transform a batch of files through the Rust native engine in one napi call.
671
683
  *
@@ -13621,5 +13633,5 @@ declare const DEFAULT_COMPILER_OPTIONS: Required<CompilerOptions>;
13621
13633
  */
13622
13634
  declare function mergeOptions(options?: Partial<CompilerOptions>): Required<CompilerOptions>;
13623
13635
 
13624
- 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 };
13636
+ export { COLOR_PROPERTIES, CsszyxCompiler, DEFAULT_COMPILER_OPTIONS, ManifestBuilder, OxcNotImplementedError, OxcRustNotImplementedError, PROPERTY_CATEGORY_MAP, PropertyCategory, SzObject, VERSION, buildParentMap, createRecoveryToken, ensureRustTransformAvailable, generateRecoveryToken, getCSSVariableName, getPropertyCategory, hoistCSSVariables, injectRecoveryToken, isRustTransformAvailable, isValidRecoveryMode, mergeOptions, parseManifest, scanGlobalVarUsages, serializeManifest, transformOxc, transformRust, transformRustBatch, transformSourceCode, validateManifest, validateSzRecover };
13625
13637
  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.mjs CHANGED
@@ -4242,6 +4242,18 @@ function ensureRustTransformAvailable() {
4242
4242
  throw err;
4243
4243
  }
4244
4244
  }
4245
+ let rustAvailability;
4246
+ function isRustTransformAvailable() {
4247
+ if (rustAvailability === void 0) {
4248
+ try {
4249
+ ensureRustTransformAvailable();
4250
+ rustAvailability = true;
4251
+ } catch {
4252
+ rustAvailability = false;
4253
+ }
4254
+ }
4255
+ return rustAvailability;
4256
+ }
4245
4257
  function transformRustBatch(files, options) {
4246
4258
  try {
4247
4259
  return transformBatch(
@@ -4326,4 +4338,4 @@ function mergeOptions(options = {}) {
4326
4338
  };
4327
4339
  }
4328
4340
 
4329
- export { COLOR_PROPERTIES, CsszyxCompiler, DEFAULT_COMPILER_OPTIONS, KNOWN_VARIANTS, ManifestBuilder, OxcNotImplementedError, OxcRustNotImplementedError, PROPERTY_MAP, PropertyCategory, VERSION, buildParentMap, createRecoveryToken, ensureRustTransformAvailable, generateRecoveryToken, getCSSVariableName, getPropertyCategory, hoistCSSVariables, injectRecoveryToken, isValidRecoveryMode, mergeOptions, parseManifest, scanGlobalVarUsages, serializeManifest, transform, transformOxc, transformRust, transformRustBatch, transformSourceCode, validateManifest, validateSzRecover };
4341
+ export { COLOR_PROPERTIES, CsszyxCompiler, DEFAULT_COMPILER_OPTIONS, KNOWN_VARIANTS, ManifestBuilder, OxcNotImplementedError, OxcRustNotImplementedError, PROPERTY_MAP, PropertyCategory, VERSION, buildParentMap, createRecoveryToken, ensureRustTransformAvailable, generateRecoveryToken, getCSSVariableName, getPropertyCategory, hoistCSSVariables, injectRecoveryToken, isRustTransformAvailable, isValidRecoveryMode, mergeOptions, parseManifest, scanGlobalVarUsages, serializeManifest, transform, transformOxc, transformRust, transformRustBatch, transformSourceCode, validateManifest, validateSzRecover };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@csszyx/compiler",
3
- "version": "0.10.5",
3
+ "version": "0.10.6",
4
4
  "description": "Core compiler and transformation logic for csszyx",
5
5
  "keywords": [
6
6
  "csszyx",
@@ -65,7 +65,7 @@
65
65
  "@babel/types": "^7.23.6",
66
66
  "magic-string": "0.30.21",
67
67
  "oxc-parser": "0.131.0",
68
- "@csszyx/core": "0.10.5"
68
+ "@csszyx/core": "0.10.6"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@types/babel__core": "^7.20.5",