{"_id":"flow-parser@0.338.0","bugs":{"url":"https://github.com/meta/flow/issues"},"dist":{"shasum":"9af43844156b3d44b93792000200b7948519d399","tarball":"http://registry-npm.ywwl.com/flow-parser/download/flow-parser-0.338.0.tgz","fileCount":55,"integrity":"sha512-GF+ohfrTVlvsNhxfRkON49QKG5j+5oqGb8qpGwE6mYlhIBaXDsss/JzfIxpSwVXgWtw8z8kabf/pNo1jXor5NA==","signatures":[{"sig":"MEUCIQCOvAFMpICxpq7OvAhEf1LgqK17zKkI+KAtUN50sFbR+gIgVJId6A/dXyYd3ZGoGdHYWu/2AZJdrdEewXyMp+QE5kk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCRd+QcuUS28B4+r0iZRp0gV13Q1e0TzJIe6tUZk3S5CQIhALQC35iIAKQ2I+LmJ4t3InKPc6M49DeH8svABQPK0Z6z"}],"unpackedSize":1974868,"size":687380,"noattachment":false,"key":"/flow-parser/-/flow-parser-0.338.0.tgz"},"main":"dist/index.js","name":"flow-parser","_from":"file:dist/npm-flow-parser.tgz","author":{"name":"Flow Team","email":"flow@fb.com"},"engines":{"node":">=0.4.0"},"license":"MIT","scripts":{"test":"node test/run_tests.js"},"version":"0.338.0","_npmUser":{"name":"flowtype","email":"flow@fb.com"},"homepage":"https://flow.org","_resolved":"/home/runner/work/flow/flow/dist/npm-flow-parser.tgz","_integrity":"sha512-GF+ohfrTVlvsNhxfRkON49QKG5j+5oqGb8qpGwE6mYlhIBaXDsss/JzfIxpSwVXgWtw8z8kabf/pNo1jXor5NA==","repository":{"url":"git+https://github.com/meta/flow.git","type":"git","directory":"packages/flow-parser"},"_npmVersion":"10.9.9","description":"JavaScript parser written in OCaml. Produces ESTree AST","directories":{},"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"},{"name":"marcoww","email":"mwang267@gmail.com"}],"_nodeVersion":"22.23.4","dependencies":{"flow-estree":"0.338.0"},"_hasShrinkwrap":false,"devDependencies":{"chalk":"^4.1.2","espree":"9.3.2","minimist":">=1.2.6","@babel/types":"7.7.4","string-width":"4.2.3","@babel/parser":"7.7.4","hermes-estree":"0.36.1","hermes-parser":"0.36.1","@babel/generator":"7.7.4","flow-enums-runtime":"0.0.6"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/flow-parser_0.338.0_1793394366201_0.6952569985041958"},"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/meta/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- **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 unspecified or `\"unambiguous\"`, a `sourceFilename` ending in `.mjs` or `.mts` selects `\"module\"`. Otherwise, source type is detected from value imports and exports, falling back to `\"script\"`. An explicit `\"module\"` or `\"script\"` takes precedence over the filename.\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":1793394366313,"_cnpm_publish_time":1793394366313,"dist-tags":{"latest":"0.343.0"}}