@dicebear/core 11.0.0 → 11.1.0-rc.2

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/lib/index.d.ts CHANGED
@@ -2,17 +2,17 @@ import { Style as StyleBase, type StyleDefinition } from './Style.js';
2
2
  import { Avatar as AvatarBase } from './Avatar.js';
3
3
  import type { NoInferStyle, StyleOptions } from './StyleOptions.js';
4
4
  /**
5
- * A style whose definition is checked against the definition schema before
6
- * it is parsed. `@dicebear/core/lite` exports the same class without the
7
- * check, for definitions that come from your own code.
5
+ * A style whose definition passes {@link StyleValidator} before it is parsed.
6
+ * `@dicebear/core/lite` exports the same class without the validation, for
7
+ * definitions that come from your own code.
8
8
  */
9
9
  export declare class Style<D = unknown> extends StyleBase<D> {
10
10
  constructor(data: D);
11
11
  }
12
12
  /**
13
- * An avatar whose options are checked against the options schema before it
14
- * renders. `@dicebear/core/lite` exports the same class without the check,
15
- * for options that come from your own code.
13
+ * An avatar whose options pass {@link OptionsValidator} before it renders.
14
+ * `@dicebear/core/lite` exports the same class without the validation, for
15
+ * options that come from your own code.
16
16
  */
17
17
  export declare class Avatar<D = unknown> extends AvatarBase<D> {
18
18
  constructor(style: StyleBase<D>, optionsInput?: StyleOptions<NoInferStyle<D>>);
package/lib/index.js CHANGED
@@ -2,41 +2,25 @@ import { Style as StyleBase } from './Style.js';
2
2
  import { Avatar as AvatarBase } from './Avatar.js';
3
3
  import { StyleValidator } from './Validator/StyleValidator.js';
4
4
  import { OptionsValidator } from './Validator/OptionsValidator.js';
5
- import { StyleValidationError } from './Error/StyleValidationError.js';
6
- import { OptionsValidationError } from './Error/OptionsValidationError.js';
7
- import { Depth } from './Utils/Depth.js';
8
- import { Finite } from './Utils/Finite.js';
9
5
  /**
10
- * A style whose definition is checked against the definition schema before
11
- * it is parsed. `@dicebear/core/lite` exports the same class without the
12
- * check, for definitions that come from your own code.
6
+ * A style whose definition passes {@link StyleValidator} before it is parsed.
7
+ * `@dicebear/core/lite` exports the same class without the validation, for
8
+ * definitions that come from your own code.
13
9
  */
14
10
  export class Style extends StyleBase {
15
11
  constructor(data) {
16
- if (Depth.exceeds(data)) {
17
- throw new StyleValidationError([{ message: Depth.MESSAGE }]);
18
- }
19
12
  StyleValidator.validate(data);
20
13
  super(data);
21
14
  }
22
15
  }
23
16
  /**
24
- * An avatar whose options are checked against the options schema before it
25
- * renders. `@dicebear/core/lite` exports the same class without the check,
26
- * for options that come from your own code.
17
+ * An avatar whose options pass {@link OptionsValidator} before it renders.
18
+ * `@dicebear/core/lite` exports the same class without the validation, for
19
+ * options that come from your own code.
27
20
  */
28
21
  export class Avatar extends AvatarBase {
29
22
  constructor(style, optionsInput) {
30
- if (Depth.exceeds(optionsInput)) {
31
- throw new OptionsValidationError([{ message: Depth.MESSAGE }]);
32
- }
33
- OptionsValidator.validate(optionsInput ?? {});
34
- const nonFinite = Finite.find(optionsInput);
35
- if (nonFinite !== undefined) {
36
- throw new OptionsValidationError([
37
- { instancePath: nonFinite, keyword: 'type', message: Finite.MESSAGE },
38
- ]);
39
- }
23
+ OptionsValidator.validate(optionsInput);
40
24
  super(style, optionsInput);
41
25
  }
42
26
  }
package/lib/lite.js CHANGED
@@ -1,8 +1,8 @@
1
- // The same API as the package root, without the schema validators. A
2
- // bundle that imports this entry leaves the two compiled validators out,
3
- // which is about half of the library. Use it when the style definitions and
4
- // the options come from your own code, and stay on the root entry when
5
- // either arrives from outside.
1
+ // The same API as the package root, without the validators. A bundle that
2
+ // imports this entry leaves `StyleValidator` and `OptionsValidator` out, and
3
+ // with them the two compiled schemas, which is about half of the library.
4
+ // Use it when the style definitions and the options come from your own code,
5
+ // and stay on the root entry when either arrives from outside.
6
6
  export { Style } from './Style.js';
7
7
  export { Avatar } from './Avatar.js';
8
8
  export { OptionsDescriptor } from './OptionsDescriptor.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dicebear/core",
3
- "version": "11.0.0",
3
+ "version": "11.1.0-rc.2",
4
4
  "description": "Unique avatars from dozens of styles — deterministic, customizable, vector-based.",
5
5
  "keywords": [
6
6
  "avatar",
@@ -49,7 +49,7 @@
49
49
  "test": "node --test"
50
50
  },
51
51
  "devDependencies": {
52
- "@dicebear/schema": "^3.0.0",
52
+ "@dicebear/schema": "^3.1.0",
53
53
  "@exodus/schemasafe": "^1.3.0",
54
54
  "@tsconfig/recommended": "^1.0.13",
55
55
  "del-cli": "^7.0.0",