{"id":25383,"library":"esbuild-plugin-pipe","title":"esbuild-plugin-pipe","description":"A tiny esbuild plugin (v0.2.0) that composes other esbuild plugins by piping their output sequentially, analogous to Unix pipes. Release cadence is low (last release 2021). It requires plugins to explicitly opt-in to support piping, which limits compatibility. Alternative approaches include manually chaining onLoad callbacks or using `esbuild`'s built-in plugin ordering. Only 84 bytes minified.","status":"active","version":"0.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/nativew/esbuild-plugin-pipe","tags":["javascript","esbuild","esbuild-plugin","pipe","merge","combine","plugins"],"install":[{"cmd":"npm install esbuild-plugin-pipe","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-plugin-pipe","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-plugin-pipe","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only; CommonJS require will fail.","wrong":"const pipe = require('esbuild-plugin-pipe')","symbol":"default","correct":"import pipe from 'esbuild-plugin-pipe'"},{"note":"Both default and named exports work; default export is recommended.","wrong":"import pipe from 'esbuild-plugin-pipe'","symbol":"pipe (named)","correct":"import { pipe } from 'esbuild-plugin-pipe'"},{"note":"Uses esbuild's Plugin type for type safety.","wrong":"type PipeOptions = { filter: RegExp; namespace: string; plugins: any[] }","symbol":"config type","correct":"interface PipeOptions { filter?: RegExp; namespace?: string; plugins: import('esbuild').Plugin[] }"}],"quickstart":{"code":"import esbuild from 'esbuild';\nimport pipe from 'esbuild-plugin-pipe';\n\nawait esbuild.build({\n  entryPoints: ['input.js'],\n  bundle: true,\n  outfile: 'output.js',\n  plugins: [\n    pipe({\n      filter: /\\.js$/,\n      namespace: 'file',\n      plugins: [\n        {\n          name: 'example',\n          setup(build, { transform } = {}) {\n            if (transform) {\n              transform.contents = transform.contents.toUpperCase();\n              return { contents: transform.contents };\n            }\n            build.onLoad({ filter: /.*/ }, async (args) => {\n              const fs = await import('fs/promises');\n              let contents = await fs.readFile(args.path, 'utf8');\n              contents = contents.toUpperCase();\n              return { contents };\n            });\n          }\n        }\n      ]\n    })\n  ]\n}).catch(() => process.exit(1));","lang":"typescript","description":"Shows basic usage of esbuild-plugin-pipe to transform file contents sequentially."},"warnings":[{"fix":"Update plugin setup functions to destructure transform from the second argument: setup(build, { transform } = {}).","message":"In v0.2.0, the transform argument to setup() changed from a direct parameter to an object property: setup(build, { transform }) instead of setup(build, transform).","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Only use pipe() with plugins that implement the piping protocol as documented.","message":"Plugins must explicitly support piping by checking the transform argument; otherwise pipe() silently ignores them and passes through unmodified contents.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"For other hooks, chain plugins manually or use a different composition mechanism.","message":"The plugin only supports piping onLoad callbacks; it does not affect other hooks like onResolve or onStart.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Update the plugin to use setup(build, { transform } = {}) and handle transform.contents and transform.args.","cause":"Using pipe() with a plugin that does not comply with the v0.2.0 protocol where transform is an object parameter.","error":"Error: The transform argument is not an object. Expected { contents, args } but got ..."},{"fix":"Guard with if (transform) before accessing transform.contents.","cause":"The plugin's setup function tries to access transform.contents without checking if transform is defined.","error":"TypeError: Cannot read properties of undefined (reading 'contents')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}