pi-lens 4.4.4 → 4.4.6
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 +477 -0
- package/README.md +45 -3
- package/config/biome/core.jsonc +3 -3
- package/config/dependency-cruiser-eager-allowlist.json +1 -0
- package/dist/{chunk-UBOQLVT2.js → chunk-2DDDCJDL.js} +4 -4
- package/dist/{chunk-RKKOYPRA.js → chunk-2DMLM3ZO.js} +13 -15
- package/dist/chunk-2F47TQOA.js +73 -0
- package/dist/{chunk-O4NWQT6I.js → chunk-2PHMIAKO.js} +4 -4
- package/dist/{chunk-DGUKIYSI.js → chunk-2RLWJO5K.js} +8 -10
- package/dist/{chunk-S67KYG37.js → chunk-2X4VLOCC.js} +2 -2
- package/dist/{chunk-TIQ2PKDW.js → chunk-3MYEA7QD.js} +4 -4
- package/dist/{chunk-3DA2JDOL.js → chunk-3WEPUD2V.js} +551 -203
- package/dist/{chunk-AMERCH6V.js → chunk-4AVZ3TG7.js} +15 -16
- package/dist/{chunk-IYNJ6YPZ.js → chunk-4PCQCU47.js} +4 -4
- package/dist/chunk-4WX4CTUE.js +57 -0
- package/dist/{chunk-P63GXC37.js → chunk-5APMQ2IJ.js} +31 -4
- package/dist/{chunk-ZIVJBOO3.js → chunk-5CV5ITZF.js} +2 -2
- package/dist/{chunk-6DLWKFEX.js → chunk-5ZR3APIM.js} +41 -42
- package/dist/{chunk-XTBDCR27.js → chunk-63RIVFQI.js} +4 -4
- package/dist/{chunk-GSLNCYGG.js → chunk-75SY4F24.js} +13 -14
- package/dist/{chunk-U44DJXQP.js → chunk-7RQXA5GG.js} +15 -18
- package/dist/chunk-A3YNG5KP.js +45 -0
- package/dist/{chunk-5OFV52AM.js → chunk-AE37FEGH.js} +1 -1
- package/dist/{chunk-BWD5EPKO.js → chunk-AMXIUN2R.js} +4 -6
- package/dist/{chunk-3KAZU3VR.js → chunk-ARD426WI.js} +2 -2
- package/dist/{chunk-BW5KFIQC.js → chunk-AWQWXSW4.js} +1 -0
- package/dist/{chunk-YH5MVY2U.js → chunk-BHUWL2Y3.js} +7 -7
- package/dist/{chunk-CT4MN5IU.js → chunk-BI5LAQ3Y.js} +353 -359
- package/dist/{chunk-KAPJINKN.js → chunk-BM5GS6ZH.js} +2 -2
- package/dist/{chunk-TLX72JTG.js → chunk-BWYQUPOS.js} +1 -1
- package/dist/chunk-CFRQMBGP.js +49 -0
- package/dist/{chunk-RMLC67LF.js → chunk-CJYKEW2L.js} +2 -30
- package/dist/chunk-CKEQFGLT.js +32 -0
- package/dist/{chunk-IWDLU6K3.js → chunk-DC4CFXM5.js} +4 -6
- package/dist/{chunk-ZVUL7QYY.js → chunk-DMSLNKF7.js} +29 -32
- package/dist/{chunk-KN35K52N.js → chunk-DQXSPYRI.js} +3 -3
- package/dist/{chunk-HYGZEMX6.js → chunk-EVDGNG4F.js} +11 -5
- package/dist/{chunk-SRYEJNES.js → chunk-F5Z6URKM.js} +2 -2
- package/dist/{chunk-UMS2MFPZ.js → chunk-F6X3YJWD.js} +2 -3
- package/dist/{chunk-XYURS6EN.js → chunk-FA5LDARD.js} +15 -17
- package/dist/{chunk-24AKHFGP.js → chunk-FFL3A2VP.js} +6 -6
- package/dist/chunk-FJIVKLPH.js +31 -0
- package/dist/chunk-G2B7F6ZU.js +88 -0
- package/dist/{chunk-US7ECLD7.js → chunk-GAACZY6R.js} +131 -41
- package/dist/{chunk-MZGQNL3Y.js → chunk-GMTFDAOK.js} +12 -13
- package/dist/{chunk-VOOAPROD.js → chunk-GNSIWBAT.js} +3 -3
- package/dist/chunk-GTAI2J6U.js +27 -0
- package/dist/{chunk-RVK72CZX.js → chunk-GZE7WOI4.js} +1362 -459
- package/dist/{chunk-IUE7SSKV.js → chunk-H7HTEQUZ.js} +13 -7
- package/dist/{chunk-EUXZEFTV.js → chunk-HK6JVFZC.js} +3 -3
- package/dist/chunk-IPDG45G5.js +26 -0
- package/dist/{chunk-5HSRT26B.js → chunk-J6JP25XU.js} +16 -15
- package/dist/{chunk-HWCCCQNX.js → chunk-JL6CXUMW.js} +13 -6
- package/dist/{chunk-EBC36LNN.js → chunk-K2YGBXOA.js} +17 -17
- package/dist/{chunk-WMYE35PX.js → chunk-KLQVC3XC.js} +7 -5
- package/dist/{chunk-ATKJFDQN.js → chunk-KSR7RGQY.js} +12 -14
- package/dist/{chunk-POMLXPMY.js → chunk-KXF5R4UN.js} +1 -1
- package/dist/{chunk-LLJNQKQW.js → chunk-LEJOJDXL.js} +20 -13
- package/dist/{chunk-JUKMK5Y4.js → chunk-MA77RSFN.js} +10 -11
- package/dist/{chunk-GAQ7OQG6.js → chunk-MKVZQUEG.js} +85 -96
- package/dist/{chunk-2EECBNC5.js → chunk-MN7MHUXQ.js} +75 -0
- package/dist/{chunk-DEL2U6CM.js → chunk-MT6BVNFW.js} +16 -14
- package/dist/chunk-NDMCVUYK.js +507 -0
- package/dist/{chunk-HRNHZA3N.js → chunk-NIU2IPC5.js} +12 -16
- package/dist/{chunk-AGSS7277.js → chunk-NNKXDXXS.js} +7 -24
- package/dist/{chunk-V35JG4JB.js → chunk-OJLTLYHB.js} +152 -334
- package/dist/{chunk-J6MPGQTS.js → chunk-OLAWH5UQ.js} +81 -15
- package/dist/{chunk-T57LYLZT.js → chunk-OOU2WZZE.js} +1 -1
- package/dist/{chunk-CYRKQRPM.js → chunk-OSTKYB55.js} +2 -4
- package/dist/chunk-P4QNXS6I.js +27 -0
- package/dist/chunk-PKES3ISE.js +297 -0
- package/dist/{chunk-ROYSX2S5.js → chunk-PO45POGF.js} +2 -2
- package/dist/{chunk-T7FEBKXN.js → chunk-PPIBVH4R.js} +7 -9
- package/dist/{chunk-3RKP3FMS.js → chunk-PQJFG24Z.js} +295 -23
- package/dist/{chunk-KUA4OJ5Y.js → chunk-Q3UZHW6N.js} +846 -350
- package/dist/{chunk-N5FLEO7W.js → chunk-Q4EMRFNA.js} +37 -37
- package/dist/{chunk-5IUSNGOC.js → chunk-Q4FCYCRE.js} +28 -21
- package/dist/chunk-Q6D6VMI4.js +22 -0
- package/dist/{chunk-UZ2XCLYS.js → chunk-QGSTQH4D.js} +8 -8
- package/dist/{chunk-DUO2TU77.js → chunk-RZOXUSPC.js} +10 -4
- package/dist/{chunk-JMYYOTQG.js → chunk-S26LC76R.js} +13 -1
- package/dist/{chunk-GMX5OS7B.js → chunk-S67UJDGQ.js} +11 -12
- package/dist/chunk-SCIUNBPF.js +44 -0
- package/dist/{chunk-RKBXZN3A.js → chunk-SJJYRZB4.js} +2 -2
- package/dist/chunk-SXGD4ANG.js +25 -0
- package/dist/{chunk-YCWYO6TQ.js → chunk-T7FTXGS3.js} +48 -45
- package/dist/{chunk-FM4RDMKT.js → chunk-TIQJPRDD.js} +115 -61
- package/dist/{chunk-XHJBS436.js → chunk-TIYGSODX.js} +25 -25
- package/dist/{chunk-S2HEXIWI.js → chunk-U2SDMG7C.js} +10 -6
- package/dist/{chunk-2KXTHF3M.js → chunk-U6OC3QEM.js} +253 -33
- package/dist/{chunk-AWSCPCN2.js → chunk-UCGQT677.js} +19 -19
- package/dist/chunk-UHGF5UT5.js +32 -0
- package/dist/{chunk-JW3YWBVB.js → chunk-UN4TEBWN.js} +17 -19
- package/dist/{chunk-ZHH37KZL.js → chunk-V3APN3DY.js} +17 -17
- package/dist/{chunk-ED36RF6Y.js → chunk-V63BC55Q.js} +1 -1
- package/dist/{chunk-XBJVAEEO.js → chunk-VG5JS5SW.js} +3 -2
- package/dist/{chunk-W66O5E25.js → chunk-VPBIMOAQ.js} +13 -15
- package/dist/chunk-VQH24FIP.js +37 -0
- package/dist/{chunk-YNE3RP52.js → chunk-VSFLRN5Y.js} +8 -1
- package/dist/{chunk-7D6L4MTX.js → chunk-W2V54OCL.js} +3 -3
- package/dist/{chunk-2FN63LPV.js → chunk-W5LGKNET.js} +13 -14
- package/dist/{chunk-IQWN5JCP.js → chunk-W5R5SABV.js} +13 -14
- package/dist/{chunk-R3T7CLQ2.js → chunk-WIZWZR4C.js} +41 -41
- package/dist/{chunk-TOY6QKOH.js → chunk-WQOIR3QY.js} +17 -17
- package/dist/{chunk-Y6GZHWSJ.js → chunk-XAIT2YGS.js} +6 -6
- package/dist/chunk-XCUHKYCQ.js +23 -0
- package/dist/{chunk-GSM5UU7A.js → chunk-XQCSWV2G.js} +44 -35
- package/dist/{chunk-OHKJ7PQF.js → chunk-YBSONGSZ.js} +43 -39
- package/dist/{chunk-GXFV6MYU.js → chunk-YISME6ON.js} +72 -39
- package/dist/chunk-YRD4ISED.js +30 -0
- package/dist/{chunk-SD4I7ZO4.js → chunk-YSBHPOY6.js} +43 -53
- package/dist/{chunk-QBFBRV2B.js → chunk-Z2XAOKHK.js} +4 -2
- package/dist/{chunk-5VSF4UUQ.js → chunk-Z7IGUAXL.js} +34 -39
- package/dist/{chunk-MPNJLASA.js → chunk-ZKXQKGWZ.js} +10 -13
- package/dist/{chunk-J64T55EI.js → chunk-ZQ6NZZTB.js} +75 -9
- package/dist/chunk-ZUUI3ZSA.js +38 -0
- package/dist/{chunk-7HXE67BN.js → chunk-ZYNI26MI.js} +2 -2
- package/dist/index.js +32674 -27567
- package/dist/mcp/analyze-cli.js +11 -12
- package/dist/mcp/cli.js +46 -45
- package/dist/mcp/server.js +1210 -574
- package/dist/mcp/worker.js +65 -65
- package/dist/probes/installer.js +21 -23
- package/docs/adr/0010-trace-validation-session-lifecycle.md +390 -0
- package/docs/adr/README.md +1 -0
- package/docs/agent-tools.md +28 -7
- package/docs/ast-grep_rules_catalog.md +5 -3
- package/docs/configuration.md +12 -1
- package/docs/defect-shapes.md +738 -0
- package/docs/engineering-principles.md +12 -0
- package/docs/environment-variables.md +20 -0
- package/docs/features.md +16 -1
- package/docs/globalconfig.md +37 -8
- package/docs/invariants/caches-stores.md +30 -0
- package/docs/invariants/dispatch-runners.md +164 -0
- package/docs/invariants/git-guard-host.md +53 -0
- package/docs/invariants/language-config.md +31 -0
- package/docs/invariants/lsp-trust-exec.md +286 -0
- package/docs/invariants/paths-os.md +59 -0
- package/docs/invariants/session-telemetry.md +74 -0
- package/docs/lsp-capability-matrix.md +105 -12
- package/docs/lsp-idle-eviction.md +37 -18
- package/docs/pi-lens-fixer.md +24 -2
- package/docs/pi-lens-investigator.md +14 -0
- package/docs/pi-lens-merge-policy.md +32 -17
- package/docs/pi-lens-monitor.md +66 -10
- package/docs/pi-lens-orchestration.md +41 -0
- package/docs/pi-lens-release.md +20 -0
- package/docs/pi-lens-retro.md +5 -4
- package/docs/pi-lens-reviewer.md +54 -7
- package/docs/pi-lens-subagent.md +10 -3
- package/docs/release-qa-baseline.md +19 -7
- package/docs/servercapabilities.md +47 -47
- package/docs/settings.md +9 -5
- package/docs/subagent-compat.md +1 -1
- package/docs/usage.md +1 -0
- package/package.json +8 -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/lib/is-main-module.mjs +27 -0
- package/scripts/lib/scratch-home-env.mjs +21 -0
- package/scripts/rpc-load-check.mjs +4 -6
- package/scripts/warm-loader-cache.mjs +2 -5
- package/dist/chunk-3PTHXJXR.js +0 -28
- package/dist/chunk-3QED2P4V.js +0 -31
- package/dist/chunk-5WRPDP2A.js +0 -47
- package/dist/chunk-ABBOA7UD.js +0 -157
- package/dist/chunk-CUHSHSB6.js +0 -273
- package/dist/chunk-GL5LUMZE.js +0 -51
- package/dist/chunk-HAD7QRQI.js +0 -30
- package/dist/chunk-JORED7EX.js +0 -44
- package/dist/chunk-KYUB6QDC.js +0 -72
- package/dist/chunk-LZSEQW6A.js +0 -57
- package/dist/chunk-M2IFVFWU.js +0 -79
- package/dist/chunk-M2UD3LPU.js +0 -88
- package/dist/chunk-MBKQHGA7.js +0 -39
- package/dist/chunk-R7YOCSNV.js +0 -23
- package/dist/chunk-SKAMFC7A.js +0 -28
- package/dist/chunk-SYE6T2EB.js +0 -28
- package/dist/chunk-TRETHTQO.js +0 -26
- package/dist/chunk-UA7ZXYDR.js +0 -184
- package/dist/chunk-XTFDJI3T.js +0 -24
- package/dist/chunk-Z3CCVDUB.js +0 -76
|
@@ -1,5 +1,155 @@
|
|
|
1
1
|
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
2
2
|
|
|
3
|
+
// dist/clients/bounded-cache.js
|
|
4
|
+
var BoundedFifoMap = class {
|
|
5
|
+
entries = /* @__PURE__ */ new Map();
|
|
6
|
+
maxEntries;
|
|
7
|
+
constructor(maxEntries) {
|
|
8
|
+
this.maxEntries = maxEntries;
|
|
9
|
+
}
|
|
10
|
+
get(key) {
|
|
11
|
+
return this.entries.get(key);
|
|
12
|
+
}
|
|
13
|
+
has(key) {
|
|
14
|
+
return this.entries.has(key);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Insert or update `key` without reordering. Evicts the oldest
|
|
18
|
+
* (insertion-order) entries once the map exceeds capacity.
|
|
19
|
+
*
|
|
20
|
+
* Returns the evicted `[key, value]` pairs, oldest first — callers with
|
|
21
|
+
* eviction-side bookkeeping use the return value instead of hand-rolling
|
|
22
|
+
* `keys().next().value` (#2442). The VALUE is returned, not just the key,
|
|
23
|
+
* because the eviction-coupled sites need it: `tree-sitter-cache.ts` has to
|
|
24
|
+
* retire the dropped entry's WASM-heap tree (#417/#890) and
|
|
25
|
+
* `tree-sitter-client.ts` has to `delete()` the dropped compiled query.
|
|
26
|
+
* Handing back only the key would force those sites to read the value out
|
|
27
|
+
* of the map before eviction — i.e. to hand-roll the block this class
|
|
28
|
+
* exists to delete.
|
|
29
|
+
*/
|
|
30
|
+
set(key, value) {
|
|
31
|
+
this.entries.set(key, value);
|
|
32
|
+
return this.evictOverflow();
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Change the capacity ceiling, evicting down to it immediately when it
|
|
36
|
+
* shrinks. Returns the evicted `[key, value]` pairs, oldest first, on the
|
|
37
|
+
* same contract as {@link set} — a caller with a DYNAMIC cap (an env-read
|
|
38
|
+
* ceiling, `TreeCache.setMaxSize`) needs the shrink to free the same
|
|
39
|
+
* resources an ordinary overflow frees.
|
|
40
|
+
*/
|
|
41
|
+
setMaxEntries(maxEntries) {
|
|
42
|
+
this.maxEntries = maxEntries;
|
|
43
|
+
return this.evictOverflow();
|
|
44
|
+
}
|
|
45
|
+
/** Current capacity ceiling. */
|
|
46
|
+
getMaxEntries() {
|
|
47
|
+
return this.maxEntries;
|
|
48
|
+
}
|
|
49
|
+
/** Drop oldest-first until within capacity. The one eviction block. */
|
|
50
|
+
evictOverflow() {
|
|
51
|
+
const evicted = [];
|
|
52
|
+
while (this.entries.size > this.maxEntries) {
|
|
53
|
+
const oldest = this.entries.entries().next().value;
|
|
54
|
+
if (oldest === void 0)
|
|
55
|
+
break;
|
|
56
|
+
this.entries.delete(oldest[0]);
|
|
57
|
+
evicted.push(oldest);
|
|
58
|
+
}
|
|
59
|
+
return evicted;
|
|
60
|
+
}
|
|
61
|
+
delete(key) {
|
|
62
|
+
return this.entries.delete(key);
|
|
63
|
+
}
|
|
64
|
+
clear() {
|
|
65
|
+
this.entries.clear();
|
|
66
|
+
}
|
|
67
|
+
get size() {
|
|
68
|
+
return this.entries.size;
|
|
69
|
+
}
|
|
70
|
+
keys() {
|
|
71
|
+
return this.entries.keys();
|
|
72
|
+
}
|
|
73
|
+
values() {
|
|
74
|
+
return this.entries.values();
|
|
75
|
+
}
|
|
76
|
+
entriesArray() {
|
|
77
|
+
return [...this.entries.entries()];
|
|
78
|
+
}
|
|
79
|
+
[Symbol.iterator]() {
|
|
80
|
+
return this.entries[Symbol.iterator]();
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var BoundedSet = class {
|
|
84
|
+
entries;
|
|
85
|
+
constructor(maxEntries) {
|
|
86
|
+
this.entries = new BoundedFifoMap(maxEntries);
|
|
87
|
+
}
|
|
88
|
+
has(value) {
|
|
89
|
+
return this.entries.has(value);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Insert `value` without reordering an already-present member. Evicts the
|
|
93
|
+
* oldest (insertion-order) members once the set exceeds capacity.
|
|
94
|
+
*
|
|
95
|
+
* Returns the evicted values, oldest first — see the class doc for why a
|
|
96
|
+
* call site consumes this instead of hand-rolling the drop.
|
|
97
|
+
*/
|
|
98
|
+
add(value) {
|
|
99
|
+
return this.entries.set(value, true).map(([evicted]) => evicted);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Change the capacity ceiling, evicting down to it immediately when it
|
|
103
|
+
* shrinks. Returns the evicted values, oldest first, on the same contract
|
|
104
|
+
* as {@link add}.
|
|
105
|
+
*/
|
|
106
|
+
setMaxEntries(maxEntries) {
|
|
107
|
+
return this.entries.setMaxEntries(maxEntries).map(([evicted]) => evicted);
|
|
108
|
+
}
|
|
109
|
+
/** Current capacity ceiling. */
|
|
110
|
+
getMaxEntries() {
|
|
111
|
+
return this.entries.getMaxEntries();
|
|
112
|
+
}
|
|
113
|
+
delete(value) {
|
|
114
|
+
return this.entries.delete(value);
|
|
115
|
+
}
|
|
116
|
+
clear() {
|
|
117
|
+
this.entries.clear();
|
|
118
|
+
}
|
|
119
|
+
get size() {
|
|
120
|
+
return this.entries.size;
|
|
121
|
+
}
|
|
122
|
+
values() {
|
|
123
|
+
return this.entries.keys();
|
|
124
|
+
}
|
|
125
|
+
[Symbol.iterator]() {
|
|
126
|
+
return this.entries.keys();
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
var BoundedLruCache = class extends BoundedFifoMap {
|
|
130
|
+
/**
|
|
131
|
+
* Read and promote to most-recently-used.
|
|
132
|
+
*
|
|
133
|
+
* A stored `undefined` value is NOT promoted — the hit is indistinguishable
|
|
134
|
+
* from a miss on this signature, and pre-#2442 `BoundedLruCache` behaved
|
|
135
|
+
* the same way. No caller stores `undefined`; the note exists so a future
|
|
136
|
+
* one does not assume otherwise.
|
|
137
|
+
*/
|
|
138
|
+
get(key) {
|
|
139
|
+
const value = this.entries.get(key);
|
|
140
|
+
if (value !== void 0) {
|
|
141
|
+
this.entries.delete(key);
|
|
142
|
+
this.entries.set(key, value);
|
|
143
|
+
}
|
|
144
|
+
return value;
|
|
145
|
+
}
|
|
146
|
+
/** Insert or update `key`, moving it to the most-recently-used position. */
|
|
147
|
+
set(key, value) {
|
|
148
|
+
this.entries.delete(key);
|
|
149
|
+
return super.set(key, value);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
3
153
|
// node_modules/balanced-match/dist/esm/index.js
|
|
4
154
|
var balanced = (a, b, str) => {
|
|
5
155
|
const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
|
|
@@ -1872,6 +2022,7 @@ minimatch.unescape = unescape;
|
|
|
1872
2022
|
|
|
1873
2023
|
// dist/clients/path-utils.js
|
|
1874
2024
|
import { existsSync, readFileSync, realpathSync, statSync } from "node:fs";
|
|
2025
|
+
import { lstat as lstatAsync, realpath as realpathNativeAsync } from "node:fs/promises";
|
|
1875
2026
|
import * as os from "node:os";
|
|
1876
2027
|
import * as path2 from "node:path";
|
|
1877
2028
|
import { win32 } from "node:path";
|
|
@@ -1916,6 +2067,12 @@ function adoptCanonicalCasing(held, canonical) {
|
|
|
1916
2067
|
return changed ? heldParts.join("/") : held;
|
|
1917
2068
|
}
|
|
1918
2069
|
function normalizeFilePath(filePath) {
|
|
2070
|
+
return normalizePathForm(filePath, true);
|
|
2071
|
+
}
|
|
2072
|
+
function normalizePathSpelling(filePath) {
|
|
2073
|
+
return normalizePathForm(filePath, false);
|
|
2074
|
+
}
|
|
2075
|
+
function normalizePathForm(filePath, identity) {
|
|
1919
2076
|
if (process.platform === "win32") {
|
|
1920
2077
|
if (filePath === "")
|
|
1921
2078
|
return "";
|
|
@@ -1925,7 +2082,10 @@ function normalizeFilePath(filePath) {
|
|
|
1925
2082
|
}
|
|
1926
2083
|
const normalized = filePath.replace(/\\/g, "/");
|
|
1927
2084
|
if (process.platform !== "win32" && !isWindowsPath(normalized)) {
|
|
1928
|
-
const
|
|
2085
|
+
const sentinel = normalized === "" || normalized.startsWith("//");
|
|
2086
|
+
if (identity && !sentinel && normalized.startsWith("/"))
|
|
2087
|
+
return posixPathIdentity(normalized);
|
|
2088
|
+
const folded = sentinel ? normalized : path2.posix.normalize(normalized);
|
|
1929
2089
|
try {
|
|
1930
2090
|
const canonical = realpathSync.native(folded);
|
|
1931
2091
|
if (canonical === folded)
|
|
@@ -1950,13 +2110,111 @@ function normalizeFilePath(filePath) {
|
|
|
1950
2110
|
}
|
|
1951
2111
|
}
|
|
1952
2112
|
}
|
|
2113
|
+
var pathIdentityFallbacks = new BoundedFifoMap(16);
|
|
2114
|
+
function recordPathIdentityFallback(code, spelled) {
|
|
2115
|
+
const existing = pathIdentityFallbacks.get(code);
|
|
2116
|
+
if (existing)
|
|
2117
|
+
existing.count += 1;
|
|
2118
|
+
else
|
|
2119
|
+
pathIdentityFallbacks.set(code, { code, count: 1, firstPath: spelled });
|
|
2120
|
+
}
|
|
2121
|
+
function getPathIdentityFallbacks() {
|
|
2122
|
+
return [...pathIdentityFallbacks.values()].map((row) => ({ ...row }));
|
|
2123
|
+
}
|
|
2124
|
+
function resetPathIdentityFallbacks() {
|
|
2125
|
+
pathIdentityFallbacks.clear();
|
|
2126
|
+
}
|
|
2127
|
+
function* identityCandidates(spelled, p) {
|
|
2128
|
+
let current = spelled;
|
|
2129
|
+
const missing = [];
|
|
2130
|
+
for (; ; ) {
|
|
2131
|
+
yield { candidate: current, missing };
|
|
2132
|
+
const parent = p.dirname(current);
|
|
2133
|
+
if (parent === current)
|
|
2134
|
+
return;
|
|
2135
|
+
missing.push(p.basename(current));
|
|
2136
|
+
current = parent;
|
|
2137
|
+
}
|
|
2138
|
+
}
|
|
2139
|
+
function recordIdentityRefusal(refusal, candidate) {
|
|
2140
|
+
if (isAbsenceRefusal(refusal))
|
|
2141
|
+
return;
|
|
2142
|
+
recordPathIdentityFallback(refusal?.code ?? "unknown", candidate);
|
|
2143
|
+
}
|
|
2144
|
+
function isAbsenceRefusal(refusal) {
|
|
2145
|
+
const code = refusal?.code;
|
|
2146
|
+
return code === "ENOENT" || code === "ENOTDIR";
|
|
2147
|
+
}
|
|
2148
|
+
function foldMissingTail(real, missing, p) {
|
|
2149
|
+
return missing.length === 0 ? real : p.join(real, ...missing.reverse());
|
|
2150
|
+
}
|
|
2151
|
+
function tailHasDotSegment(missing) {
|
|
2152
|
+
return missing.some((segment) => segment === "." || segment === "..");
|
|
2153
|
+
}
|
|
2154
|
+
function kernelAttempt(spelled, p) {
|
|
2155
|
+
for (const { candidate, missing } of identityCandidates(spelled, p)) {
|
|
2156
|
+
try {
|
|
2157
|
+
const real = realpathSync.native(candidate);
|
|
2158
|
+
return {
|
|
2159
|
+
answer: foldMissingTail(real, missing, p),
|
|
2160
|
+
foldedTail: tailHasDotSegment(missing)
|
|
2161
|
+
};
|
|
2162
|
+
} catch (refusal) {
|
|
2163
|
+
recordIdentityRefusal(refusal, candidate);
|
|
2164
|
+
}
|
|
2165
|
+
}
|
|
2166
|
+
return void 0;
|
|
2167
|
+
}
|
|
2168
|
+
function kernelRealPath(spelled, p) {
|
|
2169
|
+
const first = kernelAttempt(spelled, p);
|
|
2170
|
+
if (!first)
|
|
2171
|
+
return void 0;
|
|
2172
|
+
if (!first.foldedTail)
|
|
2173
|
+
return first.answer;
|
|
2174
|
+
return kernelAttempt(first.answer, p)?.answer ?? first.answer;
|
|
2175
|
+
}
|
|
2176
|
+
function posixPathIdentity(spelled) {
|
|
2177
|
+
return kernelRealPath(spelled, path2.posix) ?? path2.posix.normalize(spelled);
|
|
2178
|
+
}
|
|
1953
2179
|
function realpathOrResolve(filePath) {
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
2180
|
+
return kernelRealPath(filePath, path2) ?? path2.resolve(filePath);
|
|
2181
|
+
}
|
|
2182
|
+
async function realpathOrResolveAsync(filePath) {
|
|
2183
|
+
return (await kernelPathIdentityAsync(filePath))?.identity ?? path2.resolve(filePath);
|
|
2184
|
+
}
|
|
2185
|
+
async function kernelAttemptAsync(spelled) {
|
|
2186
|
+
let kernelConfirmed = true;
|
|
2187
|
+
for (const { candidate, missing } of identityCandidates(spelled, path2)) {
|
|
2188
|
+
try {
|
|
2189
|
+
const real = await realpathNativeAsync(candidate);
|
|
2190
|
+
return {
|
|
2191
|
+
answer: foldMissingTail(real, missing, path2),
|
|
2192
|
+
foldedTail: tailHasDotSegment(missing),
|
|
2193
|
+
kernelConfirmed
|
|
2194
|
+
};
|
|
2195
|
+
} catch (refusal) {
|
|
2196
|
+
recordIdentityRefusal(refusal, candidate);
|
|
2197
|
+
if (!isAbsenceRefusal(refusal))
|
|
2198
|
+
kernelConfirmed = false;
|
|
2199
|
+
else if (!await lstatAsync(candidate).then(() => false, (lstatRefusal) => {
|
|
2200
|
+
return isAbsenceRefusal(lstatRefusal);
|
|
2201
|
+
})) {
|
|
2202
|
+
recordPathIdentityFallback("ENOENT-DANGLING", candidate);
|
|
2203
|
+
kernelConfirmed = false;
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
1959
2206
|
}
|
|
2207
|
+
return void 0;
|
|
2208
|
+
}
|
|
2209
|
+
async function kernelPathIdentityAsync(filePath) {
|
|
2210
|
+
const first = await kernelAttemptAsync(filePath);
|
|
2211
|
+
if (!first)
|
|
2212
|
+
return void 0;
|
|
2213
|
+
const settled = first.foldedTail ? await kernelAttemptAsync(first.answer) : void 0;
|
|
2214
|
+
return {
|
|
2215
|
+
identity: settled?.answer ?? first.answer,
|
|
2216
|
+
kernelConfirmed: first.kernelConfirmed && (settled?.kernelConfirmed ?? true)
|
|
2217
|
+
};
|
|
1960
2218
|
}
|
|
1961
2219
|
function normalizeLoggedPath(value) {
|
|
1962
2220
|
return isFullyQualifiedWin32(value) || isFullyQualifiedPosix(value) ? normalizeFilePath(value) : value;
|
|
@@ -2026,9 +2284,13 @@ function normalizeEphemeralMapKey(filePath) {
|
|
|
2026
2284
|
function pathsEqual(a, b) {
|
|
2027
2285
|
return normalizeFilePath(a) === normalizeFilePath(b);
|
|
2028
2286
|
}
|
|
2029
|
-
function* walkUpDirs(startDir) {
|
|
2030
|
-
|
|
2031
|
-
|
|
2287
|
+
function* walkUpDirs(startDir, options = {}) {
|
|
2288
|
+
const axis = options.spelling ? path2.resolve : realpathOrResolve;
|
|
2289
|
+
let current = axis(startDir);
|
|
2290
|
+
const home = options.homeDir === void 0 ? void 0 : axis(options.homeDir);
|
|
2291
|
+
for (let yielded = 0; yielded < (options.maxDepth ?? Infinity); yielded++) {
|
|
2292
|
+
if (home !== void 0 && isAtOrAboveHomeDir(current, home))
|
|
2293
|
+
return;
|
|
2032
2294
|
yield current;
|
|
2033
2295
|
const parent = path2.dirname(current);
|
|
2034
2296
|
if (parent === current)
|
|
@@ -2046,11 +2308,7 @@ function findNearestContaining(startDir, candidates) {
|
|
|
2046
2308
|
return void 0;
|
|
2047
2309
|
}
|
|
2048
2310
|
function findLocalToolConfig(startDir, names, options = {}) {
|
|
2049
|
-
const
|
|
2050
|
-
for (const dir of walkUpDirs(startDir || process.cwd())) {
|
|
2051
|
-
if (homeDir !== void 0 && isAtOrAboveHomeDir(dir, homeDir)) {
|
|
2052
|
-
return void 0;
|
|
2053
|
-
}
|
|
2311
|
+
for (const dir of walkUpDirs(startDir || process.cwd(), options)) {
|
|
2054
2312
|
for (const name of names) {
|
|
2055
2313
|
const candidate = path2.join(dir, name);
|
|
2056
2314
|
if (existsSync(candidate))
|
|
@@ -2084,9 +2342,9 @@ function isRealGitMarker(markerPath, details) {
|
|
|
2084
2342
|
}
|
|
2085
2343
|
function findNearestMarkerRoot(startDir, markers, options = {}) {
|
|
2086
2344
|
const boundaries = options.boundaries ?? [];
|
|
2087
|
-
const homeDir =
|
|
2345
|
+
const homeDir = realpathOrResolve(options.homeDir ?? os.homedir());
|
|
2088
2346
|
const markerPredicate = options.markerPredicate ?? (() => true);
|
|
2089
|
-
let current =
|
|
2347
|
+
let current = realpathOrResolve(startDir);
|
|
2090
2348
|
for (let depth = 0; depth < 64; depth++) {
|
|
2091
2349
|
if (isAtOrAboveHomeDir(current, homeDir))
|
|
2092
2350
|
return null;
|
|
@@ -2102,8 +2360,8 @@ function findNearestMarkerRoot(startDir, markers, options = {}) {
|
|
|
2102
2360
|
return null;
|
|
2103
2361
|
}
|
|
2104
2362
|
function findNearestMarkerRootDetailed(startDir, markers, options) {
|
|
2105
|
-
const homeDir =
|
|
2106
|
-
let current =
|
|
2363
|
+
const homeDir = realpathOrResolve(options.homeDir ?? os.homedir());
|
|
2364
|
+
let current = realpathOrResolve(startDir);
|
|
2107
2365
|
for (let depth = 0; depth < 64; depth++) {
|
|
2108
2366
|
if (isAtOrAboveHomeDir(current, homeDir))
|
|
2109
2367
|
return { kind: "not-found", reason: "home-ceiling" };
|
|
@@ -2143,10 +2401,15 @@ function homeRelativePath(filePath, homeDir = os.homedir()) {
|
|
|
2143
2401
|
return `~${candidate.slice(home.length)}`;
|
|
2144
2402
|
}
|
|
2145
2403
|
function isUnderDir(child, parent) {
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2404
|
+
if (isWithinForm(normalizePathSpelling(child), normalizePathSpelling(parent)))
|
|
2405
|
+
return true;
|
|
2406
|
+
if (process.platform === "win32")
|
|
2407
|
+
return false;
|
|
2408
|
+
return isWithinForm(normalizeFilePath(child), normalizeFilePath(parent));
|
|
2409
|
+
}
|
|
2410
|
+
function isWithinForm(child, parent) {
|
|
2411
|
+
const parentPrefix = parent.endsWith("/") ? parent : `${parent}/`;
|
|
2412
|
+
return child === parent || child.startsWith(parentPrefix);
|
|
2150
2413
|
}
|
|
2151
2414
|
function isOutsideProjectRoot(filePath, projectRoot) {
|
|
2152
2415
|
return !isUnderDir(filePath, projectRoot);
|
|
@@ -2162,7 +2425,7 @@ var VENDOR_DIR_NAMES = /* @__PURE__ */ new Set([
|
|
|
2162
2425
|
"bower_components"
|
|
2163
2426
|
]);
|
|
2164
2427
|
function isVendorPath(filePath) {
|
|
2165
|
-
return
|
|
2428
|
+
return normalizePathSpelling(filePath).split("/").some((segment) => VENDOR_DIR_NAMES.has(segment.toLowerCase()));
|
|
2166
2429
|
}
|
|
2167
2430
|
function isExternalOrVendorFile(filePath, projectRoot) {
|
|
2168
2431
|
if (isOutsideProjectRoot(filePath, projectRoot))
|
|
@@ -2367,6 +2630,9 @@ function resolveHostToolPath(input, baseDir) {
|
|
|
2367
2630
|
}
|
|
2368
2631
|
|
|
2369
2632
|
export {
|
|
2633
|
+
BoundedFifoMap,
|
|
2634
|
+
BoundedSet,
|
|
2635
|
+
BoundedLruCache,
|
|
2370
2636
|
minimatch,
|
|
2371
2637
|
Minimatch,
|
|
2372
2638
|
isWindowsPath,
|
|
@@ -2375,7 +2641,12 @@ export {
|
|
|
2375
2641
|
isFullyQualified,
|
|
2376
2642
|
isAbsoluteFilePath,
|
|
2377
2643
|
normalizeFilePath,
|
|
2644
|
+
normalizePathSpelling,
|
|
2645
|
+
getPathIdentityFallbacks,
|
|
2646
|
+
resetPathIdentityFallbacks,
|
|
2378
2647
|
realpathOrResolve,
|
|
2648
|
+
realpathOrResolveAsync,
|
|
2649
|
+
kernelPathIdentityAsync,
|
|
2379
2650
|
normalizeLoggedPath,
|
|
2380
2651
|
uriToPath,
|
|
2381
2652
|
uriToDiskPath,
|
|
@@ -2392,6 +2663,7 @@ export {
|
|
|
2392
2663
|
isAtOrAboveHomeDir,
|
|
2393
2664
|
homeRelativePath,
|
|
2394
2665
|
isUnderDir,
|
|
2666
|
+
isWithinForm,
|
|
2395
2667
|
isVendorPath,
|
|
2396
2668
|
isExternalOrVendorFile,
|
|
2397
2669
|
nameMatchesMarkerGlob,
|