lingo.dev 0.117.21 → 0.117.23
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/build/{chunk-HTMTB46P.cjs → chunk-EHIR4A2G.cjs} +2 -2
- package/build/{chunk-HTMTB46P.cjs.map → chunk-EHIR4A2G.cjs.map} +1 -1
- package/build/cli.cjs +203 -152
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +61 -10
- package/build/cli.mjs.map +1 -1
- package/build/compiler.cjs +1 -1
- package/build/locale-codes.cjs +1 -1
- package/build/react/client.cjs +1 -1
- package/build/react/react-router.cjs +1 -1
- package/build/react/rsc.cjs +1 -1
- package/build/react.cjs +1 -1
- package/build/sdk.cjs +1 -1
- package/build/spec.cjs +1 -1
- package/package.json +5 -5
package/build/cli.mjs
CHANGED
|
@@ -1714,6 +1714,7 @@ function extractCommentsFromJsonc(jsoncString) {
|
|
|
1714
1714
|
return {};
|
|
1715
1715
|
}
|
|
1716
1716
|
const contextStack = [];
|
|
1717
|
+
let arrayObjectCount = {};
|
|
1717
1718
|
for (let i = 0; i < lines.length; i++) {
|
|
1718
1719
|
const line = lines[i];
|
|
1719
1720
|
const trimmedLine = line.trim();
|
|
@@ -1725,11 +1726,11 @@ function extractCommentsFromJsonc(jsoncString) {
|
|
|
1725
1726
|
const keyMatch = line.match(/^\s*["']?([^"':,\s]+)["']?\s*:/);
|
|
1726
1727
|
if (keyMatch) {
|
|
1727
1728
|
const key = keyMatch[1];
|
|
1728
|
-
const path19 = contextStack.map((ctx) => ctx.key).filter(Boolean);
|
|
1729
|
+
const path19 = contextStack.map((ctx) => ctx.arrayIndex !== void 0 ? String(ctx.arrayIndex) : ctx.key).filter(Boolean);
|
|
1729
1730
|
keyInfo = { key, path: path19 };
|
|
1730
1731
|
}
|
|
1731
1732
|
} else {
|
|
1732
|
-
keyInfo = findAssociatedKey(lines, commentData.lineIndex, contextStack);
|
|
1733
|
+
keyInfo = findAssociatedKey(lines, commentData.lineIndex, contextStack, arrayObjectCount);
|
|
1733
1734
|
}
|
|
1734
1735
|
if (keyInfo && keyInfo.key) {
|
|
1735
1736
|
setCommentAtPath(comments, keyInfo.path, keyInfo.key, commentData.hint);
|
|
@@ -1737,7 +1738,7 @@ function extractCommentsFromJsonc(jsoncString) {
|
|
|
1737
1738
|
i = commentData.endIndex;
|
|
1738
1739
|
continue;
|
|
1739
1740
|
}
|
|
1740
|
-
updateContext(contextStack, line, result);
|
|
1741
|
+
updateContext(contextStack, line, result, arrayObjectCount);
|
|
1741
1742
|
}
|
|
1742
1743
|
return comments;
|
|
1743
1744
|
}
|
|
@@ -1801,34 +1802,84 @@ function extractBlockComment(lines, startIndex) {
|
|
|
1801
1802
|
endIndex
|
|
1802
1803
|
};
|
|
1803
1804
|
}
|
|
1804
|
-
function findAssociatedKey(lines, commentLineIndex, contextStack) {
|
|
1805
|
+
function findAssociatedKey(lines, commentLineIndex, contextStack, arrayObjectCount) {
|
|
1805
1806
|
for (let i = commentLineIndex + 1; i < lines.length; i++) {
|
|
1806
1807
|
const line = lines[i].trim();
|
|
1807
|
-
if (!line || line.startsWith("//") || line.startsWith("/*")
|
|
1808
|
+
if (!line || line.startsWith("//") || line.startsWith("/*")) {
|
|
1809
|
+
continue;
|
|
1810
|
+
}
|
|
1811
|
+
if (line === "{" && contextStack.length > 0) {
|
|
1812
|
+
const parent = contextStack[contextStack.length - 1];
|
|
1813
|
+
if (parent.isArray) {
|
|
1814
|
+
const depth = contextStack.length - 1;
|
|
1815
|
+
const arrayIndex = arrayObjectCount[depth] || 0;
|
|
1816
|
+
for (let j = i + 1; j < lines.length; j++) {
|
|
1817
|
+
const innerLine = lines[j].trim();
|
|
1818
|
+
if (!innerLine || innerLine.startsWith("//") || innerLine.startsWith("/*")) continue;
|
|
1819
|
+
const keyMatch2 = innerLine.match(/^\s*["']?([^"':,\s]+)["']?\s*:/);
|
|
1820
|
+
if (keyMatch2) {
|
|
1821
|
+
const key = keyMatch2[1];
|
|
1822
|
+
const path19 = contextStack.map((ctx) => ctx.arrayIndex !== void 0 ? String(ctx.arrayIndex) : ctx.key).filter(Boolean);
|
|
1823
|
+
path19.push(String(arrayIndex));
|
|
1824
|
+
return { key, path: path19 };
|
|
1825
|
+
}
|
|
1826
|
+
if (innerLine === "}") break;
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
if (line === "{" || line === "}") {
|
|
1808
1831
|
continue;
|
|
1809
1832
|
}
|
|
1810
1833
|
const keyMatch = line.match(/^\s*["']?([^"':,\s]+)["']?\s*:/);
|
|
1811
1834
|
if (keyMatch) {
|
|
1812
1835
|
const key = keyMatch[1];
|
|
1813
|
-
const path19 = contextStack.map((ctx) => ctx.key).filter(Boolean);
|
|
1836
|
+
const path19 = contextStack.map((ctx) => ctx.arrayIndex !== void 0 ? String(ctx.arrayIndex) : ctx.key).filter(Boolean);
|
|
1814
1837
|
return { key, path: path19 };
|
|
1815
1838
|
}
|
|
1816
1839
|
}
|
|
1817
1840
|
return { key: null, path: [] };
|
|
1818
1841
|
}
|
|
1819
|
-
function updateContext(contextStack, line, parsedJson) {
|
|
1842
|
+
function updateContext(contextStack, line, parsedJson, arrayObjectCount) {
|
|
1843
|
+
const trimmed = line.trim();
|
|
1844
|
+
const arrayMatch = line.match(/^\s*["']?([^"':,\s]+)["']?\s*:\s*\[/);
|
|
1845
|
+
if (arrayMatch) {
|
|
1846
|
+
const depth = contextStack.length;
|
|
1847
|
+
arrayObjectCount[depth] = 0;
|
|
1848
|
+
contextStack.push({ key: arrayMatch[1], isArray: true });
|
|
1849
|
+
return;
|
|
1850
|
+
}
|
|
1820
1851
|
const openBraces = (line.match(/\{/g) || []).length;
|
|
1821
1852
|
const closeBraces = (line.match(/\}/g) || []).length;
|
|
1822
1853
|
if (openBraces > closeBraces) {
|
|
1823
1854
|
const keyMatch = line.match(/^\s*["']?([^"':,\s]+)["']?\s*:\s*\{/);
|
|
1824
1855
|
if (keyMatch) {
|
|
1825
1856
|
contextStack.push({ key: keyMatch[1], isArray: false });
|
|
1857
|
+
} else if (trimmed === "{" && contextStack.length > 0) {
|
|
1858
|
+
const parent = contextStack[contextStack.length - 1];
|
|
1859
|
+
if (parent.isArray) {
|
|
1860
|
+
const depth = contextStack.length - 1;
|
|
1861
|
+
const arrayIndex = arrayObjectCount[depth] || 0;
|
|
1862
|
+
contextStack.push({ key: "", isArray: false, arrayIndex });
|
|
1863
|
+
arrayObjectCount[depth]++;
|
|
1864
|
+
}
|
|
1826
1865
|
}
|
|
1827
|
-
}
|
|
1866
|
+
}
|
|
1867
|
+
const openBrackets = (line.match(/\[/g) || []).length;
|
|
1868
|
+
const closeBrackets = (line.match(/\]/g) || []).length;
|
|
1869
|
+
if (closeBraces > openBraces) {
|
|
1828
1870
|
for (let i = 0; i < closeBraces - openBraces; i++) {
|
|
1829
1871
|
contextStack.pop();
|
|
1830
1872
|
}
|
|
1831
1873
|
}
|
|
1874
|
+
if (closeBrackets > openBrackets) {
|
|
1875
|
+
for (let i = 0; i < closeBrackets - openBrackets; i++) {
|
|
1876
|
+
const popped = contextStack.pop();
|
|
1877
|
+
if (popped?.isArray) {
|
|
1878
|
+
const depth = contextStack.length;
|
|
1879
|
+
delete arrayObjectCount[depth];
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1832
1883
|
}
|
|
1833
1884
|
function setCommentAtPath(comments, path19, key, hint) {
|
|
1834
1885
|
let current = comments;
|
|
@@ -8211,7 +8262,7 @@ var path13 = {
|
|
|
8211
8262
|
};
|
|
8212
8263
|
var sep = defaultPlatform === "win32" ? path13.win32.sep : path13.posix.sep;
|
|
8213
8264
|
minimatch.sep = sep;
|
|
8214
|
-
var GLOBSTAR = Symbol("globstar **");
|
|
8265
|
+
var GLOBSTAR = /* @__PURE__ */ Symbol("globstar **");
|
|
8215
8266
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
8216
8267
|
var qmark2 = "[^/]";
|
|
8217
8268
|
var star2 = qmark2 + "*?";
|
|
@@ -14718,7 +14769,7 @@ async function renderHero2() {
|
|
|
14718
14769
|
// package.json
|
|
14719
14770
|
var package_default = {
|
|
14720
14771
|
name: "lingo.dev",
|
|
14721
|
-
version: "0.117.
|
|
14772
|
+
version: "0.117.23",
|
|
14722
14773
|
description: "Lingo.dev CLI",
|
|
14723
14774
|
private: false,
|
|
14724
14775
|
repository: {
|