@bridge-ds/visual 0.3.7 → 0.3.9
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.js +12 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -139,7 +139,7 @@ var DEFAULT_GOVERNANCE = {
|
|
|
139
139
|
owners: { design: [], tech: [] }
|
|
140
140
|
};
|
|
141
141
|
var FLAT_TOKEN_KEYS = ["primitives", "brands", "semantic", "base", "density", "components", "contrastChecks"];
|
|
142
|
-
var CANONICAL_TOKEN_KEYS = ["root", "include", "exclude", "tiers", "layers"];
|
|
142
|
+
var CANONICAL_TOKEN_KEYS = ["root", "include", "exclude", "tiers", "layers", "usage"];
|
|
143
143
|
var FLAT_MODE_KEYS = ["brands", "themes", "densities", "defaults"];
|
|
144
144
|
var AXIS_OF = { brands: "brand", themes: "theme", densities: "density" };
|
|
145
145
|
var ConfigError = class extends Error {
|
|
@@ -227,7 +227,7 @@ function defineConfig(input) {
|
|
|
227
227
|
const contrastFile = contrastPath ?? [root === "." ? "" : root, paths.contrastChecks].filter(Boolean).join("/");
|
|
228
228
|
return {
|
|
229
229
|
repo: parseRepoInput(input.repo, input.branch),
|
|
230
|
-
tokens: { ...paths, include: input.tokens?.include ?? ["**/*.tokens.json"], exclude: input.tokens?.exclude ?? [], tiers, layers },
|
|
230
|
+
tokens: { ...paths, include: input.tokens?.include ?? ["**/*.tokens.json"], exclude: input.tokens?.exclude ?? [], tiers, layers, ...t.usage ? { usage: trimSlashes(t.usage) } : {} },
|
|
231
231
|
axes,
|
|
232
232
|
modes,
|
|
233
233
|
contrast: { path: contrastFile, modes: input.contrast?.modes },
|
|
@@ -262,6 +262,7 @@ function defineConfig(input) {
|
|
|
262
262
|
products: input.products?.length ? input.products.map((p) => ({ ...p })) : DEFAULT_PRODUCTS.map((p) => ({ ...p })),
|
|
263
263
|
changes: input.changes === "direct" ? "direct" : DEFAULT_CHANGES_MODE,
|
|
264
264
|
...input.storybook?.url ? { storybook: { url: input.storybook.url.trim().replace(/\/+$/, "") } } : {},
|
|
265
|
+
...input.library?.public === true ? { library: { public: true } } : {},
|
|
265
266
|
...input.audit ? { audit: { ...input.audit } } : {},
|
|
266
267
|
...input.visualImpact ? { visualImpact: { mode: input.visualImpact.mode === "on-demand" ? "on-demand" : "auto" } } : {},
|
|
267
268
|
...input.integrations ? { integrations: { ...input.integrations } } : {},
|
|
@@ -306,7 +307,7 @@ function loadConfig(source) {
|
|
|
306
307
|
if (!isObj(tokens)) problems.push('"tokens" must be an object');
|
|
307
308
|
else
|
|
308
309
|
for (const [k, v] of Object.entries(tokens)) {
|
|
309
|
-
if (FLAT_TOKEN_KEYS.includes(k) || k === "root") {
|
|
310
|
+
if (FLAT_TOKEN_KEYS.includes(k) || k === "root" || k === "usage") {
|
|
310
311
|
if (!isStr(v)) problems.push(`"tokens.${k}" must be a non-empty string`);
|
|
311
312
|
} else if (k === "include" || k === "exclude") {
|
|
312
313
|
if (!isStrList(v)) problems.push(`"tokens.${k}" must be a list of globs`);
|
|
@@ -392,6 +393,14 @@ function loadConfig(source) {
|
|
|
392
393
|
else if (!/^https:\/\/[^\s/]+/.test(sb.url.trim())) problems.push('"storybook.url" must start with https://, for example https://storybook.example.com');
|
|
393
394
|
else for (const k of Object.keys(sb)) if (k !== "url") problems.push(`"storybook.${k}" is not a known key`);
|
|
394
395
|
}
|
|
396
|
+
const lib = d.library;
|
|
397
|
+
if (lib !== void 0) {
|
|
398
|
+
if (!isObj(lib)) problems.push('"library" must be an object, for example { "public": true }');
|
|
399
|
+
else {
|
|
400
|
+
if (lib.public !== void 0 && typeof lib.public !== "boolean") problems.push('"library.public" must be true or false');
|
|
401
|
+
for (const k of Object.keys(lib)) if (k !== "public") problems.push(`"library.${k}" is not a known key`);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
395
404
|
problems.push(...productProblems(d.products));
|
|
396
405
|
const audit = d.audit;
|
|
397
406
|
if (audit !== void 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bridge-ds/visual",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Bridge visual impact analysis: screenshots the stories and app screens a design system change touches, at the base and head refs, and pixel-diffs them into before/after/diff images and a JSON manifest.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"build:package": "node ../../scripts/build-packages.mjs visual"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@bridge-ds/core": "^0.
|
|
50
|
+
"@bridge-ds/core": "^0.15.0",
|
|
51
51
|
"pixelmatch": "7.1.0",
|
|
52
52
|
"playwright-core": "1.63.0",
|
|
53
53
|
"pngjs": "7.0.0"
|