summaryrefslogtreecommitdiff
path: root/node_modules/babylon/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/babylon/README.md')
-rw-r--r--node_modules/babylon/README.md16
1 files changed, 13 insertions, 3 deletions
diff --git a/node_modules/babylon/README.md b/node_modules/babylon/README.md
index 3c6d730f0..cbe528885 100644
--- a/node_modules/babylon/README.md
+++ b/node_modules/babylon/README.md
@@ -14,7 +14,7 @@
- The latest ECMAScript version enabled by default (ES2017).
- Comment attachment.
- Support for JSX and Flow.
- - Support for experimental language proposals (accepting PRs for anything at least [stage-0](https://github.com/tc39/proposals/blob/master/stage-0-proposals.md).
+ - Support for experimental language proposals (accepting PRs for anything at least [stage-0](https://github.com/tc39/proposals/blob/master/stage-0-proposals.md)).
## Credits
@@ -27,6 +27,12 @@ Significant diversions are expected to occur in the future such as streaming, EB
### `babylon.parse(code, [options])`
+### `babylon.parseExpression(code, [options])`
+
+`parse()` parses the provided `code` as an entire ECMAScript program, while
+`parseExpression()` tries to parse a single Expression with performance in
+mind. When in doubt, use `.parse()`.
+
### Options
- **allowImportExportEverywhere**: By default, `import` and `export`
@@ -37,15 +43,19 @@ Significant diversions are expected to occur in the future such as streaming, EB
the top level raises an error. Set this to `true` to accept such
code.
-- **allowSuperOutsideMethod** TODO
+- **allowSuperOutsideMethod**: TODO
- **sourceType**: Indicate the mode the code should be parsed in. Can be
either `"script"` or `"module"`.
- **sourceFilename**: Correlate output AST nodes with their source filename. Useful when generating code and source maps from the ASTs of multiple input files.
+- **startLine**: By default, the first line of code parsed is treated as line 1. You can provide a line number to alternatively start with. Useful for integration with other source tools.
+
- **plugins**: Array containing the plugins that you want to enable.
+- **strictMode**: TODO
+
### Output
Babylon generates AST according to [Babel AST format][].
@@ -111,7 +121,7 @@ require("babylon").parse("code", {
- `flow`
- `doExpressions`
- `objectRestSpread`
- - `decorators`
+ - `decorators` (Based on an outdated version of the Decorators proposal. Will be removed in a future version of `Babylon`)
- `classProperties`
- `exportExtensions`
- `asyncGenerators`