New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

signavio-i18n

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

signavio-i18n - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0-0

.tmp/mocha-webpack/7198eedda8454a60f1b410c3e1950df4-entry.js

14

lib-es6/index.js

@@ -1,3 +0,2 @@

import isFunction from 'lodash/isFunction';
import forEach from 'lodash/forEach';
import invariant from 'invariant';
import createTranslate from './translate';

@@ -74,2 +73,3 @@ var config = {};

invariant(config, 'could not determine default local due to missing configuration.');
return mapLocale(config.default || 'en_US'); // fall back to default

@@ -107,2 +107,3 @@ }

try {
invariant(typeof getLangLoader === 'function', 'Cannot load a bundle as no valid getLangLoader function has been set');
waitForLangChunk = getLangLoader(forLocale);

@@ -117,10 +118,7 @@ } catch (e) {

function loadBundle(resolve) {
if (!isFunction(getLangLoader)) {
throw new Error('Cannot load a bundle as no valid getLangLoader function has been set');
}
var waitForLangChunk = tryToGetLangLoader(locale());
invariant(typeof getLangLoader === 'function', 'Cannot load a bundle as no valid getLangLoader function has been set');
var waitForLangChunk = getLangLoader(locale());
waitForLangChunk(function (messages) {
singleton.messages = messages;
forEach(changeLocaleListeners, function (listener) {
changeLocaleListeners.forEach(function (listener) {
return listener();

@@ -127,0 +125,0 @@ });

import _objectSpread from "@babel/runtime/helpers/objectSpread";
import _typeof from "@babel/runtime/helpers/typeof";
import _last from "lodash/last";
import _find from "lodash/find";
import _last from "lodash/last";
import fs from 'fs';
import gettextParser from 'gettext-parser';
import fs from 'fs';
import invariant from 'invariant';
var DEFAULT_FUNCTION_NAME = 'i18n';

@@ -39,3 +41,7 @@ var DEFAULT_FILE_NAME = 'messages.pot';

if (isStringConcatExpr(node)) {
return getStringValue(node.left) + getStringValue(node.right);
var leftValue = getStringValue(node.left);
var rightValue = getStringValue(node.right);
invariant(leftValue, "Expected a string left value, but got ".concat(_typeof(leftValue), "."));
invariant(rightValue, "Expected a string right value, but got ".concat(_typeof(leftValue), "."));
return leftValue + rightValue;
}

@@ -120,3 +126,5 @@

if (base) {
base = "".concat(base.match(/^(.*?)\/*$/)[1], "/");
var match = base.match(/^(.*?)\/*$/);
invariant(match, 'Could not validate base directory');
base = "".concat(match[1], "/");
}

@@ -123,0 +131,0 @@

@@ -0,3 +1,4 @@

import fs from 'fs';
import path from 'path';
import fs from 'fs';
import invariant from 'invariant';
var I18NRC_FILENAME = '.i18nrc';

@@ -40,7 +41,4 @@ var existsCache = {};

var loc = findConfig(filename);
invariant(loc, 'Could not find .i18nrc');
if (!loc) {
throw new Error('Could not find .i18nrc');
}
if (configCache[loc]) {

@@ -47,0 +45,0 @@ return configCache[loc];

import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
import _objectSpread from "@babel/runtime/helpers/objectSpread";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
import _each from "lodash/each";
import glob from 'glob';
import invariant from 'invariant';
import ProgressBar from 'progress';

@@ -10,7 +10,3 @@ import { transformFileSync } from '@babel/core';

import getConfig from './config';
if (process.argv.length < 3) {
throw new Error("Invalid arguments, expected: 'node i18n/scripts/extract.js \"source_file_pattern\"', got: ".concat(process.argv.join(' ')));
}
invariant(process.argv.length >= 3, "Invalid arguments, expected: 'node i18n/scripts/extract.js \"source_file_pattern\"', got: ".concat(process.argv.join(' ')));
var files = glob.sync(process.argv[2]);

@@ -21,4 +17,3 @@ var progressBar = new ProgressBar(' extracting [:bar] :percent :fileName', {

});
_each(files, function (fileName) {
files.forEach(function (fileName) {
// eslint-disable-next-line no-console

@@ -25,0 +20,0 @@ progressBar.tick(1, {

@@ -1,12 +0,7 @@

import _each from "lodash/each";
import { exec } from 'child_process';
import path from 'path';
import { exec } from 'child_process';
if (process.argv.length < 4) {
throw new Error('Invalid arguments, expected: `node i18n/scripts/merge.js pot_file po_file ...`');
}
import invariant from 'invariant';
invariant(process.argv.length >= 4, 'Invalid arguments, expected: `node i18n/scripts/merge.js pot_file po_file ...`');
var templatePath = path.resolve(process.cwd(), process.argv[2]);
_each(process.argv.slice(3), function (fileName) {
process.argv.slice(3).forEach(function (fileName) {
exec("msgmerge -o ".concat(fileName, " ").concat(fileName, " ").concat(templatePath), function (error, stdout, stderr) {

@@ -13,0 +8,0 @@ // eslint-disable-next-line no-console

@@ -0,10 +1,10 @@

import _typeof from "@babel/runtime/helpers/typeof";
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
import _objectSpread from "@babel/runtime/helpers/objectSpread";
import isString from 'lodash/isString';
import invariant from 'invariant';
import escape from 'lodash/escape';
import forEach from 'lodash/forEach';
import has from 'lodash/has';
import isNumber from 'lodash/isNumber';
import isPlainObject from 'lodash/isPlainObject';
import forEach from 'lodash/forEach';
import pickBy from 'lodash/pickBy';
import has from 'lodash/has';
import escape from 'lodash/escape';
import marked from 'marked';

@@ -23,3 +23,3 @@ import React from 'react';

if (!finalOptions && isPlainObject(finalPlural)) {
if (!finalOptions && typeof plural !== 'string') {
finalOptions = plural;

@@ -42,5 +42,6 @@ finalPlural = undefined;

if (finalPlural && needsPlural(finalOptions)) {
translation = translatedPlural && isString(translatedPlural) ? translatedPlural : finalPlural;
invariant(typeof finalPlural === 'string', "Expted plural to be a string but was ".concat(_typeof(finalPlural)));
translation = translatedPlural && typeof translatedPlural === 'string' ? translatedPlural : finalPlural;
} else {
translation = translatedSingular && isString(translatedSingular) ? translatedSingular : text;
translation = translatedSingular && typeof translatedSingular === 'string' ? translatedSingular : text;
} // apply markdown processing if necessary

@@ -111,2 +112,6 @@

while ((match = placeholderRegex.exec(translation)) !== null) {
if (!match) {
break;
}
var key = match[1];

@@ -140,3 +145,3 @@ var component = options[key];

if (isString(element) && isString(lastAccumulatedElement)) {
if (typeof element === 'string' && typeof lastAccumulatedElement === 'string') {
// eslint-disable-next-line no-param-reassign

@@ -143,0 +148,0 @@ acc[acc.length - 1] = lastAccumulatedElement + element;

@@ -16,6 +16,4 @@ "use strict";

var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
var _invariant = _interopRequireDefault(require("invariant"));
var _forEach = _interopRequireDefault(require("lodash/forEach"));
var _translate = _interopRequireDefault(require("./translate"));

@@ -97,2 +95,3 @@

(0, _invariant.default)(config, 'could not determine default local due to missing configuration.');
return mapLocale(config.default || 'en_US'); // fall back to default

@@ -133,2 +132,3 @@ }

try {
(0, _invariant.default)(typeof getLangLoader === 'function', 'Cannot load a bundle as no valid getLangLoader function has been set');
waitForLangChunk = getLangLoader(forLocale);

@@ -143,10 +143,7 @@ } catch (e) {

function loadBundle(resolve) {
if (!(0, _isFunction.default)(getLangLoader)) {
throw new Error('Cannot load a bundle as no valid getLangLoader function has been set');
}
var waitForLangChunk = tryToGetLangLoader(locale());
(0, _invariant.default)(typeof getLangLoader === 'function', 'Cannot load a bundle as no valid getLangLoader function has been set');
var waitForLangChunk = getLangLoader(locale());
waitForLangChunk(function (messages) {
singleton.messages = messages;
(0, _forEach.default)(changeLocaleListeners, function (listener) {
changeLocaleListeners.forEach(function (listener) {
return listener();

@@ -153,0 +150,0 @@ });

@@ -12,10 +12,14 @@ "use strict";

var _find2 = _interopRequireDefault(require("lodash/find"));
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
var _last2 = _interopRequireDefault(require("lodash/last"));
var _gettextParser = _interopRequireDefault(require("gettext-parser"));
var _find2 = _interopRequireDefault(require("lodash/find"));
var _fs = _interopRequireDefault(require("fs"));
var _gettextParser = _interopRequireDefault(require("gettext-parser"));
var _invariant = _interopRequireDefault(require("invariant"));
var DEFAULT_FUNCTION_NAME = 'i18n';

@@ -54,3 +58,7 @@ var DEFAULT_FILE_NAME = 'messages.pot';

if (isStringConcatExpr(node)) {
return getStringValue(node.left) + getStringValue(node.right);
var leftValue = getStringValue(node.left);
var rightValue = getStringValue(node.right);
(0, _invariant.default)(leftValue, "Expected a string left value, but got ".concat((0, _typeof2.default)(leftValue), "."));
(0, _invariant.default)(rightValue, "Expected a string right value, but got ".concat((0, _typeof2.default)(leftValue), "."));
return leftValue + rightValue;
}

@@ -136,3 +144,5 @@

if (base) {
base = "".concat(base.match(/^(.*?)\/*$/)[1], "/");
var match = base.match(/^(.*?)\/*$/);
(0, _invariant.default)(match, 'Could not validate base directory');
base = "".concat(match[1], "/");
}

@@ -139,0 +149,0 @@

@@ -10,5 +10,7 @@ "use strict";

var _fs = _interopRequireDefault(require("fs"));
var _path = _interopRequireDefault(require("path"));
var _fs = _interopRequireDefault(require("fs"));
var _invariant = _interopRequireDefault(require("invariant"));

@@ -52,7 +54,4 @@ var I18NRC_FILENAME = '.i18nrc';

var loc = findConfig(filename);
(0, _invariant.default)(loc, 'Could not find .i18nrc');
if (!loc) {
throw new Error('Could not find .i18nrc');
}
if (configCache[loc]) {

@@ -59,0 +58,0 @@ return configCache[loc];

@@ -11,6 +11,6 @@ "use strict";

var _each2 = _interopRequireDefault(require("lodash/each"));
var _glob = _interopRequireDefault(require("glob"));
var _invariant = _interopRequireDefault(require("invariant"));
var _progress = _interopRequireDefault(require("progress"));

@@ -24,5 +24,3 @@

if (process.argv.length < 3) {
throw new Error("Invalid arguments, expected: 'node i18n/scripts/extract.js \"source_file_pattern\"', got: ".concat(process.argv.join(' ')));
}
(0, _invariant.default)(process.argv.length >= 3, "Invalid arguments, expected: 'node i18n/scripts/extract.js \"source_file_pattern\"', got: ".concat(process.argv.join(' ')));

@@ -35,3 +33,3 @@ var files = _glob.default.sync(process.argv[2]);

});
(0, _each2.default)(files, function (fileName) {
files.forEach(function (fileName) {
// eslint-disable-next-line no-console

@@ -38,0 +36,0 @@ progressBar.tick(1, {

@@ -5,15 +5,13 @@ "use strict";

var _each2 = _interopRequireDefault(require("lodash/each"));
var _child_process = require("child_process");
var _path = _interopRequireDefault(require("path"));
var _child_process = require("child_process");
var _invariant = _interopRequireDefault(require("invariant"));
if (process.argv.length < 4) {
throw new Error('Invalid arguments, expected: `node i18n/scripts/merge.js pot_file po_file ...`');
}
(0, _invariant.default)(process.argv.length >= 4, 'Invalid arguments, expected: `node i18n/scripts/merge.js pot_file po_file ...`');
var templatePath = _path.default.resolve(process.cwd(), process.argv[2]);
(0, _each2.default)(process.argv.slice(3), function (fileName) {
process.argv.slice(3).forEach(function (fileName) {
(0, _child_process.exec)("msgmerge -o ".concat(fileName, " ").concat(fileName, " ").concat(templatePath), function (error, stdout, stderr) {

@@ -20,0 +18,0 @@ // eslint-disable-next-line no-console

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

var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));

@@ -15,16 +17,14 @@

var _isString = _interopRequireDefault(require("lodash/isString"));
var _invariant = _interopRequireDefault(require("invariant"));
var _isNumber = _interopRequireDefault(require("lodash/isNumber"));
var _escape = _interopRequireDefault(require("lodash/escape"));
var _isPlainObject = _interopRequireDefault(require("lodash/isPlainObject"));
var _forEach = _interopRequireDefault(require("lodash/forEach"));
var _pickBy = _interopRequireDefault(require("lodash/pickBy"));
var _has = _interopRequireDefault(require("lodash/has"));
var _escape = _interopRequireDefault(require("lodash/escape"));
var _isNumber = _interopRequireDefault(require("lodash/isNumber"));
var _pickBy = _interopRequireDefault(require("lodash/pickBy"));
var _marked = _interopRequireDefault(require("marked"));

@@ -46,3 +46,3 @@

if (!finalOptions && (0, _isPlainObject.default)(finalPlural)) {
if (!finalOptions && typeof plural !== 'string') {
finalOptions = plural;

@@ -65,5 +65,6 @@ finalPlural = undefined;

if (finalPlural && needsPlural(finalOptions)) {
translation = translatedPlural && (0, _isString.default)(translatedPlural) ? translatedPlural : finalPlural;
(0, _invariant.default)(typeof finalPlural === 'string', "Expted plural to be a string but was ".concat((0, _typeof2.default)(finalPlural)));
translation = translatedPlural && typeof translatedPlural === 'string' ? translatedPlural : finalPlural;
} else {
translation = translatedSingular && (0, _isString.default)(translatedSingular) ? translatedSingular : text;
translation = translatedSingular && typeof translatedSingular === 'string' ? translatedSingular : text;
} // apply markdown processing if necessary

@@ -136,2 +137,6 @@

while ((match = placeholderRegex.exec(translation)) !== null) {
if (!match) {
break;
}
var key = match[1];

@@ -165,3 +170,3 @@ var component = options[key];

if ((0, _isString.default)(element) && (0, _isString.default)(lastAccumulatedElement)) {
if (typeof element === 'string' && typeof lastAccumulatedElement === 'string') {
// eslint-disable-next-line no-param-reassign

@@ -168,0 +173,0 @@ acc[acc.length - 1] = lastAccumulatedElement + element;

{
"name": "signavio-i18n",
"version": "2.0.1",
"version": "2.1.0-0",
"description": "Minimalist gettext style i18n for JavaScript",

@@ -20,2 +20,3 @@ "main": "lib/index.js",

"build:es6": "cross-env NODE_ENV=production BABEL_ENV=es6 babel src --out-dir lib-es6",
"postbuild": "flow-copy-source src lib && flow-copy-source src lib-es6",
"clean": "rimraf lib lib-es6",

@@ -47,2 +48,3 @@ "coverage": "cross-env NODE_ENV=coverage nyc --reporter=lcov --reporter=text yarn test",

"glob": "^6.0.1",
"invariant": "^2.2.4",
"lodash": "^4.0.0",

@@ -89,3 +91,4 @@ "marked": "^0.3.5",

"eslint-plugin-mocha": "^4.7.0",
"flow-bin": "^0.65.0",
"flow-bin": "0.100.0",
"flow-copy-source": "2.0.6",
"istanbul-instrumenter-loader": "^2.0.0",

@@ -99,2 +102,3 @@ "jsdom": "^9.12.0",

"po2json": "^0.4.2",
"prettier": "1.17.1",
"react": "^16.2.0",

@@ -101,0 +105,0 @@ "react-dom": "^16.2.0",

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