i18next-fs-backend
Advanced tools
Comparing version 1.1.4 to 1.1.5
@@ -14,3 +14,3 @@ "use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
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); } | ||
@@ -17,0 +17,0 @@ var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/; |
@@ -18,3 +18,3 @@ "use strict"; | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
@@ -21,0 +21,0 @@ var getDefaults = function getDefaults() { |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
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); } | ||
@@ -98,2 +98,12 @@ Object.defineProperty(exports, "__esModule", { | ||
var replaceLast = function replaceLast(str, find, replace) { | ||
var index = str.lastIndexOf(find); | ||
if (index > -1) { | ||
return str.substring(0, index) + replace + str.substring(index + find.length); | ||
} | ||
return str.toString(); | ||
}; | ||
var parseData = function parseData(extension, data, options) { | ||
@@ -108,5 +118,5 @@ data = data.replace(/^\uFEFF/, ''); | ||
if (data.indexOf('exports') > -1) { | ||
data = "(".concat(data.substring(data.indexOf('=') + 1).replace(/;/, ''), ")"); | ||
data = "(".concat(replaceLast(data.substring(data.indexOf('=') + 1), '};', ''), ")"); | ||
} else if (data.indexOf('export default ') > -1) { | ||
data = "(".concat(data.substring(data.indexOf('export default ') + 15).replace(/;/, ''), ")"); | ||
data = "(".concat(replaceLast(data.substring(data.indexOf('export default ') + 15), '};', ''), ")"); | ||
} | ||
@@ -113,0 +123,0 @@ } |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
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); } | ||
@@ -5,0 +5,0 @@ Object.defineProperty(exports, "__esModule", { |
@@ -7,3 +7,3 @@ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
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); } | ||
@@ -10,0 +10,0 @@ var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/; |
@@ -5,3 +5,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
@@ -8,0 +8,0 @@ import { defaults, debounce, getPath, setPath, pushPath } from './utils.js'; |
@@ -77,2 +77,12 @@ import JSON5 from './formats/json5.js'; | ||
var replaceLast = function replaceLast(str, find, replace) { | ||
var index = str.lastIndexOf(find); | ||
if (index > -1) { | ||
return str.substring(0, index) + replace + str.substring(index + find.length); | ||
} | ||
return str.toString(); | ||
}; | ||
var parseData = function parseData(extension, data, options) { | ||
@@ -87,5 +97,5 @@ data = data.replace(/^\uFEFF/, ''); | ||
if (data.indexOf('exports') > -1) { | ||
data = "(".concat(data.substring(data.indexOf('=') + 1).replace(/;/, ''), ")"); | ||
data = "(".concat(replaceLast(data.substring(data.indexOf('=') + 1), '};', ''), ")"); | ||
} else if (data.indexOf('export default ') > -1) { | ||
data = "(".concat(data.substring(data.indexOf('export default ') + 15).replace(/;/, ''), ")"); | ||
data = "(".concat(replaceLast(data.substring(data.indexOf('export default ') + 15), '};', ''), ")"); | ||
} | ||
@@ -92,0 +102,0 @@ } |
@@ -125,3 +125,3 @@ import { defaults, debounce, getPath, setPath, pushPath } from './utils.js' | ||
const filename = this.services.interpolator.interpolate(addPath, { lng: lng, ns: namespace }) | ||
const filename = this.services.interpolator.interpolate(addPath, { lng, ns: namespace }) | ||
@@ -128,0 +128,0 @@ const missings = getPath(this.queuedWrites, [lng, namespace]) |
@@ -57,2 +57,10 @@ import JSON5 from './formats/json5.js' | ||
const replaceLast = (str, find, replace) => { | ||
const index = str.lastIndexOf(find) | ||
if (index > -1) { | ||
return str.substring(0, index) + replace + str.substring(index + find.length) | ||
} | ||
return str.toString() | ||
} | ||
const parseData = (extension, data, options) => { | ||
@@ -66,5 +74,5 @@ data = data.replace(/^\uFEFF/, '') | ||
if (data.indexOf('exports') > -1) { // just to try... | ||
data = `(${data.substring(data.indexOf('=') + 1).replace(/;/, '')})` | ||
data = `(${replaceLast(data.substring(data.indexOf('=') + 1), '};', '')})` | ||
} else if (data.indexOf('export default ') > -1) { // just to try... | ||
data = `(${data.substring(data.indexOf('export default ') + 15).replace(/;/, '')})` | ||
data = `(${replaceLast(data.substring(data.indexOf('export default ') + 15), '};', '')})` | ||
} | ||
@@ -71,0 +79,0 @@ } |
{ | ||
"name": "i18next-fs-backend", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"private": false, | ||
@@ -22,19 +22,19 @@ "type": "module", | ||
"devDependencies": { | ||
"@babel/cli": "7.16.0", | ||
"@babel/core": "7.16.0", | ||
"@babel/preset-env": "7.16.0", | ||
"@babel/cli": "7.18.10", | ||
"@babel/core": "7.18.10", | ||
"@babel/preset-env": "7.18.10", | ||
"babel-plugin-add-module-exports": "1.0.4", | ||
"eslint": "7.32.0", | ||
"eslint-config-standard": "16.0.3", | ||
"eslint-plugin-import": "2.25.3", | ||
"eslint-plugin-node": "11.1.0", | ||
"eslint-plugin-promise": "5.1.1", | ||
"eslint": "8.21.0", | ||
"eslint-config-standard": "17.0.0", | ||
"eslint-plugin-import": "2.26.0", | ||
"eslint-plugin-n": "15.2.4", | ||
"eslint-plugin-promise": "6.0.0", | ||
"eslint-plugin-require-path-exists": "1.1.9", | ||
"eslint-plugin-standard": "5.0.0", | ||
"expect.js": "0.3.1", | ||
"i18next": "21.4.2", | ||
"i18next": "21.8.16", | ||
"js-yaml": "4.1.0", | ||
"json5": "2.2.0", | ||
"mocha": "9.1.3", | ||
"uglify-js": "3.14.3" | ||
"json5": "2.2.1", | ||
"mocha": "10.0.0", | ||
"uglify-js": "3.16.3" | ||
}, | ||
@@ -41,0 +41,0 @@ "description": "i18next-fs-backend is a backend layer for i18next using in Node.js and for Deno to load translations from the filesystem.", |
@@ -17,2 +17,3 @@ # Introduction | ||
- .yml/.yaml | ||
- .js/.ts (very limited, checks for `exports` or `export default`) | ||
@@ -19,0 +20,0 @@ # Getting started |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
486931
13704
130
0