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.mjs CHANGED
@@ -6499,127 +6499,6 @@ async function setup(input2) {
6499
6499
  // src/cli/cmd/run/plan.ts
6500
6500
  import chalk11 from "chalk";
6501
6501
  import { Listr as Listr2 } from "listr2";
6502
- import { resolveOverriddenLocale as resolveOverriddenLocale6 } from "@lingo.dev/_spec";
6503
- async function plan(input2) {
6504
- console.log(chalk11.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 Listr2(
6522
- [
6523
- {
6524
- title: "Locating content buckets",
6525
- task: async (ctx, task) => {
6526
- const bucketCount = buckets.length;
6527
- const bucketFilter = input2.flags.bucket ? ` ${chalk11.dim(
6528
- `(filtered by: ${chalk11.hex(colors.yellow)(
6529
- input2.flags.bucket.join(", ")
6530
- )})`
6531
- )}` : "";
6532
- task.title = `Found ${chalk11.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 ${chalk11.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 ? ` ${chalk11.dim(
6562
- `(filtered by: ${chalk11.hex(colors.yellow)(
6563
- input2.flags.file.join(", ")
6564
- )})`
6565
- )}` : "";
6566
- task.title = `Found ${chalk11.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 = resolveOverriddenLocale6(
6584
- _sourceLocale,
6585
- bucketPath.delimiter
6586
- );
6587
- for (const _targetLocale of _targetLocales) {
6588
- const targetLocale = resolveOverriddenLocale6(
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 ${chalk11.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
- import chalk12 from "chalk";
6620
- import { Listr as Listr3 } from "listr2";
6621
- import pLimit from "p-limit";
6622
- import _33 from "lodash";
6623
6502
 
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) => {
@@ -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
+ import { resolveOverriddenLocale as resolveOverriddenLocale6 } from "@lingo.dev/_spec";
8043
+ async function plan(input2) {
8044
+ console.log(chalk11.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 Listr2(
8062
+ [
8063
+ {
8064
+ title: "Locating content buckets",
8065
+ task: async (ctx, task) => {
8066
+ const bucketCount = buckets.length;
8067
+ const bucketFilter = input2.flags.bucket ? ` ${chalk11.dim(
8068
+ `(filtered by: ${chalk11.hex(colors.yellow)(
8069
+ input2.flags.bucket.join(", ")
8070
+ )})`
8071
+ )}` : "";
8072
+ task.title = `Found ${chalk11.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 ${chalk11.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 ? ` ${chalk11.dim(
8102
+ `(filtered by: ${chalk11.hex(colors.yellow)(
8103
+ input2.flags.file.join(", ")
8104
+ )})`
8105
+ )}` : "";
8106
+ task.title = `Found ${chalk11.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 = resolveOverriddenLocale6(
8124
+ _sourceLocale,
8125
+ bucketPath.delimiter
8126
+ );
8127
+ for (const _targetLocale of _targetLocales) {
8128
+ const targetLocale = resolveOverriddenLocale6(
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 ${chalk11.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
+ import chalk12 from "chalk";
8160
+ import { Listr as Listr3 } from "listr2";
8161
+ import pLimit from "p-limit";
8162
+ import _33 from "lodash";
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 Command16().command("run").description("Run Lingo.dev loca
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 Command18().command("status").description("Show the sta
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 Command18().command("status").description("Show the sta
9429
9431
  if (flags.file?.length) {
9430
9432
  buckets = buckets.map((bucket) => {
9431
9433
  const paths = bucket.paths.filter(
9432
- (path17) => flags.file.find((file) => path17.pathPattern?.match(file))
9434
+ (path17) => flags.file.find(
9435
+ (file) => path17.pathPattern?.includes(file) || path17.pathPattern?.match(file) || minimatch(path17.pathPattern, file)
9436
+ )
9433
9437
  );
9434
9438
  return { ...bucket, paths };
9435
9439
  }).filter((bucket) => bucket.paths.length > 0);
@@ -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: {