@lotics/cli 0.135.0 → 0.136.0
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/src/cli.js +50 -3
- package/package.json +1 -1
package/dist/src/cli.js
CHANGED
|
@@ -47483,9 +47483,10 @@ var CAPABILITY_GATED_CALLS = {
|
|
|
47483
47483
|
comments: ["useComments", "createComment", "updateComment", "deleteComment"]
|
|
47484
47484
|
};
|
|
47485
47485
|
function undeclaredCapabilities(sourceText, declared) {
|
|
47486
|
+
const code = codeWithoutComments(sourceText);
|
|
47486
47487
|
const used = [];
|
|
47487
47488
|
for (const [capability, calls] of Object.entries(CAPABILITY_GATED_CALLS)) {
|
|
47488
|
-
const isCalled = calls.some((call) => new RegExp(`\\b${call}\\b`).test(
|
|
47489
|
+
const isCalled = calls.some((call) => new RegExp(`\\b${call}\\b`).test(code));
|
|
47489
47490
|
if (isCalled && declared?.[capability] !== true) used.push(capability);
|
|
47490
47491
|
}
|
|
47491
47492
|
return used;
|
|
@@ -47506,6 +47507,51 @@ function canonicalJson(value2) {
|
|
|
47506
47507
|
};
|
|
47507
47508
|
return JSON.stringify(normalize(value2));
|
|
47508
47509
|
}
|
|
47510
|
+
function codeWithoutComments(sourceText) {
|
|
47511
|
+
const out = sourceText.split("");
|
|
47512
|
+
const n = sourceText.length;
|
|
47513
|
+
const blank = (from, to) => {
|
|
47514
|
+
for (let k = from; k < to; k++) if (out[k] !== "\n") out[k] = " ";
|
|
47515
|
+
};
|
|
47516
|
+
let i2 = 0;
|
|
47517
|
+
while (i2 < n) {
|
|
47518
|
+
const c = sourceText[i2];
|
|
47519
|
+
const next = sourceText[i2 + 1];
|
|
47520
|
+
if (c === "/" && next === "/") {
|
|
47521
|
+
let j = i2;
|
|
47522
|
+
while (j < n && sourceText[j] !== "\n") j++;
|
|
47523
|
+
blank(i2, j);
|
|
47524
|
+
i2 = j;
|
|
47525
|
+
continue;
|
|
47526
|
+
}
|
|
47527
|
+
if (c === "/" && next === "*") {
|
|
47528
|
+
let j = i2 + 2;
|
|
47529
|
+
while (j < n && !(sourceText[j] === "*" && sourceText[j + 1] === "/")) j++;
|
|
47530
|
+
j = j < n ? j + 2 : n;
|
|
47531
|
+
blank(i2, j);
|
|
47532
|
+
i2 = j;
|
|
47533
|
+
continue;
|
|
47534
|
+
}
|
|
47535
|
+
if (c === '"' || c === "'") {
|
|
47536
|
+
let j = i2 + 1;
|
|
47537
|
+
while (j < n && sourceText[j] !== c && sourceText[j] !== "\n") {
|
|
47538
|
+
j += sourceText[j] === "\\" ? 2 : 1;
|
|
47539
|
+
}
|
|
47540
|
+
i2 = j < n && sourceText[j] === c ? j + 1 : j;
|
|
47541
|
+
continue;
|
|
47542
|
+
}
|
|
47543
|
+
if (c === "`") {
|
|
47544
|
+
let j = i2 + 1;
|
|
47545
|
+
while (j < n && sourceText[j] !== "`") {
|
|
47546
|
+
j += sourceText[j] === "\\" ? 2 : 1;
|
|
47547
|
+
}
|
|
47548
|
+
i2 = j < n ? j + 1 : n;
|
|
47549
|
+
continue;
|
|
47550
|
+
}
|
|
47551
|
+
i2++;
|
|
47552
|
+
}
|
|
47553
|
+
return out.join("");
|
|
47554
|
+
}
|
|
47509
47555
|
var ALIAS_CALL_HOOKS = {
|
|
47510
47556
|
queries: "useQuery",
|
|
47511
47557
|
workflows: "useWorkflow",
|
|
@@ -47513,6 +47559,7 @@ var ALIAS_CALL_HOOKS = {
|
|
|
47513
47559
|
};
|
|
47514
47560
|
var LITERAL_ALIAS_ARG = `["'\`]([A-Za-z_$][A-Za-z0-9_$]*)["'\`]`;
|
|
47515
47561
|
function calledAppAliases(sourceText) {
|
|
47562
|
+
const code = codeWithoutComments(sourceText);
|
|
47516
47563
|
const out = {
|
|
47517
47564
|
queries: [],
|
|
47518
47565
|
workflows: [],
|
|
@@ -47522,8 +47569,8 @@ function calledAppAliases(sourceText) {
|
|
|
47522
47569
|
for (const [kind, hook] of Object.entries(ALIAS_CALL_HOOKS)) {
|
|
47523
47570
|
const seen = /* @__PURE__ */ new Set();
|
|
47524
47571
|
let isDynamic = false;
|
|
47525
|
-
for (const call of
|
|
47526
|
-
const rest2 =
|
|
47572
|
+
for (const call of code.matchAll(new RegExp(`\\b${hook}\\s*\\(`, "g"))) {
|
|
47573
|
+
const rest2 = code.slice(call.index + call[0].length);
|
|
47527
47574
|
const literal2 = new RegExp(`^\\s*${LITERAL_ALIAS_ARG}`).exec(rest2);
|
|
47528
47575
|
if (literal2) seen.add(literal2[1]);
|
|
47529
47576
|
else isDynamic = true;
|