@goodbones/core 0.1.0-beta.2 → 0.1.0-beta.3

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 (33) hide show
  1. package/build/dts/domain/manifest-location.d.ts +2 -0
  2. package/build/dts/domain/manifest-location.d.ts.map +1 -1
  3. package/build/dts/index.d.ts +3 -2
  4. package/build/dts/index.d.ts.map +1 -1
  5. package/build/dts/infrastructure/manifest-file.d.ts +1 -0
  6. package/build/dts/infrastructure/manifest-file.d.ts.map +1 -1
  7. package/build/dts/infrastructure/manifest-include.d.ts +16 -0
  8. package/build/dts/infrastructure/manifest-include.d.ts.map +1 -0
  9. package/build/dts/manifest/json-schema.d.ts +2 -0
  10. package/build/dts/manifest/json-schema.d.ts.map +1 -1
  11. package/build/dts/manifest/manifest.d.ts +1 -1
  12. package/build/dts/manifest/manifest.d.ts.map +1 -1
  13. package/build/esm/domain/manifest-location.js +16 -1
  14. package/build/esm/domain/manifest-location.js.map +1 -1
  15. package/build/esm/index.js +3 -1
  16. package/build/esm/index.js.map +1 -1
  17. package/build/esm/infrastructure/manifest-file.js +31 -17
  18. package/build/esm/infrastructure/manifest-file.js.map +1 -1
  19. package/build/esm/infrastructure/manifest-include.js +187 -0
  20. package/build/esm/infrastructure/manifest-include.js.map +1 -0
  21. package/build/esm/manifest/json-schema.js +72 -17
  22. package/build/esm/manifest/json-schema.js.map +1 -1
  23. package/build/esm/manifest/manifest.js +7 -18
  24. package/build/esm/manifest/manifest.js.map +1 -1
  25. package/package.json +1 -1
  26. package/schema/architecture-node.schema.json +1518 -0
  27. package/schema/architecture.schema.json +1102 -691
  28. package/src/domain/manifest-location.ts +22 -0
  29. package/src/index.ts +13 -1
  30. package/src/infrastructure/manifest-file.ts +37 -17
  31. package/src/infrastructure/manifest-include.ts +318 -0
  32. package/src/manifest/json-schema.ts +83 -18
  33. package/src/manifest/manifest.ts +11 -20
@@ -4,7 +4,11 @@ import * as SchemaIssue from "effect/SchemaIssue";
4
4
 
5
5
  import { DeclarationKind, ResolveConfig } from "../domain/architecture-config.js";
6
6
  import { ConfigInvalid } from "../domain/architecture-error.js";
7
- import type { ManifestLocator, ManifestPath } from "../domain/manifest-location.js";
7
+ import {
8
+ type ManifestLocator,
9
+ type ManifestPath,
10
+ renderManifestPath,
11
+ } from "../domain/manifest-location.js";
8
12
  import { expandManifest, originOf, type Substitution } from "./expand.js";
9
13
 
10
14
  // A manifest is a tree of nodes keyed by path pattern, where everything the
@@ -406,32 +410,19 @@ export type DecodeManifestOptions = {
406
410
  readonly locate?: ManifestLocator | undefined;
407
411
  };
408
412
 
409
- const isIdentifier = (key: string): boolean => /^[A-Za-z_$][\w$]*$/.test(key);
410
-
411
- // `tree["~/core/"].members[0].subject` — dotted where a key reads as a name,
412
- // bracketed where it does not, so a node key that is a path pattern stays
413
- // legible.
414
- const renderPath = (path: ManifestPath): string =>
415
- path.length === 0
416
- ? "(root)"
417
- : path
418
- .map((segment, index) => {
419
- if (typeof segment === "number") return `[${String(segment)}]`;
420
- const key = String(segment);
421
- if (isIdentifier(key)) return index === 0 ? key : `.${key}`;
422
- return `[${JSON.stringify(key)}]`;
423
- })
424
- .join("");
425
-
426
413
  const fileLabelOf = (configPath: string): string => configPath.split(/[\\/]/).at(-1) ?? configPath;
427
414
 
415
+ // A position carries its own file when the value was written in a file the
416
+ // manifest `include`d; otherwise it is in the manifest file itself.
428
417
  const positionOf = (
429
418
  file: string,
430
419
  locate: ManifestLocator | undefined,
431
420
  path: ManifestPath,
432
421
  ): string | null => {
433
422
  const found = locate?.(path) ?? null;
434
- return found === null ? null : `${file}:${String(found.line)}:${String(found.column)}`;
423
+ return found === null
424
+ ? null
425
+ : `${found.file ?? file}:${String(found.line)}:${String(found.column)}`;
435
426
  };
436
427
 
437
428
  // One line per issue: where in the file, which path, what was wrong — and,
@@ -452,7 +443,7 @@ const describeIssue = (
452
443
  return `via \`use: ${JSON.stringify(name)}\`${position === null ? "" : ` at ${position}`}`;
453
444
  });
454
445
  return (
455
- ` ${at === null ? "" : `${at} `}${renderPath(origin.path)}: ${detail}` +
446
+ ` ${at === null ? "" : `${at} `}${renderManifestPath(origin.path)}: ${detail}` +
456
447
  (via.length === 0 ? "" : ` (${via.join(", ")})`)
457
448
  );
458
449
  };