@neat.is/core 0.10.4 → 0.10.5-dev.20261002
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-TUGYIRUT.js → chunk-HHAPD6JD.js} +32 -6
- package/dist/chunk-HHAPD6JD.js.map +1 -0
- package/dist/{chunk-2OQVIBZZ.js → chunk-TONL5O2E.js} +4 -4
- package/dist/chunk-TONL5O2E.js.map +1 -0
- package/dist/cli.cjs +154 -28
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +125 -25
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +33 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -2
- package/dist/neatd.cjs +33 -7
- package/dist/neatd.cjs.map +1 -1
- package/dist/neatd.js +2 -2
- package/dist/server.cjs +31 -5
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-2OQVIBZZ.js.map +0 -1
- package/dist/chunk-TUGYIRUT.js.map +0 -1
|
@@ -1469,6 +1469,10 @@ function languageForPath(relPath) {
|
|
|
1469
1469
|
return void 0;
|
|
1470
1470
|
}
|
|
1471
1471
|
}
|
|
1472
|
+
var currentSource;
|
|
1473
|
+
function setExtractionSource(source) {
|
|
1474
|
+
currentSource = source;
|
|
1475
|
+
}
|
|
1472
1476
|
function ensureFileNode(graph, serviceName, serviceNodeId, relPath) {
|
|
1473
1477
|
let nodesAdded = 0;
|
|
1474
1478
|
let edgesAdded = 0;
|
|
@@ -1481,10 +1485,16 @@ function ensureFileNode(graph, serviceName, serviceNodeId, relPath) {
|
|
|
1481
1485
|
service: serviceName,
|
|
1482
1486
|
path: relPath,
|
|
1483
1487
|
...language ? { language } : {},
|
|
1488
|
+
...currentSource ? { source: currentSource } : {},
|
|
1484
1489
|
discoveredVia: "static"
|
|
1485
1490
|
};
|
|
1486
1491
|
graph.addNode(fileNodeId, node);
|
|
1487
1492
|
nodesAdded++;
|
|
1493
|
+
} else if (currentSource) {
|
|
1494
|
+
const existing = graph.getNodeAttributes(fileNodeId);
|
|
1495
|
+
if (existing.source !== currentSource) {
|
|
1496
|
+
graph.replaceNodeAttributes(fileNodeId, { ...existing, source: currentSource });
|
|
1497
|
+
}
|
|
1488
1498
|
}
|
|
1489
1499
|
const containsId = extractedEdgeId2(serviceNodeId, fileNodeId, EdgeType2.CONTAINS);
|
|
1490
1500
|
if (!graph.hasEdge(containsId)) {
|
|
@@ -15698,10 +15708,12 @@ import path67 from "path";
|
|
|
15698
15708
|
import { existsSync as existsSync2 } from "fs";
|
|
15699
15709
|
import path66 from "path";
|
|
15700
15710
|
import { NodeType as NodeType29, Provenance as Provenance23 } from "@neat.is/types";
|
|
15701
|
-
function dropOrphanedFileNodes(graph) {
|
|
15711
|
+
function dropOrphanedFileNodes(graph, source) {
|
|
15702
15712
|
const orphans = [];
|
|
15703
15713
|
graph.forEachNode((id, attrs) => {
|
|
15704
|
-
|
|
15714
|
+
const node = attrs;
|
|
15715
|
+
if (node.type !== NodeType29.FileNode) return;
|
|
15716
|
+
if (source && node.source !== source) return;
|
|
15705
15717
|
if (graph.inboundEdges(id).length === 0 && graph.outboundEdges(id).length === 0) {
|
|
15706
15718
|
orphans.push(id);
|
|
15707
15719
|
}
|
|
@@ -15722,12 +15734,23 @@ function retireEdgesByFile(graph, file) {
|
|
|
15722
15734
|
dropOrphanedFileNodes(graph);
|
|
15723
15735
|
return toDrop.length;
|
|
15724
15736
|
}
|
|
15725
|
-
function
|
|
15737
|
+
function outOfScope(graph, edge, source) {
|
|
15738
|
+
if (!source) return false;
|
|
15739
|
+
for (const endpoint2 of [edge.source, edge.target]) {
|
|
15740
|
+
if (!graph.hasNode(endpoint2)) continue;
|
|
15741
|
+
const node = graph.getNodeAttributes(endpoint2);
|
|
15742
|
+
if (node.type !== NodeType29.FileNode) continue;
|
|
15743
|
+
return node.source !== source;
|
|
15744
|
+
}
|
|
15745
|
+
return false;
|
|
15746
|
+
}
|
|
15747
|
+
function retireExtractedEdgesByMissingFile(graph, scanPath, serviceDirs = [], source) {
|
|
15726
15748
|
const toDrop = [];
|
|
15727
15749
|
const bases = [scanPath, ...serviceDirs];
|
|
15728
15750
|
graph.forEachEdge((id, attrs) => {
|
|
15729
15751
|
const edge = attrs;
|
|
15730
15752
|
if (edge.provenance !== Provenance23.EXTRACTED) return;
|
|
15753
|
+
if (outOfScope(graph, edge, source)) return;
|
|
15731
15754
|
const evidenceFile = edge.evidence?.file;
|
|
15732
15755
|
if (!evidenceFile) return;
|
|
15733
15756
|
if (path66.isAbsolute(evidenceFile)) {
|
|
@@ -15738,7 +15761,7 @@ function retireExtractedEdgesByMissingFile(graph, scanPath, serviceDirs = []) {
|
|
|
15738
15761
|
if (!found) toDrop.push(id);
|
|
15739
15762
|
});
|
|
15740
15763
|
for (const id of toDrop) graph.dropEdge(id);
|
|
15741
|
-
dropOrphanedFileNodes(graph);
|
|
15764
|
+
dropOrphanedFileNodes(graph, source);
|
|
15742
15765
|
return toDrop.length;
|
|
15743
15766
|
}
|
|
15744
15767
|
|
|
@@ -15747,6 +15770,7 @@ async function extractFromDirectory(graph, scanPath, opts = {}) {
|
|
|
15747
15770
|
await ensureCompatLoaded();
|
|
15748
15771
|
drainExtractionErrors();
|
|
15749
15772
|
drainSkippedFiles();
|
|
15773
|
+
setExtractionSource(opts.source);
|
|
15750
15774
|
const services = await discoverServices(scanPath);
|
|
15751
15775
|
const phase1Nodes = addServiceNodes(graph, services);
|
|
15752
15776
|
await addServiceAliases(graph, scanPath, services);
|
|
@@ -15767,7 +15791,8 @@ async function extractFromDirectory(graph, scanPath, opts = {}) {
|
|
|
15767
15791
|
const ghostsRetired = retireExtractedEdgesByMissingFile(
|
|
15768
15792
|
graph,
|
|
15769
15793
|
scanPath,
|
|
15770
|
-
services.map((s) => s.dir)
|
|
15794
|
+
services.map((s) => s.dir),
|
|
15795
|
+
opts.source
|
|
15771
15796
|
);
|
|
15772
15797
|
const frontiersPromoted = promoteFrontierNodes(graph);
|
|
15773
15798
|
if (opts.onPolicyTrigger) await opts.onPolicyTrigger(graph);
|
|
@@ -15802,6 +15827,7 @@ async function extractFromDirectory(graph, scanPath, opts = {}) {
|
|
|
15802
15827
|
);
|
|
15803
15828
|
}
|
|
15804
15829
|
}
|
|
15830
|
+
setExtractionSource(void 0);
|
|
15805
15831
|
const result = {
|
|
15806
15832
|
nodesAdded: phase1Nodes + fileEnum.nodesAdded + symbolEnum.nodesAdded + importGraph.nodesAdded + symbolEdges.nodesAdded + actionPhase.nodesAdded + phase2.nodesAdded + phase3.nodesAdded + routePhase.nodesAdded + grpcPhase.nodesAdded + phase4.nodesAdded + tableEdges.nodesAdded + phase5.nodesAdded + zodPhase.nodesAdded + firestoreRulesPhase.nodesAdded,
|
|
15807
15833
|
edgesAdded: fileEnum.edgesAdded + symbolEnum.edgesAdded + importGraph.edgesAdded + symbolEdges.edgesAdded + actionPhase.edgesAdded + phase2.edgesAdded + phase3.edgesAdded + routePhase.edgesAdded + grpcPhase.edgesAdded + phase4.edgesAdded + tableEdges.edgesAdded + phase5.edgesAdded + zodPhase.edgesAdded + firestoreRulesPhase.edgesAdded,
|
|
@@ -23579,4 +23605,4 @@ export {
|
|
|
23579
23605
|
deprovisionConnector,
|
|
23580
23606
|
buildApi
|
|
23581
23607
|
};
|
|
23582
|
-
//# sourceMappingURL=chunk-
|
|
23608
|
+
//# sourceMappingURL=chunk-HHAPD6JD.js.map
|