lingo.dev 0.70.4 → 0.72.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkMNP3B6L4cjs = require('./chunk-MNP3B6L4.cjs');
3
+ var _chunkHODTYTE5cjs = require('./chunk-HODTYTE5.cjs');
4
4
 
5
5
 
6
6
 
@@ -10,13 +10,15 @@ var _chunkMNP3B6L4cjs = require('./chunk-MNP3B6L4.cjs');
10
10
 
11
11
 
12
12
 
13
- var _chunkDTGLPBE5cjs = require('./chunk-DTGLPBE5.cjs');
13
+ var _chunkBCCNAFJBcjs = require('./chunk-BCCNAFJB.cjs');
14
14
 
15
15
  // src/cli/index.ts
16
16
  var _dotenv = require('dotenv'); var _dotenv2 = _interopRequireDefault(_dotenv);
17
17
  var _interactivecommander = require('interactive-commander');
18
+ var _figlet = require('figlet'); var _figlet2 = _interopRequireDefault(_figlet);
19
+ var _gradientstring = require('gradient-string');
18
20
 
19
- // src/cli/cli/auth.ts
21
+ // src/cli/cmd/auth.ts
20
22
 
21
23
  var _ora = require('ora'); var _ora2 = _interopRequireDefault(_ora);
22
24
  var _express = require('express'); var _express2 = _interopRequireDefault(_express);
@@ -34,11 +36,12 @@ function getSettings(explicitApiKey) {
34
36
  const env = _loadEnv();
35
37
  const systemFile = _loadSystemFile();
36
38
  const defaults = _loadDefaults();
39
+ _legacyEnvVarWarning();
37
40
  return {
38
41
  auth: {
39
- apiKey: explicitApiKey || env.REPLEXICA_API_KEY || _optionalChain([systemFile, 'access', _20 => _20.auth, 'optionalAccess', _21 => _21.apiKey]) || defaults.auth.apiKey,
40
- apiUrl: env.REPLEXICA_API_URL || _optionalChain([systemFile, 'access', _22 => _22.auth, 'optionalAccess', _23 => _23.apiUrl]) || defaults.auth.apiUrl,
41
- webUrl: env.REPLEXICA_WEB_URL || _optionalChain([systemFile, 'access', _24 => _24.auth, 'optionalAccess', _25 => _25.webUrl]) || defaults.auth.webUrl
42
+ apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access', _20 => _20.auth, 'optionalAccess', _21 => _21.apiKey]) || defaults.auth.apiKey,
43
+ apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _22 => _22.auth, 'optionalAccess', _23 => _23.apiUrl]) || defaults.auth.apiUrl,
44
+ webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _24 => _24.auth, 'optionalAccess', _25 => _25.webUrl]) || defaults.auth.webUrl
42
45
  }
43
46
  };
44
47
  }
@@ -63,9 +66,9 @@ function _loadDefaults() {
63
66
  }
64
67
  function _loadEnv() {
65
68
  return _zod2.default.object({
66
- REPLEXICA_API_KEY: _zod2.default.string().optional(),
67
- REPLEXICA_API_URL: _zod2.default.string().optional(),
68
- REPLEXICA_WEB_URL: _zod2.default.string().optional()
69
+ LINGODOTDEV_API_KEY: _zod2.default.string().optional(),
70
+ LINGODOTDEV_API_URL: _zod2.default.string().optional(),
71
+ LINGODOTDEV_WEB_URL: _zod2.default.string().optional()
69
72
  }).passthrough().parse(process.env);
70
73
  }
71
74
  function _loadSystemFile() {
@@ -91,6 +94,21 @@ function _getSettingsFilePath() {
91
94
  const settingsFilePath = _path2.default.join(homedir, settingsFile);
92
95
  return settingsFilePath;
93
96
  }
97
+ function _legacyEnvVarWarning() {
98
+ const env = _loadEnv();
99
+ if (env.REPLEXICA_API_KEY && !env.LINGODOTDEV_API_KEY) {
100
+ console.warn(
101
+ "\x1B[33m%s\x1B[0m",
102
+ `
103
+ \u26A0\uFE0F WARNING: REPLEXICA_API_KEY env var is deprecated \u26A0\uFE0F
104
+ ===========================================================
105
+
106
+ Please use LINGODOTDEV_API_KEY instead.
107
+ ===========================================================
108
+ `
109
+ );
110
+ }
111
+ }
94
112
 
95
113
  // src/cli/utils/errors.ts
96
114
  var docLinks = {
@@ -156,7 +174,7 @@ function createAuthenticator(params) {
156
174
  };
157
175
  }
158
176
 
159
- // src/cli/cli/auth.ts
177
+ // src/cli/cmd/auth.ts
160
178
  var auth_default = new (0, _interactivecommander.Command)().command("auth").description("Authenticate with Lingo.dev API").helpOption("-h, --help", "Show help").option("--logout", "Delete existing authentication").option("--login", "Authenticate with Lingo.dev API").action(async (options) => {
161
179
  try {
162
180
  let settings = await getSettings(void 0);
@@ -195,7 +213,7 @@ Press Enter to open the browser for authentication.
195
213
 
196
214
  ---
197
215
 
198
- Having issues? Put REPLEXICA_API_KEY in your .env file instead.
216
+ Having issues? Put LINGODOTDEV_API_KEY in your .env file instead.
199
217
  `.trim() + "\n"
200
218
  );
201
219
  const spinner = _ora2.default.call(void 0, ).start("Waiting for the API key");
@@ -224,7 +242,7 @@ async function waitForApiKey(cb) {
224
242
  });
225
243
  }
226
244
 
227
- // src/cli/cli/init.ts
245
+ // src/cli/cmd/init.ts
228
246
 
229
247
 
230
248
 
@@ -240,7 +258,7 @@ function getConfig(resave = true) {
240
258
  }
241
259
  const fileContents = _fs2.default.readFileSync(configFilePath, "utf8");
242
260
  const rawConfig = JSON.parse(fileContents);
243
- const result = _chunkDTGLPBE5cjs.parseI18nConfig.call(void 0, rawConfig);
261
+ const result = _chunkBCCNAFJBcjs.parseI18nConfig.call(void 0, rawConfig);
244
262
  const didConfigChange = !_lodash2.default.isEqual(rawConfig, result);
245
263
  if (resave && didConfigChange) {
246
264
  saveConfig(result);
@@ -257,14 +275,14 @@ function _getConfigFilePath() {
257
275
  return _path2.default.join(process.cwd(), "i18n.json");
258
276
  }
259
277
 
260
- // src/cli/cli/init.ts
278
+ // src/cli/cmd/init.ts
261
279
 
262
280
  var _child_process = require('child_process');
263
281
 
264
282
  var _prompts = require('@inquirer/prompts');
265
- var openUrl = (path7) => {
283
+ var openUrl = (path8) => {
266
284
  const settings = getSettings(void 0);
267
- _child_process.spawn.call(void 0, "open", [`${settings.auth.webUrl}${path7}`]);
285
+ _child_process.spawn.call(void 0, "open", [`${settings.auth.webUrl}${path8}`]);
268
286
  };
269
287
  var throwHelpError = (option, value) => {
270
288
  if (value === "help") {
@@ -279,7 +297,7 @@ Do you need support for ${value} ${option}? Type "help" and we will.`
279
297
  var init_default = new (0, _interactivecommander.InteractiveCommand)().command("init").description("Initialize Lingo.dev project").helpOption("-h, --help", "Show help").addOption(new (0, _interactivecommander.InteractiveOption)("-f --force", "Overwrite existing config").prompt(void 0).default(false)).addOption(
280
298
  new (0, _interactivecommander.InteractiveOption)("-s --source <locale>", "Source locale").argParser((value) => {
281
299
  try {
282
- _chunkDTGLPBE5cjs.resolveLocaleCode.call(void 0, value);
300
+ _chunkBCCNAFJBcjs.resolveLocaleCode.call(void 0, value);
283
301
  } catch (e) {
284
302
  throwHelpError("locale", value);
285
303
  }
@@ -290,7 +308,7 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
290
308
  const values = value.includes(",") ? value.split(",") : value.split(" ");
291
309
  values.forEach((value2) => {
292
310
  try {
293
- _chunkDTGLPBE5cjs.resolveLocaleCode.call(void 0, value2);
311
+ _chunkBCCNAFJBcjs.resolveLocaleCode.call(void 0, value2);
294
312
  } catch (e) {
295
313
  throwHelpError("locale", value2);
296
314
  }
@@ -299,7 +317,7 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
299
317
  }).default("es")
300
318
  ).addOption(
301
319
  new (0, _interactivecommander.InteractiveOption)("-b, --bucket <type>", "Type of bucket").argParser((value) => {
302
- if (!_chunkDTGLPBE5cjs.bucketTypes.includes(value)) {
320
+ if (!_chunkBCCNAFJBcjs.bucketTypes.includes(value)) {
303
321
  throwHelpError("bucket format", value);
304
322
  }
305
323
  return value;
@@ -307,14 +325,14 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
307
325
  ).addOption(
308
326
  new (0, _interactivecommander.InteractiveOption)("-p, --paths <path...>", "List of paths for the bucket").argParser((value) => {
309
327
  const values = value.includes(",") ? value.split(",") : value.split(" ");
310
- for (const path7 of values) {
328
+ for (const path8 of values) {
311
329
  try {
312
- const stats = _fs2.default.statSync(path7);
330
+ const stats = _fs2.default.statSync(path8);
313
331
  if (!stats.isDirectory()) {
314
- throw new Error(`${path7} is not a directory`);
332
+ throw new Error(`${path8} is not a directory`);
315
333
  }
316
334
  } catch (err) {
317
- throw new Error(`Invalid directory path: ${path7}`);
335
+ throw new Error(`Invalid directory path: ${path8}`);
318
336
  }
319
337
  }
320
338
  return values;
@@ -327,7 +345,7 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
327
345
  spinner.fail("Lingo.dev project already initialized");
328
346
  return process.exit(1);
329
347
  }
330
- const newConfig = _lodash2.default.cloneDeep(_chunkDTGLPBE5cjs.defaultConfig);
348
+ const newConfig = _lodash2.default.cloneDeep(_chunkBCCNAFJBcjs.defaultConfig);
331
349
  newConfig.locale.source = options.source;
332
350
  newConfig.locale.targets = options.targets;
333
351
  newConfig.buckets = {
@@ -378,17 +396,17 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
378
396
  }
379
397
  });
380
398
 
381
- // src/cli/cli/show/index.ts
399
+ // src/cli/cmd/show/index.ts
382
400
 
383
401
 
384
- // src/cli/cli/show/config.ts
402
+ // src/cli/cmd/show/config.ts
385
403
 
386
404
 
387
405
 
388
406
 
389
407
  var config_default = new (0, _interactivecommander.Command)().command("config").description("Print out the current configuration").helpOption("-h, --help", "Show help").action(async (options) => {
390
408
  const fileConfig = loadReplexicaFileConfig();
391
- const config = _lodash2.default.merge({}, _chunkDTGLPBE5cjs.defaultConfig, fileConfig);
409
+ const config = _lodash2.default.merge({}, _chunkBCCNAFJBcjs.defaultConfig, fileConfig);
392
410
  console.log(JSON.stringify(config, null, 2));
393
411
  });
394
412
  function loadReplexicaFileConfig() {
@@ -402,7 +420,7 @@ function loadReplexicaFileConfig() {
402
420
  return replexicaFileConfig;
403
421
  }
404
422
 
405
- // src/cli/cli/show/locale.ts
423
+ // src/cli/cmd/show/locale.ts
406
424
 
407
425
 
408
426
  var locale_default = new (0, _interactivecommander.Command)().command("locale").description("Print out the list of locales").helpOption("-h, --help", "Show help").argument("<type>", 'Type of locales to show, either "sources" or "targets"').action(async (type) => {
@@ -415,10 +433,10 @@ var locale_default = new (0, _interactivecommander.Command)().command("locale").
415
433
  docUrl: "invalidType"
416
434
  });
417
435
  case "sources":
418
- _chunkDTGLPBE5cjs.localeCodes.forEach((locale) => console.log(locale));
436
+ _chunkBCCNAFJBcjs.localeCodes.forEach((locale) => console.log(locale));
419
437
  break;
420
438
  case "targets":
421
- _chunkDTGLPBE5cjs.localeCodes.forEach((locale) => console.log(locale));
439
+ _chunkBCCNAFJBcjs.localeCodes.forEach((locale) => console.log(locale));
422
440
  break;
423
441
  }
424
442
  } catch (error) {
@@ -427,7 +445,7 @@ var locale_default = new (0, _interactivecommander.Command)().command("locale").
427
445
  }
428
446
  });
429
447
 
430
- // src/cli/cli/show/files.ts
448
+ // src/cli/cmd/show/files.ts
431
449
 
432
450
 
433
451
 
@@ -448,7 +466,7 @@ function getBuckets(i18nConfig) {
448
466
  }
449
467
  function extractPathPatterns(sourceLocale, include, exclude) {
450
468
  const includedPatterns = include.flatMap(
451
- (pattern) => expandPlaceholderedGlob(pattern.path, _chunkDTGLPBE5cjs.resolveOverridenLocale.call(void 0, sourceLocale, pattern.delimiter)).map(
469
+ (pattern) => expandPlaceholderedGlob(pattern.path, _chunkBCCNAFJBcjs.resolveOverridenLocale.call(void 0, sourceLocale, pattern.delimiter)).map(
452
470
  (pathPattern) => ({
453
471
  pathPattern,
454
472
  delimiter: pattern.delimiter
@@ -456,7 +474,7 @@ function extractPathPatterns(sourceLocale, include, exclude) {
456
474
  )
457
475
  );
458
476
  const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _31 => _31.flatMap, 'call', _32 => _32(
459
- (pattern) => expandPlaceholderedGlob(pattern.path, _chunkDTGLPBE5cjs.resolveOverridenLocale.call(void 0, sourceLocale, pattern.delimiter)).map(
477
+ (pattern) => expandPlaceholderedGlob(pattern.path, _chunkBCCNAFJBcjs.resolveOverridenLocale.call(void 0, sourceLocale, pattern.delimiter)).map(
460
478
  (pathPattern) => ({
461
479
  pathPattern,
462
480
  delimiter: pattern.delimiter
@@ -511,7 +529,7 @@ function resolveBucketItem(bucketItem) {
511
529
  return bucketItem;
512
530
  }
513
531
 
514
- // src/cli/cli/show/files.ts
532
+ // src/cli/cmd/show/files.ts
515
533
  var files_default = new (0, _interactivecommander.Command)().command("files").description("Print out the list of files managed by Lingo.dev").option("--source", "Only show source files").option("--target", "Only show target files").helpOption("-h, --help", "Show help").action(async (type) => {
516
534
  const ora = _ora2.default.call(void 0, );
517
535
  try {
@@ -526,10 +544,10 @@ var files_default = new (0, _interactivecommander.Command)().command("files").de
526
544
  const buckets = getBuckets(i18nConfig);
527
545
  for (const bucket of buckets) {
528
546
  for (const bucketConfig of bucket.config) {
529
- const sourceLocale = _chunkDTGLPBE5cjs.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
547
+ const sourceLocale = _chunkBCCNAFJBcjs.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
530
548
  const sourcePath = bucketConfig.pathPattern.replace(/\[locale\]/g, sourceLocale);
531
549
  const targetPaths = i18nConfig.locale.targets.map((_targetLocale) => {
532
- const targetLocale = _chunkDTGLPBE5cjs.resolveOverridenLocale.call(void 0, _targetLocale, bucketConfig.delimiter);
550
+ const targetLocale = _chunkBCCNAFJBcjs.resolveOverridenLocale.call(void 0, _targetLocale, bucketConfig.delimiter);
533
551
  return bucketConfig.pathPattern.replace(/\[locale\]/g, targetLocale);
534
552
  });
535
553
  const result = [];
@@ -540,8 +558,8 @@ var files_default = new (0, _interactivecommander.Command)().command("files").de
540
558
  } else if (type.target) {
541
559
  result.push(...targetPaths);
542
560
  }
543
- result.forEach((path7) => {
544
- console.log(path7);
561
+ result.forEach((path8) => {
562
+ console.log(path8);
545
563
  });
546
564
  }
547
565
  }
@@ -557,10 +575,10 @@ var files_default = new (0, _interactivecommander.Command)().command("files").de
557
575
  }
558
576
  });
559
577
 
560
- // src/cli/cli/show/index.ts
578
+ // src/cli/cmd/show/index.ts
561
579
  var show_default = new (0, _interactivecommander.Command)().command("show").description("Prints out the current configuration").helpOption("-h, --help", "Show help").addCommand(config_default).addCommand(locale_default).addCommand(files_default);
562
580
 
563
- // src/cli/cli/i18n.ts
581
+ // src/cli/cmd/i18n.ts
564
582
 
565
583
 
566
584
 
@@ -706,7 +724,7 @@ function createTextFileLoader(pathPattern) {
706
724
  const finalPath = _path2.default.resolve(draftPath);
707
725
  const dirPath = _path2.default.dirname(finalPath);
708
726
  await _promises4.default.mkdir(dirPath, { recursive: true });
709
- const finalPayload = data.trim() + "\n";
727
+ const finalPayload = data.trim();
710
728
  await _promises4.default.writeFile(finalPath, finalPayload, {
711
729
  encoding: "utf-8",
712
730
  flag: "w"
@@ -979,9 +997,9 @@ function createHtmlLoader() {
979
997
  const bDepth = b.split("/").length;
980
998
  return aDepth - bDepth;
981
999
  });
982
- paths.forEach((path7) => {
983
- const value = data[path7];
984
- const [nodePath, attribute] = path7.split("#");
1000
+ paths.forEach((path8) => {
1001
+ const value = data[path8];
1002
+ const [nodePath, attribute] = path8.split("#");
985
1003
  const [rootTag, ...indices] = nodePath.split("/");
986
1004
  let parent = rootTag === "head" ? document.head : document.body;
987
1005
  let current = parent;
@@ -1253,7 +1271,7 @@ function createPrettierLoader(options) {
1253
1271
  return data;
1254
1272
  }
1255
1273
  const result = _prettier2.default.format(data, {
1256
- ...prettierConfig || { printWidth: 2500 },
1274
+ ...prettierConfig || { printWidth: 2500, bracketSameLine: false },
1257
1275
  parser: options.parser,
1258
1276
  // For HTML parser, preserve comments and quotes
1259
1277
  ...options.parser === "html" ? {
@@ -1979,18 +1997,18 @@ function createRawDatoValue(parsedDatoValue, originalRawDatoValue, isClean = fal
1979
1997
  }
1980
1998
  function serializeStructuredText(rawStructuredText) {
1981
1999
  return serializeStructuredTextNode(rawStructuredText);
1982
- function serializeStructuredTextNode(node, path7 = [], acc = {}) {
2000
+ function serializeStructuredTextNode(node, path8 = [], acc = {}) {
1983
2001
  if ("document" in node) {
1984
- return serializeStructuredTextNode(node.document, [...path7, "document"], acc);
2002
+ return serializeStructuredTextNode(node.document, [...path8, "document"], acc);
1985
2003
  }
1986
2004
  if (!_lodash2.default.isNil(node.value)) {
1987
- acc[[...path7, "value"].join(".")] = node.value;
2005
+ acc[[...path8, "value"].join(".")] = node.value;
1988
2006
  } else if (_lodash2.default.get(node, "type") === "block") {
1989
- acc[[...path7, "item"].join(".")] = serializeBlock(node.item);
2007
+ acc[[...path8, "item"].join(".")] = serializeBlock(node.item);
1990
2008
  }
1991
2009
  if (node.children) {
1992
2010
  for (let i = 0; i < node.children.length; i++) {
1993
- serializeStructuredTextNode(node.children[i], [...path7, i.toString()], acc);
2011
+ serializeStructuredTextNode(node.children[i], [...path8, i.toString()], acc);
1994
2012
  }
1995
2013
  }
1996
2014
  return acc;
@@ -2049,8 +2067,8 @@ function deserializeBlockList(parsedBlockList, originalRawBlockList, isClean = f
2049
2067
  }
2050
2068
  function deserializeStructuredText(parsedStructuredText, originalRawStructuredText) {
2051
2069
  const result = _lodash2.default.cloneDeep(originalRawStructuredText);
2052
- for (const [path7, value] of _lodash2.default.entries(parsedStructuredText)) {
2053
- const realPath = _lodash2.default.chain(path7.split(".")).flatMap((s) => !_lodash2.default.isNaN(_lodash2.default.toNumber(s)) ? ["children", s] : s).value();
2070
+ for (const [path8, value] of _lodash2.default.entries(parsedStructuredText)) {
2071
+ const realPath = _lodash2.default.chain(path8.split(".")).flatMap((s) => !_lodash2.default.isNaN(_lodash2.default.toNumber(s)) ? ["children", s] : s).value();
2054
2072
  const deserializedValue = createRawDatoValue(value, _lodash2.default.get(originalRawStructuredText, realPath), true);
2055
2073
  _lodash2.default.set(result, realPath, deserializedValue);
2056
2074
  }
@@ -2118,7 +2136,6 @@ function createVttLoader() {
2118
2136
  text
2119
2137
  };
2120
2138
  });
2121
- console.log(payload, output);
2122
2139
  const input = {
2123
2140
  valid: true,
2124
2141
  strict: true,
@@ -2218,6 +2235,76 @@ function createSyncLoader() {
2218
2235
  });
2219
2236
  }
2220
2237
 
2238
+ // src/cli/utils/plutil-formatter.ts
2239
+ function formatPlutilStyle(jsonData, existingJson) {
2240
+ const indent = existingJson ? detectIndentation(existingJson) : " ";
2241
+ function format(data, level = 0) {
2242
+ const currentIndent = indent.repeat(level);
2243
+ const nextIndent = indent.repeat(level + 1);
2244
+ if (typeof data !== "object" || data === null) {
2245
+ return JSON.stringify(data);
2246
+ }
2247
+ if (Array.isArray(data)) {
2248
+ if (data.length === 0) return "[]";
2249
+ const items2 = data.map((item) => `${nextIndent}${format(item, level + 1)}`);
2250
+ return `[
2251
+ ${items2.join(",\n")}
2252
+ ${currentIndent}]`;
2253
+ }
2254
+ const keys = Object.keys(data);
2255
+ if (keys.length === 0) {
2256
+ return `{
2257
+
2258
+ ${currentIndent}}`;
2259
+ }
2260
+ const items = keys.map((key) => {
2261
+ const value = data[key];
2262
+ return `${nextIndent}${JSON.stringify(key)} : ${format(value, level + 1)}`;
2263
+ });
2264
+ return `{
2265
+ ${items.join(",\n")}
2266
+ ${currentIndent}}`;
2267
+ }
2268
+ return format(jsonData);
2269
+ }
2270
+ function detectIndentation(jsonStr) {
2271
+ const match = jsonStr.match(/\n(\s+)/);
2272
+ return match ? match[1] : " ";
2273
+ }
2274
+
2275
+ // src/cli/loaders/plutil-json-loader.ts
2276
+ function createPlutilJsonTextLoader() {
2277
+ return createLoader({
2278
+ async pull(locale, data) {
2279
+ return data;
2280
+ },
2281
+ async push(locale, data, originalInput) {
2282
+ const jsonData = JSON.parse(data);
2283
+ const result = formatPlutilStyle(jsonData, originalInput || "");
2284
+ console.log(result[result.length - 1]);
2285
+ return result;
2286
+ }
2287
+ });
2288
+ }
2289
+
2290
+ // src/cli/loaders/new-line.ts
2291
+ function createNewLineLoader() {
2292
+ return createLoader({
2293
+ async pull(locale, input) {
2294
+ return input;
2295
+ },
2296
+ async push(locale, data, originalInput) {
2297
+ if (!data) return "";
2298
+ const trimmed = data.replace(/[\r\n]+$/, "");
2299
+ if (_optionalChain([originalInput, 'optionalAccess', _119 => _119.match, 'call', _120 => _120(/[\r\n]$/)])) {
2300
+ const ending = _optionalChain([originalInput, 'optionalAccess', _121 => _121.includes, 'call', _122 => _122("\r\n")]) ? "\r\n" : _optionalChain([originalInput, 'optionalAccess', _123 => _123.includes, 'call', _124 => _124("\r")]) ? "\r" : "\n";
2301
+ return trimmed + ending;
2302
+ }
2303
+ return trimmed;
2304
+ }
2305
+ });
2306
+ }
2307
+
2221
2308
  // src/cli/loaders/index.ts
2222
2309
  function createBucketLoader(bucketType, bucketPathPattern) {
2223
2310
  switch (bucketType) {
@@ -2226,6 +2313,7 @@ function createBucketLoader(bucketType, bucketPathPattern) {
2226
2313
  case "android":
2227
2314
  return composeLoaders(
2228
2315
  createTextFileLoader(bucketPathPattern),
2316
+ createNewLineLoader(),
2229
2317
  createAndroidLoader(),
2230
2318
  createFlatLoader(),
2231
2319
  createSyncLoader(),
@@ -2234,6 +2322,7 @@ function createBucketLoader(bucketType, bucketPathPattern) {
2234
2322
  case "csv":
2235
2323
  return composeLoaders(
2236
2324
  createTextFileLoader(bucketPathPattern),
2325
+ createNewLineLoader(),
2237
2326
  createCsvLoader(),
2238
2327
  createFlatLoader(),
2239
2328
  createSyncLoader(),
@@ -2242,6 +2331,7 @@ function createBucketLoader(bucketType, bucketPathPattern) {
2242
2331
  case "html":
2243
2332
  return composeLoaders(
2244
2333
  createTextFileLoader(bucketPathPattern),
2334
+ createNewLineLoader(),
2245
2335
  createPrettierLoader({ parser: "html", alwaysFormat: true }),
2246
2336
  createHtmlLoader(),
2247
2337
  createSyncLoader(),
@@ -2250,6 +2340,7 @@ function createBucketLoader(bucketType, bucketPathPattern) {
2250
2340
  case "json":
2251
2341
  return composeLoaders(
2252
2342
  createTextFileLoader(bucketPathPattern),
2343
+ createNewLineLoader(),
2253
2344
  createPrettierLoader({ parser: "json" }),
2254
2345
  createJsonLoader(),
2255
2346
  createFlatLoader(),
@@ -2259,6 +2350,7 @@ function createBucketLoader(bucketType, bucketPathPattern) {
2259
2350
  case "markdown":
2260
2351
  return composeLoaders(
2261
2352
  createTextFileLoader(bucketPathPattern),
2353
+ createNewLineLoader(),
2262
2354
  createPrettierLoader({ parser: "markdown" }),
2263
2355
  createMarkdownLoader(),
2264
2356
  createSyncLoader(),
@@ -2267,6 +2359,7 @@ function createBucketLoader(bucketType, bucketPathPattern) {
2267
2359
  case "po":
2268
2360
  return composeLoaders(
2269
2361
  createTextFileLoader(bucketPathPattern),
2362
+ createNewLineLoader(),
2270
2363
  createPoLoader(),
2271
2364
  createFlatLoader(),
2272
2365
  createSyncLoader(),
@@ -2276,6 +2369,7 @@ function createBucketLoader(bucketType, bucketPathPattern) {
2276
2369
  case "properties":
2277
2370
  return composeLoaders(
2278
2371
  createTextFileLoader(bucketPathPattern),
2372
+ createNewLineLoader(),
2279
2373
  createPropertiesLoader(),
2280
2374
  createSyncLoader(),
2281
2375
  createUnlocalizableLoader()
@@ -2283,6 +2377,7 @@ function createBucketLoader(bucketType, bucketPathPattern) {
2283
2377
  case "xcode-strings":
2284
2378
  return composeLoaders(
2285
2379
  createTextFileLoader(bucketPathPattern),
2380
+ createNewLineLoader(),
2286
2381
  createXcodeStringsLoader(),
2287
2382
  createSyncLoader(),
2288
2383
  createUnlocalizableLoader()
@@ -2290,6 +2385,7 @@ function createBucketLoader(bucketType, bucketPathPattern) {
2290
2385
  case "xcode-stringsdict":
2291
2386
  return composeLoaders(
2292
2387
  createTextFileLoader(bucketPathPattern),
2388
+ createNewLineLoader(),
2293
2389
  createXcodeStringsdictLoader(),
2294
2390
  createFlatLoader(),
2295
2391
  createSyncLoader(),
@@ -2298,7 +2394,8 @@ function createBucketLoader(bucketType, bucketPathPattern) {
2298
2394
  case "xcode-xcstrings":
2299
2395
  return composeLoaders(
2300
2396
  createTextFileLoader(bucketPathPattern),
2301
- createPrettierLoader({ parser: "json" }),
2397
+ createNewLineLoader(),
2398
+ createPlutilJsonTextLoader(),
2302
2399
  createJsonLoader(),
2303
2400
  createXcodeXcstringsLoader(),
2304
2401
  createFlatLoader(),
@@ -2309,6 +2406,7 @@ function createBucketLoader(bucketType, bucketPathPattern) {
2309
2406
  case "yaml":
2310
2407
  return composeLoaders(
2311
2408
  createTextFileLoader(bucketPathPattern),
2409
+ createNewLineLoader(),
2312
2410
  createPrettierLoader({ parser: "yaml" }),
2313
2411
  createYamlLoader(),
2314
2412
  createFlatLoader(),
@@ -2318,6 +2416,7 @@ function createBucketLoader(bucketType, bucketPathPattern) {
2318
2416
  case "yaml-root-key":
2319
2417
  return composeLoaders(
2320
2418
  createTextFileLoader(bucketPathPattern),
2419
+ createNewLineLoader(),
2321
2420
  createPrettierLoader({ parser: "yaml" }),
2322
2421
  createYamlLoader(),
2323
2422
  createRootKeyLoader(true),
@@ -2328,6 +2427,7 @@ function createBucketLoader(bucketType, bucketPathPattern) {
2328
2427
  case "flutter":
2329
2428
  return composeLoaders(
2330
2429
  createTextFileLoader(bucketPathPattern),
2430
+ createNewLineLoader(),
2331
2431
  createPrettierLoader({ parser: "json" }),
2332
2432
  createJsonLoader(),
2333
2433
  createFlutterLoader(),
@@ -2338,6 +2438,7 @@ function createBucketLoader(bucketType, bucketPathPattern) {
2338
2438
  case "xliff":
2339
2439
  return composeLoaders(
2340
2440
  createTextFileLoader(bucketPathPattern),
2441
+ createNewLineLoader(),
2341
2442
  createXliffLoader(),
2342
2443
  createFlatLoader(),
2343
2444
  createSyncLoader(),
@@ -2346,6 +2447,7 @@ function createBucketLoader(bucketType, bucketPathPattern) {
2346
2447
  case "xml":
2347
2448
  return composeLoaders(
2348
2449
  createTextFileLoader(bucketPathPattern),
2450
+ createNewLineLoader(),
2349
2451
  createXmlLoader(),
2350
2452
  createFlatLoader(),
2351
2453
  createSyncLoader(),
@@ -2354,6 +2456,7 @@ function createBucketLoader(bucketType, bucketPathPattern) {
2354
2456
  case "srt":
2355
2457
  return composeLoaders(
2356
2458
  createTextFileLoader(bucketPathPattern),
2459
+ createNewLineLoader(),
2357
2460
  createSrtLoader(),
2358
2461
  createSyncLoader(),
2359
2462
  createUnlocalizableLoader()
@@ -2361,6 +2464,7 @@ function createBucketLoader(bucketType, bucketPathPattern) {
2361
2464
  case "dato":
2362
2465
  return composeLoaders(
2363
2466
  createDatoLoader(bucketPathPattern),
2467
+ createNewLineLoader(),
2364
2468
  createSyncLoader(),
2365
2469
  createFlatLoader(),
2366
2470
  createUnlocalizableLoader()
@@ -2368,6 +2472,7 @@ function createBucketLoader(bucketType, bucketPathPattern) {
2368
2472
  case "vtt":
2369
2473
  return composeLoaders(
2370
2474
  createTextFileLoader(bucketPathPattern),
2475
+ createNewLineLoader(),
2371
2476
  createVttLoader(),
2372
2477
  createSyncLoader(),
2373
2478
  createUnlocalizableLoader()
@@ -2395,6 +2500,13 @@ function createLockfileHelper() {
2395
2500
  lockfile.checksums[sectionKey] = sectionChecksums;
2396
2501
  _saveLockfile(lockfile);
2397
2502
  },
2503
+ registerPartialSourceData: (pathPattern, partialSourceData) => {
2504
+ const lockfile = _loadLockfile();
2505
+ const sectionKey = _objecthash.MD5.call(void 0, pathPattern);
2506
+ const sectionChecksums = _lodash2.default.mapValues(partialSourceData, (value) => _objecthash.MD5.call(void 0, value));
2507
+ lockfile.checksums[sectionKey] = _lodash2.default.merge({}, _nullishCoalesce(lockfile.checksums[sectionKey], () => ( {})), sectionChecksums);
2508
+ _saveLockfile(lockfile);
2509
+ },
2398
2510
  extractUpdatedData: (pathPattern, sourceData) => {
2399
2511
  const lockfile = _loadLockfile();
2400
2512
  const sectionKey = _objecthash.MD5.call(void 0, pathPattern);
@@ -2437,11 +2549,80 @@ var LockfileSchema = _zod2.default.object({
2437
2549
  ).default({})
2438
2550
  });
2439
2551
 
2440
- // src/cli/cli/i18n.ts
2552
+ // src/cli/cmd/i18n.ts
2441
2553
  var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
2442
2554
  var _diff = require('diff');
2443
2555
 
2444
2556
  var _externaleditor = require('external-editor'); var _externaleditor2 = _interopRequireDefault(_externaleditor);
2557
+
2558
+ // src/cli/utils/cache.ts
2559
+
2560
+
2561
+ var cacheChunk = (targetLocale, sourceChunk, processedChunk) => {
2562
+ const rows = Object.entries(sourceChunk).map(([key, source]) => ({
2563
+ targetLocale,
2564
+ key,
2565
+ source,
2566
+ processed: processedChunk[key]
2567
+ }));
2568
+ _appendToCache(rows);
2569
+ };
2570
+ function getNormalizedCache() {
2571
+ const rows = _loadCache();
2572
+ if (!rows.length) {
2573
+ return null;
2574
+ }
2575
+ const normalized = {};
2576
+ for (const row of rows) {
2577
+ if (!normalized[row.targetLocale]) {
2578
+ normalized[row.targetLocale] = {};
2579
+ }
2580
+ normalized[row.targetLocale][row.key] = {
2581
+ source: row.source,
2582
+ result: row.processed
2583
+ };
2584
+ }
2585
+ return normalized;
2586
+ }
2587
+ function deleteCache() {
2588
+ const cacheFilePath = _getCacheFilePath();
2589
+ try {
2590
+ _fs2.default.unlinkSync(cacheFilePath);
2591
+ } catch (e) {
2592
+ }
2593
+ }
2594
+ function _loadCache() {
2595
+ const cacheFilePath = _getCacheFilePath();
2596
+ if (!_fs2.default.existsSync(cacheFilePath)) {
2597
+ return [];
2598
+ }
2599
+ const content = _fs2.default.readFileSync(cacheFilePath, "utf-8");
2600
+ const result = _parseJSONLines(content);
2601
+ return result;
2602
+ }
2603
+ function _appendToCache(rows) {
2604
+ const cacheFilePath = _getCacheFilePath();
2605
+ const lines = _buildJSONLines(rows);
2606
+ _fs2.default.appendFileSync(cacheFilePath, lines);
2607
+ }
2608
+ function _getCacheFilePath() {
2609
+ return _path2.default.join(process.cwd(), "i18n.cache");
2610
+ }
2611
+ function _buildJSONLines(rows) {
2612
+ return rows.map((row) => JSON.stringify(row)).join("\n") + "\n";
2613
+ }
2614
+ function _parseJSONLines(lines) {
2615
+ return lines.split("\n").map(_tryParseJSON).filter((line) => line !== null);
2616
+ }
2617
+ function _tryParseJSON(line) {
2618
+ try {
2619
+ return JSON.parse(line);
2620
+ } catch (e) {
2621
+ return null;
2622
+ }
2623
+ }
2624
+
2625
+ // src/cli/cmd/i18n.ts
2445
2626
  var i18n_default = new (0, _interactivecommander.Command)().command("i18n").description("Run Localization engine").helpOption("-h, --help", "Show help").option("--locale <locale>", "Locale to process", (val, prev) => prev ? [...prev, val] : [val]).option("--bucket <bucket>", "Bucket to process", (val, prev) => prev ? [...prev, val] : [val]).option("--key <key>", "Key to process").option("--frozen", `Don't update the translations and fail if an update is needed`).option("--force", "Ignore lockfile and process all keys").option("--verbose", "Show verbose output").option("--interactive", "Interactive mode").option("--api-key <api-key>", "Explicitly set the API key to use").option("--debug", "Debug mode").option("--strict", "Stop on first error").action(async function(options) {
2446
2627
  const ora = _ora2.default.call(void 0, );
2447
2628
  const flags = parseFlags(options);
@@ -2467,18 +2648,18 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
2467
2648
  const auth = await validateAuth(settings);
2468
2649
  ora.succeed(`Authenticated as ${auth.email}`);
2469
2650
  let buckets = getBuckets(i18nConfig);
2470
- if (_optionalChain([flags, 'access', _119 => _119.bucket, 'optionalAccess', _120 => _120.length])) {
2651
+ if (_optionalChain([flags, 'access', _125 => _125.bucket, 'optionalAccess', _126 => _126.length])) {
2471
2652
  buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
2472
2653
  }
2473
2654
  ora.succeed("Buckets retrieved");
2474
- const targetLocales = _optionalChain([flags, 'access', _121 => _121.locale, 'optionalAccess', _122 => _122.length]) ? flags.locale : i18nConfig.locale.targets;
2655
+ const targetLocales = _optionalChain([flags, 'access', _127 => _127.locale, 'optionalAccess', _128 => _128.length]) ? flags.locale : i18nConfig.locale.targets;
2475
2656
  const lockfileHelper = createLockfileHelper();
2476
2657
  ora.start("Ensuring i18n.lock exists...");
2477
2658
  if (!lockfileHelper.isLockfileExists()) {
2478
2659
  ora.start("Creating i18n.lock...");
2479
2660
  for (const bucket of buckets) {
2480
2661
  for (const bucketConfig of bucket.config) {
2481
- const sourceLocale = _chunkDTGLPBE5cjs.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
2662
+ const sourceLocale = _chunkBCCNAFJBcjs.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
2482
2663
  const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern);
2483
2664
  bucketLoader.setDefaultLocale(sourceLocale);
2484
2665
  await bucketLoader.init();
@@ -2490,12 +2671,51 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
2490
2671
  } else {
2491
2672
  ora.succeed("i18n.lock loaded");
2492
2673
  }
2674
+ const cache = getNormalizedCache();
2675
+ if (cache) {
2676
+ console.log();
2677
+ ora.succeed(`Cache loaded. Attempting recovery...`);
2678
+ const cacheOra = _ora2.default.call(void 0, { indent: 2 });
2679
+ for (const bucket of buckets) {
2680
+ cacheOra.info(`Processing bucket: ${bucket.type}`);
2681
+ for (const bucketConfig of bucket.config) {
2682
+ const bucketOra = ora.info(`Processing path: ${bucketConfig.pathPattern}`);
2683
+ const sourceLocale = _chunkBCCNAFJBcjs.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
2684
+ const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern);
2685
+ bucketLoader.setDefaultLocale(sourceLocale);
2686
+ await bucketLoader.init();
2687
+ const sourceData = await bucketLoader.pull(sourceLocale);
2688
+ const cachedSourceData = {};
2689
+ for (const targetLocale in cache) {
2690
+ const targetData = await bucketLoader.pull(targetLocale);
2691
+ for (const key in cache[targetLocale]) {
2692
+ const { source, result } = cache[targetLocale][key];
2693
+ if (sourceData[key] === source && targetData[key] !== result) {
2694
+ targetData[key] = result;
2695
+ cachedSourceData[key] = source;
2696
+ }
2697
+ }
2698
+ await bucketLoader.push(targetLocale, targetData);
2699
+ lockfileHelper.registerPartialSourceData(bucketConfig.pathPattern, cachedSourceData);
2700
+ bucketOra.succeed(
2701
+ `[${sourceLocale} -> ${targetLocale}] Recovered ${Object.keys(cachedSourceData).length} entries from cache`
2702
+ );
2703
+ }
2704
+ }
2705
+ }
2706
+ deleteCache();
2707
+ if (flags.verbose) {
2708
+ cacheOra.info("Cache file deleted.");
2709
+ }
2710
+ } else if (flags.verbose) {
2711
+ ora.info("Cache file not found. Skipping recovery.");
2712
+ }
2493
2713
  if (flags.frozen) {
2494
2714
  ora.start("Checking for lockfile updates...");
2495
2715
  let requiresUpdate = false;
2496
2716
  for (const bucket of buckets) {
2497
2717
  for (const bucketConfig of bucket.config) {
2498
- const sourceLocale = _chunkDTGLPBE5cjs.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
2718
+ const sourceLocale = _chunkBCCNAFJBcjs.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
2499
2719
  const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern);
2500
2720
  bucketLoader.setDefaultLocale(sourceLocale);
2501
2721
  await bucketLoader.init();
@@ -2521,13 +2741,13 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
2521
2741
  ora.info(`Processing bucket: ${bucket.type}`);
2522
2742
  for (const bucketConfig of bucket.config) {
2523
2743
  const bucketOra = _ora2.default.call(void 0, { indent: 2 }).info(`Processing path: ${bucketConfig.pathPattern}`);
2524
- const sourceLocale = _chunkDTGLPBE5cjs.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
2744
+ const sourceLocale = _chunkBCCNAFJBcjs.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
2525
2745
  const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern);
2526
2746
  bucketLoader.setDefaultLocale(sourceLocale);
2527
2747
  await bucketLoader.init();
2528
2748
  let sourceData = await bucketLoader.pull(sourceLocale);
2529
2749
  for (const _targetLocale of targetLocales) {
2530
- const targetLocale = _chunkDTGLPBE5cjs.resolveOverridenLocale.call(void 0, _targetLocale, bucketConfig.delimiter);
2750
+ const targetLocale = _chunkBCCNAFJBcjs.resolveOverridenLocale.call(void 0, _targetLocale, bucketConfig.delimiter);
2531
2751
  try {
2532
2752
  bucketOra.start(`[${sourceLocale} -> ${targetLocale}] (0%) Localization in progress...`);
2533
2753
  sourceData = await bucketLoader.pull(sourceLocale);
@@ -2559,8 +2779,17 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
2559
2779
  targetLocale,
2560
2780
  targetData
2561
2781
  },
2562
- (progress) => {
2563
- bucketOra.text = `[${sourceLocale} -> ${targetLocale}] [${Object.keys(processableData).length} entries] (${progress}%) AI localization in progress...`;
2782
+ (progress, sourceChunk, processedChunk) => {
2783
+ cacheChunk(targetLocale, sourceChunk, processedChunk);
2784
+ const progressLog = `[${sourceLocale} -> ${targetLocale}] [${Object.keys(processableData).length} entries] (${progress}%) AI localization in progress...`;
2785
+ if (flags.verbose) {
2786
+ ora.info(progressLog);
2787
+ ora.info(
2788
+ `Caching chunk ${JSON.stringify(sourceChunk, null, 2)} -> ${JSON.stringify(processedChunk, null, 2)}`
2789
+ );
2790
+ } else {
2791
+ ora.text = progressLog;
2792
+ }
2564
2793
  }
2565
2794
  );
2566
2795
  if (flags.verbose) {
@@ -2612,6 +2841,10 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
2612
2841
  console.log();
2613
2842
  if (!hasErrors) {
2614
2843
  ora.succeed("Localization completed.");
2844
+ deleteCache();
2845
+ if (flags.verbose) {
2846
+ ora.info("Cache file deleted.");
2847
+ }
2615
2848
  } else {
2616
2849
  ora.warn("Localization completed with errors.");
2617
2850
  }
@@ -2639,7 +2872,7 @@ async function retryWithExponentialBackoff(operation, maxAttempts, baseDelay = 1
2639
2872
  throw new Error("Unreachable code");
2640
2873
  }
2641
2874
  function createLocalizationEngineConnection(params) {
2642
- const replexicaEngine = new (0, _chunkMNP3B6L4cjs.ReplexicaEngine)({
2875
+ const replexicaEngine = new (0, _chunkHODTYTE5cjs.ReplexicaEngine)({
2643
2876
  apiKey: params.apiKey,
2644
2877
  apiUrl: params.apiUrl
2645
2878
  });
@@ -2662,8 +2895,8 @@ function createLocalizationEngineConnection(params) {
2662
2895
  function parseFlags(options) {
2663
2896
  return _zod2.default.object({
2664
2897
  apiKey: _zod2.default.string().optional(),
2665
- locale: _zod2.default.array(_chunkDTGLPBE5cjs.localeCodeSchema).optional(),
2666
- bucket: _zod2.default.array(_chunkDTGLPBE5cjs.bucketTypeSchema).optional(),
2898
+ locale: _zod2.default.array(_chunkBCCNAFJBcjs.localeCodeSchema).optional(),
2899
+ bucket: _zod2.default.array(_chunkBCCNAFJBcjs.bucketTypeSchema).optional(),
2667
2900
  force: _zod2.default.boolean().optional(),
2668
2901
  frozen: _zod2.default.boolean().optional(),
2669
2902
  verbose: _zod2.default.boolean().optional(),
@@ -2704,12 +2937,12 @@ function validateParams(i18nConfig, flags) {
2704
2937
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
2705
2938
  docUrl: "bucketNotFound"
2706
2939
  });
2707
- } else if (_optionalChain([flags, 'access', _123 => _123.locale, 'optionalAccess', _124 => _124.some, 'call', _125 => _125((locale) => !i18nConfig.locale.targets.includes(locale))])) {
2940
+ } else if (_optionalChain([flags, 'access', _129 => _129.locale, 'optionalAccess', _130 => _130.some, 'call', _131 => _131((locale) => !i18nConfig.locale.targets.includes(locale))])) {
2708
2941
  throw new CLIError({
2709
2942
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
2710
2943
  docUrl: "localeTargetNotFound"
2711
2944
  });
2712
- } else if (_optionalChain([flags, 'access', _126 => _126.bucket, 'optionalAccess', _127 => _127.some, 'call', _128 => _128((bucket) => !i18nConfig.buckets[bucket])])) {
2945
+ } else if (_optionalChain([flags, 'access', _132 => _132.bucket, 'optionalAccess', _133 => _133.some, 'call', _134 => _134((bucket) => !i18nConfig.buckets[bucket])])) {
2713
2946
  throw new CLIError({
2714
2947
  message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
2715
2948
  docUrl: "bucketNotFound"
@@ -2812,7 +3045,7 @@ Editing value for: ${_chalk2.default.cyan(key)}`);
2812
3045
  return customData;
2813
3046
  }
2814
3047
 
2815
- // src/cli/cli/lockfile.ts
3048
+ // src/cli/cmd/lockfile.ts
2816
3049
 
2817
3050
 
2818
3051
 
@@ -2827,7 +3060,7 @@ var lockfile_default = new (0, _interactivecommander.Command)().command("lockfil
2827
3060
  const buckets = getBuckets(i18nConfig);
2828
3061
  for (const bucket of buckets) {
2829
3062
  for (const bucketConfig of bucket.config) {
2830
- const sourceLocale = _chunkDTGLPBE5cjs.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3063
+ const sourceLocale = _chunkBCCNAFJBcjs.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
2831
3064
  const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern);
2832
3065
  bucketLoader.setDefaultLocale(sourceLocale);
2833
3066
  const sourceData = await bucketLoader.pull(sourceLocale);
@@ -2841,7 +3074,7 @@ var flagsSchema = _zod2.default.object({
2841
3074
  force: _zod2.default.boolean().default(false)
2842
3075
  });
2843
3076
 
2844
- // src/cli/cli/cleanup.ts
3077
+ // src/cli/cmd/cleanup.ts
2845
3078
 
2846
3079
 
2847
3080
 
@@ -2862,14 +3095,14 @@ var cleanup_default = new (0, _interactivecommander.Command)().command("cleanup"
2862
3095
  console.log();
2863
3096
  ora.info(`Processing bucket: ${bucket.type}`);
2864
3097
  for (const bucketConfig of bucket.config) {
2865
- const sourceLocale = _chunkDTGLPBE5cjs.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3098
+ const sourceLocale = _chunkBCCNAFJBcjs.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
2866
3099
  const bucketOra = _ora2.default.call(void 0, { indent: 2 }).info(`Processing path: ${bucketConfig.pathPattern}`);
2867
3100
  const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern);
2868
3101
  bucketLoader.setDefaultLocale(sourceLocale);
2869
3102
  const sourceData = await bucketLoader.pull(sourceLocale);
2870
3103
  const sourceKeys = Object.keys(sourceData);
2871
3104
  for (const _targetLocale of targetLocales) {
2872
- const targetLocale = _chunkDTGLPBE5cjs.resolveOverridenLocale.call(void 0, _targetLocale, bucketConfig.delimiter);
3105
+ const targetLocale = _chunkBCCNAFJBcjs.resolveOverridenLocale.call(void 0, _targetLocale, bucketConfig.delimiter);
2873
3106
  try {
2874
3107
  const targetData = await bucketLoader.pull(targetLocale);
2875
3108
  const targetKeys = Object.keys(targetData);
@@ -2934,7 +3167,7 @@ function displaySummary(results) {
2934
3167
  // package.json
2935
3168
  var package_default = {
2936
3169
  name: "lingo.dev",
2937
- version: "0.70.4",
3170
+ version: "0.72.0",
2938
3171
  description: "Lingo.dev CLI",
2939
3172
  private: false,
2940
3173
  type: "module",
@@ -2964,7 +3197,7 @@ var package_default = {
2964
3197
  "build"
2965
3198
  ],
2966
3199
  scripts: {
2967
- "lingo.dev": "node ./bin/cli.mjs",
3200
+ "lingo.dev": "node --inspect=9229 ./bin/cli.mjs",
2968
3201
  dev: "tsup --watch",
2969
3202
  build: "tsc --noEmit && tsup",
2970
3203
  test: "vitest run",
@@ -2986,9 +3219,12 @@ var package_default = {
2986
3219
  dotenv: "^16.4.7",
2987
3220
  express: "^4.21.2",
2988
3221
  "external-editor": "^3.1.0",
3222
+ figlet: "^1.8.0",
3223
+ "figlet-cli": "^0.2.0",
2989
3224
  flat: "^6.0.1",
2990
3225
  "gettext-parser": "^8.0.0",
2991
3226
  glob: "<11.0.0",
3227
+ "gradient-string": "^3.0.0",
2992
3228
  "gray-matter": "^4.0.3",
2993
3229
  ini: "^5.0.0",
2994
3230
  inquirer: "^12.3.0",
@@ -3026,6 +3262,7 @@ var package_default = {
3026
3262
  "@types/cors": "^2.8.17",
3027
3263
  "@types/diff": "^6.0.0",
3028
3264
  "@types/express": "^5.0.0",
3265
+ "@types/figlet": "^1.7.0",
3029
3266
  "@types/gettext-parser": "^4.0.4",
3030
3267
  "@types/glob": "^8.1.0",
3031
3268
  "@types/ini": "^4.1.1",
@@ -3052,12 +3289,25 @@ _dotenv2.default.config();
3052
3289
  var cli_default = new (0, _interactivecommander.InteractiveCommand)().name("lingo.dev").description("Lingo.dev CLI").helpOption("-h, --help", "Show help").addHelpText(
3053
3290
  "beforeAll",
3054
3291
  `
3055
- Lingo.dev CLI
3292
+ ${_gradientstring.vice.call(void 0,
3293
+ _figlet2.default.textSync("LINGO.DEV", {
3294
+ font: "ANSI Shadow",
3295
+ horizontalLayout: "default",
3296
+ verticalLayout: "default"
3297
+ })
3298
+ )}
3299
+
3056
3300
  Website: https://lingo.dev
3057
3301
  `
3058
- ).version(`v${package_default.version}`, "-v, --version", "Show version").addCommand(init_default).interactive("-y, --no-interactive", "Disable interactive mode").addCommand(i18n_default).addCommand(auth_default).addCommand(show_default).addCommand(lockfile_default).addCommand(cleanup_default);
3302
+ ).version(`v${package_default.version}`, "-v, --version", "Show version").addCommand(init_default).interactive("-y, --no-interactive", "Disable interactive mode").addCommand(i18n_default).addCommand(auth_default).addCommand(show_default).addCommand(lockfile_default).addCommand(cleanup_default).exitOverride((err) => {
3303
+ if (err.code === "commander.helpDisplayed" || err.code === "commander.version" || err.code === "commander.help") {
3304
+ process.exit(0);
3305
+ }
3306
+ throw err;
3307
+ });
3059
3308
 
3060
3309
 
3061
3310
  exports.default = cli_default;
3062
3311
 
3063
3312
  module.exports = exports.default;
3313
+ //# sourceMappingURL=cli.cjs.map