pi-lens 4.4.3 → 4.4.5
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/CHANGELOG.md +721 -0
- package/README.md +25 -3
- package/config/dependency-cruiser-eager-allowlist.json +1 -0
- package/dist/chunk-22Y2BM7H.js +23 -0
- package/dist/{chunk-WU567RSC.js → chunk-27VWVB23.js} +16 -14
- package/dist/{chunk-FLKWCIZH.js → chunk-2FYKETQJ.js} +10 -6
- package/dist/{chunk-MQLUAEOC.js → chunk-2LDMXL2M.js} +2 -2
- package/dist/{chunk-YSZNHOBY.js → chunk-2SDHYHHO.js} +17 -17
- package/dist/chunk-2Y6OJRSI.js +38 -0
- package/dist/chunk-3SNDVPOR.js +507 -0
- package/dist/{chunk-EJIUXPBX.js → chunk-3WCEHYOI.js} +1 -1
- package/dist/chunk-44X7VIKR.js +73 -0
- package/dist/{chunk-Q7DUK4LX.js → chunk-4FHUGDKU.js} +16 -14
- package/dist/{chunk-H6MF6EVN.js → chunk-4ODSZ35Z.js} +1498 -534
- package/dist/{chunk-ZGDGW2V3.js → chunk-4U7GDSZQ.js} +2 -2
- package/dist/chunk-54NIOJJZ.js +25 -0
- package/dist/{chunk-ZWFS3OEF.js → chunk-5DKE4HGX.js} +38 -37
- package/dist/{chunk-VRZP76YM.js → chunk-5LRUKYFA.js} +34 -4
- package/dist/{chunk-QOBUHWHX.js → chunk-63NMUNYP.js} +12 -16
- package/dist/{chunk-VWCXW2E7.js → chunk-6XSESGWD.js} +13 -6
- package/dist/{chunk-QGQ5CCCG.js → chunk-72J27ICO.js} +2 -3
- package/dist/{chunk-CSHFH5IN.js → chunk-7FLRUH6B.js} +1 -1
- package/dist/chunk-7IYC4ENJ.js +297 -0
- package/dist/chunk-7WWQAW5P.js +30 -0
- package/dist/{chunk-EU63SDCG.js → chunk-7ZS7MC24.js} +885 -451
- package/dist/{chunk-KBG47GHP.js → chunk-AHWA4AKM.js} +18 -12
- package/dist/{chunk-FMSO6RDZ.js → chunk-AI3GP74G.js} +17 -19
- package/dist/chunk-APFJKOP6.js +67 -0
- package/dist/{chunk-RXCOMYPY.js → chunk-ASRAO7KG.js} +31 -33
- package/dist/{chunk-BW5KFIQC.js → chunk-AWQWXSW4.js} +1 -0
- package/dist/{chunk-QILIYSJF.js → chunk-CG5V25HX.js} +1 -1
- package/dist/chunk-CKEQFGLT.js +32 -0
- package/dist/{chunk-RPLINGVB.js → chunk-COOUUC5W.js} +6 -6
- package/dist/{chunk-GBPP5P7X.js → chunk-CPZ5JJW6.js} +4 -4
- package/dist/{chunk-OCAGUNBC.js → chunk-DS2USX5G.js} +13 -15
- package/dist/chunk-EA2ZRG44.js +27 -0
- package/dist/{chunk-ZHFZWTZV.js → chunk-EDMLIW6W.js} +13 -14
- package/dist/{chunk-2EECBNC5.js → chunk-EIKRZ32J.js} +75 -0
- package/dist/chunk-EKNWOL2I.js +27 -0
- package/dist/{chunk-CMMHNUZ2.js → chunk-ELZRSR5N.js} +65 -43
- package/dist/{chunk-BKE7E7TC.js → chunk-EN5AM7PX.js} +11 -12
- package/dist/{chunk-N2H3ZPZY.js → chunk-EWXXLS26.js} +227 -24
- package/dist/chunk-EX4EXBW7.js +37 -0
- package/dist/{chunk-YYOIQFRS.js → chunk-EXVXBSGN.js} +130 -52
- package/dist/{chunk-6GFRNVYR.js → chunk-F7BO6FWH.js} +12 -13
- package/dist/chunk-FEDWAYDS.js +2485 -0
- package/dist/{chunk-JAU72XNY.js → chunk-FWZRGGGY.js} +73 -9
- package/dist/{chunk-GXW6K4YJ.js → chunk-G224FADB.js} +1 -1
- package/dist/chunk-G5UCJFT7.js +26 -0
- package/dist/{chunk-67WMNWEE.js → chunk-GLW3YDZZ.js} +22 -13
- package/dist/{chunk-724UL2TJ.js → chunk-GTDSYEA2.js} +72 -39
- package/dist/{chunk-PHDMFAKM.js → chunk-GYRZ72R4.js} +10 -4
- package/dist/chunk-HYVXA3BB.js +49 -0
- package/dist/{chunk-SAEFPSB6.js → chunk-IEBJF3PN.js} +23 -15
- package/dist/chunk-IJYGIDF4.js +186 -0
- package/dist/{chunk-ACXEQZOU.js → chunk-IL7K66ZQ.js} +101 -109
- package/dist/{chunk-ZXYDQ3TZ.js → chunk-JWOVP5BL.js} +50 -19
- package/dist/{chunk-OXXKQCSV.js → chunk-K2GUZ4DN.js} +4 -4
- package/dist/{chunk-AW7R2GWG.js → chunk-K4SZB56V.js} +39 -39
- package/dist/{chunk-WOA4LN2R.js → chunk-KCBRHV5E.js} +3 -3
- package/dist/{chunk-3W7IEVVL.js → chunk-KFXCL4OV.js} +47 -45
- package/dist/{chunk-2BBLFX75.js → chunk-KJJAVH3X.js} +81 -15
- package/dist/{chunk-VCHXCQFG.js → chunk-KPVLQHCZ.js} +4 -6
- package/dist/{chunk-P7266HLM.js → chunk-KX56K73G.js} +10 -13
- package/dist/{chunk-VSSBEUFT.js → chunk-LMCTHJ2H.js} +19 -19
- package/dist/{chunk-IBGIOBEE.js → chunk-MEFLGBCS.js} +69 -8
- package/dist/{chunk-TYM6OUIT.js → chunk-MKPCELNI.js} +17 -17
- package/dist/{chunk-XTMJ7XDT.js → chunk-N3PLNNCW.js} +1 -1
- package/dist/chunk-N5FBM25N.js +22 -0
- package/dist/{chunk-CHOW74WE.js → chunk-NFNVDDGB.js} +7 -12
- package/dist/{chunk-52FUZI6K.js → chunk-NLIVE7L6.js} +2 -30
- package/dist/{chunk-SS36ZX4J.js → chunk-OMJ3OFBJ.js} +6 -6
- package/dist/{chunk-4W4VLAPJ.js → chunk-OZNCKLOX.js} +13 -14
- package/dist/chunk-P5XUGPIX.js +31 -0
- package/dist/{chunk-5UCAH366.js → chunk-PJXNTPB2.js} +253 -33
- package/dist/chunk-PKOXJIVT.js +88 -0
- package/dist/{chunk-6C7JWPCP.js → chunk-PP2A5V2T.js} +27 -26
- package/dist/{chunk-L3BLXZG7.js → chunk-Q42LJANT.js} +31 -70
- package/dist/{chunk-AB3YYG6N.js → chunk-Q4BKKOVC.js} +8 -8
- package/dist/{chunk-3EFKIGZN.js → chunk-QT66NEYN.js} +4 -4
- package/dist/{chunk-3VPVG5SU.js → chunk-RCHO5W7M.js} +19 -18
- package/dist/{chunk-77M37OKR.js → chunk-RG3MXTRI.js} +7 -7
- package/dist/chunk-RG7OODGM.js +57 -0
- package/dist/{chunk-T6CPIZNT.js → chunk-RU34BA4D.js} +44 -39
- package/dist/{chunk-JMYYOTQG.js → chunk-S26LC76R.js} +13 -1
- package/dist/{chunk-5NGR67U5.js → chunk-S55TEC7I.js} +33 -5
- package/dist/{chunk-M6HSLBWY.js → chunk-SJHC3BCZ.js} +7956 -8047
- package/dist/{chunk-XCJN5IJU.js → chunk-SNEUMLM7.js} +4 -4
- package/dist/{chunk-UZ3TUTRV.js → chunk-T4NGVFYI.js} +2 -2
- package/dist/{chunk-2VUQMUMT.js → chunk-THEXI2QO.js} +49 -43
- package/dist/{chunk-R3PCY3YS.js → chunk-TL2TCJYL.js} +15 -16
- package/dist/{chunk-C34ZXZ7O.js → chunk-TPYYEDP5.js} +838 -352
- package/dist/{chunk-AOHZU2BM.js → chunk-TVZRLTG6.js} +8 -1
- package/dist/{chunk-XMSXXAHW.js → chunk-UCVMSOXF.js} +2 -2
- package/dist/chunk-UL5SXQVX.js +32 -0
- package/dist/{chunk-GAEGEPOC.js → chunk-UO66IMVP.js} +2 -2
- package/dist/{chunk-N3X6Q4YT.js → chunk-UVY4TOJH.js} +3 -3
- package/dist/{chunk-2CD5RS6M.js → chunk-VIDEKABZ.js} +23 -2
- package/dist/{chunk-JSQFTSC6.js → chunk-VITFDI3O.js} +13 -14
- package/dist/{chunk-YIUAVF7E.js → chunk-VUAVE3QC.js} +42 -42
- package/dist/{chunk-QOZXJ4NA.js → chunk-WUY4BZEP.js} +21 -20
- package/dist/{chunk-VCO24T4L.js → chunk-X3UTCXAA.js} +43 -53
- package/dist/chunk-XHDBJODR.js +45 -0
- package/dist/{chunk-MXGY6KPT.js → chunk-XHLK33VM.js} +28 -21
- package/dist/{chunk-RWWYJ623.js → chunk-XI34NWDI.js} +2 -2
- package/dist/{chunk-QQNQ7SJW.js → chunk-XWFIHYCH.js} +12 -4
- package/dist/{chunk-6SDEP3AJ.js → chunk-Y2TPADJR.js} +10 -11
- package/dist/{chunk-MRXKYPCS.js → chunk-Y5KTA2OB.js} +17 -17
- package/dist/{chunk-7DYBLXYA.js → chunk-YKVDBNPO.js} +11 -5
- package/dist/{chunk-2B73ZPOK.js → chunk-YSDPVDFC.js} +3 -3
- package/dist/chunk-YWNO5Q4R.js +44 -0
- package/dist/{chunk-QHJ6DQ2R.js → chunk-YWWG4AQA.js} +165 -32
- package/dist/{chunk-3JNKMP3B.js → chunk-YXDCRUKQ.js} +4 -4
- package/dist/{chunk-UXGETRP4.js → chunk-YXGRRORB.js} +16 -17
- package/dist/{chunk-SQ4TVJBR.js → chunk-ZAPSUBLU.js} +13 -7
- package/dist/{chunk-76MWC2K6.js → chunk-ZPJM7DID.js} +90 -97
- package/dist/{chunk-XVF2VVXP.js → chunk-ZSUX7KEM.js} +16 -15
- package/dist/index.js +31038 -20893
- package/dist/mcp/analyze-cli.js +11 -11
- package/dist/mcp/cli.js +47 -43
- package/dist/mcp/server.js +2188 -906
- package/dist/mcp/worker.js +66 -63
- package/dist/probes/installer.js +21 -23
- package/dist/workers/project-snapshot-persist-worker.js +28 -9
- package/dist/workers/review-graph-persist-worker.js +1 -1
- package/docs/adr/0010-trace-validation-session-lifecycle.md +390 -0
- package/docs/adr/README.md +1 -0
- package/docs/ast-grep_rules_catalog.md +5 -3
- package/docs/configuration.md +20 -0
- package/docs/engineering-principles.md +44 -0
- package/docs/environment-variables.md +20 -0
- package/docs/features.md +16 -1
- package/docs/globalconfig.md +37 -8
- package/docs/lsp-capability-matrix.md +105 -12
- package/docs/lsp-idle-eviction.md +44 -36
- package/docs/pi-lens-fixer.md +139 -14
- package/docs/pi-lens-investigator.md +14 -0
- package/docs/pi-lens-merge-policy.md +120 -17
- package/docs/pi-lens-monitor.md +71 -9
- package/docs/pi-lens-retro.md +6 -3
- package/docs/pi-lens-reviewer.md +160 -5
- package/docs/pi-lens-subagent.md +29 -14
- package/docs/release-qa-baseline.md +21 -7
- package/docs/servercapabilities.md +53 -63
- package/docs/settings.md +9 -5
- package/docs/subagent-compat.md +1 -1
- package/docs/usage.md +1 -0
- package/package.json +9 -5
- package/rules/ast-grep-rules/rule-tests/no-return-value-in-generator-test.yml +17 -0
- package/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-js-test.yml +86 -0
- package/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-test.yml +86 -0
- package/rules/ast-grep-rules/rule-tests/unchecked-numeric-parse-python-test.yml +15 -0
- package/rules/ast-grep-rules/rules/no-return-value-in-generator.yml +9 -4
- package/rules/ast-grep-rules/rules/no-sql-in-code-execute-js.yml +119 -0
- package/rules/ast-grep-rules/rules/no-sql-in-code-execute.yml +119 -0
- package/rules/ast-grep-rules/rules/unchecked-numeric-parse-python.yml +13 -2
- package/rules/rule-catalog.json +25 -1
- package/scripts/analyze-pi-lens-logs.mjs +15 -5
- package/scripts/download-grammars.js +40 -7
- package/scripts/lib/is-main-module.mjs +27 -0
- package/scripts/lib/latency-log-phases.mjs +95 -0
- package/scripts/lib/scratch-home-env.mjs +21 -0
- package/scripts/rpc-load-check.mjs +568 -81
- package/scripts/warm-loader-cache.mjs +2 -5
- package/dist/chunk-23WOO7TX.js +0 -23
- package/dist/chunk-3YN6V5TV.js +0 -85
- package/dist/chunk-466Z26MG.js +0 -30
- package/dist/chunk-4UNXBNE2.js +0 -24
- package/dist/chunk-6STA6Z7I.js +0 -47
- package/dist/chunk-ABBOA7UD.js +0 -157
- package/dist/chunk-BRGDSBJE.js +0 -28
- package/dist/chunk-EC47DWFA.js +0 -56
- package/dist/chunk-FCSOVF55.js +0 -273
- package/dist/chunk-IZSHAIJ7.js +0 -26
- package/dist/chunk-KDERNTCQ.js +0 -28
- package/dist/chunk-KSX3TXSZ.js +0 -69
- package/dist/chunk-LOP6GRPH.js +0 -31
- package/dist/chunk-PNQDPDRC.js +0 -184
- package/dist/chunk-UOPVJQ4N.js +0 -103
- package/dist/chunk-XAGLWMJ4.js +0 -51
- package/dist/chunk-XIJZVPD5.js +0 -39
- package/dist/chunk-Z3CCVDUB.js +0 -76
- package/dist/chunk-Z527N6YQ.js +0 -28
- package/dist/chunk-ZANLILYD.js +0 -79
- /package/dist/{chunk-FC4RP4I2.js → chunk-6HWVI6MI.js} +0 -0
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
extractFactsFromTree
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-G224FADB.js";
|
|
5
5
|
import {
|
|
6
6
|
findOwnerName
|
|
7
7
|
} from "./chunk-5W3R6LFT.js";
|
|
8
8
|
import {
|
|
9
9
|
firstChildOfType,
|
|
10
10
|
walk
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-YWWG4AQA.js";
|
|
12
12
|
import {
|
|
13
13
|
isJstsFactFile
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-GYRZ72R4.js";
|
|
15
15
|
|
|
16
16
|
// dist/clients/dispatch/facts/function-facts.js
|
|
17
17
|
var BOUNDARY_PREFIXES = [
|
|
@@ -123,64 +123,29 @@ function isCallPassThrough(stmt, paramNames) {
|
|
|
123
123
|
}
|
|
124
124
|
return { pass: true, target: (expr.children ?? [])[0]?.text };
|
|
125
125
|
}
|
|
126
|
+
function isDecisionPoint(type, children) {
|
|
127
|
+
if (COMPLEXITY_TYPES.has(type))
|
|
128
|
+
return true;
|
|
129
|
+
return type === "binary_expression" && children.some((c) => LOGICAL_OPERATORS.has(c?.type));
|
|
130
|
+
}
|
|
126
131
|
function calcCyclomaticComplexity(body) {
|
|
127
132
|
let cc = 1;
|
|
128
133
|
walk(body, (node) => {
|
|
129
|
-
if (
|
|
134
|
+
if (isDecisionPoint(node.type, node.children ?? []))
|
|
130
135
|
cc++;
|
|
131
|
-
} else if (node.type === "binary_expression") {
|
|
132
|
-
if ((node.children ?? []).some((c) => LOGICAL_OPERATORS.has(c?.type))) {
|
|
133
|
-
cc++;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
136
|
});
|
|
137
137
|
return cc;
|
|
138
138
|
}
|
|
139
|
-
function
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
walkDepth(child, next);
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
for (const child of body.children ?? []) {
|
|
151
|
-
if (child)
|
|
152
|
-
walkDepth(child, 0);
|
|
153
|
-
}
|
|
154
|
-
return maxDepth;
|
|
155
|
-
}
|
|
156
|
-
function collectOutgoingCalls(body) {
|
|
157
|
-
const calls = /* @__PURE__ */ new Set();
|
|
158
|
-
walk(body, (node) => {
|
|
159
|
-
if (node.type === "call_expression") {
|
|
160
|
-
const callee = (node.children ?? [])[0]?.text ?? "";
|
|
161
|
-
if (callee.length < 80)
|
|
162
|
-
calls.add(callee);
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
return [...calls];
|
|
139
|
+
function memberCallSite(callee) {
|
|
140
|
+
if (callee?.type !== "member_expression")
|
|
141
|
+
return void 0;
|
|
142
|
+
const object = (callee.children ?? [])[0];
|
|
143
|
+
const property = (callee.children ?? []).find((c) => c?.type === "property_identifier");
|
|
144
|
+
if (object?.type !== "identifier" || !property)
|
|
145
|
+
return void 0;
|
|
146
|
+
return { receiver: object.text, method: property.text };
|
|
166
147
|
}
|
|
167
|
-
function
|
|
168
|
-
const sites = [];
|
|
169
|
-
walk(body, (node) => {
|
|
170
|
-
if (node.type !== "call_expression")
|
|
171
|
-
return;
|
|
172
|
-
const callee = (node.children ?? [])[0];
|
|
173
|
-
if (!callee || callee.type !== "member_expression")
|
|
174
|
-
return;
|
|
175
|
-
const object = (callee.children ?? [])[0];
|
|
176
|
-
const property = (callee.children ?? []).find((c) => c?.type === "property_identifier");
|
|
177
|
-
if (!object || object.type !== "identifier" || !property)
|
|
178
|
-
return;
|
|
179
|
-
sites.push({ receiver: object.text, method: property.text });
|
|
180
|
-
});
|
|
181
|
-
return sites;
|
|
182
|
-
}
|
|
183
|
-
function collectReceiverTypes(body, params) {
|
|
148
|
+
function parameterReceiverTypes(params) {
|
|
184
149
|
const types = {};
|
|
185
150
|
for (const param of params) {
|
|
186
151
|
const id = firstNamedChild(param);
|
|
@@ -191,49 +156,75 @@ function collectReceiverTypes(body, params) {
|
|
|
191
156
|
if (typeId)
|
|
192
157
|
types[id.text] = typeId.text;
|
|
193
158
|
}
|
|
194
|
-
walk(body, (node) => {
|
|
195
|
-
if (node.type !== "variable_declarator")
|
|
196
|
-
return;
|
|
197
|
-
const id = firstChildOfType(node, "identifier");
|
|
198
|
-
if (!id)
|
|
199
|
-
return;
|
|
200
|
-
const value = (node.children ?? []).find((c) => c?.type === "new_expression");
|
|
201
|
-
if (!value)
|
|
202
|
-
return;
|
|
203
|
-
const ctor = firstNamedChild(value);
|
|
204
|
-
if (ctor?.type === "identifier")
|
|
205
|
-
types[id.text] = ctor.text;
|
|
206
|
-
});
|
|
207
159
|
return types;
|
|
208
160
|
}
|
|
161
|
+
function returnsAwaitedCall(stmt) {
|
|
162
|
+
const ret = firstNamedChild(stmt);
|
|
163
|
+
return ret?.type === "await_expression" && firstNamedChild(ret)?.type === "call_expression";
|
|
164
|
+
}
|
|
165
|
+
function addCallFacts(callee, calls, memberCallSites) {
|
|
166
|
+
const calleeText = callee?.text ?? "";
|
|
167
|
+
if (calleeText.length < 80)
|
|
168
|
+
calls.add(calleeText);
|
|
169
|
+
const site = memberCallSite(callee);
|
|
170
|
+
if (site)
|
|
171
|
+
memberCallSites.push(site);
|
|
172
|
+
}
|
|
173
|
+
function addNewReceiverType(children, receiverTypes) {
|
|
174
|
+
const id = children.find((c) => c?.type === "identifier");
|
|
175
|
+
const value = children.find((c) => c?.type === "new_expression");
|
|
176
|
+
const ctor = value ? firstNamedChild(value) : void 0;
|
|
177
|
+
if (id && ctor?.type === "identifier")
|
|
178
|
+
receiverTypes[id.text] = ctor.text;
|
|
179
|
+
}
|
|
180
|
+
function summarizeBody(body, params) {
|
|
181
|
+
let hasAwait = false;
|
|
182
|
+
let hasReturnAwaitCall = false;
|
|
183
|
+
let cyclomaticComplexity = 1;
|
|
184
|
+
let maxNestingDepth = 0;
|
|
185
|
+
const calls = /* @__PURE__ */ new Set();
|
|
186
|
+
const memberCallSites = [];
|
|
187
|
+
const receiverTypes = parameterReceiverTypes(params);
|
|
188
|
+
const visit = (node, depth) => {
|
|
189
|
+
const type = node.type;
|
|
190
|
+
const children = node.children ?? [];
|
|
191
|
+
if (depth > maxNestingDepth)
|
|
192
|
+
maxNestingDepth = depth;
|
|
193
|
+
if (isDecisionPoint(type, children))
|
|
194
|
+
cyclomaticComplexity++;
|
|
195
|
+
if (type === "await_expression") {
|
|
196
|
+
hasAwait = true;
|
|
197
|
+
} else if (type === "return_statement") {
|
|
198
|
+
if (returnsAwaitedCall(node))
|
|
199
|
+
hasReturnAwaitCall = true;
|
|
200
|
+
} else if (type === "call_expression") {
|
|
201
|
+
addCallFacts(children[0], calls, memberCallSites);
|
|
202
|
+
} else if (type === "variable_declarator") {
|
|
203
|
+
addNewReceiverType(children, receiverTypes);
|
|
204
|
+
}
|
|
205
|
+
const next = NESTING_TYPES.has(type) ? depth + 1 : depth;
|
|
206
|
+
for (const child of children) {
|
|
207
|
+
if (child)
|
|
208
|
+
visit(child, next);
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
visit(body, 0);
|
|
212
|
+
return {
|
|
213
|
+
hasAwait,
|
|
214
|
+
hasReturnAwaitCall,
|
|
215
|
+
cyclomaticComplexity,
|
|
216
|
+
maxNestingDepth,
|
|
217
|
+
outgoingCalls: [...calls],
|
|
218
|
+
memberCallSites,
|
|
219
|
+
receiverTypes
|
|
220
|
+
};
|
|
221
|
+
}
|
|
209
222
|
function hasExplicitPromiseReturnType(node) {
|
|
210
223
|
const returnType = firstChildOfType(node, "type_annotation");
|
|
211
224
|
if (!returnType)
|
|
212
225
|
return false;
|
|
213
226
|
return /:\s*Promise\b/.test(returnType.text);
|
|
214
227
|
}
|
|
215
|
-
function hasAwaitInNode(node) {
|
|
216
|
-
let found = false;
|
|
217
|
-
walk(node, (n) => {
|
|
218
|
-
if (n.type === "await_expression")
|
|
219
|
-
found = true;
|
|
220
|
-
});
|
|
221
|
-
return found;
|
|
222
|
-
}
|
|
223
|
-
function hasReturnAwaitCall(node) {
|
|
224
|
-
let found = false;
|
|
225
|
-
walk(node, (n) => {
|
|
226
|
-
if (n.type !== "return_statement")
|
|
227
|
-
return;
|
|
228
|
-
const ret = firstNamedChild(n);
|
|
229
|
-
if (ret?.type !== "await_expression")
|
|
230
|
-
return;
|
|
231
|
-
const awaited = firstNamedChild(ret);
|
|
232
|
-
if (awaited?.type === "call_expression")
|
|
233
|
-
found = true;
|
|
234
|
-
});
|
|
235
|
-
return found;
|
|
236
|
-
}
|
|
237
228
|
var functionFactProvider = {
|
|
238
229
|
id: "fact.file.functions",
|
|
239
230
|
provides: ["file.functionSummaries", "file.functionFactsCoverage"],
|
|
@@ -257,31 +248,33 @@ var functionFactProvider = {
|
|
|
257
248
|
const target = passThrough.target ?? "";
|
|
258
249
|
const lowerTarget = target.toLowerCase();
|
|
259
250
|
const isBoundaryWrapper = BOUNDARY_PREFIXES.some((prefix) => lowerTarget.startsWith(prefix));
|
|
251
|
+
const bodySummary = summarizeBody(body, params);
|
|
260
252
|
summaries.push({
|
|
261
253
|
name: getFunctionName(node),
|
|
262
254
|
line: node.startPosition.row + 1,
|
|
263
255
|
column: node.startPosition.column + 1,
|
|
264
256
|
endLine: body.endPosition.row + 1,
|
|
265
257
|
isAsync: Boolean(firstChildOfType(node, "async")),
|
|
266
|
-
hasAwait:
|
|
267
|
-
hasReturnAwaitCall: hasReturnAwaitCall
|
|
258
|
+
hasAwait: bodySummary.hasAwait,
|
|
259
|
+
hasReturnAwaitCall: bodySummary.hasReturnAwaitCall,
|
|
268
260
|
statementCount,
|
|
269
261
|
parameterCount: params.length,
|
|
270
262
|
isPassThroughWrapper: passThrough.pass,
|
|
271
263
|
passThroughTarget: passThrough.target,
|
|
272
264
|
isBoundaryWrapper,
|
|
273
265
|
hasExplicitPromiseReturnType: hasExplicitPromiseReturnType(node),
|
|
274
|
-
cyclomaticComplexity:
|
|
275
|
-
maxNestingDepth:
|
|
276
|
-
outgoingCalls:
|
|
277
|
-
memberCallSites:
|
|
278
|
-
receiverTypes:
|
|
266
|
+
cyclomaticComplexity: bodySummary.cyclomaticComplexity,
|
|
267
|
+
maxNestingDepth: bodySummary.maxNestingDepth,
|
|
268
|
+
outgoingCalls: bodySummary.outgoingCalls,
|
|
269
|
+
memberCallSites: bodySummary.memberCallSites,
|
|
270
|
+
receiverTypes: bodySummary.receiverTypes
|
|
279
271
|
});
|
|
280
272
|
};
|
|
281
273
|
walk(root, (node) => {
|
|
282
|
-
|
|
274
|
+
const type = node.type;
|
|
275
|
+
if (FUNCTION_TYPES.has(type))
|
|
283
276
|
addSummary(node);
|
|
284
|
-
if (
|
|
277
|
+
if (type === "class_declaration" || type === "interface_declaration") {
|
|
285
278
|
const nameNode = firstChildOfType(node, "type_identifier") ?? firstChildOfType(node, "identifier");
|
|
286
279
|
if (nameNode) {
|
|
287
280
|
containers.push({
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
DEPRECATED_CONFIG_SURFACES
|
|
4
|
-
|
|
3
|
+
DEPRECATED_CONFIG_SURFACES,
|
|
4
|
+
MTIME_DRIFT_TOLERANCE_MS,
|
|
5
|
+
freshnessFromMtime
|
|
6
|
+
} from "./chunk-S26LC76R.js";
|
|
5
7
|
import {
|
|
6
8
|
logLatency
|
|
7
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-XWFIHYCH.js";
|
|
8
10
|
import {
|
|
9
|
-
isAtOrAboveHomeDir,
|
|
10
11
|
isWindowsPath,
|
|
11
12
|
nameMatchesMarkerGlob,
|
|
12
13
|
normalizeFilePath,
|
|
13
14
|
realpathOrResolve,
|
|
14
15
|
walkUpDirs
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-EWXXLS26.js";
|
|
16
17
|
|
|
17
18
|
// dist/clients/workspace-topology.js
|
|
18
19
|
import * as fs2 from "node:fs";
|
|
@@ -72,13 +73,7 @@ var DECLARED_LEGACY_FILE_SURFACES = [
|
|
|
72
73
|
...GLOBAL_CONFIG_LOCATIONS
|
|
73
74
|
].filter((location) => location.legacy).map((location) => location.surface);
|
|
74
75
|
function configSearchDirs(startDir, homeDir = os.homedir()) {
|
|
75
|
-
|
|
76
|
-
for (const dir of walkUpDirs(startDir)) {
|
|
77
|
-
if (isAtOrAboveHomeDir(dir, homeDir))
|
|
78
|
-
break;
|
|
79
|
-
dirs.push(dir);
|
|
80
|
-
}
|
|
81
|
-
return dirs;
|
|
76
|
+
return [...walkUpDirs(startDir, { homeDir })];
|
|
82
77
|
}
|
|
83
78
|
function defaultGlobalConfigExists(file) {
|
|
84
79
|
try {
|
|
@@ -326,6 +321,13 @@ function getDirectoryMarkers(dir) {
|
|
|
326
321
|
function walkCacheKey(startDir, markerKey) {
|
|
327
322
|
return `${path2.resolve(startDir)}\0${markerKey}`;
|
|
328
323
|
}
|
|
324
|
+
function dirMtimeIsRacy(mtimeMs, observedAtMs) {
|
|
325
|
+
return freshnessFromMtime({
|
|
326
|
+
mtimeMs,
|
|
327
|
+
referenceMs: observedAtMs - MTIME_DRIFT_TOLERANCE_MS,
|
|
328
|
+
toleranceMs: 0
|
|
329
|
+
}).verdict === "stale";
|
|
330
|
+
}
|
|
329
331
|
function dirMtimesStillFresh(dirMtimes) {
|
|
330
332
|
return dirMtimes.every(({ dir, mtimeMs }) => safeDirMtimeMs(dir) === mtimeMs);
|
|
331
333
|
}
|
|
@@ -355,9 +357,7 @@ function walkToNearestMatch(startDir, cacheSuffix, matches, capMetadata, homeDir
|
|
|
355
357
|
const dirMtimes = [];
|
|
356
358
|
let found;
|
|
357
359
|
let depth = 0;
|
|
358
|
-
for (const dir of walkUpDirs(startDir)) {
|
|
359
|
-
if (isAtOrAboveHomeDir(dir, homeDir))
|
|
360
|
-
break;
|
|
360
|
+
for (const dir of walkUpDirs(startDir, { homeDir })) {
|
|
361
361
|
if (depth >= MAX_WALK_DEPTH) {
|
|
362
362
|
logLatency({
|
|
363
363
|
type: "phase",
|
|
@@ -468,6 +468,7 @@ export {
|
|
|
468
468
|
registerWorkspaceTopologyReset,
|
|
469
469
|
resetWorkspaceTopology,
|
|
470
470
|
getDirectoryMarkers,
|
|
471
|
+
dirMtimeIsRacy,
|
|
471
472
|
dirMtimesStillFresh,
|
|
472
473
|
dirMtimesStillFreshAsync,
|
|
473
474
|
dirMtimeRecordsAsync,
|