leebyron / rollup-plugin-flow

Rollup plugin for removing Flow type annotations.
Other
80 stars 11 forks source link

How to keep flow types for .js.flow files #7

Open n1ru4l opened 7 years ago

n1ru4l commented 7 years ago

When authoring a library having the .js.flow files next to your type stripped types is used by IntelliSense for autocomplete

tunnckoCore commented 6 years ago

I'm thinking about that too.. Probably could be done to allow Rollup to parse Flow and to create to bundles - one with flow and another without.

Second variant is to write the id (which is if remember correctly, the filepath) given from (code, id), to dist.

Another thing is to just copy the src to dist with something like flow-copy-source. But don't know if that would work for the editors.

tunnckoCore commented 6 years ago

As given in the Rollup docs

acorn Any options that should be passed through to Acorn, such as allowReserved: true. Cf. the Acorn documentation for more available options.

acornInjectPlugins An array of plugins to be injected into Acorn. In order to use a plugin, you need to pass its inject function here and enable it via the acorn.plugins option. For instance, to use async iteration, you can specify @@18 in your rollup configuration.

But just realized that Acorn does not have Flow plugin? If so, damn ;/. One more thing why i think that Rollup should switch to Babylon. /cc @Rich-Harris