{"name":"flow-parser","version":"0.282.0","author":{"name":"Flow Team","email":"flow@fb.com"},"license":"MIT","_id":"flow-parser@0.282.0","maintainers":[{"name":"mroch","email":"marshall@roch.com"},{"name":"gabelevi","email":"gabelevi@gmail.com"},{"name":"nmote","email":"nat@natmote.net"},{"name":"flowtype","email":"flow@fb.com"},{"name":"samwgoldman","email":"samwgoldman@gmail.com"},{"name":"avikchaudhuri","email":"avik.ch@gmail.com"}],"homepage":"https://flow.org","bugs":{"url":"https://github.com/facebook/flow/issues"},"dist":{"shasum":"1661dfad8083dc57ea3dbe5a1c3172388b4e7c6f","tarball":"http://registry-npm.ywwl.com/flow-parser/download/flow-parser-0.282.0.tgz","fileCount":3,"integrity":"sha512-rFveu+DQNZ8Jt/Vp8/tiTEULCF6jB4WJMEXwBHsFgZwu41Qn5iHaLBaqO05lx+ny3whVpwnHMqMFBKs76P8FbA==","signatures":[{"sig":"MEQCIFYGhHh1wigOAOJIaXimoKYQyQoRM1CLvb8MZEC+CU7TAiAZf6Q8R71ejLZ9z4i0GPeUB4T2jr94R2mRWnJ53eDhxw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":751596,"size":172418,"noattachment":false,"key":"/flow-parser/-/flow-parser-0.282.0.tgz"},"main":"flow_parser.js","_from":"file:dist/npm-flow-parser.tgz","engines":{"node":">=0.4.0"},"scripts":{"test":"node test/run_tests.js","build":"make js"},"_npmUser":{"name":"flowtype","email":"flow@fb.com"},"_resolved":"/home/runner/work/flow/flow/dist/npm-flow-parser.tgz","_integrity":"sha512-rFveu+DQNZ8Jt/Vp8/tiTEULCF6jB4WJMEXwBHsFgZwu41Qn5iHaLBaqO05lx+ny3whVpwnHMqMFBKs76P8FbA==","repository":{"url":"git+https://github.com/facebook/flow.git","type":"git"},"_npmVersion":"10.8.2","description":"JavaScript parser written in OCaml. Produces ESTree AST","directories":{},"_nodeVersion":"20.19.5","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"chalk":"^4.1.2","minimist":">=1.2.6","ast-types":"^0.15.2","esprima-fb":"15001.1001.0-dev-harmony-fb"},"_npmOperationalInternal":{"tmp":"tmp/flow-parser_0.282.0_1758056190932_0.47576087204243844","host":"s3://npm-registry-packages-npm-production"},"readme":"# flow-parser\n\nA JavaScript parser built from the Flow's parser compiled to WebAssembly. Can parse ES6, Flow, and JSX syntax.\n\n## What is Flow\n\nSee [flow.org](https://flow.org/). The code for the Flow parser [lives on GitHub](https://github.com/facebook/flow/tree/master/src/parser).\n\n## What is the Flow Parser\n\nThe Flow Parser is a JavaScript parser for Flow syntax. It produces an AST that conforms to the [ESTree spec](https://github.com/estree/estree).\n\n## API\nThe Flow parser exposes a single `parse(code, [options])` function, where `code` is the source code to parse as a string, and `options` is an optional object that may contain the following properties:\n- **babel**: `boolean`, defaults to `false`. If `true`, output an AST conforming to Babel's AST format. If `false`, output an AST conforming to the ESTree AST format.\n- **allowReturnOutsideFunction**: `boolean`, defaults to `false`. If `true`, do not error on return statements found outside functions.\n- **assertOperator**: `boolean`, defaults to `false`. If `true`, enable Flow's postfix non-null assertion syntax (`value!`).\n- **flow**: `\"all\"` or `\"detect\"`, defaults to `\"detect\"`. If `\"detect\"`, only parse syntax as Flow syntax where it is ambiguous whether it is a Flow feature or regular JavaScript when the `@flow` pragma is present in the file. Otherwise if `\"all\"`, always parse ambiguous syntax as Flow syntax regardless of the presence of an `@flow` pragma. For example `foo<T>(x)` in a file without an `@flow` pragma will be parsed as two comparisons if set to `\"detect\"`, otherwise if set to `\"all\"` or the `@flow` pragma is included it will be parsed as a call expression with a type argument.\n- **enableExperimentalComponentSyntax**: `boolean`, defaults to `true`. Controls parsing of Flow component syntax.\n- **enableExperimentalFlowMatchSyntax**: `boolean`, defaults to `true`. Controls parsing of Flow match syntax.\n- **enableExperimentalFlowRecordSyntax**: `boolean`, defaults to `true`. Controls parsing of Flow record syntax.\n- **reactRuntimeTarget**: `\"18\"` or `\"19\"`, defaults to `\"18\"`. Controls how component `ref` parameters are lowered when `babel` is `true`. React 18 treats `ref` as a separate parameter; React 19 treats it as a regular prop.\n- **sourceFilename**: `string`, defaults to `null`. The filename corresponding to the code that is to be parsed. If non-null, the filename will be added to all source locations in the output AST.\n- **sourceType**: `\"module\"`, `\"script\"`, or `\"unambiguous\"` (default). If `\"unambiguous\"`, source type will be automatically detected and set to `\"module\"` if any ES6 imports or exports are present in the code, otherwise source type will be set to `\"script\"`.\n- **throwOnParseErrors**: `boolean`, defaults to `true`. If `true`, throw a `SyntaxError` for the first parse error. If `false`, return the partial AST with parse errors in the root node's `errors` property.\n- **tokens**: `boolean`, defaults to `false`. If `true`, add all tokens to a `tokens` property on the root node.\n- **transformOptions**: `object`. Options to be supplied to relevant transforms.\n  - `TransformEnumSyntax`\n    - `enable`: `boolean` - Whether to enable the transform. By default, `false`.\n    - `getRuntime` (optional): `() => Expression` - The expression which should be a reference to the Flow Enums runtime. By default, is `require('flow-enums-runtime')`.\n\n## Babel plugin\n\nFlow parser plugin for [Babel](https://babeljs.io/). This plugin switches Babel to use `flow-parser` instead of the `@babel/parser`. The Flow parser uses Rust compiled to WASM for full Flow syntax support.\n\n### Install\n\nUsing npm:\n\n```sh\nnpm install --save-dev flow-parser\n```\n\nor using yarn:\n\n```sh\nyarn add flow-parser --dev\n```\n\n### Usage\n\nThe plugin can be enabled via:\n\n```\n// babel.config.json\n{\n  \"plugins\": [\"flow-parser/babel-plugin\"]\n}\n```\n\nIf parser options need to be provide you can do so via the `parserOpts` config:\n\n```\n// babel.config.json\n{\n  \"plugins\": [\"flow-parser/babel-plugin\"],\n  \"parserOpts\": {\n    \"allowReturnOutsideFunction\": true\n  }\n}\n```\n","publish_time":1758056191277,"_cnpm_publish_time":1758056191277,"dist-tags":{"latest":"0.343.0"}}