@polycode-projects/seonix 0.1.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/LICENSE +661 -0
- package/README.md +77 -0
- package/bin/cli.mjs +248 -0
- package/package.json +54 -0
- package/roslyn/Program.cs +150 -0
- package/roslyn/RoslynExtract.csproj +13 -0
- package/src/codegraph.mjs +1313 -0
- package/src/config.mjs +28 -0
- package/src/cs_roslyn.mjs +38 -0
- package/src/cs_treesitter.mjs +140 -0
- package/src/extract.mjs +624 -0
- package/src/extract_ast.py +366 -0
- package/src/extract_lang.mjs +61 -0
- package/src/jsts_tsc.mjs +211 -0
- package/src/server.mjs +389 -0
- package/src/source.mjs +35 -0
- package/src/viz.mjs +218 -0
- package/src/walk.mjs +39 -0
package/src/walk.mjs
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Shared deterministic file walker. Mirrors extract_ast.py's SKIP_DIRS so the
|
|
2
|
+
// spike extractors see the same source surface the Python path would.
|
|
3
|
+
import { readdir } from "node:fs/promises";
|
|
4
|
+
import { join, relative, sep } from "node:path";
|
|
5
|
+
|
|
6
|
+
export const SKIP_DIRS = new Set([
|
|
7
|
+
".git", ".seonix", ".hg", ".svn", "node_modules", ".venv", "venv",
|
|
8
|
+
"__pycache__", ".tox", ".mypy_cache", ".pytest_cache", "build", "dist",
|
|
9
|
+
"bin", "obj", "out", "coverage", ".next", ".nuxt", ".angular", "wwwroot",
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
/** Recursively collect absolute file paths under `root` whose extension is in
|
|
13
|
+
* `exts` (lower-cased, with dot), skipping SKIP_DIRS and dot-dirs. Deterministic
|
|
14
|
+
* (sorted) so the emitted graph is byte-stable per commit. */
|
|
15
|
+
export async function walk(root, exts) {
|
|
16
|
+
const want = new Set(exts.map((e) => e.toLowerCase()));
|
|
17
|
+
const out = [];
|
|
18
|
+
async function rec(dir) {
|
|
19
|
+
let entries;
|
|
20
|
+
try { entries = await readdir(dir, { withFileTypes: true }); }
|
|
21
|
+
catch { return; }
|
|
22
|
+
entries.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
23
|
+
for (const e of entries) {
|
|
24
|
+
if (e.isDirectory()) {
|
|
25
|
+
if (SKIP_DIRS.has(e.name) || e.name.startsWith(".")) continue;
|
|
26
|
+
await rec(join(dir, e.name));
|
|
27
|
+
} else if (e.isFile()) {
|
|
28
|
+
const dot = e.name.lastIndexOf(".");
|
|
29
|
+
const ext = dot >= 0 ? e.name.slice(dot).toLowerCase() : "";
|
|
30
|
+
if (want.has(ext)) out.push(join(dir, e.name));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
await rec(root);
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Repo-relative, forward-slash path. */
|
|
39
|
+
export const relPath = (root, abs) => relative(root, abs).split(sep).join("/");
|