lingo.dev 0.112.1 → 0.113.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/build/cli.cjs +304 -155
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +211 -62
- package/build/cli.mjs.map +1 -1
- package/package.json +3 -3
package/build/cli.cjs
CHANGED
|
@@ -22,17 +22,17 @@ function getSettings(explicitApiKey) {
|
|
|
22
22
|
_envVarsInfo();
|
|
23
23
|
return {
|
|
24
24
|
auth: {
|
|
25
|
-
apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access',
|
|
26
|
-
apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access',
|
|
27
|
-
webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access',
|
|
25
|
+
apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access', _37 => _37.auth, 'optionalAccess', _38 => _38.apiKey]) || defaults2.auth.apiKey,
|
|
26
|
+
apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _39 => _39.auth, 'optionalAccess', _40 => _40.apiUrl]) || defaults2.auth.apiUrl,
|
|
27
|
+
webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _41 => _41.auth, 'optionalAccess', _42 => _42.webUrl]) || defaults2.auth.webUrl
|
|
28
28
|
},
|
|
29
29
|
llm: {
|
|
30
|
-
openaiApiKey: env.OPENAI_API_KEY || _optionalChain([systemFile, 'access',
|
|
31
|
-
anthropicApiKey: env.ANTHROPIC_API_KEY || _optionalChain([systemFile, 'access',
|
|
32
|
-
groqApiKey: env.GROQ_API_KEY || _optionalChain([systemFile, 'access',
|
|
33
|
-
googleApiKey: env.GOOGLE_API_KEY || _optionalChain([systemFile, 'access',
|
|
34
|
-
openrouterApiKey: env.OPENROUTER_API_KEY || _optionalChain([systemFile, 'access',
|
|
35
|
-
mistralApiKey: env.MISTRAL_API_KEY || _optionalChain([systemFile, 'access',
|
|
30
|
+
openaiApiKey: env.OPENAI_API_KEY || _optionalChain([systemFile, 'access', _43 => _43.llm, 'optionalAccess', _44 => _44.openaiApiKey]),
|
|
31
|
+
anthropicApiKey: env.ANTHROPIC_API_KEY || _optionalChain([systemFile, 'access', _45 => _45.llm, 'optionalAccess', _46 => _46.anthropicApiKey]),
|
|
32
|
+
groqApiKey: env.GROQ_API_KEY || _optionalChain([systemFile, 'access', _47 => _47.llm, 'optionalAccess', _48 => _48.groqApiKey]),
|
|
33
|
+
googleApiKey: env.GOOGLE_API_KEY || _optionalChain([systemFile, 'access', _49 => _49.llm, 'optionalAccess', _50 => _50.googleApiKey]),
|
|
34
|
+
openrouterApiKey: env.OPENROUTER_API_KEY || _optionalChain([systemFile, 'access', _51 => _51.llm, 'optionalAccess', _52 => _52.openrouterApiKey]),
|
|
35
|
+
mistralApiKey: env.MISTRAL_API_KEY || _optionalChain([systemFile, 'access', _53 => _53.llm, 'optionalAccess', _54 => _54.mistralApiKey])
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
}
|
|
@@ -141,43 +141,43 @@ Please use LINGODOTDEV_API_KEY instead.
|
|
|
141
141
|
function _envVarsInfo() {
|
|
142
142
|
const env = _loadEnv();
|
|
143
143
|
const systemFile = _loadSystemFile();
|
|
144
|
-
if (env.LINGODOTDEV_API_KEY && _optionalChain([systemFile, 'access',
|
|
144
|
+
if (env.LINGODOTDEV_API_KEY && _optionalChain([systemFile, 'access', _55 => _55.auth, 'optionalAccess', _56 => _56.apiKey])) {
|
|
145
145
|
console.info(
|
|
146
146
|
"\x1B[36m%s\x1B[0m",
|
|
147
147
|
`\u2139\uFE0F Using LINGODOTDEV_API_KEY env var instead of credentials from user config`
|
|
148
148
|
);
|
|
149
149
|
}
|
|
150
|
-
if (env.OPENAI_API_KEY && _optionalChain([systemFile, 'access',
|
|
150
|
+
if (env.OPENAI_API_KEY && _optionalChain([systemFile, 'access', _57 => _57.llm, 'optionalAccess', _58 => _58.openaiApiKey])) {
|
|
151
151
|
console.info(
|
|
152
152
|
"\x1B[36m%s\x1B[0m",
|
|
153
153
|
`\u2139\uFE0F Using OPENAI_API_KEY env var instead of key from user config.`
|
|
154
154
|
);
|
|
155
155
|
}
|
|
156
|
-
if (env.ANTHROPIC_API_KEY && _optionalChain([systemFile, 'access',
|
|
156
|
+
if (env.ANTHROPIC_API_KEY && _optionalChain([systemFile, 'access', _59 => _59.llm, 'optionalAccess', _60 => _60.anthropicApiKey])) {
|
|
157
157
|
console.info(
|
|
158
158
|
"\x1B[36m%s\x1B[0m",
|
|
159
159
|
`\u2139\uFE0F Using ANTHROPIC_API_KEY env var instead of key from user config`
|
|
160
160
|
);
|
|
161
161
|
}
|
|
162
|
-
if (env.GROQ_API_KEY && _optionalChain([systemFile, 'access',
|
|
162
|
+
if (env.GROQ_API_KEY && _optionalChain([systemFile, 'access', _61 => _61.llm, 'optionalAccess', _62 => _62.groqApiKey])) {
|
|
163
163
|
console.info(
|
|
164
164
|
"\x1B[36m%s\x1B[0m",
|
|
165
165
|
`\u2139\uFE0F Using GROQ_API_KEY env var instead of key from user config`
|
|
166
166
|
);
|
|
167
167
|
}
|
|
168
|
-
if (env.GOOGLE_API_KEY && _optionalChain([systemFile, 'access',
|
|
168
|
+
if (env.GOOGLE_API_KEY && _optionalChain([systemFile, 'access', _63 => _63.llm, 'optionalAccess', _64 => _64.googleApiKey])) {
|
|
169
169
|
console.info(
|
|
170
170
|
"\x1B[36m%s\x1B[0m",
|
|
171
171
|
`\u2139\uFE0F Using GOOGLE_API_KEY env var instead of key from user config`
|
|
172
172
|
);
|
|
173
173
|
}
|
|
174
|
-
if (env.OPENROUTER_API_KEY && _optionalChain([systemFile, 'access',
|
|
174
|
+
if (env.OPENROUTER_API_KEY && _optionalChain([systemFile, 'access', _65 => _65.llm, 'optionalAccess', _66 => _66.openrouterApiKey])) {
|
|
175
175
|
console.info(
|
|
176
176
|
"\x1B[36m%s\x1B[0m",
|
|
177
177
|
`\u2139\uFE0F Using OPENROUTER_API_KEY env var instead of key from user config`
|
|
178
178
|
);
|
|
179
179
|
}
|
|
180
|
-
if (env.MISTRAL_API_KEY && _optionalChain([systemFile, 'access',
|
|
180
|
+
if (env.MISTRAL_API_KEY && _optionalChain([systemFile, 'access', _67 => _67.llm, 'optionalAccess', _68 => _68.mistralApiKey])) {
|
|
181
181
|
console.info(
|
|
182
182
|
"\x1B[36m%s\x1B[0m",
|
|
183
183
|
`\u2139\uFE0F Using MISTRAL_API_KEY env var instead of key from user config`
|
|
@@ -254,10 +254,10 @@ var LocalizationError = (_class5 = class extends Error {
|
|
|
254
254
|
constructor(message, context) {
|
|
255
255
|
super(message);_class5.prototype.__init5.call(this);;
|
|
256
256
|
this.name = "LocalizationError";
|
|
257
|
-
this.bucket = _optionalChain([context, 'optionalAccess',
|
|
258
|
-
this.sourceLocale = _optionalChain([context, 'optionalAccess',
|
|
259
|
-
this.targetLocale = _optionalChain([context, 'optionalAccess',
|
|
260
|
-
this.pathPattern = _optionalChain([context, 'optionalAccess',
|
|
257
|
+
this.bucket = _optionalChain([context, 'optionalAccess', _69 => _69.bucket]);
|
|
258
|
+
this.sourceLocale = _optionalChain([context, 'optionalAccess', _70 => _70.sourceLocale]);
|
|
259
|
+
this.targetLocale = _optionalChain([context, 'optionalAccess', _71 => _71.targetLocale]);
|
|
260
|
+
this.pathPattern = _optionalChain([context, 'optionalAccess', _72 => _72.pathPattern]);
|
|
261
261
|
}
|
|
262
262
|
}, _class5);
|
|
263
263
|
var BucketProcessingError = (_class6 = class extends Error {
|
|
@@ -393,7 +393,7 @@ function createAuthenticator(params) {
|
|
|
393
393
|
});
|
|
394
394
|
if (res.ok) {
|
|
395
395
|
const payload = await res.json();
|
|
396
|
-
if (!_optionalChain([payload, 'optionalAccess',
|
|
396
|
+
if (!_optionalChain([payload, 'optionalAccess', _73 => _73.email])) {
|
|
397
397
|
return null;
|
|
398
398
|
}
|
|
399
399
|
return {
|
|
@@ -588,7 +588,7 @@ async function renderSummary(results) {
|
|
|
588
588
|
if (succeededResults.length > 0) {
|
|
589
589
|
console.log(_chalk2.default.hex(colors.green)("\n[Processed Files]"));
|
|
590
590
|
for (const result of succeededResults) {
|
|
591
|
-
const displayPath = _optionalChain([result, 'access',
|
|
591
|
+
const displayPath = _optionalChain([result, 'access', _74 => _74.pathPattern, 'optionalAccess', _75 => _75.replace, 'call', _76 => _76("[locale]", result.targetLocale)]) || "unknown";
|
|
592
592
|
console.log(
|
|
593
593
|
` \u2713 ${_chalk2.default.dim(displayPath)} ${_chalk2.default.hex(colors.yellow)(`(${result.sourceLocale} \u2192 ${result.targetLocale})`)}`
|
|
594
594
|
);
|
|
@@ -597,7 +597,7 @@ async function renderSummary(results) {
|
|
|
597
597
|
if (skippedResults.length > 0) {
|
|
598
598
|
console.log(_chalk2.default.hex(colors.blue)("\n[Cached Files]"));
|
|
599
599
|
for (const result of skippedResults) {
|
|
600
|
-
const displayPath = _optionalChain([result, 'access',
|
|
600
|
+
const displayPath = _optionalChain([result, 'access', _77 => _77.pathPattern, 'optionalAccess', _78 => _78.replace, 'call', _79 => _79("[locale]", result.targetLocale)]) || "unknown";
|
|
601
601
|
console.log(
|
|
602
602
|
` \u26A1 ${_chalk2.default.dim(displayPath)} ${_chalk2.default.hex(colors.yellow)(`(${result.sourceLocale} \u2192 ${result.targetLocale})`)}`
|
|
603
603
|
);
|
|
@@ -606,12 +606,12 @@ async function renderSummary(results) {
|
|
|
606
606
|
if (failedResults.length > 0) {
|
|
607
607
|
console.log(_chalk2.default.hex(colors.orange)("\n[Failed Files]"));
|
|
608
608
|
for (const result of failedResults) {
|
|
609
|
-
const displayPath = _optionalChain([result, 'access',
|
|
609
|
+
const displayPath = _optionalChain([result, 'access', _80 => _80.pathPattern, 'optionalAccess', _81 => _81.replace, 'call', _82 => _82("[locale]", result.targetLocale)]) || "unknown";
|
|
610
610
|
console.log(
|
|
611
611
|
` \u274C ${_chalk2.default.dim(displayPath)} ${_chalk2.default.hex(colors.yellow)(`(${result.sourceLocale} \u2192 ${result.targetLocale})`)}`
|
|
612
612
|
);
|
|
613
613
|
console.log(
|
|
614
|
-
` ${_chalk2.default.hex(colors.white)(String(_optionalChain([result, 'access',
|
|
614
|
+
` ${_chalk2.default.hex(colors.white)(String(_optionalChain([result, 'access', _83 => _83.error, 'optionalAccess', _84 => _84.message]) || "Unknown error"))}`
|
|
615
615
|
);
|
|
616
616
|
}
|
|
617
617
|
}
|
|
@@ -1257,7 +1257,7 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
|
|
|
1257
1257
|
});
|
|
1258
1258
|
const auth2 = await newAuthenticator.whoami();
|
|
1259
1259
|
if (auth2) {
|
|
1260
|
-
_ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess',
|
|
1260
|
+
_ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _85 => _85.email])}`);
|
|
1261
1261
|
} else {
|
|
1262
1262
|
_ora2.default.call(void 0, ).fail("Authentication failed.");
|
|
1263
1263
|
}
|
|
@@ -1347,7 +1347,7 @@ function getBuckets(i18nConfig) {
|
|
|
1347
1347
|
const includeItems = bucketEntry.include.map(
|
|
1348
1348
|
(item) => resolveBucketItem(item)
|
|
1349
1349
|
);
|
|
1350
|
-
const excludeItems = _optionalChain([bucketEntry, 'access',
|
|
1350
|
+
const excludeItems = _optionalChain([bucketEntry, 'access', _86 => _86.exclude, 'optionalAccess', _87 => _87.map, 'call', _88 => _88(
|
|
1351
1351
|
(item) => resolveBucketItem(item)
|
|
1352
1352
|
)]);
|
|
1353
1353
|
const config = {
|
|
@@ -1385,7 +1385,7 @@ function extractPathPatterns(sourceLocale, include, exclude) {
|
|
|
1385
1385
|
delimiter: pattern.delimiter
|
|
1386
1386
|
}))
|
|
1387
1387
|
);
|
|
1388
|
-
const excludedPatterns = _optionalChain([exclude, 'optionalAccess',
|
|
1388
|
+
const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _89 => _89.flatMap, 'call', _90 => _90(
|
|
1389
1389
|
(pattern) => expandPlaceholderedGlob(
|
|
1390
1390
|
pattern.path,
|
|
1391
1391
|
__spec.resolveOverriddenLocale.call(void 0, sourceLocale, pattern.delimiter)
|
|
@@ -1551,12 +1551,12 @@ function composeLoaders(...loaders) {
|
|
|
1551
1551
|
return {
|
|
1552
1552
|
init: async () => {
|
|
1553
1553
|
for (const loader of loaders) {
|
|
1554
|
-
await _optionalChain([loader, 'access',
|
|
1554
|
+
await _optionalChain([loader, 'access', _91 => _91.init, 'optionalCall', _92 => _92()]);
|
|
1555
1555
|
}
|
|
1556
1556
|
},
|
|
1557
1557
|
setDefaultLocale(locale) {
|
|
1558
1558
|
for (const loader of loaders) {
|
|
1559
|
-
_optionalChain([loader, 'access',
|
|
1559
|
+
_optionalChain([loader, 'access', _93 => _93.setDefaultLocale, 'optionalCall', _94 => _94(locale)]);
|
|
1560
1560
|
}
|
|
1561
1561
|
return this;
|
|
1562
1562
|
},
|
|
@@ -1577,7 +1577,7 @@ function composeLoaders(...loaders) {
|
|
|
1577
1577
|
pullHints: async (originalInput) => {
|
|
1578
1578
|
let result = originalInput;
|
|
1579
1579
|
for (let i = 0; i < loaders.length; i++) {
|
|
1580
|
-
const subResult = await _optionalChain([loaders, 'access',
|
|
1580
|
+
const subResult = await _optionalChain([loaders, 'access', _95 => _95[i], 'access', _96 => _96.pullHints, 'optionalCall', _97 => _97(result)]);
|
|
1581
1581
|
if (subResult) {
|
|
1582
1582
|
result = subResult;
|
|
1583
1583
|
}
|
|
@@ -1599,7 +1599,7 @@ function createLoader(lDefinition) {
|
|
|
1599
1599
|
if (state.initCtx) {
|
|
1600
1600
|
return state.initCtx;
|
|
1601
1601
|
}
|
|
1602
|
-
state.initCtx = await _optionalChain([lDefinition, 'access',
|
|
1602
|
+
state.initCtx = await _optionalChain([lDefinition, 'access', _98 => _98.init, 'optionalCall', _99 => _99()]);
|
|
1603
1603
|
return state.initCtx;
|
|
1604
1604
|
},
|
|
1605
1605
|
setDefaultLocale(locale) {
|
|
@@ -1610,7 +1610,7 @@ function createLoader(lDefinition) {
|
|
|
1610
1610
|
return this;
|
|
1611
1611
|
},
|
|
1612
1612
|
async pullHints() {
|
|
1613
|
-
return _optionalChain([lDefinition, 'access',
|
|
1613
|
+
return _optionalChain([lDefinition, 'access', _100 => _100.pullHints, 'optionalCall', _101 => _101(state.originalInput)]);
|
|
1614
1614
|
},
|
|
1615
1615
|
async pull(locale, input2) {
|
|
1616
1616
|
if (!state.defaultLocale) {
|
|
@@ -1915,7 +1915,7 @@ function createNormalizeLoader() {
|
|
|
1915
1915
|
return normalized;
|
|
1916
1916
|
},
|
|
1917
1917
|
push: async (locale, data, originalInput) => {
|
|
1918
|
-
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess',
|
|
1918
|
+
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _102 => _102.keysMap]), () => ( {}));
|
|
1919
1919
|
const input2 = mapDenormalizedKeys(data, keysMap);
|
|
1920
1920
|
const denormalized = _flat.unflatten.call(void 0, input2, {
|
|
1921
1921
|
delimiter: "/",
|
|
@@ -2016,7 +2016,7 @@ function createTextFileLoader(pathPattern) {
|
|
|
2016
2016
|
const trimmedResult = result.trim();
|
|
2017
2017
|
return trimmedResult;
|
|
2018
2018
|
},
|
|
2019
|
-
async push(locale, data,
|
|
2019
|
+
async push(locale, data, _36, originalLocale) {
|
|
2020
2020
|
const draftPath = pathPattern.replaceAll("[locale]", locale);
|
|
2021
2021
|
const finalPath = path14.default.resolve(draftPath);
|
|
2022
2022
|
const dirPath = path14.default.dirname(finalPath);
|
|
@@ -2049,8 +2049,8 @@ async function getTrailingNewLine(pathPattern, locale, originalLocale) {
|
|
|
2049
2049
|
if (!templateData) {
|
|
2050
2050
|
templateData = await readFileForLocale(pathPattern, originalLocale);
|
|
2051
2051
|
}
|
|
2052
|
-
if (_optionalChain([templateData, 'optionalAccess',
|
|
2053
|
-
const ending = _optionalChain([templateData, 'optionalAccess',
|
|
2052
|
+
if (_optionalChain([templateData, 'optionalAccess', _103 => _103.match, 'call', _104 => _104(/[\r\n]$/)])) {
|
|
2053
|
+
const ending = _optionalChain([templateData, 'optionalAccess', _105 => _105.includes, 'call', _106 => _106("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _107 => _107.includes, 'call', _108 => _108("\r")]) ? "\r" : "\n";
|
|
2054
2054
|
return ending;
|
|
2055
2055
|
}
|
|
2056
2056
|
return "";
|
|
@@ -2321,7 +2321,7 @@ var _sync3 = require('csv-stringify/sync');
|
|
|
2321
2321
|
|
|
2322
2322
|
function detectKeyColumnName(csvString) {
|
|
2323
2323
|
const row = _sync.parse.call(void 0, csvString)[0];
|
|
2324
|
-
const firstColumn = _optionalChain([row, 'optionalAccess',
|
|
2324
|
+
const firstColumn = _optionalChain([row, 'optionalAccess', _109 => _109[0], 'optionalAccess', _110 => _110.trim, 'call', _111 => _111()]);
|
|
2325
2325
|
return firstColumn || "KEY";
|
|
2326
2326
|
}
|
|
2327
2327
|
function createCsvLoader() {
|
|
@@ -2423,7 +2423,7 @@ function createHtmlLoader() {
|
|
|
2423
2423
|
break;
|
|
2424
2424
|
}
|
|
2425
2425
|
const siblings = Array.from(parent.childNodes).filter(
|
|
2426
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2426
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _112 => _112.textContent, 'optionalAccess', _113 => _113.trim, 'call', _114 => _114()])
|
|
2427
2427
|
);
|
|
2428
2428
|
const index = siblings.indexOf(current);
|
|
2429
2429
|
if (index !== -1) {
|
|
@@ -2459,15 +2459,15 @@ function createHtmlLoader() {
|
|
|
2459
2459
|
}
|
|
2460
2460
|
});
|
|
2461
2461
|
Array.from(element.childNodes).filter(
|
|
2462
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2462
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _115 => _115.textContent, 'optionalAccess', _116 => _116.trim, 'call', _117 => _117()])
|
|
2463
2463
|
).forEach(processNode);
|
|
2464
2464
|
}
|
|
2465
2465
|
};
|
|
2466
2466
|
Array.from(document.head.childNodes).filter(
|
|
2467
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2467
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _118 => _118.textContent, 'optionalAccess', _119 => _119.trim, 'call', _120 => _120()])
|
|
2468
2468
|
).forEach(processNode);
|
|
2469
2469
|
Array.from(document.body.childNodes).filter(
|
|
2470
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2470
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _121 => _121.textContent, 'optionalAccess', _122 => _122.trim, 'call', _123 => _123()])
|
|
2471
2471
|
).forEach(processNode);
|
|
2472
2472
|
return result;
|
|
2473
2473
|
},
|
|
@@ -2492,7 +2492,7 @@ function createHtmlLoader() {
|
|
|
2492
2492
|
for (let i = 0; i < indices.length; i++) {
|
|
2493
2493
|
const index = parseInt(indices[i]);
|
|
2494
2494
|
const siblings = Array.from(parent.childNodes).filter(
|
|
2495
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2495
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _124 => _124.textContent, 'optionalAccess', _125 => _125.trim, 'call', _126 => _126()])
|
|
2496
2496
|
);
|
|
2497
2497
|
if (index >= siblings.length) {
|
|
2498
2498
|
if (i === indices.length - 1) {
|
|
@@ -2543,7 +2543,7 @@ function createMarkdownLoader() {
|
|
|
2543
2543
|
yaml: yamlEngine
|
|
2544
2544
|
}
|
|
2545
2545
|
});
|
|
2546
|
-
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess',
|
|
2546
|
+
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _127 => _127.trim, 'call', _128 => _128()]), () => ( ""))).filter(Boolean);
|
|
2547
2547
|
return {
|
|
2548
2548
|
...Object.fromEntries(
|
|
2549
2549
|
sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
|
|
@@ -2562,7 +2562,7 @@ function createMarkdownLoader() {
|
|
|
2562
2562
|
);
|
|
2563
2563
|
let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(
|
|
2564
2564
|
([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())
|
|
2565
|
-
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess',
|
|
2565
|
+
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _129 => _129.trim, 'call', _130 => _130()]), () => ( ""))).filter(Boolean).join("\n\n");
|
|
2566
2566
|
if (Object.keys(frontmatter).length > 0) {
|
|
2567
2567
|
content = `
|
|
2568
2568
|
${content}`;
|
|
@@ -2587,7 +2587,7 @@ function createMarkdocLoader() {
|
|
|
2587
2587
|
const result = {};
|
|
2588
2588
|
const counters = {};
|
|
2589
2589
|
traverseAndExtract(ast, "", result, counters);
|
|
2590
|
-
if (_optionalChain([ast, 'access',
|
|
2590
|
+
if (_optionalChain([ast, 'access', _131 => _131.attributes, 'optionalAccess', _132 => _132.frontmatter])) {
|
|
2591
2591
|
const frontmatter = _yaml2.default.parse(ast.attributes.frontmatter);
|
|
2592
2592
|
Object.entries(frontmatter).forEach(([key, value]) => {
|
|
2593
2593
|
if (typeof value === "string") {
|
|
@@ -2633,7 +2633,7 @@ function traverseAndExtract(node, path19, result, counters, parentType) {
|
|
|
2633
2633
|
if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
|
|
2634
2634
|
semanticType = nodeSemanticType;
|
|
2635
2635
|
}
|
|
2636
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
2636
|
+
if (node.type === "text" && _optionalChain([node, 'access', _133 => _133.attributes, 'optionalAccess', _134 => _134.content])) {
|
|
2637
2637
|
const content = node.attributes.content;
|
|
2638
2638
|
if (typeof content === "string" && content.trim()) {
|
|
2639
2639
|
if (semanticType) {
|
|
@@ -2660,7 +2660,7 @@ function buildPathMap(node, path19, counters, pathMap, parentType) {
|
|
|
2660
2660
|
if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
|
|
2661
2661
|
semanticType = nodeSemanticType;
|
|
2662
2662
|
}
|
|
2663
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
2663
|
+
if (node.type === "text" && _optionalChain([node, 'access', _135 => _135.attributes, 'optionalAccess', _136 => _136.content])) {
|
|
2664
2664
|
const content = node.attributes.content;
|
|
2665
2665
|
if (typeof content === "string" && content.trim()) {
|
|
2666
2666
|
if (semanticType) {
|
|
@@ -2683,7 +2683,7 @@ function applyTranslations(node, path19, data, pathMap) {
|
|
|
2683
2683
|
if (!node || typeof node !== "object") {
|
|
2684
2684
|
return;
|
|
2685
2685
|
}
|
|
2686
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
2686
|
+
if (node.type === "text" && _optionalChain([node, 'access', _137 => _137.attributes, 'optionalAccess', _138 => _138.content])) {
|
|
2687
2687
|
const content = node.attributes.content;
|
|
2688
2688
|
if (typeof content === "string") {
|
|
2689
2689
|
const contentPath = path19 ? `${path19}/attributes/content` : "attributes/content";
|
|
@@ -2722,7 +2722,7 @@ function createPropertiesLoader() {
|
|
|
2722
2722
|
return result;
|
|
2723
2723
|
},
|
|
2724
2724
|
async push(locale, payload) {
|
|
2725
|
-
const result = Object.entries(payload).filter(([
|
|
2725
|
+
const result = Object.entries(payload).filter(([_36, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
|
|
2726
2726
|
return result;
|
|
2727
2727
|
}
|
|
2728
2728
|
});
|
|
@@ -2733,7 +2733,7 @@ function isSkippableLine(line) {
|
|
|
2733
2733
|
function parsePropertyLine(line) {
|
|
2734
2734
|
const [key, ...valueParts] = line.split("=");
|
|
2735
2735
|
return {
|
|
2736
|
-
key: _optionalChain([key, 'optionalAccess',
|
|
2736
|
+
key: _optionalChain([key, 'optionalAccess', _139 => _139.trim, 'call', _140 => _140()]) || "",
|
|
2737
2737
|
value: valueParts.join("=").trim()
|
|
2738
2738
|
};
|
|
2739
2739
|
}
|
|
@@ -2821,7 +2821,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
2821
2821
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
2822
2822
|
continue;
|
|
2823
2823
|
}
|
|
2824
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
2824
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _141 => _141.localizations, 'optionalAccess', _142 => _142[locale]]);
|
|
2825
2825
|
if (langTranslationEntity) {
|
|
2826
2826
|
if ("stringUnit" in langTranslationEntity) {
|
|
2827
2827
|
resultData[translationKey] = langTranslationEntity.stringUnit.value;
|
|
@@ -2830,7 +2830,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
2830
2830
|
resultData[translationKey] = {};
|
|
2831
2831
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
2832
2832
|
for (const form in pluralForms) {
|
|
2833
|
-
if (_optionalChain([pluralForms, 'access',
|
|
2833
|
+
if (_optionalChain([pluralForms, 'access', _143 => _143[form], 'optionalAccess', _144 => _144.stringUnit, 'optionalAccess', _145 => _145.value])) {
|
|
2834
2834
|
resultData[translationKey][form] = pluralForms[form].stringUnit.value;
|
|
2835
2835
|
}
|
|
2836
2836
|
}
|
|
@@ -2856,7 +2856,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
2856
2856
|
const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
|
|
2857
2857
|
if (typeof value === "string") {
|
|
2858
2858
|
langDataToMerge.strings[key] = {
|
|
2859
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
2859
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _146 => _146.strings, 'optionalAccess', _147 => _147[key], 'optionalAccess', _148 => _148.extractionState]),
|
|
2860
2860
|
localizations: {
|
|
2861
2861
|
[locale]: {
|
|
2862
2862
|
stringUnit: {
|
|
@@ -2914,7 +2914,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
2914
2914
|
for (const [locale, localization] of Object.entries(
|
|
2915
2915
|
entity.localizations
|
|
2916
2916
|
)) {
|
|
2917
|
-
if (_optionalChain([localization, 'access',
|
|
2917
|
+
if (_optionalChain([localization, 'access', _149 => _149.variations, 'optionalAccess', _150 => _150.plural])) {
|
|
2918
2918
|
const pluralForms = localization.variations.plural;
|
|
2919
2919
|
for (const form in pluralForms) {
|
|
2920
2920
|
const pluralKey = `${translationKey}/${form}`;
|
|
@@ -2934,7 +2934,7 @@ function _removeLocale(input2, locale) {
|
|
|
2934
2934
|
const { strings } = input2;
|
|
2935
2935
|
const newStrings = _lodash2.default.cloneDeep(strings);
|
|
2936
2936
|
for (const [key, value] of Object.entries(newStrings)) {
|
|
2937
|
-
if (_optionalChain([value, 'access',
|
|
2937
|
+
if (_optionalChain([value, 'access', _151 => _151.localizations, 'optionalAccess', _152 => _152[locale]])) {
|
|
2938
2938
|
delete value.localizations[locale];
|
|
2939
2939
|
}
|
|
2940
2940
|
}
|
|
@@ -2951,12 +2951,12 @@ function createUnlocalizableLoader(returnUnlocalizedKeys = false) {
|
|
|
2951
2951
|
const unlocalizableKeys = _getUnlocalizableKeys(input2);
|
|
2952
2952
|
const result = _lodash2.default.omitBy(
|
|
2953
2953
|
input2,
|
|
2954
|
-
(
|
|
2954
|
+
(_36, key) => unlocalizableKeys.includes(key)
|
|
2955
2955
|
);
|
|
2956
2956
|
if (returnUnlocalizedKeys) {
|
|
2957
2957
|
result.unlocalizable = _lodash2.default.omitBy(
|
|
2958
2958
|
input2,
|
|
2959
|
-
(
|
|
2959
|
+
(_36, key) => !unlocalizableKeys.includes(key)
|
|
2960
2960
|
);
|
|
2961
2961
|
}
|
|
2962
2962
|
return result;
|
|
@@ -2966,7 +2966,7 @@ function createUnlocalizableLoader(returnUnlocalizedKeys = false) {
|
|
|
2966
2966
|
const result = _lodash2.default.merge(
|
|
2967
2967
|
{},
|
|
2968
2968
|
data,
|
|
2969
|
-
_lodash2.default.omitBy(originalInput, (
|
|
2969
|
+
_lodash2.default.omitBy(originalInput, (_36, key) => !unlocalizableKeys.includes(key))
|
|
2970
2970
|
);
|
|
2971
2971
|
return result;
|
|
2972
2972
|
}
|
|
@@ -2997,7 +2997,7 @@ function _getUnlocalizableKeys(input2) {
|
|
|
2997
2997
|
}
|
|
2998
2998
|
}
|
|
2999
2999
|
return false;
|
|
3000
|
-
}).map(([key,
|
|
3000
|
+
}).map(([key, _36]) => key);
|
|
3001
3001
|
}
|
|
3002
3002
|
|
|
3003
3003
|
// src/cli/loaders/formatters/prettier.ts
|
|
@@ -3137,8 +3137,8 @@ async function formatDataWithBiome(data, filePath, options) {
|
|
|
3137
3137
|
});
|
|
3138
3138
|
return formatted.content;
|
|
3139
3139
|
} catch (error) {
|
|
3140
|
-
const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access',
|
|
3141
|
-
if (_optionalChain([errorMessage, 'optionalAccess',
|
|
3140
|
+
const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access', _153 => _153.stackTrace, 'optionalAccess', _154 => _154.toString, 'call', _155 => _155(), 'access', _156 => _156.split, 'call', _157 => _157("\n"), 'access', _158 => _158[0]]) : "";
|
|
3141
|
+
if (_optionalChain([errorMessage, 'optionalAccess', _159 => _159.includes, 'call', _160 => _160("does not exist in the workspace")])) {
|
|
3142
3142
|
} else {
|
|
3143
3143
|
console.log(`\u26A0\uFE0F Biome skipped ${path14.default.basename(filePath)}`);
|
|
3144
3144
|
if (errorMessage) {
|
|
@@ -3185,7 +3185,7 @@ function createPoDataLoader(params) {
|
|
|
3185
3185
|
Object.entries(entries).forEach(([msgid, entry]) => {
|
|
3186
3186
|
if (msgid && entry.msgid) {
|
|
3187
3187
|
const context = entry.msgctxt || "";
|
|
3188
|
-
const fullEntry = _optionalChain([parsedPo, 'access',
|
|
3188
|
+
const fullEntry = _optionalChain([parsedPo, 'access', _161 => _161.translations, 'access', _162 => _162[context], 'optionalAccess', _163 => _163[msgid]]);
|
|
3189
3189
|
if (fullEntry) {
|
|
3190
3190
|
result[msgid] = fullEntry;
|
|
3191
3191
|
}
|
|
@@ -3195,8 +3195,8 @@ function createPoDataLoader(params) {
|
|
|
3195
3195
|
return result;
|
|
3196
3196
|
},
|
|
3197
3197
|
async push(locale, data, originalInput, originalLocale, pullInput) {
|
|
3198
|
-
const currentSections = _optionalChain([pullInput, 'optionalAccess',
|
|
3199
|
-
const originalSections = _optionalChain([originalInput, 'optionalAccess',
|
|
3198
|
+
const currentSections = _optionalChain([pullInput, 'optionalAccess', _164 => _164.split, 'call', _165 => _165("\n\n"), 'access', _166 => _166.filter, 'call', _167 => _167(Boolean)]) || [];
|
|
3199
|
+
const originalSections = _optionalChain([originalInput, 'optionalAccess', _168 => _168.split, 'call', _169 => _169("\n\n"), 'access', _170 => _170.filter, 'call', _171 => _171(Boolean)]) || [];
|
|
3200
3200
|
const result = originalSections.map((section) => {
|
|
3201
3201
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
3202
3202
|
if (Object.keys(sectionPo.translations).length === 0) {
|
|
@@ -3265,8 +3265,8 @@ function createPoContentLoader() {
|
|
|
3265
3265
|
{
|
|
3266
3266
|
...entry,
|
|
3267
3267
|
msgstr: [
|
|
3268
|
-
_optionalChain([data, 'access',
|
|
3269
|
-
_optionalChain([data, 'access',
|
|
3268
|
+
_optionalChain([data, 'access', _172 => _172[entry.msgid], 'optionalAccess', _173 => _173.singular]),
|
|
3269
|
+
_optionalChain([data, 'access', _174 => _174[entry.msgid], 'optionalAccess', _175 => _175.plural]) || null
|
|
3270
3270
|
].filter(Boolean)
|
|
3271
3271
|
}
|
|
3272
3272
|
]).fromPairs().value();
|
|
@@ -3388,7 +3388,7 @@ function pullV1(xliffElement, locale, originalLocale) {
|
|
|
3388
3388
|
let key = getTransUnitKey(unit);
|
|
3389
3389
|
if (!key) return;
|
|
3390
3390
|
if (seenKeys.has(key)) {
|
|
3391
|
-
const id = _optionalChain([unit, 'access',
|
|
3391
|
+
const id = _optionalChain([unit, 'access', _176 => _176.getAttribute, 'call', _177 => _177("id"), 'optionalAccess', _178 => _178.trim, 'call', _179 => _179()]);
|
|
3392
3392
|
if (id) {
|
|
3393
3393
|
key = `${key}#${id}`;
|
|
3394
3394
|
} else {
|
|
@@ -3436,7 +3436,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
3436
3436
|
let key = getTransUnitKey(unit);
|
|
3437
3437
|
if (!key) return;
|
|
3438
3438
|
if (seenKeys.has(key)) {
|
|
3439
|
-
const id = _optionalChain([unit, 'access',
|
|
3439
|
+
const id = _optionalChain([unit, 'access', _180 => _180.getAttribute, 'call', _181 => _181("id"), 'optionalAccess', _182 => _182.trim, 'call', _183 => _183()]);
|
|
3440
3440
|
if (id) {
|
|
3441
3441
|
key = `${key}#${id}`;
|
|
3442
3442
|
} else {
|
|
@@ -3478,7 +3478,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
3478
3478
|
const translationKeys = new Set(Object.keys(translations));
|
|
3479
3479
|
existingUnits.forEach((unit, key) => {
|
|
3480
3480
|
if (!translationKeys.has(key)) {
|
|
3481
|
-
_optionalChain([unit, 'access',
|
|
3481
|
+
_optionalChain([unit, 'access', _184 => _184.parentNode, 'optionalAccess', _185 => _185.removeChild, 'call', _186 => _186(unit)]);
|
|
3482
3482
|
}
|
|
3483
3483
|
});
|
|
3484
3484
|
return serializeWithDeclaration(
|
|
@@ -3521,18 +3521,18 @@ function traverseUnitsV2(container, fileId, currentPath, result) {
|
|
|
3521
3521
|
Array.from(container.children).forEach((child) => {
|
|
3522
3522
|
const tagName = child.tagName;
|
|
3523
3523
|
if (tagName === "unit") {
|
|
3524
|
-
const unitId = _optionalChain([child, 'access',
|
|
3524
|
+
const unitId = _optionalChain([child, 'access', _187 => _187.getAttribute, 'call', _188 => _188("id"), 'optionalAccess', _189 => _189.trim, 'call', _190 => _190()]);
|
|
3525
3525
|
if (!unitId) return;
|
|
3526
3526
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
3527
3527
|
const segment = child.querySelector("segment");
|
|
3528
|
-
const source = _optionalChain([segment, 'optionalAccess',
|
|
3528
|
+
const source = _optionalChain([segment, 'optionalAccess', _191 => _191.querySelector, 'call', _192 => _192("source")]);
|
|
3529
3529
|
if (source) {
|
|
3530
3530
|
result[key] = extractTextContent(source);
|
|
3531
3531
|
} else {
|
|
3532
3532
|
result[key] = unitId;
|
|
3533
3533
|
}
|
|
3534
3534
|
} else if (tagName === "group") {
|
|
3535
|
-
const groupId = _optionalChain([child, 'access',
|
|
3535
|
+
const groupId = _optionalChain([child, 'access', _193 => _193.getAttribute, 'call', _194 => _194("id"), 'optionalAccess', _195 => _195.trim, 'call', _196 => _196()]);
|
|
3536
3536
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
3537
3537
|
traverseUnitsV2(child, fileId, newPath, result);
|
|
3538
3538
|
}
|
|
@@ -3568,12 +3568,12 @@ function indexUnitsV2(container, fileId, currentPath, index) {
|
|
|
3568
3568
|
Array.from(container.children).forEach((child) => {
|
|
3569
3569
|
const tagName = child.tagName;
|
|
3570
3570
|
if (tagName === "unit") {
|
|
3571
|
-
const unitId = _optionalChain([child, 'access',
|
|
3571
|
+
const unitId = _optionalChain([child, 'access', _197 => _197.getAttribute, 'call', _198 => _198("id"), 'optionalAccess', _199 => _199.trim, 'call', _200 => _200()]);
|
|
3572
3572
|
if (!unitId) return;
|
|
3573
3573
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
3574
3574
|
index.set(key, child);
|
|
3575
3575
|
} else if (tagName === "group") {
|
|
3576
|
-
const groupId = _optionalChain([child, 'access',
|
|
3576
|
+
const groupId = _optionalChain([child, 'access', _201 => _201.getAttribute, 'call', _202 => _202("id"), 'optionalAccess', _203 => _203.trim, 'call', _204 => _204()]);
|
|
3577
3577
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
3578
3578
|
indexUnitsV2(child, fileId, newPath, index);
|
|
3579
3579
|
}
|
|
@@ -3594,9 +3594,9 @@ function updateUnitV2(unit, value) {
|
|
|
3594
3594
|
setTextContent(source, value);
|
|
3595
3595
|
}
|
|
3596
3596
|
function getTransUnitKey(transUnit) {
|
|
3597
|
-
const resname = _optionalChain([transUnit, 'access',
|
|
3597
|
+
const resname = _optionalChain([transUnit, 'access', _205 => _205.getAttribute, 'call', _206 => _206("resname"), 'optionalAccess', _207 => _207.trim, 'call', _208 => _208()]);
|
|
3598
3598
|
if (resname) return resname;
|
|
3599
|
-
const id = _optionalChain([transUnit, 'access',
|
|
3599
|
+
const id = _optionalChain([transUnit, 'access', _209 => _209.getAttribute, 'call', _210 => _210("id"), 'optionalAccess', _211 => _211.trim, 'call', _212 => _212()]);
|
|
3600
3600
|
if (id) return id;
|
|
3601
3601
|
const sourceElement = transUnit.querySelector("source");
|
|
3602
3602
|
if (sourceElement) {
|
|
@@ -3653,7 +3653,7 @@ function formatXml(xml) {
|
|
|
3653
3653
|
if (cdataNode) {
|
|
3654
3654
|
return `${indent2}${openTag}<![CDATA[${cdataNode.nodeValue}]]></${tagName}>`;
|
|
3655
3655
|
}
|
|
3656
|
-
const textContent = _optionalChain([element, 'access',
|
|
3656
|
+
const textContent = _optionalChain([element, 'access', _213 => _213.textContent, 'optionalAccess', _214 => _214.trim, 'call', _215 => _215()]) || "";
|
|
3657
3657
|
const hasOnlyText = element.childNodes.length === 1 && element.childNodes[0].nodeType === 3;
|
|
3658
3658
|
if (hasOnlyText && textContent) {
|
|
3659
3659
|
return `${indent2}${openTag}${textContent}</${tagName}>`;
|
|
@@ -3946,7 +3946,7 @@ function createDatoClient(params) {
|
|
|
3946
3946
|
ids: !records.length ? void 0 : records.join(",")
|
|
3947
3947
|
}
|
|
3948
3948
|
}).catch(
|
|
3949
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
3949
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _216 => _216.response, 'optionalAccess', _217 => _217.body, 'optionalAccess', _218 => _218.data, 'optionalAccess', _219 => _219[0]]) || error)
|
|
3950
3950
|
);
|
|
3951
3951
|
},
|
|
3952
3952
|
findRecordsForModel: async (modelId, records) => {
|
|
@@ -3957,10 +3957,10 @@ function createDatoClient(params) {
|
|
|
3957
3957
|
filter: {
|
|
3958
3958
|
type: modelId,
|
|
3959
3959
|
only_valid: "true",
|
|
3960
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
3960
|
+
ids: !_optionalChain([records, 'optionalAccess', _220 => _220.length]) ? void 0 : records.join(",")
|
|
3961
3961
|
}
|
|
3962
3962
|
}).catch(
|
|
3963
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
3963
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _221 => _221.response, 'optionalAccess', _222 => _222.body, 'optionalAccess', _223 => _223.data, 'optionalAccess', _224 => _224[0]]) || error)
|
|
3964
3964
|
);
|
|
3965
3965
|
return result;
|
|
3966
3966
|
} catch (_error) {
|
|
@@ -3976,10 +3976,10 @@ function createDatoClient(params) {
|
|
|
3976
3976
|
updateRecord: async (id, payload) => {
|
|
3977
3977
|
try {
|
|
3978
3978
|
await dato.items.update(id, payload).catch(
|
|
3979
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
3979
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _225 => _225.response, 'optionalAccess', _226 => _226.body, 'optionalAccess', _227 => _227.data, 'optionalAccess', _228 => _228[0]]) || error)
|
|
3980
3980
|
);
|
|
3981
3981
|
} catch (_error) {
|
|
3982
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
3982
|
+
if (_optionalChain([_error, 'optionalAccess', _229 => _229.attributes, 'optionalAccess', _230 => _230.details, 'optionalAccess', _231 => _231.message])) {
|
|
3983
3983
|
throw new Error(
|
|
3984
3984
|
[
|
|
3985
3985
|
`${_error.attributes.details.message}`,
|
|
@@ -4001,10 +4001,10 @@ function createDatoClient(params) {
|
|
|
4001
4001
|
enableFieldLocalization: async (args) => {
|
|
4002
4002
|
try {
|
|
4003
4003
|
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch(
|
|
4004
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
4004
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _232 => _232.response, 'optionalAccess', _233 => _233.body, 'optionalAccess', _234 => _234.data, 'optionalAccess', _235 => _235[0]]) || error)
|
|
4005
4005
|
);
|
|
4006
4006
|
} catch (_error) {
|
|
4007
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
4007
|
+
if (_optionalChain([_error, 'optionalAccess', _236 => _236.attributes, 'optionalAccess', _237 => _237.code]) === "NOT_FOUND") {
|
|
4008
4008
|
throw new Error(
|
|
4009
4009
|
[
|
|
4010
4010
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -4012,7 +4012,7 @@ function createDatoClient(params) {
|
|
|
4012
4012
|
].join("\n\n")
|
|
4013
4013
|
);
|
|
4014
4014
|
}
|
|
4015
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
4015
|
+
if (_optionalChain([_error, 'optionalAccess', _238 => _238.attributes, 'optionalAccess', _239 => _239.details, 'optionalAccess', _240 => _240.message])) {
|
|
4016
4016
|
throw new Error(
|
|
4017
4017
|
[
|
|
4018
4018
|
`${_error.attributes.details.message}`,
|
|
@@ -4090,7 +4090,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
4090
4090
|
const records = await dato.findRecordsForModel(modelId);
|
|
4091
4091
|
const recordChoices = createRecordChoices(
|
|
4092
4092
|
records,
|
|
4093
|
-
_optionalChain([config, 'access',
|
|
4093
|
+
_optionalChain([config, 'access', _241 => _241.models, 'access', _242 => _242[modelId], 'optionalAccess', _243 => _243.records]) || [],
|
|
4094
4094
|
project
|
|
4095
4095
|
);
|
|
4096
4096
|
const selectedRecords = await promptRecordSelection(
|
|
@@ -4109,14 +4109,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
4109
4109
|
},
|
|
4110
4110
|
async pull(locale, input2, initCtx) {
|
|
4111
4111
|
const result = {};
|
|
4112
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
4113
|
-
let records = _optionalChain([initCtx, 'optionalAccess',
|
|
4112
|
+
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _244 => _244.models]) || {})) {
|
|
4113
|
+
let records = _optionalChain([initCtx, 'optionalAccess', _245 => _245.models, 'access', _246 => _246[modelId], 'access', _247 => _247.records]) || [];
|
|
4114
4114
|
const recordIds = records.map((record) => record.id);
|
|
4115
4115
|
records = await dato.findRecords(recordIds);
|
|
4116
4116
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
4117
4117
|
if (records.length > 0) {
|
|
4118
4118
|
result[modelId] = {
|
|
4119
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
4119
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _248 => _248.models, 'optionalAccess', _249 => _249[modelId], 'optionalAccess', _250 => _250.fields]) || [],
|
|
4120
4120
|
records
|
|
4121
4121
|
};
|
|
4122
4122
|
}
|
|
@@ -4179,7 +4179,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
4179
4179
|
return records.map((record) => ({
|
|
4180
4180
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
4181
4181
|
value: record.id,
|
|
4182
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
4182
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _251 => _251.includes, 'call', _252 => _252(record.id)])
|
|
4183
4183
|
}));
|
|
4184
4184
|
}
|
|
4185
4185
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -4498,7 +4498,7 @@ function createVttLoader() {
|
|
|
4498
4498
|
if (!input2) {
|
|
4499
4499
|
return "";
|
|
4500
4500
|
}
|
|
4501
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
4501
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _253 => _253.parse, 'call', _254 => _254(input2), 'optionalAccess', _255 => _255.cues]);
|
|
4502
4502
|
if (Object.keys(vtt).length === 0) {
|
|
4503
4503
|
return {};
|
|
4504
4504
|
} else {
|
|
@@ -4552,7 +4552,7 @@ function variableExtractLoader(params) {
|
|
|
4552
4552
|
for (let i = 0; i < matches.length; i++) {
|
|
4553
4553
|
const match2 = matches[i];
|
|
4554
4554
|
const currentValue = result[key].value;
|
|
4555
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
4555
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _256 => _256.replace, 'call', _257 => _257(match2, `{variable:${i}}`)]);
|
|
4556
4556
|
result[key].value = newValue;
|
|
4557
4557
|
result[key].variables[i] = match2;
|
|
4558
4558
|
}
|
|
@@ -4566,7 +4566,7 @@ function variableExtractLoader(params) {
|
|
|
4566
4566
|
for (let i = 0; i < valueObj.variables.length; i++) {
|
|
4567
4567
|
const variable = valueObj.variables[i];
|
|
4568
4568
|
const currentValue = result[key];
|
|
4569
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
4569
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _258 => _258.replace, 'call', _259 => _259(`{variable:${i}}`, variable)]);
|
|
4570
4570
|
result[key] = newValue;
|
|
4571
4571
|
}
|
|
4572
4572
|
}
|
|
@@ -4766,7 +4766,7 @@ function createVueJsonLoader() {
|
|
|
4766
4766
|
return createLoader({
|
|
4767
4767
|
pull: async (locale, input2, ctx) => {
|
|
4768
4768
|
const parsed = parseVueFile(input2);
|
|
4769
|
-
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess',
|
|
4769
|
+
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _260 => _260.i18n, 'optionalAccess', _261 => _261[locale]]), () => ( {}));
|
|
4770
4770
|
},
|
|
4771
4771
|
push: async (locale, data, originalInput) => {
|
|
4772
4772
|
const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
|
|
@@ -4951,7 +4951,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
|
|
|
4951
4951
|
objectExpression.properties.forEach((prop) => {
|
|
4952
4952
|
if (!t.isObjectProperty(prop)) return;
|
|
4953
4953
|
const key = getPropertyKey(prop);
|
|
4954
|
-
const incomingVal = _optionalChain([data, 'optionalAccess',
|
|
4954
|
+
const incomingVal = _optionalChain([data, 'optionalAccess', _262 => _262[key]]);
|
|
4955
4955
|
if (incomingVal === void 0) {
|
|
4956
4956
|
return;
|
|
4957
4957
|
}
|
|
@@ -4987,7 +4987,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
|
|
|
4987
4987
|
let modified = false;
|
|
4988
4988
|
arrayExpression.elements.forEach((element, index) => {
|
|
4989
4989
|
if (!element) return;
|
|
4990
|
-
const incomingVal = _optionalChain([incoming, 'optionalAccess',
|
|
4990
|
+
const incomingVal = _optionalChain([incoming, 'optionalAccess', _263 => _263[index]]);
|
|
4991
4991
|
if (incomingVal === void 0) return;
|
|
4992
4992
|
if (t.isStringLiteral(element) && typeof incomingVal === "string") {
|
|
4993
4993
|
if (element.value !== incomingVal) {
|
|
@@ -5478,7 +5478,7 @@ var AST = class _AST {
|
|
|
5478
5478
|
const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
|
|
5479
5479
|
if (this.isStart() && !this.type)
|
|
5480
5480
|
ret.unshift([]);
|
|
5481
|
-
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
5481
|
+
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _264 => _264.#parent, 'optionalAccess', _265 => _265.type]) === "!")) {
|
|
5482
5482
|
ret.push({});
|
|
5483
5483
|
}
|
|
5484
5484
|
return ret;
|
|
@@ -5486,7 +5486,7 @@ var AST = class _AST {
|
|
|
5486
5486
|
isStart() {
|
|
5487
5487
|
if (this.#root === this)
|
|
5488
5488
|
return true;
|
|
5489
|
-
if (!_optionalChain([this, 'access',
|
|
5489
|
+
if (!_optionalChain([this, 'access', _266 => _266.#parent, 'optionalAccess', _267 => _267.isStart, 'call', _268 => _268()]))
|
|
5490
5490
|
return false;
|
|
5491
5491
|
if (this.#parentIndex === 0)
|
|
5492
5492
|
return true;
|
|
@@ -5502,12 +5502,12 @@ var AST = class _AST {
|
|
|
5502
5502
|
isEnd() {
|
|
5503
5503
|
if (this.#root === this)
|
|
5504
5504
|
return true;
|
|
5505
|
-
if (_optionalChain([this, 'access',
|
|
5505
|
+
if (_optionalChain([this, 'access', _269 => _269.#parent, 'optionalAccess', _270 => _270.type]) === "!")
|
|
5506
5506
|
return true;
|
|
5507
|
-
if (!_optionalChain([this, 'access',
|
|
5507
|
+
if (!_optionalChain([this, 'access', _271 => _271.#parent, 'optionalAccess', _272 => _272.isEnd, 'call', _273 => _273()]))
|
|
5508
5508
|
return false;
|
|
5509
5509
|
if (!this.type)
|
|
5510
|
-
return _optionalChain([this, 'access',
|
|
5510
|
+
return _optionalChain([this, 'access', _274 => _274.#parent, 'optionalAccess', _275 => _275.isEnd, 'call', _276 => _276()]);
|
|
5511
5511
|
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
|
5512
5512
|
return this.#parentIndex === pl - 1;
|
|
5513
5513
|
}
|
|
@@ -5729,7 +5729,7 @@ var AST = class _AST {
|
|
|
5729
5729
|
if (!this.type) {
|
|
5730
5730
|
const noEmpty = this.isStart() && this.isEnd();
|
|
5731
5731
|
const src = this.#parts.map((p) => {
|
|
5732
|
-
const [re,
|
|
5732
|
+
const [re, _36, hasMagic, uflag] = typeof p === "string" ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
|
5733
5733
|
this.#hasMagic = this.#hasMagic || hasMagic;
|
|
5734
5734
|
this.#uflag = this.#uflag || uflag;
|
|
5735
5735
|
return re;
|
|
@@ -5752,7 +5752,7 @@ var AST = class _AST {
|
|
|
5752
5752
|
}
|
|
5753
5753
|
}
|
|
5754
5754
|
let end = "";
|
|
5755
|
-
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
5755
|
+
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _277 => _277.#parent, 'optionalAccess', _278 => _278.type]) === "!") {
|
|
5756
5756
|
end = "(?:$|\\/)";
|
|
5757
5757
|
}
|
|
5758
5758
|
const final2 = start2 + src + end;
|
|
@@ -5802,7 +5802,7 @@ var AST = class _AST {
|
|
|
5802
5802
|
if (typeof p === "string") {
|
|
5803
5803
|
throw new Error("string type in extglob ast??");
|
|
5804
5804
|
}
|
|
5805
|
-
const [re,
|
|
5805
|
+
const [re, _36, _hasMagic, uflag] = p.toRegExpSource(dot);
|
|
5806
5806
|
this.#uflag = this.#uflag || uflag;
|
|
5807
5807
|
return re;
|
|
5808
5808
|
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
|
|
@@ -6047,7 +6047,7 @@ var Minimatch = class {
|
|
|
6047
6047
|
}
|
|
6048
6048
|
return false;
|
|
6049
6049
|
}
|
|
6050
|
-
debug(...
|
|
6050
|
+
debug(..._36) {
|
|
6051
6051
|
}
|
|
6052
6052
|
make() {
|
|
6053
6053
|
const pattern = this.pattern;
|
|
@@ -6069,7 +6069,7 @@ var Minimatch = class {
|
|
|
6069
6069
|
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
6070
6070
|
this.globParts = this.preprocess(rawGlobParts);
|
|
6071
6071
|
this.debug(this.pattern, this.globParts);
|
|
6072
|
-
let set = this.globParts.map((s,
|
|
6072
|
+
let set = this.globParts.map((s, _36, __) => {
|
|
6073
6073
|
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
6074
6074
|
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
6075
6075
|
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
@@ -6842,7 +6842,7 @@ function createMdxSectionsSplit2Loader() {
|
|
|
6842
6842
|
const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
|
|
6843
6843
|
const result = {
|
|
6844
6844
|
frontmatter: data.frontmatter,
|
|
6845
|
-
codePlaceholders: _optionalChain([pullInput, 'optionalAccess',
|
|
6845
|
+
codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _279 => _279.codePlaceholders]) || {},
|
|
6846
6846
|
content
|
|
6847
6847
|
};
|
|
6848
6848
|
return result;
|
|
@@ -7108,7 +7108,7 @@ function createTxtLoader() {
|
|
|
7108
7108
|
const sortedEntries = Object.entries(payload).sort(
|
|
7109
7109
|
([a], [b]) => parseInt(a) - parseInt(b)
|
|
7110
7110
|
);
|
|
7111
|
-
return sortedEntries.map(([
|
|
7111
|
+
return sortedEntries.map(([_36, value]) => value).join("\n");
|
|
7112
7112
|
}
|
|
7113
7113
|
});
|
|
7114
7114
|
}
|
|
@@ -7855,7 +7855,7 @@ function createBasicTranslator(model, systemPrompt, settings = {}) {
|
|
|
7855
7855
|
]
|
|
7856
7856
|
});
|
|
7857
7857
|
const result = JSON.parse(response.text);
|
|
7858
|
-
return _optionalChain([result, 'optionalAccess',
|
|
7858
|
+
return _optionalChain([result, 'optionalAccess', _280 => _280.data]) || {};
|
|
7859
7859
|
}
|
|
7860
7860
|
}
|
|
7861
7861
|
function extractPayloadChunks(payload) {
|
|
@@ -7938,7 +7938,7 @@ function getPureModelProvider(provider) {
|
|
|
7938
7938
|
|
|
7939
7939
|
${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
|
|
7940
7940
|
`;
|
|
7941
|
-
switch (_optionalChain([provider, 'optionalAccess',
|
|
7941
|
+
switch (_optionalChain([provider, 'optionalAccess', _281 => _281.id])) {
|
|
7942
7942
|
case "openai": {
|
|
7943
7943
|
if (!process.env.OPENAI_API_KEY) {
|
|
7944
7944
|
throw new Error(
|
|
@@ -7996,7 +7996,7 @@ function getPureModelProvider(provider) {
|
|
|
7996
7996
|
})(provider.model);
|
|
7997
7997
|
}
|
|
7998
7998
|
default: {
|
|
7999
|
-
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess',
|
|
7999
|
+
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _282 => _282.id])));
|
|
8000
8000
|
}
|
|
8001
8001
|
}
|
|
8002
8002
|
}
|
|
@@ -8281,7 +8281,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
8281
8281
|
validateParams(i18nConfig, flags);
|
|
8282
8282
|
ora.succeed("Localization configuration is valid");
|
|
8283
8283
|
ora.start("Connecting to Lingo.dev Localization Engine...");
|
|
8284
|
-
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess',
|
|
8284
|
+
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _283 => _283.provider]);
|
|
8285
8285
|
if (isByokMode) {
|
|
8286
8286
|
authId = null;
|
|
8287
8287
|
ora.succeed("Using external provider (BYOK mode)");
|
|
@@ -8295,16 +8295,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
8295
8295
|
flags
|
|
8296
8296
|
});
|
|
8297
8297
|
let buckets = getBuckets(i18nConfig);
|
|
8298
|
-
if (_optionalChain([flags, 'access',
|
|
8298
|
+
if (_optionalChain([flags, 'access', _284 => _284.bucket, 'optionalAccess', _285 => _285.length])) {
|
|
8299
8299
|
buckets = buckets.filter(
|
|
8300
8300
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
8301
8301
|
);
|
|
8302
8302
|
}
|
|
8303
8303
|
ora.succeed("Buckets retrieved");
|
|
8304
|
-
if (_optionalChain([flags, 'access',
|
|
8304
|
+
if (_optionalChain([flags, 'access', _286 => _286.file, 'optionalAccess', _287 => _287.length])) {
|
|
8305
8305
|
buckets = buckets.map((bucket) => {
|
|
8306
8306
|
const paths = bucket.paths.filter(
|
|
8307
|
-
(path19) => flags.file.find((file) => _optionalChain([path19, 'access',
|
|
8307
|
+
(path19) => flags.file.find((file) => _optionalChain([path19, 'access', _288 => _288.pathPattern, 'optionalAccess', _289 => _289.includes, 'call', _290 => _290(file)]))
|
|
8308
8308
|
);
|
|
8309
8309
|
return { ...bucket, paths };
|
|
8310
8310
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -8325,7 +8325,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
8325
8325
|
});
|
|
8326
8326
|
}
|
|
8327
8327
|
}
|
|
8328
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
8328
|
+
const targetLocales = _optionalChain([flags, 'access', _291 => _291.locale, 'optionalAccess', _292 => _292.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
8329
8329
|
ora.start("Setting up localization cache...");
|
|
8330
8330
|
const checkLockfileProcessor = createDeltaProcessor("");
|
|
8331
8331
|
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
@@ -8500,7 +8500,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
8500
8500
|
if (flags.key) {
|
|
8501
8501
|
processableData = _lodash2.default.pickBy(
|
|
8502
8502
|
processableData,
|
|
8503
|
-
(
|
|
8503
|
+
(_36, key) => key === flags.key
|
|
8504
8504
|
);
|
|
8505
8505
|
}
|
|
8506
8506
|
if (flags.verbose) {
|
|
@@ -8602,7 +8602,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
8602
8602
|
}
|
|
8603
8603
|
const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
|
|
8604
8604
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
8605
|
-
if (!_optionalChain([flags, 'access',
|
|
8605
|
+
if (!_optionalChain([flags, 'access', _293 => _293.locale, 'optionalAccess', _294 => _294.length])) {
|
|
8606
8606
|
await deltaProcessor.saveChecksums(checksums);
|
|
8607
8607
|
}
|
|
8608
8608
|
}
|
|
@@ -8726,12 +8726,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
8726
8726
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
8727
8727
|
docUrl: "bucketNotFound"
|
|
8728
8728
|
});
|
|
8729
|
-
} else if (_optionalChain([flags, 'access',
|
|
8729
|
+
} else if (_optionalChain([flags, 'access', _295 => _295.locale, 'optionalAccess', _296 => _296.some, 'call', _297 => _297((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
8730
8730
|
throw new ValidationError({
|
|
8731
8731
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
8732
8732
|
docUrl: "localeTargetNotFound"
|
|
8733
8733
|
});
|
|
8734
|
-
} else if (_optionalChain([flags, 'access',
|
|
8734
|
+
} else if (_optionalChain([flags, 'access', _298 => _298.bucket, 'optionalAccess', _299 => _299.some, 'call', _300 => _300(
|
|
8735
8735
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
8736
8736
|
)])) {
|
|
8737
8737
|
throw new ValidationError({
|
|
@@ -9129,7 +9129,7 @@ var _mcpjs = require('@modelcontextprotocol/sdk/server/mcp.js');
|
|
|
9129
9129
|
|
|
9130
9130
|
var mcp_default = new (0, _interactivecommander.Command)().command("mcp").description(
|
|
9131
9131
|
"Start a Model Context Protocol (MCP) server for AI assistant integration"
|
|
9132
|
-
).helpOption("-h, --help", "Show help").action(async (
|
|
9132
|
+
).helpOption("-h, --help", "Show help").action(async (_36, program) => {
|
|
9133
9133
|
const apiKey = program.args[0];
|
|
9134
9134
|
const settings = getSettings(apiKey);
|
|
9135
9135
|
if (!settings.auth.apiKey) {
|
|
@@ -9257,7 +9257,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
|
|
|
9257
9257
|
const response = await engine.whoami();
|
|
9258
9258
|
return {
|
|
9259
9259
|
authenticated: !!response,
|
|
9260
|
-
username: _optionalChain([response, 'optionalAccess',
|
|
9260
|
+
username: _optionalChain([response, 'optionalAccess', _301 => _301.email])
|
|
9261
9261
|
};
|
|
9262
9262
|
} catch (error) {
|
|
9263
9263
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -9373,7 +9373,7 @@ function createExplicitLocalizer(provider) {
|
|
|
9373
9373
|
}
|
|
9374
9374
|
function createAiSdkLocalizer(params) {
|
|
9375
9375
|
const skipAuth = params.skipAuth === true;
|
|
9376
|
-
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
9376
|
+
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _302 => _302.apiKeyName]), () => ( ""))];
|
|
9377
9377
|
if (!skipAuth && !apiKey || !params.apiKeyName) {
|
|
9378
9378
|
throw new Error(
|
|
9379
9379
|
_dedent2.default`
|
|
@@ -9507,8 +9507,8 @@ async function setup(input2) {
|
|
|
9507
9507
|
throw new Error(
|
|
9508
9508
|
"No buckets found in i18n.json. Please add at least one bucket containing i18n content."
|
|
9509
9509
|
);
|
|
9510
|
-
} else if (_optionalChain([ctx, 'access',
|
|
9511
|
-
(bucket) => !_optionalChain([ctx, 'access',
|
|
9510
|
+
} else if (_optionalChain([ctx, 'access', _303 => _303.flags, 'access', _304 => _304.bucket, 'optionalAccess', _305 => _305.some, 'call', _306 => _306(
|
|
9511
|
+
(bucket) => !_optionalChain([ctx, 'access', _307 => _307.config, 'optionalAccess', _308 => _308.buckets, 'access', _309 => _309[bucket]])
|
|
9512
9512
|
)])) {
|
|
9513
9513
|
throw new Error(
|
|
9514
9514
|
`One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
|
|
@@ -9521,7 +9521,7 @@ async function setup(input2) {
|
|
|
9521
9521
|
title: "Selecting localization provider",
|
|
9522
9522
|
task: async (ctx, task) => {
|
|
9523
9523
|
ctx.localizer = createLocalizer(
|
|
9524
|
-
_optionalChain([ctx, 'access',
|
|
9524
|
+
_optionalChain([ctx, 'access', _310 => _310.config, 'optionalAccess', _311 => _311.provider]),
|
|
9525
9525
|
ctx.flags.apiKey
|
|
9526
9526
|
);
|
|
9527
9527
|
if (!ctx.localizer) {
|
|
@@ -9534,7 +9534,7 @@ async function setup(input2) {
|
|
|
9534
9534
|
},
|
|
9535
9535
|
{
|
|
9536
9536
|
title: "Checking authentication",
|
|
9537
|
-
enabled: (ctx) => _optionalChain([ctx, 'access',
|
|
9537
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _312 => _312.localizer, 'optionalAccess', _313 => _313.id]) === "Lingo.dev",
|
|
9538
9538
|
task: async (ctx, task) => {
|
|
9539
9539
|
const authStatus = await ctx.localizer.checkAuth();
|
|
9540
9540
|
if (!authStatus.authenticated) {
|
|
@@ -9547,7 +9547,7 @@ async function setup(input2) {
|
|
|
9547
9547
|
},
|
|
9548
9548
|
{
|
|
9549
9549
|
title: "Validating configuration",
|
|
9550
|
-
enabled: (ctx) => _optionalChain([ctx, 'access',
|
|
9550
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _314 => _314.localizer, 'optionalAccess', _315 => _315.id]) !== "Lingo.dev",
|
|
9551
9551
|
task: async (ctx, task) => {
|
|
9552
9552
|
const validationStatus = await ctx.localizer.validateSettings();
|
|
9553
9553
|
if (!validationStatus.valid) {
|
|
@@ -9756,7 +9756,7 @@ async function execute(input2) {
|
|
|
9756
9756
|
const workerTasks = [];
|
|
9757
9757
|
for (let i = 0; i < workersCount; i++) {
|
|
9758
9758
|
const assignedTasks = ctx.tasks.filter(
|
|
9759
|
-
(
|
|
9759
|
+
(_36, idx) => idx % workersCount === i
|
|
9760
9760
|
);
|
|
9761
9761
|
workerTasks.push(
|
|
9762
9762
|
createWorkerTask({
|
|
@@ -9862,7 +9862,7 @@ function createWorkerTask(args) {
|
|
|
9862
9862
|
const processableData = _lodash2.default.chain(sourceData).entries().filter(
|
|
9863
9863
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
|
|
9864
9864
|
).filter(
|
|
9865
|
-
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access',
|
|
9865
|
+
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _316 => _316.onlyKeys, 'optionalAccess', _317 => _317.some, 'call', _318 => _318(
|
|
9866
9866
|
(pattern) => minimatch(key, pattern)
|
|
9867
9867
|
)])
|
|
9868
9868
|
).fromPairs().value();
|
|
@@ -9930,7 +9930,7 @@ function createWorkerTask(args) {
|
|
|
9930
9930
|
finalRenamedTargetData
|
|
9931
9931
|
);
|
|
9932
9932
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
9933
|
-
if (!_optionalChain([args, 'access',
|
|
9933
|
+
if (!_optionalChain([args, 'access', _319 => _319.ctx, 'access', _320 => _320.flags, 'access', _321 => _321.targetLocale, 'optionalAccess', _322 => _322.length])) {
|
|
9934
9934
|
await deltaProcessor.saveChecksums(checksums);
|
|
9935
9935
|
}
|
|
9936
9936
|
});
|
|
@@ -10127,15 +10127,159 @@ var flagsSchema2 = _zod.z.object({
|
|
|
10127
10127
|
sound: _zod.z.boolean().optional()
|
|
10128
10128
|
});
|
|
10129
10129
|
|
|
10130
|
+
// src/cli/cmd/run/frozen.ts
|
|
10131
|
+
|
|
10132
|
+
|
|
10133
|
+
|
|
10134
|
+
|
|
10135
|
+
async function frozen(input2) {
|
|
10136
|
+
console.log(_chalk2.default.hex(colors.orange)("[Frozen]"));
|
|
10137
|
+
let buckets = getBuckets(input2.config);
|
|
10138
|
+
if (_optionalChain([input2, 'access', _323 => _323.flags, 'access', _324 => _324.bucket, 'optionalAccess', _325 => _325.length])) {
|
|
10139
|
+
buckets = buckets.filter((b) => input2.flags.bucket.includes(b.type));
|
|
10140
|
+
}
|
|
10141
|
+
if (_optionalChain([input2, 'access', _326 => _326.flags, 'access', _327 => _327.file, 'optionalAccess', _328 => _328.length])) {
|
|
10142
|
+
buckets = buckets.map((bucket) => {
|
|
10143
|
+
const paths = bucket.paths.filter(
|
|
10144
|
+
(p) => input2.flags.file.some(
|
|
10145
|
+
(f) => p.pathPattern.includes(f) || minimatch(p.pathPattern, f)
|
|
10146
|
+
)
|
|
10147
|
+
);
|
|
10148
|
+
return { ...bucket, paths };
|
|
10149
|
+
}).filter((bucket) => bucket.paths.length > 0);
|
|
10150
|
+
}
|
|
10151
|
+
const _sourceLocale = input2.flags.sourceLocale || input2.config.locale.source;
|
|
10152
|
+
const _targetLocales = input2.flags.targetLocale || input2.config.locale.targets;
|
|
10153
|
+
return new (0, _listr2.Listr)(
|
|
10154
|
+
[
|
|
10155
|
+
{
|
|
10156
|
+
title: "Setting up localization cache",
|
|
10157
|
+
task: async (_ctx, task) => {
|
|
10158
|
+
const checkLockfileProcessor = createDeltaProcessor("");
|
|
10159
|
+
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
10160
|
+
if (!lockfileExists) {
|
|
10161
|
+
for (const bucket of buckets) {
|
|
10162
|
+
for (const bucketPath of bucket.paths) {
|
|
10163
|
+
const resolvedSourceLocale = __spec.resolveOverriddenLocale.call(void 0,
|
|
10164
|
+
_sourceLocale,
|
|
10165
|
+
bucketPath.delimiter
|
|
10166
|
+
);
|
|
10167
|
+
const loader = createBucketLoader(
|
|
10168
|
+
bucket.type,
|
|
10169
|
+
bucketPath.pathPattern,
|
|
10170
|
+
{
|
|
10171
|
+
defaultLocale: resolvedSourceLocale,
|
|
10172
|
+
injectLocale: bucket.injectLocale,
|
|
10173
|
+
formatter: input2.config.formatter
|
|
10174
|
+
},
|
|
10175
|
+
bucket.lockedKeys,
|
|
10176
|
+
bucket.lockedPatterns,
|
|
10177
|
+
bucket.ignoredKeys
|
|
10178
|
+
);
|
|
10179
|
+
loader.setDefaultLocale(resolvedSourceLocale);
|
|
10180
|
+
await loader.init();
|
|
10181
|
+
const sourceData = await loader.pull(_sourceLocale);
|
|
10182
|
+
const delta = createDeltaProcessor(bucketPath.pathPattern);
|
|
10183
|
+
const checksums = await delta.createChecksums(sourceData);
|
|
10184
|
+
await delta.saveChecksums(checksums);
|
|
10185
|
+
}
|
|
10186
|
+
}
|
|
10187
|
+
task.title = "Localization cache initialized";
|
|
10188
|
+
} else {
|
|
10189
|
+
task.title = "Localization cache loaded";
|
|
10190
|
+
}
|
|
10191
|
+
}
|
|
10192
|
+
},
|
|
10193
|
+
{
|
|
10194
|
+
title: "Validating frozen state",
|
|
10195
|
+
enabled: () => !!input2.flags.frozen,
|
|
10196
|
+
task: async (_ctx, task) => {
|
|
10197
|
+
for (const bucket of buckets) {
|
|
10198
|
+
for (const bucketPath of bucket.paths) {
|
|
10199
|
+
const resolvedSourceLocale = __spec.resolveOverriddenLocale.call(void 0,
|
|
10200
|
+
_sourceLocale,
|
|
10201
|
+
bucketPath.delimiter
|
|
10202
|
+
);
|
|
10203
|
+
const loader = createBucketLoader(
|
|
10204
|
+
bucket.type,
|
|
10205
|
+
bucketPath.pathPattern,
|
|
10206
|
+
{
|
|
10207
|
+
defaultLocale: resolvedSourceLocale,
|
|
10208
|
+
returnUnlocalizedKeys: true,
|
|
10209
|
+
injectLocale: bucket.injectLocale
|
|
10210
|
+
},
|
|
10211
|
+
bucket.lockedKeys
|
|
10212
|
+
);
|
|
10213
|
+
loader.setDefaultLocale(resolvedSourceLocale);
|
|
10214
|
+
await loader.init();
|
|
10215
|
+
const { unlocalizable: srcUnlocalizable, ...src } = await loader.pull(_sourceLocale);
|
|
10216
|
+
const delta = createDeltaProcessor(bucketPath.pathPattern);
|
|
10217
|
+
const sourceChecksums = await delta.createChecksums(src);
|
|
10218
|
+
const savedChecksums = await delta.loadChecksums();
|
|
10219
|
+
const updatedSourceData = _lodash2.default.pickBy(
|
|
10220
|
+
src,
|
|
10221
|
+
(value, key) => sourceChecksums[key] !== savedChecksums[key]
|
|
10222
|
+
);
|
|
10223
|
+
if (Object.keys(updatedSourceData).length > 0) {
|
|
10224
|
+
throw new Error(
|
|
10225
|
+
`Localization data has changed; please update i18n.lock or run without --frozen. Details: Source file has been updated.`
|
|
10226
|
+
);
|
|
10227
|
+
}
|
|
10228
|
+
for (const _tgt of _targetLocales) {
|
|
10229
|
+
const resolvedTargetLocale = __spec.resolveOverriddenLocale.call(void 0,
|
|
10230
|
+
_tgt,
|
|
10231
|
+
bucketPath.delimiter
|
|
10232
|
+
);
|
|
10233
|
+
const { unlocalizable: tgtUnlocalizable, ...tgt } = await loader.pull(resolvedTargetLocale);
|
|
10234
|
+
const missingKeys = _lodash2.default.difference(
|
|
10235
|
+
Object.keys(src),
|
|
10236
|
+
Object.keys(tgt)
|
|
10237
|
+
);
|
|
10238
|
+
if (missingKeys.length > 0) {
|
|
10239
|
+
throw new Error(
|
|
10240
|
+
`Localization data has changed; please update i18n.lock or run without --frozen. Details: Target file is missing translations.`
|
|
10241
|
+
);
|
|
10242
|
+
}
|
|
10243
|
+
const extraKeys = _lodash2.default.difference(
|
|
10244
|
+
Object.keys(tgt),
|
|
10245
|
+
Object.keys(src)
|
|
10246
|
+
);
|
|
10247
|
+
if (extraKeys.length > 0) {
|
|
10248
|
+
throw new Error(
|
|
10249
|
+
`Localization data has changed; please update i18n.lock or run without --frozen. Details: Target file has extra translations not present in the source file.`
|
|
10250
|
+
);
|
|
10251
|
+
}
|
|
10252
|
+
const unlocalizableDataDiff = !_lodash2.default.isEqual(
|
|
10253
|
+
srcUnlocalizable,
|
|
10254
|
+
tgtUnlocalizable
|
|
10255
|
+
);
|
|
10256
|
+
if (unlocalizableDataDiff) {
|
|
10257
|
+
throw new Error(
|
|
10258
|
+
`Localization data has changed; please update i18n.lock or run without --frozen. Details: Unlocalizable data (such as booleans, dates, URLs, etc.) do not match.`
|
|
10259
|
+
);
|
|
10260
|
+
}
|
|
10261
|
+
}
|
|
10262
|
+
}
|
|
10263
|
+
}
|
|
10264
|
+
task.title = "No lockfile updates required";
|
|
10265
|
+
}
|
|
10266
|
+
}
|
|
10267
|
+
],
|
|
10268
|
+
{
|
|
10269
|
+
rendererOptions: commonTaskRendererOptions
|
|
10270
|
+
}
|
|
10271
|
+
).run(input2);
|
|
10272
|
+
}
|
|
10273
|
+
|
|
10130
10274
|
// src/cli/cmd/run/_utils.ts
|
|
10131
10275
|
async function determineAuthId(ctx) {
|
|
10132
|
-
const isByokMode = !!_optionalChain([ctx, 'access',
|
|
10276
|
+
const isByokMode = !!_optionalChain([ctx, 'access', _329 => _329.config, 'optionalAccess', _330 => _330.provider]);
|
|
10133
10277
|
if (isByokMode) {
|
|
10134
10278
|
return null;
|
|
10135
10279
|
} else {
|
|
10136
10280
|
try {
|
|
10137
|
-
const authStatus = await _optionalChain([ctx, 'access',
|
|
10138
|
-
return _optionalChain([authStatus, 'optionalAccess',
|
|
10281
|
+
const authStatus = await _optionalChain([ctx, 'access', _331 => _331.localizer, 'optionalAccess', _332 => _332.checkAuth, 'call', _333 => _333()]);
|
|
10282
|
+
return _optionalChain([authStatus, 'optionalAccess', _334 => _334.username]) || null;
|
|
10139
10283
|
} catch (e3) {
|
|
10140
10284
|
return null;
|
|
10141
10285
|
}
|
|
@@ -10191,6 +10335,9 @@ var run_default = new (0, _interactivecommander.Command)().command("run").descri
|
|
|
10191
10335
|
).option(
|
|
10192
10336
|
"--force",
|
|
10193
10337
|
"Force re-translation of all keys, bypassing change detection. Useful when you want to regenerate translations with updated AI models or translation settings"
|
|
10338
|
+
).option(
|
|
10339
|
+
"--frozen",
|
|
10340
|
+
"Validate translations are up-to-date without making changes - fails if source files, target files, or lockfile are out of sync. Ideal for CI/CD to ensure translation consistency before deployment"
|
|
10194
10341
|
).option(
|
|
10195
10342
|
"--api-key <api-key>",
|
|
10196
10343
|
"Override API key from settings or environment variables"
|
|
@@ -10233,6 +10380,8 @@ var run_default = new (0, _interactivecommander.Command)().command("run").descri
|
|
|
10233
10380
|
await renderSpacer();
|
|
10234
10381
|
await plan(ctx);
|
|
10235
10382
|
await renderSpacer();
|
|
10383
|
+
await frozen(ctx);
|
|
10384
|
+
await renderSpacer();
|
|
10236
10385
|
await execute(ctx);
|
|
10237
10386
|
await renderSpacer();
|
|
10238
10387
|
await renderSummary(ctx.results);
|
|
@@ -10327,7 +10476,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
10327
10476
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
10328
10477
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
10329
10478
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
10330
|
-
_optionalChain([this, 'access',
|
|
10479
|
+
_optionalChain([this, 'access', _335 => _335.platformKit, 'optionalAccess', _336 => _336.gitConfig, 'call', _337 => _337()]);
|
|
10331
10480
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
10332
10481
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
10333
10482
|
if (!processOwnCommits) {
|
|
@@ -10359,7 +10508,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
10359
10508
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
10360
10509
|
var PullRequestFlow = class extends InBranchFlow {
|
|
10361
10510
|
async preRun() {
|
|
10362
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
10511
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _338 => _338()]);
|
|
10363
10512
|
if (!canContinue) {
|
|
10364
10513
|
return false;
|
|
10365
10514
|
}
|
|
@@ -10622,10 +10771,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
10622
10771
|
repo_slug: this.platformConfig.repositoryName,
|
|
10623
10772
|
state: "OPEN"
|
|
10624
10773
|
}).then(({ data: { values } }) => {
|
|
10625
|
-
return _optionalChain([values, 'optionalAccess',
|
|
10626
|
-
({ source, destination }) => _optionalChain([source, 'optionalAccess',
|
|
10774
|
+
return _optionalChain([values, 'optionalAccess', _339 => _339.find, 'call', _340 => _340(
|
|
10775
|
+
({ source, destination }) => _optionalChain([source, 'optionalAccess', _341 => _341.branch, 'optionalAccess', _342 => _342.name]) === branch && _optionalChain([destination, 'optionalAccess', _343 => _343.branch, 'optionalAccess', _344 => _344.name]) === this.platformConfig.baseBranchName
|
|
10627
10776
|
)]);
|
|
10628
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
10777
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _345 => _345.id]));
|
|
10629
10778
|
}
|
|
10630
10779
|
async closePullRequest({ pullRequestNumber }) {
|
|
10631
10780
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -10721,7 +10870,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
10721
10870
|
repo: this.platformConfig.repositoryName,
|
|
10722
10871
|
base: this.platformConfig.baseBranchName,
|
|
10723
10872
|
state: "open"
|
|
10724
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
10873
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _346 => _346.number]));
|
|
10725
10874
|
}
|
|
10726
10875
|
async closePullRequest({ pullRequestNumber }) {
|
|
10727
10876
|
await this.octokit.rest.pulls.update({
|
|
@@ -10848,7 +10997,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
10848
10997
|
sourceBranch: branch,
|
|
10849
10998
|
state: "opened"
|
|
10850
10999
|
});
|
|
10851
|
-
return _optionalChain([mergeRequests, 'access',
|
|
11000
|
+
return _optionalChain([mergeRequests, 'access', _347 => _347[0], 'optionalAccess', _348 => _348.iid]);
|
|
10852
11001
|
}
|
|
10853
11002
|
async closePullRequest({
|
|
10854
11003
|
pullRequestNumber
|
|
@@ -10954,7 +11103,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
10954
11103
|
}
|
|
10955
11104
|
const env = {
|
|
10956
11105
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
10957
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
11106
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _349 => _349.pullRequest, 'optionalAccess', _350 => _350.toString, 'call', _351 => _351()]) || "false",
|
|
10958
11107
|
...options.commitMessage && {
|
|
10959
11108
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
10960
11109
|
},
|
|
@@ -10974,7 +11123,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
10974
11123
|
const { isPullRequestMode } = platformKit.config;
|
|
10975
11124
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
10976
11125
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
10977
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
11126
|
+
const canRun = await _optionalChain([flow, 'access', _352 => _352.preRun, 'optionalCall', _353 => _353()]);
|
|
10978
11127
|
if (canRun === false) {
|
|
10979
11128
|
return;
|
|
10980
11129
|
}
|
|
@@ -10984,7 +11133,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
10984
11133
|
if (!hasChanges) {
|
|
10985
11134
|
return;
|
|
10986
11135
|
}
|
|
10987
|
-
await _optionalChain([flow, 'access',
|
|
11136
|
+
await _optionalChain([flow, 'access', _354 => _354.postRun, 'optionalCall', _355 => _355()]);
|
|
10988
11137
|
});
|
|
10989
11138
|
function parseBooleanArg(val) {
|
|
10990
11139
|
if (val === true) return true;
|
|
@@ -11021,8 +11170,8 @@ function exitGracefully(elapsedMs = 0) {
|
|
|
11021
11170
|
}
|
|
11022
11171
|
}
|
|
11023
11172
|
function checkForPendingOperations() {
|
|
11024
|
-
const activeHandles = _optionalChain([process, 'access',
|
|
11025
|
-
const activeRequests = _optionalChain([process, 'access',
|
|
11173
|
+
const activeHandles = _optionalChain([process, 'access', _356 => _356._getActiveHandles, 'optionalCall', _357 => _357()]) || [];
|
|
11174
|
+
const activeRequests = _optionalChain([process, 'access', _358 => _358._getActiveRequests, 'optionalCall', _359 => _359()]) || [];
|
|
11026
11175
|
const nonStandardHandles = activeHandles.filter((handle) => {
|
|
11027
11176
|
if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
|
|
11028
11177
|
return false;
|
|
@@ -11091,17 +11240,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
11091
11240
|
flags
|
|
11092
11241
|
});
|
|
11093
11242
|
let buckets = getBuckets(i18nConfig);
|
|
11094
|
-
if (_optionalChain([flags, 'access',
|
|
11243
|
+
if (_optionalChain([flags, 'access', _360 => _360.bucket, 'optionalAccess', _361 => _361.length])) {
|
|
11095
11244
|
buckets = buckets.filter(
|
|
11096
11245
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
11097
11246
|
);
|
|
11098
11247
|
}
|
|
11099
11248
|
ora.succeed("Buckets retrieved");
|
|
11100
|
-
if (_optionalChain([flags, 'access',
|
|
11249
|
+
if (_optionalChain([flags, 'access', _362 => _362.file, 'optionalAccess', _363 => _363.length])) {
|
|
11101
11250
|
buckets = buckets.map((bucket) => {
|
|
11102
11251
|
const paths = bucket.paths.filter(
|
|
11103
11252
|
(path19) => flags.file.find(
|
|
11104
|
-
(file) => _optionalChain([path19, 'access',
|
|
11253
|
+
(file) => _optionalChain([path19, 'access', _364 => _364.pathPattern, 'optionalAccess', _365 => _365.includes, 'call', _366 => _366(file)]) || _optionalChain([path19, 'access', _367 => _367.pathPattern, 'optionalAccess', _368 => _368.match, 'call', _369 => _369(file)]) || minimatch(path19.pathPattern, file)
|
|
11105
11254
|
)
|
|
11106
11255
|
);
|
|
11107
11256
|
return { ...bucket, paths };
|
|
@@ -11121,7 +11270,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
11121
11270
|
});
|
|
11122
11271
|
}
|
|
11123
11272
|
}
|
|
11124
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
11273
|
+
const targetLocales = _optionalChain([flags, 'access', _370 => _370.locale, 'optionalAccess', _371 => _371.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
11125
11274
|
let totalSourceKeyCount = 0;
|
|
11126
11275
|
let uniqueKeysToTranslate = 0;
|
|
11127
11276
|
let totalExistingTranslations = 0;
|
|
@@ -11527,12 +11676,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
11527
11676
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
11528
11677
|
docUrl: "bucketNotFound"
|
|
11529
11678
|
});
|
|
11530
|
-
} else if (_optionalChain([flags, 'access',
|
|
11679
|
+
} else if (_optionalChain([flags, 'access', _372 => _372.locale, 'optionalAccess', _373 => _373.some, 'call', _374 => _374((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
11531
11680
|
throw new CLIError({
|
|
11532
11681
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
11533
11682
|
docUrl: "localeTargetNotFound"
|
|
11534
11683
|
});
|
|
11535
|
-
} else if (_optionalChain([flags, 'access',
|
|
11684
|
+
} else if (_optionalChain([flags, 'access', _375 => _375.bucket, 'optionalAccess', _376 => _376.some, 'call', _377 => _377(
|
|
11536
11685
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
11537
11686
|
)])) {
|
|
11538
11687
|
throw new CLIError({
|
|
@@ -11624,7 +11773,7 @@ async function renderHero2() {
|
|
|
11624
11773
|
// package.json
|
|
11625
11774
|
var package_default = {
|
|
11626
11775
|
name: "lingo.dev",
|
|
11627
|
-
version: "0.
|
|
11776
|
+
version: "0.113.0",
|
|
11628
11777
|
description: "Lingo.dev CLI",
|
|
11629
11778
|
private: false,
|
|
11630
11779
|
publishConfig: {
|
|
@@ -11914,7 +12063,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
|
|
|
11914
12063
|
if (options.file && options.file.length) {
|
|
11915
12064
|
buckets = buckets.map((bucket) => {
|
|
11916
12065
|
const paths = bucket.paths.filter(
|
|
11917
|
-
(bucketPath) => _optionalChain([options, 'access',
|
|
12066
|
+
(bucketPath) => _optionalChain([options, 'access', _378 => _378.file, 'optionalAccess', _379 => _379.some, 'call', _380 => _380((f) => bucketPath.pathPattern.includes(f))])
|
|
11918
12067
|
);
|
|
11919
12068
|
return { ...bucket, paths };
|
|
11920
12069
|
}).filter((bucket) => bucket.paths.length > 0);
|