Registry / devops / lofi-bundler

lofi-bundler

JSON →
library1.0.1jsnpmunverified

Lofi Bundler is a minimalist TypeScript utility designed for projects that prioritize simplicity and a zero-dependency build process, especially when targeting browser environments or when complex module loaders are unnecessary. It operates by walking through all specified TypeScript files within a project (explicitly excluding `node_modules` and other external folders) and concatenating their content into a single TypeScript bundle. This bundled file can then be fed into the standard TypeScript compiler (`tsc`) for final compilation, eliminating the need for more elaborate bundling solutions like Webpack, Rollup, or even Babel configurations. The package's current stable version is 1.0.1, suggesting a mature, feature-complete state with an infrequent release cadence focused on stability. Its primary differentiator lies in its 'lofi' philosophy: a bare-bones approach that avoids external dependencies and configuration overhead, making it ideal for small, self-contained utilities or libraries that need to run in both Node.js and the browser without introducing complex build chains or module resolution challenges inherent to different environments.

npm install lofi-bundler
INSTALL
IMPORT
SIG · LOFI-BUNDLER
L
lofi-bundler
devopsjavascriptv1.0.1
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.

traceConcat
import { traceConcat } from 'lofi-bundler';
const { traceConcat } = require('lofi-bundler');
Lofi Bundler is primarily designed for TypeScript projects; use ESM imports for optimal integration. Default exports are not supported.

Demonstrates how to configure and run `lofi-bundler` via CLI in `package.json` scripts, including the subsequent `tsc` step for browser compatibility, and also shows programmatic API usage for direct integration.

{ "name": "my-lofi-project", "version": "1.0.0", "scripts": { "prebuild:browser": "rm -f bundle.ts", "build:browser": "lofi-bundler && tsc bundle.ts --target es5 --module commonjs --outFile dist/browser-bundle.js", "postbuild:browser": "rm bundle.ts" }, "config": { "lofi-bundler": { "entry": "src/index.ts", "target": "bundle.ts", "include": "src/utils/*.ts" } }, "devDependencies": { "lofi-bundler": "^1.0.0", "typescript": "^5.0.0" } } // src/index.ts export function sayHello(name: string): string { return `Hello from Lofi Bundler, ${name}!`; } // src/utils/math.ts export function add(a: number, b: number): number { return a + b; } // To run: // 1. Save the above package.json // 2. Create src/index.ts and src/utils/math.ts with the content above. // 3. Run `npm install` or `yarn install`. // 4. Run `npm run build:browser` or `yarn build:browser`. // This will generate `dist/browser-bundle.js`. // Example of programmatic usage (optional, does not require package.json config) // import { traceConcat } from 'lofi-bundler'; // import * as fs from 'fs'; // async function generateBundleApi() { // const entryFilePath = 'src/index.ts'; // const bundledSource = await traceConcat(entryFilePath); // fs.writeFileSync('bundle-via-api.ts', bundledSource); // console.log('Bundle generated via API to bundle-via-api.ts'); // } // generateBundleApi();
Debug
Known issues
breakingLofi Bundler explicitly does not support default exports. Using them will lead to unexpected naming or compilation errors, as the bundler is designed around named exports only.
fix
Refactor your code to use named exports exclusively. For example, instead of `export default class MyClass {}`, use `export class MyClass {}`.
affects: >=1.0.0
gotchaThis bundler is intentionally designed to process only files within your immediate project scope and explicitly excludes `node_modules` or other external folders. It is not suitable for bundling third-party npm dependencies.
fix
Ensure your project truly has zero runtime dependencies, or manually manage external dependencies outside the lofi-bundler process (e.g., via `<script>` tags in HTML or a separate bundling step).
affects: >=1.0.0
gotchaLofi Bundler outputs a single TypeScript file. This intermediate file still requires a subsequent compilation step using `tsc` to be transformed into a runnable JavaScript file, especially for specific browser targets (e.g., ES5).
fix
Always include `tsc` as a follow-up step in your build script after running `lofi-bundler`, configuring `tsc` with appropriate `--target` and `--module` options for your deployment environment.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Default exports are not supported.
Attempting to use `export default` syntax in your TypeScript files.
fix
Change all default exports to named exports. The bundler does not guarantee correct naming or resolution for default exports.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
lofi-bundler — npm install lofi-bundler · libregistry