lingo.dev 0.91.0 → 0.92.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 +203 -122
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +177 -96
- package/build/cli.mjs.map +1 -1
- package/package.json +3 -3
package/build/cli.cjs
CHANGED
|
@@ -180,7 +180,7 @@ var require_lib = __commonJS({
|
|
|
180
180
|
let regex = null;
|
|
181
181
|
try {
|
|
182
182
|
regex = new RegExp(pattern, flags);
|
|
183
|
-
} catch (
|
|
183
|
+
} catch (_27) {
|
|
184
184
|
}
|
|
185
185
|
const node = this.estreeParseLiteral(regex);
|
|
186
186
|
node.regex = { pattern, flags };
|
|
@@ -13119,7 +13119,7 @@ var require_node = __commonJS({
|
|
|
13119
13119
|
exports.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
13120
13120
|
return /^debug_/i.test(key);
|
|
13121
13121
|
}).reduce((obj, key) => {
|
|
13122
|
-
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (
|
|
13122
|
+
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_27, k) => {
|
|
13123
13123
|
return k.toUpperCase();
|
|
13124
13124
|
});
|
|
13125
13125
|
let val = process.env[key];
|
|
@@ -13279,7 +13279,7 @@ var require_generated = __commonJS({
|
|
|
13279
13279
|
exports.isAccessor = isAccessor;
|
|
13280
13280
|
exports.isAnyTypeAnnotation = isAnyTypeAnnotation;
|
|
13281
13281
|
exports.isArgumentPlaceholder = isArgumentPlaceholder;
|
|
13282
|
-
exports.isArrayExpression =
|
|
13282
|
+
exports.isArrayExpression = isArrayExpression2;
|
|
13283
13283
|
exports.isArrayPattern = isArrayPattern;
|
|
13284
13284
|
exports.isArrayTypeAnnotation = isArrayTypeAnnotation;
|
|
13285
13285
|
exports.isArrowFunctionExpression = isArrowFunctionExpression;
|
|
@@ -13584,7 +13584,7 @@ var require_generated = __commonJS({
|
|
|
13584
13584
|
exports.isYieldExpression = isYieldExpression;
|
|
13585
13585
|
var _shallowEqual = require_shallowEqual();
|
|
13586
13586
|
var _deprecationWarning = require_deprecationWarning();
|
|
13587
|
-
function
|
|
13587
|
+
function isArrayExpression2(node, opts) {
|
|
13588
13588
|
if (!node) return false;
|
|
13589
13589
|
if (node.type !== "ArrayExpression") return false;
|
|
13590
13590
|
return opts == null || (0, _shallowEqual.default)(node, opts);
|
|
@@ -29430,7 +29430,7 @@ var require_scope = __commonJS({
|
|
|
29430
29430
|
cloneNode,
|
|
29431
29431
|
getBindingIdentifiers,
|
|
29432
29432
|
identifier,
|
|
29433
|
-
isArrayExpression,
|
|
29433
|
+
isArrayExpression: isArrayExpression2,
|
|
29434
29434
|
isBinary,
|
|
29435
29435
|
isCallExpression,
|
|
29436
29436
|
isClass,
|
|
@@ -29981,7 +29981,7 @@ var require_scope = __commonJS({
|
|
|
29981
29981
|
return true;
|
|
29982
29982
|
} else if (isBinary(node)) {
|
|
29983
29983
|
return this.isPure(node.left, constantsOnly) && this.isPure(node.right, constantsOnly);
|
|
29984
|
-
} else if (
|
|
29984
|
+
} else if (isArrayExpression2(node) || isTupleExpression(node)) {
|
|
29985
29985
|
for (const elem of node.elements) {
|
|
29986
29986
|
if (elem !== null && !this.isPure(elem, constantsOnly)) return false;
|
|
29987
29987
|
}
|
|
@@ -30360,7 +30360,7 @@ var require_scope = __commonJS({
|
|
|
30360
30360
|
return node;
|
|
30361
30361
|
}
|
|
30362
30362
|
}
|
|
30363
|
-
if (
|
|
30363
|
+
if (isArrayExpression2(node)) {
|
|
30364
30364
|
return node;
|
|
30365
30365
|
}
|
|
30366
30366
|
if (isIdentifier2(node, {
|
|
@@ -32173,7 +32173,7 @@ var require_whitespace = __commonJS({
|
|
|
32173
32173
|
var _t = require_lib4();
|
|
32174
32174
|
var {
|
|
32175
32175
|
FLIPPED_ALIAS_KEYS,
|
|
32176
|
-
isArrayExpression,
|
|
32176
|
+
isArrayExpression: isArrayExpression2,
|
|
32177
32177
|
isAssignmentExpression,
|
|
32178
32178
|
isBinary,
|
|
32179
32179
|
isBlockStatement,
|
|
@@ -32227,7 +32227,7 @@ var require_whitespace = __commonJS({
|
|
|
32227
32227
|
}
|
|
32228
32228
|
}
|
|
32229
32229
|
function isType(node) {
|
|
32230
|
-
return isLiteral(node) || isObjectExpression2(node) ||
|
|
32230
|
+
return isLiteral(node) || isObjectExpression2(node) || isArrayExpression2(node) || isIdentifier2(node) || isMemberExpression(node);
|
|
32231
32231
|
}
|
|
32232
32232
|
var nodes = exports.nodes = {
|
|
32233
32233
|
AssignmentExpression(node) {
|
|
@@ -41487,7 +41487,7 @@ var require_family = __commonJS({
|
|
|
41487
41487
|
const node = this.node;
|
|
41488
41488
|
const container = node[key];
|
|
41489
41489
|
if (Array.isArray(container)) {
|
|
41490
|
-
return container.map((
|
|
41490
|
+
return container.map((_27, i) => {
|
|
41491
41491
|
return _index.default.get({
|
|
41492
41492
|
listKey: key,
|
|
41493
41493
|
parentPath: this,
|
|
@@ -42481,9 +42481,9 @@ function getSettings(explicitApiKey) {
|
|
|
42481
42481
|
_envVarsInfo();
|
|
42482
42482
|
return {
|
|
42483
42483
|
auth: {
|
|
42484
|
-
apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access',
|
|
42485
|
-
apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access',
|
|
42486
|
-
webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access',
|
|
42484
|
+
apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access', _28 => _28.auth, 'optionalAccess', _29 => _29.apiKey]) || defaults.auth.apiKey,
|
|
42485
|
+
apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _30 => _30.auth, 'optionalAccess', _31 => _31.apiUrl]) || defaults.auth.apiUrl,
|
|
42486
|
+
webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _32 => _32.auth, 'optionalAccess', _33 => _33.webUrl]) || defaults.auth.webUrl
|
|
42487
42487
|
}
|
|
42488
42488
|
};
|
|
42489
42489
|
}
|
|
@@ -42554,7 +42554,7 @@ Please use LINGODOTDEV_API_KEY instead.
|
|
|
42554
42554
|
function _envVarsInfo() {
|
|
42555
42555
|
const env = _loadEnv();
|
|
42556
42556
|
const systemFile = _loadSystemFile();
|
|
42557
|
-
if (env.LINGODOTDEV_API_KEY && _optionalChain([systemFile, 'access',
|
|
42557
|
+
if (env.LINGODOTDEV_API_KEY && _optionalChain([systemFile, 'access', _34 => _34.auth, 'optionalAccess', _35 => _35.apiKey])) {
|
|
42558
42558
|
console.info(
|
|
42559
42559
|
"\x1B[36m%s\x1B[0m",
|
|
42560
42560
|
`\u2139\uFE0F Using LINGODOTDEV_API_KEY env var instead of credentials from login flow (saved in .lingodotdevrc)`
|
|
@@ -42609,7 +42609,7 @@ function createAuthenticator(params) {
|
|
|
42609
42609
|
});
|
|
42610
42610
|
if (res.ok) {
|
|
42611
42611
|
const payload = await res.json();
|
|
42612
|
-
if (!_optionalChain([payload, 'optionalAccess',
|
|
42612
|
+
if (!_optionalChain([payload, 'optionalAccess', _36 => _36.email])) {
|
|
42613
42613
|
return null;
|
|
42614
42614
|
}
|
|
42615
42615
|
return {
|
|
@@ -43229,7 +43229,7 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
|
|
|
43229
43229
|
});
|
|
43230
43230
|
const auth2 = await newAuthenticator.whoami();
|
|
43231
43231
|
if (auth2) {
|
|
43232
|
-
_ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess',
|
|
43232
|
+
_ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _37 => _37.email])}`);
|
|
43233
43233
|
} else {
|
|
43234
43234
|
_ora2.default.call(void 0, ).fail("Authentication failed.");
|
|
43235
43235
|
}
|
|
@@ -43309,7 +43309,7 @@ var locale_default = new (0, _interactivecommander.Command)().command("locale").
|
|
|
43309
43309
|
function getBuckets(i18nConfig) {
|
|
43310
43310
|
const result = Object.entries(i18nConfig.buckets).map(([bucketType, bucketEntry]) => {
|
|
43311
43311
|
const includeItems = bucketEntry.include.map((item) => resolveBucketItem(item));
|
|
43312
|
-
const excludeItems = _optionalChain([bucketEntry, 'access',
|
|
43312
|
+
const excludeItems = _optionalChain([bucketEntry, 'access', _38 => _38.exclude, 'optionalAccess', _39 => _39.map, 'call', _40 => _40((item) => resolveBucketItem(item))]);
|
|
43313
43313
|
const config = {
|
|
43314
43314
|
type: bucketType,
|
|
43315
43315
|
paths: extractPathPatterns(i18nConfig.locale.source, includeItems, excludeItems)
|
|
@@ -43336,7 +43336,7 @@ function extractPathPatterns(sourceLocale, include, exclude) {
|
|
|
43336
43336
|
})
|
|
43337
43337
|
)
|
|
43338
43338
|
);
|
|
43339
|
-
const excludedPatterns = _optionalChain([exclude, 'optionalAccess',
|
|
43339
|
+
const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _41 => _41.flatMap, 'call', _42 => _42(
|
|
43340
43340
|
(pattern) => expandPlaceholderedGlob(pattern.path, __spec.resolveOverriddenLocale.call(void 0, sourceLocale, pattern.delimiter)).map(
|
|
43341
43341
|
(pathPattern) => ({
|
|
43342
43342
|
pathPattern,
|
|
@@ -43465,12 +43465,12 @@ function composeLoaders(...loaders) {
|
|
|
43465
43465
|
return {
|
|
43466
43466
|
init: async () => {
|
|
43467
43467
|
for (const loader of loaders) {
|
|
43468
|
-
await _optionalChain([loader, 'access',
|
|
43468
|
+
await _optionalChain([loader, 'access', _43 => _43.init, 'optionalCall', _44 => _44()]);
|
|
43469
43469
|
}
|
|
43470
43470
|
},
|
|
43471
43471
|
setDefaultLocale(locale) {
|
|
43472
43472
|
for (const loader of loaders) {
|
|
43473
|
-
_optionalChain([loader, 'access',
|
|
43473
|
+
_optionalChain([loader, 'access', _45 => _45.setDefaultLocale, 'optionalCall', _46 => _46(locale)]);
|
|
43474
43474
|
}
|
|
43475
43475
|
return this;
|
|
43476
43476
|
},
|
|
@@ -43503,7 +43503,7 @@ function createLoader(lDefinition) {
|
|
|
43503
43503
|
if (state.initCtx) {
|
|
43504
43504
|
return state.initCtx;
|
|
43505
43505
|
}
|
|
43506
|
-
state.initCtx = await _optionalChain([lDefinition, 'access',
|
|
43506
|
+
state.initCtx = await _optionalChain([lDefinition, 'access', _47 => _47.init, 'optionalCall', _48 => _48()]);
|
|
43507
43507
|
return state.initCtx;
|
|
43508
43508
|
},
|
|
43509
43509
|
setDefaultLocale(locale) {
|
|
@@ -43607,7 +43607,7 @@ function createNormalizeLoader() {
|
|
|
43607
43607
|
return normalized;
|
|
43608
43608
|
},
|
|
43609
43609
|
push: async (locale, data, originalInput) => {
|
|
43610
|
-
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess',
|
|
43610
|
+
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _49 => _49.keysMap]), () => ( {}));
|
|
43611
43611
|
const input2 = mapDenormalizedKeys(data, keysMap);
|
|
43612
43612
|
const denormalized = _flat.unflatten.call(void 0, input2, {
|
|
43613
43613
|
delimiter: "/",
|
|
@@ -43681,7 +43681,7 @@ function createTextFileLoader(pathPattern) {
|
|
|
43681
43681
|
const trimmedResult = result.trim();
|
|
43682
43682
|
return trimmedResult;
|
|
43683
43683
|
},
|
|
43684
|
-
async push(locale, data,
|
|
43684
|
+
async push(locale, data, _27, originalLocale) {
|
|
43685
43685
|
const draftPath = pathPattern.replaceAll("[locale]", locale);
|
|
43686
43686
|
const finalPath = path14.default.resolve(draftPath);
|
|
43687
43687
|
const dirPath = path14.default.dirname(finalPath);
|
|
@@ -43710,8 +43710,8 @@ async function getTrailingNewLine(pathPattern, locale, originalLocale) {
|
|
|
43710
43710
|
if (!templateData) {
|
|
43711
43711
|
templateData = await readFileForLocale(pathPattern, originalLocale);
|
|
43712
43712
|
}
|
|
43713
|
-
if (_optionalChain([templateData, 'optionalAccess',
|
|
43714
|
-
const ending = _optionalChain([templateData, 'optionalAccess',
|
|
43713
|
+
if (_optionalChain([templateData, 'optionalAccess', _50 => _50.match, 'call', _51 => _51(/[\r\n]$/)])) {
|
|
43714
|
+
const ending = _optionalChain([templateData, 'optionalAccess', _52 => _52.includes, 'call', _53 => _53("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _54 => _54.includes, 'call', _55 => _55("\r")]) ? "\r" : "\n";
|
|
43715
43715
|
return ending;
|
|
43716
43716
|
}
|
|
43717
43717
|
return "";
|
|
@@ -44050,7 +44050,7 @@ function createHtmlLoader() {
|
|
|
44050
44050
|
break;
|
|
44051
44051
|
}
|
|
44052
44052
|
const siblings = Array.from(parent.childNodes).filter(
|
|
44053
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
44053
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _56 => _56.textContent, 'optionalAccess', _57 => _57.trim, 'call', _58 => _58()])
|
|
44054
44054
|
);
|
|
44055
44055
|
const index = siblings.indexOf(current);
|
|
44056
44056
|
if (index !== -1) {
|
|
@@ -44085,11 +44085,11 @@ function createHtmlLoader() {
|
|
|
44085
44085
|
result[getPath(element, attr)] = value;
|
|
44086
44086
|
}
|
|
44087
44087
|
});
|
|
44088
|
-
Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
44088
|
+
Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _59 => _59.textContent, 'optionalAccess', _60 => _60.trim, 'call', _61 => _61()])).forEach(processNode);
|
|
44089
44089
|
}
|
|
44090
44090
|
};
|
|
44091
|
-
Array.from(document2.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
44092
|
-
Array.from(document2.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
44091
|
+
Array.from(document2.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _62 => _62.textContent, 'optionalAccess', _63 => _63.trim, 'call', _64 => _64()])).forEach(processNode);
|
|
44092
|
+
Array.from(document2.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _65 => _65.textContent, 'optionalAccess', _66 => _66.trim, 'call', _67 => _67()])).forEach(processNode);
|
|
44093
44093
|
return result;
|
|
44094
44094
|
},
|
|
44095
44095
|
async push(locale, data, originalInput) {
|
|
@@ -44111,7 +44111,7 @@ function createHtmlLoader() {
|
|
|
44111
44111
|
for (let i = 0; i < indices.length; i++) {
|
|
44112
44112
|
const index = parseInt(indices[i]);
|
|
44113
44113
|
const siblings = Array.from(parent.childNodes).filter(
|
|
44114
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
44114
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _68 => _68.textContent, 'optionalAccess', _69 => _69.trim, 'call', _70 => _70()])
|
|
44115
44115
|
);
|
|
44116
44116
|
if (index >= siblings.length) {
|
|
44117
44117
|
if (i === indices.length - 1) {
|
|
@@ -44162,7 +44162,7 @@ function createMarkdownLoader() {
|
|
|
44162
44162
|
yaml: yamlEngine
|
|
44163
44163
|
}
|
|
44164
44164
|
});
|
|
44165
|
-
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess',
|
|
44165
|
+
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _71 => _71.trim, 'call', _72 => _72()]), () => ( ""))).filter(Boolean);
|
|
44166
44166
|
return {
|
|
44167
44167
|
...Object.fromEntries(
|
|
44168
44168
|
sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
|
|
@@ -44174,7 +44174,7 @@ function createMarkdownLoader() {
|
|
|
44174
44174
|
const frontmatter = Object.fromEntries(
|
|
44175
44175
|
Object.entries(data).filter(([key]) => key.startsWith(FM_ATTR_PREFIX)).map(([key, value]) => [key.replace(FM_ATTR_PREFIX, ""), value])
|
|
44176
44176
|
);
|
|
44177
|
-
let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess',
|
|
44177
|
+
let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _73 => _73.trim, 'call', _74 => _74()]), () => ( ""))).filter(Boolean).join("\n\n");
|
|
44178
44178
|
if (Object.keys(frontmatter).length > 0) {
|
|
44179
44179
|
content = `
|
|
44180
44180
|
${content}`;
|
|
@@ -44207,7 +44207,7 @@ function createPropertiesLoader() {
|
|
|
44207
44207
|
return result;
|
|
44208
44208
|
},
|
|
44209
44209
|
async push(locale, payload) {
|
|
44210
|
-
const result = Object.entries(payload).filter(([
|
|
44210
|
+
const result = Object.entries(payload).filter(([_27, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
|
|
44211
44211
|
return result;
|
|
44212
44212
|
}
|
|
44213
44213
|
});
|
|
@@ -44218,7 +44218,7 @@ function isSkippableLine(line) {
|
|
|
44218
44218
|
function parsePropertyLine(line) {
|
|
44219
44219
|
const [key, ...valueParts] = line.split("=");
|
|
44220
44220
|
return {
|
|
44221
|
-
key: _optionalChain([key, 'optionalAccess',
|
|
44221
|
+
key: _optionalChain([key, 'optionalAccess', _75 => _75.trim, 'call', _76 => _76()]) || "",
|
|
44222
44222
|
value: valueParts.join("=").trim()
|
|
44223
44223
|
};
|
|
44224
44224
|
}
|
|
@@ -44304,7 +44304,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
44304
44304
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
44305
44305
|
continue;
|
|
44306
44306
|
}
|
|
44307
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
44307
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _77 => _77.localizations, 'optionalAccess', _78 => _78[locale]]);
|
|
44308
44308
|
if (langTranslationEntity) {
|
|
44309
44309
|
if ("stringUnit" in langTranslationEntity) {
|
|
44310
44310
|
resultData[translationKey] = langTranslationEntity.stringUnit.value;
|
|
@@ -44313,7 +44313,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
44313
44313
|
resultData[translationKey] = {};
|
|
44314
44314
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
44315
44315
|
for (const form in pluralForms) {
|
|
44316
|
-
if (_optionalChain([pluralForms, 'access',
|
|
44316
|
+
if (_optionalChain([pluralForms, 'access', _79 => _79[form], 'optionalAccess', _80 => _80.stringUnit, 'optionalAccess', _81 => _81.value])) {
|
|
44317
44317
|
resultData[translationKey][form] = pluralForms[form].stringUnit.value;
|
|
44318
44318
|
}
|
|
44319
44319
|
}
|
|
@@ -44336,7 +44336,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
44336
44336
|
const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
|
|
44337
44337
|
if (typeof value === "string") {
|
|
44338
44338
|
langDataToMerge.strings[key] = {
|
|
44339
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
44339
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _82 => _82.strings, 'optionalAccess', _83 => _83[key], 'optionalAccess', _84 => _84.extractionState]),
|
|
44340
44340
|
localizations: {
|
|
44341
44341
|
[locale]: {
|
|
44342
44342
|
stringUnit: {
|
|
@@ -44474,10 +44474,10 @@ function createUnlocalizableLoader(isCacheRestore = false, returnUnlocalizedKeys
|
|
|
44474
44474
|
}
|
|
44475
44475
|
}
|
|
44476
44476
|
return false;
|
|
44477
|
-
}).map(([key,
|
|
44478
|
-
const result = _lodash2.default.omitBy(input2, (
|
|
44477
|
+
}).map(([key, _27]) => key);
|
|
44478
|
+
const result = _lodash2.default.omitBy(input2, (_27, key) => passthroughKeys.includes(key));
|
|
44479
44479
|
if (returnUnlocalizedKeys) {
|
|
44480
|
-
result.unlocalizable = _lodash2.default.omitBy(input2, (
|
|
44480
|
+
result.unlocalizable = _lodash2.default.omitBy(input2, (_27, key) => !passthroughKeys.includes(key));
|
|
44481
44481
|
}
|
|
44482
44482
|
return result;
|
|
44483
44483
|
},
|
|
@@ -44516,7 +44516,7 @@ function createPoDataLoader(params) {
|
|
|
44516
44516
|
Object.entries(entries).forEach(([msgid, entry]) => {
|
|
44517
44517
|
if (msgid && entry.msgid) {
|
|
44518
44518
|
const context = entry.msgctxt || "";
|
|
44519
|
-
const fullEntry = _optionalChain([parsedPo, 'access',
|
|
44519
|
+
const fullEntry = _optionalChain([parsedPo, 'access', _85 => _85.translations, 'access', _86 => _86[context], 'optionalAccess', _87 => _87[msgid]]);
|
|
44520
44520
|
if (fullEntry) {
|
|
44521
44521
|
result[msgid] = fullEntry;
|
|
44522
44522
|
}
|
|
@@ -44526,8 +44526,8 @@ function createPoDataLoader(params) {
|
|
|
44526
44526
|
return result;
|
|
44527
44527
|
},
|
|
44528
44528
|
async push(locale, data, originalInput, originalLocale, pullInput) {
|
|
44529
|
-
const currentSections = _optionalChain([pullInput, 'optionalAccess',
|
|
44530
|
-
const originalSections = _optionalChain([originalInput, 'optionalAccess',
|
|
44529
|
+
const currentSections = _optionalChain([pullInput, 'optionalAccess', _88 => _88.split, 'call', _89 => _89("\n\n"), 'access', _90 => _90.filter, 'call', _91 => _91(Boolean)]) || [];
|
|
44530
|
+
const originalSections = _optionalChain([originalInput, 'optionalAccess', _92 => _92.split, 'call', _93 => _93("\n\n"), 'access', _94 => _94.filter, 'call', _95 => _95(Boolean)]) || [];
|
|
44531
44531
|
const result = originalSections.map((section) => {
|
|
44532
44532
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
44533
44533
|
const contextKey = _lodash2.default.keys(sectionPo.translations)[0];
|
|
@@ -44592,8 +44592,8 @@ function createPoContentLoader() {
|
|
|
44592
44592
|
{
|
|
44593
44593
|
...entry,
|
|
44594
44594
|
msgstr: [
|
|
44595
|
-
_optionalChain([data, 'access',
|
|
44596
|
-
_optionalChain([data, 'access',
|
|
44595
|
+
_optionalChain([data, 'access', _96 => _96[entry.msgid], 'optionalAccess', _97 => _97.singular]),
|
|
44596
|
+
_optionalChain([data, 'access', _98 => _98[entry.msgid], 'optionalAccess', _99 => _99.plural]) || null
|
|
44597
44597
|
].filter(Boolean)
|
|
44598
44598
|
}
|
|
44599
44599
|
]).fromPairs().value();
|
|
@@ -44840,7 +44840,7 @@ function createDatoClient(params) {
|
|
|
44840
44840
|
only_valid: "true",
|
|
44841
44841
|
ids: !records.length ? void 0 : records.join(",")
|
|
44842
44842
|
}
|
|
44843
|
-
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
44843
|
+
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _100 => _100.response, 'optionalAccess', _101 => _101.body, 'optionalAccess', _102 => _102.data, 'optionalAccess', _103 => _103[0]]) || error));
|
|
44844
44844
|
},
|
|
44845
44845
|
findRecordsForModel: async (modelId, records) => {
|
|
44846
44846
|
try {
|
|
@@ -44850,9 +44850,9 @@ function createDatoClient(params) {
|
|
|
44850
44850
|
filter: {
|
|
44851
44851
|
type: modelId,
|
|
44852
44852
|
only_valid: "true",
|
|
44853
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
44853
|
+
ids: !_optionalChain([records, 'optionalAccess', _104 => _104.length]) ? void 0 : records.join(",")
|
|
44854
44854
|
}
|
|
44855
|
-
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
44855
|
+
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _105 => _105.response, 'optionalAccess', _106 => _106.body, 'optionalAccess', _107 => _107.data, 'optionalAccess', _108 => _108[0]]) || error));
|
|
44856
44856
|
return result;
|
|
44857
44857
|
} catch (_error) {
|
|
44858
44858
|
throw new Error(
|
|
@@ -44866,9 +44866,9 @@ function createDatoClient(params) {
|
|
|
44866
44866
|
},
|
|
44867
44867
|
updateRecord: async (id, payload) => {
|
|
44868
44868
|
try {
|
|
44869
|
-
await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
44869
|
+
await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _109 => _109.response, 'optionalAccess', _110 => _110.body, 'optionalAccess', _111 => _111.data, 'optionalAccess', _112 => _112[0]]) || error));
|
|
44870
44870
|
} catch (_error) {
|
|
44871
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
44871
|
+
if (_optionalChain([_error, 'optionalAccess', _113 => _113.attributes, 'optionalAccess', _114 => _114.details, 'optionalAccess', _115 => _115.message])) {
|
|
44872
44872
|
throw new Error(
|
|
44873
44873
|
[
|
|
44874
44874
|
`${_error.attributes.details.message}`,
|
|
@@ -44889,9 +44889,9 @@ function createDatoClient(params) {
|
|
|
44889
44889
|
},
|
|
44890
44890
|
enableFieldLocalization: async (args) => {
|
|
44891
44891
|
try {
|
|
44892
|
-
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
44892
|
+
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _116 => _116.response, 'optionalAccess', _117 => _117.body, 'optionalAccess', _118 => _118.data, 'optionalAccess', _119 => _119[0]]) || error));
|
|
44893
44893
|
} catch (_error) {
|
|
44894
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
44894
|
+
if (_optionalChain([_error, 'optionalAccess', _120 => _120.attributes, 'optionalAccess', _121 => _121.code]) === "NOT_FOUND") {
|
|
44895
44895
|
throw new Error(
|
|
44896
44896
|
[
|
|
44897
44897
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -44899,7 +44899,7 @@ function createDatoClient(params) {
|
|
|
44899
44899
|
].join("\n\n")
|
|
44900
44900
|
);
|
|
44901
44901
|
}
|
|
44902
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
44902
|
+
if (_optionalChain([_error, 'optionalAccess', _122 => _122.attributes, 'optionalAccess', _123 => _123.details, 'optionalAccess', _124 => _124.message])) {
|
|
44903
44903
|
throw new Error(
|
|
44904
44904
|
[`${_error.attributes.details.message}`, `Error: ${JSON.stringify(_error, null, 2)}`].join("\n\n")
|
|
44905
44905
|
);
|
|
@@ -44965,7 +44965,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
44965
44965
|
}
|
|
44966
44966
|
}
|
|
44967
44967
|
const records = await dato.findRecordsForModel(modelId);
|
|
44968
|
-
const recordChoices = createRecordChoices(records, _optionalChain([config, 'access',
|
|
44968
|
+
const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _125 => _125.models, 'access', _126 => _126[modelId], 'optionalAccess', _127 => _127.records]) || [], project);
|
|
44969
44969
|
const selectedRecords = await promptRecordSelection(modelName, recordChoices);
|
|
44970
44970
|
result.models[modelId].records = records.filter((record) => selectedRecords.includes(record.id));
|
|
44971
44971
|
updatedConfig.models[modelId].records = selectedRecords;
|
|
@@ -44977,14 +44977,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
44977
44977
|
},
|
|
44978
44978
|
async pull(locale, input2, initCtx) {
|
|
44979
44979
|
const result = {};
|
|
44980
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
44981
|
-
let records = _optionalChain([initCtx, 'optionalAccess',
|
|
44980
|
+
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _128 => _128.models]) || {})) {
|
|
44981
|
+
let records = _optionalChain([initCtx, 'optionalAccess', _129 => _129.models, 'access', _130 => _130[modelId], 'access', _131 => _131.records]) || [];
|
|
44982
44982
|
const recordIds = records.map((record) => record.id);
|
|
44983
44983
|
records = await dato.findRecords(recordIds);
|
|
44984
44984
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
44985
44985
|
if (records.length > 0) {
|
|
44986
44986
|
result[modelId] = {
|
|
44987
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
44987
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _132 => _132.models, 'optionalAccess', _133 => _133[modelId], 'optionalAccess', _134 => _134.fields]) || [],
|
|
44988
44988
|
records
|
|
44989
44989
|
};
|
|
44990
44990
|
}
|
|
@@ -45043,7 +45043,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
45043
45043
|
return records.map((record) => ({
|
|
45044
45044
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
45045
45045
|
value: record.id,
|
|
45046
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
45046
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _135 => _135.includes, 'call', _136 => _136(record.id)])
|
|
45047
45047
|
}));
|
|
45048
45048
|
}
|
|
45049
45049
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -45310,7 +45310,7 @@ var _nodewebvtt = require('node-webvtt'); var _nodewebvtt2 = _interopRequireDefa
|
|
|
45310
45310
|
function createVttLoader() {
|
|
45311
45311
|
return createLoader({
|
|
45312
45312
|
async pull(locale, input2) {
|
|
45313
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
45313
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _137 => _137.parse, 'call', _138 => _138(input2), 'optionalAccess', _139 => _139.cues]);
|
|
45314
45314
|
if (Object.keys(vtt).length === 0) {
|
|
45315
45315
|
return {};
|
|
45316
45316
|
} else {
|
|
@@ -45363,7 +45363,7 @@ function variableExtractLoader(params) {
|
|
|
45363
45363
|
for (let i = 0; i < matches.length; i++) {
|
|
45364
45364
|
const match = matches[i];
|
|
45365
45365
|
const currentValue = result[key].value;
|
|
45366
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
45366
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _140 => _140.replace, 'call', _141 => _141(match, `{variable:${i}}`)]);
|
|
45367
45367
|
result[key].value = newValue;
|
|
45368
45368
|
result[key].variables[i] = match;
|
|
45369
45369
|
}
|
|
@@ -45377,7 +45377,7 @@ function variableExtractLoader(params) {
|
|
|
45377
45377
|
for (let i = 0; i < valueObj.variables.length; i++) {
|
|
45378
45378
|
const variable = valueObj.variables[i];
|
|
45379
45379
|
const currentValue = result[key];
|
|
45380
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
45380
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _142 => _142.replace, 'call', _143 => _143(`{variable:${i}}`, variable)]);
|
|
45381
45381
|
result[key] = newValue;
|
|
45382
45382
|
}
|
|
45383
45383
|
}
|
|
@@ -45558,7 +45558,7 @@ function createVueJsonLoader() {
|
|
|
45558
45558
|
return createLoader({
|
|
45559
45559
|
pull: async (locale, input2, ctx) => {
|
|
45560
45560
|
const parsed = parseVueFile(input2);
|
|
45561
|
-
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess',
|
|
45561
|
+
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _144 => _144.i18n, 'optionalAccess', _145 => _145[locale]]), () => ( {}));
|
|
45562
45562
|
},
|
|
45563
45563
|
push: async (locale, data, originalInput) => {
|
|
45564
45564
|
const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
|
|
@@ -45592,6 +45592,8 @@ var import_parser = __toESM(require_lib(), 1);
|
|
|
45592
45592
|
var import_traverse = __toESM(require_lib8(), 1);
|
|
45593
45593
|
var t = __toESM(require_lib4(), 1);
|
|
45594
45594
|
var import_generator = __toESM(require_lib5(), 1);
|
|
45595
|
+
|
|
45596
|
+
|
|
45595
45597
|
function createTypescriptLoader() {
|
|
45596
45598
|
return createLoader({
|
|
45597
45599
|
pull: async (locale, input2) => {
|
|
@@ -45600,7 +45602,8 @@ function createTypescriptLoader() {
|
|
|
45600
45602
|
}
|
|
45601
45603
|
try {
|
|
45602
45604
|
const ast = parseTypeScript(input2);
|
|
45603
|
-
|
|
45605
|
+
const extractedStrings = extractStringsFromDefaultExport(ast);
|
|
45606
|
+
return flattenExtractedStrings(extractedStrings);
|
|
45604
45607
|
} catch (error) {
|
|
45605
45608
|
console.error("Error parsing TypeScript file:", error);
|
|
45606
45609
|
return {};
|
|
@@ -45613,7 +45616,8 @@ function createTypescriptLoader() {
|
|
|
45613
45616
|
const input2 = originalInput;
|
|
45614
45617
|
try {
|
|
45615
45618
|
const ast = parseTypeScript(input2);
|
|
45616
|
-
const
|
|
45619
|
+
const nestedData = unflattenStringData(data);
|
|
45620
|
+
const modified = updateStringsInDefaultExport(ast, nestedData);
|
|
45617
45621
|
if (!modified) {
|
|
45618
45622
|
return input2;
|
|
45619
45623
|
}
|
|
@@ -45632,36 +45636,69 @@ function parseTypeScript(input2) {
|
|
|
45632
45636
|
plugins: ["typescript"]
|
|
45633
45637
|
});
|
|
45634
45638
|
}
|
|
45639
|
+
function flattenExtractedStrings(obj) {
|
|
45640
|
+
const flattened = _flat.flatten.call(void 0, obj, { delimiter: "/" });
|
|
45641
|
+
return Object.entries(flattened).reduce((acc, [key, value]) => {
|
|
45642
|
+
if (typeof value === "string") {
|
|
45643
|
+
acc[key] = value;
|
|
45644
|
+
}
|
|
45645
|
+
return acc;
|
|
45646
|
+
}, {});
|
|
45647
|
+
}
|
|
45648
|
+
function unflattenStringData(data) {
|
|
45649
|
+
return _flat.unflatten.call(void 0, data, { delimiter: "/" });
|
|
45650
|
+
}
|
|
45635
45651
|
function extractStringsFromDefaultExport(ast) {
|
|
45636
45652
|
const result = {};
|
|
45637
45653
|
(0, import_traverse.default)(ast, {
|
|
45638
45654
|
ExportDefaultDeclaration(path17) {
|
|
45639
45655
|
if (t.isObjectExpression(path17.node.declaration)) {
|
|
45640
|
-
extractStringsFromObjectExpression(path17.node.declaration, result);
|
|
45656
|
+
extractStringsFromObjectExpression(path17.node.declaration, result, "");
|
|
45641
45657
|
} else if (t.isIdentifier(path17.node.declaration)) {
|
|
45642
|
-
extractStringsFromExportedIdentifier(path17, result);
|
|
45658
|
+
extractStringsFromExportedIdentifier(path17, result, "");
|
|
45643
45659
|
}
|
|
45644
45660
|
}
|
|
45645
45661
|
});
|
|
45646
45662
|
return result;
|
|
45647
45663
|
}
|
|
45648
|
-
function extractStringsFromObjectExpression(objectExpression, result) {
|
|
45664
|
+
function extractStringsFromObjectExpression(objectExpression, result, path17) {
|
|
45649
45665
|
objectExpression.properties.forEach((prop) => {
|
|
45650
45666
|
if (t.isObjectProperty(prop)) {
|
|
45651
45667
|
const key = getPropertyKey(prop);
|
|
45668
|
+
const currentPath = path17 ? `${path17}/${key}` : key;
|
|
45652
45669
|
if (t.isStringLiteral(prop.value)) {
|
|
45653
|
-
result
|
|
45670
|
+
_lodash2.default.set(result, currentPath, prop.value.value);
|
|
45671
|
+
} else if (t.isObjectExpression(prop.value)) {
|
|
45672
|
+
extractStringsFromObjectExpression(prop.value, result, currentPath);
|
|
45673
|
+
} else if (t.isArrayExpression(prop.value)) {
|
|
45674
|
+
extractStringsFromArrayExpression(prop.value, result, currentPath);
|
|
45654
45675
|
}
|
|
45655
45676
|
}
|
|
45656
45677
|
});
|
|
45657
45678
|
}
|
|
45658
|
-
function
|
|
45679
|
+
function extractStringsFromArrayExpression(arrayExpression, result, path17) {
|
|
45680
|
+
arrayExpression.elements.forEach((element, index) => {
|
|
45681
|
+
const currentPath = `${path17}/${index}`;
|
|
45682
|
+
if (t.isStringLiteral(element)) {
|
|
45683
|
+
_lodash2.default.set(result, currentPath, element.value);
|
|
45684
|
+
} else if (t.isObjectExpression(element)) {
|
|
45685
|
+
extractStringsFromObjectExpression(element, result, currentPath);
|
|
45686
|
+
} else if (t.isArrayExpression(element)) {
|
|
45687
|
+
extractStringsFromArrayExpression(element, result, currentPath);
|
|
45688
|
+
}
|
|
45689
|
+
});
|
|
45690
|
+
}
|
|
45691
|
+
function extractStringsFromExportedIdentifier(path17, result, basePath) {
|
|
45659
45692
|
const exportName = path17.node.declaration.name;
|
|
45660
45693
|
const binding = path17.scope.bindings[exportName];
|
|
45661
45694
|
if (binding && binding.path.node) {
|
|
45662
45695
|
const bindingPath = binding.path;
|
|
45663
|
-
if (t.isVariableDeclarator(bindingPath.node) && bindingPath.node.init
|
|
45664
|
-
|
|
45696
|
+
if (t.isVariableDeclarator(bindingPath.node) && bindingPath.node.init) {
|
|
45697
|
+
if (t.isObjectExpression(bindingPath.node.init)) {
|
|
45698
|
+
extractStringsFromObjectExpression(bindingPath.node.init, result, basePath);
|
|
45699
|
+
} else if (t.isArrayExpression(bindingPath.node.init)) {
|
|
45700
|
+
extractStringsFromArrayExpression(bindingPath.node.init, result, basePath);
|
|
45701
|
+
}
|
|
45665
45702
|
}
|
|
45666
45703
|
}
|
|
45667
45704
|
}
|
|
@@ -45670,35 +45707,93 @@ function updateStringsInDefaultExport(ast, data) {
|
|
|
45670
45707
|
(0, import_traverse.default)(ast, {
|
|
45671
45708
|
ExportDefaultDeclaration(path17) {
|
|
45672
45709
|
if (t.isObjectExpression(path17.node.declaration)) {
|
|
45673
|
-
modified = updateStringsInObjectExpression(path17.node.declaration, data) || modified;
|
|
45710
|
+
modified = updateStringsInObjectExpression(path17.node.declaration, data, "") || modified;
|
|
45674
45711
|
} else if (t.isIdentifier(path17.node.declaration)) {
|
|
45675
|
-
modified = updateStringsInExportedIdentifier(path17, data) || modified;
|
|
45712
|
+
modified = updateStringsInExportedIdentifier(path17, data, "") || modified;
|
|
45676
45713
|
}
|
|
45677
45714
|
}
|
|
45678
45715
|
});
|
|
45679
45716
|
return modified;
|
|
45680
45717
|
}
|
|
45681
|
-
function updateStringsInObjectExpression(objectExpression, data) {
|
|
45718
|
+
function updateStringsInObjectExpression(objectExpression, data, path17) {
|
|
45682
45719
|
let modified = false;
|
|
45683
45720
|
objectExpression.properties.forEach((prop) => {
|
|
45684
45721
|
if (t.isObjectProperty(prop)) {
|
|
45685
45722
|
const key = getPropertyKey(prop);
|
|
45686
|
-
|
|
45687
|
-
|
|
45723
|
+
const currentPath = path17 ? `${path17}/${key}` : key;
|
|
45724
|
+
if (t.isStringLiteral(prop.value)) {
|
|
45725
|
+
if (data[currentPath] !== void 0) {
|
|
45726
|
+
prop.value.value = data[currentPath];
|
|
45727
|
+
modified = true;
|
|
45728
|
+
} else if (path17 === "" && data[key] !== void 0) {
|
|
45729
|
+
prop.value.value = data[key];
|
|
45730
|
+
modified = true;
|
|
45731
|
+
}
|
|
45732
|
+
} else if (t.isObjectExpression(prop.value)) {
|
|
45733
|
+
if (data[key] && typeof data[key] === "object") {
|
|
45734
|
+
const subModified = updateStringsInObjectExpression(prop.value, data[key], "");
|
|
45735
|
+
modified = subModified || modified;
|
|
45736
|
+
} else {
|
|
45737
|
+
const subModified = updateStringsInObjectExpression(prop.value, data, currentPath);
|
|
45738
|
+
modified = subModified || modified;
|
|
45739
|
+
}
|
|
45740
|
+
} else if (t.isArrayExpression(prop.value)) {
|
|
45741
|
+
if (data[key] && Array.isArray(data[key])) {
|
|
45742
|
+
const subModified = updateStringsInArrayExpression(prop.value, data[key], "");
|
|
45743
|
+
modified = subModified || modified;
|
|
45744
|
+
} else {
|
|
45745
|
+
const subModified = updateStringsInArrayExpression(prop.value, data, currentPath);
|
|
45746
|
+
modified = subModified || modified;
|
|
45747
|
+
}
|
|
45748
|
+
}
|
|
45749
|
+
}
|
|
45750
|
+
});
|
|
45751
|
+
return modified;
|
|
45752
|
+
}
|
|
45753
|
+
function updateStringsInArrayExpression(arrayExpression, data, path17) {
|
|
45754
|
+
let modified = false;
|
|
45755
|
+
arrayExpression.elements.forEach((element, index) => {
|
|
45756
|
+
const currentPath = `${path17}/${index}`;
|
|
45757
|
+
if (t.isStringLiteral(element)) {
|
|
45758
|
+
if (Array.isArray(data) && data[index] !== void 0) {
|
|
45759
|
+
element.value = data[index];
|
|
45760
|
+
modified = true;
|
|
45761
|
+
} else if (!Array.isArray(data) && data[currentPath] !== void 0) {
|
|
45762
|
+
element.value = data[currentPath];
|
|
45688
45763
|
modified = true;
|
|
45689
45764
|
}
|
|
45765
|
+
} else if (t.isObjectExpression(element)) {
|
|
45766
|
+
if (Array.isArray(data) && data[index] && typeof data[index] === "object") {
|
|
45767
|
+
const subModified = updateStringsInObjectExpression(element, data[index], "");
|
|
45768
|
+
modified = subModified || modified;
|
|
45769
|
+
} else {
|
|
45770
|
+
const subModified = updateStringsInObjectExpression(element, data, currentPath);
|
|
45771
|
+
modified = subModified || modified;
|
|
45772
|
+
}
|
|
45773
|
+
} else if (t.isArrayExpression(element)) {
|
|
45774
|
+
if (Array.isArray(data) && data[index] && Array.isArray(data[index])) {
|
|
45775
|
+
const subModified = updateStringsInArrayExpression(element, data[index], "");
|
|
45776
|
+
modified = subModified || modified;
|
|
45777
|
+
} else {
|
|
45778
|
+
const subModified = updateStringsInArrayExpression(element, data, currentPath);
|
|
45779
|
+
modified = subModified || modified;
|
|
45780
|
+
}
|
|
45690
45781
|
}
|
|
45691
45782
|
});
|
|
45692
45783
|
return modified;
|
|
45693
45784
|
}
|
|
45694
|
-
function updateStringsInExportedIdentifier(path17, data) {
|
|
45785
|
+
function updateStringsInExportedIdentifier(path17, data, basePath) {
|
|
45695
45786
|
let modified = false;
|
|
45696
45787
|
const exportName = path17.node.declaration.name;
|
|
45697
45788
|
const binding = path17.scope.bindings[exportName];
|
|
45698
45789
|
if (binding && binding.path.node) {
|
|
45699
45790
|
const bindingPath = binding.path;
|
|
45700
|
-
if (t.isVariableDeclarator(bindingPath.node) && bindingPath.node.init
|
|
45701
|
-
|
|
45791
|
+
if (t.isVariableDeclarator(bindingPath.node) && bindingPath.node.init) {
|
|
45792
|
+
if (t.isObjectExpression(bindingPath.node.init)) {
|
|
45793
|
+
modified = updateStringsInObjectExpression(bindingPath.node.init, data, basePath) || modified;
|
|
45794
|
+
} else if (t.isArrayExpression(bindingPath.node.init)) {
|
|
45795
|
+
modified = updateStringsInArrayExpression(bindingPath.node.init, data, basePath) || modified;
|
|
45796
|
+
}
|
|
45702
45797
|
}
|
|
45703
45798
|
}
|
|
45704
45799
|
return modified;
|
|
@@ -45938,7 +46033,7 @@ function createMdxSectionsSplit2Loader() {
|
|
|
45938
46033
|
const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
|
|
45939
46034
|
const result = {
|
|
45940
46035
|
frontmatter: data.frontmatter,
|
|
45941
|
-
codePlaceholders: _optionalChain([pullInput, 'optionalAccess',
|
|
46036
|
+
codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _146 => _146.codePlaceholders]) || {},
|
|
45942
46037
|
content
|
|
45943
46038
|
};
|
|
45944
46039
|
return result;
|
|
@@ -46347,7 +46442,7 @@ function createBasicTranslator(model, systemPrompt) {
|
|
|
46347
46442
|
]
|
|
46348
46443
|
});
|
|
46349
46444
|
const result = JSON.parse(response.text);
|
|
46350
|
-
return _optionalChain([result, 'optionalAccess',
|
|
46445
|
+
return _optionalChain([result, 'optionalAccess', _147 => _147.data]) || {};
|
|
46351
46446
|
};
|
|
46352
46447
|
}
|
|
46353
46448
|
|
|
@@ -46365,7 +46460,7 @@ function createProcessor(provider, params) {
|
|
|
46365
46460
|
}
|
|
46366
46461
|
}
|
|
46367
46462
|
function getPureModelProvider(provider) {
|
|
46368
|
-
switch (_optionalChain([provider, 'optionalAccess',
|
|
46463
|
+
switch (_optionalChain([provider, 'optionalAccess', _148 => _148.id])) {
|
|
46369
46464
|
case "openai":
|
|
46370
46465
|
if (!process.env.OPENAI_API_KEY) {
|
|
46371
46466
|
throw new Error("OPENAI_API_KEY is not set.");
|
|
@@ -46382,7 +46477,7 @@ function getPureModelProvider(provider) {
|
|
|
46382
46477
|
apiKey: process.env.ANTHROPIC_API_KEY
|
|
46383
46478
|
})(provider.model);
|
|
46384
46479
|
default:
|
|
46385
|
-
throw new Error(`Unsupported provider: ${_optionalChain([provider, 'optionalAccess',
|
|
46480
|
+
throw new Error(`Unsupported provider: ${_optionalChain([provider, 'optionalAccess', _149 => _149.id])}`);
|
|
46386
46481
|
}
|
|
46387
46482
|
}
|
|
46388
46483
|
|
|
@@ -46624,16 +46719,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
46624
46719
|
flags
|
|
46625
46720
|
});
|
|
46626
46721
|
let buckets = getBuckets(i18nConfig);
|
|
46627
|
-
if (_optionalChain([flags, 'access',
|
|
46722
|
+
if (_optionalChain([flags, 'access', _150 => _150.bucket, 'optionalAccess', _151 => _151.length])) {
|
|
46628
46723
|
buckets = buckets.filter(
|
|
46629
46724
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
46630
46725
|
);
|
|
46631
46726
|
}
|
|
46632
46727
|
ora.succeed("Buckets retrieved");
|
|
46633
|
-
if (_optionalChain([flags, 'access',
|
|
46728
|
+
if (_optionalChain([flags, 'access', _152 => _152.file, 'optionalAccess', _153 => _153.length])) {
|
|
46634
46729
|
buckets = buckets.map((bucket) => {
|
|
46635
46730
|
const paths = bucket.paths.filter(
|
|
46636
|
-
(path17) => flags.file.find((file) => _optionalChain([path17, 'access',
|
|
46731
|
+
(path17) => flags.file.find((file) => _optionalChain([path17, 'access', _154 => _154.pathPattern, 'optionalAccess', _155 => _155.includes, 'call', _156 => _156(file)]))
|
|
46637
46732
|
);
|
|
46638
46733
|
return { ...bucket, paths };
|
|
46639
46734
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -46652,7 +46747,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
46652
46747
|
});
|
|
46653
46748
|
}
|
|
46654
46749
|
}
|
|
46655
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
46750
|
+
const targetLocales = _optionalChain([flags, 'access', _157 => _157.locale, 'optionalAccess', _158 => _158.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
46656
46751
|
ora.start("Setting up localization cache...");
|
|
46657
46752
|
const checkLockfileProcessor = createDeltaProcessor("");
|
|
46658
46753
|
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
@@ -46891,7 +46986,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
46891
46986
|
if (flags.key) {
|
|
46892
46987
|
processableData = _lodash2.default.pickBy(
|
|
46893
46988
|
processableData,
|
|
46894
|
-
(
|
|
46989
|
+
(_27, key) => key === flags.key
|
|
46895
46990
|
);
|
|
46896
46991
|
}
|
|
46897
46992
|
if (flags.verbose) {
|
|
@@ -47057,12 +47152,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
47057
47152
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
47058
47153
|
docUrl: "bucketNotFound"
|
|
47059
47154
|
});
|
|
47060
|
-
} else if (_optionalChain([flags, 'access',
|
|
47155
|
+
} else if (_optionalChain([flags, 'access', _159 => _159.locale, 'optionalAccess', _160 => _160.some, 'call', _161 => _161((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
47061
47156
|
throw new CLIError({
|
|
47062
47157
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
47063
47158
|
docUrl: "localeTargetNotFound"
|
|
47064
47159
|
});
|
|
47065
|
-
} else if (_optionalChain([flags, 'access',
|
|
47160
|
+
} else if (_optionalChain([flags, 'access', _162 => _162.bucket, 'optionalAccess', _163 => _163.some, 'call', _164 => _164(
|
|
47066
47161
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
47067
47162
|
)])) {
|
|
47068
47163
|
throw new CLIError({
|
|
@@ -47390,7 +47485,7 @@ var _stdiojs = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
|
47390
47485
|
var _mcpjs = require('@modelcontextprotocol/sdk/server/mcp.js');
|
|
47391
47486
|
|
|
47392
47487
|
|
|
47393
|
-
var mcp_default = new (0, _interactivecommander.Command)().command("mcp").description("Use Lingo.dev model context provider with your AI agent").helpOption("-h, --help", "Show help").action(async (
|
|
47488
|
+
var mcp_default = new (0, _interactivecommander.Command)().command("mcp").description("Use Lingo.dev model context provider with your AI agent").helpOption("-h, --help", "Show help").action(async (_27, program) => {
|
|
47394
47489
|
const apiKey = program.args[0];
|
|
47395
47490
|
const settings = getSettings(apiKey);
|
|
47396
47491
|
if (!settings.auth.apiKey) {
|
|
@@ -47527,7 +47622,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
47527
47622
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
47528
47623
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
47529
47624
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
47530
|
-
_optionalChain([this, 'access',
|
|
47625
|
+
_optionalChain([this, 'access', _165 => _165.platformKit, 'optionalAccess', _166 => _166.gitConfig, 'call', _167 => _167()]);
|
|
47531
47626
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
47532
47627
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
47533
47628
|
if (!processOwnCommits) {
|
|
@@ -47559,7 +47654,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
47559
47654
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
47560
47655
|
var PullRequestFlow = class extends InBranchFlow {
|
|
47561
47656
|
async preRun() {
|
|
47562
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
47657
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _168 => _168()]);
|
|
47563
47658
|
if (!canContinue) {
|
|
47564
47659
|
return false;
|
|
47565
47660
|
}
|
|
@@ -47811,10 +47906,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
47811
47906
|
repo_slug: this.platformConfig.repositoryName,
|
|
47812
47907
|
state: "OPEN"
|
|
47813
47908
|
}).then(({ data: { values } }) => {
|
|
47814
|
-
return _optionalChain([values, 'optionalAccess',
|
|
47815
|
-
({ source, destination }) => _optionalChain([source, 'optionalAccess',
|
|
47909
|
+
return _optionalChain([values, 'optionalAccess', _169 => _169.find, 'call', _170 => _170(
|
|
47910
|
+
({ source, destination }) => _optionalChain([source, 'optionalAccess', _171 => _171.branch, 'optionalAccess', _172 => _172.name]) === branch && _optionalChain([destination, 'optionalAccess', _173 => _173.branch, 'optionalAccess', _174 => _174.name]) === this.platformConfig.baseBranchName
|
|
47816
47911
|
)]);
|
|
47817
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
47912
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _175 => _175.id]));
|
|
47818
47913
|
}
|
|
47819
47914
|
async closePullRequest({ pullRequestNumber }) {
|
|
47820
47915
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -47910,7 +48005,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
47910
48005
|
repo: this.platformConfig.repositoryName,
|
|
47911
48006
|
base: this.platformConfig.baseBranchName,
|
|
47912
48007
|
state: "open"
|
|
47913
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
48008
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _176 => _176.number]));
|
|
47914
48009
|
}
|
|
47915
48010
|
async closePullRequest({ pullRequestNumber }) {
|
|
47916
48011
|
await this.octokit.rest.pulls.update({
|
|
@@ -48037,7 +48132,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
48037
48132
|
sourceBranch: branch,
|
|
48038
48133
|
state: "opened"
|
|
48039
48134
|
});
|
|
48040
|
-
return _optionalChain([mergeRequests, 'access',
|
|
48135
|
+
return _optionalChain([mergeRequests, 'access', _177 => _177[0], 'optionalAccess', _178 => _178.iid]);
|
|
48041
48136
|
}
|
|
48042
48137
|
async closePullRequest({
|
|
48043
48138
|
pullRequestNumber
|
|
@@ -48101,24 +48196,10 @@ var getPlatformKit = () => {
|
|
|
48101
48196
|
};
|
|
48102
48197
|
|
|
48103
48198
|
// src/cli/cmd/ci/index.ts
|
|
48104
|
-
|
|
48105
48199
|
var ci_default = new (0, _interactivecommander.Command)().command("ci").description("Run Lingo.dev CI/CD action").helpOption("-h, --help", "Show help").option("--api-key <key>", "API key").option("--pull-request [boolean]", "Create a pull request with the changes").option("--commit-message <message>", "Commit message").option("--pull-request-title <title>", "Pull request title").option("--working-directory <dir>", "Working directory").option(
|
|
48106
48200
|
"--process-own-commits [boolean]",
|
|
48107
48201
|
"Process commits made by this action"
|
|
48108
|
-
).option(
|
|
48109
|
-
"--debug",
|
|
48110
|
-
"Debug mode. Wait for user input before continuing.",
|
|
48111
|
-
false
|
|
48112
48202
|
).action(async (options) => {
|
|
48113
|
-
if (options.debug) {
|
|
48114
|
-
const { debug } = await _inquirer2.default.prompt([
|
|
48115
|
-
{
|
|
48116
|
-
type: "confirm",
|
|
48117
|
-
name: "debug",
|
|
48118
|
-
message: "Debug mode. Wait for user input before continuing."
|
|
48119
|
-
}
|
|
48120
|
-
]);
|
|
48121
|
-
}
|
|
48122
48203
|
const settings = getSettings(options.apiKey);
|
|
48123
48204
|
if (!settings.auth.apiKey) {
|
|
48124
48205
|
console.error("No API key provided");
|
|
@@ -48135,7 +48216,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
48135
48216
|
}
|
|
48136
48217
|
const env = {
|
|
48137
48218
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
48138
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
48219
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _179 => _179.pullRequest, 'optionalAccess', _180 => _180.toString, 'call', _181 => _181()]) || "false",
|
|
48139
48220
|
...options.commitMessage && {
|
|
48140
48221
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
48141
48222
|
},
|
|
@@ -48155,7 +48236,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
48155
48236
|
const { isPullRequestMode } = platformKit.config;
|
|
48156
48237
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
48157
48238
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
48158
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
48239
|
+
const canRun = await _optionalChain([flow, 'access', _182 => _182.preRun, 'optionalCall', _183 => _183()]);
|
|
48159
48240
|
if (canRun === false) {
|
|
48160
48241
|
return;
|
|
48161
48242
|
}
|
|
@@ -48163,7 +48244,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
48163
48244
|
if (!hasChanges) {
|
|
48164
48245
|
return;
|
|
48165
48246
|
}
|
|
48166
|
-
await _optionalChain([flow, 'access',
|
|
48247
|
+
await _optionalChain([flow, 'access', _184 => _184.postRun, 'optionalCall', _185 => _185()]);
|
|
48167
48248
|
});
|
|
48168
48249
|
|
|
48169
48250
|
// src/cli/cmd/status.ts
|
|
@@ -48207,13 +48288,13 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
48207
48288
|
flags
|
|
48208
48289
|
});
|
|
48209
48290
|
let buckets = getBuckets(i18nConfig);
|
|
48210
|
-
if (_optionalChain([flags, 'access',
|
|
48291
|
+
if (_optionalChain([flags, 'access', _186 => _186.bucket, 'optionalAccess', _187 => _187.length])) {
|
|
48211
48292
|
buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
|
|
48212
48293
|
}
|
|
48213
48294
|
ora.succeed("Buckets retrieved");
|
|
48214
|
-
if (_optionalChain([flags, 'access',
|
|
48295
|
+
if (_optionalChain([flags, 'access', _188 => _188.file, 'optionalAccess', _189 => _189.length])) {
|
|
48215
48296
|
buckets = buckets.map((bucket) => {
|
|
48216
|
-
const paths = bucket.paths.filter((path17) => flags.file.find((file) => _optionalChain([path17, 'access',
|
|
48297
|
+
const paths = bucket.paths.filter((path17) => flags.file.find((file) => _optionalChain([path17, 'access', _190 => _190.pathPattern, 'optionalAccess', _191 => _191.match, 'call', _192 => _192(file)])));
|
|
48217
48298
|
return { ...bucket, paths };
|
|
48218
48299
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
48219
48300
|
if (buckets.length === 0) {
|
|
@@ -48229,7 +48310,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
48229
48310
|
});
|
|
48230
48311
|
}
|
|
48231
48312
|
}
|
|
48232
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
48313
|
+
const targetLocales = _optionalChain([flags, 'access', _193 => _193.locale, 'optionalAccess', _194 => _194.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
48233
48314
|
let totalSourceKeyCount = 0;
|
|
48234
48315
|
let uniqueKeysToTranslate = 0;
|
|
48235
48316
|
let totalExistingTranslations = 0;
|
|
@@ -48570,12 +48651,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
48570
48651
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
48571
48652
|
docUrl: "bucketNotFound"
|
|
48572
48653
|
});
|
|
48573
|
-
} else if (_optionalChain([flags, 'access',
|
|
48654
|
+
} else if (_optionalChain([flags, 'access', _195 => _195.locale, 'optionalAccess', _196 => _196.some, 'call', _197 => _197((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
48574
48655
|
throw new CLIError({
|
|
48575
48656
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
48576
48657
|
docUrl: "localeTargetNotFound"
|
|
48577
48658
|
});
|
|
48578
|
-
} else if (_optionalChain([flags, 'access',
|
|
48659
|
+
} else if (_optionalChain([flags, 'access', _198 => _198.bucket, 'optionalAccess', _199 => _199.some, 'call', _200 => _200((bucket) => !i18nConfig.buckets[bucket])])) {
|
|
48579
48660
|
throw new CLIError({
|
|
48580
48661
|
message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
|
|
48581
48662
|
docUrl: "bucketNotFound"
|
|
@@ -48658,7 +48739,7 @@ async function renderHero() {
|
|
|
48658
48739
|
// package.json
|
|
48659
48740
|
var package_default = {
|
|
48660
48741
|
name: "lingo.dev",
|
|
48661
|
-
version: "0.
|
|
48742
|
+
version: "0.92.0",
|
|
48662
48743
|
description: "Lingo.dev CLI",
|
|
48663
48744
|
private: false,
|
|
48664
48745
|
publishConfig: {
|