{"id":18174,"library":"bpm-bundle","title":"bpm-bundle","description":"Episode bundler for brainpm (BPM), the package manager for the brain. Version 2.1.0 is the latest stable. Transforms an episode repository (including package.json) into publishable file bundles for distribution via bpm-github or other publishers. Part of the BPM ecosystem, specialized for brain package format; no direct alternatives.","status":"active","version":"2.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/regular/bpm-bundle","tags":["javascript","brainpm","bpm"],"install":[{"cmd":"npm install bpm-bundle","lang":"bash","label":"npm"},{"cmd":"yarn add bpm-bundle","lang":"bash","label":"yarn"},{"cmd":"pnpm add bpm-bundle","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core BPM runtime required for bundling","package":"brainpm","optional":false}],"imports":[{"note":"ESM-only package. Default export is the bundler function.","wrong":"const bundle = require('bpm-bundle')","symbol":"default","correct":"import bundle from 'bpm-bundle'"},{"note":"Also supports named export for tree-shaking.","wrong":"import bundle from 'bpm-bundle' (if using named export)","symbol":"bundle","correct":"import { bundle } from 'bpm-bundle'"},{"note":"TypeScript users must use 'import type' for interfaces.","wrong":"import { BundleOptions } from 'bpm-bundle' (runtime error, only a type)","symbol":"type BundleOptions","correct":"import type { BundleOptions } from 'bpm-bundle'"}],"quickstart":{"code":"import bundle from 'bpm-bundle';\nimport { readFileSync, writeFileSync } from 'fs';\n\nconst episodePath = './my-episode';\nconst options = { format: 'github', version: '2.1.0' };\ntry {\n  const result = bundle(episodePath, options);\n  console.log('Bundled files:', Object.keys(result));\n  writeFileSync('./dist/bundle.zip', result.zip);\n} catch (err) {\n  console.error('Bundling failed:', err);\n}","lang":"typescript","description":"Demonstrates importing the default bundler, reading an episode, and writing the output zip file."},"warnings":[{"fix":"Use import instead of require().","message":"Import syntax changed from CommonJS to ESM in v2.0. require() throws error.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use 'format' instead of 'bundleFormat'.","message":"The 'bundleFormat' option was renamed to 'format' in v2.0.","severity":"deprecated","affected_versions":">=1.0.0 <2.0.0"},{"fix":"Ensure package.json includes a 'brainpm' configuration object.","message":"bpm-bundle expects a valid brainpm package.json. Missing 'brainpm' field causes silent failure.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run npm install bpm-bundle and use import syntax.","cause":"Package not installed or wrong import path in ESM context","error":"Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'bpm-bundle'"},{"fix":"Use import bundle from 'bpm-bundle' instead of import { bundle } from 'bpm-bundle'.","cause":"Using named import when importing as default","error":"TypeError: bundle is not a function"},{"fix":"Add \"type\": \"module\" to package.json or use require with dynamic import.","cause":"Using ESM syntax in a CommonJS file","error":"SyntaxError: Unexpected token 'export'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}