Socket
Socket
Sign inDemoInstall

flow-parser

Package Overview
Dependencies
Maintainers
4
Versions
323
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flow-parser - npm Package Compare versions

Comparing version 0.44.0 to 0.45.0

2

package.json
{
"name": "flow-parser",
"version": "0.44.0",
"version": "0.45.0",
"description": "JavaScript parser written in OCaml. Produces SpiderMonkey AST",

@@ -5,0 +5,0 @@ "homepage": "https://flow.org",

@@ -1,41 +0,33 @@

# The flow-parser package
# The Flow Parser
This package contains the Flow parser in its compiled-to-JavaScript form.
The Flow Parser is a JavaScript parser written in OCaml. It produces an AST that conforms to [SpiderMonkey's Parser API](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Parser_API) and that mostly matches what [esprima](http://esprima.org/) produces. The Flow Parser can be compiled to native code or can be compiled to JavaScript using [js_of_ocaml](http://ocsigen.org/js_of_ocaml/).
# What is Flow
## Building the Flow Parser
See [flowtype.org](http://flowtype.org/). The code for the Flow parser [lives on GitHub](https://github.com/facebook/flow/tree/master/src/parser).
Building the Flow Parser requires OCaml. Compiling to JavaScript requires js_of_ocaml >= 2.8.
# What is the Flow Parser
### Initial set up
The Flow Parser is a JavaScript parser written in OCaml. It produces an AST that conforms to the [ESTree spec](https://github.com/estree/estree) and that mostly matches what [esprima](http://esprima.org/) produces. The Flow Parser can be compiled to native code or can be compiled to JavaScript using [js_of_ocaml](http://ocsigen.org/js_of_ocaml/). This npm package contains the Flow parser compiled to JavaScript.
* [Install opam](https://opam.ocaml.org/doc/Install.html)
* `opam install js_of_ocaml`
# Usage
### Building the OCaml Flow Parser library
You can use the Flow parser in your browser or in node. To use in node you can just do
make
### Compiling the Flow Parser to JavaScript
```JavaScript
require('flow-parser').parse('1+1', {});
```
make js
To use in the browser, you can add
## Tests
```HTML
<script src="flow_parser.js"></script>
```
The Flow Parser's test suite tests the JavaScript version of the parser, so you will need js_of_ocaml installed. The tests and tools also have some node module dependencies, so you will need to run
which will make the `flow` object available to use like so:
### Initial set up
```JavaScript
flow.parse('1+1', {});
```
* Follow the steps in [Building the Flow Parser](https://github.com/facebook/flow/blob/master/src/parser/README.md#building-the-flow-parser)
* `npm install`
## Options
### Running the Tests
The second argument to `flow.parse` is the options object. Currently supported options:
* `esproposal_decorators` (boolean, default `false`) - enable parsing of decorators
* `esproposal_class_instance_fields` (boolean, default `false`) - enable parsing of class instance fields
* `esproposal_class_static_fields` (boolean, default `false`) - enable parsing of class static fields
* `esproposal_export_star_as` (boolean, default `false`) - enable parsing of `export * as` syntax
* `types` (boolean, default `true`) - enable parsing of Flow types
make test

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc