@neat.is/core 0.7.7 → 0.7.9
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/dist/{chunk-BIY46Q6U.js → chunk-BC53SCT7.js} +36 -2
- package/dist/chunk-BC53SCT7.js.map +1 -0
- package/dist/{chunk-4GCV46AP.js → chunk-FCO5Z3RW.js} +2 -2
- package/dist/{chunk-YVZRBT4C.js → chunk-ILG3SMD5.js} +54 -4
- package/dist/{chunk-YVZRBT4C.js.map → chunk-ILG3SMD5.js.map} +1 -1
- package/dist/{chunk-UI3AFJAF.js → chunk-N5TPODCX.js} +171 -49
- package/dist/chunk-N5TPODCX.js.map +1 -0
- package/dist/{chunk-Y43UCVZS.js → chunk-UUYCTH2E.js} +24 -8
- package/dist/chunk-UUYCTH2E.js.map +1 -0
- package/dist/cli.cjs +238 -63
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +17 -14
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +242 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -4
- package/dist/neatd.cjs +242 -54
- package/dist/neatd.cjs.map +1 -1
- package/dist/neatd.js +3 -3
- package/dist/{otel-grpc-DPSAGRUU.js → otel-grpc-CO47JRIN.js} +3 -3
- package/dist/server.cjs +226 -54
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +4 -4
- package/package.json +2 -2
- package/dist/chunk-BIY46Q6U.js.map +0 -1
- package/dist/chunk-UI3AFJAF.js.map +0 -1
- package/dist/chunk-Y43UCVZS.js.map +0 -1
- /package/dist/{chunk-4GCV46AP.js.map → chunk-FCO5Z3RW.js.map} +0 -0
- /package/dist/{otel-grpc-DPSAGRUU.js.map → otel-grpc-CO47JRIN.js.map} +0 -0
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
mountBearerAuth,
|
|
4
4
|
readAuthEnv,
|
|
5
5
|
tableFromSqlStatement
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UUYCTH2E.js";
|
|
7
7
|
|
|
8
8
|
// src/graph.ts
|
|
9
9
|
import GraphDefault from "graphology";
|
|
@@ -1780,6 +1780,7 @@ var ROUTER_METHODS = /* @__PURE__ */ new Set([
|
|
|
1780
1780
|
"all"
|
|
1781
1781
|
]);
|
|
1782
1782
|
var NEXT_APP_METHODS = /* @__PURE__ */ new Set(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]);
|
|
1783
|
+
var NET_HTTP_METHODS = /* @__PURE__ */ new Set(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]);
|
|
1783
1784
|
var JS_ROUTE_EXTENSIONS = /* @__PURE__ */ new Set([".js", ".jsx", ".mjs", ".cjs", ".ts", ".tsx"]);
|
|
1784
1785
|
function goRouterRoutesFromSource(source, parser, framework) {
|
|
1785
1786
|
const tree = parseSource2(parser, source);
|
|
@@ -1833,6 +1834,101 @@ function echoRoutesFromSource(source, parser) {
|
|
|
1833
1834
|
function fiberRoutesFromSource(source, parser) {
|
|
1834
1835
|
return goRouterRoutesFromSource(source, parser, "fiber");
|
|
1835
1836
|
}
|
|
1837
|
+
function chiRoutesFromSource(source, parser) {
|
|
1838
|
+
const tree = parseSource2(parser, source);
|
|
1839
|
+
const out = [];
|
|
1840
|
+
chiWalk(tree.rootNode, "", out);
|
|
1841
|
+
return out;
|
|
1842
|
+
}
|
|
1843
|
+
function stripChiRegex(path64) {
|
|
1844
|
+
return path64.replace(/\{([^{}:]+):[^{}]*\}/g, "{$1}");
|
|
1845
|
+
}
|
|
1846
|
+
function chiWalk(node, prefix, out) {
|
|
1847
|
+
for (let i = 0; i < node.namedChildCount; i++) {
|
|
1848
|
+
const child = node.namedChild(i);
|
|
1849
|
+
if (child) chiHandle(child, prefix, out);
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
function chiHandle(node, prefix, out) {
|
|
1853
|
+
if (node.type === "call_expression") {
|
|
1854
|
+
const fn = node.childForFieldName("function");
|
|
1855
|
+
if (fn?.type === "selector_expression") {
|
|
1856
|
+
const field = fn.childForFieldName("field")?.text;
|
|
1857
|
+
const args = node.childForFieldName("arguments");
|
|
1858
|
+
if (field === "Route") {
|
|
1859
|
+
const leaf = goStringLiteral(args?.namedChild(0));
|
|
1860
|
+
const closure = args?.namedChild(1);
|
|
1861
|
+
if (leaf !== null && closure?.type === "func_literal") {
|
|
1862
|
+
const body = closure.childForFieldName("body");
|
|
1863
|
+
if (body) chiWalk(body, prefix + leaf, out);
|
|
1864
|
+
}
|
|
1865
|
+
return;
|
|
1866
|
+
}
|
|
1867
|
+
if (field === "Group") {
|
|
1868
|
+
const closure = args?.namedChild(0);
|
|
1869
|
+
if (closure?.type === "func_literal") {
|
|
1870
|
+
const body = closure.childForFieldName("body");
|
|
1871
|
+
if (body) chiWalk(body, prefix, out);
|
|
1872
|
+
}
|
|
1873
|
+
return;
|
|
1874
|
+
}
|
|
1875
|
+
if (field === "Mount") {
|
|
1876
|
+
return;
|
|
1877
|
+
}
|
|
1878
|
+
if (field && ROUTER_METHODS.has(field.toLowerCase())) {
|
|
1879
|
+
const leaf = goStringLiteral(args?.namedChild(0));
|
|
1880
|
+
if (leaf !== null) {
|
|
1881
|
+
out.push({
|
|
1882
|
+
method: field.toUpperCase(),
|
|
1883
|
+
pathTemplate: canonicalizeTemplate(stripChiRegex(prefix + leaf)),
|
|
1884
|
+
line: node.startPosition.row + 1,
|
|
1885
|
+
framework: "chi"
|
|
1886
|
+
});
|
|
1887
|
+
}
|
|
1888
|
+
return;
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
chiWalk(node, prefix, out);
|
|
1893
|
+
}
|
|
1894
|
+
function netHttpRoutesFromSource(source, parser) {
|
|
1895
|
+
const tree = parseSource2(parser, source);
|
|
1896
|
+
if (!goImportsNetHttp(tree.rootNode)) return [];
|
|
1897
|
+
const out = [];
|
|
1898
|
+
walk(tree.rootNode, (node) => {
|
|
1899
|
+
if (node.type !== "call_expression") return;
|
|
1900
|
+
const fn = node.childForFieldName("function");
|
|
1901
|
+
if (fn?.type !== "selector_expression") return;
|
|
1902
|
+
const field = fn.childForFieldName("field")?.text;
|
|
1903
|
+
if (field !== "HandleFunc" && field !== "Handle") return;
|
|
1904
|
+
const leaf = goStringLiteral(node.childForFieldName("arguments")?.namedChild(0));
|
|
1905
|
+
if (leaf === null) return;
|
|
1906
|
+
const sp = leaf.indexOf(" ");
|
|
1907
|
+
if (sp < 0) return;
|
|
1908
|
+
const method = leaf.slice(0, sp);
|
|
1909
|
+
const rest = leaf.slice(sp + 1);
|
|
1910
|
+
if (!NET_HTTP_METHODS.has(method)) return;
|
|
1911
|
+
if (!rest.startsWith("/")) return;
|
|
1912
|
+
out.push({
|
|
1913
|
+
method,
|
|
1914
|
+
pathTemplate: canonicalizeTemplate(rest),
|
|
1915
|
+
line: node.startPosition.row + 1,
|
|
1916
|
+
framework: "net/http"
|
|
1917
|
+
});
|
|
1918
|
+
});
|
|
1919
|
+
return out;
|
|
1920
|
+
}
|
|
1921
|
+
function goImportsNetHttp(root) {
|
|
1922
|
+
let found = false;
|
|
1923
|
+
walk(root, (node) => {
|
|
1924
|
+
if (found || node.type !== "import_spec") return;
|
|
1925
|
+
for (let i = 0; i < node.namedChildCount; i++) {
|
|
1926
|
+
const child = node.namedChild(i);
|
|
1927
|
+
if (goStringLiteral(child) === "net/http") found = true;
|
|
1928
|
+
}
|
|
1929
|
+
});
|
|
1930
|
+
return found;
|
|
1931
|
+
}
|
|
1836
1932
|
var FASTAPI_METHODS = /* @__PURE__ */ new Set(["get", "post", "put", "patch", "delete", "options", "head", "trace"]);
|
|
1837
1933
|
var NESTJS_METHODS = /* @__PURE__ */ new Map([
|
|
1838
1934
|
["Get", "GET"],
|
|
@@ -3098,9 +3194,11 @@ async function addRoutes(graph, services) {
|
|
|
3098
3194
|
const hasGin = deps["github.com/gin-gonic/gin"] !== void 0;
|
|
3099
3195
|
const hasEcho = deps["github.com/labstack/echo/v4"] !== void 0 || deps["github.com/labstack/echo"] !== void 0;
|
|
3100
3196
|
const hasFiber = deps["github.com/gofiber/fiber/v2"] !== void 0 || deps["github.com/gofiber/fiber/v3"] !== void 0;
|
|
3197
|
+
const hasChi = deps["github.com/go-chi/chi/v5"] !== void 0 || deps["github.com/go-chi/chi"] !== void 0;
|
|
3198
|
+
const isGoService = service.node.language === "go";
|
|
3101
3199
|
const hasRails = deps["rails"] !== void 0;
|
|
3102
3200
|
const hasLaravel = deps["laravel/framework"] !== void 0;
|
|
3103
|
-
if (!hasExpress && !hasFastify && !hasHono && !hasNext && !hasNestjs && !hasFastapi && !hasFlask && !hasDjango && !hasGin && !hasEcho && !hasFiber && !hasRails && !hasLaravel)
|
|
3201
|
+
if (!hasExpress && !hasFastify && !hasHono && !hasNext && !hasNestjs && !hasFastapi && !hasFlask && !hasDjango && !hasGin && !hasEcho && !hasFiber && !hasChi && !isGoService && !hasRails && !hasLaravel)
|
|
3104
3202
|
continue;
|
|
3105
3203
|
const files = await loadSourceFiles(service.dir);
|
|
3106
3204
|
const mountPrefixes = hasExpress ? await expressMountPrefixes(files, service.dir, await loadTsPathConfig(service.dir)) : /* @__PURE__ */ new Map();
|
|
@@ -3127,7 +3225,9 @@ async function addRoutes(graph, services) {
|
|
|
3127
3225
|
if (hasGin) routes = ginRoutesFromSource(file.content, goParser);
|
|
3128
3226
|
else if (hasEcho) routes = echoRoutesFromSource(file.content, goParser);
|
|
3129
3227
|
else if (hasFiber) routes = fiberRoutesFromSource(file.content, goParser);
|
|
3228
|
+
else if (hasChi) routes = chiRoutesFromSource(file.content, goParser);
|
|
3130
3229
|
else routes = [];
|
|
3230
|
+
routes = routes.concat(netHttpRoutesFromSource(file.content, goParser));
|
|
3131
3231
|
} else if (isPy) {
|
|
3132
3232
|
routes = hasFastapi || hasFlask ? pythonRoutesFromSource(file.content, pyParser, hasFastapi ? "fastapi" : "flask") : [];
|
|
3133
3233
|
if (hasDjango) routes = routes.concat(djangoRoutesFromSource(file.content, pyParser));
|
|
@@ -3499,10 +3599,15 @@ function resolveDistToSrc(absFilepath, line) {
|
|
|
3499
3599
|
}
|
|
3500
3600
|
if (!entry) return null;
|
|
3501
3601
|
try {
|
|
3502
|
-
const
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3602
|
+
const queryLine = line !== void 0 && Number.isFinite(line) ? line : 1;
|
|
3603
|
+
let pos = entry.consumer.originalPositionFor({ line: queryLine, column: 0 });
|
|
3604
|
+
if (!pos || !pos.source) {
|
|
3605
|
+
pos = entry.consumer.originalPositionFor({
|
|
3606
|
+
line: queryLine,
|
|
3607
|
+
column: 0,
|
|
3608
|
+
bias: sourceMapJs.SourceMapConsumer.LEAST_UPPER_BOUND
|
|
3609
|
+
});
|
|
3610
|
+
}
|
|
3506
3611
|
if (!pos || !pos.source) return null;
|
|
3507
3612
|
const root = entry.consumer.sourceRoot ?? "";
|
|
3508
3613
|
const resolved = path8.resolve(entry.dir, root, pos.source);
|
|
@@ -3511,6 +3616,9 @@ function resolveDistToSrc(absFilepath, line) {
|
|
|
3511
3616
|
return null;
|
|
3512
3617
|
}
|
|
3513
3618
|
}
|
|
3619
|
+
function hasAdjacentSourceMap(absFilepath) {
|
|
3620
|
+
return sourceMapCache.get(absFilepath) != null;
|
|
3621
|
+
}
|
|
3514
3622
|
function callSiteFromSpan(span, serviceNode, scanPath) {
|
|
3515
3623
|
const filepath = codeFilepathOf(span.attributes);
|
|
3516
3624
|
if (filepath === void 0) return null;
|
|
@@ -3526,7 +3634,7 @@ function callSiteFromSpan(span, serviceNode, scanPath) {
|
|
|
3526
3634
|
}
|
|
3527
3635
|
const relPath = relPathForRuntimeFile(effectivePath, serviceNode, scanPath);
|
|
3528
3636
|
if (!relPath) return null;
|
|
3529
|
-
if (!resolved && abs.endsWith(".js") && relPath.startsWith("dist/") && serviceNode?.name) {
|
|
3637
|
+
if (!resolved && abs.endsWith(".js") && relPath.startsWith("dist/") && !hasAdjacentSourceMap(abs) && serviceNode?.name) {
|
|
3530
3638
|
warnNoSourceMaps(serviceNode.name);
|
|
3531
3639
|
}
|
|
3532
3640
|
const fn = codeFunctionOf(span.attributes);
|
|
@@ -3802,7 +3910,7 @@ function resolveServiceId(graph, host, env) {
|
|
|
3802
3910
|
function frontierIdFor(host) {
|
|
3803
3911
|
return frontierId(host);
|
|
3804
3912
|
}
|
|
3805
|
-
function
|
|
3913
|
+
function resolveFusedServiceId(graph, serviceName, env) {
|
|
3806
3914
|
const id = serviceId(serviceName, env);
|
|
3807
3915
|
if (graph.hasNode(id)) return id;
|
|
3808
3916
|
const wanted = serviceName.toLowerCase();
|
|
@@ -3812,17 +3920,21 @@ function ensureServiceNode(graph, serviceName, env) {
|
|
|
3812
3920
|
if (svc.discoveredVia === "otel") return false;
|
|
3813
3921
|
return typeof svc.name === "string" && svc.name.toLowerCase() === wanted;
|
|
3814
3922
|
});
|
|
3815
|
-
|
|
3923
|
+
return extractedId ?? id;
|
|
3924
|
+
}
|
|
3925
|
+
function ensureServiceNode(graph, serviceName, env) {
|
|
3926
|
+
const resolved = resolveFusedServiceId(graph, serviceName, env);
|
|
3927
|
+
if (graph.hasNode(resolved)) return resolved;
|
|
3816
3928
|
const node = {
|
|
3817
|
-
id,
|
|
3929
|
+
id: resolved,
|
|
3818
3930
|
type: NodeType4.ServiceNode,
|
|
3819
3931
|
name: serviceName,
|
|
3820
3932
|
language: "unknown",
|
|
3821
3933
|
discoveredVia: "otel",
|
|
3822
3934
|
...env !== "unknown" ? { env } : {}
|
|
3823
3935
|
};
|
|
3824
|
-
graph.addNode(
|
|
3825
|
-
return
|
|
3936
|
+
graph.addNode(resolved, node);
|
|
3937
|
+
return resolved;
|
|
3826
3938
|
}
|
|
3827
3939
|
function ensureInfraNode(graph, kind, name, provider) {
|
|
3828
3940
|
const id = infraId(kind, name);
|
|
@@ -4016,7 +4128,7 @@ async function appendErrorEvent(ctx, ev) {
|
|
|
4016
4128
|
await fs7.appendFile(ctx.errorsPath, JSON.stringify(ev) + "\n", "utf8");
|
|
4017
4129
|
}
|
|
4018
4130
|
function incidentAffectedNode(span, graph, scanPath) {
|
|
4019
|
-
const sid = serviceId(span.service, span.env);
|
|
4131
|
+
const sid = graph ? resolveFusedServiceId(graph, span.service, span.env) : serviceId(span.service, span.env);
|
|
4020
4132
|
const serviceNode = graph && graph.hasNode(sid) ? graph.getNodeAttributes(sid) : void 0;
|
|
4021
4133
|
const callSite = callSiteFromSpan(span, serviceNode, scanPath);
|
|
4022
4134
|
if (callSite) {
|
|
@@ -5268,6 +5380,7 @@ function goFramework(deps) {
|
|
|
5268
5380
|
if (deps["github.com/gin-gonic/gin"]) return "gin";
|
|
5269
5381
|
if (deps["github.com/labstack/echo/v4"] || deps["github.com/labstack/echo"]) return "echo";
|
|
5270
5382
|
if (deps["github.com/gofiber/fiber/v2"] || deps["github.com/gofiber/fiber/v3"]) return "fiber";
|
|
5383
|
+
if (deps["github.com/go-chi/chi/v5"] || deps["github.com/go-chi/chi"]) return "chi";
|
|
5271
5384
|
return void 0;
|
|
5272
5385
|
}
|
|
5273
5386
|
async function discoverGoService(scanPath, dir) {
|
|
@@ -5946,7 +6059,7 @@ function disambiguate(defs) {
|
|
|
5946
6059
|
}
|
|
5947
6060
|
async function addSymbols(graph, services) {
|
|
5948
6061
|
const parsers = /* @__PURE__ */ new Map();
|
|
5949
|
-
const
|
|
6062
|
+
const parserForExt5 = (ext) => {
|
|
5950
6063
|
const grammar = GRAMMAR_BY_EXT[ext];
|
|
5951
6064
|
if (!grammar) return null;
|
|
5952
6065
|
let parser = parsers.get(ext);
|
|
@@ -5962,7 +6075,7 @@ async function addSymbols(graph, services) {
|
|
|
5962
6075
|
for (const service of services) {
|
|
5963
6076
|
const files = await loadSourceFiles(service.dir);
|
|
5964
6077
|
for (const file of files) {
|
|
5965
|
-
const parser =
|
|
6078
|
+
const parser = parserForExt5(path17.extname(file.path));
|
|
5966
6079
|
if (!parser) continue;
|
|
5967
6080
|
const relPath = toPosix(path17.relative(service.dir, file.path));
|
|
5968
6081
|
let defs;
|
|
@@ -6120,7 +6233,7 @@ function stringInner(node) {
|
|
|
6120
6233
|
}
|
|
6121
6234
|
async function addSymbolEdges(graph, services) {
|
|
6122
6235
|
const parsers = /* @__PURE__ */ new Map();
|
|
6123
|
-
const
|
|
6236
|
+
const parserForExt5 = (ext) => {
|
|
6124
6237
|
const grammar = GRAMMAR_BY_EXT[ext];
|
|
6125
6238
|
if (!grammar) return null;
|
|
6126
6239
|
let parser = parsers.get(ext);
|
|
@@ -6137,7 +6250,7 @@ async function addSymbolEdges(graph, services) {
|
|
|
6137
6250
|
const tsPaths = await loadTsPathConfig(service.dir);
|
|
6138
6251
|
const files = await loadSourceFiles(service.dir);
|
|
6139
6252
|
for (const file of files) {
|
|
6140
|
-
const parser =
|
|
6253
|
+
const parser = parserForExt5(path18.extname(file.path));
|
|
6141
6254
|
if (!parser) continue;
|
|
6142
6255
|
const relPath = toPosix(path18.relative(service.dir, file.path));
|
|
6143
6256
|
const fileDir = path18.dirname(file.path);
|
|
@@ -6405,7 +6518,7 @@ function firstReferenceLines(root, wanted) {
|
|
|
6405
6518
|
}
|
|
6406
6519
|
async function addServerActions(graph, services) {
|
|
6407
6520
|
const parsers = /* @__PURE__ */ new Map();
|
|
6408
|
-
const
|
|
6521
|
+
const parserForExt5 = (ext) => {
|
|
6409
6522
|
const grammar = GRAMMAR_BY_EXT[ext];
|
|
6410
6523
|
if (!grammar) return null;
|
|
6411
6524
|
let parser = parsers.get(ext);
|
|
@@ -6428,7 +6541,7 @@ async function addServerActions(graph, services) {
|
|
|
6428
6541
|
const files = await loadSourceFiles(service.dir);
|
|
6429
6542
|
for (const file of files) {
|
|
6430
6543
|
if (isTestPath(file.path)) continue;
|
|
6431
|
-
const parser =
|
|
6544
|
+
const parser = parserForExt5(path19.extname(file.path));
|
|
6432
6545
|
if (!parser) continue;
|
|
6433
6546
|
const relPath = toPosix(path19.relative(service.dir, file.path));
|
|
6434
6547
|
let root;
|
|
@@ -6491,7 +6604,7 @@ async function addServerActions(graph, services) {
|
|
|
6491
6604
|
}
|
|
6492
6605
|
for (const file of files) {
|
|
6493
6606
|
if (isTestPath(file.path)) continue;
|
|
6494
|
-
const parser =
|
|
6607
|
+
const parser = parserForExt5(path19.extname(file.path));
|
|
6495
6608
|
if (!parser) continue;
|
|
6496
6609
|
const relPath = toPosix(path19.relative(service.dir, file.path));
|
|
6497
6610
|
const fileDir = path19.dirname(file.path);
|
|
@@ -7466,6 +7579,7 @@ import {
|
|
|
7466
7579
|
import path30 from "path";
|
|
7467
7580
|
import Parser6 from "tree-sitter";
|
|
7468
7581
|
import JavaScript4 from "tree-sitter-javascript";
|
|
7582
|
+
import TypeScript2 from "tree-sitter-typescript";
|
|
7469
7583
|
import Python3 from "tree-sitter-python";
|
|
7470
7584
|
import {
|
|
7471
7585
|
EdgeType as EdgeType13,
|
|
@@ -7521,19 +7635,27 @@ function callsFromSource(source, parser, knownHosts) {
|
|
|
7521
7635
|
}
|
|
7522
7636
|
return out;
|
|
7523
7637
|
}
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
7638
|
+
var GRAMMAR_BY_EXT2 = {
|
|
7639
|
+
".ts": TypeScript2.typescript,
|
|
7640
|
+
".tsx": TypeScript2.tsx,
|
|
7641
|
+
".js": JavaScript4,
|
|
7642
|
+
".jsx": JavaScript4,
|
|
7643
|
+
".mjs": JavaScript4,
|
|
7644
|
+
".cjs": JavaScript4,
|
|
7645
|
+
".py": Python3
|
|
7646
|
+
};
|
|
7647
|
+
function parserForExt(ext, cache) {
|
|
7648
|
+
const grammar = GRAMMAR_BY_EXT2[ext] ?? JavaScript4;
|
|
7649
|
+
let parser = cache.get(grammar);
|
|
7650
|
+
if (!parser) {
|
|
7651
|
+
parser = new Parser6();
|
|
7652
|
+
parser.setLanguage(grammar);
|
|
7653
|
+
cache.set(grammar, parser);
|
|
7654
|
+
}
|
|
7655
|
+
return parser;
|
|
7533
7656
|
}
|
|
7534
7657
|
async function addHttpCallEdges(graph, services) {
|
|
7535
|
-
const
|
|
7536
|
-
const pyParser = makePyParser3();
|
|
7658
|
+
const parserCache = /* @__PURE__ */ new Map();
|
|
7537
7659
|
const { knownHosts, hostToNodeId } = buildServiceHostIndex(services);
|
|
7538
7660
|
let nodesAdded = 0;
|
|
7539
7661
|
let edgesAdded = 0;
|
|
@@ -7542,7 +7664,7 @@ async function addHttpCallEdges(graph, services) {
|
|
|
7542
7664
|
const seen = /* @__PURE__ */ new Set();
|
|
7543
7665
|
for (const file of files) {
|
|
7544
7666
|
if (isTestPath(file.path)) continue;
|
|
7545
|
-
const parser = path30.extname(file.path)
|
|
7667
|
+
const parser = parserForExt(path30.extname(file.path), parserCache);
|
|
7546
7668
|
let sites;
|
|
7547
7669
|
try {
|
|
7548
7670
|
sites = callsFromSource(file.content, parser, knownHosts);
|
|
@@ -7621,7 +7743,7 @@ function parseSource5(parser, source) {
|
|
|
7621
7743
|
(index) => index >= source.length ? "" : source.slice(index, index + PARSE_CHUNK5)
|
|
7622
7744
|
);
|
|
7623
7745
|
}
|
|
7624
|
-
function
|
|
7746
|
+
function makeJsParser3() {
|
|
7625
7747
|
const p = new Parser7();
|
|
7626
7748
|
p.setLanguage(JavaScript5);
|
|
7627
7749
|
return p;
|
|
@@ -7799,7 +7921,7 @@ function findRoute(entries, method, normalizedPath) {
|
|
|
7799
7921
|
);
|
|
7800
7922
|
}
|
|
7801
7923
|
async function addRouteCallEdges(graph, services) {
|
|
7802
|
-
const jsParser =
|
|
7924
|
+
const jsParser = makeJsParser3();
|
|
7803
7925
|
const { knownHosts, hostToNodeId } = buildServiceHostIndex(services);
|
|
7804
7926
|
const routeIndex = buildRouteIndex(graph);
|
|
7805
7927
|
if (routeIndex.size === 0) return { nodesAdded: 0, edgesAdded: 0 };
|
|
@@ -8185,7 +8307,7 @@ import JavaScript6 from "tree-sitter-javascript";
|
|
|
8185
8307
|
import { infraId as infraId7 } from "@neat.is/types";
|
|
8186
8308
|
var FIRESTORE_CLIENT_IMPORT_RE = /(?:from\s+['"`]|require\(\s*['"`])firebase\/firestore['"`]/;
|
|
8187
8309
|
var FIRESTORE_ADMIN_IMPORT_RE = /(?:from\s+['"`]|require\(\s*['"`])firebase-admin(?:\/firestore)?['"`]/;
|
|
8188
|
-
function
|
|
8310
|
+
function parserForExt2(ext) {
|
|
8189
8311
|
const p = new Parser8();
|
|
8190
8312
|
p.setLanguage(GRAMMAR_BY_EXT[ext] ?? JavaScript6);
|
|
8191
8313
|
return p;
|
|
@@ -8350,7 +8472,7 @@ function firestoreEndpointsFromFile(file, serviceDir) {
|
|
|
8350
8472
|
const hasAdmin = FIRESTORE_ADMIN_IMPORT_RE.test(file.content);
|
|
8351
8473
|
if (!hasClient && !hasAdmin) return [];
|
|
8352
8474
|
const fileSdk = hasClient && !hasAdmin ? "client" : hasAdmin && !hasClient ? "admin" : null;
|
|
8353
|
-
const tree = parseSource3(
|
|
8475
|
+
const tree = parseSource3(parserForExt2(path37.extname(file.path)), file.content);
|
|
8354
8476
|
const clientVars = firestoreClientVars(tree.rootNode);
|
|
8355
8477
|
const collLine = /* @__PURE__ */ new Map();
|
|
8356
8478
|
const writes = /* @__PURE__ */ new Map();
|
|
@@ -8765,7 +8887,7 @@ import Python4 from "tree-sitter-python";
|
|
|
8765
8887
|
import { infraId as infraId9 } from "@neat.is/types";
|
|
8766
8888
|
var SQLALCHEMY_IMPORT_RE = /(?:from|import)\s+(?:flask_sqlalchemy|sqlalchemy)\b/;
|
|
8767
8889
|
var PARSE_CHUNK6 = 16384;
|
|
8768
|
-
function
|
|
8890
|
+
function makePyParser3() {
|
|
8769
8891
|
const p = new Parser9();
|
|
8770
8892
|
p.setLanguage(Python4);
|
|
8771
8893
|
return p;
|
|
@@ -8872,7 +8994,7 @@ function foreignKeyParentTable(call) {
|
|
|
8872
8994
|
}
|
|
8873
8995
|
function sqlalchemyForeignKeys(file, serviceDir) {
|
|
8874
8996
|
if (!SQLALCHEMY_IMPORT_RE.test(file.content)) return [];
|
|
8875
|
-
const tree = parseSource6(
|
|
8997
|
+
const tree = parseSource6(makePyParser3(), file.content);
|
|
8876
8998
|
const out = [];
|
|
8877
8999
|
const seen = /* @__PURE__ */ new Set();
|
|
8878
9000
|
walk3(tree.rootNode, (node) => {
|
|
@@ -8909,7 +9031,7 @@ function sqlalchemyForeignKeys(file, serviceDir) {
|
|
|
8909
9031
|
}
|
|
8910
9032
|
function sqlalchemyEndpointsFromFile(file, serviceDir) {
|
|
8911
9033
|
if (!SQLALCHEMY_IMPORT_RE.test(file.content)) return [];
|
|
8912
|
-
const tree = parseSource6(
|
|
9034
|
+
const tree = parseSource6(makePyParser3(), file.content);
|
|
8913
9035
|
const out = [];
|
|
8914
9036
|
const seen = /* @__PURE__ */ new Set();
|
|
8915
9037
|
const push = (name, line, columns) => {
|
|
@@ -8961,7 +9083,7 @@ function sqlalchemyEndpointsFromFile(file, serviceDir) {
|
|
|
8961
9083
|
function buildSqlalchemyModelRegistry(files) {
|
|
8962
9084
|
const table = /* @__PURE__ */ new Map();
|
|
8963
9085
|
const ambiguous = /* @__PURE__ */ new Set();
|
|
8964
|
-
const parser =
|
|
9086
|
+
const parser = makePyParser3();
|
|
8965
9087
|
for (const file of files) {
|
|
8966
9088
|
if (!SQLALCHEMY_IMPORT_RE.test(file.content)) continue;
|
|
8967
9089
|
const tree = parseSource6(parser, file.content);
|
|
@@ -9010,7 +9132,7 @@ function importsModelName(content, name) {
|
|
|
9010
9132
|
function pythonOrmCrossFileEndpoints(files, serviceDir) {
|
|
9011
9133
|
const registry = buildSqlalchemyModelRegistry(files);
|
|
9012
9134
|
if (registry.size === 0) return [];
|
|
9013
|
-
const parser =
|
|
9135
|
+
const parser = makePyParser3();
|
|
9014
9136
|
const out = [];
|
|
9015
9137
|
const seen = /* @__PURE__ */ new Set();
|
|
9016
9138
|
for (const file of files) {
|
|
@@ -9047,7 +9169,7 @@ import Python5 from "tree-sitter-python";
|
|
|
9047
9169
|
import { infraId as infraId10 } from "@neat.is/types";
|
|
9048
9170
|
var DJANGO_IMPORT_RE = /(?:from|import)\s+django\b/;
|
|
9049
9171
|
var PARSE_CHUNK7 = 16384;
|
|
9050
|
-
function
|
|
9172
|
+
function makePyParser4() {
|
|
9051
9173
|
const p = new Parser10();
|
|
9052
9174
|
p.setLanguage(Python5);
|
|
9053
9175
|
return p;
|
|
@@ -9108,7 +9230,7 @@ function readMeta(body) {
|
|
|
9108
9230
|
}
|
|
9109
9231
|
function djangoOrmEndpointsFromFile(file, serviceDir) {
|
|
9110
9232
|
if (!DJANGO_IMPORT_RE.test(file.content)) return [];
|
|
9111
|
-
const tree = parseSource7(
|
|
9233
|
+
const tree = parseSource7(makePyParser4(), file.content);
|
|
9112
9234
|
const out = [];
|
|
9113
9235
|
const seen = /* @__PURE__ */ new Set();
|
|
9114
9236
|
const defaultAppLabel = path40.basename(path40.dirname(file.path));
|
|
@@ -9142,7 +9264,7 @@ import JavaScript7 from "tree-sitter-javascript";
|
|
|
9142
9264
|
import { infraId as infraId11 } from "@neat.is/types";
|
|
9143
9265
|
var DRIZZLE_IMPORT_RE = /drizzle-orm/;
|
|
9144
9266
|
var TABLE_BUILDERS = /* @__PURE__ */ new Set(["pgTable", "mysqlTable", "sqliteTable"]);
|
|
9145
|
-
function
|
|
9267
|
+
function parserForExt3(ext) {
|
|
9146
9268
|
const p = new Parser11();
|
|
9147
9269
|
p.setLanguage(GRAMMAR_BY_EXT[ext] ?? JavaScript7);
|
|
9148
9270
|
return p;
|
|
@@ -9214,7 +9336,7 @@ function columnsFromObject(obj) {
|
|
|
9214
9336
|
}
|
|
9215
9337
|
function drizzleEndpointsFromFile(file, serviceDir) {
|
|
9216
9338
|
if (!DRIZZLE_IMPORT_RE.test(file.content)) return [];
|
|
9217
|
-
const tree = parseSource3(
|
|
9339
|
+
const tree = parseSource3(parserForExt3(path41.extname(file.path)), file.content);
|
|
9218
9340
|
const out = [];
|
|
9219
9341
|
const seen = /* @__PURE__ */ new Set();
|
|
9220
9342
|
const walk9 = (node) => {
|
|
@@ -9303,7 +9425,7 @@ function referencesTargetVar(call) {
|
|
|
9303
9425
|
}
|
|
9304
9426
|
function drizzleForeignKeys(file, serviceDir) {
|
|
9305
9427
|
if (!DRIZZLE_IMPORT_RE.test(file.content)) return [];
|
|
9306
|
-
const tree = parseSource3(
|
|
9428
|
+
const tree = parseSource3(parserForExt3(path41.extname(file.path)), file.content);
|
|
9307
9429
|
const { tables, varToTable } = collectDrizzleTables(tree.rootNode);
|
|
9308
9430
|
const out = [];
|
|
9309
9431
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -12004,7 +12126,7 @@ import {
|
|
|
12004
12126
|
} from "@neat.is/types";
|
|
12005
12127
|
var ZOD_IMPORT_RE = /\bzod\b/;
|
|
12006
12128
|
var ZOD_OBJECTS = /* @__PURE__ */ new Set(["z", "zod"]);
|
|
12007
|
-
function
|
|
12129
|
+
function parserForExt4(ext) {
|
|
12008
12130
|
const p = new Parser16();
|
|
12009
12131
|
p.setLanguage(GRAMMAR_BY_EXT[ext] ?? JavaScript8);
|
|
12010
12132
|
return p;
|
|
@@ -12093,7 +12215,7 @@ function topLevelSchemas(root) {
|
|
|
12093
12215
|
}
|
|
12094
12216
|
function zodShapesFromFile(file, serviceDir) {
|
|
12095
12217
|
if (!ZOD_IMPORT_RE.test(file.content)) return [];
|
|
12096
|
-
const tree = parseSource3(
|
|
12218
|
+
const tree = parseSource3(parserForExt4(path55.extname(file.path)), file.content);
|
|
12097
12219
|
const out = [];
|
|
12098
12220
|
const seen = /* @__PURE__ */ new Set();
|
|
12099
12221
|
for (const { name, call } of topLevelSchemas(tree.rootNode)) {
|
|
@@ -17934,4 +18056,4 @@ export {
|
|
|
17934
18056
|
deprovisionConnector,
|
|
17935
18057
|
buildApi
|
|
17936
18058
|
};
|
|
17937
|
-
//# sourceMappingURL=chunk-
|
|
18059
|
+
//# sourceMappingURL=chunk-N5TPODCX.js.map
|