i18next-xhr-backend
Advanced tools
Comparing version 1.2.1 to 1.3.0
@@ -0,1 +1,5 @@ | ||
### 1.3.0 | ||
- add support for custom headers [PR250](https://github.com/i18next/i18next-xhr-backend/pull/250) | ||
- update dev dependencies | ||
### 1.2.1 | ||
@@ -2,0 +6,0 @@ - downgrade babel-preset-es2015-native-modules to correctly build es files |
@@ -31,2 +31,8 @@ 'use strict'; | ||
} | ||
var h = options.customHeaders; | ||
if (h) { | ||
for (var i in h) { | ||
x.setRequestHeader(i, h[i]); | ||
} | ||
} | ||
x.onreadystatechange = function () { | ||
@@ -37,3 +43,3 @@ x.readyState > 3 && callback && callback(x.responseText, x); | ||
} catch (e) { | ||
window.console && console.log(e); | ||
console && console.log(e); | ||
} | ||
@@ -40,0 +46,0 @@ } |
@@ -25,2 +25,8 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
} | ||
var h = options.customHeaders; | ||
if (h) { | ||
for (var i in h) { | ||
x.setRequestHeader(i, h[i]); | ||
} | ||
} | ||
x.onreadystatechange = function () { | ||
@@ -31,3 +37,3 @@ x.readyState > 3 && callback && callback(x.responseText, x); | ||
} catch (e) { | ||
window.console && console.log(e); | ||
console && console.log(e); | ||
} | ||
@@ -34,0 +40,0 @@ } |
@@ -5,293 +5,164 @@ (function (global, factory) { | ||
(global.i18nextXHRBackend = factory()); | ||
}(this, function () { 'use strict'; | ||
}(this, (function () { 'use strict'; | ||
var arr = []; | ||
var each = arr.forEach; | ||
var slice = arr.slice; | ||
var arr = []; | ||
var each = arr.forEach; | ||
var slice = arr.slice; | ||
function defaults(obj) { | ||
each.call(slice.call(arguments, 1), function (source) { | ||
if (source) { | ||
for (var prop in source) { | ||
if (obj[prop] === undefined) obj[prop] = source[prop]; | ||
} | ||
function defaults(obj) { | ||
each.call(slice.call(arguments, 1), function (source) { | ||
if (source) { | ||
for (var prop in source) { | ||
if (obj[prop] === undefined) obj[prop] = source[prop]; | ||
} | ||
}); | ||
return obj; | ||
} | ||
} | ||
}); | ||
return obj; | ||
} | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var asyncGenerator = function () { | ||
function AwaitValue(value) { | ||
this.value = value; | ||
// https://gist.github.com/Xeoncross/7663273 | ||
function ajax(url, options, callback, data, cache) { | ||
// Must encode data | ||
if (data && (typeof data === 'undefined' ? 'undefined' : _typeof(data)) === 'object') { | ||
var y = '', | ||
e = encodeURIComponent; | ||
for (var m in data) { | ||
y += '&' + e(m) + '=' + e(data[m]); | ||
} | ||
data = y.slice(1) + (!cache ? '&_t=' + new Date() : ''); | ||
} | ||
function AsyncGenerator(gen) { | ||
var front, back; | ||
function send(key, arg) { | ||
return new Promise(function (resolve, reject) { | ||
var request = { | ||
key: key, | ||
arg: arg, | ||
resolve: resolve, | ||
reject: reject, | ||
next: null | ||
}; | ||
if (back) { | ||
back = back.next = request; | ||
} else { | ||
front = back = request; | ||
resume(key, arg); | ||
} | ||
}); | ||
try { | ||
var x = new (XMLHttpRequest || ActiveXObject)('MSXML2.XMLHTTP.3.0'); | ||
x.open(data ? 'POST' : 'GET', url, 1); | ||
if (!options.crossDomain) { | ||
x.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); | ||
} | ||
x.withCredentials = !!options.withCredentials; | ||
if (data) { | ||
x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); | ||
} | ||
var h = options.customHeaders; | ||
if (h) { | ||
for (var i in h) { | ||
x.setRequestHeader(i, h[i]); | ||
} | ||
function resume(key, arg) { | ||
try { | ||
var result = gen[key](arg); | ||
var value = result.value; | ||
if (value instanceof AwaitValue) { | ||
Promise.resolve(value.value).then(function (arg) { | ||
resume("next", arg); | ||
}, function (arg) { | ||
resume("throw", arg); | ||
}); | ||
} else { | ||
settle(result.done ? "return" : "normal", result.value); | ||
} | ||
} catch (err) { | ||
settle("throw", err); | ||
} | ||
} | ||
function settle(type, value) { | ||
switch (type) { | ||
case "return": | ||
front.resolve({ | ||
value: value, | ||
done: true | ||
}); | ||
break; | ||
case "throw": | ||
front.reject(value); | ||
break; | ||
default: | ||
front.resolve({ | ||
value: value, | ||
done: false | ||
}); | ||
break; | ||
} | ||
front = front.next; | ||
if (front) { | ||
resume(front.key, front.arg); | ||
} else { | ||
back = null; | ||
} | ||
} | ||
this._invoke = send; | ||
if (typeof gen.return !== "function") { | ||
this.return = undefined; | ||
} | ||
} | ||
if (typeof Symbol === "function" && Symbol.asyncIterator) { | ||
AsyncGenerator.prototype[Symbol.asyncIterator] = function () { | ||
return this; | ||
}; | ||
} | ||
AsyncGenerator.prototype.next = function (arg) { | ||
return this._invoke("next", arg); | ||
x.onreadystatechange = function () { | ||
x.readyState > 3 && callback && callback(x.responseText, x); | ||
}; | ||
x.send(data); | ||
} catch (e) { | ||
console && console.log(e); | ||
} | ||
} | ||
AsyncGenerator.prototype.throw = function (arg) { | ||
return this._invoke("throw", arg); | ||
}; | ||
var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
AsyncGenerator.prototype.return = function (arg) { | ||
return this._invoke("return", arg); | ||
}; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
return { | ||
wrap: function (fn) { | ||
return function () { | ||
return new AsyncGenerator(fn.apply(this, arguments)); | ||
}; | ||
}, | ||
await: function (value) { | ||
return new AwaitValue(value); | ||
} | ||
}; | ||
}(); | ||
var classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
function getDefaults() { | ||
return { | ||
loadPath: '/locales/{{lng}}/{{ns}}.json', | ||
addPath: 'locales/add/{{lng}}/{{ns}}', | ||
allowMultiLoading: false, | ||
parse: JSON.parse, | ||
crossDomain: false, | ||
ajax: ajax | ||
}; | ||
} | ||
var createClass = 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); | ||
} | ||
} | ||
var Backend = function () { | ||
function Backend(services) { | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
return function (Constructor, protoProps, staticProps) { | ||
if (protoProps) defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
}; | ||
}(); | ||
_classCallCheck(this, Backend); | ||
// https://gist.github.com/Xeoncross/7663273 | ||
function ajax(url, options, callback, data, cache) { | ||
// Must encode data | ||
if (data && (typeof data === 'undefined' ? 'undefined' : _typeof(data)) === 'object') { | ||
var y = '', | ||
e = encodeURIComponent; | ||
for (var m in data) { | ||
y += '&' + e(m) + '=' + e(data[m]); | ||
} | ||
data = y.slice(1) + (!cache ? '&_t=' + new Date() : ''); | ||
} | ||
this.init(services, options); | ||
try { | ||
var x = new (XMLHttpRequest || ActiveXObject)('MSXML2.XMLHTTP.3.0'); | ||
x.open(data ? 'POST' : 'GET', url, 1); | ||
if (!options.crossDomain) { | ||
x.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); | ||
} | ||
x.withCredentials = !!options.withCredentials; | ||
if (data) { | ||
x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); | ||
} | ||
x.onreadystatechange = function () { | ||
x.readyState > 3 && callback && callback(x.responseText, x); | ||
}; | ||
x.send(data); | ||
} catch (e) { | ||
window.console && console.log(e); | ||
} | ||
this.type = 'backend'; | ||
} | ||
function getDefaults() { | ||
return { | ||
loadPath: '/locales/{{lng}}/{{ns}}.json', | ||
addPath: 'locales/add/{{lng}}/{{ns}}', | ||
allowMultiLoading: false, | ||
parse: JSON.parse, | ||
crossDomain: false, | ||
ajax: ajax | ||
}; | ||
} | ||
var Backend = function () { | ||
function Backend(services) { | ||
_createClass(Backend, [{ | ||
key: 'init', | ||
value: function init(services) { | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
classCallCheck(this, Backend); | ||
this.init(services, options); | ||
this.type = 'backend'; | ||
this.services = services; | ||
this.options = defaults(options, this.options || {}, getDefaults()); | ||
} | ||
}, { | ||
key: 'readMulti', | ||
value: function readMulti(languages, namespaces, callback) { | ||
var loadPath = this.options.loadPath; | ||
if (typeof this.options.loadPath === 'function') { | ||
loadPath = this.options.loadPath(languages, namespaces); | ||
} | ||
createClass(Backend, [{ | ||
key: 'init', | ||
value: function init(services) { | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var url = this.services.interpolator.interpolate(loadPath, { lng: languages.join('+'), ns: namespaces.join('+') }); | ||
this.services = services; | ||
this.options = defaults(options, this.options || {}, getDefaults()); | ||
this.loadUrl(url, callback); | ||
} | ||
}, { | ||
key: 'read', | ||
value: function read(language, namespace, callback) { | ||
var loadPath = this.options.loadPath; | ||
if (typeof this.options.loadPath === 'function') { | ||
loadPath = this.options.loadPath([language], [namespace]); | ||
} | ||
}, { | ||
key: 'readMulti', | ||
value: function readMulti(languages, namespaces, callback) { | ||
var loadPath = this.options.loadPath; | ||
if (typeof this.options.loadPath === 'function') { | ||
loadPath = this.options.loadPath(languages, namespaces); | ||
} | ||
var url = this.services.interpolator.interpolate(loadPath, { lng: languages.join('+'), ns: namespaces.join('+') }); | ||
var url = this.services.interpolator.interpolate(loadPath, { lng: language, ns: namespace }); | ||
this.loadUrl(url, callback); | ||
} | ||
}, { | ||
key: 'read', | ||
value: function read(language, namespace, callback) { | ||
var loadPath = this.options.loadPath; | ||
if (typeof this.options.loadPath === 'function') { | ||
loadPath = this.options.loadPath([language], [namespace]); | ||
} | ||
this.loadUrl(url, callback); | ||
} | ||
}, { | ||
key: 'loadUrl', | ||
value: function loadUrl(url, callback) { | ||
var _this = this; | ||
var url = this.services.interpolator.interpolate(loadPath, { lng: language, ns: namespace }); | ||
this.options.ajax(url, this.options, function (data, xhr) { | ||
if (xhr.status >= 500 && xhr.status < 600) return callback('failed loading ' + url, true /* retry */); | ||
if (xhr.status >= 400 && xhr.status < 500) return callback('failed loading ' + url, false /* no retry */); | ||
this.loadUrl(url, callback); | ||
} | ||
}, { | ||
key: 'loadUrl', | ||
value: function loadUrl(url, callback) { | ||
var _this = this; | ||
var ret = void 0, | ||
err = void 0; | ||
try { | ||
ret = _this.options.parse(data, url); | ||
} catch (e) { | ||
err = 'failed parsing ' + url + ' to json'; | ||
} | ||
if (err) return callback(err, false); | ||
callback(null, ret); | ||
}); | ||
} | ||
}, { | ||
key: 'create', | ||
value: function create(languages, namespace, key, fallbackValue) { | ||
var _this2 = this; | ||
this.options.ajax(url, this.options, function (data, xhr) { | ||
if (xhr.status >= 500 && xhr.status < 600) return callback('failed loading ' + url, true /* retry */); | ||
if (xhr.status >= 400 && xhr.status < 500) return callback('failed loading ' + url, false /* no retry */); | ||
if (typeof languages === 'string') languages = [languages]; | ||
var ret = void 0, | ||
err = void 0; | ||
try { | ||
ret = _this.options.parse(data, url); | ||
} catch (e) { | ||
err = 'failed parsing ' + url + ' to json'; | ||
} | ||
if (err) return callback(err, false); | ||
callback(null, ret); | ||
}); | ||
} | ||
}, { | ||
key: 'create', | ||
value: function create(languages, namespace, key, fallbackValue) { | ||
var _this2 = this; | ||
var payload = {}; | ||
payload[key] = fallbackValue || ''; | ||
if (typeof languages === 'string') languages = [languages]; | ||
languages.forEach(function (lng) { | ||
var url = _this2.services.interpolator.interpolate(_this2.options.addPath, { lng: lng, ns: namespace }); | ||
var payload = {}; | ||
payload[key] = fallbackValue || ''; | ||
_this2.options.ajax(url, _this2.options, function (data, xhr) { | ||
//const statusCode = xhr.status.toString(); | ||
// TODO: if statusCode === 4xx do log | ||
}, payload); | ||
}); | ||
} | ||
}]); | ||
languages.forEach(function (lng) { | ||
var url = _this2.services.interpolator.interpolate(_this2.options.addPath, { lng: lng, ns: namespace }); | ||
return Backend; | ||
}(); | ||
_this2.options.ajax(url, _this2.options, function (data, xhr) { | ||
//const statusCode = xhr.status.toString(); | ||
// TODO: if statusCode === 4xx do log | ||
}, payload); | ||
}); | ||
} | ||
}]); | ||
return Backend; | ||
}(); | ||
Backend.type = 'backend'; | ||
Backend.type = 'backend'; | ||
return Backend; | ||
return Backend; | ||
})); | ||
}))); |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.i18nextXHRBackend=n()}(this,function(){"use strict";function t(t){return i.call(r.call(arguments,1),function(n){if(n)for(var e in n)void 0===t[e]&&(t[e]=n[e])}),t}function n(t,n,e,o,i){if(o&&"object"===("undefined"==typeof o?"undefined":a(o))){var r="",s=encodeURIComponent;for(var u in o)r+="&"+s(u)+"="+s(o[u]);o=r.slice(1)+(i?"":"&_t="+new Date)}try{var c=new(XMLHttpRequest||ActiveXObject)("MSXML2.XMLHTTP.3.0");c.open(o?"POST":"GET",t,1),n.crossDomain||c.setRequestHeader("X-Requested-With","XMLHttpRequest"),c.withCredentials=!!n.withCredentials,o&&c.setRequestHeader("Content-type","application/x-www-form-urlencoded"),c.onreadystatechange=function(){c.readyState>3&&e&&e(c.responseText,c)},c.send(o)}catch(t){window.console&&console.log(t)}}function e(){return{loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"locales/add/{{lng}}/{{ns}}",allowMultiLoading:!1,parse:JSON.parse,crossDomain:!1,ajax:n}}var o=[],i=o.forEach,r=o.slice,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s=(function(){function t(t){this.value=t}function n(n){function e(t,n){return new Promise(function(e,i){var s={key:t,arg:n,resolve:e,reject:i,next:null};a?a=a.next=s:(r=a=s,o(t,n))})}function o(e,r){try{var a=n[e](r),s=a.value;s instanceof t?Promise.resolve(s.value).then(function(t){o("next",t)},function(t){o("throw",t)}):i(a.done?"return":"normal",a.value)}catch(t){i("throw",t)}}function i(t,n){switch(t){case"return":r.resolve({value:n,done:!0});break;case"throw":r.reject(n);break;default:r.resolve({value:n,done:!1})}r=r.next,r?o(r.key,r.arg):a=null}var r,a;this._invoke=e,"function"!=typeof n.return&&(this.return=void 0)}return"function"==typeof Symbol&&Symbol.asyncIterator&&(n.prototype[Symbol.asyncIterator]=function(){return this}),n.prototype.next=function(t){return this._invoke("next",t)},n.prototype.throw=function(t){return this._invoke("throw",t)},n.prototype.return=function(t){return this._invoke("return",t)},{wrap:function(t){return function(){return new n(t.apply(this,arguments))}},await:function(n){return new t(n)}}}(),function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}),u=function(){function t(t,n){for(var e=0;e<n.length;e++){var o=n[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(n,e,o){return e&&t(n.prototype,e),o&&t(n,o),n}}(),c=function(){function n(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s(this,n),this.init(t,e),this.type="backend"}return u(n,[{key:"init",value:function(n){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.services=n,this.options=t(o,this.options||{},e())}},{key:"readMulti",value:function(t,n,e){var o=this.options.loadPath;"function"==typeof this.options.loadPath&&(o=this.options.loadPath(t,n));var i=this.services.interpolator.interpolate(o,{lng:t.join("+"),ns:n.join("+")});this.loadUrl(i,e)}},{key:"read",value:function(t,n,e){var o=this.options.loadPath;"function"==typeof this.options.loadPath&&(o=this.options.loadPath([t],[n]));var i=this.services.interpolator.interpolate(o,{lng:t,ns:n});this.loadUrl(i,e)}},{key:"loadUrl",value:function(t,n){var e=this;this.options.ajax(t,this.options,function(o,i){if(i.status>=500&&i.status<600)return n("failed loading "+t,!0);if(i.status>=400&&i.status<500)return n("failed loading "+t,!1);var r=void 0,a=void 0;try{r=e.options.parse(o,t)}catch(n){a="failed parsing "+t+" to json"}return a?n(a,!1):void n(null,r)})}},{key:"create",value:function(t,n,e,o){var i=this;"string"==typeof t&&(t=[t]);var r={};r[e]=o||"",t.forEach(function(t){var e=i.services.interpolator.interpolate(i.options.addPath,{lng:t,ns:n});i.options.ajax(e,i.options,function(t,n){},r)})}}]),n}();return c.type="backend",c}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.i18nextXHRBackend=e()}(this,function(){"use strict";function t(t){return a.call(r.call(arguments,1),function(e){if(e)for(var n in e)void 0===t[n]&&(t[n]=e[n])}),t}function e(t,e,n,o,i){if(o&&"object"===("undefined"==typeof o?"undefined":s(o))){var a="",r=encodeURIComponent;for(var l in o)a+="&"+r(l)+"="+r(o[l]);o=a.slice(1)+(i?"":"&_t="+new Date)}try{var u=new(XMLHttpRequest||ActiveXObject)("MSXML2.XMLHTTP.3.0");u.open(o?"POST":"GET",t,1),e.crossDomain||u.setRequestHeader("X-Requested-With","XMLHttpRequest"),u.withCredentials=!!e.withCredentials,o&&u.setRequestHeader("Content-type","application/x-www-form-urlencoded");var c=e.customHeaders;if(c)for(var f in c)u.setRequestHeader(f,c[f]);u.onreadystatechange=function(){u.readyState>3&&n&&n(u.responseText,u)},u.send(o)}catch(t){console&&console.log(t)}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(){return{loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"locales/add/{{lng}}/{{ns}}",allowMultiLoading:!1,parse:JSON.parse,crossDomain:!1,ajax:e}}var i=[],a=i.forEach,r=i.slice,s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),u=function(){function e(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n(this,e),this.init(t,o),this.type="backend"}return l(e,[{key:"init",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.services=e,this.options=t(n,this.options||{},o())}},{key:"readMulti",value:function(t,e,n){var o=this.options.loadPath;"function"==typeof this.options.loadPath&&(o=this.options.loadPath(t,e));var i=this.services.interpolator.interpolate(o,{lng:t.join("+"),ns:e.join("+")});this.loadUrl(i,n)}},{key:"read",value:function(t,e,n){var o=this.options.loadPath;"function"==typeof this.options.loadPath&&(o=this.options.loadPath([t],[e]));var i=this.services.interpolator.interpolate(o,{lng:t,ns:e});this.loadUrl(i,n)}},{key:"loadUrl",value:function(t,e){var n=this;this.options.ajax(t,this.options,function(o,i){if(i.status>=500&&i.status<600)return e("failed loading "+t,!0);if(i.status>=400&&i.status<500)return e("failed loading "+t,!1);var a=void 0,r=void 0;try{a=n.options.parse(o,t)}catch(e){r="failed parsing "+t+" to json"}return r?e(r,!1):void e(null,a)})}},{key:"create",value:function(t,e,n,o){var i=this;"string"==typeof t&&(t=[t]);var a={};a[n]=o||"",t.forEach(function(t){var n=i.services.interpolator.interpolate(i.options.addPath,{lng:t,ns:e});i.options.ajax(n,i.options,function(t,e){},a)})}}]),e}();return u.type="backend",u}); |
@@ -5,293 +5,164 @@ (function (global, factory) { | ||
(global.i18nextXHRBackend = factory()); | ||
}(this, function () { 'use strict'; | ||
}(this, (function () { 'use strict'; | ||
var arr = []; | ||
var each = arr.forEach; | ||
var slice = arr.slice; | ||
var arr = []; | ||
var each = arr.forEach; | ||
var slice = arr.slice; | ||
function defaults(obj) { | ||
each.call(slice.call(arguments, 1), function (source) { | ||
if (source) { | ||
for (var prop in source) { | ||
if (obj[prop] === undefined) obj[prop] = source[prop]; | ||
} | ||
function defaults(obj) { | ||
each.call(slice.call(arguments, 1), function (source) { | ||
if (source) { | ||
for (var prop in source) { | ||
if (obj[prop] === undefined) obj[prop] = source[prop]; | ||
} | ||
}); | ||
return obj; | ||
} | ||
} | ||
}); | ||
return obj; | ||
} | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var asyncGenerator = function () { | ||
function AwaitValue(value) { | ||
this.value = value; | ||
// https://gist.github.com/Xeoncross/7663273 | ||
function ajax(url, options, callback, data, cache) { | ||
// Must encode data | ||
if (data && (typeof data === 'undefined' ? 'undefined' : _typeof(data)) === 'object') { | ||
var y = '', | ||
e = encodeURIComponent; | ||
for (var m in data) { | ||
y += '&' + e(m) + '=' + e(data[m]); | ||
} | ||
data = y.slice(1) + (!cache ? '&_t=' + new Date() : ''); | ||
} | ||
function AsyncGenerator(gen) { | ||
var front, back; | ||
function send(key, arg) { | ||
return new Promise(function (resolve, reject) { | ||
var request = { | ||
key: key, | ||
arg: arg, | ||
resolve: resolve, | ||
reject: reject, | ||
next: null | ||
}; | ||
if (back) { | ||
back = back.next = request; | ||
} else { | ||
front = back = request; | ||
resume(key, arg); | ||
} | ||
}); | ||
try { | ||
var x = new (XMLHttpRequest || ActiveXObject)('MSXML2.XMLHTTP.3.0'); | ||
x.open(data ? 'POST' : 'GET', url, 1); | ||
if (!options.crossDomain) { | ||
x.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); | ||
} | ||
x.withCredentials = !!options.withCredentials; | ||
if (data) { | ||
x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); | ||
} | ||
var h = options.customHeaders; | ||
if (h) { | ||
for (var i in h) { | ||
x.setRequestHeader(i, h[i]); | ||
} | ||
function resume(key, arg) { | ||
try { | ||
var result = gen[key](arg); | ||
var value = result.value; | ||
if (value instanceof AwaitValue) { | ||
Promise.resolve(value.value).then(function (arg) { | ||
resume("next", arg); | ||
}, function (arg) { | ||
resume("throw", arg); | ||
}); | ||
} else { | ||
settle(result.done ? "return" : "normal", result.value); | ||
} | ||
} catch (err) { | ||
settle("throw", err); | ||
} | ||
} | ||
function settle(type, value) { | ||
switch (type) { | ||
case "return": | ||
front.resolve({ | ||
value: value, | ||
done: true | ||
}); | ||
break; | ||
case "throw": | ||
front.reject(value); | ||
break; | ||
default: | ||
front.resolve({ | ||
value: value, | ||
done: false | ||
}); | ||
break; | ||
} | ||
front = front.next; | ||
if (front) { | ||
resume(front.key, front.arg); | ||
} else { | ||
back = null; | ||
} | ||
} | ||
this._invoke = send; | ||
if (typeof gen.return !== "function") { | ||
this.return = undefined; | ||
} | ||
} | ||
if (typeof Symbol === "function" && Symbol.asyncIterator) { | ||
AsyncGenerator.prototype[Symbol.asyncIterator] = function () { | ||
return this; | ||
}; | ||
} | ||
AsyncGenerator.prototype.next = function (arg) { | ||
return this._invoke("next", arg); | ||
x.onreadystatechange = function () { | ||
x.readyState > 3 && callback && callback(x.responseText, x); | ||
}; | ||
x.send(data); | ||
} catch (e) { | ||
console && console.log(e); | ||
} | ||
} | ||
AsyncGenerator.prototype.throw = function (arg) { | ||
return this._invoke("throw", arg); | ||
}; | ||
var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
AsyncGenerator.prototype.return = function (arg) { | ||
return this._invoke("return", arg); | ||
}; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
return { | ||
wrap: function (fn) { | ||
return function () { | ||
return new AsyncGenerator(fn.apply(this, arguments)); | ||
}; | ||
}, | ||
await: function (value) { | ||
return new AwaitValue(value); | ||
} | ||
}; | ||
}(); | ||
var classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
function getDefaults() { | ||
return { | ||
loadPath: '/locales/{{lng}}/{{ns}}.json', | ||
addPath: 'locales/add/{{lng}}/{{ns}}', | ||
allowMultiLoading: false, | ||
parse: JSON.parse, | ||
crossDomain: false, | ||
ajax: ajax | ||
}; | ||
} | ||
var createClass = 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); | ||
} | ||
} | ||
var Backend = function () { | ||
function Backend(services) { | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
return function (Constructor, protoProps, staticProps) { | ||
if (protoProps) defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
}; | ||
}(); | ||
_classCallCheck(this, Backend); | ||
// https://gist.github.com/Xeoncross/7663273 | ||
function ajax(url, options, callback, data, cache) { | ||
// Must encode data | ||
if (data && (typeof data === 'undefined' ? 'undefined' : _typeof(data)) === 'object') { | ||
var y = '', | ||
e = encodeURIComponent; | ||
for (var m in data) { | ||
y += '&' + e(m) + '=' + e(data[m]); | ||
} | ||
data = y.slice(1) + (!cache ? '&_t=' + new Date() : ''); | ||
} | ||
this.init(services, options); | ||
try { | ||
var x = new (XMLHttpRequest || ActiveXObject)('MSXML2.XMLHTTP.3.0'); | ||
x.open(data ? 'POST' : 'GET', url, 1); | ||
if (!options.crossDomain) { | ||
x.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); | ||
} | ||
x.withCredentials = !!options.withCredentials; | ||
if (data) { | ||
x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); | ||
} | ||
x.onreadystatechange = function () { | ||
x.readyState > 3 && callback && callback(x.responseText, x); | ||
}; | ||
x.send(data); | ||
} catch (e) { | ||
window.console && console.log(e); | ||
} | ||
this.type = 'backend'; | ||
} | ||
function getDefaults() { | ||
return { | ||
loadPath: '/locales/{{lng}}/{{ns}}.json', | ||
addPath: 'locales/add/{{lng}}/{{ns}}', | ||
allowMultiLoading: false, | ||
parse: JSON.parse, | ||
crossDomain: false, | ||
ajax: ajax | ||
}; | ||
} | ||
var Backend = function () { | ||
function Backend(services) { | ||
_createClass(Backend, [{ | ||
key: 'init', | ||
value: function init(services) { | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
classCallCheck(this, Backend); | ||
this.init(services, options); | ||
this.type = 'backend'; | ||
this.services = services; | ||
this.options = defaults(options, this.options || {}, getDefaults()); | ||
} | ||
}, { | ||
key: 'readMulti', | ||
value: function readMulti(languages, namespaces, callback) { | ||
var loadPath = this.options.loadPath; | ||
if (typeof this.options.loadPath === 'function') { | ||
loadPath = this.options.loadPath(languages, namespaces); | ||
} | ||
createClass(Backend, [{ | ||
key: 'init', | ||
value: function init(services) { | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var url = this.services.interpolator.interpolate(loadPath, { lng: languages.join('+'), ns: namespaces.join('+') }); | ||
this.services = services; | ||
this.options = defaults(options, this.options || {}, getDefaults()); | ||
this.loadUrl(url, callback); | ||
} | ||
}, { | ||
key: 'read', | ||
value: function read(language, namespace, callback) { | ||
var loadPath = this.options.loadPath; | ||
if (typeof this.options.loadPath === 'function') { | ||
loadPath = this.options.loadPath([language], [namespace]); | ||
} | ||
}, { | ||
key: 'readMulti', | ||
value: function readMulti(languages, namespaces, callback) { | ||
var loadPath = this.options.loadPath; | ||
if (typeof this.options.loadPath === 'function') { | ||
loadPath = this.options.loadPath(languages, namespaces); | ||
} | ||
var url = this.services.interpolator.interpolate(loadPath, { lng: languages.join('+'), ns: namespaces.join('+') }); | ||
var url = this.services.interpolator.interpolate(loadPath, { lng: language, ns: namespace }); | ||
this.loadUrl(url, callback); | ||
} | ||
}, { | ||
key: 'read', | ||
value: function read(language, namespace, callback) { | ||
var loadPath = this.options.loadPath; | ||
if (typeof this.options.loadPath === 'function') { | ||
loadPath = this.options.loadPath([language], [namespace]); | ||
} | ||
this.loadUrl(url, callback); | ||
} | ||
}, { | ||
key: 'loadUrl', | ||
value: function loadUrl(url, callback) { | ||
var _this = this; | ||
var url = this.services.interpolator.interpolate(loadPath, { lng: language, ns: namespace }); | ||
this.options.ajax(url, this.options, function (data, xhr) { | ||
if (xhr.status >= 500 && xhr.status < 600) return callback('failed loading ' + url, true /* retry */); | ||
if (xhr.status >= 400 && xhr.status < 500) return callback('failed loading ' + url, false /* no retry */); | ||
this.loadUrl(url, callback); | ||
} | ||
}, { | ||
key: 'loadUrl', | ||
value: function loadUrl(url, callback) { | ||
var _this = this; | ||
var ret = void 0, | ||
err = void 0; | ||
try { | ||
ret = _this.options.parse(data, url); | ||
} catch (e) { | ||
err = 'failed parsing ' + url + ' to json'; | ||
} | ||
if (err) return callback(err, false); | ||
callback(null, ret); | ||
}); | ||
} | ||
}, { | ||
key: 'create', | ||
value: function create(languages, namespace, key, fallbackValue) { | ||
var _this2 = this; | ||
this.options.ajax(url, this.options, function (data, xhr) { | ||
if (xhr.status >= 500 && xhr.status < 600) return callback('failed loading ' + url, true /* retry */); | ||
if (xhr.status >= 400 && xhr.status < 500) return callback('failed loading ' + url, false /* no retry */); | ||
if (typeof languages === 'string') languages = [languages]; | ||
var ret = void 0, | ||
err = void 0; | ||
try { | ||
ret = _this.options.parse(data, url); | ||
} catch (e) { | ||
err = 'failed parsing ' + url + ' to json'; | ||
} | ||
if (err) return callback(err, false); | ||
callback(null, ret); | ||
}); | ||
} | ||
}, { | ||
key: 'create', | ||
value: function create(languages, namespace, key, fallbackValue) { | ||
var _this2 = this; | ||
var payload = {}; | ||
payload[key] = fallbackValue || ''; | ||
if (typeof languages === 'string') languages = [languages]; | ||
languages.forEach(function (lng) { | ||
var url = _this2.services.interpolator.interpolate(_this2.options.addPath, { lng: lng, ns: namespace }); | ||
var payload = {}; | ||
payload[key] = fallbackValue || ''; | ||
_this2.options.ajax(url, _this2.options, function (data, xhr) { | ||
//const statusCode = xhr.status.toString(); | ||
// TODO: if statusCode === 4xx do log | ||
}, payload); | ||
}); | ||
} | ||
}]); | ||
languages.forEach(function (lng) { | ||
var url = _this2.services.interpolator.interpolate(_this2.options.addPath, { lng: lng, ns: namespace }); | ||
return Backend; | ||
}(); | ||
_this2.options.ajax(url, _this2.options, function (data, xhr) { | ||
//const statusCode = xhr.status.toString(); | ||
// TODO: if statusCode === 4xx do log | ||
}, payload); | ||
}); | ||
} | ||
}]); | ||
return Backend; | ||
}(); | ||
Backend.type = 'backend'; | ||
Backend.type = 'backend'; | ||
return Backend; | ||
return Backend; | ||
})); | ||
}))); |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.i18nextXHRBackend=n()}(this,function(){"use strict";function t(t){return i.call(r.call(arguments,1),function(n){if(n)for(var e in n)void 0===t[e]&&(t[e]=n[e])}),t}function n(t,n,e,o,i){if(o&&"object"===("undefined"==typeof o?"undefined":a(o))){var r="",s=encodeURIComponent;for(var u in o)r+="&"+s(u)+"="+s(o[u]);o=r.slice(1)+(i?"":"&_t="+new Date)}try{var c=new(XMLHttpRequest||ActiveXObject)("MSXML2.XMLHTTP.3.0");c.open(o?"POST":"GET",t,1),n.crossDomain||c.setRequestHeader("X-Requested-With","XMLHttpRequest"),c.withCredentials=!!n.withCredentials,o&&c.setRequestHeader("Content-type","application/x-www-form-urlencoded"),c.onreadystatechange=function(){c.readyState>3&&e&&e(c.responseText,c)},c.send(o)}catch(t){window.console&&console.log(t)}}function e(){return{loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"locales/add/{{lng}}/{{ns}}",allowMultiLoading:!1,parse:JSON.parse,crossDomain:!1,ajax:n}}var o=[],i=o.forEach,r=o.slice,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s=(function(){function t(t){this.value=t}function n(n){function e(t,n){return new Promise(function(e,i){var s={key:t,arg:n,resolve:e,reject:i,next:null};a?a=a.next=s:(r=a=s,o(t,n))})}function o(e,r){try{var a=n[e](r),s=a.value;s instanceof t?Promise.resolve(s.value).then(function(t){o("next",t)},function(t){o("throw",t)}):i(a.done?"return":"normal",a.value)}catch(t){i("throw",t)}}function i(t,n){switch(t){case"return":r.resolve({value:n,done:!0});break;case"throw":r.reject(n);break;default:r.resolve({value:n,done:!1})}r=r.next,r?o(r.key,r.arg):a=null}var r,a;this._invoke=e,"function"!=typeof n.return&&(this.return=void 0)}return"function"==typeof Symbol&&Symbol.asyncIterator&&(n.prototype[Symbol.asyncIterator]=function(){return this}),n.prototype.next=function(t){return this._invoke("next",t)},n.prototype.throw=function(t){return this._invoke("throw",t)},n.prototype.return=function(t){return this._invoke("return",t)},{wrap:function(t){return function(){return new n(t.apply(this,arguments))}},await:function(n){return new t(n)}}}(),function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}),u=function(){function t(t,n){for(var e=0;e<n.length;e++){var o=n[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(n,e,o){return e&&t(n.prototype,e),o&&t(n,o),n}}(),c=function(){function n(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s(this,n),this.init(t,e),this.type="backend"}return u(n,[{key:"init",value:function(n){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.services=n,this.options=t(o,this.options||{},e())}},{key:"readMulti",value:function(t,n,e){var o=this.options.loadPath;"function"==typeof this.options.loadPath&&(o=this.options.loadPath(t,n));var i=this.services.interpolator.interpolate(o,{lng:t.join("+"),ns:n.join("+")});this.loadUrl(i,e)}},{key:"read",value:function(t,n,e){var o=this.options.loadPath;"function"==typeof this.options.loadPath&&(o=this.options.loadPath([t],[n]));var i=this.services.interpolator.interpolate(o,{lng:t,ns:n});this.loadUrl(i,e)}},{key:"loadUrl",value:function(t,n){var e=this;this.options.ajax(t,this.options,function(o,i){if(i.status>=500&&i.status<600)return n("failed loading "+t,!0);if(i.status>=400&&i.status<500)return n("failed loading "+t,!1);var r=void 0,a=void 0;try{r=e.options.parse(o,t)}catch(n){a="failed parsing "+t+" to json"}return a?n(a,!1):void n(null,r)})}},{key:"create",value:function(t,n,e,o){var i=this;"string"==typeof t&&(t=[t]);var r={};r[e]=o||"",t.forEach(function(t){var e=i.services.interpolator.interpolate(i.options.addPath,{lng:t,ns:n});i.options.ajax(e,i.options,function(t,n){},r)})}}]),n}();return c.type="backend",c}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.i18nextXHRBackend=e()}(this,function(){"use strict";function t(t){return a.call(r.call(arguments,1),function(e){if(e)for(var n in e)void 0===t[n]&&(t[n]=e[n])}),t}function e(t,e,n,o,i){if(o&&"object"===("undefined"==typeof o?"undefined":s(o))){var a="",r=encodeURIComponent;for(var l in o)a+="&"+r(l)+"="+r(o[l]);o=a.slice(1)+(i?"":"&_t="+new Date)}try{var u=new(XMLHttpRequest||ActiveXObject)("MSXML2.XMLHTTP.3.0");u.open(o?"POST":"GET",t,1),e.crossDomain||u.setRequestHeader("X-Requested-With","XMLHttpRequest"),u.withCredentials=!!e.withCredentials,o&&u.setRequestHeader("Content-type","application/x-www-form-urlencoded");var c=e.customHeaders;if(c)for(var f in c)u.setRequestHeader(f,c[f]);u.onreadystatechange=function(){u.readyState>3&&n&&n(u.responseText,u)},u.send(o)}catch(t){console&&console.log(t)}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(){return{loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"locales/add/{{lng}}/{{ns}}",allowMultiLoading:!1,parse:JSON.parse,crossDomain:!1,ajax:e}}var i=[],a=i.forEach,r=i.slice,s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),u=function(){function e(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n(this,e),this.init(t,o),this.type="backend"}return l(e,[{key:"init",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.services=e,this.options=t(n,this.options||{},o())}},{key:"readMulti",value:function(t,e,n){var o=this.options.loadPath;"function"==typeof this.options.loadPath&&(o=this.options.loadPath(t,e));var i=this.services.interpolator.interpolate(o,{lng:t.join("+"),ns:e.join("+")});this.loadUrl(i,n)}},{key:"read",value:function(t,e,n){var o=this.options.loadPath;"function"==typeof this.options.loadPath&&(o=this.options.loadPath([t],[e]));var i=this.services.interpolator.interpolate(o,{lng:t,ns:e});this.loadUrl(i,n)}},{key:"loadUrl",value:function(t,e){var n=this;this.options.ajax(t,this.options,function(o,i){if(i.status>=500&&i.status<600)return e("failed loading "+t,!0);if(i.status>=400&&i.status<500)return e("failed loading "+t,!1);var a=void 0,r=void 0;try{a=n.options.parse(o,t)}catch(e){r="failed parsing "+t+" to json"}return r?e(r,!1):void e(null,a)})}},{key:"create",value:function(t,e,n,o){var i=this;"string"==typeof t&&(t=[t]);var a={};a[n]=o||"",t.forEach(function(t){var n=i.services.interpolator.interpolate(i.options.addPath,{lng:t,ns:e});i.options.ajax(n,i.options,function(t,e){},a)})}}]),e}();return u.type="backend",u}); |
{ | ||
"name": "i18next-xhr-backend", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "backend layer for i18next using browsers xhr", | ||
@@ -19,42 +19,40 @@ "main": "./index.js", | ||
"devDependencies": { | ||
"babel-cli": "6.11.4", | ||
"babel-core": "6.13.2", | ||
"babel-eslint": "6.1.2", | ||
"babel-preset-es2015": "6.9.0", | ||
"babel-preset-es2015-native-modules": "6.6.0", | ||
"babel-preset-es2015-rollup": "1.1.1", | ||
"babel-preset-stage-0": "6.5.0", | ||
"babel-cli": "6.18.0", | ||
"babel-core": "6.21.0", | ||
"babel-eslint": "7.1.1", | ||
"babel-preset-es2015": "6.18.0", | ||
"babel-preset-stage-0": "6.16.0", | ||
"babelify": "7.3.0", | ||
"browserify": "13.0.1", | ||
"browserify": "13.3.0", | ||
"browserify-istanbul": "2.0.0", | ||
"chai": "3.5.0", | ||
"coveralls": "2.11.11", | ||
"eslint": "3.1.1", | ||
"eslint-config-airbnb": "9.0.1", | ||
"i18next": "3.4.1", | ||
"coveralls": "2.11.15", | ||
"eslint": "3.13.0", | ||
"eslint-config-airbnb": "13.0.0", | ||
"i18next": "4.1.4", | ||
"istanbul": "gotwarlost/istanbul#source-map", | ||
"json5": "0.5.0", | ||
"karma": "1.1.1", | ||
"json5": "0.5.1", | ||
"karma": "1.3.0", | ||
"karma-browserify": "5.1.0", | ||
"karma-chai": "0.1.0", | ||
"karma-chrome-launcher": "1.0.1", | ||
"karma-chrome-launcher": "2.0.0", | ||
"karma-cli": "1.0.1", | ||
"karma-coverage": "douglasduteil/karma-coverage#next", | ||
"karma-coveralls": "1.1.2", | ||
"karma-expect": "1.1.2", | ||
"karma-mocha": "1.1.1", | ||
"karma-phantomjs-launcher": "1.0.1", | ||
"karma-rollup-preprocessor": "2.0.2", | ||
"karma-expect": "1.1.3", | ||
"karma-mocha": "1.3.0", | ||
"karma-phantomjs-launcher": "1.0.2", | ||
"karma-rollup-preprocessor": "3.0.3", | ||
"karma-sinon": "1.0.5", | ||
"karma-spec-reporter": "0.0.26", | ||
"mkdirp": "0.5.1", | ||
"mocha": "2.5.3", | ||
"phantomjs-prebuilt": "2.1.7", | ||
"mocha": "3.2.0", | ||
"phantomjs-prebuilt": "2.1.14", | ||
"rimraf": "2.5.4", | ||
"rollup": "0.34.1", | ||
"rollup-plugin-babel": "2.6.1", | ||
"rollup-plugin-node-resolve": "1.7.1", | ||
"rollup": "0.41.1", | ||
"rollup-plugin-babel": "2.7.1", | ||
"rollup-plugin-node-resolve": "2.0.0", | ||
"rollup-plugin-uglify": "1.0.1", | ||
"sinon": "1.17.4", | ||
"yargs": "4.8.1" | ||
"sinon": "1.17.7", | ||
"yargs": "6.6.0" | ||
}, | ||
@@ -61,0 +59,0 @@ "scripts": { |
@@ -11,3 +11,3 @@ import babel from 'rollup-plugin-babel'; | ||
exclude: 'node_modules/**', | ||
presets: ['es2015-rollup', 'stage-0'], | ||
presets: [['es2015', { modules: false }], 'stage-0'], | ||
babelrc: false | ||
@@ -14,0 +14,0 @@ }; |
38
38816
638