@commercetools-uikit/utils
Advanced tools
Comparing version 10.44.0 to 10.47.0
# @commercetools-uikit/utils | ||
## 10.47.0 | ||
### Patch Changes | ||
- [`48abdf42`](https://github.com/commercetools/ui-kit/commit/48abdf42c8522a700403f7b3436e0fdce22022b0) [#1775](https://github.com/commercetools/ui-kit/pull/1775) Thanks [@adnasa](https://github.com/adnasa)! - Clone invariant, do not throw on production | ||
## 10.44.0 | ||
@@ -4,0 +10,0 @@ |
@@ -17,3 +17,2 @@ 'use strict'; | ||
var _slicedToArray__default = /*#__PURE__*/_interopDefault(_slicedToArray); | ||
var _Object$entries__default = /*#__PURE__*/_interopDefault(_Object$entries); | ||
@@ -33,3 +32,3 @@ var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty); | ||
return _Object$fromEntries__default['default'](_filterInstanceProperty__default['default'](_context = _Object$entries__default['default'](obj)).call(_context, function (_ref) { | ||
var _ref2 = _slicedToArray__default['default'](_ref, 1), | ||
var _ref2 = _slicedToArray(_ref, 1), | ||
propFromEntry = _ref2[0]; | ||
@@ -46,3 +45,3 @@ | ||
return _Object$fromEntries__default['default'](_filterInstanceProperty__default['default'](_context = _Object$entries__default['default'](obj)).call(_context, function (_ref) { | ||
var _ref2 = _slicedToArray__default['default'](_ref, 1), | ||
var _ref2 = _slicedToArray(_ref, 1), | ||
propFromEntry = _ref2[0]; | ||
@@ -58,3 +57,3 @@ | ||
return _Object$fromEntries__default['default'](_filterInstanceProperty__default['default'](_context = _Object$entries__default['default'](obj)).call(_context, function (_ref) { | ||
var _ref2 = _slicedToArray__default['default'](_ref, 1), | ||
var _ref2 = _slicedToArray(_ref, 1), | ||
propFromEntry = _ref2[0]; | ||
@@ -79,3 +78,3 @@ | ||
warning__default['default'](false, message); | ||
process.env.NODE_ENV !== "production" ? warning__default['default'](false, message) : void 0; | ||
} | ||
@@ -90,3 +89,3 @@ | ||
warning__default['default'](false, message); | ||
process.env.NODE_ENV !== "production" ? warning__default['default'](false, message) : void 0; | ||
} | ||
@@ -137,3 +136,3 @@ | ||
var _match = _slicedToArray__default['default'](match, 6), | ||
var _match = _slicedToArray(match, 6), | ||
hours = _match[1], | ||
@@ -191,3 +190,3 @@ minutes = _match[2], | ||
_forEachInstanceProperty__default['default'](_context = _Object$entries__default['default'](fields)).call(_context, function (_ref) { | ||
var _ref2 = _slicedToArray__default['default'](_ref, 2), | ||
var _ref2 = _slicedToArray(_ref, 2), | ||
key = _ref2[0], | ||
@@ -204,4 +203,28 @@ value = _ref2[1]; | ||
var isProduction = process.env.NODE_ENV === 'production'; // @TODO: allow consumer to set the prefix e.g `[ Text.Body ]` | ||
var prefix = 'Invariant failed'; // Throw an error if the condition fails | ||
// Strip out error messages for production | ||
// > Not providing an inline default argument for message as the result is smaller | ||
var invariant = function invariant(condition, message) { | ||
var _context; | ||
if (condition) { | ||
return; | ||
} // GIVEN product, suppress the message. | ||
if (isProduction) { | ||
return; | ||
} // Condition not passed | ||
// When not in production we allow the message to pass through | ||
// *This block will be removed in production builds* | ||
throw new Error(_concatInstanceProperty__default['default'](_context = "".concat(prefix, ": ")).call(_context, message || '')); | ||
}; | ||
// NOTE: This string will be replaced in the `prepare` script by the `scripts/version.js` file. | ||
var version = '10.44.0'; | ||
var version = '10.47.0'; | ||
@@ -215,2 +238,3 @@ exports.SafeHTMLElement = SafeHTMLElement; | ||
exports.getFieldId = getFieldId; | ||
exports.invariant = invariant; | ||
exports.isNumberish = isNumberish; | ||
@@ -217,0 +241,0 @@ exports.parseTime = parseTime; |
@@ -11,3 +11,3 @@ 'use strict'; | ||
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat'); | ||
var warning = require('warning'); | ||
require('warning'); | ||
var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim'); | ||
@@ -18,3 +18,2 @@ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each'); | ||
var _slicedToArray__default = /*#__PURE__*/_interopDefault(_slicedToArray); | ||
var _Object$entries__default = /*#__PURE__*/_interopDefault(_Object$entries); | ||
@@ -25,3 +24,2 @@ var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty); | ||
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty); | ||
var warning__default = /*#__PURE__*/_interopDefault(warning); | ||
var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty); | ||
@@ -35,3 +33,3 @@ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty); | ||
return _Object$fromEntries__default['default'](_filterInstanceProperty__default['default'](_context = _Object$entries__default['default'](obj)).call(_context, function (_ref) { | ||
var _ref2 = _slicedToArray__default['default'](_ref, 1), | ||
var _ref2 = _slicedToArray(_ref, 1), | ||
propFromEntry = _ref2[0]; | ||
@@ -48,3 +46,3 @@ | ||
return _Object$fromEntries__default['default'](_filterInstanceProperty__default['default'](_context = _Object$entries__default['default'](obj)).call(_context, function (_ref) { | ||
var _ref2 = _slicedToArray__default['default'](_ref, 1), | ||
var _ref2 = _slicedToArray(_ref, 1), | ||
propFromEntry = _ref2[0]; | ||
@@ -60,3 +58,3 @@ | ||
return _Object$fromEntries__default['default'](_filterInstanceProperty__default['default'](_context = _Object$entries__default['default'](obj)).call(_context, function (_ref) { | ||
var _ref2 = _slicedToArray__default['default'](_ref, 1), | ||
var _ref2 = _slicedToArray(_ref, 1), | ||
propFromEntry = _ref2[0]; | ||
@@ -79,5 +77,3 @@ | ||
var message = _concatInstanceProperty__default['default'](_context = "\"".concat(componentName, "\" has been deprecated and will be removed in the next major version.")).call(_context, additionalMessage); | ||
warning__default['default'](false, message); | ||
_concatInstanceProperty__default['default'](_context = "\"".concat(componentName, "\" has been deprecated and will be removed in the next major version.")).call(_context, additionalMessage); | ||
} | ||
@@ -90,5 +86,3 @@ | ||
var message = _concatInstanceProperty__default['default'](_context = _concatInstanceProperty__default['default'](_context2 = "\"".concat(propName, "\" property of \"")).call(_context2, componentName, "\" has been deprecated and will be removed in the next major version.")).call(_context, additionalMessage); | ||
warning__default['default'](false, message); | ||
_concatInstanceProperty__default['default'](_context = _concatInstanceProperty__default['default'](_context2 = "\"".concat(propName, "\" property of \"")).call(_context2, componentName, "\" has been deprecated and will be removed in the next major version.")).call(_context, additionalMessage); | ||
} | ||
@@ -139,3 +133,3 @@ | ||
var _match = _slicedToArray__default['default'](match, 6), | ||
var _match = _slicedToArray(match, 6), | ||
hours = _match[1], | ||
@@ -193,3 +187,3 @@ minutes = _match[2], | ||
_forEachInstanceProperty__default['default'](_context = _Object$entries__default['default'](fields)).call(_context, function (_ref) { | ||
var _ref2 = _slicedToArray__default['default'](_ref, 2), | ||
var _ref2 = _slicedToArray(_ref, 2), | ||
key = _ref2[0], | ||
@@ -206,4 +200,19 @@ value = _ref2[1]; | ||
// Strip out error messages for production | ||
// > Not providing an inline default argument for message as the result is smaller | ||
var invariant = function invariant(condition, message) { | ||
if (condition) { | ||
return; | ||
} // GIVEN product, suppress the message. | ||
{ | ||
return; | ||
} // Condition not passed | ||
}; | ||
// NOTE: This string will be replaced in the `prepare` script by the `scripts/version.js` file. | ||
var version = '10.44.0'; | ||
var version = '10.47.0'; | ||
@@ -217,2 +226,3 @@ exports.SafeHTMLElement = SafeHTMLElement; | ||
exports.getFieldId = getFieldId; | ||
exports.invariant = invariant; | ||
exports.isNumberish = isNumberish; | ||
@@ -219,0 +229,0 @@ exports.parseTime = parseTime; |
@@ -1,2 +0,2 @@ | ||
import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray'; | ||
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray'; | ||
import _Object$entries from '@babel/runtime-corejs3/core-js-stable/object/entries'; | ||
@@ -59,3 +59,3 @@ import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter'; | ||
warning(false, message); | ||
process.env.NODE_ENV !== "production" ? warning(false, message) : void 0; | ||
} | ||
@@ -70,3 +70,3 @@ | ||
warning(false, message); | ||
process.env.NODE_ENV !== "production" ? warning(false, message) : void 0; | ||
} | ||
@@ -182,5 +182,29 @@ | ||
var isProduction = process.env.NODE_ENV === 'production'; // @TODO: allow consumer to set the prefix e.g `[ Text.Body ]` | ||
var prefix = 'Invariant failed'; // Throw an error if the condition fails | ||
// Strip out error messages for production | ||
// > Not providing an inline default argument for message as the result is smaller | ||
var invariant = function invariant(condition, message) { | ||
var _context; | ||
if (condition) { | ||
return; | ||
} // GIVEN product, suppress the message. | ||
if (isProduction) { | ||
return; | ||
} // Condition not passed | ||
// When not in production we allow the message to pass through | ||
// *This block will be removed in production builds* | ||
throw new Error(_concatInstanceProperty(_context = "".concat(prefix, ": ")).call(_context, message || '')); | ||
}; | ||
// NOTE: This string will be replaced in the `prepare` script by the `scripts/version.js` file. | ||
var version = '10.44.0'; | ||
var version = '10.47.0'; | ||
export { SafeHTMLElement, addStaticFields, createSequentialId, filterAriaAttributes, filterDataAttributes, filterInvalidAttributes, getFieldId, isNumberish, parseTime, version, warnDeprecatedComponent, warnDeprecatedProp }; | ||
export { SafeHTMLElement, addStaticFields, createSequentialId, filterAriaAttributes, filterDataAttributes, filterInvalidAttributes, getFieldId, invariant, isNumberish, parseTime, version, warnDeprecatedComponent, warnDeprecatedProp }; |
@@ -12,2 +12,3 @@ export { default as filterDataAttributes } from './filter-data-attributes'; | ||
export { default as addStaticFields } from './add-static-fields'; | ||
export { default as invariant } from './invariant'; | ||
export { default as version } from './version'; |
@@ -1,2 +0,2 @@ | ||
declare const _default: "10.44.0"; | ||
declare const _default: "10.47.0"; | ||
export default _default; |
{ | ||
"name": "@commercetools-uikit/utils", | ||
"description": "A collection of utilities shared across the other packages.", | ||
"version": "10.44.0", | ||
"version": "10.47.0", | ||
"bugs": "https://github.com/commercetools/ui-kit/issues", | ||
@@ -26,5 +26,5 @@ "repository": { | ||
"dependencies": { | ||
"@babel/runtime": "7.12.5", | ||
"@babel/runtime-corejs3": "7.12.5", | ||
"@emotion/is-prop-valid": "1.0.0", | ||
"@babel/runtime": "7.12.13", | ||
"@babel/runtime-corejs3": "7.12.13", | ||
"@emotion/is-prop-valid": "1.1.0", | ||
"@types/warning": "^3.0.0", | ||
@@ -31,0 +31,0 @@ "warning": "4.0.3" |
34575
24
576
7
+ Added@babel/runtime@7.12.13(transitive)
+ Added@babel/runtime-corejs3@7.12.13(transitive)
+ Added@emotion/is-prop-valid@1.1.0(transitive)
- Removed@babel/runtime@7.12.5(transitive)
- Removed@babel/runtime-corejs3@7.12.5(transitive)
- Removed@emotion/is-prop-valid@1.0.0(transitive)
Updated@babel/runtime@7.12.13
Updated@emotion/is-prop-valid@1.1.0