@glossarist/concept-browser 0.7.114 → 0.7.115

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 (82) hide show
  1. package/README.md +45 -2
  2. package/cli/index.mjs +15 -15
  3. package/cli/index.ts +9 -11
  4. package/data/concept-model/shapes/glossarist.concept.yaml.schema.json +255 -0
  5. package/package.json +14 -12
  6. package/scripts/__tests__/{bibliography.test.mjs → bibliography.test.ts} +1 -1
  7. package/scripts/__tests__/{cli-script-contract.test.mjs → cli-script-contract.test.ts} +3 -3
  8. package/scripts/__tests__/{concept-groups.test.mjs → concept-groups.test.ts} +1 -1
  9. package/scripts/__tests__/{doctor.test.mjs → doctor.test.ts} +1 -1
  10. package/scripts/__tests__/{fetch-datasets.test.mjs → fetch-datasets.test.ts} +1 -1
  11. package/scripts/__tests__/{first-non-empty.test.mjs → first-non-empty.test.ts} +1 -1
  12. package/scripts/__tests__/{process-about-pages.test.mjs → process-about-pages.test.ts} +1 -1
  13. package/scripts/{bridge-to-astro.mjs → bridge-to-astro.ts} +2 -4
  14. package/scripts/{build-edges.js → build-edges.ts} +11 -13
  15. package/scripts/{check-syntax.mjs → check-syntax.ts} +20 -13
  16. package/scripts/{fetch-datasets.mjs → fetch-datasets.ts} +2 -2
  17. package/scripts/{generate-data.mjs → generate-data.ts} +73 -460
  18. package/scripts/{generate-ontology-schema.mjs → generate-ontology-schema.ts} +2 -2
  19. package/scripts/lib/{build-cache.mjs → build-cache.ts} +3 -2
  20. package/scripts/lib/concept-formats.ts +206 -0
  21. package/scripts/lib/concept-uri.ts +14 -0
  22. package/scripts/lib/{dataset-turtle.mjs → dataset-turtle.ts} +4 -3
  23. package/scripts/lib/harmonize-concept.ts +86 -0
  24. package/scripts/lib/jsonld-emitter.ts +169 -0
  25. package/scripts/lib/{local-path-safety.mjs → local-path-safety.ts} +6 -2
  26. package/scripts/lib/yaml-types.ts +262 -0
  27. package/scripts/{process-about-pages.mjs → process-about-pages.ts} +1 -1
  28. package/scripts/{smoke.mjs → smoke.ts} +4 -3
  29. package/scripts/{validate-shacl.mjs → validate-shacl.ts} +5 -5
  30. package/scripts/validate-yaml.ts +144 -0
  31. package/src/__tests__/extract-source-refs.test.ts +2 -3
  32. package/src/__tests__/perf/serialization-perf.test.ts +5 -5
  33. package/src/__tests__/scripts/agents-turtle.test.ts +1 -1
  34. package/src/__tests__/scripts/bibliography-turtle.test.ts +1 -1
  35. package/src/__tests__/scripts/build-activity-turtle.test.ts +1 -1
  36. package/src/__tests__/scripts/build-cache.test.ts +1 -1
  37. package/src/__tests__/scripts/build-integration.test.ts +19 -19
  38. package/src/__tests__/scripts/dataset-turtle.test.ts +1 -1
  39. package/src/__tests__/scripts/migrate-v1-to-v3.test.ts +1 -1
  40. package/src/__tests__/scripts/normalize-yaml.test.ts +1 -1
  41. package/src/__tests__/scripts/turtle-escape.test.ts +1 -1
  42. package/src/__tests__/scripts/validate-yaml.test.ts +76 -0
  43. package/src/__tests__/scripts/version-turtle.test.ts +1 -1
  44. package/src/__tests__/scripts/vocab-turtle.test.ts +1 -1
  45. package/src/__tests__/scripts-syntax.test.ts +2 -2
  46. package/src/__tests__/use-rdf-document.test.ts +2 -3
  47. package/src/__tests__/utils/content-renderer-xss.test.ts +57 -0
  48. package/src/__tests__/validate-shacl.test.ts +3 -3
  49. package/src/adapters/wire/index.ts +69 -0
  50. package/src/utils/content-renderer.ts +7 -3
  51. package/src/utils/url-safety.ts +1 -5
  52. package/tsconfig.json +2 -2
  53. package/vite.config.ts +1 -1
  54. package/src/__tests__/composables/use-concept-edges-v2.test.ts +0 -167
  55. package/src/__tests__/composables/use-concept-edges-v2.test.ts.bak +0 -166
  56. package/src/types/agents-version-turtle.d.ts +0 -27
  57. package/src/types/bibliography-turtle.d.ts +0 -12
  58. package/src/types/build-activity-turtle.d.ts +0 -16
  59. package/src/types/build-cache.d.ts +0 -20
  60. package/src/types/dataset-turtle.d.ts +0 -32
  61. package/src/types/normalize-yaml.d.ts +0 -16
  62. package/src/types/turtle-escape.d.ts +0 -6
  63. package/src/types/vocab-turtle.d.ts +0 -13
  64. /package/scripts/{doctor.mjs → doctor.ts} +0 -0
  65. /package/scripts/{extract-source-refs.js → extract-source-refs.ts} +0 -0
  66. /package/scripts/{generate-404.js → generate-404.ts} +0 -0
  67. /package/scripts/{generate-ontology-data.mjs → generate-ontology-data.ts} +0 -0
  68. /package/scripts/lib/{agents-turtle.mjs → agents-turtle.ts} +0 -0
  69. /package/scripts/lib/{bibliography-turtle.mjs → bibliography-turtle.ts} +0 -0
  70. /package/scripts/lib/{bibliography.mjs → bibliography.ts} +0 -0
  71. /package/scripts/lib/build/{image-assets.mjs → image-assets.ts} +0 -0
  72. /package/scripts/lib/build/{non-verbal-consumer.mjs → non-verbal-consumer.ts} +0 -0
  73. /package/scripts/lib/{build-activity-turtle.mjs → build-activity-turtle.ts} +0 -0
  74. /package/scripts/lib/{concept-groups.mjs → concept-groups.ts} +0 -0
  75. /package/scripts/lib/{first-non-empty.mjs → first-non-empty.ts} +0 -0
  76. /package/scripts/lib/{turtle-escape.mjs → turtle-escape.ts} +0 -0
  77. /package/scripts/lib/{version-turtle.mjs → version-turtle.ts} +0 -0
  78. /package/scripts/lib/{vocab-turtle.mjs → vocab-turtle.ts} +0 -0
  79. /package/scripts/{load-site-config.mjs → load-site-config.ts} +0 -0
  80. /package/scripts/{migrate-v1-to-v3.mjs → migrate-v1-to-v3.ts} +0 -0
  81. /package/scripts/{normalize-yaml.mjs → normalize-yaml.ts} +0 -0
  82. /package/scripts/{sync-concept-model.mjs → sync-concept-model.ts} +0 -0
@@ -7,7 +7,8 @@ import process from "node:process";
7
7
  const ROOT = path.resolve(path.dirname(new URL(import.meta.url).pathname), "..");
8
8
 
9
9
  const TARGET_DIRS = ["scripts", "cli"];
10
- const EXTENSIONS = new Set([".mjs", ".js", ".cjs"]);
10
+ const JS_EXTENSIONS = new Set([".mjs", ".js", ".cjs"]);
11
+ const ALL_EXTENSIONS = new Set([".ts", ...JS_EXTENSIONS]);
11
12
  const SKIP_DIRS = new Set(["__tests__", "node_modules"]);
12
13
 
13
14
  function walk(dir) {
@@ -18,7 +19,7 @@ function walk(dir) {
18
19
  const st = statSync(full);
19
20
  if (st.isDirectory()) {
20
21
  out.push(...walk(full));
21
- } else if (EXTENSIONS.has(path.extname(entry))) {
22
+ } else if (ALL_EXTENSIONS.has(path.extname(entry))) {
22
23
  out.push(full);
23
24
  }
24
25
  }
@@ -39,15 +40,24 @@ export function checkAllScripts({ root = ROOT } = {}) {
39
40
  files.sort();
40
41
 
41
42
  const failures = [];
42
- for (const file of files) {
43
- const result = spawnSync(process.execPath, ["--check", file], {
43
+
44
+ // JS files: syntax-check with node --check
45
+ for (const file of files.filter(f => JS_EXTENSIONS.has(path.extname(f)))) {
46
+ const result = spawnSync(process.execPath, ["--check", file], { encoding: "utf8" });
47
+ if (result.status !== 0) {
48
+ failures.push({ file: path.relative(root, file), stderr: result.stderr || "" });
49
+ }
50
+ }
51
+
52
+ // TS files: type-check with tsc (authoritative for TypeScript)
53
+ if (files.some(f => path.extname(f) === ".ts")) {
54
+ const tsconfig = path.join(root, "tsconfig.scripts.json");
55
+ const result = spawnSync("npx", ["tsc", "-p", tsconfig, "--noEmit"], {
44
56
  encoding: "utf8",
57
+ cwd: root,
45
58
  });
46
59
  if (result.status !== 0) {
47
- failures.push({
48
- file: path.relative(root, file),
49
- stderr: result.stderr || "",
50
- });
60
+ failures.push({ file: "tsconfig.scripts.json (tsc)", stderr: result.stdout || result.stderr || "" });
51
61
  }
52
62
  }
53
63
 
@@ -60,9 +70,7 @@ function main() {
60
70
  process.stdout.write(`syntax OK: ${files.length} file(s) checked\n`);
61
71
  return;
62
72
  }
63
- process.stderr.write(
64
- `syntax check failed: ${failures.length} of ${files.length} file(s)\n\n`,
65
- );
73
+ process.stderr.write(`syntax check failed: ${failures.length} of ${files.length} file(s)\n\n`);
66
74
  for (const { file, stderr } of failures) {
67
75
  process.stderr.write(`--- ${file} ---\n${stderr}\n`);
68
76
  }
@@ -70,8 +78,7 @@ function main() {
70
78
  }
71
79
 
72
80
  const isDirectEntry = process.argv[1] &&
73
- path.resolve(process.argv[1]) ===
74
- path.resolve(new URL(import.meta.url).pathname);
81
+ path.resolve(process.argv[1]) === path.resolve(new URL(import.meta.url).pathname);
75
82
 
76
83
  if (isDirectEntry) {
77
84
  main();
@@ -20,8 +20,8 @@ import JSZip from 'jszip';
20
20
  import { loadGcr } from 'glossarist';
21
21
  import { execFileSync } from 'child_process';
22
22
  import { fileURLToPath } from 'url';
23
- import { loadSiteConfig } from './load-site-config.mjs';
24
- import { assertLocalPathSafe } from './lib/local-path-safety.mjs';const ROOT = process.cwd();
23
+ import { loadSiteConfig } from './load-site-config';
24
+ import { assertLocalPathSafe } from './lib/local-path-safety';const ROOT = process.cwd();
25
25
  const DATASETS_DIR = path.join(ROOT, '.datasets');
26
26
  const GCR_DIR = path.join(ROOT, '.gcr');
27
27