@sigloch/graph-view-edit 0.9.0 → 0.10.0
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/README.md +8 -0
- package/dist/assets/index-BOif4jTy.js +246 -0
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/config.mjs +7 -0
- package/vite.config.js +94 -5
- package/dist/assets/index-_FhVxvpu.js +0 -246
package/dist/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>graph-view-edit</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-BOif4jTy.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-BtUB8acj.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sigloch/graph-view-edit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "React/Vite viewer+editor over @sigloch/graphcode — 12 graph-views + 16 doc-views via a declarative View-Registry, plus an SE-Dashboard sibling route. Reads docs/graph/<member>.graph.json client-side (no 2nd Kuzu handle).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/config.mjs
CHANGED
|
@@ -80,6 +80,13 @@ export const ConfigSchema = z.object({
|
|
|
80
80
|
enabled: z.boolean().default(false),
|
|
81
81
|
})
|
|
82
82
|
.prefault({}),
|
|
83
|
+
// CR-GVE-283: ab MEHR als so vielen Enden (Sender + Leser im Modell) zeichnet
|
|
84
|
+
// das Funktionsnetzwerk ein Netz als Etikett je Anschluss statt als Linien.
|
|
85
|
+
net: z
|
|
86
|
+
.object({
|
|
87
|
+
globalThreshold: z.number().int().nonnegative().default(9),
|
|
88
|
+
})
|
|
89
|
+
.prefault({}),
|
|
83
90
|
});
|
|
84
91
|
|
|
85
92
|
export function loadConfig(path = process.env.GVE_CONFIG_PATH || resolve(process.cwd(), 'config.json')) {
|
package/vite.config.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync, mkdirSync, unlinkSync, existsSync, readdirSync, realpathSync, statSync, watch } from 'node:fs';
|
|
2
2
|
import { execFileSync } from 'node:child_process';
|
|
3
|
-
import { join, basename } from 'node:path';
|
|
3
|
+
import { join, basename, dirname, sep } from 'node:path';
|
|
4
|
+
import { createRequire } from 'node:module';
|
|
4
5
|
import { fileURLToPath } from 'node:url';
|
|
5
6
|
import { defineConfig } from 'vite';
|
|
6
7
|
import react from '@vitejs/plugin-react';
|
|
@@ -100,9 +101,97 @@ function servedRepoRoot() {
|
|
|
100
101
|
* listed ontology/rules/engine but never the app rendering them, so a bug
|
|
101
102
|
* report could not say WHICH GVE produced the screen.
|
|
102
103
|
*/
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
const OWN_ROOT = fileURLToPath(new URL('.', import.meta.url));
|
|
105
|
+
const GVE_VERSION = JSON.parse(readFileSync(join(OWN_ROOT, 'package.json'), 'utf8')).version;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* CR-GVE-292: die Version allein sagt nicht, WELCHER Code läuft. `0.9.0` war
|
|
109
|
+
* gleichzeitig das npm-Paket unter bok/node_modules UND der Dev-Checkout mit 25
|
|
110
|
+
* Commits danach — Health zeigte beides als dieselbe Zahl. Deshalb trägt jede
|
|
111
|
+
* Paketzeile jetzt ihre HERKUNFT: `npm` (aus einem node_modules-Baum installiert,
|
|
112
|
+
* also exakt der publizierte Tarball) oder `dev <sha>` (Arbeitskopie, per Link
|
|
113
|
+
* eingebunden; `*` = ungecommittete Änderungen im Paketverzeichnis). Und nicht
|
|
114
|
+
* nur gve: dieselbe Zeile für jedes Familienpaket, das der Viewer lädt — sonst
|
|
115
|
+
* bleibt die Frage „welche contracts sind das" wieder eine Rekonstruktion aus
|
|
116
|
+
* vier package.json. Der Pfad-Test auf `node_modules` ist die Unterscheidung:
|
|
117
|
+
* `realpathSync` folgt dem Link aus dem node_modules-Baum heraus in die
|
|
118
|
+
* Arbeitskopie; ein installiertes Paket bleibt drin. Kein Tarball trägt ein
|
|
119
|
+
* `.git`, also braucht es keinen zweiten Beweis.
|
|
120
|
+
*/
|
|
121
|
+
export const FAMILY_PACKAGES = [
|
|
122
|
+
'@sigloch/contracts',
|
|
123
|
+
'@sigloch/graph-api-core',
|
|
124
|
+
'@sigloch/graphcode-client',
|
|
125
|
+
'@sigloch/se-engine',
|
|
126
|
+
'@sigloch/graphcode',
|
|
127
|
+
];
|
|
128
|
+
|
|
129
|
+
const ownRequire = createRequire(import.meta.url);
|
|
130
|
+
|
|
131
|
+
/** Reales Paketverzeichnis eines geladenen Pakets, `null` wenn nicht auflösbar. */
|
|
132
|
+
export function packageRoot(name, requireImpl = ownRequire, from = OWN_ROOT) {
|
|
133
|
+
let dir;
|
|
134
|
+
try {
|
|
135
|
+
dir = dirname(requireImpl.resolve(`${name}/package.json`));
|
|
136
|
+
} catch {
|
|
137
|
+
try {
|
|
138
|
+
dir = dirname(requireImpl.resolve(name));
|
|
139
|
+
} catch {
|
|
140
|
+
// Ein Paket ohne `.`-Export (graphcode ist ein bin-Paket) löst `require`
|
|
141
|
+
// nicht auf — dann derselbe node_modules-Aufstieg, den Node selbst ginge.
|
|
142
|
+
dir = null;
|
|
143
|
+
for (let d = from; ; d = dirname(d)) {
|
|
144
|
+
const candidate = join(d, 'node_modules', name);
|
|
145
|
+
if (existsSync(join(candidate, 'package.json'))) { dir = candidate; break; }
|
|
146
|
+
if (dirname(d) === d) return null;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
for (;;) {
|
|
151
|
+
const pj = join(dir, 'package.json');
|
|
152
|
+
if (existsSync(pj) && JSON.parse(readFileSync(pj, 'utf8')).name === name) return realpathSync(dir);
|
|
153
|
+
const parent = dirname(dir);
|
|
154
|
+
if (parent === dir) return null;
|
|
155
|
+
dir = parent;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** Herkunft eines Paketverzeichnisses: `{source:'npm'}` oder `{source:'dev', commit, dirty}`. */
|
|
160
|
+
export function provenanceOf(root, git = gitOut) {
|
|
161
|
+
if (!root) return null;
|
|
162
|
+
if (root.split(sep).includes('node_modules')) return { source: 'npm' };
|
|
163
|
+
const commit = git(root, ['rev-parse', '--short', 'HEAD']);
|
|
164
|
+
const dirty = commit !== null && git(root, ['status', '--porcelain', '--', '.']) !== '';
|
|
165
|
+
return { source: 'dev', commit, dirty };
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function gitOut(root, args) {
|
|
169
|
+
try {
|
|
170
|
+
return execFileSync('git', ['-C', root, ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();
|
|
171
|
+
} catch {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** Eine Health-Zelle: `10.2.0 · npm` bzw. `0.9.0 · dev 6130c07*`. */
|
|
177
|
+
export function versionLabel(version, prov) {
|
|
178
|
+
if (!prov) return `${version} · nicht auflösbar`;
|
|
179
|
+
if (prov.source === 'npm') return `${version} · npm`;
|
|
180
|
+
return `${version} · dev ${prov.commit ?? '?'}${prov.dirty ? '*' : ''}`;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const FAMILY_ROOTS = new Map(FAMILY_PACKAGES.map((n) => [n, packageRoot(n)]));
|
|
184
|
+
|
|
185
|
+
/** gve selbst plus jedes Familienpaket, Schlüssel ohne den `@sigloch/`-Präfix. */
|
|
186
|
+
export function familyVersions() {
|
|
187
|
+
const rows = { gve: versionLabel(GVE_VERSION, provenanceOf(realpathSync(OWN_ROOT))) };
|
|
188
|
+
for (const name of FAMILY_PACKAGES) {
|
|
189
|
+
const root = FAMILY_ROOTS.get(name);
|
|
190
|
+
const version = root ? JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')).version : '—';
|
|
191
|
+
rows[name.replace('@sigloch/', '')] = versionLabel(version, provenanceOf(root));
|
|
192
|
+
}
|
|
193
|
+
return rows;
|
|
194
|
+
}
|
|
106
195
|
|
|
107
196
|
/**
|
|
108
197
|
* Serves docs/graph/*.json from the resolved repo root (CR-GVE-127) instead
|
|
@@ -1039,7 +1128,7 @@ function dashboardApiPlugin() {
|
|
|
1039
1128
|
store: 'committed graph.json (read-only)',
|
|
1040
1129
|
gate: 'n/a — dashboard is read-only (writes go through MCP mutate())',
|
|
1041
1130
|
versions: {
|
|
1042
|
-
|
|
1131
|
+
...familyVersions(),
|
|
1043
1132
|
ontology: ONTOLOGY_VERSION,
|
|
1044
1133
|
rules: RULES_VERSION,
|
|
1045
1134
|
engine: SE_DESCRIPTOR.version,
|