Normalize options sections in docs [skip ci] (#5244)
This commit is contained in:
parent
2104ab6c44
commit
160bd3924b
@ -35,9 +35,26 @@ If the column number is not known, you may pass `null` instead.
|
|||||||
|
|
||||||
## Options
|
## Options
|
||||||
|
|
||||||
name | type | default | description
|
### `highlightCode`
|
||||||
-----------------------|----------|-----------------|------------------------------------------------------
|
|
||||||
highlightCode | boolean | `false` | Syntax highlight the code as JavaScript for terminals
|
`boolean`, defaults to `false`.
|
||||||
linesAbove | number | 2 | The number of lines to show above the error
|
|
||||||
linesBelow | number | 3 | The number of lines to show below the error
|
Toggles syntax highlighting the code as JavaScript for terminals.
|
||||||
forceColor | boolean | `false` | Forcibly syntax highlight the code as JavaScript (for non-terminals); overrides highlightCode
|
|
||||||
|
### `linesAbove`
|
||||||
|
|
||||||
|
`number`, defaults to `2`.
|
||||||
|
|
||||||
|
Adjust the number of lines to show above the error.
|
||||||
|
|
||||||
|
### `linesBelow`
|
||||||
|
|
||||||
|
`number`, defaults to `3`.
|
||||||
|
|
||||||
|
Adjust the number of lines to show below the error.
|
||||||
|
|
||||||
|
### `forceColor`
|
||||||
|
|
||||||
|
`boolean`, defaults to `false`.
|
||||||
|
|
||||||
|
Enable this to forcibly syntax highlight the code as JavaScript (for non-terminals); overrides `highlightCode`.
|
||||||
|
|||||||
@ -117,4 +117,5 @@ Following is a table of the options you can use:
|
|||||||
| `sourceMaps` | `false` | If truthy, adds a `map` property to returned output. If set to `"inline"`, a comment with a sourceMappingURL directive is added to the bottom of the returned code. If set to `"both"` then a `map` property is returned as well as a source map comment appended. **This does not emit sourcemap files by itself!** To have sourcemaps emitted using the CLI, you must pass it the `--source-maps` option. |
|
| `sourceMaps` | `false` | If truthy, adds a `map` property to returned output. If set to `"inline"`, a comment with a sourceMappingURL directive is added to the bottom of the returned code. If set to `"both"` then a `map` property is returned as well as a source map comment appended. **This does not emit sourcemap files by itself!** To have sourcemaps emitted using the CLI, you must pass it the `--source-maps` option. |
|
||||||
| `sourceMapTarget` | `(filenameRelative)` | Set `file` on returned source map. |
|
| `sourceMapTarget` | `(filenameRelative)` | Set `file` on returned source map. |
|
||||||
| `sourceRoot` | `(moduleRoot)` | The root from which all sources are relative. |
|
| `sourceRoot` | `(moduleRoot)` | The root from which all sources are relative. |
|
||||||
|
| `sourceType` | `"module"` | Indicate the mode the code should be parsed in. Can be either "script" or "module". |
|
||||||
| `wrapPluginVisitorMethod`| `null` | An optional callback that can be used to wrap visitor methods. **NOTE:** This is useful for things like introspection, and not really needed for implementing anything. Called as `wrapPluginVisitorMethod(pluginAlias, visitorType, callback)`.
|
| `wrapPluginVisitorMethod`| `null` | An optional callback that can be used to wrap visitor methods. **NOTE:** This is useful for things like introspection, and not really needed for implementing anything. Called as `wrapPluginVisitorMethod(pluginAlias, visitorType, callback)`.
|
||||||
|
|||||||
@ -76,7 +76,11 @@ require("babel-core").transform("code", {
|
|||||||
|
|
||||||
## Options
|
## Options
|
||||||
|
|
||||||
* `spec` - Class properties are compiled to use `Object.defineProperty. Static fields are now defined even if they are not initialized
|
### `spec`
|
||||||
|
|
||||||
|
`boolean`, defaults to `false`.
|
||||||
|
|
||||||
|
Class properties are compiled to use `Object.defineProperty`. Static fields are now defined even if they are not initialized.
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
|
|||||||
@ -97,4 +97,8 @@ require("babel-core").transform("code", {
|
|||||||
|
|
||||||
## Options
|
## Options
|
||||||
|
|
||||||
* `spec` - This option wraps the generated function in `.bind(this)` and keeps uses of `this` inside the function as-is, instead of using a renamed `this`. It also adds a runtime check to ensure the functions are not instantiated.
|
### `spec`
|
||||||
|
|
||||||
|
`boolean`, defaults to `false`.
|
||||||
|
|
||||||
|
This option wraps the generated function in `.bind(this)` and keeps uses of `this` inside the function as-is, instead of using a renamed `this`. It also adds a runtime check to ensure the functions are not instantiated.
|
||||||
|
|||||||
@ -50,7 +50,11 @@ require("babel-core").transform("code", {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
## Options `loose`
|
## Options
|
||||||
|
|
||||||
|
### `loose`
|
||||||
|
|
||||||
|
`boolean`, defaults to `false`.
|
||||||
|
|
||||||
#### Method enumerability
|
#### Method enumerability
|
||||||
|
|
||||||
|
|||||||
@ -62,7 +62,11 @@ require("babel-core").transform("code", {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
## Options `loose`
|
## Options
|
||||||
|
|
||||||
|
### `loose`
|
||||||
|
|
||||||
|
`boolean`, defaults to `false`.
|
||||||
|
|
||||||
As per the spec, `import` and `export` are only allowed to be used at the top
|
As per the spec, `import` and `export` are only allowed to be used at the top
|
||||||
level. When in loose mode these are allowed to be used anywhere.
|
level. When in loose mode these are allowed to be used anywhere.
|
||||||
|
|||||||
@ -80,4 +80,8 @@ require("babel-core").transform("code", {
|
|||||||
|
|
||||||
## Options
|
## Options
|
||||||
|
|
||||||
* `loose` - All iterables are assumed to be arrays.
|
### `loose`
|
||||||
|
|
||||||
|
`boolean`, defaults to `false`.
|
||||||
|
|
||||||
|
In loose mode, **all** iterables are assumed to be arrays.
|
||||||
|
|||||||
@ -62,10 +62,15 @@ require("babel-core").transform("code", {
|
|||||||
## Options
|
## Options
|
||||||
|
|
||||||
### `loose`
|
### `loose`
|
||||||
|
|
||||||
|
`boolean`, defaults to `false`.
|
||||||
|
|
||||||
In loose mode, tagged template literal objects aren't frozen.
|
In loose mode, tagged template literal objects aren't frozen.
|
||||||
|
|
||||||
|
|
||||||
### `spec`
|
### `spec`
|
||||||
|
|
||||||
|
`boolean`, defaults to `false`.
|
||||||
|
|
||||||
This option wraps all template literal expressions with `String`. See [babel/babel#1065](https://github.com/babel/babel/issues/1065) for more info.
|
This option wraps all template literal expressions with `String`. See [babel/babel#1065](https://github.com/babel/babel/issues/1065) for more info.
|
||||||
|
|
||||||
**In**
|
**In**
|
||||||
|
|||||||
@ -95,6 +95,16 @@ require("babel-core").transform("code", {
|
|||||||
|
|
||||||
## Options
|
## Options
|
||||||
|
|
||||||
* `pragma` - Replace the function used when compiling JSX expressions (Defaults to `React.createElement`).
|
### `pragma`
|
||||||
- Note that the `@jsx React.DOM` pragma has been deprecated as of React v0.12
|
|
||||||
* `useBuiltIns` - When spreading props, use Object.assign instead of Babel's extend helper (Disabled by default).
|
`string`, defaults to `React.createElement`.
|
||||||
|
|
||||||
|
Replace the function used when compiling JSX expressions.
|
||||||
|
|
||||||
|
Note that the `@jsx React.DOM` pragma has been deprecated as of React v0.12
|
||||||
|
|
||||||
|
### `useBuiltIns`
|
||||||
|
|
||||||
|
`boolean`, defaults to `false`.
|
||||||
|
|
||||||
|
When spreading props, use `Object.assign` directly instead of Babel's extend helper.
|
||||||
|
|||||||
@ -36,30 +36,22 @@ require("babel-core").transform("code", {
|
|||||||
|
|
||||||
## Options
|
## Options
|
||||||
|
|
||||||
* `loose` - Enable "loose" transformations for any plugins in this preset that allow them (Disabled by default).
|
### `loose`
|
||||||
* `modules` - Enable transformation of ES6 module syntax to another module type (Enabled by default to `"commonjs"`).
|
|
||||||
* Can be `false` to not transform modules, or one of `["amd", "umd", "systemjs", "commonjs"]`
|
|
||||||
* `spec` - Enable "spec" transformations for any plugins in this preset that allow them (Disabled by default)
|
|
||||||
|
|
||||||
```js
|
`boolean`, defaults to `false`.
|
||||||
{
|
|
||||||
presets: [
|
Enable "loose" transformations for any plugins in this preset that allow them.
|
||||||
["es2015", { "loose": true }]
|
|
||||||
]
|
### `modules`
|
||||||
}
|
|
||||||
{
|
`"amd" | "umd" | "systemjs" | "commonjs" | false`, defaults to `"commonjs"`.
|
||||||
presets: [
|
|
||||||
["es2015", { "modules": false }]
|
Enable transformation of ES6 module syntax to another module type.
|
||||||
]
|
|
||||||
}
|
Setting this to `false` will not transform modules.
|
||||||
{
|
|
||||||
presets: [
|
### `spec`
|
||||||
["es2015", { "loose": true, "modules": false }]
|
|
||||||
]
|
`boolean`, defaults to `false`.
|
||||||
}
|
|
||||||
{
|
Enable "spec" transformations for any plugins in this preset that allow them.
|
||||||
presets: [
|
|
||||||
["es2015", { "spec": true }]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@ -36,15 +36,17 @@ require("babel-core").transform("code", {
|
|||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
- `es2015`: Optionally not run any plugins from this preset (defaults to true)
|
### `es2015`
|
||||||
- `es2016`: Optionally not run any plugins from this preset (defaults to true)
|
|
||||||
- `es2017`: Optionally not run any plugins from this preset (defaults to true)
|
`boolean`, defaults to `true`.
|
||||||
|
|
||||||
|
Toggles including plugins from the [es2015 preset](https://babeljs.io/docs/plugins/preset-es2015/).
|
||||||
|
|
||||||
```js
|
```js
|
||||||
{
|
{
|
||||||
"presets": [
|
"presets": [
|
||||||
["latest", {
|
["latest", {
|
||||||
"es2015": false // defaults to true
|
"es2015": false
|
||||||
}]
|
}]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -63,3 +65,17 @@ You can also pass options down to the `es2015` preset.
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Note:** This also works for the other preset-year options below.
|
||||||
|
|
||||||
|
### `es2016`
|
||||||
|
|
||||||
|
`boolean`, defaults to `true`.
|
||||||
|
|
||||||
|
Toggles including plugins from the [es2016 preset](https://babeljs.io/docs/plugins/preset-es2016/).
|
||||||
|
|
||||||
|
### `es2017`
|
||||||
|
|
||||||
|
`boolean`, defaults to `true`.
|
||||||
|
|
||||||
|
Toggles including plugins from the [es2017 preset](https://babeljs.io/docs/plugins/preset-es2017/).
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user