@aiready/core 0.23.19 → 0.23.21
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-2N7ISIKE.mjs +158 -0
- package/dist/chunk-ARUIZO7M.mjs +297 -0
- package/dist/chunk-CYC5EGEI.mjs +297 -0
- package/dist/{chunk-ZB3EHHAG.mjs → chunk-DBOPSRBC.mjs} +88 -26
- package/dist/chunk-EZ7ECLAZ.mjs +299 -0
- package/dist/chunk-FNPULWG7.mjs +248 -0
- package/dist/chunk-FZTFKZUQ.mjs +250 -0
- package/dist/chunk-GTS642BQ.mjs +262 -0
- package/dist/chunk-IXPY5J4K.mjs +248 -0
- package/dist/chunk-JJQLYW6Z.mjs +111 -0
- package/dist/chunk-L6BKANJC.mjs +130 -0
- package/dist/chunk-LXEO5PG3.mjs +292 -0
- package/dist/chunk-LZHO636W.mjs +501 -0
- package/dist/chunk-MTK2IIDZ.mjs +262 -0
- package/dist/chunk-QDCQETSI.mjs +262 -0
- package/dist/chunk-QZNY7B2N.mjs +248 -0
- package/dist/chunk-RCZSMGCX.mjs +250 -0
- package/dist/chunk-SWZOT67M.mjs +250 -0
- package/dist/chunk-U3IY2CFC.mjs +36 -0
- package/dist/chunk-UBCM5Y6R.mjs +275 -0
- package/dist/chunk-UTCRW3N7.mjs +301 -0
- package/dist/{chunk-RMH2TPAT.mjs → chunk-UYLH35LA.mjs} +88 -26
- package/dist/{chunk-TJXR2CHZ.mjs → chunk-WVNVC2PP.mjs} +266 -213
- package/dist/chunk-WYOW6O3P.mjs +114 -0
- package/dist/{chunk-CGOS2J6T.mjs → chunk-YRSSR4KN.mjs} +260 -217
- package/dist/client-2xbeKnrg.d.mts +1291 -0
- package/dist/client-2xbeKnrg.d.ts +1291 -0
- package/dist/client-4HLAGzFg.d.mts +1291 -0
- package/dist/client-4HLAGzFg.d.ts +1291 -0
- package/dist/client-B4TQwNa7.d.mts +1290 -0
- package/dist/client-B4TQwNa7.d.ts +1290 -0
- package/dist/client-Bdi4ty0v.d.mts +1294 -0
- package/dist/client-Bdi4ty0v.d.ts +1294 -0
- package/dist/client-BsKpUH3H.d.mts +1339 -0
- package/dist/client-BsKpUH3H.d.ts +1339 -0
- package/dist/client-Bv1zOaWF.d.mts +1291 -0
- package/dist/client-Bv1zOaWF.d.ts +1291 -0
- package/dist/client-Bz9YJMIX.d.mts +1290 -0
- package/dist/client-Bz9YJMIX.d.ts +1290 -0
- package/dist/client-CBpzm34X.d.mts +1291 -0
- package/dist/client-CBpzm34X.d.ts +1291 -0
- package/dist/client-CNu_tCZZ.d.mts +1305 -0
- package/dist/client-CNu_tCZZ.d.ts +1305 -0
- package/dist/client-CmEvxxQu.d.mts +1339 -0
- package/dist/client-CmEvxxQu.d.ts +1339 -0
- package/dist/client-DGMAxkZc.d.mts +1339 -0
- package/dist/client-DGMAxkZc.d.ts +1339 -0
- package/dist/client-DZq-CqcD.d.mts +1292 -0
- package/dist/client-DZq-CqcD.d.ts +1292 -0
- package/dist/{client-WVCAIWdJ.d.mts → client-DcqGfDTt.d.mts} +318 -226
- package/dist/{client-WVCAIWdJ.d.ts → client-DcqGfDTt.d.ts} +318 -226
- package/dist/{client-DLvFR2qA.d.mts → client-O8RvSRm0.d.mts} +89 -25
- package/dist/{client-DLvFR2qA.d.ts → client-O8RvSRm0.d.ts} +89 -25
- package/dist/client.d.mts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +53 -27
- package/dist/client.mjs +6 -6
- package/dist/csharp-parser-4ZKCSX5B.mjs +9 -0
- package/dist/csharp-parser-5HKICCRR.mjs +9 -0
- package/dist/csharp-parser-JCKXIAJW.mjs +9 -0
- package/dist/go-parser-J4KIH4RG.mjs +9 -0
- package/dist/go-parser-TKXL3DVH.mjs +9 -0
- package/dist/go-parser-XOM232XZ.mjs +9 -0
- package/dist/index.d.mts +332 -54
- package/dist/index.d.ts +332 -54
- package/dist/index.js +3930 -3064
- package/dist/index.mjs +933 -2036
- package/dist/java-parser-3KHXOXRQ.mjs +9 -0
- package/dist/java-parser-MASGS4WB.mjs +9 -0
- package/dist/java-parser-T5LXD63J.mjs +9 -0
- package/dist/python-parser-FNFK2473.mjs +8 -0
- package/dist/typescript-parser-2GGNRNB5.mjs +7 -0
- package/dist/typescript-parser-3ENJ6C7H.mjs +7 -0
- package/dist/typescript-parser-4GI7DPSW.mjs +7 -0
- package/dist/typescript-parser-4H3HUBO4.mjs +7 -0
- package/dist/typescript-parser-K63IVZMF.mjs +7 -0
- package/dist/typescript-parser-ZJKROMQG.mjs +7 -0
- package/package.json +1 -1
- package/dist/chunk-5SHLHMH7.mjs +0 -760
- package/dist/chunk-Q55AMEFV.mjs +0 -760
- package/dist/client-BEoUYNLp.d.mts +0 -1191
- package/dist/client-BEoUYNLp.d.ts +0 -1191
- package/dist/client-BrIMPk89.d.mts +0 -1214
- package/dist/client-BrIMPk89.d.ts +0 -1214
- package/dist/client-C5BuGX4F.d.mts +0 -1205
- package/dist/client-C5BuGX4F.d.ts +0 -1205
- package/dist/client-CKcjnPXt.d.mts +0 -1214
- package/dist/client-CKcjnPXt.d.ts +0 -1214
- package/dist/client-CLulBnie.d.mts +0 -1182
- package/dist/client-CLulBnie.d.ts +0 -1182
- package/dist/client-CQwvp8ep.d.mts +0 -1182
- package/dist/client-CQwvp8ep.d.ts +0 -1182
- package/dist/client-PFPdeo-z.d.mts +0 -1186
- package/dist/client-PFPdeo-z.d.ts +0 -1186
- package/dist/client-wk2fgk1q.d.mts +0 -1184
- package/dist/client-wk2fgk1q.d.ts +0 -1184
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// src/parsers/shared-parser-utils.ts
|
|
2
|
+
var SIDE_EFFECT_KEYWORDS = [
|
|
3
|
+
"print(",
|
|
4
|
+
"console.",
|
|
5
|
+
"System.out",
|
|
6
|
+
"System.err",
|
|
7
|
+
"fmt.",
|
|
8
|
+
"File.Write",
|
|
9
|
+
"Files.write",
|
|
10
|
+
"os.Exit",
|
|
11
|
+
"panic(",
|
|
12
|
+
"throw ",
|
|
13
|
+
"Logging.",
|
|
14
|
+
"log."
|
|
15
|
+
];
|
|
16
|
+
function analyzeGeneralMetadata(node, code, options = {}) {
|
|
17
|
+
const metadata = {
|
|
18
|
+
isPure: true,
|
|
19
|
+
hasSideEffects: false
|
|
20
|
+
};
|
|
21
|
+
try {
|
|
22
|
+
let prev = node.previousNamedSibling || node.previousSibling || null;
|
|
23
|
+
while (prev && /attribute|decorator/i.test(prev.type)) {
|
|
24
|
+
prev = prev.previousNamedSibling || prev.previousSibling || null;
|
|
25
|
+
}
|
|
26
|
+
while (prev && /comment|xml|doc/i.test(prev.type)) {
|
|
27
|
+
const text = prev.text || "";
|
|
28
|
+
if (text.trim().startsWith("/**")) {
|
|
29
|
+
metadata.documentation = {
|
|
30
|
+
content: text.replace(/^[/*]+|[/*]+$/g, "").trim(),
|
|
31
|
+
type: "jsdoc"
|
|
32
|
+
};
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
if (text.trim().startsWith("///")) {
|
|
36
|
+
metadata.documentation = {
|
|
37
|
+
content: text.replace(/^\/\/\//, "").trim(),
|
|
38
|
+
type: "xml-doc"
|
|
39
|
+
};
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
if (text.trim().startsWith("//")) {
|
|
43
|
+
metadata.documentation = {
|
|
44
|
+
content: text.replace(/^\/\//, "").trim(),
|
|
45
|
+
type: "comment"
|
|
46
|
+
};
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
prev = prev.previousSibling || null;
|
|
50
|
+
}
|
|
51
|
+
} catch {
|
|
52
|
+
}
|
|
53
|
+
const signatures = [
|
|
54
|
+
...SIDE_EFFECT_KEYWORDS,
|
|
55
|
+
...options.sideEffectSignatures || []
|
|
56
|
+
];
|
|
57
|
+
const walk = (n) => {
|
|
58
|
+
if (/assign|assignment|assignment_statement|assignment_expression/i.test(
|
|
59
|
+
n.type
|
|
60
|
+
)) {
|
|
61
|
+
metadata.isPure = false;
|
|
62
|
+
metadata.hasSideEffects = true;
|
|
63
|
+
}
|
|
64
|
+
const text = n.text;
|
|
65
|
+
for (const sig of signatures) {
|
|
66
|
+
if (text.includes(sig)) {
|
|
67
|
+
metadata.isPure = false;
|
|
68
|
+
metadata.hasSideEffects = true;
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (!metadata.hasSideEffects) {
|
|
73
|
+
for (let i = 0; i < n.childCount; i++) {
|
|
74
|
+
const child = n.child(i);
|
|
75
|
+
if (child) walk(child);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
walk(node);
|
|
80
|
+
return metadata;
|
|
81
|
+
}
|
|
82
|
+
function extractParameterNames(node) {
|
|
83
|
+
const params = [];
|
|
84
|
+
const candidates = [
|
|
85
|
+
// common field name
|
|
86
|
+
node.childForFieldName ? node.childForFieldName("parameters") : null,
|
|
87
|
+
node.childForFieldName ? node.childForFieldName("parameter_list") : null,
|
|
88
|
+
node.children.find((c) => c.type === "parameter_list") || null,
|
|
89
|
+
node.children.find((c) => c.type === "parameters") || null,
|
|
90
|
+
node.children.find((c) => c.type === "formal_parameters") || null,
|
|
91
|
+
node.children.find((c) => c.type === "formal_parameter") || null
|
|
92
|
+
];
|
|
93
|
+
const list = candidates.find(Boolean);
|
|
94
|
+
if (!list) return params;
|
|
95
|
+
for (const child of list.children) {
|
|
96
|
+
if (!child) continue;
|
|
97
|
+
const id = child.childForFieldName?.("name") || child.children.find(
|
|
98
|
+
(c) => [
|
|
99
|
+
"identifier",
|
|
100
|
+
"variable_name",
|
|
101
|
+
"name",
|
|
102
|
+
"parameter",
|
|
103
|
+
"formal_parameter"
|
|
104
|
+
].includes(c.type)
|
|
105
|
+
) || (child.type === "identifier" ? child : void 0);
|
|
106
|
+
if (id && typeof id.text === "string") params.push(id.text);
|
|
107
|
+
}
|
|
108
|
+
return params;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export {
|
|
112
|
+
analyzeGeneralMetadata,
|
|
113
|
+
extractParameterNames
|
|
114
|
+
};
|