token-goat 2.9.30 → 2.9.31
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/README.md +24 -7
- package/SECURITY.md +10 -2
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/native/linux-arm64/tg-hook +0 -0
- package/dist/native/linux-x64/tg-hook +0 -0
- package/dist/native/win32-arm64/tg-hook.exe +0 -0
- package/dist/native/win32-x64/tg-hook.exe +0 -0
- package/dist/{token-goat-chunk-QSBRTGM2.mjs → token-goat-chunk-25TRAWET.mjs} +17 -7
- package/dist/token-goat-chunk-2KXO6V2B.mjs +203 -0
- package/dist/{token-goat-chunk-IVKIZWAB.mjs → token-goat-chunk-2M7E4PF7.mjs} +41 -12
- package/dist/{token-goat-chunk-SMVRN2HU.mjs → token-goat-chunk-2UPZGKKY.mjs} +2 -2
- package/dist/token-goat-chunk-2WLPWKHV.mjs +135 -0
- package/dist/token-goat-chunk-2XBMMDBD.mjs +126 -0
- package/dist/token-goat-chunk-32ZOY4N5.mjs +23 -0
- package/dist/token-goat-chunk-3EZRNKTK.mjs +188 -0
- package/dist/token-goat-chunk-4ADZHI7J.mjs +63 -0
- package/dist/token-goat-chunk-4GBVPH3D.mjs +242 -0
- package/dist/{token-goat-chunk-KWPNJBDH.mjs → token-goat-chunk-4GILLLWY.mjs} +7 -4
- package/dist/{token-goat-chunk-67TQJ76B.mjs → token-goat-chunk-4NAPX7BA.mjs} +36 -3
- package/dist/{token-goat-chunk-PU7V3FD6.mjs → token-goat-chunk-4SC7UJYV.mjs} +3354 -2553
- package/dist/token-goat-chunk-4SMRO4TO.mjs +366 -0
- package/dist/{token-goat-chunk-AFLYLHDH.mjs → token-goat-chunk-4ZBFWLXF.mjs} +283 -427
- package/dist/{token-goat-chunk-JDWCRD6M.mjs → token-goat-chunk-57BIAXJL.mjs} +73 -40
- package/dist/token-goat-chunk-5AC66HNP.mjs +115 -0
- package/dist/token-goat-chunk-5IMLKSOP.mjs +145 -0
- package/dist/token-goat-chunk-646E6U44.mjs +398 -0
- package/dist/token-goat-chunk-65N4RHP4.mjs +33 -0
- package/dist/{token-goat-chunk-JN4XMLSD.mjs → token-goat-chunk-6DG6HWP3.mjs} +8 -2
- package/dist/token-goat-chunk-6ENQSNRZ.mjs +573 -0
- package/dist/token-goat-chunk-6ZY4GNF2.mjs +91 -0
- package/dist/{token-goat-chunk-VPBBTSJR.mjs → token-goat-chunk-76FGDLRO.mjs} +262 -255
- package/dist/{token-goat-chunk-7IN2MKDS.mjs → token-goat-chunk-7EZTZOMC.mjs} +121 -289
- package/dist/{token-goat-chunk-OJBNYTJP.mjs → token-goat-chunk-7MAOA6X4.mjs} +640 -80
- package/dist/token-goat-chunk-7R2ZVVAX.mjs +218 -0
- package/dist/{token-goat-chunk-PD5VKH46.mjs → token-goat-chunk-AUNGYYQX.mjs} +2 -2
- package/dist/{token-goat-chunk-HG45AF2B.mjs → token-goat-chunk-AUQYRMMH.mjs} +794 -37
- package/dist/token-goat-chunk-B3PEKBYG.mjs +128 -0
- package/dist/{token-goat-chunk-A3CK6N5Z.mjs → token-goat-chunk-BA4HI6BW.mjs} +1309 -110
- package/dist/{token-goat-chunk-JB6QN6VF.mjs → token-goat-chunk-BFCWY73P.mjs} +59 -23
- package/dist/{token-goat-chunk-B45VMIIH.mjs → token-goat-chunk-BWGFUZZE.mjs} +7 -5
- package/dist/{token-goat-chunk-P4QMM4WK.mjs → token-goat-chunk-C75NA7PL.mjs} +50 -23
- package/dist/token-goat-chunk-CBIQ7WTD.mjs +87 -0
- package/dist/token-goat-chunk-CETM74KC.mjs +307 -0
- package/dist/{token-goat-chunk-H2PHHGM5.mjs → token-goat-chunk-CIMQ2BB3.mjs} +57 -12
- package/dist/{token-goat-chunk-N2NMER56.mjs → token-goat-chunk-CJLS3CDL.mjs} +46 -4
- package/dist/{token-goat-chunk-VES7EL7O.mjs → token-goat-chunk-CO3UYX6G.mjs} +1 -1
- package/dist/token-goat-chunk-COPNXRJM.mjs +154 -0
- package/dist/token-goat-chunk-CSJ5L3NL.mjs +479 -0
- package/dist/{token-goat-chunk-4LCCNRTG.mjs → token-goat-chunk-CVCEVUGK.mjs} +8 -6
- package/dist/{token-goat-chunk-B2RZZCSS.mjs → token-goat-chunk-CXHOFN7R.mjs} +37 -20
- package/dist/token-goat-chunk-D735C4QM.mjs +603 -0
- package/dist/{token-goat-chunk-APGZXSPS.mjs → token-goat-chunk-DGS2LVNA.mjs} +47 -30
- package/dist/{token-goat-chunk-54K3EUV3.mjs → token-goat-chunk-DOWRSMWO.mjs} +1 -1
- package/dist/token-goat-chunk-E45INMY3.mjs +71 -0
- package/dist/token-goat-chunk-EC5F37F4.mjs +244 -0
- package/dist/{token-goat-chunk-XTQAOTSO.mjs → token-goat-chunk-EDBDRVH5.mjs} +4 -1
- package/dist/{token-goat-chunk-5BCIJXMO.mjs → token-goat-chunk-EELTBKDM.mjs} +14 -10
- package/dist/{token-goat-chunk-W3QCJS6G.mjs → token-goat-chunk-F4HYL64R.mjs} +8 -6
- package/dist/token-goat-chunk-F6PAUIEK.mjs +624 -0
- package/dist/token-goat-chunk-FDSREWLX.mjs +692 -0
- package/dist/token-goat-chunk-GGGG7RWB.mjs +236 -0
- package/dist/{token-goat-chunk-C63JQV5K.mjs → token-goat-chunk-GL3ETKSC.mjs} +233 -15
- package/dist/token-goat-chunk-GVB2MUST.mjs +1298 -0
- package/dist/token-goat-chunk-GWFLAUMQ.mjs +307 -0
- package/dist/{token-goat-chunk-ZEJVMUQH.mjs → token-goat-chunk-HLPW63A7.mjs} +2 -2
- package/dist/{token-goat-chunk-GOLEOXZP.mjs → token-goat-chunk-HU4TORC5.mjs} +44 -26
- package/dist/{token-goat-chunk-Z57YODA2.mjs → token-goat-chunk-I7VKZZAW.mjs} +2 -2
- package/dist/{token-goat-chunk-NYKZLXMK.mjs → token-goat-chunk-IA6XSPE3.mjs} +6 -6
- package/dist/{token-goat-chunk-E3OQX2XT.mjs → token-goat-chunk-IAGXMHIK.mjs} +81 -42
- package/dist/{token-goat-chunk-HYBFA5X3.mjs → token-goat-chunk-IK2DRMFX.mjs} +24 -68
- package/dist/{token-goat-chunk-COBQGL5S.mjs → token-goat-chunk-INNPTRUX.mjs} +249 -299
- package/dist/{token-goat-chunk-7NADEDKJ.mjs → token-goat-chunk-JJ5BX4F4.mjs} +6 -1
- package/dist/{token-goat-chunk-PEPTHRFF.mjs → token-goat-chunk-JVFSHVFJ.mjs} +6 -6
- package/dist/token-goat-chunk-KGEFFSHD.mjs +50 -0
- package/dist/token-goat-chunk-KQBLRPBN.mjs +433 -0
- package/dist/{token-goat-chunk-Q5VTGRH7.mjs → token-goat-chunk-LCNQ2CNN.mjs} +55 -319
- package/dist/token-goat-chunk-M3LFJDPU.mjs +58 -0
- package/dist/token-goat-chunk-M52KPT3C.mjs +87 -0
- package/dist/token-goat-chunk-MBEG42H7.mjs +150 -0
- package/dist/{token-goat-chunk-EVC4TOLE.mjs → token-goat-chunk-METECDOH.mjs} +3 -12
- package/dist/{token-goat-chunk-T4FK7VOV.mjs → token-goat-chunk-MHX7XCC3.mjs} +2 -1
- package/dist/token-goat-chunk-N5LSOVSU.mjs +137 -0
- package/dist/{token-goat-chunk-LOBGHXPB.mjs → token-goat-chunk-N5MMR2IW.mjs} +1 -1
- package/dist/token-goat-chunk-N7B3JQ2C.mjs +160 -0
- package/dist/{token-goat-chunk-RHXKCZX3.mjs → token-goat-chunk-NISNMD7T.mjs} +2182 -2959
- package/dist/token-goat-chunk-NMD42SFQ.mjs +434 -0
- package/dist/token-goat-chunk-NOSS5VWY.mjs +174 -0
- package/dist/{token-goat-chunk-KQNZDCBD.mjs → token-goat-chunk-NSNSPPBG.mjs} +25 -3
- package/dist/token-goat-chunk-OBOFIHKN.mjs +38 -0
- package/dist/token-goat-chunk-OBRFJ5O5.mjs +76 -0
- package/dist/{token-goat-chunk-JTQQGXZH.mjs → token-goat-chunk-ODBT2USM.mjs} +124 -57
- package/dist/token-goat-chunk-OS5EM5PP.mjs +107 -0
- package/dist/token-goat-chunk-OUKDTVNU.mjs +1178 -0
- package/dist/token-goat-chunk-OXFMP75N.mjs +566 -0
- package/dist/{token-goat-chunk-DZX2YDPT.mjs → token-goat-chunk-OYIYKDDT.mjs} +2 -2
- package/dist/{token-goat-chunk-QCLDAQTS.mjs → token-goat-chunk-P6HQSWQ3.mjs} +50 -53
- package/dist/token-goat-chunk-P6VGNTQT.mjs +71 -0
- package/dist/{token-goat-chunk-7BXSNBY5.mjs → token-goat-chunk-PFWIMH2E.mjs} +23 -15
- package/dist/token-goat-chunk-PJZXIS3G.mjs +39 -0
- package/dist/token-goat-chunk-PUO5INXP.mjs +606 -0
- package/dist/{token-goat-chunk-GFBSN7BD.mjs → token-goat-chunk-PX5PQWTY.mjs} +22 -250
- package/dist/token-goat-chunk-Q5QDBC6O.mjs +111 -0
- package/dist/token-goat-chunk-QFNQXSDT.mjs +40 -0
- package/dist/{token-goat-chunk-FBNQNSJK.mjs → token-goat-chunk-QH7YVYOY.mjs} +2198 -2782
- package/dist/{token-goat-chunk-64FBPDTK.mjs → token-goat-chunk-QLMUHEPB.mjs} +12 -9
- package/dist/{token-goat-chunk-RZRTDST7.mjs → token-goat-chunk-QQOJIHL3.mjs} +37 -11
- package/dist/{token-goat-chunk-XKI4SEMX.mjs → token-goat-chunk-QQTWJY2O.mjs} +19 -0
- package/dist/{token-goat-chunk-U4N3BN2W.mjs → token-goat-chunk-QYHO5CPH.mjs} +3 -2
- package/dist/token-goat-chunk-RELAVWAD.mjs +27 -0
- package/dist/{token-goat-chunk-ETBHVDB6.mjs → token-goat-chunk-RSLPOBKQ.mjs} +22 -11
- package/dist/token-goat-chunk-SAMFDIS2.mjs +712 -0
- package/dist/token-goat-chunk-SDELXLDM.mjs +48 -0
- package/dist/{token-goat-chunk-4JJS54TR.mjs → token-goat-chunk-SOAFZNNZ.mjs} +161 -38
- package/dist/{token-goat-chunk-664RTTUV.mjs → token-goat-chunk-SRTHT7KV.mjs} +21 -16
- package/dist/{token-goat-chunk-4FVIAHSI.mjs → token-goat-chunk-T5P5ACNQ.mjs} +7 -6
- package/dist/token-goat-chunk-T5YGG4V3.mjs +45 -0
- package/dist/token-goat-chunk-TAUZ4OFS.mjs +110 -0
- package/dist/{token-goat-chunk-COTXZHTS.mjs → token-goat-chunk-TM6MC754.mjs} +4 -3
- package/dist/token-goat-chunk-TWUKBOMP.mjs +72 -0
- package/dist/{token-goat-chunk-3CHUNJ2O.mjs → token-goat-chunk-U2KSB4SG.mjs} +8 -5
- package/dist/{token-goat-chunk-3Z5S4KGM.mjs → token-goat-chunk-U4WHMG6Y.mjs} +29 -49
- package/dist/{token-goat-chunk-PY533T7F.mjs → token-goat-chunk-UGJHGR5A.mjs} +21 -15
- package/dist/{token-goat-chunk-CYCEYAEO.mjs → token-goat-chunk-UOUDVA5U.mjs} +1 -1
- package/dist/{token-goat-chunk-JDHE26RP.mjs → token-goat-chunk-URRJ33GR.mjs} +16 -5
- package/dist/{token-goat-chunk-56EIMS3E.mjs → token-goat-chunk-UZOROKIS.mjs} +23 -17
- package/dist/{token-goat-chunk-CZ3LUXYZ.mjs → token-goat-chunk-VIHGGGEI.mjs} +427 -308
- package/dist/token-goat-chunk-VTJLAA7P.mjs +21 -0
- package/dist/token-goat-chunk-VWDXLT4F.mjs +678 -0
- package/dist/{token-goat-chunk-YARZFCZS.mjs → token-goat-chunk-VWZA2H4P.mjs} +62 -53
- package/dist/{token-goat-chunk-SQSSNQPE.mjs → token-goat-chunk-VXEXMJDL.mjs} +3979 -4745
- package/dist/token-goat-chunk-WBA5SKT4.mjs +547 -0
- package/dist/{token-goat-chunk-SJHWVNDQ.mjs → token-goat-chunk-WDH44VAU.mjs} +7 -4
- package/dist/token-goat-chunk-X2SUP3EI.mjs +107 -0
- package/dist/token-goat-chunk-X3BELZSJ.mjs +125 -0
- package/dist/{token-goat-chunk-FZ3NEW5O.mjs → token-goat-chunk-XLRBNZCC.mjs} +13 -8
- package/dist/{token-goat-chunk-Z44YO3QZ.mjs → token-goat-chunk-XRKUX6CM.mjs} +1 -1
- package/dist/token-goat-chunk-XX6O25RN.mjs +82 -0
- package/dist/token-goat-chunk-XZSUHBVS.mjs +65 -0
- package/dist/{token-goat-chunk-WY3L4DVT.mjs → token-goat-chunk-Y2ZTQOCL.mjs} +13 -8
- package/dist/{token-goat-chunk-UQ5UK2T7.mjs → token-goat-chunk-YB4VMGK2.mjs} +1 -1
- package/dist/token-goat-chunk-YBIIY3HR.mjs +51 -0
- package/dist/{token-goat-chunk-ZQSJMO2R.mjs → token-goat-chunk-YHVDKQBR.mjs} +105 -105
- package/dist/{token-goat-chunk-H2K3QP6H.mjs → token-goat-chunk-YJB5XLWI.mjs} +8 -6
- package/dist/{token-goat-chunk-ZCDTCVIS.mjs → token-goat-chunk-YKB6AQG3.mjs} +5 -2
- package/dist/token-goat-chunk-YMTG2YA5.mjs +35 -0
- package/dist/token-goat-chunk-YPBZYQRV.mjs +40 -0
- package/dist/{token-goat-chunk-HOJLCGDP.mjs → token-goat-chunk-YY6AVUFL.mjs} +2033 -2251
- package/dist/token-goat-chunk-Z7N5OMMP.mjs +98 -0
- package/dist/token-goat-chunk-ZNMNUPAZ.mjs +938 -0
- package/dist/token-goat-hook-client.cjs +1 -1
- package/dist/token-goat-hook-client.mjs +3 -3
- package/dist/token-goat-hook.mjs +67 -38
- package/dist/token-goat.core.mjs +4 -4
- package/docs/C4_RUNTIME_ARCHITECTURE.md +1 -1
- package/docs/cli.md +40 -21
- package/docs/install.md +19 -9
- package/docs/security.md +5 -3
- package/package.json +2 -1
- package/dist/token-goat-chunk-5KDMCMF2.mjs +0 -362
- package/dist/token-goat-chunk-6QMAS7AB.mjs +0 -42
- package/dist/token-goat-chunk-7F2UBPD3.mjs +0 -397
- package/dist/token-goat-chunk-ARDNEC2U.mjs +0 -248
- package/dist/token-goat-chunk-ATCPY7EQ.mjs +0 -134
- package/dist/token-goat-chunk-EFHMMIGP.mjs +0 -68
- package/dist/token-goat-chunk-IVALLT3S.mjs +0 -48
- package/dist/token-goat-chunk-JDU3EXSU.mjs +0 -65
- package/dist/token-goat-chunk-MKPF4CL5.mjs +0 -37
- package/dist/token-goat-chunk-RC35RBUL.mjs +0 -312
- package/dist/token-goat-chunk-USILZ3T3.mjs +0 -53
- package/dist/token-goat-chunk-VL3YIFHZ.mjs +0 -2975
- package/dist/token-goat-chunk-XU4P6Z24.mjs +0 -133
- package/dist/token-goat-chunk-Y776AENC.mjs +0 -1597
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
buildLineIndex,
|
|
5
|
+
lineTextAt,
|
|
6
|
+
offsetToLine,
|
|
7
|
+
stripJsComments,
|
|
8
|
+
stripXmlComments
|
|
9
|
+
} from "./token-goat-chunk-OUKDTVNU.mjs";
|
|
10
|
+
import {
|
|
11
|
+
countContentLines
|
|
12
|
+
} from "./token-goat-chunk-HU4TORC5.mjs";
|
|
13
|
+
import "./token-goat-chunk-GGGG7RWB.mjs";
|
|
14
|
+
import "./token-goat-chunk-AM5V6GSX.mjs";
|
|
15
|
+
import "./token-goat-chunk-FNFBKLRD.mjs";
|
|
16
|
+
import "./token-goat-chunk-CO3UYX6G.mjs";
|
|
17
|
+
import {
|
|
18
|
+
init_define_import_meta_env
|
|
19
|
+
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
20
|
+
|
|
21
|
+
// src/languages/salesforce_frontend.ts
|
|
22
|
+
init_define_import_meta_env();
|
|
23
|
+
import * as path from "node:path";
|
|
24
|
+
function bundleName(filePath) {
|
|
25
|
+
const normalized = filePath.replaceAll("\\", "/");
|
|
26
|
+
const parent = path.posix.basename(path.posix.dirname(normalized));
|
|
27
|
+
const base = path.posix.basename(normalized).replace(/\.[^.]+$/, "");
|
|
28
|
+
return parent === "lwc" || parent === "aura" ? base : parent;
|
|
29
|
+
}
|
|
30
|
+
function lwcTagAlias(name) {
|
|
31
|
+
const kebab = name.replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").replace(/([a-z\d])([A-Z])/g, "$1-$2").toLowerCase();
|
|
32
|
+
return `c-${kebab}`;
|
|
33
|
+
}
|
|
34
|
+
function symbol(filePath, name, kind, lineStart, lineEnd = lineStart) {
|
|
35
|
+
return { filePath, name, kind, lineStart, lineEnd, body: "", docstring: "", parent: "" };
|
|
36
|
+
}
|
|
37
|
+
function ref(filePath, name, line, col, context) {
|
|
38
|
+
return { filePath, name, line, col, context };
|
|
39
|
+
}
|
|
40
|
+
function dedupe(values, key) {
|
|
41
|
+
const seen = /* @__PURE__ */ new Set();
|
|
42
|
+
return values.filter((value) => {
|
|
43
|
+
const id = key(value);
|
|
44
|
+
if (seen.has(id)) return false;
|
|
45
|
+
seen.add(id);
|
|
46
|
+
return true;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function extractLwcJavaScript(content, filePath) {
|
|
50
|
+
const lineIndex = buildLineIndex(content);
|
|
51
|
+
const bundle = bundleName(filePath);
|
|
52
|
+
const symbols = [
|
|
53
|
+
symbol(filePath, bundle, "lwc_bundle", 1, countContentLines(content)),
|
|
54
|
+
symbol(filePath, lwcTagAlias(bundle), "lwc_component_alias", 1, countContentLines(content))
|
|
55
|
+
];
|
|
56
|
+
const refs = [];
|
|
57
|
+
const commentFree = stripJsComments(content);
|
|
58
|
+
const apiRe = /@api\s*(?:\r?\n\s*)?(?:(get|set)\s+)?(?:async\s+)?([A-Za-z_$][\w$]*)\s*(\()?/g;
|
|
59
|
+
for (const match of commentFree.matchAll(apiRe)) {
|
|
60
|
+
const line = offsetToLine(lineIndex, match.index ?? 0);
|
|
61
|
+
const kind = match[3] && !match[1] ? "lwc_api_method" : "lwc_api_property";
|
|
62
|
+
symbols.push(symbol(filePath, match[2] ?? "", kind, line));
|
|
63
|
+
}
|
|
64
|
+
const importRe = /from\s+['"]@salesforce\/(apex|schema|label|resourceUrl|messageChannel|customPermission|userPermission)\/([^'"]+)['"]/g;
|
|
65
|
+
for (const match of commentFree.matchAll(importRe)) {
|
|
66
|
+
const offset = match.index ?? 0;
|
|
67
|
+
const line = offsetToLine(lineIndex, offset);
|
|
68
|
+
const context = lineTextAt(content, lineIndex, line);
|
|
69
|
+
const target = match[2] ?? "";
|
|
70
|
+
const targetOffset = offset + (match[0]?.indexOf(target) ?? 0);
|
|
71
|
+
const col = targetOffset - (commentFree.lastIndexOf("\n", targetOffset) + 1);
|
|
72
|
+
if (match[1] === "apex") {
|
|
73
|
+
const className = target.split(".")[0] ?? target;
|
|
74
|
+
refs.push(ref(filePath, className, line, col, context));
|
|
75
|
+
}
|
|
76
|
+
refs.push(ref(filePath, target, line, col, context));
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
symbols: dedupe(symbols, (entry) => `${entry.name}\0${entry.kind}\0${entry.lineStart}`),
|
|
80
|
+
refs: dedupe(refs, (entry) => `${entry.filePath}\0${entry.name}\0${entry.line}\0${entry.col}`)
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function extractLwcTemplate(content, filePath) {
|
|
84
|
+
const symbols = [];
|
|
85
|
+
const refs = [];
|
|
86
|
+
const markupNoComments = stripXmlComments(content);
|
|
87
|
+
const lineIndex = buildLineIndex(content);
|
|
88
|
+
for (const match of markupNoComments.matchAll(/\blwc:ref\s*=\s*["']([^"']+)["']/gi)) {
|
|
89
|
+
const line = offsetToLine(lineIndex, match.index ?? 0);
|
|
90
|
+
symbols.push(symbol(filePath, match[1] ?? "", "lwc_ref", line));
|
|
91
|
+
}
|
|
92
|
+
for (const match of markupNoComments.matchAll(/\bid\s*=\s*["']([^"'{}:]+)["']/gi)) {
|
|
93
|
+
const line = offsetToLine(lineIndex, match.index ?? 0);
|
|
94
|
+
symbols.push(symbol(filePath, match[1] ?? "", "lwc_id", line));
|
|
95
|
+
}
|
|
96
|
+
for (const match of markupNoComments.matchAll(/\bon[a-z][\w-]*\s*=\s*\{\s*([A-Za-z_$][\w$]*)\s*\}/gi)) {
|
|
97
|
+
const offset = match.index ?? 0;
|
|
98
|
+
const line = offsetToLine(lineIndex, offset);
|
|
99
|
+
refs.push(ref(filePath, match[1] ?? "", line, 0, lineTextAt(content, lineIndex, line)));
|
|
100
|
+
}
|
|
101
|
+
for (const match of markupNoComments.matchAll(/<\s*(c-[a-z][\w-]*)\b/gi)) {
|
|
102
|
+
const offset = match.index ?? 0;
|
|
103
|
+
const line = offsetToLine(lineIndex, offset);
|
|
104
|
+
refs.push(ref(filePath, (match[1] ?? "").toLowerCase(), line, 0, lineTextAt(content, lineIndex, line)));
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
symbols: dedupe(symbols, (entry) => `${entry.name}\0${entry.kind}\0${entry.lineStart}`),
|
|
108
|
+
refs: dedupe(refs, (entry) => `${entry.filePath}\0${entry.name}\0${entry.line}\0${entry.col}`)
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
var MARKUP_KIND = {
|
|
112
|
+
".cmp": "aura_bundle",
|
|
113
|
+
".app": "aura_application",
|
|
114
|
+
".evt": "aura_event_bundle",
|
|
115
|
+
".intf": "aura_interface",
|
|
116
|
+
".design": "aura_design",
|
|
117
|
+
".auradoc": "aura_documentation",
|
|
118
|
+
".tokens": "aura_tokens",
|
|
119
|
+
".page": "visualforce_page",
|
|
120
|
+
".component": "visualforce_component",
|
|
121
|
+
".email": "visualforce_email_template"
|
|
122
|
+
};
|
|
123
|
+
function markupArtifactName(filePath, extension) {
|
|
124
|
+
if (extension === ".page" || extension === ".component" || extension === ".email") {
|
|
125
|
+
return path.posix.basename(filePath.replaceAll("\\", "/")).replace(new RegExp(`${extension.replace(".", "\\.")}$`, "i"), "");
|
|
126
|
+
}
|
|
127
|
+
return bundleName(filePath);
|
|
128
|
+
}
|
|
129
|
+
function addAttributeSymbols(symbols, content, lineIndex, filePath, tag, kind) {
|
|
130
|
+
scanAttributeTags(content, tag, (name, index) => symbols.push(symbol(filePath, name, kind, offsetToLine(lineIndex, index))));
|
|
131
|
+
}
|
|
132
|
+
function scanAttributeTags(content, tag, onName) {
|
|
133
|
+
const tagStart = new RegExp(`<\\s*${tag}\\b`, "gi");
|
|
134
|
+
let work = 0;
|
|
135
|
+
for (let found = tagStart.exec(content); found !== null; found = tagStart.exec(content)) {
|
|
136
|
+
const scanned = scanTagForName(content, tagStart.lastIndex);
|
|
137
|
+
work += scanned.scanned;
|
|
138
|
+
if (scanned.end < 0) break;
|
|
139
|
+
if (scanned.name !== void 0) onName(scanned.name, found.index);
|
|
140
|
+
tagStart.lastIndex = scanned.end + 1;
|
|
141
|
+
}
|
|
142
|
+
return work;
|
|
143
|
+
}
|
|
144
|
+
var AURA_NAME_TAGS = [
|
|
145
|
+
["aura:attribute", "aura_attribute"],
|
|
146
|
+
["aura:handler", "aura_handler"],
|
|
147
|
+
["aura:registerEvent", "aura_event"],
|
|
148
|
+
["design:attribute", "aura_design_attribute"]
|
|
149
|
+
];
|
|
150
|
+
function attributeScanWork(content) {
|
|
151
|
+
const text = stripXmlComments(content);
|
|
152
|
+
return AURA_NAME_TAGS.reduce((sum, [tag]) => sum + scanAttributeTags(text, tag, () => void 0), 0);
|
|
153
|
+
}
|
|
154
|
+
var NAME_ATTRIBUTE = /name\s*=\s*["']([^"']+)["']/iy;
|
|
155
|
+
function scanTagForName(content, from) {
|
|
156
|
+
let name;
|
|
157
|
+
let searched = 0;
|
|
158
|
+
const unpaired = {};
|
|
159
|
+
for (let i = from; i < content.length; i++) {
|
|
160
|
+
const ch = content[i] ?? "";
|
|
161
|
+
if (ch === ">") return { name, end: i, scanned: i - from + searched };
|
|
162
|
+
if (ch === '"' || ch === "'") {
|
|
163
|
+
const close = unpaired[ch] ? -1 : content.indexOf(ch, i + 1);
|
|
164
|
+
if (close < 0) {
|
|
165
|
+
if (!unpaired[ch]) searched += content.length - i - 1;
|
|
166
|
+
unpaired[ch] = true;
|
|
167
|
+
} else i = close;
|
|
168
|
+
} else if ((ch === "n" || ch === "N") && !/\w/.test(content[i - 1] ?? "")) {
|
|
169
|
+
NAME_ATTRIBUTE.lastIndex = i;
|
|
170
|
+
name = NAME_ATTRIBUTE.exec(content)?.[1] ?? name;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return { name, end: -1, scanned: content.length - from + searched };
|
|
174
|
+
}
|
|
175
|
+
function attributeRefs(refs, content, lineIndex, filePath, attribute, split = false) {
|
|
176
|
+
const attributeRe = new RegExp(`\\b${attribute}\\s*=\\s*["']([^"']+)["']`, "gi");
|
|
177
|
+
for (const match of content.matchAll(attributeRe)) {
|
|
178
|
+
const line = offsetToLine(lineIndex, match.index ?? 0);
|
|
179
|
+
const values = split ? (match[1] ?? "").split(",").map((value) => value.trim()).filter(Boolean) : [match[1] ?? ""];
|
|
180
|
+
for (const value of values) refs.push(ref(filePath, value, line, 0, lineTextAt(content, lineIndex, line)));
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
function extractSalesforceMarkup(content, filePath) {
|
|
184
|
+
const normalized = filePath.replaceAll("\\", "/");
|
|
185
|
+
const extension = path.posix.extname(normalized).toLowerCase();
|
|
186
|
+
const kind = MARKUP_KIND[extension] ?? "salesforce_markup";
|
|
187
|
+
const symbols = [
|
|
188
|
+
symbol(filePath, markupArtifactName(normalized, extension), kind, 1, countContentLines(content))
|
|
189
|
+
];
|
|
190
|
+
const refs = [];
|
|
191
|
+
const isAura = [".cmp", ".app", ".evt", ".intf", ".design", ".auradoc", ".tokens"].includes(extension);
|
|
192
|
+
const markupNoComments = stripXmlComments(content);
|
|
193
|
+
const lineIndex = buildLineIndex(content);
|
|
194
|
+
if (isAura) {
|
|
195
|
+
for (const [tag, tagKind] of AURA_NAME_TAGS) addAttributeSymbols(symbols, markupNoComments, lineIndex, filePath, tag, tagKind);
|
|
196
|
+
}
|
|
197
|
+
attributeRefs(refs, markupNoComments, lineIndex, filePath, "controller");
|
|
198
|
+
attributeRefs(refs, markupNoComments, lineIndex, filePath, "extensions", true);
|
|
199
|
+
const actionRe = isAura ? /\{!\s*c\.([A-Za-z_$][\w$]*)(?:[^}\w$][^}]*)?\}/gi : /\baction\s*=\s*["']\{!\s*(?:c\.)?([A-Za-z_$][\w$]*)(?:[^}\w$][^}]*)?\}["']/gi;
|
|
200
|
+
for (const match of markupNoComments.matchAll(actionRe)) {
|
|
201
|
+
const line = offsetToLine(lineIndex, match.index ?? 0);
|
|
202
|
+
refs.push(ref(filePath, match[1] ?? "", line, 0, lineTextAt(content, lineIndex, line)));
|
|
203
|
+
}
|
|
204
|
+
for (const match of markupNoComments.matchAll(/\bc:[A-Za-z_$][\w$]*/g)) {
|
|
205
|
+
const line = offsetToLine(lineIndex, match.index ?? 0);
|
|
206
|
+
refs.push(ref(filePath, match[0], line, 0, lineTextAt(content, lineIndex, line)));
|
|
207
|
+
}
|
|
208
|
+
return {
|
|
209
|
+
symbols: dedupe(symbols, (entry) => `${entry.name}\0${entry.kind}\0${entry.lineStart}`),
|
|
210
|
+
refs: dedupe(refs, (entry) => `${entry.filePath}\0${entry.name}\0${entry.line}\0${entry.col}`)
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
export {
|
|
214
|
+
attributeScanWork,
|
|
215
|
+
extractLwcJavaScript,
|
|
216
|
+
extractLwcTemplate,
|
|
217
|
+
extractSalesforceMarkup
|
|
218
|
+
};
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
describeCause,
|
|
9
9
|
isExplicitDownload,
|
|
10
10
|
recordDownloadFailure
|
|
11
|
-
} from "./token-goat-chunk-
|
|
11
|
+
} from "./token-goat-chunk-2UPZGKKY.mjs";
|
|
12
12
|
import {
|
|
13
13
|
loadConfig
|
|
14
|
-
} from "./token-goat-chunk-
|
|
14
|
+
} from "./token-goat-chunk-7EZTZOMC.mjs";
|
|
15
15
|
import {
|
|
16
16
|
init_define_import_meta_env
|
|
17
17
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|