Bundler API
defineBundler, esbuild factory, and bundler types for JS/TS kernel input processing.
Bundlers resolve imports, transpile code, and produce executable bundles for JS/TS kernel inputs.
Types
Prop
Type
Prop
Type
Prop
Type
Prop
Type
Prop
Type
Prop
Type
esbuild
esbuild() installs the default esbuild-wasm bundler toolkit. Use esbuildBundler(options) only when configuring the role factory directly. Both handle ts, js, tsx, jsx by default.
defineBundler
defineBundler creates a BundlerPluginFactory from a configuration object. Required methods: initialize, detectImports, bundle, execute, registerModule. Optional: clearExecutionCache, onDispose.
Operation methods use (input, runtime, context): a BundleInput, a BundlerServices carrying a fresh operation-scoped AbortSignal, and the persistent context returned by initialize (which receives a BundlerInitServices). detectImports returns a DetectImportsResult; execute returns an ExecuteResult. entryPath and returned dependency paths are canonical root-relative runtime paths.
Usage
import { createRuntimeClient } from '@taucad/runtime';
import { fromMemoryFs } from '@taucad/runtime/filesystem';
import { inProcessTransport } from '@taucad/runtime/transport/in-process';
import { defineRuntime } from '@taucad/runtime/worker';
import { replicad } from '@taucad/replicad';
import { esbuild } from '@taucad/esbuild';
const runtime = defineRuntime({
plugins: [replicad(), esbuild()],
});
const client = createRuntimeClient({
transport: inProcessTransport({ runtime, fileSystem: fromMemoryFs() }),
});