{"id":14464,"library":"bdr","title":"BDR Bundler","description":"BDR (BunDleR) is a JavaScript/TypeScript bundler inspired by `bili` and `poi`, originally designed for bundling, transforming, and developing JavaScript projects. It aimed to provide a lightweight alternative for building modern applications, leveraging TypeScript. Originally released with features for source code transformation and development server capabilities, its latest version is 1.7.0, released in September 2019. The project is currently abandoned, with its GitHub repository archived, indicating no further development or maintenance. Users should be aware that it lacks support for newer JavaScript features, security updates, and compatibility with recent Node.js and TypeScript versions, making it unsuitable for new projects or active development.","status":"abandoned","version":"1.7.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/fjc0k/bdr","tags":["javascript","bundler","bdr"],"install":[{"cmd":"npm install bdr","lang":"bash","label":"npm"},{"cmd":"yarn add bdr","lang":"bash","label":"yarn"},{"cmd":"pnpm add bdr","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for TypeScript compilation and type checking during development and build processes, specifically `^3.1.3`.","package":"typescript","optional":false}],"imports":[{"note":"The primary function for programmatically triggering a build. While ESM import is shown, CommonJS 'require' was also common for Node.js projects at the time of its last update.","wrong":"const { build } = require('bdr')","symbol":"build","correct":"import { build } from 'bdr'"},{"note":"BDR was primarily used via its command-line interface. 'npx' ensures using the locally installed version without global installation.","wrong":"bdr build // Requires global install which is not recommended.","symbol":"CLI Tool","correct":"npx bdr build [entrypoint] --outDir dist"},{"note":"Configuration was typically provided via a 'bdr.config.js' file in the project root, exported as a CommonJS module.","wrong":"import config from './bdr.config.js' // ES module config files (.mjs) were less common at the time, and direct import of configuration files is not how bundlers typically consume them.","symbol":"Configuration","correct":"// bdr.config.js\nmodule.exports = { entry: 'src/index.js', output: { dir: 'dist' } };"}],"quickstart":{"code":"import { build } from 'bdr';\nimport path from 'path';\nimport fs from 'fs';\n\n// Create a dummy source file for demonstration\nconst entryContent = `\nconsole.log('Hello from BDR!');\nexport const greeting = 'BDR says hi!';\n`;\nconst srcDir = path.resolve(__dirname, 'temp_bdr_src');\nconst entryPath = path.resolve(srcDir, 'main.js');\nconst distPath = path.resolve(__dirname, 'temp_bdr_dist');\n\nfs.mkdirSync(path.dirname(entryPath), { recursive: true });\nfs.writeFileSync(entryPath, entryContent);\n\nasync function runBuild() {\n  try {\n    console.log('Starting BDR build...');\n    await build({\n      entry: entryPath,\n      output: {\n        dir: distPath,\n        format: 'cjs', // 'cjs' or 'esm'\n        fileName: 'bundle.js'\n      }\n    });\n    console.log(`Build complete! Output in ${distPath}`);\n    const bundleContent = fs.readFileSync(path.join(distPath, 'bundle.js'), 'utf-8');\n    console.log('Bundle content preview:\\n', bundleContent.substring(0, Math.min(bundleContent.length, 150)) + (bundleContent.length > 150 ? '...' : ''));\n  } catch (error) {\n    console.error('BDR build failed:', error);\n  } finally {\n    // Clean up temporary files\n    fs.rmSync(srcDir, { recursive: true, force: true });\n    fs.rmSync(distPath, { recursive: true, force: true });\n    console.log('Cleaned up temporary files.');\n  }\n}\n\nrunBuild();","lang":"typescript","description":"Demonstrates how to programmatically use BDR's `build` function to bundle a simple JavaScript file, including temporary file setup and cleanup for execution."},"warnings":[{"fix":"Migrate to an actively maintained and supported bundler such as Rollup, esbuild, Vite (which leverages Rollup/esbuild), or Webpack.","message":"The 'bdr' project is abandoned and its GitHub repository is archived. This means there will be no further updates, bug fixes, or security patches, making it unsafe for new projects or critical applications.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Projects requiring modern language features or recent runtime compatibility must use an alternative, maintained bundler to avoid parsing errors or unexpected behavior.","message":"Due to its abandonment in 2019, 'bdr' does not support modern JavaScript syntax (e.g., optional chaining, nullish coalescing), recent TypeScript features, or newer Node.js versions.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"If 'bdr' must be used for legacy projects, ensure 'typescript@^3.1.3' is installed as a peer dependency. Consider migration as the long-term, recommended solution.","message":"The peer dependency on 'typescript' is locked to '^3.1.3'. Using newer TypeScript versions (e.g., 4.x or 5.x) will likely lead to compilation errors or incompatibility issues due to changes in the TypeScript API or syntax support.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Thoroughly audit any existing project using 'bdr' for transitive vulnerabilities. The most effective mitigation is to migrate to a current bundler with active security maintenance.","message":"Internal and transitive dependencies used by 'bdr' are likely outdated, posing potential security vulnerabilities (CVEs) and compatibility issues with current npm ecosystems. Using this package introduces significant supply chain risks.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure you are using the correct ESM import: `import { build } from 'bdr'`. If using CommonJS, verify the module target in your `tsconfig.json` or try `const bdr = require('bdr'); bdr.build(...)` if it's a default export with properties.","cause":"Incorrect import statement, or 'build' function is not exposed as expected when attempting to use CommonJS `require` or an outdated version of the package.","error":"TypeError: build is not a function"},{"fix":"Install the specific TypeScript version required by 'bdr': `npm install typescript@^3.1.3` or `yarn add typescript@^3.1.3`.","cause":"'typescript' is a peer dependency of 'bdr' but was not installed in the project's `node_modules`.","error":"Error: Cannot find module 'typescript' or Module not found: Error: Can't resolve 'typescript'"},{"fix":"Use `npx bdr` to execute the local installation of the CLI, or ensure 'bdr' is listed in your project's `package.json` scripts (e.g., `\"build\": \"bdr build\"`) and run via `npm run build`.","cause":"The `bdr` CLI tool is not globally installed on your system's PATH, or it is not available in the local project's `node_modules/.bin` directory.","error":"bdr: command not found"},{"fix":"This issue is fundamental to 'bdr' being an abandoned project with an outdated parser. It cannot be fixed within 'bdr'. The only resolution is to migrate your project to a current bundler that supports these modern language features.","cause":"Attempting to bundle source code that uses modern JavaScript syntax (e.g., optional chaining `?.`, nullish coalescing `??`, private class fields `#field`) which 'bdr's outdated parser cannot understand.","error":"SyntaxError: Unexpected token '?' / Unexpected private field"}],"ecosystem":"npm"}