diff --git a/build/index.js b/build/index.js index d130a8d..f64e395 100644 --- a/build/index.js +++ b/build/index.js @@ -64,7 +64,7 @@ module.exports = /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 5); +/******/ return __webpack_require__(__webpack_require__.s = 8); /******/ }) /************************************************************************/ /******/ ([ @@ -261,6 +261,108 @@ process.umask = function() { return 0; }; /* 1 */ /***/ (function(module, exports, __webpack_require__) { +"use strict"; + + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + +function makeEmptyFunction(arg) { + return function () { + return arg; + }; +} + +/** + * This function accepts and discards inputs; it has no side effects. This is + * primarily useful idiomatically for overridable function endpoints which + * always need to be callable, since JS lacks a null-call idiom ala Cocoa. + */ +var emptyFunction = function emptyFunction() {}; + +emptyFunction.thatReturns = makeEmptyFunction; +emptyFunction.thatReturnsFalse = makeEmptyFunction(false); +emptyFunction.thatReturnsTrue = makeEmptyFunction(true); +emptyFunction.thatReturnsNull = makeEmptyFunction(null); +emptyFunction.thatReturnsThis = function () { + return this; +}; +emptyFunction.thatReturnsArgument = function (arg) { + return arg; +}; + +module.exports = emptyFunction; + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) {/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +/** + * Use invariant() to assert state which your program assumes to be true. + * + * Provide sprintf-style format (only %s is supported) and arguments + * to provide information about what broke and what you were + * expecting. + * + * The invariant message will be stripped in production, but the invariant + * will remain to ensure logic does not differ in production. + */ + +var validateFormat = function validateFormat(format) {}; + +if (process.env.NODE_ENV !== 'production') { + validateFormat = function validateFormat(format) { + if (format === undefined) { + throw new Error('invariant requires an error message argument'); + } + }; +} + +function invariant(condition, format, a, b, c, d, e, f) { + validateFormat(format); + + if (!condition) { + var error; + if (format === undefined) { + error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); + } else { + var args = [a, b, c, d, e, f]; + var argIndex = 0; + error = new Error(format.replace(/%s/g, function () { + return args[argIndex++]; + })); + error.name = 'Invariant Violation'; + } + + error.framesToPop = 1; // we don't care about invariant's own frame + throw error; + } +} + +module.exports = invariant; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { + "use strict"; /** * Copyright (c) 2013-present, Facebook, Inc. @@ -277,7 +379,76 @@ module.exports = ReactPropTypesSecret; /***/ }), -/* 2 */ +/* 4 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) {/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var emptyFunction = __webpack_require__(1); + +/** + * Similar to invariant but only logs a warning if the condition is not met. + * This can be used to log issues in development environments in critical + * paths. Removing the logging code for production environments will keep the + * same logic and follow the same code paths. + */ + +var warning = emptyFunction; + +if (process.env.NODE_ENV !== 'production') { + var printWarning = function printWarning(format) { + for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + var argIndex = 0; + var message = 'Warning: ' + format.replace(/%s/g, function () { + return args[argIndex++]; + }); + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; + + warning = function warning(condition, format) { + if (format === undefined) { + throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); + } + + if (format.indexOf('Failed Composite propType: ') === 0) { + return; // Ignore CompositeComponent proptype check. + } + + if (!condition) { + for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { + args[_key2 - 2] = arguments[_key2]; + } + + printWarning.apply(undefined, [format].concat(args)); + } + }; +} + +module.exports = warning; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) + +/***/ }), +/* 5 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! @@ -452,7 +623,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! /***/ }), -/* 3 */ +/* 6 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(process) {/** @@ -477,23 +648,23 @@ if (process.env.NODE_ENV !== 'production') { // By explicitly using `prop-types` you are opting into new development behavior. // http://fb.me/prop-types-in-prod var throwOnDirectAccess = true; - module.exports = __webpack_require__(9)(isValidElement, throwOnDirectAccess); + module.exports = __webpack_require__(12)(isValidElement, throwOnDirectAccess); } else { // By explicitly using `prop-types` you are opting into new production behavior. // http://fb.me/prop-types-in-prod - module.exports = __webpack_require__(8)(); + module.exports = __webpack_require__(11)(); } /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 4 */ +/* 7 */ /***/ (function(module, exports) { module.exports = require("react"); /***/ }), -/* 5 */ +/* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -508,15 +679,15 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument 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; }; }(); -var _react = __webpack_require__(4); +var _react = __webpack_require__(7); var _react2 = _interopRequireDefault(_react); -var _propTypes = __webpack_require__(3); +var _propTypes = __webpack_require__(6); var _propTypes2 = _interopRequireDefault(_propTypes); -var _jsCookie = __webpack_require__(2); +var _jsCookie = __webpack_require__(5); var _jsCookie2 = _interopRequireDefault(_jsCookie); @@ -777,7 +948,7 @@ exports.default = CookieConsent; exports.Cookies = _jsCookie2.default; /***/ }), -/* 6 */ +/* 9 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -874,7 +1045,7 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { /***/ }), -/* 7 */ +/* 10 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -887,24 +1058,11 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { -var printWarning = function() {}; - if (process.env.NODE_ENV !== 'production') { - var ReactPropTypesSecret = __webpack_require__(1); + var invariant = __webpack_require__(2); + var warning = __webpack_require__(4); + var ReactPropTypesSecret = __webpack_require__(3); var loggedTypeFailures = {}; - - printWarning = function(text) { - var message = 'Warning: ' + text; - if (typeof console !== 'undefined') { - console.error(message); - } - try { - // --- Welcome to debugging React --- - // This error was thrown as a convenience so that you can use this stack - // to find the callsite that caused this warning to fire. - throw new Error(message); - } catch (x) {} - }; } /** @@ -929,29 +1087,12 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) { try { // This is intentionally an invariant that gets caught. It's the same // behavior as without this statement except with a better message. - if (typeof typeSpecs[typeSpecName] !== 'function') { - var err = Error( - (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + - 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' - ); - err.name = 'Invariant Violation'; - throw err; - } + invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]); error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); } catch (ex) { error = ex; } - if (error && !(error instanceof Error)) { - printWarning( - (componentName || 'React class') + ': type specification of ' + - location + ' `' + typeSpecName + '` is invalid; the type checker ' + - 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' + - 'You may have forgotten to pass an argument to the type checker ' + - 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + - 'shape all require an argument).' - ) - - } + warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error); if (error instanceof Error && !(error.message in loggedTypeFailures)) { // Only monitor this failure once because there tends to be a lot of the // same error. @@ -959,9 +1100,7 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) { var stack = getStack ? getStack() : ''; - printWarning( - 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '') - ); + warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : ''); } } } @@ -973,7 +1112,7 @@ module.exports = checkPropTypes; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 8 */ +/* 11 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -986,9 +1125,9 @@ module.exports = checkPropTypes; -var ReactPropTypesSecret = __webpack_require__(1); - -function emptyFunction() {} +var emptyFunction = __webpack_require__(1); +var invariant = __webpack_require__(2); +var ReactPropTypesSecret = __webpack_require__(3); module.exports = function() { function shim(props, propName, componentName, location, propFullName, secret) { @@ -996,13 +1135,12 @@ module.exports = function() { // It is still safe when called from React. return; } - var err = new Error( + invariant( + false, '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' ); - err.name = 'Invariant Violation'; - throw err; }; shim.isRequired = shim; function getShim() { @@ -1039,7 +1177,7 @@ module.exports = function() { /***/ }), -/* 9 */ +/* 12 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -1052,31 +1190,13 @@ module.exports = function() { -var assign = __webpack_require__(6); +var emptyFunction = __webpack_require__(1); +var invariant = __webpack_require__(2); +var warning = __webpack_require__(4); +var assign = __webpack_require__(9); -var ReactPropTypesSecret = __webpack_require__(1); -var checkPropTypes = __webpack_require__(7); - -var printWarning = function() {}; - -if (process.env.NODE_ENV !== 'production') { - printWarning = function(text) { - var message = 'Warning: ' + text; - if (typeof console !== 'undefined') { - console.error(message); - } - try { - // --- Welcome to debugging React --- - // This error was thrown as a convenience so that you can use this stack - // to find the callsite that caused this warning to fire. - throw new Error(message); - } catch (x) {} - }; -} - -function emptyFunctionThatReturnsNull() { - return null; -} +var ReactPropTypesSecret = __webpack_require__(3); +var checkPropTypes = __webpack_require__(10); module.exports = function(isValidElement, throwOnDirectAccess) { /* global Symbol */ @@ -1220,13 +1340,12 @@ module.exports = function(isValidElement, throwOnDirectAccess) { if (secret !== ReactPropTypesSecret) { if (throwOnDirectAccess) { // New behavior only for users of `prop-types` package - var err = new Error( + invariant( + false, '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' ); - err.name = 'Invariant Violation'; - throw err; } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') { // Old behavior for people using React.PropTypes var cacheKey = componentName + ':' + propName; @@ -1235,12 +1354,15 @@ module.exports = function(isValidElement, throwOnDirectAccess) { // Avoid spamming the console because they are often not actionable except for lib authors manualPropTypeWarningCount < 3 ) { - printWarning( + warning( + false, 'You are manually calling a React.PropTypes validation ' + - 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + + 'function for the `%s` prop on `%s`. This is deprecated ' + 'and will throw in the standalone `prop-types` package. ' + 'You may be seeing this warning due to a third-party PropTypes ' + - 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', + propFullName, + componentName ); manualPropTypeCallCache[cacheKey] = true; manualPropTypeWarningCount++; @@ -1284,7 +1406,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) { } function createAnyTypeChecker() { - return createChainableTypeChecker(emptyFunctionThatReturnsNull); + return createChainableTypeChecker(emptyFunction.thatReturnsNull); } function createArrayOfTypeChecker(typeChecker) { @@ -1334,8 +1456,8 @@ module.exports = function(isValidElement, throwOnDirectAccess) { function createEnumTypeChecker(expectedValues) { if (!Array.isArray(expectedValues)) { - process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOf, expected an instance of array.') : void 0; - return emptyFunctionThatReturnsNull; + process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0; + return emptyFunction.thatReturnsNull; } function validate(props, propName, componentName, location, propFullName) { @@ -1377,18 +1499,21 @@ module.exports = function(isValidElement, throwOnDirectAccess) { function createUnionTypeChecker(arrayOfTypeCheckers) { if (!Array.isArray(arrayOfTypeCheckers)) { - process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; - return emptyFunctionThatReturnsNull; + process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; + return emptyFunction.thatReturnsNull; } for (var i = 0; i < arrayOfTypeCheckers.length; i++) { var checker = arrayOfTypeCheckers[i]; if (typeof checker !== 'function') { - printWarning( + warning( + false, 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + - 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.' + 'received %s at index %s.', + getPostfixForTypeWarning(checker), + i ); - return emptyFunctionThatReturnsNull; + return emptyFunction.thatReturnsNull; } } diff --git a/package.json b/package.json index 68dff5f..6bc658f 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "name": "Rick van Lieshout", "email": "info@rickvanlieshout.com" }, - "version": "1.8.1", + "version": "1.9.0", "description": "A small, simple and customizable cookie consent bar for use in React applications.", "main": "build/index.js", "dependencies": { @@ -38,7 +38,7 @@ "babel-cli": "^6.24.1", "babel-core": "^6.26.3", "babel-loader": "^7.1.4", - "babel-plugin-transform-object-rest-spread": "^6.23.0", + "babel-plugin-transform-object-rest-spread": "^6.26.0", "babel-plugin-transform-react-jsx": "^6.24.1", "babel-preset-env": "^1.5.1", "babel-preset-es2015": "^6.24.1",