Socket
Socket
Sign inDemoInstall

i18next-scanner

Package Overview
Dependencies
116
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.0 to 4.1.0

16

lib/acorn-jsx-walk.js

@@ -7,13 +7,7 @@ "use strict";

exports["default"] = void 0;
var _acornWalk = require("acorn-walk");
var _acornDynamicImport = require("acorn-dynamic-import");
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
Object.assign(_acornWalk.base, _defineProperty({

@@ -25,5 +19,6 @@ FieldDefinition: function FieldDefinition(node, state, callback) {

}
}, _acornDynamicImport.DynamicImportKey, function () {})); // Extends acorn walk with JSX elements
}, _acornDynamicImport.DynamicImportKey, function () {}));
// Extends acorn walk with JSX elements
// https://github.com/RReverser/acorn-jsx/issues/23#issuecomment-403753801
Object.assign(_acornWalk.base, {

@@ -43,3 +38,4 @@ JSXAttribute: function JSXAttribute(node, state, callback) {

},
JSXEmptyExpression: function JSXEmptyExpression(node, state, callback) {// Comments. Just ignore.
JSXEmptyExpression: function JSXEmptyExpression(node, state, callback) {
// Comments. Just ignore.
},

@@ -59,7 +55,5 @@ JSXExpressionContainer: function JSXExpressionContainer(node, state, callback) {

});
var _default = function _default(ast, options) {
(0, _acornWalk.simple)(ast, _objectSpread({}, options));
};
exports["default"] = _default;

@@ -7,7 +7,4 @@ "use strict";

exports["default"] = void 0;
var _isPlainObject = _interopRequireDefault(require("lodash/isPlainObject"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
// flattenObjectKeys({

@@ -37,4 +34,3 @@ // a: {

};
var _default = flattenObjectKeys;
exports["default"] = _default;
"use strict";
var _fs = _interopRequireDefault(require("fs"));
var _path = _interopRequireDefault(require("path"));
var _eol = _interopRequireDefault(require("eol"));
var _get = _interopRequireDefault(require("lodash/get"));
var _includes = _interopRequireDefault(require("lodash/includes"));
var _vinyl = _interopRequireDefault(require("vinyl"));
var _through = _interopRequireDefault(require("through2"));
var _parser = _interopRequireDefault(require("./parser"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/* eslint-disable import/no-import-module-exports */
/* eslint-disable import/no-import-module-exports */
var transform = function transform(parser, customTransform) {
return function _transform(file, enc, done) {
var options = parser.options;
var content = _fs["default"].readFileSync(file.path, enc);
var extname = _path["default"].extname(file.path);
if ((0, _includes["default"])((0, _get["default"])(options, 'attr.extensions'), extname)) {

@@ -38,3 +27,2 @@ // Parse attribute (e.g. data-i18n="key")

}
if ((0, _includes["default"])((0, _get["default"])(options, 'func.extensions'), extname)) {

@@ -48,3 +36,2 @@ // Parse translation function (e.g. i18next.t('key'))

}
if ((0, _includes["default"])((0, _get["default"])(options, 'trans.extensions'), extname)) {

@@ -58,3 +45,2 @@ // Look for Trans components in JSX

}
if (typeof customTransform === 'function') {

@@ -65,13 +51,9 @@ this.parser = parser;

}
done();
};
};
var flush = function flush(parser, customFlush) {
return function _flush(done) {
var _this = this;
var options = parser.options;
if (typeof customFlush === 'function') {

@@ -81,5 +63,5 @@ this.parser = parser;

return;
} // Flush to resource store
}
// Flush to resource store
var resStore = parser.get({

@@ -96,3 +78,2 @@ sort: options.sort

var text = JSON.stringify(obj, null, jsonIndent) + '\n';
if (lineEnding === 'auto') {

@@ -110,5 +91,3 @@ text = _eol["default"].auto(text);

}
var contents = null;
try {

@@ -130,26 +109,24 @@ // "Buffer.from(string[, encoding])" is added in Node.js v5.10.0

};
}; // @param {object} options The options object.
};
// @param {object} options The options object.
// @param {function} [customTransform]
// @param {function} [customFlush]
// @return {object} Returns a through2.obj().
var createStream = function createStream(options, customTransform, customFlush) {
var parser = new _parser["default"](options);
var stream = _through["default"].obj(transform(parser, customTransform), flush(parser, customFlush));
return stream;
}; // Convenience API
};
// Convenience API
module.exports = function () {
var _module$exports;
return (_module$exports = module.exports).createStream.apply(_module$exports, arguments);
}; // Basic API
};
// Basic API
module.exports.createStream = createStream;
module.exports.createStream = createStream; // Parser
// Parser
module.exports.Parser = _parser["default"];

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

exports["default"] = void 0;
var _ensureType = require("ensure-type");
var _get2 = _interopRequireDefault(require("lodash/get"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var isJSXText = function isJSXText(node) {

@@ -19,6 +15,4 @@ if (!node) {

}
return node.type === 'JSXText';
};
var isNumericLiteral = function isNumericLiteral(node) {

@@ -28,6 +22,4 @@ if (!node) {

}
return node.type === 'Literal' && typeof node.value === 'number';
};
var isStringLiteral = function isStringLiteral(node) {

@@ -37,6 +29,4 @@ if (!node) {

}
return node.type === 'Literal' && typeof node.value === 'string';
};
var isObjectExpression = function isObjectExpression(node) {

@@ -46,6 +36,4 @@ if (!node) {

}
return node.type === 'ObjectExpression';
};
var trimValue = function trimValue(value) {

@@ -57,3 +45,2 @@ return (0, _ensureType.ensureString)(value).replace(/^[\r\n]+\s*/g, '') // remove leading spaces containing a leading newline character

var nodesToString = function nodesToString(nodes, options) {

@@ -66,3 +53,2 @@ var supportBasicHtmlNodes = (0, _ensureType.ensureBoolean)(options === null || options === void 0 ? void 0 : options.supportBasicHtmlNodes);

}
return true;

@@ -74,12 +60,9 @@ });

var value = trimValue(node.value);
if (!value) {
return;
}
memo += value;
} else if (node.type === 'JSXExpressionContainer') {
var _node$expression = node.expression,
expression = _node$expression === void 0 ? {} : _node$expression;
expression = _node$expression === void 0 ? {} : _node$expression;
if (isNumericLiteral(expression)) {

@@ -89,3 +72,2 @@ // Numeric literal is ignored in react-i18next

}
if (isStringLiteral(expression)) {

@@ -102,3 +84,2 @@ memo += expression.value;

var _node$openingElement, _node$openingElement$, _node$openingElement2, _node$openingElement3, _node$openingElement4, _node$openingElement5;
var nodeType = (_node$openingElement = node.openingElement) === null || _node$openingElement === void 0 ? void 0 : (_node$openingElement$ = _node$openingElement.name) === null || _node$openingElement$ === void 0 ? void 0 : _node$openingElement$.name;

@@ -111,3 +92,2 @@ var selfClosing = (_node$openingElement2 = node.openingElement) === null || _node$openingElement2 === void 0 ? void 0 : _node$openingElement2.selfClosing;

}
return true;

@@ -118,3 +98,2 @@ });

var shouldKeepChild = supportBasicHtmlNodes && keepBasicHtmlNodesFor.indexOf((_node$openingElement4 = node.openingElement) === null || _node$openingElement4 === void 0 ? void 0 : (_node$openingElement5 = _node$openingElement4.name) === null || _node$openingElement5 === void 0 ? void 0 : _node$openingElement5.name) > -1;
if (selfClosing && shouldKeepChild && attributeCount === 0) {

@@ -140,4 +119,3 @@ // actual e.g. lorem <br/> ipsum

};
var _default = nodesToString;
exports["default"] = _default;

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

exports["default"] = void 0;
var _isPlainObject = _interopRequireDefault(require("lodash/isPlainObject"));
var _cloneDeep = _interopRequireDefault(require("clone-deep"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
// omitEmptyObject({

@@ -34,5 +30,3 @@ // a: {

}
unsetEmptyObject(obj[key]);
if ((0, _isPlainObject["default"])(obj[key]) && Object.keys(obj[key]).length === 0) {

@@ -45,8 +39,6 @@ obj[key] = undefined;

};
var omitEmptyObject = function omitEmptyObject(obj) {
return unsetEmptyObject((0, _cloneDeep["default"])(obj));
};
var _default = omitEmptyObject;
exports["default"] = _default;
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", {

@@ -9,82 +8,47 @@ value: true

exports["default"] = void 0;
var _fs = _interopRequireDefault(require("fs"));
var acorn = _interopRequireWildcard(require("acorn"));
var _acornJsx = _interopRequireDefault(require("acorn-jsx"));
var _acornStage = _interopRequireDefault(require("acorn-stage3"));
var _chalk = _interopRequireDefault(require("chalk"));
var _cloneDeep = _interopRequireDefault(require("clone-deep"));
var _deepmerge = _interopRequireDefault(require("deepmerge"));
var _ensureType = require("ensure-type");
var _esprimaNext = require("esprima-next");
var _fs = _interopRequireDefault(require("fs"));
var _i18next = _interopRequireDefault(require("i18next"));
var _lodash = _interopRequireDefault(require("lodash"));
var _parse = _interopRequireDefault(require("parse5"));
var _sortobject = _interopRequireDefault(require("sortobject"));
var _i18next = _interopRequireDefault(require("i18next"));
var _acornJsxWalk = _interopRequireDefault(require("./acorn-jsx-walk"));
var _flattenObjectKeys = _interopRequireDefault(require("./flatten-object-keys"));
var _nodesToString = _interopRequireDefault(require("./nodes-to-string"));
var _omitEmptyObject = _interopRequireDefault(require("./omit-empty-object"));
var _nodesToString = _interopRequireDefault(require("./nodes-to-string"));
var _excluded = ["replacer", "space"];
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
_i18next["default"].init({
compatibilityJSON: 'v3'
});
var defaults = {
debug: false,
// verbose logging
sort: false,
// sort keys in alphabetical order
attr: {

@@ -116,5 +80,5 @@ // HTML attributes to parse

// Check out https://github.com/acornjs/acorn/tree/master/acorn#interface for additional options
}
},
lngs: ['en'],

@@ -124,10 +88,15 @@ // array of supported languages

// language to lookup key if not found while calling `parser.get(key, { lng: '' })`
ns: [],
// string or array of namespaces
defaultLng: 'en',
// default language used for checking default values
defaultNs: 'translation',
// default namespace used if not passed to translation function
defaultValue: '',
// default value used if not passed to `parser.set`
// resource

@@ -149,2 +118,3 @@ resource: {

// char to split namespace from key
// Context Form

@@ -159,2 +129,3 @@ context: true,

// list of values for dynamic values
// Plural Form

@@ -167,2 +138,3 @@ plural: true,

// char to split plural from key
// interpolation options

@@ -173,10 +145,10 @@ interpolation: {

suffix: '}}' // suffix for interpolation
},
},
metadata: {},
// additional custom options
allowDynamicKeys: false // allow Dynamic Keys
};
}; // http://codereview.stackexchange.com/questions/45991/balanced-parentheses
// http://codereview.stackexchange.com/questions/45991/balanced-parentheses
var matchBalancedParentheses = function matchBalancedParentheses() {

@@ -190,3 +162,2 @@ var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';

str = '' + str; // ensure string
for (i = 0; i < str.length; ++i) {

@@ -196,9 +167,6 @@ if (start >= 0 && stack.length === 0) {

}
bracePosition = parentheses.indexOf(str[i]);
if (bracePosition < 0) {
continue;
}
if (bracePosition % 2 === 0) {

@@ -210,6 +178,4 @@ if (start < 0) {

stack.push(bracePosition + 1); // push next expected brace position
continue;
}
if (stack.pop() !== bracePosition) {

@@ -219,6 +185,4 @@ return str.substring(start, i);

}
return str.substring(start, i);
};
var normalizeOptions = function normalizeOptions(options) {

@@ -229,17 +193,15 @@ // Attribute

}
if (_lodash["default"].isUndefined(_lodash["default"].get(options, 'attr.extensions'))) {
_lodash["default"].set(options, 'attr.extensions', defaults.attr.extensions);
} // Function
}
// Function
if (_lodash["default"].isUndefined(_lodash["default"].get(options, 'func.list'))) {
_lodash["default"].set(options, 'func.list', defaults.func.list);
}
if (_lodash["default"].isUndefined(_lodash["default"].get(options, 'func.extensions'))) {
_lodash["default"].set(options, 'func.extensions', defaults.func.extensions);
} // Trans
}
// Trans
if (_lodash["default"].get(options, 'trans')) {

@@ -249,88 +211,72 @@ if (_lodash["default"].isUndefined(_lodash["default"].get(options, 'trans.component'))) {

}
if (_lodash["default"].isUndefined(_lodash["default"].get(options, 'trans.i18nKey'))) {
_lodash["default"].set(options, 'trans.i18nKey', defaults.trans.i18nKey);
}
if (_lodash["default"].isUndefined(_lodash["default"].get(options, 'trans.defaultsKey'))) {
_lodash["default"].set(options, 'trans.defaultsKey', defaults.trans.defaultsKey);
}
if (_lodash["default"].isUndefined(_lodash["default"].get(options, 'trans.extensions'))) {
_lodash["default"].set(options, 'trans.extensions', defaults.trans.extensions);
}
if (_lodash["default"].isUndefined(_lodash["default"].get(options, 'trans.fallbackKey'))) {
_lodash["default"].set(options, 'trans.fallbackKey', defaults.trans.fallbackKey);
}
if (_lodash["default"].isUndefined(_lodash["default"].get(options, 'trans.acorn'))) {
_lodash["default"].set(options, 'trans.acorn', defaults.trans.acorn);
}
if (_lodash["default"].isUndefined(_lodash["default"].get(options, 'trans.supportBasicHtmlNodes'))) {
_lodash["default"].set(options, 'trans.supportBasicHtmlNodes', defaults.trans.supportBasicHtmlNodes);
}
if (_lodash["default"].isUndefined(_lodash["default"].get(options, 'trans.keepBasicHtmlNodesFor'))) {
_lodash["default"].set(options, 'trans.keepBasicHtmlNodesFor', defaults.trans.keepBasicHtmlNodesFor);
}
} // Resource
}
// Resource
if (_lodash["default"].isUndefined(_lodash["default"].get(options, 'resource.loadPath'))) {
_lodash["default"].set(options, 'resource.loadPath', defaults.resource.loadPath);
}
if (_lodash["default"].isUndefined(_lodash["default"].get(options, 'resource.savePath'))) {
_lodash["default"].set(options, 'resource.savePath', defaults.resource.savePath);
}
if (_lodash["default"].isUndefined(_lodash["default"].get(options, 'resource.jsonIndent'))) {
_lodash["default"].set(options, 'resource.jsonIndent', defaults.resource.jsonIndent);
}
if (_lodash["default"].isUndefined(_lodash["default"].get(options, 'resource.lineEnding'))) {
_lodash["default"].set(options, 'resource.lineEnding', defaults.resource.lineEnding);
} // Accept both nsseparator or nsSeparator
}
// Accept both nsseparator or nsSeparator
if (!_lodash["default"].isUndefined(options.nsseparator)) {
options.nsSeparator = options.nsseparator;
delete options.nsseparator;
} // Allowed only string or false
}
// Allowed only string or false
if (!_lodash["default"].isString(options.nsSeparator)) {
options.nsSeparator = false;
} // Accept both keyseparator or keySeparator
}
// Accept both keyseparator or keySeparator
if (!_lodash["default"].isUndefined(options.keyseparator)) {
options.keySeparator = options.keyseparator;
delete options.keyseparator;
} // Allowed only string or false
}
// Allowed only string or false
if (!_lodash["default"].isString(options.keySeparator)) {
options.keySeparator = false;
}
if (!_lodash["default"].isArray(options.ns)) {
options.ns = [options.ns];
}
options.ns = _lodash["default"].union(_lodash["default"].flatten(options.ns.concat(options.defaultNs)));
return options;
}; // Get an array of plural suffixes for a given language.
};
// Get an array of plural suffixes for a given language.
// @param {string} lng The language.
// @param {string} pluralSeparator pluralSeparator, default '_'.
// @return {array} An array of plural suffixes.
var getPluralSuffixes = function getPluralSuffixes(lng) {
var pluralSeparator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '_';
var rule = _i18next["default"].services.pluralResolver.getRule(lng);
if (!(rule && rule.numbers)) {

@@ -343,7 +289,5 @@ return []; // Return an empty array if lng is not supported

}
if (rule.numbers.length === 2) {
return ['', "".concat(pluralSeparator, "plural")];
}
var suffixes = rule.numbers.reduce(function (acc, n, i) {

@@ -354,2 +298,3 @@ return acc.concat("".concat(pluralSeparator).concat(i));

};
/**

@@ -359,21 +304,16 @@ * Creates a new parser

*/
var Parser = /*#__PURE__*/function () {
// The resStore stores all translation keys including unused ones
// The resScan only stores translation keys parsed from code
// The all plurals suffixes for each of target languages.
function Parser(options) {
var _this = this;
_classCallCheck(this, Parser);
_defineProperty(this, "options", _objectSpread({}, defaults));
_defineProperty(this, "resStore", {});
_defineProperty(this, "resScan", {});
_defineProperty(this, "pluralSuffixes", {});
this.options = normalizeOptions(_objectSpread(_objectSpread({}, this.options), options));

@@ -386,13 +326,9 @@ var lngs = this.options.lngs;

_this.pluralSuffixes[lng] = (0, _ensureType.ensureArray)(getPluralSuffixes(lng, _this.options.pluralSeparator));
if (_this.pluralSuffixes[lng].length === 0) {
_this.log("No plural rule found for: ".concat(lng));
}
namespaces.forEach(function (ns) {
var resPath = _this.formatResourceLoadPath(lng, ns);
_this.resStore[lng][ns] = {};
_this.resScan[lng][ns] = {};
try {

@@ -404,3 +340,2 @@ if (_fs["default"].existsSync(resPath)) {

_this.error("Unable to load resource file ".concat(_chalk["default"].yellow(JSON.stringify(resPath)), ": lng=").concat(lng, ", ns=").concat(ns));
_this.error(err);

@@ -412,3 +347,2 @@ }

}
_createClass(Parser, [{

@@ -418,3 +352,2 @@ key: "log",

var debug = this.options.debug;
if (debug) {

@@ -424,3 +357,2 @@ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {

}
console.log.apply(this, [_chalk["default"].cyan('i18next-scanner:')].concat(args));

@@ -435,3 +367,2 @@ }

}
console.error.apply(this, [_chalk["default"].red('i18next-scanner:')].concat(args));

@@ -463,8 +394,4 @@ }

var options = this.options;
var fixedString = _lodash["default"].trim(strToFix); // Remove leading and trailing whitespace
var firstChar = fixedString[0];
if (firstChar === '`' && fixedString.match(/\${.*?}/)) {

@@ -479,21 +406,23 @@ if (options.allowDynamicKeys && fixedString.endsWith('}`')) {

}
if (_lodash["default"].includes(['\'', '"', '`'], firstChar)) {
// Remove first and last character
fixedString = fixedString.slice(1, -1);
} // restore multiline strings
}
// restore multiline strings
fixedString = fixedString.replace(/(\\\n|\\\r\n)/g, '');
fixedString = fixedString.replace(/(\\\n|\\\r\n)/g, ''); // JavaScript character escape sequences
// JavaScript character escape sequences
// https://mathiasbynens.be/notes/javascript-escapes
// Single character escape sequences
// Note: IE < 9 treats '\v' as 'v' instead of a vertical tab ('\x0B'). If cross-browser compatibility is a concern, use \x0B instead of \v.
// Another thing to note is that the \v and \0 escapes are not allowed in JSON strings.
fixedString = fixedString.replace(/(\\b|\\f|\\n|\\r|\\t|\\v|\\0|\\\\|\\"|\\')/g, function (match) {
return eval("\"".concat(match, "\""));
}); // * Octal escapes have been deprecated in ES5.
});
// * Octal escapes have been deprecated in ES5.
// * Hexadecimal escape sequences: \\x[a-fA-F0-9]{2}
// * Unicode escape sequences: \\u[a-fA-F0-9]{4}
fixedString = fixedString.replace(/(\\x[a-fA-F0-9]{2}|\\u[a-fA-F0-9]{4})/g, function (match) {

@@ -508,7 +437,5 @@ return eval("\"".concat(match, "\""));

var _this2 = this;
return props.reduce(function (acc, prop) {
if (prop.type !== 'ObjectMethod') {
var value = _this2.optionsBuilder(prop.value);
if (value !== undefined) {

@@ -518,3 +445,2 @@ return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, prop.key.name, value));

}
return acc;

@@ -527,3 +453,2 @@ }, {});

var _this3 = this;
return elements.reduce(function (acc, element) {

@@ -550,3 +475,5 @@ return [].concat(_toConsumableArray(acc), [_this3.optionsBuilder(element)]);

}
} // i18next.t('ns:foo.bar') // matched
}
// i18next.t('ns:foo.bar') // matched
// i18next.t("ns:foo.bar") // matched

@@ -556,3 +483,2 @@ // i18next.t('ns:foo.bar') // matched

// i18next.t("ns:foo.bar" + str); // not matched
}, {

@@ -562,6 +488,4 @@ key: "parseFuncFromString",

var _this4 = this;
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var customHandler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
if (_lodash["default"].isFunction(opts)) {

@@ -571,17 +495,17 @@ customHandler = opts;

}
var funcs = opts.list !== undefined ? (0, _ensureType.ensureArray)(opts.list) : (0, _ensureType.ensureArray)(this.options.func.list);
if (funcs.length === 0) {
return this;
}
var matchFuncs = funcs.map(function (func) {
return '(?:' + func + ')';
}).join('|').replace(/\./g, '\\.'); // `\s` matches a single whitespace character, which includes spaces, tabs, form feeds, line feeds and other unicode spaces.
}).join('|').replace(/\./g, '\\.');
// `\s` matches a single whitespace character, which includes spaces, tabs, form feeds, line feeds and other unicode spaces.
var matchSpecialCharacters = '[\\r\\n\\s]*';
var stringGroup = matchSpecialCharacters + '(' + // backtick (``)
'`(?:[^`\\\\]|\\\\(?:.|$))*`' + '|' + // double quotes ("")
'"(?:[^"\\\\]|\\\\(?:.|$))*"' + '|' + // single quote ('')
var stringGroup = matchSpecialCharacters + '(' +
// backtick (``)
'`(?:[^`\\\\]|\\\\(?:.|$))*`' + '|' +
// double quotes ("")
'"(?:[^"\\\\]|\\\\(?:.|$))*"' + '|' +
// single quote ('')
'\'(?:[^\'\\\\]|\\\\(?:.|$))*\'' + ')' + matchSpecialCharacters;

@@ -591,39 +515,28 @@ var pattern = '(?:(?:^\\s*)|[^a-zA-Z0-9_])' + '(?:' + matchFuncs + ')' + '\\(' + stringGroup + '(?:[\\,]' + stringGroup + ')?' + '[\\,\\)]';

var r;
var _loop = function _loop() {
var options = {};
var full = r[0];
var key = _this4.fixStringAfterRegExp(r[1], true);
if (!key) {
return "continue";
}
if (r[2] !== undefined) {
var defaultValue = _this4.fixStringAfterRegExp(r[2], false);
if (!defaultValue) {
return "continue";
}
options.defaultValue = defaultValue;
}
var endsWithComma = full[full.length - 1] === ',';
if (endsWithComma) {
var _opts = _objectSpread({}, opts),
propsFilter = _opts.propsFilter;
propsFilter = _opts.propsFilter;
var code = matchBalancedParentheses(content.substr(re.lastIndex));
if (typeof propsFilter === 'function') {
code = propsFilter(code);
}
try {
var syntax = code.trim() !== '' ? (0, _esprimaNext.parse)('(' + code + ')') : {};
var props = _lodash["default"].get(syntax, 'body[0].expression.properties') || []; // http://i18next.com/docs/options/
var props = _lodash["default"].get(syntax, 'body[0].expression.properties') || [];
// http://i18next.com/docs/options/
var supportedOptions = ['defaultValue', 'defaultValue_plural', 'count', 'context', 'ns', 'keySeparator', 'nsSeparator', 'metadata'];

@@ -637,7 +550,5 @@ props.forEach(function (prop) {

_this4.error("Unable to parse code \"".concat(code, "\""));
_this4.error(err);
}
}
if (customHandler) {

@@ -647,16 +558,13 @@ customHandler(key, options);

}
_this4.set(key, options);
};
while (r = re.exec(content)) {
var _ret = _loop();
if (_ret === "continue") continue;
}
return this;
}
return this;
} // Parses translation keys from `Trans` components in JSX
// Parses translation keys from `Trans` components in JSX
// <Trans i18nKey="some.key">Default text</Trans>
}, {

@@ -666,6 +574,4 @@ key: "parseTransFromString",

var _this5 = this;
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var customHandler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
if (_lodash["default"].isFunction(opts)) {

@@ -675,20 +581,18 @@ customHandler = opts;

}
var _opts2 = _objectSpread({}, opts),
_opts2$transformOptio = _opts2.transformOptions,
transformOptions = _opts2$transformOptio === void 0 ? {} : _opts2$transformOptio,
_opts2$component = _opts2.component,
component = _opts2$component === void 0 ? this.options.trans.component : _opts2$component,
_opts2$i18nKey = _opts2.i18nKey,
i18nKey = _opts2$i18nKey === void 0 ? this.options.trans.i18nKey : _opts2$i18nKey,
_opts2$defaultsKey = _opts2.defaultsKey,
defaultsKey = _opts2$defaultsKey === void 0 ? this.options.trans.defaultsKey : _opts2$defaultsKey,
fallbackKey = _opts2.fallbackKey,
_opts2$acorn = _opts2.acorn,
acornOptions = _opts2$acorn === void 0 ? this.options.trans.acorn : _opts2$acorn,
_opts2$supportBasicHt = _opts2.supportBasicHtmlNodes,
supportBasicHtmlNodes = _opts2$supportBasicHt === void 0 ? this.options.trans.supportBasicHtmlNodes : _opts2$supportBasicHt,
_opts2$keepBasicHtmlN = _opts2.keepBasicHtmlNodesFor,
keepBasicHtmlNodesFor = _opts2$keepBasicHtmlN === void 0 ? this.options.trans.keepBasicHtmlNodesFor : _opts2$keepBasicHtmlN;
_opts2$transformOptio = _opts2.transformOptions,
transformOptions = _opts2$transformOptio === void 0 ? {} : _opts2$transformOptio,
_opts2$component = _opts2.component,
component = _opts2$component === void 0 ? this.options.trans.component : _opts2$component,
_opts2$i18nKey = _opts2.i18nKey,
i18nKey = _opts2$i18nKey === void 0 ? this.options.trans.i18nKey : _opts2$i18nKey,
_opts2$defaultsKey = _opts2.defaultsKey,
defaultsKey = _opts2$defaultsKey === void 0 ? this.options.trans.defaultsKey : _opts2$defaultsKey,
fallbackKey = _opts2.fallbackKey,
_opts2$acorn = _opts2.acorn,
acornOptions = _opts2$acorn === void 0 ? this.options.trans.acorn : _opts2$acorn,
_opts2$supportBasicHt = _opts2.supportBasicHtmlNodes,
supportBasicHtmlNodes = _opts2$supportBasicHt === void 0 ? this.options.trans.supportBasicHtmlNodes : _opts2$supportBasicHt,
_opts2$keepBasicHtmlN = _opts2.keepBasicHtmlNodesFor,
keepBasicHtmlNodesFor = _opts2$keepBasicHtmlN === void 0 ? this.options.trans.keepBasicHtmlNodesFor : _opts2$keepBasicHtmlN;
var parseJSXElement = function parseJSXElement(node, code) {

@@ -698,16 +602,11 @@ if (!node) {

}
(0, _ensureType.ensureArray)(node.openingElement.attributes).forEach(function (attribute) {
var value = attribute.value;
if (!(value && value.type === 'JSXExpressionContainer')) {
return;
}
var expression = value.expression;
if (!(expression && expression.type === 'JSXElement')) {
return;
}
parseJSXElement(expression, code);

@@ -720,7 +619,5 @@ });

});
if (node.openingElement.name.name !== component) {
return;
}
var attr = (0, _ensureType.ensureArray)(node.openingElement.attributes).reduce(function (acc, attribute) {

@@ -730,20 +627,19 @@ if (attribute.type !== 'JSXAttribute' || attribute.name.type !== 'JSXIdentifier') {

}
var name = attribute.name.name;
if (attribute.value.type === 'Literal') {
acc[name] = attribute.value.value;
} else if (attribute.value.type === 'JSXExpressionContainer') {
var expression = attribute.value.expression; // Identifier
var expression = attribute.value.expression;
// Identifier
if (expression.type === 'Identifier') {
acc[name] = expression.name;
} // Literal
}
// Literal
if (expression.type === 'Literal') {
acc[name] = expression.value;
} // Object Expression
}
// Object Expression
if (expression.type === 'ObjectExpression') {

@@ -762,8 +658,7 @@ var properties = (0, _ensureType.ensureArray)(expression.properties);

}
return obj;
}, {});
} // Template Literal
}
// Template Literal
if (expression.type === 'TemplateLiteral') {

@@ -775,17 +670,12 @@ acc[name] = expression.quasis.map(function (element) {

}
return acc;
}, {});
var transKey = _lodash["default"].trim(attr[i18nKey]);
var defaultsString = attr[defaultsKey] || '';
if (typeof defaultsString !== 'string') {
_this5.log("defaults value must be a static string, saw ".concat(_chalk["default"].yellow(defaultsString)));
} // https://www.i18next.com/translation-function/essentials#overview-options
}
// https://www.i18next.com/translation-function/essentials#overview-options
var tOptions = attr.tOptions;
var options = _objectSpread(_objectSpread({}, tOptions), {}, {

@@ -799,7 +689,5 @@ defaultValue: defaultsString || (0, _nodesToString["default"])(node.children, {

});
if (Object.prototype.hasOwnProperty.call(attr, 'count')) {
options.count = Number(attr.count) || 0;
}
if (Object.prototype.hasOwnProperty.call(attr, 'ns')) {

@@ -809,6 +697,4 @@ if (typeof attr.ns !== 'string') {

}
options.ns = attr.ns;
}
if (customHandler) {

@@ -818,6 +704,4 @@ customHandler(transKey, options);

}
_this5.set(transKey, options);
};
try {

@@ -840,8 +724,8 @@ var ast = acorn.Parser.extend(_acornStage["default"], (0, _acornJsx["default"])()).parse(content, _objectSpread(_objectSpread({}, defaults.trans.acorn), acornOptions));

}
return this;
}
return this;
} // Parses translation keys from `data-i18n` attribute in HTML
// Parses translation keys from `data-i18n` attribute in HTML
// <div data-i18n="[attr]ns:foo.bar;[attr]ns:foo.baz">
// </div>
}, {

@@ -853,3 +737,2 @@ key: "parseAttrFromString",

var setter = this.set.bind(this);
if (_lodash["default"].isFunction(opts)) {

@@ -861,18 +744,12 @@ setter = opts;

}
var attrs = opts.list !== undefined ? (0, _ensureType.ensureArray)(opts.list) : (0, _ensureType.ensureArray)(this.options.attr.list);
if (attrs.length === 0) {
return this;
}
var ast = _parse["default"].parse(content);
var parseAttributeValue = function parseAttributeValue(key) {
key = _lodash["default"].trim(key);
if (key.length === 0) {
return;
}
if (key.indexOf('[') === 0) {

@@ -882,10 +759,7 @@ var parts = key.split(']');

}
if (key.indexOf(';') === key.length - 1) {
key = key.substr(0, key.length - 2);
}
setter(key);
};
var walk = function walk(nodes) {

@@ -901,7 +775,5 @@ nodes.forEach(function (node) {

}
if (node.childNodes) {
walk(node.childNodes);
}
if (node.content && node.content.childNodes) {

@@ -912,6 +784,7 @@ walk(node.content.childNodes);

};
walk(ast.childNodes);
return this;
} // Get the value of a translation key or the whole resource store containing translation information
}
// Get the value of a translation key or the whole resource store containing translation information
// @param {string} [key] The translation key

@@ -922,3 +795,2 @@ // @param {object} [opts] The opts object

// @return {object}
}, {

@@ -928,5 +800,3 @@ key: "get",

var _this6 = this;
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (_lodash["default"].isPlainObject(key)) {

@@ -936,5 +806,3 @@ opts = key;

}
var resStore = {};
if (this.options.removeUnusedKeys) {

@@ -947,12 +815,9 @@ // Merge two objects `resStore` and `resScan` deeply, returning a new merged object with the elements from both `resStore` and `resScan`.

var resScanKeys = (0, _flattenObjectKeys["default"])(_lodash["default"].get(_this6.resScan, [lng, ns], {}));
var unusedKeys = _lodash["default"].differenceWith(resStoreKeys, resScanKeys, _lodash["default"].isEqual);
for (var i = 0; i < unusedKeys.length; ++i) {
_lodash["default"].unset(resMerged[lng][ns], unusedKeys[i]);
_this6.log("Removed an unused translation key { ".concat(_chalk["default"].red(JSON.stringify(unusedKeys[i])), " from ").concat(_chalk["default"].red(JSON.stringify(_this6.formatResourceLoadPath(lng, ns)))));
} // Omit empty object
}
// Omit empty object
resMerged[lng][ns] = (0, _omitEmptyObject["default"])(resMerged[lng][ns]);

@@ -965,3 +830,2 @@ });

}
if (opts.sort) {

@@ -976,5 +840,6 @@ Object.keys(resStore).forEach(function (lng) {

}
if (!_lodash["default"].isUndefined(key)) {
var ns = this.options.defaultNs;
if (!_lodash["default"].isUndefined(key)) {
var ns = this.options.defaultNs; // http://i18next.com/translate/keyBasedFallback/
// http://i18next.com/translate/keyBasedFallback/
// Set nsSeparator and keySeparator to false if you prefer

@@ -992,3 +857,2 @@ // having keys as the fallback for translation.

}
var keys = _lodash["default"].isString(this.options.keySeparator) ? key.split(this.options.keySeparator) : [key];

@@ -999,3 +863,2 @@ var lng = opts.lng ? opts.lng : this.options.fallbackLng;

var x = 0;
while (keys[x]) {

@@ -1005,8 +868,8 @@ value = value && value[keys[x]];

}
return value;
}
return resStore;
}
return resStore;
} // Set translation key with an optional defaultValue to i18n resource store
// Set translation key with an optional defaultValue to i18n resource store
// @param {string} key The translation key

@@ -1021,3 +884,2 @@ // @param {object} [options] The options object

// @param {string|boolean} [options.keySeparator] The value used to override this.options.keySeparator
}, {

@@ -1027,5 +889,3 @@ key: "set",

var _this7 = this;
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
// Backward compatibility

@@ -1038,7 +898,8 @@ if (_lodash["default"].isString(options)) {

}
var nsSeparator = options.nsSeparator !== undefined ? options.nsSeparator : this.options.nsSeparator;
var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
var ns = options.ns || this.options.defaultNs;
console.assert(_lodash["default"].isString(ns) && !!ns.length, 'ns is not a valid string', ns); // http://i18next.com/translate/keyBasedFallback/
console.assert(_lodash["default"].isString(ns) && !!ns.length, 'ns is not a valid string', ns);
// http://i18next.com/translate/keyBasedFallback/
// Set nsSeparator and keySeparator to false if you prefer

@@ -1056,5 +917,3 @@ // having keys as the fallback for translation.

}
var keys = [];
if (key) {

@@ -1067,7 +926,5 @@ keys = _lodash["default"].isString(keySeparator) ? key.split(keySeparator) : [key];

}
if (typeof options.fallbackKey === 'function') {
key = options.fallbackKey(ns, options.defaultValue);
}
if (!key) {

@@ -1077,31 +934,25 @@ // Ignore empty key

}
keys = [key];
}
var _this$options = this.options,
lngs = _this$options.lngs,
context = _this$options.context,
contextFallback = _this$options.contextFallback,
contextSeparator = _this$options.contextSeparator,
contextDefaultValues = _this$options.contextDefaultValues,
plural = _this$options.plural,
pluralFallback = _this$options.pluralFallback,
pluralSeparator = _this$options.pluralSeparator,
defaultLng = _this$options.defaultLng,
defaultValue = _this$options.defaultValue;
lngs = _this$options.lngs,
context = _this$options.context,
contextFallback = _this$options.contextFallback,
contextSeparator = _this$options.contextSeparator,
contextDefaultValues = _this$options.contextDefaultValues,
plural = _this$options.plural,
pluralFallback = _this$options.pluralFallback,
pluralSeparator = _this$options.pluralSeparator,
defaultLng = _this$options.defaultLng,
defaultValue = _this$options.defaultValue;
lngs.forEach(function (lng) {
var resLoad = _this7.resStore[lng] && _this7.resStore[lng][ns];
var resScan = _this7.resScan[lng] && _this7.resScan[lng][ns];
if (!_lodash["default"].isPlainObject(resLoad)) {
// Skip undefined namespace
_this7.error("".concat(_chalk["default"].yellow(JSON.stringify(ns)), " does not exist in the namespaces (").concat(_chalk["default"].yellow(JSON.stringify(_this7.options.ns)), "): key=").concat(_chalk["default"].yellow(JSON.stringify(key)), ", options=").concat(_chalk["default"].yellow(JSON.stringify(options))));
return;
}
Object.keys(keys).forEach(function (index) {
var key = keys[index];
if (index < keys.length - 1) {

@@ -1113,3 +964,5 @@ resLoad[key] = resLoad[key] || {};

return; // continue
} // Context & Plural
}
// Context & Plural
// http://i18next.com/translate/context/

@@ -1131,6 +984,5 @@ // http://i18next.com/translate/pluralSimple/

// }
var resKeys = [];
var resKeys = []; // http://i18next.com/translate/context/
// http://i18next.com/translate/context/
var containsContext = function () {

@@ -1140,11 +992,9 @@ if (!context) {

}
if (_lodash["default"].isUndefined(options.context)) {
return false;
}
return _lodash["default"].isFunction(context) ? context(lng, ns, key, options) : !!context;
}(); // http://i18next.com/translate/pluralSimple/
}();
// http://i18next.com/translate/pluralSimple/
var containsPlural = function () {

@@ -1154,10 +1004,7 @@ if (!plural) {

}
if (_lodash["default"].isUndefined(options.count)) {
return false;
}
return _lodash["default"].isFunction(plural) ? plural(lng, ns, key, options) : !!plural;
}();
var contextValues = function () {

@@ -1167,10 +1014,7 @@ if (options.context !== '') {

}
if ((0, _ensureType.ensureArray)(contextDefaultValues).length > 0) {
return (0, _ensureType.ensureArray)(contextDefaultValues);
}
return [];
}();
if (containsPlural) {

@@ -1181,3 +1025,2 @@ var suffixes = pluralFallback ? _this7.pluralSuffixes[lng] : _this7.pluralSuffixes[lng].slice(1);

});
if (containsContext && containsPlural) {

@@ -1194,3 +1037,2 @@ suffixes.forEach(function (pluralSuffix) {

}
if (containsContext) {

@@ -1202,3 +1044,2 @@ contextValues.forEach(function (contextValue) {

}
resKeys.forEach(function (resKey) {

@@ -1212,3 +1053,2 @@ if (resLoad[resKey] === undefined) {

}
_this7.log("Added a new translation key { ".concat(_chalk["default"].yellow(JSON.stringify(resKey)), ": ").concat(_chalk["default"].yellow(JSON.stringify(resLoad[resKey])), " } to ").concat(_chalk["default"].yellow(JSON.stringify(_this7.formatResourceLoadPath(lng, ns)))));

@@ -1221,3 +1061,3 @@ } else if (options.defaultValue && (!options.defaultValue_plural || !resKey.endsWith("".concat(pluralSeparator, "plural")))) {

// A default value has provided but it's different with the expected default
_this7.log("The translation key ".concat(_chalk["default"].yellow(JSON.stringify(resKey)), " has a different default value, you may need to check the translation key of default language (").concat(defaultLng, ")"));
_this7.log("The translation key ".concat(_chalk["default"].yellow(JSON.stringify(resKey)), ", with a default value of \"").concat(_chalk["default"].yellow(options.defaultValue), "\" has a different default value, you may need to check the translation key of default language (").concat(defaultLng, ")"));
}

@@ -1230,6 +1070,5 @@ } else if (options.defaultValue_plural && resKey.endsWith("".concat(pluralSeparator, "plural"))) {

// A default value has provided but it's different with the expected default
_this7.log("The translation key ".concat(_chalk["default"].yellow(JSON.stringify(resKey)), " has a different default value, you may need to check the translation key of default language (").concat(defaultLng, ")"));
_this7.log("The translation key ".concat(_chalk["default"].yellow(JSON.stringify(resKey)), ", with a default value of \"").concat(_chalk["default"].yellow(options.defaultValue_plural), "\" has a different default value, you may need to check the translation key of default language (").concat(defaultLng, ")"));
}
}
resScan[resKey] = resLoad[resKey];

@@ -1239,3 +1078,5 @@ });

});
} // Returns a JSON string containing translation information
}
// Returns a JSON string containing translation information
// @param {object} [options] The options object

@@ -1246,3 +1087,2 @@ // @param {boolean} [options.sort] True to sort object by key

// @return {string}
}, {

@@ -1252,15 +1092,11 @@ key: "toJSON",

var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var replacer = options.replacer,
space = options.space,
others = _objectWithoutProperties(options, _excluded);
space = options.space,
others = _objectWithoutProperties(options, _excluded);
return JSON.stringify(this.get(others), replacer, space);
}
}]);
return Parser;
}();
var _default = Parser;
exports["default"] = _default;
{
"name": "i18next-scanner",
"version": "4.0.0",
"version": "4.1.0",
"description": "Scan your code, extract translation keys/values, and merge them into i18n resource files.",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/i18next/i18next-scanner",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc