dispersa 0.4.0 → 0.4.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.
@@ -325,7 +325,7 @@ type CssRendererOptions = {
325
325
  /**
326
326
  * Error code identifying the type of build error
327
327
  */
328
- type ErrorCode = 'TOKEN_REFERENCE' | 'CIRCULAR_REFERENCE' | 'VALIDATION' | 'COLOR_PARSE' | 'DIMENSION_FORMAT' | 'FILE_OPERATION' | 'CONFIGURATION' | 'BASE_PERMUTATION' | 'MODIFIER' | 'UNKNOWN';
328
+ type ErrorCode = 'TOKEN_REFERENCE' | 'CIRCULAR_REFERENCE' | 'VALIDATION' | 'FILE_OPERATION' | 'CONFIGURATION' | 'BASE_PERMUTATION' | 'MODIFIER' | 'UNKNOWN';
329
329
  /**
330
330
  * Structured error from a build operation
331
331
  *
@@ -473,6 +473,13 @@ type LifecycleHooks = {
473
473
  onBuildEnd?: (result: BuildResult) => void | Promise<void>;
474
474
  };
475
475
 
476
+ /**
477
+ * Function that generates an output file path based on modifier inputs.
478
+ *
479
+ * Used as the `file` property on `OutputConfig` and builder configs when
480
+ * the file name needs to vary per permutation.
481
+ */
482
+ type FileFunction = (modifierInputs: ModifierInputs) => string;
476
483
  /**
477
484
  * Output configuration for a single build target
478
485
  *
@@ -577,7 +584,7 @@ type OutputConfig<TOptions extends FormatOptions = FormatOptions> = Omit<OutputC
577
584
  * }
578
585
  * ```
579
586
  */
580
- file?: string | ((modifierInputs: ModifierInputs) => string);
587
+ file?: string | FileFunction;
581
588
  /**
582
589
  * Renderer-specific options passed to the formatter.
583
590
  */
@@ -701,4 +708,4 @@ type DispersaOptions = Omit<DispersaOptionsBase, 'validation'> & {
701
708
  validation?: ValidationOptions;
702
709
  };
703
710
 
704
- export { type AndroidRendererOptions as A, type BuildConfig as B, type CssRendererOptions as C, type DispersaOptions as D, type ErrorCode as E, type FormatOptions as F, type IosRendererOptions as I, type LifecycleHooks as L, type ModifierInputs as M, type OutputConfig as O, type PermutationData as P, type ResolverDocument as R, type SelectorFunction as S, type TailwindRendererOptions as T, type ValidationOptions as V, type BuildResult as a, type ValidationMode as b, type BuildError as c, type BuildOutput as d, type MediaQueryFunction as e, type OutputTree as f, type Renderer as g, type RenderContext as h, type RenderMeta as i, type RenderOutput as j, defineRenderer as k };
711
+ export { type AndroidRendererOptions as A, type BuildConfig as B, type CssRendererOptions as C, type DispersaOptions as D, type ErrorCode as E, type FileFunction as F, type IosRendererOptions as I, type LifecycleHooks as L, type ModifierInputs as M, type OutputConfig as O, type PermutationData as P, type ResolverDocument as R, type SelectorFunction as S, type TailwindRendererOptions as T, type ValidationOptions as V, type BuildResult as a, type ValidationMode as b, type BuildError as c, type BuildOutput as d, type FormatOptions as e, type MediaQueryFunction as f, type OutputTree as g, type Renderer as h, type RenderContext as i, type RenderMeta as j, type RenderOutput as k, defineRenderer as l };
@@ -325,7 +325,7 @@ type CssRendererOptions = {
325
325
  /**
326
326
  * Error code identifying the type of build error
327
327
  */
328
- type ErrorCode = 'TOKEN_REFERENCE' | 'CIRCULAR_REFERENCE' | 'VALIDATION' | 'COLOR_PARSE' | 'DIMENSION_FORMAT' | 'FILE_OPERATION' | 'CONFIGURATION' | 'BASE_PERMUTATION' | 'MODIFIER' | 'UNKNOWN';
328
+ type ErrorCode = 'TOKEN_REFERENCE' | 'CIRCULAR_REFERENCE' | 'VALIDATION' | 'FILE_OPERATION' | 'CONFIGURATION' | 'BASE_PERMUTATION' | 'MODIFIER' | 'UNKNOWN';
329
329
  /**
330
330
  * Structured error from a build operation
331
331
  *
@@ -473,6 +473,13 @@ type LifecycleHooks = {
473
473
  onBuildEnd?: (result: BuildResult) => void | Promise<void>;
474
474
  };
475
475
 
476
+ /**
477
+ * Function that generates an output file path based on modifier inputs.
478
+ *
479
+ * Used as the `file` property on `OutputConfig` and builder configs when
480
+ * the file name needs to vary per permutation.
481
+ */
482
+ type FileFunction = (modifierInputs: ModifierInputs) => string;
476
483
  /**
477
484
  * Output configuration for a single build target
478
485
  *
@@ -577,7 +584,7 @@ type OutputConfig<TOptions extends FormatOptions = FormatOptions> = Omit<OutputC
577
584
  * }
578
585
  * ```
579
586
  */
580
- file?: string | ((modifierInputs: ModifierInputs) => string);
587
+ file?: string | FileFunction;
581
588
  /**
582
589
  * Renderer-specific options passed to the formatter.
583
590
  */
@@ -701,4 +708,4 @@ type DispersaOptions = Omit<DispersaOptionsBase, 'validation'> & {
701
708
  validation?: ValidationOptions;
702
709
  };
703
710
 
704
- export { type AndroidRendererOptions as A, type BuildConfig as B, type CssRendererOptions as C, type DispersaOptions as D, type ErrorCode as E, type FormatOptions as F, type IosRendererOptions as I, type LifecycleHooks as L, type ModifierInputs as M, type OutputConfig as O, type PermutationData as P, type ResolverDocument as R, type SelectorFunction as S, type TailwindRendererOptions as T, type ValidationOptions as V, type BuildResult as a, type ValidationMode as b, type BuildError as c, type BuildOutput as d, type MediaQueryFunction as e, type OutputTree as f, type Renderer as g, type RenderContext as h, type RenderMeta as i, type RenderOutput as j, defineRenderer as k };
711
+ export { type AndroidRendererOptions as A, type BuildConfig as B, type CssRendererOptions as C, type DispersaOptions as D, type ErrorCode as E, type FileFunction as F, type IosRendererOptions as I, type LifecycleHooks as L, type ModifierInputs as M, type OutputConfig as O, type PermutationData as P, type ResolverDocument as R, type SelectorFunction as S, type TailwindRendererOptions as T, type ValidationOptions as V, type BuildResult as a, type ValidationMode as b, type BuildError as c, type BuildOutput as d, type FormatOptions as e, type MediaQueryFunction as f, type OutputTree as g, type Renderer as h, type RenderContext as i, type RenderMeta as j, type RenderOutput as k, defineRenderer as l };
package/dist/index.cjs CHANGED
@@ -86,7 +86,7 @@ var init_token_utils = __esm({
86
86
  });
87
87
 
88
88
  // src/shared/errors/index.ts
89
- exports.DispersaError = void 0; exports.TokenReferenceError = void 0; exports.CircularReferenceError = void 0; exports.ValidationError = void 0; exports.ColorParseError = void 0; exports.DimensionFormatError = void 0; exports.FileOperationError = void 0; exports.ConfigurationError = void 0; exports.BasePermutationError = void 0; exports.ModifierError = void 0;
89
+ exports.DispersaError = void 0; exports.TokenReferenceError = void 0; exports.CircularReferenceError = void 0; exports.ValidationError = void 0; exports.FileOperationError = void 0; exports.ConfigurationError = void 0; exports.BasePermutationError = void 0; exports.ModifierError = void 0;
90
90
  var init_errors = __esm({
91
91
  "src/shared/errors/index.ts"() {
92
92
  exports.DispersaError = class extends Error {
@@ -137,20 +137,6 @@ var init_errors = __esm({
137
137
  this.name = "ValidationError";
138
138
  }
139
139
  };
140
- exports.ColorParseError = class extends exports.DispersaError {
141
- constructor(colorValue) {
142
- super(`Color parsing failed: '${colorValue}'. Provide a valid CSS color or DTCG color object.`);
143
- this.colorValue = colorValue;
144
- this.name = "ColorParseError";
145
- }
146
- };
147
- exports.DimensionFormatError = class extends exports.DispersaError {
148
- constructor(dimensionValue) {
149
- super(`Dimension parsing failed: '${dimensionValue}'. Provide a valid DTCG dimension object.`);
150
- this.dimensionValue = dimensionValue;
151
- this.name = "DimensionFormatError";
152
- }
153
- };
154
140
  exports.FileOperationError = class extends exports.DispersaError {
155
141
  constructor(operation, filePath, originalError) {
156
142
  super(`Failed to ${operation} file: ${filePath}. ${originalError.message}`);
@@ -3907,12 +3893,6 @@ function toBuildError(error, outputName) {
3907
3893
  if (error instanceof exports.ValidationError) {
3908
3894
  return { message, code: "VALIDATION", severity: "error" };
3909
3895
  }
3910
- if (error instanceof exports.ColorParseError) {
3911
- return { message, code: "COLOR_PARSE", severity: "error" };
3912
- }
3913
- if (error instanceof exports.DimensionFormatError) {
3914
- return { message, code: "DIMENSION_FORMAT", severity: "error" };
3915
- }
3916
3896
  if (error instanceof exports.FileOperationError) {
3917
3897
  return { message, code: "FILE_OPERATION", path: error.filePath, severity: "error" };
3918
3898
  }