@suss/adapter-python 0.5.2 → 0.5.3
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/index.cjs +22 -9
- package/dist/index.js +22 -9
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -18221,8 +18221,10 @@ function buildRouterIndex(files, packs, resolverOptions) {
|
|
|
18221
18221
|
}
|
|
18222
18222
|
}
|
|
18223
18223
|
const byFile = /* @__PURE__ */ new Map();
|
|
18224
|
+
const displayPaths = /* @__PURE__ */ new Map();
|
|
18224
18225
|
for (const file2 of files) {
|
|
18225
18226
|
byFile.set(file2.file, file2);
|
|
18227
|
+
displayPaths.set(file2.module, file2.displayPath);
|
|
18226
18228
|
}
|
|
18227
18229
|
return {
|
|
18228
18230
|
moduleDef(fromFile, spec, name) {
|
|
@@ -18262,14 +18264,15 @@ function buildRouterIndex(files, packs, resolverOptions) {
|
|
|
18262
18264
|
if (ownPrefix.kind === "abstain") {
|
|
18263
18265
|
return ownPrefix;
|
|
18264
18266
|
}
|
|
18267
|
+
const routerPath = displayPaths.get(module2);
|
|
18265
18268
|
const mount = index.mounts.get(construction);
|
|
18266
18269
|
if (mount === void 0) {
|
|
18267
|
-
return { kind: "abstain", reason: unmountedReason(index) };
|
|
18270
|
+
return { kind: "abstain", reason: unmountedReason(index, routerPath) };
|
|
18268
18271
|
}
|
|
18269
18272
|
if (mount.kind === "abstain") {
|
|
18270
18273
|
return { kind: "abstain", reason: mount.reason };
|
|
18271
18274
|
}
|
|
18272
|
-
const rivalled = rivalRegistration(index, mount.site);
|
|
18275
|
+
const rivalled = rivalRegistration(index, mount.site, routerPath);
|
|
18273
18276
|
if (rivalled !== null) {
|
|
18274
18277
|
return { kind: "abstain", reason: rivalled };
|
|
18275
18278
|
}
|
|
@@ -18303,24 +18306,32 @@ function loopsClause(loops, verb) {
|
|
|
18303
18306
|
}
|
|
18304
18307
|
return `loops at ${locations.join(", ")} ${verb}`;
|
|
18305
18308
|
}
|
|
18306
|
-
function
|
|
18307
|
-
|
|
18308
|
-
|
|
18309
|
-
return "is never mounted through a single variable binding in the files read";
|
|
18309
|
+
function couldReach(loop, routerPath) {
|
|
18310
|
+
if (routerPath === void 0) {
|
|
18311
|
+
return true;
|
|
18310
18312
|
}
|
|
18313
|
+
const directory = loop.file.slice(0, loop.file.lastIndexOf("/") + 1);
|
|
18314
|
+
return routerPath.startsWith(directory);
|
|
18315
|
+
}
|
|
18316
|
+
function unmountedReason(index, routerPath) {
|
|
18317
|
+
const loops = [...index.unenumerableLoops.values()];
|
|
18311
18318
|
const stopped = loops.find((loop) => loop.unmatched !== void 0);
|
|
18312
18319
|
if (stopped?.unmatched !== void 0) {
|
|
18313
18320
|
const { name, resolvedTo, matched, of } = stopped.unmatched;
|
|
18314
18321
|
return `is not mounted by name in the files read, and a loop at ${stopped.location} mounts a list this reading resolved, where ${matched} of ${of} entries matched a router and ${name} did not (it resolved to ${resolvedTo}), so the whole list is declined rather than most of it mounted`;
|
|
18315
18322
|
}
|
|
18316
|
-
|
|
18323
|
+
const reachable = loops.filter((loop) => couldReach(loop, routerPath));
|
|
18324
|
+
if (reachable.length === 0) {
|
|
18325
|
+
return "is never mounted through a single variable binding in the files read";
|
|
18326
|
+
}
|
|
18327
|
+
return `is not mounted by name in the files read, and ${loopsClause(reachable, "mount")} routers read out of a call this reading does not follow`;
|
|
18317
18328
|
}
|
|
18318
|
-
function rivalRegistration(index, site) {
|
|
18329
|
+
function rivalRegistration(index, site, routerPath) {
|
|
18319
18330
|
if (site.kind === "module") {
|
|
18320
18331
|
return null;
|
|
18321
18332
|
}
|
|
18322
18333
|
const rivals = [...index.unenumerableLoops.values()].filter(
|
|
18323
|
-
(loop) => !sameSite(loop.site, site)
|
|
18334
|
+
(loop) => !sameSite(loop.site, site) && couldReach(loop, routerPath)
|
|
18324
18335
|
);
|
|
18325
18336
|
if (rivals.length === 0) {
|
|
18326
18337
|
return null;
|
|
@@ -18793,6 +18804,7 @@ function mountedConstructions(arg, position, scan) {
|
|
|
18793
18804
|
}
|
|
18794
18805
|
scan.index.unenumerableLoops.set(target.location, {
|
|
18795
18806
|
site: position.site,
|
|
18807
|
+
file: scan.bound.displayPath,
|
|
18796
18808
|
location: target.location,
|
|
18797
18809
|
...returned.kind === "unmatched" ? { unmatched: returned } : {}
|
|
18798
18810
|
});
|
|
@@ -18800,6 +18812,7 @@ function mountedConstructions(arg, position, scan) {
|
|
|
18800
18812
|
}
|
|
18801
18813
|
scan.index.unenumerableLoops.set(target.location, {
|
|
18802
18814
|
site: position.site,
|
|
18815
|
+
file: scan.bound.displayPath,
|
|
18803
18816
|
location: target.location
|
|
18804
18817
|
});
|
|
18805
18818
|
return [];
|
package/dist/index.js
CHANGED
|
@@ -18177,8 +18177,10 @@ function buildRouterIndex(files, packs, resolverOptions) {
|
|
|
18177
18177
|
}
|
|
18178
18178
|
}
|
|
18179
18179
|
const byFile = /* @__PURE__ */ new Map();
|
|
18180
|
+
const displayPaths = /* @__PURE__ */ new Map();
|
|
18180
18181
|
for (const file2 of files) {
|
|
18181
18182
|
byFile.set(file2.file, file2);
|
|
18183
|
+
displayPaths.set(file2.module, file2.displayPath);
|
|
18182
18184
|
}
|
|
18183
18185
|
return {
|
|
18184
18186
|
moduleDef(fromFile, spec, name) {
|
|
@@ -18218,14 +18220,15 @@ function buildRouterIndex(files, packs, resolverOptions) {
|
|
|
18218
18220
|
if (ownPrefix.kind === "abstain") {
|
|
18219
18221
|
return ownPrefix;
|
|
18220
18222
|
}
|
|
18223
|
+
const routerPath = displayPaths.get(module);
|
|
18221
18224
|
const mount = index.mounts.get(construction);
|
|
18222
18225
|
if (mount === void 0) {
|
|
18223
|
-
return { kind: "abstain", reason: unmountedReason(index) };
|
|
18226
|
+
return { kind: "abstain", reason: unmountedReason(index, routerPath) };
|
|
18224
18227
|
}
|
|
18225
18228
|
if (mount.kind === "abstain") {
|
|
18226
18229
|
return { kind: "abstain", reason: mount.reason };
|
|
18227
18230
|
}
|
|
18228
|
-
const rivalled = rivalRegistration(index, mount.site);
|
|
18231
|
+
const rivalled = rivalRegistration(index, mount.site, routerPath);
|
|
18229
18232
|
if (rivalled !== null) {
|
|
18230
18233
|
return { kind: "abstain", reason: rivalled };
|
|
18231
18234
|
}
|
|
@@ -18259,24 +18262,32 @@ function loopsClause(loops, verb) {
|
|
|
18259
18262
|
}
|
|
18260
18263
|
return `loops at ${locations.join(", ")} ${verb}`;
|
|
18261
18264
|
}
|
|
18262
|
-
function
|
|
18263
|
-
|
|
18264
|
-
|
|
18265
|
-
return "is never mounted through a single variable binding in the files read";
|
|
18265
|
+
function couldReach(loop, routerPath) {
|
|
18266
|
+
if (routerPath === void 0) {
|
|
18267
|
+
return true;
|
|
18266
18268
|
}
|
|
18269
|
+
const directory = loop.file.slice(0, loop.file.lastIndexOf("/") + 1);
|
|
18270
|
+
return routerPath.startsWith(directory);
|
|
18271
|
+
}
|
|
18272
|
+
function unmountedReason(index, routerPath) {
|
|
18273
|
+
const loops = [...index.unenumerableLoops.values()];
|
|
18267
18274
|
const stopped = loops.find((loop) => loop.unmatched !== void 0);
|
|
18268
18275
|
if (stopped?.unmatched !== void 0) {
|
|
18269
18276
|
const { name, resolvedTo, matched, of } = stopped.unmatched;
|
|
18270
18277
|
return `is not mounted by name in the files read, and a loop at ${stopped.location} mounts a list this reading resolved, where ${matched} of ${of} entries matched a router and ${name} did not (it resolved to ${resolvedTo}), so the whole list is declined rather than most of it mounted`;
|
|
18271
18278
|
}
|
|
18272
|
-
|
|
18279
|
+
const reachable = loops.filter((loop) => couldReach(loop, routerPath));
|
|
18280
|
+
if (reachable.length === 0) {
|
|
18281
|
+
return "is never mounted through a single variable binding in the files read";
|
|
18282
|
+
}
|
|
18283
|
+
return `is not mounted by name in the files read, and ${loopsClause(reachable, "mount")} routers read out of a call this reading does not follow`;
|
|
18273
18284
|
}
|
|
18274
|
-
function rivalRegistration(index, site) {
|
|
18285
|
+
function rivalRegistration(index, site, routerPath) {
|
|
18275
18286
|
if (site.kind === "module") {
|
|
18276
18287
|
return null;
|
|
18277
18288
|
}
|
|
18278
18289
|
const rivals = [...index.unenumerableLoops.values()].filter(
|
|
18279
|
-
(loop) => !sameSite(loop.site, site)
|
|
18290
|
+
(loop) => !sameSite(loop.site, site) && couldReach(loop, routerPath)
|
|
18280
18291
|
);
|
|
18281
18292
|
if (rivals.length === 0) {
|
|
18282
18293
|
return null;
|
|
@@ -18749,6 +18760,7 @@ function mountedConstructions(arg, position, scan) {
|
|
|
18749
18760
|
}
|
|
18750
18761
|
scan.index.unenumerableLoops.set(target.location, {
|
|
18751
18762
|
site: position.site,
|
|
18763
|
+
file: scan.bound.displayPath,
|
|
18752
18764
|
location: target.location,
|
|
18753
18765
|
...returned.kind === "unmatched" ? { unmatched: returned } : {}
|
|
18754
18766
|
});
|
|
@@ -18756,6 +18768,7 @@ function mountedConstructions(arg, position, scan) {
|
|
|
18756
18768
|
}
|
|
18757
18769
|
scan.index.unenumerableLoops.set(target.location, {
|
|
18758
18770
|
site: position.site,
|
|
18771
|
+
file: scan.bound.displayPath,
|
|
18759
18772
|
location: target.location
|
|
18760
18773
|
});
|
|
18761
18774
|
return [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suss/adapter-python",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Python language adapter for suss — parses source with tree-sitter (WASM), resolves names with a lexical binder, and emits raw extractions for the suss pipeline.",
|
|
6
6
|
"keywords": [
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"typecheck": "tsc --noEmit"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@suss/behavioral-ir": "0.5.
|
|
51
|
-
"@suss/datalog": "0.5.
|
|
52
|
-
"@suss/extractor": "0.5.
|
|
50
|
+
"@suss/behavioral-ir": "0.5.3",
|
|
51
|
+
"@suss/datalog": "0.5.3",
|
|
52
|
+
"@suss/extractor": "0.5.3",
|
|
53
53
|
"web-tree-sitter": "^0.26.11"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|