lingo.dev 0.111.10 → 0.111.11

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.mjs CHANGED
@@ -1060,9 +1060,9 @@ function makeGitlabInitializer(spinner) {
1060
1060
 
1061
1061
  // src/cli/cmd/init.ts
1062
1062
  import open2 from "open";
1063
- var openUrl = (path18) => {
1063
+ var openUrl = (path19) => {
1064
1064
  const settings = getSettings(void 0);
1065
- open2(`${settings.auth.webUrl}${path18}`, { wait: false });
1065
+ open2(`${settings.auth.webUrl}${path19}`, { wait: false });
1066
1066
  };
1067
1067
  var throwHelpError = (option, value) => {
1068
1068
  if (value === "help") {
@@ -1499,8 +1499,8 @@ var files_default = new Command6().command("files").description(
1499
1499
  } else if (type.target) {
1500
1500
  result.push(...targetPaths);
1501
1501
  }
1502
- result.forEach((path18) => {
1503
- console.log(path18);
1502
+ result.forEach((path19) => {
1503
+ console.log(path19);
1504
1504
  });
1505
1505
  }
1506
1506
  }
@@ -1829,8 +1829,8 @@ function extractCommentsFromJsonc(jsoncString) {
1829
1829
  const keyMatch = line.match(/^\s*["']?([^"':,\s]+)["']?\s*:/);
1830
1830
  if (keyMatch) {
1831
1831
  const key = keyMatch[1];
1832
- const path18 = contextStack.map((ctx) => ctx.key).filter(Boolean);
1833
- keyInfo = { key, path: path18 };
1832
+ const path19 = contextStack.map((ctx) => ctx.key).filter(Boolean);
1833
+ keyInfo = { key, path: path19 };
1834
1834
  }
1835
1835
  } else {
1836
1836
  keyInfo = findAssociatedKey(lines, commentData.lineIndex, contextStack);
@@ -1914,8 +1914,8 @@ function findAssociatedKey(lines, commentLineIndex, contextStack) {
1914
1914
  const keyMatch = line.match(/^\s*["']?([^"':,\s]+)["']?\s*:/);
1915
1915
  if (keyMatch) {
1916
1916
  const key = keyMatch[1];
1917
- const path18 = contextStack.map((ctx) => ctx.key).filter(Boolean);
1918
- return { key, path: path18 };
1917
+ const path19 = contextStack.map((ctx) => ctx.key).filter(Boolean);
1918
+ return { key, path: path19 };
1919
1919
  }
1920
1920
  }
1921
1921
  return { key: null, path: [] };
@@ -1934,9 +1934,9 @@ function updateContext(contextStack, line, parsedJson) {
1934
1934
  }
1935
1935
  }
1936
1936
  }
1937
- function setCommentAtPath(comments, path18, key, hint) {
1937
+ function setCommentAtPath(comments, path19, key, hint) {
1938
1938
  let current = comments;
1939
- for (const pathKey of path18) {
1939
+ for (const pathKey of path19) {
1940
1940
  if (!current[pathKey]) {
1941
1941
  current[pathKey] = {};
1942
1942
  }
@@ -2597,9 +2597,9 @@ function createHtmlLoader() {
2597
2597
  const bDepth = b.split("/").length;
2598
2598
  return aDepth - bDepth;
2599
2599
  });
2600
- paths.forEach((path18) => {
2601
- const value = data[path18];
2602
- const [nodePath, attribute] = path18.split("#");
2600
+ paths.forEach((path19) => {
2601
+ const value = data[path19];
2602
+ const [nodePath, attribute] = path19.split("#");
2603
2603
  const [rootTag, ...indices] = nodePath.split("/");
2604
2604
  let parent = rootTag === "head" ? document.head : document.body;
2605
2605
  let current = parent;
@@ -2928,36 +2928,99 @@ function _removeLocale(input2, locale) {
2928
2928
  return { ...input2, strings: newStrings };
2929
2929
  }
2930
2930
 
2931
- // src/cli/loaders/prettier.ts
2932
- import path11 from "path";
2931
+ // src/cli/loaders/unlocalizable.ts
2932
+ import _13 from "lodash";
2933
+ import _isUrl from "is-url";
2934
+ import { isValid, parseISO } from "date-fns";
2935
+ function createUnlocalizableLoader(returnUnlocalizedKeys = false) {
2936
+ return createLoader({
2937
+ async pull(locale, input2) {
2938
+ const unlocalizableKeys = _getUnlocalizableKeys(input2);
2939
+ const result = _13.omitBy(
2940
+ input2,
2941
+ (_35, key) => unlocalizableKeys.includes(key)
2942
+ );
2943
+ if (returnUnlocalizedKeys) {
2944
+ result.unlocalizable = _13.omitBy(
2945
+ input2,
2946
+ (_35, key) => !unlocalizableKeys.includes(key)
2947
+ );
2948
+ }
2949
+ return result;
2950
+ },
2951
+ async push(locale, data, originalInput) {
2952
+ const unlocalizableKeys = _getUnlocalizableKeys(originalInput);
2953
+ const result = _13.merge(
2954
+ {},
2955
+ data,
2956
+ _13.omitBy(originalInput, (_35, key) => !unlocalizableKeys.includes(key))
2957
+ );
2958
+ return result;
2959
+ }
2960
+ });
2961
+ }
2962
+ function _isSystemId(v) {
2963
+ return /^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)[A-Za-z0-9]{22}$/.test(v);
2964
+ }
2965
+ function _isIsoDate(v) {
2966
+ return isValid(parseISO(v));
2967
+ }
2968
+ function _getUnlocalizableKeys(input2) {
2969
+ const rules = {
2970
+ isEmpty: (v) => _13.isEmpty(v),
2971
+ isNumber: (v) => typeof v === "number" || /^[0-9]+$/.test(v),
2972
+ isBoolean: (v) => _13.isBoolean(v),
2973
+ isIsoDate: (v) => _13.isString(v) && _isIsoDate(v),
2974
+ isSystemId: (v) => _13.isString(v) && _isSystemId(v),
2975
+ isUrl: (v) => _13.isString(v) && _isUrl(v)
2976
+ };
2977
+ if (!input2) {
2978
+ return [];
2979
+ }
2980
+ return Object.entries(input2).filter(([key, value]) => {
2981
+ for (const [ruleName, rule] of Object.entries(rules)) {
2982
+ if (rule(value)) {
2983
+ return true;
2984
+ }
2985
+ }
2986
+ return false;
2987
+ }).map(([key, _35]) => key);
2988
+ }
2989
+
2990
+ // src/cli/loaders/formatters/prettier.ts
2933
2991
  import prettier from "prettier";
2934
- function createPrettierLoader(options) {
2992
+
2993
+ // src/cli/loaders/formatters/_base.ts
2994
+ import path11 from "path";
2995
+ function createBaseFormatterLoader(options, formatFn) {
2935
2996
  const stage = options.stage || "both";
2997
+ const formatData = async (locale, data) => {
2998
+ const draftPath = options.bucketPathPattern.replaceAll("[locale]", locale);
2999
+ const finalPath = path11.resolve(draftPath);
3000
+ return await formatFn(data, finalPath);
3001
+ };
2936
3002
  return createLoader({
2937
3003
  async pull(locale, data) {
2938
3004
  if (!["pull", "both"].includes(stage)) {
2939
3005
  return data;
2940
3006
  }
2941
- const draftPath = options.bucketPathPattern.replaceAll(
2942
- "[locale]",
2943
- locale
2944
- );
2945
- const finalPath = path11.resolve(draftPath);
2946
- return await formatDataWithPrettier(data, finalPath, options);
3007
+ return await formatData(locale, data);
2947
3008
  },
2948
3009
  async push(locale, data) {
2949
3010
  if (!["push", "both"].includes(stage)) {
2950
3011
  return data;
2951
3012
  }
2952
- const draftPath = options.bucketPathPattern.replaceAll(
2953
- "[locale]",
2954
- locale
2955
- );
2956
- const finalPath = path11.resolve(draftPath);
2957
- return await formatDataWithPrettier(data, finalPath, options);
3013
+ return await formatData(locale, data);
2958
3014
  }
2959
3015
  });
2960
3016
  }
3017
+
3018
+ // src/cli/loaders/formatters/prettier.ts
3019
+ function createPrettierLoader(options) {
3020
+ return createBaseFormatterLoader(options, async (data, filePath) => {
3021
+ return await formatDataWithPrettier(data, filePath, options);
3022
+ });
3023
+ }
2961
3024
  async function loadPrettierConfig(filePath) {
2962
3025
  try {
2963
3026
  const config = await prettier.resolveConfig(filePath);
@@ -3000,63 +3063,71 @@ async function formatDataWithPrettier(data, filePath, options) {
3000
3063
  }
3001
3064
  }
3002
3065
 
3003
- // src/cli/loaders/unlocalizable.ts
3004
- import _13 from "lodash";
3005
- import _isUrl from "is-url";
3006
- import { isValid, parseISO } from "date-fns";
3007
- function createUnlocalizableLoader(returnUnlocalizedKeys = false) {
3008
- return createLoader({
3009
- async pull(locale, input2) {
3010
- const unlocalizableKeys = _getUnlocalizableKeys(input2);
3011
- const result = _13.omitBy(
3012
- input2,
3013
- (_35, key) => unlocalizableKeys.includes(key)
3014
- );
3015
- if (returnUnlocalizedKeys) {
3016
- result.unlocalizable = _13.omitBy(
3017
- input2,
3018
- (_35, key) => !unlocalizableKeys.includes(key)
3019
- );
3020
- }
3021
- return result;
3022
- },
3023
- async push(locale, data, originalInput) {
3024
- const unlocalizableKeys = _getUnlocalizableKeys(originalInput);
3025
- const result = _13.merge(
3026
- {},
3027
- data,
3028
- _13.omitBy(originalInput, (_35, key) => !unlocalizableKeys.includes(key))
3029
- );
3030
- return result;
3031
- }
3066
+ // src/cli/loaders/formatters/biome.ts
3067
+ import path12 from "path";
3068
+ import fs9 from "fs/promises";
3069
+ import { Biome, Distribution } from "@biomejs/js-api";
3070
+ function createBiomeLoader(options) {
3071
+ return createBaseFormatterLoader(options, async (data, filePath) => {
3072
+ return await formatDataWithBiome(data, filePath, options);
3032
3073
  });
3033
3074
  }
3034
- function _isSystemId(v) {
3035
- return /^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)[A-Za-z0-9]{22}$/.test(v);
3075
+ async function findBiomeConfig(startPath) {
3076
+ let currentDir = path12.dirname(startPath);
3077
+ const root = path12.parse(currentDir).root;
3078
+ while (currentDir !== root) {
3079
+ for (const configName of ["biome.json", "biome.jsonc"]) {
3080
+ const configPath = path12.join(currentDir, configName);
3081
+ try {
3082
+ await fs9.access(configPath);
3083
+ return configPath;
3084
+ } catch {
3085
+ }
3086
+ }
3087
+ const parentDir = path12.dirname(currentDir);
3088
+ if (parentDir === currentDir) break;
3089
+ currentDir = parentDir;
3090
+ }
3091
+ return null;
3036
3092
  }
3037
- function _isIsoDate(v) {
3038
- return isValid(parseISO(v));
3093
+ async function formatDataWithBiome(data, filePath, options) {
3094
+ try {
3095
+ const biome = await Biome.create({
3096
+ distribution: Distribution.NODE
3097
+ });
3098
+ const configPath = await findBiomeConfig(filePath);
3099
+ if (!configPath && !options.alwaysFormat) {
3100
+ return data;
3101
+ }
3102
+ if (configPath) {
3103
+ const configContent = await fs9.readFile(configPath, "utf-8");
3104
+ biome.applyConfiguration(JSON.parse(configContent));
3105
+ }
3106
+ const formatted = biome.formatContent(data, {
3107
+ filePath
3108
+ });
3109
+ return formatted.content;
3110
+ } catch (error) {
3111
+ if (error instanceof Error) {
3112
+ console.log();
3113
+ console.log("\u26A0\uFE0F Biome formatting failed:", error.message);
3114
+ }
3115
+ return data;
3116
+ }
3039
3117
  }
3040
- function _getUnlocalizableKeys(input2) {
3041
- const rules = {
3042
- isEmpty: (v) => _13.isEmpty(v),
3043
- isNumber: (v) => typeof v === "number" || /^[0-9]+$/.test(v),
3044
- isBoolean: (v) => _13.isBoolean(v),
3045
- isIsoDate: (v) => _13.isString(v) && _isIsoDate(v),
3046
- isSystemId: (v) => _13.isString(v) && _isSystemId(v),
3047
- isUrl: (v) => _13.isString(v) && _isUrl(v)
3048
- };
3049
- if (!input2) {
3050
- return [];
3118
+
3119
+ // src/cli/loaders/formatters/index.ts
3120
+ function createFormatterLoader(formatterType, parser, bucketPathPattern) {
3121
+ if (formatterType === void 0) {
3122
+ return createPrettierLoader({ parser, bucketPathPattern });
3051
3123
  }
3052
- return Object.entries(input2).filter(([key, value]) => {
3053
- for (const [ruleName, rule] of Object.entries(rules)) {
3054
- if (rule(value)) {
3055
- return true;
3056
- }
3057
- }
3058
- return false;
3059
- }).map(([key, _35]) => key);
3124
+ if (formatterType === "prettier") {
3125
+ return createPrettierLoader({ parser, bucketPathPattern });
3126
+ }
3127
+ if (formatterType === "biome") {
3128
+ return createBiomeLoader({ bucketPathPattern });
3129
+ }
3130
+ throw new Error(`Unknown formatter: ${formatterType}`);
3060
3131
  }
3061
3132
 
3062
3133
  // src/cli/loaders/po/index.ts
@@ -3677,7 +3748,7 @@ function createSrtLoader() {
3677
3748
  }
3678
3749
 
3679
3750
  // src/cli/loaders/dato/index.ts
3680
- import fs9 from "fs";
3751
+ import fs10 from "fs";
3681
3752
  import JSON52 from "json5";
3682
3753
 
3683
3754
  // src/cli/loaders/dato/_base.ts
@@ -4242,24 +4313,24 @@ function createRawDatoValue(parsedDatoValue, originalRawDatoValue, isClean = fal
4242
4313
  }
4243
4314
  function serializeStructuredText(rawStructuredText) {
4244
4315
  return serializeStructuredTextNode(rawStructuredText);
4245
- function serializeStructuredTextNode(node, path18 = [], acc = {}) {
4316
+ function serializeStructuredTextNode(node, path19 = [], acc = {}) {
4246
4317
  if ("document" in node) {
4247
4318
  return serializeStructuredTextNode(
4248
4319
  node.document,
4249
- [...path18, "document"],
4320
+ [...path19, "document"],
4250
4321
  acc
4251
4322
  );
4252
4323
  }
4253
4324
  if (!_18.isNil(node.value)) {
4254
- acc[[...path18, "value"].join(".")] = node.value;
4325
+ acc[[...path19, "value"].join(".")] = node.value;
4255
4326
  } else if (_18.get(node, "type") === "block") {
4256
- acc[[...path18, "item"].join(".")] = serializeBlock(node.item);
4327
+ acc[[...path19, "item"].join(".")] = serializeBlock(node.item);
4257
4328
  }
4258
4329
  if (node.children) {
4259
4330
  for (let i = 0; i < node.children.length; i++) {
4260
4331
  serializeStructuredTextNode(
4261
4332
  node.children[i],
4262
- [...path18, i.toString()],
4333
+ [...path19, i.toString()],
4263
4334
  acc
4264
4335
  );
4265
4336
  }
@@ -4326,8 +4397,8 @@ function deserializeBlockList(parsedBlockList, originalRawBlockList, isClean = f
4326
4397
  }
4327
4398
  function deserializeStructuredText(parsedStructuredText, originalRawStructuredText) {
4328
4399
  const result = _18.cloneDeep(originalRawStructuredText);
4329
- for (const [path18, value] of _18.entries(parsedStructuredText)) {
4330
- const realPath = _18.chain(path18.split(".")).flatMap((s) => !_18.isNaN(_18.toNumber(s)) ? ["children", s] : s).value();
4400
+ for (const [path19, value] of _18.entries(parsedStructuredText)) {
4401
+ const realPath = _18.chain(path19.split(".")).flatMap((s) => !_18.isNaN(_18.toNumber(s)) ? ["children", s] : s).value();
4331
4402
  const deserializedValue = createRawDatoValue(
4332
4403
  value,
4333
4404
  _18.get(originalRawStructuredText, realPath),
@@ -4364,12 +4435,12 @@ function _isVideo(rawDatoValue) {
4364
4435
  // src/cli/loaders/dato/index.ts
4365
4436
  function createDatoLoader(configFilePath) {
4366
4437
  try {
4367
- const configContent = fs9.readFileSync(configFilePath, "utf-8");
4438
+ const configContent = fs10.readFileSync(configFilePath, "utf-8");
4368
4439
  const datoConfig = datoConfigSchema.parse(JSON52.parse(configContent));
4369
4440
  return composeLoaders(
4370
4441
  createDatoApiLoader(
4371
4442
  datoConfig,
4372
- (updatedConfig) => fs9.writeFileSync(
4443
+ (updatedConfig) => fs10.writeFileSync(
4373
4444
  configFilePath,
4374
4445
  JSON52.stringify(updatedConfig, null, 2)
4375
4446
  )
@@ -4753,15 +4824,15 @@ function parseTypeScript(input2) {
4753
4824
  function extractStringsFromDefaultExport(ast) {
4754
4825
  let extracted = {};
4755
4826
  traverse(ast, {
4756
- ExportDefaultDeclaration(path18) {
4757
- const { declaration } = path18.node;
4827
+ ExportDefaultDeclaration(path19) {
4828
+ const { declaration } = path19.node;
4758
4829
  const decl = unwrapTSAsExpression(declaration);
4759
4830
  if (t.isObjectExpression(decl)) {
4760
4831
  extracted = objectExpressionToObject(decl);
4761
4832
  } else if (t.isArrayExpression(decl)) {
4762
4833
  extracted = arrayExpressionToArray(decl);
4763
4834
  } else if (t.isIdentifier(decl)) {
4764
- const binding = path18.scope.bindings[decl.name];
4835
+ const binding = path19.scope.bindings[decl.name];
4765
4836
  if (binding && t.isVariableDeclarator(binding.path.node) && binding.path.node.init) {
4766
4837
  const initRaw = binding.path.node.init;
4767
4838
  const init = initRaw ? unwrapTSAsExpression(initRaw) : initRaw;
@@ -4826,8 +4897,8 @@ function arrayExpressionToArray(arrayExpression) {
4826
4897
  function updateStringsInDefaultExport(ast, data) {
4827
4898
  let modified = false;
4828
4899
  traverse(ast, {
4829
- ExportDefaultDeclaration(path18) {
4830
- const { declaration } = path18.node;
4900
+ ExportDefaultDeclaration(path19) {
4901
+ const { declaration } = path19.node;
4831
4902
  const decl = unwrapTSAsExpression(declaration);
4832
4903
  if (t.isObjectExpression(decl)) {
4833
4904
  modified = updateStringsInObjectExpression(decl, data) || modified;
@@ -4836,7 +4907,7 @@ function updateStringsInDefaultExport(ast, data) {
4836
4907
  modified = updateStringsInArrayExpression(decl, data) || modified;
4837
4908
  }
4838
4909
  } else if (t.isIdentifier(decl)) {
4839
- modified = updateStringsInExportedIdentifier(path18, data) || modified;
4910
+ modified = updateStringsInExportedIdentifier(path19, data) || modified;
4840
4911
  }
4841
4912
  }
4842
4913
  });
@@ -4907,9 +4978,9 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
4907
4978
  });
4908
4979
  return modified;
4909
4980
  }
4910
- function updateStringsInExportedIdentifier(path18, data) {
4911
- const exportName = path18.node.declaration.name;
4912
- const binding = path18.scope.bindings[exportName];
4981
+ function updateStringsInExportedIdentifier(path19, data) {
4982
+ const exportName = path19.node.declaration.name;
4983
+ const binding = path19.scope.bindings[exportName];
4913
4984
  if (!binding || !binding.path.node) return false;
4914
4985
  if (t.isVariableDeclarator(binding.path.node) && binding.path.node.init) {
4915
4986
  const initRaw = binding.path.node.init;
@@ -5815,11 +5886,11 @@ var qmarksTestNoExtDot = ([$0]) => {
5815
5886
  return (f) => f.length === len && f !== "." && f !== "..";
5816
5887
  };
5817
5888
  var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
5818
- var path12 = {
5889
+ var path13 = {
5819
5890
  win32: { sep: "\\" },
5820
5891
  posix: { sep: "/" }
5821
5892
  };
5822
- var sep = defaultPlatform === "win32" ? path12.win32.sep : path12.posix.sep;
5893
+ var sep = defaultPlatform === "win32" ? path13.win32.sep : path13.posix.sep;
5823
5894
  minimatch.sep = sep;
5824
5895
  var GLOBSTAR = Symbol("globstar **");
5825
5896
  minimatch.GLOBSTAR = GLOBSTAR;
@@ -6511,11 +6582,11 @@ function _getAllKeys(obj, prefix = "") {
6511
6582
  let keys = [];
6512
6583
  for (const key in obj) {
6513
6584
  if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
6514
- const path18 = prefix ? `${prefix}.${key}` : key;
6585
+ const path19 = prefix ? `${prefix}.${key}` : key;
6515
6586
  if (typeof obj[key] === "object" && obj[key] !== null && !Array.isArray(obj[key])) {
6516
- keys = keys.concat(_getAllKeys(obj[key], path18));
6587
+ keys = keys.concat(_getAllKeys(obj[key], path19));
6517
6588
  } else {
6518
- keys.push(path18);
6589
+ keys.push(path19);
6519
6590
  }
6520
6591
  }
6521
6592
  return keys;
@@ -7028,19 +7099,19 @@ function createJsonDictionaryLoader() {
7028
7099
  );
7029
7100
  return input2;
7030
7101
  }
7031
- function walk(obj, dataNode, path18 = []) {
7102
+ function walk(obj, dataNode, path19 = []) {
7032
7103
  if (Array.isArray(obj) && Array.isArray(dataNode)) {
7033
7104
  obj.forEach(
7034
- (item, idx) => walk(item, dataNode[idx], [...path18, String(idx)])
7105
+ (item, idx) => walk(item, dataNode[idx], [...path19, String(idx)])
7035
7106
  );
7036
7107
  } else if (obj && typeof obj === "object" && dataNode && typeof dataNode === "object" && !Array.isArray(dataNode)) {
7037
7108
  for (const key of Object.keys(obj)) {
7038
7109
  if (dataNode.hasOwnProperty(key)) {
7039
- walk(obj[key], dataNode[key], [...path18, key]);
7110
+ walk(obj[key], dataNode[key], [...path19, key]);
7040
7111
  }
7041
7112
  }
7042
7113
  } else if (obj && typeof obj === "object" && !Array.isArray(obj) && typeof dataNode === "string") {
7043
- setNestedLocale(input2, path18, locale, dataNode, originalLocale);
7114
+ setNestedLocale(input2, path19, locale, dataNode, originalLocale);
7044
7115
  }
7045
7116
  }
7046
7117
  walk(input2, data);
@@ -7068,14 +7139,14 @@ function extractTranslatables(obj, locale) {
7068
7139
  function isTranslatableObject(obj, locale) {
7069
7140
  return obj && typeof obj === "object" && !Array.isArray(obj) && Object.prototype.hasOwnProperty.call(obj, locale);
7070
7141
  }
7071
- function setNestedLocale(obj, path18, locale, value, originalLocale) {
7142
+ function setNestedLocale(obj, path19, locale, value, originalLocale) {
7072
7143
  let curr = obj;
7073
- for (let i = 0; i < path18.length - 1; i++) {
7074
- const key = path18[i];
7144
+ for (let i = 0; i < path19.length - 1; i++) {
7145
+ const key = path19[i];
7075
7146
  if (!(key in curr)) curr[key] = {};
7076
7147
  curr = curr[key];
7077
7148
  }
7078
- const last = path18[path18.length - 1];
7149
+ const last = path19[path19.length - 1];
7079
7150
  if (curr[last] && typeof curr[last] === "object") {
7080
7151
  curr[last][locale] = value;
7081
7152
  if (originalLocale && curr[last][originalLocale]) {
@@ -7118,7 +7189,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
7118
7189
  case "html":
7119
7190
  return composeLoaders(
7120
7191
  createTextFileLoader(bucketPathPattern),
7121
- createPrettierLoader({ parser: "html", bucketPathPattern }),
7192
+ createFormatterLoader(options.formatter, "html", bucketPathPattern),
7122
7193
  createHtmlLoader(),
7123
7194
  createSyncLoader(),
7124
7195
  createUnlocalizableLoader(options.returnUnlocalizedKeys)
@@ -7133,7 +7204,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
7133
7204
  case "json":
7134
7205
  return composeLoaders(
7135
7206
  createTextFileLoader(bucketPathPattern),
7136
- createPrettierLoader({ parser: "json", bucketPathPattern }),
7207
+ createFormatterLoader(options.formatter, "json", bucketPathPattern),
7137
7208
  createJsonLoader(),
7138
7209
  createEnsureKeyOrderLoader(),
7139
7210
  createFlatLoader(),
@@ -7167,7 +7238,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
7167
7238
  case "markdown":
7168
7239
  return composeLoaders(
7169
7240
  createTextFileLoader(bucketPathPattern),
7170
- createPrettierLoader({ parser: "markdown", bucketPathPattern }),
7241
+ createFormatterLoader(options.formatter, "markdown", bucketPathPattern),
7171
7242
  createMarkdownLoader(),
7172
7243
  createSyncLoader(),
7173
7244
  createUnlocalizableLoader(options.returnUnlocalizedKeys)
@@ -7175,10 +7246,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
7175
7246
  case "mdx":
7176
7247
  return composeLoaders(
7177
7248
  createTextFileLoader(bucketPathPattern),
7178
- createPrettierLoader({
7179
- parser: "mdx",
7180
- bucketPathPattern
7181
- }),
7249
+ createFormatterLoader(options.formatter, "mdx", bucketPathPattern),
7182
7250
  createMdxCodePlaceholderLoader(),
7183
7251
  createMdxLockedPatternsLoader(lockedPatterns),
7184
7252
  createMdxFrontmatterSplitLoader(),
@@ -7239,7 +7307,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
7239
7307
  case "yaml":
7240
7308
  return composeLoaders(
7241
7309
  createTextFileLoader(bucketPathPattern),
7242
- createPrettierLoader({ parser: "yaml", bucketPathPattern }),
7310
+ createFormatterLoader(options.formatter, "yaml", bucketPathPattern),
7243
7311
  createYamlLoader(),
7244
7312
  createFlatLoader(),
7245
7313
  createEnsureKeyOrderLoader(),
@@ -7250,7 +7318,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
7250
7318
  case "yaml-root-key":
7251
7319
  return composeLoaders(
7252
7320
  createTextFileLoader(bucketPathPattern),
7253
- createPrettierLoader({ parser: "yaml", bucketPathPattern }),
7321
+ createFormatterLoader(options.formatter, "yaml", bucketPathPattern),
7254
7322
  createYamlLoader(),
7255
7323
  createRootKeyLoader(true),
7256
7324
  createFlatLoader(),
@@ -7261,7 +7329,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
7261
7329
  case "flutter":
7262
7330
  return composeLoaders(
7263
7331
  createTextFileLoader(bucketPathPattern),
7264
- createPrettierLoader({ parser: "json", bucketPathPattern }),
7332
+ createFormatterLoader(options.formatter, "json", bucketPathPattern),
7265
7333
  createJsonLoader(),
7266
7334
  createEnsureKeyOrderLoader(),
7267
7335
  createFlutterLoader(),
@@ -7330,7 +7398,11 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
7330
7398
  case "typescript":
7331
7399
  return composeLoaders(
7332
7400
  createTextFileLoader(bucketPathPattern),
7333
- createPrettierLoader({ parser: "typescript", bucketPathPattern }),
7401
+ createFormatterLoader(
7402
+ options.formatter,
7403
+ "typescript",
7404
+ bucketPathPattern
7405
+ ),
7334
7406
  createTypescriptLoader(),
7335
7407
  createFlatLoader(),
7336
7408
  createEnsureKeyOrderLoader(),
@@ -7349,7 +7421,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
7349
7421
  case "json-dictionary":
7350
7422
  return composeLoaders(
7351
7423
  createTextFileLoader(bucketPathPattern),
7352
- createPrettierLoader({ parser: "json", bucketPathPattern }),
7424
+ createFormatterLoader(options.formatter, "json", bucketPathPattern),
7353
7425
  createJsonLoader(),
7354
7426
  createJsonDictionaryLoader(),
7355
7427
  createEnsureKeyOrderLoader(),
@@ -7694,29 +7766,29 @@ import _30 from "lodash";
7694
7766
  import z from "zod";
7695
7767
 
7696
7768
  // src/cli/utils/fs.ts
7697
- import * as fs10 from "fs";
7698
- import * as path13 from "path";
7769
+ import * as fs11 from "fs";
7770
+ import * as path14 from "path";
7699
7771
  function tryReadFile(filePath, defaultValue = null) {
7700
7772
  try {
7701
- const content = fs10.readFileSync(filePath, "utf-8");
7773
+ const content = fs11.readFileSync(filePath, "utf-8");
7702
7774
  return content;
7703
7775
  } catch (error) {
7704
7776
  return defaultValue;
7705
7777
  }
7706
7778
  }
7707
7779
  function writeFile(filePath, content) {
7708
- const dir = path13.dirname(filePath);
7709
- if (!fs10.existsSync(dir)) {
7710
- fs10.mkdirSync(dir, { recursive: true });
7780
+ const dir = path14.dirname(filePath);
7781
+ if (!fs11.existsSync(dir)) {
7782
+ fs11.mkdirSync(dir, { recursive: true });
7711
7783
  }
7712
- fs10.writeFileSync(filePath, content);
7784
+ fs11.writeFileSync(filePath, content);
7713
7785
  }
7714
7786
  function checkIfFileExists(filePath) {
7715
- return fs10.existsSync(filePath);
7787
+ return fs11.existsSync(filePath);
7716
7788
  }
7717
7789
 
7718
7790
  // src/cli/utils/delta.ts
7719
- import * as path14 from "path";
7791
+ import * as path15 from "path";
7720
7792
  import YAML4 from "yaml";
7721
7793
  var LockSchema = z.object({
7722
7794
  version: z.literal(1).default(1),
@@ -7733,7 +7805,7 @@ var LockSchema = z.object({
7733
7805
  ).default({})
7734
7806
  });
7735
7807
  function createDeltaProcessor(fileKey) {
7736
- const lockfilePath = path14.join(process.cwd(), "i18n.lock");
7808
+ const lockfilePath = path15.join(process.cwd(), "i18n.lock");
7737
7809
  return {
7738
7810
  async checkIfLockExists() {
7739
7811
  return checkIfFileExists(lockfilePath);
@@ -7911,7 +7983,7 @@ var i18n_default = new Command12().command("i18n").description(
7911
7983
  if (flags.file?.length) {
7912
7984
  buckets = buckets.map((bucket) => {
7913
7985
  const paths = bucket.paths.filter(
7914
- (path18) => flags.file.find((file) => path18.pathPattern?.includes(file))
7986
+ (path19) => flags.file.find((file) => path19.pathPattern?.includes(file))
7915
7987
  );
7916
7988
  return { ...bucket, paths };
7917
7989
  }).filter((bucket) => bucket.paths.length > 0);
@@ -7926,8 +7998,8 @@ var i18n_default = new Command12().command("i18n").description(
7926
7998
  ora.info(`\x1B[36mProcessing only filtered buckets:\x1B[0m`);
7927
7999
  buckets.map((bucket) => {
7928
8000
  ora.info(` ${bucket.type}:`);
7929
- bucket.paths.forEach((path18) => {
7930
- ora.info(` - ${path18.pathPattern}`);
8001
+ bucket.paths.forEach((path19) => {
8002
+ ora.info(` - ${path19.pathPattern}`);
7931
8003
  });
7932
8004
  });
7933
8005
  }
@@ -7949,7 +8021,8 @@ var i18n_default = new Command12().command("i18n").description(
7949
8021
  bucketPath.pathPattern,
7950
8022
  {
7951
8023
  defaultLocale: sourceLocale,
7952
- injectLocale: bucket.injectLocale
8024
+ injectLocale: bucket.injectLocale,
8025
+ formatter: i18nConfig.formatter
7953
8026
  },
7954
8027
  bucket.lockedKeys,
7955
8028
  bucket.lockedPatterns,
@@ -8070,7 +8143,8 @@ var i18n_default = new Command12().command("i18n").description(
8070
8143
  bucketPath.pathPattern,
8071
8144
  {
8072
8145
  defaultLocale: sourceLocale,
8073
- injectLocale: bucket.injectLocale
8146
+ injectLocale: bucket.injectLocale,
8147
+ formatter: i18nConfig.formatter
8074
8148
  },
8075
8149
  bucket.lockedKeys,
8076
8150
  bucket.lockedPatterns,
@@ -8467,8 +8541,8 @@ import Z5 from "zod";
8467
8541
  import Ora8 from "ora";
8468
8542
 
8469
8543
  // src/cli/utils/lockfile.ts
8470
- import fs11 from "fs";
8471
- import path15 from "path";
8544
+ import fs12 from "fs";
8545
+ import path16 from "path";
8472
8546
  import Z4 from "zod";
8473
8547
  import YAML5 from "yaml";
8474
8548
  import { MD5 as MD52 } from "object-hash";
@@ -8477,7 +8551,7 @@ function createLockfileHelper() {
8477
8551
  return {
8478
8552
  isLockfileExists: () => {
8479
8553
  const lockfilePath = _getLockfilePath();
8480
- return fs11.existsSync(lockfilePath);
8554
+ return fs12.existsSync(lockfilePath);
8481
8555
  },
8482
8556
  registerSourceData: (pathPattern, sourceData) => {
8483
8557
  const lockfile = _loadLockfile();
@@ -8514,20 +8588,20 @@ function createLockfileHelper() {
8514
8588
  };
8515
8589
  function _loadLockfile() {
8516
8590
  const lockfilePath = _getLockfilePath();
8517
- if (!fs11.existsSync(lockfilePath)) {
8591
+ if (!fs12.existsSync(lockfilePath)) {
8518
8592
  return LockfileSchema.parse({});
8519
8593
  }
8520
- const content = fs11.readFileSync(lockfilePath, "utf-8");
8594
+ const content = fs12.readFileSync(lockfilePath, "utf-8");
8521
8595
  const result = LockfileSchema.parse(YAML5.parse(content));
8522
8596
  return result;
8523
8597
  }
8524
8598
  function _saveLockfile(lockfile) {
8525
8599
  const lockfilePath = _getLockfilePath();
8526
8600
  const content = YAML5.stringify(lockfile);
8527
- fs11.writeFileSync(lockfilePath, content);
8601
+ fs12.writeFileSync(lockfilePath, content);
8528
8602
  }
8529
8603
  function _getLockfilePath() {
8530
- return path15.join(process.cwd(), "i18n.lock");
8604
+ return path16.join(process.cwd(), "i18n.lock");
8531
8605
  }
8532
8606
  }
8533
8607
  var LockfileSchema = Z4.object({
@@ -8573,7 +8647,8 @@ var lockfile_default = new Command13().command("lockfile").description(
8573
8647
  bucket.type,
8574
8648
  bucketConfig.pathPattern,
8575
8649
  {
8576
- defaultLocale: sourceLocale
8650
+ defaultLocale: sourceLocale,
8651
+ formatter: i18nConfig.formatter
8577
8652
  }
8578
8653
  );
8579
8654
  bucketLoader.setDefaultLocale(sourceLocale);
@@ -8640,7 +8715,8 @@ var cleanup_default = new Command14().command("cleanup").description(
8640
8715
  bucket.type,
8641
8716
  bucketConfig.pathPattern,
8642
8717
  {
8643
- defaultLocale: sourceLocale
8718
+ defaultLocale: sourceLocale,
8719
+ formatter: i18nConfig.formatter
8644
8720
  }
8645
8721
  );
8646
8722
  bucketLoader.setDefaultLocale(sourceLocale);
@@ -8788,7 +8864,7 @@ import { execSync as execSync2 } from "child_process";
8788
8864
 
8789
8865
  // src/cli/cmd/ci/flows/in-branch.ts
8790
8866
  import { execSync } from "child_process";
8791
- import path17 from "path";
8867
+ import path18 from "path";
8792
8868
 
8793
8869
  // src/cli/cmd/ci/flows/_base.ts
8794
8870
  var IntegrationFlow = class {
@@ -8809,7 +8885,7 @@ function escapeShellArg(arg) {
8809
8885
  // src/cli/cmd/run/index.ts
8810
8886
  import { Command as Command16 } from "interactive-commander";
8811
8887
  import { exec } from "child_process";
8812
- import path16 from "path";
8888
+ import path17 from "path";
8813
8889
  import { fileURLToPath } from "url";
8814
8890
  import os2 from "os";
8815
8891
 
@@ -9266,7 +9342,8 @@ async function plan(input2) {
9266
9342
  injectLocale: bucket.injectLocale || [],
9267
9343
  lockedKeys: bucket.lockedKeys || [],
9268
9344
  lockedPatterns: bucket.lockedPatterns || [],
9269
- onlyKeys: input2.flags.key || []
9345
+ onlyKeys: input2.flags.key || [],
9346
+ formatter: input2.config.formatter
9270
9347
  });
9271
9348
  }
9272
9349
  }
@@ -9387,7 +9464,8 @@ function createLoaderForTask(assignedTask) {
9387
9464
  assignedTask.bucketPathPattern,
9388
9465
  {
9389
9466
  defaultLocale: assignedTask.sourceLocale,
9390
- injectLocale: assignedTask.injectLocale
9467
+ injectLocale: assignedTask.injectLocale,
9468
+ formatter: assignedTask.formatter
9391
9469
  },
9392
9470
  assignedTask.lockedKeys,
9393
9471
  assignedTask.lockedPatterns
@@ -9555,14 +9633,14 @@ async function watch2(ctx) {
9555
9633
  pollInterval: 100
9556
9634
  }
9557
9635
  });
9558
- watcher.on("change", (path18) => {
9559
- handleFileChange(path18, state, ctx);
9636
+ watcher.on("change", (path19) => {
9637
+ handleFileChange(path19, state, ctx);
9560
9638
  });
9561
- watcher.on("add", (path18) => {
9562
- handleFileChange(path18, state, ctx);
9639
+ watcher.on("add", (path19) => {
9640
+ handleFileChange(path19, state, ctx);
9563
9641
  });
9564
- watcher.on("unlink", (path18) => {
9565
- handleFileChange(path18, state, ctx);
9642
+ watcher.on("unlink", (path19) => {
9643
+ handleFileChange(path19, state, ctx);
9566
9644
  });
9567
9645
  watcher.on("error", (error) => {
9568
9646
  console.error(
@@ -9694,12 +9772,12 @@ async function determineAuthId(ctx) {
9694
9772
  }
9695
9773
 
9696
9774
  // src/cli/cmd/run/index.ts
9697
- var __dirname = path16.dirname(fileURLToPath(import.meta.url));
9775
+ var __dirname = path17.dirname(fileURLToPath(import.meta.url));
9698
9776
  function playSound(type) {
9699
9777
  const platform = os2.platform();
9700
9778
  return new Promise((resolve) => {
9701
- const assetDir = path16.join(__dirname, "../assets");
9702
- const soundFiles = [path16.join(assetDir, `${type}.mp3`)];
9779
+ const assetDir = path17.join(__dirname, "../assets");
9780
+ const soundFiles = [path17.join(assetDir, `${type}.mp3`)];
9703
9781
  let command = "";
9704
9782
  if (platform === "linux") {
9705
9783
  command = soundFiles.map(
@@ -9893,7 +9971,7 @@ var InBranchFlow = class extends IntegrationFlow {
9893
9971
  return false;
9894
9972
  }
9895
9973
  }
9896
- const workingDir = path17.resolve(
9974
+ const workingDir = path18.resolve(
9897
9975
  process.cwd(),
9898
9976
  this.platformKit.config.workingDir
9899
9977
  );
@@ -10651,8 +10729,8 @@ var status_default = new Command18().command("status").description("Show the sta
10651
10729
  if (flags.file?.length) {
10652
10730
  buckets = buckets.map((bucket) => {
10653
10731
  const paths = bucket.paths.filter(
10654
- (path18) => flags.file.find(
10655
- (file) => path18.pathPattern?.includes(file) || path18.pathPattern?.match(file) || minimatch(path18.pathPattern, file)
10732
+ (path19) => flags.file.find(
10733
+ (file) => path19.pathPattern?.includes(file) || path19.pathPattern?.match(file) || minimatch(path19.pathPattern, file)
10656
10734
  )
10657
10735
  );
10658
10736
  return { ...bucket, paths };
@@ -10666,8 +10744,8 @@ var status_default = new Command18().command("status").description("Show the sta
10666
10744
  ora.info(`\x1B[36mProcessing only filtered buckets:\x1B[0m`);
10667
10745
  buckets.map((bucket) => {
10668
10746
  ora.info(` ${bucket.type}:`);
10669
- bucket.paths.forEach((path18) => {
10670
- ora.info(` - ${path18.pathPattern}`);
10747
+ bucket.paths.forEach((path19) => {
10748
+ ora.info(` - ${path19.pathPattern}`);
10671
10749
  });
10672
10750
  });
10673
10751
  }
@@ -10705,7 +10783,8 @@ var status_default = new Command18().command("status").description("Show the sta
10705
10783
  bucketPath.pathPattern,
10706
10784
  {
10707
10785
  defaultLocale: sourceLocale,
10708
- injectLocale: bucket.injectLocale
10786
+ injectLocale: bucket.injectLocale,
10787
+ formatter: i18nConfig.formatter
10709
10788
  },
10710
10789
  bucket.lockedKeys
10711
10790
  );
@@ -10951,10 +11030,10 @@ var status_default = new Command18().command("status").description("Show the sta
10951
11030
  if (flags.confirm && Object.keys(fileStats).length > 0) {
10952
11031
  console.log(chalk14.bold(`
10953
11032
  \u{1F4D1} BREAKDOWN BY FILE:`));
10954
- Object.entries(fileStats).sort((a, b) => b[1].wordCount - a[1].wordCount).forEach(([path18, stats]) => {
11033
+ Object.entries(fileStats).sort((a, b) => b[1].wordCount - a[1].wordCount).forEach(([path19, stats]) => {
10955
11034
  if (stats.sourceKeys === 0) return;
10956
11035
  console.log(chalk14.bold(`
10957
- \u2022 ${path18}:`));
11036
+ \u2022 ${path19}:`));
10958
11037
  console.log(
10959
11038
  ` ${stats.sourceKeys} source keys, ~${stats.wordCount.toLocaleString()} source words`
10960
11039
  );
@@ -11174,7 +11253,7 @@ async function renderHero2() {
11174
11253
  // package.json
11175
11254
  var package_default = {
11176
11255
  name: "lingo.dev",
11177
- version: "0.111.10",
11256
+ version: "0.111.11",
11178
11257
  description: "Lingo.dev CLI",
11179
11258
  private: false,
11180
11259
  publishConfig: {
@@ -11304,6 +11383,8 @@ var package_default = {
11304
11383
  "@babel/parser": "^7.27.1",
11305
11384
  "@babel/traverse": "^7.27.4",
11306
11385
  "@babel/types": "^7.27.1",
11386
+ "@biomejs/js-api": "^0.6.2",
11387
+ "@biomejs/wasm-nodejs": "^1.8.3",
11307
11388
  "@datocms/cma-client-node": "^4.0.1",
11308
11389
  "@gitbeaker/rest": "^39.34.3",
11309
11390
  "@inkjs/ui": "^2.0.0",
@@ -11491,7 +11572,8 @@ var purge_default = new Command20().command("purge").description(
11491
11572
  bucketPath.pathPattern,
11492
11573
  {
11493
11574
  defaultLocale: sourceLocale,
11494
- injectLocale: bucket.injectLocale
11575
+ injectLocale: bucket.injectLocale,
11576
+ formatter: i18nConfig.formatter
11495
11577
  },
11496
11578
  bucket.lockedKeys,
11497
11579
  bucket.lockedPatterns,