lingo.dev 0.117.6 → 0.117.8

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 CHANGED
@@ -3407,8 +3407,8 @@ function serializeElement(node) {
3407
3407
  const attrString = Object.entries(attributes).map(([key, value]) => ` ${key}="${escapeAttributeValue(String(value))}"`).join("");
3408
3408
  const children = Array.isArray(node.$$) ? node.$$ : [];
3409
3409
  if (children.length === 0) {
3410
- const textContent2 = _nullishCoalesce(node._, () => ( ""));
3411
- return `<${name}${attrString}>${textContent2}</${name}>`;
3410
+ const textContent3 = _nullishCoalesce(node._, () => ( ""));
3411
+ return `<${name}${attrString}>${textContent3}</${name}>`;
3412
3412
  }
3413
3413
  const childContent = children.map(serializeElement).join("");
3414
3414
  return `<${name}${attrString}>${childContent}</${name}>`;
@@ -3497,10 +3497,10 @@ function createPullOutputCleaner() {
3497
3497
  }
3498
3498
 
3499
3499
  // src/cli/loaders/html.ts
3500
- var _htmlparser2 = require('htmlparser2'); var htmlparser2 = _interopRequireWildcard(_htmlparser2);
3500
+ var _htmlparser2 = require('htmlparser2'); var htmlparser2 = _interopRequireWildcard(_htmlparser2); var htmlparser22 = _interopRequireWildcard(_htmlparser2); var htmlparser23 = _interopRequireWildcard(_htmlparser2);
3501
3501
  var _domhandler = require('domhandler');
3502
- var _domutils = require('domutils'); var domutils = _interopRequireWildcard(_domutils);
3503
- var _domserializer = require('dom-serializer'); var DomSerializer = _interopRequireWildcard(_domserializer);
3502
+ var _domutils = require('domutils'); var domutils = _interopRequireWildcard(_domutils); var domutils2 = _interopRequireWildcard(_domutils);
3503
+ var _domserializer = require('dom-serializer'); var DomSerializer = _interopRequireWildcard(_domserializer); var DomSerializer2 = _interopRequireWildcard(_domserializer);
3504
3504
  function createHtmlLoader() {
3505
3505
  const PHRASING_ELEMENTS = /* @__PURE__ */ new Set([
3506
3506
  // Text-level semantics
@@ -3602,7 +3602,7 @@ function createHtmlLoader() {
3602
3602
  // <title> should be treated as a block element for translation
3603
3603
  ]);
3604
3604
  const UNLOCALIZABLE_TAGS = /* @__PURE__ */ new Set(["script", "style"]);
3605
- const LOCALIZABLE_ATTRIBUTES = {
3605
+ const LOCALIZABLE_ATTRIBUTES2 = {
3606
3606
  meta: ["content"],
3607
3607
  img: ["alt", "title"],
3608
3608
  input: ["placeholder", "title"],
@@ -3648,12 +3648,12 @@ function createHtmlLoader() {
3648
3648
  }
3649
3649
  return hasTranslatableContent(element);
3650
3650
  }
3651
- function getInnerHTML(element) {
3651
+ function getInnerHTML2(element) {
3652
3652
  return element.children.map((child) => DomSerializer.default(child, { encodeEntities: false })).join("");
3653
3653
  }
3654
3654
  function extractAttributes(element, path19) {
3655
3655
  const tagName = element.name.toLowerCase();
3656
- const attrs = LOCALIZABLE_ATTRIBUTES[tagName];
3656
+ const attrs = LOCALIZABLE_ATTRIBUTES2[tagName];
3657
3657
  if (!attrs) return;
3658
3658
  for (const attr of attrs) {
3659
3659
  const value = _optionalChain([element, 'access', _143 => _143.attribs, 'optionalAccess', _144 => _144[attr]]);
@@ -3670,14 +3670,14 @@ function createHtmlLoader() {
3670
3670
  extractAttributes(element, path19);
3671
3671
  const tagName = element.name.toLowerCase();
3672
3672
  if (BLOCK_ELEMENTS.has(tagName) && isLeafBlock(element)) {
3673
- const content = getInnerHTML(element).trim();
3673
+ const content = getInnerHTML2(element).trim();
3674
3674
  if (content) {
3675
3675
  result[path19] = content;
3676
3676
  }
3677
3677
  return;
3678
3678
  }
3679
3679
  if (PHRASING_ELEMENTS.has(tagName) && hasTranslatableContent(element)) {
3680
- const content = getInnerHTML(element).trim();
3680
+ const content = getInnerHTML2(element).trim();
3681
3681
  if (content) {
3682
3682
  result[path19] = content;
3683
3683
  }
@@ -4008,6 +4008,264 @@ function applyTranslations(node, path19, data, pathMap) {
4008
4008
  }
4009
4009
  }
4010
4010
 
4011
+ // src/cli/loaders/mjml.ts
4012
+
4013
+
4014
+
4015
+ var LOCALIZABLE_COMPONENTS = [
4016
+ "mj-text",
4017
+ "mj-button",
4018
+ "mj-title",
4019
+ "mj-preview",
4020
+ "mj-navbar-link",
4021
+ "mj-accordion-title",
4022
+ "mj-accordion-text",
4023
+ "p",
4024
+ "h1",
4025
+ "h2",
4026
+ "h3",
4027
+ "h4",
4028
+ "h5",
4029
+ "h6",
4030
+ "li"
4031
+ ];
4032
+ var LOCALIZABLE_ATTRIBUTES = {
4033
+ "mj-image": ["alt", "title"],
4034
+ "mj-button": ["title", "aria-label"],
4035
+ "mj-social-element": ["title", "alt"],
4036
+ "img": ["alt", "title"],
4037
+ "a": ["title", "aria-label"]
4038
+ };
4039
+ function createMjmlLoader() {
4040
+ return createLoader({
4041
+ async pull(locale, input2) {
4042
+ const result = {};
4043
+ try {
4044
+ const parsed = await _xml2js.parseStringPromise.call(void 0, input2, {
4045
+ explicitArray: true,
4046
+ explicitChildren: true,
4047
+ preserveChildrenOrder: true,
4048
+ charsAsChildren: true,
4049
+ includeWhiteChars: true,
4050
+ mergeAttrs: false,
4051
+ trim: false,
4052
+ attrkey: "$",
4053
+ charkey: "_",
4054
+ childkey: "$$"
4055
+ });
4056
+ if (!parsed || typeof parsed !== "object") {
4057
+ console.error("Failed to parse MJML: invalid parsed structure");
4058
+ return result;
4059
+ }
4060
+ const rootKey = Object.keys(parsed).find((key) => !key.startsWith("_") && !key.startsWith("$"));
4061
+ const rootNode = rootKey ? parsed[rootKey] : parsed;
4062
+ const rootPath = rootNode["#name"] || rootKey || "";
4063
+ traverse(rootNode, (node, path19, componentName) => {
4064
+ if (typeof node !== "object") return;
4065
+ const localizableAttrs = LOCALIZABLE_ATTRIBUTES[componentName];
4066
+ if (localizableAttrs && node.$) {
4067
+ localizableAttrs.forEach((attr) => {
4068
+ const attrValue = node.$[attr];
4069
+ if (attrValue) {
4070
+ result[`${path19}#${attr}`] = attrValue;
4071
+ }
4072
+ });
4073
+ }
4074
+ if (LOCALIZABLE_COMPONENTS.includes(componentName)) {
4075
+ const innerHTML = getInnerHTML(node);
4076
+ if (innerHTML) {
4077
+ result[path19] = innerHTML;
4078
+ return "SKIP_CHILDREN";
4079
+ }
4080
+ }
4081
+ return void 0;
4082
+ }, rootPath);
4083
+ } catch (error) {
4084
+ console.error("Failed to parse MJML:", error);
4085
+ }
4086
+ return result;
4087
+ },
4088
+ async push(locale, data, originalInput) {
4089
+ try {
4090
+ const parsed = await _xml2js.parseStringPromise.call(void 0, originalInput || "", {
4091
+ explicitArray: true,
4092
+ explicitChildren: true,
4093
+ preserveChildrenOrder: true,
4094
+ charsAsChildren: true,
4095
+ includeWhiteChars: true,
4096
+ mergeAttrs: false,
4097
+ trim: false,
4098
+ attrkey: "$",
4099
+ charkey: "_",
4100
+ childkey: "$$"
4101
+ });
4102
+ if (!parsed || typeof parsed !== "object") {
4103
+ console.error("Failed to parse MJML for push: invalid parsed structure");
4104
+ return originalInput || "";
4105
+ }
4106
+ const rootKey = Object.keys(parsed).find((key) => !key.startsWith("_") && !key.startsWith("$"));
4107
+ const rootNode = rootKey ? parsed[rootKey] : parsed;
4108
+ const rootPath = rootNode["#name"] || rootKey || "";
4109
+ traverse(rootNode, (node, path19, componentName) => {
4110
+ if (typeof node !== "object") return;
4111
+ const localizableAttrs = LOCALIZABLE_ATTRIBUTES[componentName];
4112
+ if (localizableAttrs && node.$) {
4113
+ localizableAttrs.forEach((attr) => {
4114
+ const attrKey = `${path19}#${attr}`;
4115
+ if (data[attrKey] !== void 0) {
4116
+ node.$[attr] = data[attrKey];
4117
+ }
4118
+ });
4119
+ }
4120
+ if (LOCALIZABLE_COMPONENTS.includes(componentName) && data[path19]) {
4121
+ setInnerHTML(node, data[path19]);
4122
+ return "SKIP_CHILDREN";
4123
+ }
4124
+ return void 0;
4125
+ }, rootPath);
4126
+ return serializeMjml(parsed);
4127
+ } catch (error) {
4128
+ console.error("Failed to build MJML:", error);
4129
+ return "";
4130
+ }
4131
+ }
4132
+ });
4133
+ }
4134
+ function traverse(node, visitor, path19 = "") {
4135
+ if (!node || typeof node !== "object") {
4136
+ return;
4137
+ }
4138
+ const children = node.$$;
4139
+ if (!Array.isArray(children)) {
4140
+ return;
4141
+ }
4142
+ const elementCounts = /* @__PURE__ */ new Map();
4143
+ children.forEach((child) => {
4144
+ const elementName = child["#name"];
4145
+ if (!elementName || elementName.startsWith("__")) {
4146
+ return;
4147
+ }
4148
+ const currentIndex = elementCounts.get(elementName) || 0;
4149
+ elementCounts.set(elementName, currentIndex + 1);
4150
+ const currentPath = path19 ? `${path19}/${elementName}/${currentIndex}` : `${elementName}/${currentIndex}`;
4151
+ const result = visitor(child, currentPath, elementName);
4152
+ if (result !== "SKIP_CHILDREN") {
4153
+ traverse(child, visitor, currentPath);
4154
+ }
4155
+ });
4156
+ }
4157
+ function getInnerHTML(node) {
4158
+ if (!node.$$ || !Array.isArray(node.$$)) {
4159
+ return null;
4160
+ }
4161
+ let html = "";
4162
+ node.$$.forEach((child) => {
4163
+ html += serializeXmlNode(child);
4164
+ });
4165
+ return html.trim() || null;
4166
+ }
4167
+ function setInnerHTML(node, htmlContent) {
4168
+ const handler = new (0, _domhandler.DomHandler)();
4169
+ const parser = new htmlparser22.Parser(handler);
4170
+ parser.write(htmlContent);
4171
+ parser.end();
4172
+ const newChildren = [];
4173
+ for (const domNode of handler.dom) {
4174
+ const xmlNode = convertDomToXmlNode(domNode);
4175
+ if (xmlNode) {
4176
+ newChildren.push(xmlNode);
4177
+ }
4178
+ }
4179
+ node.$$ = newChildren;
4180
+ node._ = htmlContent;
4181
+ }
4182
+ function serializeXmlNode(node) {
4183
+ const name = node["#name"];
4184
+ if (name === "__text__") {
4185
+ return node._ || "";
4186
+ }
4187
+ if (name === "__cdata") {
4188
+ return `<![CDATA[${node._ || ""}]]>`;
4189
+ }
4190
+ if (!name || name.startsWith("__")) {
4191
+ return "";
4192
+ }
4193
+ const attrs = node.$ || {};
4194
+ const attrString = Object.entries(attrs).map(([key, value]) => ` ${key}="${escapeAttributeValue2(String(value))}"`).join("");
4195
+ const children = node.$$ || [];
4196
+ if (children.length === 0) {
4197
+ const textContent3 = node._ || "";
4198
+ if (textContent3) {
4199
+ return `<${name}${attrString}>${textContent3}</${name}>`;
4200
+ }
4201
+ return `<${name}${attrString} />`;
4202
+ }
4203
+ const childContent = children.map(serializeXmlNode).join("");
4204
+ return `<${name}${attrString}>${childContent}</${name}>`;
4205
+ }
4206
+ function convertDomToXmlNode(domNode) {
4207
+ if (domNode.type === "text") {
4208
+ return {
4209
+ "#name": "__text__",
4210
+ "_": domNode.data
4211
+ };
4212
+ }
4213
+ if (domNode.type === "tag") {
4214
+ const xmlNode = {
4215
+ "#name": domNode.name,
4216
+ "$": domNode.attribs || {},
4217
+ "$$": []
4218
+ };
4219
+ if (domNode.children && domNode.children.length > 0) {
4220
+ for (const child of domNode.children) {
4221
+ const xmlChild = convertDomToXmlNode(child);
4222
+ if (xmlChild) {
4223
+ xmlNode.$$.push(xmlChild);
4224
+ }
4225
+ }
4226
+ }
4227
+ return xmlNode;
4228
+ }
4229
+ return null;
4230
+ }
4231
+ function serializeMjml(parsed) {
4232
+ const xmlDec = '<?xml version="1.0" encoding="UTF-8"?>\n';
4233
+ const rootKey = Object.keys(parsed).find((key) => !key.startsWith("_") && !key.startsWith("$"));
4234
+ const rootNode = rootKey ? parsed[rootKey] : parsed;
4235
+ const body = serializeElement2(rootNode);
4236
+ return xmlDec + body;
4237
+ }
4238
+ function serializeElement2(node, indent2 = "") {
4239
+ if (!node) {
4240
+ return "";
4241
+ }
4242
+ const name = _nullishCoalesce(node["#name"], () => ( "mjml"));
4243
+ if (name === "__text__") {
4244
+ return _nullishCoalesce(node._, () => ( ""));
4245
+ }
4246
+ if (name === "__cdata") {
4247
+ return `<![CDATA[${_nullishCoalesce(node._, () => ( ""))}]]>`;
4248
+ }
4249
+ if (name === "__comment__") {
4250
+ return `<!--${_nullishCoalesce(node._, () => ( ""))}-->`;
4251
+ }
4252
+ const attributes = _nullishCoalesce(node.$, () => ( {}));
4253
+ const attrString = Object.entries(attributes).map(([key, value]) => ` ${key}="${escapeAttributeValue2(String(value))}"`).join("");
4254
+ const children = Array.isArray(node.$$) ? node.$$ : [];
4255
+ if (children.length === 0) {
4256
+ const textContent3 = _nullishCoalesce(node._, () => ( ""));
4257
+ if (textContent3) {
4258
+ return `${indent2}<${name}${attrString}>${textContent3}</${name}>`;
4259
+ }
4260
+ return `${indent2}<${name}${attrString} />`;
4261
+ }
4262
+ const childContent = children.map((child) => serializeElement2(child, indent2)).join("");
4263
+ return `${indent2}<${name}${attrString}>${childContent}</${name}>`;
4264
+ }
4265
+ function escapeAttributeValue2(value) {
4266
+ return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/'/g, "&apos;");
4267
+ }
4268
+
4011
4269
  // src/cli/loaders/properties.ts
4012
4270
  function createPropertiesLoader() {
4013
4271
  return createLoader({
@@ -4271,7 +4529,7 @@ function escapeString(str) {
4271
4529
  }
4272
4530
 
4273
4531
  // src/cli/loaders/xcode-strings/parser.ts
4274
- var Parser2 = class {
4532
+ var Parser3 = class {
4275
4533
 
4276
4534
 
4277
4535
  constructor(tokens) {
@@ -4344,7 +4602,7 @@ function createXcodeStringsLoader() {
4344
4602
  async pull(locale, input2) {
4345
4603
  const tokenizer = new Tokenizer(input2);
4346
4604
  const tokens = tokenizer.tokenize();
4347
- const parser = new Parser2(tokens);
4605
+ const parser = new Parser3(tokens);
4348
4606
  const result = parser.parse();
4349
4607
  return result;
4350
4608
  },
@@ -5556,10 +5814,10 @@ function formatXml(xml) {
5556
5814
  if (cdataNode) {
5557
5815
  return `${indent2}${openTag}<![CDATA[${cdataNode.nodeValue}]]></${tagName}>`;
5558
5816
  }
5559
- const textContent2 = _optionalChain([element, 'access', _258 => _258.textContent, 'optionalAccess', _259 => _259.trim, 'call', _260 => _260()]) || "";
5817
+ const textContent3 = _optionalChain([element, 'access', _258 => _258.textContent, 'optionalAccess', _259 => _259.trim, 'call', _260 => _260()]) || "";
5560
5818
  const hasOnlyText = element.childNodes.length === 1 && element.childNodes[0].nodeType === 3;
5561
- if (hasOnlyText && textContent2) {
5562
- return `${indent2}${openTag}${textContent2}</${tagName}>`;
5819
+ if (hasOnlyText && textContent3) {
5820
+ return `${indent2}${openTag}${textContent3}</${tagName}>`;
5563
5821
  }
5564
5822
  const children = Array.from(element.children);
5565
5823
  if (children.length === 0) {
@@ -6731,7 +6989,7 @@ function resolveCjsExport(mod, name = "module") {
6731
6989
  }
6732
6990
 
6733
6991
  // src/cli/loaders/typescript/index.ts
6734
- var traverse = resolveCjsExport(_traverse2.default, "@babel/traverse");
6992
+ var traverse2 = resolveCjsExport(_traverse2.default, "@babel/traverse");
6735
6993
  var generate = resolveCjsExport(_generator2.default, "@babel/generator");
6736
6994
  function createTypescriptLoader() {
6737
6995
  return createLoader({
@@ -6764,7 +7022,7 @@ function parseTypeScript(input2) {
6764
7022
  }
6765
7023
  function extractStringsFromDefaultExport(ast) {
6766
7024
  let extracted = {};
6767
- traverse(ast, {
7025
+ traverse2(ast, {
6768
7026
  ExportDefaultDeclaration(path19) {
6769
7027
  const { declaration } = path19.node;
6770
7028
  const decl = unwrapTSAsExpression(declaration);
@@ -6837,7 +7095,7 @@ function arrayExpressionToArray(arrayExpression) {
6837
7095
  }
6838
7096
  function updateStringsInDefaultExport(ast, data) {
6839
7097
  let modified = false;
6840
- traverse(ast, {
7098
+ traverse2(ast, {
6841
7099
  ExportDefaultDeclaration(path19) {
6842
7100
  const { declaration } = path19.node;
6843
7101
  const decl = unwrapTSAsExpression(declaration);
@@ -8879,14 +9137,14 @@ function parseEjsForTranslation(input2) {
8879
9137
  if (part.type === "ejs") {
8880
9138
  template += part.content;
8881
9139
  } else {
8882
- const textContent2 = part.content;
9140
+ const textContent3 = part.content;
8883
9141
  const htmlTagRegex = /<[^>]+>/g;
8884
9142
  const textParts = [];
8885
9143
  let lastTextIndex = 0;
8886
9144
  let htmlMatch;
8887
- while ((htmlMatch = htmlTagRegex.exec(textContent2)) !== null) {
9145
+ while ((htmlMatch = htmlTagRegex.exec(textContent3)) !== null) {
8888
9146
  if (htmlMatch.index > lastTextIndex) {
8889
- const textBefore = textContent2.slice(lastTextIndex, htmlMatch.index);
9147
+ const textBefore = textContent3.slice(lastTextIndex, htmlMatch.index);
8890
9148
  if (textBefore.trim()) {
8891
9149
  textParts.push({ type: "text", content: textBefore });
8892
9150
  } else {
@@ -8896,8 +9154,8 @@ function parseEjsForTranslation(input2) {
8896
9154
  textParts.push({ type: "html", content: htmlMatch[0] });
8897
9155
  lastTextIndex = htmlMatch.index + htmlMatch[0].length;
8898
9156
  }
8899
- if (lastTextIndex < textContent2.length) {
8900
- const remainingText = textContent2.slice(lastTextIndex);
9157
+ if (lastTextIndex < textContent3.length) {
9158
+ const remainingText = textContent3.slice(lastTextIndex);
8901
9159
  if (remainingText.trim()) {
8902
9160
  textParts.push({ type: "text", content: remainingText });
8903
9161
  } else {
@@ -8905,11 +9163,11 @@ function parseEjsForTranslation(input2) {
8905
9163
  }
8906
9164
  }
8907
9165
  if (textParts.length === 0) {
8908
- const trimmedContent = textContent2.trim();
9166
+ const trimmedContent = textContent3.trim();
8909
9167
  if (trimmedContent) {
8910
- textParts.push({ type: "text", content: textContent2 });
9168
+ textParts.push({ type: "text", content: textContent3 });
8911
9169
  } else {
8912
- textParts.push({ type: "html", content: textContent2 });
9170
+ textParts.push({ type: "html", content: textContent3 });
8913
9171
  }
8914
9172
  }
8915
9173
  for (const textPart of textParts) {
@@ -8978,6 +9236,368 @@ function createEjsLoader() {
8978
9236
  });
8979
9237
  }
8980
9238
 
9239
+ // src/cli/loaders/twig.ts
9240
+
9241
+
9242
+
9243
+
9244
+ function createTwigLoader() {
9245
+ const PHRASING_ELEMENTS = /* @__PURE__ */ new Set([
9246
+ // Text-level semantics
9247
+ "a",
9248
+ "abbr",
9249
+ "b",
9250
+ "bdi",
9251
+ "bdo",
9252
+ "br",
9253
+ "cite",
9254
+ "code",
9255
+ "data",
9256
+ "dfn",
9257
+ "em",
9258
+ "i",
9259
+ "kbd",
9260
+ "mark",
9261
+ "q",
9262
+ "ruby",
9263
+ "s",
9264
+ "samp",
9265
+ "small",
9266
+ "span",
9267
+ "strong",
9268
+ "sub",
9269
+ "sup",
9270
+ "time",
9271
+ "u",
9272
+ "var",
9273
+ "wbr",
9274
+ // Media
9275
+ "audio",
9276
+ "img",
9277
+ "video",
9278
+ "picture",
9279
+ // Interactive
9280
+ "button",
9281
+ "input",
9282
+ "label",
9283
+ "select",
9284
+ "textarea",
9285
+ // Embedded
9286
+ "canvas",
9287
+ "iframe",
9288
+ "object",
9289
+ "svg",
9290
+ "math",
9291
+ // Other
9292
+ "del",
9293
+ "ins",
9294
+ "map",
9295
+ "area"
9296
+ ]);
9297
+ const BLOCK_ELEMENTS = /* @__PURE__ */ new Set([
9298
+ "div",
9299
+ "p",
9300
+ "h1",
9301
+ "h2",
9302
+ "h3",
9303
+ "h4",
9304
+ "h5",
9305
+ "h6",
9306
+ "ul",
9307
+ "ol",
9308
+ "li",
9309
+ "dl",
9310
+ "dt",
9311
+ "dd",
9312
+ "blockquote",
9313
+ "pre",
9314
+ "article",
9315
+ "aside",
9316
+ "nav",
9317
+ "section",
9318
+ "header",
9319
+ "footer",
9320
+ "main",
9321
+ "figure",
9322
+ "figcaption",
9323
+ "table",
9324
+ "thead",
9325
+ "tbody",
9326
+ "tfoot",
9327
+ "tr",
9328
+ "td",
9329
+ "th",
9330
+ "caption",
9331
+ "form",
9332
+ "fieldset",
9333
+ "legend",
9334
+ "details",
9335
+ "summary",
9336
+ "address",
9337
+ "hr",
9338
+ "search",
9339
+ "dialog",
9340
+ "noscript",
9341
+ "title"
9342
+ ]);
9343
+ const UNLOCALIZABLE_TAGS = /* @__PURE__ */ new Set(["script", "style"]);
9344
+ const LOCALIZABLE_ATTRIBUTES2 = {
9345
+ meta: ["content"],
9346
+ img: ["alt", "title"],
9347
+ input: ["placeholder", "title", "aria-label"],
9348
+ textarea: ["placeholder", "title", "aria-label"],
9349
+ button: ["title", "aria-label"],
9350
+ a: ["title", "aria-label"],
9351
+ abbr: ["title"],
9352
+ link: ["title"]
9353
+ };
9354
+ function preprocessTwig(input2) {
9355
+ const twigBlocks = [];
9356
+ let counter = 0;
9357
+ const processed = input2.replace(/\{%[\s\S]*?%\}/g, (match2) => {
9358
+ twigBlocks.push(match2);
9359
+ return `__TWIG_BLOCK_${counter++}__`;
9360
+ });
9361
+ return {
9362
+ processed: processed.replace(/\{#[\s\S]*?#\}/g, (match2) => {
9363
+ twigBlocks.push(match2);
9364
+ return `__TWIG_BLOCK_${counter++}__`;
9365
+ }),
9366
+ twigBlocks
9367
+ };
9368
+ }
9369
+ function postprocessTwig(text, twigBlocks) {
9370
+ return text.replace(/__TWIG_BLOCK_(\d+)__/g, (_37, index) => {
9371
+ return twigBlocks[parseInt(index, 10)] || "";
9372
+ });
9373
+ }
9374
+ return createLoader({
9375
+ async pull(locale, input2) {
9376
+ const result = {};
9377
+ const { processed, twigBlocks } = preprocessTwig(input2);
9378
+ const handler = new (0, _domhandler.DomHandler)();
9379
+ const parser = new htmlparser23.Parser(handler, {
9380
+ lowerCaseTags: false,
9381
+ lowerCaseAttributeNames: false
9382
+ });
9383
+ parser.write(processed);
9384
+ parser.end();
9385
+ const dom = handler.dom;
9386
+ function isInsideUnlocalizableTag(element) {
9387
+ let current = element.parent;
9388
+ while (current && current.type === "tag") {
9389
+ if (UNLOCALIZABLE_TAGS.has(current.name.toLowerCase())) {
9390
+ return true;
9391
+ }
9392
+ current = current.parent;
9393
+ }
9394
+ return false;
9395
+ }
9396
+ function hasTranslatableContent(element) {
9397
+ const text = domutils2.textContent(element);
9398
+ return text.trim().length > 0;
9399
+ }
9400
+ function isLeafBlock(element) {
9401
+ const childElements = element.children.filter(
9402
+ (child) => child.type === "tag"
9403
+ );
9404
+ for (const child of childElements) {
9405
+ if (BLOCK_ELEMENTS.has(child.name.toLowerCase())) {
9406
+ return false;
9407
+ }
9408
+ }
9409
+ return hasTranslatableContent(element);
9410
+ }
9411
+ function getInnerHTML2(element) {
9412
+ const html2 = element.children.map((child) => DomSerializer2.default(child, { encodeEntities: false })).join("");
9413
+ return postprocessTwig(html2, twigBlocks);
9414
+ }
9415
+ function extractAttributes(element, path19) {
9416
+ const tagName = element.name.toLowerCase();
9417
+ const attrs = LOCALIZABLE_ATTRIBUTES2[tagName];
9418
+ if (!attrs) return;
9419
+ for (const attr of attrs) {
9420
+ const value = _optionalChain([element, 'access', _325 => _325.attribs, 'optionalAccess', _326 => _326[attr]]);
9421
+ if (value && value.trim()) {
9422
+ const restoredValue = postprocessTwig(value.trim(), twigBlocks);
9423
+ result[`${path19}#${attr}`] = restoredValue;
9424
+ }
9425
+ }
9426
+ }
9427
+ function extractFromElement(element, pathParts) {
9428
+ const path19 = pathParts.join("/");
9429
+ if (isInsideUnlocalizableTag(element)) {
9430
+ return;
9431
+ }
9432
+ extractAttributes(element, path19);
9433
+ const tagName = element.name.toLowerCase();
9434
+ if (BLOCK_ELEMENTS.has(tagName) && isLeafBlock(element)) {
9435
+ const content = getInnerHTML2(element).trim();
9436
+ if (content) {
9437
+ result[path19] = content;
9438
+ }
9439
+ return;
9440
+ }
9441
+ if (PHRASING_ELEMENTS.has(tagName) && hasTranslatableContent(element)) {
9442
+ const content = getInnerHTML2(element).trim();
9443
+ if (content) {
9444
+ result[path19] = content;
9445
+ }
9446
+ return;
9447
+ }
9448
+ let childIndex = 0;
9449
+ const childElements = element.children.filter(
9450
+ (child) => child.type === "tag"
9451
+ );
9452
+ for (const child of childElements) {
9453
+ extractFromElement(child, [...pathParts, childIndex++]);
9454
+ }
9455
+ }
9456
+ const html = domutils2.findOne(
9457
+ (elem) => elem.type === "tag" && elem.name.toLowerCase() === "html",
9458
+ dom,
9459
+ true
9460
+ );
9461
+ if (html) {
9462
+ const head = domutils2.findOne(
9463
+ (elem) => elem.type === "tag" && elem.name.toLowerCase() === "head",
9464
+ html.children,
9465
+ true
9466
+ );
9467
+ const body = domutils2.findOne(
9468
+ (elem) => elem.type === "tag" && elem.name.toLowerCase() === "body",
9469
+ html.children,
9470
+ true
9471
+ );
9472
+ if (head) {
9473
+ let headIndex = 0;
9474
+ const headChildren = head.children.filter(
9475
+ (child) => child.type === "tag"
9476
+ );
9477
+ for (const child of headChildren) {
9478
+ extractFromElement(child, ["head", headIndex++]);
9479
+ }
9480
+ }
9481
+ if (body) {
9482
+ let bodyIndex = 0;
9483
+ const bodyChildren = body.children.filter(
9484
+ (child) => child.type === "tag"
9485
+ );
9486
+ for (const child of bodyChildren) {
9487
+ extractFromElement(child, ["body", bodyIndex++]);
9488
+ }
9489
+ }
9490
+ } else {
9491
+ let rootIndex = 0;
9492
+ const rootElements = dom.filter(
9493
+ (child) => child.type === "tag"
9494
+ );
9495
+ for (const child of rootElements) {
9496
+ extractFromElement(child, [rootIndex++]);
9497
+ }
9498
+ }
9499
+ return result;
9500
+ },
9501
+ async push(locale, data, originalInput) {
9502
+ const { processed, twigBlocks } = preprocessTwig(originalInput || "");
9503
+ const handler = new (0, _domhandler.DomHandler)();
9504
+ const parser = new htmlparser23.Parser(handler, {
9505
+ lowerCaseTags: false,
9506
+ lowerCaseAttributeNames: false
9507
+ });
9508
+ parser.write(processed || "<!DOCTYPE html><html><head></head><body></body></html>");
9509
+ parser.end();
9510
+ const dom = handler.dom;
9511
+ const html = domutils2.findOne(
9512
+ (elem) => elem.type === "tag" && elem.name.toLowerCase() === "html",
9513
+ dom,
9514
+ true
9515
+ );
9516
+ if (html) {
9517
+ html.attribs = html.attribs || {};
9518
+ html.attribs.lang = locale;
9519
+ }
9520
+ function traverseByIndices(element, indices) {
9521
+ let current = element;
9522
+ for (const indexStr of indices) {
9523
+ if (!current) return null;
9524
+ const index = parseInt(indexStr, 10);
9525
+ const children = current.children.filter(
9526
+ (child) => child.type === "tag"
9527
+ );
9528
+ if (index >= children.length) {
9529
+ return null;
9530
+ }
9531
+ current = children[index];
9532
+ }
9533
+ return current;
9534
+ }
9535
+ function resolvePathToElement(path19) {
9536
+ const parts = path19.split("/");
9537
+ const [rootTag, ...indices] = parts;
9538
+ let current = null;
9539
+ if (html) {
9540
+ if (rootTag === "head") {
9541
+ current = domutils2.findOne(
9542
+ (elem) => elem.type === "tag" && elem.name.toLowerCase() === "head",
9543
+ html.children,
9544
+ true
9545
+ );
9546
+ } else if (rootTag === "body") {
9547
+ current = domutils2.findOne(
9548
+ (elem) => elem.type === "tag" && elem.name.toLowerCase() === "body",
9549
+ html.children,
9550
+ true
9551
+ );
9552
+ }
9553
+ if (!current) return null;
9554
+ return traverseByIndices(current, indices);
9555
+ } else {
9556
+ const rootElements = dom.filter(
9557
+ (child) => child.type === "tag"
9558
+ );
9559
+ const rootIndex = parseInt(rootTag, 10);
9560
+ if (rootIndex >= rootElements.length) {
9561
+ return null;
9562
+ }
9563
+ current = rootElements[rootIndex];
9564
+ return traverseByIndices(current, indices);
9565
+ }
9566
+ }
9567
+ for (const [path19, value] of Object.entries(data)) {
9568
+ const [nodePath, attribute] = path19.split("#");
9569
+ const element = resolvePathToElement(nodePath);
9570
+ if (!element) {
9571
+ console.warn(`Path not found in original template: ${nodePath}`);
9572
+ continue;
9573
+ }
9574
+ if (attribute) {
9575
+ element.attribs = element.attribs || {};
9576
+ element.attribs[attribute] = value;
9577
+ } else {
9578
+ if (value) {
9579
+ const { processed: processedValue, twigBlocks: valueTwigBlocks } = preprocessTwig(value);
9580
+ const valueHandler = new (0, _domhandler.DomHandler)();
9581
+ const valueParser = new htmlparser23.Parser(valueHandler);
9582
+ valueParser.write(processedValue);
9583
+ valueParser.end();
9584
+ element.children = valueHandler.dom;
9585
+ element.children.forEach((child) => {
9586
+ if (child.type === "text" && child.data) {
9587
+ child.data = postprocessTwig(child.data, valueTwigBlocks);
9588
+ }
9589
+ });
9590
+ } else {
9591
+ element.children = [];
9592
+ }
9593
+ }
9594
+ }
9595
+ const serialized = DomSerializer2.default(dom, { encodeEntities: false });
9596
+ return postprocessTwig(serialized, twigBlocks);
9597
+ }
9598
+ });
9599
+ }
9600
+
8981
9601
  // src/cli/loaders/ensure-key-order.ts
8982
9602
 
8983
9603
  function createEnsureKeyOrderLoader() {
@@ -9254,6 +9874,17 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
9254
9874
  createSyncLoader(),
9255
9875
  createUnlocalizableLoader(options.returnUnlocalizedKeys)
9256
9876
  );
9877
+ case "mjml":
9878
+ return composeLoaders(
9879
+ createTextFileLoader(bucketPathPattern),
9880
+ createFormatterLoader(options.formatter, "html", bucketPathPattern),
9881
+ createLockedPatternsLoader(lockedPatterns),
9882
+ createMjmlLoader(),
9883
+ createLockedKeysLoader(lockedKeys || []),
9884
+ createIgnoredKeysLoader(ignoredKeys || []),
9885
+ createSyncLoader(),
9886
+ createUnlocalizableLoader(options.returnUnlocalizedKeys)
9887
+ );
9257
9888
  case "po":
9258
9889
  return composeLoaders(
9259
9890
  createTextFileLoader(bucketPathPattern),
@@ -9465,6 +10096,16 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
9465
10096
  createIgnoredKeysLoader(ignoredKeys || []),
9466
10097
  createUnlocalizableLoader(options.returnUnlocalizedKeys)
9467
10098
  );
10099
+ case "twig":
10100
+ return composeLoaders(
10101
+ createTextFileLoader(bucketPathPattern),
10102
+ createLockedPatternsLoader(lockedPatterns),
10103
+ createTwigLoader(),
10104
+ createLockedKeysLoader(lockedKeys || []),
10105
+ createIgnoredKeysLoader(ignoredKeys || []),
10106
+ createSyncLoader(),
10107
+ createUnlocalizableLoader(options.returnUnlocalizedKeys)
10108
+ );
9468
10109
  case "txt":
9469
10110
  return composeLoaders(
9470
10111
  createTextFileLoader(bucketPathPattern),
@@ -9864,7 +10505,7 @@ function createBasicTranslator(model, systemPrompt, settings = {}) {
9864
10505
  ]
9865
10506
  });
9866
10507
  const result = JSON.parse(response.text);
9867
- return _optionalChain([result, 'optionalAccess', _325 => _325.data]) || {};
10508
+ return _optionalChain([result, 'optionalAccess', _327 => _327.data]) || {};
9868
10509
  }
9869
10510
  }
9870
10511
  function extractPayloadChunks(payload) {
@@ -9947,7 +10588,7 @@ function getPureModelProvider(provider) {
9947
10588
 
9948
10589
  ${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
9949
10590
  `;
9950
- switch (_optionalChain([provider, 'optionalAccess', _326 => _326.id])) {
10591
+ switch (_optionalChain([provider, 'optionalAccess', _328 => _328.id])) {
9951
10592
  case "openai": {
9952
10593
  if (!process.env.OPENAI_API_KEY) {
9953
10594
  throw new Error(
@@ -10005,7 +10646,7 @@ function getPureModelProvider(provider) {
10005
10646
  })(provider.model);
10006
10647
  }
10007
10648
  default: {
10008
- throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _327 => _327.id])));
10649
+ throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _329 => _329.id])));
10009
10650
  }
10010
10651
  }
10011
10652
  }
@@ -10291,7 +10932,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10291
10932
  validateParams(i18nConfig, flags);
10292
10933
  ora.succeed("Localization configuration is valid");
10293
10934
  ora.start("Connecting to Lingo.dev Localization Engine...");
10294
- const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _328 => _328.provider]);
10935
+ const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _330 => _330.provider]);
10295
10936
  if (isByokMode) {
10296
10937
  authId = null;
10297
10938
  ora.succeed("Using external provider (BYOK mode)");
@@ -10305,16 +10946,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10305
10946
  flags
10306
10947
  });
10307
10948
  let buckets = getBuckets(i18nConfig);
10308
- if (_optionalChain([flags, 'access', _329 => _329.bucket, 'optionalAccess', _330 => _330.length])) {
10949
+ if (_optionalChain([flags, 'access', _331 => _331.bucket, 'optionalAccess', _332 => _332.length])) {
10309
10950
  buckets = buckets.filter(
10310
10951
  (bucket) => flags.bucket.includes(bucket.type)
10311
10952
  );
10312
10953
  }
10313
10954
  ora.succeed("Buckets retrieved");
10314
- if (_optionalChain([flags, 'access', _331 => _331.file, 'optionalAccess', _332 => _332.length])) {
10955
+ if (_optionalChain([flags, 'access', _333 => _333.file, 'optionalAccess', _334 => _334.length])) {
10315
10956
  buckets = buckets.map((bucket) => {
10316
10957
  const paths = bucket.paths.filter(
10317
- (path19) => flags.file.find((file) => _optionalChain([path19, 'access', _333 => _333.pathPattern, 'optionalAccess', _334 => _334.includes, 'call', _335 => _335(file)]))
10958
+ (path19) => flags.file.find((file) => _optionalChain([path19, 'access', _335 => _335.pathPattern, 'optionalAccess', _336 => _336.includes, 'call', _337 => _337(file)]))
10318
10959
  );
10319
10960
  return { ...bucket, paths };
10320
10961
  }).filter((bucket) => bucket.paths.length > 0);
@@ -10335,7 +10976,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10335
10976
  });
10336
10977
  }
10337
10978
  }
10338
- const targetLocales = _optionalChain([flags, 'access', _336 => _336.locale, 'optionalAccess', _337 => _337.length]) ? flags.locale : i18nConfig.locale.targets;
10979
+ const targetLocales = _optionalChain([flags, 'access', _338 => _338.locale, 'optionalAccess', _339 => _339.length]) ? flags.locale : i18nConfig.locale.targets;
10339
10980
  ora.start("Setting up localization cache...");
10340
10981
  const checkLockfileProcessor = createDeltaProcessor("");
10341
10982
  const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
@@ -10620,7 +11261,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10620
11261
  }
10621
11262
  const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
10622
11263
  const checksums = await deltaProcessor.createChecksums(sourceData);
10623
- if (!_optionalChain([flags, 'access', _338 => _338.locale, 'optionalAccess', _339 => _339.length])) {
11264
+ if (!_optionalChain([flags, 'access', _340 => _340.locale, 'optionalAccess', _341 => _341.length])) {
10624
11265
  await deltaProcessor.saveChecksums(checksums);
10625
11266
  }
10626
11267
  }
@@ -10744,12 +11385,12 @@ function validateParams(i18nConfig, flags) {
10744
11385
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
10745
11386
  docUrl: "bucketNotFound"
10746
11387
  });
10747
- } else if (_optionalChain([flags, 'access', _340 => _340.locale, 'optionalAccess', _341 => _341.some, 'call', _342 => _342((locale) => !i18nConfig.locale.targets.includes(locale))])) {
11388
+ } else if (_optionalChain([flags, 'access', _342 => _342.locale, 'optionalAccess', _343 => _343.some, 'call', _344 => _344((locale) => !i18nConfig.locale.targets.includes(locale))])) {
10748
11389
  throw new ValidationError({
10749
11390
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
10750
11391
  docUrl: "localeTargetNotFound"
10751
11392
  });
10752
- } else if (_optionalChain([flags, 'access', _343 => _343.bucket, 'optionalAccess', _344 => _344.some, 'call', _345 => _345(
11393
+ } else if (_optionalChain([flags, 'access', _345 => _345.bucket, 'optionalAccess', _346 => _346.some, 'call', _347 => _347(
10753
11394
  (bucket) => !i18nConfig.buckets[bucket]
10754
11395
  )])) {
10755
11396
  throw new ValidationError({
@@ -11283,7 +11924,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
11283
11924
  const response = await engine.whoami();
11284
11925
  return {
11285
11926
  authenticated: !!response,
11286
- username: _optionalChain([response, 'optionalAccess', _346 => _346.email])
11927
+ username: _optionalChain([response, 'optionalAccess', _348 => _348.email])
11287
11928
  };
11288
11929
  } catch (error) {
11289
11930
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -11399,7 +12040,7 @@ function createExplicitLocalizer(provider) {
11399
12040
  }
11400
12041
  function createAiSdkLocalizer(params) {
11401
12042
  const skipAuth = params.skipAuth === true;
11402
- const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _347 => _347.apiKeyName]), () => ( ""))];
12043
+ const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _349 => _349.apiKeyName]), () => ( ""))];
11403
12044
  if (!skipAuth && !apiKey || !params.apiKeyName) {
11404
12045
  throw new Error(
11405
12046
  _dedent2.default`
@@ -11533,8 +12174,8 @@ async function setup(input2) {
11533
12174
  throw new Error(
11534
12175
  "No buckets found in i18n.json. Please add at least one bucket containing i18n content."
11535
12176
  );
11536
- } else if (_optionalChain([ctx, 'access', _348 => _348.flags, 'access', _349 => _349.bucket, 'optionalAccess', _350 => _350.some, 'call', _351 => _351(
11537
- (bucket) => !_optionalChain([ctx, 'access', _352 => _352.config, 'optionalAccess', _353 => _353.buckets, 'access', _354 => _354[bucket]])
12177
+ } else if (_optionalChain([ctx, 'access', _350 => _350.flags, 'access', _351 => _351.bucket, 'optionalAccess', _352 => _352.some, 'call', _353 => _353(
12178
+ (bucket) => !_optionalChain([ctx, 'access', _354 => _354.config, 'optionalAccess', _355 => _355.buckets, 'access', _356 => _356[bucket]])
11538
12179
  )])) {
11539
12180
  throw new Error(
11540
12181
  `One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
@@ -11547,7 +12188,7 @@ async function setup(input2) {
11547
12188
  title: "Selecting localization provider",
11548
12189
  task: async (ctx, task) => {
11549
12190
  ctx.localizer = createLocalizer(
11550
- _optionalChain([ctx, 'access', _355 => _355.config, 'optionalAccess', _356 => _356.provider]),
12191
+ _optionalChain([ctx, 'access', _357 => _357.config, 'optionalAccess', _358 => _358.provider]),
11551
12192
  ctx.flags.apiKey
11552
12193
  );
11553
12194
  if (!ctx.localizer) {
@@ -11560,7 +12201,7 @@ async function setup(input2) {
11560
12201
  },
11561
12202
  {
11562
12203
  title: "Checking authentication",
11563
- enabled: (ctx) => _optionalChain([ctx, 'access', _357 => _357.localizer, 'optionalAccess', _358 => _358.id]) === "Lingo.dev",
12204
+ enabled: (ctx) => _optionalChain([ctx, 'access', _359 => _359.localizer, 'optionalAccess', _360 => _360.id]) === "Lingo.dev",
11564
12205
  task: async (ctx, task) => {
11565
12206
  const authStatus = await ctx.localizer.checkAuth();
11566
12207
  if (!authStatus.authenticated) {
@@ -11573,7 +12214,7 @@ async function setup(input2) {
11573
12214
  },
11574
12215
  {
11575
12216
  title: "Validating configuration",
11576
- enabled: (ctx) => _optionalChain([ctx, 'access', _359 => _359.localizer, 'optionalAccess', _360 => _360.id]) !== "Lingo.dev",
12217
+ enabled: (ctx) => _optionalChain([ctx, 'access', _361 => _361.localizer, 'optionalAccess', _362 => _362.id]) !== "Lingo.dev",
11577
12218
  task: async (ctx, task) => {
11578
12219
  const validationStatus = await ctx.localizer.validateSettings();
11579
12220
  if (!validationStatus.valid) {
@@ -11904,7 +12545,7 @@ function createWorkerTask(args) {
11904
12545
  const processableData = _lodash2.default.chain(sourceData).entries().filter(
11905
12546
  ([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
11906
12547
  ).filter(
11907
- ([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _361 => _361.onlyKeys, 'optionalAccess', _362 => _362.some, 'call', _363 => _363(
12548
+ ([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _363 => _363.onlyKeys, 'optionalAccess', _364 => _364.some, 'call', _365 => _365(
11908
12549
  (pattern) => minimatch(key, pattern)
11909
12550
  )])
11910
12551
  ).fromPairs().value();
@@ -11972,7 +12613,7 @@ function createWorkerTask(args) {
11972
12613
  finalRenamedTargetData
11973
12614
  );
11974
12615
  const checksums = await deltaProcessor.createChecksums(sourceData);
11975
- if (!_optionalChain([args, 'access', _364 => _364.ctx, 'access', _365 => _365.flags, 'access', _366 => _366.targetLocale, 'optionalAccess', _367 => _367.length])) {
12616
+ if (!_optionalChain([args, 'access', _366 => _366.ctx, 'access', _367 => _367.flags, 'access', _368 => _368.targetLocale, 'optionalAccess', _369 => _369.length])) {
11976
12617
  await deltaProcessor.saveChecksums(checksums);
11977
12618
  }
11978
12619
  });
@@ -12177,10 +12818,10 @@ var flagsSchema2 = _zod.z.object({
12177
12818
  async function frozen(input2) {
12178
12819
  console.log(_chalk2.default.hex(colors.orange)("[Frozen]"));
12179
12820
  let buckets = getBuckets(input2.config);
12180
- if (_optionalChain([input2, 'access', _368 => _368.flags, 'access', _369 => _369.bucket, 'optionalAccess', _370 => _370.length])) {
12821
+ if (_optionalChain([input2, 'access', _370 => _370.flags, 'access', _371 => _371.bucket, 'optionalAccess', _372 => _372.length])) {
12181
12822
  buckets = buckets.filter((b) => input2.flags.bucket.includes(b.type));
12182
12823
  }
12183
- if (_optionalChain([input2, 'access', _371 => _371.flags, 'access', _372 => _372.file, 'optionalAccess', _373 => _373.length])) {
12824
+ if (_optionalChain([input2, 'access', _373 => _373.flags, 'access', _374 => _374.file, 'optionalAccess', _375 => _375.length])) {
12184
12825
  buckets = buckets.map((bucket) => {
12185
12826
  const paths = bucket.paths.filter(
12186
12827
  (p) => input2.flags.file.some(
@@ -12317,13 +12958,13 @@ async function frozen(input2) {
12317
12958
 
12318
12959
  // src/cli/cmd/run/_utils.ts
12319
12960
  async function determineAuthId(ctx) {
12320
- const isByokMode = !!_optionalChain([ctx, 'access', _374 => _374.config, 'optionalAccess', _375 => _375.provider]);
12961
+ const isByokMode = !!_optionalChain([ctx, 'access', _376 => _376.config, 'optionalAccess', _377 => _377.provider]);
12321
12962
  if (isByokMode) {
12322
12963
  return null;
12323
12964
  } else {
12324
12965
  try {
12325
- const authStatus = await _optionalChain([ctx, 'access', _376 => _376.localizer, 'optionalAccess', _377 => _377.checkAuth, 'call', _378 => _378()]);
12326
- return _optionalChain([authStatus, 'optionalAccess', _379 => _379.username]) || null;
12966
+ const authStatus = await _optionalChain([ctx, 'access', _378 => _378.localizer, 'optionalAccess', _379 => _379.checkAuth, 'call', _380 => _380()]);
12967
+ return _optionalChain([authStatus, 'optionalAccess', _381 => _381.username]) || null;
12327
12968
  } catch (e3) {
12328
12969
  return null;
12329
12970
  }
@@ -12521,7 +13162,7 @@ var InBranchFlow = class extends IntegrationFlow {
12521
13162
  _child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
12522
13163
  _child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
12523
13164
  _child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
12524
- _optionalChain([this, 'access', _380 => _380.platformKit, 'optionalAccess', _381 => _381.gitConfig, 'call', _382 => _382()]);
13165
+ _optionalChain([this, 'access', _382 => _382.platformKit, 'optionalAccess', _383 => _383.gitConfig, 'call', _384 => _384()]);
12525
13166
  _child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
12526
13167
  _child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
12527
13168
  if (!processOwnCommits) {
@@ -12553,7 +13194,7 @@ var InBranchFlow = class extends IntegrationFlow {
12553
13194
  // src/cli/cmd/ci/flows/pull-request.ts
12554
13195
  var PullRequestFlow = class extends InBranchFlow {
12555
13196
  async preRun() {
12556
- const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _383 => _383()]);
13197
+ const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _385 => _385()]);
12557
13198
  if (!canContinue) {
12558
13199
  return false;
12559
13200
  }
@@ -12820,10 +13461,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
12820
13461
  repo_slug: this.platformConfig.repositoryName,
12821
13462
  state: "OPEN"
12822
13463
  }).then(({ data: { values } }) => {
12823
- return _optionalChain([values, 'optionalAccess', _384 => _384.find, 'call', _385 => _385(
12824
- ({ source, destination }) => _optionalChain([source, 'optionalAccess', _386 => _386.branch, 'optionalAccess', _387 => _387.name]) === branch && _optionalChain([destination, 'optionalAccess', _388 => _388.branch, 'optionalAccess', _389 => _389.name]) === this.platformConfig.baseBranchName
13464
+ return _optionalChain([values, 'optionalAccess', _386 => _386.find, 'call', _387 => _387(
13465
+ ({ source, destination }) => _optionalChain([source, 'optionalAccess', _388 => _388.branch, 'optionalAccess', _389 => _389.name]) === branch && _optionalChain([destination, 'optionalAccess', _390 => _390.branch, 'optionalAccess', _391 => _391.name]) === this.platformConfig.baseBranchName
12825
13466
  )]);
12826
- }).then((pr) => _optionalChain([pr, 'optionalAccess', _390 => _390.id]));
13467
+ }).then((pr) => _optionalChain([pr, 'optionalAccess', _392 => _392.id]));
12827
13468
  }
12828
13469
  async closePullRequest({ pullRequestNumber }) {
12829
13470
  await this.bb.repositories.declinePullRequest({
@@ -12919,7 +13560,7 @@ var GitHubPlatformKit = class extends PlatformKit {
12919
13560
  repo: this.platformConfig.repositoryName,
12920
13561
  base: this.platformConfig.baseBranchName,
12921
13562
  state: "open"
12922
- }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _391 => _391.number]));
13563
+ }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _393 => _393.number]));
12923
13564
  }
12924
13565
  async closePullRequest({ pullRequestNumber }) {
12925
13566
  await this.octokit.rest.pulls.update({
@@ -13046,7 +13687,7 @@ var GitlabPlatformKit = class extends PlatformKit {
13046
13687
  sourceBranch: branch,
13047
13688
  state: "opened"
13048
13689
  });
13049
- return _optionalChain([mergeRequests, 'access', _392 => _392[0], 'optionalAccess', _393 => _393.iid]);
13690
+ return _optionalChain([mergeRequests, 'access', _394 => _394[0], 'optionalAccess', _395 => _395.iid]);
13050
13691
  }
13051
13692
  async closePullRequest({
13052
13693
  pullRequestNumber
@@ -13158,7 +13799,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
13158
13799
  }
13159
13800
  const env = {
13160
13801
  LINGODOTDEV_API_KEY: settings.auth.apiKey,
13161
- LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _394 => _394.pullRequest, 'optionalAccess', _395 => _395.toString, 'call', _396 => _396()]) || "false",
13802
+ LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _396 => _396.pullRequest, 'optionalAccess', _397 => _397.toString, 'call', _398 => _398()]) || "false",
13162
13803
  ...options.commitMessage && {
13163
13804
  LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
13164
13805
  },
@@ -13184,7 +13825,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
13184
13825
  const { isPullRequestMode } = platformKit.config;
13185
13826
  ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
13186
13827
  const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
13187
- const canRun = await _optionalChain([flow, 'access', _397 => _397.preRun, 'optionalCall', _398 => _398()]);
13828
+ const canRun = await _optionalChain([flow, 'access', _399 => _399.preRun, 'optionalCall', _400 => _400()]);
13188
13829
  if (canRun === false) {
13189
13830
  return;
13190
13831
  }
@@ -13194,7 +13835,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
13194
13835
  if (!hasChanges) {
13195
13836
  return;
13196
13837
  }
13197
- await _optionalChain([flow, 'access', _399 => _399.postRun, 'optionalCall', _400 => _400()]);
13838
+ await _optionalChain([flow, 'access', _401 => _401.postRun, 'optionalCall', _402 => _402()]);
13198
13839
  });
13199
13840
  function parseBooleanArg(val) {
13200
13841
  if (val === true) return true;
@@ -13231,8 +13872,8 @@ function exitGracefully(elapsedMs = 0) {
13231
13872
  }
13232
13873
  }
13233
13874
  function checkForPendingOperations() {
13234
- const activeHandles = _optionalChain([process, 'access', _401 => _401._getActiveHandles, 'optionalCall', _402 => _402()]) || [];
13235
- const activeRequests = _optionalChain([process, 'access', _403 => _403._getActiveRequests, 'optionalCall', _404 => _404()]) || [];
13875
+ const activeHandles = _optionalChain([process, 'access', _403 => _403._getActiveHandles, 'optionalCall', _404 => _404()]) || [];
13876
+ const activeRequests = _optionalChain([process, 'access', _405 => _405._getActiveRequests, 'optionalCall', _406 => _406()]) || [];
13236
13877
  const nonStandardHandles = activeHandles.filter((handle) => {
13237
13878
  if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
13238
13879
  return false;
@@ -13301,17 +13942,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
13301
13942
  flags
13302
13943
  });
13303
13944
  let buckets = getBuckets(i18nConfig);
13304
- if (_optionalChain([flags, 'access', _405 => _405.bucket, 'optionalAccess', _406 => _406.length])) {
13945
+ if (_optionalChain([flags, 'access', _407 => _407.bucket, 'optionalAccess', _408 => _408.length])) {
13305
13946
  buckets = buckets.filter(
13306
13947
  (bucket) => flags.bucket.includes(bucket.type)
13307
13948
  );
13308
13949
  }
13309
13950
  ora.succeed("Buckets retrieved");
13310
- if (_optionalChain([flags, 'access', _407 => _407.file, 'optionalAccess', _408 => _408.length])) {
13951
+ if (_optionalChain([flags, 'access', _409 => _409.file, 'optionalAccess', _410 => _410.length])) {
13311
13952
  buckets = buckets.map((bucket) => {
13312
13953
  const paths = bucket.paths.filter(
13313
13954
  (path19) => flags.file.find(
13314
- (file) => _optionalChain([path19, 'access', _409 => _409.pathPattern, 'optionalAccess', _410 => _410.includes, 'call', _411 => _411(file)]) || _optionalChain([path19, 'access', _412 => _412.pathPattern, 'optionalAccess', _413 => _413.match, 'call', _414 => _414(file)]) || minimatch(path19.pathPattern, file)
13955
+ (file) => _optionalChain([path19, 'access', _411 => _411.pathPattern, 'optionalAccess', _412 => _412.includes, 'call', _413 => _413(file)]) || _optionalChain([path19, 'access', _414 => _414.pathPattern, 'optionalAccess', _415 => _415.match, 'call', _416 => _416(file)]) || minimatch(path19.pathPattern, file)
13315
13956
  )
13316
13957
  );
13317
13958
  return { ...bucket, paths };
@@ -13331,7 +13972,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
13331
13972
  });
13332
13973
  }
13333
13974
  }
13334
- const targetLocales = _optionalChain([flags, 'access', _415 => _415.locale, 'optionalAccess', _416 => _416.length]) ? flags.locale : i18nConfig.locale.targets;
13975
+ const targetLocales = _optionalChain([flags, 'access', _417 => _417.locale, 'optionalAccess', _418 => _418.length]) ? flags.locale : i18nConfig.locale.targets;
13335
13976
  let totalSourceKeyCount = 0;
13336
13977
  let uniqueKeysToTranslate = 0;
13337
13978
  let totalExistingTranslations = 0;
@@ -13739,12 +14380,12 @@ function validateParams2(i18nConfig, flags) {
13739
14380
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
13740
14381
  docUrl: "bucketNotFound"
13741
14382
  });
13742
- } else if (_optionalChain([flags, 'access', _417 => _417.locale, 'optionalAccess', _418 => _418.some, 'call', _419 => _419((locale) => !i18nConfig.locale.targets.includes(locale))])) {
14383
+ } else if (_optionalChain([flags, 'access', _419 => _419.locale, 'optionalAccess', _420 => _420.some, 'call', _421 => _421((locale) => !i18nConfig.locale.targets.includes(locale))])) {
13743
14384
  throw new CLIError({
13744
14385
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
13745
14386
  docUrl: "localeTargetNotFound"
13746
14387
  });
13747
- } else if (_optionalChain([flags, 'access', _420 => _420.bucket, 'optionalAccess', _421 => _421.some, 'call', _422 => _422(
14388
+ } else if (_optionalChain([flags, 'access', _422 => _422.bucket, 'optionalAccess', _423 => _423.some, 'call', _424 => _424(
13748
14389
  (bucket) => !i18nConfig.buckets[bucket]
13749
14390
  )])) {
13750
14391
  throw new CLIError({
@@ -13836,7 +14477,7 @@ async function renderHero2() {
13836
14477
  // package.json
13837
14478
  var package_default = {
13838
14479
  name: "lingo.dev",
13839
- version: "0.117.6",
14480
+ version: "0.117.8",
13840
14481
  description: "Lingo.dev CLI",
13841
14482
  private: false,
13842
14483
  publishConfig: {
@@ -14132,7 +14773,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
14132
14773
  if (options.file && options.file.length) {
14133
14774
  buckets = buckets.map((bucket) => {
14134
14775
  const paths = bucket.paths.filter(
14135
- (bucketPath) => _optionalChain([options, 'access', _423 => _423.file, 'optionalAccess', _424 => _424.some, 'call', _425 => _425((f) => bucketPath.pathPattern.includes(f))])
14776
+ (bucketPath) => _optionalChain([options, 'access', _425 => _425.file, 'optionalAccess', _426 => _426.some, 'call', _427 => _427((f) => bucketPath.pathPattern.includes(f))])
14136
14777
  );
14137
14778
  return { ...bucket, paths };
14138
14779
  }).filter((bucket) => bucket.paths.length > 0);