babel-plugin-react-v-html
Advanced tools
+1
-1
| { | ||
| "name": "babel-plugin-react-v-html", | ||
| "version": "1.0.1", | ||
| "version": "1.0.3", | ||
| "description": "Babel plugin for React component to transform the JSXAttribute from v-html to dangerouslySetInnerHTML.", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
+23
-14
@@ -1,8 +0,7 @@ | ||
| module.exports = ({ types: babelTypes }) => ({ | ||
| module.exports = ({ | ||
| types: babelTypes | ||
| }) => ({ | ||
| visitor: { | ||
| JSXIdentifier(path) { | ||
| const name = path.node.name; | ||
| if (name === 'v-html') { | ||
| path.node.name = 'dangerouslySetInnerHTML'; | ||
| if (path.node.name === 'v-html') { | ||
| const { | ||
@@ -12,13 +11,23 @@ JSXExpressionContainer, | ||
| ObjectProperty, | ||
| StringLiteral | ||
| } = babelTypes; | ||
| StringLiteral, | ||
| JSXIdentifier | ||
| } = babelTypes | ||
| path.container.value = JSXExpressionContainer( | ||
| ObjectExpression([ | ||
| ObjectProperty( | ||
| StringLiteral('__html'), | ||
| path.container.value.expression, | ||
| ) | ||
| ]) | ||
| path.replaceWith( | ||
| JSXIdentifier('dangerouslySetInnerHTML') | ||
| ) | ||
| const htmlContainer = path.parentPath.get('value'), | ||
| html = htmlContainer.get('expression') | ||
| htmlContainer.replaceWith( | ||
| JSXExpressionContainer( | ||
| ObjectExpression([ | ||
| ObjectProperty( | ||
| StringLiteral('__html'), | ||
| html.node | ||
| ) | ||
| ]) | ||
| ) | ||
| ) | ||
| } | ||
@@ -25,0 +34,0 @@ } |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
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
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
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
11906
2.01%197
4.23%