@lingui/cli 5.3.1 → 5.3.3

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.
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.extractFromFiles = extractFromFiles;
7
- const chalk_1 = __importDefault(require("chalk"));
7
+ const picocolors_1 = __importDefault(require("picocolors"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const extractors_1 = __importDefault(require("../extractors"));
10
10
  const utils_1 = require("../utils");
@@ -42,9 +42,9 @@ async function extractFromFiles(paths, config) {
42
42
  : "";
43
43
  const origin = [filename, next.origin[1]];
44
44
  if (prev.message && next.message && prev.message !== next.message) {
45
- throw new Error(`Encountered different default translations for message ${chalk_1.default.yellow(next.id)}` +
46
- `\n${chalk_1.default.yellow((0, utils_1.prettyOrigin)(prev.origin))} ${prev.message}` +
47
- `\n${chalk_1.default.yellow((0, utils_1.prettyOrigin)([origin]))} ${next.message}`);
45
+ throw new Error(`Encountered different default translations for message ${picocolors_1.default.yellow(next.id)}` +
46
+ `\n${picocolors_1.default.yellow((0, utils_1.prettyOrigin)(prev.origin))} ${prev.message}` +
47
+ `\n${picocolors_1.default.yellow((0, utils_1.prettyOrigin)([origin]))} ${next.message}`);
48
48
  }
49
49
  messages[next.id] = Object.assign(Object.assign({}, prev), { message: (_a = prev.message) !== null && _a !== void 0 ? _a : next.message, comments: next.comment
50
50
  ? [...prev.comments, next.comment]
@@ -155,7 +155,8 @@ class Catalog {
155
155
  return await this.format.read(filename, undefined);
156
156
  }
157
157
  get sourcePaths() {
158
- const includeGlobs = this.include.map((includePath) => {
158
+ const includeGlobs = this.include
159
+ .map((includePath) => {
159
160
  const isDir = (0, utils_1.isDirectory)(includePath);
160
161
  /**
161
162
  * glob library results from absolute patterns such as /foo/* are mounted onto the root setting using path.join.
@@ -164,7 +165,8 @@ class Catalog {
164
165
  return isDir
165
166
  ? (0, normalize_path_1.default)(path_1.default.resolve(process.cwd(), includePath === "/" ? "" : includePath, "**/*.*"))
166
167
  : includePath;
167
- });
168
+ })
169
+ .map(utils_1.makePathRegexSafe);
168
170
  return (0, glob_1.globSync)(includeGlobs, { ignore: this.exclude, mark: true });
169
171
  }
170
172
  get localeDir() {
@@ -5,9 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createMissingErrorMessage = createMissingErrorMessage;
7
7
  exports.createCompilationErrorMessage = createCompilationErrorMessage;
8
- const chalk_1 = __importDefault(require("chalk"));
8
+ const picocolors_1 = __importDefault(require("picocolors"));
9
9
  function createMissingErrorMessage(locale, missingMessages, configurationMsg) {
10
- let message = `Failed to compile catalog for locale ${chalk_1.default.bold(locale)}!
10
+ let message = `Failed to compile catalog for locale ${picocolors_1.default.bold(locale)}!
11
11
 
12
12
  Missing ${missingMessages.length} translation(s):
13
13
  \n`;
@@ -20,7 +20,7 @@ Missing ${missingMessages.length} translation(s):
20
20
  return message;
21
21
  }
22
22
  function createCompilationErrorMessage(locale, errors) {
23
- let message = `Failed to compile catalog for locale ${chalk_1.default.bold(locale)}!
23
+ let message = `Failed to compile catalog for locale ${picocolors_1.default.bold(locale)}!
24
24
 
25
25
  Compilation error for ${errors.length} translation(s):
26
26
  \n`;
package/dist/api/stats.js CHANGED
@@ -8,7 +8,7 @@ exports.printStats = printStats;
8
8
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
9
9
  // @ts-ignore
10
10
  const cli_table_1 = __importDefault(require("cli-table"));
11
- const chalk_1 = __importDefault(require("chalk"));
11
+ const picocolors_1 = __importDefault(require("picocolors"));
12
12
  function getStats(catalog) {
13
13
  return [
14
14
  Object.keys(catalog).length,
@@ -33,7 +33,7 @@ function printStats(config, catalogs) {
33
33
  // was not extracted due to a `--locale` filter
34
34
  const [all, translated] = catalog ? getStats(catalog) : ["-", "-"];
35
35
  if (config.sourceLocale === locale) {
36
- table.push({ [`${chalk_1.default.bold(locale)} (source)`]: [all, "-"] });
36
+ table.push({ [`${picocolors_1.default.bold(locale)} (source)`]: [all, "-"] });
37
37
  }
38
38
  else {
39
39
  table.push({ [locale]: [all, translated] });
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.writeCatalogs = writeCatalogs;
7
7
  exports.writeTemplate = writeTemplate;
8
8
  const resolveTemplatePath_1 = require("./resolveTemplatePath");
9
- const chalk_1 = __importDefault(require("chalk"));
9
+ const picocolors_1 = __importDefault(require("picocolors"));
10
10
  const resolveCatalogPath_1 = require("./resolveCatalogPath");
11
11
  const mergeCatalog_1 = require("../api/catalog/mergeCatalog");
12
12
  const stats_1 = require("../api/stats");
@@ -35,6 +35,6 @@ async function writeTemplate(params) {
35
35
  const catalogOutput = (0, resolveTemplatePath_1.resolveTemplatePath)(entryPoint, outputPattern, linguiConfig.rootDir, format.getTemplateExtension());
36
36
  await format.write(catalogOutput, cleanAndSort(messages, clean, linguiConfig.orderBy), undefined);
37
37
  return {
38
- statMessage: `${chalk_1.default.bold(Object.keys(messages).length)} message(s) extracted`,
38
+ statMessage: `${picocolors_1.default.bold(Object.keys(messages).length)} message(s) extracted`,
39
39
  };
40
40
  }
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.command = command;
7
- const chalk_1 = __importDefault(require("chalk"));
7
+ const picocolors_1 = __importDefault(require("picocolors"));
8
8
  const chokidar_1 = __importDefault(require("chokidar"));
9
9
  const commander_1 = require("commander");
10
10
  const conf_1 = require("@lingui/conf");
@@ -29,9 +29,9 @@ async function command(config, options) {
29
29
  if (!options.allowEmpty &&
30
30
  locale !== config.pseudoLocale &&
31
31
  missingMessages.length > 0) {
32
- console.error(chalk_1.default.red(`Error: Failed to compile catalog for locale ${chalk_1.default.bold(locale)}!`));
32
+ console.error(picocolors_1.default.red(`Error: Failed to compile catalog for locale ${picocolors_1.default.bold(locale)}!`));
33
33
  if (options.verbose) {
34
- console.error(chalk_1.default.red("Missing translations:"));
34
+ console.error(picocolors_1.default.red("Missing translations:"));
35
35
  missingMessages.forEach((missing) => {
36
36
  const source = missing.source || missing.source === missing.id
37
37
  ? `: (${missing.source})`
@@ -40,7 +40,7 @@ async function command(config, options) {
40
40
  });
41
41
  }
42
42
  else {
43
- console.error(chalk_1.default.red(`Missing ${missingMessages.length} translation(s)`));
43
+ console.error(picocolors_1.default.red(`Missing ${missingMessages.length} translation(s)`));
44
44
  }
45
45
  console.error();
46
46
  return false;
@@ -55,7 +55,10 @@ async function command(config, options) {
55
55
  }
56
56
  }
57
57
  if (doMerge) {
58
- return await compileAndWrite(locale, config, options, await (0, getCatalogs_1.getCatalogForMerge)(config), mergedCatalogs);
58
+ const result = await compileAndWrite(locale, config, options, await (0, getCatalogs_1.getCatalogForMerge)(config), mergedCatalogs);
59
+ if (!result) {
60
+ return false;
61
+ }
59
62
  }
60
63
  }
61
64
  return true;
@@ -74,17 +77,17 @@ async function compileAndWrite(locale, config, options, catalogToWrite, messages
74
77
  let message = (0, api_1.createCompilationErrorMessage)(locale, errors);
75
78
  if (options.failOnCompileError) {
76
79
  message += `These errors fail command execution because \`--strict\` option passed`;
77
- console.error(chalk_1.default.red(message));
80
+ console.error(picocolors_1.default.red(message));
78
81
  return false;
79
82
  }
80
83
  else {
81
84
  message += `You can fail command execution on these errors by passing \`--strict\` option`;
82
- console.error(chalk_1.default.red(message));
85
+ console.error(picocolors_1.default.red(message));
83
86
  }
84
87
  }
85
88
  let compiledPath = await catalogToWrite.writeCompiled(locale, compiledCatalog, namespace);
86
89
  compiledPath = (0, normalize_path_1.default)(path_1.default.relative(config.rootDir, compiledPath));
87
- options.verbose && console.error(chalk_1.default.green(`${locale} ⇒ ${compiledPath}`));
90
+ options.verbose && console.error(picocolors_1.default.green(`${locale} ⇒ ${compiledPath}`));
88
91
  return true;
89
92
  }
90
93
  if (require.main === module) {
@@ -132,7 +135,7 @@ if (require.main === module) {
132
135
  };
133
136
  // Check if Watch Mode is enabled
134
137
  if (options.watch) {
135
- console.info(chalk_1.default.bold("Initializing Watch Mode..."));
138
+ console.info(picocolors_1.default.bold("Initializing Watch Mode..."));
136
139
  (async function initWatch() {
137
140
  const format = await (0, api_1.getFormat)(config.format, config.formatOptions, config.sourceLocale);
138
141
  const catalogs = await (0, api_1.getCatalogs)(config);
@@ -148,7 +151,7 @@ if (require.main === module) {
148
151
  persistent: true,
149
152
  });
150
153
  const onReady = () => {
151
- console.info(chalk_1.default.green.bold("Watcher is ready!"));
154
+ console.info(picocolors_1.default.green(picocolors_1.default.bold("Watcher is ready!")));
152
155
  watcher
153
156
  .on("add", () => dispatchCompile())
154
157
  .on("change", () => dispatchCompile());
@@ -15,7 +15,7 @@ const normalize_path_1 = __importDefault(require("normalize-path"));
15
15
  const bundleSource_1 = require("./extract-experimental/bundleSource");
16
16
  const writeCatalogs_1 = require("./extract-experimental/writeCatalogs");
17
17
  const getEntryPoints_1 = require("./extract-experimental/getEntryPoints");
18
- const chalk_1 = __importDefault(require("chalk"));
18
+ const picocolors_1 = __importDefault(require("picocolors"));
19
19
  const babel_1 = require("./api/extractors/babel");
20
20
  async function command(linguiConfig, options) {
21
21
  var _a;
@@ -24,7 +24,7 @@ async function command(linguiConfig, options) {
24
24
  if (!config) {
25
25
  throw new Error("The configuration for experimental extractor is empty. Please read the docs.");
26
26
  }
27
- console.log(chalk_1.default.yellow([
27
+ console.log(picocolors_1.default.yellow([
28
28
  "You have using an experimental feature",
29
29
  "Experimental features are not covered by semver, and may cause unexpected or broken application behavior." +
30
30
  " Use at your own risk.",
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.default = command;
7
- const chalk_1 = __importDefault(require("chalk"));
7
+ const picocolors_1 = __importDefault(require("picocolors"));
8
8
  const commander_1 = require("commander");
9
9
  const conf_1 = require("@lingui/conf");
10
10
  const api_1 = require("./api");
@@ -23,7 +23,7 @@ async function command(config, options) {
23
23
  commandSuccess && (commandSuccess = Boolean(result));
24
24
  }));
25
25
  Object.entries(catalogStats).forEach(([key, value]) => {
26
- console.log(`Catalog statistics for ${chalk_1.default.bold(key)}: ${chalk_1.default.green(value)} messages`);
26
+ console.log(`Catalog statistics for ${picocolors_1.default.bold(key)}: ${picocolors_1.default.green(value)} messages`);
27
27
  console.log();
28
28
  });
29
29
  return commandSuccess;
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.default = command;
7
- const chalk_1 = __importDefault(require("chalk"));
7
+ const picocolors_1 = __importDefault(require("picocolors"));
8
8
  const chokidar_1 = __importDefault(require("chokidar"));
9
9
  const commander_1 = require("commander");
10
10
  const path_1 = __importDefault(require("path"));
@@ -37,8 +37,8 @@ async function command(config, options) {
37
37
  console.log();
38
38
  });
39
39
  if (!options.watch) {
40
- console.log(`(Use "${chalk_1.default.yellow((0, help_1.helpRun)("extract"))}" to update catalogs with new messages.)`);
41
- console.log(`(Use "${chalk_1.default.yellow((0, help_1.helpRun)("compile"))}" to compile catalogs for production. Alternatively, use bundler plugins: https://lingui.dev/ref/cli#compiling-catalogs-in-ci)`);
40
+ console.log(`(Use "${picocolors_1.default.yellow((0, help_1.helpRun)("extract"))}" to update catalogs with new messages.)`);
41
+ console.log(`(Use "${picocolors_1.default.yellow((0, help_1.helpRun)("compile"))}" to compile catalogs for production. Alternatively, use bundler plugins: https://lingui.dev/ref/cli#compiling-catalogs-in-ci)`);
42
42
  }
43
43
  // If service key is present in configuration, synchronize with cloud translation platform
44
44
  if (typeof config.service === "object" &&
@@ -83,18 +83,18 @@ if (require.main === module) {
83
83
  if (prevFormat && config.format === prevFormat) {
84
84
  hasErrors = true;
85
85
  console.error("Trying to migrate message catalog to the same format");
86
- console.error(`Set ${chalk_1.default.bold("new")} format in LinguiJS configuration\n` +
87
- ` and ${chalk_1.default.bold("previous")} format using --convert-from option.`);
86
+ console.error(`Set ${picocolors_1.default.bold("new")} format in LinguiJS configuration\n` +
87
+ ` and ${picocolors_1.default.bold("previous")} format using --convert-from option.`);
88
88
  console.log();
89
89
  console.log(`Example: Convert from lingui format to minimal`);
90
- console.log(chalk_1.default.yellow((0, help_1.helpRun)(`extract --convert-from lingui`)));
90
+ console.log(picocolors_1.default.yellow((0, help_1.helpRun)(`extract --convert-from lingui`)));
91
91
  process.exit(1);
92
92
  }
93
93
  if (options.locale) {
94
94
  const missingLocale = options.locale.find((l) => !config.locales.includes(l));
95
95
  if (missingLocale) {
96
96
  hasErrors = true;
97
- console.error(`Locale ${chalk_1.default.bold(missingLocale)} does not exist.`);
97
+ console.error(`Locale ${picocolors_1.default.bold(missingLocale)} does not exist.`);
98
98
  console.error();
99
99
  }
100
100
  }
@@ -132,7 +132,7 @@ if (require.main === module) {
132
132
  };
133
133
  // Check if Watch Mode is enabled
134
134
  if (options.watch) {
135
- console.info(chalk_1.default.bold("Initializing Watch Mode..."));
135
+ console.info(picocolors_1.default.bold("Initializing Watch Mode..."));
136
136
  (async function initWatch() {
137
137
  const catalogs = await (0, api_1.getCatalogs)(config);
138
138
  const paths = [];
@@ -146,7 +146,7 @@ if (require.main === module) {
146
146
  persistent: true,
147
147
  });
148
148
  const onReady = () => {
149
- console.info(chalk_1.default.green.bold("Watcher is ready!"));
149
+ console.info(picocolors_1.default.green(picocolors_1.default.bold("Watcher is ready!")));
150
150
  watcher
151
151
  .on("add", (path) => dispatchExtract([path]))
152
152
  .on("change", (path) => dispatchExtract([path]));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingui/cli",
3
- "version": "5.3.1",
3
+ "version": "5.3.3",
4
4
  "description": "CLI for working wit message catalogs",
5
5
  "keywords": [
6
6
  "cli",
@@ -12,7 +12,11 @@
12
12
  "translation",
13
13
  "multilingual"
14
14
  ],
15
- "repository": "lingui/js-lingui",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/lingui/js-lingui.git",
18
+ "directory": "packages/cli"
19
+ },
16
20
  "bugs": "https://github.com/lingui/js-lingui/issues",
17
21
  "license": "MIT",
18
22
  "author": {
@@ -57,14 +61,12 @@
57
61
  "@babel/parser": "^7.22.0",
58
62
  "@babel/runtime": "^7.21.0",
59
63
  "@babel/types": "^7.21.2",
60
- "@lingui/babel-plugin-extract-messages": "5.3.1",
61
- "@lingui/babel-plugin-lingui-macro": "5.3.1",
62
- "@lingui/conf": "5.3.1",
63
- "@lingui/core": "5.3.1",
64
- "@lingui/format-po": "5.3.1",
65
- "@lingui/message-utils": "5.3.1",
66
- "babel-plugin-macros": "^3.0.1",
67
- "chalk": "^4.1.0",
64
+ "@lingui/babel-plugin-extract-messages": "5.3.3",
65
+ "@lingui/babel-plugin-lingui-macro": "5.3.3",
66
+ "@lingui/conf": "5.3.3",
67
+ "@lingui/core": "5.3.3",
68
+ "@lingui/format-po": "5.3.3",
69
+ "@lingui/message-utils": "5.3.3",
68
70
  "chokidar": "3.5.1",
69
71
  "cli-table": "^0.3.11",
70
72
  "commander": "^10.0.0",
@@ -72,12 +74,10 @@
72
74
  "date-fns": "^3.6.0",
73
75
  "esbuild": "^0.25.1",
74
76
  "glob": "^11.0.0",
75
- "inquirer": "^7.3.3",
76
77
  "micromatch": "^4.0.7",
77
78
  "normalize-path": "^3.0.0",
78
79
  "ora": "^5.1.0",
79
- "pathe": "^1.1.0",
80
- "pkg-up": "^3.1.0",
80
+ "picocolors": "^1.1.1",
81
81
  "pofile": "^1.1.4",
82
82
  "pseudolocale": "^2.0.0",
83
83
  "source-map": "^0.8.0-beta.0"
@@ -90,5 +90,5 @@
90
90
  "mock-fs": "^5.2.0",
91
91
  "mockdate": "^3.0.5"
92
92
  },
93
- "gitHead": "f2cccd1211178f34aa47f0548a0c5d8caff93f59"
93
+ "gitHead": "f8dc4af3d9110f53613bb1b2fb303d6751e7a7b1"
94
94
  }