@lingui/cli 4.5.0 → 4.6.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.
@@ -247,11 +247,14 @@ function orderByOrigin(messages) {
247
247
  }, {});
248
248
  }
249
249
  function orderByMessage(messages) {
250
+ // hardcoded en-US locale to have consistent sorting
251
+ // @see https://github.com/lingui/js-lingui/pull/1808
252
+ const collator = new Intl.Collator("en-US");
250
253
  return Object.keys(messages)
251
254
  .sort((a, b) => {
252
255
  const aMsg = messages[a].message || "";
253
256
  const bMsg = messages[b].message || "";
254
- return aMsg.localeCompare(bMsg);
257
+ return collator.compare(aMsg, bMsg);
255
258
  })
256
259
  .reduce((acc, key) => {
257
260
  ;
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.getPackageJson = exports.buildExternalizeFilter = void 0;
7
+ const node_fs_1 = __importDefault(require("node:fs"));
4
8
  function createPackageRegExp(packageName) {
5
9
  return new RegExp("^" + packageName + "(?:\\/.+)?");
6
10
  }
@@ -33,6 +37,11 @@ async function getPackageJson(rootDir) {
33
37
  throw new Error("We could not able to find your package.json file. " +
34
38
  "Check that `rootDir` is pointing to the folder with package.json");
35
39
  }
36
- return await import(packageJsonPath);
40
+ try {
41
+ return JSON.parse(await node_fs_1.default.promises.readFile(packageJsonPath, "utf-8"));
42
+ }
43
+ catch (e) {
44
+ throw new Error(`Unable to read package.json file at path ${packageJsonPath}. \n\n Error: ${e.message}`);
45
+ }
37
46
  }
38
47
  exports.getPackageJson = getPackageJson;
@@ -64,7 +64,7 @@ async function command(config, options) {
64
64
  let compiledPath = await catalog.writeCompiled(locale, compiledCatalog, namespace);
65
65
  if (options.typescript) {
66
66
  const typescriptPath = compiledPath.replace(/\.ts?$/, "") + ".d.ts";
67
- fs_1.default.writeFileSync(typescriptPath, `import { Messages } from '@lingui/core';
67
+ fs_1.default.writeFileSync(typescriptPath, `import type { Messages } from '@lingui/core';
68
68
  declare const messages: Messages;
69
69
  export { messages };
70
70
  `);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingui/cli",
3
- "version": "4.5.0",
3
+ "version": "4.6.0",
4
4
  "description": "CLI for working wit message catalogs",
5
5
  "keywords": [
6
6
  "cli",
@@ -53,11 +53,11 @@
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.5.0",
57
- "@lingui/conf": "4.5.0",
58
- "@lingui/core": "4.5.0",
59
- "@lingui/format-po": "4.5.0",
60
- "@lingui/message-utils": "4.5.0",
56
+ "@lingui/babel-plugin-extract-messages": "4.6.0",
57
+ "@lingui/conf": "4.6.0",
58
+ "@lingui/core": "4.6.0",
59
+ "@lingui/format-po": "4.6.0",
60
+ "@lingui/message-utils": "4.6.0",
61
61
  "babel-plugin-macros": "^3.0.1",
62
62
  "chalk": "^4.1.0",
63
63
  "chokidar": "3.5.1",
@@ -80,7 +80,7 @@
80
80
  },
81
81
  "devDependencies": {
82
82
  "@lingui/jest-mocks": "*",
83
- "@lingui/macro": "4.5.0",
83
+ "@lingui/macro": "4.6.0",
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": "62c92d1f8c60b3890bdda870f307fa780d423080"
91
+ "gitHead": "2afa0efb2d0cd1d47adc76e1eec9f5e57e34ae18"
92
92
  }