@whzxc/agent-design-gallery 0.13.1 → 0.13.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whzxc/agent-design-gallery",
3
- "version": "0.13.1",
3
+ "version": "0.13.2",
4
4
  "description": "Local TSX design toolkit and SVG viewer",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -28,7 +28,7 @@
28
28
  "start": "node src/cli.mjs",
29
29
  "benchmark": "node tooling/benchmark.mjs",
30
30
  "compare": "node tooling/compare.mjs",
31
- "test": "node --test test/*.test.mjs",
31
+ "test": "node --import ./tooling/test-temp.mjs --test test/*.test.mjs",
32
32
  "prepack": "node tooling/package.mjs"
33
33
  },
34
34
  "dependencies": {
@@ -20,7 +20,7 @@ function frameStructure(frame) {
20
20
  .trim();
21
21
  }
22
22
 
23
- function frameOwnsPart(frame, source, part, config) {
23
+ function frameOwnsPart(frame, source, part) {
24
24
  return (frame.owners ?? frameOwners(frame.html)).some(owner => owner.source === source && owner.export === part);
25
25
  }
26
26
 
@@ -300,10 +300,11 @@ export async function check(config, args = [], options = {}, log = console.log,
300
300
  const active = validatedMap.bindings.filter(binding => binding.active);
301
301
  const hasBinding = (source, part = null) => active.some(binding => binding.design.source === source && (part === null ? binding.design.part === undefined : binding.design.part === part));
302
302
  for (const [source, built] of allBuilt) {
303
- const layer = source.split('/')[0];
303
+ const designSource = path.relative(config.design, path.join(config.root, source)).split(path.sep).join('/');
304
+ const layer = designSource.split('/')[0];
304
305
  if (!production.includes(layer)) continue;
305
306
  for (const part of built.parts ?? []) {
306
- const frames = built.frames.filter(frame => frameOwnsPart(frame, source.replace(/^design\//, ''), part, config));
307
+ const frames = built.frames.filter(frame => frameOwnsPart(frame, designSource, part));
307
308
  if (layer !== top && !hasBinding(source, part) && !frames.some(frame => frame.proposed)) add({ code: 'OWNER_PART_UNBOUND', message: `Exported part ${part} has no implementation binding or proposed frame; add a binding or mark a review frame with proposed`, line: null, column: null }, path.join(config.root, source));
308
309
  }
309
310
  if (layer === top && !hasBinding(source)) add({ code: 'OWNER_SURFACE_UNBOUND', message: `Surface source has no whole-source implementation binding; add a binding without part`, line: null, column: null }, path.join(config.root, source));
@@ -311,7 +312,7 @@ export async function check(config, args = [], options = {}, log = console.log,
311
312
  }
312
313
  }
313
314
  if (config.check?.singleConsumer !== false) {
314
- for (const warning of singleConsumerComponents(graph, sourceDirectories(config), Object.fromEntries([...allBuilt].map(([source, built]) => [source.replace(/^design\//, ''), built.parts ?? []])))) {
315
+ for (const warning of singleConsumerComponents(graph, sourceDirectories(config), Object.fromEntries([...allBuilt].map(([source, built]) => [path.relative(config.design, path.join(config.root, source)).split(path.sep).join('/'), built.parts ?? []])))) {
315
316
  warnings.push({ code: warning.code, message: warning.message, next: [] });
316
317
  if (!options.json) log(`WARNING ${warning.message}`);
317
318
  }