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.cjs CHANGED
@@ -10,9 +10,9 @@ var _ora = require('ora'); var _ora2 = _interopRequireDefault(_ora);
10
10
 
11
11
  // src/cli/utils/settings.ts
12
12
  var _os = require('os'); var _os2 = _interopRequireDefault(_os);
13
- var _path = require('path'); var path13 = _interopRequireWildcard(_path); var path14 = _interopRequireWildcard(_path);
13
+ var _path = require('path'); var path14 = _interopRequireWildcard(_path); var path15 = _interopRequireWildcard(_path);
14
14
  var _zod = require('zod'); var _zod2 = _interopRequireDefault(_zod);
15
- var _fs = require('fs'); var fs10 = _interopRequireWildcard(_fs);
15
+ var _fs = require('fs'); var fs11 = _interopRequireWildcard(_fs);
16
16
  var _ini = require('ini'); var _ini2 = _interopRequireDefault(_ini);
17
17
  function getSettings(explicitApiKey) {
18
18
  const env = _loadEnv();
@@ -94,7 +94,7 @@ function _loadEnv() {
94
94
  }
95
95
  function _loadSystemFile() {
96
96
  const settingsFilePath = _getSettingsFilePath();
97
- const content = fs10.default.existsSync(settingsFilePath) ? fs10.default.readFileSync(settingsFilePath, "utf-8") : "";
97
+ const content = fs11.default.existsSync(settingsFilePath) ? fs11.default.readFileSync(settingsFilePath, "utf-8") : "";
98
98
  const data = _ini2.default.parse(content);
99
99
  return _zod2.default.object({
100
100
  auth: _zod2.default.object({
@@ -115,12 +115,12 @@ function _loadSystemFile() {
115
115
  function _saveSystemFile(settings) {
116
116
  const settingsFilePath = _getSettingsFilePath();
117
117
  const content = _ini2.default.stringify(settings);
118
- fs10.default.writeFileSync(settingsFilePath, content);
118
+ fs11.default.writeFileSync(settingsFilePath, content);
119
119
  }
120
120
  function _getSettingsFilePath() {
121
121
  const settingsFile = ".lingodotdevrc";
122
122
  const homedir = _os2.default.homedir();
123
- const settingsFilePath = path13.default.join(homedir, settingsFile);
123
+ const settingsFilePath = path14.default.join(homedir, settingsFile);
124
124
  return settingsFilePath;
125
125
  }
126
126
  function _legacyEnvVarWarning() {
@@ -684,11 +684,11 @@ var _lodash = require('lodash'); var _lodash2 = _interopRequireDefault(_lodash);
684
684
  var __spec = require('@lingo.dev/_spec');
685
685
  function getConfig(resave = true) {
686
686
  const configFilePath = _getConfigFilePath();
687
- const configFileExists = fs10.default.existsSync(configFilePath);
687
+ const configFileExists = fs11.default.existsSync(configFilePath);
688
688
  if (!configFileExists) {
689
689
  return null;
690
690
  }
691
- const fileContents = fs10.default.readFileSync(configFilePath, "utf8");
691
+ const fileContents = fs11.default.readFileSync(configFilePath, "utf8");
692
692
  const rawConfig = JSON.parse(fileContents);
693
693
  const result = __spec.parseI18nConfig.call(void 0, rawConfig);
694
694
  const didConfigChange = !_lodash2.default.isEqual(rawConfig, result);
@@ -700,11 +700,11 @@ function getConfig(resave = true) {
700
700
  function saveConfig(config) {
701
701
  const configFilePath = _getConfigFilePath();
702
702
  const serialized = JSON.stringify(config, null, 2);
703
- fs10.default.writeFileSync(configFilePath, serialized);
703
+ fs11.default.writeFileSync(configFilePath, serialized);
704
704
  return config;
705
705
  }
706
706
  function _getConfigFilePath() {
707
- return path13.default.join(process.cwd(), "i18n.json");
707
+ return path14.default.join(process.cwd(), "i18n.json");
708
708
  }
709
709
 
710
710
  // src/cli/cmd/init.ts
@@ -799,7 +799,7 @@ function findLocaleFilesForFilename(fileName) {
799
799
  });
800
800
  const localeFilesAndPatterns = localeFiles.map((file) => ({
801
801
  file,
802
- pattern: path13.default.join(path13.default.dirname(file), pattern)
802
+ pattern: path14.default.join(path14.default.dirname(file), pattern)
803
803
  }));
804
804
  const grouppedFilesAndPatterns = _lodash2.default.groupBy(localeFilesAndPatterns, "pattern");
805
805
  const patterns = Object.keys(grouppedFilesAndPatterns);
@@ -819,10 +819,10 @@ function ensurePatterns(patterns, source) {
819
819
  }
820
820
  patterns.forEach((pattern) => {
821
821
  const filePath = pattern.replace("[locale]", source);
822
- if (!fs10.default.existsSync(filePath)) {
823
- const defaultContent = getDefaultContent(path13.default.extname(filePath), source);
824
- fs10.default.mkdirSync(path13.default.dirname(filePath), { recursive: true });
825
- fs10.default.writeFileSync(filePath, defaultContent);
822
+ if (!fs11.default.existsSync(filePath)) {
823
+ const defaultContent = getDefaultContent(path14.default.extname(filePath), source);
824
+ fs11.default.mkdirSync(path14.default.dirname(filePath), { recursive: true });
825
+ fs11.default.writeFileSync(filePath, defaultContent);
826
826
  }
827
827
  });
828
828
  }
@@ -901,31 +901,31 @@ function updateGitignore() {
901
901
  if (!projectRoot) {
902
902
  return;
903
903
  }
904
- const gitignorePath = path13.default.join(projectRoot, ".gitignore");
905
- if (!fs10.default.existsSync(gitignorePath)) {
904
+ const gitignorePath = path14.default.join(projectRoot, ".gitignore");
905
+ if (!fs11.default.existsSync(gitignorePath)) {
906
906
  return;
907
907
  }
908
- const gitignore = fs10.default.readFileSync(gitignorePath, "utf8").split("\n");
908
+ const gitignore = fs11.default.readFileSync(gitignorePath, "utf8").split("\n");
909
909
  const cacheIsIgnored = gitignore.includes(cacheFile);
910
910
  if (!cacheIsIgnored) {
911
911
  let content = "";
912
- content = fs10.default.readFileSync(gitignorePath, "utf8");
912
+ content = fs11.default.readFileSync(gitignorePath, "utf8");
913
913
  if (content !== "" && !content.endsWith("\n")) {
914
914
  content += "\n";
915
915
  }
916
916
  content += `${cacheFile}
917
917
  `;
918
- fs10.default.writeFileSync(gitignorePath, content);
918
+ fs11.default.writeFileSync(gitignorePath, content);
919
919
  }
920
920
  }
921
921
  function findCurrentProjectRoot() {
922
922
  let currentDir = process.cwd();
923
- while (currentDir !== path13.default.parse(currentDir).root) {
924
- const gitDirPath = path13.default.join(currentDir, ".git");
925
- if (fs10.default.existsSync(gitDirPath) && fs10.default.lstatSync(gitDirPath).isDirectory()) {
923
+ while (currentDir !== path14.default.parse(currentDir).root) {
924
+ const gitDirPath = path14.default.join(currentDir, ".git");
925
+ if (fs11.default.existsSync(gitDirPath) && fs11.default.lstatSync(gitDirPath).isDirectory()) {
926
926
  return currentDir;
927
927
  }
928
- currentDir = path13.default.dirname(currentDir);
928
+ currentDir = path14.default.dirname(currentDir);
929
929
  }
930
930
  return null;
931
931
  }
@@ -969,24 +969,24 @@ function makePlatformInitializer(config, spinner) {
969
969
  return {
970
970
  name: config.name,
971
971
  isEnabled: () => {
972
- const filePath = path13.default.join(process.cwd(), config.checkPath);
973
- return fs10.default.existsSync(filePath);
972
+ const filePath = path14.default.join(process.cwd(), config.checkPath);
973
+ return fs11.default.existsSync(filePath);
974
974
  },
975
975
  init: async () => {
976
- const filePath = path13.default.join(process.cwd(), config.ciConfigPath);
977
- const dirPath = path13.default.dirname(filePath);
978
- if (!fs10.default.existsSync(dirPath)) {
979
- fs10.default.mkdirSync(dirPath, { recursive: true });
976
+ const filePath = path14.default.join(process.cwd(), config.ciConfigPath);
977
+ const dirPath = path14.default.dirname(filePath);
978
+ if (!fs11.default.existsSync(dirPath)) {
979
+ fs11.default.mkdirSync(dirPath, { recursive: true });
980
980
  }
981
981
  let canWrite = true;
982
- if (fs10.default.existsSync(filePath)) {
982
+ if (fs11.default.existsSync(filePath)) {
983
983
  canWrite = await _prompts.confirm.call(void 0, {
984
984
  message: `File ${filePath} already exists. Do you want to overwrite it?`,
985
985
  default: false
986
986
  });
987
987
  }
988
988
  if (canWrite) {
989
- fs10.default.writeFileSync(filePath, config.ciConfigContent);
989
+ fs11.default.writeFileSync(filePath, config.ciConfigContent);
990
990
  spinner.succeed(`CI/CD initialized for ${config.name}`);
991
991
  } else {
992
992
  spinner.warn(`CI/CD not initialized for ${config.name}`);
@@ -1060,9 +1060,9 @@ function makeGitlabInitializer(spinner) {
1060
1060
 
1061
1061
  // src/cli/cmd/init.ts
1062
1062
 
1063
- var openUrl = (path18) => {
1063
+ var openUrl = (path19) => {
1064
1064
  const settings = getSettings(void 0);
1065
- _open2.default.call(void 0, `${settings.auth.webUrl}${path18}`, { wait: false });
1065
+ _open2.default.call(void 0, `${settings.auth.webUrl}${path19}`, { wait: false });
1066
1066
  };
1067
1067
  var throwHelpError = (option, value) => {
1068
1068
  if (value === "help") {
@@ -1125,8 +1125,8 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
1125
1125
  const values = value.includes(",") ? value.split(",") : value.split(" ");
1126
1126
  for (const p of values) {
1127
1127
  try {
1128
- const dirPath = path13.default.dirname(p);
1129
- const stats = fs10.default.statSync(dirPath);
1128
+ const dirPath = path14.default.dirname(p);
1129
+ const stats = fs11.default.statSync(dirPath);
1130
1130
  if (!stats.isDirectory()) {
1131
1131
  throw new Error(`${dirPath} is not a directory`);
1132
1132
  }
@@ -1268,12 +1268,12 @@ var config_default = new (0, _interactivecommander.Command)().command("config").
1268
1268
  console.log(JSON.stringify(config, null, 2));
1269
1269
  });
1270
1270
  function loadReplexicaFileConfig() {
1271
- const replexicaConfigPath = path13.default.resolve(process.cwd(), "i18n.json");
1272
- const fileExists = fs10.default.existsSync(replexicaConfigPath);
1271
+ const replexicaConfigPath = path14.default.resolve(process.cwd(), "i18n.json");
1272
+ const fileExists = fs11.default.existsSync(replexicaConfigPath);
1273
1273
  if (!fileExists) {
1274
1274
  return void 0;
1275
1275
  }
1276
- const fileContent = fs10.default.readFileSync(replexicaConfigPath, "utf-8");
1276
+ const fileContent = fs11.default.readFileSync(replexicaConfigPath, "utf-8");
1277
1277
  const replexicaFileConfig = JSON.parse(fileContent);
1278
1278
  return replexicaFileConfig;
1279
1279
  }
@@ -1379,13 +1379,13 @@ function extractPathPatterns(sourceLocale, include, exclude) {
1379
1379
  return result;
1380
1380
  }
1381
1381
  function normalizePath(filepath) {
1382
- const normalized = path13.default.normalize(filepath);
1382
+ const normalized = path14.default.normalize(filepath);
1383
1383
  return process.platform === "win32" ? normalized.toLowerCase() : normalized;
1384
1384
  }
1385
1385
  function expandPlaceholderedGlob(_pathPattern, sourceLocale) {
1386
- const absolutePathPattern = path13.default.resolve(_pathPattern);
1386
+ const absolutePathPattern = path14.default.resolve(_pathPattern);
1387
1387
  const pathPattern = normalizePath(
1388
- path13.default.relative(process.cwd(), absolutePathPattern)
1388
+ path14.default.relative(process.cwd(), absolutePathPattern)
1389
1389
  );
1390
1390
  if (pathPattern.startsWith("..")) {
1391
1391
  throw new CLIError({
@@ -1399,7 +1399,7 @@ function expandPlaceholderedGlob(_pathPattern, sourceLocale) {
1399
1399
  docUrl: "invalidPathPattern"
1400
1400
  });
1401
1401
  }
1402
- const pathPatternChunks = pathPattern.split(path13.default.sep);
1402
+ const pathPatternChunks = pathPattern.split(path14.default.sep);
1403
1403
  const localeSegmentIndexes = pathPatternChunks.reduce(
1404
1404
  (indexes, segment, index) => {
1405
1405
  if (segment.includes("[locale]")) {
@@ -1416,12 +1416,12 @@ function expandPlaceholderedGlob(_pathPattern, sourceLocale) {
1416
1416
  withFileTypes: true,
1417
1417
  windowsPathsNoEscape: true
1418
1418
  // Windows path support
1419
- }).filter((file) => file.isFile() || file.isSymbolicLink()).map((file) => file.fullpath()).map((fullpath) => normalizePath(path13.default.relative(process.cwd(), fullpath)));
1419
+ }).filter((file) => file.isFile() || file.isSymbolicLink()).map((file) => file.fullpath()).map((fullpath) => normalizePath(path14.default.relative(process.cwd(), fullpath)));
1420
1420
  const placeholderedPaths = sourcePaths.map((sourcePath) => {
1421
1421
  const normalizedSourcePath = normalizePath(
1422
- sourcePath.replace(/\//g, path13.default.sep)
1422
+ sourcePath.replace(/\//g, path14.default.sep)
1423
1423
  );
1424
- const sourcePathChunks = normalizedSourcePath.split(path13.default.sep);
1424
+ const sourcePathChunks = normalizedSourcePath.split(path14.default.sep);
1425
1425
  localeSegmentIndexes.forEach((localeSegmentIndex) => {
1426
1426
  const pathPatternChunk = pathPatternChunks[localeSegmentIndex];
1427
1427
  const sourcePathChunk = sourcePathChunks[localeSegmentIndex];
@@ -1435,7 +1435,7 @@ function expandPlaceholderedGlob(_pathPattern, sourceLocale) {
1435
1435
  sourcePathChunks[localeSegmentIndex] = placeholderedSegment;
1436
1436
  }
1437
1437
  });
1438
- const placeholderedPath = sourcePathChunks.join(path13.default.sep);
1438
+ const placeholderedPath = sourcePathChunks.join(path14.default.sep);
1439
1439
  return placeholderedPath;
1440
1440
  });
1441
1441
  return placeholderedPaths;
@@ -1499,8 +1499,8 @@ var files_default = new (0, _interactivecommander.Command)().command("files").de
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
  }
@@ -2132,8 +2132,8 @@ function createTextFileLoader(pathPattern) {
2132
2132
  },
2133
2133
  async push(locale, data, _35, originalLocale) {
2134
2134
  const draftPath = pathPattern.replaceAll("[locale]", locale);
2135
- const finalPath = path13.default.resolve(draftPath);
2136
- const dirPath = path13.default.dirname(finalPath);
2135
+ const finalPath = path14.default.resolve(draftPath);
2136
+ const dirPath = path14.default.dirname(finalPath);
2137
2137
  await _promises4.default.mkdir(dirPath, { recursive: true });
2138
2138
  const trimmedPayload = data.trim();
2139
2139
  const trailingNewLine = await getTrailingNewLine(
@@ -2151,7 +2151,7 @@ function createTextFileLoader(pathPattern) {
2151
2151
  }
2152
2152
  async function readFileForLocale(pathPattern, locale) {
2153
2153
  const draftPath = pathPattern.replaceAll("[locale]", locale);
2154
- const finalPath = path13.default.resolve(draftPath);
2154
+ const finalPath = path14.default.resolve(draftPath);
2155
2155
  const exists = await _promises4.default.access(finalPath).then(() => true).catch(() => false);
2156
2156
  if (!exists) {
2157
2157
  return "";
@@ -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
2931
+ // src/cli/loaders/unlocalizable.ts
2932
+
2933
+ var _isurl = require('is-url'); var _isurl2 = _interopRequireDefault(_isurl);
2934
+ var _datefns = require('date-fns');
2935
+ function createUnlocalizableLoader(returnUnlocalizedKeys = false) {
2936
+ return createLoader({
2937
+ async pull(locale, input2) {
2938
+ const unlocalizableKeys = _getUnlocalizableKeys(input2);
2939
+ const result = _lodash2.default.omitBy(
2940
+ input2,
2941
+ (_35, key) => unlocalizableKeys.includes(key)
2942
+ );
2943
+ if (returnUnlocalizedKeys) {
2944
+ result.unlocalizable = _lodash2.default.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 = _lodash2.default.merge(
2954
+ {},
2955
+ data,
2956
+ _lodash2.default.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 _datefns.isValid.call(void 0, _datefns.parseISO.call(void 0, v));
2967
+ }
2968
+ function _getUnlocalizableKeys(input2) {
2969
+ const rules = {
2970
+ isEmpty: (v) => _lodash2.default.isEmpty(v),
2971
+ isNumber: (v) => typeof v === "number" || /^[0-9]+$/.test(v),
2972
+ isBoolean: (v) => _lodash2.default.isBoolean(v),
2973
+ isIsoDate: (v) => _lodash2.default.isString(v) && _isIsoDate(v),
2974
+ isSystemId: (v) => _lodash2.default.isString(v) && _isSystemId(v),
2975
+ isUrl: (v) => _lodash2.default.isString(v) && _isurl2.default.call(void 0, 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
+ }
2932
2989
 
2990
+ // src/cli/loaders/formatters/prettier.ts
2933
2991
  var _prettier = require('prettier'); var _prettier2 = _interopRequireDefault(_prettier);
2934
- function createPrettierLoader(options) {
2992
+
2993
+ // src/cli/loaders/formatters/_base.ts
2994
+
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 = path14.default.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 = path13.default.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 = path13.default.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 _prettier2.default.resolveConfig(filePath);
@@ -3000,63 +3063,71 @@ async function formatDataWithPrettier(data, filePath, options) {
3000
3063
  }
3001
3064
  }
3002
3065
 
3003
- // src/cli/loaders/unlocalizable.ts
3066
+ // src/cli/loaders/formatters/biome.ts
3004
3067
 
3005
- var _isurl = require('is-url'); var _isurl2 = _interopRequireDefault(_isurl);
3006
- var _datefns = require('date-fns');
3007
- function createUnlocalizableLoader(returnUnlocalizedKeys = false) {
3008
- return createLoader({
3009
- async pull(locale, input2) {
3010
- const unlocalizableKeys = _getUnlocalizableKeys(input2);
3011
- const result = _lodash2.default.omitBy(
3012
- input2,
3013
- (_35, key) => unlocalizableKeys.includes(key)
3014
- );
3015
- if (returnUnlocalizedKeys) {
3016
- result.unlocalizable = _lodash2.default.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 = _lodash2.default.merge(
3026
- {},
3027
- data,
3028
- _lodash2.default.omitBy(originalInput, (_35, key) => !unlocalizableKeys.includes(key))
3029
- );
3030
- return result;
3031
- }
3068
+
3069
+ var _jsapi = require('@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 = path14.default.dirname(startPath);
3077
+ const root = path14.default.parse(currentDir).root;
3078
+ while (currentDir !== root) {
3079
+ for (const configName of ["biome.json", "biome.jsonc"]) {
3080
+ const configPath = path14.default.join(currentDir, configName);
3081
+ try {
3082
+ await _promises4.default.access(configPath);
3083
+ return configPath;
3084
+ } catch (e2) {
3085
+ }
3086
+ }
3087
+ const parentDir = path14.default.dirname(currentDir);
3088
+ if (parentDir === currentDir) break;
3089
+ currentDir = parentDir;
3090
+ }
3091
+ return null;
3036
3092
  }
3037
- function _isIsoDate(v) {
3038
- return _datefns.isValid.call(void 0, _datefns.parseISO.call(void 0, v));
3093
+ async function formatDataWithBiome(data, filePath, options) {
3094
+ try {
3095
+ const biome = await _jsapi.Biome.create({
3096
+ distribution: _jsapi.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 _promises4.default.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) => _lodash2.default.isEmpty(v),
3043
- isNumber: (v) => typeof v === "number" || /^[0-9]+$/.test(v),
3044
- isBoolean: (v) => _lodash2.default.isBoolean(v),
3045
- isIsoDate: (v) => _lodash2.default.isString(v) && _isIsoDate(v),
3046
- isSystemId: (v) => _lodash2.default.isString(v) && _isSystemId(v),
3047
- isUrl: (v) => _lodash2.default.isString(v) && _isurl2.default.call(void 0, 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
@@ -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 (!_lodash2.default.isNil(node.value)) {
4254
- acc[[...path18, "value"].join(".")] = node.value;
4325
+ acc[[...path19, "value"].join(".")] = node.value;
4255
4326
  } else if (_lodash2.default.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 = _lodash2.default.cloneDeep(originalRawStructuredText);
4329
- for (const [path18, value] of _lodash2.default.entries(parsedStructuredText)) {
4330
- const realPath = _lodash2.default.chain(path18.split(".")).flatMap((s) => !_lodash2.default.isNaN(_lodash2.default.toNumber(s)) ? ["children", s] : s).value();
4400
+ for (const [path19, value] of _lodash2.default.entries(parsedStructuredText)) {
4401
+ const realPath = _lodash2.default.chain(path19.split(".")).flatMap((s) => !_lodash2.default.isNaN(_lodash2.default.toNumber(s)) ? ["children", s] : s).value();
4331
4402
  const deserializedValue = createRawDatoValue(
4332
4403
  value,
4333
4404
  _lodash2.default.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 = fs10.default.readFileSync(configFilePath, "utf-8");
4438
+ const configContent = fs11.default.readFileSync(configFilePath, "utf-8");
4368
4439
  const datoConfig = datoConfigSchema.parse(_json52.default.parse(configContent));
4369
4440
  return composeLoaders(
4370
4441
  createDatoApiLoader(
4371
4442
  datoConfig,
4372
- (updatedConfig) => fs10.default.writeFileSync(
4443
+ (updatedConfig) => fs11.default.writeFileSync(
4373
4444
  configFilePath,
4374
4445
  _json52.default.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(),
@@ -7698,21 +7770,21 @@ function trackEvent(distinctId, event, properties) {
7698
7770
 
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
@@ -7733,7 +7805,7 @@ var LockSchema = _zod2.default.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 (0, _interactivecommander.Command)().command("i18n").desc
7911
7983
  if (_optionalChain([flags, 'access', _258 => _258.file, 'optionalAccess', _259 => _259.length])) {
7912
7984
  buckets = buckets.map((bucket) => {
7913
7985
  const paths = bucket.paths.filter(
7914
- (path18) => flags.file.find((file) => _optionalChain([path18, 'access', _260 => _260.pathPattern, 'optionalAccess', _261 => _261.includes, 'call', _262 => _262(file)]))
7986
+ (path19) => flags.file.find((file) => _optionalChain([path19, 'access', _260 => _260.pathPattern, 'optionalAccess', _261 => _261.includes, 'call', _262 => _262(file)]))
7915
7987
  );
7916
7988
  return { ...bucket, paths };
7917
7989
  }).filter((bucket) => bucket.paths.length > 0);
@@ -7926,8 +7998,8 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
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 (0, _interactivecommander.Command)().command("i18n").desc
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 (0, _interactivecommander.Command)().command("i18n").desc
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,
@@ -8477,7 +8551,7 @@ function createLockfileHelper() {
8477
8551
  return {
8478
8552
  isLockfileExists: () => {
8479
8553
  const lockfilePath = _getLockfilePath();
8480
- return fs10.default.existsSync(lockfilePath);
8554
+ return fs11.default.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 (!fs10.default.existsSync(lockfilePath)) {
8591
+ if (!fs11.default.existsSync(lockfilePath)) {
8518
8592
  return LockfileSchema.parse({});
8519
8593
  }
8520
- const content = fs10.default.readFileSync(lockfilePath, "utf-8");
8594
+ const content = fs11.default.readFileSync(lockfilePath, "utf-8");
8521
8595
  const result = LockfileSchema.parse(_yaml2.default.parse(content));
8522
8596
  return result;
8523
8597
  }
8524
8598
  function _saveLockfile(lockfile) {
8525
8599
  const lockfilePath = _getLockfilePath();
8526
8600
  const content = _yaml2.default.stringify(lockfile);
8527
- fs10.default.writeFileSync(lockfilePath, content);
8601
+ fs11.default.writeFileSync(lockfilePath, content);
8528
8602
  }
8529
8603
  function _getLockfilePath() {
8530
- return path13.default.join(process.cwd(), "i18n.lock");
8604
+ return path14.default.join(process.cwd(), "i18n.lock");
8531
8605
  }
8532
8606
  }
8533
8607
  var LockfileSchema = _zod2.default.object({
@@ -8573,7 +8647,8 @@ var lockfile_default = new (0, _interactivecommander.Command)().command("lockfil
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 (0, _interactivecommander.Command)().command("cleanup"
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);
@@ -8862,7 +8938,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
8862
8938
  authenticated: !!response,
8863
8939
  username: _optionalChain([response, 'optionalAccess', _273 => _273.email])
8864
8940
  };
8865
- } catch (e2) {
8941
+ } catch (e3) {
8866
8942
  return { authenticated: false };
8867
8943
  }
8868
8944
  },
@@ -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(
@@ -9687,19 +9765,19 @@ async function determineAuthId(ctx) {
9687
9765
  try {
9688
9766
  const authStatus = await _optionalChain([ctx, 'access', _293 => _293.localizer, 'optionalAccess', _294 => _294.checkAuth, 'call', _295 => _295()]);
9689
9767
  return _optionalChain([authStatus, 'optionalAccess', _296 => _296.username]) || null;
9690
- } catch (e3) {
9768
+ } catch (e4) {
9691
9769
  return null;
9692
9770
  }
9693
9771
  }
9694
9772
  }
9695
9773
 
9696
9774
  // src/cli/cmd/run/index.ts
9697
- var __dirname = path13.default.dirname(_url.fileURLToPath.call(void 0, import.meta.url));
9775
+ var __dirname = path14.default.dirname(_url.fileURLToPath.call(void 0, import.meta.url));
9698
9776
  function playSound(type) {
9699
9777
  const platform = _os2.default.platform();
9700
9778
  return new Promise((resolve) => {
9701
- const assetDir = path13.default.join(__dirname, "../assets");
9702
- const soundFiles = [path13.default.join(assetDir, `${type}.mp3`)];
9779
+ const assetDir = path14.default.join(__dirname, "../assets");
9780
+ const soundFiles = [path14.default.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 = path13.default.resolve(
9974
+ const workingDir = path14.default.resolve(
9897
9975
  process.cwd(),
9898
9976
  this.platformKit.config.workingDir
9899
9977
  );
@@ -10387,7 +10465,7 @@ var GitlabPlatformKit = class extends PlatformKit {
10387
10465
  branch
10388
10466
  );
10389
10467
  return true;
10390
- } catch (e4) {
10468
+ } catch (e5) {
10391
10469
  return false;
10392
10470
  }
10393
10471
  }
@@ -10651,8 +10729,8 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
10651
10729
  if (_optionalChain([flags, 'access', _324 => _324.file, 'optionalAccess', _325 => _325.length])) {
10652
10730
  buckets = buckets.map((bucket) => {
10653
10731
  const paths = bucket.paths.filter(
10654
- (path18) => flags.file.find(
10655
- (file) => _optionalChain([path18, 'access', _326 => _326.pathPattern, 'optionalAccess', _327 => _327.includes, 'call', _328 => _328(file)]) || _optionalChain([path18, 'access', _329 => _329.pathPattern, 'optionalAccess', _330 => _330.match, 'call', _331 => _331(file)]) || minimatch(path18.pathPattern, file)
10732
+ (path19) => flags.file.find(
10733
+ (file) => _optionalChain([path19, 'access', _326 => _326.pathPattern, 'optionalAccess', _327 => _327.includes, 'call', _328 => _328(file)]) || _optionalChain([path19, 'access', _329 => _329.pathPattern, 'optionalAccess', _330 => _330.match, 'call', _331 => _331(file)]) || minimatch(path19.pathPattern, file)
10656
10734
  )
10657
10735
  );
10658
10736
  return { ...bucket, paths };
@@ -10666,8 +10744,8 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
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 (0, _interactivecommander.Command)().command("status").
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 (0, _interactivecommander.Command)().command("status").
10951
11030
  if (flags.confirm && Object.keys(fileStats).length > 0) {
10952
11031
  console.log(_chalk2.default.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(_chalk2.default.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 (0, _interactivecommander.Command)().command("purge").de
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,