@lingui/macro 4.0.0-next.4 → 4.0.0-next.6
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/dist/index.cjs +3 -13
- package/dist/index.mjs +1 -11
- package/package.json +15 -6
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const babelPluginMacros = require('babel-plugin-macros');
|
|
4
4
|
const conf = require('@lingui/conf');
|
|
5
5
|
const types = require('@babel/types');
|
|
6
|
-
const
|
|
6
|
+
const generateMessageId = require('@lingui/message-utils/generateMessageId');
|
|
7
7
|
|
|
8
8
|
const metaOptions = ["id", "comment", "props"];
|
|
9
9
|
const escapedMetaOptionsRe = new RegExp(`^_(${metaOptions.join("|")})$`);
|
|
@@ -229,7 +229,7 @@ class MacroJs {
|
|
|
229
229
|
createIdProperty(message, context) {
|
|
230
230
|
return this.createObjectProperty(
|
|
231
231
|
ID,
|
|
232
|
-
this.types.stringLiteral(
|
|
232
|
+
this.types.stringLiteral(generateMessageId.generateMessageId(message, context))
|
|
233
233
|
);
|
|
234
234
|
}
|
|
235
235
|
createValuesProperty(values) {
|
|
@@ -313,13 +313,6 @@ class MacroJs {
|
|
|
313
313
|
return token;
|
|
314
314
|
}
|
|
315
315
|
tokenizeExpression(node) {
|
|
316
|
-
if (this.isArg(node) && this.types.isCallExpression(node)) {
|
|
317
|
-
return {
|
|
318
|
-
type: "arg",
|
|
319
|
-
name: node.arguments[0].value,
|
|
320
|
-
value: void 0
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
316
|
return {
|
|
324
317
|
type: "arg",
|
|
325
318
|
name: this.expressionToArgument(node),
|
|
@@ -392,9 +385,6 @@ class MacroJs {
|
|
|
392
385
|
isDefineMessage(node) {
|
|
393
386
|
return this.isLinguiIdentifier(node, "defineMessage") || this.isLinguiIdentifier(node, "msg");
|
|
394
387
|
}
|
|
395
|
-
isArg(node) {
|
|
396
|
-
return this.types.isCallExpression(node) && this.isLinguiIdentifier(node.callee, "arg");
|
|
397
|
-
}
|
|
398
388
|
isI18nMethod(node) {
|
|
399
389
|
return this.types.isTaggedTemplateExpression(node) && (this.isLinguiIdentifier(node.tag, "t") || this.types.isCallExpression(node.tag) && this.isLinguiIdentifier(node.tag.callee, "t"));
|
|
400
390
|
}
|
|
@@ -467,7 +457,7 @@ class MacroJSX {
|
|
|
467
457
|
);
|
|
468
458
|
} else {
|
|
469
459
|
attributes.push(
|
|
470
|
-
this.createStringJsxAttribute(ID,
|
|
460
|
+
this.createStringJsxAttribute(ID, generateMessageId.generateMessageId(message, context))
|
|
471
461
|
);
|
|
472
462
|
}
|
|
473
463
|
if (!this.stripNonEssentialProps) {
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createMacro } from 'babel-plugin-macros';
|
|
2
2
|
import { getConfig as getConfig$1 } from '@lingui/conf';
|
|
3
3
|
import { isJSXEmptyExpression, isObjectProperty, isImportSpecifier, isIdentifier } from '@babel/types';
|
|
4
|
-
import { generateMessageId } from '@lingui/
|
|
4
|
+
import { generateMessageId } from '@lingui/message-utils/generateMessageId';
|
|
5
5
|
|
|
6
6
|
const metaOptions = ["id", "comment", "props"];
|
|
7
7
|
const escapedMetaOptionsRe = new RegExp(`^_(${metaOptions.join("|")})$`);
|
|
@@ -311,13 +311,6 @@ class MacroJs {
|
|
|
311
311
|
return token;
|
|
312
312
|
}
|
|
313
313
|
tokenizeExpression(node) {
|
|
314
|
-
if (this.isArg(node) && this.types.isCallExpression(node)) {
|
|
315
|
-
return {
|
|
316
|
-
type: "arg",
|
|
317
|
-
name: node.arguments[0].value,
|
|
318
|
-
value: void 0
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
314
|
return {
|
|
322
315
|
type: "arg",
|
|
323
316
|
name: this.expressionToArgument(node),
|
|
@@ -390,9 +383,6 @@ class MacroJs {
|
|
|
390
383
|
isDefineMessage(node) {
|
|
391
384
|
return this.isLinguiIdentifier(node, "defineMessage") || this.isLinguiIdentifier(node, "msg");
|
|
392
385
|
}
|
|
393
|
-
isArg(node) {
|
|
394
|
-
return this.types.isCallExpression(node) && this.isLinguiIdentifier(node.callee, "arg");
|
|
395
|
-
}
|
|
396
386
|
isI18nMethod(node) {
|
|
397
387
|
return this.types.isTaggedTemplateExpression(node) && (this.isLinguiIdentifier(node.tag, "t") || this.types.isCallExpression(node.tag) && this.isLinguiIdentifier(node.tag.callee, "t"));
|
|
398
388
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingui/macro",
|
|
3
|
-
"version": "4.0.0-next.
|
|
3
|
+
"version": "4.0.0-next.6",
|
|
4
4
|
"description": "Macro for generating messages in ICU MessageFormat syntax",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
8
9
|
"author": {
|
|
9
10
|
"name": "Tomáš Ehrlich",
|
|
10
11
|
"email": "tomas.ehrlich@gmail.com"
|
|
@@ -38,6 +39,14 @@
|
|
|
38
39
|
"types": "./index.d.ts",
|
|
39
40
|
"default": "./dist/index.mjs"
|
|
40
41
|
}
|
|
42
|
+
},
|
|
43
|
+
"./node": {
|
|
44
|
+
"require": {
|
|
45
|
+
"types": "./dist/index.d.ts"
|
|
46
|
+
},
|
|
47
|
+
"import": {
|
|
48
|
+
"types": "./dist/index.d.ts"
|
|
49
|
+
}
|
|
41
50
|
}
|
|
42
51
|
},
|
|
43
52
|
"files": [
|
|
@@ -49,12 +58,12 @@
|
|
|
49
58
|
"dependencies": {
|
|
50
59
|
"@babel/runtime": "^7.20.13",
|
|
51
60
|
"@babel/types": "^7.20.7",
|
|
52
|
-
"@lingui/
|
|
53
|
-
"@lingui/
|
|
61
|
+
"@lingui/conf": "^4.0.0-next.6",
|
|
62
|
+
"@lingui/core": "^4.0.0-next.6",
|
|
63
|
+
"@lingui/message-utils": "^4.0.0-next.6"
|
|
54
64
|
},
|
|
55
65
|
"peerDependencies": {
|
|
56
|
-
"@lingui/
|
|
57
|
-
"@lingui/react": "4.0.0-next.4",
|
|
66
|
+
"@lingui/react": "4.0.0-next.6",
|
|
58
67
|
"babel-plugin-macros": "2 || 3"
|
|
59
68
|
},
|
|
60
69
|
"devDependencies": {
|
|
@@ -66,5 +75,5 @@
|
|
|
66
75
|
"tsd": "^0.26.1",
|
|
67
76
|
"unbuild": "^1.1.2"
|
|
68
77
|
},
|
|
69
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "d4d9e149b2419d1796e14176d53703a7cff4b82c"
|
|
70
79
|
}
|