@team-griffin/react-dye
Advanced tools
Comparing version 3.0.1 to 3.0.2
'use strict'; | ||
if (process.env.NODE_ENV === 'production') { | ||
module.exports = require('./react-dye.production.js'); | ||
} else { | ||
module.exports = require('./react-dye.development.js'); | ||
} | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var React = require('react'); | ||
var React__default = _interopDefault(React); | ||
var ThemeContext = React.createContext(null); | ||
var Provider = ThemeContext.Provider, | ||
Consumer = ThemeContext.Consumer; | ||
var ThemeProvider = function ThemeProvider(_ref) { | ||
var theme = _ref.theme, | ||
children = _ref.children; | ||
return React__default.createElement( | ||
Provider, | ||
{ | ||
value: theme | ||
}, | ||
children | ||
); | ||
}; | ||
// eslint-disable-next-line | ||
ThemeProvider.displayName = 'ThemeProvider'; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var withTheme = (function (WrappedComponent) { | ||
var WithTheme = function WithTheme(props) { | ||
return React__default.createElement( | ||
Consumer, | ||
null, | ||
function (providedTheme) { | ||
return React__default.createElement(WrappedComponent, _extends({ | ||
theme: providedTheme | ||
}, props)); | ||
} | ||
); | ||
}; | ||
// eslint-disable-next-line | ||
WithTheme.displayName = 'WithTheme'; | ||
return WithTheme; | ||
}); | ||
var useTheme = function useTheme() { | ||
var theme = React.useContext(ThemeContext); | ||
return theme; | ||
}; | ||
var withThemeHook = function withThemeHook(props) { | ||
return Object.assign({ | ||
theme: useTheme() | ||
}, props); | ||
}; | ||
exports.ThemeProvider = ThemeProvider; | ||
exports.useTheme = useTheme; | ||
exports.withTheme = withTheme; | ||
exports.withThemeHook = withThemeHook; |
@@ -1,5 +0,56 @@ | ||
if (process.env.NODE_ENV === 'production') { | ||
module.exports = require('./react-dye.production.js'); | ||
} else { | ||
module.exports = require('./react-dye.development.js'); | ||
} | ||
import React, { createContext, useContext } from 'react'; | ||
var ThemeContext = createContext(null); | ||
var Provider = ThemeContext.Provider, | ||
Consumer = ThemeContext.Consumer; | ||
var ThemeProvider = function ThemeProvider(_ref) { | ||
var theme = _ref.theme, | ||
children = _ref.children; | ||
return React.createElement( | ||
Provider, | ||
{ | ||
value: theme | ||
}, | ||
children | ||
); | ||
}; | ||
// eslint-disable-next-line | ||
ThemeProvider.displayName = 'ThemeProvider'; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var withTheme = (function (WrappedComponent) { | ||
var WithTheme = function WithTheme(props) { | ||
return React.createElement( | ||
Consumer, | ||
null, | ||
function (providedTheme) { | ||
return React.createElement(WrappedComponent, _extends({ | ||
theme: providedTheme | ||
}, props)); | ||
} | ||
); | ||
}; | ||
// eslint-disable-next-line | ||
WithTheme.displayName = 'WithTheme'; | ||
return WithTheme; | ||
}); | ||
var useTheme = function useTheme() { | ||
var theme = useContext(ThemeContext); | ||
return theme; | ||
}; | ||
var withThemeHook = function withThemeHook(props) { | ||
return Object.assign({ | ||
theme: useTheme() | ||
}, props); | ||
}; | ||
export { ThemeProvider, useTheme, withTheme, withThemeHook }; |
{ | ||
"name": "@team-griffin/react-dye", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"main": "dist/cjs/react-dye.js", | ||
@@ -12,11 +12,5 @@ "module": "dist/es/react-dye.js", | ||
"transpile": "babel src -d lib --copy-files", | ||
"lint": "npm run lint:js && npm run flow", | ||
"lint:js": "eslint -c ./config/.eslintrc.js 'src/**/*.js'", | ||
"lint:js:fix": "eslint --fix -c ./config/.eslintrc.js 'src/**/*.js'", | ||
"lint": "eslint -c ./config/.eslintrc.js 'src/**/*.js'", | ||
"build-storybook": "build-storybook", | ||
"flow": "flow check; test $? -eq 0 -o $? -eq 2", | ||
"build:dev": "cross-env NODE_ENV=development rollup --config ./rollup/development.js", | ||
"build:prod": "cross-env NODE_ENV=production rollup --config ./rollup/production.js", | ||
"build:entry": "cross-env NODE_ENV=production rollup --config ./rollup/entry.js", | ||
"build": "yarn build:dev && yarn build:prod && yarn build:entry", | ||
"build": "rm -rf dist && rollup --config ./rollup.config.js", | ||
"test": "node_modules/.bin/karma start ./config/karma.conf.js", | ||
@@ -45,13 +39,9 @@ "test:single": "yarn run test -- --single", | ||
"babel-runtime": "^6.26.0", | ||
"cross-env": "^5.1.3", | ||
"cross-env": "^7.0.2", | ||
"dockerscript": "^0.0.6", | ||
"eslint": "^4.13.0", | ||
"eslint-plugin-flowtype": "^2.30.4", | ||
"eslint": "^6.8.0", | ||
"eslint-plugin-react": "^7.5.1", | ||
"rollup": "^0.55.3", | ||
"rollup": "^2.3.2", | ||
"rollup-plugin-babel": "^3.0.3", | ||
"rollup-plugin-local-resolve": "^1.0.7", | ||
"rollup-plugin-memory": "^3.0.0", | ||
"rollup-plugin-replace": "^2.0.0", | ||
"rollup-plugin-uglify-es": "^0.0.1" | ||
"rollup-plugin-node-resolve": "^5.2.0" | ||
}, | ||
@@ -58,0 +48,0 @@ "dependencies": {}, |
@@ -15,4 +15,5 @@ import React from 'react'; | ||
// eslint-disable-next-line | ||
ThemeProvider.displayName = 'ThemeProvider'; | ||
export default ThemeProvider; |
@@ -16,2 +16,3 @@ import React from 'react'; | ||
// eslint-disable-next-line | ||
WithTheme.displayName = 'WithTheme'; | ||
@@ -18,0 +19,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
22
1
1
12015
20
253
1