Initial commit
This commit is contained in:
30
node_modules/react-lifecycles-compat/package.json
generated
vendored
Normal file
30
node_modules/react-lifecycles-compat/package.json
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "react-lifecycles-compat",
|
||||
"version": "3.0.4",
|
||||
"description": "Backwards compatibility polyfill for React class components",
|
||||
"main": "react-lifecycles-compat.cjs.js",
|
||||
"module": "react-lifecycles-compat.es.js",
|
||||
"license": "MIT",
|
||||
"repository": "reactjs/react-lifecycles-compat",
|
||||
"files": [
|
||||
"react-lifecycles-compat.cjs.js",
|
||||
"react-lifecycles-compat.es.js",
|
||||
"react-lifecycles-compat.js",
|
||||
"react-lifecycles-compat.min.js"
|
||||
],
|
||||
"devDependencies": {
|
||||
"camelcase": "^5.0.0",
|
||||
"chalk": "^2.3.0",
|
||||
"eslint": "^4.16.0",
|
||||
"eslint-config-es5": "^0.5.0",
|
||||
"jest": "^22.1.4",
|
||||
"jest-cli": "^22.1.4",
|
||||
"prettier": "^1.10.2",
|
||||
"rollup": "^0.57.1",
|
||||
"rollup-plugin-replace": "^2.0.0",
|
||||
"rollup-plugin-uglify": "^3.0.0"
|
||||
},
|
||||
"devEngines": {
|
||||
"node": "8.5 || 9.x"
|
||||
}
|
||||
}
|
||||
162
node_modules/react-lifecycles-compat/react-lifecycles-compat.cjs.js
generated
vendored
Normal file
162
node_modules/react-lifecycles-compat/react-lifecycles-compat.cjs.js
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
/**
|
||||
* 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 componentWillMount() {
|
||||
// Call this.constructor.gDSFP to support sub-classes.
|
||||
var state = this.constructor.getDerivedStateFromProps(this.props, this.state);
|
||||
if (state !== null && state !== undefined) {
|
||||
this.setState(state);
|
||||
}
|
||||
}
|
||||
|
||||
function componentWillReceiveProps(nextProps) {
|
||||
// Call this.constructor.gDSFP to support sub-classes.
|
||||
// Use the setState() updater to ensure state isn't stale in certain edge cases.
|
||||
function updater(prevState) {
|
||||
var state = this.constructor.getDerivedStateFromProps(nextProps, prevState);
|
||||
return state !== null && state !== undefined ? state : null;
|
||||
}
|
||||
// Binding "this" is important for shallow renderer support.
|
||||
this.setState(updater.bind(this));
|
||||
}
|
||||
|
||||
function componentWillUpdate(nextProps, nextState) {
|
||||
try {
|
||||
var prevProps = this.props;
|
||||
var prevState = this.state;
|
||||
this.props = nextProps;
|
||||
this.state = nextState;
|
||||
this.__reactInternalSnapshotFlag = true;
|
||||
this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate(
|
||||
prevProps,
|
||||
prevState
|
||||
);
|
||||
} finally {
|
||||
this.props = prevProps;
|
||||
this.state = prevState;
|
||||
}
|
||||
}
|
||||
|
||||
// React may warn about cWM/cWRP/cWU methods being deprecated.
|
||||
// Add a flag to suppress these warnings for this special case.
|
||||
componentWillMount.__suppressDeprecationWarning = true;
|
||||
componentWillReceiveProps.__suppressDeprecationWarning = true;
|
||||
componentWillUpdate.__suppressDeprecationWarning = true;
|
||||
|
||||
function polyfill(Component) {
|
||||
var prototype = Component.prototype;
|
||||
|
||||
if (!prototype || !prototype.isReactComponent) {
|
||||
throw new Error('Can only polyfill class components');
|
||||
}
|
||||
|
||||
if (
|
||||
typeof Component.getDerivedStateFromProps !== 'function' &&
|
||||
typeof prototype.getSnapshotBeforeUpdate !== 'function'
|
||||
) {
|
||||
return Component;
|
||||
}
|
||||
|
||||
// If new component APIs are defined, "unsafe" lifecycles won't be called.
|
||||
// Error if any of these lifecycles are present,
|
||||
// Because they would work differently between older and newer (16.3+) versions of React.
|
||||
var foundWillMountName = null;
|
||||
var foundWillReceivePropsName = null;
|
||||
var foundWillUpdateName = null;
|
||||
if (typeof prototype.componentWillMount === 'function') {
|
||||
foundWillMountName = 'componentWillMount';
|
||||
} else if (typeof prototype.UNSAFE_componentWillMount === 'function') {
|
||||
foundWillMountName = 'UNSAFE_componentWillMount';
|
||||
}
|
||||
if (typeof prototype.componentWillReceiveProps === 'function') {
|
||||
foundWillReceivePropsName = 'componentWillReceiveProps';
|
||||
} else if (typeof prototype.UNSAFE_componentWillReceiveProps === 'function') {
|
||||
foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
|
||||
}
|
||||
if (typeof prototype.componentWillUpdate === 'function') {
|
||||
foundWillUpdateName = 'componentWillUpdate';
|
||||
} else if (typeof prototype.UNSAFE_componentWillUpdate === 'function') {
|
||||
foundWillUpdateName = 'UNSAFE_componentWillUpdate';
|
||||
}
|
||||
if (
|
||||
foundWillMountName !== null ||
|
||||
foundWillReceivePropsName !== null ||
|
||||
foundWillUpdateName !== null
|
||||
) {
|
||||
var componentName = Component.displayName || Component.name;
|
||||
var newApiName =
|
||||
typeof Component.getDerivedStateFromProps === 'function'
|
||||
? 'getDerivedStateFromProps()'
|
||||
: 'getSnapshotBeforeUpdate()';
|
||||
|
||||
throw Error(
|
||||
'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' +
|
||||
componentName +
|
||||
' uses ' +
|
||||
newApiName +
|
||||
' but also contains the following legacy lifecycles:' +
|
||||
(foundWillMountName !== null ? '\n ' + foundWillMountName : '') +
|
||||
(foundWillReceivePropsName !== null
|
||||
? '\n ' + foundWillReceivePropsName
|
||||
: '') +
|
||||
(foundWillUpdateName !== null ? '\n ' + foundWillUpdateName : '') +
|
||||
'\n\nThe above lifecycles should be removed. Learn more about this warning here:\n' +
|
||||
'https://fb.me/react-async-component-lifecycle-hooks'
|
||||
);
|
||||
}
|
||||
|
||||
// React <= 16.2 does not support static getDerivedStateFromProps.
|
||||
// As a workaround, use cWM and cWRP to invoke the new static lifecycle.
|
||||
// Newer versions of React will ignore these lifecycles if gDSFP exists.
|
||||
if (typeof Component.getDerivedStateFromProps === 'function') {
|
||||
prototype.componentWillMount = componentWillMount;
|
||||
prototype.componentWillReceiveProps = componentWillReceiveProps;
|
||||
}
|
||||
|
||||
// React <= 16.2 does not support getSnapshotBeforeUpdate.
|
||||
// As a workaround, use cWU to invoke the new lifecycle.
|
||||
// Newer versions of React will ignore that lifecycle if gSBU exists.
|
||||
if (typeof prototype.getSnapshotBeforeUpdate === 'function') {
|
||||
if (typeof prototype.componentDidUpdate !== 'function') {
|
||||
throw new Error(
|
||||
'Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype'
|
||||
);
|
||||
}
|
||||
|
||||
prototype.componentWillUpdate = componentWillUpdate;
|
||||
|
||||
var componentDidUpdate = prototype.componentDidUpdate;
|
||||
|
||||
prototype.componentDidUpdate = function componentDidUpdatePolyfill(
|
||||
prevProps,
|
||||
prevState,
|
||||
maybeSnapshot
|
||||
) {
|
||||
// 16.3+ will not execute our will-update method;
|
||||
// It will pass a snapshot value to did-update though.
|
||||
// Older versions will require our polyfilled will-update value.
|
||||
// We need to handle both cases, but can't just check for the presence of "maybeSnapshot",
|
||||
// Because for <= 15.x versions this might be a "prevContext" object.
|
||||
// We also can't just check "__reactInternalSnapshot",
|
||||
// Because get-snapshot might return a falsy value.
|
||||
// So check for the explicit __reactInternalSnapshotFlag flag to determine behavior.
|
||||
var snapshot = this.__reactInternalSnapshotFlag
|
||||
? this.__reactInternalSnapshot
|
||||
: maybeSnapshot;
|
||||
|
||||
componentDidUpdate.call(this, prevProps, prevState, snapshot);
|
||||
};
|
||||
}
|
||||
|
||||
return Component;
|
||||
}
|
||||
|
||||
exports.polyfill = polyfill;
|
||||
158
node_modules/react-lifecycles-compat/react-lifecycles-compat.es.js
generated
vendored
Normal file
158
node_modules/react-lifecycles-compat/react-lifecycles-compat.es.js
generated
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
/**
|
||||
* 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 componentWillMount() {
|
||||
// Call this.constructor.gDSFP to support sub-classes.
|
||||
var state = this.constructor.getDerivedStateFromProps(this.props, this.state);
|
||||
if (state !== null && state !== undefined) {
|
||||
this.setState(state);
|
||||
}
|
||||
}
|
||||
|
||||
function componentWillReceiveProps(nextProps) {
|
||||
// Call this.constructor.gDSFP to support sub-classes.
|
||||
// Use the setState() updater to ensure state isn't stale in certain edge cases.
|
||||
function updater(prevState) {
|
||||
var state = this.constructor.getDerivedStateFromProps(nextProps, prevState);
|
||||
return state !== null && state !== undefined ? state : null;
|
||||
}
|
||||
// Binding "this" is important for shallow renderer support.
|
||||
this.setState(updater.bind(this));
|
||||
}
|
||||
|
||||
function componentWillUpdate(nextProps, nextState) {
|
||||
try {
|
||||
var prevProps = this.props;
|
||||
var prevState = this.state;
|
||||
this.props = nextProps;
|
||||
this.state = nextState;
|
||||
this.__reactInternalSnapshotFlag = true;
|
||||
this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate(
|
||||
prevProps,
|
||||
prevState
|
||||
);
|
||||
} finally {
|
||||
this.props = prevProps;
|
||||
this.state = prevState;
|
||||
}
|
||||
}
|
||||
|
||||
// React may warn about cWM/cWRP/cWU methods being deprecated.
|
||||
// Add a flag to suppress these warnings for this special case.
|
||||
componentWillMount.__suppressDeprecationWarning = true;
|
||||
componentWillReceiveProps.__suppressDeprecationWarning = true;
|
||||
componentWillUpdate.__suppressDeprecationWarning = true;
|
||||
|
||||
function polyfill(Component) {
|
||||
var prototype = Component.prototype;
|
||||
|
||||
if (!prototype || !prototype.isReactComponent) {
|
||||
throw new Error('Can only polyfill class components');
|
||||
}
|
||||
|
||||
if (
|
||||
typeof Component.getDerivedStateFromProps !== 'function' &&
|
||||
typeof prototype.getSnapshotBeforeUpdate !== 'function'
|
||||
) {
|
||||
return Component;
|
||||
}
|
||||
|
||||
// If new component APIs are defined, "unsafe" lifecycles won't be called.
|
||||
// Error if any of these lifecycles are present,
|
||||
// Because they would work differently between older and newer (16.3+) versions of React.
|
||||
var foundWillMountName = null;
|
||||
var foundWillReceivePropsName = null;
|
||||
var foundWillUpdateName = null;
|
||||
if (typeof prototype.componentWillMount === 'function') {
|
||||
foundWillMountName = 'componentWillMount';
|
||||
} else if (typeof prototype.UNSAFE_componentWillMount === 'function') {
|
||||
foundWillMountName = 'UNSAFE_componentWillMount';
|
||||
}
|
||||
if (typeof prototype.componentWillReceiveProps === 'function') {
|
||||
foundWillReceivePropsName = 'componentWillReceiveProps';
|
||||
} else if (typeof prototype.UNSAFE_componentWillReceiveProps === 'function') {
|
||||
foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
|
||||
}
|
||||
if (typeof prototype.componentWillUpdate === 'function') {
|
||||
foundWillUpdateName = 'componentWillUpdate';
|
||||
} else if (typeof prototype.UNSAFE_componentWillUpdate === 'function') {
|
||||
foundWillUpdateName = 'UNSAFE_componentWillUpdate';
|
||||
}
|
||||
if (
|
||||
foundWillMountName !== null ||
|
||||
foundWillReceivePropsName !== null ||
|
||||
foundWillUpdateName !== null
|
||||
) {
|
||||
var componentName = Component.displayName || Component.name;
|
||||
var newApiName =
|
||||
typeof Component.getDerivedStateFromProps === 'function'
|
||||
? 'getDerivedStateFromProps()'
|
||||
: 'getSnapshotBeforeUpdate()';
|
||||
|
||||
throw Error(
|
||||
'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' +
|
||||
componentName +
|
||||
' uses ' +
|
||||
newApiName +
|
||||
' but also contains the following legacy lifecycles:' +
|
||||
(foundWillMountName !== null ? '\n ' + foundWillMountName : '') +
|
||||
(foundWillReceivePropsName !== null
|
||||
? '\n ' + foundWillReceivePropsName
|
||||
: '') +
|
||||
(foundWillUpdateName !== null ? '\n ' + foundWillUpdateName : '') +
|
||||
'\n\nThe above lifecycles should be removed. Learn more about this warning here:\n' +
|
||||
'https://fb.me/react-async-component-lifecycle-hooks'
|
||||
);
|
||||
}
|
||||
|
||||
// React <= 16.2 does not support static getDerivedStateFromProps.
|
||||
// As a workaround, use cWM and cWRP to invoke the new static lifecycle.
|
||||
// Newer versions of React will ignore these lifecycles if gDSFP exists.
|
||||
if (typeof Component.getDerivedStateFromProps === 'function') {
|
||||
prototype.componentWillMount = componentWillMount;
|
||||
prototype.componentWillReceiveProps = componentWillReceiveProps;
|
||||
}
|
||||
|
||||
// React <= 16.2 does not support getSnapshotBeforeUpdate.
|
||||
// As a workaround, use cWU to invoke the new lifecycle.
|
||||
// Newer versions of React will ignore that lifecycle if gSBU exists.
|
||||
if (typeof prototype.getSnapshotBeforeUpdate === 'function') {
|
||||
if (typeof prototype.componentDidUpdate !== 'function') {
|
||||
throw new Error(
|
||||
'Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype'
|
||||
);
|
||||
}
|
||||
|
||||
prototype.componentWillUpdate = componentWillUpdate;
|
||||
|
||||
var componentDidUpdate = prototype.componentDidUpdate;
|
||||
|
||||
prototype.componentDidUpdate = function componentDidUpdatePolyfill(
|
||||
prevProps,
|
||||
prevState,
|
||||
maybeSnapshot
|
||||
) {
|
||||
// 16.3+ will not execute our will-update method;
|
||||
// It will pass a snapshot value to did-update though.
|
||||
// Older versions will require our polyfilled will-update value.
|
||||
// We need to handle both cases, but can't just check for the presence of "maybeSnapshot",
|
||||
// Because for <= 15.x versions this might be a "prevContext" object.
|
||||
// We also can't just check "__reactInternalSnapshot",
|
||||
// Because get-snapshot might return a falsy value.
|
||||
// So check for the explicit __reactInternalSnapshotFlag flag to determine behavior.
|
||||
var snapshot = this.__reactInternalSnapshotFlag
|
||||
? this.__reactInternalSnapshot
|
||||
: maybeSnapshot;
|
||||
|
||||
componentDidUpdate.call(this, prevProps, prevState, snapshot);
|
||||
};
|
||||
}
|
||||
|
||||
return Component;
|
||||
}
|
||||
|
||||
export { polyfill };
|
||||
168
node_modules/react-lifecycles-compat/react-lifecycles-compat.js
generated
vendored
Normal file
168
node_modules/react-lifecycles-compat/react-lifecycles-compat.js
generated
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(factory((global.reactLifecyclesCompat = {})));
|
||||
}(this, (function (exports) { '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 componentWillMount() {
|
||||
// Call this.constructor.gDSFP to support sub-classes.
|
||||
var state = this.constructor.getDerivedStateFromProps(this.props, this.state);
|
||||
if (state !== null && state !== undefined) {
|
||||
this.setState(state);
|
||||
}
|
||||
}
|
||||
|
||||
function componentWillReceiveProps(nextProps) {
|
||||
// Call this.constructor.gDSFP to support sub-classes.
|
||||
// Use the setState() updater to ensure state isn't stale in certain edge cases.
|
||||
function updater(prevState) {
|
||||
var state = this.constructor.getDerivedStateFromProps(nextProps, prevState);
|
||||
return state !== null && state !== undefined ? state : null;
|
||||
}
|
||||
// Binding "this" is important for shallow renderer support.
|
||||
this.setState(updater.bind(this));
|
||||
}
|
||||
|
||||
function componentWillUpdate(nextProps, nextState) {
|
||||
try {
|
||||
var prevProps = this.props;
|
||||
var prevState = this.state;
|
||||
this.props = nextProps;
|
||||
this.state = nextState;
|
||||
this.__reactInternalSnapshotFlag = true;
|
||||
this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate(
|
||||
prevProps,
|
||||
prevState
|
||||
);
|
||||
} finally {
|
||||
this.props = prevProps;
|
||||
this.state = prevState;
|
||||
}
|
||||
}
|
||||
|
||||
// React may warn about cWM/cWRP/cWU methods being deprecated.
|
||||
// Add a flag to suppress these warnings for this special case.
|
||||
componentWillMount.__suppressDeprecationWarning = true;
|
||||
componentWillReceiveProps.__suppressDeprecationWarning = true;
|
||||
componentWillUpdate.__suppressDeprecationWarning = true;
|
||||
|
||||
function polyfill(Component) {
|
||||
var prototype = Component.prototype;
|
||||
|
||||
if (!prototype || !prototype.isReactComponent) {
|
||||
throw new Error('Can only polyfill class components');
|
||||
}
|
||||
|
||||
if (
|
||||
typeof Component.getDerivedStateFromProps !== 'function' &&
|
||||
typeof prototype.getSnapshotBeforeUpdate !== 'function'
|
||||
) {
|
||||
return Component;
|
||||
}
|
||||
|
||||
// If new component APIs are defined, "unsafe" lifecycles won't be called.
|
||||
// Error if any of these lifecycles are present,
|
||||
// Because they would work differently between older and newer (16.3+) versions of React.
|
||||
var foundWillMountName = null;
|
||||
var foundWillReceivePropsName = null;
|
||||
var foundWillUpdateName = null;
|
||||
if (typeof prototype.componentWillMount === 'function') {
|
||||
foundWillMountName = 'componentWillMount';
|
||||
} else if (typeof prototype.UNSAFE_componentWillMount === 'function') {
|
||||
foundWillMountName = 'UNSAFE_componentWillMount';
|
||||
}
|
||||
if (typeof prototype.componentWillReceiveProps === 'function') {
|
||||
foundWillReceivePropsName = 'componentWillReceiveProps';
|
||||
} else if (typeof prototype.UNSAFE_componentWillReceiveProps === 'function') {
|
||||
foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
|
||||
}
|
||||
if (typeof prototype.componentWillUpdate === 'function') {
|
||||
foundWillUpdateName = 'componentWillUpdate';
|
||||
} else if (typeof prototype.UNSAFE_componentWillUpdate === 'function') {
|
||||
foundWillUpdateName = 'UNSAFE_componentWillUpdate';
|
||||
}
|
||||
if (
|
||||
foundWillMountName !== null ||
|
||||
foundWillReceivePropsName !== null ||
|
||||
foundWillUpdateName !== null
|
||||
) {
|
||||
var componentName = Component.displayName || Component.name;
|
||||
var newApiName =
|
||||
typeof Component.getDerivedStateFromProps === 'function'
|
||||
? 'getDerivedStateFromProps()'
|
||||
: 'getSnapshotBeforeUpdate()';
|
||||
|
||||
throw Error(
|
||||
'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' +
|
||||
componentName +
|
||||
' uses ' +
|
||||
newApiName +
|
||||
' but also contains the following legacy lifecycles:' +
|
||||
(foundWillMountName !== null ? '\n ' + foundWillMountName : '') +
|
||||
(foundWillReceivePropsName !== null
|
||||
? '\n ' + foundWillReceivePropsName
|
||||
: '') +
|
||||
(foundWillUpdateName !== null ? '\n ' + foundWillUpdateName : '') +
|
||||
'\n\nThe above lifecycles should be removed. Learn more about this warning here:\n' +
|
||||
'https://fb.me/react-async-component-lifecycle-hooks'
|
||||
);
|
||||
}
|
||||
|
||||
// React <= 16.2 does not support static getDerivedStateFromProps.
|
||||
// As a workaround, use cWM and cWRP to invoke the new static lifecycle.
|
||||
// Newer versions of React will ignore these lifecycles if gDSFP exists.
|
||||
if (typeof Component.getDerivedStateFromProps === 'function') {
|
||||
prototype.componentWillMount = componentWillMount;
|
||||
prototype.componentWillReceiveProps = componentWillReceiveProps;
|
||||
}
|
||||
|
||||
// React <= 16.2 does not support getSnapshotBeforeUpdate.
|
||||
// As a workaround, use cWU to invoke the new lifecycle.
|
||||
// Newer versions of React will ignore that lifecycle if gSBU exists.
|
||||
if (typeof prototype.getSnapshotBeforeUpdate === 'function') {
|
||||
if (typeof prototype.componentDidUpdate !== 'function') {
|
||||
throw new Error(
|
||||
'Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype'
|
||||
);
|
||||
}
|
||||
|
||||
prototype.componentWillUpdate = componentWillUpdate;
|
||||
|
||||
var componentDidUpdate = prototype.componentDidUpdate;
|
||||
|
||||
prototype.componentDidUpdate = function componentDidUpdatePolyfill(
|
||||
prevProps,
|
||||
prevState,
|
||||
maybeSnapshot
|
||||
) {
|
||||
// 16.3+ will not execute our will-update method;
|
||||
// It will pass a snapshot value to did-update though.
|
||||
// Older versions will require our polyfilled will-update value.
|
||||
// We need to handle both cases, but can't just check for the presence of "maybeSnapshot",
|
||||
// Because for <= 15.x versions this might be a "prevContext" object.
|
||||
// We also can't just check "__reactInternalSnapshot",
|
||||
// Because get-snapshot might return a falsy value.
|
||||
// So check for the explicit __reactInternalSnapshotFlag flag to determine behavior.
|
||||
var snapshot = this.__reactInternalSnapshotFlag
|
||||
? this.__reactInternalSnapshot
|
||||
: maybeSnapshot;
|
||||
|
||||
componentDidUpdate.call(this, prevProps, prevState, snapshot);
|
||||
};
|
||||
}
|
||||
|
||||
return Component;
|
||||
}
|
||||
|
||||
exports.polyfill = polyfill;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
})));
|
||||
1
node_modules/react-lifecycles-compat/react-lifecycles-compat.min.js
generated
vendored
Normal file
1
node_modules/react-lifecycles-compat/react-lifecycles-compat.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.reactLifecyclesCompat={})}(this,function(e){"use strict";function t(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);null!==e&&void 0!==e&&this.setState(e)}function n(e){this.setState(function(t){var n=this.constructor.getDerivedStateFromProps(e,t);return null!==n&&void 0!==n?n:null}.bind(this))}function o(e,t){try{var n=this.props,o=this.state;this.props=e,this.state=t,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,o)}finally{this.props=n,this.state=o}}t.__suppressDeprecationWarning=!0,n.__suppressDeprecationWarning=!0,o.__suppressDeprecationWarning=!0,e.polyfill=function(e){var i=e.prototype;if(!i||!i.isReactComponent)throw new Error("Can only polyfill class components");if("function"!=typeof e.getDerivedStateFromProps&&"function"!=typeof i.getSnapshotBeforeUpdate)return e;var p=null,l=null,r=null;if("function"==typeof i.componentWillMount?p="componentWillMount":"function"==typeof i.UNSAFE_componentWillMount&&(p="UNSAFE_componentWillMount"),"function"==typeof i.componentWillReceiveProps?l="componentWillReceiveProps":"function"==typeof i.UNSAFE_componentWillReceiveProps&&(l="UNSAFE_componentWillReceiveProps"),"function"==typeof i.componentWillUpdate?r="componentWillUpdate":"function"==typeof i.UNSAFE_componentWillUpdate&&(r="UNSAFE_componentWillUpdate"),null!==p||null!==l||null!==r){var s=e.displayName||e.name,a="function"==typeof e.getDerivedStateFromProps?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n"+s+" uses "+a+" but also contains the following legacy lifecycles:"+(null!==p?"\n "+p:"")+(null!==l?"\n "+l:"")+(null!==r?"\n "+r:"")+"\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks")}if("function"==typeof e.getDerivedStateFromProps&&(i.componentWillMount=t,i.componentWillReceiveProps=n),"function"==typeof i.getSnapshotBeforeUpdate){if("function"!=typeof i.componentDidUpdate)throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");i.componentWillUpdate=o;var c=i.componentDidUpdate;i.componentDidUpdate=function(e,t,n){var o=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:n;c.call(this,e,t,o)}}return e},Object.defineProperty(e,"__esModule",{value:!0})});
|
||||
Reference in New Issue
Block a user