Registry / devops / assemble-handle

assemble-handle

JSON →
library1.0.0jsnpmunverified

Assemble pipeline plugin for handling custom middleware stages in the Assemble build system. Version 1.0.0 is the latest stable release, updated on npm with monthly downloads. It allows you to create and manage middleware stages like 'onStream', 'preWrite', and 'postWrite', and handle them on files via .pipe(). The package also provides a .once() method to prevent middleware from running multiple times for the same stage. Key differentiator: tightly integrated with Assemble, not a general-purpose middleware runner.

npm install assemble-handle
INSTALL
IMPORT
SIG · ASSEMBLE-HANDLE
A
assemble-handle
devopsjavascriptv1.0.0
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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

default
const handle = require('assemble-handle')
import handle from 'assemble-handle'
CommonJS module; no default ESM export. Use require.
handle.once
handle.once(app, 'stageName')
handle.once('stageName', app)
Arguments order: (app, stage).
handle
const handle = require('assemble-handle'); handle(app, 'stageName')
handle('stageName', app)
Must pass app as first argument.

Demonstrates creating handlers, adding middleware, and using handle in a pipeline task.

const assemble = require('assemble-core'); const handle = require('assemble-handle'); const app = assemble(); // Create middleware stages app.handler('onStream'); app.handler('preWrite'); // Add middleware app.onStream(/.*/, function(file, next) { console.log('onStream:', file.relative); next(); }); app.preWrite(/.*/, function(file, next) { console.log('preWrite:', file.relative); next(); }); // Task using handle app.task('default', function() { return app.src('*.js') .pipe(handle(app, 'onStream')) .pipe(handle(app, 'preWrite')) .pipe(app.dest('dist')); }); app.build('default');
Debug
Known issues
gotchaThe handle function must be called with app as first argument; order matters.
fix
Use handle(app, 'stageName'), not handle('stageName', app).
affects: >=0.0.0
gotchahandle.once only prevents multiple calls within the same file stream; not global deduplication.
fix
Understand that .once() resets per stream; use other dedup patterns if needed.
affects: >=0.0.0
gotchaHandlers must be created with app.handler() before being used.
fix
Always call app.handler('stageName') before accessing app.onStage or using handle.
affects: >=0.0.0
deprecatedAssemble ecosystem is largely superseded by other build tools; not actively maintained.
fix
Consider migrating to Gulp or other modern pipelines.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: app.handler is not a function
Missing assemble-core dependency or incorrect import.
fix
Ensure you npm install assemble-core and require it before assemble-handle.
Error: Middleware stage "onStream" is not defined
Forgot to call app.handler('onStream') before using handle.
fix
Add app.handler('onStream') before calling handle(app, 'onStream').
ReferenceError: handle is not defined
Package not required properly.
fix
Add const handle = require('assemble-handle'); at top of file.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
assemble-corerequiredRequired for handler creation and app instance
Agent activity
14 hits · last 30 days
node
10
Amazon
1
OpenAI (training)
1
Resources
assemble-handle — npm install assemble-handle · libregistry