@formatjs/cli-lib 6.3.6 → 6.3.7

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/extract.js +10 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formatjs/cli-lib",
3
- "version": "6.3.6",
3
+ "version": "6.3.7",
4
4
  "description": "Lib for CLI for formatjs.",
5
5
  "keywords": [
6
6
  "intl",
@@ -43,8 +43,8 @@
43
43
  "loud-rejection": "^2.2.0",
44
44
  "tslib": "^2.4.0",
45
45
  "typescript": "5",
46
- "@formatjs/icu-messageformat-parser": "2.7.6",
47
- "@formatjs/ts-transformer": "3.13.12"
46
+ "@formatjs/ts-transformer": "3.13.12",
47
+ "@formatjs/icu-messageformat-parser": "2.7.6"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "@vue/compiler-core": "^3.3.4",
package/src/extract.js CHANGED
@@ -23,13 +23,15 @@ function calculateLineColFromOffset(text, start) {
23
23
  async function processFile(source, fn, { idInterpolationPattern, ...opts }) {
24
24
  let messages = [];
25
25
  let meta;
26
+ const onMsgExtracted = opts.onMsgExtracted;
27
+ const onMetaExtracted = opts.onMetaExtracted;
26
28
  opts = {
27
29
  ...opts,
28
30
  additionalComponentNames: [
29
31
  '$formatMessage',
30
32
  ...(opts.additionalComponentNames || []),
31
33
  ],
32
- onMsgExtracted(_, msgs) {
34
+ onMsgExtracted(filePath, msgs) {
33
35
  if (opts.extractSourceLocation) {
34
36
  msgs = msgs.map(msg => ({
35
37
  ...msg,
@@ -37,9 +39,15 @@ async function processFile(source, fn, { idInterpolationPattern, ...opts }) {
37
39
  }));
38
40
  }
39
41
  messages = messages.concat(msgs);
42
+ if (onMsgExtracted) {
43
+ onMsgExtracted(filePath, msgs);
44
+ }
40
45
  },
41
- onMetaExtracted(_, m) {
46
+ onMetaExtracted(filePath, m) {
42
47
  meta = m;
48
+ if (onMetaExtracted) {
49
+ onMetaExtracted(filePath, m);
50
+ }
43
51
  },
44
52
  };
45
53
  if (!opts.overrideIdFn && idInterpolationPattern) {