@polycode-projects/seonix 0.2.0 → 0.2.1
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 +1 -1
- package/src/viz.mjs +15 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polycode-projects/seonix",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "SEONIX — a deterministic, offline, $0 code-graph tool that makes a cheap coding agent edit like an expensive one. Indexes a repo with Python ast + git (zero model calls) and renders a bounded edit-digest.",
|
package/src/viz.mjs
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
import { readFile, writeFile } from "node:fs/promises";
|
|
18
18
|
import { execFile } from "node:child_process";
|
|
19
19
|
import { createServer } from "node:http";
|
|
20
|
+
import { createRequire } from "node:module";
|
|
20
21
|
import { dirname, join, relative, resolve } from "node:path";
|
|
21
22
|
import { fileURLToPath } from "node:url";
|
|
22
23
|
import { parseArgs, promisify } from "node:util";
|
|
@@ -147,16 +148,21 @@ export function buildViewerData(subgraph, { focusLabel, repoUrl = "", repoRef =
|
|
|
147
148
|
};
|
|
148
149
|
}
|
|
149
150
|
|
|
150
|
-
/** Inline the Cytoscape dist so the HTML is one portable file (no sidecar, no CDN).
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
151
|
+
/** Inline the Cytoscape dist so the HTML is one portable file (no sidecar, no CDN).
|
|
152
|
+
* Resolved via Node's own module resolution (createRequire), not a hardcoded
|
|
153
|
+
* relative-path guess — the guess only worked inside this monorepo's own dev
|
|
154
|
+
* layout (root-hoisted node_modules) and broke for a real npm-installed consumer,
|
|
155
|
+
* where cytoscape sits under the consumer's own node_modules, at a different
|
|
156
|
+
* depth from this file (`node_modules/@polycode-projects/seonix/src/…`). Node's
|
|
157
|
+
* resolution algorithm walks every parent node_modules correctly regardless of
|
|
158
|
+
* install topology (monorepo, flat install, nested install, pnpm symlinks). */
|
|
159
|
+
export async function cytoscapeSource() {
|
|
160
|
+
try {
|
|
161
|
+
const path = createRequire(import.meta.url).resolve("cytoscape/dist/cytoscape.min.js");
|
|
162
|
+
return await readFile(path, "utf8");
|
|
163
|
+
} catch {
|
|
164
|
+
throw new Error("cytoscape not installed — reinstall @polycode-projects/seonix (cytoscape is a declared dependency)");
|
|
158
165
|
}
|
|
159
|
-
throw new Error("cytoscape not installed — run `npm install` in packages/seonix");
|
|
160
166
|
}
|
|
161
167
|
|
|
162
168
|
/** The mechanical (zero-model-call) chat panel's engine, inlined into the viewer
|