{"name":"flow-remove-types","version":"2.167.0","keywords":["flow","flowtype","compiler","transpiler","transform","es6"],"author":{"name":"Flow Team","email":"flow@fb.com"},"license":"MIT","_id":"flow-remove-types@2.167.0","maintainers":[{"name":"leebyron","email":"lee@leebyron.com"},{"name":"flowtype","email":"flow@fb.com"}],"contributors":[{"url":"http://leebyron.com/","name":"Lee Byron","email":"lee@leebyron.com"}],"homepage":"https://flow.org","bugs":{"url":"https://github.com/facebook/flow/issues"},"bin":{"flow-node":"flow-node","flow-remove-types":"flow-remove-types"},"dist":{"shasum":"5bc0b9622b319a8bf6c3dbeac37c65b982782e6c","tarball":"http://registry-npm.ywwl.com/flow-remove-types/download/flow-remove-types-2.167.0.tgz","fileCount":8,"integrity":"sha512-QtniNTHDkW01hfuOfWkEKhGMj5GhE5zNzi2ysrRKkPGq4eOIqFYcV+iIXOM1GwyBz0ySqLXkH16cCgCnhIUVUQ==","signatures":[{"sig":"MEUCIQCu/uKSHRulcfGxuO8BABCKdOdX3bNylXK1wcx5rjDl0AIgMCoI3tjdvbsnbDlIoWM1PPMGS0au3hLF024l8MxZOyI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":42295,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhs+NFCRA9TVsSAnZWagAAMT4P/1bF2zCbX286b9AR2Yok\n5JUB4nVdYPKhFcNVVtQ/9P5icu+YfiItaoMdJr3y0hlYuSQH5sh5MRAFQo3e\nQx3SFPgz4zz/Ae0V7UpF/Oppq/b48MlEynS+pItZWoYpYfNMFAEBNMT3Ua4F\n/CG8ZnE3qDwnEVZnzhmMrq155AY2VJuLsSPaiXsjTNTfNyrfLj/HoEOwhyfT\nU9Smjsi77EtfX6Fete56QrWAV9NY+EPuzj/3xNf2+QGF2UZEcGrN//Q7KLV2\nv7dy60qbrsU+B0W09HuGgfwggsYQe1ZTqGqg5joCjCNUHzVMEukcXEACqgRB\nI1phJhjPCS9KzR5Ar0u1in6I+RvsFhNLpNwPB44FdvJ8mXgLTpd8s2HCWUpj\nM275H23CfVPy7Z+M7CHLWDE8pBHLWNOq0PDONKblqbl9c+SINjz5tUXsQRCq\nuV+AU2EOth/bLb6iFNL31b7m/TzsQIIrSoH5akS4Hw+HIXYR+1m1qazt9QK8\nFYfpgU6FZ2QFE/A2wt2W+2+gs6f5FajiVM/AnBDY+GbmLY+7O92YdVD00jVP\n0ibZi4jsTYr2nGlt0l1gUkvltAuiIz+Kd4FAhmcbsd7khLW7iEM1vddGInLI\nNymi8U0s3HMwMYZrt8vRmtAWKsMFDjdjAEi6VuqpXYgzcP30nueUeNWls4Qh\nzt/j\r\n=XEDv\r\n-----END PGP SIGNATURE-----\r\n","size":12997,"noattachment":false,"key":"/flow-remove-types/-/flow-remove-types-2.167.0.tgz"},"main":"index.js","_from":"file:dist/npm-flow-remove-types.tgz","engines":{"node":">=4"},"scripts":{"test":"./test.sh","test-update":"./test-update.sh"},"_npmUser":{"name":"flowtype","email":"flow@fb.com"},"_resolved":"","_integrity":"","repository":{"url":"git+https://github.com/facebook/flow.git","type":"git"},"_npmVersion":"6.14.15","description":"Removes Flow type annotations from JavaScript files with speed and simplicity.","directories":{},"_nodeVersion":"12.22.7","dependencies":{"vlq":"^0.2.1","pirates":"^3.0.2","flow-parser":"^0.167.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/flow-remove-types_2.167.0_1639179077090_0.5319878356449579","host":"s3://npm-registry-packages"},"readme":"# flow-remove-types\n\n[![npm](https://img.shields.io/npm/v/flow-remove-types.svg?maxAge=86400)](https://www.npmjs.com/package/flow-remove-types)\n\nTurn your JavaScript with [Flow](https://flowtype.org/) type annotations into\nstandard JavaScript in an instant with no configuration and minimal setup.\n\n[Flow](https://flow.org/) provides static type checking to JavaScript which\ncan both help find and detect bugs long before code is deployed and can make\ncode easier to read and more self-documenting. The Flow tool itself only reads\nand analyzes code. Running code with Flow type annotations requires first\nremoving the annotations which are non-standard JavaScript. Typically this is\ndone via adding a plugin to your [Babel](https://babeljs.io/) configuration,\nhowever Babel may be overkill if you're only targeting modern versions of\nNode.js or just not using the modern ES2015 features that may not be in\nevery browser.\n\n`flow-remove-types` is a faster, simpler, zero-configuration alternative with\nminimal dependencies for super-fast `npm install` time.\n\n## Getting Started\n\nUse the command line:\n\n```bash\nnpm install --global flow-remove-types\n```\n\n```bash\nflow-remove-types --help\nflow-remove-types input.js > output.js\n```\n\nOr the JavaScript API:\n\n```bash\nnpm install flow-remove-types\n```\n\n```js\nvar flowRemoveTypes = require('flow-remove-types');\nvar fs = require('fs');\n\nvar input = fs.readFileSync('input.js', 'utf8');\nvar output = flowRemoveTypes(input);\nfs.writeFileSync('output.js', output.toString());\n```\n\nWhen using the `flow-remove-types` script, be sure [not to direct the output to itself](https://superuser.com/questions/597244/why-does-redirecting-the-output-of-a-file-to-itself-produce-a-blank-file)!\n\n## Use in Build Systems\n\n**Rollup:** [`rollup-plugin-flow`](https://github.com/leebyron/rollup-plugin-flow)\n\n**Browserify:** [`unflowify`](https://github.com/leebyron/unflowify)\n\n**Webpack:** [`remove-flow-types-loader`](https://github.com/conorhastings/remove-flow-types-loader)\n\n**Gulp:** [`gulp-flow-remove-types`](https://github.com/wain-pc/gulp-flow-remove-types)\n\n## Use with existing development tools\n\n* ESLint: [eslint-plugin-flowtype](https://github.com/gajus/eslint-plugin-flowtype)\n* Mocha: `mocha -r flow-remove-types/register`\n* Jest: Add to your config:\n\n  ```js\n   transform: {\n     \"^.+\\\\.js(?:\\\\.flow)?$\": \"flow-remove-types/jest\"\n   }\n   ```\n\n## Use `flow-node`\n\nWherever you use `node` you can substitute `flow-node` and have a super fast\nflow-types aware evaluator or REPL.\n\n```bash\n$ flow-node\n> var x: number = 42\nundefined\n> x\n42\n```\n\n> Note: This package is also available under the *alias* `flow-node` since it's\n> often looked for at that location due to the popularity of this script. Both\n> scripts are available no matter which package you install.\n\n## Use the require hook\n\nUsing the require hook allows you to automatically compile files on the fly when\nrequiring in node, useful during development:\n\n```js\nrequire('flow-remove-types/register')\nrequire('./some-module-with-flow-type-syntax')\n```\n\nYou can also provide options to the require hook:\n\n```js\n// Transforms all files, not just those with a \"@flow\" comment.\nrequire('flow-remove-types/register')({ all: true })\n```\n\nUse options to define exactly which files to `includes` or `excludes` with regular\nexpressions. All files are included by default except those found in the\n`node_modules` folder, which is excluded by default.\n\n```js\nrequire('flow-remove-types/register')({ includes: /\\/custom_path\\// })\n```\n\n> **Don't use the require hook in packages distributed on NPM**\n> As always, don't forget to use `flow-remove-types` to compile files before distributing\n> your code on npm, as using the require hook affects the whole runtime and not\n> just your module and may hurt the runtime performance of code that includes it.\n\n## Dead-Simple Transforms\n\nWhen `flow-remove-types` removes Flow types, it replaces them with whitespace.\nThis ensures that the transformed output has exactly the same number of lines\nand characters and that all character offsets remain the same. This removes the\nneed for sourcemaps, maintains legible output, and ensures that it is super easy\nto include `flow-remove-types` at any point in your existing build tools.\n\nBuilt atop the official Flow [parser](https://github.com/facebook/flow/tree/master/packages/flow-parser),\n`flow-remove-types` is designed to operate on the same syntax Flow itself understands.\nIt also passes through other common non-standard syntax such as [JSX](https://facebook.github.io/jsx/)\nand experimental ECMAScript proposals that Flow supports.\n\n**Before:**\n\n```js\nimport SomeClass from 'some-module'\nimport type { SomeInterface } from 'some-module'\n\nexport class MyClass<T> extends SomeClass implements SomeInterface {\n\n  value: T\n\n  constructor(value: T) {\n    this.value = value\n  }\n\n  get(): T {\n    return this.value\n  }\n\n}\n\n```\n\n**After:**\n\n```js\nimport SomeClass from 'some-module'\n\n\nexport class MyClass    extends SomeClass                          {\n\n\n\n  constructor(value   ) {\n    this.value = value\n  }\n\n  get()    {\n    return this.value\n  }\n\n}\n```\n\n### Pretty Transform\n\nRather not have the whitespace? Pass the `--pretty` flag to remove the whitespace.\n\n```bash\nflow-remove-types --pretty --sourcemaps source.js\n```\n\nOr using the JS API:\n\n```js\nvar flowRemoveTypes = require('flow-remove-types');\nvar fs = require('fs');\n\nvar input = fs.readFileSync('input.js', 'utf8');\nvar output = flowRemoveTypes(input, { pretty: true });\nfs.writeFileSync('output.js', output.toString());\nvar sourceMap = output.generateMap();\nfs.writeFileSync('output.js.map', JSON.stringify(sourceMap));\n```\n\n## Performance\n\n> *NOTE*: These timings are for `flow-remove-types` v1.\n\n### Install\n\nInstalling via `npm` from an empty project:\n\n**flow-remove-types:**\n\n```bash\ntime npm install flow-remove-types\n\nreal  0m3.193s\nuser  0m1.643s\nsys   0m0.775s\n```\n\n**Babel:**\n\n```bash\ntime npm install babel-cli babel-plugin-transform-flow-strip-types\n\nreal  0m23.200s\nuser  0m10.395s\nsys   0m4.238s\n```\n\n### Transform\n\nTransforming a directory of 20 files of 100 lines each:\n\n**flow-remove-types:**\n\n```bash\ntime flow-remove-types src/ --out-dir dest/\n\nreal  0m0.431s\nuser  0m0.436s\nsys   0m0.068s\n```\n\n**Babel:**\n\n```bash\ntime babel src/ --out-dir dest/\n\nreal  0m1.074s\nuser  0m1.092s\nsys   0m0.149s\n```\n","publish_time":1639179077246,"_cnpm_publish_time":1639179077246,"dist-tags":{"latest":"2.338.0"}}