From 47951530203c6c065c7f0e259133ccf82f790e60 Mon Sep 17 00:00:00 2001 From: Patrick Stadler Date: Mon, 19 Feb 2018 13:09:49 +0100 Subject: [PATCH] clean up builds --- example/lib/app.html | 2 +- example/lib/main.js | 158 ++++++++++++++++++++++++-------------- example/src/App.js | 7 +- example/src/app.html | 2 +- example/webpack.config.js | 29 ++----- example/yarn.lock | 4 +- lib/main.js | 2 +- package.json | 5 +- src/LightBoxHoc.js | 28 ++++--- src/index.js | 2 +- webpack.config.js | 18 ----- yarn.lock | 123 +++++++++++++++++------------ 12 files changed, 205 insertions(+), 175 deletions(-) diff --git a/example/lib/app.html b/example/lib/app.html index fd4dff9..faa6aca 100644 --- a/example/lib/app.html +++ b/example/lib/app.html @@ -9,7 +9,7 @@ - UPP Admin + Datatrans React Lightbox diff --git a/example/lib/main.js b/example/lib/main.js index ef33d70..e6e0ae2 100644 --- a/example/lib/main.js +++ b/example/lib/main.js @@ -1221,8 +1221,10 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol };return t.d(n, "a", n), n; }, t.o = function (e, t) { return Object.prototype.hasOwnProperty.call(e, t); - }, t.p = "", t(t.s = 8); - }([function (t, n) { + }, t.p = "", t(t.s = 13); + }([function (e, t, n) { + e.exports = n(11)(); + }, function (t, n) { t.exports = e; }, function (e, t, n) { "use strict"; @@ -1239,7 +1241,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return !t || "object" != (typeof t === "undefined" ? "undefined" : _typeof(t)) && "function" != typeof t ? e : t; }function i(e, t) { if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + (typeof t === "undefined" ? "undefined" : _typeof(t)));e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); - }Object.defineProperty(t, "__esModule", { value: !0 });var l = function () { + }Object.defineProperty(t, "__esModule", { value: !0 });var u = function () { function e(e, t) { for (var n = 0; n < t.length; n++) { var r = t[n];r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r); @@ -1248,48 +1250,50 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return n && e(t.prototype, n), r && e(t, r), t; }; }(), - u = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) { + l = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (e) { return typeof e === "undefined" ? "undefined" : _typeof(e); } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e === "undefined" ? "undefined" : _typeof(e); }, - s = n(0), + s = n(1), c = r(s), - f = n(7), + f = n(0), d = r(f), - p = n(3), - h = ["production", "onCancelled", "onLoaded", "onError", "version"], - y = function y(e, t) { - return t ? "https://payment.datatrans.biz/upp/jsp/upStart.jsp?" + (0, p.toUrlParams)(e) : "https://pilot.datatrans.biz/upp/jsp/upStart.jsp?" + (0, p.toUrlParams)(e); + p = n(8), + h = r(p), + y = n(4), + b = ["production", "onCancelled", "onLoaded", "onError", "version"], + m = function m(e, t) { + return t ? "https://payment.datatrans.biz/upp/jsp/upStart.jsp?" + (0, y.toUrlParams)(e) : "https://pilot.datatrans.biz/upp/jsp/upStart.jsp?" + (0, y.toUrlParams)(e); }, - m = function m(e) { - return "undefined" !== u(e.data) && "error" === e.data.type; + v = function v(e) { + return "undefined" !== l(e.data) && "error" === e.data.type; }, - v = function (e) { + g = function (e) { function t(e) { - o(this, t);var n = a(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e));n.onMessage = n.onMessage.bind(n), n.onCancelled = n.onCancelled.bind(n), (0, p.lockScrolling)();var r = (0, p.filterProps)(n.props, h);return n.url = y(r, n.props.production), n.origin = (0, p.parseUrl)(n.url).origin, n.state = { visible: !0 }, n; - }return i(t, e), l(t, [{ key: "onMessage", value: function value(e) { - if (e.origin === this.origin) return "cancel" === e.data ? this.onCancelled() : "frameReady" === e.data ? this.props.onLoaded() : m(e) ? this.props.onError(e.data) : void 0; + o(this, t);var n = a(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e));n.onMessage = n.onMessage.bind(n), n.onCancelled = n.onCancelled.bind(n), (0, y.lockScrolling)();var r = (0, y.filterProps)(n.props, b);return n.url = m(r, n.props.production), n.origin = (0, y.parseUrl)(n.url).origin, n.state = { visible: !0 }, n; + }return i(t, e), u(t, [{ key: "onMessage", value: function value(e) { + if (e.origin === this.origin) return "cancel" === e.data ? this.onCancelled() : "frameReady" === e.data ? this.props.onLoaded() : v(e) ? this.props.onError(e.data) : void 0; } }, { key: "onCancelled", value: function value() { - this.setState({ visible: !1 }), (0, p.releaseLock)(), this.props.onCancelled(); + this.setState({ visible: !1 }), (0, y.releaseLock)(), this.props.onCancelled(); } }, { key: "componentDidMount", value: function value() { - (0, p.addListener)("message", this.onMessage); + (window.addEventListener || window.attachEvent)("message", this.onMessage); } }, { key: "componentWillUnmount", value: function value() { - (0, p.removeListener)("message", this.onMessage), (0, p.releaseLock)(); + (window.removeEventListener || window.detachEvent)("message", this.onMessage), (0, y.releaseLock)(); } }, { key: "render", value: function value() { - return this.state.visible ? c.default.createElement(d.default, { url: this.url, showsPaymentPage: this.props.showsPaymentPage }) : c.default.createElement("div", null, " do not render me "); + return this.state.visible ? c.default.createElement(h.default, { url: this.url, showsPaymentPage: this.props.showsPaymentPage }) : c.default.createElement("div", null, " do not render me "); } }]), t; - }(s.Component);t.default = v, v.defaultProps = { onCancelled: function onCancelled() {}, onLoaded: function onLoaded() {}, onError: function onError() {}, production: !1, theme: "DT2015", version: "1.0.2", showsPaymentPage: !0 }; + }(s.Component);t.default = g, g.propTypes = { merchantId: d.default.string.isRequired, refno: d.default.string.isRequired, amount: d.default.string.isRequired, currency: d.default.string.isRequired, sign: d.default.string.isRequired, production: d.default.bool, showsPaymentPage: d.default.bool.isRequired, onCancelled: d.default.func.isRequired, onLoaded: d.default.func.isRequired, onError: d.default.func.isRequired }, g.defaultProps = { onCancelled: function onCancelled() {}, onLoaded: function onLoaded() {}, onError: function onError() {}, production: !1, theme: "DT2015", version: "1.0.2", showsPaymentPage: !0 }; }, function (e, t, n) { "use strict"; - Object.defineProperty(t, "__esModule", { value: !0 }), t.releaseLock = t.lockScrolling = t.addListener = t.removeListener = t.parseUrl = t.toUrlParams = t.set = t.filterProps = void 0;var r = Object.assign || function (e) { + Object.defineProperty(t, "__esModule", { value: !0 }), t.releaseLock = t.lockScrolling = t.parseUrl = t.toUrlParams = t.set = t.filterProps = void 0;var r = Object.assign || function (e) { for (var t = 1; t < arguments.length; t++) { var n = arguments[t];for (var r in n) { Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); } }return e; }, - o = n(1), + o = n(2), a = function (e) { return e && e.__esModule ? e : { default: e }; }(o);t.filterProps = function (e, t) { @@ -1304,7 +1308,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }).join("&"); }, t.parseUrl = function (e) { var t = document.createElement("a");return t.href = e, t; - }, t.removeListener = removeEventListener || detachEvent, t.addListener = addEventListener || attachEvent, t.lockScrolling = function () { + }, t.lockScrolling = function () { var e = document.createElement("style");e.innerHTML = a.default.scrollLock, e.id = "scroll-lock", document.getElementsByTagName("head")[0].appendChild(e); }, t.releaseLock = function () { var e = document.getElementById("scroll-lock");e && (e.outerHTML = ""); @@ -1313,10 +1317,10 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol "use strict"; function r(e) { return e && e.__esModule ? e : { default: e }; - }Object.defineProperty(t, "__esModule", { value: !0 }), t.withLightBox = t.LightBoxHoc = void 0;var o = n(2), + }Object.defineProperty(t, "__esModule", { value: !0 }), t.withLightBox = t.LightBoxHoc = void 0;var o = n(3), a = r(o), - i = n(5), - l = r(i);a.default.Hoc = l.default, t.LightBoxHoc = l.default, t.withLightBox = l.default, t.default = a.default; + i = n(6), + u = r(i);a.default.Hoc = u.default, t.LightBoxHoc = u.default, t.withLightBox = u.default, t.default = a.default; }, function (e, t, n) { "use strict"; function r(e) { @@ -1327,14 +1331,14 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return !t || "object" != (typeof t === "undefined" ? "undefined" : _typeof(t)) && "function" != typeof t ? e : t; }function i(e, t) { if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + (typeof t === "undefined" ? "undefined" : _typeof(t)));e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); - }Object.defineProperty(t, "__esModule", { value: !0 });var l = Object.assign || function (e) { + }Object.defineProperty(t, "__esModule", { value: !0 });var u = Object.assign || function (e) { for (var t = 1; t < arguments.length; t++) { var n = arguments[t];for (var r in n) { Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); } }return e; }, - u = function () { + l = function () { function e(e, t) { for (var n = 0; n < t.length; n++) { var r = t[n];r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r); @@ -1343,25 +1347,27 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return n && e(t.prototype, n), r && e(t, r), t; }; }(), - s = n(0), + s = n(1), c = r(s), - f = n(2), + f = n(0), d = r(f), p = n(3), - h = function h() { + h = r(p), + y = n(4), + b = function b() { return new Error("payment page is not loaded yet."); }, - y = { shouldLoad: !1, visible: !1, loaded: !1, error: null, cancelled: !1 }, - m = function m(e) { + m = { shouldLoad: !1, visible: !1, loaded: !1, error: null, cancelled: !1 }, + v = function v(e) { return function (t) { function n(e) { - o(this, n);var t = a(this, (n.__proto__ || Object.getPrototypeOf(n)).call(this, e));return t.load = t.load.bind(t), t.show = t.show.bind(t), t.on = t.on.bind(t), t.onLoaded = t.onLoaded.bind(t), t.onCancelled = t.onCancelled.bind(t), t.onError = t.onError.bind(t), t.config = {}, t.state = l({}, y, { load: t.load, show: t.show, on: t.on }), t.listeners = { cancelled: [], error: [], loaded: [] }, t; - }return i(n, t), u(n, [{ key: "onCancelled", value: function value() { + o(this, n);var t = a(this, (n.__proto__ || Object.getPrototypeOf(n)).call(this, e));return t.load = t.load.bind(t), t.show = t.show.bind(t), t.on = t.on.bind(t), t.onLoaded = t.onLoaded.bind(t), t.onCancelled = t.onCancelled.bind(t), t.onError = t.onError.bind(t), t.config = {}, t.state = u({}, m, { load: t.load, show: t.show, on: t.on }), t.listeners = { cancelled: [], error: [], loaded: [] }, t; + }return i(n, t), l(n, [{ key: "onCancelled", value: function value() { this.listeners.cancelled.forEach(function (e) { return e(); - }), this.setState(l({}, y, { cancelled: !0 })); + }), this.setState(u({}, m, { cancelled: !0 })); } }, { key: "onError", value: function value(e) { - var t = this;this.setState(l({}, y, { error: e }), function () { + var t = this;this.setState(u({}, m, { error: e }), function () { return t.listeners.error.forEach(function (t) { return t(e); }); @@ -1377,23 +1383,25 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } }, { key: "load", value: function value(e) { this.config = e, this.setState({ shouldLoad: !0 }); } }, { key: "show", value: function value() { - if (!this.state.loaded) throw h();this.setState({ visible: !0 }); + if (!this.state.loaded) throw b();this.setState({ visible: !0 }); } }, { key: "render", value: function value() { - return c.default.createElement("div", null, this.state.shouldLoad && c.default.createElement(d.default, l({}, this.config, { onLoaded: this.onLoaded, showsPaymentPage: this.state.visible, onCancelled: this.onCancelled, onError: this.onError })), c.default.createElement(e, l({}, this.props, { lightBox: (0, p.filterProps)(this.state, ["shouldLoad"]) }))); + return c.default.createElement("div", null, this.state.shouldLoad && c.default.createElement(h.default, u({}, this.config, { onLoaded: this.onLoaded, showsPaymentPage: this.state.visible, onCancelled: this.onCancelled, onError: this.onError })), c.default.createElement(e, u({}, this.props, { lightBox: (0, y.filterProps)(this.state, ["shouldLoad"]) }))); } }]), n; }(s.Component); - };t.default = m; + };v.propType = d.default.shape({ visible: d.default.bool.isRequired, loaded: d.default.bool.isRequired, cancelled: d.default.bool.isRequired, error: d.default.any, load: d.default.func.isRequired, show: d.default.func.isRequired, on: d.default.func.isRequired }), t.default = v; }, function (e, t, n) { "use strict"; function r(e) { return e && e.__esModule ? e : { default: e }; - }Object.defineProperty(t, "__esModule", { value: !0 });var o = n(0), + }Object.defineProperty(t, "__esModule", { value: !0 });var o = n(1), a = r(o), - i = n(1), - l = r(i), - u = function u(e) { - return a.default.createElement("iframe", { src: e.url, style: l.default.iframe, id: "datatransPaymentFrame", name: "datatransPaymentFrame", frameBorder: 0, allowTransparency: !0 }); - };t.default = u; + i = n(0), + u = r(i), + l = n(2), + s = r(l), + c = function c(e) { + return a.default.createElement("iframe", { src: e.url, style: s.default.iframe, id: "datatransPaymentFrame", name: "datatransPaymentFrame", frameBorder: 0, allowTransparency: !0 }); + };c.propTypes = { url: u.default.string.isRequired }, t.default = c; }, function (e, t, n) { "use strict"; function r(e) { @@ -1405,17 +1413,56 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } }return e; }, - a = n(0), + a = n(1), i = r(a), - l = n(6), - u = r(l), - s = n(1), + u = n(0), + l = r(u), + s = n(7), c = r(s), - f = function f(e) { - var t = e.showsPaymentPage ? o({}, c.default.pageFrame, { display: "block" }) : c.default.pageFrame;return i.default.createElement("div", { style: t }, i.default.createElement(u.default, { url: e.url })); - };t.default = f; + f = n(2), + d = r(f), + p = function p(e) { + var t = e.showsPaymentPage ? o({}, d.default.pageFrame, { display: "block" }) : d.default.pageFrame;return i.default.createElement("div", { style: t }, i.default.createElement(c.default, { url: e.url })); + };p.propTypes = { url: l.default.string.isRequired, showsPaymentPage: l.default.bool.isRequired }, t.default = p; }, function (e, t, n) { - e.exports = n(4); + "use strict"; + function r(e) { + return function () { + return e; + }; + }var o = function o() {};o.thatReturns = r, o.thatReturnsFalse = r(!1), o.thatReturnsTrue = r(!0), o.thatReturnsNull = r(null), o.thatReturnsThis = function () { + return this; + }, o.thatReturnsArgument = function (e) { + return e; + }, e.exports = o; + }, function (e, t, n) { + "use strict"; + function r(e, t, n, r, a, i, u, l) { + if (o(t), !e) { + var s;if (void 0 === t) s = new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else { + var c = [n, r, a, i, u, l], + f = 0;s = new Error(t.replace(/%s/g, function () { + return c[f++]; + })), s.name = "Invariant Violation"; + }throw s.framesToPop = 1, s; + } + }var o = function o(e) {};e.exports = r; + }, function (e, t, n) { + "use strict"; + var r = n(9), + o = n(10), + a = n(12);e.exports = function () { + function e(e, t, n, r, i, u) { + u !== a && o(!1, "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"); + }function t() { + return e; + }e.isRequired = e;var n = { array: e, bool: e, func: e, number: e, object: e, string: e, symbol: e, any: e, arrayOf: t, element: e, instanceOf: t, node: e, objectOf: t, oneOf: t, oneOfType: t, shape: t, exact: t };return n.checkPropTypes = r, n.PropTypes = n, n; + }; + }, function (e, t, n) { + "use strict"; + e.exports = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"; + }, function (e, t, n) { + e.exports = n(5); }]); }); /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(28)(module))) @@ -8148,7 +8195,6 @@ var LightBoxHocApproachBase = function (_Component3) { LightBoxHocApproachBase.propTypes = { lightBox: _reactDatatransLightBox2.default.Hoc.propType - }; var LightBoxHocApproach = _reactDatatransLightBox2.default.Hoc(LightBoxHocApproachBase); diff --git a/example/src/App.js b/example/src/App.js index 6f650ff..a80136b 100644 --- a/example/src/App.js +++ b/example/src/App.js @@ -1,8 +1,6 @@ - -import React, {PropTypes, Component} from 'react' +import React, { Component } from 'react' import LightBox from 'react-datatrans-light-box' - const config = { merchantId: '1100004624', refno: '11000asdfasdf4624', @@ -97,11 +95,8 @@ class LightBoxHocApproachBase extends Component { } - LightBoxHocApproachBase.propTypes = { lightBox: LightBox.Hoc.propType, - } const LightBoxHocApproach = LightBox.Hoc(LightBoxHocApproachBase) - diff --git a/example/src/app.html b/example/src/app.html index fd4dff9..faa6aca 100644 --- a/example/src/app.html +++ b/example/src/app.html @@ -9,7 +9,7 @@ - UPP Admin + Datatrans React Lightbox diff --git a/example/webpack.config.js b/example/webpack.config.js index ee50e02..51d8c9e 100644 --- a/example/webpack.config.js +++ b/example/webpack.config.js @@ -1,32 +1,21 @@ const path = require('path') -const webpack = require('webpack') const HtmlWebpackPlugin = require('html-webpack-plugin') module.exports = { module: { - loaders: [{ - test: /\.js$/, // Transform all .js files required somewhere with Babel - loader: 'babel-loader', - // include: ['../../shared'], - // exclude: [/node_modules/], - // query: env.babelQuery, - }] + loaders: [ + { + test: /\.js$/, + loader: 'babel-loader' + } + ] }, entry: { main: ['./src/index.js'], - }, plugins: [ - // new webpack.optimize.UglifyJsPlugin({ - // compress: { - // warnings: false, // ...but do not show warnings in the console (there is a lot of them) - // }, - // comments: false, - // }), - // new webpack.HotModuleReplacementPlugin(), // Tell webpack we want hot reloading - // new webpack.NoErrorsPlugin(), new HtmlWebpackPlugin({ inject: true, chunks:['app'], @@ -38,9 +27,5 @@ module.exports = { output: { path: path.resolve(__dirname, 'lib'), filename: '[name].js' - }, - - // resolve: { - // modules:[path.resolve(__dirname, '../../shared'), 'node_modules'] - // } + } } diff --git a/example/yarn.lock b/example/yarn.lock index fec3758..8d209e7 100644 --- a/example/yarn.lock +++ b/example/yarn.lock @@ -2400,9 +2400,7 @@ rc@^1.1.7: strip-json-comments "~2.0.1" react-datatrans-light-box@../: - version "1.0.2" - dependencies: - prop-types "^15.6.0" + version "1.0.4" react-dom@^16.2.0: version "16.2.0" diff --git a/lib/main.js b/lib/main.js index aa5f297..c777282 100644 --- a/lib/main.js +++ b/lib/main.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require(void 0)):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.LightBox=t(require("react"),require(void 0)):e.LightBox=t(e.React,e[void 0])}(this,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=9)}([function(t,n){t.exports=e},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=t.scrollLock="\n html {\n width: 100%;\n height: 100%;\n overflow: hidden;\n }\n html body {\n width: 100%;\n height: 100%;\n overflow: visible;\n position: fixed;\n }\n",o=t.pageFrame={zIndex:9999,position:"fixed",right:0,bottom:0,left:0,top:0,overflow:"hidden",WebkitTransform:"translate3d(0, 0, 0)",transform:"translate3d(0, 0, 0)",display:"none"},a=t.iframe={border:0,margin:0,padding:0,width:"100%",height:"100%"};t.default={scrollLock:r,pageFrame:o,iframe:a}},function(e,n){e.exports=t},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n class Wrapper extends Component { } } -// LightBoxHoc.propType = PropTypes.shape({ - - -// //LightBox state -// visible: PropTypes.bool.isRequired, -// loaded: PropTypes.bool.isRequired, -// cancelled: PropTypes.bool.isRequired, -// error: PropTypes.any, - -// //Methods -// load: PropTypes.func.isRequired, -// show: PropTypes.func.isRequired, -// on: PropTypes.func.isRequired, -// }) +LightBoxHoc.propType = PropTypes.shape({ + //LightBox state + visible: PropTypes.bool.isRequired, + loaded: PropTypes.bool.isRequired, + cancelled: PropTypes.bool.isRequired, + error: PropTypes.any, + + //Methods + load: PropTypes.func.isRequired, + show: PropTypes.func.isRequired, + on: PropTypes.func.isRequired, +}) export default LightBoxHoc diff --git a/src/index.js b/src/index.js index 280f4c4..12d9ccc 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,4 @@ -import LightBox from './LightBox.js' +import LightBox from './LightBox' import LightBoxHoc from './LightBoxHoc' LightBox.Hoc = LightBoxHoc diff --git a/webpack.config.js b/webpack.config.js index e455306..1bbc342 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,6 +1,5 @@ const path = require('path') const webpack = require('webpack') -const CompressionPlugin = require('compression-webpack-plugin') module.exports = { externals: { @@ -9,14 +8,6 @@ module.exports = { commonjs2: 'react', commonjs: 'react', amd: 'react' - }, - 'prop-types': { - react: { - root: 'PropTypes', - commonjs2: 'prop-types', - commonjs: 'prop-types', - amd: 'prop-types' - } } }, module: { @@ -31,14 +22,12 @@ module.exports = { }, entry: { main: ['./src/index.js'], - }, plugins: [ new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('production') }), new webpack.optimize.UglifyJsPlugin({ - beautify: false, mangle: true, output: { @@ -57,13 +46,6 @@ module.exports = { booleans: true, }, comments: false, - }), - new CompressionPlugin({ - asset: '[path].gz[query]', - algorithm: 'gzip', - test: /\.js$|\.css$|\.html$/, - threshold: 10240, - minRatio: 0 }) ], diff --git a/yarn.lock b/yarn.lock index 96a258e..3fdb0c0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -124,6 +124,10 @@ arrify@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" +asap@~2.0.3: + version "2.0.6" + resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" + asn1.js@^4.0.0: version "4.9.1" resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.9.1.tgz#48ba240b45a9280e94748990ba597d216617fd40" @@ -154,10 +158,6 @@ async-each@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d" -async@0.2.x: - version "0.2.10" - resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1" - async@^2.1.2: version "2.3.0" resolved "https://registry.yarnpkg.com/async/-/async-2.3.0.tgz#1013d1051047dd320fe24e494d5c66ecaf6147d9" @@ -1195,10 +1195,6 @@ cliui@^3.2.0: strip-ansi "^3.0.1" wrap-ansi "^2.0.0" -clone@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.2.tgz#260b7a99ebb1edfe247538175f783243cb19d149" - co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" @@ -1223,15 +1219,6 @@ commondir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" -compression-webpack-plugin@^0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/compression-webpack-plugin/-/compression-webpack-plugin-0.3.2.tgz#1edfb0e749d7366d3e701670c463359b2c0cf704" - dependencies: - async "0.2.x" - webpack-sources "^0.1.0" - optionalDependencies: - node-zopfli "^2.0.0" - concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" @@ -1266,6 +1253,10 @@ convert-source-map@^1.1.0: version "1.5.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.0.tgz#9acd70851c6d5dfdd93d9282e5edf94a03ff46b5" +core-js@^1.0.0: + version "1.2.7" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" + core-js@^2.4.0: version "2.4.1" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e" @@ -1362,12 +1353,6 @@ deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" -defaults@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d" - dependencies: - clone "^1.0.2" - define-properties@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94" @@ -1460,6 +1445,12 @@ emojis-list@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389" +encoding@^0.1.11: + version "0.1.12" + resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" + dependencies: + iconv-lite "~0.4.13" + enhanced-resolve@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-3.1.0.tgz#9f4b626f577245edcf4b2ad83d86e17f4f421dec" @@ -1779,6 +1770,18 @@ fast-levenshtein@~2.0.4: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" +fbjs@^0.8.16: + version "0.8.16" + resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.16.tgz#5e67432f550dc41b572bf55847b8aca64e5337db" + dependencies: + core-js "^1.0.0" + isomorphic-fetch "^2.1.1" + loose-envify "^1.0.0" + object-assign "^4.1.0" + promise "^7.1.1" + setimmediate "^1.0.5" + ua-parser-js "^0.7.9" + figures@^1.3.5: version "1.7.0" resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" @@ -2058,6 +2061,10 @@ https-browserify@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-0.0.1.tgz#3f91365cabe60b77ed0ebba24b454e3e09d95a82" +iconv-lite@~0.4.13: + version "0.4.19" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" + ieee754@^1.1.4: version "1.1.8" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4" @@ -2261,6 +2268,10 @@ is-resolvable@^1.0.0: dependencies: tryit "^1.0.1" +is-stream@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + is-symbol@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572" @@ -2293,6 +2304,13 @@ isobject@^2.0.0: dependencies: isarray "1.0.0" +isomorphic-fetch@^2.1.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" + dependencies: + node-fetch "^1.0.1" + whatwg-fetch ">=0.10.0" + isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" @@ -2465,7 +2483,7 @@ longest@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" -loose-envify@^1.0.0: +loose-envify@^1.0.0, loose-envify@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" dependencies: @@ -2557,7 +2575,7 @@ mute-stream@0.0.5: version "0.0.5" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.5.tgz#8fbfabb0a98a253d3184331f9e8deb7372fac6c0" -nan@^2.0.0, nan@^2.3.0: +nan@^2.3.0: version "2.5.1" resolved "https://registry.yarnpkg.com/nan/-/nan-2.5.1.tgz#d5b01691253326a97a2bbee9e61c55d8d60351e2" @@ -2565,6 +2583,13 @@ natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" +node-fetch@^1.0.1: + version "1.7.3" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" + dependencies: + encoding "^0.1.11" + is-stream "^1.0.1" + node-libs-browser@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-1.1.1.tgz#2a38243abedd7dffcd07a97c9aca5668975a6fea" @@ -2621,7 +2646,7 @@ node-libs-browser@^2.0.0: util "^0.10.3" vm-browserify "0.0.4" -node-pre-gyp@^0.6.29, node-pre-gyp@^0.6.4: +node-pre-gyp@^0.6.29: version "0.6.34" resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.34.tgz#94ad1c798a11d7fc67381b50d47f8cc18d9799f7" dependencies: @@ -2635,15 +2660,6 @@ node-pre-gyp@^0.6.29, node-pre-gyp@^0.6.4: tar "^2.2.1" tar-pack "^3.4.0" -node-zopfli@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/node-zopfli/-/node-zopfli-2.0.2.tgz#a7a473ae92aaea85d4c68d45bbf2c944c46116b8" - dependencies: - commander "^2.8.1" - defaults "^1.0.2" - nan "^2.0.0" - node-pre-gyp "^0.6.4" - nopt@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" @@ -2683,7 +2699,7 @@ oauth-sign@~0.8.1: version "0.8.2" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" -object-assign@^4.0.1, object-assign@^4.1.0: +object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" @@ -2887,6 +2903,20 @@ progress@^1.1.8: version "1.1.8" resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" +promise@^7.1.1: + version "7.3.1" + resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" + dependencies: + asap "~2.0.3" + +prop-types@^15.6.0: + version "15.6.0" + resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.0.tgz#ceaf083022fc46b4a35f69e13ef75aed0d639856" + dependencies: + fbjs "^0.8.16" + loose-envify "^1.3.1" + object-assign "^4.1.1" + prr@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/prr/-/prr-0.0.0.tgz#1a84b85908325501411853d0081ee3fa86e2926a" @@ -3151,7 +3181,7 @@ set-immediate-shim@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61" -setimmediate@^1.0.4: +setimmediate@^1.0.4, setimmediate@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" @@ -3191,10 +3221,6 @@ source-list-map@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-1.1.1.tgz#1a33ac210ca144d1e561f906ebccab5669ff4cb4" -source-list-map@~0.1.7: - version "0.1.8" - resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-0.1.8.tgz#c550b2ab5427f6b3f21f5afead88c4f5587b2106" - source-map-support@^0.4.2: version "0.4.14" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.14.tgz#9d4463772598b86271b4f523f6c1f4e02a7d6aef" @@ -3414,6 +3440,10 @@ typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" +ua-parser-js@^0.7.9: + version "0.7.17" + resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.17.tgz#e9ec5f9498b9ec910e7ae3ac626a805c4d09ecac" + uglify-js@^2.8.5: version "2.8.21" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.21.tgz#1733f669ae6f82fc90c7b25ec0f5c783ee375314" @@ -3524,13 +3554,6 @@ webpack: webpack-sources "^0.2.3" yargs "^6.0.0" -webpack-sources@^0.1.0: - version "0.1.5" - resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-0.1.5.tgz#aa1f3abf0f0d74db7111c40e500b84f966640750" - dependencies: - source-list-map "~0.1.7" - source-map "~0.5.3" - webpack-sources@^0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-0.2.3.tgz#17c62bfaf13c707f9d02c479e0dcdde8380697fb" @@ -3538,6 +3561,10 @@ webpack-sources@^0.2.3: source-list-map "^1.1.1" source-map "~0.5.3" +whatwg-fetch@>=0.10.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz#9c84ec2dcf68187ff00bc64e1274b442176e1c84" + which-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f"