lingo.dev 0.73.0 → 0.74.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
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ReplexicaEngine
3
- } from "./chunk-NUMPOGXY.mjs";
3
+ } from "./chunk-D7CRCYTW.mjs";
4
4
  import {
5
5
  bucketTypeSchema,
6
6
  bucketTypes,
@@ -10,7 +10,7 @@ import {
10
10
  parseI18nConfig,
11
11
  resolveLocaleCode,
12
12
  resolveOverridenLocale
13
- } from "./chunk-NF6GBJ2R.mjs";
13
+ } from "./chunk-B6KMMXCA.mjs";
14
14
 
15
15
  // src/cli/index.ts
16
16
  import dotenv from "dotenv";
@@ -1298,17 +1298,23 @@ import _8 from "lodash";
1298
1298
  import _isUrl from "is-url";
1299
1299
  import { isValid, parseISO } from "date-fns";
1300
1300
  function createUnlocalizableLoader() {
1301
+ const rules = {
1302
+ isEmpty: (v) => _8.isEmpty(v),
1303
+ isNumber: (v) => !_8.isNaN(_8.toNumber(v)),
1304
+ isBoolean: (v) => _8.isBoolean(v),
1305
+ isIsoDate: (v) => _8.isString(v) && _isIsoDate(v),
1306
+ isSystemId: (v) => _8.isString(v) && _isSystemId(v),
1307
+ isUrl: (v) => _8.isString(v) && _isUrl(v)
1308
+ };
1301
1309
  return createLoader({
1302
1310
  async pull(locale, input) {
1303
1311
  const passthroughKeys = Object.entries(input).filter(([key, value]) => {
1304
- return [
1305
- (v) => _8.isEmpty(v),
1306
- (v) => _8.isString(v) && _isIsoDate(v),
1307
- (v) => !_8.isNaN(_8.toNumber(v)),
1308
- (v) => _8.isBoolean(v),
1309
- (v) => _8.isString(v) && _isSystemId(v),
1310
- (v) => _8.isString(v) && _isUrl(v)
1311
- ].some((fn) => fn(value));
1312
+ for (const [ruleName, rule] of Object.entries(rules)) {
1313
+ if (rule(value)) {
1314
+ return true;
1315
+ }
1316
+ }
1317
+ return false;
1312
1318
  }).map(([key, _19]) => key);
1313
1319
  const result = _8.omitBy(input, (_19, key) => passthroughKeys.includes(key));
1314
1320
  return result;
@@ -2257,7 +2263,14 @@ ${currentIndent}]`;
2257
2263
 
2258
2264
  ${currentIndent}}`;
2259
2265
  }
2260
- const items = keys.map((key) => {
2266
+ const sortedKeys = keys.sort((a, b) => {
2267
+ const aIsWhitespace = /^\s*$/.test(a);
2268
+ const bIsWhitespace = /^\s*$/.test(b);
2269
+ if (aIsWhitespace && !bIsWhitespace) return -1;
2270
+ if (!aIsWhitespace && bIsWhitespace) return 1;
2271
+ return a.localeCompare(b, void 0, { numeric: false });
2272
+ });
2273
+ const items = sortedKeys.map((key) => {
2261
2274
  const value = data[key];
2262
2275
  return `${nextIndent}${JSON.stringify(key)} : ${format(value, level + 1)}`;
2263
2276
  });
@@ -2265,7 +2278,8 @@ ${currentIndent}}`;
2265
2278
  ${items.join(",\n")}
2266
2279
  ${currentIndent}}`;
2267
2280
  }
2268
- return format(jsonData);
2281
+ const result = format(jsonData);
2282
+ return result;
2269
2283
  }
2270
2284
  function detectIndentation(jsonStr) {
2271
2285
  const match = jsonStr.match(/\n(\s+)/);
@@ -2281,7 +2295,6 @@ function createPlutilJsonTextLoader() {
2281
2295
  async push(locale, data, originalInput) {
2282
2296
  const jsonData = JSON.parse(data);
2283
2297
  const result = formatPlutilStyle(jsonData, originalInput || "");
2284
- console.log(result[result.length - 1]);
2285
2298
  return result;
2286
2299
  }
2287
2300
  });
@@ -2305,30 +2318,6 @@ function createNewLineLoader() {
2305
2318
  });
2306
2319
  }
2307
2320
 
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
-
2332
2321
  // src/cli/loaders/index.ts
2333
2322
  function createBucketLoader(bucketType, bucketPathPattern) {
2334
2323
  switch (bucketType) {
@@ -2421,7 +2410,6 @@ function createBucketLoader(bucketType, bucketPathPattern) {
2421
2410
  createNewLineLoader(),
2422
2411
  createPlutilJsonTextLoader(),
2423
2412
  createJsonLoader(),
2424
- createJsonSortingLoader(),
2425
2413
  createXcodeXcstringsLoader(),
2426
2414
  createFlatLoader(),
2427
2415
  createSyncLoader(),
@@ -3192,7 +3180,7 @@ function displaySummary(results) {
3192
3180
  // package.json
3193
3181
  var package_default = {
3194
3182
  name: "lingo.dev",
3195
- version: "0.73.0",
3183
+ version: "0.74.0",
3196
3184
  description: "Lingo.dev CLI",
3197
3185
  private: false,
3198
3186
  type: "module",
@@ -3252,7 +3240,7 @@ var package_default = {
3252
3240
  "gradient-string": "^3.0.0",
3253
3241
  "gray-matter": "^4.0.3",
3254
3242
  ini: "^5.0.0",
3255
- inquirer: "^12.3.0",
3243
+ inquirer: "^12.3.2",
3256
3244
  "interactive-commander": "^0.5.194",
3257
3245
  "is-url": "^1.2.4",
3258
3246
  jsdom: "^25.0.1",
@@ -3261,7 +3249,7 @@ var package_default = {
3261
3249
  lodash: "^4.17.21",
3262
3250
  "markdown-it": "^14.1.0",
3263
3251
  "markdown-it-front-matter": "^0.2.4",
3264
- marked: "^15.0.4",
3252
+ marked: "^15.0.6",
3265
3253
  "node-webvtt": "^1.9.4",
3266
3254
  "object-hash": "^3.0.0",
3267
3255
  open: "^10.1.0",
@@ -3278,14 +3266,14 @@ var package_default = {
3278
3266
  xml2js: "^0.6.2",
3279
3267
  xmldom: "^0.6.0",
3280
3268
  xpath: "^0.0.34",
3281
- yaml: "^2.6.1",
3269
+ yaml: "^2.7.0",
3282
3270
  zod: "^3.24.1"
3283
3271
  },
3284
3272
  devDependencies: {
3285
3273
  "@lingo.dev/sdk": "workspace:*",
3286
3274
  "@lingo.dev/spec": "workspace:*",
3287
3275
  "@types/cors": "^2.8.17",
3288
- "@types/diff": "^6.0.0",
3276
+ "@types/diff": "^7.0.0",
3289
3277
  "@types/express": "^5.0.0",
3290
3278
  "@types/figlet": "^1.7.0",
3291
3279
  "@types/gettext-parser": "^4.0.4",