Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@visma/react-intl-helpers

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@visma/react-intl-helpers - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

5

CHANGELOG.md

@@ -0,3 +1,8 @@

# 0.1.1
* Set default export to all message ids.
* Fix: Download messages only once.
# 0.1.0
* First release.

17

cjs/loader/index.js

@@ -62,3 +62,3 @@ "use strict";

_regenerator.default.mark(function _callee(error, files) {
var _loop, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, file;
var _loop, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, file, keys;

@@ -174,16 +174,17 @@ return _regenerator.default.wrap(function _callee$(_context2) {

case 30:
callback(null, "".concat((0, _keys.default)((0, _properties.parse)(source)).map(function (key) {
keys = (0, _keys.default)((0, _properties.parse)(source));
callback(null, "".concat(keys.map(function (key) {
return "export const ".concat((0, _lodash.camelCase)(key), " = '").concat(addNamespace(key), "';");
}).join('\n')).concat(process.env.NODE_ENV === 'production' ? '' : // If only message values change, content of returned data does
}).join('\n'), "\nexport default {").concat(keys.map(_lodash.camelCase).join(', '), "};\n").concat(process.env.NODE_ENV === 'production' ? '' : // If only message values change, content of returned data does
// not change. Add timestamp to notify Webpack for changes.
"/* ".concat(Date.now(), " */")));
_context2.next = 36;
_context2.next = 37;
break;
case 33:
_context2.prev = 33;
case 34:
_context2.prev = 34;
_context2.t2 = _context2["catch"](3);
callback(_context2.t2);
case 36:
case 37:
case "end":

@@ -193,3 +194,3 @@ return _context2.stop();

}
}, _callee, this, [[3, 33], [8, 18, 22, 30], [23,, 25, 29]]);
}, _callee, this, [[3, 34], [8, 18, 22, 30], [23,, 25, 29]]);
}));

@@ -196,0 +197,0 @@

@@ -79,4 +79,9 @@ "use strict";

case 0:
if (!(_this.state.locale !== locale)) {
_context.next = 8;
break;
}
if (!(process.env.NODE_ENV === 'production' && _.translations.has(locale))) {
_context.next = 4;
_context.next = 5;
break;

@@ -87,16 +92,16 @@ }

_context.next = 7;
_context.next = 8;
break;
case 4:
_context.next = 6;
case 5:
_context.next = 7;
return (0, _fetchLocaleData.default)(locale);
case 6:
case 7:
_this.setLocale(locale);
case 7:
case 8:
callback();
case 8:
case 9:
case "end":

@@ -103,0 +108,0 @@ return _context.stop();

@@ -37,3 +37,3 @@ import _getIterator from "@babel/runtime/core-js/get-iterator";

_regeneratorRuntime.mark(function _callee(error, files) {
var _loop, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, file;
var _loop, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, file, keys;

@@ -151,16 +151,17 @@ return _regeneratorRuntime.wrap(function _callee$(_context2) {

case 30:
callback(null, "".concat(_Object$keys(parse(source)).map(function (key) {
keys = _Object$keys(parse(source));
callback(null, "".concat(keys.map(function (key) {
return "export const ".concat(camelCase(key), " = '").concat(addNamespace(key), "';");
}).join('\n')).concat(process.env.NODE_ENV === 'production' ? '' : // If only message values change, content of returned data does
}).join('\n'), "\nexport default {").concat(keys.map(camelCase).join(', '), "};\n").concat(process.env.NODE_ENV === 'production' ? '' : // If only message values change, content of returned data does
// not change. Add timestamp to notify Webpack for changes.
"/* ".concat(Date.now(), " */")));
_context2.next = 36;
_context2.next = 37;
break;
case 33:
_context2.prev = 33;
case 34:
_context2.prev = 34;
_context2.t2 = _context2["catch"](3);
callback(_context2.t2);
case 36:
case 37:
case "end":

@@ -170,3 +171,3 @@ return _context2.stop();

}
}, _callee, this, [[3, 33], [8, 18, 22, 30], [23,, 25, 29]]);
}, _callee, this, [[3, 34], [8, 18, 22, 30], [23,, 25, 29]]);
}));

@@ -173,0 +174,0 @@

@@ -54,4 +54,9 @@ import _extends from "@babel/runtime/helpers/extends";

case 0:
if (!(_this.state.locale !== locale)) {
_context.next = 8;
break;
}
if (!(process.env.NODE_ENV === 'production' && translations.has(locale))) {
_context.next = 4;
_context.next = 5;
break;

@@ -62,16 +67,16 @@ }

_context.next = 7;
_context.next = 8;
break;
case 4:
_context.next = 6;
case 5:
_context.next = 7;
return fetchLocaleData(locale);
case 6:
case 7:
_this.setLocale(locale);
case 7:
case 8:
callback();
case 8:
case 9:
case "end":

@@ -78,0 +83,0 @@ return _context.stop();

{
"name": "@visma/react-intl-helpers",
"version": "0.1.0",
"version": "0.1.1",
"description": "Modular messages.properties, loaded dynamically.",

@@ -8,3 +8,4 @@ "main": "cjs",

"build": "npm run inbuild --",
"inbuild": "library-util babel",
"inbuild": "library-util babel --verbose",
"eslint": "eslint {.,src/**}/*.js --fix",
"lint": "npm run eslint && npm run prettier",

@@ -50,4 +51,4 @@ "prebuild": "rimraf cjs es",

"concurrently": "^3.5.1",
"library-util": "^0.1.6"
"library-util": "^0.1.7"
}
}

@@ -26,7 +26,7 @@ # @visma/react-intl-helpers

my-app/
dist/intl/ // generated
messages.1f87c6b2907b3c71.json // defaults
messages.en-US.64c397a24b33b0e8.json // defaults + en + en-US
messages.en.f6ddad6c6db9e386.json // defaults + en
messages.fi.7ad0b2e9bd60b8b2.json // defaults + fi
dist/intl/ // generated
messages.1f87c6b2907b3c71.json // defaults
messages.en-US.64c397a24b33b0e8.json // defaults + en + en-US
messages.en.f6ddad6c6db9e386.json // defaults + en
messages.fi.7ad0b2e9bd60b8b2.json // defaults + fi
src/

@@ -70,8 +70,8 @@ intl/

import { someThing } from "some-package/messages/messages.properties";
import * as ids from "./intl/messages.properties";
import messages from "./intl/messages.properties";
export default () => (
<Localize locale="fi-FI">
<FormattedMessage id={ids.title} />
<FormattedMessage id={ids.someThing} />
<FormattedMessage id={messages.title} />
<FormattedMessage id={messages.someThing} />
<FormattedMessage id={someThing} />

@@ -78,0 +78,0 @@ </Localize>

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc