lingo.dev 0.72.0 → 0.73.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
@@ -2305,6 +2305,30 @@ function createNewLineLoader() {
2305
2305
  });
2306
2306
  }
2307
2307
 
2308
+ // src/cli/loaders/json-sorting.ts
2309
+ function createJsonSortingLoader() {
2310
+ return createLoader({
2311
+ async pull(locale, input) {
2312
+ return input;
2313
+ },
2314
+ async push(locale, data, originalInput) {
2315
+ return sortObjectDeep(data);
2316
+ }
2317
+ });
2318
+ }
2319
+ function sortObjectDeep(obj) {
2320
+ if (Array.isArray(obj)) {
2321
+ return obj.map(sortObjectDeep);
2322
+ }
2323
+ if (obj !== null && typeof obj === "object") {
2324
+ return Object.keys(obj).sort().reduce((result, key) => {
2325
+ result[key] = sortObjectDeep(obj[key]);
2326
+ return result;
2327
+ }, {});
2328
+ }
2329
+ return obj;
2330
+ }
2331
+
2308
2332
  // src/cli/loaders/index.ts
2309
2333
  function createBucketLoader(bucketType, bucketPathPattern) {
2310
2334
  switch (bucketType) {
@@ -2397,6 +2421,7 @@ function createBucketLoader(bucketType, bucketPathPattern) {
2397
2421
  createNewLineLoader(),
2398
2422
  createPlutilJsonTextLoader(),
2399
2423
  createJsonLoader(),
2424
+ createJsonSortingLoader(),
2400
2425
  createXcodeXcstringsLoader(),
2401
2426
  createFlatLoader(),
2402
2427
  createSyncLoader(),
@@ -3167,7 +3192,7 @@ function displaySummary(results) {
3167
3192
  // package.json
3168
3193
  var package_default = {
3169
3194
  name: "lingo.dev",
3170
- version: "0.72.0",
3195
+ version: "0.73.0",
3171
3196
  description: "Lingo.dev CLI",
3172
3197
  private: false,
3173
3198
  type: "module",