@lingui/macro
Advanced tools
Comparing version 3.4.0 to 3.5.0
@@ -34,3 +34,3 @@ import type { ReactElement, ComponentType, ReactNode } from "react" | ||
comment?: string | ||
component?: ReactElement<any, any> | null | ||
component?: React.ComponentType<TransRenderProps> | ||
render?: (props: TransRenderProps) => ReactElement<any, any> | null | ||
@@ -37,0 +37,0 @@ } |
@@ -139,16 +139,14 @@ "use strict"; | ||
}); | ||
(0, _defineProperty2.default)(this, "attrName", function (names) { | ||
var exclude = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
var namesRe = new RegExp("^(" + names.join("|") + ")$"); | ||
return function (attr) { | ||
return exclude ? !namesRe.test(attr.name.name) : namesRe.test(attr.name.name); | ||
}; | ||
}); | ||
(0, _defineProperty2.default)(this, "stripMacroAttributes", function (node) { | ||
var attributes = node.openingElement.attributes; | ||
var attrName = function attrName(names) { | ||
var exclude = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
var namesRe = new RegExp("^(" + names.join("|") + ")$"); | ||
return function (attr) { | ||
return exclude ? !namesRe.test(attr.name.name) : namesRe.test(attr.name.name); | ||
}; | ||
}; | ||
var id = attributes.filter(attrName([_constants.ID]))[0]; | ||
var message = attributes.filter(attrName([_constants.MESSAGE]))[0]; | ||
var comment = attributes.filter(attrName([_constants.COMMENT]))[0]; | ||
var id = attributes.filter(_this.attrName([_constants.ID]))[0]; | ||
var message = attributes.filter(_this.attrName([_constants.MESSAGE]))[0]; | ||
var comment = attributes.filter(_this.attrName([_constants.COMMENT]))[0]; | ||
var reserved = [_constants.ID, _constants.MESSAGE, _constants.COMMENT]; | ||
@@ -165,3 +163,3 @@ | ||
comment: maybeNodeValue(comment), | ||
attributes: attributes.filter(attrName(reserved, true)) | ||
attributes: attributes.filter(_this.attrName(reserved, true)) | ||
}; | ||
@@ -198,6 +196,6 @@ }); | ||
} else if (_this.types.isTemplateLiteral(exp)) { | ||
var tokenize = R.pipe( // Don't output tokens without text. | ||
var tokenize = R.pipe( // Don"t output tokens without text. | ||
R.evolve({ | ||
quasis: R.map(function (text) { | ||
// Don't output tokens without text. | ||
// Don"t output tokens without text. | ||
var value = text.value.raw; | ||
@@ -232,3 +230,4 @@ if (value === "") return null; | ||
var format = element.name.name.toLowerCase(); | ||
var props = element.attributes; | ||
var props = element.attributes.filter(_this.attrName([_constants.ID, _constants.COMMENT, _constants.MESSAGE, // we remove <Trans /> react props that are not useful for translation | ||
"render", "component", "components"], true)); | ||
var token = { | ||
@@ -259,3 +258,3 @@ type: "arg", | ||
token.options.offset = _this.types.isStringLiteral(attr.value) ? attr.value.value : attr.value.expression.value; | ||
} else if (pluralRuleRe.test(name)) { | ||
} else { | ||
var value = void 0; | ||
@@ -269,3 +268,7 @@ | ||
token.options[jsx2icuExactChoice(name)] = value; | ||
if (pluralRuleRe.test(name)) { | ||
token.options[jsx2icuExactChoice(name)] = value; | ||
} else { | ||
token.options[name] = value; | ||
} | ||
} | ||
@@ -338,3 +341,3 @@ } | ||
* We clean '//\` ' to just '`' | ||
*/ | ||
* */ | ||
value: function clearBackslashes(value) { | ||
@@ -341,0 +344,0 @@ return value.replace(removeExtraScapedLiterals, "`"); |
{ | ||
"name": "@lingui/macro", | ||
"version": "3.4.0", | ||
"version": "3.5.0", | ||
"description": "Macro for generating messages in ICU MessageFormat syntax", | ||
@@ -32,3 +32,3 @@ "main": "index.ts", | ||
"@babel/runtime": "^7.11.2", | ||
"@lingui/conf": "^3.4.0", | ||
"@lingui/conf": "^3.5.0", | ||
"ramda": "^0.27.1" | ||
@@ -35,0 +35,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
44955
911
Updated@lingui/conf@^3.5.0