lingo.dev 0.110.0 → 0.110.2
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 +146 -159
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +79 -92
- package/build/cli.mjs.map +1 -1
- package/package.json +4 -4
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', _36 => _36.auth, 'optionalAccess', _37 => _37.apiKey]) || defaults2.auth.apiKey,
|
|
26
|
+
apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _38 => _38.auth, 'optionalAccess', _39 => _39.apiUrl]) || defaults2.auth.apiUrl,
|
|
27
|
+
webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _40 => _40.auth, 'optionalAccess', _41 => _41.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', _42 => _42.llm, 'optionalAccess', _43 => _43.openaiApiKey]),
|
|
31
|
+
anthropicApiKey: env.ANTHROPIC_API_KEY || _optionalChain([systemFile, 'access', _44 => _44.llm, 'optionalAccess', _45 => _45.anthropicApiKey]),
|
|
32
|
+
groqApiKey: env.GROQ_API_KEY || _optionalChain([systemFile, 'access', _46 => _46.llm, 'optionalAccess', _47 => _47.groqApiKey]),
|
|
33
|
+
googleApiKey: env.GOOGLE_API_KEY || _optionalChain([systemFile, 'access', _48 => _48.llm, 'optionalAccess', _49 => _49.googleApiKey]),
|
|
34
|
+
openrouterApiKey: env.OPENROUTER_API_KEY || _optionalChain([systemFile, 'access', _50 => _50.llm, 'optionalAccess', _51 => _51.openrouterApiKey]),
|
|
35
|
+
mistralApiKey: env.MISTRAL_API_KEY || _optionalChain([systemFile, 'access', _52 => _52.llm, 'optionalAccess', _53 => _53.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', _54 => _54.auth, 'optionalAccess', _55 => _55.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', _56 => _56.llm, 'optionalAccess', _57 => _57.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', _58 => _58.llm, 'optionalAccess', _59 => _59.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', _60 => _60.llm, 'optionalAccess', _61 => _61.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', _62 => _62.llm, 'optionalAccess', _63 => _63.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', _64 => _64.llm, 'optionalAccess', _65 => _65.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', _66 => _66.llm, 'optionalAccess', _67 => _67.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', _68 => _68.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', _69 => _69.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', _70 => _70.exclude, 'optionalAccess', _71 => _71.map, 'call', _72 => _72(
|
|
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', _73 => _73.flatMap, 'call', _74 => _74(
|
|
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', _75 => _75.init, 'optionalCall', _76 => _76()]);
|
|
1507
1507
|
}
|
|
1508
1508
|
},
|
|
1509
1509
|
setDefaultLocale(locale) {
|
|
1510
1510
|
for (const loader of loaders) {
|
|
1511
|
-
_optionalChain([loader, 'access',
|
|
1511
|
+
_optionalChain([loader, 'access', _77 => _77.setDefaultLocale, 'optionalCall', _78 => _78(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', _79 => _79[i], 'access', _80 => _80.pullHints, 'optionalCall', _81 => _81(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', _82 => _82.init, 'optionalCall', _83 => _83()]);
|
|
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', _84 => _84.pullHints, 'optionalCall', _85 => _85(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', _86 => _86.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, _35, 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', _87 => _87.match, 'call', _88 => _88(/[\r\n]$/)])) {
|
|
2005
|
+
const ending = _optionalChain([templateData, 'optionalAccess', _89 => _89.includes, 'call', _90 => _90("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _91 => _91.includes, 'call', _92 => _92("\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', _93 => _93[0], 'optionalAccess', _94 => _94.trim, 'call', _95 => _95()]);
|
|
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', _96 => _96.textContent, 'optionalAccess', _97 => _97.trim, 'call', _98 => _98()])
|
|
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', _99 => _99.textContent, 'optionalAccess', _100 => _100.trim, 'call', _101 => _101()])
|
|
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', _102 => _102.textContent, 'optionalAccess', _103 => _103.trim, 'call', _104 => _104()])
|
|
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', _105 => _105.textContent, 'optionalAccess', _106 => _106.trim, 'call', _107 => _107()])
|
|
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', _108 => _108.textContent, 'optionalAccess', _109 => _109.trim, 'call', _110 => _110()])
|
|
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', _111 => _111.trim, 'call', _112 => _112()]), () => ( ""))).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', _113 => _113.trim, 'call', _114 => _114()]), () => ( ""))).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(([_35, 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', _115 => _115.trim, 'call', _116 => _116()]) || "",
|
|
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', _117 => _117.localizations, 'optionalAccess', _118 => _118[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', _119 => _119[form], 'optionalAccess', _120 => _120.stringUnit, 'optionalAccess', _121 => _121.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', _122 => _122.strings, 'optionalAccess', _123 => _123[key], 'optionalAccess', _124 => _124.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', _125 => _125.variations, 'optionalAccess', _126 => _126.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', _127 => _127.localizations, 'optionalAccess', _128 => _128[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
|
+
(_35, key) => unlocalizableKeys.includes(key)
|
|
2852
2852
|
);
|
|
2853
2853
|
if (returnUnlocalizedKeys) {
|
|
2854
2854
|
result.unlocalizable = _lodash2.default.omitBy(
|
|
2855
2855
|
input2,
|
|
2856
|
-
(
|
|
2856
|
+
(_35, 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, (_35, 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, _35]) => 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', _129 => _129.translations, 'access', _130 => _130[context], 'optionalAccess', _131 => _131[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', _132 => _132.split, 'call', _133 => _133("\n\n"), 'access', _134 => _134.filter, 'call', _135 => _135(Boolean)]) || [];
|
|
2933
|
+
const originalSections = _optionalChain([originalInput, 'optionalAccess', _136 => _136.split, 'call', _137 => _137("\n\n"), 'access', _138 => _138.filter, 'call', _139 => _139(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', _140 => _140[entry.msgid], 'optionalAccess', _141 => _141.singular]),
|
|
3003
|
+
_optionalChain([data, 'access', _142 => _142[entry.msgid], 'optionalAccess', _143 => _143.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', _144 => _144.getAttribute, 'call', _145 => _145("id"), 'optionalAccess', _146 => _146.trim, 'call', _147 => _147()]);
|
|
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', _148 => _148.getAttribute, 'call', _149 => _149("id"), 'optionalAccess', _150 => _150.trim, 'call', _151 => _151()]);
|
|
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', _152 => _152.parentNode, 'optionalAccess', _153 => _153.removeChild, 'call', _154 => _154(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', _155 => _155.getAttribute, 'call', _156 => _156("id"), 'optionalAccess', _157 => _157.trim, 'call', _158 => _158()]);
|
|
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', _159 => _159.querySelector, 'call', _160 => _160("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', _161 => _161.getAttribute, 'call', _162 => _162("id"), 'optionalAccess', _163 => _163.trim, 'call', _164 => _164()]);
|
|
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', _165 => _165.getAttribute, 'call', _166 => _166("id"), 'optionalAccess', _167 => _167.trim, 'call', _168 => _168()]);
|
|
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', _169 => _169.getAttribute, 'call', _170 => _170("id"), 'optionalAccess', _171 => _171.trim, 'call', _172 => _172()]);
|
|
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', _173 => _173.getAttribute, 'call', _174 => _174("resname"), 'optionalAccess', _175 => _175.trim, 'call', _176 => _176()]);
|
|
3332
3332
|
if (resname) return resname;
|
|
3333
|
-
const id = _optionalChain([transUnit, 'access',
|
|
3333
|
+
const id = _optionalChain([transUnit, 'access', _177 => _177.getAttribute, 'call', _178 => _178("id"), 'optionalAccess', _179 => _179.trim, 'call', _180 => _180()]);
|
|
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', _181 => _181.textContent, 'optionalAccess', _182 => _182.trim, 'call', _183 => _183()]) || "";
|
|
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', _184 => _184.response, 'optionalAccess', _185 => _185.body, 'optionalAccess', _186 => _186.data, 'optionalAccess', _187 => _187[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', _188 => _188.length]) ? void 0 : records.join(",")
|
|
3695
3695
|
}
|
|
3696
3696
|
}).catch(
|
|
3697
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
3697
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _189 => _189.response, 'optionalAccess', _190 => _190.body, 'optionalAccess', _191 => _191.data, 'optionalAccess', _192 => _192[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', _193 => _193.response, 'optionalAccess', _194 => _194.body, 'optionalAccess', _195 => _195.data, 'optionalAccess', _196 => _196[0]]) || error)
|
|
3714
3714
|
);
|
|
3715
3715
|
} catch (_error) {
|
|
3716
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
3716
|
+
if (_optionalChain([_error, 'optionalAccess', _197 => _197.attributes, 'optionalAccess', _198 => _198.details, 'optionalAccess', _199 => _199.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', _200 => _200.response, 'optionalAccess', _201 => _201.body, 'optionalAccess', _202 => _202.data, 'optionalAccess', _203 => _203[0]]) || error)
|
|
3739
3739
|
);
|
|
3740
3740
|
} catch (_error) {
|
|
3741
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
3741
|
+
if (_optionalChain([_error, 'optionalAccess', _204 => _204.attributes, 'optionalAccess', _205 => _205.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', _206 => _206.attributes, 'optionalAccess', _207 => _207.details, 'optionalAccess', _208 => _208.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', _209 => _209.models, 'access', _210 => _210[modelId], 'optionalAccess', _211 => _211.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', _212 => _212.models]) || {})) {
|
|
3847
|
+
let records = _optionalChain([initCtx, 'optionalAccess', _213 => _213.models, 'access', _214 => _214[modelId], 'access', _215 => _215.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', _216 => _216.models, 'optionalAccess', _217 => _217[modelId], 'optionalAccess', _218 => _218.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', _219 => _219.includes, 'call', _220 => _220(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', _221 => _221.parse, 'call', _222 => _222(input2), 'optionalAccess', _223 => _223.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', _224 => _224.replace, 'call', _225 => _225(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', _226 => _226.replace, 'call', _227 => _227(`{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', _228 => _228.i18n, 'optionalAccess', _229 => _229[locale]]), () => ( {}));
|
|
4504
4504
|
},
|
|
4505
4505
|
push: async (locale, data, originalInput) => {
|
|
4506
4506
|
const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
|
|
@@ -4535,6 +4535,7 @@ function parseVueFile(input2) {
|
|
|
4535
4535
|
|
|
4536
4536
|
// src/cli/loaders/typescript/index.ts
|
|
4537
4537
|
var _parser = require('@babel/parser');
|
|
4538
|
+
|
|
4538
4539
|
var _traverse = require('@babel/traverse'); var _traverse2 = _interopRequireDefault(_traverse);
|
|
4539
4540
|
var _types = require('@babel/types'); var t = _interopRequireWildcard(_types);
|
|
4540
4541
|
var _generator = require('@babel/generator'); var _generator2 = _interopRequireDefault(_generator);
|
|
@@ -4570,7 +4571,8 @@ function createTypescriptLoader() {
|
|
|
4570
4571
|
},
|
|
4571
4572
|
push: async (locale, data, originalInput, defaultLocale, pullInput, pullOutput) => {
|
|
4572
4573
|
const ast = parseTypeScript(originalInput || "");
|
|
4573
|
-
|
|
4574
|
+
const finalData = _lodash2.default.merge({}, pullOutput, data);
|
|
4575
|
+
updateStringsInDefaultExport(ast, finalData);
|
|
4574
4576
|
const { code } = generate(ast, {
|
|
4575
4577
|
jsescOption: {
|
|
4576
4578
|
minimal: true
|
|
@@ -4680,22 +4682,12 @@ function updateStringsInDefaultExport(ast, data) {
|
|
|
4680
4682
|
}
|
|
4681
4683
|
function updateStringsInObjectExpression(objectExpression, data) {
|
|
4682
4684
|
let modified = false;
|
|
4683
|
-
const propertiesToKeep = [];
|
|
4684
4685
|
objectExpression.properties.forEach((prop) => {
|
|
4685
|
-
if (!t.isObjectProperty(prop))
|
|
4686
|
-
propertiesToKeep.push(prop);
|
|
4687
|
-
return;
|
|
4688
|
-
}
|
|
4686
|
+
if (!t.isObjectProperty(prop)) return;
|
|
4689
4687
|
const key = getPropertyKey(prop);
|
|
4690
|
-
const incomingVal = _optionalChain([data, 'optionalAccess',
|
|
4688
|
+
const incomingVal = _optionalChain([data, 'optionalAccess', _230 => _230[key]]);
|
|
4691
4689
|
if (incomingVal === void 0) {
|
|
4692
|
-
|
|
4693
|
-
modified = true;
|
|
4694
|
-
return;
|
|
4695
|
-
} else {
|
|
4696
|
-
propertiesToKeep.push(prop);
|
|
4697
|
-
return;
|
|
4698
|
-
}
|
|
4690
|
+
return;
|
|
4699
4691
|
}
|
|
4700
4692
|
if (t.isStringLiteral(prop.value) && typeof incomingVal === "string") {
|
|
4701
4693
|
if (prop.value.value !== incomingVal) {
|
|
@@ -4722,18 +4714,14 @@ function updateStringsInObjectExpression(objectExpression, data) {
|
|
|
4722
4714
|
);
|
|
4723
4715
|
modified = subModified || modified;
|
|
4724
4716
|
}
|
|
4725
|
-
propertiesToKeep.push(prop);
|
|
4726
4717
|
});
|
|
4727
|
-
if (modified) {
|
|
4728
|
-
objectExpression.properties = propertiesToKeep;
|
|
4729
|
-
}
|
|
4730
4718
|
return modified;
|
|
4731
4719
|
}
|
|
4732
4720
|
function updateStringsInArrayExpression(arrayExpression, incoming) {
|
|
4733
4721
|
let modified = false;
|
|
4734
4722
|
arrayExpression.elements.forEach((element, index) => {
|
|
4735
4723
|
if (!element) return;
|
|
4736
|
-
const incomingVal = _optionalChain([incoming, 'optionalAccess',
|
|
4724
|
+
const incomingVal = _optionalChain([incoming, 'optionalAccess', _231 => _231[index]]);
|
|
4737
4725
|
if (incomingVal === void 0) return;
|
|
4738
4726
|
if (t.isStringLiteral(element) && typeof incomingVal === "string") {
|
|
4739
4727
|
if (element.value !== incomingVal) {
|
|
@@ -5224,7 +5212,7 @@ var AST = class _AST {
|
|
|
5224
5212
|
const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
|
|
5225
5213
|
if (this.isStart() && !this.type)
|
|
5226
5214
|
ret.unshift([]);
|
|
5227
|
-
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
5215
|
+
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _232 => _232.#parent, 'optionalAccess', _233 => _233.type]) === "!")) {
|
|
5228
5216
|
ret.push({});
|
|
5229
5217
|
}
|
|
5230
5218
|
return ret;
|
|
@@ -5232,7 +5220,7 @@ var AST = class _AST {
|
|
|
5232
5220
|
isStart() {
|
|
5233
5221
|
if (this.#root === this)
|
|
5234
5222
|
return true;
|
|
5235
|
-
if (!_optionalChain([this, 'access',
|
|
5223
|
+
if (!_optionalChain([this, 'access', _234 => _234.#parent, 'optionalAccess', _235 => _235.isStart, 'call', _236 => _236()]))
|
|
5236
5224
|
return false;
|
|
5237
5225
|
if (this.#parentIndex === 0)
|
|
5238
5226
|
return true;
|
|
@@ -5248,12 +5236,12 @@ var AST = class _AST {
|
|
|
5248
5236
|
isEnd() {
|
|
5249
5237
|
if (this.#root === this)
|
|
5250
5238
|
return true;
|
|
5251
|
-
if (_optionalChain([this, 'access',
|
|
5239
|
+
if (_optionalChain([this, 'access', _237 => _237.#parent, 'optionalAccess', _238 => _238.type]) === "!")
|
|
5252
5240
|
return true;
|
|
5253
|
-
if (!_optionalChain([this, 'access',
|
|
5241
|
+
if (!_optionalChain([this, 'access', _239 => _239.#parent, 'optionalAccess', _240 => _240.isEnd, 'call', _241 => _241()]))
|
|
5254
5242
|
return false;
|
|
5255
5243
|
if (!this.type)
|
|
5256
|
-
return _optionalChain([this, 'access',
|
|
5244
|
+
return _optionalChain([this, 'access', _242 => _242.#parent, 'optionalAccess', _243 => _243.isEnd, 'call', _244 => _244()]);
|
|
5257
5245
|
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
|
5258
5246
|
return this.#parentIndex === pl - 1;
|
|
5259
5247
|
}
|
|
@@ -5475,7 +5463,7 @@ var AST = class _AST {
|
|
|
5475
5463
|
if (!this.type) {
|
|
5476
5464
|
const noEmpty = this.isStart() && this.isEnd();
|
|
5477
5465
|
const src = this.#parts.map((p) => {
|
|
5478
|
-
const [re,
|
|
5466
|
+
const [re, _35, hasMagic, uflag] = typeof p === "string" ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
|
5479
5467
|
this.#hasMagic = this.#hasMagic || hasMagic;
|
|
5480
5468
|
this.#uflag = this.#uflag || uflag;
|
|
5481
5469
|
return re;
|
|
@@ -5498,7 +5486,7 @@ var AST = class _AST {
|
|
|
5498
5486
|
}
|
|
5499
5487
|
}
|
|
5500
5488
|
let end = "";
|
|
5501
|
-
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
5489
|
+
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _245 => _245.#parent, 'optionalAccess', _246 => _246.type]) === "!") {
|
|
5502
5490
|
end = "(?:$|\\/)";
|
|
5503
5491
|
}
|
|
5504
5492
|
const final2 = start2 + src + end;
|
|
@@ -5548,7 +5536,7 @@ var AST = class _AST {
|
|
|
5548
5536
|
if (typeof p === "string") {
|
|
5549
5537
|
throw new Error("string type in extglob ast??");
|
|
5550
5538
|
}
|
|
5551
|
-
const [re,
|
|
5539
|
+
const [re, _35, _hasMagic, uflag] = p.toRegExpSource(dot);
|
|
5552
5540
|
this.#uflag = this.#uflag || uflag;
|
|
5553
5541
|
return re;
|
|
5554
5542
|
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
|
|
@@ -5793,7 +5781,7 @@ var Minimatch = class {
|
|
|
5793
5781
|
}
|
|
5794
5782
|
return false;
|
|
5795
5783
|
}
|
|
5796
|
-
debug(...
|
|
5784
|
+
debug(..._35) {
|
|
5797
5785
|
}
|
|
5798
5786
|
make() {
|
|
5799
5787
|
const pattern = this.pattern;
|
|
@@ -5815,7 +5803,7 @@ var Minimatch = class {
|
|
|
5815
5803
|
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
5816
5804
|
this.globParts = this.preprocess(rawGlobParts);
|
|
5817
5805
|
this.debug(this.pattern, this.globParts);
|
|
5818
|
-
let set = this.globParts.map((s,
|
|
5806
|
+
let set = this.globParts.map((s, _35, __) => {
|
|
5819
5807
|
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
5820
5808
|
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
5821
5809
|
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
@@ -6575,7 +6563,7 @@ function createMdxSectionsSplit2Loader() {
|
|
|
6575
6563
|
const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
|
|
6576
6564
|
const result = {
|
|
6577
6565
|
frontmatter: data.frontmatter,
|
|
6578
|
-
codePlaceholders: _optionalChain([pullInput, 'optionalAccess',
|
|
6566
|
+
codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _247 => _247.codePlaceholders]) || {},
|
|
6579
6567
|
content
|
|
6580
6568
|
};
|
|
6581
6569
|
return result;
|
|
@@ -6649,10 +6637,11 @@ function createIgnoredKeysLoader(ignoredKeys) {
|
|
|
6649
6637
|
return result;
|
|
6650
6638
|
},
|
|
6651
6639
|
push: async (locale, data, originalInput, originalLocale, pullInput) => {
|
|
6652
|
-
const
|
|
6653
|
-
|
|
6640
|
+
const ignoredSubObject = _lodash2.default.pickBy(
|
|
6641
|
+
pullInput,
|
|
6654
6642
|
(value, key) => _isIgnoredKey(key, ignoredKeys)
|
|
6655
6643
|
);
|
|
6644
|
+
const result = _lodash2.default.merge({}, data, ignoredSubObject);
|
|
6656
6645
|
return result;
|
|
6657
6646
|
}
|
|
6658
6647
|
});
|
|
@@ -6845,7 +6834,7 @@ function createTxtLoader() {
|
|
|
6845
6834
|
const sortedEntries = Object.entries(payload).sort(
|
|
6846
6835
|
([a], [b]) => parseInt(a) - parseInt(b)
|
|
6847
6836
|
);
|
|
6848
|
-
return sortedEntries.map(([
|
|
6837
|
+
return sortedEntries.map(([_35, value]) => value).join("\n");
|
|
6849
6838
|
}
|
|
6850
6839
|
});
|
|
6851
6840
|
}
|
|
@@ -7311,7 +7300,7 @@ function createBasicTranslator(model, systemPrompt) {
|
|
|
7311
7300
|
]
|
|
7312
7301
|
});
|
|
7313
7302
|
const result = JSON.parse(response.text);
|
|
7314
|
-
return _optionalChain([result, 'optionalAccess',
|
|
7303
|
+
return _optionalChain([result, 'optionalAccess', _248 => _248.data]) || {};
|
|
7315
7304
|
}
|
|
7316
7305
|
}
|
|
7317
7306
|
function extractPayloadChunks(payload) {
|
|
@@ -7393,7 +7382,7 @@ function getPureModelProvider(provider) {
|
|
|
7393
7382
|
|
|
7394
7383
|
${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
|
|
7395
7384
|
`;
|
|
7396
|
-
switch (_optionalChain([provider, 'optionalAccess',
|
|
7385
|
+
switch (_optionalChain([provider, 'optionalAccess', _249 => _249.id])) {
|
|
7397
7386
|
case "openai": {
|
|
7398
7387
|
if (!process.env.OPENAI_API_KEY) {
|
|
7399
7388
|
throw new Error(
|
|
@@ -7451,7 +7440,7 @@ function getPureModelProvider(provider) {
|
|
|
7451
7440
|
})(provider.model);
|
|
7452
7441
|
}
|
|
7453
7442
|
default: {
|
|
7454
|
-
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess',
|
|
7443
|
+
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _250 => _250.id])));
|
|
7455
7444
|
}
|
|
7456
7445
|
}
|
|
7457
7446
|
}
|
|
@@ -7691,7 +7680,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
7691
7680
|
validateParams(i18nConfig, flags);
|
|
7692
7681
|
ora.succeed("Localization configuration is valid");
|
|
7693
7682
|
ora.start("Connecting to Lingo.dev Localization Engine...");
|
|
7694
|
-
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess',
|
|
7683
|
+
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _251 => _251.provider]);
|
|
7695
7684
|
if (isByokMode) {
|
|
7696
7685
|
authId = null;
|
|
7697
7686
|
ora.succeed("Using external provider (BYOK mode)");
|
|
@@ -7705,16 +7694,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
7705
7694
|
flags
|
|
7706
7695
|
});
|
|
7707
7696
|
let buckets = getBuckets(i18nConfig);
|
|
7708
|
-
if (_optionalChain([flags, 'access',
|
|
7697
|
+
if (_optionalChain([flags, 'access', _252 => _252.bucket, 'optionalAccess', _253 => _253.length])) {
|
|
7709
7698
|
buckets = buckets.filter(
|
|
7710
7699
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
7711
7700
|
);
|
|
7712
7701
|
}
|
|
7713
7702
|
ora.succeed("Buckets retrieved");
|
|
7714
|
-
if (_optionalChain([flags, 'access',
|
|
7703
|
+
if (_optionalChain([flags, 'access', _254 => _254.file, 'optionalAccess', _255 => _255.length])) {
|
|
7715
7704
|
buckets = buckets.map((bucket) => {
|
|
7716
7705
|
const paths = bucket.paths.filter(
|
|
7717
|
-
(path17) => flags.file.find((file) => _optionalChain([path17, 'access',
|
|
7706
|
+
(path17) => flags.file.find((file) => _optionalChain([path17, 'access', _256 => _256.pathPattern, 'optionalAccess', _257 => _257.includes, 'call', _258 => _258(file)]))
|
|
7718
7707
|
);
|
|
7719
7708
|
return { ...bucket, paths };
|
|
7720
7709
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -7733,7 +7722,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
7733
7722
|
});
|
|
7734
7723
|
}
|
|
7735
7724
|
}
|
|
7736
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
7725
|
+
const targetLocales = _optionalChain([flags, 'access', _259 => _259.locale, 'optionalAccess', _260 => _260.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
7737
7726
|
ora.start("Setting up localization cache...");
|
|
7738
7727
|
const checkLockfileProcessor = createDeltaProcessor("");
|
|
7739
7728
|
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
@@ -7904,7 +7893,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
7904
7893
|
if (flags.key) {
|
|
7905
7894
|
processableData = _lodash2.default.pickBy(
|
|
7906
7895
|
processableData,
|
|
7907
|
-
(
|
|
7896
|
+
(_35, key) => key === flags.key
|
|
7908
7897
|
);
|
|
7909
7898
|
}
|
|
7910
7899
|
if (flags.verbose) {
|
|
@@ -7992,7 +7981,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
7992
7981
|
}
|
|
7993
7982
|
const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
|
|
7994
7983
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
7995
|
-
if (!_optionalChain([flags, 'access',
|
|
7984
|
+
if (!_optionalChain([flags, 'access', _261 => _261.locale, 'optionalAccess', _262 => _262.length])) {
|
|
7996
7985
|
await deltaProcessor.saveChecksums(checksums);
|
|
7997
7986
|
}
|
|
7998
7987
|
}
|
|
@@ -8076,12 +8065,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
8076
8065
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
8077
8066
|
docUrl: "bucketNotFound"
|
|
8078
8067
|
});
|
|
8079
|
-
} else if (_optionalChain([flags, 'access',
|
|
8068
|
+
} else if (_optionalChain([flags, 'access', _263 => _263.locale, 'optionalAccess', _264 => _264.some, 'call', _265 => _265((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
8080
8069
|
throw new CLIError({
|
|
8081
8070
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
8082
8071
|
docUrl: "localeTargetNotFound"
|
|
8083
8072
|
});
|
|
8084
|
-
} else if (_optionalChain([flags, 'access',
|
|
8073
|
+
} else if (_optionalChain([flags, 'access', _266 => _266.bucket, 'optionalAccess', _267 => _267.some, 'call', _268 => _268(
|
|
8085
8074
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
8086
8075
|
)])) {
|
|
8087
8076
|
throw new CLIError({
|
|
@@ -8461,7 +8450,7 @@ var _stdiojs = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
|
8461
8450
|
var _mcpjs = require('@modelcontextprotocol/sdk/server/mcp.js');
|
|
8462
8451
|
|
|
8463
8452
|
|
|
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 (
|
|
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 (_35, program) => {
|
|
8465
8454
|
const apiKey = program.args[0];
|
|
8466
8455
|
const settings = getSettings(apiKey);
|
|
8467
8456
|
if (!settings.auth.apiKey) {
|
|
@@ -8585,7 +8574,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
|
|
|
8585
8574
|
const response = await engine.whoami();
|
|
8586
8575
|
return {
|
|
8587
8576
|
authenticated: !!response,
|
|
8588
|
-
username: _optionalChain([response, 'optionalAccess',
|
|
8577
|
+
username: _optionalChain([response, 'optionalAccess', _269 => _269.email])
|
|
8589
8578
|
};
|
|
8590
8579
|
} catch (e2) {
|
|
8591
8580
|
return { authenticated: false };
|
|
@@ -8693,7 +8682,7 @@ function createExplicitLocalizer(provider) {
|
|
|
8693
8682
|
}
|
|
8694
8683
|
function createAiSdkLocalizer(params) {
|
|
8695
8684
|
const skipAuth = params.skipAuth === true;
|
|
8696
|
-
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
8685
|
+
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _270 => _270.apiKeyName]), () => ( ""))];
|
|
8697
8686
|
if (!skipAuth && !apiKey || !params.apiKeyName) {
|
|
8698
8687
|
throw new Error(
|
|
8699
8688
|
_dedent2.default`
|
|
@@ -8818,8 +8807,8 @@ async function setup(input2) {
|
|
|
8818
8807
|
throw new Error(
|
|
8819
8808
|
"No buckets found in i18n.json. Please add at least one bucket containing i18n content."
|
|
8820
8809
|
);
|
|
8821
|
-
} else if (_optionalChain([ctx, 'access',
|
|
8822
|
-
(bucket) => !_optionalChain([ctx, 'access',
|
|
8810
|
+
} else if (_optionalChain([ctx, 'access', _271 => _271.flags, 'access', _272 => _272.bucket, 'optionalAccess', _273 => _273.some, 'call', _274 => _274(
|
|
8811
|
+
(bucket) => !_optionalChain([ctx, 'access', _275 => _275.config, 'optionalAccess', _276 => _276.buckets, 'access', _277 => _277[bucket]])
|
|
8823
8812
|
)])) {
|
|
8824
8813
|
throw new Error(
|
|
8825
8814
|
`One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
|
|
@@ -8832,7 +8821,7 @@ async function setup(input2) {
|
|
|
8832
8821
|
title: "Selecting localization provider",
|
|
8833
8822
|
task: async (ctx, task) => {
|
|
8834
8823
|
ctx.localizer = createLocalizer(
|
|
8835
|
-
_optionalChain([ctx, 'access',
|
|
8824
|
+
_optionalChain([ctx, 'access', _278 => _278.config, 'optionalAccess', _279 => _279.provider]),
|
|
8836
8825
|
ctx.flags.apiKey
|
|
8837
8826
|
);
|
|
8838
8827
|
if (!ctx.localizer) {
|
|
@@ -8991,7 +8980,6 @@ async function plan(input2) {
|
|
|
8991
8980
|
injectLocale: bucket.injectLocale || [],
|
|
8992
8981
|
lockedKeys: bucket.lockedKeys || [],
|
|
8993
8982
|
lockedPatterns: bucket.lockedPatterns || [],
|
|
8994
|
-
ignoredKeys: bucket.ignoredKeys || [],
|
|
8995
8983
|
onlyKeys: input2.flags.key || []
|
|
8996
8984
|
});
|
|
8997
8985
|
}
|
|
@@ -9048,7 +9036,7 @@ async function execute(input2) {
|
|
|
9048
9036
|
const workerTasks = [];
|
|
9049
9037
|
for (let i = 0; i < workersCount; i++) {
|
|
9050
9038
|
const assignedTasks = ctx.tasks.filter(
|
|
9051
|
-
(
|
|
9039
|
+
(_35, idx) => idx % workersCount === i
|
|
9052
9040
|
);
|
|
9053
9041
|
workerTasks.push(
|
|
9054
9042
|
createWorkerTask({
|
|
@@ -9116,8 +9104,7 @@ function createLoaderForTask(assignedTask) {
|
|
|
9116
9104
|
injectLocale: assignedTask.injectLocale
|
|
9117
9105
|
},
|
|
9118
9106
|
assignedTask.lockedKeys,
|
|
9119
|
-
assignedTask.lockedPatterns
|
|
9120
|
-
assignedTask.ignoredKeys
|
|
9107
|
+
assignedTask.lockedPatterns
|
|
9121
9108
|
);
|
|
9122
9109
|
bucketLoader.setDefaultLocale(assignedTask.sourceLocale);
|
|
9123
9110
|
return bucketLoader;
|
|
@@ -9153,7 +9140,7 @@ function createWorkerTask(args) {
|
|
|
9153
9140
|
const processableData = _lodash2.default.chain(sourceData).entries().filter(
|
|
9154
9141
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
|
|
9155
9142
|
).filter(
|
|
9156
|
-
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access',
|
|
9143
|
+
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _280 => _280.onlyKeys, 'optionalAccess', _281 => _281.some, 'call', _282 => _282(
|
|
9157
9144
|
(pattern) => minimatch(key, pattern)
|
|
9158
9145
|
)])
|
|
9159
9146
|
).fromPairs().value();
|
|
@@ -9216,7 +9203,7 @@ function createWorkerTask(args) {
|
|
|
9216
9203
|
finalRenamedTargetData
|
|
9217
9204
|
);
|
|
9218
9205
|
const checksums2 = await deltaProcessor.createChecksums(sourceData);
|
|
9219
|
-
if (!_optionalChain([args, 'access',
|
|
9206
|
+
if (!_optionalChain([args, 'access', _283 => _283.ctx, 'access', _284 => _284.flags, 'access', _285 => _285.targetLocale, 'optionalAccess', _286 => _286.length])) {
|
|
9220
9207
|
await deltaProcessor.saveChecksums(checksums2);
|
|
9221
9208
|
}
|
|
9222
9209
|
});
|
|
@@ -9406,13 +9393,13 @@ var flagsSchema2 = _zod.z.object({
|
|
|
9406
9393
|
|
|
9407
9394
|
// src/cli/cmd/run/_utils.ts
|
|
9408
9395
|
async function determineAuthId(ctx) {
|
|
9409
|
-
const isByokMode = !!_optionalChain([ctx, 'access',
|
|
9396
|
+
const isByokMode = !!_optionalChain([ctx, 'access', _287 => _287.config, 'optionalAccess', _288 => _288.provider]);
|
|
9410
9397
|
if (isByokMode) {
|
|
9411
9398
|
return null;
|
|
9412
9399
|
} else {
|
|
9413
9400
|
try {
|
|
9414
|
-
const authStatus = await _optionalChain([ctx, 'access',
|
|
9415
|
-
return _optionalChain([authStatus, 'optionalAccess',
|
|
9401
|
+
const authStatus = await _optionalChain([ctx, 'access', _289 => _289.localizer, 'optionalAccess', _290 => _290.checkAuth, 'call', _291 => _291()]);
|
|
9402
|
+
return _optionalChain([authStatus, 'optionalAccess', _292 => _292.username]) || null;
|
|
9416
9403
|
} catch (e3) {
|
|
9417
9404
|
return null;
|
|
9418
9405
|
}
|
|
@@ -9572,7 +9559,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
9572
9559
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
9573
9560
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
9574
9561
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
9575
|
-
_optionalChain([this, 'access',
|
|
9562
|
+
_optionalChain([this, 'access', _293 => _293.platformKit, 'optionalAccess', _294 => _294.gitConfig, 'call', _295 => _295()]);
|
|
9576
9563
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
9577
9564
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
9578
9565
|
if (!processOwnCommits) {
|
|
@@ -9604,7 +9591,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
9604
9591
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
9605
9592
|
var PullRequestFlow = class extends InBranchFlow {
|
|
9606
9593
|
async preRun() {
|
|
9607
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
9594
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _296 => _296()]);
|
|
9608
9595
|
if (!canContinue) {
|
|
9609
9596
|
return false;
|
|
9610
9597
|
}
|
|
@@ -9867,10 +9854,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
9867
9854
|
repo_slug: this.platformConfig.repositoryName,
|
|
9868
9855
|
state: "OPEN"
|
|
9869
9856
|
}).then(({ data: { values } }) => {
|
|
9870
|
-
return _optionalChain([values, 'optionalAccess',
|
|
9871
|
-
({ source, destination }) => _optionalChain([source, 'optionalAccess',
|
|
9857
|
+
return _optionalChain([values, 'optionalAccess', _297 => _297.find, 'call', _298 => _298(
|
|
9858
|
+
({ source, destination }) => _optionalChain([source, 'optionalAccess', _299 => _299.branch, 'optionalAccess', _300 => _300.name]) === branch && _optionalChain([destination, 'optionalAccess', _301 => _301.branch, 'optionalAccess', _302 => _302.name]) === this.platformConfig.baseBranchName
|
|
9872
9859
|
)]);
|
|
9873
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
9860
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _303 => _303.id]));
|
|
9874
9861
|
}
|
|
9875
9862
|
async closePullRequest({ pullRequestNumber }) {
|
|
9876
9863
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -9966,7 +9953,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
9966
9953
|
repo: this.platformConfig.repositoryName,
|
|
9967
9954
|
base: this.platformConfig.baseBranchName,
|
|
9968
9955
|
state: "open"
|
|
9969
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
9956
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _304 => _304.number]));
|
|
9970
9957
|
}
|
|
9971
9958
|
async closePullRequest({ pullRequestNumber }) {
|
|
9972
9959
|
await this.octokit.rest.pulls.update({
|
|
@@ -10093,7 +10080,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
10093
10080
|
sourceBranch: branch,
|
|
10094
10081
|
state: "opened"
|
|
10095
10082
|
});
|
|
10096
|
-
return _optionalChain([mergeRequests, 'access',
|
|
10083
|
+
return _optionalChain([mergeRequests, 'access', _305 => _305[0], 'optionalAccess', _306 => _306.iid]);
|
|
10097
10084
|
}
|
|
10098
10085
|
async closePullRequest({
|
|
10099
10086
|
pullRequestNumber
|
|
@@ -10183,7 +10170,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
10183
10170
|
}
|
|
10184
10171
|
const env = {
|
|
10185
10172
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
10186
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
10173
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _307 => _307.pullRequest, 'optionalAccess', _308 => _308.toString, 'call', _309 => _309()]) || "false",
|
|
10187
10174
|
...options.commitMessage && {
|
|
10188
10175
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
10189
10176
|
},
|
|
@@ -10203,7 +10190,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
10203
10190
|
const { isPullRequestMode } = platformKit.config;
|
|
10204
10191
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
10205
10192
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
10206
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
10193
|
+
const canRun = await _optionalChain([flow, 'access', _310 => _310.preRun, 'optionalCall', _311 => _311()]);
|
|
10207
10194
|
if (canRun === false) {
|
|
10208
10195
|
return;
|
|
10209
10196
|
}
|
|
@@ -10213,7 +10200,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
10213
10200
|
if (!hasChanges) {
|
|
10214
10201
|
return;
|
|
10215
10202
|
}
|
|
10216
|
-
await _optionalChain([flow, 'access',
|
|
10203
|
+
await _optionalChain([flow, 'access', _312 => _312.postRun, 'optionalCall', _313 => _313()]);
|
|
10217
10204
|
});
|
|
10218
10205
|
function parseBooleanArg(val) {
|
|
10219
10206
|
if (val === true) return true;
|
|
@@ -10282,17 +10269,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
10282
10269
|
flags
|
|
10283
10270
|
});
|
|
10284
10271
|
let buckets = getBuckets(i18nConfig);
|
|
10285
|
-
if (_optionalChain([flags, 'access',
|
|
10272
|
+
if (_optionalChain([flags, 'access', _314 => _314.bucket, 'optionalAccess', _315 => _315.length])) {
|
|
10286
10273
|
buckets = buckets.filter(
|
|
10287
10274
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
10288
10275
|
);
|
|
10289
10276
|
}
|
|
10290
10277
|
ora.succeed("Buckets retrieved");
|
|
10291
|
-
if (_optionalChain([flags, 'access',
|
|
10278
|
+
if (_optionalChain([flags, 'access', _316 => _316.file, 'optionalAccess', _317 => _317.length])) {
|
|
10292
10279
|
buckets = buckets.map((bucket) => {
|
|
10293
10280
|
const paths = bucket.paths.filter(
|
|
10294
10281
|
(path17) => flags.file.find(
|
|
10295
|
-
(file) => _optionalChain([path17, 'access',
|
|
10282
|
+
(file) => _optionalChain([path17, 'access', _318 => _318.pathPattern, 'optionalAccess', _319 => _319.includes, 'call', _320 => _320(file)]) || _optionalChain([path17, 'access', _321 => _321.pathPattern, 'optionalAccess', _322 => _322.match, 'call', _323 => _323(file)]) || minimatch(path17.pathPattern, file)
|
|
10296
10283
|
)
|
|
10297
10284
|
);
|
|
10298
10285
|
return { ...bucket, paths };
|
|
@@ -10312,7 +10299,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
10312
10299
|
});
|
|
10313
10300
|
}
|
|
10314
10301
|
}
|
|
10315
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
10302
|
+
const targetLocales = _optionalChain([flags, 'access', _324 => _324.locale, 'optionalAccess', _325 => _325.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
10316
10303
|
let totalSourceKeyCount = 0;
|
|
10317
10304
|
let uniqueKeysToTranslate = 0;
|
|
10318
10305
|
let totalExistingTranslations = 0;
|
|
@@ -10716,12 +10703,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
10716
10703
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
10717
10704
|
docUrl: "bucketNotFound"
|
|
10718
10705
|
});
|
|
10719
|
-
} else if (_optionalChain([flags, 'access',
|
|
10706
|
+
} else if (_optionalChain([flags, 'access', _326 => _326.locale, 'optionalAccess', _327 => _327.some, 'call', _328 => _328((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
10720
10707
|
throw new CLIError({
|
|
10721
10708
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
10722
10709
|
docUrl: "localeTargetNotFound"
|
|
10723
10710
|
});
|
|
10724
|
-
} else if (_optionalChain([flags, 'access',
|
|
10711
|
+
} else if (_optionalChain([flags, 'access', _329 => _329.bucket, 'optionalAccess', _330 => _330.some, 'call', _331 => _331(
|
|
10725
10712
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
10726
10713
|
)])) {
|
|
10727
10714
|
throw new CLIError({
|
|
@@ -10813,7 +10800,7 @@ async function renderHero2() {
|
|
|
10813
10800
|
// package.json
|
|
10814
10801
|
var package_default = {
|
|
10815
10802
|
name: "lingo.dev",
|
|
10816
|
-
version: "0.110.
|
|
10803
|
+
version: "0.110.2",
|
|
10817
10804
|
description: "Lingo.dev CLI",
|
|
10818
10805
|
private: false,
|
|
10819
10806
|
publishConfig: {
|
|
@@ -11090,7 +11077,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
|
|
|
11090
11077
|
if (options.file && options.file.length) {
|
|
11091
11078
|
buckets = buckets.map((bucket) => {
|
|
11092
11079
|
const paths = bucket.paths.filter(
|
|
11093
|
-
(bucketPath) => _optionalChain([options, 'access',
|
|
11080
|
+
(bucketPath) => _optionalChain([options, 'access', _332 => _332.file, 'optionalAccess', _333 => _333.some, 'call', _334 => _334((f) => bucketPath.pathPattern.includes(f))])
|
|
11094
11081
|
);
|
|
11095
11082
|
return { ...bucket, paths };
|
|
11096
11083
|
}).filter((bucket) => bucket.paths.length > 0);
|