lingo.dev 0.78.8 → 0.78.10

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
@@ -602,9 +602,9 @@ function makeGitlabInitializer(spinner) {
602
602
 
603
603
  // src/cli/cmd/init.ts
604
604
 
605
- var openUrl = (path13) => {
605
+ var openUrl = (path14) => {
606
606
  const settings = getSettings(void 0);
607
- _open2.default.call(void 0, `${settings.auth.webUrl}${path13}`, { wait: false });
607
+ _open2.default.call(void 0, `${settings.auth.webUrl}${path14}`, { wait: false });
608
608
  };
609
609
  var throwHelpError = (option, value) => {
610
610
  if (value === "help") {
@@ -944,8 +944,8 @@ var files_default = new (0, _interactivecommander.Command)().command("files").de
944
944
  } else if (type.target) {
945
945
  result.push(...targetPaths);
946
946
  }
947
- result.forEach((path13) => {
948
- console.log(path13);
947
+ result.forEach((path14) => {
948
+ console.log(path14);
949
949
  });
950
950
  }
951
951
  }
@@ -1513,9 +1513,9 @@ function createHtmlLoader() {
1513
1513
  const bDepth = b.split("/").length;
1514
1514
  return aDepth - bDepth;
1515
1515
  });
1516
- paths.forEach((path13) => {
1517
- const value = data[path13];
1518
- const [nodePath, attribute] = path13.split("#");
1516
+ paths.forEach((path14) => {
1517
+ const value = data[path14];
1518
+ const [nodePath, attribute] = path14.split("#");
1519
1519
  const [rootTag, ...indices] = nodePath.split("/");
1520
1520
  let parent = rootTag === "head" ? document.head : document.body;
1521
1521
  let current = parent;
@@ -1793,6 +1793,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
1793
1793
  }
1794
1794
 
1795
1795
  // src/cli/loaders/prettier.ts
1796
+
1796
1797
  var _prettier = require('prettier'); var _prettier2 = _interopRequireDefault(_prettier);
1797
1798
  function createPrettierLoader(options) {
1798
1799
  return createLoader({
@@ -1800,8 +1801,10 @@ function createPrettierLoader(options) {
1800
1801
  return data;
1801
1802
  },
1802
1803
  async push(locale, data) {
1803
- const prettierConfig = await loadPrettierConfig();
1804
- if (!prettierConfig && !options.alwaysFormat) {
1804
+ const draftPath = options.bucketPathPattern.replaceAll("[locale]", locale);
1805
+ const finalPath = _path2.default.resolve(draftPath);
1806
+ const prettierConfig = await loadPrettierConfig(finalPath);
1807
+ if (!prettierConfig) {
1805
1808
  return data;
1806
1809
  }
1807
1810
  const result = _prettier2.default.format(data, {
@@ -1818,9 +1821,9 @@ function createPrettierLoader(options) {
1818
1821
  }
1819
1822
  });
1820
1823
  }
1821
- async function loadPrettierConfig() {
1824
+ async function loadPrettierConfig(filePath) {
1822
1825
  try {
1823
- const config = await _prettier2.default.resolveConfig(process.cwd());
1826
+ const config = await _prettier2.default.resolveConfig(filePath);
1824
1827
  return config;
1825
1828
  } catch (error) {
1826
1829
  return {};
@@ -2543,18 +2546,18 @@ function createRawDatoValue(parsedDatoValue, originalRawDatoValue, isClean = fal
2543
2546
  }
2544
2547
  function serializeStructuredText(rawStructuredText) {
2545
2548
  return serializeStructuredTextNode(rawStructuredText);
2546
- function serializeStructuredTextNode(node, path13 = [], acc = {}) {
2549
+ function serializeStructuredTextNode(node, path14 = [], acc = {}) {
2547
2550
  if ("document" in node) {
2548
- return serializeStructuredTextNode(node.document, [...path13, "document"], acc);
2551
+ return serializeStructuredTextNode(node.document, [...path14, "document"], acc);
2549
2552
  }
2550
2553
  if (!_lodash2.default.isNil(node.value)) {
2551
- acc[[...path13, "value"].join(".")] = node.value;
2554
+ acc[[...path14, "value"].join(".")] = node.value;
2552
2555
  } else if (_lodash2.default.get(node, "type") === "block") {
2553
- acc[[...path13, "item"].join(".")] = serializeBlock(node.item);
2556
+ acc[[...path14, "item"].join(".")] = serializeBlock(node.item);
2554
2557
  }
2555
2558
  if (node.children) {
2556
2559
  for (let i = 0; i < node.children.length; i++) {
2557
- serializeStructuredTextNode(node.children[i], [...path13, i.toString()], acc);
2560
+ serializeStructuredTextNode(node.children[i], [...path14, i.toString()], acc);
2558
2561
  }
2559
2562
  }
2560
2563
  return acc;
@@ -2613,8 +2616,8 @@ function deserializeBlockList(parsedBlockList, originalRawBlockList, isClean = f
2613
2616
  }
2614
2617
  function deserializeStructuredText(parsedStructuredText, originalRawStructuredText) {
2615
2618
  const result = _lodash2.default.cloneDeep(originalRawStructuredText);
2616
- for (const [path13, value] of _lodash2.default.entries(parsedStructuredText)) {
2617
- const realPath = _lodash2.default.chain(path13.split(".")).flatMap((s) => !_lodash2.default.isNaN(_lodash2.default.toNumber(s)) ? ["children", s] : s).value();
2619
+ for (const [path14, value] of _lodash2.default.entries(parsedStructuredText)) {
2620
+ const realPath = _lodash2.default.chain(path14.split(".")).flatMap((s) => !_lodash2.default.isNaN(_lodash2.default.toNumber(s)) ? ["children", s] : s).value();
2618
2621
  const deserializedValue = createRawDatoValue(value, _lodash2.default.get(originalRawStructuredText, realPath), true);
2619
2622
  _lodash2.default.set(result, realPath, deserializedValue);
2620
2623
  }
@@ -2959,7 +2962,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options) {
2959
2962
  case "html":
2960
2963
  return composeLoaders(
2961
2964
  createTextFileLoader(bucketPathPattern),
2962
- createPrettierLoader({ parser: "html", alwaysFormat: true }),
2965
+ createPrettierLoader({ parser: "html", bucketPathPattern }),
2963
2966
  createHtmlLoader(),
2964
2967
  createSyncLoader(),
2965
2968
  createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
@@ -2967,7 +2970,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options) {
2967
2970
  case "json":
2968
2971
  return composeLoaders(
2969
2972
  createTextFileLoader(bucketPathPattern),
2970
- createPrettierLoader({ parser: "json" }),
2973
+ createPrettierLoader({ parser: "json", bucketPathPattern }),
2971
2974
  createJsonLoader(),
2972
2975
  createFlatLoader(),
2973
2976
  createSyncLoader(),
@@ -2976,7 +2979,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options) {
2976
2979
  case "markdown":
2977
2980
  return composeLoaders(
2978
2981
  createTextFileLoader(bucketPathPattern),
2979
- createPrettierLoader({ parser: "markdown" }),
2982
+ createPrettierLoader({ parser: "markdown", bucketPathPattern }),
2980
2983
  createMarkdownLoader(),
2981
2984
  createSyncLoader(),
2982
2985
  createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
@@ -3026,7 +3029,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options) {
3026
3029
  case "yaml":
3027
3030
  return composeLoaders(
3028
3031
  createTextFileLoader(bucketPathPattern),
3029
- createPrettierLoader({ parser: "yaml" }),
3032
+ createPrettierLoader({ parser: "yaml", bucketPathPattern }),
3030
3033
  createYamlLoader(),
3031
3034
  createFlatLoader(),
3032
3035
  createSyncLoader(),
@@ -3035,7 +3038,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options) {
3035
3038
  case "yaml-root-key":
3036
3039
  return composeLoaders(
3037
3040
  createTextFileLoader(bucketPathPattern),
3038
- createPrettierLoader({ parser: "yaml" }),
3041
+ createPrettierLoader({ parser: "yaml", bucketPathPattern }),
3039
3042
  createYamlLoader(),
3040
3043
  createRootKeyLoader(true),
3041
3044
  createFlatLoader(),
@@ -3045,7 +3048,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options) {
3045
3048
  case "flutter":
3046
3049
  return composeLoaders(
3047
3050
  createTextFileLoader(bucketPathPattern),
3048
- createPrettierLoader({ parser: "json" }),
3051
+ createPrettierLoader({ parser: "json", bucketPathPattern }),
3049
3052
  createJsonLoader(),
3050
3053
  createFlutterLoader(),
3051
3054
  createFlatLoader(),
@@ -3896,7 +3899,7 @@ var mcp_default = new (0, _interactivecommander.Command)().command("mcp").descri
3896
3899
  // package.json
3897
3900
  var package_default = {
3898
3901
  name: "lingo.dev",
3899
- version: "0.78.8",
3902
+ version: "0.78.10",
3900
3903
  description: "Lingo.dev CLI",
3901
3904
  private: false,
3902
3905
  publishConfig: {