Completely updated React, fixed #11, (hopefully)

This commit is contained in:
2018-03-04 19:11:49 -05:00
parent 6e0afd6e2a
commit 34e5f5139a
13674 changed files with 333464 additions and 473223 deletions

View File

@@ -1,6 +0,0 @@
.idea
.coveralls.yml
.eslintrc
.travis.yml
/artifacts/
/tests/

View File

@@ -17,9 +17,9 @@ $ npm install --save hoist-non-react-statics
## Usage
```js
import hoistNonReactStatic from 'hoist-non-react-statics';
import hoistNonReactStatics from 'hoist-non-react-statics';
hoistNonReactStatic(targetComponent, sourceComponent);
hoistNonReactStatics(targetComponent, sourceComponent);
```
## What does this module do?
@@ -30,7 +30,7 @@ See this [explanation](https://facebook.github.io/react/docs/higher-order-compon
| Compatible React Version | hoist-non-react-statics Version |
|--------------------------|-------------------------------|
| 0.13-15.0 | >= 1.0.0 |
| 0.13-16.0 | >= 1.0.0 |
## Browser Support

View File

@@ -2,64 +2,71 @@
* Copyright 2015, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
'use strict';
var REACT_STATICS = {
childContextTypes: true,
contextTypes: true,
defaultProps: true,
displayName: true,
getDefaultProps: true,
mixins: true,
propTypes: true,
type: true
};
var KNOWN_STATICS = {
name: true,
length: true,
prototype: true,
caller: true,
callee: true,
arguments: true,
arity: true
};
var defineProperty = Object.defineProperty;
var getOwnPropertyNames = Object.getOwnPropertyNames;
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var getPrototypeOf = Object.getPrototypeOf;
var objectPrototype = getPrototypeOf && getPrototypeOf(Object);
module.exports = function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components
if (objectPrototype) {
var inheritedComponent = getPrototypeOf(sourceComponent);
if (inheritedComponent && inheritedComponent !== objectPrototype) {
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.hoistNonReactStatics = factory());
}(this, (function () {
'use strict';
var REACT_STATICS = {
childContextTypes: true,
contextTypes: true,
defaultProps: true,
displayName: true,
getDefaultProps: true,
getDerivedStateFromProps: true,
mixins: true,
propTypes: true,
type: true
};
var KNOWN_STATICS = {
name: true,
length: true,
prototype: true,
caller: true,
callee: true,
arguments: true,
arity: true
};
var defineProperty = Object.defineProperty;
var getOwnPropertyNames = Object.getOwnPropertyNames;
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var getPrototypeOf = Object.getPrototypeOf;
var objectPrototype = getPrototypeOf && getPrototypeOf(Object);
return function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components
if (objectPrototype) {
var inheritedComponent = getPrototypeOf(sourceComponent);
if (inheritedComponent && inheritedComponent !== objectPrototype) {
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
}
}
}
var keys = getOwnPropertyNames(sourceComponent);
if (getOwnPropertySymbols) {
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
}
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
if (!REACT_STATICS[key] && !KNOWN_STATICS[key] && (!blacklist || !blacklist[key])) {
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
try { // Avoid failures from read-only properties
defineProperty(targetComponent, key, descriptor);
} catch (e) {}
var keys = getOwnPropertyNames(sourceComponent);
if (getOwnPropertySymbols) {
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
}
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
if (!REACT_STATICS[key] && !KNOWN_STATICS[key] && (!blacklist || !blacklist[key])) {
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
try { // Avoid failures from read-only properties
defineProperty(targetComponent, key, descriptor);
} catch (e) {}
}
}
return targetComponent;
}
return targetComponent;
}
return targetComponent;
};
};
})));

View File

@@ -1,20 +1,42 @@
{
"name": "hoist-non-react-statics",
"version": "2.3.1",
"_args": [
[
"hoist-non-react-statics@2.5.0",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI"
]
],
"_from": "hoist-non-react-statics@2.5.0",
"_id": "hoist-non-react-statics@2.5.0",
"_inBundle": false,
"_integrity": "sha512-6Bl6XsDT1ntE0lHbIhr4Kp2PGcleGZ66qu5Jqk8lc0Xc/IeG6gVLmwUGs/K0Us+L8VWoKgj0uWdPMataOsm31w==",
"_location": "/material-ui/hoist-non-react-statics",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "hoist-non-react-statics@2.5.0",
"name": "hoist-non-react-statics",
"escapedName": "hoist-non-react-statics",
"rawSpec": "2.5.0",
"saveSpec": null,
"fetchSpec": "2.5.0"
},
"_requiredBy": [
"/material-ui",
"/material-ui/react-jss",
"/material-ui/recompose"
],
"_resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-2.5.0.tgz",
"_spec": "2.5.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",
"author": {
"name": "Michael Ridgway",
"email": "mcridgway@gmail.com"
},
"bugs": {
"url": "https://github.com/mridgway/hoist-non-react-statics/issues"
},
"description": "Copies non-react specific statics from a child component to a parent component",
"main": "index.js",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "git://github.com/mridgway/hoist-non-react-statics.git"
},
"scripts": {
"cover": "node node_modules/istanbul/lib/cli.js cover --dir artifacts -- ./node_modules/mocha/bin/_mocha tests/unit/ --recursive --compilers js:babel/register --reporter spec",
"lint": "eslint ./index.js",
"test": "mocha tests/unit/ --recursive --compilers js:babel-register --reporter spec"
},
"author": "Michael Ridgway <mcridgway@gmail.com>",
"license": "BSD-3-Clause",
"devDependencies": {
"babel": "^6.23.0",
"babel-cli": "^6.24.1",
@@ -33,7 +55,22 @@
"pre-commit": "^1.0.7",
"react": "^15.0.0"
},
"homepage": "https://github.com/mridgway/hoist-non-react-statics#readme",
"keywords": [
"react"
]
],
"license": "BSD-3-Clause",
"main": "index.js",
"name": "hoist-non-react-statics",
"repository": {
"type": "git",
"url": "git://github.com/mridgway/hoist-non-react-statics.git"
},
"scripts": {
"cover": "node node_modules/istanbul/lib/cli.js cover --dir artifacts -- ./node_modules/mocha/bin/_mocha tests/unit/ --recursive --compilers js:babel/register --reporter spec",
"lint": "eslint ./index.js",
"test": "mocha tests/unit/ --recursive --compilers js:babel-register --reporter spec"
},
"types": "index.d.ts",
"version": "2.5.0"
}