babel-plugin-streamline
raw JSON → 2.0.26 verified Sat Apr 25 auth: no javascript maintenance
Babel plugin that enables compile-time transformation of Streamline.js async syntax (callback-, fiber-, and generator-based) within the Babel ecosystem. This package (version 2.0.26, last stable) allows you to combine Streamline's non-blocking control flow with Babel's transpilation pipeline. Key differentiators: integrates Streamline's _ (callback) / fiber / generator modes as Babel plugins, requires matching Babel major version, and is primarily for legacy projects using Streamline.js. Release cadence is low; mainly maintenance updates.
Common errors
error ReferenceError: _ is not defined ↓
cause Missing or incorrect require of streamline runtime (e.g., require('streamline').register())
fix
Add require('streamline').register() at entry point or use runtime option 'callbacks' which auto-includes helpers.
error Babel 7: Cannot find module 'babel-plugin-streamline' ↓
cause babel-plugin-streamline is not compatible with Babel 7; npm install may fail or resolve incorrectly.
fix
Downgrade to Babel 6 or use an alternative async transform (e.g., @babel/plugin-transform-runtime).
error TypeError: Cannot read property 'transpile' of undefined ↓
cause Using plugin array syntax with options instead of extra object.
fix
Move options to extra.streamline in Babel config; do not pass options as second element in plugins array.
Warnings
breaking babel-plugin-streamline only works with Babel 5.x and 6.x; not compatible with Babel 7+ ↓
fix Do not use with Babel 7; consider switching to @babel/plugin or alternative async transform.
gotcha Options must be placed under babel's extra object, not as plugin arguments. ↓
fix Set options via extra.streamline in Babel config.
gotcha When using 'generators' or 'fibers' runtime, you must blacklist Babel's regenerator plugin to avoid conflicts. ↓
fix Add 'blacklist': ['regenerator'] to Babel config when runtime is not 'callbacks'.
deprecated Package is in maintenance mode; no active development; consider migrating away from Streamline.js. ↓
fix Replace Streamline.js with async/await or other modern async patterns.
Install
npm install babel-plugin-streamline yarn add babel-plugin-streamline pnpm add babel-plugin-streamline Imports
- plugin wrong
{ plugins: ["babel-plugin-streamline"] }correct{ plugins: ["streamline"] } - options wrong
{ plugins: [["streamline", { runtime: 'callbacks' }]] }correct{ extra: { streamline: { runtime: 'callbacks' } } } - use with generators wrong
{ extra: { streamline: { runtime: 'generators' } } }correct{ extra: { streamline: { runtime: 'generators' } }, blacklist: ['regenerator'] }
Quickstart
// Install: npm install babel-plugin-streamline babel-core
// .babelrc
{
"plugins": ["streamline"],
"extra": {
"streamline": {
"runtime": "callbacks"
}
}
}
// Input file (app._js)
function delay(ms, callback) {
setTimeout(callback, ms);
}
function test() {
console.log('before');
delay(1000, _);
console.log('after');
}