babel-plugin-transform-react-remove-prop-types
Advanced tools
Comparing version 0.4.6 to 0.4.7
{ | ||
"name": "babel-plugin-transform-react-remove-prop-types", | ||
"version": "0.4.6", | ||
"version": "0.4.7", | ||
"description": "Remove unnecessary React propTypes from the production build", | ||
@@ -14,3 +14,3 @@ "main": "lib/index.js", | ||
"flow": "flow", | ||
"prepublish": "npm run build && pkgfiles" | ||
"source": "npm run build && pkgfiles" | ||
}, | ||
@@ -34,10 +34,10 @@ "repository": { | ||
"dependencies": { | ||
"babel-traverse": "^6.24.1" | ||
"babel-traverse": "^6.25.0" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.22.2", | ||
"babel-core": "^6.22.1", | ||
"babel-eslint": "^7.1.1", | ||
"babel-generator": "^6.24.1", | ||
"babel-plugin-flow-react-proptypes": "^2.1.3", | ||
"babel-core": "^6.25.0", | ||
"babel-eslint": "^7.2.3", | ||
"babel-generator": "^6.25.0", | ||
"babel-plugin-flow-react-proptypes": "^4.1.0", | ||
"babel-plugin-transform-flow-strip-types": "^6.22.0", | ||
@@ -47,13 +47,13 @@ "babel-preset-es2015": "^6.22.0", | ||
"babel-preset-stage-0": "^6.22.0", | ||
"chai": "^4.0.2", | ||
"chai": "^4.1.0", | ||
"eslint": "^3.19.0", | ||
"eslint-config-airbnb": "^14.0.0", | ||
"eslint-plugin-babel": "^4.0.1", | ||
"eslint-plugin-flowtype": "^2.30.0", | ||
"eslint-plugin-import": "^2.2.0", | ||
"eslint-plugin-jsx-a11y": "^3.0.2", | ||
"eslint-plugin-mocha": "^4.8.0", | ||
"eslint-plugin-react": "^6.9.0", | ||
"flow-bin": "^0.43.1", | ||
"mocha": "^3.2.0", | ||
"eslint-config-airbnb": "^15.1.0", | ||
"eslint-plugin-babel": "^4.1.2", | ||
"eslint-plugin-flowtype": "^2.35.0", | ||
"eslint-plugin-import": "^2.7.0", | ||
"eslint-plugin-jsx-a11y": "^5.0.3", | ||
"eslint-plugin-mocha": "^4.11.0", | ||
"eslint-plugin-react": "^7.1.0", | ||
"flow-bin": "^0.51.1", | ||
"mocha": "^3.5.0", | ||
"path-exists": "^3.0.0", | ||
@@ -60,0 +60,0 @@ "pkgfiles": "^2.3.2" |
@@ -168,3 +168,3 @@ # babel-plugin-transform-react-remove-prop-types | ||
### `additionalLibraries` | ||
### `additionalLibraries` | ||
@@ -171,0 +171,0 @@ This option gives the possibility to remove other `propTypes` in addition to the canonical `prop-types`. |
// @flow weak | ||
/* eslint-disable global-require, import/no-dynamic-require */ | ||
import { visitors } from 'babel-traverse'; | ||
import traverse, { visitors } from 'babel-traverse'; | ||
// import generate from 'babel-generator'; | ||
@@ -82,3 +82,14 @@ // console.log(generate(node).code); | ||
if (state.opts.plugins) { | ||
const pluginsVisitors = state.opts.plugins.map((pluginName) => { | ||
const pluginsState = state; | ||
const pluginsVisitors = state.opts.plugins.map((pluginOpts) => { | ||
const pluginName = | ||
typeof pluginOpts === 'string' ? pluginOpts : pluginOpts[0]; | ||
if (typeof pluginOpts !== 'string') { | ||
pluginsState.opts = { | ||
...pluginsState.opts, | ||
...pluginOpts[1], | ||
}; | ||
} | ||
const plugin = require(pluginName); | ||
@@ -88,3 +99,9 @@ return plugin({ template, types }).visitor; | ||
programPath.traverse(visitors.merge(pluginsVisitors)); | ||
traverse( | ||
programPath.parent, | ||
visitors.merge(pluginsVisitors), | ||
programPath.scope, | ||
pluginsState, | ||
programPath.parentPath, | ||
); | ||
} | ||
@@ -91,0 +108,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31790
669
Updatedbabel-traverse@^6.25.0