@lingui/babel-plugin-transform-react
Advanced tools
Comparing version 2.0.5 to 2.0.7
36
index.js
@@ -124,4 +124,4 @@ "use strict"; | ||
for (var _iterator = (0, _getIterator2.default)(node.children), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var _child = _step.value; | ||
props = processChildren(_child, file, props); | ||
var child = _step.value; | ||
props = processChildren(child, file, props); | ||
} // Plural, Select, SelectOrdinal | ||
@@ -160,7 +160,7 @@ | ||
for (var _iterator2 = (0, _getIterator2.default)(element.attributes), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var _attr = _step2.value; | ||
var name = _attr.name.name; | ||
var attr = _step2.value; | ||
var name = attr.name.name; | ||
if (name === "value") { | ||
var exp = t.isLiteral(_attr.value) ? _attr.value : _attr.value.expression; | ||
var exp = t.isLiteral(attr.value) ? attr.value : attr.value.expression; | ||
variable = t.isIdentifier(exp) ? exp.name : argumentGenerator(); | ||
@@ -172,3 +172,3 @@ var key = t.isIdentifier(exp) ? exp : t.numericLiteral(variable); | ||
// offset is static parameter, so it must be either string or number | ||
var offsetExp = t.isStringLiteral(_attr.value) ? _attr.value : _attr.value.expression; | ||
var offsetExp = t.isStringLiteral(attr.value) ? attr.value : attr.value.expression; | ||
@@ -181,3 +181,3 @@ if (offsetExp.value === undefined) { | ||
} else { | ||
props = processChildren(_attr.value, file, (0, _assign.default)({}, props, { | ||
props = processChildren(attr.value, file, (0, _assign.default)({}, props, { | ||
text: "" | ||
@@ -251,7 +251,7 @@ })); | ||
for (var _iterator3 = (0, _getIterator2.default)(element.attributes), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var _attr3 = _step3.value; | ||
var _name2 = _attr3.name.name; | ||
var _attr = _step3.value; | ||
var name = _attr.name.name; | ||
if (_name2 === "value") { | ||
var _exp = t.isLiteral(_attr3.value) ? _attr3.value : _attr3.value.expression; | ||
if (name === "value") { | ||
var _exp = t.isLiteral(_attr.value) ? _attr.value : _attr.value.expression; | ||
@@ -263,7 +263,7 @@ _variable = t.isIdentifier(_exp) ? _exp.name : argumentGenerator(); | ||
props.values[_variable] = t.objectProperty(_key, _exp); | ||
} else if (_name2 === "format") { | ||
if (t.isStringLiteral(_attr3.value)) { | ||
format = _attr3.value.value; | ||
} else if (t.isJSXExpressionContainer(_attr3.value)) { | ||
var _exp2 = _attr3.value.expression; | ||
} else if (name === "format") { | ||
if (t.isStringLiteral(_attr.value)) { | ||
format = _attr.value.value; | ||
} else if (t.isJSXExpressionContainer(_attr.value)) { | ||
var _exp2 = _attr.value.expression; | ||
@@ -332,4 +332,4 @@ if (t.isStringLiteral(_exp2)) { | ||
for (var _iterator4 = (0, _getIterator2.default)(node.children), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { | ||
var _child3 = _step4.value; | ||
props = processChildren(_child3, file, props); | ||
var _child = _step4.value; | ||
props = processChildren(_child, file, props); | ||
} | ||
@@ -336,0 +336,0 @@ } catch (err) { |
{ | ||
"name": "@lingui/babel-plugin-transform-react", | ||
"version": "2.0.5", | ||
"version": "2.0.7", | ||
"description": "Transform React components to ICU message format", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,7 +5,7 @@ [![License][Badge-License]][License] | ||
# babel-plugin-lingui-transform-react | ||
# @lingui/babel-plugin-transform-react | ||
> Babel plugin which transforms content of components from [lingui-react](https://www.npmjs.com/package/lingui-react) to ICU MessageFormat. | ||
`babel-plugin-lingui-transform-react` is part of [js-lingui][jsLingui]. See the [documentation][Documentation] for all information, tutorials and examples. | ||
`@lingui/babel-plugin-transform-react` is part of [js-lingui][jsLingui]. See the [documentation][Documentation] for all information, tutorials and examples. | ||
@@ -15,4 +15,4 @@ ## Installation | ||
```bash | ||
yarn add --dev babel-plugin-lingui-transform-react | ||
# npm install --save-dev babel-plugin-lingui-transform-react | ||
yarn add --dev @lingui/babel-plugin-transform-react | ||
# npm install --save-dev @lingui/babel-plugin-transform-react | ||
``` | ||
@@ -28,3 +28,3 @@ | ||
{ | ||
"plugins": ["lingui-transform-react"] | ||
"plugins": ["@lingui/babel-plugin-transform-react"] | ||
} | ||
@@ -36,3 +36,3 @@ ``` | ||
```bash | ||
babel --plugins lingui-transform-react script.js | ||
babel --plugins @lingui/babel-plugin-transform-react script.js | ||
``` | ||
@@ -43,4 +43,4 @@ | ||
```js | ||
require("babel-core").transform("code", { | ||
plugins: ["lingui-transform-react"] | ||
require("@babel/core").transform("code", { | ||
plugins: ["@lingui/babel-plugin-transform-react"] | ||
}) | ||
@@ -47,0 +47,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20836