@lingui/cli 4.11.2 → 4.11.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.
@@ -88,7 +88,7 @@ class Catalog {
88
88
  async collect(options = {}) {
89
89
  let paths = this.sourcePaths;
90
90
  if (options.files) {
91
- options.files = options.files.map((p) => (0, normalize_path_1.default)(p, false));
91
+ options.files = options.files.map((p) => (0, utils_1.makePathRegexSafe)((0, normalize_path_1.default)(p, false)));
92
92
  const regex = new RegExp(options.files.join("|"), "i");
93
93
  paths = paths.filter((path) => regex.test(path));
94
94
  }
package/dist/api/help.js CHANGED
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.helpRun = void 0;
4
4
  /**
5
- * Detect where's is the command lingui extract or lingui compile
6
- * and how is being run (npm, yarn) and construct help
5
+ * Detect where is the command lingui extract or lingui compile
6
+ * and how is being run (npm, yarn, pnpm) and construct help
7
7
  * for follow-up commands based on that.
8
8
  *
9
9
  * Example:
@@ -15,6 +15,10 @@ exports.helpRun = void 0;
15
15
  * ...
16
16
  * (use "yarn lingui compile" to compile catalogs for production)
17
17
  *
18
+ * $ pnpm run extract
19
+ * ...
20
+ * (use "pnpm run compile" to compile catalogs for production)
21
+ *
18
22
  * $ npm run extract
19
23
  * ...
20
24
  * (use "npm run compile" to compile catalogs for production)
@@ -32,9 +36,20 @@ function helpRun(command) {
32
36
  command = res[0];
33
37
  }
34
38
  }
35
- const isYarn = process.env.npm_config_user_agent &&
36
- process.env.npm_config_user_agent.includes("yarn");
37
- const runCommand = isYarn ? "yarn" : "npm run";
39
+ const runCommand = runCommandFrom(process.env.npm_config_user_agent);
38
40
  return `${runCommand} ${command}`;
39
41
  }
40
42
  exports.helpRun = helpRun;
43
+ function runCommandFrom(userAgent) {
44
+ const defaultRunCommand = "npm run";
45
+ if (!userAgent) {
46
+ return defaultRunCommand;
47
+ }
48
+ if (userAgent.includes("yarn")) {
49
+ return "yarn";
50
+ }
51
+ if (userAgent.includes("pnpm")) {
52
+ return "pnpm run";
53
+ }
54
+ return defaultRunCommand;
55
+ }
@@ -18,3 +18,7 @@ export declare function normalizeSlashes(path: string): string;
18
18
  * Preserve absolute paths: /absolute/path => /absolute/path
19
19
  */
20
20
  export declare function normalizeRelativePath(sourcePath: string): string;
21
+ /**
22
+ * Escape special regex characters used in file-based routing systems
23
+ */
24
+ export declare function makePathRegexSafe(path: string): string;
package/dist/api/utils.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.normalizeRelativePath = exports.normalizeSlashes = exports.makeInstall = exports.hasYarn = exports.writeFileIfChanged = exports.writeFile = exports.isDirectory = exports.readFile = exports.replacePlaceholders = exports.prettyOrigin = exports.PATHSEP = void 0;
6
+ exports.makePathRegexSafe = exports.normalizeRelativePath = exports.normalizeSlashes = exports.makeInstall = exports.hasYarn = exports.writeFileIfChanged = exports.writeFile = exports.isDirectory = exports.readFile = exports.replacePlaceholders = exports.prettyOrigin = exports.PATHSEP = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const normalize_path_1 = __importDefault(require("normalize-path"));
@@ -110,3 +110,10 @@ function normalizeRelativePath(sourcePath) {
110
110
  (isDir ? "/" : ""));
111
111
  }
112
112
  exports.normalizeRelativePath = normalizeRelativePath;
113
+ /**
114
+ * Escape special regex characters used in file-based routing systems
115
+ */
116
+ function makePathRegexSafe(path) {
117
+ return path.replace(/[(){}[\]^$+]/g, "\\$&");
118
+ }
119
+ exports.makePathRegexSafe = makePathRegexSafe;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingui/cli",
3
- "version": "4.11.2",
3
+ "version": "4.11.3",
4
4
  "description": "CLI for working wit message catalogs",
5
5
  "keywords": [
6
6
  "cli",
@@ -53,15 +53,15 @@
53
53
  "@babel/parser": "^7.21.2",
54
54
  "@babel/runtime": "^7.21.0",
55
55
  "@babel/types": "^7.21.2",
56
- "@lingui/babel-plugin-extract-messages": "4.11.2",
57
- "@lingui/conf": "4.11.2",
58
- "@lingui/core": "4.11.2",
59
- "@lingui/format-po": "4.11.2",
60
- "@lingui/message-utils": "4.11.2",
56
+ "@lingui/babel-plugin-extract-messages": "4.11.3",
57
+ "@lingui/conf": "4.11.3",
58
+ "@lingui/core": "4.11.3",
59
+ "@lingui/format-po": "4.11.3",
60
+ "@lingui/message-utils": "4.11.3",
61
61
  "babel-plugin-macros": "^3.0.1",
62
62
  "chalk": "^4.1.0",
63
63
  "chokidar": "3.5.1",
64
- "cli-table": "0.3.6",
64
+ "cli-table": "^0.3.11",
65
65
  "commander": "^10.0.0",
66
66
  "convert-source-map": "^2.0.0",
67
67
  "date-fns": "^3.6.0",
@@ -80,7 +80,7 @@
80
80
  },
81
81
  "devDependencies": {
82
82
  "@lingui/jest-mocks": "*",
83
- "@lingui/macro": "4.11.2",
83
+ "@lingui/macro": "4.11.3",
84
84
  "@types/convert-source-map": "^2.0.0",
85
85
  "@types/glob": "^8.1.0",
86
86
  "@types/micromatch": "^4.0.1",
@@ -88,5 +88,5 @@
88
88
  "mock-fs": "^5.2.0",
89
89
  "mockdate": "^3.0.5"
90
90
  },
91
- "gitHead": "17e0af54b0b9d9577db2cef1be680a6d871611e7"
91
+ "gitHead": "088efe57f23e88aee7ef72c58a45db427ecd78c9"
92
92
  }