@bridge-ds/visual 0.3.7 → 0.3.10

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.
Files changed (2) hide show
  1. package/dist/index.js +15 -4
  2. 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 },
@@ -237,7 +237,8 @@ function defineConfig(input) {
237
237
  styleSuffix: input.components.styleSuffix ?? ".module.css",
238
238
  reference: input.components.reference,
239
239
  index: input.components.index,
240
- specs: input.components.specs
240
+ specs: input.components.specs,
241
+ ...input.components.styles ? { styles: input.components.styles.map(trimSlashes) } : {}
241
242
  } : void 0,
242
243
  docs: { ...input.docs },
243
244
  changesets: pkg ? { dir: trimSlashes(input.changesets?.dir ?? ".changeset"), package: pkg } : void 0,
@@ -262,6 +263,7 @@ function defineConfig(input) {
262
263
  products: input.products?.length ? input.products.map((p) => ({ ...p })) : DEFAULT_PRODUCTS.map((p) => ({ ...p })),
263
264
  changes: input.changes === "direct" ? "direct" : DEFAULT_CHANGES_MODE,
264
265
  ...input.storybook?.url ? { storybook: { url: input.storybook.url.trim().replace(/\/+$/, "") } } : {},
266
+ ...input.library?.public === true ? { library: { public: true } } : {},
265
267
  ...input.audit ? { audit: { ...input.audit } } : {},
266
268
  ...input.visualImpact ? { visualImpact: { mode: input.visualImpact.mode === "on-demand" ? "on-demand" : "auto" } } : {},
267
269
  ...input.integrations ? { integrations: { ...input.integrations } } : {},
@@ -306,7 +308,7 @@ function loadConfig(source) {
306
308
  if (!isObj(tokens)) problems.push('"tokens" must be an object');
307
309
  else
308
310
  for (const [k, v] of Object.entries(tokens)) {
309
- if (FLAT_TOKEN_KEYS.includes(k) || k === "root") {
311
+ if (FLAT_TOKEN_KEYS.includes(k) || k === "root" || k === "usage") {
310
312
  if (!isStr(v)) problems.push(`"tokens.${k}" must be a non-empty string`);
311
313
  } else if (k === "include" || k === "exclude") {
312
314
  if (!isStrList(v)) problems.push(`"tokens.${k}" must be a list of globs`);
@@ -360,6 +362,7 @@ function loadConfig(source) {
360
362
  problems.push('"contrast" must be { "path", "modes"? }');
361
363
  const comps = d.components;
362
364
  if (comps !== void 0 && (!isObj(comps) || !isStr(comps.dir))) problems.push('"components.dir" must be a non-empty string');
365
+ if (isObj(comps) && comps.styles !== void 0 && !isStrList(comps.styles)) problems.push('"components.styles" must be a list of globs');
363
366
  const cs = d.changeset;
364
367
  if (cs !== void 0 && (!isObj(cs) || !isStr(cs.package))) problems.push('"changeset.package" must be a non-empty string');
365
368
  const css = d.changesets;
@@ -392,6 +395,14 @@ function loadConfig(source) {
392
395
  else if (!/^https:\/\/[^\s/]+/.test(sb.url.trim())) problems.push('"storybook.url" must start with https://, for example https://storybook.example.com');
393
396
  else for (const k of Object.keys(sb)) if (k !== "url") problems.push(`"storybook.${k}" is not a known key`);
394
397
  }
398
+ const lib = d.library;
399
+ if (lib !== void 0) {
400
+ if (!isObj(lib)) problems.push('"library" must be an object, for example { "public": true }');
401
+ else {
402
+ if (lib.public !== void 0 && typeof lib.public !== "boolean") problems.push('"library.public" must be true or false');
403
+ for (const k of Object.keys(lib)) if (k !== "public") problems.push(`"library.${k}" is not a known key`);
404
+ }
405
+ }
395
406
  problems.push(...productProblems(d.products));
396
407
  const audit = d.audit;
397
408
  if (audit !== void 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bridge-ds/visual",
3
- "version": "0.3.7",
3
+ "version": "0.3.10",
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.13.0",
50
+ "@bridge-ds/core": "^0.16.0",
51
51
  "pixelmatch": "7.1.0",
52
52
  "playwright-core": "1.63.0",
53
53
  "pngjs": "7.0.0"