add more plugins, rename some

This commit is contained in:
Sebastian McKenzie
2015-09-15 06:12:46 +01:00
parent 3e8cbc60eb
commit 9969224a93
328 changed files with 2013 additions and 1543 deletions

View File

@@ -0,0 +1,3 @@
node_modules
*.log
src

View File

@@ -0,0 +1,35 @@
# babel-plugin-transform-jscript
Babel plugin to fix buggy JScript named function expressions
## Installation
```sh
$ npm install babel-plugin-transform-jscript
```
## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
```json
{
"plugins": ["transform-jscript"]
}
```
### Via CLI
```sh
$ babel --plugins transform-jscript script.js
```
### Via Node API
```javascript
require("babel-core").transform("code", {
plugins: ["transform-jscript"]
});
```

View File

@@ -0,0 +1,11 @@
{
"name": "babel-plugin-transform-jscript",
"version": "1.0.4",
"description": "Babel plugin to fix buggy JScript named function expressions",
"repository": "babel/babel",
"license": "MIT",
"main": "lib/index.js",
"keywords": [
"babel-plugin"
]
}

View File

@@ -0,0 +1,20 @@
export default function ({ types: t }) {
return {
visitor: {
FunctionExpression: {
exit(node) {
if (!node.id) return;
node._ignoreUserWhitespace = true;
return t.callExpression(
t.functionExpression(null, [], t.blockStatement([
t.toStatement(node),
t.returnStatement(node.id)
])),
[]
);
}
}
}
};
}