lingo.dev 0.83.0 → 0.84.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/cli.mjs CHANGED
@@ -1635,9 +1635,9 @@ import remarkGfm from "remark-gfm";
1635
1635
  import remarkStringify from "remark-stringify";
1636
1636
  import remarkMdxFrontmatter from "remark-mdx-frontmatter";
1637
1637
  import { VFile } from "vfile";
1638
+ var parser = unified().use(remarkParse).use(remarkMdx).use(remarkFrontmatter, ["yaml"]).use(remarkMdxFrontmatter).use(remarkGfm);
1639
+ var serializer = unified().use(remarkStringify).use(remarkMdx).use(remarkFrontmatter, ["yaml"]).use(remarkMdxFrontmatter).use(remarkGfm);
1638
1640
  function createMdxFormatLoader() {
1639
- const parser = unified().use(remarkParse).use(remarkMdx).use(remarkFrontmatter, ["yaml"]).use(remarkMdxFrontmatter).use(remarkGfm);
1640
- const serializer = unified().use(remarkStringify).use(remarkMdx).use(remarkFrontmatter, ["yaml"]).use(remarkMdxFrontmatter).use(remarkGfm);
1641
1641
  return createLoader({
1642
1642
  async pull(locale, input2) {
1643
1643
  const file = new VFile(input2);
@@ -1646,8 +1646,21 @@ function createMdxFormatLoader() {
1646
1646
  },
1647
1647
  async push(locale, data) {
1648
1648
  const ast = data;
1649
- const file = serializer.stringify(ast);
1650
- return String(file);
1649
+ const content = String(serializer.stringify(ast));
1650
+ return content;
1651
+ }
1652
+ });
1653
+ }
1654
+ function createDoubleSerializationLoader() {
1655
+ return createLoader({
1656
+ async pull(locale, input2) {
1657
+ return input2;
1658
+ },
1659
+ async push(locale, data) {
1660
+ const file = new VFile(data);
1661
+ const ast = parser.parse(file);
1662
+ const finalContent = String(serializer.stringify(ast));
1663
+ return finalContent;
1651
1664
  }
1652
1665
  });
1653
1666
  }
@@ -2092,10 +2105,10 @@ function createXmlLoader() {
2092
2105
  // src/cli/loaders/srt.ts
2093
2106
  import srtParser from "srt-parser-2";
2094
2107
  function createSrtLoader() {
2095
- const parser = new srtParser();
2108
+ const parser2 = new srtParser();
2096
2109
  return createLoader({
2097
2110
  async pull(locale, input2) {
2098
- const parsed = parser.fromSrt(input2) || [];
2111
+ const parsed = parser2.fromSrt(input2) || [];
2099
2112
  const result = {};
2100
2113
  parsed.forEach((entry) => {
2101
2114
  const key = `${entry.id}#${entry.startTime}-${entry.endTime}`;
@@ -2116,7 +2129,7 @@ function createSrtLoader() {
2116
2129
  text
2117
2130
  };
2118
2131
  });
2119
- const srtContent = parser.toSrt(output).trim().replace(/\r?\n/g, "\n");
2132
+ const srtContent = parser2.toSrt(output).trim().replace(/\r?\n/g, "\n");
2120
2133
  return srtContent;
2121
2134
  }
2122
2135
  });
@@ -3075,7 +3088,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3075
3088
  createAndroidLoader(),
3076
3089
  createFlatLoader(),
3077
3090
  createSyncLoader(),
3078
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3091
+ createUnlocalizableLoader(
3092
+ options.isCacheRestore,
3093
+ options.returnUnlocalizedKeys
3094
+ )
3079
3095
  );
3080
3096
  case "csv":
3081
3097
  return composeLoaders(
@@ -3083,7 +3099,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3083
3099
  createCsvLoader(),
3084
3100
  createFlatLoader(),
3085
3101
  createSyncLoader(),
3086
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3102
+ createUnlocalizableLoader(
3103
+ options.isCacheRestore,
3104
+ options.returnUnlocalizedKeys
3105
+ )
3087
3106
  );
3088
3107
  case "html":
3089
3108
  return composeLoaders(
@@ -3091,7 +3110,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3091
3110
  createPrettierLoader({ parser: "html", bucketPathPattern }),
3092
3111
  createHtmlLoader(),
3093
3112
  createSyncLoader(),
3094
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3113
+ createUnlocalizableLoader(
3114
+ options.isCacheRestore,
3115
+ options.returnUnlocalizedKeys
3116
+ )
3095
3117
  );
3096
3118
  case "json":
3097
3119
  return composeLoaders(
@@ -3102,7 +3124,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3102
3124
  createFlatLoader(),
3103
3125
  createLockedKeysLoader(lockedKeys || [], options.isCacheRestore),
3104
3126
  createSyncLoader(),
3105
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3127
+ createUnlocalizableLoader(
3128
+ options.isCacheRestore,
3129
+ options.returnUnlocalizedKeys
3130
+ )
3106
3131
  );
3107
3132
  case "markdown":
3108
3133
  return composeLoaders(
@@ -3110,7 +3135,24 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3110
3135
  createPrettierLoader({ parser: "markdown", bucketPathPattern }),
3111
3136
  createMarkdownLoader(),
3112
3137
  createSyncLoader(),
3113
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3138
+ createUnlocalizableLoader(
3139
+ options.isCacheRestore,
3140
+ options.returnUnlocalizedKeys
3141
+ )
3142
+ );
3143
+ case "mdx":
3144
+ return composeLoaders(
3145
+ createTextFileLoader(bucketPathPattern),
3146
+ createDoubleSerializationLoader(),
3147
+ createPrettierLoader({ parser: "mdx", bucketPathPattern }),
3148
+ createMdxFormatLoader(),
3149
+ createFlatLoader(),
3150
+ createMdxStructureLoader(),
3151
+ createSyncLoader(),
3152
+ createUnlocalizableLoader(
3153
+ options.isCacheRestore,
3154
+ options.returnUnlocalizedKeys
3155
+ )
3114
3156
  );
3115
3157
  case "mdx":
3116
3158
  return composeLoaders(
@@ -3129,21 +3171,30 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3129
3171
  createFlatLoader(),
3130
3172
  createSyncLoader(),
3131
3173
  createVariableLoader({ type: "python" }),
3132
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3174
+ createUnlocalizableLoader(
3175
+ options.isCacheRestore,
3176
+ options.returnUnlocalizedKeys
3177
+ )
3133
3178
  );
3134
3179
  case "properties":
3135
3180
  return composeLoaders(
3136
3181
  createTextFileLoader(bucketPathPattern),
3137
3182
  createPropertiesLoader(),
3138
3183
  createSyncLoader(),
3139
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3184
+ createUnlocalizableLoader(
3185
+ options.isCacheRestore,
3186
+ options.returnUnlocalizedKeys
3187
+ )
3140
3188
  );
3141
3189
  case "xcode-strings":
3142
3190
  return composeLoaders(
3143
3191
  createTextFileLoader(bucketPathPattern),
3144
3192
  createXcodeStringsLoader(),
3145
3193
  createSyncLoader(),
3146
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3194
+ createUnlocalizableLoader(
3195
+ options.isCacheRestore,
3196
+ options.returnUnlocalizedKeys
3197
+ )
3147
3198
  );
3148
3199
  case "xcode-stringsdict":
3149
3200
  return composeLoaders(
@@ -3151,7 +3202,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3151
3202
  createXcodeStringsdictLoader(),
3152
3203
  createFlatLoader(),
3153
3204
  createSyncLoader(),
3154
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3205
+ createUnlocalizableLoader(
3206
+ options.isCacheRestore,
3207
+ options.returnUnlocalizedKeys
3208
+ )
3155
3209
  );
3156
3210
  case "xcode-xcstrings":
3157
3211
  return composeLoaders(
@@ -3162,7 +3216,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3162
3216
  createFlatLoader(),
3163
3217
  createSyncLoader(),
3164
3218
  createVariableLoader({ type: "ieee" }),
3165
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3219
+ createUnlocalizableLoader(
3220
+ options.isCacheRestore,
3221
+ options.returnUnlocalizedKeys
3222
+ )
3166
3223
  );
3167
3224
  case "yaml":
3168
3225
  return composeLoaders(
@@ -3172,7 +3229,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3172
3229
  createFlatLoader(),
3173
3230
  createLockedKeysLoader(lockedKeys || [], options.isCacheRestore),
3174
3231
  createSyncLoader(),
3175
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3232
+ createUnlocalizableLoader(
3233
+ options.isCacheRestore,
3234
+ options.returnUnlocalizedKeys
3235
+ )
3176
3236
  );
3177
3237
  case "yaml-root-key":
3178
3238
  return composeLoaders(
@@ -3182,7 +3242,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3182
3242
  createRootKeyLoader(true),
3183
3243
  createFlatLoader(),
3184
3244
  createSyncLoader(),
3185
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3245
+ createUnlocalizableLoader(
3246
+ options.isCacheRestore,
3247
+ options.returnUnlocalizedKeys
3248
+ )
3186
3249
  );
3187
3250
  case "flutter":
3188
3251
  return composeLoaders(
@@ -3192,7 +3255,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3192
3255
  createFlutterLoader(),
3193
3256
  createFlatLoader(),
3194
3257
  createSyncLoader(),
3195
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3258
+ createUnlocalizableLoader(
3259
+ options.isCacheRestore,
3260
+ options.returnUnlocalizedKeys
3261
+ )
3196
3262
  );
3197
3263
  case "xliff":
3198
3264
  return composeLoaders(
@@ -3200,7 +3266,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3200
3266
  createXliffLoader(),
3201
3267
  createFlatLoader(),
3202
3268
  createSyncLoader(),
3203
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3269
+ createUnlocalizableLoader(
3270
+ options.isCacheRestore,
3271
+ options.returnUnlocalizedKeys
3272
+ )
3204
3273
  );
3205
3274
  case "xml":
3206
3275
  return composeLoaders(
@@ -3208,28 +3277,40 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3208
3277
  createXmlLoader(),
3209
3278
  createFlatLoader(),
3210
3279
  createSyncLoader(),
3211
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3280
+ createUnlocalizableLoader(
3281
+ options.isCacheRestore,
3282
+ options.returnUnlocalizedKeys
3283
+ )
3212
3284
  );
3213
3285
  case "srt":
3214
3286
  return composeLoaders(
3215
3287
  createTextFileLoader(bucketPathPattern),
3216
3288
  createSrtLoader(),
3217
3289
  createSyncLoader(),
3218
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3290
+ createUnlocalizableLoader(
3291
+ options.isCacheRestore,
3292
+ options.returnUnlocalizedKeys
3293
+ )
3219
3294
  );
3220
3295
  case "dato":
3221
3296
  return composeLoaders(
3222
3297
  createDatoLoader(bucketPathPattern),
3223
3298
  createSyncLoader(),
3224
3299
  createFlatLoader(),
3225
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3300
+ createUnlocalizableLoader(
3301
+ options.isCacheRestore,
3302
+ options.returnUnlocalizedKeys
3303
+ )
3226
3304
  );
3227
3305
  case "vtt":
3228
3306
  return composeLoaders(
3229
3307
  createTextFileLoader(bucketPathPattern),
3230
3308
  createVttLoader(),
3231
3309
  createSyncLoader(),
3232
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3310
+ createUnlocalizableLoader(
3311
+ options.isCacheRestore,
3312
+ options.returnUnlocalizedKeys
3313
+ )
3233
3314
  );
3234
3315
  case "php":
3235
3316
  return composeLoaders(
@@ -3237,7 +3318,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3237
3318
  createPhpLoader(),
3238
3319
  createSyncLoader(),
3239
3320
  createFlatLoader(),
3240
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3321
+ createUnlocalizableLoader(
3322
+ options.isCacheRestore,
3323
+ options.returnUnlocalizedKeys
3324
+ )
3241
3325
  );
3242
3326
  case "vue-json":
3243
3327
  return composeLoaders(
@@ -3245,7 +3329,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3245
3329
  createVueJsonLoader(),
3246
3330
  createSyncLoader(),
3247
3331
  createFlatLoader(),
3248
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3332
+ createUnlocalizableLoader(
3333
+ options.isCacheRestore,
3334
+ options.returnUnlocalizedKeys
3335
+ )
3249
3336
  );
3250
3337
  }
3251
3338
  }
@@ -5027,7 +5114,7 @@ var ci_default = new Command10().command("ci").description("Run Lingo.dev CI/CD
5027
5114
  // package.json
5028
5115
  var package_default = {
5029
5116
  name: "lingo.dev",
5030
- version: "0.83.0",
5117
+ version: "0.84.0",
5031
5118
  description: "Lingo.dev CLI",
5032
5119
  private: false,
5033
5120
  publishConfig: {