lingo.dev 0.130.1 → 0.131.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli.cjs +300 -207
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +214 -121
- package/build/cli.mjs.map +1 -1
- package/package.json +4 -4
package/build/cli.cjs
CHANGED
|
@@ -26,20 +26,20 @@ function getSettings(explicitApiKey) {
|
|
|
26
26
|
_envVarsInfo();
|
|
27
27
|
return {
|
|
28
28
|
auth: {
|
|
29
|
-
apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access',
|
|
30
|
-
apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access',
|
|
31
|
-
webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access',
|
|
29
|
+
apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access', _39 => _39.auth, 'optionalAccess', _40 => _40.apiKey]) || defaults2.auth.apiKey,
|
|
30
|
+
apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _41 => _41.auth, 'optionalAccess', _42 => _42.apiUrl]) || defaults2.auth.apiUrl,
|
|
31
|
+
webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _43 => _43.auth, 'optionalAccess', _44 => _44.webUrl]) || defaults2.auth.webUrl,
|
|
32
32
|
vnext: {
|
|
33
|
-
apiKey: env.LINGO_API_KEY || _optionalChain([systemFile, 'access',
|
|
33
|
+
apiKey: env.LINGO_API_KEY || _optionalChain([systemFile, 'access', _45 => _45.auth, 'optionalAccess', _46 => _46.vnext, 'optionalAccess', _47 => _47.apiKey])
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
llm: {
|
|
37
|
-
openaiApiKey: env.OPENAI_API_KEY || _optionalChain([systemFile, 'access',
|
|
38
|
-
anthropicApiKey: env.ANTHROPIC_API_KEY || _optionalChain([systemFile, 'access',
|
|
39
|
-
groqApiKey: env.GROQ_API_KEY || _optionalChain([systemFile, 'access',
|
|
40
|
-
googleApiKey: env.GOOGLE_API_KEY || _optionalChain([systemFile, 'access',
|
|
41
|
-
openrouterApiKey: env.OPENROUTER_API_KEY || _optionalChain([systemFile, 'access',
|
|
42
|
-
mistralApiKey: env.MISTRAL_API_KEY || _optionalChain([systemFile, 'access',
|
|
37
|
+
openaiApiKey: env.OPENAI_API_KEY || _optionalChain([systemFile, 'access', _48 => _48.llm, 'optionalAccess', _49 => _49.openaiApiKey]),
|
|
38
|
+
anthropicApiKey: env.ANTHROPIC_API_KEY || _optionalChain([systemFile, 'access', _50 => _50.llm, 'optionalAccess', _51 => _51.anthropicApiKey]),
|
|
39
|
+
groqApiKey: env.GROQ_API_KEY || _optionalChain([systemFile, 'access', _52 => _52.llm, 'optionalAccess', _53 => _53.groqApiKey]),
|
|
40
|
+
googleApiKey: env.GOOGLE_API_KEY || _optionalChain([systemFile, 'access', _54 => _54.llm, 'optionalAccess', _55 => _55.googleApiKey]),
|
|
41
|
+
openrouterApiKey: env.OPENROUTER_API_KEY || _optionalChain([systemFile, 'access', _56 => _56.llm, 'optionalAccess', _57 => _57.openrouterApiKey]),
|
|
42
|
+
mistralApiKey: env.MISTRAL_API_KEY || _optionalChain([systemFile, 'access', _58 => _58.llm, 'optionalAccess', _59 => _59.mistralApiKey])
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
}
|
|
@@ -155,43 +155,43 @@ Please use LINGODOTDEV_API_KEY instead.
|
|
|
155
155
|
function _envVarsInfo() {
|
|
156
156
|
const env = _loadEnv();
|
|
157
157
|
const systemFile = _loadSystemFile();
|
|
158
|
-
if (env.LINGODOTDEV_API_KEY && _optionalChain([systemFile, 'access',
|
|
158
|
+
if (env.LINGODOTDEV_API_KEY && _optionalChain([systemFile, 'access', _60 => _60.auth, 'optionalAccess', _61 => _61.apiKey])) {
|
|
159
159
|
console.info(
|
|
160
160
|
"\x1B[36m%s\x1B[0m",
|
|
161
161
|
`\u2139\uFE0F Using LINGODOTDEV_API_KEY env var instead of credentials from user config`
|
|
162
162
|
);
|
|
163
163
|
}
|
|
164
|
-
if (env.OPENAI_API_KEY && _optionalChain([systemFile, 'access',
|
|
164
|
+
if (env.OPENAI_API_KEY && _optionalChain([systemFile, 'access', _62 => _62.llm, 'optionalAccess', _63 => _63.openaiApiKey])) {
|
|
165
165
|
console.info(
|
|
166
166
|
"\x1B[36m%s\x1B[0m",
|
|
167
167
|
`\u2139\uFE0F Using OPENAI_API_KEY env var instead of key from user config.`
|
|
168
168
|
);
|
|
169
169
|
}
|
|
170
|
-
if (env.ANTHROPIC_API_KEY && _optionalChain([systemFile, 'access',
|
|
170
|
+
if (env.ANTHROPIC_API_KEY && _optionalChain([systemFile, 'access', _64 => _64.llm, 'optionalAccess', _65 => _65.anthropicApiKey])) {
|
|
171
171
|
console.info(
|
|
172
172
|
"\x1B[36m%s\x1B[0m",
|
|
173
173
|
`\u2139\uFE0F Using ANTHROPIC_API_KEY env var instead of key from user config`
|
|
174
174
|
);
|
|
175
175
|
}
|
|
176
|
-
if (env.GROQ_API_KEY && _optionalChain([systemFile, 'access',
|
|
176
|
+
if (env.GROQ_API_KEY && _optionalChain([systemFile, 'access', _66 => _66.llm, 'optionalAccess', _67 => _67.groqApiKey])) {
|
|
177
177
|
console.info(
|
|
178
178
|
"\x1B[36m%s\x1B[0m",
|
|
179
179
|
`\u2139\uFE0F Using GROQ_API_KEY env var instead of key from user config`
|
|
180
180
|
);
|
|
181
181
|
}
|
|
182
|
-
if (env.GOOGLE_API_KEY && _optionalChain([systemFile, 'access',
|
|
182
|
+
if (env.GOOGLE_API_KEY && _optionalChain([systemFile, 'access', _68 => _68.llm, 'optionalAccess', _69 => _69.googleApiKey])) {
|
|
183
183
|
console.info(
|
|
184
184
|
"\x1B[36m%s\x1B[0m",
|
|
185
185
|
`\u2139\uFE0F Using GOOGLE_API_KEY env var instead of key from user config`
|
|
186
186
|
);
|
|
187
187
|
}
|
|
188
|
-
if (env.OPENROUTER_API_KEY && _optionalChain([systemFile, 'access',
|
|
188
|
+
if (env.OPENROUTER_API_KEY && _optionalChain([systemFile, 'access', _70 => _70.llm, 'optionalAccess', _71 => _71.openrouterApiKey])) {
|
|
189
189
|
console.info(
|
|
190
190
|
"\x1B[36m%s\x1B[0m",
|
|
191
191
|
`\u2139\uFE0F Using OPENROUTER_API_KEY env var instead of key from user config`
|
|
192
192
|
);
|
|
193
193
|
}
|
|
194
|
-
if (env.MISTRAL_API_KEY && _optionalChain([systemFile, 'access',
|
|
194
|
+
if (env.MISTRAL_API_KEY && _optionalChain([systemFile, 'access', _72 => _72.llm, 'optionalAccess', _73 => _73.mistralApiKey])) {
|
|
195
195
|
console.info(
|
|
196
196
|
"\x1B[36m%s\x1B[0m",
|
|
197
197
|
`\u2139\uFE0F Using MISTRAL_API_KEY env var instead of key from user config`
|
|
@@ -209,7 +209,7 @@ function _envVarsInfo() {
|
|
|
209
209
|
`\u2139\uFE0F Using LINGODOTDEV_WEB_URL: ${env.LINGODOTDEV_WEB_URL}`
|
|
210
210
|
);
|
|
211
211
|
}
|
|
212
|
-
if (env.LINGO_API_KEY && _optionalChain([systemFile, 'access',
|
|
212
|
+
if (env.LINGO_API_KEY && _optionalChain([systemFile, 'access', _74 => _74.auth, 'optionalAccess', _75 => _75.vnext, 'optionalAccess', _76 => _76.apiKey])) {
|
|
213
213
|
console.info(
|
|
214
214
|
"\x1B[36m%s\x1B[0m",
|
|
215
215
|
`\u2139\uFE0F Using LINGO_API_KEY env var instead of key from user config`
|
|
@@ -280,10 +280,10 @@ var LocalizationError = (_class5 = class extends Error {
|
|
|
280
280
|
constructor(message, context) {
|
|
281
281
|
super(message);_class5.prototype.__init5.call(this);;
|
|
282
282
|
this.name = "LocalizationError";
|
|
283
|
-
this.bucket = _optionalChain([context, 'optionalAccess',
|
|
284
|
-
this.sourceLocale = _optionalChain([context, 'optionalAccess',
|
|
285
|
-
this.targetLocale = _optionalChain([context, 'optionalAccess',
|
|
286
|
-
this.pathPattern = _optionalChain([context, 'optionalAccess',
|
|
283
|
+
this.bucket = _optionalChain([context, 'optionalAccess', _77 => _77.bucket]);
|
|
284
|
+
this.sourceLocale = _optionalChain([context, 'optionalAccess', _78 => _78.sourceLocale]);
|
|
285
|
+
this.targetLocale = _optionalChain([context, 'optionalAccess', _79 => _79.targetLocale]);
|
|
286
|
+
this.pathPattern = _optionalChain([context, 'optionalAccess', _80 => _80.pathPattern]);
|
|
287
287
|
}
|
|
288
288
|
}, _class5);
|
|
289
289
|
var BucketProcessingError = (_class6 = class extends Error {
|
|
@@ -419,7 +419,7 @@ function createAuthenticator(params) {
|
|
|
419
419
|
});
|
|
420
420
|
if (res.ok) {
|
|
421
421
|
const payload = await res.json();
|
|
422
|
-
if (!_optionalChain([payload, 'optionalAccess',
|
|
422
|
+
if (!_optionalChain([payload, 'optionalAccess', _81 => _81.email])) {
|
|
423
423
|
return null;
|
|
424
424
|
}
|
|
425
425
|
return {
|
|
@@ -620,7 +620,7 @@ async function renderSummary(results) {
|
|
|
620
620
|
if (succeededResults.length > 0) {
|
|
621
621
|
console.log(_chalk2.default.hex(colors.green)("\n[Processed Files]"));
|
|
622
622
|
for (const result of succeededResults) {
|
|
623
|
-
const displayPath = _optionalChain([result, 'access',
|
|
623
|
+
const displayPath = _optionalChain([result, 'access', _82 => _82.pathPattern, 'optionalAccess', _83 => _83.replace, 'call', _84 => _84("[locale]", result.targetLocale)]) || "unknown";
|
|
624
624
|
console.log(
|
|
625
625
|
` \u2713 ${_chalk2.default.dim(displayPath)} ${_chalk2.default.hex(colors.yellow)(`(${result.sourceLocale} \u2192 ${result.targetLocale})`)}`
|
|
626
626
|
);
|
|
@@ -629,7 +629,7 @@ async function renderSummary(results) {
|
|
|
629
629
|
if (skippedResults.length > 0) {
|
|
630
630
|
console.log(_chalk2.default.hex(colors.blue)("\n[Cached Files]"));
|
|
631
631
|
for (const result of skippedResults) {
|
|
632
|
-
const displayPath = _optionalChain([result, 'access',
|
|
632
|
+
const displayPath = _optionalChain([result, 'access', _85 => _85.pathPattern, 'optionalAccess', _86 => _86.replace, 'call', _87 => _87("[locale]", result.targetLocale)]) || "unknown";
|
|
633
633
|
console.log(
|
|
634
634
|
` \u26A1 ${_chalk2.default.dim(displayPath)} ${_chalk2.default.hex(colors.yellow)(`(${result.sourceLocale} \u2192 ${result.targetLocale})`)}`
|
|
635
635
|
);
|
|
@@ -638,12 +638,12 @@ async function renderSummary(results) {
|
|
|
638
638
|
if (failedResults.length > 0) {
|
|
639
639
|
console.log(_chalk2.default.hex(colors.orange)("\n[Failed Files]"));
|
|
640
640
|
for (const result of failedResults) {
|
|
641
|
-
const displayPath = _optionalChain([result, 'access',
|
|
641
|
+
const displayPath = _optionalChain([result, 'access', _88 => _88.pathPattern, 'optionalAccess', _89 => _89.replace, 'call', _90 => _90("[locale]", result.targetLocale)]) || "unknown";
|
|
642
642
|
console.log(
|
|
643
643
|
` \u274C ${_chalk2.default.dim(displayPath)} ${_chalk2.default.hex(colors.yellow)(`(${result.sourceLocale} \u2192 ${result.targetLocale})`)}`
|
|
644
644
|
);
|
|
645
645
|
console.log(
|
|
646
|
-
` ${_chalk2.default.hex(colors.white)(String(_optionalChain([result, 'access',
|
|
646
|
+
` ${_chalk2.default.hex(colors.white)(String(_optionalChain([result, 'access', _91 => _91.error, 'optionalAccess', _92 => _92.message]) || "Unknown error"))}`
|
|
647
647
|
);
|
|
648
648
|
}
|
|
649
649
|
}
|
|
@@ -1337,7 +1337,7 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
|
|
|
1337
1337
|
});
|
|
1338
1338
|
const auth2 = await newAuthenticator.whoami();
|
|
1339
1339
|
if (auth2) {
|
|
1340
|
-
_ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess',
|
|
1340
|
+
_ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _93 => _93.email])}`);
|
|
1341
1341
|
} else {
|
|
1342
1342
|
_ora2.default.call(void 0, ).fail("Authentication failed.");
|
|
1343
1343
|
}
|
|
@@ -1428,7 +1428,7 @@ function getBuckets(i18nConfig) {
|
|
|
1428
1428
|
const includeItems = bucketEntry.include.map(
|
|
1429
1429
|
(item) => resolveBucketItem(item)
|
|
1430
1430
|
);
|
|
1431
|
-
const excludeItems = _optionalChain([bucketEntry, 'access',
|
|
1431
|
+
const excludeItems = _optionalChain([bucketEntry, 'access', _94 => _94.exclude, 'optionalAccess', _95 => _95.map, 'call', _96 => _96(
|
|
1432
1432
|
(item) => resolveBucketItem(item)
|
|
1433
1433
|
)]);
|
|
1434
1434
|
const config = {
|
|
@@ -1451,6 +1451,9 @@ function getBuckets(i18nConfig) {
|
|
|
1451
1451
|
if (bucketEntry.ignoredKeys) {
|
|
1452
1452
|
config.ignoredKeys = bucketEntry.ignoredKeys;
|
|
1453
1453
|
}
|
|
1454
|
+
if (bucketEntry.preservedKeys) {
|
|
1455
|
+
config.preservedKeys = bucketEntry.preservedKeys;
|
|
1456
|
+
}
|
|
1454
1457
|
return config;
|
|
1455
1458
|
}
|
|
1456
1459
|
);
|
|
@@ -1466,7 +1469,7 @@ function extractPathPatterns(sourceLocale, include, exclude) {
|
|
|
1466
1469
|
delimiter: pattern.delimiter
|
|
1467
1470
|
}))
|
|
1468
1471
|
);
|
|
1469
|
-
const excludedPatterns = _optionalChain([exclude, 'optionalAccess',
|
|
1472
|
+
const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _97 => _97.flatMap, 'call', _98 => _98(
|
|
1470
1473
|
(pattern) => expandPlaceholderedGlob(
|
|
1471
1474
|
pattern.path,
|
|
1472
1475
|
__spec.resolveOverriddenLocale.call(void 0, sourceLocale, pattern.delimiter)
|
|
@@ -1632,12 +1635,12 @@ function composeLoaders(...loaders) {
|
|
|
1632
1635
|
return {
|
|
1633
1636
|
init: async () => {
|
|
1634
1637
|
for (const loader of loaders) {
|
|
1635
|
-
await _optionalChain([loader, 'access',
|
|
1638
|
+
await _optionalChain([loader, 'access', _99 => _99.init, 'optionalCall', _100 => _100()]);
|
|
1636
1639
|
}
|
|
1637
1640
|
},
|
|
1638
1641
|
setDefaultLocale(locale) {
|
|
1639
1642
|
for (const loader of loaders) {
|
|
1640
|
-
_optionalChain([loader, 'access',
|
|
1643
|
+
_optionalChain([loader, 'access', _101 => _101.setDefaultLocale, 'optionalCall', _102 => _102(locale)]);
|
|
1641
1644
|
}
|
|
1642
1645
|
return this;
|
|
1643
1646
|
},
|
|
@@ -1658,7 +1661,7 @@ function composeLoaders(...loaders) {
|
|
|
1658
1661
|
pullHints: async (originalInput) => {
|
|
1659
1662
|
let result = originalInput;
|
|
1660
1663
|
for (let i = 0; i < loaders.length; i++) {
|
|
1661
|
-
const subResult = await _optionalChain([loaders, 'access',
|
|
1664
|
+
const subResult = await _optionalChain([loaders, 'access', _103 => _103[i], 'access', _104 => _104.pullHints, 'optionalCall', _105 => _105(result)]);
|
|
1662
1665
|
if (subResult) {
|
|
1663
1666
|
result = subResult;
|
|
1664
1667
|
}
|
|
@@ -1682,7 +1685,7 @@ function createLoader(lDefinition) {
|
|
|
1682
1685
|
if (state.initCtx) {
|
|
1683
1686
|
return state.initCtx;
|
|
1684
1687
|
}
|
|
1685
|
-
state.initCtx = await _optionalChain([lDefinition, 'access',
|
|
1688
|
+
state.initCtx = await _optionalChain([lDefinition, 'access', _106 => _106.init, 'optionalCall', _107 => _107()]);
|
|
1686
1689
|
return state.initCtx;
|
|
1687
1690
|
},
|
|
1688
1691
|
setDefaultLocale(locale) {
|
|
@@ -1693,7 +1696,7 @@ function createLoader(lDefinition) {
|
|
|
1693
1696
|
return this;
|
|
1694
1697
|
},
|
|
1695
1698
|
async pullHints(originalInput) {
|
|
1696
|
-
return _optionalChain([lDefinition, 'access',
|
|
1699
|
+
return _optionalChain([lDefinition, 'access', _108 => _108.pullHints, 'optionalCall', _109 => _109(originalInput || state.originalInput)]);
|
|
1697
1700
|
},
|
|
1698
1701
|
async pull(locale, input2) {
|
|
1699
1702
|
if (!state.defaultLocale) {
|
|
@@ -1949,7 +1952,7 @@ function updateContext(contextStack, line, parsedJson, arrayObjectCount) {
|
|
|
1949
1952
|
if (closeBrackets > openBrackets) {
|
|
1950
1953
|
for (let i = 0; i < closeBrackets - openBrackets; i++) {
|
|
1951
1954
|
const popped = contextStack.pop();
|
|
1952
|
-
if (_optionalChain([popped, 'optionalAccess',
|
|
1955
|
+
if (_optionalChain([popped, 'optionalAccess', _110 => _110.isArray])) {
|
|
1953
1956
|
const depth = contextStack.length;
|
|
1954
1957
|
delete arrayObjectCount[depth];
|
|
1955
1958
|
}
|
|
@@ -2032,7 +2035,7 @@ function createDenormalizeLoader(options) {
|
|
|
2032
2035
|
const preservedObjects = {};
|
|
2033
2036
|
const nonPreservedInput = {};
|
|
2034
2037
|
for (const [key, value] of Object.entries(inputDenormalized)) {
|
|
2035
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
2038
|
+
if (_optionalChain([options, 'optionalAccess', _111 => _111.shouldPreserveObject, 'optionalCall', _112 => _112(value)])) {
|
|
2036
2039
|
preservedObjects[key] = value;
|
|
2037
2040
|
} else {
|
|
2038
2041
|
nonPreservedInput[key] = value;
|
|
@@ -2065,7 +2068,7 @@ function createNormalizeLoader() {
|
|
|
2065
2068
|
return normalized;
|
|
2066
2069
|
},
|
|
2067
2070
|
push: async (locale, data, originalInput) => {
|
|
2068
|
-
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess',
|
|
2071
|
+
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _113 => _113.keysMap]), () => ( {}));
|
|
2069
2072
|
const input2 = mapDenormalizedKeys(data, keysMap);
|
|
2070
2073
|
const denormalized = _flat.unflatten.call(void 0, input2, {
|
|
2071
2074
|
delimiter: "/",
|
|
@@ -2166,7 +2169,7 @@ function createTextFileLoader(pathPattern) {
|
|
|
2166
2169
|
const trimmedResult = result.trim();
|
|
2167
2170
|
return trimmedResult;
|
|
2168
2171
|
},
|
|
2169
|
-
async push(locale, data,
|
|
2172
|
+
async push(locale, data, _38, originalLocale) {
|
|
2170
2173
|
const draftPath = pathPattern.replaceAll("[locale]", locale);
|
|
2171
2174
|
const finalPath = path15.default.resolve(draftPath);
|
|
2172
2175
|
const dirPath = path15.default.dirname(finalPath);
|
|
@@ -2199,8 +2202,8 @@ async function getTrailingNewLine(pathPattern, locale, originalLocale) {
|
|
|
2199
2202
|
if (!templateData) {
|
|
2200
2203
|
templateData = await readFileForLocale(pathPattern, originalLocale);
|
|
2201
2204
|
}
|
|
2202
|
-
if (_optionalChain([templateData, 'optionalAccess',
|
|
2203
|
-
const ending = _optionalChain([templateData, 'optionalAccess',
|
|
2205
|
+
if (_optionalChain([templateData, 'optionalAccess', _114 => _114.match, 'call', _115 => _115(/[\r\n]$/)])) {
|
|
2206
|
+
const ending = _optionalChain([templateData, 'optionalAccess', _116 => _116.includes, 'call', _117 => _117("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _118 => _118.includes, 'call', _119 => _119("\r")]) ? "\r" : "\n";
|
|
2204
2207
|
return ending;
|
|
2205
2208
|
}
|
|
2206
2209
|
return "";
|
|
@@ -2475,15 +2478,15 @@ function createAilLoader() {
|
|
|
2475
2478
|
}
|
|
2476
2479
|
const entries = dictionary.ENTRY || [];
|
|
2477
2480
|
for (const entry of entries) {
|
|
2478
|
-
const id = _optionalChain([entry, 'access',
|
|
2481
|
+
const id = _optionalChain([entry, 'access', _120 => _120.$, 'optionalAccess', _121 => _121.id]);
|
|
2479
2482
|
if (!id) {
|
|
2480
2483
|
continue;
|
|
2481
2484
|
}
|
|
2482
2485
|
const strings = entry.STRING || [];
|
|
2483
2486
|
const sourceString = strings.find(
|
|
2484
|
-
(s) => _optionalChain([s, 'access',
|
|
2487
|
+
(s) => _optionalChain([s, 'access', _122 => _122.$, 'optionalAccess', _123 => _123.lang]) === locale
|
|
2485
2488
|
);
|
|
2486
|
-
if (_optionalChain([sourceString, 'optionalAccess',
|
|
2489
|
+
if (_optionalChain([sourceString, 'optionalAccess', _124 => _124.$, 'access', _125 => _125.value])) {
|
|
2487
2490
|
result[id] = sourceString.$.value;
|
|
2488
2491
|
}
|
|
2489
2492
|
}
|
|
@@ -2525,7 +2528,7 @@ function createAilLoader() {
|
|
|
2525
2528
|
}
|
|
2526
2529
|
const entries = dictionary.ENTRY || [];
|
|
2527
2530
|
for (const [id, value] of Object.entries(data)) {
|
|
2528
|
-
let entry = entries.find((e) => _optionalChain([e, 'access',
|
|
2531
|
+
let entry = entries.find((e) => _optionalChain([e, 'access', _126 => _126.$, 'optionalAccess', _127 => _127.id]) === id);
|
|
2529
2532
|
if (!entry) {
|
|
2530
2533
|
entry = {
|
|
2531
2534
|
$: { id },
|
|
@@ -2537,7 +2540,7 @@ function createAilLoader() {
|
|
|
2537
2540
|
entry.STRING = [];
|
|
2538
2541
|
}
|
|
2539
2542
|
let targetString = entry.STRING.find(
|
|
2540
|
-
(s) => _optionalChain([s, 'access',
|
|
2543
|
+
(s) => _optionalChain([s, 'access', _128 => _128.$, 'optionalAccess', _129 => _129.lang]) === locale
|
|
2541
2544
|
);
|
|
2542
2545
|
if (targetString) {
|
|
2543
2546
|
targetString.$.value = value;
|
|
@@ -2668,7 +2671,7 @@ async function parseAndroidDocument(input2) {
|
|
|
2668
2671
|
const resourceNodes = [];
|
|
2669
2672
|
let metaIndex = 0;
|
|
2670
2673
|
for (const child of resourcesNode.$$) {
|
|
2671
|
-
const elementName = _optionalChain([child, 'optionalAccess',
|
|
2674
|
+
const elementName = _optionalChain([child, 'optionalAccess', _130 => _130["#name"]]);
|
|
2672
2675
|
if (!isResourceElementName(elementName)) {
|
|
2673
2676
|
continue;
|
|
2674
2677
|
}
|
|
@@ -2676,11 +2679,11 @@ async function parseAndroidDocument(input2) {
|
|
|
2676
2679
|
if (!meta || meta.type !== elementName) {
|
|
2677
2680
|
continue;
|
|
2678
2681
|
}
|
|
2679
|
-
const name = _nullishCoalesce(_optionalChain([child, 'optionalAccess',
|
|
2682
|
+
const name = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _131 => _131.$, 'optionalAccess', _132 => _132.name]), () => ( meta.name));
|
|
2680
2683
|
if (!name) {
|
|
2681
2684
|
continue;
|
|
2682
2685
|
}
|
|
2683
|
-
const translatable = (_nullishCoalesce(_optionalChain([child, 'optionalAccess',
|
|
2686
|
+
const translatable = (_nullishCoalesce(_optionalChain([child, 'optionalAccess', _133 => _133.$, 'optionalAccess', _134 => _134.translatable]), () => ( ""))).toLowerCase() !== "false";
|
|
2684
2687
|
switch (meta.type) {
|
|
2685
2688
|
case "string": {
|
|
2686
2689
|
resourceNodes.push({
|
|
@@ -2693,7 +2696,7 @@ async function parseAndroidDocument(input2) {
|
|
|
2693
2696
|
break;
|
|
2694
2697
|
}
|
|
2695
2698
|
case "string-array": {
|
|
2696
|
-
const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess',
|
|
2699
|
+
const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _135 => _135.item]), () => ( []));
|
|
2697
2700
|
const items = [];
|
|
2698
2701
|
const templateItems = meta.items;
|
|
2699
2702
|
for (let i = 0; i < Math.max(itemNodes.length, templateItems.length); i++) {
|
|
@@ -2717,7 +2720,7 @@ async function parseAndroidDocument(input2) {
|
|
|
2717
2720
|
break;
|
|
2718
2721
|
}
|
|
2719
2722
|
case "plurals": {
|
|
2720
|
-
const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess',
|
|
2723
|
+
const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _136 => _136.item]), () => ( []));
|
|
2721
2724
|
const templateItems = meta.items;
|
|
2722
2725
|
const items = [];
|
|
2723
2726
|
for (const templateItem of templateItems) {
|
|
@@ -2726,7 +2729,7 @@ async function parseAndroidDocument(input2) {
|
|
|
2726
2729
|
continue;
|
|
2727
2730
|
}
|
|
2728
2731
|
const nodeItem = itemNodes.find(
|
|
2729
|
-
(item) => _optionalChain([item, 'optionalAccess',
|
|
2732
|
+
(item) => _optionalChain([item, 'optionalAccess', _137 => _137.$, 'optionalAccess', _138 => _138.quantity]) === quantity
|
|
2730
2733
|
);
|
|
2731
2734
|
if (!nodeItem) {
|
|
2732
2735
|
continue;
|
|
@@ -3000,7 +3003,7 @@ function cloneResourceNode(resource) {
|
|
|
3000
3003
|
const nodeClone = deepClone(resource.node);
|
|
3001
3004
|
const itemNodes = _nullishCoalesce(nodeClone.item, () => ( []));
|
|
3002
3005
|
const items = itemNodes.map((itemNode, index) => {
|
|
3003
|
-
const templateMeta = _nullishCoalesce(_nullishCoalesce(_optionalChain([resource, 'access',
|
|
3006
|
+
const templateMeta = _nullishCoalesce(_nullishCoalesce(_optionalChain([resource, 'access', _139 => _139.items, 'access', _140 => _140[index], 'optionalAccess', _141 => _141.meta]), () => ( _optionalChain([resource, 'access', _142 => _142.items, 'access', _143 => _143[resource.items.length - 1], 'optionalAccess', _144 => _144.meta]))), () => ( makeTextMeta([])));
|
|
3004
3007
|
return {
|
|
3005
3008
|
node: itemNode,
|
|
3006
3009
|
meta: cloneTextMeta(templateMeta)
|
|
@@ -3020,7 +3023,7 @@ function cloneResourceNode(resource) {
|
|
|
3020
3023
|
const items = [];
|
|
3021
3024
|
for (const templateItem of resource.items) {
|
|
3022
3025
|
const cloneNode = itemNodes.find(
|
|
3023
|
-
(item) => _optionalChain([item, 'optionalAccess',
|
|
3026
|
+
(item) => _optionalChain([item, 'optionalAccess', _145 => _145.$, 'optionalAccess', _146 => _146.quantity]) === templateItem.quantity
|
|
3024
3027
|
);
|
|
3025
3028
|
if (!cloneNode) {
|
|
3026
3029
|
continue;
|
|
@@ -3276,8 +3279,8 @@ function cloneDocumentStructure(document) {
|
|
|
3276
3279
|
resourceNodes.map((r) => resourceLookupKey(r.type, r.name))
|
|
3277
3280
|
);
|
|
3278
3281
|
let filtered = resourcesClone.$$.filter((child) => {
|
|
3279
|
-
const elementName = _optionalChain([child, 'optionalAccess',
|
|
3280
|
-
const name = _optionalChain([child, 'optionalAccess',
|
|
3282
|
+
const elementName = _optionalChain([child, 'optionalAccess', _147 => _147["#name"]]);
|
|
3283
|
+
const name = _optionalChain([child, 'optionalAccess', _148 => _148.$, 'optionalAccess', _149 => _149.name]);
|
|
3281
3284
|
if (!isResourceElementName(elementName) || !name) {
|
|
3282
3285
|
return true;
|
|
3283
3286
|
}
|
|
@@ -3286,7 +3289,7 @@ function cloneDocumentStructure(document) {
|
|
|
3286
3289
|
const cleaned = [];
|
|
3287
3290
|
let lastWasWhitespace = false;
|
|
3288
3291
|
for (const child of filtered) {
|
|
3289
|
-
const isWhitespace = _optionalChain([child, 'optionalAccess',
|
|
3292
|
+
const isWhitespace = _optionalChain([child, 'optionalAccess', _150 => _150["#name"]]) === "__text__" && (!child._ || child._.trim() === "");
|
|
3290
3293
|
if (isWhitespace) {
|
|
3291
3294
|
if (!lastWasWhitespace) {
|
|
3292
3295
|
cleaned.push(child);
|
|
@@ -3308,8 +3311,8 @@ function buildResourceLookup(resources) {
|
|
|
3308
3311
|
const lookup = /* @__PURE__ */ new Map();
|
|
3309
3312
|
const children = Array.isArray(resources.$$) ? resources.$$ : [];
|
|
3310
3313
|
for (const child of children) {
|
|
3311
|
-
const type = _optionalChain([child, 'optionalAccess',
|
|
3312
|
-
const name = _optionalChain([child, 'optionalAccess',
|
|
3314
|
+
const type = _optionalChain([child, 'optionalAccess', _151 => _151["#name"]]);
|
|
3315
|
+
const name = _optionalChain([child, 'optionalAccess', _152 => _152.$, 'optionalAccess', _153 => _153.name]);
|
|
3313
3316
|
if (!type || !name || !isResourceElementName(type)) {
|
|
3314
3317
|
continue;
|
|
3315
3318
|
}
|
|
@@ -3338,7 +3341,7 @@ function cloneResourceNodeFromLookup(resource, lookup) {
|
|
|
3338
3341
|
}
|
|
3339
3342
|
case "string-array": {
|
|
3340
3343
|
const childItems = (Array.isArray(node.$$) ? node.$$ : []).filter(
|
|
3341
|
-
(child) => _optionalChain([child, 'optionalAccess',
|
|
3344
|
+
(child) => _optionalChain([child, 'optionalAccess', _154 => _154["#name"]]) === "item"
|
|
3342
3345
|
);
|
|
3343
3346
|
node.item = childItems;
|
|
3344
3347
|
if (childItems.length < resource.items.length) {
|
|
@@ -3367,12 +3370,12 @@ function cloneResourceNodeFromLookup(resource, lookup) {
|
|
|
3367
3370
|
}
|
|
3368
3371
|
case "plurals": {
|
|
3369
3372
|
const childItems = (Array.isArray(node.$$) ? node.$$ : []).filter(
|
|
3370
|
-
(child) => _optionalChain([child, 'optionalAccess',
|
|
3373
|
+
(child) => _optionalChain([child, 'optionalAccess', _155 => _155["#name"]]) === "item"
|
|
3371
3374
|
);
|
|
3372
3375
|
node.item = childItems;
|
|
3373
3376
|
const itemMap = /* @__PURE__ */ new Map();
|
|
3374
3377
|
for (const item of childItems) {
|
|
3375
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
3378
|
+
if (_optionalChain([item, 'optionalAccess', _156 => _156.$, 'optionalAccess', _157 => _157.quantity])) {
|
|
3376
3379
|
itemMap.set(item.$.quantity, item);
|
|
3377
3380
|
}
|
|
3378
3381
|
}
|
|
@@ -3662,7 +3665,7 @@ var _sync3 = require('csv-stringify/sync');
|
|
|
3662
3665
|
|
|
3663
3666
|
function detectKeyColumnName(csvString) {
|
|
3664
3667
|
const row = _sync.parse.call(void 0, csvString)[0];
|
|
3665
|
-
const firstColumn = _optionalChain([row, 'optionalAccess',
|
|
3668
|
+
const firstColumn = _optionalChain([row, 'optionalAccess', _158 => _158[0], 'optionalAccess', _159 => _159.trim, 'call', _160 => _160()]);
|
|
3666
3669
|
return firstColumn || "KEY";
|
|
3667
3670
|
}
|
|
3668
3671
|
function createCsvLoader() {
|
|
@@ -3991,7 +3994,7 @@ function createHtmlLoader() {
|
|
|
3991
3994
|
const attrs = BASE_LOCALIZABLE_ATTRIBUTES[tagName];
|
|
3992
3995
|
if (!attrs) return;
|
|
3993
3996
|
for (const attr of attrs) {
|
|
3994
|
-
const value = _optionalChain([element, 'access',
|
|
3997
|
+
const value = _optionalChain([element, 'access', _161 => _161.attribs, 'optionalAccess', _162 => _162[attr]]);
|
|
3995
3998
|
if (value && value.trim()) {
|
|
3996
3999
|
result[`${path20}#${attr}`] = value.trim();
|
|
3997
4000
|
}
|
|
@@ -4158,7 +4161,7 @@ function createMarkdownLoader() {
|
|
|
4158
4161
|
yaml: yamlEngine
|
|
4159
4162
|
}
|
|
4160
4163
|
});
|
|
4161
|
-
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess',
|
|
4164
|
+
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _163 => _163.trim, 'call', _164 => _164()]), () => ( ""))).filter(Boolean);
|
|
4162
4165
|
return {
|
|
4163
4166
|
...Object.fromEntries(
|
|
4164
4167
|
sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
|
|
@@ -4177,7 +4180,7 @@ function createMarkdownLoader() {
|
|
|
4177
4180
|
);
|
|
4178
4181
|
let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(
|
|
4179
4182
|
([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())
|
|
4180
|
-
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess',
|
|
4183
|
+
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _165 => _165.trim, 'call', _166 => _166()]), () => ( ""))).filter(Boolean).join("\n\n");
|
|
4181
4184
|
if (Object.keys(frontmatter).length > 0) {
|
|
4182
4185
|
content = `
|
|
4183
4186
|
${content}`;
|
|
@@ -4202,7 +4205,7 @@ function createMarkdocLoader() {
|
|
|
4202
4205
|
const result = {};
|
|
4203
4206
|
const counters = {};
|
|
4204
4207
|
traverseAndExtract(ast, "", result, counters);
|
|
4205
|
-
if (_optionalChain([ast, 'access',
|
|
4208
|
+
if (_optionalChain([ast, 'access', _167 => _167.attributes, 'optionalAccess', _168 => _168.frontmatter])) {
|
|
4206
4209
|
const frontmatter = _yaml2.default.parse(ast.attributes.frontmatter);
|
|
4207
4210
|
Object.entries(frontmatter).forEach(([key, value]) => {
|
|
4208
4211
|
if (typeof value === "string") {
|
|
@@ -4248,7 +4251,7 @@ function traverseAndExtract(node, path20, result, counters, parentType) {
|
|
|
4248
4251
|
if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
|
|
4249
4252
|
semanticType = nodeSemanticType;
|
|
4250
4253
|
}
|
|
4251
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
4254
|
+
if (node.type === "text" && _optionalChain([node, 'access', _169 => _169.attributes, 'optionalAccess', _170 => _170.content])) {
|
|
4252
4255
|
const content = node.attributes.content;
|
|
4253
4256
|
if (typeof content === "string" && content.trim()) {
|
|
4254
4257
|
if (semanticType) {
|
|
@@ -4275,7 +4278,7 @@ function buildPathMap(node, path20, counters, pathMap, parentType) {
|
|
|
4275
4278
|
if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
|
|
4276
4279
|
semanticType = nodeSemanticType;
|
|
4277
4280
|
}
|
|
4278
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
4281
|
+
if (node.type === "text" && _optionalChain([node, 'access', _171 => _171.attributes, 'optionalAccess', _172 => _172.content])) {
|
|
4279
4282
|
const content = node.attributes.content;
|
|
4280
4283
|
if (typeof content === "string" && content.trim()) {
|
|
4281
4284
|
if (semanticType) {
|
|
@@ -4298,7 +4301,7 @@ function applyTranslations(node, path20, data, pathMap) {
|
|
|
4298
4301
|
if (!node || typeof node !== "object") {
|
|
4299
4302
|
return;
|
|
4300
4303
|
}
|
|
4301
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
4304
|
+
if (node.type === "text" && _optionalChain([node, 'access', _173 => _173.attributes, 'optionalAccess', _174 => _174.content])) {
|
|
4302
4305
|
const content = node.attributes.content;
|
|
4303
4306
|
if (typeof content === "string") {
|
|
4304
4307
|
const contentPath = path20 ? `${path20}/attributes/content` : "attributes/content";
|
|
@@ -4600,7 +4603,7 @@ function createPropertiesLoader() {
|
|
|
4600
4603
|
return result;
|
|
4601
4604
|
},
|
|
4602
4605
|
async push(locale, payload) {
|
|
4603
|
-
const result = Object.entries(payload).filter(([
|
|
4606
|
+
const result = Object.entries(payload).filter(([_38, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
|
|
4604
4607
|
return result;
|
|
4605
4608
|
}
|
|
4606
4609
|
});
|
|
@@ -4611,7 +4614,7 @@ function isSkippableLine(line) {
|
|
|
4611
4614
|
function parsePropertyLine(line) {
|
|
4612
4615
|
const [key, ...valueParts] = line.split("=");
|
|
4613
4616
|
return {
|
|
4614
|
-
key: _optionalChain([key, 'optionalAccess',
|
|
4617
|
+
key: _optionalChain([key, 'optionalAccess', _175 => _175.trim, 'call', _176 => _176()]) || "",
|
|
4615
4618
|
value: valueParts.join("=").trim()
|
|
4616
4619
|
};
|
|
4617
4620
|
}
|
|
@@ -4903,7 +4906,7 @@ var Parser3 = class {
|
|
|
4903
4906
|
}
|
|
4904
4907
|
}
|
|
4905
4908
|
expect(type) {
|
|
4906
|
-
if (_optionalChain([this, 'access',
|
|
4909
|
+
if (_optionalChain([this, 'access', _177 => _177.current, 'call', _178 => _178(), 'optionalAccess', _179 => _179.type]) === type) {
|
|
4907
4910
|
this.advance();
|
|
4908
4911
|
return true;
|
|
4909
4912
|
}
|
|
@@ -4922,7 +4925,7 @@ function createXcodeStringsLoader() {
|
|
|
4922
4925
|
return result;
|
|
4923
4926
|
},
|
|
4924
4927
|
async push(locale, payload) {
|
|
4925
|
-
const lines = Object.entries(payload).filter(([
|
|
4928
|
+
const lines = Object.entries(payload).filter(([_38, value]) => value != null).map(([key, value]) => {
|
|
4926
4929
|
const escapedValue = escapeString(value);
|
|
4927
4930
|
return `"${key}" = "${escapedValue}";`;
|
|
4928
4931
|
});
|
|
@@ -4980,7 +4983,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4980
4983
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
4981
4984
|
continue;
|
|
4982
4985
|
}
|
|
4983
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
4986
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _180 => _180.localizations, 'optionalAccess', _181 => _181[locale]]);
|
|
4984
4987
|
if (langTranslationEntity) {
|
|
4985
4988
|
if ("stringUnit" in langTranslationEntity) {
|
|
4986
4989
|
resultData[translationKey] = langTranslationEntity.stringUnit.value;
|
|
@@ -4994,7 +4997,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4994
4997
|
resultData[translationKey] = {};
|
|
4995
4998
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
4996
4999
|
for (const form in pluralForms) {
|
|
4997
|
-
if (_optionalChain([pluralForms, 'access',
|
|
5000
|
+
if (_optionalChain([pluralForms, 'access', _182 => _182[form], 'optionalAccess', _183 => _183.stringUnit, 'optionalAccess', _184 => _184.value])) {
|
|
4998
5001
|
resultData[translationKey][form] = pluralForms[form].stringUnit.value;
|
|
4999
5002
|
}
|
|
5000
5003
|
}
|
|
@@ -5020,7 +5023,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
5020
5023
|
const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
|
|
5021
5024
|
if (typeof value === "string") {
|
|
5022
5025
|
langDataToMerge.strings[key] = {
|
|
5023
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
5026
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _185 => _185.strings, 'optionalAccess', _186 => _186[key], 'optionalAccess', _187 => _187.extractionState]),
|
|
5024
5027
|
localizations: {
|
|
5025
5028
|
[locale]: {
|
|
5026
5029
|
stringUnit: {
|
|
@@ -5035,7 +5038,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
5035
5038
|
}
|
|
5036
5039
|
} else if (Array.isArray(value)) {
|
|
5037
5040
|
langDataToMerge.strings[key] = {
|
|
5038
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
5041
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _188 => _188.strings, 'optionalAccess', _189 => _189[key], 'optionalAccess', _190 => _190.extractionState]),
|
|
5039
5042
|
localizations: {
|
|
5040
5043
|
[locale]: {
|
|
5041
5044
|
stringSet: {
|
|
@@ -5093,7 +5096,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
5093
5096
|
for (const [locale, localization] of Object.entries(
|
|
5094
5097
|
entity.localizations
|
|
5095
5098
|
)) {
|
|
5096
|
-
if (_optionalChain([localization, 'access',
|
|
5099
|
+
if (_optionalChain([localization, 'access', _191 => _191.variations, 'optionalAccess', _192 => _192.plural])) {
|
|
5097
5100
|
const pluralForms = localization.variations.plural;
|
|
5098
5101
|
for (const form in pluralForms) {
|
|
5099
5102
|
const pluralKey = `${translationKey}/${form}`;
|
|
@@ -5113,7 +5116,7 @@ function _removeLocale(input2, locale) {
|
|
|
5113
5116
|
const { strings } = input2;
|
|
5114
5117
|
const newStrings = _lodash2.default.cloneDeep(strings);
|
|
5115
5118
|
for (const [key, value] of Object.entries(newStrings)) {
|
|
5116
|
-
if (_optionalChain([value, 'access',
|
|
5119
|
+
if (_optionalChain([value, 'access', _193 => _193.localizations, 'optionalAccess', _194 => _194[locale]])) {
|
|
5117
5120
|
delete value.localizations[locale];
|
|
5118
5121
|
}
|
|
5119
5122
|
}
|
|
@@ -5244,7 +5247,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
5244
5247
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
5245
5248
|
continue;
|
|
5246
5249
|
}
|
|
5247
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
5250
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _195 => _195.localizations, 'optionalAccess', _196 => _196[locale]]);
|
|
5248
5251
|
if (langTranslationEntity) {
|
|
5249
5252
|
if (!resultData[translationKey]) {
|
|
5250
5253
|
resultData[translationKey] = {};
|
|
@@ -5256,7 +5259,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
5256
5259
|
for (const [subName, subData] of Object.entries(
|
|
5257
5260
|
langTranslationEntity.substitutions
|
|
5258
5261
|
)) {
|
|
5259
|
-
const pluralForms = _optionalChain([subData, 'access',
|
|
5262
|
+
const pluralForms = _optionalChain([subData, 'access', _197 => _197.variations, 'optionalAccess', _198 => _198.plural]);
|
|
5260
5263
|
if (pluralForms) {
|
|
5261
5264
|
const forms = {};
|
|
5262
5265
|
for (const [form, formData] of Object.entries(pluralForms)) {
|
|
@@ -5281,7 +5284,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
5281
5284
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
5282
5285
|
const forms = {};
|
|
5283
5286
|
for (const [form, formData] of Object.entries(pluralForms)) {
|
|
5284
|
-
if (_optionalChain([formData, 'optionalAccess',
|
|
5287
|
+
if (_optionalChain([formData, 'optionalAccess', _199 => _199.stringUnit, 'optionalAccess', _200 => _200.value])) {
|
|
5285
5288
|
forms[form] = formData.stringUnit.value;
|
|
5286
5289
|
}
|
|
5287
5290
|
}
|
|
@@ -5324,7 +5327,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
5324
5327
|
for (const [subName, subData] of Object.entries(
|
|
5325
5328
|
keyData.substitutions
|
|
5326
5329
|
)) {
|
|
5327
|
-
const pluralValue = _optionalChain([subData, 'optionalAccess',
|
|
5330
|
+
const pluralValue = _optionalChain([subData, 'optionalAccess', _201 => _201.variations, 'optionalAccess', _202 => _202.plural]);
|
|
5328
5331
|
if (pluralValue && isIcuPluralString(pluralValue)) {
|
|
5329
5332
|
try {
|
|
5330
5333
|
const pluralForms = parseIcuPluralString(pluralValue, locale);
|
|
@@ -5337,8 +5340,8 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
5337
5340
|
}
|
|
5338
5341
|
};
|
|
5339
5342
|
}
|
|
5340
|
-
const sourceLocale = _optionalChain([originalInput, 'optionalAccess',
|
|
5341
|
-
const origFormatSpec = _optionalChain([originalInput, 'optionalAccess',
|
|
5343
|
+
const sourceLocale = _optionalChain([originalInput, 'optionalAccess', _203 => _203.sourceLanguage]) || "en";
|
|
5344
|
+
const origFormatSpec = _optionalChain([originalInput, 'optionalAccess', _204 => _204.strings, 'optionalAccess', _205 => _205[baseKey], 'optionalAccess', _206 => _206.localizations, 'optionalAccess', _207 => _207[sourceLocale], 'optionalAccess', _208 => _208.substitutions, 'optionalAccess', _209 => _209[subName], 'optionalAccess', _210 => _210.formatSpecifier]) || subName;
|
|
5342
5345
|
subs[subName] = {
|
|
5343
5346
|
formatSpecifier: origFormatSpec,
|
|
5344
5347
|
variations: {
|
|
@@ -5363,7 +5366,7 @@ ${error instanceof Error ? error.message : String(error)}`
|
|
|
5363
5366
|
values: keyData.stringSet
|
|
5364
5367
|
};
|
|
5365
5368
|
}
|
|
5366
|
-
if ("variations" in keyData && _optionalChain([keyData, 'access',
|
|
5369
|
+
if ("variations" in keyData && _optionalChain([keyData, 'access', _211 => _211.variations, 'optionalAccess', _212 => _212.plural])) {
|
|
5367
5370
|
const pluralValue = keyData.variations.plural;
|
|
5368
5371
|
if (isIcuPluralString(pluralValue)) {
|
|
5369
5372
|
try {
|
|
@@ -5390,7 +5393,7 @@ ${error instanceof Error ? error.message : String(error)}`
|
|
|
5390
5393
|
}
|
|
5391
5394
|
if (Object.keys(localizationData).length > 0) {
|
|
5392
5395
|
langDataToMerge.strings[baseKey] = {
|
|
5393
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
5396
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _213 => _213.strings, 'optionalAccess', _214 => _214[baseKey], 'optionalAccess', _215 => _215.extractionState]),
|
|
5394
5397
|
localizations: {
|
|
5395
5398
|
[locale]: localizationData
|
|
5396
5399
|
}
|
|
@@ -5427,12 +5430,12 @@ function createUnlocalizableLoader(returnUnlocalizedKeys = false) {
|
|
|
5427
5430
|
const unlocalizableKeys = _getUnlocalizableKeys(input2);
|
|
5428
5431
|
const result = _lodash2.default.omitBy(
|
|
5429
5432
|
input2,
|
|
5430
|
-
(
|
|
5433
|
+
(_38, key) => unlocalizableKeys.includes(key)
|
|
5431
5434
|
);
|
|
5432
5435
|
if (returnUnlocalizedKeys) {
|
|
5433
5436
|
result.unlocalizable = _lodash2.default.omitBy(
|
|
5434
5437
|
input2,
|
|
5435
|
-
(
|
|
5438
|
+
(_38, key) => !unlocalizableKeys.includes(key)
|
|
5436
5439
|
);
|
|
5437
5440
|
}
|
|
5438
5441
|
return result;
|
|
@@ -5442,7 +5445,7 @@ function createUnlocalizableLoader(returnUnlocalizedKeys = false) {
|
|
|
5442
5445
|
const result = _lodash2.default.merge(
|
|
5443
5446
|
{},
|
|
5444
5447
|
data,
|
|
5445
|
-
_lodash2.default.omitBy(originalInput, (
|
|
5448
|
+
_lodash2.default.omitBy(originalInput, (_38, key) => !unlocalizableKeys.includes(key))
|
|
5446
5449
|
);
|
|
5447
5450
|
return result;
|
|
5448
5451
|
}
|
|
@@ -5473,7 +5476,7 @@ function _getUnlocalizableKeys(input2) {
|
|
|
5473
5476
|
}
|
|
5474
5477
|
}
|
|
5475
5478
|
return false;
|
|
5476
|
-
}).map(([key,
|
|
5479
|
+
}).map(([key, _38]) => key);
|
|
5477
5480
|
}
|
|
5478
5481
|
|
|
5479
5482
|
// src/cli/loaders/formatters/prettier.ts
|
|
@@ -5613,8 +5616,8 @@ async function formatDataWithBiome(data, filePath, options) {
|
|
|
5613
5616
|
});
|
|
5614
5617
|
return formatted.content;
|
|
5615
5618
|
} catch (error) {
|
|
5616
|
-
const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access',
|
|
5617
|
-
if (_optionalChain([errorMessage, 'optionalAccess',
|
|
5619
|
+
const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access', _216 => _216.stackTrace, 'optionalAccess', _217 => _217.toString, 'call', _218 => _218(), 'access', _219 => _219.split, 'call', _220 => _220("\n"), 'access', _221 => _221[0]]) : "";
|
|
5620
|
+
if (_optionalChain([errorMessage, 'optionalAccess', _222 => _222.includes, 'call', _223 => _223("does not exist in the workspace")])) {
|
|
5618
5621
|
} else {
|
|
5619
5622
|
console.log(`\u26A0\uFE0F Biome skipped ${path15.default.basename(filePath)}`);
|
|
5620
5623
|
if (errorMessage) {
|
|
@@ -5661,7 +5664,7 @@ function createPoDataLoader(params) {
|
|
|
5661
5664
|
Object.entries(entries).forEach(([msgid, entry]) => {
|
|
5662
5665
|
if (msgid && entry.msgid) {
|
|
5663
5666
|
const context = entry.msgctxt || "";
|
|
5664
|
-
const fullEntry = _optionalChain([parsedPo, 'access',
|
|
5667
|
+
const fullEntry = _optionalChain([parsedPo, 'access', _224 => _224.translations, 'access', _225 => _225[context], 'optionalAccess', _226 => _226[msgid]]);
|
|
5665
5668
|
if (fullEntry) {
|
|
5666
5669
|
result[msgid] = fullEntry;
|
|
5667
5670
|
}
|
|
@@ -5671,8 +5674,8 @@ function createPoDataLoader(params) {
|
|
|
5671
5674
|
return result;
|
|
5672
5675
|
},
|
|
5673
5676
|
async push(locale, data, originalInput, originalLocale, pullInput) {
|
|
5674
|
-
const currentSections = _optionalChain([pullInput, 'optionalAccess',
|
|
5675
|
-
const originalSections = _optionalChain([originalInput, 'optionalAccess',
|
|
5677
|
+
const currentSections = _optionalChain([pullInput, 'optionalAccess', _227 => _227.split, 'call', _228 => _228("\n\n"), 'access', _229 => _229.filter, 'call', _230 => _230(Boolean)]) || [];
|
|
5678
|
+
const originalSections = _optionalChain([originalInput, 'optionalAccess', _231 => _231.split, 'call', _232 => _232("\n\n"), 'access', _233 => _233.filter, 'call', _234 => _234(Boolean)]) || [];
|
|
5676
5679
|
const result = originalSections.map((section) => {
|
|
5677
5680
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
5678
5681
|
if (Object.keys(sectionPo.translations).length === 0) {
|
|
@@ -5743,8 +5746,8 @@ function createPoContentLoader() {
|
|
|
5743
5746
|
{
|
|
5744
5747
|
...entry,
|
|
5745
5748
|
msgstr: [
|
|
5746
|
-
_optionalChain([data, 'access',
|
|
5747
|
-
_optionalChain([data, 'access',
|
|
5749
|
+
_optionalChain([data, 'access', _235 => _235[entry.msgid], 'optionalAccess', _236 => _236.singular]),
|
|
5750
|
+
_optionalChain([data, 'access', _237 => _237[entry.msgid], 'optionalAccess', _238 => _238.plural]) || null
|
|
5748
5751
|
].filter(Boolean)
|
|
5749
5752
|
}
|
|
5750
5753
|
]).fromPairs().value();
|
|
@@ -5866,7 +5869,7 @@ function pullV1(xliffElement, locale, originalLocale) {
|
|
|
5866
5869
|
let key = getTransUnitKey(unit);
|
|
5867
5870
|
if (!key) return;
|
|
5868
5871
|
if (seenKeys.has(key)) {
|
|
5869
|
-
const id = _optionalChain([unit, 'access',
|
|
5872
|
+
const id = _optionalChain([unit, 'access', _239 => _239.getAttribute, 'call', _240 => _240("id"), 'optionalAccess', _241 => _241.trim, 'call', _242 => _242()]);
|
|
5870
5873
|
if (id) {
|
|
5871
5874
|
key = `${key}#${id}`;
|
|
5872
5875
|
} else {
|
|
@@ -5914,7 +5917,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
5914
5917
|
let key = getTransUnitKey(unit);
|
|
5915
5918
|
if (!key) return;
|
|
5916
5919
|
if (seenKeys.has(key)) {
|
|
5917
|
-
const id = _optionalChain([unit, 'access',
|
|
5920
|
+
const id = _optionalChain([unit, 'access', _243 => _243.getAttribute, 'call', _244 => _244("id"), 'optionalAccess', _245 => _245.trim, 'call', _246 => _246()]);
|
|
5918
5921
|
if (id) {
|
|
5919
5922
|
key = `${key}#${id}`;
|
|
5920
5923
|
} else {
|
|
@@ -5956,7 +5959,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
5956
5959
|
const translationKeys = new Set(Object.keys(translations));
|
|
5957
5960
|
existingUnits.forEach((unit, key) => {
|
|
5958
5961
|
if (!translationKeys.has(key)) {
|
|
5959
|
-
_optionalChain([unit, 'access',
|
|
5962
|
+
_optionalChain([unit, 'access', _247 => _247.parentNode, 'optionalAccess', _248 => _248.removeChild, 'call', _249 => _249(unit)]);
|
|
5960
5963
|
}
|
|
5961
5964
|
});
|
|
5962
5965
|
return serializeWithDeclaration(
|
|
@@ -5999,18 +6002,18 @@ function traverseUnitsV2(container, fileId, currentPath, result) {
|
|
|
5999
6002
|
Array.from(container.children).forEach((child) => {
|
|
6000
6003
|
const tagName = child.tagName;
|
|
6001
6004
|
if (tagName === "unit") {
|
|
6002
|
-
const unitId = _optionalChain([child, 'access',
|
|
6005
|
+
const unitId = _optionalChain([child, 'access', _250 => _250.getAttribute, 'call', _251 => _251("id"), 'optionalAccess', _252 => _252.trim, 'call', _253 => _253()]);
|
|
6003
6006
|
if (!unitId) return;
|
|
6004
6007
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
6005
6008
|
const segment = child.querySelector("segment");
|
|
6006
|
-
const source = _optionalChain([segment, 'optionalAccess',
|
|
6009
|
+
const source = _optionalChain([segment, 'optionalAccess', _254 => _254.querySelector, 'call', _255 => _255("source")]);
|
|
6007
6010
|
if (source) {
|
|
6008
6011
|
result[key] = extractTextContent(source);
|
|
6009
6012
|
} else {
|
|
6010
6013
|
result[key] = unitId;
|
|
6011
6014
|
}
|
|
6012
6015
|
} else if (tagName === "group") {
|
|
6013
|
-
const groupId = _optionalChain([child, 'access',
|
|
6016
|
+
const groupId = _optionalChain([child, 'access', _256 => _256.getAttribute, 'call', _257 => _257("id"), 'optionalAccess', _258 => _258.trim, 'call', _259 => _259()]);
|
|
6014
6017
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
6015
6018
|
traverseUnitsV2(child, fileId, newPath, result);
|
|
6016
6019
|
}
|
|
@@ -6046,12 +6049,12 @@ function indexUnitsV2(container, fileId, currentPath, index) {
|
|
|
6046
6049
|
Array.from(container.children).forEach((child) => {
|
|
6047
6050
|
const tagName = child.tagName;
|
|
6048
6051
|
if (tagName === "unit") {
|
|
6049
|
-
const unitId = _optionalChain([child, 'access',
|
|
6052
|
+
const unitId = _optionalChain([child, 'access', _260 => _260.getAttribute, 'call', _261 => _261("id"), 'optionalAccess', _262 => _262.trim, 'call', _263 => _263()]);
|
|
6050
6053
|
if (!unitId) return;
|
|
6051
6054
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
6052
6055
|
index.set(key, child);
|
|
6053
6056
|
} else if (tagName === "group") {
|
|
6054
|
-
const groupId = _optionalChain([child, 'access',
|
|
6057
|
+
const groupId = _optionalChain([child, 'access', _264 => _264.getAttribute, 'call', _265 => _265("id"), 'optionalAccess', _266 => _266.trim, 'call', _267 => _267()]);
|
|
6055
6058
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
6056
6059
|
indexUnitsV2(child, fileId, newPath, index);
|
|
6057
6060
|
}
|
|
@@ -6072,9 +6075,9 @@ function updateUnitV2(unit, value) {
|
|
|
6072
6075
|
setTextContent(source, value);
|
|
6073
6076
|
}
|
|
6074
6077
|
function getTransUnitKey(transUnit) {
|
|
6075
|
-
const resname = _optionalChain([transUnit, 'access',
|
|
6078
|
+
const resname = _optionalChain([transUnit, 'access', _268 => _268.getAttribute, 'call', _269 => _269("resname"), 'optionalAccess', _270 => _270.trim, 'call', _271 => _271()]);
|
|
6076
6079
|
if (resname) return resname;
|
|
6077
|
-
const id = _optionalChain([transUnit, 'access',
|
|
6080
|
+
const id = _optionalChain([transUnit, 'access', _272 => _272.getAttribute, 'call', _273 => _273("id"), 'optionalAccess', _274 => _274.trim, 'call', _275 => _275()]);
|
|
6078
6081
|
if (id) return id;
|
|
6079
6082
|
const sourceElement = transUnit.querySelector("source");
|
|
6080
6083
|
if (sourceElement) {
|
|
@@ -6131,7 +6134,7 @@ function formatXml(xml) {
|
|
|
6131
6134
|
if (cdataNode) {
|
|
6132
6135
|
return `${indent2}${openTag}<![CDATA[${cdataNode.nodeValue}]]></${tagName}>`;
|
|
6133
6136
|
}
|
|
6134
|
-
const textContent2 = _optionalChain([element, 'access',
|
|
6137
|
+
const textContent2 = _optionalChain([element, 'access', _276 => _276.textContent, 'optionalAccess', _277 => _277.trim, 'call', _278 => _278()]) || "";
|
|
6135
6138
|
const hasOnlyText = element.childNodes.length === 1 && element.childNodes[0].nodeType === 3;
|
|
6136
6139
|
if (hasOnlyText && textContent2) {
|
|
6137
6140
|
return `${indent2}${openTag}${textContent2}</${tagName}>`;
|
|
@@ -6424,7 +6427,7 @@ function createDatoClient(params) {
|
|
|
6424
6427
|
ids: !records.length ? void 0 : records.join(",")
|
|
6425
6428
|
}
|
|
6426
6429
|
}).catch(
|
|
6427
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
6430
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _279 => _279.response, 'optionalAccess', _280 => _280.body, 'optionalAccess', _281 => _281.data, 'optionalAccess', _282 => _282[0]]) || error)
|
|
6428
6431
|
);
|
|
6429
6432
|
},
|
|
6430
6433
|
findRecordsForModel: async (modelId, records) => {
|
|
@@ -6435,10 +6438,10 @@ function createDatoClient(params) {
|
|
|
6435
6438
|
filter: {
|
|
6436
6439
|
type: modelId,
|
|
6437
6440
|
only_valid: "true",
|
|
6438
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
6441
|
+
ids: !_optionalChain([records, 'optionalAccess', _283 => _283.length]) ? void 0 : records.join(",")
|
|
6439
6442
|
}
|
|
6440
6443
|
}).catch(
|
|
6441
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
6444
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _284 => _284.response, 'optionalAccess', _285 => _285.body, 'optionalAccess', _286 => _286.data, 'optionalAccess', _287 => _287[0]]) || error)
|
|
6442
6445
|
);
|
|
6443
6446
|
return result;
|
|
6444
6447
|
} catch (_error) {
|
|
@@ -6454,10 +6457,10 @@ function createDatoClient(params) {
|
|
|
6454
6457
|
updateRecord: async (id, payload) => {
|
|
6455
6458
|
try {
|
|
6456
6459
|
await dato.items.update(id, payload).catch(
|
|
6457
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
6460
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _288 => _288.response, 'optionalAccess', _289 => _289.body, 'optionalAccess', _290 => _290.data, 'optionalAccess', _291 => _291[0]]) || error)
|
|
6458
6461
|
);
|
|
6459
6462
|
} catch (_error) {
|
|
6460
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
6463
|
+
if (_optionalChain([_error, 'optionalAccess', _292 => _292.attributes, 'optionalAccess', _293 => _293.details, 'optionalAccess', _294 => _294.message])) {
|
|
6461
6464
|
throw new Error(
|
|
6462
6465
|
[
|
|
6463
6466
|
`${_error.attributes.details.message}`,
|
|
@@ -6479,10 +6482,10 @@ function createDatoClient(params) {
|
|
|
6479
6482
|
enableFieldLocalization: async (args) => {
|
|
6480
6483
|
try {
|
|
6481
6484
|
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch(
|
|
6482
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
6485
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _295 => _295.response, 'optionalAccess', _296 => _296.body, 'optionalAccess', _297 => _297.data, 'optionalAccess', _298 => _298[0]]) || error)
|
|
6483
6486
|
);
|
|
6484
6487
|
} catch (_error) {
|
|
6485
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
6488
|
+
if (_optionalChain([_error, 'optionalAccess', _299 => _299.attributes, 'optionalAccess', _300 => _300.code]) === "NOT_FOUND") {
|
|
6486
6489
|
throw new Error(
|
|
6487
6490
|
[
|
|
6488
6491
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -6490,7 +6493,7 @@ function createDatoClient(params) {
|
|
|
6490
6493
|
].join("\n\n")
|
|
6491
6494
|
);
|
|
6492
6495
|
}
|
|
6493
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
6496
|
+
if (_optionalChain([_error, 'optionalAccess', _301 => _301.attributes, 'optionalAccess', _302 => _302.details, 'optionalAccess', _303 => _303.message])) {
|
|
6494
6497
|
throw new Error(
|
|
6495
6498
|
[
|
|
6496
6499
|
`${_error.attributes.details.message}`,
|
|
@@ -6568,7 +6571,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
6568
6571
|
const records = await dato.findRecordsForModel(modelId);
|
|
6569
6572
|
const recordChoices = createRecordChoices(
|
|
6570
6573
|
records,
|
|
6571
|
-
_optionalChain([config, 'access',
|
|
6574
|
+
_optionalChain([config, 'access', _304 => _304.models, 'access', _305 => _305[modelId], 'optionalAccess', _306 => _306.records]) || [],
|
|
6572
6575
|
project
|
|
6573
6576
|
);
|
|
6574
6577
|
const selectedRecords = await promptRecordSelection(
|
|
@@ -6587,14 +6590,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
6587
6590
|
},
|
|
6588
6591
|
async pull(locale, input2, initCtx) {
|
|
6589
6592
|
const result = {};
|
|
6590
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
6591
|
-
let records = _optionalChain([initCtx, 'optionalAccess',
|
|
6593
|
+
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _307 => _307.models]) || {})) {
|
|
6594
|
+
let records = _optionalChain([initCtx, 'optionalAccess', _308 => _308.models, 'access', _309 => _309[modelId], 'access', _310 => _310.records]) || [];
|
|
6592
6595
|
const recordIds = records.map((record) => record.id);
|
|
6593
6596
|
records = await dato.findRecords(recordIds);
|
|
6594
6597
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
6595
6598
|
if (records.length > 0) {
|
|
6596
6599
|
result[modelId] = {
|
|
6597
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
6600
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _311 => _311.models, 'optionalAccess', _312 => _312[modelId], 'optionalAccess', _313 => _313.fields]) || [],
|
|
6598
6601
|
records
|
|
6599
6602
|
};
|
|
6600
6603
|
}
|
|
@@ -6657,7 +6660,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
6657
6660
|
return records.map((record) => ({
|
|
6658
6661
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
6659
6662
|
value: record.id,
|
|
6660
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
6663
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _314 => _314.includes, 'call', _315 => _315(record.id)])
|
|
6661
6664
|
}));
|
|
6662
6665
|
}
|
|
6663
6666
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -6976,7 +6979,7 @@ function createVttLoader() {
|
|
|
6976
6979
|
if (!input2) {
|
|
6977
6980
|
return "";
|
|
6978
6981
|
}
|
|
6979
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
6982
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _316 => _316.parse, 'call', _317 => _317(input2), 'optionalAccess', _318 => _318.cues]);
|
|
6980
6983
|
if (Object.keys(vtt).length === 0) {
|
|
6981
6984
|
return {};
|
|
6982
6985
|
} else {
|
|
@@ -7030,7 +7033,7 @@ function variableExtractLoader(params) {
|
|
|
7030
7033
|
for (let i = 0; i < matches.length; i++) {
|
|
7031
7034
|
const match2 = matches[i];
|
|
7032
7035
|
const currentValue = result[key].value;
|
|
7033
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
7036
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _319 => _319.replace, 'call', _320 => _320(match2, `{variable:${i}}`)]);
|
|
7034
7037
|
result[key].value = newValue;
|
|
7035
7038
|
result[key].variables[i] = match2;
|
|
7036
7039
|
}
|
|
@@ -7045,7 +7048,7 @@ function variableExtractLoader(params) {
|
|
|
7045
7048
|
const variable = valueObj.variables[i];
|
|
7046
7049
|
const currentValue = result[key];
|
|
7047
7050
|
if (typeof currentValue === "string") {
|
|
7048
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
7051
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _321 => _321.replaceAll, 'call', _322 => _322(
|
|
7049
7052
|
`{variable:${i}}`,
|
|
7050
7053
|
variable
|
|
7051
7054
|
)]);
|
|
@@ -7249,7 +7252,7 @@ function createVueJsonLoader() {
|
|
|
7249
7252
|
return createLoader({
|
|
7250
7253
|
pull: async (locale, input2, ctx) => {
|
|
7251
7254
|
const parsed = parseVueFile(input2);
|
|
7252
|
-
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess',
|
|
7255
|
+
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _323 => _323.i18n, 'optionalAccess', _324 => _324[locale]]), () => ( {}));
|
|
7253
7256
|
},
|
|
7254
7257
|
push: async (locale, data, originalInput) => {
|
|
7255
7258
|
const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
|
|
@@ -7434,7 +7437,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
|
|
|
7434
7437
|
objectExpression.properties.forEach((prop) => {
|
|
7435
7438
|
if (!t.isObjectProperty(prop)) return;
|
|
7436
7439
|
const key = getPropertyKey(prop);
|
|
7437
|
-
const incomingVal = _optionalChain([data, 'optionalAccess',
|
|
7440
|
+
const incomingVal = _optionalChain([data, 'optionalAccess', _325 => _325[key]]);
|
|
7438
7441
|
if (incomingVal === void 0) {
|
|
7439
7442
|
return;
|
|
7440
7443
|
}
|
|
@@ -7470,7 +7473,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
|
|
|
7470
7473
|
let modified = false;
|
|
7471
7474
|
arrayExpression.elements.forEach((element, index) => {
|
|
7472
7475
|
if (!element) return;
|
|
7473
|
-
const incomingVal = _optionalChain([incoming, 'optionalAccess',
|
|
7476
|
+
const incomingVal = _optionalChain([incoming, 'optionalAccess', _326 => _326[index]]);
|
|
7474
7477
|
if (incomingVal === void 0) return;
|
|
7475
7478
|
if (t.isStringLiteral(element) && typeof incomingVal === "string") {
|
|
7476
7479
|
if (element.value !== incomingVal) {
|
|
@@ -7964,7 +7967,7 @@ var AST = class _AST {
|
|
|
7964
7967
|
const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
|
|
7965
7968
|
if (this.isStart() && !this.type)
|
|
7966
7969
|
ret.unshift([]);
|
|
7967
|
-
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
7970
|
+
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _327 => _327.#parent, 'optionalAccess', _328 => _328.type]) === "!")) {
|
|
7968
7971
|
ret.push({});
|
|
7969
7972
|
}
|
|
7970
7973
|
return ret;
|
|
@@ -7972,7 +7975,7 @@ var AST = class _AST {
|
|
|
7972
7975
|
isStart() {
|
|
7973
7976
|
if (this.#root === this)
|
|
7974
7977
|
return true;
|
|
7975
|
-
if (!_optionalChain([this, 'access',
|
|
7978
|
+
if (!_optionalChain([this, 'access', _329 => _329.#parent, 'optionalAccess', _330 => _330.isStart, 'call', _331 => _331()]))
|
|
7976
7979
|
return false;
|
|
7977
7980
|
if (this.#parentIndex === 0)
|
|
7978
7981
|
return true;
|
|
@@ -7988,12 +7991,12 @@ var AST = class _AST {
|
|
|
7988
7991
|
isEnd() {
|
|
7989
7992
|
if (this.#root === this)
|
|
7990
7993
|
return true;
|
|
7991
|
-
if (_optionalChain([this, 'access',
|
|
7994
|
+
if (_optionalChain([this, 'access', _332 => _332.#parent, 'optionalAccess', _333 => _333.type]) === "!")
|
|
7992
7995
|
return true;
|
|
7993
|
-
if (!_optionalChain([this, 'access',
|
|
7996
|
+
if (!_optionalChain([this, 'access', _334 => _334.#parent, 'optionalAccess', _335 => _335.isEnd, 'call', _336 => _336()]))
|
|
7994
7997
|
return false;
|
|
7995
7998
|
if (!this.type)
|
|
7996
|
-
return _optionalChain([this, 'access',
|
|
7999
|
+
return _optionalChain([this, 'access', _337 => _337.#parent, 'optionalAccess', _338 => _338.isEnd, 'call', _339 => _339()]);
|
|
7997
8000
|
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
|
7998
8001
|
return this.#parentIndex === pl - 1;
|
|
7999
8002
|
}
|
|
@@ -8215,7 +8218,7 @@ var AST = class _AST {
|
|
|
8215
8218
|
if (!this.type) {
|
|
8216
8219
|
const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
|
|
8217
8220
|
const src = this.#parts.map((p) => {
|
|
8218
|
-
const [re,
|
|
8221
|
+
const [re, _38, hasMagic, uflag] = typeof p === "string" ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
|
8219
8222
|
this.#hasMagic = this.#hasMagic || hasMagic;
|
|
8220
8223
|
this.#uflag = this.#uflag || uflag;
|
|
8221
8224
|
return re;
|
|
@@ -8238,7 +8241,7 @@ var AST = class _AST {
|
|
|
8238
8241
|
}
|
|
8239
8242
|
}
|
|
8240
8243
|
let end = "";
|
|
8241
|
-
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
8244
|
+
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _340 => _340.#parent, 'optionalAccess', _341 => _341.type]) === "!") {
|
|
8242
8245
|
end = "(?:$|\\/)";
|
|
8243
8246
|
}
|
|
8244
8247
|
const final2 = start2 + src + end;
|
|
@@ -8288,7 +8291,7 @@ var AST = class _AST {
|
|
|
8288
8291
|
if (typeof p === "string") {
|
|
8289
8292
|
throw new Error("string type in extglob ast??");
|
|
8290
8293
|
}
|
|
8291
|
-
const [re,
|
|
8294
|
+
const [re, _38, _hasMagic, uflag] = p.toRegExpSource(dot);
|
|
8292
8295
|
this.#uflag = this.#uflag || uflag;
|
|
8293
8296
|
return re;
|
|
8294
8297
|
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
|
|
@@ -8533,7 +8536,7 @@ var Minimatch = class {
|
|
|
8533
8536
|
}
|
|
8534
8537
|
return false;
|
|
8535
8538
|
}
|
|
8536
|
-
debug(...
|
|
8539
|
+
debug(..._38) {
|
|
8537
8540
|
}
|
|
8538
8541
|
make() {
|
|
8539
8542
|
const pattern = this.pattern;
|
|
@@ -8555,7 +8558,7 @@ var Minimatch = class {
|
|
|
8555
8558
|
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
8556
8559
|
this.globParts = this.preprocess(rawGlobParts);
|
|
8557
8560
|
this.debug(this.pattern, this.globParts);
|
|
8558
|
-
let set = this.globParts.map((s,
|
|
8561
|
+
let set = this.globParts.map((s, _38, __) => {
|
|
8559
8562
|
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
8560
8563
|
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
8561
8564
|
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
@@ -9339,7 +9342,7 @@ function createMdxSectionsSplit2Loader() {
|
|
|
9339
9342
|
const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
|
|
9340
9343
|
const result = {
|
|
9341
9344
|
frontmatter: data.frontmatter,
|
|
9342
|
-
codePlaceholders: _optionalChain([pullInput, 'optionalAccess',
|
|
9345
|
+
codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _342 => _342.codePlaceholders]) || {},
|
|
9343
9346
|
content
|
|
9344
9347
|
};
|
|
9345
9348
|
return result;
|
|
@@ -9422,6 +9425,26 @@ function createIgnoredKeysLoader(ignoredKeys) {
|
|
|
9422
9425
|
});
|
|
9423
9426
|
}
|
|
9424
9427
|
|
|
9428
|
+
// src/cli/loaders/preserved-keys.ts
|
|
9429
|
+
|
|
9430
|
+
function createPreservedKeysLoader(preservedKeys) {
|
|
9431
|
+
return createLoader({
|
|
9432
|
+
pull: async (_locale, data) => {
|
|
9433
|
+
return _lodash2.default.pickBy(
|
|
9434
|
+
data,
|
|
9435
|
+
(_value, key) => !matchesKeyPattern(key, preservedKeys)
|
|
9436
|
+
);
|
|
9437
|
+
},
|
|
9438
|
+
push: async (_locale, data, originalInput, _originalLocale, pullInput) => {
|
|
9439
|
+
const preservedSubObject = _lodash2.default.chain(originalInput).pickBy((_value, key) => matchesKeyPattern(key, preservedKeys)).mapValues((sourceValue, key) => {
|
|
9440
|
+
const targetValue = _optionalChain([pullInput, 'optionalAccess', _343 => _343[key]]);
|
|
9441
|
+
return targetValue !== void 0 ? targetValue : sourceValue;
|
|
9442
|
+
}).value();
|
|
9443
|
+
return _lodash2.default.merge({}, data, preservedSubObject);
|
|
9444
|
+
}
|
|
9445
|
+
});
|
|
9446
|
+
}
|
|
9447
|
+
|
|
9425
9448
|
// src/cli/loaders/ejs.ts
|
|
9426
9449
|
function parseEjsForTranslation(input2) {
|
|
9427
9450
|
const translatable = {};
|
|
@@ -9582,7 +9605,7 @@ function createTwigLoader() {
|
|
|
9582
9605
|
};
|
|
9583
9606
|
}
|
|
9584
9607
|
function postprocessTwig(text, twigBlocks) {
|
|
9585
|
-
return text.replace(/__TWIG_BLOCK_(\d+)__/g, (
|
|
9608
|
+
return text.replace(/__TWIG_BLOCK_(\d+)__/g, (_38, index) => {
|
|
9586
9609
|
return twigBlocks[parseInt(index, 10)] || "";
|
|
9587
9610
|
});
|
|
9588
9611
|
}
|
|
@@ -9609,7 +9632,7 @@ function createTwigLoader() {
|
|
|
9609
9632
|
const attrs = LOCALIZABLE_ATTRIBUTES2[tagName];
|
|
9610
9633
|
if (!attrs) return;
|
|
9611
9634
|
for (const attr of attrs) {
|
|
9612
|
-
const value = _optionalChain([element, 'access',
|
|
9635
|
+
const value = _optionalChain([element, 'access', _344 => _344.attribs, 'optionalAccess', _345 => _345[attr]]);
|
|
9613
9636
|
if (value && value.trim()) {
|
|
9614
9637
|
const restoredValue = postprocessTwig(value.trim(), twigBlocks);
|
|
9615
9638
|
result[`${path20}#${attr}`] = restoredValue;
|
|
@@ -9820,7 +9843,7 @@ function createTxtLoader() {
|
|
|
9820
9843
|
const sortedEntries = Object.entries(payload).sort(
|
|
9821
9844
|
([a], [b]) => parseInt(a) - parseInt(b)
|
|
9822
9845
|
);
|
|
9823
|
-
return sortedEntries.map(([
|
|
9846
|
+
return sortedEntries.map(([_38, value]) => value).join("\n");
|
|
9824
9847
|
}
|
|
9825
9848
|
});
|
|
9826
9849
|
}
|
|
@@ -9930,7 +9953,7 @@ function dedupeHeaders(headers) {
|
|
|
9930
9953
|
function createCsvPerLocaleLoader() {
|
|
9931
9954
|
return createLoader({
|
|
9932
9955
|
async pull(_locale, input2) {
|
|
9933
|
-
if (!_optionalChain([input2, 'optionalAccess',
|
|
9956
|
+
if (!_optionalChain([input2, 'optionalAccess', _346 => _346.trim, 'call', _347 => _347()])) return {};
|
|
9934
9957
|
const parsed = _sync.parse.call(void 0, input2, {
|
|
9935
9958
|
skip_empty_lines: true,
|
|
9936
9959
|
columns: (headers) => {
|
|
@@ -9977,7 +10000,7 @@ function normalizeCsvPatterns(patterns) {
|
|
|
9977
10000
|
return `*/${pattern}`;
|
|
9978
10001
|
});
|
|
9979
10002
|
}
|
|
9980
|
-
function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys, lockedPatterns, ignoredKeys) {
|
|
10003
|
+
function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys, lockedPatterns, ignoredKeys, preservedKeys) {
|
|
9981
10004
|
switch (bucketType) {
|
|
9982
10005
|
default:
|
|
9983
10006
|
throw new Error(`Unsupported bucket type: ${bucketType}`);
|
|
@@ -9990,6 +10013,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
9990
10013
|
createFlatLoader(),
|
|
9991
10014
|
createLockedKeysLoader(lockedKeys || []),
|
|
9992
10015
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10016
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
9993
10017
|
createSyncLoader(),
|
|
9994
10018
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
9995
10019
|
);
|
|
@@ -10002,6 +10026,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10002
10026
|
createFlatLoader(),
|
|
10003
10027
|
createLockedKeysLoader(lockedKeys || []),
|
|
10004
10028
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10029
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10005
10030
|
createSyncLoader(),
|
|
10006
10031
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10007
10032
|
);
|
|
@@ -10014,6 +10039,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10014
10039
|
createFlatLoader(),
|
|
10015
10040
|
createLockedKeysLoader(lockedKeys || []),
|
|
10016
10041
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10042
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10017
10043
|
createSyncLoader(),
|
|
10018
10044
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10019
10045
|
);
|
|
@@ -10026,6 +10052,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10026
10052
|
createFlatLoader(),
|
|
10027
10053
|
createLockedKeysLoader(normalizeCsvPatterns(lockedKeys || [])),
|
|
10028
10054
|
createIgnoredKeysLoader(normalizeCsvPatterns(ignoredKeys || [])),
|
|
10055
|
+
createPreservedKeysLoader(normalizeCsvPatterns(preservedKeys || [])),
|
|
10029
10056
|
createSyncLoader(),
|
|
10030
10057
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10031
10058
|
);
|
|
@@ -10037,6 +10064,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10037
10064
|
createHtmlLoader(),
|
|
10038
10065
|
createLockedKeysLoader(lockedKeys || []),
|
|
10039
10066
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10067
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10040
10068
|
createSyncLoader(),
|
|
10041
10069
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10042
10070
|
);
|
|
@@ -10047,6 +10075,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10047
10075
|
createEjsLoader(),
|
|
10048
10076
|
createLockedKeysLoader(lockedKeys || []),
|
|
10049
10077
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10078
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10050
10079
|
createSyncLoader(),
|
|
10051
10080
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10052
10081
|
);
|
|
@@ -10061,6 +10090,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10061
10090
|
createInjectLocaleLoader(options.injectLocale),
|
|
10062
10091
|
createLockedKeysLoader(lockedKeys || []),
|
|
10063
10092
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10093
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10064
10094
|
createSyncLoader(),
|
|
10065
10095
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10066
10096
|
);
|
|
@@ -10074,6 +10104,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10074
10104
|
createInjectLocaleLoader(options.injectLocale),
|
|
10075
10105
|
createLockedKeysLoader(lockedKeys || []),
|
|
10076
10106
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10107
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10077
10108
|
createSyncLoader(),
|
|
10078
10109
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10079
10110
|
);
|
|
@@ -10087,6 +10118,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10087
10118
|
createInjectLocaleLoader(options.injectLocale),
|
|
10088
10119
|
createLockedKeysLoader(lockedKeys || []),
|
|
10089
10120
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10121
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10090
10122
|
createSyncLoader(),
|
|
10091
10123
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10092
10124
|
);
|
|
@@ -10098,6 +10130,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10098
10130
|
createMarkdownLoader(),
|
|
10099
10131
|
createLockedKeysLoader(lockedKeys || []),
|
|
10100
10132
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10133
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10101
10134
|
createSyncLoader(),
|
|
10102
10135
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10103
10136
|
);
|
|
@@ -10110,6 +10143,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10110
10143
|
createEnsureKeyOrderLoader(),
|
|
10111
10144
|
createLockedKeysLoader(lockedKeys || []),
|
|
10112
10145
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10146
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10113
10147
|
createSyncLoader(),
|
|
10114
10148
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10115
10149
|
);
|
|
@@ -10126,6 +10160,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10126
10160
|
createEnsureKeyOrderLoader(),
|
|
10127
10161
|
createLockedKeysLoader(lockedKeys || []),
|
|
10128
10162
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10163
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10129
10164
|
createSyncLoader(),
|
|
10130
10165
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10131
10166
|
);
|
|
@@ -10137,6 +10172,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10137
10172
|
createMjmlLoader(),
|
|
10138
10173
|
createLockedKeysLoader(lockedKeys || []),
|
|
10139
10174
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10175
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10140
10176
|
createSyncLoader(),
|
|
10141
10177
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10142
10178
|
);
|
|
@@ -10149,6 +10185,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10149
10185
|
createEnsureKeyOrderLoader(),
|
|
10150
10186
|
createLockedKeysLoader(lockedKeys || []),
|
|
10151
10187
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10188
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10152
10189
|
createSyncLoader(),
|
|
10153
10190
|
createVariableLoader({ type: "python" }),
|
|
10154
10191
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
@@ -10160,6 +10197,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10160
10197
|
createPropertiesLoader(),
|
|
10161
10198
|
createLockedKeysLoader(lockedKeys || []),
|
|
10162
10199
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10200
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10163
10201
|
createSyncLoader(),
|
|
10164
10202
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10165
10203
|
);
|
|
@@ -10170,6 +10208,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10170
10208
|
createXcodeStringsLoader(),
|
|
10171
10209
|
createLockedKeysLoader(lockedKeys || []),
|
|
10172
10210
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10211
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10173
10212
|
createSyncLoader(),
|
|
10174
10213
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10175
10214
|
);
|
|
@@ -10182,6 +10221,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10182
10221
|
createEnsureKeyOrderLoader(),
|
|
10183
10222
|
createLockedKeysLoader(lockedKeys || []),
|
|
10184
10223
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10224
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10185
10225
|
createSyncLoader(),
|
|
10186
10226
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10187
10227
|
);
|
|
@@ -10196,6 +10236,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10196
10236
|
createEnsureKeyOrderLoader(),
|
|
10197
10237
|
createLockedKeysLoader(encodeKeys(lockedKeys || [])),
|
|
10198
10238
|
createIgnoredKeysLoader(encodeKeys(ignoredKeys || [])),
|
|
10239
|
+
createPreservedKeysLoader(encodeKeys(preservedKeys || [])),
|
|
10199
10240
|
createSyncLoader(),
|
|
10200
10241
|
createVariableLoader({ type: "ieee" }),
|
|
10201
10242
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
@@ -10211,6 +10252,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10211
10252
|
createEnsureKeyOrderLoader(),
|
|
10212
10253
|
createLockedKeysLoader(encodeKeys(lockedKeys || [])),
|
|
10213
10254
|
createIgnoredKeysLoader(encodeKeys(ignoredKeys || [])),
|
|
10255
|
+
createPreservedKeysLoader(encodeKeys(preservedKeys || [])),
|
|
10214
10256
|
createSyncLoader(),
|
|
10215
10257
|
createVariableLoader({ type: "ieee" }),
|
|
10216
10258
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
@@ -10225,6 +10267,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10225
10267
|
createEnsureKeyOrderLoader(),
|
|
10226
10268
|
createLockedKeysLoader(lockedKeys || []),
|
|
10227
10269
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10270
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10228
10271
|
createSyncLoader(),
|
|
10229
10272
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10230
10273
|
);
|
|
@@ -10239,6 +10282,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10239
10282
|
createEnsureKeyOrderLoader(),
|
|
10240
10283
|
createLockedKeysLoader(lockedKeys || []),
|
|
10241
10284
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10285
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10242
10286
|
createSyncLoader(),
|
|
10243
10287
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10244
10288
|
);
|
|
@@ -10253,6 +10297,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10253
10297
|
createFlatLoader(),
|
|
10254
10298
|
createLockedKeysLoader(lockedKeys || []),
|
|
10255
10299
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10300
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10256
10301
|
createSyncLoader(),
|
|
10257
10302
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10258
10303
|
);
|
|
@@ -10265,6 +10310,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10265
10310
|
createEnsureKeyOrderLoader(),
|
|
10266
10311
|
createLockedKeysLoader(lockedKeys || []),
|
|
10267
10312
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10313
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10268
10314
|
createSyncLoader(),
|
|
10269
10315
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10270
10316
|
);
|
|
@@ -10277,6 +10323,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10277
10323
|
createEnsureKeyOrderLoader(),
|
|
10278
10324
|
createLockedKeysLoader(lockedKeys || []),
|
|
10279
10325
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10326
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10280
10327
|
createSyncLoader(),
|
|
10281
10328
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10282
10329
|
);
|
|
@@ -10287,6 +10334,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10287
10334
|
createSrtLoader(),
|
|
10288
10335
|
createLockedKeysLoader(lockedKeys || []),
|
|
10289
10336
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10337
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10290
10338
|
createSyncLoader(),
|
|
10291
10339
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10292
10340
|
);
|
|
@@ -10298,6 +10346,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10298
10346
|
createEnsureKeyOrderLoader(),
|
|
10299
10347
|
createLockedKeysLoader(lockedKeys || []),
|
|
10300
10348
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10349
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10301
10350
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10302
10351
|
);
|
|
10303
10352
|
case "vtt":
|
|
@@ -10307,6 +10356,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10307
10356
|
createVttLoader(),
|
|
10308
10357
|
createLockedKeysLoader(lockedKeys || []),
|
|
10309
10358
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10359
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10310
10360
|
createSyncLoader(),
|
|
10311
10361
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10312
10362
|
);
|
|
@@ -10320,6 +10370,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10320
10370
|
createEnsureKeyOrderLoader(),
|
|
10321
10371
|
createLockedKeysLoader(lockedKeys || []),
|
|
10322
10372
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10373
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10323
10374
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10324
10375
|
);
|
|
10325
10376
|
case "vue-json":
|
|
@@ -10332,6 +10383,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10332
10383
|
createEnsureKeyOrderLoader(),
|
|
10333
10384
|
createLockedKeysLoader(lockedKeys || []),
|
|
10334
10385
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10386
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10335
10387
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10336
10388
|
);
|
|
10337
10389
|
case "typescript":
|
|
@@ -10349,6 +10401,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10349
10401
|
createSyncLoader(),
|
|
10350
10402
|
createLockedKeysLoader(lockedKeys || []),
|
|
10351
10403
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10404
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10352
10405
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10353
10406
|
);
|
|
10354
10407
|
case "twig":
|
|
@@ -10358,6 +10411,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10358
10411
|
createTwigLoader(),
|
|
10359
10412
|
createLockedKeysLoader(lockedKeys || []),
|
|
10360
10413
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10414
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10361
10415
|
createSyncLoader(),
|
|
10362
10416
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10363
10417
|
);
|
|
@@ -10368,6 +10422,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10368
10422
|
createTxtLoader(),
|
|
10369
10423
|
createLockedKeysLoader(lockedKeys || []),
|
|
10370
10424
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10425
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10371
10426
|
createSyncLoader(),
|
|
10372
10427
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10373
10428
|
);
|
|
@@ -10383,6 +10438,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
10383
10438
|
createInjectLocaleLoader(options.injectLocale),
|
|
10384
10439
|
createLockedKeysLoader(lockedKeys || []),
|
|
10385
10440
|
createIgnoredKeysLoader(ignoredKeys || []),
|
|
10441
|
+
createPreservedKeysLoader(preservedKeys || []),
|
|
10386
10442
|
createSyncLoader(),
|
|
10387
10443
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
10388
10444
|
);
|
|
@@ -10516,8 +10572,34 @@ var ignored_keys_default = new (0, _interactivecommander.Command)().command("ign
|
|
|
10516
10572
|
}
|
|
10517
10573
|
});
|
|
10518
10574
|
|
|
10575
|
+
// src/cli/cmd/show/preserved-keys.ts
|
|
10576
|
+
|
|
10577
|
+
|
|
10578
|
+
var preserved_keys_default = new (0, _interactivecommander.Command)().command("preserved-keys").description(
|
|
10579
|
+
"Show which key-value pairs in source files match preservedKeys patterns"
|
|
10580
|
+
).option("--bucket <name>", "Only show preserved keys for a specific bucket").helpOption("-h, --help", "Show help").action(async (options) => {
|
|
10581
|
+
const ora = _ora2.default.call(void 0, );
|
|
10582
|
+
try {
|
|
10583
|
+
const i18nConfig = await getConfig();
|
|
10584
|
+
if (!i18nConfig) {
|
|
10585
|
+
throw new CLIError({
|
|
10586
|
+
message: "i18n.json not found. Please run `lingo.dev init` to initialize the project.",
|
|
10587
|
+
docUrl: "i18nNotFound"
|
|
10588
|
+
});
|
|
10589
|
+
}
|
|
10590
|
+
const buckets = getBuckets(i18nConfig);
|
|
10591
|
+
await executeKeyCommand(i18nConfig, buckets, options, {
|
|
10592
|
+
filterType: "preservedKeys",
|
|
10593
|
+
displayName: "preserved"
|
|
10594
|
+
});
|
|
10595
|
+
} catch (error) {
|
|
10596
|
+
ora.fail(error.message);
|
|
10597
|
+
process.exit(1);
|
|
10598
|
+
}
|
|
10599
|
+
});
|
|
10600
|
+
|
|
10519
10601
|
// src/cli/cmd/show/index.ts
|
|
10520
|
-
var show_default = new (0, _interactivecommander.Command)().command("show").description("Display configuration, locales, and file paths").helpOption("-h, --help", "Show help").addCommand(config_default).addCommand(locale_default).addCommand(files_default).addCommand(locked_keys_default).addCommand(ignored_keys_default);
|
|
10602
|
+
var show_default = new (0, _interactivecommander.Command)().command("show").description("Display configuration, locales, and file paths").helpOption("-h, --help", "Show help").addCommand(config_default).addCommand(locale_default).addCommand(files_default).addCommand(locked_keys_default).addCommand(ignored_keys_default).addCommand(preserved_keys_default);
|
|
10521
10603
|
|
|
10522
10604
|
// src/cli/cmd/config/index.ts
|
|
10523
10605
|
|
|
@@ -10760,7 +10842,7 @@ function createBasicTranslator(model, systemPrompt, settings = {}) {
|
|
|
10760
10842
|
]
|
|
10761
10843
|
});
|
|
10762
10844
|
const result = JSON.parse(response.text);
|
|
10763
|
-
return _optionalChain([result, 'optionalAccess',
|
|
10845
|
+
return _optionalChain([result, 'optionalAccess', _348 => _348.data]) || {};
|
|
10764
10846
|
}
|
|
10765
10847
|
}
|
|
10766
10848
|
function extractPayloadChunks(payload) {
|
|
@@ -10843,7 +10925,7 @@ function getPureModelProvider(provider) {
|
|
|
10843
10925
|
|
|
10844
10926
|
${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
|
|
10845
10927
|
`;
|
|
10846
|
-
switch (_optionalChain([provider, 'optionalAccess',
|
|
10928
|
+
switch (_optionalChain([provider, 'optionalAccess', _349 => _349.id])) {
|
|
10847
10929
|
case "openai": {
|
|
10848
10930
|
if (!process.env.OPENAI_API_KEY) {
|
|
10849
10931
|
throw new Error(
|
|
@@ -10901,7 +10983,7 @@ function getPureModelProvider(provider) {
|
|
|
10901
10983
|
})(provider.model);
|
|
10902
10984
|
}
|
|
10903
10985
|
default: {
|
|
10904
|
-
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess',
|
|
10986
|
+
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _350 => _350.id])));
|
|
10905
10987
|
}
|
|
10906
10988
|
}
|
|
10907
10989
|
}
|
|
@@ -10990,7 +11072,7 @@ function parseGitUrl(url) {
|
|
|
10990
11072
|
}
|
|
10991
11073
|
const sshMatch = cleanUrl.match(/[@:]([^:/@]+\/[^:/@]+)$/);
|
|
10992
11074
|
const httpsMatch = cleanUrl.match(/\/([^/]+\/[^/]+)$/);
|
|
10993
|
-
const repoPath = _optionalChain([sshMatch, 'optionalAccess',
|
|
11075
|
+
const repoPath = _optionalChain([sshMatch, 'optionalAccess', _351 => _351[1]]) || _optionalChain([httpsMatch, 'optionalAccess', _352 => _352[1]]);
|
|
10994
11076
|
if (!repoPath) return null;
|
|
10995
11077
|
const org = extractOrg(repoPath);
|
|
10996
11078
|
if (!org) return null;
|
|
@@ -11446,7 +11528,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
11446
11528
|
validateParams(i18nConfig, flags);
|
|
11447
11529
|
ora.succeed("Localization configuration is valid");
|
|
11448
11530
|
ora.start("Connecting to Lingo.dev Localization Engine...");
|
|
11449
|
-
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess',
|
|
11531
|
+
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _353 => _353.provider]);
|
|
11450
11532
|
if (isByokMode) {
|
|
11451
11533
|
email = null;
|
|
11452
11534
|
ora.succeed("Using external provider (BYOK mode)");
|
|
@@ -11460,16 +11542,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
11460
11542
|
flags
|
|
11461
11543
|
});
|
|
11462
11544
|
let buckets = getBuckets(i18nConfig);
|
|
11463
|
-
if (_optionalChain([flags, 'access',
|
|
11545
|
+
if (_optionalChain([flags, 'access', _354 => _354.bucket, 'optionalAccess', _355 => _355.length])) {
|
|
11464
11546
|
buckets = buckets.filter(
|
|
11465
11547
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
11466
11548
|
);
|
|
11467
11549
|
}
|
|
11468
11550
|
ora.succeed("Buckets retrieved");
|
|
11469
|
-
if (_optionalChain([flags, 'access',
|
|
11551
|
+
if (_optionalChain([flags, 'access', _356 => _356.file, 'optionalAccess', _357 => _357.length])) {
|
|
11470
11552
|
buckets = buckets.map((bucket) => {
|
|
11471
11553
|
const paths = bucket.paths.filter(
|
|
11472
|
-
(path20) => flags.file.find((file) => _optionalChain([path20, 'access',
|
|
11554
|
+
(path20) => flags.file.find((file) => _optionalChain([path20, 'access', _358 => _358.pathPattern, 'optionalAccess', _359 => _359.includes, 'call', _360 => _360(file)]))
|
|
11473
11555
|
);
|
|
11474
11556
|
return { ...bucket, paths };
|
|
11475
11557
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -11490,7 +11572,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
11490
11572
|
});
|
|
11491
11573
|
}
|
|
11492
11574
|
}
|
|
11493
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
11575
|
+
const targetLocales = _optionalChain([flags, 'access', _361 => _361.locale, 'optionalAccess', _362 => _362.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
11494
11576
|
ora.start("Setting up localization cache...");
|
|
11495
11577
|
const checkLockfileProcessor = createDeltaProcessor("");
|
|
11496
11578
|
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
@@ -11512,7 +11594,8 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
11512
11594
|
},
|
|
11513
11595
|
bucket.lockedKeys,
|
|
11514
11596
|
bucket.lockedPatterns,
|
|
11515
|
-
bucket.ignoredKeys
|
|
11597
|
+
bucket.ignoredKeys,
|
|
11598
|
+
bucket.preservedKeys
|
|
11516
11599
|
);
|
|
11517
11600
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
11518
11601
|
await bucketLoader.init();
|
|
@@ -11547,7 +11630,8 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
11547
11630
|
},
|
|
11548
11631
|
bucket.lockedKeys,
|
|
11549
11632
|
bucket.lockedPatterns,
|
|
11550
|
-
bucket.ignoredKeys
|
|
11633
|
+
bucket.ignoredKeys,
|
|
11634
|
+
bucket.preservedKeys
|
|
11551
11635
|
);
|
|
11552
11636
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
11553
11637
|
await bucketLoader.init();
|
|
@@ -11636,7 +11720,8 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
11636
11720
|
},
|
|
11637
11721
|
bucket.lockedKeys,
|
|
11638
11722
|
bucket.lockedPatterns,
|
|
11639
|
-
bucket.ignoredKeys
|
|
11723
|
+
bucket.ignoredKeys,
|
|
11724
|
+
bucket.preservedKeys
|
|
11640
11725
|
);
|
|
11641
11726
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
11642
11727
|
await bucketLoader.init();
|
|
@@ -11667,7 +11752,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
11667
11752
|
if (flags.key) {
|
|
11668
11753
|
processableData = _lodash2.default.pickBy(
|
|
11669
11754
|
processableData,
|
|
11670
|
-
(
|
|
11755
|
+
(_38, key) => key === flags.key
|
|
11671
11756
|
);
|
|
11672
11757
|
}
|
|
11673
11758
|
if (flags.verbose) {
|
|
@@ -11776,7 +11861,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
11776
11861
|
}
|
|
11777
11862
|
const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
|
|
11778
11863
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
11779
|
-
if (!_optionalChain([flags, 'access',
|
|
11864
|
+
if (!_optionalChain([flags, 'access', _363 => _363.locale, 'optionalAccess', _364 => _364.length])) {
|
|
11780
11865
|
await deltaProcessor.saveChecksums(checksums);
|
|
11781
11866
|
}
|
|
11782
11867
|
}
|
|
@@ -11903,12 +11988,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
11903
11988
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
11904
11989
|
docUrl: "bucketNotFound"
|
|
11905
11990
|
});
|
|
11906
|
-
} else if (_optionalChain([flags, 'access',
|
|
11991
|
+
} else if (_optionalChain([flags, 'access', _365 => _365.locale, 'optionalAccess', _366 => _366.some, 'call', _367 => _367((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
11907
11992
|
throw new ValidationError({
|
|
11908
11993
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
11909
11994
|
docUrl: "localeTargetNotFound"
|
|
11910
11995
|
});
|
|
11911
|
-
} else if (_optionalChain([flags, 'access',
|
|
11996
|
+
} else if (_optionalChain([flags, 'access', _368 => _368.bucket, 'optionalAccess', _369 => _369.some, 'call', _370 => _370(
|
|
11912
11997
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
11913
11998
|
)])) {
|
|
11914
11999
|
throw new ValidationError({
|
|
@@ -12069,7 +12154,8 @@ var lockfile_default = new (0, _interactivecommander.Command)().command("lockfil
|
|
|
12069
12154
|
},
|
|
12070
12155
|
bucket.lockedKeys,
|
|
12071
12156
|
bucket.lockedPatterns,
|
|
12072
|
-
bucket.ignoredKeys
|
|
12157
|
+
bucket.ignoredKeys,
|
|
12158
|
+
bucket.preservedKeys
|
|
12073
12159
|
);
|
|
12074
12160
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
12075
12161
|
const sourceData = await bucketLoader.pull(sourceLocale);
|
|
@@ -12140,7 +12226,8 @@ var cleanup_default = new (0, _interactivecommander.Command)().command("cleanup"
|
|
|
12140
12226
|
},
|
|
12141
12227
|
bucket.lockedKeys,
|
|
12142
12228
|
bucket.lockedPatterns,
|
|
12143
|
-
bucket.ignoredKeys
|
|
12229
|
+
bucket.ignoredKeys,
|
|
12230
|
+
bucket.preservedKeys
|
|
12144
12231
|
);
|
|
12145
12232
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
12146
12233
|
const sourceData = await bucketLoader.pull(sourceLocale);
|
|
@@ -12306,7 +12393,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
|
|
|
12306
12393
|
const response = await engine.whoami();
|
|
12307
12394
|
return {
|
|
12308
12395
|
authenticated: !!response,
|
|
12309
|
-
username: _optionalChain([response, 'optionalAccess',
|
|
12396
|
+
username: _optionalChain([response, 'optionalAccess', _371 => _371.email])
|
|
12310
12397
|
};
|
|
12311
12398
|
} catch (error) {
|
|
12312
12399
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -12448,7 +12535,7 @@ function countWordsInRecord2(payload) {
|
|
|
12448
12535
|
}
|
|
12449
12536
|
function createLingoDotDevVNextLocalizer(processId) {
|
|
12450
12537
|
const settings = getSettings(void 0);
|
|
12451
|
-
const apiKey = process.env.LINGO_API_KEY || _optionalChain([settings, 'access',
|
|
12538
|
+
const apiKey = process.env.LINGO_API_KEY || _optionalChain([settings, 'access', _372 => _372.auth, 'access', _373 => _373.vnext, 'optionalAccess', _374 => _374.apiKey]);
|
|
12452
12539
|
if (!apiKey) {
|
|
12453
12540
|
throw new Error(
|
|
12454
12541
|
_dedent2.default`
|
|
@@ -12475,7 +12562,7 @@ function createLingoDotDevVNextLocalizer(processId) {
|
|
|
12475
12562
|
const response = await engine.whoami();
|
|
12476
12563
|
return {
|
|
12477
12564
|
authenticated: !!response,
|
|
12478
|
-
username: _optionalChain([response, 'optionalAccess',
|
|
12565
|
+
username: _optionalChain([response, 'optionalAccess', _375 => _375.email])
|
|
12479
12566
|
};
|
|
12480
12567
|
} catch (error) {
|
|
12481
12568
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -12591,7 +12678,7 @@ function createExplicitLocalizer(provider) {
|
|
|
12591
12678
|
}
|
|
12592
12679
|
function createAiSdkLocalizer(params) {
|
|
12593
12680
|
const skipAuth = params.skipAuth === true;
|
|
12594
|
-
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
12681
|
+
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _376 => _376.apiKeyName]), () => ( ""))];
|
|
12595
12682
|
if (!skipAuth && (!apiKey || !params.apiKeyName)) {
|
|
12596
12683
|
throw new Error(
|
|
12597
12684
|
_dedent2.default`
|
|
@@ -12870,8 +12957,8 @@ async function setup(input2) {
|
|
|
12870
12957
|
throw new Error(
|
|
12871
12958
|
"No buckets found in i18n.json. Please add at least one bucket containing i18n content."
|
|
12872
12959
|
);
|
|
12873
|
-
} else if (_optionalChain([ctx, 'access',
|
|
12874
|
-
(bucket) => !_optionalChain([ctx, 'access',
|
|
12960
|
+
} else if (_optionalChain([ctx, 'access', _377 => _377.flags, 'access', _378 => _378.bucket, 'optionalAccess', _379 => _379.some, 'call', _380 => _380(
|
|
12961
|
+
(bucket) => !_optionalChain([ctx, 'access', _381 => _381.config, 'optionalAccess', _382 => _382.buckets, 'access', _383 => _383[bucket]])
|
|
12875
12962
|
)])) {
|
|
12876
12963
|
throw new Error(
|
|
12877
12964
|
`One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
|
|
@@ -12883,8 +12970,8 @@ async function setup(input2) {
|
|
|
12883
12970
|
{
|
|
12884
12971
|
title: "Selecting localization provider",
|
|
12885
12972
|
task: async (ctx, task) => {
|
|
12886
|
-
const provider = ctx.flags.pseudo ? "pseudo" : _optionalChain([ctx, 'access',
|
|
12887
|
-
const vNext = _optionalChain([ctx, 'access',
|
|
12973
|
+
const provider = ctx.flags.pseudo ? "pseudo" : _optionalChain([ctx, 'access', _384 => _384.config, 'optionalAccess', _385 => _385.provider]);
|
|
12974
|
+
const vNext = _optionalChain([ctx, 'access', _386 => _386.config, 'optionalAccess', _387 => _387.vNext]);
|
|
12888
12975
|
ctx.localizer = createLocalizer(provider, ctx.flags.apiKey, vNext);
|
|
12889
12976
|
if (!ctx.localizer) {
|
|
12890
12977
|
throw new Error(
|
|
@@ -12896,7 +12983,7 @@ async function setup(input2) {
|
|
|
12896
12983
|
},
|
|
12897
12984
|
{
|
|
12898
12985
|
title: "Checking authentication",
|
|
12899
|
-
enabled: (ctx) => (_optionalChain([ctx, 'access',
|
|
12986
|
+
enabled: (ctx) => (_optionalChain([ctx, 'access', _388 => _388.localizer, 'optionalAccess', _389 => _389.id]) === "Lingo.dev" || _optionalChain([ctx, 'access', _390 => _390.localizer, 'optionalAccess', _391 => _391.id]) === "Lingo.dev vNext") && !ctx.flags.pseudo,
|
|
12900
12987
|
task: async (ctx, task) => {
|
|
12901
12988
|
const authStatus = await ctx.localizer.checkAuth();
|
|
12902
12989
|
if (!authStatus.authenticated) {
|
|
@@ -12909,7 +12996,7 @@ async function setup(input2) {
|
|
|
12909
12996
|
},
|
|
12910
12997
|
{
|
|
12911
12998
|
title: "Validating configuration",
|
|
12912
|
-
enabled: (ctx) => _optionalChain([ctx, 'access',
|
|
12999
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _392 => _392.localizer, 'optionalAccess', _393 => _393.id]) !== "Lingo.dev" && _optionalChain([ctx, 'access', _394 => _394.localizer, 'optionalAccess', _395 => _395.id]) !== "Lingo.dev vNext",
|
|
12913
13000
|
task: async (ctx, task) => {
|
|
12914
13001
|
const validationStatus = await ctx.localizer.validateSettings();
|
|
12915
13002
|
if (!validationStatus.valid) {
|
|
@@ -13059,6 +13146,7 @@ async function plan(input2) {
|
|
|
13059
13146
|
lockedKeys: bucket.lockedKeys || [],
|
|
13060
13147
|
lockedPatterns: bucket.lockedPatterns || [],
|
|
13061
13148
|
ignoredKeys: bucket.ignoredKeys || [],
|
|
13149
|
+
preservedKeys: bucket.preservedKeys || [],
|
|
13062
13150
|
onlyKeys: input2.flags.key || [],
|
|
13063
13151
|
formatter: input2.config.formatter
|
|
13064
13152
|
});
|
|
@@ -13139,7 +13227,7 @@ async function execute(input2) {
|
|
|
13139
13227
|
const workerTasks = [];
|
|
13140
13228
|
for (let i = 0; i < workersCount; i++) {
|
|
13141
13229
|
const assignedTasks = ctx.tasks.filter(
|
|
13142
|
-
(
|
|
13230
|
+
(_38, idx) => idx % workersCount === i
|
|
13143
13231
|
);
|
|
13144
13232
|
workerTasks.push(
|
|
13145
13233
|
createWorkerTask({
|
|
@@ -13211,7 +13299,8 @@ function createLoaderForTask(assignedTask) {
|
|
|
13211
13299
|
},
|
|
13212
13300
|
assignedTask.lockedKeys,
|
|
13213
13301
|
assignedTask.lockedPatterns,
|
|
13214
|
-
assignedTask.ignoredKeys
|
|
13302
|
+
assignedTask.ignoredKeys,
|
|
13303
|
+
assignedTask.preservedKeys
|
|
13215
13304
|
);
|
|
13216
13305
|
bucketLoader.setDefaultLocale(assignedTask.sourceLocale);
|
|
13217
13306
|
return bucketLoader;
|
|
@@ -13252,7 +13341,7 @@ function createWorkerTask(args) {
|
|
|
13252
13341
|
const processableData = _lodash2.default.chain(sourceData).entries().filter(
|
|
13253
13342
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
|
|
13254
13343
|
).filter(
|
|
13255
|
-
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access',
|
|
13344
|
+
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _396 => _396.onlyKeys, 'optionalAccess', _397 => _397.some, 'call', _398 => _398(
|
|
13256
13345
|
(pattern) => minimatch(key, pattern)
|
|
13257
13346
|
)])
|
|
13258
13347
|
).fromPairs().value();
|
|
@@ -13321,7 +13410,7 @@ function createWorkerTask(args) {
|
|
|
13321
13410
|
finalRenamedTargetData
|
|
13322
13411
|
);
|
|
13323
13412
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
13324
|
-
if (!_optionalChain([args, 'access',
|
|
13413
|
+
if (!_optionalChain([args, 'access', _399 => _399.ctx, 'access', _400 => _400.flags, 'access', _401 => _401.targetLocale, 'optionalAccess', _402 => _402.length])) {
|
|
13325
13414
|
await deltaProcessor.saveChecksums(checksums);
|
|
13326
13415
|
}
|
|
13327
13416
|
});
|
|
@@ -13527,10 +13616,10 @@ var flagsSchema2 = _zod.z.object({
|
|
|
13527
13616
|
async function frozen(input2) {
|
|
13528
13617
|
console.log(_chalk2.default.hex(colors.orange)("[Frozen]"));
|
|
13529
13618
|
let buckets = getBuckets(input2.config);
|
|
13530
|
-
if (_optionalChain([input2, 'access',
|
|
13619
|
+
if (_optionalChain([input2, 'access', _403 => _403.flags, 'access', _404 => _404.bucket, 'optionalAccess', _405 => _405.length])) {
|
|
13531
13620
|
buckets = buckets.filter((b) => input2.flags.bucket.includes(b.type));
|
|
13532
13621
|
}
|
|
13533
|
-
if (_optionalChain([input2, 'access',
|
|
13622
|
+
if (_optionalChain([input2, 'access', _406 => _406.flags, 'access', _407 => _407.file, 'optionalAccess', _408 => _408.length])) {
|
|
13534
13623
|
buckets = buckets.map((bucket) => {
|
|
13535
13624
|
const paths = bucket.paths.filter(
|
|
13536
13625
|
(p) => input2.flags.file.some(
|
|
@@ -13566,7 +13655,8 @@ async function frozen(input2) {
|
|
|
13566
13655
|
},
|
|
13567
13656
|
bucket.lockedKeys,
|
|
13568
13657
|
bucket.lockedPatterns,
|
|
13569
|
-
bucket.ignoredKeys
|
|
13658
|
+
bucket.ignoredKeys,
|
|
13659
|
+
bucket.preservedKeys
|
|
13570
13660
|
);
|
|
13571
13661
|
loader.setDefaultLocale(resolvedSourceLocale);
|
|
13572
13662
|
await loader.init();
|
|
@@ -13602,7 +13692,8 @@ async function frozen(input2) {
|
|
|
13602
13692
|
},
|
|
13603
13693
|
bucket.lockedKeys,
|
|
13604
13694
|
bucket.lockedPatterns,
|
|
13605
|
-
bucket.ignoredKeys
|
|
13695
|
+
bucket.ignoredKeys,
|
|
13696
|
+
bucket.preservedKeys
|
|
13606
13697
|
);
|
|
13607
13698
|
loader.setDefaultLocale(resolvedSourceLocale);
|
|
13608
13699
|
await loader.init();
|
|
@@ -13667,13 +13758,13 @@ async function frozen(input2) {
|
|
|
13667
13758
|
|
|
13668
13759
|
// src/cli/cmd/run/_utils.ts
|
|
13669
13760
|
async function determineEmail(ctx) {
|
|
13670
|
-
const isByokMode = !!_optionalChain([ctx, 'access',
|
|
13761
|
+
const isByokMode = !!_optionalChain([ctx, 'access', _409 => _409.config, 'optionalAccess', _410 => _410.provider]);
|
|
13671
13762
|
if (isByokMode) {
|
|
13672
13763
|
return null;
|
|
13673
13764
|
} else {
|
|
13674
13765
|
try {
|
|
13675
|
-
const authStatus = await _optionalChain([ctx, 'access',
|
|
13676
|
-
return _optionalChain([authStatus, 'optionalAccess',
|
|
13766
|
+
const authStatus = await _optionalChain([ctx, 'access', _411 => _411.localizer, 'optionalAccess', _412 => _412.checkAuth, 'call', _413 => _413()]);
|
|
13767
|
+
return _optionalChain([authStatus, 'optionalAccess', _414 => _414.username]) || null;
|
|
13677
13768
|
} catch (e4) {
|
|
13678
13769
|
return null;
|
|
13679
13770
|
}
|
|
@@ -13896,7 +13987,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
13896
13987
|
}
|
|
13897
13988
|
_child_process.execSync.call(void 0, `git config commit.gpgsign true`);
|
|
13898
13989
|
}
|
|
13899
|
-
_optionalChain([this, 'access',
|
|
13990
|
+
_optionalChain([this, 'access', _415 => _415.platformKit, 'optionalAccess', _416 => _416.gitConfig, 'call', _417 => _417()]);
|
|
13900
13991
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
13901
13992
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
13902
13993
|
if (!processOwnCommits) {
|
|
@@ -13928,7 +14019,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
13928
14019
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
13929
14020
|
var PullRequestFlow = class extends InBranchFlow {
|
|
13930
14021
|
async preRun() {
|
|
13931
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
14022
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _418 => _418()]);
|
|
13932
14023
|
if (!canContinue) {
|
|
13933
14024
|
return false;
|
|
13934
14025
|
}
|
|
@@ -14201,10 +14292,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
14201
14292
|
repo_slug: this.platformConfig.repositoryName,
|
|
14202
14293
|
state: "OPEN"
|
|
14203
14294
|
}).then(({ data: { values } }) => {
|
|
14204
|
-
return _optionalChain([values, 'optionalAccess',
|
|
14205
|
-
({ source, destination }) => _optionalChain([source, 'optionalAccess',
|
|
14295
|
+
return _optionalChain([values, 'optionalAccess', _419 => _419.find, 'call', _420 => _420(
|
|
14296
|
+
({ source, destination }) => _optionalChain([source, 'optionalAccess', _421 => _421.branch, 'optionalAccess', _422 => _422.name]) === branch && _optionalChain([destination, 'optionalAccess', _423 => _423.branch, 'optionalAccess', _424 => _424.name]) === this.platformConfig.baseBranchName
|
|
14206
14297
|
)]);
|
|
14207
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
14298
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _425 => _425.id]));
|
|
14208
14299
|
}
|
|
14209
14300
|
async closePullRequest({ pullRequestNumber }) {
|
|
14210
14301
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -14300,7 +14391,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
14300
14391
|
repo: this.platformConfig.repositoryName,
|
|
14301
14392
|
base: this.platformConfig.baseBranchName,
|
|
14302
14393
|
state: "open"
|
|
14303
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
14394
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _426 => _426.number]));
|
|
14304
14395
|
}
|
|
14305
14396
|
async closePullRequest({ pullRequestNumber }) {
|
|
14306
14397
|
await this.octokit.rest.pulls.update({
|
|
@@ -14427,7 +14518,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
14427
14518
|
sourceBranch: branch,
|
|
14428
14519
|
state: "opened"
|
|
14429
14520
|
});
|
|
14430
|
-
return _optionalChain([mergeRequests, 'access',
|
|
14521
|
+
return _optionalChain([mergeRequests, 'access', _427 => _427[0], 'optionalAccess', _428 => _428.iid]);
|
|
14431
14522
|
}
|
|
14432
14523
|
async closePullRequest({
|
|
14433
14524
|
pullRequestNumber
|
|
@@ -14542,7 +14633,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
14542
14633
|
}
|
|
14543
14634
|
const env = {
|
|
14544
14635
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
14545
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
14636
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _429 => _429.pullRequest, 'optionalAccess', _430 => _430.toString, 'call', _431 => _431()]) || "false",
|
|
14546
14637
|
...options.commitMessage && {
|
|
14547
14638
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
14548
14639
|
},
|
|
@@ -14571,7 +14662,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
14571
14662
|
const { isPullRequestMode } = platformKit.config;
|
|
14572
14663
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
14573
14664
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
14574
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
14665
|
+
const canRun = await _optionalChain([flow, 'access', _432 => _432.preRun, 'optionalCall', _433 => _433()]);
|
|
14575
14666
|
if (canRun === false) {
|
|
14576
14667
|
return;
|
|
14577
14668
|
}
|
|
@@ -14581,7 +14672,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
14581
14672
|
if (!hasChanges) {
|
|
14582
14673
|
return;
|
|
14583
14674
|
}
|
|
14584
|
-
await _optionalChain([flow, 'access',
|
|
14675
|
+
await _optionalChain([flow, 'access', _434 => _434.postRun, 'optionalCall', _435 => _435()]);
|
|
14585
14676
|
});
|
|
14586
14677
|
function parseBooleanArg(val) {
|
|
14587
14678
|
if (val === true) return true;
|
|
@@ -14618,8 +14709,8 @@ function exitGracefully(elapsedMs = 0) {
|
|
|
14618
14709
|
}
|
|
14619
14710
|
}
|
|
14620
14711
|
function checkForPendingOperations() {
|
|
14621
|
-
const activeHandles = _optionalChain([process, 'access',
|
|
14622
|
-
const activeRequests = _optionalChain([process, 'access',
|
|
14712
|
+
const activeHandles = _optionalChain([process, 'access', _436 => _436._getActiveHandles, 'optionalCall', _437 => _437()]) || [];
|
|
14713
|
+
const activeRequests = _optionalChain([process, 'access', _438 => _438._getActiveRequests, 'optionalCall', _439 => _439()]) || [];
|
|
14623
14714
|
const nonStandardHandles = activeHandles.filter((handle) => {
|
|
14624
14715
|
if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
|
|
14625
14716
|
return false;
|
|
@@ -14689,17 +14780,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
14689
14780
|
});
|
|
14690
14781
|
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
14691
14782
|
let buckets = getBuckets(i18nConfig);
|
|
14692
|
-
if (_optionalChain([flags, 'access',
|
|
14783
|
+
if (_optionalChain([flags, 'access', _440 => _440.bucket, 'optionalAccess', _441 => _441.length])) {
|
|
14693
14784
|
buckets = buckets.filter(
|
|
14694
14785
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
14695
14786
|
);
|
|
14696
14787
|
}
|
|
14697
14788
|
ora.succeed("Buckets retrieved");
|
|
14698
|
-
if (_optionalChain([flags, 'access',
|
|
14789
|
+
if (_optionalChain([flags, 'access', _442 => _442.file, 'optionalAccess', _443 => _443.length])) {
|
|
14699
14790
|
buckets = buckets.map((bucket) => {
|
|
14700
14791
|
const paths = bucket.paths.filter(
|
|
14701
14792
|
(path20) => flags.file.find(
|
|
14702
|
-
(file) => _optionalChain([path20, 'access',
|
|
14793
|
+
(file) => _optionalChain([path20, 'access', _444 => _444.pathPattern, 'optionalAccess', _445 => _445.includes, 'call', _446 => _446(file)]) || _optionalChain([path20, 'access', _447 => _447.pathPattern, 'optionalAccess', _448 => _448.match, 'call', _449 => _449(file)]) || minimatch(path20.pathPattern, file)
|
|
14703
14794
|
)
|
|
14704
14795
|
);
|
|
14705
14796
|
return { ...bucket, paths };
|
|
@@ -14719,7 +14810,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
14719
14810
|
});
|
|
14720
14811
|
}
|
|
14721
14812
|
}
|
|
14722
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
14813
|
+
const targetLocales = _optionalChain([flags, 'access', _450 => _450.locale, 'optionalAccess', _451 => _451.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
14723
14814
|
let totalSourceKeyCount = 0;
|
|
14724
14815
|
let uniqueKeysToTranslate = 0;
|
|
14725
14816
|
let totalExistingTranslations = 0;
|
|
@@ -14757,7 +14848,8 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
14757
14848
|
},
|
|
14758
14849
|
bucket.lockedKeys,
|
|
14759
14850
|
bucket.lockedPatterns,
|
|
14760
|
-
bucket.ignoredKeys
|
|
14851
|
+
bucket.ignoredKeys,
|
|
14852
|
+
bucket.preservedKeys
|
|
14761
14853
|
);
|
|
14762
14854
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
14763
14855
|
await bucketLoader.init();
|
|
@@ -15129,12 +15221,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
15129
15221
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
15130
15222
|
docUrl: "bucketNotFound"
|
|
15131
15223
|
});
|
|
15132
|
-
} else if (_optionalChain([flags, 'access',
|
|
15224
|
+
} else if (_optionalChain([flags, 'access', _452 => _452.locale, 'optionalAccess', _453 => _453.some, 'call', _454 => _454((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
15133
15225
|
throw new CLIError({
|
|
15134
15226
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
15135
15227
|
docUrl: "localeTargetNotFound"
|
|
15136
15228
|
});
|
|
15137
|
-
} else if (_optionalChain([flags, 'access',
|
|
15229
|
+
} else if (_optionalChain([flags, 'access', _455 => _455.bucket, 'optionalAccess', _456 => _456.some, 'call', _457 => _457(
|
|
15138
15230
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
15139
15231
|
)])) {
|
|
15140
15232
|
throw new CLIError({
|
|
@@ -15226,7 +15318,7 @@ async function renderHero2() {
|
|
|
15226
15318
|
// package.json
|
|
15227
15319
|
var package_default = {
|
|
15228
15320
|
name: "lingo.dev",
|
|
15229
|
-
version: "0.
|
|
15321
|
+
version: "0.131.0",
|
|
15230
15322
|
description: "Lingo.dev CLI",
|
|
15231
15323
|
private: false,
|
|
15232
15324
|
repository: {
|
|
@@ -15530,7 +15622,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
|
|
|
15530
15622
|
if (options.file && options.file.length) {
|
|
15531
15623
|
buckets = buckets.map((bucket) => {
|
|
15532
15624
|
const paths = bucket.paths.filter(
|
|
15533
|
-
(bucketPath) => _optionalChain([options, 'access',
|
|
15625
|
+
(bucketPath) => _optionalChain([options, 'access', _458 => _458.file, 'optionalAccess', _459 => _459.some, 'call', _460 => _460((f) => bucketPath.pathPattern.includes(f))])
|
|
15534
15626
|
);
|
|
15535
15627
|
return { ...bucket, paths };
|
|
15536
15628
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -15565,7 +15657,8 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
|
|
|
15565
15657
|
},
|
|
15566
15658
|
bucket.lockedKeys,
|
|
15567
15659
|
bucket.lockedPatterns,
|
|
15568
|
-
bucket.ignoredKeys
|
|
15660
|
+
bucket.ignoredKeys,
|
|
15661
|
+
bucket.preservedKeys
|
|
15569
15662
|
);
|
|
15570
15663
|
await bucketLoader.init();
|
|
15571
15664
|
bucketLoader.setDefaultLocale(sourceLocale);
|