add more plugins, rename some
This commit is contained in:
parent
3e8cbc60eb
commit
9969224a93
@ -1,35 +0,0 @@
|
|||||||
# babel-plugin-async-to-bluebird-coroutines
|
|
||||||
|
|
||||||
Turn async functions into a Bluebird coroutine
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm install babel-plugin-async-to-bluebird-coroutines
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### Via `.babelrc` (Recommended)
|
|
||||||
|
|
||||||
**.babelrc**
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"plugins": ["async-to-bluebird-coroutines"]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via CLI
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ babel --plugins async-to-bluebird-coroutines script.js
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via Node API
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
require("babel-core").transform("code", {
|
|
||||||
plugins: ["async-to-bluebird-coroutines"]
|
|
||||||
});
|
|
||||||
```
|
|
||||||
22
packages/babel-plugin-builder-react-jsx/README.md
Normal file
22
packages/babel-plugin-builder-react-jsx/README.md
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# babel-plugin-builder-react-jsx
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
type ElementState = {
|
||||||
|
tagExpr: Object; // tag node
|
||||||
|
tagName: string; // raw string tag name
|
||||||
|
args: Array<Object>; // array of call arguments
|
||||||
|
call?: Object; // optional call property that can be set to override the call expression returned
|
||||||
|
};
|
||||||
|
|
||||||
|
require("babel-plugin-builder-react-jsx")({
|
||||||
|
pre: function (state: ElementState) {
|
||||||
|
// called before building the element
|
||||||
|
},
|
||||||
|
|
||||||
|
post: function (state: ElementState) {
|
||||||
|
// called after building the element
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
13
packages/babel-plugin-builder-react-jsx/package.json
Normal file
13
packages/babel-plugin-builder-react-jsx/package.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"name": "babel-plugin-builder-react-jsx",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"repository": "babel/babel",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"dependencies": {
|
||||||
|
"babel-runtime": "^5.8.20",
|
||||||
|
"esutils": "^2.0.0",
|
||||||
|
"lodash": "^3.10.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
153
packages/babel-plugin-builder-react-jsx/src/index.js
Normal file
153
packages/babel-plugin-builder-react-jsx/src/index.js
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
import isString from "lodash/lang/isString";
|
||||||
|
import esutils from "esutils";
|
||||||
|
|
||||||
|
export default function (t, opts) {
|
||||||
|
var visitor = {};
|
||||||
|
|
||||||
|
visitor.JSXNamespacedName = function (path) {
|
||||||
|
throw path.buildCodeFrameError("Namespace tags are not supported. ReactJSX is not XML.");
|
||||||
|
};
|
||||||
|
|
||||||
|
visitor.JSXElement = {
|
||||||
|
exit(path, file) {
|
||||||
|
var callExpr = buildElementCall(path.get("openingElement"), file);
|
||||||
|
|
||||||
|
callExpr.arguments = callExpr.arguments.concat(path.node.children);
|
||||||
|
|
||||||
|
if (callExpr.arguments.length >= 3) {
|
||||||
|
callExpr._prettyCall = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return t.inherits(callExpr, path.node);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return visitor;
|
||||||
|
|
||||||
|
function convertFunctionName(path) {
|
||||||
|
var { node } = path;
|
||||||
|
|
||||||
|
if (path.isJSXIdentifier()) {
|
||||||
|
if (node.name === "this" && path.isReferenced()) {
|
||||||
|
return t.thisExpression();
|
||||||
|
} else if (esutils.keyword.isIdentifierNameES6(node.name)) {
|
||||||
|
node.type = "Identifier";
|
||||||
|
} else {
|
||||||
|
return t.stringLiteral(node.name);
|
||||||
|
}
|
||||||
|
} else if (path.isJSXMemberExpression()) {
|
||||||
|
node.computed = t.isLiteral(node.property);
|
||||||
|
node.type = "MemberExpression";
|
||||||
|
}
|
||||||
|
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertAttributeValue(node) {
|
||||||
|
if (t.isJSXExpressionContainer(node)) {
|
||||||
|
return node.expression;
|
||||||
|
} else {
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertAttribute(node) {
|
||||||
|
var value = convertAttributeValue(node.value || t.booleanLiteral(true));
|
||||||
|
|
||||||
|
if (t.isLiteral(value) && isString(value.value)) {
|
||||||
|
value.value = value.value.replace(/\n\s+/g, " ");
|
||||||
|
}
|
||||||
|
|
||||||
|
node.name.type = "Identifier";
|
||||||
|
|
||||||
|
return t.inherits(t.property("init", node.name, value), node);
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildElementCall(path, file) {
|
||||||
|
path.parent.children = t.react.buildChildren(path.parent);
|
||||||
|
|
||||||
|
var tagExpr = convertFunctionName(path.get("name"));
|
||||||
|
var args = [];
|
||||||
|
|
||||||
|
var tagName;
|
||||||
|
if (t.isIdentifier(tagExpr)) {
|
||||||
|
tagName = tagExpr.name;
|
||||||
|
} else if (t.isLiteral(tagExpr)) {
|
||||||
|
tagName = tagExpr.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
var state = {
|
||||||
|
tagExpr: tagExpr,
|
||||||
|
tagName: tagName,
|
||||||
|
args: args
|
||||||
|
};
|
||||||
|
|
||||||
|
if (opts.pre) {
|
||||||
|
opts.pre(state, file);
|
||||||
|
}
|
||||||
|
|
||||||
|
var attribs = path.node.attributes;
|
||||||
|
if (attribs.length) {
|
||||||
|
attribs = buildOpeningElementAttributes(attribs, file);
|
||||||
|
} else {
|
||||||
|
attribs = t.nullLiteral();
|
||||||
|
}
|
||||||
|
|
||||||
|
args.push(attribs);
|
||||||
|
|
||||||
|
if (opts.post) {
|
||||||
|
opts.post(state, file);
|
||||||
|
}
|
||||||
|
|
||||||
|
return state.call || t.callExpression(state.callee, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The logic for this is quite terse. It's because we need to
|
||||||
|
* support spread elements. We loop over all attributes,
|
||||||
|
* breaking on spreads, we then push a new object containg
|
||||||
|
* all prior attributes to an array for later processing.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function buildOpeningElementAttributes(attribs, file) {
|
||||||
|
var _props = [];
|
||||||
|
var objs = [];
|
||||||
|
|
||||||
|
function pushProps() {
|
||||||
|
if (!_props.length) return;
|
||||||
|
|
||||||
|
objs.push(t.objectExpression(_props));
|
||||||
|
_props = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
while (attribs.length) {
|
||||||
|
var prop = attribs.shift();
|
||||||
|
if (t.isJSXSpreadAttribute(prop)) {
|
||||||
|
pushProps();
|
||||||
|
objs.push(prop.argument);
|
||||||
|
} else {
|
||||||
|
_props.push(convertAttribute(prop));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pushProps();
|
||||||
|
|
||||||
|
if (objs.length === 1) {
|
||||||
|
// only one object
|
||||||
|
attribs = objs[0];
|
||||||
|
} else {
|
||||||
|
// looks like we have multiple objects
|
||||||
|
if (!t.isObjectExpression(objs[0])) {
|
||||||
|
objs.unshift(t.objectExpression([]));
|
||||||
|
}
|
||||||
|
|
||||||
|
// spread it
|
||||||
|
attribs = t.callExpression(
|
||||||
|
file.addHelper("extends"),
|
||||||
|
objs
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return attribs;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
export default function ({ types: t }) {
|
|
||||||
return {
|
|
||||||
visitor: {
|
|
||||||
// your visitor methods go here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
# babel-plugin-dead-code-elimination
|
|
||||||
|
|
||||||
Eliminate dead code
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm install babel-plugin-dead-code-elimination
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### Via `.babelrc` (Recommended)
|
|
||||||
|
|
||||||
**.babelrc**
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"plugins": ["dead-code-elimination"]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via CLI
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ babel --plugins dead-code-elimination script.js
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via Node API
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
require("babel-core").transform("code", {
|
|
||||||
plugins: ["dead-code-elimination"]
|
|
||||||
});
|
|
||||||
```
|
|
||||||
3
packages/babel-plugin-decorators/.gitignore
vendored
3
packages/babel-plugin-decorators/.gitignore
vendored
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
export default function ({ types: t }) {
|
|
||||||
return {
|
|
||||||
visitor: {
|
|
||||||
// your visitor methods go here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
export default function ({ types: t }) {
|
|
||||||
return {
|
|
||||||
visitor: {
|
|
||||||
// your visitor methods go here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
# babel-plugin-es2015-arrow-functions
|
|
||||||
|
|
||||||
Compile ES2015 arrow functions to ES5
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm install babel-plugin-es2015-arrow-functions
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### Via `.babelrc` (Recommended)
|
|
||||||
|
|
||||||
**.babelrc**
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"plugins": ["es2015-arrow-functions"]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via CLI
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ babel --plugins es2015-arrow-functions script.js
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via Node API
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
require("babel-core").transform("code", {
|
|
||||||
plugins: ["es2015-arrow-functions"]
|
|
||||||
});
|
|
||||||
```
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
export default function ({ types: t }) {
|
|
||||||
return {
|
|
||||||
visitor: {
|
|
||||||
ArrowFunctionExpression(node) {
|
|
||||||
this.ensureBlock();
|
|
||||||
node.expression = false;
|
|
||||||
node.type = "FunctionExpression";
|
|
||||||
node.shadow = node.shadow || true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
# babel-plugin-es2015-block-scoped-functions
|
|
||||||
|
|
||||||
Babel plugin to ensure function declarations at the block level are block scoped.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm install babel-plugin-es2015-block-scoped-functions
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### Via `.babelrc` (Recommended)
|
|
||||||
|
|
||||||
**.babelrc**
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"plugins": ["es2015-block-scoped-functions"]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via CLI
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ babel --plugins es2015-block-scoped-functions script.js
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via Node API
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
require("babel-core").transform("code", {
|
|
||||||
plugins: ["es2015-block-scoped-functions"]
|
|
||||||
});
|
|
||||||
```
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
export default function ({ types: t }) {
|
|
||||||
return {
|
|
||||||
visitor: {
|
|
||||||
// your visitor methods go here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
export default function ({ types: t }) {
|
|
||||||
return {
|
|
||||||
visitor: {
|
|
||||||
// your visitor methods go here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
# babel-plugin-es2015-computed-properties
|
|
||||||
|
|
||||||
Compile ES2015 computed properties to ES5
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm install babel-plugin-es2015-computed-properties
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### Via `.babelrc` (Recommended)
|
|
||||||
|
|
||||||
**.babelrc**
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"plugins": ["es2015-computed-properties"]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via CLI
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ babel --plugins es2015-computed-properties script.js
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via Node API
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
require("babel-core").transform("code", {
|
|
||||||
plugins: ["es2015-computed-properties"]
|
|
||||||
});
|
|
||||||
```
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
# babel-plugin-es2015-destructuring
|
|
||||||
|
|
||||||
Compile ES2015 destructuring to ES5
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm install babel-plugin-es2015-destructuring
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### Via `.babelrc` (Recommended)
|
|
||||||
|
|
||||||
**.babelrc**
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"plugins": ["es2015-destructuring"]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via CLI
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ babel --plugins es2015-destructuring script.js
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via Node API
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
require("babel-core").transform("code", {
|
|
||||||
plugins: ["es2015-destructuring"]
|
|
||||||
});
|
|
||||||
```
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
export default function ({ types: t }) {
|
|
||||||
return {
|
|
||||||
visitor: {
|
|
||||||
// your visitor methods go here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
export default function ({ types: t }) {
|
|
||||||
return {
|
|
||||||
visitor: {
|
|
||||||
// your visitor methods go here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
# babel-plugin-es2015-object-super
|
|
||||||
|
|
||||||
Compile ES2015 object super to ES5
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm install babel-plugin-es2015-object-super
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### Via `.babelrc` (Recommended)
|
|
||||||
|
|
||||||
**.babelrc**
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"plugins": ["es2015-object-super"]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via CLI
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ babel --plugins es2015-object-super script.js
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via Node API
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
require("babel-core").transform("code", {
|
|
||||||
plugins: ["es2015-object-super"]
|
|
||||||
});
|
|
||||||
```
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
export default function ({ types: t }) {
|
|
||||||
return {
|
|
||||||
visitor: {
|
|
||||||
// your visitor methods go here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
export default function ({ types: t }) {
|
|
||||||
return {
|
|
||||||
visitor: {
|
|
||||||
// your visitor methods go here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
# babel-plugin-es2015-shorthand-properties
|
|
||||||
|
|
||||||
Compile ES2015 shorthand properties to ES5
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm install babel-plugin-es2015-shorthand-properties
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### Via `.babelrc` (Recommended)
|
|
||||||
|
|
||||||
**.babelrc**
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"plugins": ["es2015-shorthand-properties"]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via CLI
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ babel --plugins es2015-shorthand-properties script.js
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via Node API
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
require("babel-core").transform("code", {
|
|
||||||
plugins: ["es2015-shorthand-properties"]
|
|
||||||
});
|
|
||||||
```
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
export default function ({ types: t }) {
|
|
||||||
return {
|
|
||||||
visitor: {
|
|
||||||
// your visitor methods go here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
export default function ({ types: t }) {
|
|
||||||
return {
|
|
||||||
visitor: {
|
|
||||||
// your visitor methods go here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
# babel-plugin-es2015-template-literals
|
|
||||||
|
|
||||||
Compile ES2015 template literals to ES5
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm install babel-plugin-es2015-template-literals
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### Via `.babelrc` (Recommended)
|
|
||||||
|
|
||||||
**.babelrc**
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"plugins": ["es2015-template-literals"]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via CLI
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ babel --plugins es2015-template-literals script.js
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via Node API
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
require("babel-core").transform("code", {
|
|
||||||
plugins: ["es2015-template-literals"]
|
|
||||||
});
|
|
||||||
```
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
# babel-plugin-es2015-unicode-regex
|
|
||||||
|
|
||||||
Compile ES2015 unicode regex to ES5
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm install babel-plugin-es2015-unicode-regex
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### Via `.babelrc` (Recommended)
|
|
||||||
|
|
||||||
**.babelrc**
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"plugins": ["es2015-unicode-regex"]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via CLI
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ babel --plugins es2015-unicode-regex script.js
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via Node API
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
require("babel-core").transform("code", {
|
|
||||||
plugins: ["es2015-unicode-regex"]
|
|
||||||
});
|
|
||||||
```
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
export default function ({ types: t }) {
|
|
||||||
return {
|
|
||||||
visitor: {
|
|
||||||
// your visitor methods go here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
# babel-plugin-es3-member-expression-literals
|
|
||||||
|
|
||||||
Ensure that reserved words are quoted in property accesses
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm install babel-plugin-es3-member-expression-literals
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### Via `.babelrc` (Recommended)
|
|
||||||
|
|
||||||
**.babelrc**
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"plugins": ["es3-member-expression-literals"]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via CLI
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ babel --plugins es3-member-expression-literals script.js
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via Node API
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
require("babel-core").transform("code", {
|
|
||||||
plugins: ["es3-member-expression-literals"]
|
|
||||||
});
|
|
||||||
```
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
export default function ({ types: t }) {
|
|
||||||
return {
|
|
||||||
visitor: {
|
|
||||||
// your visitor methods go here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
# babel-plugin-exponentiation-operator
|
|
||||||
|
|
||||||
Compile exponentiation operator to ES5
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm install babel-plugin-exponentiation-operator
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### Via `.babelrc` (Recommended)
|
|
||||||
|
|
||||||
**.babelrc**
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"plugins": ["exponentiation-operator"]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via CLI
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ babel --plugins exponentiation-operator script.js
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via Node API
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
require("babel-core").transform("code", {
|
|
||||||
plugins: ["exponentiation-operator"]
|
|
||||||
});
|
|
||||||
```
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
export default function ({ types: t }) {
|
|
||||||
return {
|
|
||||||
visitor: {
|
|
||||||
// your visitor methods go here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
export default function ({ types: t }) {
|
|
||||||
return {
|
|
||||||
visitor: {
|
|
||||||
// your visitor methods go here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
33
packages/babel-plugin-external-helpers/README.md
Normal file
33
packages/babel-plugin-external-helpers/README.md
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# babel-plugin-external-helpers
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ npm install babel-plugin-external-helpers
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Via `.babelrc` (Recommended)
|
||||||
|
|
||||||
|
**.babelrc**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"plugins": ["external-helpers"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Via CLI
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ babel --plugins external-helpers script.js
|
||||||
|
```
|
||||||
|
|
||||||
|
### Via Node API
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
require("babel-core").transform("code", {
|
||||||
|
plugins: ["external-helpers"]
|
||||||
|
});
|
||||||
|
```
|
||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "babel-plugin-class-properties",
|
"name": "babel-plugin-external-helpers",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"repository": "babel/babel",
|
"repository": "babel/babel",
|
||||||
7
packages/babel-plugin-external-helpers/src/index.js
Normal file
7
packages/babel-plugin-external-helpers/src/index.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
export default function ({ types: t }) {
|
||||||
|
return {
|
||||||
|
pre(file) {
|
||||||
|
file.set("helpersNamespace", t.identifier("babelHelpers"));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
export default function ({ types: t }) {
|
|
||||||
return {
|
|
||||||
visitor: {
|
|
||||||
// your visitor methods go here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
# babel-plugin-inline-environment-variables
|
|
||||||
|
|
||||||
Inline environment variables
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm install babel-plugin-inline-environment-variables
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### Via `.babelrc` (Recommended)
|
|
||||||
|
|
||||||
**.babelrc**
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"plugins": ["inline-environment-variables"]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via CLI
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ babel --plugins inline-environment-variables script.js
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via Node API
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
require("babel-core").transform("code", {
|
|
||||||
plugins: ["inline-environment-variables"]
|
|
||||||
});
|
|
||||||
```
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
export default function ({ Plugin, types: t }) {
|
|
||||||
return {
|
|
||||||
metadata: {
|
|
||||||
group: "builtin-pre"
|
|
||||||
},
|
|
||||||
|
|
||||||
visitor: {
|
|
||||||
MemberExpression() {
|
|
||||||
if (this.get("object").matchesPattern("process.env")) {
|
|
||||||
var key = this.toComputedKey();
|
|
||||||
if (t.isStringLiteral(key)) {
|
|
||||||
return t.valueToNode(process.env[key.value]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
export default function ({ types: t }) {
|
|
||||||
return {
|
|
||||||
metadata: {
|
|
||||||
group: "builtin-pre"
|
|
||||||
},
|
|
||||||
|
|
||||||
visitor: {
|
|
||||||
MemberExpression() {
|
|
||||||
if (this.matchesPattern("process.env.NODE_ENV")) {
|
|
||||||
this.replaceWith(t.valueToNode(process.env.NODE_ENV));
|
|
||||||
|
|
||||||
if (this.parentPath.isBinaryExpression()) {
|
|
||||||
var evaluated = this.parentPath.evaluate();
|
|
||||||
if (evaluated.confident) {
|
|
||||||
this.parentPath.replaceWith(t.valueToNode(evaluated.value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
export default function () {
|
|
||||||
return {
|
|
||||||
metadata: {
|
|
||||||
group: "builtin-pre"
|
|
||||||
},
|
|
||||||
|
|
||||||
visitor: {
|
|
||||||
CallExpression: function (node, parent, scope, file) {
|
|
||||||
if (this.get("callee").matchesPattern("Object.assign")) {
|
|
||||||
node.callee = file.addHelper("extends");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
export default function ({ types: t }) {
|
|
||||||
return {
|
|
||||||
visitor: {
|
|
||||||
// your visitor methods go here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
export default function () {
|
|
||||||
return {
|
|
||||||
visitor: {
|
|
||||||
CallExpression(node, parent, scope, file) {
|
|
||||||
if (this.get("callee").matchesPattern("Object.setPrototypeOf")) {
|
|
||||||
node.callee = file.addHelper("defaults");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
export default function ({ types: t }) {
|
|
||||||
return {
|
|
||||||
visitor: {
|
|
||||||
// your visitor methods go here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,46 +0,0 @@
|
|||||||
export default function () {
|
|
||||||
var immutabilityVisitor = {
|
|
||||||
enter(node, parent, scope, state) {
|
|
||||||
var stop = () => {
|
|
||||||
state.isImmutable = false;
|
|
||||||
this.stop();
|
|
||||||
};
|
|
||||||
|
|
||||||
if (this.isJSXClosingElement()) {
|
|
||||||
this.skip();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.isJSXIdentifier({ name: "ref" }) && this.parentPath.isJSXAttribute({ name: node })) {
|
|
||||||
return stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.isJSXIdentifier() || this.isIdentifier() || this.isJSXMemberExpression()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.isImmutable()) stop();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
|
||||||
metadata: {
|
|
||||||
group: "builtin-basic"
|
|
||||||
},
|
|
||||||
|
|
||||||
visitor: {
|
|
||||||
JSXElement(node) {
|
|
||||||
if (node._hoisted) return;
|
|
||||||
|
|
||||||
var state = { isImmutable: true };
|
|
||||||
this.traverse(immutabilityVisitor, state);
|
|
||||||
|
|
||||||
if (state.isImmutable) {
|
|
||||||
this.hoist();
|
|
||||||
} else {
|
|
||||||
node._hoisted = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
# babel-plugin-react-inline-elements
|
|
||||||
|
|
||||||
Turn JSX elements into exploded React objects
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm install babel-plugin-react-inline-elements
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### Via `.babelrc` (Recommended)
|
|
||||||
|
|
||||||
**.babelrc**
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"plugins": ["react-inline-elements"]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via CLI
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ babel --plugins react-inline-elements script.js
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via Node API
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
require("babel-core").transform("code", {
|
|
||||||
plugins: ["react-inline-elements"]
|
|
||||||
});
|
|
||||||
```
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
export default function ({ types: t }) {
|
|
||||||
return {
|
|
||||||
visitor: {
|
|
||||||
// your visitor methods go here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
3
packages/babel-plugin-react-jsx/.gitignore
vendored
3
packages/babel-plugin-react-jsx/.gitignore
vendored
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
export default function ({ types: t }) {
|
|
||||||
return {
|
|
||||||
visitor: {
|
|
||||||
// your visitor methods go here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
export default function () {
|
|
||||||
return {
|
|
||||||
metadata: {
|
|
||||||
group: "builtin-pre"
|
|
||||||
},
|
|
||||||
|
|
||||||
visitor: {
|
|
||||||
CallExpression() {
|
|
||||||
if (this.get("callee").matchesPattern("console", true)) {
|
|
||||||
this.dangerouslyRemove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
export default function () {
|
|
||||||
return {
|
|
||||||
metadata: {
|
|
||||||
group: "builtin-pre"
|
|
||||||
},
|
|
||||||
|
|
||||||
visitor: {
|
|
||||||
DebuggerStatement() {
|
|
||||||
this.dangerouslyRemove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,11 +1,11 @@
|
|||||||
# babel-plugin-class-properties
|
# babel-plugin-syntax-flow
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ npm install babel-plugin-class-properties
|
$ npm install babel-plugin-syntax-flow
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
@ -16,20 +16,20 @@ $ npm install babel-plugin-class-properties
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"plugins": ["class-properties"]
|
"plugins": ["syntax-flow"]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Via CLI
|
### Via CLI
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ babel --plugins class-properties script.js
|
$ babel --plugins syntax-flow script.js
|
||||||
```
|
```
|
||||||
|
|
||||||
### Via Node API
|
### Via Node API
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
require("babel-core").transform("code", {
|
require("babel-core").transform("code", {
|
||||||
plugins: ["class-properties"]
|
plugins: ["syntax-flow"]
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
11
packages/babel-plugin-syntax-flow/package.json
Normal file
11
packages/babel-plugin-syntax-flow/package.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "babel-plugin-syntax-flow",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"repository": "babel/babel",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"keywords": [
|
||||||
|
"babel-plugin"
|
||||||
|
]
|
||||||
|
}
|
||||||
11
packages/babel-plugin-syntax-flow/src/index.js
Normal file
11
packages/babel-plugin-syntax-flow/src/index.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
export default function () {
|
||||||
|
return {
|
||||||
|
manipulateOptions(opts, parserOpts) {
|
||||||
|
var jsx = parserOpts.plugins.jsx;
|
||||||
|
delete parserOpts.plugins.jsx;
|
||||||
|
|
||||||
|
parserOpts.plugins.flow = true;
|
||||||
|
if (jsx) parserOpts.plugins.jsx = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -1,11 +1,11 @@
|
|||||||
# babel-plugin-remove-console
|
# babel-plugin-syntax-jsx
|
||||||
|
|
||||||
|
|
||||||
Remove console.* calls
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ npm install babel-plugin-remove-console
|
$ npm install babel-plugin-syntax-jsx
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
@ -16,20 +16,20 @@ $ npm install babel-plugin-remove-console
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"plugins": ["remove-console"]
|
"plugins": ["syntax-jsx"]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Via CLI
|
### Via CLI
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ babel --plugins remove-console script.js
|
$ babel --plugins syntax-jsx script.js
|
||||||
```
|
```
|
||||||
|
|
||||||
### Via Node API
|
### Via Node API
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
require("babel-core").transform("code", {
|
require("babel-core").transform("code", {
|
||||||
plugins: ["remove-console"]
|
plugins: ["syntax-jsx"]
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
11
packages/babel-plugin-syntax-jsx/package.json
Normal file
11
packages/babel-plugin-syntax-jsx/package.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "babel-plugin-syntax-jsx",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"repository": "babel/babel",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"keywords": [
|
||||||
|
"babel-plugin"
|
||||||
|
]
|
||||||
|
}
|
||||||
7
packages/babel-plugin-syntax-jsx/src/index.js
Normal file
7
packages/babel-plugin-syntax-jsx/src/index.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
export default function () {
|
||||||
|
return {
|
||||||
|
manipulateOptions(opts, parserOpts) {
|
||||||
|
parserOpts.plugins.jsx = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
# babel-plugin-syntax-trailing-function-commas
|
||||||
|
|
||||||
|
Compile trailing function commas to ES5
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ npm install babel-plugin-syntax-trailing-function-commas
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Via `.babelrc` (Recommended)
|
||||||
|
|
||||||
|
**.babelrc**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"plugins": ["syntax-trailing-function-commas"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Via CLI
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ babel --plugins syntax-trailing-function-commas script.js
|
||||||
|
```
|
||||||
|
|
||||||
|
### Via Node API
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
require("babel-core").transform("code", {
|
||||||
|
plugins: ["syntax-trailing-function-commas"]
|
||||||
|
});
|
||||||
|
```
|
||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "babel-plugin-trailing-function-commas",
|
"name": "babel-plugin-syntax-trailing-function-commas",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Compile trailing function commas to ES5",
|
"description": "Compile trailing function commas to ES5",
|
||||||
"repository": "babel/babel",
|
"repository": "babel/babel",
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
export default function () {
|
||||||
|
return {
|
||||||
|
manipulateOptions(opts, parserOpts) {
|
||||||
|
parserOpts.features["es7.trailingFunctionCommas"] = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
*.log
|
|
||||||
lib
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
# babel-plugin-trailing-function-commas
|
|
||||||
|
|
||||||
Compile trailing function commas to ES5
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ npm install babel-plugin-trailing-function-commas
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### Via `.babelrc` (Recommended)
|
|
||||||
|
|
||||||
**.babelrc**
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"plugins": ["trailing-function-commas"]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via CLI
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ babel --plugins trailing-function-commas script.js
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via Node API
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
require("babel-core").transform("code", {
|
|
||||||
plugins: ["trailing-function-commas"]
|
|
||||||
});
|
|
||||||
```
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
export default function ({ types: t }) {
|
|
||||||
return {
|
|
||||||
visitor: {
|
|
||||||
// your visitor methods go here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,11 +1,11 @@
|
|||||||
# babel-plugin-async-functions
|
# babel-plugin-transform-async-functions
|
||||||
|
|
||||||
Compile async functions to ES5
|
Compile async functions to ES5
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ npm install babel-plugin-async-functions
|
$ npm install babel-plugin-transform-async-functions
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
@ -16,20 +16,20 @@ $ npm install babel-plugin-async-functions
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"plugins": ["async-functions"]
|
"plugins": ["transform-async-functions"]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Via CLI
|
### Via CLI
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ babel --plugins async-functions script.js
|
$ babel --plugins transform-async-functions script.js
|
||||||
```
|
```
|
||||||
|
|
||||||
### Via Node API
|
### Via Node API
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
require("babel-core").transform("code", {
|
require("babel-core").transform("code", {
|
||||||
plugins: ["async-functions"]
|
plugins: ["transform-async-functions"]
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "babel-plugin-async-functions",
|
"name": "babel-plugin-transform-async-functions",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Compile async functions to ES5",
|
"description": "Compile async functions to ES5",
|
||||||
"repository": "babel/babel",
|
"repository": "babel/babel",
|
||||||
@ -1,4 +1,4 @@
|
|||||||
export default function ({ types: t }) {
|
export default function () {
|
||||||
return {
|
return {
|
||||||
visitor: {
|
visitor: {
|
||||||
// your visitor methods go here
|
// your visitor methods go here
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
# babel-plugin-transform-async-to-bluebird-coroutines
|
||||||
|
|
||||||
|
Turn async functions into a Bluebird coroutine
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ npm install babel-plugin-transform-async-to-bluebird-coroutines
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Via `.babelrc` (Recommended)
|
||||||
|
|
||||||
|
**.babelrc**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"plugins": ["transform-async-to-bluebird-coroutines"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Via CLI
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ babel --plugins transform-async-to-bluebird-coroutines script.js
|
||||||
|
```
|
||||||
|
|
||||||
|
### Via Node API
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
require("babel-core").transform("code", {
|
||||||
|
plugins: ["transform-async-to-bluebird-coroutines"]
|
||||||
|
});
|
||||||
|
```
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user