removed plugin transform eval (#7262)
This commit is contained in:
parent
b96fdf8780
commit
88e550c733
@ -1,3 +0,0 @@
|
||||
src
|
||||
test
|
||||
*.log
|
||||
@ -1,49 +0,0 @@
|
||||
# @babel/plugin-transform-eval
|
||||
|
||||
> This plugin allows Babel to compile eval calls with string literals.
|
||||
|
||||
## Example
|
||||
|
||||
**In**
|
||||
|
||||
```javascript
|
||||
eval("(() => 'foo')");
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```javascript
|
||||
eval("(function () { return 'foo'; })");
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/plugin-transform-eval
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Via `.babelrc` (Recommended)
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["@babel/plugin-transform-eval"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins @babel/plugin-transform-eval script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["@babel/plugin-transform-eval"]
|
||||
});
|
||||
```
|
||||
@ -1,18 +0,0 @@
|
||||
{
|
||||
"name": "@babel/plugin-transform-eval",
|
||||
"version": "7.0.0-beta.38",
|
||||
"description": "Compile eval calls with string literals",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-eval",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"keywords": [
|
||||
"babel-plugin"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"@babel/core": "7.0.0-beta.38"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.0.0-beta.38",
|
||||
"@babel/helper-plugin-test-runner": "7.0.0-beta.38"
|
||||
}
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
export default function({ parse, traverse }) {
|
||||
return {
|
||||
visitor: {
|
||||
CallExpression(path) {
|
||||
if (
|
||||
path.get("callee").isIdentifier({ name: "eval" }) &&
|
||||
path.node.arguments.length === 1
|
||||
) {
|
||||
const evaluate = path.get("arguments")[0].evaluate();
|
||||
if (!evaluate.confident) return;
|
||||
|
||||
const code = evaluate.value;
|
||||
if (typeof code !== "string") return;
|
||||
|
||||
const ast = parse(code);
|
||||
traverse.removeProperties(ast);
|
||||
return ast.program;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
@ -48,7 +48,6 @@
|
||||
"@babel/plugin-transform-destructuring": "7.0.0-beta.38",
|
||||
"@babel/plugin-transform-dotall-regex": "7.0.0-beta.38",
|
||||
"@babel/plugin-transform-duplicate-keys": "7.0.0-beta.38",
|
||||
"@babel/plugin-transform-eval": "7.0.0-beta.38",
|
||||
"@babel/plugin-transform-exponentiation-operator": "7.0.0-beta.38",
|
||||
"@babel/plugin-transform-flow-comments": "7.0.0-beta.38",
|
||||
"@babel/plugin-transform-flow-strip-types": "7.0.0-beta.38",
|
||||
|
||||
@ -194,7 +194,6 @@ registerPlugins({
|
||||
"transform-member-expression-literals": require("@babel/plugin-transform-member-expression-literals"),
|
||||
"transform-property-literals": require("@babel/plugin-transform-property-literals"),
|
||||
"transform-property-mutators": require("@babel/plugin-transform-property-mutators"),
|
||||
"transform-eval": require("@babel/plugin-transform-eval"),
|
||||
"transform-exponentiation-operator": require("@babel/plugin-transform-exponentiation-operator"),
|
||||
"transform-flow-comments": require("@babel/plugin-transform-flow-comments"),
|
||||
"transform-flow-strip-types": require("@babel/plugin-transform-flow-strip-types"),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user