package flow_parser

Build not checked
  1. Overview
  2. Docs
The Flow parser is a JavaScript parser written in OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.246.0.tar.gz
md5=5c57d271f28352f52dff2dadd7cfff02
sha512=01c10524a82fc31f66a882cb250ea840c40d07e57bf9eec4c9e0ae2aacf750c1de3ed69d5fcc74eb69ed55b8b1987d674970784622b3232a23a7129789c159c9

Description

It produces an AST that conforms to ESTree. The Flow Parser can be compiled to native code or can be compiled to JavaScript using js_of_ocaml.

To find out more about Flow, check out https://flow.org.

Added to opam-repository:

README

Flow

CircleCI Follow @flowtype MIT License GitHub contributors GitHub top language Join Discord Chat

Flow is a static typechecker for JavaScript. To find out more about Flow, check out flow.org.

Contents

Requirements

Flow works with:

  • macOS (x86_64)
  • Linux (x86_64 and arm64)
  • Windows (x86_64, Windows 10 recommended)

There are binary distributions for each of these platforms and you can also build it from source on any of them as well.

Using Flow

Check out the installation instructions, and then the usage docs.

Using Flow's parser from JavaScript

While Flow is written in OCaml, its parser is available as a compiled-to-JavaScript module published to npm, named flow-parser. Most end users of Flow will not need to use this parser directly, but JavaScript packages which make use of parsing Flow-typed JavaScript can use this to generate Flow's syntax tree with annotated types attached.

Building Flow from source

Flow is written in OCaml (OCaml 5.2.0 is required).

  1. Install system dependencies:

    • Mac: brew install opam
    • Debian: sudo apt-get install opam
    • Other Linux: see opam docs
    • Windows: cygwin and a number of dependencies like make, gcc and g++ are required.

      One way to install everything is to install Chocolatey and then run .\scripts\windows\install_deps.ps1 and .\scripts\windows\install_opam.ps1. Otherwise, see the "Manual Installation" section of OCaml for Windows docs and install all of the packages listed in our install_deps.ps1.

      The remainder of these instructions should be run inside the Cygwin shell: C:\tools\cygwin\Cygwin. Then cd /cygdrive/c/Users/you/path/to/checkout.

  2. Validate the opam version is 2.x.x:

    opam --version

    The following instructions expect 2.x.x. Should your package manager have installed a 1.x.x version, please refer to the opam docs to install a newer version manually.

  3. Initialize opam:

        # on Mac and Linux:
    opam init
    
    # on Windows:
    scripts/windows/init_opam.sh
  4. Install Flow's OCaml dependencies:

        # from within this git checkout
    make deps

    note: If you find that you get an error looking for ocaml-base-compiler version, your local dependency repo may be out of date and you need to run opam update + opam upgrade

  5. Build the flow binary:

        eval $(opam env)
    make

    This produces the bin/flow binary.

  6. Build flow.js (optional):

        opam install -y js_of_ocaml.5.7.2
    make js

    This produces bin/flow.js.

    The Flow parser can also be compiled to JavaScript. Read how here.

Running the tests

To run the tests, first compile flow using make. Then run bash ./runtests.sh bin/flow

There is a make test target that compiles and runs tests.

To run a subset of the tests you can pass a second argument to the runtests.sh file.

For example: bash runtests.sh bin/flow class | grep -v 'SKIP'

Join the Flow community

License

Flow is MIT-licensed (LICENSE). The website and documentation are licensed under the Creative Commons Attribution 4.0 license (website/LICENSE-DOCUMENTATION).

Dependencies (7)

  1. wtf8
  2. ppx_gen_rec build
  3. ppx_deriving build
  4. ppxlib >= "0.32.1" & < "0.36.0"
  5. base >= "v0.16.3"
  6. dune >= "3.2"
  7. ocaml >= "5.2.0" & < "5.3"

Dev Dependencies

None

Optional Dependencies

None

Used by

None

Conflicts

None

Build status

Results of building flow_parser with each compiler on check.ci.ocaml.org, run of against opam-repository 8a77e58. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

This version is not in the latest run; the versions below are.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
0.268.0 n/a n/a good n/a n/a
0.229.1 n/a good n/a n/a n/a
0.159.0 good n/a n/a n/a n/a
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure