🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

flow-parser

Package Overview
Dependencies
Maintainers
7
Versions
422
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flow-parser

JavaScript parser written in OCaml. Produces ESTree AST

latest
Source
npmnpm
Version
0.321.0
Version published
Weekly downloads
6.5M
0.94%
Maintainers
7
Weekly downloads
 
Created
Source

The flow-parser package

This package contains the Flow parser in its JavaScript package form.

What is Flow

See flow.org. The code for the Flow parser lives on GitHub.

What is the Flow Parser

The Flow Parser is a JavaScript parser for Flow syntax. It produces an AST that conforms to the ESTree spec. This npm package contains the Flow Rust parser compiled to WASM with JavaScript bindings.

Usage

You can use the Flow parser in node:

const {parse} = require('flow-parser');
parse('1+1', {});

Options

The second argument to parse is the options object. Common options:

Basic options

  • flow ('detect' or 'all', default 'detect') - parse Flow syntax only with an @flow pragma, or always parse Flow syntax
  • sourceType ('module', 'script', or 'unambiguous') - parse the file as a module, script, or infer it from the contents
  • tokens (boolean, default false) - include a list of all parsed tokens in a top-level tokens property
  • babel (boolean, default false) - return a Babel-shaped AST

Language features

  • enableEnums (boolean, default true) - enable parsing of enums
  • enableExperimentalFlowMatchSyntax (boolean, default true) - enable parsing of match expressions and match statements
  • enableExperimentalComponentSyntax (boolean, default true) - enable parsing of component syntax
  • assertOperator (boolean, default false) - enable parsing of the assert operator
  • enableExperimentalDecorators (boolean, default true) - enable parsing of decorators

FAQs

Package last updated on 24 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts