lingo.dev 0.92.14 → 0.92.16

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
@@ -1096,7 +1096,8 @@ function createLoader(lDefinition) {
1096
1096
  locale,
1097
1097
  input2,
1098
1098
  state.initCtx,
1099
- state.defaultLocale
1099
+ state.defaultLocale,
1100
+ state.originalInput
1100
1101
  );
1101
1102
  state.pullOutput = result;
1102
1103
  return result;
@@ -2922,11 +2923,12 @@ function createVariableLoader(params) {
2922
2923
  function variableExtractLoader(params) {
2923
2924
  const specifierPattern = getFormatSpecifierPattern(params.type);
2924
2925
  return createLoader({
2925
- pull: async (locale, input2) => {
2926
+ pull: async (locale, input2, initXtx, originalLocale, originalInput) => {
2926
2927
  const result = {};
2927
2928
  const inputValues = _lodash2.default.omitBy(input2, _lodash2.default.isEmpty);
2928
2929
  for (const [key, value] of Object.entries(inputValues)) {
2929
- const matches = value.match(specifierPattern) || [];
2930
+ const originalValue = originalInput[key];
2931
+ const matches = originalValue.match(specifierPattern) || [];
2930
2932
  result[key] = result[key] || {
2931
2933
  value,
2932
2934
  variables: []
@@ -2941,7 +2943,7 @@ function variableExtractLoader(params) {
2941
2943
  }
2942
2944
  return result;
2943
2945
  },
2944
- push: async (locale, data) => {
2946
+ push: async (locale, data, originalInput, originalDefaultLocale, pullInput, pullOutput) => {
2945
2947
  const result = {};
2946
2948
  for (const [key, valueObj] of Object.entries(data)) {
2947
2949
  result[key] = valueObj.value;
@@ -2964,7 +2966,7 @@ function variableContentLoader() {
2964
2966
  },
2965
2967
  push: async (locale, data, originalInput, defaultLocale, pullInput) => {
2966
2968
  const result = _lodash2.default.cloneDeep(
2967
- pullInput || {}
2969
+ originalInput || {}
2968
2970
  );
2969
2971
  for (const [key, originalValueObj] of Object.entries(result)) {
2970
2972
  result[key] = {
@@ -2991,7 +2993,7 @@ function getFormatSpecifierPattern(type) {
2991
2993
 
2992
2994
  function createSyncLoader() {
2993
2995
  return createLoader({
2994
- async pull(locale, input2, originalInput) {
2996
+ async pull(locale, input2, initCtx, originalLocale, originalInput) {
2995
2997
  if (!originalInput) {
2996
2998
  return input2;
2997
2999
  }
@@ -6367,7 +6369,7 @@ async function renderHero() {
6367
6369
  // package.json
6368
6370
  var package_default = {
6369
6371
  name: "lingo.dev",
6370
- version: "0.92.14",
6372
+ version: "0.92.16",
6371
6373
  description: "Lingo.dev CLI",
6372
6374
  private: false,
6373
6375
  publishConfig: {
@@ -6615,6 +6617,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
6615
6617
 
6616
6618
 
6617
6619
 
6620
+
6618
6621
  function createExplicitLocalizer(provider) {
6619
6622
  switch (provider.id) {
6620
6623
  default:
@@ -6724,7 +6727,12 @@ function createAiSdkLocalizer(params) {
6724
6727
  ]
6725
6728
  });
6726
6729
  const result = JSON.parse(response.text);
6727
- return result.data;
6730
+ const index = result.data.indexOf("{");
6731
+ const lastIndex = result.data.lastIndexOf("}");
6732
+ const trimmed = result.data.slice(index, lastIndex + 1);
6733
+ const repaired = _jsonrepair.jsonrepair.call(void 0, trimmed);
6734
+ const finalResult = JSON.parse(repaired);
6735
+ return finalResult.data;
6728
6736
  }
6729
6737
  };
6730
6738
  }
@@ -7212,11 +7220,17 @@ async function waitForUserPrompt(message) {
7212
7220
  }
7213
7221
  async function renderSummary(ctx) {
7214
7222
  console.log(_chalk2.default.hex(colors.green)("[Done]"));
7215
- const skippedTasksCount = ctx.results.values().filter((r) => r.status === "skipped").toArray().length;
7223
+ const skippedTasksCount = Array.from(ctx.results.values()).filter(
7224
+ (r) => r.status === "skipped"
7225
+ ).length;
7216
7226
  console.log(`\u2022 ${_chalk2.default.hex(colors.yellow)(skippedTasksCount)} from cache`);
7217
- const succeededTasksCount = ctx.results.values().filter((r) => r.status === "success").toArray().length;
7227
+ const succeededTasksCount = Array.from(ctx.results.values()).filter(
7228
+ (r) => r.status === "success"
7229
+ ).length;
7218
7230
  console.log(`\u2022 ${_chalk2.default.hex(colors.yellow)(succeededTasksCount)} processed`);
7219
- const failedTasksCount = ctx.results.values().filter((r) => r.status === "error").toArray().length;
7231
+ const failedTasksCount = Array.from(ctx.results.values()).filter(
7232
+ (r) => r.status === "error"
7233
+ ).length;
7220
7234
  console.log(`\u2022 ${_chalk2.default.hex(colors.yellow)(failedTasksCount)} failed`);
7221
7235
  }
7222
7236