lingo.dev 0.103.0 → 0.104.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.cjs CHANGED
@@ -6500,127 +6500,6 @@ async function setup(input2) {
6500
6500
 
6501
6501
 
6502
6502
 
6503
- async function plan(input2) {
6504
- console.log(_chalk2.default.hex(colors.orange)("[Planning]"));
6505
- let buckets = getBuckets(input2.config);
6506
- if (input2.flags.bucket) {
6507
- buckets = buckets.filter((b) => input2.flags.bucket.includes(b.type));
6508
- }
6509
- const _sourceLocale = input2.flags.sourceLocale || input2.config.locale.source;
6510
- if (!_sourceLocale) {
6511
- throw new Error(
6512
- `No source locale provided. Use --source-locale to specify the source locale or add it to i18n.json (locale.source)`
6513
- );
6514
- }
6515
- const _targetLocales = input2.flags.targetLocale || input2.config.locale.targets;
6516
- if (!_targetLocales.length) {
6517
- throw new Error(
6518
- `No target locales provided. Use --target-locale to specify the target locales or add them to i18n.json (locale.targets)`
6519
- );
6520
- }
6521
- return new (0, _listr2.Listr)(
6522
- [
6523
- {
6524
- title: "Locating content buckets",
6525
- task: async (ctx, task) => {
6526
- const bucketCount = buckets.length;
6527
- const bucketFilter = input2.flags.bucket ? ` ${_chalk2.default.dim(
6528
- `(filtered by: ${_chalk2.default.hex(colors.yellow)(
6529
- input2.flags.bucket.join(", ")
6530
- )})`
6531
- )}` : "";
6532
- task.title = `Found ${_chalk2.default.hex(colors.yellow)(
6533
- bucketCount.toString()
6534
- )} bucket(s)${bucketFilter}`;
6535
- }
6536
- },
6537
- {
6538
- title: "Detecting locales",
6539
- task: async (ctx, task) => {
6540
- task.title = `Found ${_chalk2.default.hex(colors.yellow)(
6541
- _targetLocales.length.toString()
6542
- )} target locale(s)`;
6543
- }
6544
- },
6545
- {
6546
- title: "Locating localizable files",
6547
- task: async (ctx, task) => {
6548
- const patterns = [];
6549
- for (const bucket of buckets) {
6550
- for (const bucketPath of bucket.paths) {
6551
- if (input2.flags.file) {
6552
- if (!input2.flags.file.some(
6553
- (f) => bucketPath.pathPattern.includes(f)
6554
- )) {
6555
- continue;
6556
- }
6557
- }
6558
- patterns.push(bucketPath.pathPattern);
6559
- }
6560
- }
6561
- const fileFilter = input2.flags.file ? ` ${_chalk2.default.dim(
6562
- `(filtered by: ${_chalk2.default.hex(colors.yellow)(
6563
- input2.flags.file.join(", ")
6564
- )})`
6565
- )}` : "";
6566
- task.title = `Found ${_chalk2.default.hex(colors.yellow)(
6567
- patterns.length.toString()
6568
- )} path pattern(s)${fileFilter}`;
6569
- }
6570
- },
6571
- {
6572
- title: "Computing translation tasks",
6573
- task: async (ctx, task) => {
6574
- for (const bucket of buckets) {
6575
- for (const bucketPath of bucket.paths) {
6576
- if (input2.flags.file) {
6577
- if (!input2.flags.file.some(
6578
- (f) => bucketPath.pathPattern.includes(f)
6579
- )) {
6580
- continue;
6581
- }
6582
- }
6583
- const sourceLocale = __spec.resolveOverriddenLocale.call(void 0,
6584
- _sourceLocale,
6585
- bucketPath.delimiter
6586
- );
6587
- for (const _targetLocale of _targetLocales) {
6588
- const targetLocale = __spec.resolveOverriddenLocale.call(void 0,
6589
- _targetLocale,
6590
- bucketPath.delimiter
6591
- );
6592
- if (sourceLocale === targetLocale) continue;
6593
- ctx.tasks.push({
6594
- sourceLocale,
6595
- targetLocale,
6596
- bucketType: bucket.type,
6597
- bucketPathPattern: bucketPath.pathPattern,
6598
- injectLocale: bucket.injectLocale || [],
6599
- lockedKeys: bucket.lockedKeys || [],
6600
- lockedPatterns: bucket.lockedPatterns || [],
6601
- onlyKeys: input2.flags.key || []
6602
- });
6603
- }
6604
- }
6605
- }
6606
- task.title = `Prepared ${_chalk2.default.hex(colors.green)(
6607
- ctx.tasks.length.toString()
6608
- )} translation task(s)`;
6609
- }
6610
- }
6611
- ],
6612
- {
6613
- rendererOptions: commonTaskRendererOptions
6614
- }
6615
- ).run(input2);
6616
- }
6617
-
6618
- // src/cli/cmd/run/execute.ts
6619
-
6620
-
6621
- var _plimit = require('p-limit'); var _plimit2 = _interopRequireDefault(_plimit);
6622
-
6623
-
6624
6503
  // ../../node_modules/.pnpm/@isaacs+balanced-match@4.0.1/node_modules/@isaacs/balanced-match/dist/esm/index.js
6625
6504
  var balanced = (a, b, str) => {
6626
6505
  const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
@@ -8159,7 +8038,128 @@ minimatch.Minimatch = Minimatch;
8159
8038
  minimatch.escape = escape;
8160
8039
  minimatch.unescape = unescape;
8161
8040
 
8041
+ // src/cli/cmd/run/plan.ts
8042
+
8043
+ async function plan(input2) {
8044
+ console.log(_chalk2.default.hex(colors.orange)("[Planning]"));
8045
+ let buckets = getBuckets(input2.config);
8046
+ if (input2.flags.bucket) {
8047
+ buckets = buckets.filter((b) => input2.flags.bucket.includes(b.type));
8048
+ }
8049
+ const _sourceLocale = input2.flags.sourceLocale || input2.config.locale.source;
8050
+ if (!_sourceLocale) {
8051
+ throw new Error(
8052
+ `No source locale provided. Use --source-locale to specify the source locale or add it to i18n.json (locale.source)`
8053
+ );
8054
+ }
8055
+ const _targetLocales = input2.flags.targetLocale || input2.config.locale.targets;
8056
+ if (!_targetLocales.length) {
8057
+ throw new Error(
8058
+ `No target locales provided. Use --target-locale to specify the target locales or add them to i18n.json (locale.targets)`
8059
+ );
8060
+ }
8061
+ return new (0, _listr2.Listr)(
8062
+ [
8063
+ {
8064
+ title: "Locating content buckets",
8065
+ task: async (ctx, task) => {
8066
+ const bucketCount = buckets.length;
8067
+ const bucketFilter = input2.flags.bucket ? ` ${_chalk2.default.dim(
8068
+ `(filtered by: ${_chalk2.default.hex(colors.yellow)(
8069
+ input2.flags.bucket.join(", ")
8070
+ )})`
8071
+ )}` : "";
8072
+ task.title = `Found ${_chalk2.default.hex(colors.yellow)(
8073
+ bucketCount.toString()
8074
+ )} bucket(s)${bucketFilter}`;
8075
+ }
8076
+ },
8077
+ {
8078
+ title: "Detecting locales",
8079
+ task: async (ctx, task) => {
8080
+ task.title = `Found ${_chalk2.default.hex(colors.yellow)(
8081
+ _targetLocales.length.toString()
8082
+ )} target locale(s)`;
8083
+ }
8084
+ },
8085
+ {
8086
+ title: "Locating localizable files",
8087
+ task: async (ctx, task) => {
8088
+ const patterns = [];
8089
+ for (const bucket of buckets) {
8090
+ for (const bucketPath of bucket.paths) {
8091
+ if (input2.flags.file) {
8092
+ if (!input2.flags.file.some(
8093
+ (f) => bucketPath.pathPattern.includes(f) || minimatch(bucketPath.pathPattern, f)
8094
+ )) {
8095
+ continue;
8096
+ }
8097
+ }
8098
+ patterns.push(bucketPath.pathPattern);
8099
+ }
8100
+ }
8101
+ const fileFilter = input2.flags.file ? ` ${_chalk2.default.dim(
8102
+ `(filtered by: ${_chalk2.default.hex(colors.yellow)(
8103
+ input2.flags.file.join(", ")
8104
+ )})`
8105
+ )}` : "";
8106
+ task.title = `Found ${_chalk2.default.hex(colors.yellow)(
8107
+ patterns.length.toString()
8108
+ )} path pattern(s)${fileFilter}`;
8109
+ }
8110
+ },
8111
+ {
8112
+ title: "Computing translation tasks",
8113
+ task: async (ctx, task) => {
8114
+ for (const bucket of buckets) {
8115
+ for (const bucketPath of bucket.paths) {
8116
+ if (input2.flags.file) {
8117
+ if (!input2.flags.file.some(
8118
+ (f) => bucketPath.pathPattern.includes(f) || minimatch(bucketPath.pathPattern, f)
8119
+ )) {
8120
+ continue;
8121
+ }
8122
+ }
8123
+ const sourceLocale = __spec.resolveOverriddenLocale.call(void 0,
8124
+ _sourceLocale,
8125
+ bucketPath.delimiter
8126
+ );
8127
+ for (const _targetLocale of _targetLocales) {
8128
+ const targetLocale = __spec.resolveOverriddenLocale.call(void 0,
8129
+ _targetLocale,
8130
+ bucketPath.delimiter
8131
+ );
8132
+ if (sourceLocale === targetLocale) continue;
8133
+ ctx.tasks.push({
8134
+ sourceLocale,
8135
+ targetLocale,
8136
+ bucketType: bucket.type,
8137
+ bucketPathPattern: bucketPath.pathPattern,
8138
+ injectLocale: bucket.injectLocale || [],
8139
+ lockedKeys: bucket.lockedKeys || [],
8140
+ lockedPatterns: bucket.lockedPatterns || [],
8141
+ onlyKeys: input2.flags.key || []
8142
+ });
8143
+ }
8144
+ }
8145
+ }
8146
+ task.title = `Prepared ${_chalk2.default.hex(colors.green)(
8147
+ ctx.tasks.length.toString()
8148
+ )} translation task(s)`;
8149
+ }
8150
+ }
8151
+ ],
8152
+ {
8153
+ rendererOptions: commonTaskRendererOptions
8154
+ }
8155
+ ).run(input2);
8156
+ }
8157
+
8162
8158
  // src/cli/cmd/run/execute.ts
8159
+
8160
+
8161
+ var _plimit = require('p-limit'); var _plimit2 = _interopRequireDefault(_plimit);
8162
+
8163
8163
  var MAX_WORKER_COUNT = 10;
8164
8164
  async function execute(input2) {
8165
8165
  const effectiveConcurrency = Math.min(
@@ -8456,7 +8456,9 @@ async function getWatchPatterns(ctx) {
8456
8456
  }
8457
8457
  for (const bucketPath of bucket.paths) {
8458
8458
  if (ctx.flags.file) {
8459
- if (!ctx.flags.file.some((f) => bucketPath.pathPattern.includes(f))) {
8459
+ if (!ctx.flags.file.some(
8460
+ (f) => bucketPath.pathPattern.includes(f) || minimatch(bucketPath.pathPattern, f)
8461
+ )) {
8460
8462
  continue;
8461
8463
  }
8462
8464
  }
@@ -8571,7 +8573,7 @@ var run_default = new (0, _interactivecommander.Command)().command("run").descri
8571
8573
  (val, prev) => prev ? [...prev, val] : [val]
8572
8574
  ).option(
8573
8575
  "--file <file>",
8574
- "File to process. Process only files that include this string in their path. Useful if you have a lot of files and want to focus on a specific one. Specify more files separated by commas or spaces.",
8576
+ "File to process. Process only files that match this glob pattern in their path. Use quotes around patterns to prevent shell expansion (e.g., --file '**/*.json'). Useful if you have a lot of files and want to focus on a specific one. Specify more files separated by commas or spaces. Accepts glob patterns.",
8575
8577
  (val, prev) => prev ? [...prev, val] : [val]
8576
8578
  ).option(
8577
8579
  "--key <key>",
@@ -9382,7 +9384,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
9382
9384
  (val, prev) => prev ? [...prev, val] : [val]
9383
9385
  ).option(
9384
9386
  "--file [files...]",
9385
- "File to process. Process only a specific path, may contain asterisk * to match multiple files."
9387
+ "File to process. Process only files that include this string in their path. Useful if you have a lot of files and want to focus on a specific one. Specify more files separated by commas or spaces."
9386
9388
  ).option(
9387
9389
  "--force",
9388
9390
  "Ignore lockfile and process all keys, useful for estimating full re-translation"
@@ -9429,7 +9431,9 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
9429
9431
  if (_optionalChain([flags, 'access', _262 => _262.file, 'optionalAccess', _263 => _263.length])) {
9430
9432
  buckets = buckets.map((bucket) => {
9431
9433
  const paths = bucket.paths.filter(
9432
- (path17) => flags.file.find((file) => _optionalChain([path17, 'access', _264 => _264.pathPattern, 'optionalAccess', _265 => _265.match, 'call', _266 => _266(file)]))
9434
+ (path17) => flags.file.find(
9435
+ (file) => _optionalChain([path17, 'access', _264 => _264.pathPattern, 'optionalAccess', _265 => _265.includes, 'call', _266 => _266(file)]) || _optionalChain([path17, 'access', _267 => _267.pathPattern, 'optionalAccess', _268 => _268.match, 'call', _269 => _269(file)]) || minimatch(path17.pathPattern, file)
9436
+ )
9433
9437
  );
9434
9438
  return { ...bucket, paths };
9435
9439
  }).filter((bucket) => bucket.paths.length > 0);
@@ -9448,7 +9452,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
9448
9452
  });
9449
9453
  }
9450
9454
  }
9451
- const targetLocales = _optionalChain([flags, 'access', _267 => _267.locale, 'optionalAccess', _268 => _268.length]) ? flags.locale : i18nConfig.locale.targets;
9455
+ const targetLocales = _optionalChain([flags, 'access', _270 => _270.locale, 'optionalAccess', _271 => _271.length]) ? flags.locale : i18nConfig.locale.targets;
9452
9456
  let totalSourceKeyCount = 0;
9453
9457
  let uniqueKeysToTranslate = 0;
9454
9458
  let totalExistingTranslations = 0;
@@ -9852,12 +9856,12 @@ function validateParams2(i18nConfig, flags) {
9852
9856
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
9853
9857
  docUrl: "bucketNotFound"
9854
9858
  });
9855
- } else if (_optionalChain([flags, 'access', _269 => _269.locale, 'optionalAccess', _270 => _270.some, 'call', _271 => _271((locale) => !i18nConfig.locale.targets.includes(locale))])) {
9859
+ } else if (_optionalChain([flags, 'access', _272 => _272.locale, 'optionalAccess', _273 => _273.some, 'call', _274 => _274((locale) => !i18nConfig.locale.targets.includes(locale))])) {
9856
9860
  throw new CLIError({
9857
9861
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
9858
9862
  docUrl: "localeTargetNotFound"
9859
9863
  });
9860
- } else if (_optionalChain([flags, 'access', _272 => _272.bucket, 'optionalAccess', _273 => _273.some, 'call', _274 => _274(
9864
+ } else if (_optionalChain([flags, 'access', _275 => _275.bucket, 'optionalAccess', _276 => _276.some, 'call', _277 => _277(
9861
9865
  (bucket) => !i18nConfig.buckets[bucket]
9862
9866
  )])) {
9863
9867
  throw new CLIError({
@@ -9946,7 +9950,7 @@ async function renderHero2() {
9946
9950
  // package.json
9947
9951
  var package_default = {
9948
9952
  name: "lingo.dev",
9949
- version: "0.103.0",
9953
+ version: "0.104.0",
9950
9954
  description: "Lingo.dev CLI",
9951
9955
  private: false,
9952
9956
  publishConfig: {
@@ -10221,7 +10225,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
10221
10225
  if (options.file && options.file.length) {
10222
10226
  buckets = buckets.map((bucket) => {
10223
10227
  const paths = bucket.paths.filter(
10224
- (bucketPath) => _optionalChain([options, 'access', _275 => _275.file, 'optionalAccess', _276 => _276.some, 'call', _277 => _277((f) => bucketPath.pathPattern.includes(f))])
10228
+ (bucketPath) => _optionalChain([options, 'access', _278 => _278.file, 'optionalAccess', _279 => _279.some, 'call', _280 => _280((f) => bucketPath.pathPattern.includes(f))])
10225
10229
  );
10226
10230
  return { ...bucket, paths };
10227
10231
  }).filter((bucket) => bucket.paths.length > 0);