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.
- package/README.md +0 -2
- package/dist/builders.cjs.map +1 -1
- package/dist/builders.d.cts +2 -2
- package/dist/builders.d.ts +2 -2
- package/dist/builders.js.map +1 -1
- package/dist/errors.cjs +0 -16
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +1 -15
- package/dist/errors.d.ts +1 -15
- package/dist/errors.js +1 -15
- package/dist/errors.js.map +1 -1
- package/dist/filters.cjs.map +1 -1
- package/dist/filters.js.map +1 -1
- package/dist/{index-DJ_UHSQG.d.ts → index-Bkedvob6.d.ts} +10 -3
- package/dist/{index-BkvV7Z54.d.cts → index-dwm-xYbQ.d.cts} +10 -3
- package/dist/index.cjs +1 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -22
- package/dist/index.js.map +1 -1
- package/dist/renderers.cjs.map +1 -1
- package/dist/renderers.d.cts +2 -2
- package/dist/renderers.d.ts +2 -2
- package/dist/renderers.js.map +1 -1
- package/package.json +1 -1
|
@@ -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' | '
|
|
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 |
|
|
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
|
|
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' | '
|
|
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 |
|
|
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
|
|
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.
|
|
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
|
}
|