lingo.dev 0.112.0 → 0.113.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli.cjs +597 -308
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +683 -394
- package/build/cli.mjs.map +1 -1
- package/package.json +1 -1
package/build/cli.cjs
CHANGED
|
@@ -22,17 +22,17 @@ function getSettings(explicitApiKey) {
|
|
|
22
22
|
_envVarsInfo();
|
|
23
23
|
return {
|
|
24
24
|
auth: {
|
|
25
|
-
apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access',
|
|
26
|
-
apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access',
|
|
27
|
-
webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access',
|
|
25
|
+
apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access', _37 => _37.auth, 'optionalAccess', _38 => _38.apiKey]) || defaults2.auth.apiKey,
|
|
26
|
+
apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _39 => _39.auth, 'optionalAccess', _40 => _40.apiUrl]) || defaults2.auth.apiUrl,
|
|
27
|
+
webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _41 => _41.auth, 'optionalAccess', _42 => _42.webUrl]) || defaults2.auth.webUrl
|
|
28
28
|
},
|
|
29
29
|
llm: {
|
|
30
|
-
openaiApiKey: env.OPENAI_API_KEY || _optionalChain([systemFile, 'access',
|
|
31
|
-
anthropicApiKey: env.ANTHROPIC_API_KEY || _optionalChain([systemFile, 'access',
|
|
32
|
-
groqApiKey: env.GROQ_API_KEY || _optionalChain([systemFile, 'access',
|
|
33
|
-
googleApiKey: env.GOOGLE_API_KEY || _optionalChain([systemFile, 'access',
|
|
34
|
-
openrouterApiKey: env.OPENROUTER_API_KEY || _optionalChain([systemFile, 'access',
|
|
35
|
-
mistralApiKey: env.MISTRAL_API_KEY || _optionalChain([systemFile, 'access',
|
|
30
|
+
openaiApiKey: env.OPENAI_API_KEY || _optionalChain([systemFile, 'access', _43 => _43.llm, 'optionalAccess', _44 => _44.openaiApiKey]),
|
|
31
|
+
anthropicApiKey: env.ANTHROPIC_API_KEY || _optionalChain([systemFile, 'access', _45 => _45.llm, 'optionalAccess', _46 => _46.anthropicApiKey]),
|
|
32
|
+
groqApiKey: env.GROQ_API_KEY || _optionalChain([systemFile, 'access', _47 => _47.llm, 'optionalAccess', _48 => _48.groqApiKey]),
|
|
33
|
+
googleApiKey: env.GOOGLE_API_KEY || _optionalChain([systemFile, 'access', _49 => _49.llm, 'optionalAccess', _50 => _50.googleApiKey]),
|
|
34
|
+
openrouterApiKey: env.OPENROUTER_API_KEY || _optionalChain([systemFile, 'access', _51 => _51.llm, 'optionalAccess', _52 => _52.openrouterApiKey]),
|
|
35
|
+
mistralApiKey: env.MISTRAL_API_KEY || _optionalChain([systemFile, 'access', _53 => _53.llm, 'optionalAccess', _54 => _54.mistralApiKey])
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
}
|
|
@@ -141,43 +141,43 @@ Please use LINGODOTDEV_API_KEY instead.
|
|
|
141
141
|
function _envVarsInfo() {
|
|
142
142
|
const env = _loadEnv();
|
|
143
143
|
const systemFile = _loadSystemFile();
|
|
144
|
-
if (env.LINGODOTDEV_API_KEY && _optionalChain([systemFile, 'access',
|
|
144
|
+
if (env.LINGODOTDEV_API_KEY && _optionalChain([systemFile, 'access', _55 => _55.auth, 'optionalAccess', _56 => _56.apiKey])) {
|
|
145
145
|
console.info(
|
|
146
146
|
"\x1B[36m%s\x1B[0m",
|
|
147
147
|
`\u2139\uFE0F Using LINGODOTDEV_API_KEY env var instead of credentials from user config`
|
|
148
148
|
);
|
|
149
149
|
}
|
|
150
|
-
if (env.OPENAI_API_KEY && _optionalChain([systemFile, 'access',
|
|
150
|
+
if (env.OPENAI_API_KEY && _optionalChain([systemFile, 'access', _57 => _57.llm, 'optionalAccess', _58 => _58.openaiApiKey])) {
|
|
151
151
|
console.info(
|
|
152
152
|
"\x1B[36m%s\x1B[0m",
|
|
153
153
|
`\u2139\uFE0F Using OPENAI_API_KEY env var instead of key from user config.`
|
|
154
154
|
);
|
|
155
155
|
}
|
|
156
|
-
if (env.ANTHROPIC_API_KEY && _optionalChain([systemFile, 'access',
|
|
156
|
+
if (env.ANTHROPIC_API_KEY && _optionalChain([systemFile, 'access', _59 => _59.llm, 'optionalAccess', _60 => _60.anthropicApiKey])) {
|
|
157
157
|
console.info(
|
|
158
158
|
"\x1B[36m%s\x1B[0m",
|
|
159
159
|
`\u2139\uFE0F Using ANTHROPIC_API_KEY env var instead of key from user config`
|
|
160
160
|
);
|
|
161
161
|
}
|
|
162
|
-
if (env.GROQ_API_KEY && _optionalChain([systemFile, 'access',
|
|
162
|
+
if (env.GROQ_API_KEY && _optionalChain([systemFile, 'access', _61 => _61.llm, 'optionalAccess', _62 => _62.groqApiKey])) {
|
|
163
163
|
console.info(
|
|
164
164
|
"\x1B[36m%s\x1B[0m",
|
|
165
165
|
`\u2139\uFE0F Using GROQ_API_KEY env var instead of key from user config`
|
|
166
166
|
);
|
|
167
167
|
}
|
|
168
|
-
if (env.GOOGLE_API_KEY && _optionalChain([systemFile, 'access',
|
|
168
|
+
if (env.GOOGLE_API_KEY && _optionalChain([systemFile, 'access', _63 => _63.llm, 'optionalAccess', _64 => _64.googleApiKey])) {
|
|
169
169
|
console.info(
|
|
170
170
|
"\x1B[36m%s\x1B[0m",
|
|
171
171
|
`\u2139\uFE0F Using GOOGLE_API_KEY env var instead of key from user config`
|
|
172
172
|
);
|
|
173
173
|
}
|
|
174
|
-
if (env.OPENROUTER_API_KEY && _optionalChain([systemFile, 'access',
|
|
174
|
+
if (env.OPENROUTER_API_KEY && _optionalChain([systemFile, 'access', _65 => _65.llm, 'optionalAccess', _66 => _66.openrouterApiKey])) {
|
|
175
175
|
console.info(
|
|
176
176
|
"\x1B[36m%s\x1B[0m",
|
|
177
177
|
`\u2139\uFE0F Using OPENROUTER_API_KEY env var instead of key from user config`
|
|
178
178
|
);
|
|
179
179
|
}
|
|
180
|
-
if (env.MISTRAL_API_KEY && _optionalChain([systemFile, 'access',
|
|
180
|
+
if (env.MISTRAL_API_KEY && _optionalChain([systemFile, 'access', _67 => _67.llm, 'optionalAccess', _68 => _68.mistralApiKey])) {
|
|
181
181
|
console.info(
|
|
182
182
|
"\x1B[36m%s\x1B[0m",
|
|
183
183
|
`\u2139\uFE0F Using MISTRAL_API_KEY env var instead of key from user config`
|
|
@@ -254,10 +254,10 @@ var LocalizationError = (_class5 = class extends Error {
|
|
|
254
254
|
constructor(message, context) {
|
|
255
255
|
super(message);_class5.prototype.__init5.call(this);;
|
|
256
256
|
this.name = "LocalizationError";
|
|
257
|
-
this.bucket = _optionalChain([context, 'optionalAccess',
|
|
258
|
-
this.sourceLocale = _optionalChain([context, 'optionalAccess',
|
|
259
|
-
this.targetLocale = _optionalChain([context, 'optionalAccess',
|
|
260
|
-
this.pathPattern = _optionalChain([context, 'optionalAccess',
|
|
257
|
+
this.bucket = _optionalChain([context, 'optionalAccess', _69 => _69.bucket]);
|
|
258
|
+
this.sourceLocale = _optionalChain([context, 'optionalAccess', _70 => _70.sourceLocale]);
|
|
259
|
+
this.targetLocale = _optionalChain([context, 'optionalAccess', _71 => _71.targetLocale]);
|
|
260
|
+
this.pathPattern = _optionalChain([context, 'optionalAccess', _72 => _72.pathPattern]);
|
|
261
261
|
}
|
|
262
262
|
}, _class5);
|
|
263
263
|
var BucketProcessingError = (_class6 = class extends Error {
|
|
@@ -393,7 +393,7 @@ function createAuthenticator(params) {
|
|
|
393
393
|
});
|
|
394
394
|
if (res.ok) {
|
|
395
395
|
const payload = await res.json();
|
|
396
|
-
if (!_optionalChain([payload, 'optionalAccess',
|
|
396
|
+
if (!_optionalChain([payload, 'optionalAccess', _73 => _73.email])) {
|
|
397
397
|
return null;
|
|
398
398
|
}
|
|
399
399
|
return {
|
|
@@ -588,7 +588,7 @@ async function renderSummary(results) {
|
|
|
588
588
|
if (succeededResults.length > 0) {
|
|
589
589
|
console.log(_chalk2.default.hex(colors.green)("\n[Processed Files]"));
|
|
590
590
|
for (const result of succeededResults) {
|
|
591
|
-
const displayPath = _optionalChain([result, 'access',
|
|
591
|
+
const displayPath = _optionalChain([result, 'access', _74 => _74.pathPattern, 'optionalAccess', _75 => _75.replace, 'call', _76 => _76("[locale]", result.targetLocale)]) || "unknown";
|
|
592
592
|
console.log(
|
|
593
593
|
` \u2713 ${_chalk2.default.dim(displayPath)} ${_chalk2.default.hex(colors.yellow)(`(${result.sourceLocale} \u2192 ${result.targetLocale})`)}`
|
|
594
594
|
);
|
|
@@ -597,7 +597,7 @@ async function renderSummary(results) {
|
|
|
597
597
|
if (skippedResults.length > 0) {
|
|
598
598
|
console.log(_chalk2.default.hex(colors.blue)("\n[Cached Files]"));
|
|
599
599
|
for (const result of skippedResults) {
|
|
600
|
-
const displayPath = _optionalChain([result, 'access',
|
|
600
|
+
const displayPath = _optionalChain([result, 'access', _77 => _77.pathPattern, 'optionalAccess', _78 => _78.replace, 'call', _79 => _79("[locale]", result.targetLocale)]) || "unknown";
|
|
601
601
|
console.log(
|
|
602
602
|
` \u26A1 ${_chalk2.default.dim(displayPath)} ${_chalk2.default.hex(colors.yellow)(`(${result.sourceLocale} \u2192 ${result.targetLocale})`)}`
|
|
603
603
|
);
|
|
@@ -606,12 +606,12 @@ async function renderSummary(results) {
|
|
|
606
606
|
if (failedResults.length > 0) {
|
|
607
607
|
console.log(_chalk2.default.hex(colors.orange)("\n[Failed Files]"));
|
|
608
608
|
for (const result of failedResults) {
|
|
609
|
-
const displayPath = _optionalChain([result, 'access',
|
|
609
|
+
const displayPath = _optionalChain([result, 'access', _80 => _80.pathPattern, 'optionalAccess', _81 => _81.replace, 'call', _82 => _82("[locale]", result.targetLocale)]) || "unknown";
|
|
610
610
|
console.log(
|
|
611
611
|
` \u274C ${_chalk2.default.dim(displayPath)} ${_chalk2.default.hex(colors.yellow)(`(${result.sourceLocale} \u2192 ${result.targetLocale})`)}`
|
|
612
612
|
);
|
|
613
613
|
console.log(
|
|
614
|
-
` ${_chalk2.default.hex(colors.white)(String(_optionalChain([result, 'access',
|
|
614
|
+
` ${_chalk2.default.hex(colors.white)(String(_optionalChain([result, 'access', _83 => _83.error, 'optionalAccess', _84 => _84.message]) || "Unknown error"))}`
|
|
615
615
|
);
|
|
616
616
|
}
|
|
617
617
|
}
|
|
@@ -1257,7 +1257,7 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
|
|
|
1257
1257
|
});
|
|
1258
1258
|
const auth2 = await newAuthenticator.whoami();
|
|
1259
1259
|
if (auth2) {
|
|
1260
|
-
_ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess',
|
|
1260
|
+
_ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _85 => _85.email])}`);
|
|
1261
1261
|
} else {
|
|
1262
1262
|
_ora2.default.call(void 0, ).fail("Authentication failed.");
|
|
1263
1263
|
}
|
|
@@ -1347,7 +1347,7 @@ function getBuckets(i18nConfig) {
|
|
|
1347
1347
|
const includeItems = bucketEntry.include.map(
|
|
1348
1348
|
(item) => resolveBucketItem(item)
|
|
1349
1349
|
);
|
|
1350
|
-
const excludeItems = _optionalChain([bucketEntry, 'access',
|
|
1350
|
+
const excludeItems = _optionalChain([bucketEntry, 'access', _86 => _86.exclude, 'optionalAccess', _87 => _87.map, 'call', _88 => _88(
|
|
1351
1351
|
(item) => resolveBucketItem(item)
|
|
1352
1352
|
)]);
|
|
1353
1353
|
const config = {
|
|
@@ -1385,7 +1385,7 @@ function extractPathPatterns(sourceLocale, include, exclude) {
|
|
|
1385
1385
|
delimiter: pattern.delimiter
|
|
1386
1386
|
}))
|
|
1387
1387
|
);
|
|
1388
|
-
const excludedPatterns = _optionalChain([exclude, 'optionalAccess',
|
|
1388
|
+
const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _89 => _89.flatMap, 'call', _90 => _90(
|
|
1389
1389
|
(pattern) => expandPlaceholderedGlob(
|
|
1390
1390
|
pattern.path,
|
|
1391
1391
|
__spec.resolveOverriddenLocale.call(void 0, sourceLocale, pattern.delimiter)
|
|
@@ -1539,148 +1539,11 @@ var files_default = new (0, _interactivecommander.Command)().command("files").de
|
|
|
1539
1539
|
}
|
|
1540
1540
|
});
|
|
1541
1541
|
|
|
1542
|
-
// src/cli/cmd/show/
|
|
1543
|
-
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);
|
|
1544
|
-
|
|
1545
|
-
// src/cli/cmd/config/index.ts
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
// src/cli/cmd/config/set.ts
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
var _dedent = require('dedent'); var _dedent2 = _interopRequireDefault(_dedent);
|
|
1552
|
-
|
|
1553
|
-
var set_default = new (0, _interactivecommander.Command)().name("set").description("Set or update a CLI setting in ~/.lingodotdevrc").addHelpText("afterAll", `
|
|
1554
|
-
Available keys:
|
|
1555
|
-
${SETTINGS_KEYS.join("\n ")}`).argument(
|
|
1556
|
-
"<key>",
|
|
1557
|
-
"Configuration key to set (dot notation, e.g., auth.apiKey)"
|
|
1558
|
-
).argument("<value>", "The configuration value to set").helpOption("-h, --help", "Show help").action(async (key, value) => {
|
|
1559
|
-
if (!SETTINGS_KEYS.includes(key)) {
|
|
1560
|
-
console.error(
|
|
1561
|
-
_dedent2.default`
|
|
1562
|
-
${_chalk2.default.red("\u2716")} Unknown configuration key: ${_chalk2.default.bold(key)}
|
|
1563
|
-
Run ${_chalk2.default.dim("lingo.dev config set --help")} to see available keys.
|
|
1564
|
-
`
|
|
1565
|
-
);
|
|
1566
|
-
process.exitCode = 1;
|
|
1567
|
-
return;
|
|
1568
|
-
}
|
|
1569
|
-
const current = loadSystemSettings();
|
|
1570
|
-
const updated = _lodash2.default.cloneDeep(current);
|
|
1571
|
-
_lodash2.default.set(updated, key, value);
|
|
1572
|
-
try {
|
|
1573
|
-
saveSettings(updated);
|
|
1574
|
-
console.log(`${_chalk2.default.green("\u2714")} Set ${_chalk2.default.bold(key)}`);
|
|
1575
|
-
} catch (err) {
|
|
1576
|
-
console.error(
|
|
1577
|
-
_chalk2.default.red(
|
|
1578
|
-
`\u2716 Failed to save configuration: ${_chalk2.default.dim(
|
|
1579
|
-
err instanceof Error ? err.message : String(err)
|
|
1580
|
-
)}`
|
|
1581
|
-
)
|
|
1582
|
-
);
|
|
1583
|
-
process.exitCode = 1;
|
|
1584
|
-
}
|
|
1585
|
-
});
|
|
1586
|
-
|
|
1587
|
-
// src/cli/cmd/config/unset.ts
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
var unset_default = new (0, _interactivecommander.Command)().name("unset").description("Remove a CLI setting from ~/.lingodotdevrc").addHelpText("afterAll", `
|
|
1593
|
-
Available keys:
|
|
1594
|
-
${SETTINGS_KEYS.join("\n ")}`).argument(
|
|
1595
|
-
"<key>",
|
|
1596
|
-
"Configuration key to remove (must match one of the available keys listed below)"
|
|
1597
|
-
).helpOption("-h, --help", "Show help").action(async (key) => {
|
|
1598
|
-
if (!SETTINGS_KEYS.includes(key)) {
|
|
1599
|
-
console.error(
|
|
1600
|
-
_dedent2.default`
|
|
1601
|
-
${_chalk2.default.red("\u2716")} Unknown configuration key: ${_chalk2.default.bold(key)}
|
|
1602
|
-
Run ${_chalk2.default.dim(
|
|
1603
|
-
"lingo.dev config unset --help"
|
|
1604
|
-
)} to see available keys.
|
|
1605
|
-
`
|
|
1606
|
-
);
|
|
1607
|
-
process.exitCode = 1;
|
|
1608
|
-
return;
|
|
1609
|
-
}
|
|
1610
|
-
const settings = loadSystemSettings();
|
|
1611
|
-
const currentValue = _lodash2.default.get(settings, key);
|
|
1612
|
-
if (!_lodash2.default.trim(String(currentValue || ""))) {
|
|
1613
|
-
console.log(`${_chalk2.default.cyan("\u2139")} ${_chalk2.default.bold(key)} is not set.`);
|
|
1614
|
-
return;
|
|
1615
|
-
} else {
|
|
1616
|
-
const updated = _lodash2.default.cloneDeep(settings);
|
|
1617
|
-
_lodash2.default.unset(updated, key);
|
|
1618
|
-
try {
|
|
1619
|
-
saveSettings(updated);
|
|
1620
|
-
console.log(
|
|
1621
|
-
`${_chalk2.default.green("\u2714")} Removed configuration key ${_chalk2.default.bold(key)}`
|
|
1622
|
-
);
|
|
1623
|
-
} catch (err) {
|
|
1624
|
-
console.error(
|
|
1625
|
-
_chalk2.default.red(
|
|
1626
|
-
`\u2716 Failed to save configuration: ${_chalk2.default.dim(
|
|
1627
|
-
err instanceof Error ? err.message : String(err)
|
|
1628
|
-
)}`
|
|
1629
|
-
)
|
|
1630
|
-
);
|
|
1631
|
-
process.exitCode = 1;
|
|
1632
|
-
}
|
|
1633
|
-
}
|
|
1634
|
-
});
|
|
1635
|
-
|
|
1636
|
-
// src/cli/cmd/config/get.ts
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
var get_default = new (0, _interactivecommander.Command)().name("get").description("Display the value of a CLI setting from ~/.lingodotdevrc").addHelpText("afterAll", `
|
|
1642
|
-
Available keys:
|
|
1643
|
-
${SETTINGS_KEYS.join("\n ")}`).argument(
|
|
1644
|
-
"<key>",
|
|
1645
|
-
"Configuration key to read (choose from the available keys listed below)"
|
|
1646
|
-
).helpOption("-h, --help", "Show help").action(async (key) => {
|
|
1647
|
-
if (!SETTINGS_KEYS.includes(key)) {
|
|
1648
|
-
console.error(
|
|
1649
|
-
_dedent2.default`
|
|
1650
|
-
${_chalk2.default.red("\u2716")} Unknown configuration key: ${_chalk2.default.bold(key)}
|
|
1651
|
-
Run ${_chalk2.default.dim("lingo.dev config get --help")} to see available keys.
|
|
1652
|
-
`
|
|
1653
|
-
);
|
|
1654
|
-
process.exitCode = 1;
|
|
1655
|
-
return;
|
|
1656
|
-
}
|
|
1657
|
-
const settings = loadSystemSettings();
|
|
1658
|
-
const value = _lodash2.default.get(settings, key);
|
|
1659
|
-
if (!value) {
|
|
1660
|
-
console.log(`${_chalk2.default.cyan("\u2139")} ${_chalk2.default.bold(key)} is not set.`);
|
|
1661
|
-
return;
|
|
1662
|
-
}
|
|
1663
|
-
if (typeof value === "object") {
|
|
1664
|
-
console.log(JSON.stringify(value, null, 2));
|
|
1665
|
-
} else {
|
|
1666
|
-
console.log(value);
|
|
1667
|
-
}
|
|
1668
|
-
});
|
|
1669
|
-
|
|
1670
|
-
// src/cli/cmd/config/index.ts
|
|
1671
|
-
var config_default2 = new (0, _interactivecommander.Command)().command("config").description(
|
|
1672
|
-
"Manage CLI settings (authentication, API keys) stored in ~/.lingodotdevrc"
|
|
1673
|
-
).helpOption("-h, --help", "Show help").addCommand(set_default).addCommand(unset_default).addCommand(get_default);
|
|
1674
|
-
|
|
1675
|
-
// src/cli/cmd/i18n.ts
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1542
|
+
// src/cli/cmd/show/locked-keys.ts
|
|
1681
1543
|
|
|
1682
1544
|
|
|
1683
1545
|
|
|
1546
|
+
// src/cli/cmd/show/_shared-key-command.ts
|
|
1684
1547
|
|
|
1685
1548
|
|
|
1686
1549
|
// src/cli/loaders/_utils.ts
|
|
@@ -1688,12 +1551,12 @@ function composeLoaders(...loaders) {
|
|
|
1688
1551
|
return {
|
|
1689
1552
|
init: async () => {
|
|
1690
1553
|
for (const loader of loaders) {
|
|
1691
|
-
await _optionalChain([loader, 'access',
|
|
1554
|
+
await _optionalChain([loader, 'access', _91 => _91.init, 'optionalCall', _92 => _92()]);
|
|
1692
1555
|
}
|
|
1693
1556
|
},
|
|
1694
1557
|
setDefaultLocale(locale) {
|
|
1695
1558
|
for (const loader of loaders) {
|
|
1696
|
-
_optionalChain([loader, 'access',
|
|
1559
|
+
_optionalChain([loader, 'access', _93 => _93.setDefaultLocale, 'optionalCall', _94 => _94(locale)]);
|
|
1697
1560
|
}
|
|
1698
1561
|
return this;
|
|
1699
1562
|
},
|
|
@@ -1714,7 +1577,7 @@ function composeLoaders(...loaders) {
|
|
|
1714
1577
|
pullHints: async (originalInput) => {
|
|
1715
1578
|
let result = originalInput;
|
|
1716
1579
|
for (let i = 0; i < loaders.length; i++) {
|
|
1717
|
-
const subResult = await _optionalChain([loaders, 'access',
|
|
1580
|
+
const subResult = await _optionalChain([loaders, 'access', _95 => _95[i], 'access', _96 => _96.pullHints, 'optionalCall', _97 => _97(result)]);
|
|
1718
1581
|
if (subResult) {
|
|
1719
1582
|
result = subResult;
|
|
1720
1583
|
}
|
|
@@ -1736,7 +1599,7 @@ function createLoader(lDefinition) {
|
|
|
1736
1599
|
if (state.initCtx) {
|
|
1737
1600
|
return state.initCtx;
|
|
1738
1601
|
}
|
|
1739
|
-
state.initCtx = await _optionalChain([lDefinition, 'access',
|
|
1602
|
+
state.initCtx = await _optionalChain([lDefinition, 'access', _98 => _98.init, 'optionalCall', _99 => _99()]);
|
|
1740
1603
|
return state.initCtx;
|
|
1741
1604
|
},
|
|
1742
1605
|
setDefaultLocale(locale) {
|
|
@@ -1747,7 +1610,7 @@ function createLoader(lDefinition) {
|
|
|
1747
1610
|
return this;
|
|
1748
1611
|
},
|
|
1749
1612
|
async pullHints() {
|
|
1750
|
-
return _optionalChain([lDefinition, 'access',
|
|
1613
|
+
return _optionalChain([lDefinition, 'access', _100 => _100.pullHints, 'optionalCall', _101 => _101(state.originalInput)]);
|
|
1751
1614
|
},
|
|
1752
1615
|
async pull(locale, input2) {
|
|
1753
1616
|
if (!state.defaultLocale) {
|
|
@@ -2052,7 +1915,7 @@ function createNormalizeLoader() {
|
|
|
2052
1915
|
return normalized;
|
|
2053
1916
|
},
|
|
2054
1917
|
push: async (locale, data, originalInput) => {
|
|
2055
|
-
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess',
|
|
1918
|
+
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _102 => _102.keysMap]), () => ( {}));
|
|
2056
1919
|
const input2 = mapDenormalizedKeys(data, keysMap);
|
|
2057
1920
|
const denormalized = _flat.unflatten.call(void 0, input2, {
|
|
2058
1921
|
delimiter: "/",
|
|
@@ -2153,7 +2016,7 @@ function createTextFileLoader(pathPattern) {
|
|
|
2153
2016
|
const trimmedResult = result.trim();
|
|
2154
2017
|
return trimmedResult;
|
|
2155
2018
|
},
|
|
2156
|
-
async push(locale, data,
|
|
2019
|
+
async push(locale, data, _36, originalLocale) {
|
|
2157
2020
|
const draftPath = pathPattern.replaceAll("[locale]", locale);
|
|
2158
2021
|
const finalPath = path14.default.resolve(draftPath);
|
|
2159
2022
|
const dirPath = path14.default.dirname(finalPath);
|
|
@@ -2186,8 +2049,8 @@ async function getTrailingNewLine(pathPattern, locale, originalLocale) {
|
|
|
2186
2049
|
if (!templateData) {
|
|
2187
2050
|
templateData = await readFileForLocale(pathPattern, originalLocale);
|
|
2188
2051
|
}
|
|
2189
|
-
if (_optionalChain([templateData, 'optionalAccess',
|
|
2190
|
-
const ending = _optionalChain([templateData, 'optionalAccess',
|
|
2052
|
+
if (_optionalChain([templateData, 'optionalAccess', _103 => _103.match, 'call', _104 => _104(/[\r\n]$/)])) {
|
|
2053
|
+
const ending = _optionalChain([templateData, 'optionalAccess', _105 => _105.includes, 'call', _106 => _106("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _107 => _107.includes, 'call', _108 => _108("\r")]) ? "\r" : "\n";
|
|
2191
2054
|
return ending;
|
|
2192
2055
|
}
|
|
2193
2056
|
return "";
|
|
@@ -2458,7 +2321,7 @@ var _sync3 = require('csv-stringify/sync');
|
|
|
2458
2321
|
|
|
2459
2322
|
function detectKeyColumnName(csvString) {
|
|
2460
2323
|
const row = _sync.parse.call(void 0, csvString)[0];
|
|
2461
|
-
const firstColumn = _optionalChain([row, 'optionalAccess',
|
|
2324
|
+
const firstColumn = _optionalChain([row, 'optionalAccess', _109 => _109[0], 'optionalAccess', _110 => _110.trim, 'call', _111 => _111()]);
|
|
2462
2325
|
return firstColumn || "KEY";
|
|
2463
2326
|
}
|
|
2464
2327
|
function createCsvLoader() {
|
|
@@ -2560,7 +2423,7 @@ function createHtmlLoader() {
|
|
|
2560
2423
|
break;
|
|
2561
2424
|
}
|
|
2562
2425
|
const siblings = Array.from(parent.childNodes).filter(
|
|
2563
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2426
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _112 => _112.textContent, 'optionalAccess', _113 => _113.trim, 'call', _114 => _114()])
|
|
2564
2427
|
);
|
|
2565
2428
|
const index = siblings.indexOf(current);
|
|
2566
2429
|
if (index !== -1) {
|
|
@@ -2596,15 +2459,15 @@ function createHtmlLoader() {
|
|
|
2596
2459
|
}
|
|
2597
2460
|
});
|
|
2598
2461
|
Array.from(element.childNodes).filter(
|
|
2599
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2462
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _115 => _115.textContent, 'optionalAccess', _116 => _116.trim, 'call', _117 => _117()])
|
|
2600
2463
|
).forEach(processNode);
|
|
2601
2464
|
}
|
|
2602
2465
|
};
|
|
2603
2466
|
Array.from(document.head.childNodes).filter(
|
|
2604
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2467
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _118 => _118.textContent, 'optionalAccess', _119 => _119.trim, 'call', _120 => _120()])
|
|
2605
2468
|
).forEach(processNode);
|
|
2606
2469
|
Array.from(document.body.childNodes).filter(
|
|
2607
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2470
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _121 => _121.textContent, 'optionalAccess', _122 => _122.trim, 'call', _123 => _123()])
|
|
2608
2471
|
).forEach(processNode);
|
|
2609
2472
|
return result;
|
|
2610
2473
|
},
|
|
@@ -2629,7 +2492,7 @@ function createHtmlLoader() {
|
|
|
2629
2492
|
for (let i = 0; i < indices.length; i++) {
|
|
2630
2493
|
const index = parseInt(indices[i]);
|
|
2631
2494
|
const siblings = Array.from(parent.childNodes).filter(
|
|
2632
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2495
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _124 => _124.textContent, 'optionalAccess', _125 => _125.trim, 'call', _126 => _126()])
|
|
2633
2496
|
);
|
|
2634
2497
|
if (index >= siblings.length) {
|
|
2635
2498
|
if (i === indices.length - 1) {
|
|
@@ -2680,7 +2543,7 @@ function createMarkdownLoader() {
|
|
|
2680
2543
|
yaml: yamlEngine
|
|
2681
2544
|
}
|
|
2682
2545
|
});
|
|
2683
|
-
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess',
|
|
2546
|
+
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _127 => _127.trim, 'call', _128 => _128()]), () => ( ""))).filter(Boolean);
|
|
2684
2547
|
return {
|
|
2685
2548
|
...Object.fromEntries(
|
|
2686
2549
|
sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
|
|
@@ -2699,7 +2562,7 @@ function createMarkdownLoader() {
|
|
|
2699
2562
|
);
|
|
2700
2563
|
let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(
|
|
2701
2564
|
([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())
|
|
2702
|
-
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess',
|
|
2565
|
+
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _129 => _129.trim, 'call', _130 => _130()]), () => ( ""))).filter(Boolean).join("\n\n");
|
|
2703
2566
|
if (Object.keys(frontmatter).length > 0) {
|
|
2704
2567
|
content = `
|
|
2705
2568
|
${content}`;
|
|
@@ -2724,7 +2587,7 @@ function createMarkdocLoader() {
|
|
|
2724
2587
|
const result = {};
|
|
2725
2588
|
const counters = {};
|
|
2726
2589
|
traverseAndExtract(ast, "", result, counters);
|
|
2727
|
-
if (_optionalChain([ast, 'access',
|
|
2590
|
+
if (_optionalChain([ast, 'access', _131 => _131.attributes, 'optionalAccess', _132 => _132.frontmatter])) {
|
|
2728
2591
|
const frontmatter = _yaml2.default.parse(ast.attributes.frontmatter);
|
|
2729
2592
|
Object.entries(frontmatter).forEach(([key, value]) => {
|
|
2730
2593
|
if (typeof value === "string") {
|
|
@@ -2770,7 +2633,7 @@ function traverseAndExtract(node, path19, result, counters, parentType) {
|
|
|
2770
2633
|
if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
|
|
2771
2634
|
semanticType = nodeSemanticType;
|
|
2772
2635
|
}
|
|
2773
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
2636
|
+
if (node.type === "text" && _optionalChain([node, 'access', _133 => _133.attributes, 'optionalAccess', _134 => _134.content])) {
|
|
2774
2637
|
const content = node.attributes.content;
|
|
2775
2638
|
if (typeof content === "string" && content.trim()) {
|
|
2776
2639
|
if (semanticType) {
|
|
@@ -2797,7 +2660,7 @@ function buildPathMap(node, path19, counters, pathMap, parentType) {
|
|
|
2797
2660
|
if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
|
|
2798
2661
|
semanticType = nodeSemanticType;
|
|
2799
2662
|
}
|
|
2800
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
2663
|
+
if (node.type === "text" && _optionalChain([node, 'access', _135 => _135.attributes, 'optionalAccess', _136 => _136.content])) {
|
|
2801
2664
|
const content = node.attributes.content;
|
|
2802
2665
|
if (typeof content === "string" && content.trim()) {
|
|
2803
2666
|
if (semanticType) {
|
|
@@ -2820,7 +2683,7 @@ function applyTranslations(node, path19, data, pathMap) {
|
|
|
2820
2683
|
if (!node || typeof node !== "object") {
|
|
2821
2684
|
return;
|
|
2822
2685
|
}
|
|
2823
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
2686
|
+
if (node.type === "text" && _optionalChain([node, 'access', _137 => _137.attributes, 'optionalAccess', _138 => _138.content])) {
|
|
2824
2687
|
const content = node.attributes.content;
|
|
2825
2688
|
if (typeof content === "string") {
|
|
2826
2689
|
const contentPath = path19 ? `${path19}/attributes/content` : "attributes/content";
|
|
@@ -2859,7 +2722,7 @@ function createPropertiesLoader() {
|
|
|
2859
2722
|
return result;
|
|
2860
2723
|
},
|
|
2861
2724
|
async push(locale, payload) {
|
|
2862
|
-
const result = Object.entries(payload).filter(([
|
|
2725
|
+
const result = Object.entries(payload).filter(([_36, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
|
|
2863
2726
|
return result;
|
|
2864
2727
|
}
|
|
2865
2728
|
});
|
|
@@ -2870,7 +2733,7 @@ function isSkippableLine(line) {
|
|
|
2870
2733
|
function parsePropertyLine(line) {
|
|
2871
2734
|
const [key, ...valueParts] = line.split("=");
|
|
2872
2735
|
return {
|
|
2873
|
-
key: _optionalChain([key, 'optionalAccess',
|
|
2736
|
+
key: _optionalChain([key, 'optionalAccess', _139 => _139.trim, 'call', _140 => _140()]) || "",
|
|
2874
2737
|
value: valueParts.join("=").trim()
|
|
2875
2738
|
};
|
|
2876
2739
|
}
|
|
@@ -2958,7 +2821,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
2958
2821
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
2959
2822
|
continue;
|
|
2960
2823
|
}
|
|
2961
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
2824
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _141 => _141.localizations, 'optionalAccess', _142 => _142[locale]]);
|
|
2962
2825
|
if (langTranslationEntity) {
|
|
2963
2826
|
if ("stringUnit" in langTranslationEntity) {
|
|
2964
2827
|
resultData[translationKey] = langTranslationEntity.stringUnit.value;
|
|
@@ -2967,7 +2830,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
2967
2830
|
resultData[translationKey] = {};
|
|
2968
2831
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
2969
2832
|
for (const form in pluralForms) {
|
|
2970
|
-
if (_optionalChain([pluralForms, 'access',
|
|
2833
|
+
if (_optionalChain([pluralForms, 'access', _143 => _143[form], 'optionalAccess', _144 => _144.stringUnit, 'optionalAccess', _145 => _145.value])) {
|
|
2971
2834
|
resultData[translationKey][form] = pluralForms[form].stringUnit.value;
|
|
2972
2835
|
}
|
|
2973
2836
|
}
|
|
@@ -2993,7 +2856,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
2993
2856
|
const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
|
|
2994
2857
|
if (typeof value === "string") {
|
|
2995
2858
|
langDataToMerge.strings[key] = {
|
|
2996
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
2859
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _146 => _146.strings, 'optionalAccess', _147 => _147[key], 'optionalAccess', _148 => _148.extractionState]),
|
|
2997
2860
|
localizations: {
|
|
2998
2861
|
[locale]: {
|
|
2999
2862
|
stringUnit: {
|
|
@@ -3051,7 +2914,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
3051
2914
|
for (const [locale, localization] of Object.entries(
|
|
3052
2915
|
entity.localizations
|
|
3053
2916
|
)) {
|
|
3054
|
-
if (_optionalChain([localization, 'access',
|
|
2917
|
+
if (_optionalChain([localization, 'access', _149 => _149.variations, 'optionalAccess', _150 => _150.plural])) {
|
|
3055
2918
|
const pluralForms = localization.variations.plural;
|
|
3056
2919
|
for (const form in pluralForms) {
|
|
3057
2920
|
const pluralKey = `${translationKey}/${form}`;
|
|
@@ -3071,7 +2934,7 @@ function _removeLocale(input2, locale) {
|
|
|
3071
2934
|
const { strings } = input2;
|
|
3072
2935
|
const newStrings = _lodash2.default.cloneDeep(strings);
|
|
3073
2936
|
for (const [key, value] of Object.entries(newStrings)) {
|
|
3074
|
-
if (_optionalChain([value, 'access',
|
|
2937
|
+
if (_optionalChain([value, 'access', _151 => _151.localizations, 'optionalAccess', _152 => _152[locale]])) {
|
|
3075
2938
|
delete value.localizations[locale];
|
|
3076
2939
|
}
|
|
3077
2940
|
}
|
|
@@ -3088,12 +2951,12 @@ function createUnlocalizableLoader(returnUnlocalizedKeys = false) {
|
|
|
3088
2951
|
const unlocalizableKeys = _getUnlocalizableKeys(input2);
|
|
3089
2952
|
const result = _lodash2.default.omitBy(
|
|
3090
2953
|
input2,
|
|
3091
|
-
(
|
|
2954
|
+
(_36, key) => unlocalizableKeys.includes(key)
|
|
3092
2955
|
);
|
|
3093
2956
|
if (returnUnlocalizedKeys) {
|
|
3094
2957
|
result.unlocalizable = _lodash2.default.omitBy(
|
|
3095
2958
|
input2,
|
|
3096
|
-
(
|
|
2959
|
+
(_36, key) => !unlocalizableKeys.includes(key)
|
|
3097
2960
|
);
|
|
3098
2961
|
}
|
|
3099
2962
|
return result;
|
|
@@ -3103,7 +2966,7 @@ function createUnlocalizableLoader(returnUnlocalizedKeys = false) {
|
|
|
3103
2966
|
const result = _lodash2.default.merge(
|
|
3104
2967
|
{},
|
|
3105
2968
|
data,
|
|
3106
|
-
_lodash2.default.omitBy(originalInput, (
|
|
2969
|
+
_lodash2.default.omitBy(originalInput, (_36, key) => !unlocalizableKeys.includes(key))
|
|
3107
2970
|
);
|
|
3108
2971
|
return result;
|
|
3109
2972
|
}
|
|
@@ -3134,7 +2997,7 @@ function _getUnlocalizableKeys(input2) {
|
|
|
3134
2997
|
}
|
|
3135
2998
|
}
|
|
3136
2999
|
return false;
|
|
3137
|
-
}).map(([key,
|
|
3000
|
+
}).map(([key, _36]) => key);
|
|
3138
3001
|
}
|
|
3139
3002
|
|
|
3140
3003
|
// src/cli/loaders/formatters/prettier.ts
|
|
@@ -3274,8 +3137,8 @@ async function formatDataWithBiome(data, filePath, options) {
|
|
|
3274
3137
|
});
|
|
3275
3138
|
return formatted.content;
|
|
3276
3139
|
} catch (error) {
|
|
3277
|
-
const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access',
|
|
3278
|
-
if (_optionalChain([errorMessage, 'optionalAccess',
|
|
3140
|
+
const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access', _153 => _153.stackTrace, 'optionalAccess', _154 => _154.toString, 'call', _155 => _155(), 'access', _156 => _156.split, 'call', _157 => _157("\n"), 'access', _158 => _158[0]]) : "";
|
|
3141
|
+
if (_optionalChain([errorMessage, 'optionalAccess', _159 => _159.includes, 'call', _160 => _160("does not exist in the workspace")])) {
|
|
3279
3142
|
} else {
|
|
3280
3143
|
console.log(`\u26A0\uFE0F Biome skipped ${path14.default.basename(filePath)}`);
|
|
3281
3144
|
if (errorMessage) {
|
|
@@ -3322,7 +3185,7 @@ function createPoDataLoader(params) {
|
|
|
3322
3185
|
Object.entries(entries).forEach(([msgid, entry]) => {
|
|
3323
3186
|
if (msgid && entry.msgid) {
|
|
3324
3187
|
const context = entry.msgctxt || "";
|
|
3325
|
-
const fullEntry = _optionalChain([parsedPo, 'access',
|
|
3188
|
+
const fullEntry = _optionalChain([parsedPo, 'access', _161 => _161.translations, 'access', _162 => _162[context], 'optionalAccess', _163 => _163[msgid]]);
|
|
3326
3189
|
if (fullEntry) {
|
|
3327
3190
|
result[msgid] = fullEntry;
|
|
3328
3191
|
}
|
|
@@ -3332,8 +3195,8 @@ function createPoDataLoader(params) {
|
|
|
3332
3195
|
return result;
|
|
3333
3196
|
},
|
|
3334
3197
|
async push(locale, data, originalInput, originalLocale, pullInput) {
|
|
3335
|
-
const currentSections = _optionalChain([pullInput, 'optionalAccess',
|
|
3336
|
-
const originalSections = _optionalChain([originalInput, 'optionalAccess',
|
|
3198
|
+
const currentSections = _optionalChain([pullInput, 'optionalAccess', _164 => _164.split, 'call', _165 => _165("\n\n"), 'access', _166 => _166.filter, 'call', _167 => _167(Boolean)]) || [];
|
|
3199
|
+
const originalSections = _optionalChain([originalInput, 'optionalAccess', _168 => _168.split, 'call', _169 => _169("\n\n"), 'access', _170 => _170.filter, 'call', _171 => _171(Boolean)]) || [];
|
|
3337
3200
|
const result = originalSections.map((section) => {
|
|
3338
3201
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
3339
3202
|
if (Object.keys(sectionPo.translations).length === 0) {
|
|
@@ -3402,8 +3265,8 @@ function createPoContentLoader() {
|
|
|
3402
3265
|
{
|
|
3403
3266
|
...entry,
|
|
3404
3267
|
msgstr: [
|
|
3405
|
-
_optionalChain([data, 'access',
|
|
3406
|
-
_optionalChain([data, 'access',
|
|
3268
|
+
_optionalChain([data, 'access', _172 => _172[entry.msgid], 'optionalAccess', _173 => _173.singular]),
|
|
3269
|
+
_optionalChain([data, 'access', _174 => _174[entry.msgid], 'optionalAccess', _175 => _175.plural]) || null
|
|
3407
3270
|
].filter(Boolean)
|
|
3408
3271
|
}
|
|
3409
3272
|
]).fromPairs().value();
|
|
@@ -3525,7 +3388,7 @@ function pullV1(xliffElement, locale, originalLocale) {
|
|
|
3525
3388
|
let key = getTransUnitKey(unit);
|
|
3526
3389
|
if (!key) return;
|
|
3527
3390
|
if (seenKeys.has(key)) {
|
|
3528
|
-
const id = _optionalChain([unit, 'access',
|
|
3391
|
+
const id = _optionalChain([unit, 'access', _176 => _176.getAttribute, 'call', _177 => _177("id"), 'optionalAccess', _178 => _178.trim, 'call', _179 => _179()]);
|
|
3529
3392
|
if (id) {
|
|
3530
3393
|
key = `${key}#${id}`;
|
|
3531
3394
|
} else {
|
|
@@ -3573,7 +3436,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
3573
3436
|
let key = getTransUnitKey(unit);
|
|
3574
3437
|
if (!key) return;
|
|
3575
3438
|
if (seenKeys.has(key)) {
|
|
3576
|
-
const id = _optionalChain([unit, 'access',
|
|
3439
|
+
const id = _optionalChain([unit, 'access', _180 => _180.getAttribute, 'call', _181 => _181("id"), 'optionalAccess', _182 => _182.trim, 'call', _183 => _183()]);
|
|
3577
3440
|
if (id) {
|
|
3578
3441
|
key = `${key}#${id}`;
|
|
3579
3442
|
} else {
|
|
@@ -3615,7 +3478,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
3615
3478
|
const translationKeys = new Set(Object.keys(translations));
|
|
3616
3479
|
existingUnits.forEach((unit, key) => {
|
|
3617
3480
|
if (!translationKeys.has(key)) {
|
|
3618
|
-
_optionalChain([unit, 'access',
|
|
3481
|
+
_optionalChain([unit, 'access', _184 => _184.parentNode, 'optionalAccess', _185 => _185.removeChild, 'call', _186 => _186(unit)]);
|
|
3619
3482
|
}
|
|
3620
3483
|
});
|
|
3621
3484
|
return serializeWithDeclaration(
|
|
@@ -3658,18 +3521,18 @@ function traverseUnitsV2(container, fileId, currentPath, result) {
|
|
|
3658
3521
|
Array.from(container.children).forEach((child) => {
|
|
3659
3522
|
const tagName = child.tagName;
|
|
3660
3523
|
if (tagName === "unit") {
|
|
3661
|
-
const unitId = _optionalChain([child, 'access',
|
|
3524
|
+
const unitId = _optionalChain([child, 'access', _187 => _187.getAttribute, 'call', _188 => _188("id"), 'optionalAccess', _189 => _189.trim, 'call', _190 => _190()]);
|
|
3662
3525
|
if (!unitId) return;
|
|
3663
3526
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
3664
3527
|
const segment = child.querySelector("segment");
|
|
3665
|
-
const source = _optionalChain([segment, 'optionalAccess',
|
|
3528
|
+
const source = _optionalChain([segment, 'optionalAccess', _191 => _191.querySelector, 'call', _192 => _192("source")]);
|
|
3666
3529
|
if (source) {
|
|
3667
3530
|
result[key] = extractTextContent(source);
|
|
3668
3531
|
} else {
|
|
3669
3532
|
result[key] = unitId;
|
|
3670
3533
|
}
|
|
3671
3534
|
} else if (tagName === "group") {
|
|
3672
|
-
const groupId = _optionalChain([child, 'access',
|
|
3535
|
+
const groupId = _optionalChain([child, 'access', _193 => _193.getAttribute, 'call', _194 => _194("id"), 'optionalAccess', _195 => _195.trim, 'call', _196 => _196()]);
|
|
3673
3536
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
3674
3537
|
traverseUnitsV2(child, fileId, newPath, result);
|
|
3675
3538
|
}
|
|
@@ -3705,12 +3568,12 @@ function indexUnitsV2(container, fileId, currentPath, index) {
|
|
|
3705
3568
|
Array.from(container.children).forEach((child) => {
|
|
3706
3569
|
const tagName = child.tagName;
|
|
3707
3570
|
if (tagName === "unit") {
|
|
3708
|
-
const unitId = _optionalChain([child, 'access',
|
|
3571
|
+
const unitId = _optionalChain([child, 'access', _197 => _197.getAttribute, 'call', _198 => _198("id"), 'optionalAccess', _199 => _199.trim, 'call', _200 => _200()]);
|
|
3709
3572
|
if (!unitId) return;
|
|
3710
3573
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
3711
3574
|
index.set(key, child);
|
|
3712
3575
|
} else if (tagName === "group") {
|
|
3713
|
-
const groupId = _optionalChain([child, 'access',
|
|
3576
|
+
const groupId = _optionalChain([child, 'access', _201 => _201.getAttribute, 'call', _202 => _202("id"), 'optionalAccess', _203 => _203.trim, 'call', _204 => _204()]);
|
|
3714
3577
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
3715
3578
|
indexUnitsV2(child, fileId, newPath, index);
|
|
3716
3579
|
}
|
|
@@ -3731,9 +3594,9 @@ function updateUnitV2(unit, value) {
|
|
|
3731
3594
|
setTextContent(source, value);
|
|
3732
3595
|
}
|
|
3733
3596
|
function getTransUnitKey(transUnit) {
|
|
3734
|
-
const resname = _optionalChain([transUnit, 'access',
|
|
3597
|
+
const resname = _optionalChain([transUnit, 'access', _205 => _205.getAttribute, 'call', _206 => _206("resname"), 'optionalAccess', _207 => _207.trim, 'call', _208 => _208()]);
|
|
3735
3598
|
if (resname) return resname;
|
|
3736
|
-
const id = _optionalChain([transUnit, 'access',
|
|
3599
|
+
const id = _optionalChain([transUnit, 'access', _209 => _209.getAttribute, 'call', _210 => _210("id"), 'optionalAccess', _211 => _211.trim, 'call', _212 => _212()]);
|
|
3737
3600
|
if (id) return id;
|
|
3738
3601
|
const sourceElement = transUnit.querySelector("source");
|
|
3739
3602
|
if (sourceElement) {
|
|
@@ -3790,7 +3653,7 @@ function formatXml(xml) {
|
|
|
3790
3653
|
if (cdataNode) {
|
|
3791
3654
|
return `${indent2}${openTag}<![CDATA[${cdataNode.nodeValue}]]></${tagName}>`;
|
|
3792
3655
|
}
|
|
3793
|
-
const textContent = _optionalChain([element, 'access',
|
|
3656
|
+
const textContent = _optionalChain([element, 'access', _213 => _213.textContent, 'optionalAccess', _214 => _214.trim, 'call', _215 => _215()]) || "";
|
|
3794
3657
|
const hasOnlyText = element.childNodes.length === 1 && element.childNodes[0].nodeType === 3;
|
|
3795
3658
|
if (hasOnlyText && textContent) {
|
|
3796
3659
|
return `${indent2}${openTag}${textContent}</${tagName}>`;
|
|
@@ -4083,7 +3946,7 @@ function createDatoClient(params) {
|
|
|
4083
3946
|
ids: !records.length ? void 0 : records.join(",")
|
|
4084
3947
|
}
|
|
4085
3948
|
}).catch(
|
|
4086
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
3949
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _216 => _216.response, 'optionalAccess', _217 => _217.body, 'optionalAccess', _218 => _218.data, 'optionalAccess', _219 => _219[0]]) || error)
|
|
4087
3950
|
);
|
|
4088
3951
|
},
|
|
4089
3952
|
findRecordsForModel: async (modelId, records) => {
|
|
@@ -4094,10 +3957,10 @@ function createDatoClient(params) {
|
|
|
4094
3957
|
filter: {
|
|
4095
3958
|
type: modelId,
|
|
4096
3959
|
only_valid: "true",
|
|
4097
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
3960
|
+
ids: !_optionalChain([records, 'optionalAccess', _220 => _220.length]) ? void 0 : records.join(",")
|
|
4098
3961
|
}
|
|
4099
3962
|
}).catch(
|
|
4100
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
3963
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _221 => _221.response, 'optionalAccess', _222 => _222.body, 'optionalAccess', _223 => _223.data, 'optionalAccess', _224 => _224[0]]) || error)
|
|
4101
3964
|
);
|
|
4102
3965
|
return result;
|
|
4103
3966
|
} catch (_error) {
|
|
@@ -4113,10 +3976,10 @@ function createDatoClient(params) {
|
|
|
4113
3976
|
updateRecord: async (id, payload) => {
|
|
4114
3977
|
try {
|
|
4115
3978
|
await dato.items.update(id, payload).catch(
|
|
4116
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
3979
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _225 => _225.response, 'optionalAccess', _226 => _226.body, 'optionalAccess', _227 => _227.data, 'optionalAccess', _228 => _228[0]]) || error)
|
|
4117
3980
|
);
|
|
4118
3981
|
} catch (_error) {
|
|
4119
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
3982
|
+
if (_optionalChain([_error, 'optionalAccess', _229 => _229.attributes, 'optionalAccess', _230 => _230.details, 'optionalAccess', _231 => _231.message])) {
|
|
4120
3983
|
throw new Error(
|
|
4121
3984
|
[
|
|
4122
3985
|
`${_error.attributes.details.message}`,
|
|
@@ -4138,10 +4001,10 @@ function createDatoClient(params) {
|
|
|
4138
4001
|
enableFieldLocalization: async (args) => {
|
|
4139
4002
|
try {
|
|
4140
4003
|
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch(
|
|
4141
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
4004
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _232 => _232.response, 'optionalAccess', _233 => _233.body, 'optionalAccess', _234 => _234.data, 'optionalAccess', _235 => _235[0]]) || error)
|
|
4142
4005
|
);
|
|
4143
4006
|
} catch (_error) {
|
|
4144
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
4007
|
+
if (_optionalChain([_error, 'optionalAccess', _236 => _236.attributes, 'optionalAccess', _237 => _237.code]) === "NOT_FOUND") {
|
|
4145
4008
|
throw new Error(
|
|
4146
4009
|
[
|
|
4147
4010
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -4149,7 +4012,7 @@ function createDatoClient(params) {
|
|
|
4149
4012
|
].join("\n\n")
|
|
4150
4013
|
);
|
|
4151
4014
|
}
|
|
4152
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
4015
|
+
if (_optionalChain([_error, 'optionalAccess', _238 => _238.attributes, 'optionalAccess', _239 => _239.details, 'optionalAccess', _240 => _240.message])) {
|
|
4153
4016
|
throw new Error(
|
|
4154
4017
|
[
|
|
4155
4018
|
`${_error.attributes.details.message}`,
|
|
@@ -4227,7 +4090,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
4227
4090
|
const records = await dato.findRecordsForModel(modelId);
|
|
4228
4091
|
const recordChoices = createRecordChoices(
|
|
4229
4092
|
records,
|
|
4230
|
-
_optionalChain([config, 'access',
|
|
4093
|
+
_optionalChain([config, 'access', _241 => _241.models, 'access', _242 => _242[modelId], 'optionalAccess', _243 => _243.records]) || [],
|
|
4231
4094
|
project
|
|
4232
4095
|
);
|
|
4233
4096
|
const selectedRecords = await promptRecordSelection(
|
|
@@ -4246,14 +4109,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
4246
4109
|
},
|
|
4247
4110
|
async pull(locale, input2, initCtx) {
|
|
4248
4111
|
const result = {};
|
|
4249
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
4250
|
-
let records = _optionalChain([initCtx, 'optionalAccess',
|
|
4112
|
+
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _244 => _244.models]) || {})) {
|
|
4113
|
+
let records = _optionalChain([initCtx, 'optionalAccess', _245 => _245.models, 'access', _246 => _246[modelId], 'access', _247 => _247.records]) || [];
|
|
4251
4114
|
const recordIds = records.map((record) => record.id);
|
|
4252
4115
|
records = await dato.findRecords(recordIds);
|
|
4253
4116
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
4254
4117
|
if (records.length > 0) {
|
|
4255
4118
|
result[modelId] = {
|
|
4256
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
4119
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _248 => _248.models, 'optionalAccess', _249 => _249[modelId], 'optionalAccess', _250 => _250.fields]) || [],
|
|
4257
4120
|
records
|
|
4258
4121
|
};
|
|
4259
4122
|
}
|
|
@@ -4316,7 +4179,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
4316
4179
|
return records.map((record) => ({
|
|
4317
4180
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
4318
4181
|
value: record.id,
|
|
4319
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
4182
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _251 => _251.includes, 'call', _252 => _252(record.id)])
|
|
4320
4183
|
}));
|
|
4321
4184
|
}
|
|
4322
4185
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -4635,7 +4498,7 @@ function createVttLoader() {
|
|
|
4635
4498
|
if (!input2) {
|
|
4636
4499
|
return "";
|
|
4637
4500
|
}
|
|
4638
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
4501
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _253 => _253.parse, 'call', _254 => _254(input2), 'optionalAccess', _255 => _255.cues]);
|
|
4639
4502
|
if (Object.keys(vtt).length === 0) {
|
|
4640
4503
|
return {};
|
|
4641
4504
|
} else {
|
|
@@ -4689,7 +4552,7 @@ function variableExtractLoader(params) {
|
|
|
4689
4552
|
for (let i = 0; i < matches.length; i++) {
|
|
4690
4553
|
const match2 = matches[i];
|
|
4691
4554
|
const currentValue = result[key].value;
|
|
4692
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
4555
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _256 => _256.replace, 'call', _257 => _257(match2, `{variable:${i}}`)]);
|
|
4693
4556
|
result[key].value = newValue;
|
|
4694
4557
|
result[key].variables[i] = match2;
|
|
4695
4558
|
}
|
|
@@ -4703,7 +4566,7 @@ function variableExtractLoader(params) {
|
|
|
4703
4566
|
for (let i = 0; i < valueObj.variables.length; i++) {
|
|
4704
4567
|
const variable = valueObj.variables[i];
|
|
4705
4568
|
const currentValue = result[key];
|
|
4706
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
4569
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _258 => _258.replace, 'call', _259 => _259(`{variable:${i}}`, variable)]);
|
|
4707
4570
|
result[key] = newValue;
|
|
4708
4571
|
}
|
|
4709
4572
|
}
|
|
@@ -4903,7 +4766,7 @@ function createVueJsonLoader() {
|
|
|
4903
4766
|
return createLoader({
|
|
4904
4767
|
pull: async (locale, input2, ctx) => {
|
|
4905
4768
|
const parsed = parseVueFile(input2);
|
|
4906
|
-
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess',
|
|
4769
|
+
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _260 => _260.i18n, 'optionalAccess', _261 => _261[locale]]), () => ( {}));
|
|
4907
4770
|
},
|
|
4908
4771
|
push: async (locale, data, originalInput) => {
|
|
4909
4772
|
const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
|
|
@@ -5088,7 +4951,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
|
|
|
5088
4951
|
objectExpression.properties.forEach((prop) => {
|
|
5089
4952
|
if (!t.isObjectProperty(prop)) return;
|
|
5090
4953
|
const key = getPropertyKey(prop);
|
|
5091
|
-
const incomingVal = _optionalChain([data, 'optionalAccess',
|
|
4954
|
+
const incomingVal = _optionalChain([data, 'optionalAccess', _262 => _262[key]]);
|
|
5092
4955
|
if (incomingVal === void 0) {
|
|
5093
4956
|
return;
|
|
5094
4957
|
}
|
|
@@ -5124,7 +4987,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
|
|
|
5124
4987
|
let modified = false;
|
|
5125
4988
|
arrayExpression.elements.forEach((element, index) => {
|
|
5126
4989
|
if (!element) return;
|
|
5127
|
-
const incomingVal = _optionalChain([incoming, 'optionalAccess',
|
|
4990
|
+
const incomingVal = _optionalChain([incoming, 'optionalAccess', _263 => _263[index]]);
|
|
5128
4991
|
if (incomingVal === void 0) return;
|
|
5129
4992
|
if (t.isStringLiteral(element) && typeof incomingVal === "string") {
|
|
5130
4993
|
if (element.value !== incomingVal) {
|
|
@@ -5615,7 +5478,7 @@ var AST = class _AST {
|
|
|
5615
5478
|
const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
|
|
5616
5479
|
if (this.isStart() && !this.type)
|
|
5617
5480
|
ret.unshift([]);
|
|
5618
|
-
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
5481
|
+
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _264 => _264.#parent, 'optionalAccess', _265 => _265.type]) === "!")) {
|
|
5619
5482
|
ret.push({});
|
|
5620
5483
|
}
|
|
5621
5484
|
return ret;
|
|
@@ -5623,7 +5486,7 @@ var AST = class _AST {
|
|
|
5623
5486
|
isStart() {
|
|
5624
5487
|
if (this.#root === this)
|
|
5625
5488
|
return true;
|
|
5626
|
-
if (!_optionalChain([this, 'access',
|
|
5489
|
+
if (!_optionalChain([this, 'access', _266 => _266.#parent, 'optionalAccess', _267 => _267.isStart, 'call', _268 => _268()]))
|
|
5627
5490
|
return false;
|
|
5628
5491
|
if (this.#parentIndex === 0)
|
|
5629
5492
|
return true;
|
|
@@ -5639,12 +5502,12 @@ var AST = class _AST {
|
|
|
5639
5502
|
isEnd() {
|
|
5640
5503
|
if (this.#root === this)
|
|
5641
5504
|
return true;
|
|
5642
|
-
if (_optionalChain([this, 'access',
|
|
5505
|
+
if (_optionalChain([this, 'access', _269 => _269.#parent, 'optionalAccess', _270 => _270.type]) === "!")
|
|
5643
5506
|
return true;
|
|
5644
|
-
if (!_optionalChain([this, 'access',
|
|
5507
|
+
if (!_optionalChain([this, 'access', _271 => _271.#parent, 'optionalAccess', _272 => _272.isEnd, 'call', _273 => _273()]))
|
|
5645
5508
|
return false;
|
|
5646
5509
|
if (!this.type)
|
|
5647
|
-
return _optionalChain([this, 'access',
|
|
5510
|
+
return _optionalChain([this, 'access', _274 => _274.#parent, 'optionalAccess', _275 => _275.isEnd, 'call', _276 => _276()]);
|
|
5648
5511
|
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
|
5649
5512
|
return this.#parentIndex === pl - 1;
|
|
5650
5513
|
}
|
|
@@ -5866,7 +5729,7 @@ var AST = class _AST {
|
|
|
5866
5729
|
if (!this.type) {
|
|
5867
5730
|
const noEmpty = this.isStart() && this.isEnd();
|
|
5868
5731
|
const src = this.#parts.map((p) => {
|
|
5869
|
-
const [re,
|
|
5732
|
+
const [re, _36, hasMagic, uflag] = typeof p === "string" ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
|
5870
5733
|
this.#hasMagic = this.#hasMagic || hasMagic;
|
|
5871
5734
|
this.#uflag = this.#uflag || uflag;
|
|
5872
5735
|
return re;
|
|
@@ -5889,7 +5752,7 @@ var AST = class _AST {
|
|
|
5889
5752
|
}
|
|
5890
5753
|
}
|
|
5891
5754
|
let end = "";
|
|
5892
|
-
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
5755
|
+
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _277 => _277.#parent, 'optionalAccess', _278 => _278.type]) === "!") {
|
|
5893
5756
|
end = "(?:$|\\/)";
|
|
5894
5757
|
}
|
|
5895
5758
|
const final2 = start2 + src + end;
|
|
@@ -5939,7 +5802,7 @@ var AST = class _AST {
|
|
|
5939
5802
|
if (typeof p === "string") {
|
|
5940
5803
|
throw new Error("string type in extglob ast??");
|
|
5941
5804
|
}
|
|
5942
|
-
const [re,
|
|
5805
|
+
const [re, _36, _hasMagic, uflag] = p.toRegExpSource(dot);
|
|
5943
5806
|
this.#uflag = this.#uflag || uflag;
|
|
5944
5807
|
return re;
|
|
5945
5808
|
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
|
|
@@ -6184,7 +6047,7 @@ var Minimatch = class {
|
|
|
6184
6047
|
}
|
|
6185
6048
|
return false;
|
|
6186
6049
|
}
|
|
6187
|
-
debug(...
|
|
6050
|
+
debug(..._36) {
|
|
6188
6051
|
}
|
|
6189
6052
|
make() {
|
|
6190
6053
|
const pattern = this.pattern;
|
|
@@ -6206,7 +6069,7 @@ var Minimatch = class {
|
|
|
6206
6069
|
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
6207
6070
|
this.globParts = this.preprocess(rawGlobParts);
|
|
6208
6071
|
this.debug(this.pattern, this.globParts);
|
|
6209
|
-
let set = this.globParts.map((s,
|
|
6072
|
+
let set = this.globParts.map((s, _36, __) => {
|
|
6210
6073
|
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
6211
6074
|
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
6212
6075
|
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
@@ -6764,22 +6627,35 @@ function _getAllKeys(obj, prefix = "") {
|
|
|
6764
6627
|
|
|
6765
6628
|
// src/cli/loaders/locked-keys.ts
|
|
6766
6629
|
|
|
6630
|
+
|
|
6631
|
+
// src/cli/utils/key-matching.ts
|
|
6632
|
+
function matchesKeyPattern(key, patterns) {
|
|
6633
|
+
return patterns.some(
|
|
6634
|
+
(pattern) => key.startsWith(pattern) || minimatch(key, pattern)
|
|
6635
|
+
);
|
|
6636
|
+
}
|
|
6637
|
+
function formatDisplayValue(value, maxLength = 50) {
|
|
6638
|
+
if (typeof value === "string") {
|
|
6639
|
+
return value.length > maxLength ? `${value.substring(0, maxLength)}...` : value;
|
|
6640
|
+
}
|
|
6641
|
+
return JSON.stringify(value);
|
|
6642
|
+
}
|
|
6643
|
+
|
|
6644
|
+
// src/cli/loaders/locked-keys.ts
|
|
6767
6645
|
function createLockedKeysLoader(lockedKeys) {
|
|
6768
6646
|
return createLoader({
|
|
6769
6647
|
pull: async (locale, data) => {
|
|
6770
|
-
return _lodash2.default.pickBy(
|
|
6648
|
+
return _lodash2.default.pickBy(
|
|
6649
|
+
data,
|
|
6650
|
+
(value, key) => !matchesKeyPattern(key, lockedKeys)
|
|
6651
|
+
);
|
|
6771
6652
|
},
|
|
6772
6653
|
push: async (locale, data, originalInput) => {
|
|
6773
|
-
const lockedSubObject = _lodash2.default.chain(originalInput).pickBy((value, key) =>
|
|
6654
|
+
const lockedSubObject = _lodash2.default.chain(originalInput).pickBy((value, key) => matchesKeyPattern(key, lockedKeys)).value();
|
|
6774
6655
|
return _lodash2.default.merge({}, data, lockedSubObject);
|
|
6775
6656
|
}
|
|
6776
6657
|
});
|
|
6777
6658
|
}
|
|
6778
|
-
function _isLockedKey(key, lockedKeys) {
|
|
6779
|
-
return lockedKeys.some(
|
|
6780
|
-
(lockedKey) => key.startsWith(lockedKey) || minimatch(key, lockedKey)
|
|
6781
|
-
);
|
|
6782
|
-
}
|
|
6783
6659
|
|
|
6784
6660
|
// src/cli/loaders/mdx2/frontmatter-split.ts
|
|
6785
6661
|
|
|
@@ -6966,7 +6842,7 @@ function createMdxSectionsSplit2Loader() {
|
|
|
6966
6842
|
const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
|
|
6967
6843
|
const result = {
|
|
6968
6844
|
frontmatter: data.frontmatter,
|
|
6969
|
-
codePlaceholders: _optionalChain([pullInput, 'optionalAccess',
|
|
6845
|
+
codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _279 => _279.codePlaceholders]) || {},
|
|
6970
6846
|
content
|
|
6971
6847
|
};
|
|
6972
6848
|
return result;
|
|
@@ -7035,25 +6911,20 @@ function createIgnoredKeysLoader(ignoredKeys) {
|
|
|
7035
6911
|
pull: async (locale, data) => {
|
|
7036
6912
|
const result = _lodash2.default.omitBy(
|
|
7037
6913
|
data,
|
|
7038
|
-
(value, key) =>
|
|
6914
|
+
(value, key) => matchesKeyPattern(key, ignoredKeys)
|
|
7039
6915
|
);
|
|
7040
6916
|
return result;
|
|
7041
6917
|
},
|
|
7042
6918
|
push: async (locale, data, originalInput, originalLocale, pullInput) => {
|
|
7043
6919
|
const ignoredSubObject = _lodash2.default.pickBy(
|
|
7044
6920
|
pullInput,
|
|
7045
|
-
(value, key) =>
|
|
6921
|
+
(value, key) => matchesKeyPattern(key, ignoredKeys)
|
|
7046
6922
|
);
|
|
7047
6923
|
const result = _lodash2.default.merge({}, data, ignoredSubObject);
|
|
7048
6924
|
return result;
|
|
7049
6925
|
}
|
|
7050
6926
|
});
|
|
7051
6927
|
}
|
|
7052
|
-
function _isIgnoredKey(key, ignoredKeys) {
|
|
7053
|
-
return ignoredKeys.some(
|
|
7054
|
-
(ignoredKey) => key.startsWith(ignoredKey) || minimatch(key, ignoredKey)
|
|
7055
|
-
);
|
|
7056
|
-
}
|
|
7057
6928
|
|
|
7058
6929
|
// src/cli/loaders/ejs.ts
|
|
7059
6930
|
function parseEjsForTranslation(input2) {
|
|
@@ -7237,7 +7108,7 @@ function createTxtLoader() {
|
|
|
7237
7108
|
const sortedEntries = Object.entries(payload).sort(
|
|
7238
7109
|
([a], [b]) => parseInt(a) - parseInt(b)
|
|
7239
7110
|
);
|
|
7240
|
-
return sortedEntries.map(([
|
|
7111
|
+
return sortedEntries.map(([_36, value]) => value).join("\n");
|
|
7241
7112
|
}
|
|
7242
7113
|
});
|
|
7243
7114
|
}
|
|
@@ -7613,8 +7484,277 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
7613
7484
|
}
|
|
7614
7485
|
}
|
|
7615
7486
|
|
|
7487
|
+
// src/cli/cmd/show/_shared-key-command.ts
|
|
7488
|
+
async function executeKeyCommand(i18nConfig, buckets, options, config) {
|
|
7489
|
+
let hasAnyKeys = false;
|
|
7490
|
+
for (const bucket of buckets) {
|
|
7491
|
+
if (options.bucket && bucket.type !== options.bucket) {
|
|
7492
|
+
continue;
|
|
7493
|
+
}
|
|
7494
|
+
const keyPatterns = bucket[config.filterType];
|
|
7495
|
+
if (!keyPatterns || keyPatterns.length === 0) {
|
|
7496
|
+
continue;
|
|
7497
|
+
}
|
|
7498
|
+
hasAnyKeys = true;
|
|
7499
|
+
console.log(`
|
|
7500
|
+
Bucket: ${bucket.type}`);
|
|
7501
|
+
console.log(
|
|
7502
|
+
`${capitalize(config.displayName)} key patterns: ${keyPatterns.join(", ")}`
|
|
7503
|
+
);
|
|
7504
|
+
for (const bucketConfig of bucket.paths) {
|
|
7505
|
+
const sourceLocale = __spec.resolveOverriddenLocale.call(void 0,
|
|
7506
|
+
i18nConfig.locale.source,
|
|
7507
|
+
bucketConfig.delimiter
|
|
7508
|
+
);
|
|
7509
|
+
const sourcePath = bucketConfig.pathPattern.replace(
|
|
7510
|
+
/\[locale\]/g,
|
|
7511
|
+
sourceLocale
|
|
7512
|
+
);
|
|
7513
|
+
try {
|
|
7514
|
+
const loader = createBucketLoader(
|
|
7515
|
+
bucket.type,
|
|
7516
|
+
bucketConfig.pathPattern,
|
|
7517
|
+
{
|
|
7518
|
+
defaultLocale: sourceLocale,
|
|
7519
|
+
injectLocale: bucket.injectLocale
|
|
7520
|
+
},
|
|
7521
|
+
[],
|
|
7522
|
+
// Don't apply any filtering when reading
|
|
7523
|
+
[],
|
|
7524
|
+
[]
|
|
7525
|
+
);
|
|
7526
|
+
loader.setDefaultLocale(sourceLocale);
|
|
7527
|
+
const data = await loader.pull(sourceLocale);
|
|
7528
|
+
if (!data || Object.keys(data).length === 0) {
|
|
7529
|
+
continue;
|
|
7530
|
+
}
|
|
7531
|
+
const matchedEntries = Object.entries(data).filter(
|
|
7532
|
+
([key]) => matchesKeyPattern(key, keyPatterns)
|
|
7533
|
+
);
|
|
7534
|
+
if (matchedEntries.length > 0) {
|
|
7535
|
+
console.log(`
|
|
7536
|
+
Matches in ${sourcePath}:`);
|
|
7537
|
+
for (const [key, value] of matchedEntries) {
|
|
7538
|
+
const displayValue = formatDisplayValue(value);
|
|
7539
|
+
console.log(` - ${key}: ${displayValue}`);
|
|
7540
|
+
}
|
|
7541
|
+
console.log(
|
|
7542
|
+
`Total: ${matchedEntries.length} ${config.displayName} key(s)`
|
|
7543
|
+
);
|
|
7544
|
+
}
|
|
7545
|
+
} catch (error) {
|
|
7546
|
+
console.error(` Error reading ${sourcePath}: ${error.message}`);
|
|
7547
|
+
}
|
|
7548
|
+
}
|
|
7549
|
+
}
|
|
7550
|
+
if (!hasAnyKeys) {
|
|
7551
|
+
if (options.bucket) {
|
|
7552
|
+
console.log(
|
|
7553
|
+
`No ${config.displayName} keys configured for bucket: ${options.bucket}`
|
|
7554
|
+
);
|
|
7555
|
+
} else {
|
|
7556
|
+
console.log(`No ${config.displayName} keys configured in any bucket.`);
|
|
7557
|
+
}
|
|
7558
|
+
}
|
|
7559
|
+
}
|
|
7560
|
+
function capitalize(str) {
|
|
7561
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
7562
|
+
}
|
|
7563
|
+
|
|
7564
|
+
// src/cli/cmd/show/locked-keys.ts
|
|
7565
|
+
var locked_keys_default = new (0, _interactivecommander.Command)().command("locked-keys").description(
|
|
7566
|
+
"Show which key-value pairs in source files match lockedKeys patterns"
|
|
7567
|
+
).option("--bucket <name>", "Only show locked keys for a specific bucket").helpOption("-h, --help", "Show help").action(async (options) => {
|
|
7568
|
+
const ora = _ora2.default.call(void 0, );
|
|
7569
|
+
try {
|
|
7570
|
+
const i18nConfig = await getConfig();
|
|
7571
|
+
if (!i18nConfig) {
|
|
7572
|
+
throw new CLIError({
|
|
7573
|
+
message: "i18n.json not found. Please run `lingo.dev init` to initialize the project.",
|
|
7574
|
+
docUrl: "i18nNotFound"
|
|
7575
|
+
});
|
|
7576
|
+
}
|
|
7577
|
+
const buckets = getBuckets(i18nConfig);
|
|
7578
|
+
await executeKeyCommand(i18nConfig, buckets, options, {
|
|
7579
|
+
filterType: "lockedKeys",
|
|
7580
|
+
displayName: "locked"
|
|
7581
|
+
});
|
|
7582
|
+
} catch (error) {
|
|
7583
|
+
ora.fail(error.message);
|
|
7584
|
+
process.exit(1);
|
|
7585
|
+
}
|
|
7586
|
+
});
|
|
7587
|
+
|
|
7588
|
+
// src/cli/cmd/show/ignored-keys.ts
|
|
7589
|
+
|
|
7590
|
+
|
|
7591
|
+
var ignored_keys_default = new (0, _interactivecommander.Command)().command("ignored-keys").description(
|
|
7592
|
+
"Show which key-value pairs in source files match ignoredKeys patterns"
|
|
7593
|
+
).option("--bucket <name>", "Only show ignored keys for a specific bucket").helpOption("-h, --help", "Show help").action(async (options) => {
|
|
7594
|
+
const ora = _ora2.default.call(void 0, );
|
|
7595
|
+
try {
|
|
7596
|
+
const i18nConfig = await getConfig();
|
|
7597
|
+
if (!i18nConfig) {
|
|
7598
|
+
throw new CLIError({
|
|
7599
|
+
message: "i18n.json not found. Please run `lingo.dev init` to initialize the project.",
|
|
7600
|
+
docUrl: "i18nNotFound"
|
|
7601
|
+
});
|
|
7602
|
+
}
|
|
7603
|
+
const buckets = getBuckets(i18nConfig);
|
|
7604
|
+
await executeKeyCommand(i18nConfig, buckets, options, {
|
|
7605
|
+
filterType: "ignoredKeys",
|
|
7606
|
+
displayName: "ignored"
|
|
7607
|
+
});
|
|
7608
|
+
} catch (error) {
|
|
7609
|
+
ora.fail(error.message);
|
|
7610
|
+
process.exit(1);
|
|
7611
|
+
}
|
|
7612
|
+
});
|
|
7613
|
+
|
|
7614
|
+
// src/cli/cmd/show/index.ts
|
|
7615
|
+
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);
|
|
7616
|
+
|
|
7617
|
+
// src/cli/cmd/config/index.ts
|
|
7618
|
+
|
|
7619
|
+
|
|
7620
|
+
// src/cli/cmd/config/set.ts
|
|
7621
|
+
|
|
7622
|
+
|
|
7623
|
+
var _dedent = require('dedent'); var _dedent2 = _interopRequireDefault(_dedent);
|
|
7624
|
+
|
|
7625
|
+
var set_default = new (0, _interactivecommander.Command)().name("set").description("Set or update a CLI setting in ~/.lingodotdevrc").addHelpText("afterAll", `
|
|
7626
|
+
Available keys:
|
|
7627
|
+
${SETTINGS_KEYS.join("\n ")}`).argument(
|
|
7628
|
+
"<key>",
|
|
7629
|
+
"Configuration key to set (dot notation, e.g., auth.apiKey)"
|
|
7630
|
+
).argument("<value>", "The configuration value to set").helpOption("-h, --help", "Show help").action(async (key, value) => {
|
|
7631
|
+
if (!SETTINGS_KEYS.includes(key)) {
|
|
7632
|
+
console.error(
|
|
7633
|
+
_dedent2.default`
|
|
7634
|
+
${_chalk2.default.red("\u2716")} Unknown configuration key: ${_chalk2.default.bold(key)}
|
|
7635
|
+
Run ${_chalk2.default.dim("lingo.dev config set --help")} to see available keys.
|
|
7636
|
+
`
|
|
7637
|
+
);
|
|
7638
|
+
process.exitCode = 1;
|
|
7639
|
+
return;
|
|
7640
|
+
}
|
|
7641
|
+
const current = loadSystemSettings();
|
|
7642
|
+
const updated = _lodash2.default.cloneDeep(current);
|
|
7643
|
+
_lodash2.default.set(updated, key, value);
|
|
7644
|
+
try {
|
|
7645
|
+
saveSettings(updated);
|
|
7646
|
+
console.log(`${_chalk2.default.green("\u2714")} Set ${_chalk2.default.bold(key)}`);
|
|
7647
|
+
} catch (err) {
|
|
7648
|
+
console.error(
|
|
7649
|
+
_chalk2.default.red(
|
|
7650
|
+
`\u2716 Failed to save configuration: ${_chalk2.default.dim(
|
|
7651
|
+
err instanceof Error ? err.message : String(err)
|
|
7652
|
+
)}`
|
|
7653
|
+
)
|
|
7654
|
+
);
|
|
7655
|
+
process.exitCode = 1;
|
|
7656
|
+
}
|
|
7657
|
+
});
|
|
7658
|
+
|
|
7659
|
+
// src/cli/cmd/config/unset.ts
|
|
7660
|
+
|
|
7661
|
+
|
|
7662
|
+
|
|
7663
|
+
|
|
7664
|
+
var unset_default = new (0, _interactivecommander.Command)().name("unset").description("Remove a CLI setting from ~/.lingodotdevrc").addHelpText("afterAll", `
|
|
7665
|
+
Available keys:
|
|
7666
|
+
${SETTINGS_KEYS.join("\n ")}`).argument(
|
|
7667
|
+
"<key>",
|
|
7668
|
+
"Configuration key to remove (must match one of the available keys listed below)"
|
|
7669
|
+
).helpOption("-h, --help", "Show help").action(async (key) => {
|
|
7670
|
+
if (!SETTINGS_KEYS.includes(key)) {
|
|
7671
|
+
console.error(
|
|
7672
|
+
_dedent2.default`
|
|
7673
|
+
${_chalk2.default.red("\u2716")} Unknown configuration key: ${_chalk2.default.bold(key)}
|
|
7674
|
+
Run ${_chalk2.default.dim(
|
|
7675
|
+
"lingo.dev config unset --help"
|
|
7676
|
+
)} to see available keys.
|
|
7677
|
+
`
|
|
7678
|
+
);
|
|
7679
|
+
process.exitCode = 1;
|
|
7680
|
+
return;
|
|
7681
|
+
}
|
|
7682
|
+
const settings = loadSystemSettings();
|
|
7683
|
+
const currentValue = _lodash2.default.get(settings, key);
|
|
7684
|
+
if (!_lodash2.default.trim(String(currentValue || ""))) {
|
|
7685
|
+
console.log(`${_chalk2.default.cyan("\u2139")} ${_chalk2.default.bold(key)} is not set.`);
|
|
7686
|
+
return;
|
|
7687
|
+
} else {
|
|
7688
|
+
const updated = _lodash2.default.cloneDeep(settings);
|
|
7689
|
+
_lodash2.default.unset(updated, key);
|
|
7690
|
+
try {
|
|
7691
|
+
saveSettings(updated);
|
|
7692
|
+
console.log(
|
|
7693
|
+
`${_chalk2.default.green("\u2714")} Removed configuration key ${_chalk2.default.bold(key)}`
|
|
7694
|
+
);
|
|
7695
|
+
} catch (err) {
|
|
7696
|
+
console.error(
|
|
7697
|
+
_chalk2.default.red(
|
|
7698
|
+
`\u2716 Failed to save configuration: ${_chalk2.default.dim(
|
|
7699
|
+
err instanceof Error ? err.message : String(err)
|
|
7700
|
+
)}`
|
|
7701
|
+
)
|
|
7702
|
+
);
|
|
7703
|
+
process.exitCode = 1;
|
|
7704
|
+
}
|
|
7705
|
+
}
|
|
7706
|
+
});
|
|
7707
|
+
|
|
7708
|
+
// src/cli/cmd/config/get.ts
|
|
7709
|
+
|
|
7710
|
+
|
|
7711
|
+
|
|
7712
|
+
|
|
7713
|
+
var get_default = new (0, _interactivecommander.Command)().name("get").description("Display the value of a CLI setting from ~/.lingodotdevrc").addHelpText("afterAll", `
|
|
7714
|
+
Available keys:
|
|
7715
|
+
${SETTINGS_KEYS.join("\n ")}`).argument(
|
|
7716
|
+
"<key>",
|
|
7717
|
+
"Configuration key to read (choose from the available keys listed below)"
|
|
7718
|
+
).helpOption("-h, --help", "Show help").action(async (key) => {
|
|
7719
|
+
if (!SETTINGS_KEYS.includes(key)) {
|
|
7720
|
+
console.error(
|
|
7721
|
+
_dedent2.default`
|
|
7722
|
+
${_chalk2.default.red("\u2716")} Unknown configuration key: ${_chalk2.default.bold(key)}
|
|
7723
|
+
Run ${_chalk2.default.dim("lingo.dev config get --help")} to see available keys.
|
|
7724
|
+
`
|
|
7725
|
+
);
|
|
7726
|
+
process.exitCode = 1;
|
|
7727
|
+
return;
|
|
7728
|
+
}
|
|
7729
|
+
const settings = loadSystemSettings();
|
|
7730
|
+
const value = _lodash2.default.get(settings, key);
|
|
7731
|
+
if (!value) {
|
|
7732
|
+
console.log(`${_chalk2.default.cyan("\u2139")} ${_chalk2.default.bold(key)} is not set.`);
|
|
7733
|
+
return;
|
|
7734
|
+
}
|
|
7735
|
+
if (typeof value === "object") {
|
|
7736
|
+
console.log(JSON.stringify(value, null, 2));
|
|
7737
|
+
} else {
|
|
7738
|
+
console.log(value);
|
|
7739
|
+
}
|
|
7740
|
+
});
|
|
7741
|
+
|
|
7742
|
+
// src/cli/cmd/config/index.ts
|
|
7743
|
+
var config_default2 = new (0, _interactivecommander.Command)().command("config").description(
|
|
7744
|
+
"Manage CLI settings (authentication, API keys) stored in ~/.lingodotdevrc"
|
|
7745
|
+
).helpOption("-h, --help", "Show help").addCommand(set_default).addCommand(unset_default).addCommand(get_default);
|
|
7746
|
+
|
|
7616
7747
|
// src/cli/cmd/i18n.ts
|
|
7617
7748
|
|
|
7749
|
+
|
|
7750
|
+
|
|
7751
|
+
|
|
7752
|
+
|
|
7753
|
+
|
|
7754
|
+
|
|
7755
|
+
|
|
7756
|
+
|
|
7757
|
+
|
|
7618
7758
|
var _diff = require('diff');
|
|
7619
7759
|
|
|
7620
7760
|
var _externaleditor = require('external-editor'); var _externaleditor2 = _interopRequireDefault(_externaleditor);
|
|
@@ -7715,7 +7855,7 @@ function createBasicTranslator(model, systemPrompt, settings = {}) {
|
|
|
7715
7855
|
]
|
|
7716
7856
|
});
|
|
7717
7857
|
const result = JSON.parse(response.text);
|
|
7718
|
-
return _optionalChain([result, 'optionalAccess',
|
|
7858
|
+
return _optionalChain([result, 'optionalAccess', _280 => _280.data]) || {};
|
|
7719
7859
|
}
|
|
7720
7860
|
}
|
|
7721
7861
|
function extractPayloadChunks(payload) {
|
|
@@ -7798,7 +7938,7 @@ function getPureModelProvider(provider) {
|
|
|
7798
7938
|
|
|
7799
7939
|
${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
|
|
7800
7940
|
`;
|
|
7801
|
-
switch (_optionalChain([provider, 'optionalAccess',
|
|
7941
|
+
switch (_optionalChain([provider, 'optionalAccess', _281 => _281.id])) {
|
|
7802
7942
|
case "openai": {
|
|
7803
7943
|
if (!process.env.OPENAI_API_KEY) {
|
|
7804
7944
|
throw new Error(
|
|
@@ -7856,7 +7996,7 @@ function getPureModelProvider(provider) {
|
|
|
7856
7996
|
})(provider.model);
|
|
7857
7997
|
}
|
|
7858
7998
|
default: {
|
|
7859
|
-
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess',
|
|
7999
|
+
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _282 => _282.id])));
|
|
7860
8000
|
}
|
|
7861
8001
|
}
|
|
7862
8002
|
}
|
|
@@ -8141,7 +8281,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
8141
8281
|
validateParams(i18nConfig, flags);
|
|
8142
8282
|
ora.succeed("Localization configuration is valid");
|
|
8143
8283
|
ora.start("Connecting to Lingo.dev Localization Engine...");
|
|
8144
|
-
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess',
|
|
8284
|
+
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _283 => _283.provider]);
|
|
8145
8285
|
if (isByokMode) {
|
|
8146
8286
|
authId = null;
|
|
8147
8287
|
ora.succeed("Using external provider (BYOK mode)");
|
|
@@ -8155,16 +8295,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
8155
8295
|
flags
|
|
8156
8296
|
});
|
|
8157
8297
|
let buckets = getBuckets(i18nConfig);
|
|
8158
|
-
if (_optionalChain([flags, 'access',
|
|
8298
|
+
if (_optionalChain([flags, 'access', _284 => _284.bucket, 'optionalAccess', _285 => _285.length])) {
|
|
8159
8299
|
buckets = buckets.filter(
|
|
8160
8300
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
8161
8301
|
);
|
|
8162
8302
|
}
|
|
8163
8303
|
ora.succeed("Buckets retrieved");
|
|
8164
|
-
if (_optionalChain([flags, 'access',
|
|
8304
|
+
if (_optionalChain([flags, 'access', _286 => _286.file, 'optionalAccess', _287 => _287.length])) {
|
|
8165
8305
|
buckets = buckets.map((bucket) => {
|
|
8166
8306
|
const paths = bucket.paths.filter(
|
|
8167
|
-
(path19) => flags.file.find((file) => _optionalChain([path19, 'access',
|
|
8307
|
+
(path19) => flags.file.find((file) => _optionalChain([path19, 'access', _288 => _288.pathPattern, 'optionalAccess', _289 => _289.includes, 'call', _290 => _290(file)]))
|
|
8168
8308
|
);
|
|
8169
8309
|
return { ...bucket, paths };
|
|
8170
8310
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -8185,7 +8325,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
8185
8325
|
});
|
|
8186
8326
|
}
|
|
8187
8327
|
}
|
|
8188
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
8328
|
+
const targetLocales = _optionalChain([flags, 'access', _291 => _291.locale, 'optionalAccess', _292 => _292.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
8189
8329
|
ora.start("Setting up localization cache...");
|
|
8190
8330
|
const checkLockfileProcessor = createDeltaProcessor("");
|
|
8191
8331
|
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
@@ -8360,7 +8500,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
8360
8500
|
if (flags.key) {
|
|
8361
8501
|
processableData = _lodash2.default.pickBy(
|
|
8362
8502
|
processableData,
|
|
8363
|
-
(
|
|
8503
|
+
(_36, key) => key === flags.key
|
|
8364
8504
|
);
|
|
8365
8505
|
}
|
|
8366
8506
|
if (flags.verbose) {
|
|
@@ -8462,7 +8602,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
8462
8602
|
}
|
|
8463
8603
|
const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
|
|
8464
8604
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
8465
|
-
if (!_optionalChain([flags, 'access',
|
|
8605
|
+
if (!_optionalChain([flags, 'access', _293 => _293.locale, 'optionalAccess', _294 => _294.length])) {
|
|
8466
8606
|
await deltaProcessor.saveChecksums(checksums);
|
|
8467
8607
|
}
|
|
8468
8608
|
}
|
|
@@ -8586,12 +8726,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
8586
8726
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
8587
8727
|
docUrl: "bucketNotFound"
|
|
8588
8728
|
});
|
|
8589
|
-
} else if (_optionalChain([flags, 'access',
|
|
8729
|
+
} else if (_optionalChain([flags, 'access', _295 => _295.locale, 'optionalAccess', _296 => _296.some, 'call', _297 => _297((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
8590
8730
|
throw new ValidationError({
|
|
8591
8731
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
8592
8732
|
docUrl: "localeTargetNotFound"
|
|
8593
8733
|
});
|
|
8594
|
-
} else if (_optionalChain([flags, 'access',
|
|
8734
|
+
} else if (_optionalChain([flags, 'access', _298 => _298.bucket, 'optionalAccess', _299 => _299.some, 'call', _300 => _300(
|
|
8595
8735
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
8596
8736
|
)])) {
|
|
8597
8737
|
throw new ValidationError({
|
|
@@ -8989,7 +9129,7 @@ var _mcpjs = require('@modelcontextprotocol/sdk/server/mcp.js');
|
|
|
8989
9129
|
|
|
8990
9130
|
var mcp_default = new (0, _interactivecommander.Command)().command("mcp").description(
|
|
8991
9131
|
"Start a Model Context Protocol (MCP) server for AI assistant integration"
|
|
8992
|
-
).helpOption("-h, --help", "Show help").action(async (
|
|
9132
|
+
).helpOption("-h, --help", "Show help").action(async (_36, program) => {
|
|
8993
9133
|
const apiKey = program.args[0];
|
|
8994
9134
|
const settings = getSettings(apiKey);
|
|
8995
9135
|
if (!settings.auth.apiKey) {
|
|
@@ -9117,7 +9257,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
|
|
|
9117
9257
|
const response = await engine.whoami();
|
|
9118
9258
|
return {
|
|
9119
9259
|
authenticated: !!response,
|
|
9120
|
-
username: _optionalChain([response, 'optionalAccess',
|
|
9260
|
+
username: _optionalChain([response, 'optionalAccess', _301 => _301.email])
|
|
9121
9261
|
};
|
|
9122
9262
|
} catch (error) {
|
|
9123
9263
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -9233,7 +9373,7 @@ function createExplicitLocalizer(provider) {
|
|
|
9233
9373
|
}
|
|
9234
9374
|
function createAiSdkLocalizer(params) {
|
|
9235
9375
|
const skipAuth = params.skipAuth === true;
|
|
9236
|
-
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
9376
|
+
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _302 => _302.apiKeyName]), () => ( ""))];
|
|
9237
9377
|
if (!skipAuth && !apiKey || !params.apiKeyName) {
|
|
9238
9378
|
throw new Error(
|
|
9239
9379
|
_dedent2.default`
|
|
@@ -9367,8 +9507,8 @@ async function setup(input2) {
|
|
|
9367
9507
|
throw new Error(
|
|
9368
9508
|
"No buckets found in i18n.json. Please add at least one bucket containing i18n content."
|
|
9369
9509
|
);
|
|
9370
|
-
} else if (_optionalChain([ctx, 'access',
|
|
9371
|
-
(bucket) => !_optionalChain([ctx, 'access',
|
|
9510
|
+
} else if (_optionalChain([ctx, 'access', _303 => _303.flags, 'access', _304 => _304.bucket, 'optionalAccess', _305 => _305.some, 'call', _306 => _306(
|
|
9511
|
+
(bucket) => !_optionalChain([ctx, 'access', _307 => _307.config, 'optionalAccess', _308 => _308.buckets, 'access', _309 => _309[bucket]])
|
|
9372
9512
|
)])) {
|
|
9373
9513
|
throw new Error(
|
|
9374
9514
|
`One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
|
|
@@ -9381,7 +9521,7 @@ async function setup(input2) {
|
|
|
9381
9521
|
title: "Selecting localization provider",
|
|
9382
9522
|
task: async (ctx, task) => {
|
|
9383
9523
|
ctx.localizer = createLocalizer(
|
|
9384
|
-
_optionalChain([ctx, 'access',
|
|
9524
|
+
_optionalChain([ctx, 'access', _310 => _310.config, 'optionalAccess', _311 => _311.provider]),
|
|
9385
9525
|
ctx.flags.apiKey
|
|
9386
9526
|
);
|
|
9387
9527
|
if (!ctx.localizer) {
|
|
@@ -9394,7 +9534,7 @@ async function setup(input2) {
|
|
|
9394
9534
|
},
|
|
9395
9535
|
{
|
|
9396
9536
|
title: "Checking authentication",
|
|
9397
|
-
enabled: (ctx) => _optionalChain([ctx, 'access',
|
|
9537
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _312 => _312.localizer, 'optionalAccess', _313 => _313.id]) === "Lingo.dev",
|
|
9398
9538
|
task: async (ctx, task) => {
|
|
9399
9539
|
const authStatus = await ctx.localizer.checkAuth();
|
|
9400
9540
|
if (!authStatus.authenticated) {
|
|
@@ -9407,7 +9547,7 @@ async function setup(input2) {
|
|
|
9407
9547
|
},
|
|
9408
9548
|
{
|
|
9409
9549
|
title: "Validating configuration",
|
|
9410
|
-
enabled: (ctx) => _optionalChain([ctx, 'access',
|
|
9550
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _314 => _314.localizer, 'optionalAccess', _315 => _315.id]) !== "Lingo.dev",
|
|
9411
9551
|
task: async (ctx, task) => {
|
|
9412
9552
|
const validationStatus = await ctx.localizer.validateSettings();
|
|
9413
9553
|
if (!validationStatus.valid) {
|
|
@@ -9616,7 +9756,7 @@ async function execute(input2) {
|
|
|
9616
9756
|
const workerTasks = [];
|
|
9617
9757
|
for (let i = 0; i < workersCount; i++) {
|
|
9618
9758
|
const assignedTasks = ctx.tasks.filter(
|
|
9619
|
-
(
|
|
9759
|
+
(_36, idx) => idx % workersCount === i
|
|
9620
9760
|
);
|
|
9621
9761
|
workerTasks.push(
|
|
9622
9762
|
createWorkerTask({
|
|
@@ -9722,7 +9862,7 @@ function createWorkerTask(args) {
|
|
|
9722
9862
|
const processableData = _lodash2.default.chain(sourceData).entries().filter(
|
|
9723
9863
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
|
|
9724
9864
|
).filter(
|
|
9725
|
-
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access',
|
|
9865
|
+
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _316 => _316.onlyKeys, 'optionalAccess', _317 => _317.some, 'call', _318 => _318(
|
|
9726
9866
|
(pattern) => minimatch(key, pattern)
|
|
9727
9867
|
)])
|
|
9728
9868
|
).fromPairs().value();
|
|
@@ -9790,7 +9930,7 @@ function createWorkerTask(args) {
|
|
|
9790
9930
|
finalRenamedTargetData
|
|
9791
9931
|
);
|
|
9792
9932
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
9793
|
-
if (!_optionalChain([args, 'access',
|
|
9933
|
+
if (!_optionalChain([args, 'access', _319 => _319.ctx, 'access', _320 => _320.flags, 'access', _321 => _321.targetLocale, 'optionalAccess', _322 => _322.length])) {
|
|
9794
9934
|
await deltaProcessor.saveChecksums(checksums);
|
|
9795
9935
|
}
|
|
9796
9936
|
});
|
|
@@ -9987,15 +10127,159 @@ var flagsSchema2 = _zod.z.object({
|
|
|
9987
10127
|
sound: _zod.z.boolean().optional()
|
|
9988
10128
|
});
|
|
9989
10129
|
|
|
10130
|
+
// src/cli/cmd/run/frozen.ts
|
|
10131
|
+
|
|
10132
|
+
|
|
10133
|
+
|
|
10134
|
+
|
|
10135
|
+
async function frozen(input2) {
|
|
10136
|
+
console.log(_chalk2.default.hex(colors.orange)("[Frozen]"));
|
|
10137
|
+
let buckets = getBuckets(input2.config);
|
|
10138
|
+
if (_optionalChain([input2, 'access', _323 => _323.flags, 'access', _324 => _324.bucket, 'optionalAccess', _325 => _325.length])) {
|
|
10139
|
+
buckets = buckets.filter((b) => input2.flags.bucket.includes(b.type));
|
|
10140
|
+
}
|
|
10141
|
+
if (_optionalChain([input2, 'access', _326 => _326.flags, 'access', _327 => _327.file, 'optionalAccess', _328 => _328.length])) {
|
|
10142
|
+
buckets = buckets.map((bucket) => {
|
|
10143
|
+
const paths = bucket.paths.filter(
|
|
10144
|
+
(p) => input2.flags.file.some(
|
|
10145
|
+
(f) => p.pathPattern.includes(f) || minimatch(p.pathPattern, f)
|
|
10146
|
+
)
|
|
10147
|
+
);
|
|
10148
|
+
return { ...bucket, paths };
|
|
10149
|
+
}).filter((bucket) => bucket.paths.length > 0);
|
|
10150
|
+
}
|
|
10151
|
+
const _sourceLocale = input2.flags.sourceLocale || input2.config.locale.source;
|
|
10152
|
+
const _targetLocales = input2.flags.targetLocale || input2.config.locale.targets;
|
|
10153
|
+
return new (0, _listr2.Listr)(
|
|
10154
|
+
[
|
|
10155
|
+
{
|
|
10156
|
+
title: "Setting up localization cache",
|
|
10157
|
+
task: async (_ctx, task) => {
|
|
10158
|
+
const checkLockfileProcessor = createDeltaProcessor("");
|
|
10159
|
+
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
10160
|
+
if (!lockfileExists) {
|
|
10161
|
+
for (const bucket of buckets) {
|
|
10162
|
+
for (const bucketPath of bucket.paths) {
|
|
10163
|
+
const resolvedSourceLocale = __spec.resolveOverriddenLocale.call(void 0,
|
|
10164
|
+
_sourceLocale,
|
|
10165
|
+
bucketPath.delimiter
|
|
10166
|
+
);
|
|
10167
|
+
const loader = createBucketLoader(
|
|
10168
|
+
bucket.type,
|
|
10169
|
+
bucketPath.pathPattern,
|
|
10170
|
+
{
|
|
10171
|
+
defaultLocale: resolvedSourceLocale,
|
|
10172
|
+
injectLocale: bucket.injectLocale,
|
|
10173
|
+
formatter: input2.config.formatter
|
|
10174
|
+
},
|
|
10175
|
+
bucket.lockedKeys,
|
|
10176
|
+
bucket.lockedPatterns,
|
|
10177
|
+
bucket.ignoredKeys
|
|
10178
|
+
);
|
|
10179
|
+
loader.setDefaultLocale(resolvedSourceLocale);
|
|
10180
|
+
await loader.init();
|
|
10181
|
+
const sourceData = await loader.pull(_sourceLocale);
|
|
10182
|
+
const delta = createDeltaProcessor(bucketPath.pathPattern);
|
|
10183
|
+
const checksums = await delta.createChecksums(sourceData);
|
|
10184
|
+
await delta.saveChecksums(checksums);
|
|
10185
|
+
}
|
|
10186
|
+
}
|
|
10187
|
+
task.title = "Localization cache initialized";
|
|
10188
|
+
} else {
|
|
10189
|
+
task.title = "Localization cache loaded";
|
|
10190
|
+
}
|
|
10191
|
+
}
|
|
10192
|
+
},
|
|
10193
|
+
{
|
|
10194
|
+
title: "Validating frozen state",
|
|
10195
|
+
enabled: () => !!input2.flags.frozen,
|
|
10196
|
+
task: async (_ctx, task) => {
|
|
10197
|
+
for (const bucket of buckets) {
|
|
10198
|
+
for (const bucketPath of bucket.paths) {
|
|
10199
|
+
const resolvedSourceLocale = __spec.resolveOverriddenLocale.call(void 0,
|
|
10200
|
+
_sourceLocale,
|
|
10201
|
+
bucketPath.delimiter
|
|
10202
|
+
);
|
|
10203
|
+
const loader = createBucketLoader(
|
|
10204
|
+
bucket.type,
|
|
10205
|
+
bucketPath.pathPattern,
|
|
10206
|
+
{
|
|
10207
|
+
defaultLocale: resolvedSourceLocale,
|
|
10208
|
+
returnUnlocalizedKeys: true,
|
|
10209
|
+
injectLocale: bucket.injectLocale
|
|
10210
|
+
},
|
|
10211
|
+
bucket.lockedKeys
|
|
10212
|
+
);
|
|
10213
|
+
loader.setDefaultLocale(resolvedSourceLocale);
|
|
10214
|
+
await loader.init();
|
|
10215
|
+
const { unlocalizable: srcUnlocalizable, ...src } = await loader.pull(_sourceLocale);
|
|
10216
|
+
const delta = createDeltaProcessor(bucketPath.pathPattern);
|
|
10217
|
+
const sourceChecksums = await delta.createChecksums(src);
|
|
10218
|
+
const savedChecksums = await delta.loadChecksums();
|
|
10219
|
+
const updatedSourceData = _lodash2.default.pickBy(
|
|
10220
|
+
src,
|
|
10221
|
+
(value, key) => sourceChecksums[key] !== savedChecksums[key]
|
|
10222
|
+
);
|
|
10223
|
+
if (Object.keys(updatedSourceData).length > 0) {
|
|
10224
|
+
throw new Error(
|
|
10225
|
+
`Localization data has changed; please update i18n.lock or run without --frozen. Details: Source file has been updated.`
|
|
10226
|
+
);
|
|
10227
|
+
}
|
|
10228
|
+
for (const _tgt of _targetLocales) {
|
|
10229
|
+
const resolvedTargetLocale = __spec.resolveOverriddenLocale.call(void 0,
|
|
10230
|
+
_tgt,
|
|
10231
|
+
bucketPath.delimiter
|
|
10232
|
+
);
|
|
10233
|
+
const { unlocalizable: tgtUnlocalizable, ...tgt } = await loader.pull(resolvedTargetLocale);
|
|
10234
|
+
const missingKeys = _lodash2.default.difference(
|
|
10235
|
+
Object.keys(src),
|
|
10236
|
+
Object.keys(tgt)
|
|
10237
|
+
);
|
|
10238
|
+
if (missingKeys.length > 0) {
|
|
10239
|
+
throw new Error(
|
|
10240
|
+
`Localization data has changed; please update i18n.lock or run without --frozen. Details: Target file is missing translations.`
|
|
10241
|
+
);
|
|
10242
|
+
}
|
|
10243
|
+
const extraKeys = _lodash2.default.difference(
|
|
10244
|
+
Object.keys(tgt),
|
|
10245
|
+
Object.keys(src)
|
|
10246
|
+
);
|
|
10247
|
+
if (extraKeys.length > 0) {
|
|
10248
|
+
throw new Error(
|
|
10249
|
+
`Localization data has changed; please update i18n.lock or run without --frozen. Details: Target file has extra translations not present in the source file.`
|
|
10250
|
+
);
|
|
10251
|
+
}
|
|
10252
|
+
const unlocalizableDataDiff = !_lodash2.default.isEqual(
|
|
10253
|
+
srcUnlocalizable,
|
|
10254
|
+
tgtUnlocalizable
|
|
10255
|
+
);
|
|
10256
|
+
if (unlocalizableDataDiff) {
|
|
10257
|
+
throw new Error(
|
|
10258
|
+
`Localization data has changed; please update i18n.lock or run without --frozen. Details: Unlocalizable data (such as booleans, dates, URLs, etc.) do not match.`
|
|
10259
|
+
);
|
|
10260
|
+
}
|
|
10261
|
+
}
|
|
10262
|
+
}
|
|
10263
|
+
}
|
|
10264
|
+
task.title = "No lockfile updates required";
|
|
10265
|
+
}
|
|
10266
|
+
}
|
|
10267
|
+
],
|
|
10268
|
+
{
|
|
10269
|
+
rendererOptions: commonTaskRendererOptions
|
|
10270
|
+
}
|
|
10271
|
+
).run(input2);
|
|
10272
|
+
}
|
|
10273
|
+
|
|
9990
10274
|
// src/cli/cmd/run/_utils.ts
|
|
9991
10275
|
async function determineAuthId(ctx) {
|
|
9992
|
-
const isByokMode = !!_optionalChain([ctx, 'access',
|
|
10276
|
+
const isByokMode = !!_optionalChain([ctx, 'access', _329 => _329.config, 'optionalAccess', _330 => _330.provider]);
|
|
9993
10277
|
if (isByokMode) {
|
|
9994
10278
|
return null;
|
|
9995
10279
|
} else {
|
|
9996
10280
|
try {
|
|
9997
|
-
const authStatus = await _optionalChain([ctx, 'access',
|
|
9998
|
-
return _optionalChain([authStatus, 'optionalAccess',
|
|
10281
|
+
const authStatus = await _optionalChain([ctx, 'access', _331 => _331.localizer, 'optionalAccess', _332 => _332.checkAuth, 'call', _333 => _333()]);
|
|
10282
|
+
return _optionalChain([authStatus, 'optionalAccess', _334 => _334.username]) || null;
|
|
9999
10283
|
} catch (e3) {
|
|
10000
10284
|
return null;
|
|
10001
10285
|
}
|
|
@@ -10051,6 +10335,9 @@ var run_default = new (0, _interactivecommander.Command)().command("run").descri
|
|
|
10051
10335
|
).option(
|
|
10052
10336
|
"--force",
|
|
10053
10337
|
"Force re-translation of all keys, bypassing change detection. Useful when you want to regenerate translations with updated AI models or translation settings"
|
|
10338
|
+
).option(
|
|
10339
|
+
"--frozen",
|
|
10340
|
+
"Validate translations are up-to-date without making changes - fails if source files, target files, or lockfile are out of sync. Ideal for CI/CD to ensure translation consistency before deployment"
|
|
10054
10341
|
).option(
|
|
10055
10342
|
"--api-key <api-key>",
|
|
10056
10343
|
"Override API key from settings or environment variables"
|
|
@@ -10093,6 +10380,8 @@ var run_default = new (0, _interactivecommander.Command)().command("run").descri
|
|
|
10093
10380
|
await renderSpacer();
|
|
10094
10381
|
await plan(ctx);
|
|
10095
10382
|
await renderSpacer();
|
|
10383
|
+
await frozen(ctx);
|
|
10384
|
+
await renderSpacer();
|
|
10096
10385
|
await execute(ctx);
|
|
10097
10386
|
await renderSpacer();
|
|
10098
10387
|
await renderSummary(ctx.results);
|
|
@@ -10187,7 +10476,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
10187
10476
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
10188
10477
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
10189
10478
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
10190
|
-
_optionalChain([this, 'access',
|
|
10479
|
+
_optionalChain([this, 'access', _335 => _335.platformKit, 'optionalAccess', _336 => _336.gitConfig, 'call', _337 => _337()]);
|
|
10191
10480
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
10192
10481
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
10193
10482
|
if (!processOwnCommits) {
|
|
@@ -10219,7 +10508,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
10219
10508
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
10220
10509
|
var PullRequestFlow = class extends InBranchFlow {
|
|
10221
10510
|
async preRun() {
|
|
10222
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
10511
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _338 => _338()]);
|
|
10223
10512
|
if (!canContinue) {
|
|
10224
10513
|
return false;
|
|
10225
10514
|
}
|
|
@@ -10482,10 +10771,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
10482
10771
|
repo_slug: this.platformConfig.repositoryName,
|
|
10483
10772
|
state: "OPEN"
|
|
10484
10773
|
}).then(({ data: { values } }) => {
|
|
10485
|
-
return _optionalChain([values, 'optionalAccess',
|
|
10486
|
-
({ source, destination }) => _optionalChain([source, 'optionalAccess',
|
|
10774
|
+
return _optionalChain([values, 'optionalAccess', _339 => _339.find, 'call', _340 => _340(
|
|
10775
|
+
({ source, destination }) => _optionalChain([source, 'optionalAccess', _341 => _341.branch, 'optionalAccess', _342 => _342.name]) === branch && _optionalChain([destination, 'optionalAccess', _343 => _343.branch, 'optionalAccess', _344 => _344.name]) === this.platformConfig.baseBranchName
|
|
10487
10776
|
)]);
|
|
10488
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
10777
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _345 => _345.id]));
|
|
10489
10778
|
}
|
|
10490
10779
|
async closePullRequest({ pullRequestNumber }) {
|
|
10491
10780
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -10581,7 +10870,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
10581
10870
|
repo: this.platformConfig.repositoryName,
|
|
10582
10871
|
base: this.platformConfig.baseBranchName,
|
|
10583
10872
|
state: "open"
|
|
10584
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
10873
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _346 => _346.number]));
|
|
10585
10874
|
}
|
|
10586
10875
|
async closePullRequest({ pullRequestNumber }) {
|
|
10587
10876
|
await this.octokit.rest.pulls.update({
|
|
@@ -10708,7 +10997,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
10708
10997
|
sourceBranch: branch,
|
|
10709
10998
|
state: "opened"
|
|
10710
10999
|
});
|
|
10711
|
-
return _optionalChain([mergeRequests, 'access',
|
|
11000
|
+
return _optionalChain([mergeRequests, 'access', _347 => _347[0], 'optionalAccess', _348 => _348.iid]);
|
|
10712
11001
|
}
|
|
10713
11002
|
async closePullRequest({
|
|
10714
11003
|
pullRequestNumber
|
|
@@ -10814,7 +11103,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
10814
11103
|
}
|
|
10815
11104
|
const env = {
|
|
10816
11105
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
10817
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
11106
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _349 => _349.pullRequest, 'optionalAccess', _350 => _350.toString, 'call', _351 => _351()]) || "false",
|
|
10818
11107
|
...options.commitMessage && {
|
|
10819
11108
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
10820
11109
|
},
|
|
@@ -10834,7 +11123,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
10834
11123
|
const { isPullRequestMode } = platformKit.config;
|
|
10835
11124
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
10836
11125
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
10837
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
11126
|
+
const canRun = await _optionalChain([flow, 'access', _352 => _352.preRun, 'optionalCall', _353 => _353()]);
|
|
10838
11127
|
if (canRun === false) {
|
|
10839
11128
|
return;
|
|
10840
11129
|
}
|
|
@@ -10844,7 +11133,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
10844
11133
|
if (!hasChanges) {
|
|
10845
11134
|
return;
|
|
10846
11135
|
}
|
|
10847
|
-
await _optionalChain([flow, 'access',
|
|
11136
|
+
await _optionalChain([flow, 'access', _354 => _354.postRun, 'optionalCall', _355 => _355()]);
|
|
10848
11137
|
});
|
|
10849
11138
|
function parseBooleanArg(val) {
|
|
10850
11139
|
if (val === true) return true;
|
|
@@ -10881,8 +11170,8 @@ function exitGracefully(elapsedMs = 0) {
|
|
|
10881
11170
|
}
|
|
10882
11171
|
}
|
|
10883
11172
|
function checkForPendingOperations() {
|
|
10884
|
-
const activeHandles = _optionalChain([process, 'access',
|
|
10885
|
-
const activeRequests = _optionalChain([process, 'access',
|
|
11173
|
+
const activeHandles = _optionalChain([process, 'access', _356 => _356._getActiveHandles, 'optionalCall', _357 => _357()]) || [];
|
|
11174
|
+
const activeRequests = _optionalChain([process, 'access', _358 => _358._getActiveRequests, 'optionalCall', _359 => _359()]) || [];
|
|
10886
11175
|
const nonStandardHandles = activeHandles.filter((handle) => {
|
|
10887
11176
|
if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
|
|
10888
11177
|
return false;
|
|
@@ -10951,17 +11240,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
10951
11240
|
flags
|
|
10952
11241
|
});
|
|
10953
11242
|
let buckets = getBuckets(i18nConfig);
|
|
10954
|
-
if (_optionalChain([flags, 'access',
|
|
11243
|
+
if (_optionalChain([flags, 'access', _360 => _360.bucket, 'optionalAccess', _361 => _361.length])) {
|
|
10955
11244
|
buckets = buckets.filter(
|
|
10956
11245
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
10957
11246
|
);
|
|
10958
11247
|
}
|
|
10959
11248
|
ora.succeed("Buckets retrieved");
|
|
10960
|
-
if (_optionalChain([flags, 'access',
|
|
11249
|
+
if (_optionalChain([flags, 'access', _362 => _362.file, 'optionalAccess', _363 => _363.length])) {
|
|
10961
11250
|
buckets = buckets.map((bucket) => {
|
|
10962
11251
|
const paths = bucket.paths.filter(
|
|
10963
11252
|
(path19) => flags.file.find(
|
|
10964
|
-
(file) => _optionalChain([path19, 'access',
|
|
11253
|
+
(file) => _optionalChain([path19, 'access', _364 => _364.pathPattern, 'optionalAccess', _365 => _365.includes, 'call', _366 => _366(file)]) || _optionalChain([path19, 'access', _367 => _367.pathPattern, 'optionalAccess', _368 => _368.match, 'call', _369 => _369(file)]) || minimatch(path19.pathPattern, file)
|
|
10965
11254
|
)
|
|
10966
11255
|
);
|
|
10967
11256
|
return { ...bucket, paths };
|
|
@@ -10981,7 +11270,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
10981
11270
|
});
|
|
10982
11271
|
}
|
|
10983
11272
|
}
|
|
10984
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
11273
|
+
const targetLocales = _optionalChain([flags, 'access', _370 => _370.locale, 'optionalAccess', _371 => _371.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
10985
11274
|
let totalSourceKeyCount = 0;
|
|
10986
11275
|
let uniqueKeysToTranslate = 0;
|
|
10987
11276
|
let totalExistingTranslations = 0;
|
|
@@ -11387,12 +11676,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
11387
11676
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
11388
11677
|
docUrl: "bucketNotFound"
|
|
11389
11678
|
});
|
|
11390
|
-
} else if (_optionalChain([flags, 'access',
|
|
11679
|
+
} else if (_optionalChain([flags, 'access', _372 => _372.locale, 'optionalAccess', _373 => _373.some, 'call', _374 => _374((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
11391
11680
|
throw new CLIError({
|
|
11392
11681
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
11393
11682
|
docUrl: "localeTargetNotFound"
|
|
11394
11683
|
});
|
|
11395
|
-
} else if (_optionalChain([flags, 'access',
|
|
11684
|
+
} else if (_optionalChain([flags, 'access', _375 => _375.bucket, 'optionalAccess', _376 => _376.some, 'call', _377 => _377(
|
|
11396
11685
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
11397
11686
|
)])) {
|
|
11398
11687
|
throw new CLIError({
|
|
@@ -11484,7 +11773,7 @@ async function renderHero2() {
|
|
|
11484
11773
|
// package.json
|
|
11485
11774
|
var package_default = {
|
|
11486
11775
|
name: "lingo.dev",
|
|
11487
|
-
version: "0.
|
|
11776
|
+
version: "0.113.0",
|
|
11488
11777
|
description: "Lingo.dev CLI",
|
|
11489
11778
|
private: false,
|
|
11490
11779
|
publishConfig: {
|
|
@@ -11774,7 +12063,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
|
|
|
11774
12063
|
if (options.file && options.file.length) {
|
|
11775
12064
|
buckets = buckets.map((bucket) => {
|
|
11776
12065
|
const paths = bucket.paths.filter(
|
|
11777
|
-
(bucketPath) => _optionalChain([options, 'access',
|
|
12066
|
+
(bucketPath) => _optionalChain([options, 'access', _378 => _378.file, 'optionalAccess', _379 => _379.some, 'call', _380 => _380((f) => bucketPath.pathPattern.includes(f))])
|
|
11778
12067
|
);
|
|
11779
12068
|
return { ...bucket, paths };
|
|
11780
12069
|
}).filter((bucket) => bucket.paths.length > 0);
|