Socket
Socket
Sign inDemoInstall

@lingui/babel-plugin-extract-messages

Package Overview
Dependencies
Maintainers
1
Versions
143
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lingui/babel-plugin-extract-messages - npm Package Compare versions

Comparing version 2.6.1 to 2.7.0

index.js.flow

55

index.js

@@ -23,2 +23,10 @@ "use strict";

var _extends2 = require("babel-runtime/helpers/extends");
var _extends3 = _interopRequireDefault(_extends2);
var _objectWithoutProperties2 = require("babel-runtime/helpers/objectWithoutProperties");
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
var _symbol = require("babel-runtime/core-js/symbol");

@@ -69,6 +77,6 @@

var moduleName = node.source.value;
if (!(0, _includes2.default)(["@lingui/react", "@lingui/core"], moduleName)) return;
if (!(0, _includes2.default)(["@lingui/react", "@lingui/macro", "@lingui/core"], moduleName)) return;
var importDeclarations = {};
if (moduleName === "@lingui/react") {
if (moduleName === "@lingui/react" || moduleName === "@lingui/macro") {
node.specifiers.forEach(function (specifier) {

@@ -105,3 +113,3 @@ importDeclarations[specifier.imported.name] = specifier.local.name;

var key = item.name.name;
if (key === "id" || key === "defaults") {
if (key === "id" || key === "defaults" || key === "description") {
if (item.value.value) {

@@ -180,2 +188,38 @@ acc[key] = item.value.value;

}
},
// Extract message descriptors
ObjectExpression: function ObjectExpression(path, _ref5) {
var file = _ref5.file;
var visited = file.get(VISITED);
var comment = path.node.leadingComments && path.node.leadingComments.filter(function (node) {
return node.value.startsWith("i18n");
})[0];
if (!comment || visited.has(path.node)) {
return;
}
visited.add(path.node);
var props = {};
var description = comment.value.replace(/\s*i18n:?\s*/, "").trim();
if (description) props.description = description;
var copyProps = ["id", "defaults"];
path.node.properties.filter(function (_ref6) {
var key = _ref6.key;
return copyProps.indexOf(key.name) !== -1;
}).forEach(function (_ref7) {
var key = _ref7.key,
value = _ref7.value;
props[key.name] = value.value;
});
collectMessage(path, file, props);
}

@@ -264,3 +308,4 @@ },

defaults = _ref.defaults,
origin = _ref.origin;
origin = _ref.origin,
props = (0, _objectWithoutProperties3.default)(_ref, ["id", "defaults", "origin"]);

@@ -281,4 +326,4 @@ if (messages.has(id)) {

} else {
messages.set(id, { defaults: defaults, origin: origin });
messages.set(id, (0, _extends3.default)({}, props, { defaults: defaults, origin: origin }));
}
}

8

package.json
{
"name": "@lingui/babel-plugin-extract-messages",
"version": "2.6.1",
"version": "2.7.0",
"description": "Extract messages for translation",

@@ -31,9 +31,9 @@ "main": "index.js",

"dependencies": {
"@lingui/conf": "2.6.1",
"@lingui/conf": "2.7.0",
"babel-generator": "^6.26.1"
},
"devDependencies": {
"@lingui/babel-plugin-transform-js": "2.6.1",
"@lingui/babel-plugin-transform-react": "2.6.1"
"@lingui/babel-plugin-transform-js": "2.7.0",
"@lingui/babel-plugin-transform-react": "2.7.0"
}
}

@@ -9,3 +9,3 @@ [![License][Badge-License]][License]

`@lingui/babel-plugin-extract-messages` is part of [js-lingui][jsLingui]. See the [documentation][Documentation] for all information, tutorials and examples.
`@lingui/babel-plugin-extract-messages` is part of [LinguiJS][LinguiJS]. See the [documentation][Documentation] for all information, tutorials and examples.

@@ -50,4 +50,4 @@ ## Installation

[License]: https://github.com/lingui/js-lingui/blob/master/LICENSE
[jsLingui]: https://github.com/lingui/js-lingui
[Documentation]: https://lingui.github.io/js-lingui/
[LinguiJS]: https://github.com/lingui/js-lingui
[Documentation]: https://lingui.js.org/
[Package]: https://www.npmjs.com/package/@lingui/babel-plugin-extract-messages

@@ -54,0 +54,0 @@ [Badge-Downloads]: https://img.shields.io/npm/dw/@lingui/babel-plugin-extract-messages.svg

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc