babel-plugin-formatjs 10.3.11 → 10.3.12
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/package.json +3 -3
- package/utils.js +2 -2
- package/visitors/call-expression.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-plugin-formatjs",
|
|
3
|
-
"version": "10.3.
|
|
3
|
+
"version": "10.3.12",
|
|
4
4
|
"description": "Extracts string messages for translation from modules that use formatjs.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"@babel/plugin-syntax-jsx": "7",
|
|
17
17
|
"@babel/traverse": "7",
|
|
18
18
|
"@babel/types": "^7.12.11",
|
|
19
|
-
"@formatjs/icu-messageformat-parser": "2.0.
|
|
20
|
-
"@formatjs/ts-transformer": "3.
|
|
19
|
+
"@formatjs/icu-messageformat-parser": "2.0.15",
|
|
20
|
+
"@formatjs/ts-transformer": "3.7.0",
|
|
21
21
|
"@types/babel__core": "^7.1.7",
|
|
22
22
|
"@types/babel__helper-plugin-utils": "^7.10.0",
|
|
23
23
|
"tslib": "^2.1.0"
|
package/utils.js
CHANGED
|
@@ -66,7 +66,7 @@ function evaluateMessageDescriptor(descriptorPath, isJSXSource, filename, idInte
|
|
|
66
66
|
else if (!id && idInterpolationPattern && defaultMessage) {
|
|
67
67
|
id = (0, ts_transformer_1.interpolateName)({ resourcePath: filename }, idInterpolationPattern, {
|
|
68
68
|
content: description
|
|
69
|
-
? defaultMessage
|
|
69
|
+
? "".concat(defaultMessage, "#").concat(description)
|
|
70
70
|
: defaultMessage,
|
|
71
71
|
});
|
|
72
72
|
}
|
|
@@ -106,7 +106,7 @@ function getICUMessageValue(messagePath, _a, preserveWhitespace) {
|
|
|
106
106
|
}
|
|
107
107
|
throw messagePath.buildCodeFrameError('[React Intl] Message failed to parse. ' +
|
|
108
108
|
'See: https://formatjs.io/docs/core-concepts/icu-syntax' +
|
|
109
|
-
|
|
109
|
+
"\n".concat(parseError));
|
|
110
110
|
}
|
|
111
111
|
return message;
|
|
112
112
|
}
|
|
@@ -7,7 +7,7 @@ var utils_1 = require("../utils");
|
|
|
7
7
|
var icu_messageformat_parser_1 = require("@formatjs/icu-messageformat-parser");
|
|
8
8
|
function assertObjectExpression(path, callee) {
|
|
9
9
|
if (!path || !path.isObjectExpression()) {
|
|
10
|
-
throw path.buildCodeFrameError("[React Intl] `"
|
|
10
|
+
throw path.buildCodeFrameError("[React Intl] `".concat(callee.get('property').node.name, "()` must be called with an object expression with values that are React Intl Message Descriptors, also defined as object expressions."));
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
function isFormatMessageCall(callee, functionNames) {
|