diff --git a/CHANGELOG.md b/CHANGELOG.md index e25ad31..50bf96d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.5.1] - 2022-02-03 + +### Changed + +- Added `browserslist` section to `package.json` to specify that babel should transpile to ES5 + ## [0.5.0] - 2022-02-01 ### Added diff --git a/babel.config.js b/babel.config.js index 6941103..8e5f789 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,3 +1,6 @@ module.exports = { - presets: [['@babel/preset-env', {targets: {node: 'current'}}]] + presets: ['@babel/preset-env'], + plugins: [ + ["@babel/transform-runtime"] + ] }; diff --git a/dist/signalerjs.min.js b/dist/signalerjs.min.js index 80dfc42..9d3e69e 100644 --- a/dist/signalerjs.min.js +++ b/dist/signalerjs.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.signalerjs=t():e.signalerjs=t()}(self,(function(){return(()=>{var e={560:function(e,t,n){var r;!function(o){"use strict";function u(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function i(e,t,n,r,o,i){return u((c=u(u(t,e),u(r,i)))<<(a=o)|c>>>32-a,n);var c,a}function c(e,t,n,r,o,u,c){return i(t&n|~t&r,e,t,o,u,c)}function a(e,t,n,r,o,u,c){return i(t&r|n&~r,e,t,o,u,c)}function f(e,t,n,r,o,u,c){return i(t^n^r,e,t,o,u,c)}function s(e,t,n,r,o,u,c){return i(n^(t|~r),e,t,o,u,c)}function l(e,t){var n,r,o,i,l;e[t>>5]|=128<>>9<<4)]=t;var d=1732584193,p=-271733879,g=-1732584194,h=271733878;for(n=0;n>5]>>>t%32&255);return n}function p(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t>5]|=(255&e.charCodeAt(t/8))<>>4&15)+r.charAt(15&t);return o}function h(e){return unescape(encodeURIComponent(e))}function m(e){return function(e){return d(l(p(e),8*e.length))}(h(e))}function v(e,t){return function(e,t){var n,r,o=p(e),u=[],i=[];for(u[15]=i[15]=void 0,o.length>16&&(o=l(o,8*e.length)),n=0;n<16;n+=1)u[n]=909522486^o[n],i[n]=1549556828^o[n];return r=l(u.concat(p(t)),512+8*t.length),d(l(i.concat(r),640))}(h(e),h(t))}function y(e,t,n){return t?n?v(t,e):g(v(t,e)):n?m(e):g(m(e))}void 0===(r=function(){return y}.call(t,n,t,e))||(e.exports=r)}()},360:function(e,t,n){var r;!function(o,u){"use strict";var i=function(e){if("object"!=typeof e.document)throw new Error("Cookies.js requires a `window` with a `document` object");var t=function(e,n,r){return 1===arguments.length?t.get(e):t.set(e,n,r)};return t._document=e.document,t._cacheKeyPrefix="cookey.",t._maxExpireDate=new Date("Fri, 31 Dec 9999 23:59:59 UTC"),t.defaults={path:"/",secure:!1},t.get=function(e){t._cachedDocumentCookie!==t._document.cookie&&t._renewCache();var n=t._cache[t._cacheKeyPrefix+e];return n===u?u:decodeURIComponent(n)},t.set=function(e,n,r){return(r=t._getExtendedOptions(r)).expires=t._getExpiresDate(n===u?-1:r.expires),t._document.cookie=t._generateCookieString(e,n,r),t},t.expire=function(e,n){return t.set(e,u,n)},t._getExtendedOptions=function(e){return{path:e&&e.path||t.defaults.path,domain:e&&e.domain||t.defaults.domain,expires:e&&e.expires||t.defaults.expires,secure:e&&e.secure!==u?e.secure:t.defaults.secure}},t._isValidDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e.getTime())},t._getExpiresDate=function(e,n){if(n=n||new Date,"number"==typeof e?e=e===1/0?t._maxExpireDate:new Date(n.getTime()+1e3*e):"string"==typeof e&&(e=new Date(e)),e&&!t._isValidDate(e))throw new Error("`expires` parameter cannot be converted to a valid Date instance");return e},t._generateCookieString=function(e,t,n){var r=(e=(e=e.replace(/[^#$&+\^`|]/g,encodeURIComponent)).replace(/\(/g,"%28").replace(/\)/g,"%29"))+"="+(t=(t+"").replace(/[^!#$&-+\--:<-\[\]-~]/g,encodeURIComponent));return r+=(n=n||{}).path?";path="+n.path:"",r+=n.domain?";domain="+n.domain:"",(r+=n.expires?";expires="+n.expires.toUTCString():"")+(n.secure?";secure":"")},t._getCacheFromString=function(e){for(var n={},r=e?e.split("; "):[],o=0;o=t?(u=!0,e):void 0}))[0]||null},e.exports=t.default}])}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var u=t[r]={exports:{}};return e[r].call(u.exports,u,u.exports,n),u.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n.r(r),n.d(r,{default:()=>m});var e=n(560),t=n.n(e),o=n(360),u=n.n(o),i=n(789),c=n.n(i);function a(e){var t=Date.now();return new Date(t+864e5*e).toUTCString()}function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}var s,l,d={path:"/",domain:(s=window.location.hostname,l=s.split("."),l.length>2?".".concat(l.slice(1).join(".")):".".concat(s)),expires:a(30)};function p(e){var t={};return e.map((function(e){t[e]=g(e)})),t}function g(e){return u().get(t()(e))}function h(e){switch(f(e)){case"string":return{expires:e};case"number":return{expires:a(e)};default:return{}}}function m(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.transformCookieOptions||function(e){return e};function o(){if("string"===f(e))return window.fetch("".concat(e,".json")).then((function(e){return e.json()})).then((function(e){return p(Object.keys(e))}));var t=p(Object.keys(e));return new Promise((function(e){return e(t)}))}function i(e){var t=g(e);return t?new Promise((function(e){return e(t)})):a(e)}function a(t){if("string"===f(e))return window.fetch("".concat(e,"/").concat(t,".json")).then((function(e){return e.json()})).then((function(e){var n=h(e.expires);return s(t,e.flag,n),e.flag}));var n=e[t],r=c()(n.flags),o=h(n.expires);return s(t,r,o),new Promise((function(e){return e(r)}))}function s(e,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};u().set(t()(e),n,r(o))}return u().defaults=n.cookieDefaults||d,{featureFlags:o,featureFlag:i,setFeatureFlag:s}}})(),r})()})); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.signalerjs=t():e.signalerjs=t()}(self,(function(){return function(){var e={560:function(e,t,n){var r;!function(o){"use strict";function u(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function i(e,t,n,r,o,i){return u((c=u(u(t,e),u(r,i)))<<(a=o)|c>>>32-a,n);var c,a}function c(e,t,n,r,o,u,c){return i(t&n|~t&r,e,t,o,u,c)}function a(e,t,n,r,o,u,c){return i(t&r|n&~r,e,t,o,u,c)}function f(e,t,n,r,o,u,c){return i(t^n^r,e,t,o,u,c)}function s(e,t,n,r,o,u,c){return i(n^(t|~r),e,t,o,u,c)}function l(e,t){var n,r,o,i,l;e[t>>5]|=128<>>9<<4)]=t;var d=1732584193,p=-271733879,g=-1732584194,h=271733878;for(n=0;n>5]>>>t%32&255);return n}function p(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t>5]|=(255&e.charCodeAt(t/8))<>>4&15)+r.charAt(15&t);return o}function h(e){return unescape(encodeURIComponent(e))}function m(e){return function(e){return d(l(p(e),8*e.length))}(h(e))}function v(e,t){return function(e,t){var n,r,o=p(e),u=[],i=[];for(u[15]=i[15]=void 0,o.length>16&&(o=l(o,8*e.length)),n=0;n<16;n+=1)u[n]=909522486^o[n],i[n]=1549556828^o[n];return r=l(u.concat(p(t)),512+8*t.length),d(l(i.concat(r),640))}(h(e),h(t))}function y(e,t,n){return t?n?v(t,e):g(v(t,e)):n?m(e):g(m(e))}void 0===(r=function(){return y}.call(t,n,t,e))||(e.exports=r)}()},360:function(e,t,n){var r;!function(o,u){"use strict";var i=function(e){if("object"!=typeof e.document)throw new Error("Cookies.js requires a `window` with a `document` object");var t=function(e,n,r){return 1===arguments.length?t.get(e):t.set(e,n,r)};return t._document=e.document,t._cacheKeyPrefix="cookey.",t._maxExpireDate=new Date("Fri, 31 Dec 9999 23:59:59 UTC"),t.defaults={path:"/",secure:!1},t.get=function(e){t._cachedDocumentCookie!==t._document.cookie&&t._renewCache();var n=t._cache[t._cacheKeyPrefix+e];return n===u?u:decodeURIComponent(n)},t.set=function(e,n,r){return(r=t._getExtendedOptions(r)).expires=t._getExpiresDate(n===u?-1:r.expires),t._document.cookie=t._generateCookieString(e,n,r),t},t.expire=function(e,n){return t.set(e,u,n)},t._getExtendedOptions=function(e){return{path:e&&e.path||t.defaults.path,domain:e&&e.domain||t.defaults.domain,expires:e&&e.expires||t.defaults.expires,secure:e&&e.secure!==u?e.secure:t.defaults.secure}},t._isValidDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e.getTime())},t._getExpiresDate=function(e,n){if(n=n||new Date,"number"==typeof e?e=e===1/0?t._maxExpireDate:new Date(n.getTime()+1e3*e):"string"==typeof e&&(e=new Date(e)),e&&!t._isValidDate(e))throw new Error("`expires` parameter cannot be converted to a valid Date instance");return e},t._generateCookieString=function(e,t,n){var r=(e=(e=e.replace(/[^#$&+\^`|]/g,encodeURIComponent)).replace(/\(/g,"%28").replace(/\)/g,"%29"))+"="+(t=(t+"").replace(/[^!#$&-+\--:<-\[\]-~]/g,encodeURIComponent));return r+=(n=n||{}).path?";path="+n.path:"",r+=n.domain?";domain="+n.domain:"",(r+=n.expires?";expires="+n.expires.toUTCString():"")+(n.secure?";secure":"")},t._getCacheFromString=function(e){for(var n={},r=e?e.split("; "):[],o=0;o=t?(u=!0,e):void 0}))[0]||null},e.exports=t.default}])}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var u=t[r]={exports:{}};return e[r].call(u.exports,u,u.exports,n),u.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}n.r(r),n.d(r,{default:function(){return m}});var t=n(560),o=n.n(t),u=n(360),i=n.n(u),c=n(789),a=n.n(c);function f(e){var t=Date.now();return new Date(t+864e5*e).toUTCString()}var s,l,d={path:"/",domain:(s=window.location.hostname,l=s.split("."),l.length>2?".".concat(l.slice(1).join(".")):".".concat(s)),expires:f(30)};function p(e){var t={};return e.map((function(e){t[e]=g(e)})),t}function g(e){return i().get(o()(e))}function h(t){switch(e(t)){case"string":return{expires:t};case"number":return{expires:f(t)};default:return{}}}function m(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.transformCookieOptions||function(e){return e};function u(){if("string"===e(t))return window.fetch("".concat(t,".json")).then((function(e){return e.json()})).then((function(e){return p(Object.keys(e))}));var n=p(Object.keys(t));return new Promise((function(e){return e(n)}))}function c(e){var t=g(e);return t?new Promise((function(e){return e(t)})):f(e)}function f(n){if("string"===e(t))return window.fetch("".concat(t,"/").concat(n,".json")).then((function(e){return e.json()})).then((function(e){var t=h(e.expires);return s(n,e.flag,t),e.flag}));var r=t[n],o=a()(r.flags),u=h(r.expires);return s(n,o,u),new Promise((function(e){return e(o)}))}function s(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};i().set(o()(e),t,r(n))}return i().defaults=n.cookieDefaults||d,{featureFlags:u,featureFlag:c,setFeatureFlag:s}}}(),r}()})); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 01c2ad9..ece47ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "signalerjs", - "version": "0.4.0", + "version": "0.5.1", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "0.4.0", + "version": "0.5.1", "license": "MIT", "dependencies": { "blueimp-md5": "2.19.0", @@ -16,6 +16,7 @@ "@babel/core": "^7.0.0", "@babel/eslint-parser": "^7.0.0", "@babel/eslint-plugin": "^7.0.0", + "@babel/plugin-transform-runtime": "^7.17.0", "@babel/preset-env": "^7.0.0", "babel-loader": "^8.2.3", "es6-promise": "4.2.4", @@ -1386,6 +1387,26 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-transform-runtime": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.17.0.tgz", + "integrity": "sha512-fr7zPWnKXNc1xoHfrIU9mN/4XKX4VLZ45Q+oMhfsYIaHvg7mHgmhfOy/ckRWqDK7XF3QDigRpkh5DKq6+clE8A==", + "dev": true, + "dependencies": { + "@babel/helper-module-imports": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7", + "babel-plugin-polyfill-corejs2": "^0.3.0", + "babel-plugin-polyfill-corejs3": "^0.5.0", + "babel-plugin-polyfill-regenerator": "^0.3.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-transform-shorthand-properties": { "version": "7.16.7", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.16.7.tgz", @@ -9692,6 +9713,20 @@ "@babel/helper-plugin-utils": "^7.16.7" } }, + "@babel/plugin-transform-runtime": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.17.0.tgz", + "integrity": "sha512-fr7zPWnKXNc1xoHfrIU9mN/4XKX4VLZ45Q+oMhfsYIaHvg7mHgmhfOy/ckRWqDK7XF3QDigRpkh5DKq6+clE8A==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7", + "babel-plugin-polyfill-corejs2": "^0.3.0", + "babel-plugin-polyfill-corejs3": "^0.5.0", + "babel-plugin-polyfill-regenerator": "^0.3.0", + "semver": "^6.3.0" + } + }, "@babel/plugin-transform-shorthand-properties": { "version": "7.16.7", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.16.7.tgz", diff --git a/package.json b/package.json index 510d40f..c9891fb 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name": "signalerjs", - "version": "0.5.0", + "version": "0.5.1", "description": "JavaScript A/B testing feature flag library", "main": "dist/signalerjs.min.js", "scripts": { - "build": "webpack", + "build": "webpack --mode production", "test": "jest", "lint": "npx eslint ./src ./test" }, @@ -23,10 +23,16 @@ ], "author": "Custom Ink Technology", "license": "MIT", + "browserslist": [ + "> 1%", + "last 2 versions", + "not ie <= 8" + ], "devDependencies": { "@babel/core": "^7.0.0", "@babel/eslint-parser": "^7.0.0", "@babel/eslint-plugin": "^7.0.0", + "@babel/plugin-transform-runtime": "^7.17.0", "@babel/preset-env": "^7.0.0", "babel-loader": "^8.2.3", "es6-promise": "4.2.4", diff --git a/webpack.config.js b/webpack.config.js index 12ea76d..70e6d71 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -10,7 +10,7 @@ module.exports = { use: { loader: 'babel-loader', options: { - presets: [['@babel/preset-env', {targets: 'defaults'}]] + presets: ['@babel/preset-env'] } } },