{"id":12820,"library":"arenaless-bundler","title":"ArenaLess Bundler","description":"arenaless-bundler is a JavaScript/TypeScript bundler built upon Rollup, specifically designed for the ArenaLess ecosystem. Currently at version 1.1.7, its release cadence appears irregular, driven by project needs rather than a fixed schedule. A key differentiator is its support for a virtual file system, allowing builds to run in environments without direct file access, such as web browsers. It features Deno-like network imports, supporting `npm:`, `jsr:`, `http:`, and `https:` schemes (with `npm:` and `jsr:` resolving via `esm.sh`). The bundler also provides unique asset loading capabilities for local modules via special import suffixes like `?text`, `?base64`, `?binary`, and `?wasm`, alongside default JSON file importing. This focus on virtualized environments and flexible asset handling makes it suitable for specific web-based build pipelines or specialized module bundling needs.","status":"active","version":"1.1.7","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install arenaless-bundler","lang":"bash","label":"npm"},{"cmd":"yarn add arenaless-bundler","lang":"bash","label":"yarn"},{"cmd":"pnpm add arenaless-bundler","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The library is primarily designed for ESM consumption, as demonstrated in its documentation and examples.","wrong":"const { build } = require('arenaless-bundler');","symbol":"build","correct":"import { build } from 'arenaless-bundler';"}],"quickstart":{"code":"import { build } from \"arenaless-bundler\";\nimport * as fs from \"fs\";\n\nasync function testBundler() {\n    let files_text: Record<string, string> = {\n        \"index.ts\": `import { hello } from './hello/hi';\nimport hellots from './hello/hi.ts?text';\nimport hellob64 from './hello/hi.ts?base64';\nhello();\nconsole.log(hellots);\nconsole.log(hellob64);\nimport JSON5 from 'npm:json5';\nconsole.log(JSON5.parse('{a:1}'));\nimport foo from './foo.json';\nconsole.log(foo);`,\n        \"hello/hi.ts\": `export function hello(): void {\n            console.log(\"hello from hi.ts\");\n        }`,\n        \"foo.json\": `{\"bar\":12345}`\n    };\n\n    let files: Record<string, Uint8Array> = {};\n    for (let key in files_text) {\n        files[key] = new TextEncoder().encode(files_text[key]);\n    }\n\n    console.log(\"Starting bundle process...\");\n    // The last three parameters are 'config_json_str', 'logger', 'output_format', 'esbuild_config_json_str', 'is_prod'\n    let res = await build(files, \"index.ts\", \"{}\", console, \"cjs\", \"{}\", false);\n    \n    const outputPath = \"./test_output.js\";\n    fs.writeFileSync(outputPath, res, { encoding: \"utf-8\" });\n    console.log(`Bundle complete. Output written to ${outputPath}`);\n    return res;\n}\n\n(async () => {\n    const start = Date.now();\n    await testBundler();\n    console.log(`Bundling took ${Date.now() - start}ms`);\n})();","lang":"typescript","description":"This quickstart demonstrates how to use `arenaless-bundler` to bundle a small virtual file system project, including local modules, special suffix imports, and network imports, outputting a CommonJS bundle."},"warnings":[{"fix":"Ensure that special suffixes are only applied to paths referencing files within the `Record<string, Uint8Array>` input to the `build` function. Network-imported modules must be consumed without these suffixes.","message":"Special import suffixes like `?binary`, `?text`, `?base64`, and `?wasm` are explicitly designed to work only with local modules provided within the bundler's virtual file system. They are not supported for modules imported via network schemes (`npm:`, `jsr:`, `http:`, `https:`).","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Be aware of the reliance on `esm.sh` for `npm:` and `jsr:` imports. For critical dependencies, consider vendoring them into your virtual file system or using direct `https:` imports if a specific CDN URL is preferred and stable.","message":"The `npm:` and `jsr:` network import schemes internally resolve modules via `https://esm.sh/`. This introduces an external dependency for module resolution that may affect build reliability, performance, or introduce unexpected versioning behavior if `esm.sh` experiences issues or changes its policies.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always convert string content to `Uint8Array` using `new TextEncoder().encode()` for text files, and ensure binary files are also provided as `Uint8Array`.","message":"All input files for the `build` function must be provided as `Uint8Array` within the `files` object representing the virtual file system. Text-based files (like `.ts`, `.js`, `.json`) require explicit manual encoding using `new TextEncoder().encode(fileContent)` before being passed to the bundler.","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":"Verify that all imported modules are present as keys in the `files` object passed to `build`, and that the paths in `import` statements exactly match the keys in the virtual file system.","cause":"The module path specified in an import statement (e.g., `./some-file.ts`) does not correspond to a key in the `files` object provided to the `build` function, or the path is misspelled.","error":"Module not found: Could not resolve 'path/to/module'"},{"fix":"Ensure the `output_format` parameter in the `build` function call (e.g., set to `'cjs'` for CommonJS or `'esm'` for ES modules) matches the target environment's expectations. If bundling to CJS, ensure `package.json` doesn't force ESM; if to ESM, ensure `package.json` has `\"type\": \"module\"` or files end in `.mjs`.","cause":"This error typically occurs when attempting to execute the bundled output (e.g., `test_output.js`) directly in a Node.js environment configured for CommonJS, but the bundled output uses ES module syntax (e.g., `import`/`export`).","error":"SyntaxError: Cannot use import statement outside a module"},{"fix":"These special suffixes are strictly for local modules within the virtual file system. Network imports must be consumed directly without any suffixes.","cause":"Attempting to use a special import suffix (`?text`, `?binary`, `?base64`, `?wasm`) on a module imported via a network scheme (e.g., `npm:json5?text`).","error":"Error: Special suffix '?text' is not supported for network imports."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null}