lingo.dev 0.109.2 → 0.110.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 +159 -146
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +92 -79
- 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', _35 => _35.auth, 'optionalAccess', _36 => _36.apiKey]) || defaults2.auth.apiKey,
|
|
26
|
+
apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _37 => _37.auth, 'optionalAccess', _38 => _38.apiUrl]) || defaults2.auth.apiUrl,
|
|
27
|
+
webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _39 => _39.auth, 'optionalAccess', _40 => _40.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', _41 => _41.llm, 'optionalAccess', _42 => _42.openaiApiKey]),
|
|
31
|
+
anthropicApiKey: env.ANTHROPIC_API_KEY || _optionalChain([systemFile, 'access', _43 => _43.llm, 'optionalAccess', _44 => _44.anthropicApiKey]),
|
|
32
|
+
groqApiKey: env.GROQ_API_KEY || _optionalChain([systemFile, 'access', _45 => _45.llm, 'optionalAccess', _46 => _46.groqApiKey]),
|
|
33
|
+
googleApiKey: env.GOOGLE_API_KEY || _optionalChain([systemFile, 'access', _47 => _47.llm, 'optionalAccess', _48 => _48.googleApiKey]),
|
|
34
|
+
openrouterApiKey: env.OPENROUTER_API_KEY || _optionalChain([systemFile, 'access', _49 => _49.llm, 'optionalAccess', _50 => _50.openrouterApiKey]),
|
|
35
|
+
mistralApiKey: env.MISTRAL_API_KEY || _optionalChain([systemFile, 'access', _51 => _51.llm, 'optionalAccess', _52 => _52.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', _53 => _53.auth, 'optionalAccess', _54 => _54.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', _55 => _55.llm, 'optionalAccess', _56 => _56.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', _57 => _57.llm, 'optionalAccess', _58 => _58.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', _59 => _59.llm, 'optionalAccess', _60 => _60.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', _61 => _61.llm, 'optionalAccess', _62 => _62.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', _63 => _63.llm, 'optionalAccess', _64 => _64.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', _65 => _65.llm, 'optionalAccess', _66 => _66.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`
|
|
@@ -261,7 +261,7 @@ function createAuthenticator(params) {
|
|
|
261
261
|
});
|
|
262
262
|
if (res.ok) {
|
|
263
263
|
const payload = await res.json();
|
|
264
|
-
if (!_optionalChain([payload, 'optionalAccess',
|
|
264
|
+
if (!_optionalChain([payload, 'optionalAccess', _67 => _67.email])) {
|
|
265
265
|
return null;
|
|
266
266
|
}
|
|
267
267
|
return {
|
|
@@ -1088,7 +1088,7 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
|
|
|
1088
1088
|
});
|
|
1089
1089
|
const auth2 = await newAuthenticator.whoami();
|
|
1090
1090
|
if (auth2) {
|
|
1091
|
-
_ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess',
|
|
1091
|
+
_ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _68 => _68.email])}`);
|
|
1092
1092
|
} else {
|
|
1093
1093
|
_ora2.default.call(void 0, ).fail("Authentication failed.");
|
|
1094
1094
|
}
|
|
@@ -1175,7 +1175,7 @@ function getBuckets(i18nConfig) {
|
|
|
1175
1175
|
const includeItems = bucketEntry.include.map(
|
|
1176
1176
|
(item) => resolveBucketItem(item)
|
|
1177
1177
|
);
|
|
1178
|
-
const excludeItems = _optionalChain([bucketEntry, 'access',
|
|
1178
|
+
const excludeItems = _optionalChain([bucketEntry, 'access', _69 => _69.exclude, 'optionalAccess', _70 => _70.map, 'call', _71 => _71(
|
|
1179
1179
|
(item) => resolveBucketItem(item)
|
|
1180
1180
|
)]);
|
|
1181
1181
|
const config = {
|
|
@@ -1213,7 +1213,7 @@ function extractPathPatterns(sourceLocale, include, exclude) {
|
|
|
1213
1213
|
delimiter: pattern.delimiter
|
|
1214
1214
|
}))
|
|
1215
1215
|
);
|
|
1216
|
-
const excludedPatterns = _optionalChain([exclude, 'optionalAccess',
|
|
1216
|
+
const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _72 => _72.flatMap, 'call', _73 => _73(
|
|
1217
1217
|
(pattern) => expandPlaceholderedGlob(
|
|
1218
1218
|
pattern.path,
|
|
1219
1219
|
__spec.resolveOverriddenLocale.call(void 0, sourceLocale, pattern.delimiter)
|
|
@@ -1503,12 +1503,12 @@ function composeLoaders(...loaders) {
|
|
|
1503
1503
|
return {
|
|
1504
1504
|
init: async () => {
|
|
1505
1505
|
for (const loader of loaders) {
|
|
1506
|
-
await _optionalChain([loader, 'access',
|
|
1506
|
+
await _optionalChain([loader, 'access', _74 => _74.init, 'optionalCall', _75 => _75()]);
|
|
1507
1507
|
}
|
|
1508
1508
|
},
|
|
1509
1509
|
setDefaultLocale(locale) {
|
|
1510
1510
|
for (const loader of loaders) {
|
|
1511
|
-
_optionalChain([loader, 'access',
|
|
1511
|
+
_optionalChain([loader, 'access', _76 => _76.setDefaultLocale, 'optionalCall', _77 => _77(locale)]);
|
|
1512
1512
|
}
|
|
1513
1513
|
return this;
|
|
1514
1514
|
},
|
|
@@ -1529,7 +1529,7 @@ function composeLoaders(...loaders) {
|
|
|
1529
1529
|
pullHints: async (originalInput) => {
|
|
1530
1530
|
let result = originalInput;
|
|
1531
1531
|
for (let i = 0; i < loaders.length; i++) {
|
|
1532
|
-
const subResult = await _optionalChain([loaders, 'access',
|
|
1532
|
+
const subResult = await _optionalChain([loaders, 'access', _78 => _78[i], 'access', _79 => _79.pullHints, 'optionalCall', _80 => _80(result)]);
|
|
1533
1533
|
if (subResult) {
|
|
1534
1534
|
result = subResult;
|
|
1535
1535
|
}
|
|
@@ -1551,7 +1551,7 @@ function createLoader(lDefinition) {
|
|
|
1551
1551
|
if (state.initCtx) {
|
|
1552
1552
|
return state.initCtx;
|
|
1553
1553
|
}
|
|
1554
|
-
state.initCtx = await _optionalChain([lDefinition, 'access',
|
|
1554
|
+
state.initCtx = await _optionalChain([lDefinition, 'access', _81 => _81.init, 'optionalCall', _82 => _82()]);
|
|
1555
1555
|
return state.initCtx;
|
|
1556
1556
|
},
|
|
1557
1557
|
setDefaultLocale(locale) {
|
|
@@ -1562,7 +1562,7 @@ function createLoader(lDefinition) {
|
|
|
1562
1562
|
return this;
|
|
1563
1563
|
},
|
|
1564
1564
|
async pullHints() {
|
|
1565
|
-
return _optionalChain([lDefinition, 'access',
|
|
1565
|
+
return _optionalChain([lDefinition, 'access', _83 => _83.pullHints, 'optionalCall', _84 => _84(state.originalInput)]);
|
|
1566
1566
|
},
|
|
1567
1567
|
async pull(locale, input2) {
|
|
1568
1568
|
if (!state.defaultLocale) {
|
|
@@ -1867,7 +1867,7 @@ function createNormalizeLoader() {
|
|
|
1867
1867
|
return normalized;
|
|
1868
1868
|
},
|
|
1869
1869
|
push: async (locale, data, originalInput) => {
|
|
1870
|
-
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess',
|
|
1870
|
+
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _85 => _85.keysMap]), () => ( {}));
|
|
1871
1871
|
const input2 = mapDenormalizedKeys(data, keysMap);
|
|
1872
1872
|
const denormalized = _flat.unflatten.call(void 0, input2, {
|
|
1873
1873
|
delimiter: "/",
|
|
@@ -1968,7 +1968,7 @@ function createTextFileLoader(pathPattern) {
|
|
|
1968
1968
|
const trimmedResult = result.trim();
|
|
1969
1969
|
return trimmedResult;
|
|
1970
1970
|
},
|
|
1971
|
-
async push(locale, data,
|
|
1971
|
+
async push(locale, data, _34, originalLocale) {
|
|
1972
1972
|
const draftPath = pathPattern.replaceAll("[locale]", locale);
|
|
1973
1973
|
const finalPath = path13.default.resolve(draftPath);
|
|
1974
1974
|
const dirPath = path13.default.dirname(finalPath);
|
|
@@ -2001,8 +2001,8 @@ async function getTrailingNewLine(pathPattern, locale, originalLocale) {
|
|
|
2001
2001
|
if (!templateData) {
|
|
2002
2002
|
templateData = await readFileForLocale(pathPattern, originalLocale);
|
|
2003
2003
|
}
|
|
2004
|
-
if (_optionalChain([templateData, 'optionalAccess',
|
|
2005
|
-
const ending = _optionalChain([templateData, 'optionalAccess',
|
|
2004
|
+
if (_optionalChain([templateData, 'optionalAccess', _86 => _86.match, 'call', _87 => _87(/[\r\n]$/)])) {
|
|
2005
|
+
const ending = _optionalChain([templateData, 'optionalAccess', _88 => _88.includes, 'call', _89 => _89("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _90 => _90.includes, 'call', _91 => _91("\r")]) ? "\r" : "\n";
|
|
2006
2006
|
return ending;
|
|
2007
2007
|
}
|
|
2008
2008
|
return "";
|
|
@@ -2273,7 +2273,7 @@ var _sync3 = require('csv-stringify/sync');
|
|
|
2273
2273
|
|
|
2274
2274
|
function detectKeyColumnName(csvString) {
|
|
2275
2275
|
const row = _sync.parse.call(void 0, csvString)[0];
|
|
2276
|
-
const firstColumn = _optionalChain([row, 'optionalAccess',
|
|
2276
|
+
const firstColumn = _optionalChain([row, 'optionalAccess', _92 => _92[0], 'optionalAccess', _93 => _93.trim, 'call', _94 => _94()]);
|
|
2277
2277
|
return firstColumn || "KEY";
|
|
2278
2278
|
}
|
|
2279
2279
|
function createCsvLoader() {
|
|
@@ -2375,7 +2375,7 @@ function createHtmlLoader() {
|
|
|
2375
2375
|
break;
|
|
2376
2376
|
}
|
|
2377
2377
|
const siblings = Array.from(parent.childNodes).filter(
|
|
2378
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2378
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _95 => _95.textContent, 'optionalAccess', _96 => _96.trim, 'call', _97 => _97()])
|
|
2379
2379
|
);
|
|
2380
2380
|
const index = siblings.indexOf(current);
|
|
2381
2381
|
if (index !== -1) {
|
|
@@ -2411,15 +2411,15 @@ function createHtmlLoader() {
|
|
|
2411
2411
|
}
|
|
2412
2412
|
});
|
|
2413
2413
|
Array.from(element.childNodes).filter(
|
|
2414
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2414
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _98 => _98.textContent, 'optionalAccess', _99 => _99.trim, 'call', _100 => _100()])
|
|
2415
2415
|
).forEach(processNode);
|
|
2416
2416
|
}
|
|
2417
2417
|
};
|
|
2418
2418
|
Array.from(document.head.childNodes).filter(
|
|
2419
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2419
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _101 => _101.textContent, 'optionalAccess', _102 => _102.trim, 'call', _103 => _103()])
|
|
2420
2420
|
).forEach(processNode);
|
|
2421
2421
|
Array.from(document.body.childNodes).filter(
|
|
2422
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2422
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _104 => _104.textContent, 'optionalAccess', _105 => _105.trim, 'call', _106 => _106()])
|
|
2423
2423
|
).forEach(processNode);
|
|
2424
2424
|
return result;
|
|
2425
2425
|
},
|
|
@@ -2444,7 +2444,7 @@ function createHtmlLoader() {
|
|
|
2444
2444
|
for (let i = 0; i < indices.length; i++) {
|
|
2445
2445
|
const index = parseInt(indices[i]);
|
|
2446
2446
|
const siblings = Array.from(parent.childNodes).filter(
|
|
2447
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2447
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _107 => _107.textContent, 'optionalAccess', _108 => _108.trim, 'call', _109 => _109()])
|
|
2448
2448
|
);
|
|
2449
2449
|
if (index >= siblings.length) {
|
|
2450
2450
|
if (i === indices.length - 1) {
|
|
@@ -2495,7 +2495,7 @@ function createMarkdownLoader() {
|
|
|
2495
2495
|
yaml: yamlEngine
|
|
2496
2496
|
}
|
|
2497
2497
|
});
|
|
2498
|
-
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess',
|
|
2498
|
+
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _110 => _110.trim, 'call', _111 => _111()]), () => ( ""))).filter(Boolean);
|
|
2499
2499
|
return {
|
|
2500
2500
|
...Object.fromEntries(
|
|
2501
2501
|
sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
|
|
@@ -2514,7 +2514,7 @@ function createMarkdownLoader() {
|
|
|
2514
2514
|
);
|
|
2515
2515
|
let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(
|
|
2516
2516
|
([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())
|
|
2517
|
-
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess',
|
|
2517
|
+
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _112 => _112.trim, 'call', _113 => _113()]), () => ( ""))).filter(Boolean).join("\n\n");
|
|
2518
2518
|
if (Object.keys(frontmatter).length > 0) {
|
|
2519
2519
|
content = `
|
|
2520
2520
|
${content}`;
|
|
@@ -2547,7 +2547,7 @@ function createPropertiesLoader() {
|
|
|
2547
2547
|
return result;
|
|
2548
2548
|
},
|
|
2549
2549
|
async push(locale, payload) {
|
|
2550
|
-
const result = Object.entries(payload).filter(([
|
|
2550
|
+
const result = Object.entries(payload).filter(([_34, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
|
|
2551
2551
|
return result;
|
|
2552
2552
|
}
|
|
2553
2553
|
});
|
|
@@ -2558,7 +2558,7 @@ function isSkippableLine(line) {
|
|
|
2558
2558
|
function parsePropertyLine(line) {
|
|
2559
2559
|
const [key, ...valueParts] = line.split("=");
|
|
2560
2560
|
return {
|
|
2561
|
-
key: _optionalChain([key, 'optionalAccess',
|
|
2561
|
+
key: _optionalChain([key, 'optionalAccess', _114 => _114.trim, 'call', _115 => _115()]) || "",
|
|
2562
2562
|
value: valueParts.join("=").trim()
|
|
2563
2563
|
};
|
|
2564
2564
|
}
|
|
@@ -2646,7 +2646,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
2646
2646
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
2647
2647
|
continue;
|
|
2648
2648
|
}
|
|
2649
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
2649
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _116 => _116.localizations, 'optionalAccess', _117 => _117[locale]]);
|
|
2650
2650
|
if (langTranslationEntity) {
|
|
2651
2651
|
if ("stringUnit" in langTranslationEntity) {
|
|
2652
2652
|
resultData[translationKey] = langTranslationEntity.stringUnit.value;
|
|
@@ -2655,7 +2655,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
2655
2655
|
resultData[translationKey] = {};
|
|
2656
2656
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
2657
2657
|
for (const form in pluralForms) {
|
|
2658
|
-
if (_optionalChain([pluralForms, 'access',
|
|
2658
|
+
if (_optionalChain([pluralForms, 'access', _118 => _118[form], 'optionalAccess', _119 => _119.stringUnit, 'optionalAccess', _120 => _120.value])) {
|
|
2659
2659
|
resultData[translationKey][form] = pluralForms[form].stringUnit.value;
|
|
2660
2660
|
}
|
|
2661
2661
|
}
|
|
@@ -2681,7 +2681,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
2681
2681
|
const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
|
|
2682
2682
|
if (typeof value === "string") {
|
|
2683
2683
|
langDataToMerge.strings[key] = {
|
|
2684
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
2684
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _121 => _121.strings, 'optionalAccess', _122 => _122[key], 'optionalAccess', _123 => _123.extractionState]),
|
|
2685
2685
|
localizations: {
|
|
2686
2686
|
[locale]: {
|
|
2687
2687
|
stringUnit: {
|
|
@@ -2739,7 +2739,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
2739
2739
|
for (const [locale, localization] of Object.entries(
|
|
2740
2740
|
entity.localizations
|
|
2741
2741
|
)) {
|
|
2742
|
-
if (_optionalChain([localization, 'access',
|
|
2742
|
+
if (_optionalChain([localization, 'access', _124 => _124.variations, 'optionalAccess', _125 => _125.plural])) {
|
|
2743
2743
|
const pluralForms = localization.variations.plural;
|
|
2744
2744
|
for (const form in pluralForms) {
|
|
2745
2745
|
const pluralKey = `${translationKey}/${form}`;
|
|
@@ -2759,7 +2759,7 @@ function _removeLocale(input2, locale) {
|
|
|
2759
2759
|
const { strings } = input2;
|
|
2760
2760
|
const newStrings = _lodash2.default.cloneDeep(strings);
|
|
2761
2761
|
for (const [key, value] of Object.entries(newStrings)) {
|
|
2762
|
-
if (_optionalChain([value, 'access',
|
|
2762
|
+
if (_optionalChain([value, 'access', _126 => _126.localizations, 'optionalAccess', _127 => _127[locale]])) {
|
|
2763
2763
|
delete value.localizations[locale];
|
|
2764
2764
|
}
|
|
2765
2765
|
}
|
|
@@ -2848,12 +2848,12 @@ function createUnlocalizableLoader(returnUnlocalizedKeys = false) {
|
|
|
2848
2848
|
const unlocalizableKeys = _getUnlocalizableKeys(input2);
|
|
2849
2849
|
const result = _lodash2.default.omitBy(
|
|
2850
2850
|
input2,
|
|
2851
|
-
(
|
|
2851
|
+
(_34, key) => unlocalizableKeys.includes(key)
|
|
2852
2852
|
);
|
|
2853
2853
|
if (returnUnlocalizedKeys) {
|
|
2854
2854
|
result.unlocalizable = _lodash2.default.omitBy(
|
|
2855
2855
|
input2,
|
|
2856
|
-
(
|
|
2856
|
+
(_34, key) => !unlocalizableKeys.includes(key)
|
|
2857
2857
|
);
|
|
2858
2858
|
}
|
|
2859
2859
|
return result;
|
|
@@ -2863,7 +2863,7 @@ function createUnlocalizableLoader(returnUnlocalizedKeys = false) {
|
|
|
2863
2863
|
const result = _lodash2.default.merge(
|
|
2864
2864
|
{},
|
|
2865
2865
|
data,
|
|
2866
|
-
_lodash2.default.omitBy(originalInput, (
|
|
2866
|
+
_lodash2.default.omitBy(originalInput, (_34, key) => !unlocalizableKeys.includes(key))
|
|
2867
2867
|
);
|
|
2868
2868
|
return result;
|
|
2869
2869
|
}
|
|
@@ -2894,7 +2894,7 @@ function _getUnlocalizableKeys(input2) {
|
|
|
2894
2894
|
}
|
|
2895
2895
|
}
|
|
2896
2896
|
return false;
|
|
2897
|
-
}).map(([key,
|
|
2897
|
+
}).map(([key, _34]) => key);
|
|
2898
2898
|
}
|
|
2899
2899
|
|
|
2900
2900
|
// src/cli/loaders/po/index.ts
|
|
@@ -2919,7 +2919,7 @@ function createPoDataLoader(params) {
|
|
|
2919
2919
|
Object.entries(entries).forEach(([msgid, entry]) => {
|
|
2920
2920
|
if (msgid && entry.msgid) {
|
|
2921
2921
|
const context = entry.msgctxt || "";
|
|
2922
|
-
const fullEntry = _optionalChain([parsedPo, 'access',
|
|
2922
|
+
const fullEntry = _optionalChain([parsedPo, 'access', _128 => _128.translations, 'access', _129 => _129[context], 'optionalAccess', _130 => _130[msgid]]);
|
|
2923
2923
|
if (fullEntry) {
|
|
2924
2924
|
result[msgid] = fullEntry;
|
|
2925
2925
|
}
|
|
@@ -2929,8 +2929,8 @@ function createPoDataLoader(params) {
|
|
|
2929
2929
|
return result;
|
|
2930
2930
|
},
|
|
2931
2931
|
async push(locale, data, originalInput, originalLocale, pullInput) {
|
|
2932
|
-
const currentSections = _optionalChain([pullInput, 'optionalAccess',
|
|
2933
|
-
const originalSections = _optionalChain([originalInput, 'optionalAccess',
|
|
2932
|
+
const currentSections = _optionalChain([pullInput, 'optionalAccess', _131 => _131.split, 'call', _132 => _132("\n\n"), 'access', _133 => _133.filter, 'call', _134 => _134(Boolean)]) || [];
|
|
2933
|
+
const originalSections = _optionalChain([originalInput, 'optionalAccess', _135 => _135.split, 'call', _136 => _136("\n\n"), 'access', _137 => _137.filter, 'call', _138 => _138(Boolean)]) || [];
|
|
2934
2934
|
const result = originalSections.map((section) => {
|
|
2935
2935
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
2936
2936
|
if (Object.keys(sectionPo.translations).length === 0) {
|
|
@@ -2999,8 +2999,8 @@ function createPoContentLoader() {
|
|
|
2999
2999
|
{
|
|
3000
3000
|
...entry,
|
|
3001
3001
|
msgstr: [
|
|
3002
|
-
_optionalChain([data, 'access',
|
|
3003
|
-
_optionalChain([data, 'access',
|
|
3002
|
+
_optionalChain([data, 'access', _139 => _139[entry.msgid], 'optionalAccess', _140 => _140.singular]),
|
|
3003
|
+
_optionalChain([data, 'access', _141 => _141[entry.msgid], 'optionalAccess', _142 => _142.plural]) || null
|
|
3004
3004
|
].filter(Boolean)
|
|
3005
3005
|
}
|
|
3006
3006
|
]).fromPairs().value();
|
|
@@ -3122,7 +3122,7 @@ function pullV1(xliffElement, locale, originalLocale) {
|
|
|
3122
3122
|
let key = getTransUnitKey(unit);
|
|
3123
3123
|
if (!key) return;
|
|
3124
3124
|
if (seenKeys.has(key)) {
|
|
3125
|
-
const id = _optionalChain([unit, 'access',
|
|
3125
|
+
const id = _optionalChain([unit, 'access', _143 => _143.getAttribute, 'call', _144 => _144("id"), 'optionalAccess', _145 => _145.trim, 'call', _146 => _146()]);
|
|
3126
3126
|
if (id) {
|
|
3127
3127
|
key = `${key}#${id}`;
|
|
3128
3128
|
} else {
|
|
@@ -3170,7 +3170,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
3170
3170
|
let key = getTransUnitKey(unit);
|
|
3171
3171
|
if (!key) return;
|
|
3172
3172
|
if (seenKeys.has(key)) {
|
|
3173
|
-
const id = _optionalChain([unit, 'access',
|
|
3173
|
+
const id = _optionalChain([unit, 'access', _147 => _147.getAttribute, 'call', _148 => _148("id"), 'optionalAccess', _149 => _149.trim, 'call', _150 => _150()]);
|
|
3174
3174
|
if (id) {
|
|
3175
3175
|
key = `${key}#${id}`;
|
|
3176
3176
|
} else {
|
|
@@ -3212,7 +3212,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
3212
3212
|
const translationKeys = new Set(Object.keys(translations));
|
|
3213
3213
|
existingUnits.forEach((unit, key) => {
|
|
3214
3214
|
if (!translationKeys.has(key)) {
|
|
3215
|
-
_optionalChain([unit, 'access',
|
|
3215
|
+
_optionalChain([unit, 'access', _151 => _151.parentNode, 'optionalAccess', _152 => _152.removeChild, 'call', _153 => _153(unit)]);
|
|
3216
3216
|
}
|
|
3217
3217
|
});
|
|
3218
3218
|
return serializeWithDeclaration(
|
|
@@ -3255,18 +3255,18 @@ function traverseUnitsV2(container, fileId, currentPath, result) {
|
|
|
3255
3255
|
Array.from(container.children).forEach((child) => {
|
|
3256
3256
|
const tagName = child.tagName;
|
|
3257
3257
|
if (tagName === "unit") {
|
|
3258
|
-
const unitId = _optionalChain([child, 'access',
|
|
3258
|
+
const unitId = _optionalChain([child, 'access', _154 => _154.getAttribute, 'call', _155 => _155("id"), 'optionalAccess', _156 => _156.trim, 'call', _157 => _157()]);
|
|
3259
3259
|
if (!unitId) return;
|
|
3260
3260
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
3261
3261
|
const segment = child.querySelector("segment");
|
|
3262
|
-
const source = _optionalChain([segment, 'optionalAccess',
|
|
3262
|
+
const source = _optionalChain([segment, 'optionalAccess', _158 => _158.querySelector, 'call', _159 => _159("source")]);
|
|
3263
3263
|
if (source) {
|
|
3264
3264
|
result[key] = extractTextContent(source);
|
|
3265
3265
|
} else {
|
|
3266
3266
|
result[key] = unitId;
|
|
3267
3267
|
}
|
|
3268
3268
|
} else if (tagName === "group") {
|
|
3269
|
-
const groupId = _optionalChain([child, 'access',
|
|
3269
|
+
const groupId = _optionalChain([child, 'access', _160 => _160.getAttribute, 'call', _161 => _161("id"), 'optionalAccess', _162 => _162.trim, 'call', _163 => _163()]);
|
|
3270
3270
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
3271
3271
|
traverseUnitsV2(child, fileId, newPath, result);
|
|
3272
3272
|
}
|
|
@@ -3302,12 +3302,12 @@ function indexUnitsV2(container, fileId, currentPath, index) {
|
|
|
3302
3302
|
Array.from(container.children).forEach((child) => {
|
|
3303
3303
|
const tagName = child.tagName;
|
|
3304
3304
|
if (tagName === "unit") {
|
|
3305
|
-
const unitId = _optionalChain([child, 'access',
|
|
3305
|
+
const unitId = _optionalChain([child, 'access', _164 => _164.getAttribute, 'call', _165 => _165("id"), 'optionalAccess', _166 => _166.trim, 'call', _167 => _167()]);
|
|
3306
3306
|
if (!unitId) return;
|
|
3307
3307
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
3308
3308
|
index.set(key, child);
|
|
3309
3309
|
} else if (tagName === "group") {
|
|
3310
|
-
const groupId = _optionalChain([child, 'access',
|
|
3310
|
+
const groupId = _optionalChain([child, 'access', _168 => _168.getAttribute, 'call', _169 => _169("id"), 'optionalAccess', _170 => _170.trim, 'call', _171 => _171()]);
|
|
3311
3311
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
3312
3312
|
indexUnitsV2(child, fileId, newPath, index);
|
|
3313
3313
|
}
|
|
@@ -3328,9 +3328,9 @@ function updateUnitV2(unit, value) {
|
|
|
3328
3328
|
setTextContent(source, value);
|
|
3329
3329
|
}
|
|
3330
3330
|
function getTransUnitKey(transUnit) {
|
|
3331
|
-
const resname = _optionalChain([transUnit, 'access',
|
|
3331
|
+
const resname = _optionalChain([transUnit, 'access', _172 => _172.getAttribute, 'call', _173 => _173("resname"), 'optionalAccess', _174 => _174.trim, 'call', _175 => _175()]);
|
|
3332
3332
|
if (resname) return resname;
|
|
3333
|
-
const id = _optionalChain([transUnit, 'access',
|
|
3333
|
+
const id = _optionalChain([transUnit, 'access', _176 => _176.getAttribute, 'call', _177 => _177("id"), 'optionalAccess', _178 => _178.trim, 'call', _179 => _179()]);
|
|
3334
3334
|
if (id) return id;
|
|
3335
3335
|
const sourceElement = transUnit.querySelector("source");
|
|
3336
3336
|
if (sourceElement) {
|
|
@@ -3387,7 +3387,7 @@ function formatXml(xml) {
|
|
|
3387
3387
|
if (cdataNode) {
|
|
3388
3388
|
return `${indent2}${openTag}<![CDATA[${cdataNode.nodeValue}]]></${tagName}>`;
|
|
3389
3389
|
}
|
|
3390
|
-
const textContent = _optionalChain([element, 'access',
|
|
3390
|
+
const textContent = _optionalChain([element, 'access', _180 => _180.textContent, 'optionalAccess', _181 => _181.trim, 'call', _182 => _182()]) || "";
|
|
3391
3391
|
const hasOnlyText = element.childNodes.length === 1 && element.childNodes[0].nodeType === 3;
|
|
3392
3392
|
if (hasOnlyText && textContent) {
|
|
3393
3393
|
return `${indent2}${openTag}${textContent}</${tagName}>`;
|
|
@@ -3680,7 +3680,7 @@ function createDatoClient(params) {
|
|
|
3680
3680
|
ids: !records.length ? void 0 : records.join(",")
|
|
3681
3681
|
}
|
|
3682
3682
|
}).catch(
|
|
3683
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
3683
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _183 => _183.response, 'optionalAccess', _184 => _184.body, 'optionalAccess', _185 => _185.data, 'optionalAccess', _186 => _186[0]]) || error)
|
|
3684
3684
|
);
|
|
3685
3685
|
},
|
|
3686
3686
|
findRecordsForModel: async (modelId, records) => {
|
|
@@ -3691,10 +3691,10 @@ function createDatoClient(params) {
|
|
|
3691
3691
|
filter: {
|
|
3692
3692
|
type: modelId,
|
|
3693
3693
|
only_valid: "true",
|
|
3694
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
3694
|
+
ids: !_optionalChain([records, 'optionalAccess', _187 => _187.length]) ? void 0 : records.join(",")
|
|
3695
3695
|
}
|
|
3696
3696
|
}).catch(
|
|
3697
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
3697
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _188 => _188.response, 'optionalAccess', _189 => _189.body, 'optionalAccess', _190 => _190.data, 'optionalAccess', _191 => _191[0]]) || error)
|
|
3698
3698
|
);
|
|
3699
3699
|
return result;
|
|
3700
3700
|
} catch (_error) {
|
|
@@ -3710,10 +3710,10 @@ function createDatoClient(params) {
|
|
|
3710
3710
|
updateRecord: async (id, payload) => {
|
|
3711
3711
|
try {
|
|
3712
3712
|
await dato.items.update(id, payload).catch(
|
|
3713
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
3713
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _192 => _192.response, 'optionalAccess', _193 => _193.body, 'optionalAccess', _194 => _194.data, 'optionalAccess', _195 => _195[0]]) || error)
|
|
3714
3714
|
);
|
|
3715
3715
|
} catch (_error) {
|
|
3716
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
3716
|
+
if (_optionalChain([_error, 'optionalAccess', _196 => _196.attributes, 'optionalAccess', _197 => _197.details, 'optionalAccess', _198 => _198.message])) {
|
|
3717
3717
|
throw new Error(
|
|
3718
3718
|
[
|
|
3719
3719
|
`${_error.attributes.details.message}`,
|
|
@@ -3735,10 +3735,10 @@ function createDatoClient(params) {
|
|
|
3735
3735
|
enableFieldLocalization: async (args) => {
|
|
3736
3736
|
try {
|
|
3737
3737
|
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch(
|
|
3738
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
3738
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _199 => _199.response, 'optionalAccess', _200 => _200.body, 'optionalAccess', _201 => _201.data, 'optionalAccess', _202 => _202[0]]) || error)
|
|
3739
3739
|
);
|
|
3740
3740
|
} catch (_error) {
|
|
3741
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
3741
|
+
if (_optionalChain([_error, 'optionalAccess', _203 => _203.attributes, 'optionalAccess', _204 => _204.code]) === "NOT_FOUND") {
|
|
3742
3742
|
throw new Error(
|
|
3743
3743
|
[
|
|
3744
3744
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -3746,7 +3746,7 @@ function createDatoClient(params) {
|
|
|
3746
3746
|
].join("\n\n")
|
|
3747
3747
|
);
|
|
3748
3748
|
}
|
|
3749
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
3749
|
+
if (_optionalChain([_error, 'optionalAccess', _205 => _205.attributes, 'optionalAccess', _206 => _206.details, 'optionalAccess', _207 => _207.message])) {
|
|
3750
3750
|
throw new Error(
|
|
3751
3751
|
[
|
|
3752
3752
|
`${_error.attributes.details.message}`,
|
|
@@ -3824,7 +3824,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
3824
3824
|
const records = await dato.findRecordsForModel(modelId);
|
|
3825
3825
|
const recordChoices = createRecordChoices(
|
|
3826
3826
|
records,
|
|
3827
|
-
_optionalChain([config, 'access',
|
|
3827
|
+
_optionalChain([config, 'access', _208 => _208.models, 'access', _209 => _209[modelId], 'optionalAccess', _210 => _210.records]) || [],
|
|
3828
3828
|
project
|
|
3829
3829
|
);
|
|
3830
3830
|
const selectedRecords = await promptRecordSelection(
|
|
@@ -3843,14 +3843,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
3843
3843
|
},
|
|
3844
3844
|
async pull(locale, input2, initCtx) {
|
|
3845
3845
|
const result = {};
|
|
3846
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
3847
|
-
let records = _optionalChain([initCtx, 'optionalAccess',
|
|
3846
|
+
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _211 => _211.models]) || {})) {
|
|
3847
|
+
let records = _optionalChain([initCtx, 'optionalAccess', _212 => _212.models, 'access', _213 => _213[modelId], 'access', _214 => _214.records]) || [];
|
|
3848
3848
|
const recordIds = records.map((record) => record.id);
|
|
3849
3849
|
records = await dato.findRecords(recordIds);
|
|
3850
3850
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
3851
3851
|
if (records.length > 0) {
|
|
3852
3852
|
result[modelId] = {
|
|
3853
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
3853
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _215 => _215.models, 'optionalAccess', _216 => _216[modelId], 'optionalAccess', _217 => _217.fields]) || [],
|
|
3854
3854
|
records
|
|
3855
3855
|
};
|
|
3856
3856
|
}
|
|
@@ -3913,7 +3913,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
3913
3913
|
return records.map((record) => ({
|
|
3914
3914
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
3915
3915
|
value: record.id,
|
|
3916
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
3916
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _218 => _218.includes, 'call', _219 => _219(record.id)])
|
|
3917
3917
|
}));
|
|
3918
3918
|
}
|
|
3919
3919
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -4232,7 +4232,7 @@ function createVttLoader() {
|
|
|
4232
4232
|
if (!input2) {
|
|
4233
4233
|
return "";
|
|
4234
4234
|
}
|
|
4235
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
4235
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _220 => _220.parse, 'call', _221 => _221(input2), 'optionalAccess', _222 => _222.cues]);
|
|
4236
4236
|
if (Object.keys(vtt).length === 0) {
|
|
4237
4237
|
return {};
|
|
4238
4238
|
} else {
|
|
@@ -4286,7 +4286,7 @@ function variableExtractLoader(params) {
|
|
|
4286
4286
|
for (let i = 0; i < matches.length; i++) {
|
|
4287
4287
|
const match2 = matches[i];
|
|
4288
4288
|
const currentValue = result[key].value;
|
|
4289
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
4289
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _223 => _223.replace, 'call', _224 => _224(match2, `{variable:${i}}`)]);
|
|
4290
4290
|
result[key].value = newValue;
|
|
4291
4291
|
result[key].variables[i] = match2;
|
|
4292
4292
|
}
|
|
@@ -4300,7 +4300,7 @@ function variableExtractLoader(params) {
|
|
|
4300
4300
|
for (let i = 0; i < valueObj.variables.length; i++) {
|
|
4301
4301
|
const variable = valueObj.variables[i];
|
|
4302
4302
|
const currentValue = result[key];
|
|
4303
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
4303
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _225 => _225.replace, 'call', _226 => _226(`{variable:${i}}`, variable)]);
|
|
4304
4304
|
result[key] = newValue;
|
|
4305
4305
|
}
|
|
4306
4306
|
}
|
|
@@ -4500,7 +4500,7 @@ function createVueJsonLoader() {
|
|
|
4500
4500
|
return createLoader({
|
|
4501
4501
|
pull: async (locale, input2, ctx) => {
|
|
4502
4502
|
const parsed = parseVueFile(input2);
|
|
4503
|
-
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess',
|
|
4503
|
+
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _227 => _227.i18n, 'optionalAccess', _228 => _228[locale]]), () => ( {}));
|
|
4504
4504
|
},
|
|
4505
4505
|
push: async (locale, data, originalInput) => {
|
|
4506
4506
|
const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
|
|
@@ -4535,7 +4535,6 @@ function parseVueFile(input2) {
|
|
|
4535
4535
|
|
|
4536
4536
|
// src/cli/loaders/typescript/index.ts
|
|
4537
4537
|
var _parser = require('@babel/parser');
|
|
4538
|
-
|
|
4539
4538
|
var _traverse = require('@babel/traverse'); var _traverse2 = _interopRequireDefault(_traverse);
|
|
4540
4539
|
var _types = require('@babel/types'); var t = _interopRequireWildcard(_types);
|
|
4541
4540
|
var _generator = require('@babel/generator'); var _generator2 = _interopRequireDefault(_generator);
|
|
@@ -4571,8 +4570,7 @@ function createTypescriptLoader() {
|
|
|
4571
4570
|
},
|
|
4572
4571
|
push: async (locale, data, originalInput, defaultLocale, pullInput, pullOutput) => {
|
|
4573
4572
|
const ast = parseTypeScript(originalInput || "");
|
|
4574
|
-
|
|
4575
|
-
updateStringsInDefaultExport(ast, finalData);
|
|
4573
|
+
updateStringsInDefaultExport(ast, data);
|
|
4576
4574
|
const { code } = generate(ast, {
|
|
4577
4575
|
jsescOption: {
|
|
4578
4576
|
minimal: true
|
|
@@ -4682,12 +4680,22 @@ function updateStringsInDefaultExport(ast, data) {
|
|
|
4682
4680
|
}
|
|
4683
4681
|
function updateStringsInObjectExpression(objectExpression, data) {
|
|
4684
4682
|
let modified = false;
|
|
4683
|
+
const propertiesToKeep = [];
|
|
4685
4684
|
objectExpression.properties.forEach((prop) => {
|
|
4686
|
-
if (!t.isObjectProperty(prop))
|
|
4685
|
+
if (!t.isObjectProperty(prop)) {
|
|
4686
|
+
propertiesToKeep.push(prop);
|
|
4687
|
+
return;
|
|
4688
|
+
}
|
|
4687
4689
|
const key = getPropertyKey(prop);
|
|
4688
|
-
const incomingVal = _optionalChain([data, 'optionalAccess',
|
|
4690
|
+
const incomingVal = _optionalChain([data, 'optionalAccess', _229 => _229[key]]);
|
|
4689
4691
|
if (incomingVal === void 0) {
|
|
4690
|
-
|
|
4692
|
+
if (t.isStringLiteral(prop.value) || t.isTemplateLiteral(prop.value) && prop.value.expressions.length === 0 || t.isObjectExpression(prop.value) || t.isArrayExpression(prop.value)) {
|
|
4693
|
+
modified = true;
|
|
4694
|
+
return;
|
|
4695
|
+
} else {
|
|
4696
|
+
propertiesToKeep.push(prop);
|
|
4697
|
+
return;
|
|
4698
|
+
}
|
|
4691
4699
|
}
|
|
4692
4700
|
if (t.isStringLiteral(prop.value) && typeof incomingVal === "string") {
|
|
4693
4701
|
if (prop.value.value !== incomingVal) {
|
|
@@ -4714,14 +4722,18 @@ function updateStringsInObjectExpression(objectExpression, data) {
|
|
|
4714
4722
|
);
|
|
4715
4723
|
modified = subModified || modified;
|
|
4716
4724
|
}
|
|
4725
|
+
propertiesToKeep.push(prop);
|
|
4717
4726
|
});
|
|
4727
|
+
if (modified) {
|
|
4728
|
+
objectExpression.properties = propertiesToKeep;
|
|
4729
|
+
}
|
|
4718
4730
|
return modified;
|
|
4719
4731
|
}
|
|
4720
4732
|
function updateStringsInArrayExpression(arrayExpression, incoming) {
|
|
4721
4733
|
let modified = false;
|
|
4722
4734
|
arrayExpression.elements.forEach((element, index) => {
|
|
4723
4735
|
if (!element) return;
|
|
4724
|
-
const incomingVal = _optionalChain([incoming, 'optionalAccess',
|
|
4736
|
+
const incomingVal = _optionalChain([incoming, 'optionalAccess', _230 => _230[index]]);
|
|
4725
4737
|
if (incomingVal === void 0) return;
|
|
4726
4738
|
if (t.isStringLiteral(element) && typeof incomingVal === "string") {
|
|
4727
4739
|
if (element.value !== incomingVal) {
|
|
@@ -5212,7 +5224,7 @@ var AST = class _AST {
|
|
|
5212
5224
|
const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
|
|
5213
5225
|
if (this.isStart() && !this.type)
|
|
5214
5226
|
ret.unshift([]);
|
|
5215
|
-
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
5227
|
+
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _231 => _231.#parent, 'optionalAccess', _232 => _232.type]) === "!")) {
|
|
5216
5228
|
ret.push({});
|
|
5217
5229
|
}
|
|
5218
5230
|
return ret;
|
|
@@ -5220,7 +5232,7 @@ var AST = class _AST {
|
|
|
5220
5232
|
isStart() {
|
|
5221
5233
|
if (this.#root === this)
|
|
5222
5234
|
return true;
|
|
5223
|
-
if (!_optionalChain([this, 'access',
|
|
5235
|
+
if (!_optionalChain([this, 'access', _233 => _233.#parent, 'optionalAccess', _234 => _234.isStart, 'call', _235 => _235()]))
|
|
5224
5236
|
return false;
|
|
5225
5237
|
if (this.#parentIndex === 0)
|
|
5226
5238
|
return true;
|
|
@@ -5236,12 +5248,12 @@ var AST = class _AST {
|
|
|
5236
5248
|
isEnd() {
|
|
5237
5249
|
if (this.#root === this)
|
|
5238
5250
|
return true;
|
|
5239
|
-
if (_optionalChain([this, 'access',
|
|
5251
|
+
if (_optionalChain([this, 'access', _236 => _236.#parent, 'optionalAccess', _237 => _237.type]) === "!")
|
|
5240
5252
|
return true;
|
|
5241
|
-
if (!_optionalChain([this, 'access',
|
|
5253
|
+
if (!_optionalChain([this, 'access', _238 => _238.#parent, 'optionalAccess', _239 => _239.isEnd, 'call', _240 => _240()]))
|
|
5242
5254
|
return false;
|
|
5243
5255
|
if (!this.type)
|
|
5244
|
-
return _optionalChain([this, 'access',
|
|
5256
|
+
return _optionalChain([this, 'access', _241 => _241.#parent, 'optionalAccess', _242 => _242.isEnd, 'call', _243 => _243()]);
|
|
5245
5257
|
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
|
5246
5258
|
return this.#parentIndex === pl - 1;
|
|
5247
5259
|
}
|
|
@@ -5463,7 +5475,7 @@ var AST = class _AST {
|
|
|
5463
5475
|
if (!this.type) {
|
|
5464
5476
|
const noEmpty = this.isStart() && this.isEnd();
|
|
5465
5477
|
const src = this.#parts.map((p) => {
|
|
5466
|
-
const [re,
|
|
5478
|
+
const [re, _34, hasMagic, uflag] = typeof p === "string" ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
|
5467
5479
|
this.#hasMagic = this.#hasMagic || hasMagic;
|
|
5468
5480
|
this.#uflag = this.#uflag || uflag;
|
|
5469
5481
|
return re;
|
|
@@ -5486,7 +5498,7 @@ var AST = class _AST {
|
|
|
5486
5498
|
}
|
|
5487
5499
|
}
|
|
5488
5500
|
let end = "";
|
|
5489
|
-
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
5501
|
+
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _244 => _244.#parent, 'optionalAccess', _245 => _245.type]) === "!") {
|
|
5490
5502
|
end = "(?:$|\\/)";
|
|
5491
5503
|
}
|
|
5492
5504
|
const final2 = start2 + src + end;
|
|
@@ -5536,7 +5548,7 @@ var AST = class _AST {
|
|
|
5536
5548
|
if (typeof p === "string") {
|
|
5537
5549
|
throw new Error("string type in extglob ast??");
|
|
5538
5550
|
}
|
|
5539
|
-
const [re,
|
|
5551
|
+
const [re, _34, _hasMagic, uflag] = p.toRegExpSource(dot);
|
|
5540
5552
|
this.#uflag = this.#uflag || uflag;
|
|
5541
5553
|
return re;
|
|
5542
5554
|
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
|
|
@@ -5781,7 +5793,7 @@ var Minimatch = class {
|
|
|
5781
5793
|
}
|
|
5782
5794
|
return false;
|
|
5783
5795
|
}
|
|
5784
|
-
debug(...
|
|
5796
|
+
debug(..._34) {
|
|
5785
5797
|
}
|
|
5786
5798
|
make() {
|
|
5787
5799
|
const pattern = this.pattern;
|
|
@@ -5803,7 +5815,7 @@ var Minimatch = class {
|
|
|
5803
5815
|
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
5804
5816
|
this.globParts = this.preprocess(rawGlobParts);
|
|
5805
5817
|
this.debug(this.pattern, this.globParts);
|
|
5806
|
-
let set = this.globParts.map((s,
|
|
5818
|
+
let set = this.globParts.map((s, _34, __) => {
|
|
5807
5819
|
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
5808
5820
|
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
5809
5821
|
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
@@ -6563,7 +6575,7 @@ function createMdxSectionsSplit2Loader() {
|
|
|
6563
6575
|
const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
|
|
6564
6576
|
const result = {
|
|
6565
6577
|
frontmatter: data.frontmatter,
|
|
6566
|
-
codePlaceholders: _optionalChain([pullInput, 'optionalAccess',
|
|
6578
|
+
codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _246 => _246.codePlaceholders]) || {},
|
|
6567
6579
|
content
|
|
6568
6580
|
};
|
|
6569
6581
|
return result;
|
|
@@ -6637,11 +6649,10 @@ function createIgnoredKeysLoader(ignoredKeys) {
|
|
|
6637
6649
|
return result;
|
|
6638
6650
|
},
|
|
6639
6651
|
push: async (locale, data, originalInput, originalLocale, pullInput) => {
|
|
6640
|
-
const
|
|
6641
|
-
|
|
6652
|
+
const result = _lodash2.default.omitBy(
|
|
6653
|
+
data,
|
|
6642
6654
|
(value, key) => _isIgnoredKey(key, ignoredKeys)
|
|
6643
6655
|
);
|
|
6644
|
-
const result = _lodash2.default.merge({}, data, ignoredSubObject);
|
|
6645
6656
|
return result;
|
|
6646
6657
|
}
|
|
6647
6658
|
});
|
|
@@ -6834,7 +6845,7 @@ function createTxtLoader() {
|
|
|
6834
6845
|
const sortedEntries = Object.entries(payload).sort(
|
|
6835
6846
|
([a], [b]) => parseInt(a) - parseInt(b)
|
|
6836
6847
|
);
|
|
6837
|
-
return sortedEntries.map(([
|
|
6848
|
+
return sortedEntries.map(([_34, value]) => value).join("\n");
|
|
6838
6849
|
}
|
|
6839
6850
|
});
|
|
6840
6851
|
}
|
|
@@ -7300,7 +7311,7 @@ function createBasicTranslator(model, systemPrompt) {
|
|
|
7300
7311
|
]
|
|
7301
7312
|
});
|
|
7302
7313
|
const result = JSON.parse(response.text);
|
|
7303
|
-
return _optionalChain([result, 'optionalAccess',
|
|
7314
|
+
return _optionalChain([result, 'optionalAccess', _247 => _247.data]) || {};
|
|
7304
7315
|
}
|
|
7305
7316
|
}
|
|
7306
7317
|
function extractPayloadChunks(payload) {
|
|
@@ -7382,7 +7393,7 @@ function getPureModelProvider(provider) {
|
|
|
7382
7393
|
|
|
7383
7394
|
${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
|
|
7384
7395
|
`;
|
|
7385
|
-
switch (_optionalChain([provider, 'optionalAccess',
|
|
7396
|
+
switch (_optionalChain([provider, 'optionalAccess', _248 => _248.id])) {
|
|
7386
7397
|
case "openai": {
|
|
7387
7398
|
if (!process.env.OPENAI_API_KEY) {
|
|
7388
7399
|
throw new Error(
|
|
@@ -7440,7 +7451,7 @@ function getPureModelProvider(provider) {
|
|
|
7440
7451
|
})(provider.model);
|
|
7441
7452
|
}
|
|
7442
7453
|
default: {
|
|
7443
|
-
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess',
|
|
7454
|
+
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _249 => _249.id])));
|
|
7444
7455
|
}
|
|
7445
7456
|
}
|
|
7446
7457
|
}
|
|
@@ -7680,7 +7691,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
7680
7691
|
validateParams(i18nConfig, flags);
|
|
7681
7692
|
ora.succeed("Localization configuration is valid");
|
|
7682
7693
|
ora.start("Connecting to Lingo.dev Localization Engine...");
|
|
7683
|
-
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess',
|
|
7694
|
+
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _250 => _250.provider]);
|
|
7684
7695
|
if (isByokMode) {
|
|
7685
7696
|
authId = null;
|
|
7686
7697
|
ora.succeed("Using external provider (BYOK mode)");
|
|
@@ -7694,16 +7705,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
7694
7705
|
flags
|
|
7695
7706
|
});
|
|
7696
7707
|
let buckets = getBuckets(i18nConfig);
|
|
7697
|
-
if (_optionalChain([flags, 'access',
|
|
7708
|
+
if (_optionalChain([flags, 'access', _251 => _251.bucket, 'optionalAccess', _252 => _252.length])) {
|
|
7698
7709
|
buckets = buckets.filter(
|
|
7699
7710
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
7700
7711
|
);
|
|
7701
7712
|
}
|
|
7702
7713
|
ora.succeed("Buckets retrieved");
|
|
7703
|
-
if (_optionalChain([flags, 'access',
|
|
7714
|
+
if (_optionalChain([flags, 'access', _253 => _253.file, 'optionalAccess', _254 => _254.length])) {
|
|
7704
7715
|
buckets = buckets.map((bucket) => {
|
|
7705
7716
|
const paths = bucket.paths.filter(
|
|
7706
|
-
(path17) => flags.file.find((file) => _optionalChain([path17, 'access',
|
|
7717
|
+
(path17) => flags.file.find((file) => _optionalChain([path17, 'access', _255 => _255.pathPattern, 'optionalAccess', _256 => _256.includes, 'call', _257 => _257(file)]))
|
|
7707
7718
|
);
|
|
7708
7719
|
return { ...bucket, paths };
|
|
7709
7720
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -7722,7 +7733,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
7722
7733
|
});
|
|
7723
7734
|
}
|
|
7724
7735
|
}
|
|
7725
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
7736
|
+
const targetLocales = _optionalChain([flags, 'access', _258 => _258.locale, 'optionalAccess', _259 => _259.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
7726
7737
|
ora.start("Setting up localization cache...");
|
|
7727
7738
|
const checkLockfileProcessor = createDeltaProcessor("");
|
|
7728
7739
|
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
@@ -7893,7 +7904,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
7893
7904
|
if (flags.key) {
|
|
7894
7905
|
processableData = _lodash2.default.pickBy(
|
|
7895
7906
|
processableData,
|
|
7896
|
-
(
|
|
7907
|
+
(_34, key) => key === flags.key
|
|
7897
7908
|
);
|
|
7898
7909
|
}
|
|
7899
7910
|
if (flags.verbose) {
|
|
@@ -7981,7 +7992,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
7981
7992
|
}
|
|
7982
7993
|
const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
|
|
7983
7994
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
7984
|
-
if (!_optionalChain([flags, 'access',
|
|
7995
|
+
if (!_optionalChain([flags, 'access', _260 => _260.locale, 'optionalAccess', _261 => _261.length])) {
|
|
7985
7996
|
await deltaProcessor.saveChecksums(checksums);
|
|
7986
7997
|
}
|
|
7987
7998
|
}
|
|
@@ -8065,12 +8076,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
8065
8076
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
8066
8077
|
docUrl: "bucketNotFound"
|
|
8067
8078
|
});
|
|
8068
|
-
} else if (_optionalChain([flags, 'access',
|
|
8079
|
+
} else if (_optionalChain([flags, 'access', _262 => _262.locale, 'optionalAccess', _263 => _263.some, 'call', _264 => _264((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
8069
8080
|
throw new CLIError({
|
|
8070
8081
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
8071
8082
|
docUrl: "localeTargetNotFound"
|
|
8072
8083
|
});
|
|
8073
|
-
} else if (_optionalChain([flags, 'access',
|
|
8084
|
+
} else if (_optionalChain([flags, 'access', _265 => _265.bucket, 'optionalAccess', _266 => _266.some, 'call', _267 => _267(
|
|
8074
8085
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
8075
8086
|
)])) {
|
|
8076
8087
|
throw new CLIError({
|
|
@@ -8450,7 +8461,7 @@ var _stdiojs = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
|
8450
8461
|
var _mcpjs = require('@modelcontextprotocol/sdk/server/mcp.js');
|
|
8451
8462
|
|
|
8452
8463
|
|
|
8453
|
-
var mcp_default = new (0, _interactivecommander.Command)().command("mcp").description("Use Lingo.dev model context provider with your AI agent").helpOption("-h, --help", "Show help").action(async (
|
|
8464
|
+
var mcp_default = new (0, _interactivecommander.Command)().command("mcp").description("Use Lingo.dev model context provider with your AI agent").helpOption("-h, --help", "Show help").action(async (_34, program) => {
|
|
8454
8465
|
const apiKey = program.args[0];
|
|
8455
8466
|
const settings = getSettings(apiKey);
|
|
8456
8467
|
if (!settings.auth.apiKey) {
|
|
@@ -8574,7 +8585,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
|
|
|
8574
8585
|
const response = await engine.whoami();
|
|
8575
8586
|
return {
|
|
8576
8587
|
authenticated: !!response,
|
|
8577
|
-
username: _optionalChain([response, 'optionalAccess',
|
|
8588
|
+
username: _optionalChain([response, 'optionalAccess', _268 => _268.email])
|
|
8578
8589
|
};
|
|
8579
8590
|
} catch (e2) {
|
|
8580
8591
|
return { authenticated: false };
|
|
@@ -8682,7 +8693,7 @@ function createExplicitLocalizer(provider) {
|
|
|
8682
8693
|
}
|
|
8683
8694
|
function createAiSdkLocalizer(params) {
|
|
8684
8695
|
const skipAuth = params.skipAuth === true;
|
|
8685
|
-
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
8696
|
+
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _269 => _269.apiKeyName]), () => ( ""))];
|
|
8686
8697
|
if (!skipAuth && !apiKey || !params.apiKeyName) {
|
|
8687
8698
|
throw new Error(
|
|
8688
8699
|
_dedent2.default`
|
|
@@ -8807,8 +8818,8 @@ async function setup(input2) {
|
|
|
8807
8818
|
throw new Error(
|
|
8808
8819
|
"No buckets found in i18n.json. Please add at least one bucket containing i18n content."
|
|
8809
8820
|
);
|
|
8810
|
-
} else if (_optionalChain([ctx, 'access',
|
|
8811
|
-
(bucket) => !_optionalChain([ctx, 'access',
|
|
8821
|
+
} else if (_optionalChain([ctx, 'access', _270 => _270.flags, 'access', _271 => _271.bucket, 'optionalAccess', _272 => _272.some, 'call', _273 => _273(
|
|
8822
|
+
(bucket) => !_optionalChain([ctx, 'access', _274 => _274.config, 'optionalAccess', _275 => _275.buckets, 'access', _276 => _276[bucket]])
|
|
8812
8823
|
)])) {
|
|
8813
8824
|
throw new Error(
|
|
8814
8825
|
`One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
|
|
@@ -8821,7 +8832,7 @@ async function setup(input2) {
|
|
|
8821
8832
|
title: "Selecting localization provider",
|
|
8822
8833
|
task: async (ctx, task) => {
|
|
8823
8834
|
ctx.localizer = createLocalizer(
|
|
8824
|
-
_optionalChain([ctx, 'access',
|
|
8835
|
+
_optionalChain([ctx, 'access', _277 => _277.config, 'optionalAccess', _278 => _278.provider]),
|
|
8825
8836
|
ctx.flags.apiKey
|
|
8826
8837
|
);
|
|
8827
8838
|
if (!ctx.localizer) {
|
|
@@ -8980,6 +8991,7 @@ async function plan(input2) {
|
|
|
8980
8991
|
injectLocale: bucket.injectLocale || [],
|
|
8981
8992
|
lockedKeys: bucket.lockedKeys || [],
|
|
8982
8993
|
lockedPatterns: bucket.lockedPatterns || [],
|
|
8994
|
+
ignoredKeys: bucket.ignoredKeys || [],
|
|
8983
8995
|
onlyKeys: input2.flags.key || []
|
|
8984
8996
|
});
|
|
8985
8997
|
}
|
|
@@ -9036,7 +9048,7 @@ async function execute(input2) {
|
|
|
9036
9048
|
const workerTasks = [];
|
|
9037
9049
|
for (let i = 0; i < workersCount; i++) {
|
|
9038
9050
|
const assignedTasks = ctx.tasks.filter(
|
|
9039
|
-
(
|
|
9051
|
+
(_34, idx) => idx % workersCount === i
|
|
9040
9052
|
);
|
|
9041
9053
|
workerTasks.push(
|
|
9042
9054
|
createWorkerTask({
|
|
@@ -9104,7 +9116,8 @@ function createLoaderForTask(assignedTask) {
|
|
|
9104
9116
|
injectLocale: assignedTask.injectLocale
|
|
9105
9117
|
},
|
|
9106
9118
|
assignedTask.lockedKeys,
|
|
9107
|
-
assignedTask.lockedPatterns
|
|
9119
|
+
assignedTask.lockedPatterns,
|
|
9120
|
+
assignedTask.ignoredKeys
|
|
9108
9121
|
);
|
|
9109
9122
|
bucketLoader.setDefaultLocale(assignedTask.sourceLocale);
|
|
9110
9123
|
return bucketLoader;
|
|
@@ -9140,7 +9153,7 @@ function createWorkerTask(args) {
|
|
|
9140
9153
|
const processableData = _lodash2.default.chain(sourceData).entries().filter(
|
|
9141
9154
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
|
|
9142
9155
|
).filter(
|
|
9143
|
-
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access',
|
|
9156
|
+
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _279 => _279.onlyKeys, 'optionalAccess', _280 => _280.some, 'call', _281 => _281(
|
|
9144
9157
|
(pattern) => minimatch(key, pattern)
|
|
9145
9158
|
)])
|
|
9146
9159
|
).fromPairs().value();
|
|
@@ -9203,7 +9216,7 @@ function createWorkerTask(args) {
|
|
|
9203
9216
|
finalRenamedTargetData
|
|
9204
9217
|
);
|
|
9205
9218
|
const checksums2 = await deltaProcessor.createChecksums(sourceData);
|
|
9206
|
-
if (!_optionalChain([args, 'access',
|
|
9219
|
+
if (!_optionalChain([args, 'access', _282 => _282.ctx, 'access', _283 => _283.flags, 'access', _284 => _284.targetLocale, 'optionalAccess', _285 => _285.length])) {
|
|
9207
9220
|
await deltaProcessor.saveChecksums(checksums2);
|
|
9208
9221
|
}
|
|
9209
9222
|
});
|
|
@@ -9393,13 +9406,13 @@ var flagsSchema2 = _zod.z.object({
|
|
|
9393
9406
|
|
|
9394
9407
|
// src/cli/cmd/run/_utils.ts
|
|
9395
9408
|
async function determineAuthId(ctx) {
|
|
9396
|
-
const isByokMode = !!_optionalChain([ctx, 'access',
|
|
9409
|
+
const isByokMode = !!_optionalChain([ctx, 'access', _286 => _286.config, 'optionalAccess', _287 => _287.provider]);
|
|
9397
9410
|
if (isByokMode) {
|
|
9398
9411
|
return null;
|
|
9399
9412
|
} else {
|
|
9400
9413
|
try {
|
|
9401
|
-
const authStatus = await _optionalChain([ctx, 'access',
|
|
9402
|
-
return _optionalChain([authStatus, 'optionalAccess',
|
|
9414
|
+
const authStatus = await _optionalChain([ctx, 'access', _288 => _288.localizer, 'optionalAccess', _289 => _289.checkAuth, 'call', _290 => _290()]);
|
|
9415
|
+
return _optionalChain([authStatus, 'optionalAccess', _291 => _291.username]) || null;
|
|
9403
9416
|
} catch (e3) {
|
|
9404
9417
|
return null;
|
|
9405
9418
|
}
|
|
@@ -9559,7 +9572,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
9559
9572
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
9560
9573
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
9561
9574
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
9562
|
-
_optionalChain([this, 'access',
|
|
9575
|
+
_optionalChain([this, 'access', _292 => _292.platformKit, 'optionalAccess', _293 => _293.gitConfig, 'call', _294 => _294()]);
|
|
9563
9576
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
9564
9577
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
9565
9578
|
if (!processOwnCommits) {
|
|
@@ -9591,7 +9604,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
9591
9604
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
9592
9605
|
var PullRequestFlow = class extends InBranchFlow {
|
|
9593
9606
|
async preRun() {
|
|
9594
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
9607
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _295 => _295()]);
|
|
9595
9608
|
if (!canContinue) {
|
|
9596
9609
|
return false;
|
|
9597
9610
|
}
|
|
@@ -9854,10 +9867,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
9854
9867
|
repo_slug: this.platformConfig.repositoryName,
|
|
9855
9868
|
state: "OPEN"
|
|
9856
9869
|
}).then(({ data: { values } }) => {
|
|
9857
|
-
return _optionalChain([values, 'optionalAccess',
|
|
9858
|
-
({ source, destination }) => _optionalChain([source, 'optionalAccess',
|
|
9870
|
+
return _optionalChain([values, 'optionalAccess', _296 => _296.find, 'call', _297 => _297(
|
|
9871
|
+
({ source, destination }) => _optionalChain([source, 'optionalAccess', _298 => _298.branch, 'optionalAccess', _299 => _299.name]) === branch && _optionalChain([destination, 'optionalAccess', _300 => _300.branch, 'optionalAccess', _301 => _301.name]) === this.platformConfig.baseBranchName
|
|
9859
9872
|
)]);
|
|
9860
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
9873
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _302 => _302.id]));
|
|
9861
9874
|
}
|
|
9862
9875
|
async closePullRequest({ pullRequestNumber }) {
|
|
9863
9876
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -9953,7 +9966,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
9953
9966
|
repo: this.platformConfig.repositoryName,
|
|
9954
9967
|
base: this.platformConfig.baseBranchName,
|
|
9955
9968
|
state: "open"
|
|
9956
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
9969
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _303 => _303.number]));
|
|
9957
9970
|
}
|
|
9958
9971
|
async closePullRequest({ pullRequestNumber }) {
|
|
9959
9972
|
await this.octokit.rest.pulls.update({
|
|
@@ -10080,7 +10093,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
10080
10093
|
sourceBranch: branch,
|
|
10081
10094
|
state: "opened"
|
|
10082
10095
|
});
|
|
10083
|
-
return _optionalChain([mergeRequests, 'access',
|
|
10096
|
+
return _optionalChain([mergeRequests, 'access', _304 => _304[0], 'optionalAccess', _305 => _305.iid]);
|
|
10084
10097
|
}
|
|
10085
10098
|
async closePullRequest({
|
|
10086
10099
|
pullRequestNumber
|
|
@@ -10170,7 +10183,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
10170
10183
|
}
|
|
10171
10184
|
const env = {
|
|
10172
10185
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
10173
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
10186
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _306 => _306.pullRequest, 'optionalAccess', _307 => _307.toString, 'call', _308 => _308()]) || "false",
|
|
10174
10187
|
...options.commitMessage && {
|
|
10175
10188
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
10176
10189
|
},
|
|
@@ -10190,7 +10203,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
10190
10203
|
const { isPullRequestMode } = platformKit.config;
|
|
10191
10204
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
10192
10205
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
10193
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
10206
|
+
const canRun = await _optionalChain([flow, 'access', _309 => _309.preRun, 'optionalCall', _310 => _310()]);
|
|
10194
10207
|
if (canRun === false) {
|
|
10195
10208
|
return;
|
|
10196
10209
|
}
|
|
@@ -10200,7 +10213,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
10200
10213
|
if (!hasChanges) {
|
|
10201
10214
|
return;
|
|
10202
10215
|
}
|
|
10203
|
-
await _optionalChain([flow, 'access',
|
|
10216
|
+
await _optionalChain([flow, 'access', _311 => _311.postRun, 'optionalCall', _312 => _312()]);
|
|
10204
10217
|
});
|
|
10205
10218
|
function parseBooleanArg(val) {
|
|
10206
10219
|
if (val === true) return true;
|
|
@@ -10269,17 +10282,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
10269
10282
|
flags
|
|
10270
10283
|
});
|
|
10271
10284
|
let buckets = getBuckets(i18nConfig);
|
|
10272
|
-
if (_optionalChain([flags, 'access',
|
|
10285
|
+
if (_optionalChain([flags, 'access', _313 => _313.bucket, 'optionalAccess', _314 => _314.length])) {
|
|
10273
10286
|
buckets = buckets.filter(
|
|
10274
10287
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
10275
10288
|
);
|
|
10276
10289
|
}
|
|
10277
10290
|
ora.succeed("Buckets retrieved");
|
|
10278
|
-
if (_optionalChain([flags, 'access',
|
|
10291
|
+
if (_optionalChain([flags, 'access', _315 => _315.file, 'optionalAccess', _316 => _316.length])) {
|
|
10279
10292
|
buckets = buckets.map((bucket) => {
|
|
10280
10293
|
const paths = bucket.paths.filter(
|
|
10281
10294
|
(path17) => flags.file.find(
|
|
10282
|
-
(file) => _optionalChain([path17, 'access',
|
|
10295
|
+
(file) => _optionalChain([path17, 'access', _317 => _317.pathPattern, 'optionalAccess', _318 => _318.includes, 'call', _319 => _319(file)]) || _optionalChain([path17, 'access', _320 => _320.pathPattern, 'optionalAccess', _321 => _321.match, 'call', _322 => _322(file)]) || minimatch(path17.pathPattern, file)
|
|
10283
10296
|
)
|
|
10284
10297
|
);
|
|
10285
10298
|
return { ...bucket, paths };
|
|
@@ -10299,7 +10312,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
10299
10312
|
});
|
|
10300
10313
|
}
|
|
10301
10314
|
}
|
|
10302
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
10315
|
+
const targetLocales = _optionalChain([flags, 'access', _323 => _323.locale, 'optionalAccess', _324 => _324.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
10303
10316
|
let totalSourceKeyCount = 0;
|
|
10304
10317
|
let uniqueKeysToTranslate = 0;
|
|
10305
10318
|
let totalExistingTranslations = 0;
|
|
@@ -10703,12 +10716,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
10703
10716
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
10704
10717
|
docUrl: "bucketNotFound"
|
|
10705
10718
|
});
|
|
10706
|
-
} else if (_optionalChain([flags, 'access',
|
|
10719
|
+
} else if (_optionalChain([flags, 'access', _325 => _325.locale, 'optionalAccess', _326 => _326.some, 'call', _327 => _327((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
10707
10720
|
throw new CLIError({
|
|
10708
10721
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
10709
10722
|
docUrl: "localeTargetNotFound"
|
|
10710
10723
|
});
|
|
10711
|
-
} else if (_optionalChain([flags, 'access',
|
|
10724
|
+
} else if (_optionalChain([flags, 'access', _328 => _328.bucket, 'optionalAccess', _329 => _329.some, 'call', _330 => _330(
|
|
10712
10725
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
10713
10726
|
)])) {
|
|
10714
10727
|
throw new CLIError({
|
|
@@ -10800,7 +10813,7 @@ async function renderHero2() {
|
|
|
10800
10813
|
// package.json
|
|
10801
10814
|
var package_default = {
|
|
10802
10815
|
name: "lingo.dev",
|
|
10803
|
-
version: "0.
|
|
10816
|
+
version: "0.110.0",
|
|
10804
10817
|
description: "Lingo.dev CLI",
|
|
10805
10818
|
private: false,
|
|
10806
10819
|
publishConfig: {
|
|
@@ -11077,7 +11090,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
|
|
|
11077
11090
|
if (options.file && options.file.length) {
|
|
11078
11091
|
buckets = buckets.map((bucket) => {
|
|
11079
11092
|
const paths = bucket.paths.filter(
|
|
11080
|
-
(bucketPath) => _optionalChain([options, 'access',
|
|
11093
|
+
(bucketPath) => _optionalChain([options, 'access', _331 => _331.file, 'optionalAccess', _332 => _332.some, 'call', _333 => _333((f) => bucketPath.pathPattern.includes(f))])
|
|
11081
11094
|
);
|
|
11082
11095
|
return { ...bucket, paths };
|
|
11083
11096
|
}).filter((bucket) => bucket.paths.length > 0);
|