lingo.dev 0.107.2 → 0.107.3
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 +224 -135
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +136 -47
- 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 {
|
|
@@ -510,7 +510,7 @@ async function waitForApiKey(cb) {
|
|
|
510
510
|
// src/cli/cmd/logout.ts
|
|
511
511
|
|
|
512
512
|
|
|
513
|
-
var logout_default = new (0, _interactivecommander.Command)().command("logout").description("
|
|
513
|
+
var logout_default = new (0, _interactivecommander.Command)().command("logout").description("Log out from Lingo.dev API").helpOption("-h, --help", "Show help").action(async () => {
|
|
514
514
|
try {
|
|
515
515
|
await renderClear();
|
|
516
516
|
await renderSpacer();
|
|
@@ -1076,7 +1076,7 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
|
|
|
1076
1076
|
});
|
|
1077
1077
|
const auth2 = await newAuthenticator.whoami();
|
|
1078
1078
|
if (auth2) {
|
|
1079
|
-
_ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess',
|
|
1079
|
+
_ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _69 => _69.email])}`);
|
|
1080
1080
|
} else {
|
|
1081
1081
|
_ora2.default.call(void 0, ).fail("Authentication failed.");
|
|
1082
1082
|
}
|
|
@@ -1163,7 +1163,7 @@ function getBuckets(i18nConfig) {
|
|
|
1163
1163
|
const includeItems = bucketEntry.include.map(
|
|
1164
1164
|
(item) => resolveBucketItem(item)
|
|
1165
1165
|
);
|
|
1166
|
-
const excludeItems = _optionalChain([bucketEntry, 'access',
|
|
1166
|
+
const excludeItems = _optionalChain([bucketEntry, 'access', _70 => _70.exclude, 'optionalAccess', _71 => _71.map, 'call', _72 => _72(
|
|
1167
1167
|
(item) => resolveBucketItem(item)
|
|
1168
1168
|
)]);
|
|
1169
1169
|
const config = {
|
|
@@ -1201,7 +1201,7 @@ function extractPathPatterns(sourceLocale, include, exclude) {
|
|
|
1201
1201
|
delimiter: pattern.delimiter
|
|
1202
1202
|
}))
|
|
1203
1203
|
);
|
|
1204
|
-
const excludedPatterns = _optionalChain([exclude, 'optionalAccess',
|
|
1204
|
+
const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _73 => _73.flatMap, 'call', _74 => _74(
|
|
1205
1205
|
(pattern) => expandPlaceholderedGlob(
|
|
1206
1206
|
pattern.path,
|
|
1207
1207
|
__spec.resolveOverriddenLocale.call(void 0, sourceLocale, pattern.delimiter)
|
|
@@ -1491,12 +1491,12 @@ function composeLoaders(...loaders) {
|
|
|
1491
1491
|
return {
|
|
1492
1492
|
init: async () => {
|
|
1493
1493
|
for (const loader of loaders) {
|
|
1494
|
-
await _optionalChain([loader, 'access',
|
|
1494
|
+
await _optionalChain([loader, 'access', _75 => _75.init, 'optionalCall', _76 => _76()]);
|
|
1495
1495
|
}
|
|
1496
1496
|
},
|
|
1497
1497
|
setDefaultLocale(locale) {
|
|
1498
1498
|
for (const loader of loaders) {
|
|
1499
|
-
_optionalChain([loader, 'access',
|
|
1499
|
+
_optionalChain([loader, 'access', _77 => _77.setDefaultLocale, 'optionalCall', _78 => _78(locale)]);
|
|
1500
1500
|
}
|
|
1501
1501
|
return this;
|
|
1502
1502
|
},
|
|
@@ -1529,7 +1529,7 @@ function createLoader(lDefinition) {
|
|
|
1529
1529
|
if (state.initCtx) {
|
|
1530
1530
|
return state.initCtx;
|
|
1531
1531
|
}
|
|
1532
|
-
state.initCtx = await _optionalChain([lDefinition, 'access',
|
|
1532
|
+
state.initCtx = await _optionalChain([lDefinition, 'access', _79 => _79.init, 'optionalCall', _80 => _80()]);
|
|
1533
1533
|
return state.initCtx;
|
|
1534
1534
|
},
|
|
1535
1535
|
setDefaultLocale(locale) {
|
|
@@ -1634,7 +1634,7 @@ function createNormalizeLoader() {
|
|
|
1634
1634
|
return normalized;
|
|
1635
1635
|
},
|
|
1636
1636
|
push: async (locale, data, originalInput) => {
|
|
1637
|
-
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess',
|
|
1637
|
+
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _81 => _81.keysMap]), () => ( {}));
|
|
1638
1638
|
const input2 = mapDenormalizedKeys(data, keysMap);
|
|
1639
1639
|
const denormalized = _flat.unflatten.call(void 0, input2, {
|
|
1640
1640
|
delimiter: "/",
|
|
@@ -1708,7 +1708,7 @@ function createTextFileLoader(pathPattern) {
|
|
|
1708
1708
|
const trimmedResult = result.trim();
|
|
1709
1709
|
return trimmedResult;
|
|
1710
1710
|
},
|
|
1711
|
-
async push(locale, data,
|
|
1711
|
+
async push(locale, data, _35, originalLocale) {
|
|
1712
1712
|
const draftPath = pathPattern.replaceAll("[locale]", locale);
|
|
1713
1713
|
const finalPath = path13.default.resolve(draftPath);
|
|
1714
1714
|
const dirPath = path13.default.dirname(finalPath);
|
|
@@ -1741,8 +1741,8 @@ async function getTrailingNewLine(pathPattern, locale, originalLocale) {
|
|
|
1741
1741
|
if (!templateData) {
|
|
1742
1742
|
templateData = await readFileForLocale(pathPattern, originalLocale);
|
|
1743
1743
|
}
|
|
1744
|
-
if (_optionalChain([templateData, 'optionalAccess',
|
|
1745
|
-
const ending = _optionalChain([templateData, 'optionalAccess',
|
|
1744
|
+
if (_optionalChain([templateData, 'optionalAccess', _82 => _82.match, 'call', _83 => _83(/[\r\n]$/)])) {
|
|
1745
|
+
const ending = _optionalChain([templateData, 'optionalAccess', _84 => _84.includes, 'call', _85 => _85("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _86 => _86.includes, 'call', _87 => _87("\r")]) ? "\r" : "\n";
|
|
1746
1746
|
return ending;
|
|
1747
1747
|
}
|
|
1748
1748
|
return "";
|
|
@@ -2013,7 +2013,7 @@ var _sync3 = require('csv-stringify/sync');
|
|
|
2013
2013
|
|
|
2014
2014
|
function detectKeyColumnName(csvString) {
|
|
2015
2015
|
const row = _sync.parse.call(void 0, csvString)[0];
|
|
2016
|
-
const firstColumn = _optionalChain([row, 'optionalAccess',
|
|
2016
|
+
const firstColumn = _optionalChain([row, 'optionalAccess', _88 => _88[0], 'optionalAccess', _89 => _89.trim, 'call', _90 => _90()]);
|
|
2017
2017
|
return firstColumn || "KEY";
|
|
2018
2018
|
}
|
|
2019
2019
|
function createCsvLoader() {
|
|
@@ -2115,7 +2115,7 @@ function createHtmlLoader() {
|
|
|
2115
2115
|
break;
|
|
2116
2116
|
}
|
|
2117
2117
|
const siblings = Array.from(parent.childNodes).filter(
|
|
2118
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2118
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _91 => _91.textContent, 'optionalAccess', _92 => _92.trim, 'call', _93 => _93()])
|
|
2119
2119
|
);
|
|
2120
2120
|
const index = siblings.indexOf(current);
|
|
2121
2121
|
if (index !== -1) {
|
|
@@ -2151,15 +2151,15 @@ function createHtmlLoader() {
|
|
|
2151
2151
|
}
|
|
2152
2152
|
});
|
|
2153
2153
|
Array.from(element.childNodes).filter(
|
|
2154
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2154
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _94 => _94.textContent, 'optionalAccess', _95 => _95.trim, 'call', _96 => _96()])
|
|
2155
2155
|
).forEach(processNode);
|
|
2156
2156
|
}
|
|
2157
2157
|
};
|
|
2158
2158
|
Array.from(document.head.childNodes).filter(
|
|
2159
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2159
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _97 => _97.textContent, 'optionalAccess', _98 => _98.trim, 'call', _99 => _99()])
|
|
2160
2160
|
).forEach(processNode);
|
|
2161
2161
|
Array.from(document.body.childNodes).filter(
|
|
2162
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2162
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _100 => _100.textContent, 'optionalAccess', _101 => _101.trim, 'call', _102 => _102()])
|
|
2163
2163
|
).forEach(processNode);
|
|
2164
2164
|
return result;
|
|
2165
2165
|
},
|
|
@@ -2184,7 +2184,7 @@ function createHtmlLoader() {
|
|
|
2184
2184
|
for (let i = 0; i < indices.length; i++) {
|
|
2185
2185
|
const index = parseInt(indices[i]);
|
|
2186
2186
|
const siblings = Array.from(parent.childNodes).filter(
|
|
2187
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2187
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _103 => _103.textContent, 'optionalAccess', _104 => _104.trim, 'call', _105 => _105()])
|
|
2188
2188
|
);
|
|
2189
2189
|
if (index >= siblings.length) {
|
|
2190
2190
|
if (i === indices.length - 1) {
|
|
@@ -2235,7 +2235,7 @@ function createMarkdownLoader() {
|
|
|
2235
2235
|
yaml: yamlEngine
|
|
2236
2236
|
}
|
|
2237
2237
|
});
|
|
2238
|
-
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess',
|
|
2238
|
+
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _106 => _106.trim, 'call', _107 => _107()]), () => ( ""))).filter(Boolean);
|
|
2239
2239
|
return {
|
|
2240
2240
|
...Object.fromEntries(
|
|
2241
2241
|
sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
|
|
@@ -2254,7 +2254,7 @@ function createMarkdownLoader() {
|
|
|
2254
2254
|
);
|
|
2255
2255
|
let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(
|
|
2256
2256
|
([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())
|
|
2257
|
-
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess',
|
|
2257
|
+
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _108 => _108.trim, 'call', _109 => _109()]), () => ( ""))).filter(Boolean).join("\n\n");
|
|
2258
2258
|
if (Object.keys(frontmatter).length > 0) {
|
|
2259
2259
|
content = `
|
|
2260
2260
|
${content}`;
|
|
@@ -2287,7 +2287,7 @@ function createPropertiesLoader() {
|
|
|
2287
2287
|
return result;
|
|
2288
2288
|
},
|
|
2289
2289
|
async push(locale, payload) {
|
|
2290
|
-
const result = Object.entries(payload).filter(([
|
|
2290
|
+
const result = Object.entries(payload).filter(([_35, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
|
|
2291
2291
|
return result;
|
|
2292
2292
|
}
|
|
2293
2293
|
});
|
|
@@ -2298,7 +2298,7 @@ function isSkippableLine(line) {
|
|
|
2298
2298
|
function parsePropertyLine(line) {
|
|
2299
2299
|
const [key, ...valueParts] = line.split("=");
|
|
2300
2300
|
return {
|
|
2301
|
-
key: _optionalChain([key, 'optionalAccess',
|
|
2301
|
+
key: _optionalChain([key, 'optionalAccess', _110 => _110.trim, 'call', _111 => _111()]) || "",
|
|
2302
2302
|
value: valueParts.join("=").trim()
|
|
2303
2303
|
};
|
|
2304
2304
|
}
|
|
@@ -2386,7 +2386,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
2386
2386
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
2387
2387
|
continue;
|
|
2388
2388
|
}
|
|
2389
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
2389
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _112 => _112.localizations, 'optionalAccess', _113 => _113[locale]]);
|
|
2390
2390
|
if (langTranslationEntity) {
|
|
2391
2391
|
if ("stringUnit" in langTranslationEntity) {
|
|
2392
2392
|
resultData[translationKey] = langTranslationEntity.stringUnit.value;
|
|
@@ -2395,7 +2395,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
2395
2395
|
resultData[translationKey] = {};
|
|
2396
2396
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
2397
2397
|
for (const form in pluralForms) {
|
|
2398
|
-
if (_optionalChain([pluralForms, 'access',
|
|
2398
|
+
if (_optionalChain([pluralForms, 'access', _114 => _114[form], 'optionalAccess', _115 => _115.stringUnit, 'optionalAccess', _116 => _116.value])) {
|
|
2399
2399
|
resultData[translationKey][form] = pluralForms[form].stringUnit.value;
|
|
2400
2400
|
}
|
|
2401
2401
|
}
|
|
@@ -2421,7 +2421,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
2421
2421
|
const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
|
|
2422
2422
|
if (typeof value === "string") {
|
|
2423
2423
|
langDataToMerge.strings[key] = {
|
|
2424
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
2424
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _117 => _117.strings, 'optionalAccess', _118 => _118[key], 'optionalAccess', _119 => _119.extractionState]),
|
|
2425
2425
|
localizations: {
|
|
2426
2426
|
[locale]: {
|
|
2427
2427
|
stringUnit: {
|
|
@@ -2469,7 +2469,7 @@ function _removeLocale(input2, locale) {
|
|
|
2469
2469
|
const { strings } = input2;
|
|
2470
2470
|
const newStrings = _lodash2.default.cloneDeep(strings);
|
|
2471
2471
|
for (const [key, value] of Object.entries(newStrings)) {
|
|
2472
|
-
if (_optionalChain([value, 'access',
|
|
2472
|
+
if (_optionalChain([value, 'access', _120 => _120.localizations, 'optionalAccess', _121 => _121[locale]])) {
|
|
2473
2473
|
delete value.localizations[locale];
|
|
2474
2474
|
}
|
|
2475
2475
|
}
|
|
@@ -2558,12 +2558,12 @@ function createUnlocalizableLoader(returnUnlocalizedKeys = false) {
|
|
|
2558
2558
|
const unlocalizableKeys = _getUnlocalizableKeys(input2);
|
|
2559
2559
|
const result = _lodash2.default.omitBy(
|
|
2560
2560
|
input2,
|
|
2561
|
-
(
|
|
2561
|
+
(_35, key) => unlocalizableKeys.includes(key)
|
|
2562
2562
|
);
|
|
2563
2563
|
if (returnUnlocalizedKeys) {
|
|
2564
2564
|
result.unlocalizable = _lodash2.default.omitBy(
|
|
2565
2565
|
input2,
|
|
2566
|
-
(
|
|
2566
|
+
(_35, key) => !unlocalizableKeys.includes(key)
|
|
2567
2567
|
);
|
|
2568
2568
|
}
|
|
2569
2569
|
return result;
|
|
@@ -2573,7 +2573,7 @@ function createUnlocalizableLoader(returnUnlocalizedKeys = false) {
|
|
|
2573
2573
|
const result = _lodash2.default.merge(
|
|
2574
2574
|
{},
|
|
2575
2575
|
data,
|
|
2576
|
-
_lodash2.default.omitBy(originalInput, (
|
|
2576
|
+
_lodash2.default.omitBy(originalInput, (_35, key) => !unlocalizableKeys.includes(key))
|
|
2577
2577
|
);
|
|
2578
2578
|
return result;
|
|
2579
2579
|
}
|
|
@@ -2604,7 +2604,7 @@ function _getUnlocalizableKeys(input2) {
|
|
|
2604
2604
|
}
|
|
2605
2605
|
}
|
|
2606
2606
|
return false;
|
|
2607
|
-
}).map(([key,
|
|
2607
|
+
}).map(([key, _35]) => key);
|
|
2608
2608
|
}
|
|
2609
2609
|
|
|
2610
2610
|
// src/cli/loaders/po/index.ts
|
|
@@ -2629,7 +2629,7 @@ function createPoDataLoader(params) {
|
|
|
2629
2629
|
Object.entries(entries).forEach(([msgid, entry]) => {
|
|
2630
2630
|
if (msgid && entry.msgid) {
|
|
2631
2631
|
const context = entry.msgctxt || "";
|
|
2632
|
-
const fullEntry = _optionalChain([parsedPo, 'access',
|
|
2632
|
+
const fullEntry = _optionalChain([parsedPo, 'access', _122 => _122.translations, 'access', _123 => _123[context], 'optionalAccess', _124 => _124[msgid]]);
|
|
2633
2633
|
if (fullEntry) {
|
|
2634
2634
|
result[msgid] = fullEntry;
|
|
2635
2635
|
}
|
|
@@ -2639,8 +2639,8 @@ function createPoDataLoader(params) {
|
|
|
2639
2639
|
return result;
|
|
2640
2640
|
},
|
|
2641
2641
|
async push(locale, data, originalInput, originalLocale, pullInput) {
|
|
2642
|
-
const currentSections = _optionalChain([pullInput, 'optionalAccess',
|
|
2643
|
-
const originalSections = _optionalChain([originalInput, 'optionalAccess',
|
|
2642
|
+
const currentSections = _optionalChain([pullInput, 'optionalAccess', _125 => _125.split, 'call', _126 => _126("\n\n"), 'access', _127 => _127.filter, 'call', _128 => _128(Boolean)]) || [];
|
|
2643
|
+
const originalSections = _optionalChain([originalInput, 'optionalAccess', _129 => _129.split, 'call', _130 => _130("\n\n"), 'access', _131 => _131.filter, 'call', _132 => _132(Boolean)]) || [];
|
|
2644
2644
|
const result = originalSections.map((section) => {
|
|
2645
2645
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
2646
2646
|
if (Object.keys(sectionPo.translations).length === 0) {
|
|
@@ -2709,8 +2709,8 @@ function createPoContentLoader() {
|
|
|
2709
2709
|
{
|
|
2710
2710
|
...entry,
|
|
2711
2711
|
msgstr: [
|
|
2712
|
-
_optionalChain([data, 'access',
|
|
2713
|
-
_optionalChain([data, 'access',
|
|
2712
|
+
_optionalChain([data, 'access', _133 => _133[entry.msgid], 'optionalAccess', _134 => _134.singular]),
|
|
2713
|
+
_optionalChain([data, 'access', _135 => _135[entry.msgid], 'optionalAccess', _136 => _136.plural]) || null
|
|
2714
2714
|
].filter(Boolean)
|
|
2715
2715
|
}
|
|
2716
2716
|
]).fromPairs().value();
|
|
@@ -2832,7 +2832,7 @@ function pullV1(xliffElement, locale, originalLocale) {
|
|
|
2832
2832
|
let key = getTransUnitKey(unit);
|
|
2833
2833
|
if (!key) return;
|
|
2834
2834
|
if (seenKeys.has(key)) {
|
|
2835
|
-
const id = _optionalChain([unit, 'access',
|
|
2835
|
+
const id = _optionalChain([unit, 'access', _137 => _137.getAttribute, 'call', _138 => _138("id"), 'optionalAccess', _139 => _139.trim, 'call', _140 => _140()]);
|
|
2836
2836
|
if (id) {
|
|
2837
2837
|
key = `${key}#${id}`;
|
|
2838
2838
|
} else {
|
|
@@ -2880,7 +2880,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
2880
2880
|
let key = getTransUnitKey(unit);
|
|
2881
2881
|
if (!key) return;
|
|
2882
2882
|
if (seenKeys.has(key)) {
|
|
2883
|
-
const id = _optionalChain([unit, 'access',
|
|
2883
|
+
const id = _optionalChain([unit, 'access', _141 => _141.getAttribute, 'call', _142 => _142("id"), 'optionalAccess', _143 => _143.trim, 'call', _144 => _144()]);
|
|
2884
2884
|
if (id) {
|
|
2885
2885
|
key = `${key}#${id}`;
|
|
2886
2886
|
} else {
|
|
@@ -2922,7 +2922,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
2922
2922
|
const translationKeys = new Set(Object.keys(translations));
|
|
2923
2923
|
existingUnits.forEach((unit, key) => {
|
|
2924
2924
|
if (!translationKeys.has(key)) {
|
|
2925
|
-
_optionalChain([unit, 'access',
|
|
2925
|
+
_optionalChain([unit, 'access', _145 => _145.parentNode, 'optionalAccess', _146 => _146.removeChild, 'call', _147 => _147(unit)]);
|
|
2926
2926
|
}
|
|
2927
2927
|
});
|
|
2928
2928
|
return serializeWithDeclaration(
|
|
@@ -2965,18 +2965,18 @@ function traverseUnitsV2(container, fileId, currentPath, result) {
|
|
|
2965
2965
|
Array.from(container.children).forEach((child) => {
|
|
2966
2966
|
const tagName = child.tagName;
|
|
2967
2967
|
if (tagName === "unit") {
|
|
2968
|
-
const unitId = _optionalChain([child, 'access',
|
|
2968
|
+
const unitId = _optionalChain([child, 'access', _148 => _148.getAttribute, 'call', _149 => _149("id"), 'optionalAccess', _150 => _150.trim, 'call', _151 => _151()]);
|
|
2969
2969
|
if (!unitId) return;
|
|
2970
2970
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
2971
2971
|
const segment = child.querySelector("segment");
|
|
2972
|
-
const source = _optionalChain([segment, 'optionalAccess',
|
|
2972
|
+
const source = _optionalChain([segment, 'optionalAccess', _152 => _152.querySelector, 'call', _153 => _153("source")]);
|
|
2973
2973
|
if (source) {
|
|
2974
2974
|
result[key] = extractTextContent(source);
|
|
2975
2975
|
} else {
|
|
2976
2976
|
result[key] = unitId;
|
|
2977
2977
|
}
|
|
2978
2978
|
} else if (tagName === "group") {
|
|
2979
|
-
const groupId = _optionalChain([child, 'access',
|
|
2979
|
+
const groupId = _optionalChain([child, 'access', _154 => _154.getAttribute, 'call', _155 => _155("id"), 'optionalAccess', _156 => _156.trim, 'call', _157 => _157()]);
|
|
2980
2980
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
2981
2981
|
traverseUnitsV2(child, fileId, newPath, result);
|
|
2982
2982
|
}
|
|
@@ -3012,12 +3012,12 @@ function indexUnitsV2(container, fileId, currentPath, index) {
|
|
|
3012
3012
|
Array.from(container.children).forEach((child) => {
|
|
3013
3013
|
const tagName = child.tagName;
|
|
3014
3014
|
if (tagName === "unit") {
|
|
3015
|
-
const unitId = _optionalChain([child, 'access',
|
|
3015
|
+
const unitId = _optionalChain([child, 'access', _158 => _158.getAttribute, 'call', _159 => _159("id"), 'optionalAccess', _160 => _160.trim, 'call', _161 => _161()]);
|
|
3016
3016
|
if (!unitId) return;
|
|
3017
3017
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
3018
3018
|
index.set(key, child);
|
|
3019
3019
|
} else if (tagName === "group") {
|
|
3020
|
-
const groupId = _optionalChain([child, 'access',
|
|
3020
|
+
const groupId = _optionalChain([child, 'access', _162 => _162.getAttribute, 'call', _163 => _163("id"), 'optionalAccess', _164 => _164.trim, 'call', _165 => _165()]);
|
|
3021
3021
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
3022
3022
|
indexUnitsV2(child, fileId, newPath, index);
|
|
3023
3023
|
}
|
|
@@ -3038,9 +3038,9 @@ function updateUnitV2(unit, value) {
|
|
|
3038
3038
|
setTextContent(source, value);
|
|
3039
3039
|
}
|
|
3040
3040
|
function getTransUnitKey(transUnit) {
|
|
3041
|
-
const resname = _optionalChain([transUnit, 'access',
|
|
3041
|
+
const resname = _optionalChain([transUnit, 'access', _166 => _166.getAttribute, 'call', _167 => _167("resname"), 'optionalAccess', _168 => _168.trim, 'call', _169 => _169()]);
|
|
3042
3042
|
if (resname) return resname;
|
|
3043
|
-
const id = _optionalChain([transUnit, 'access',
|
|
3043
|
+
const id = _optionalChain([transUnit, 'access', _170 => _170.getAttribute, 'call', _171 => _171("id"), 'optionalAccess', _172 => _172.trim, 'call', _173 => _173()]);
|
|
3044
3044
|
if (id) return id;
|
|
3045
3045
|
const sourceElement = transUnit.querySelector("source");
|
|
3046
3046
|
if (sourceElement) {
|
|
@@ -3097,7 +3097,7 @@ function formatXml(xml) {
|
|
|
3097
3097
|
if (cdataNode) {
|
|
3098
3098
|
return `${indent2}${openTag}<![CDATA[${cdataNode.nodeValue}]]></${tagName}>`;
|
|
3099
3099
|
}
|
|
3100
|
-
const textContent = _optionalChain([element, 'access',
|
|
3100
|
+
const textContent = _optionalChain([element, 'access', _174 => _174.textContent, 'optionalAccess', _175 => _175.trim, 'call', _176 => _176()]) || "";
|
|
3101
3101
|
const hasOnlyText = element.childNodes.length === 1 && element.childNodes[0].nodeType === 3;
|
|
3102
3102
|
if (hasOnlyText && textContent) {
|
|
3103
3103
|
return `${indent2}${openTag}${textContent}</${tagName}>`;
|
|
@@ -3390,7 +3390,7 @@ function createDatoClient(params) {
|
|
|
3390
3390
|
ids: !records.length ? void 0 : records.join(",")
|
|
3391
3391
|
}
|
|
3392
3392
|
}).catch(
|
|
3393
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
3393
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _177 => _177.response, 'optionalAccess', _178 => _178.body, 'optionalAccess', _179 => _179.data, 'optionalAccess', _180 => _180[0]]) || error)
|
|
3394
3394
|
);
|
|
3395
3395
|
},
|
|
3396
3396
|
findRecordsForModel: async (modelId, records) => {
|
|
@@ -3401,10 +3401,10 @@ function createDatoClient(params) {
|
|
|
3401
3401
|
filter: {
|
|
3402
3402
|
type: modelId,
|
|
3403
3403
|
only_valid: "true",
|
|
3404
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
3404
|
+
ids: !_optionalChain([records, 'optionalAccess', _181 => _181.length]) ? void 0 : records.join(",")
|
|
3405
3405
|
}
|
|
3406
3406
|
}).catch(
|
|
3407
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
3407
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _182 => _182.response, 'optionalAccess', _183 => _183.body, 'optionalAccess', _184 => _184.data, 'optionalAccess', _185 => _185[0]]) || error)
|
|
3408
3408
|
);
|
|
3409
3409
|
return result;
|
|
3410
3410
|
} catch (_error) {
|
|
@@ -3420,10 +3420,10 @@ function createDatoClient(params) {
|
|
|
3420
3420
|
updateRecord: async (id, payload) => {
|
|
3421
3421
|
try {
|
|
3422
3422
|
await dato.items.update(id, payload).catch(
|
|
3423
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
3423
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _186 => _186.response, 'optionalAccess', _187 => _187.body, 'optionalAccess', _188 => _188.data, 'optionalAccess', _189 => _189[0]]) || error)
|
|
3424
3424
|
);
|
|
3425
3425
|
} catch (_error) {
|
|
3426
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
3426
|
+
if (_optionalChain([_error, 'optionalAccess', _190 => _190.attributes, 'optionalAccess', _191 => _191.details, 'optionalAccess', _192 => _192.message])) {
|
|
3427
3427
|
throw new Error(
|
|
3428
3428
|
[
|
|
3429
3429
|
`${_error.attributes.details.message}`,
|
|
@@ -3445,10 +3445,10 @@ function createDatoClient(params) {
|
|
|
3445
3445
|
enableFieldLocalization: async (args) => {
|
|
3446
3446
|
try {
|
|
3447
3447
|
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch(
|
|
3448
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
3448
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _193 => _193.response, 'optionalAccess', _194 => _194.body, 'optionalAccess', _195 => _195.data, 'optionalAccess', _196 => _196[0]]) || error)
|
|
3449
3449
|
);
|
|
3450
3450
|
} catch (_error) {
|
|
3451
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
3451
|
+
if (_optionalChain([_error, 'optionalAccess', _197 => _197.attributes, 'optionalAccess', _198 => _198.code]) === "NOT_FOUND") {
|
|
3452
3452
|
throw new Error(
|
|
3453
3453
|
[
|
|
3454
3454
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -3456,7 +3456,7 @@ function createDatoClient(params) {
|
|
|
3456
3456
|
].join("\n\n")
|
|
3457
3457
|
);
|
|
3458
3458
|
}
|
|
3459
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
3459
|
+
if (_optionalChain([_error, 'optionalAccess', _199 => _199.attributes, 'optionalAccess', _200 => _200.details, 'optionalAccess', _201 => _201.message])) {
|
|
3460
3460
|
throw new Error(
|
|
3461
3461
|
[
|
|
3462
3462
|
`${_error.attributes.details.message}`,
|
|
@@ -3534,7 +3534,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
3534
3534
|
const records = await dato.findRecordsForModel(modelId);
|
|
3535
3535
|
const recordChoices = createRecordChoices(
|
|
3536
3536
|
records,
|
|
3537
|
-
_optionalChain([config, 'access',
|
|
3537
|
+
_optionalChain([config, 'access', _202 => _202.models, 'access', _203 => _203[modelId], 'optionalAccess', _204 => _204.records]) || [],
|
|
3538
3538
|
project
|
|
3539
3539
|
);
|
|
3540
3540
|
const selectedRecords = await promptRecordSelection(
|
|
@@ -3553,14 +3553,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
3553
3553
|
},
|
|
3554
3554
|
async pull(locale, input2, initCtx) {
|
|
3555
3555
|
const result = {};
|
|
3556
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
3557
|
-
let records = _optionalChain([initCtx, 'optionalAccess',
|
|
3556
|
+
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _205 => _205.models]) || {})) {
|
|
3557
|
+
let records = _optionalChain([initCtx, 'optionalAccess', _206 => _206.models, 'access', _207 => _207[modelId], 'access', _208 => _208.records]) || [];
|
|
3558
3558
|
const recordIds = records.map((record) => record.id);
|
|
3559
3559
|
records = await dato.findRecords(recordIds);
|
|
3560
3560
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
3561
3561
|
if (records.length > 0) {
|
|
3562
3562
|
result[modelId] = {
|
|
3563
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
3563
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _209 => _209.models, 'optionalAccess', _210 => _210[modelId], 'optionalAccess', _211 => _211.fields]) || [],
|
|
3564
3564
|
records
|
|
3565
3565
|
};
|
|
3566
3566
|
}
|
|
@@ -3623,7 +3623,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
3623
3623
|
return records.map((record) => ({
|
|
3624
3624
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
3625
3625
|
value: record.id,
|
|
3626
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
3626
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _212 => _212.includes, 'call', _213 => _213(record.id)])
|
|
3627
3627
|
}));
|
|
3628
3628
|
}
|
|
3629
3629
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -3942,7 +3942,7 @@ function createVttLoader() {
|
|
|
3942
3942
|
if (!input2) {
|
|
3943
3943
|
return "";
|
|
3944
3944
|
}
|
|
3945
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
3945
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _214 => _214.parse, 'call', _215 => _215(input2), 'optionalAccess', _216 => _216.cues]);
|
|
3946
3946
|
if (Object.keys(vtt).length === 0) {
|
|
3947
3947
|
return {};
|
|
3948
3948
|
} else {
|
|
@@ -3996,7 +3996,7 @@ function variableExtractLoader(params) {
|
|
|
3996
3996
|
for (let i = 0; i < matches.length; i++) {
|
|
3997
3997
|
const match2 = matches[i];
|
|
3998
3998
|
const currentValue = result[key].value;
|
|
3999
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
3999
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _217 => _217.replace, 'call', _218 => _218(match2, `{variable:${i}}`)]);
|
|
4000
4000
|
result[key].value = newValue;
|
|
4001
4001
|
result[key].variables[i] = match2;
|
|
4002
4002
|
}
|
|
@@ -4010,7 +4010,7 @@ function variableExtractLoader(params) {
|
|
|
4010
4010
|
for (let i = 0; i < valueObj.variables.length; i++) {
|
|
4011
4011
|
const variable = valueObj.variables[i];
|
|
4012
4012
|
const currentValue = result[key];
|
|
4013
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
4013
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _219 => _219.replace, 'call', _220 => _220(`{variable:${i}}`, variable)]);
|
|
4014
4014
|
result[key] = newValue;
|
|
4015
4015
|
}
|
|
4016
4016
|
}
|
|
@@ -4210,7 +4210,7 @@ function createVueJsonLoader() {
|
|
|
4210
4210
|
return createLoader({
|
|
4211
4211
|
pull: async (locale, input2, ctx) => {
|
|
4212
4212
|
const parsed = parseVueFile(input2);
|
|
4213
|
-
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess',
|
|
4213
|
+
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _221 => _221.i18n, 'optionalAccess', _222 => _222[locale]]), () => ( {}));
|
|
4214
4214
|
},
|
|
4215
4215
|
push: async (locale, data, originalInput) => {
|
|
4216
4216
|
const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
|
|
@@ -4395,7 +4395,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
|
|
|
4395
4395
|
objectExpression.properties.forEach((prop) => {
|
|
4396
4396
|
if (!t.isObjectProperty(prop)) return;
|
|
4397
4397
|
const key = getPropertyKey(prop);
|
|
4398
|
-
const incomingVal = _optionalChain([data, 'optionalAccess',
|
|
4398
|
+
const incomingVal = _optionalChain([data, 'optionalAccess', _223 => _223[key]]);
|
|
4399
4399
|
if (incomingVal === void 0) {
|
|
4400
4400
|
return;
|
|
4401
4401
|
}
|
|
@@ -4431,7 +4431,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
|
|
|
4431
4431
|
let modified = false;
|
|
4432
4432
|
arrayExpression.elements.forEach((element, index) => {
|
|
4433
4433
|
if (!element) return;
|
|
4434
|
-
const incomingVal = _optionalChain([incoming, 'optionalAccess',
|
|
4434
|
+
const incomingVal = _optionalChain([incoming, 'optionalAccess', _224 => _224[index]]);
|
|
4435
4435
|
if (incomingVal === void 0) return;
|
|
4436
4436
|
if (t.isStringLiteral(element) && typeof incomingVal === "string") {
|
|
4437
4437
|
if (element.value !== incomingVal) {
|
|
@@ -4922,7 +4922,7 @@ var AST = class _AST {
|
|
|
4922
4922
|
const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
|
|
4923
4923
|
if (this.isStart() && !this.type)
|
|
4924
4924
|
ret.unshift([]);
|
|
4925
|
-
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
4925
|
+
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _225 => _225.#parent, 'optionalAccess', _226 => _226.type]) === "!")) {
|
|
4926
4926
|
ret.push({});
|
|
4927
4927
|
}
|
|
4928
4928
|
return ret;
|
|
@@ -4930,7 +4930,7 @@ var AST = class _AST {
|
|
|
4930
4930
|
isStart() {
|
|
4931
4931
|
if (this.#root === this)
|
|
4932
4932
|
return true;
|
|
4933
|
-
if (!_optionalChain([this, 'access',
|
|
4933
|
+
if (!_optionalChain([this, 'access', _227 => _227.#parent, 'optionalAccess', _228 => _228.isStart, 'call', _229 => _229()]))
|
|
4934
4934
|
return false;
|
|
4935
4935
|
if (this.#parentIndex === 0)
|
|
4936
4936
|
return true;
|
|
@@ -4946,12 +4946,12 @@ var AST = class _AST {
|
|
|
4946
4946
|
isEnd() {
|
|
4947
4947
|
if (this.#root === this)
|
|
4948
4948
|
return true;
|
|
4949
|
-
if (_optionalChain([this, 'access',
|
|
4949
|
+
if (_optionalChain([this, 'access', _230 => _230.#parent, 'optionalAccess', _231 => _231.type]) === "!")
|
|
4950
4950
|
return true;
|
|
4951
|
-
if (!_optionalChain([this, 'access',
|
|
4951
|
+
if (!_optionalChain([this, 'access', _232 => _232.#parent, 'optionalAccess', _233 => _233.isEnd, 'call', _234 => _234()]))
|
|
4952
4952
|
return false;
|
|
4953
4953
|
if (!this.type)
|
|
4954
|
-
return _optionalChain([this, 'access',
|
|
4954
|
+
return _optionalChain([this, 'access', _235 => _235.#parent, 'optionalAccess', _236 => _236.isEnd, 'call', _237 => _237()]);
|
|
4955
4955
|
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
|
4956
4956
|
return this.#parentIndex === pl - 1;
|
|
4957
4957
|
}
|
|
@@ -5173,7 +5173,7 @@ var AST = class _AST {
|
|
|
5173
5173
|
if (!this.type) {
|
|
5174
5174
|
const noEmpty = this.isStart() && this.isEnd();
|
|
5175
5175
|
const src = this.#parts.map((p) => {
|
|
5176
|
-
const [re,
|
|
5176
|
+
const [re, _35, hasMagic, uflag] = typeof p === "string" ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
|
5177
5177
|
this.#hasMagic = this.#hasMagic || hasMagic;
|
|
5178
5178
|
this.#uflag = this.#uflag || uflag;
|
|
5179
5179
|
return re;
|
|
@@ -5196,7 +5196,7 @@ var AST = class _AST {
|
|
|
5196
5196
|
}
|
|
5197
5197
|
}
|
|
5198
5198
|
let end = "";
|
|
5199
|
-
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
5199
|
+
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _238 => _238.#parent, 'optionalAccess', _239 => _239.type]) === "!") {
|
|
5200
5200
|
end = "(?:$|\\/)";
|
|
5201
5201
|
}
|
|
5202
5202
|
const final2 = start2 + src + end;
|
|
@@ -5246,7 +5246,7 @@ var AST = class _AST {
|
|
|
5246
5246
|
if (typeof p === "string") {
|
|
5247
5247
|
throw new Error("string type in extglob ast??");
|
|
5248
5248
|
}
|
|
5249
|
-
const [re,
|
|
5249
|
+
const [re, _35, _hasMagic, uflag] = p.toRegExpSource(dot);
|
|
5250
5250
|
this.#uflag = this.#uflag || uflag;
|
|
5251
5251
|
return re;
|
|
5252
5252
|
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
|
|
@@ -5491,7 +5491,7 @@ var Minimatch = class {
|
|
|
5491
5491
|
}
|
|
5492
5492
|
return false;
|
|
5493
5493
|
}
|
|
5494
|
-
debug(...
|
|
5494
|
+
debug(..._35) {
|
|
5495
5495
|
}
|
|
5496
5496
|
make() {
|
|
5497
5497
|
const pattern = this.pattern;
|
|
@@ -5513,7 +5513,7 @@ var Minimatch = class {
|
|
|
5513
5513
|
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
5514
5514
|
this.globParts = this.preprocess(rawGlobParts);
|
|
5515
5515
|
this.debug(this.pattern, this.globParts);
|
|
5516
|
-
let set = this.globParts.map((s,
|
|
5516
|
+
let set = this.globParts.map((s, _35, __) => {
|
|
5517
5517
|
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
5518
5518
|
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
5519
5519
|
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
@@ -6269,7 +6269,7 @@ function createMdxSectionsSplit2Loader() {
|
|
|
6269
6269
|
const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
|
|
6270
6270
|
const result = {
|
|
6271
6271
|
frontmatter: data.frontmatter,
|
|
6272
|
-
codePlaceholders: _optionalChain([pullInput, 'optionalAccess',
|
|
6272
|
+
codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _240 => _240.codePlaceholders]) || {},
|
|
6273
6273
|
content
|
|
6274
6274
|
};
|
|
6275
6275
|
return result;
|
|
@@ -6540,11 +6540,87 @@ function createTxtLoader() {
|
|
|
6540
6540
|
const sortedEntries = Object.entries(payload).sort(
|
|
6541
6541
|
([a], [b]) => parseInt(a) - parseInt(b)
|
|
6542
6542
|
);
|
|
6543
|
-
return sortedEntries.map(([
|
|
6543
|
+
return sortedEntries.map(([_35, value]) => value).join("\n");
|
|
6544
6544
|
}
|
|
6545
6545
|
});
|
|
6546
6546
|
}
|
|
6547
6547
|
|
|
6548
|
+
// src/cli/loaders/json-dictionary.ts
|
|
6549
|
+
|
|
6550
|
+
function createJsonDictionaryLoader() {
|
|
6551
|
+
return createLoader({
|
|
6552
|
+
pull: async (locale, input2) => {
|
|
6553
|
+
return extractTranslatables(input2, locale);
|
|
6554
|
+
},
|
|
6555
|
+
push: async (locale, data, originalInput, originalLocale) => {
|
|
6556
|
+
if (!originalInput) {
|
|
6557
|
+
throw new Error("Error while parsing json-dictionary bucket");
|
|
6558
|
+
}
|
|
6559
|
+
const input2 = _lodash2.default.cloneDeep(originalInput);
|
|
6560
|
+
function walk(obj, dataNode, path17 = []) {
|
|
6561
|
+
if (Array.isArray(obj) && Array.isArray(dataNode)) {
|
|
6562
|
+
obj.forEach(
|
|
6563
|
+
(item, idx) => walk(item, dataNode[idx], [...path17, String(idx)])
|
|
6564
|
+
);
|
|
6565
|
+
} else if (obj && typeof obj === "object" && dataNode && typeof dataNode === "object" && !Array.isArray(dataNode)) {
|
|
6566
|
+
for (const key of Object.keys(obj)) {
|
|
6567
|
+
if (dataNode.hasOwnProperty(key)) {
|
|
6568
|
+
walk(obj[key], dataNode[key], [...path17, key]);
|
|
6569
|
+
}
|
|
6570
|
+
}
|
|
6571
|
+
} else if (obj && typeof obj === "object" && !Array.isArray(obj) && typeof dataNode === "string") {
|
|
6572
|
+
setNestedLocale(input2, path17, locale, dataNode, originalLocale);
|
|
6573
|
+
}
|
|
6574
|
+
}
|
|
6575
|
+
walk(originalInput, data);
|
|
6576
|
+
return input2;
|
|
6577
|
+
}
|
|
6578
|
+
});
|
|
6579
|
+
}
|
|
6580
|
+
function extractTranslatables(obj, locale) {
|
|
6581
|
+
if (Array.isArray(obj)) {
|
|
6582
|
+
return obj.map((item) => extractTranslatables(item, locale));
|
|
6583
|
+
} else if (isTranslatableObject(obj, locale)) {
|
|
6584
|
+
return obj[locale];
|
|
6585
|
+
} else if (obj && typeof obj === "object") {
|
|
6586
|
+
const result = {};
|
|
6587
|
+
for (const key of Object.keys(obj)) {
|
|
6588
|
+
const value = extractTranslatables(obj[key], locale);
|
|
6589
|
+
if (typeof value === "object" && value !== null && Object.keys(value).length > 0 || Array.isArray(value) && value.length > 0 || typeof value === "string" && value.length > 0) {
|
|
6590
|
+
result[key] = value;
|
|
6591
|
+
}
|
|
6592
|
+
}
|
|
6593
|
+
return result;
|
|
6594
|
+
}
|
|
6595
|
+
return void 0;
|
|
6596
|
+
}
|
|
6597
|
+
function isTranslatableObject(obj, locale) {
|
|
6598
|
+
return obj && typeof obj === "object" && !Array.isArray(obj) && Object.prototype.hasOwnProperty.call(obj, locale);
|
|
6599
|
+
}
|
|
6600
|
+
function setNestedLocale(obj, path17, locale, value, originalLocale) {
|
|
6601
|
+
let curr = obj;
|
|
6602
|
+
for (let i = 0; i < path17.length - 1; i++) {
|
|
6603
|
+
const key = path17[i];
|
|
6604
|
+
if (!(key in curr)) curr[key] = {};
|
|
6605
|
+
curr = curr[key];
|
|
6606
|
+
}
|
|
6607
|
+
const last = path17[path17.length - 1];
|
|
6608
|
+
if (curr[last] && typeof curr[last] === "object") {
|
|
6609
|
+
curr[last][locale] = value;
|
|
6610
|
+
if (originalLocale && curr[last][originalLocale]) {
|
|
6611
|
+
const entries = Object.entries(curr[last]);
|
|
6612
|
+
const first = entries.filter(([k]) => k === originalLocale);
|
|
6613
|
+
const rest = entries.filter(([k]) => k !== originalLocale).sort(([a], [b]) => a.localeCompare(b));
|
|
6614
|
+
const ordered = [...first, ...rest];
|
|
6615
|
+
const reordered = {};
|
|
6616
|
+
for (const [k, v] of ordered) {
|
|
6617
|
+
reordered[k] = v;
|
|
6618
|
+
}
|
|
6619
|
+
curr[last] = reordered;
|
|
6620
|
+
}
|
|
6621
|
+
}
|
|
6622
|
+
}
|
|
6623
|
+
|
|
6548
6624
|
// src/cli/loaders/index.ts
|
|
6549
6625
|
function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys, lockedPatterns, ignoredKeys) {
|
|
6550
6626
|
switch (bucketType) {
|
|
@@ -6776,6 +6852,19 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
6776
6852
|
createSyncLoader(),
|
|
6777
6853
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
6778
6854
|
);
|
|
6855
|
+
case "json-dictionary":
|
|
6856
|
+
return composeLoaders(
|
|
6857
|
+
createTextFileLoader(bucketPathPattern),
|
|
6858
|
+
createPrettierLoader({ parser: "json", bucketPathPattern }),
|
|
6859
|
+
createJsonLoader(),
|
|
6860
|
+
createJsonDictionaryLoader(),
|
|
6861
|
+
createEnsureKeyOrderLoader(),
|
|
6862
|
+
createFlatLoader(),
|
|
6863
|
+
createInjectLocaleLoader(options.injectLocale),
|
|
6864
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
6865
|
+
createSyncLoader(),
|
|
6866
|
+
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
6867
|
+
);
|
|
6779
6868
|
}
|
|
6780
6869
|
}
|
|
6781
6870
|
|
|
@@ -6880,7 +6969,7 @@ function createBasicTranslator(model, systemPrompt) {
|
|
|
6880
6969
|
]
|
|
6881
6970
|
});
|
|
6882
6971
|
const result = JSON.parse(response.text);
|
|
6883
|
-
return _optionalChain([result, 'optionalAccess',
|
|
6972
|
+
return _optionalChain([result, 'optionalAccess', _241 => _241.data]) || {};
|
|
6884
6973
|
}
|
|
6885
6974
|
}
|
|
6886
6975
|
function extractPayloadChunks(payload) {
|
|
@@ -6962,7 +7051,7 @@ function getPureModelProvider(provider) {
|
|
|
6962
7051
|
|
|
6963
7052
|
${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
|
|
6964
7053
|
`;
|
|
6965
|
-
switch (_optionalChain([provider, 'optionalAccess',
|
|
7054
|
+
switch (_optionalChain([provider, 'optionalAccess', _242 => _242.id])) {
|
|
6966
7055
|
case "openai": {
|
|
6967
7056
|
if (!process.env.OPENAI_API_KEY) {
|
|
6968
7057
|
throw new Error(
|
|
@@ -7020,7 +7109,7 @@ function getPureModelProvider(provider) {
|
|
|
7020
7109
|
})(provider.model);
|
|
7021
7110
|
}
|
|
7022
7111
|
default: {
|
|
7023
|
-
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess',
|
|
7112
|
+
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _243 => _243.id])));
|
|
7024
7113
|
}
|
|
7025
7114
|
}
|
|
7026
7115
|
}
|
|
@@ -7260,7 +7349,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
7260
7349
|
validateParams(i18nConfig, flags);
|
|
7261
7350
|
ora.succeed("Localization configuration is valid");
|
|
7262
7351
|
ora.start("Connecting to Lingo.dev Localization Engine...");
|
|
7263
|
-
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess',
|
|
7352
|
+
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _244 => _244.provider]);
|
|
7264
7353
|
if (isByokMode) {
|
|
7265
7354
|
authId = null;
|
|
7266
7355
|
ora.succeed("Using external provider (BYOK mode)");
|
|
@@ -7274,16 +7363,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
7274
7363
|
flags
|
|
7275
7364
|
});
|
|
7276
7365
|
let buckets = getBuckets(i18nConfig);
|
|
7277
|
-
if (_optionalChain([flags, 'access',
|
|
7366
|
+
if (_optionalChain([flags, 'access', _245 => _245.bucket, 'optionalAccess', _246 => _246.length])) {
|
|
7278
7367
|
buckets = buckets.filter(
|
|
7279
7368
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
7280
7369
|
);
|
|
7281
7370
|
}
|
|
7282
7371
|
ora.succeed("Buckets retrieved");
|
|
7283
|
-
if (_optionalChain([flags, 'access',
|
|
7372
|
+
if (_optionalChain([flags, 'access', _247 => _247.file, 'optionalAccess', _248 => _248.length])) {
|
|
7284
7373
|
buckets = buckets.map((bucket) => {
|
|
7285
7374
|
const paths = bucket.paths.filter(
|
|
7286
|
-
(path17) => flags.file.find((file) => _optionalChain([path17, 'access',
|
|
7375
|
+
(path17) => flags.file.find((file) => _optionalChain([path17, 'access', _249 => _249.pathPattern, 'optionalAccess', _250 => _250.includes, 'call', _251 => _251(file)]))
|
|
7287
7376
|
);
|
|
7288
7377
|
return { ...bucket, paths };
|
|
7289
7378
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -7302,7 +7391,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
7302
7391
|
});
|
|
7303
7392
|
}
|
|
7304
7393
|
}
|
|
7305
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
7394
|
+
const targetLocales = _optionalChain([flags, 'access', _252 => _252.locale, 'optionalAccess', _253 => _253.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
7306
7395
|
ora.start("Setting up localization cache...");
|
|
7307
7396
|
const checkLockfileProcessor = createDeltaProcessor("");
|
|
7308
7397
|
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
@@ -7473,7 +7562,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
7473
7562
|
if (flags.key) {
|
|
7474
7563
|
processableData = _lodash2.default.pickBy(
|
|
7475
7564
|
processableData,
|
|
7476
|
-
(
|
|
7565
|
+
(_35, key) => key === flags.key
|
|
7477
7566
|
);
|
|
7478
7567
|
}
|
|
7479
7568
|
if (flags.verbose) {
|
|
@@ -7561,7 +7650,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
7561
7650
|
}
|
|
7562
7651
|
const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
|
|
7563
7652
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
7564
|
-
if (!_optionalChain([flags, 'access',
|
|
7653
|
+
if (!_optionalChain([flags, 'access', _254 => _254.locale, 'optionalAccess', _255 => _255.length])) {
|
|
7565
7654
|
await deltaProcessor.saveChecksums(checksums);
|
|
7566
7655
|
}
|
|
7567
7656
|
}
|
|
@@ -7645,12 +7734,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
7645
7734
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
7646
7735
|
docUrl: "bucketNotFound"
|
|
7647
7736
|
});
|
|
7648
|
-
} else if (_optionalChain([flags, 'access',
|
|
7737
|
+
} else if (_optionalChain([flags, 'access', _256 => _256.locale, 'optionalAccess', _257 => _257.some, 'call', _258 => _258((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
7649
7738
|
throw new CLIError({
|
|
7650
7739
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
7651
7740
|
docUrl: "localeTargetNotFound"
|
|
7652
7741
|
});
|
|
7653
|
-
} else if (_optionalChain([flags, 'access',
|
|
7742
|
+
} else if (_optionalChain([flags, 'access', _259 => _259.bucket, 'optionalAccess', _260 => _260.some, 'call', _261 => _261(
|
|
7654
7743
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
7655
7744
|
)])) {
|
|
7656
7745
|
throw new CLIError({
|
|
@@ -8030,7 +8119,7 @@ var _stdiojs = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
|
8030
8119
|
var _mcpjs = require('@modelcontextprotocol/sdk/server/mcp.js');
|
|
8031
8120
|
|
|
8032
8121
|
|
|
8033
|
-
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 (
|
|
8122
|
+
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) => {
|
|
8034
8123
|
const apiKey = program.args[0];
|
|
8035
8124
|
const settings = getSettings(apiKey);
|
|
8036
8125
|
if (!settings.auth.apiKey) {
|
|
@@ -8154,7 +8243,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
|
|
|
8154
8243
|
const response = await engine.whoami();
|
|
8155
8244
|
return {
|
|
8156
8245
|
authenticated: !!response,
|
|
8157
|
-
username: _optionalChain([response, 'optionalAccess',
|
|
8246
|
+
username: _optionalChain([response, 'optionalAccess', _262 => _262.email])
|
|
8158
8247
|
};
|
|
8159
8248
|
} catch (e2) {
|
|
8160
8249
|
return { authenticated: false };
|
|
@@ -8261,7 +8350,7 @@ function createExplicitLocalizer(provider) {
|
|
|
8261
8350
|
}
|
|
8262
8351
|
function createAiSdkLocalizer(params) {
|
|
8263
8352
|
const skipAuth = params.skipAuth === true;
|
|
8264
|
-
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
8353
|
+
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _263 => _263.apiKeyName]), () => ( ""))];
|
|
8265
8354
|
if (!skipAuth && !apiKey || !params.apiKeyName) {
|
|
8266
8355
|
throw new Error(
|
|
8267
8356
|
_dedent2.default`
|
|
@@ -8386,8 +8475,8 @@ async function setup(input2) {
|
|
|
8386
8475
|
throw new Error(
|
|
8387
8476
|
"No buckets found in i18n.json. Please add at least one bucket containing i18n content."
|
|
8388
8477
|
);
|
|
8389
|
-
} else if (_optionalChain([ctx, 'access',
|
|
8390
|
-
(bucket) => !_optionalChain([ctx, 'access',
|
|
8478
|
+
} else if (_optionalChain([ctx, 'access', _264 => _264.flags, 'access', _265 => _265.bucket, 'optionalAccess', _266 => _266.some, 'call', _267 => _267(
|
|
8479
|
+
(bucket) => !_optionalChain([ctx, 'access', _268 => _268.config, 'optionalAccess', _269 => _269.buckets, 'access', _270 => _270[bucket]])
|
|
8391
8480
|
)])) {
|
|
8392
8481
|
throw new Error(
|
|
8393
8482
|
`One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
|
|
@@ -8400,7 +8489,7 @@ async function setup(input2) {
|
|
|
8400
8489
|
title: "Selecting localization provider",
|
|
8401
8490
|
task: async (ctx, task) => {
|
|
8402
8491
|
ctx.localizer = createLocalizer(
|
|
8403
|
-
_optionalChain([ctx, 'access',
|
|
8492
|
+
_optionalChain([ctx, 'access', _271 => _271.config, 'optionalAccess', _272 => _272.provider]),
|
|
8404
8493
|
ctx.flags.apiKey
|
|
8405
8494
|
);
|
|
8406
8495
|
if (!ctx.localizer) {
|
|
@@ -8615,7 +8704,7 @@ async function execute(input2) {
|
|
|
8615
8704
|
const workerTasks = [];
|
|
8616
8705
|
for (let i = 0; i < workersCount; i++) {
|
|
8617
8706
|
const assignedTasks = ctx.tasks.filter(
|
|
8618
|
-
(
|
|
8707
|
+
(_35, idx) => idx % workersCount === i
|
|
8619
8708
|
);
|
|
8620
8709
|
workerTasks.push(
|
|
8621
8710
|
createWorkerTask({
|
|
@@ -8718,7 +8807,7 @@ function createWorkerTask(args) {
|
|
|
8718
8807
|
const processableData = _lodash2.default.chain(sourceData).entries().filter(
|
|
8719
8808
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
|
|
8720
8809
|
).filter(
|
|
8721
|
-
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access',
|
|
8810
|
+
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _273 => _273.onlyKeys, 'optionalAccess', _274 => _274.some, 'call', _275 => _275(
|
|
8722
8811
|
(pattern) => minimatch(key, pattern)
|
|
8723
8812
|
)])
|
|
8724
8813
|
).fromPairs().value();
|
|
@@ -8779,7 +8868,7 @@ function createWorkerTask(args) {
|
|
|
8779
8868
|
finalRenamedTargetData
|
|
8780
8869
|
);
|
|
8781
8870
|
const checksums2 = await deltaProcessor.createChecksums(sourceData);
|
|
8782
|
-
if (!_optionalChain([args, 'access',
|
|
8871
|
+
if (!_optionalChain([args, 'access', _276 => _276.ctx, 'access', _277 => _277.flags, 'access', _278 => _278.targetLocale, 'optionalAccess', _279 => _279.length])) {
|
|
8783
8872
|
await deltaProcessor.saveChecksums(checksums2);
|
|
8784
8873
|
}
|
|
8785
8874
|
});
|
|
@@ -8969,13 +9058,13 @@ var flagsSchema2 = _zod.z.object({
|
|
|
8969
9058
|
|
|
8970
9059
|
// src/cli/cmd/run/_utils.ts
|
|
8971
9060
|
async function determineAuthId(ctx) {
|
|
8972
|
-
const isByokMode = !!_optionalChain([ctx, 'access',
|
|
9061
|
+
const isByokMode = !!_optionalChain([ctx, 'access', _280 => _280.config, 'optionalAccess', _281 => _281.provider]);
|
|
8973
9062
|
if (isByokMode) {
|
|
8974
9063
|
return null;
|
|
8975
9064
|
} else {
|
|
8976
9065
|
try {
|
|
8977
|
-
const authStatus = await _optionalChain([ctx, 'access',
|
|
8978
|
-
return _optionalChain([authStatus, 'optionalAccess',
|
|
9066
|
+
const authStatus = await _optionalChain([ctx, 'access', _282 => _282.localizer, 'optionalAccess', _283 => _283.checkAuth, 'call', _284 => _284()]);
|
|
9067
|
+
return _optionalChain([authStatus, 'optionalAccess', _285 => _285.username]) || null;
|
|
8979
9068
|
} catch (e3) {
|
|
8980
9069
|
return null;
|
|
8981
9070
|
}
|
|
@@ -9135,7 +9224,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
9135
9224
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
9136
9225
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
9137
9226
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
9138
|
-
_optionalChain([this, 'access',
|
|
9227
|
+
_optionalChain([this, 'access', _286 => _286.platformKit, 'optionalAccess', _287 => _287.gitConfig, 'call', _288 => _288()]);
|
|
9139
9228
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
9140
9229
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
9141
9230
|
if (!processOwnCommits) {
|
|
@@ -9167,7 +9256,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
9167
9256
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
9168
9257
|
var PullRequestFlow = class extends InBranchFlow {
|
|
9169
9258
|
async preRun() {
|
|
9170
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
9259
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _289 => _289()]);
|
|
9171
9260
|
if (!canContinue) {
|
|
9172
9261
|
return false;
|
|
9173
9262
|
}
|
|
@@ -9430,10 +9519,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
9430
9519
|
repo_slug: this.platformConfig.repositoryName,
|
|
9431
9520
|
state: "OPEN"
|
|
9432
9521
|
}).then(({ data: { values } }) => {
|
|
9433
|
-
return _optionalChain([values, 'optionalAccess',
|
|
9434
|
-
({ source, destination }) => _optionalChain([source, 'optionalAccess',
|
|
9522
|
+
return _optionalChain([values, 'optionalAccess', _290 => _290.find, 'call', _291 => _291(
|
|
9523
|
+
({ source, destination }) => _optionalChain([source, 'optionalAccess', _292 => _292.branch, 'optionalAccess', _293 => _293.name]) === branch && _optionalChain([destination, 'optionalAccess', _294 => _294.branch, 'optionalAccess', _295 => _295.name]) === this.platformConfig.baseBranchName
|
|
9435
9524
|
)]);
|
|
9436
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
9525
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _296 => _296.id]));
|
|
9437
9526
|
}
|
|
9438
9527
|
async closePullRequest({ pullRequestNumber }) {
|
|
9439
9528
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -9529,7 +9618,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
9529
9618
|
repo: this.platformConfig.repositoryName,
|
|
9530
9619
|
base: this.platformConfig.baseBranchName,
|
|
9531
9620
|
state: "open"
|
|
9532
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
9621
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _297 => _297.number]));
|
|
9533
9622
|
}
|
|
9534
9623
|
async closePullRequest({ pullRequestNumber }) {
|
|
9535
9624
|
await this.octokit.rest.pulls.update({
|
|
@@ -9656,7 +9745,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
9656
9745
|
sourceBranch: branch,
|
|
9657
9746
|
state: "opened"
|
|
9658
9747
|
});
|
|
9659
|
-
return _optionalChain([mergeRequests, 'access',
|
|
9748
|
+
return _optionalChain([mergeRequests, 'access', _298 => _298[0], 'optionalAccess', _299 => _299.iid]);
|
|
9660
9749
|
}
|
|
9661
9750
|
async closePullRequest({
|
|
9662
9751
|
pullRequestNumber
|
|
@@ -9746,7 +9835,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
9746
9835
|
}
|
|
9747
9836
|
const env = {
|
|
9748
9837
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
9749
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
9838
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _300 => _300.pullRequest, 'optionalAccess', _301 => _301.toString, 'call', _302 => _302()]) || "false",
|
|
9750
9839
|
...options.commitMessage && {
|
|
9751
9840
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
9752
9841
|
},
|
|
@@ -9766,7 +9855,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
9766
9855
|
const { isPullRequestMode } = platformKit.config;
|
|
9767
9856
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
9768
9857
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
9769
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
9858
|
+
const canRun = await _optionalChain([flow, 'access', _303 => _303.preRun, 'optionalCall', _304 => _304()]);
|
|
9770
9859
|
if (canRun === false) {
|
|
9771
9860
|
return;
|
|
9772
9861
|
}
|
|
@@ -9776,7 +9865,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
9776
9865
|
if (!hasChanges) {
|
|
9777
9866
|
return;
|
|
9778
9867
|
}
|
|
9779
|
-
await _optionalChain([flow, 'access',
|
|
9868
|
+
await _optionalChain([flow, 'access', _305 => _305.postRun, 'optionalCall', _306 => _306()]);
|
|
9780
9869
|
});
|
|
9781
9870
|
function parseBooleanArg(val) {
|
|
9782
9871
|
if (val === true) return true;
|
|
@@ -9845,17 +9934,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
9845
9934
|
flags
|
|
9846
9935
|
});
|
|
9847
9936
|
let buckets = getBuckets(i18nConfig);
|
|
9848
|
-
if (_optionalChain([flags, 'access',
|
|
9937
|
+
if (_optionalChain([flags, 'access', _307 => _307.bucket, 'optionalAccess', _308 => _308.length])) {
|
|
9849
9938
|
buckets = buckets.filter(
|
|
9850
9939
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
9851
9940
|
);
|
|
9852
9941
|
}
|
|
9853
9942
|
ora.succeed("Buckets retrieved");
|
|
9854
|
-
if (_optionalChain([flags, 'access',
|
|
9943
|
+
if (_optionalChain([flags, 'access', _309 => _309.file, 'optionalAccess', _310 => _310.length])) {
|
|
9855
9944
|
buckets = buckets.map((bucket) => {
|
|
9856
9945
|
const paths = bucket.paths.filter(
|
|
9857
9946
|
(path17) => flags.file.find(
|
|
9858
|
-
(file) => _optionalChain([path17, 'access',
|
|
9947
|
+
(file) => _optionalChain([path17, 'access', _311 => _311.pathPattern, 'optionalAccess', _312 => _312.includes, 'call', _313 => _313(file)]) || _optionalChain([path17, 'access', _314 => _314.pathPattern, 'optionalAccess', _315 => _315.match, 'call', _316 => _316(file)]) || minimatch(path17.pathPattern, file)
|
|
9859
9948
|
)
|
|
9860
9949
|
);
|
|
9861
9950
|
return { ...bucket, paths };
|
|
@@ -9875,7 +9964,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
9875
9964
|
});
|
|
9876
9965
|
}
|
|
9877
9966
|
}
|
|
9878
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
9967
|
+
const targetLocales = _optionalChain([flags, 'access', _317 => _317.locale, 'optionalAccess', _318 => _318.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
9879
9968
|
let totalSourceKeyCount = 0;
|
|
9880
9969
|
let uniqueKeysToTranslate = 0;
|
|
9881
9970
|
let totalExistingTranslations = 0;
|
|
@@ -10279,12 +10368,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
10279
10368
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
10280
10369
|
docUrl: "bucketNotFound"
|
|
10281
10370
|
});
|
|
10282
|
-
} else if (_optionalChain([flags, 'access',
|
|
10371
|
+
} else if (_optionalChain([flags, 'access', _319 => _319.locale, 'optionalAccess', _320 => _320.some, 'call', _321 => _321((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
10283
10372
|
throw new CLIError({
|
|
10284
10373
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
10285
10374
|
docUrl: "localeTargetNotFound"
|
|
10286
10375
|
});
|
|
10287
|
-
} else if (_optionalChain([flags, 'access',
|
|
10376
|
+
} else if (_optionalChain([flags, 'access', _322 => _322.bucket, 'optionalAccess', _323 => _323.some, 'call', _324 => _324(
|
|
10288
10377
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
10289
10378
|
)])) {
|
|
10290
10379
|
throw new CLIError({
|
|
@@ -10373,7 +10462,7 @@ async function renderHero2() {
|
|
|
10373
10462
|
// package.json
|
|
10374
10463
|
var package_default = {
|
|
10375
10464
|
name: "lingo.dev",
|
|
10376
|
-
version: "0.107.
|
|
10465
|
+
version: "0.107.3",
|
|
10377
10466
|
description: "Lingo.dev CLI",
|
|
10378
10467
|
private: false,
|
|
10379
10468
|
publishConfig: {
|
|
@@ -10648,7 +10737,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
|
|
|
10648
10737
|
if (options.file && options.file.length) {
|
|
10649
10738
|
buckets = buckets.map((bucket) => {
|
|
10650
10739
|
const paths = bucket.paths.filter(
|
|
10651
|
-
(bucketPath) => _optionalChain([options, 'access',
|
|
10740
|
+
(bucketPath) => _optionalChain([options, 'access', _325 => _325.file, 'optionalAccess', _326 => _326.some, 'call', _327 => _327((f) => bucketPath.pathPattern.includes(f))])
|
|
10652
10741
|
);
|
|
10653
10742
|
return { ...bucket, paths };
|
|
10654
10743
|
}).filter((bucket) => bucket.paths.length > 0);
|