token-goat 2.9.29 → 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 +53 -42
- package/SECURITY.md +37 -11
- package/THIRD_PARTY_NOTICES.md +41 -4
- 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/ort-wasm-simd-threaded.mjs +59 -0
- package/dist/{token-goat-chunk-SE6E4BKJ.mjs → token-goat-chunk-25TRAWET.mjs} +23 -6
- package/dist/token-goat-chunk-2KXO6V2B.mjs +203 -0
- package/dist/{token-goat-chunk-UXSXQQIY.mjs → token-goat-chunk-2M7E4PF7.mjs} +43 -14
- package/dist/token-goat-chunk-2UPZGKKY.mjs +188 -0
- 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-2WOUYWLM.mjs → token-goat-chunk-4GILLLWY.mjs} +34 -7
- package/dist/token-goat-chunk-4NAPX7BA.mjs +90 -0
- package/dist/{token-goat-chunk-NMBWLRHW.mjs → token-goat-chunk-4SC7UJYV.mjs} +9981 -11563
- package/dist/token-goat-chunk-4SMRO4TO.mjs +366 -0
- package/dist/{token-goat-chunk-O6I2XU4P.mjs → token-goat-chunk-4ZBFWLXF.mjs} +310 -441
- package/dist/token-goat-chunk-57BIAXJL.mjs +286 -0
- package/dist/token-goat-chunk-5AC66HNP.mjs +115 -0
- package/dist/token-goat-chunk-5IMLKSOP.mjs +145 -0
- package/dist/token-goat-chunk-5RG5SBL6.mjs +221 -0
- package/dist/{token-goat-chunk-RRNZMM3A.mjs → token-goat-chunk-5Y6ZYL6U.mjs} +21 -2
- package/dist/token-goat-chunk-646E6U44.mjs +398 -0
- package/dist/token-goat-chunk-65N4RHP4.mjs +33 -0
- package/dist/{token-goat-chunk-6AK46ZT7.mjs → token-goat-chunk-6DG6HWP3.mjs} +13 -3
- package/dist/token-goat-chunk-6ENQSNRZ.mjs +573 -0
- package/dist/token-goat-chunk-6ZY4GNF2.mjs +91 -0
- package/dist/{token-goat-chunk-E5TK5DNO.mjs → token-goat-chunk-76FGDLRO.mjs} +574 -340
- package/dist/{token-goat-chunk-TGOXNAHW.mjs → token-goat-chunk-7EZTZOMC.mjs} +780 -767
- package/dist/token-goat-chunk-7MAOA6X4.mjs +3647 -0
- package/dist/token-goat-chunk-7R2ZVVAX.mjs +218 -0
- package/dist/{token-goat-chunk-TCQANXYC.mjs → token-goat-chunk-AM5V6GSX.mjs} +18 -2
- package/dist/token-goat-chunk-AUNGYYQX.mjs +184 -0
- package/dist/token-goat-chunk-AUQYRMMH.mjs +2985 -0
- package/dist/token-goat-chunk-B3PEKBYG.mjs +128 -0
- package/dist/{token-goat-chunk-KOPIR3KZ.mjs → token-goat-chunk-BA4HI6BW.mjs} +1910 -165
- package/dist/{token-goat-chunk-52NSDWYY.mjs → token-goat-chunk-BFCWY73P.mjs} +58 -20
- package/dist/token-goat-chunk-BPGCUMR7.mjs +30 -0
- package/dist/token-goat-chunk-BWGFUZZE.mjs +25 -0
- package/dist/token-goat-chunk-C75NA7PL.mjs +322 -0
- package/dist/token-goat-chunk-CBIQ7WTD.mjs +87 -0
- package/dist/token-goat-chunk-CETM74KC.mjs +307 -0
- package/dist/token-goat-chunk-CIMQ2BB3.mjs +233 -0
- package/dist/{token-goat-chunk-DNSPXQXQ.mjs → token-goat-chunk-CJLS3CDL.mjs} +70 -18
- package/dist/{token-goat-chunk-MELOKFDJ.mjs → token-goat-chunk-CO3UYX6G.mjs} +7 -1
- package/dist/token-goat-chunk-COPNXRJM.mjs +154 -0
- package/dist/token-goat-chunk-CSJ5L3NL.mjs +479 -0
- package/dist/token-goat-chunk-CVCEVUGK.mjs +315 -0
- package/dist/token-goat-chunk-CXHOFN7R.mjs +371 -0
- package/dist/token-goat-chunk-D735C4QM.mjs +603 -0
- package/dist/{token-goat-chunk-E4ZOJIZK.mjs → token-goat-chunk-DGS2LVNA.mjs} +70 -160
- package/dist/{token-goat-chunk-L7H3U27L.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-EELTBKDM.mjs +613 -0
- package/dist/token-goat-chunk-EVMZJ27Z.mjs +147 -0
- package/dist/token-goat-chunk-EXKGNHEG.mjs +2096 -0
- package/dist/{token-goat-chunk-YOOVFPTP.mjs → token-goat-chunk-F4HYL64R.mjs} +12 -2
- package/dist/token-goat-chunk-F6PAUIEK.mjs +624 -0
- package/dist/token-goat-chunk-FDSREWLX.mjs +692 -0
- package/dist/{token-goat-chunk-NMTKNYGF.mjs → token-goat-chunk-FNFBKLRD.mjs} +74 -9
- package/dist/token-goat-chunk-G5PJ7AGM.mjs +36 -0
- package/dist/token-goat-chunk-GGGG7RWB.mjs +236 -0
- package/dist/{token-goat-chunk-TDUT2CL6.mjs → token-goat-chunk-GL3ETKSC.mjs} +276 -19
- package/dist/{token-goat-chunk-7CPMDFGB.mjs → token-goat-chunk-GVB2MUST.mjs} +265 -1567
- package/dist/token-goat-chunk-GWFLAUMQ.mjs +307 -0
- package/dist/token-goat-chunk-HAVAOB3S.mjs +87 -0
- package/dist/token-goat-chunk-HLPW63A7.mjs +48 -0
- package/dist/token-goat-chunk-HU4TORC5.mjs +1377 -0
- package/dist/token-goat-chunk-I7VKZZAW.mjs +35 -0
- package/dist/token-goat-chunk-IA6XSPE3.mjs +218 -0
- package/dist/token-goat-chunk-IAGXMHIK.mjs +863 -0
- package/dist/{token-goat-chunk-435UQTKD.mjs → token-goat-chunk-IK2DRMFX.mjs} +129 -74
- package/dist/{token-goat-chunk-ZER6EAXZ.mjs → token-goat-chunk-INNPTRUX.mjs} +2954 -2783
- package/dist/token-goat-chunk-JJ5BX4F4.mjs +129 -0
- package/dist/token-goat-chunk-JVFSHVFJ.mjs +129 -0
- package/dist/token-goat-chunk-KGEFFSHD.mjs +50 -0
- package/dist/token-goat-chunk-KKUFXAPD.mjs +25 -0
- package/dist/token-goat-chunk-KQBLRPBN.mjs +433 -0
- package/dist/token-goat-chunk-LCNQ2CNN.mjs +497 -0
- 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-2AWQ2R5X.mjs → token-goat-chunk-MHX7XCC3.mjs} +3 -2
- package/dist/token-goat-chunk-MNWKPRAL.mjs +13 -0
- package/dist/token-goat-chunk-N5LSOVSU.mjs +137 -0
- package/dist/{token-goat-chunk-DPNLUJWB.mjs → token-goat-chunk-N5MMR2IW.mjs} +30 -8
- package/dist/token-goat-chunk-N7B3JQ2C.mjs +160 -0
- package/dist/{token-goat-chunk-VMFWNHGR.mjs → token-goat-chunk-NISNMD7T.mjs} +2545 -2953
- package/dist/token-goat-chunk-NMD42SFQ.mjs +434 -0
- package/dist/token-goat-chunk-NOSS5VWY.mjs +174 -0
- package/dist/token-goat-chunk-NSNSPPBG.mjs +69 -0
- package/dist/token-goat-chunk-OBOFIHKN.mjs +38 -0
- package/dist/token-goat-chunk-OBRFJ5O5.mjs +76 -0
- package/dist/token-goat-chunk-ODBT2USM.mjs +800 -0
- 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-ASLWOQ3I.mjs → token-goat-chunk-OYIYKDDT.mjs} +2 -1
- package/dist/{token-goat-chunk-67BNIKKO.mjs → token-goat-chunk-P6HQSWQ3.mjs} +55 -47
- package/dist/token-goat-chunk-P6VGNTQT.mjs +71 -0
- package/dist/token-goat-chunk-PFWIMH2E.mjs +261 -0
- package/dist/token-goat-chunk-PJZXIS3G.mjs +39 -0
- package/dist/token-goat-chunk-PUO5INXP.mjs +606 -0
- package/dist/token-goat-chunk-PX5PQWTY.mjs +462 -0
- package/dist/token-goat-chunk-Q5QDBC6O.mjs +111 -0
- package/dist/token-goat-chunk-QFNQXSDT.mjs +40 -0
- package/dist/token-goat-chunk-QH7YVYOY.mjs +3957 -0
- package/dist/token-goat-chunk-QLMUHEPB.mjs +43 -0
- package/dist/{token-goat-chunk-PYSUADX4.mjs → token-goat-chunk-QQOJIHL3.mjs} +50 -14
- package/dist/token-goat-chunk-QQTWJY2O.mjs +85 -0
- package/dist/token-goat-chunk-QYHO5CPH.mjs +93 -0
- package/dist/token-goat-chunk-RELAVWAD.mjs +27 -0
- package/dist/token-goat-chunk-RSLPOBKQ.mjs +339 -0
- package/dist/token-goat-chunk-SAMFDIS2.mjs +712 -0
- package/dist/token-goat-chunk-SDELXLDM.mjs +48 -0
- package/dist/{token-goat-chunk-PGTH2U4C.mjs → token-goat-chunk-SOAFZNNZ.mjs} +164 -40
- package/dist/{token-goat-chunk-G23DWHV4.mjs → token-goat-chunk-SRTHT7KV.mjs} +33 -15
- package/dist/token-goat-chunk-T5P5ACNQ.mjs +212 -0
- package/dist/token-goat-chunk-T5YGG4V3.mjs +45 -0
- package/dist/token-goat-chunk-TAUZ4OFS.mjs +110 -0
- package/dist/token-goat-chunk-TM6MC754.mjs +40 -0
- package/dist/token-goat-chunk-TWUKBOMP.mjs +72 -0
- package/dist/token-goat-chunk-U2KSB4SG.mjs +56 -0
- package/dist/token-goat-chunk-U4WHMG6Y.mjs +898 -0
- package/dist/token-goat-chunk-UA5V6P3P.mjs +122 -0
- package/dist/token-goat-chunk-UGJHGR5A.mjs +52 -0
- package/dist/{token-goat-chunk-RQGGMPCR.mjs → token-goat-chunk-UOUDVA5U.mjs} +76 -16
- package/dist/{token-goat-chunk-HNFZZHFW.mjs → token-goat-chunk-URRJ33GR.mjs} +22 -4
- package/dist/token-goat-chunk-UZOROKIS.mjs +165 -0
- package/dist/token-goat-chunk-VIHGGGEI.mjs +4234 -0
- package/dist/token-goat-chunk-VTJLAA7P.mjs +21 -0
- package/dist/token-goat-chunk-VWDXLT4F.mjs +678 -0
- package/dist/token-goat-chunk-VWZA2H4P.mjs +368 -0
- package/dist/{token-goat-chunk-QO3LXVVR.mjs → token-goat-chunk-VXEXMJDL.mjs} +2964 -3153
- package/dist/token-goat-chunk-WBA5SKT4.mjs +547 -0
- package/dist/{token-goat-chunk-ONXH6NZ5.mjs → token-goat-chunk-WDH44VAU.mjs} +19 -22
- package/dist/token-goat-chunk-X2SUP3EI.mjs +107 -0
- package/dist/token-goat-chunk-X3BELZSJ.mjs +125 -0
- package/dist/{token-goat-chunk-RLP6J7WR.mjs → token-goat-chunk-XLRBNZCC.mjs} +40 -21
- package/dist/{token-goat-chunk-S4VSXURL.mjs → token-goat-chunk-XRKUX6CM.mjs} +4 -0
- package/dist/token-goat-chunk-XX6O25RN.mjs +82 -0
- package/dist/token-goat-chunk-XZSUHBVS.mjs +65 -0
- package/dist/token-goat-chunk-Y2ZTQOCL.mjs +35 -0
- package/dist/{token-goat-chunk-UA5BKWWQ.mjs → token-goat-chunk-YB4VMGK2.mjs} +15 -4
- package/dist/token-goat-chunk-YBIIY3HR.mjs +51 -0
- package/dist/{token-goat-chunk-PKRWMHVP.mjs → token-goat-chunk-YHVDKQBR.mjs} +389 -221
- package/dist/token-goat-chunk-YJB5XLWI.mjs +26 -0
- package/dist/{token-goat-chunk-PQ53BSCF.mjs → token-goat-chunk-YKB6AQG3.mjs} +53 -31
- package/dist/token-goat-chunk-YMTG2YA5.mjs +35 -0
- package/dist/token-goat-chunk-YPBZYQRV.mjs +40 -0
- package/dist/{token-goat-chunk-HUYUHODZ.mjs → token-goat-chunk-YY6AVUFL.mjs} +13246 -12247
- package/dist/token-goat-chunk-Z7N5OMMP.mjs +98 -0
- package/dist/{token-goat-chunk-BGHSSJUA.mjs → token-goat-chunk-ZFOBKUWH.mjs} +1 -1
- package/dist/token-goat-chunk-ZMBL6UVV.mjs +110 -0
- package/dist/token-goat-chunk-ZNMNUPAZ.mjs +938 -0
- package/dist/token-goat-hook-client.cjs +87 -23
- package/dist/token-goat-hook-client.mjs +3 -3
- package/dist/token-goat-hook.mjs +76 -31
- package/dist/token-goat.core.mjs +6 -6
- package/docs/C4_RUNTIME_ARCHITECTURE.md +2 -2
- package/docs/cli.md +113 -60
- package/docs/install.md +63 -20
- package/docs/security.md +10 -8
- package/package.json +18 -7
- package/scripts/verify-native-dist.mjs +386 -0
- package/dist/token-goat-chunk-2NNUA2LR.mjs +0 -143
- package/dist/token-goat-chunk-44BM7DDQ.mjs +0 -294
- package/dist/token-goat-chunk-BGYOZ6DO.mjs +0 -24
- package/dist/token-goat-chunk-C5YPNZKQ.mjs +0 -318
- package/dist/token-goat-chunk-CIQ2FTY3.mjs +0 -1990
- package/dist/token-goat-chunk-D4ETHJD6.mjs +0 -246
- package/dist/token-goat-chunk-DNRPXHYH.mjs +0 -1062
- package/dist/token-goat-chunk-EUSDXRXU.mjs +0 -1429
- package/dist/token-goat-chunk-FTP4U4QA.mjs +0 -64
- package/dist/token-goat-chunk-G7IWXCFF.mjs +0 -456
- package/dist/token-goat-chunk-GLXRTTLE.mjs +0 -36
- package/dist/token-goat-chunk-H5J3C56Q.mjs +0 -1511
- package/dist/token-goat-chunk-IVWI2OCK.mjs +0 -368
- package/dist/token-goat-chunk-JTKCQMQA.mjs +0 -418
- package/dist/token-goat-chunk-LZNBQTDK.mjs +0 -26
- package/dist/token-goat-chunk-ORNFMIER.mjs +0 -295
- package/dist/token-goat-chunk-RTMVLHWX.mjs +0 -7113
- package/dist/token-goat-chunk-VQ6F6T7X.mjs +0 -36
- package/dist/token-goat-chunk-VZQEWRVH.mjs +0 -312
- package/dist/token-goat-chunk-XYWPOSCN.mjs +0 -807
- package/dist/token-goat-chunk-YAGLESS3.mjs +0 -23
- package/dist/token-goat-chunk-YKSRAWUU.mjs +0 -33
- package/dist/token-goat-chunk-Z6KBMOBI.mjs +0 -53
|
@@ -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
|
+
};
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
isUncOrDevicePath,
|
|
8
8
|
lowercaseDriveLetter,
|
|
9
9
|
normalizeDarwinSystemAlias
|
|
10
|
-
} from "./token-goat-chunk-
|
|
10
|
+
} from "./token-goat-chunk-FNFBKLRD.mjs";
|
|
11
11
|
import {
|
|
12
12
|
init_define_import_meta_env
|
|
13
13
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
@@ -209,6 +209,7 @@ function sameDirectory(a, b, platform = process.platform) {
|
|
|
209
209
|
|
|
210
210
|
// src/process_util.ts
|
|
211
211
|
init_define_import_meta_env();
|
|
212
|
+
import { spawnSync } from "node:child_process";
|
|
212
213
|
import { existsSync, realpathSync as realpathSync2, statSync } from "node:fs";
|
|
213
214
|
import * as path2 from "node:path";
|
|
214
215
|
function sleepSync(ms) {
|
|
@@ -283,9 +284,16 @@ function quoteShellPath(value) {
|
|
|
283
284
|
if (process.platform === "win32") return `"${value}"`;
|
|
284
285
|
return `"${value.replace(/[\\$`"]/g, "\\$&")}"`;
|
|
285
286
|
}
|
|
287
|
+
function quotePosixShellWord(value) {
|
|
288
|
+
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
289
|
+
}
|
|
286
290
|
function quotePowershellPath(value) {
|
|
287
291
|
return `'${value.replace(/'/g, "''")}'`;
|
|
288
292
|
}
|
|
293
|
+
var POWERSHELL_EXIT_SUFFIX = "; if (Get-Variable LASTEXITCODE -ErrorAction Ignore) { exit (Get-Variable LASTEXITCODE -ValueOnly) }; exit 1";
|
|
294
|
+
function powershellHookLine(call) {
|
|
295
|
+
return `& ${call}${POWERSHELL_EXIT_SUFFIX}`;
|
|
296
|
+
}
|
|
289
297
|
function resolveOnPath(label) {
|
|
290
298
|
if (path2.isAbsolute(label)) return existsSync(label) ? label : null;
|
|
291
299
|
if (label.includes("/") || label.includes("\\")) return null;
|
|
@@ -317,6 +325,12 @@ function resolveOnPath(label) {
|
|
|
317
325
|
}
|
|
318
326
|
return null;
|
|
319
327
|
}
|
|
328
|
+
function spawnResolvedSync(resolved, args, options) {
|
|
329
|
+
if (!isWindows() || !/\.(?:cmd|bat)$/i.test(resolved)) return spawnSync(resolved, args, options);
|
|
330
|
+
const comspec = path2.join(process.env["SystemRoot"] ?? process.env["windir"] ?? "C:\\Windows", "System32", "cmd.exe");
|
|
331
|
+
const line = [resolved, ...args].map(windowsCmdQuoteArg).join(" ");
|
|
332
|
+
return spawnSync(existsSync(comspec) ? comspec : "cmd.exe", ["/d", "/s", "/c", `"${line}"`], { ...options, windowsVerbatimArguments: true });
|
|
333
|
+
}
|
|
320
334
|
function installEpipeGuard(streams) {
|
|
321
335
|
const targets = (streams ?? [process.stdout, process.stderr]).filter((s) => s !== void 0);
|
|
322
336
|
for (const stream of targets) {
|
|
@@ -343,9 +357,11 @@ export {
|
|
|
343
357
|
isInsideRoot,
|
|
344
358
|
sleepSync,
|
|
345
359
|
isWindows,
|
|
346
|
-
windowsCmdQuoteArg,
|
|
347
360
|
quoteShellPath,
|
|
361
|
+
quotePosixShellWord,
|
|
348
362
|
quotePowershellPath,
|
|
363
|
+
powershellHookLine,
|
|
349
364
|
resolveOnPath,
|
|
365
|
+
spawnResolvedSync,
|
|
350
366
|
installEpipeGuard
|
|
351
367
|
};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
DownloadCooldownError,
|
|
5
|
+
DownloadFailedError,
|
|
6
|
+
activeDownloadCooldown,
|
|
7
|
+
clearDownloadFailure,
|
|
8
|
+
describeCause,
|
|
9
|
+
isExplicitDownload,
|
|
10
|
+
recordDownloadFailure
|
|
11
|
+
} from "./token-goat-chunk-2UPZGKKY.mjs";
|
|
12
|
+
import {
|
|
13
|
+
loadConfig
|
|
14
|
+
} from "./token-goat-chunk-7EZTZOMC.mjs";
|
|
15
|
+
import {
|
|
16
|
+
init_define_import_meta_env
|
|
17
|
+
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
18
|
+
|
|
19
|
+
// src/pinned_fetch.ts
|
|
20
|
+
init_define_import_meta_env();
|
|
21
|
+
import { createHash } from "node:crypto";
|
|
22
|
+
import * as fs from "node:fs";
|
|
23
|
+
import * as path from "node:path";
|
|
24
|
+
import { pipeline } from "node:stream/promises";
|
|
25
|
+
var ATTEMPTS = 3;
|
|
26
|
+
var retryDelayMs = 250;
|
|
27
|
+
function setPinnedRetryDelayForTesting(ms) {
|
|
28
|
+
retryDelayMs = ms ?? 250;
|
|
29
|
+
}
|
|
30
|
+
var DETERMINISTIC_CODE = /^(?:ENOTFOUND|EAI_NONAME|ERR_INVALID_URL|ERR_TLS_|ERR_SSL_|CERT_|DEPTH_ZERO_SELF_SIGNED_CERT$|SELF_SIGNED_CERT_IN_CHAIN$|UNABLE_TO_)/;
|
|
31
|
+
function causeCodes(e) {
|
|
32
|
+
const codes = [];
|
|
33
|
+
let cursor = e;
|
|
34
|
+
for (let depth = 0; cursor !== null && typeof cursor === "object" && depth < 5; depth++) {
|
|
35
|
+
const code = cursor.code;
|
|
36
|
+
if (typeof code === "string") codes.push(code);
|
|
37
|
+
cursor = cursor.cause;
|
|
38
|
+
}
|
|
39
|
+
return codes;
|
|
40
|
+
}
|
|
41
|
+
function transient(e) {
|
|
42
|
+
if (e instanceof TypeError) return !causeCodes(e).some((code) => DETERMINISTIC_CODE.test(code)) && !/ENOTFOUND/.test(describeCause(e));
|
|
43
|
+
return e instanceof Error && (e.name === "TimeoutError" || e.name === "AbortError");
|
|
44
|
+
}
|
|
45
|
+
var HostFailure = class extends Error {
|
|
46
|
+
retry;
|
|
47
|
+
constructor(message, retry, cause) {
|
|
48
|
+
super(message, cause === void 0 ? void 0 : { cause });
|
|
49
|
+
this.retry = retry;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
function failure(url, message, cause, startedAt) {
|
|
53
|
+
let at = Date.now();
|
|
54
|
+
try {
|
|
55
|
+
at = recordDownloadFailure(url, message, at, startedAt).at;
|
|
56
|
+
} catch {
|
|
57
|
+
}
|
|
58
|
+
return new DownloadFailedError(message, url, at, cause);
|
|
59
|
+
}
|
|
60
|
+
function forgetFailure(url) {
|
|
61
|
+
try {
|
|
62
|
+
clearDownloadFailure(url);
|
|
63
|
+
} catch {
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async function fetchOk(url) {
|
|
67
|
+
let response;
|
|
68
|
+
try {
|
|
69
|
+
response = await fetch(url, { redirect: "follow" });
|
|
70
|
+
} catch (e) {
|
|
71
|
+
throw new HostFailure(`GET ${url} failed: ${describeCause(e)}`, transient(e), e);
|
|
72
|
+
}
|
|
73
|
+
if (response.ok) return response;
|
|
74
|
+
await response.body?.cancel().catch(() => void 0);
|
|
75
|
+
throw new HostFailure(`GET ${url} returned ${response.status} ${response.statusText}`, response.status >= 500 || response.status === 429);
|
|
76
|
+
}
|
|
77
|
+
async function* bodyChunks(url, body, expected) {
|
|
78
|
+
let received = 0;
|
|
79
|
+
try {
|
|
80
|
+
for await (const chunk of body) {
|
|
81
|
+
received += chunk.byteLength;
|
|
82
|
+
yield chunk;
|
|
83
|
+
}
|
|
84
|
+
} catch (e) {
|
|
85
|
+
throw new HostFailure(`GET ${url} broke off after ${received} of ${expected} bytes: ${describeCause(e)}`, transient(e), e);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function sha256Of(filePath) {
|
|
89
|
+
return new Promise((resolve, reject) => {
|
|
90
|
+
const hash = createHash("sha256");
|
|
91
|
+
const stream = fs.createReadStream(filePath);
|
|
92
|
+
stream.on("error", reject);
|
|
93
|
+
stream.on("data", (chunk) => hash.update(chunk));
|
|
94
|
+
stream.on("end", () => resolve(hash.digest("hex")));
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
async function copyFromSharedCache(shared, file, target) {
|
|
98
|
+
const source = path.join(shared, file.name);
|
|
99
|
+
const temp = `${target}.${process.pid}.shared`;
|
|
100
|
+
try {
|
|
101
|
+
const info = fs.lstatSync(source, { throwIfNoEntry: false });
|
|
102
|
+
if (!info?.isFile() || info.size !== file.bytes) return false;
|
|
103
|
+
fs.copyFileSync(source, temp);
|
|
104
|
+
if (await sha256Of(temp) !== file.sha256) {
|
|
105
|
+
fs.rmSync(temp, { force: true, maxRetries: 20, retryDelay: 25 });
|
|
106
|
+
fs.rmSync(source, { force: true, maxRetries: 20, retryDelay: 25 });
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
fs.renameSync(temp, target);
|
|
110
|
+
return true;
|
|
111
|
+
} catch {
|
|
112
|
+
try {
|
|
113
|
+
fs.rmSync(temp, { force: true, maxRetries: 20, retryDelay: 25 });
|
|
114
|
+
} catch {
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
async function downloadPinned(url, file, target) {
|
|
120
|
+
if (loadConfig().network.offline) throw new Error(`Offline mode is on (network.offline): refusing to download ${url}`);
|
|
121
|
+
if (!isExplicitDownload()) {
|
|
122
|
+
const cooldown = activeDownloadCooldown(url);
|
|
123
|
+
if (cooldown) throw new DownloadCooldownError(url, cooldown);
|
|
124
|
+
}
|
|
125
|
+
const startedAt = Date.now();
|
|
126
|
+
for (let attempt = 1; ; attempt++) {
|
|
127
|
+
try {
|
|
128
|
+
await fetchAndPlace(url, file, target);
|
|
129
|
+
forgetFailure(url);
|
|
130
|
+
return;
|
|
131
|
+
} catch (e) {
|
|
132
|
+
if (!(e instanceof HostFailure)) throw e;
|
|
133
|
+
if (attempt < ATTEMPTS && e.retry) {
|
|
134
|
+
await new Promise((resolve) => setTimeout(resolve, retryDelayMs * attempt));
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
throw failure(url, e.message, e.cause, startedAt);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
async function fetchAndPlace(url, file, target) {
|
|
142
|
+
const response = await fetchOk(url);
|
|
143
|
+
const body = response.body;
|
|
144
|
+
if (!body) throw new Error(`GET ${url} returned no body`);
|
|
145
|
+
const temp = `${target}.${process.pid}.partial`;
|
|
146
|
+
const hash = createHash("sha256");
|
|
147
|
+
let written = 0;
|
|
148
|
+
const out = fs.createWriteStream(temp);
|
|
149
|
+
try {
|
|
150
|
+
await pipeline(async function* () {
|
|
151
|
+
for await (const chunk of bodyChunks(url, body, file.bytes)) {
|
|
152
|
+
written += chunk.byteLength;
|
|
153
|
+
if (written > file.bytes) throw new Error(`${file.name} is longer than the pinned ${file.bytes} bytes`);
|
|
154
|
+
hash.update(chunk);
|
|
155
|
+
yield chunk;
|
|
156
|
+
}
|
|
157
|
+
}, out);
|
|
158
|
+
if (written !== file.bytes) {
|
|
159
|
+
throw new Error(`${file.name} is ${written} bytes, expected the pinned ${file.bytes}`);
|
|
160
|
+
}
|
|
161
|
+
const digest = hash.digest("hex");
|
|
162
|
+
if (digest !== file.sha256) {
|
|
163
|
+
throw new Error(`${file.name} has sha256 ${digest}, expected the pinned ${file.sha256}`);
|
|
164
|
+
}
|
|
165
|
+
fs.renameSync(temp, target);
|
|
166
|
+
} catch (e) {
|
|
167
|
+
await new Promise((resolve) => {
|
|
168
|
+
if (out.closed) resolve();
|
|
169
|
+
else out.once("close", () => resolve());
|
|
170
|
+
});
|
|
171
|
+
try {
|
|
172
|
+
fs.rmSync(temp, { force: true, maxRetries: 20, retryDelay: 25 });
|
|
173
|
+
} catch {
|
|
174
|
+
}
|
|
175
|
+
throw e;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export {
|
|
180
|
+
setPinnedRetryDelayForTesting,
|
|
181
|
+
sha256Of,
|
|
182
|
+
copyFromSharedCache,
|
|
183
|
+
downloadPinned
|
|
184
|
+
};
|