@adobe/design-data 3.2.5 → 3.2.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/package.json +3 -2
- package/src/validate.js +7 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/design-data",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.6",
|
|
4
4
|
"description": "Node.js helpers for @adobe/design-data-wasm: filesystem dataset loading, token write operations, and authoring-session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"ajv": "^8.17.1",
|
|
47
47
|
"ajv-formats": "^3.0.1",
|
|
48
|
-
"@adobe/design-data-
|
|
48
|
+
"@adobe/design-data-spec": "4.7.0",
|
|
49
|
+
"@adobe/design-data-wasm": "0.11.0"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"ava": "^6.1.2"
|
package/src/validate.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* Mirrors the Rust implementation in sdk/core/src/validate/structural.rs using
|
|
19
19
|
* Ajv 2020-12 (same draft as the Rust jsonschema crate).
|
|
20
20
|
*
|
|
21
|
-
* Schema source: packages/
|
|
21
|
+
* Schema source: packages/design-data-spec/schemas/ (published in @adobe/design-data-spec)
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import { createRequire } from "node:module";
|
|
@@ -34,14 +34,14 @@ import { buildDataset, walkTokenFiles } from "./load.js";
|
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Attempt to locate the Spectrum token schemas directory by resolving
|
|
37
|
-
* @adobe/
|
|
37
|
+
* @adobe/design-data-spec (the npm package that ships them).
|
|
38
38
|
*
|
|
39
39
|
* @returns {string|null} Absolute path to the schemas/ directory, or null.
|
|
40
40
|
*/
|
|
41
|
-
function
|
|
41
|
+
function resolveSpecSchemaDir() {
|
|
42
42
|
try {
|
|
43
43
|
const req = createRequire(import.meta.url);
|
|
44
|
-
const pkgJson = req.resolve("@adobe/
|
|
44
|
+
const pkgJson = req.resolve("@adobe/design-data-spec/package.json");
|
|
45
45
|
return join(dirname(pkgJson), "schemas");
|
|
46
46
|
} catch {
|
|
47
47
|
return null;
|
|
@@ -53,7 +53,7 @@ function resolveSpectrumTokensSchemaDir() {
|
|
|
53
53
|
*
|
|
54
54
|
* @param {string|null|undefined} schemaPath - Caller-supplied override (the
|
|
55
55
|
* directory that contains token-types/ and token-file.json). If omitted the
|
|
56
|
-
* function falls back to @adobe/
|
|
56
|
+
* function falls back to @adobe/design-data-spec.
|
|
57
57
|
* @param {{ required?: boolean }} [opts]
|
|
58
58
|
* @returns {string|null} Absolute path to the schemas directory, or null when
|
|
59
59
|
* no path was supplied AND auto-discovery failed (only when required is false).
|
|
@@ -78,7 +78,7 @@ export function resolveSchemaDir(schemaPath, { required = true } = {}) {
|
|
|
78
78
|
return schemaPath;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
const fallback =
|
|
81
|
+
const fallback = resolveSpecSchemaDir();
|
|
82
82
|
if (fallback && existsSync(join(fallback, "token-types"))) {
|
|
83
83
|
return fallback;
|
|
84
84
|
}
|
|
@@ -86,7 +86,7 @@ export function resolveSchemaDir(schemaPath, { required = true } = {}) {
|
|
|
86
86
|
if (required) {
|
|
87
87
|
throw new Error(
|
|
88
88
|
`Cannot locate the Spectrum token schemas directory. ` +
|
|
89
|
-
`Either install @adobe/
|
|
89
|
+
`Either install @adobe/design-data-spec or pass an explicit schema_path ` +
|
|
90
90
|
`pointing at a directory containing token-types/ and token-file.json.`,
|
|
91
91
|
);
|
|
92
92
|
}
|