Registry / web-framework / fast-flow-transform

fast-flow-transform

JSON →
library0.0.3jsnpmunverified

A native Hermes/FFT-based Flow type stripper built on napi-rs, providing programmatic transform, CLI, and bundler adapters for webpack, rspack, rsbuild, Parcel, Vite, Rollup, Rolldown, and esbuild. Current version 0.0.3 (pre-1.0, rapid iteration). Differentiator: uses the battle-tested Hermes parser (same as Metro/React Native) for speed and correctness, supports source map merging, removes empty type-only value imports automatically, and offers a 'preserve' format mode (experimental) that keeps whitespace structure. Compared to alternatives like babel-plugin-flow, it is purpose-built for stripping Flow types without transforming JSX or other syntax.

npm install fast-flow-transform
INSTALL
IMPORT
SIG · FAST-FLOW-TRANSFOR
F
fast-flow-transform
web-frameworkjavascriptv0.0.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

transform
import transform from 'fast-flow-transform';
import { transform } from 'fast-flow-transform';
Default export only. Named export does not exist.
transform (CJS)
const transform = require('fast-flow-transform');
const { transform } = require('fast-flow-transform');
CommonJS require returns the default export directly, not an object with a transform property.
TypeScript types
import type { TransformOptions } from 'fast-flow-transform';
import { TransformOptions } from 'fast-flow-transform';
Types are exported as value-like symbols; use `import type` for type-only imports to avoid runtime side-effects.

Shows basic programmatic usage: importing the default transform function, passing a Flow source string with filename and sourcemap enabled, and logging the stripped output.

import transform from 'fast-flow-transform'; const { code, map } = await transform({ filename: '/path/to/input.js', source: ` // @flow function greet(name: string): string { return 'Hello, ' + name; } `, sourcemap: true, comments: true, }); console.log(code); // Output (stripped): function greet(name) { return 'Hello, ' + name; } console.log(map); // Source map object
fast-flow-transform --version
Debug
Known issues
breakingSource map merge does not preserve upstream sourcesContent or custom metadata fields.
fix
If you need full source map chain fidelity, work with babel-plugin-flow or wait for a future release.
affects: >=0.0.1
gotchaFlow enums lower to flow-enums-runtime package. Generated code imports it at runtime.
fix
Install flow-enums-runtime as a production dependency if your project uses Flow enums.
affects: >=0.0.1
gotchaEmpty type-only value imports are removed. This may break code expecting side-effect imports that are actually type-only.
fix
If you need to retain an import that appears type-only but has runtime side effects, mark it with a comment or restructure imports.
affects: >=0.0.3
deprecatedreactRuntimeTarget option only affects Flow component lowering. It does not change JSX handling.
fix
Use reactRuntimeTarget only when using Flow component syntax with React 18 vs 19. For pure type stripping, omit it.
affects: >=0.0.1
gotchaPreserve format mode is experimental. Output may differ from input whitespace.
fix
Stick to 'compact' or 'pretty' for production. Test preserve mode thoroughly.
affects: >=0.0.1
Errors
Common errors & fixes
Error: Cannot find module 'flow-enums-runtime'
Generated code imports flow-enums-runtime when Flow enums are lowered, but it is not installed.
fix
npm install flow-enums-runtime or add to dependencies.
TypeError: (0 , fast_flow_transform_1.default) is not a function
Named import { transform } used instead of default import.
fix
Use import transform from 'fast-flow-transform' or const transform = require('fast-flow-transform').
SyntaxError: Unexpected token (1:16) - Flow syntax not stripped
transform was called without waiting for promise (missing await) or source was not passed correctly.
fix
Ensure transform is awaited: const result = await transform({...}).
Error: Could not resolve 'fast-flow-transform'
Package not installed or mismatched version in package.json.
fix
npm install fast-flow-transform@latest
Upgrade
Version history
0.0.3latest on npm
Audit
Dependencies
@parcel/pluginoptionalPeer dependency for Parcel adapter
@parcel/source-mapoptionalPeer dependency for Parcel adapter source map handling
viteoptionalPeer dependency for Vite plugin (v7.0.0 or later)
Agent activity
8 hits · last 30 days
node
8
Resources
fast-flow-transform — npm install fast-flow-transform · libregistry