Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hoist-non-react-statics

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hoist-non-react-statics - npm Package Compare versions

Comparing version 3.2.1 to 3.3.0

3

CHANGELOG.md

@@ -0,1 +1,4 @@

# 3.3.0 (January 23, 2019)
- Prevent hoisting of React.memo statics (#73)
# 3.2.1 (December 3, 2018)

@@ -2,0 +5,0 @@ - Fixed `defaultProps`, `displayName` and `propTypes` being hoisted from `React.forwardRef` to `React.forwardRef`. ([#71])

@@ -40,5 +40,21 @@ 'use strict';

var MEMO_STATICS = {
'$$typeof': true,
compare: true,
defaultProps: true,
displayName: true,
propTypes: true,
type: true
};
var TYPE_STATICS = {};
TYPE_STATICS[ReactIs.ForwardRef] = FORWARD_REF_STATICS;
function getStatics(component) {
if (ReactIs.isMemo(component)) {
return MEMO_STATICS;
}
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
}
var defineProperty = Object.defineProperty;

@@ -68,4 +84,4 @@ var getOwnPropertyNames = Object.getOwnPropertyNames;

var targetStatics = TYPE_STATICS[targetComponent['$$typeof']] || REACT_STATICS;
var sourceStatics = TYPE_STATICS[sourceComponent['$$typeof']] || REACT_STATICS;
var targetStatics = getStatics(targetComponent);
var sourceStatics = getStatics(sourceComponent);

@@ -72,0 +88,0 @@ for (var i = 0; i < keys.length; ++i) {

@@ -44,5 +44,21 @@ (function (global, factory) {

var MEMO_STATICS = {
'$$typeof': true,
compare: true,
defaultProps: true,
displayName: true,
propTypes: true,
type: true
};
var TYPE_STATICS = {};
TYPE_STATICS[ReactIs.ForwardRef] = FORWARD_REF_STATICS;
function getStatics(component) {
if (ReactIs.isMemo(component)) {
return MEMO_STATICS;
}
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
}
var defineProperty = Object.defineProperty;

@@ -72,4 +88,4 @@ var getOwnPropertyNames = Object.getOwnPropertyNames;

var targetStatics = TYPE_STATICS[targetComponent['$$typeof']] || REACT_STATICS;
var sourceStatics = TYPE_STATICS[sourceComponent['$$typeof']] || REACT_STATICS;
var targetStatics = getStatics(targetComponent);
var sourceStatics = getStatics(sourceComponent);

@@ -76,0 +92,0 @@ for (var i = 0; i < keys.length; ++i) {

2

dist/hoist-non-react-statics.min.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.hoistNonReactStatics=t()}(this,function(){"use strict";var e=require("react-is"),s={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},d={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},u={};u[e.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0};var l=Object.defineProperty,m=Object.getOwnPropertyNames,g=Object.getOwnPropertySymbols,O=Object.getOwnPropertyDescriptor,v=Object.getPrototypeOf,P=Object.prototype;return function e(t,r,o){if("string"!=typeof r){if(P){var p=v(r);p&&p!==P&&e(t,p,o)}var n=m(r);g&&(n=n.concat(g(r)));for(var a=u[t.$$typeof]||s,i=u[r.$$typeof]||s,c=0;c<n.length;++c){var f=n[c];if(!(d[f]||o&&o[f]||i&&i[f]||a&&a[f])){var y=O(r,f);try{l(t,f,y)}catch(e){}}}return t}return t}});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.hoistNonReactStatics=t()}(this,function(){"use strict";var t=require("react-is"),r={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},f={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},o={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},p={};function d(e){return t.isMemo(e)?o:p[e.$$typeof]||r}p[t.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0};var u=Object.defineProperty,l=Object.getOwnPropertyNames,m=Object.getOwnPropertySymbols,g=Object.getOwnPropertyDescriptor,O=Object.getPrototypeOf,P=Object.prototype;return function e(t,r,o){if("string"!=typeof r){if(P){var p=O(r);p&&p!==P&&e(t,p,o)}var n=l(r);m&&(n=n.concat(m(r)));for(var a=d(t),i=d(r),s=0;s<n.length;++s){var y=n[s];if(!(f[y]||o&&o[y]||i&&i[y]||a&&a[y])){var c=g(r,y);try{u(t,y,c)}catch(e){}}}return t}return t}});
{
"name": "hoist-non-react-statics",
"version": "3.2.1",
"version": "3.3.0",
"description": "Copies non-react specific statics from a child component to a parent component",

@@ -27,3 +27,3 @@ "main": "dist/hoist-non-react-statics.cjs.js",

"dependencies": {
"react-is": "^16.3.2"
"react-is": "^16.7.0"
},

@@ -48,3 +48,3 @@ "devDependencies": {

"prop-types": "^15.6.2",
"react": "^16.3.2",
"react": "^16.7.0",
"rimraf": "^2.6.2",

@@ -51,0 +51,0 @@ "rollup": "^0.52.3",

@@ -38,5 +38,21 @@ /**

const MEMO_STATICS = {
'$$typeof': true,
compare: true,
defaultProps: true,
displayName: true,
propTypes: true,
type: true,
}
const TYPE_STATICS = {};
TYPE_STATICS[ReactIs.ForwardRef] = FORWARD_REF_STATICS;
function getStatics(component) {
if (ReactIs.isMemo(component)) {
return MEMO_STATICS;
}
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
}
const defineProperty = Object.defineProperty;

@@ -65,4 +81,4 @@ const getOwnPropertyNames = Object.getOwnPropertyNames;

const targetStatics = TYPE_STATICS[targetComponent['$$typeof']] || REACT_STATICS;
const sourceStatics = TYPE_STATICS[sourceComponent['$$typeof']] || REACT_STATICS;
const targetStatics = getStatics(targetComponent);
const sourceStatics = getStatics(sourceComponent);

@@ -69,0 +85,0 @@ for (let i = 0; i < keys.length; ++i) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc