LogoPear Docs
ReferencesBareModules

bare-union-bundle

Reference for bare-union-bundle: layer multiple Bare bundles into a single union bundle and load modules across the layers.

bare-union-bundle layers multiple bare-bundle files into one union bundle, so modules resolve across a stack of bundles (for example, an app layer over a shared base). It's pure JavaScript, built on bare-module-traverse.

npm i bare-union-bundle

Usage

const UnionBundle = require('bare-union-bundle')

const b = UnionBundle.require('./0.bundle', './1.bundle', './2.bundle')

// load entrypoint.js from layer 1, unioning back to the project root
const mod = b.load(new URL('file:///root-of-project'), 'entrypoint.js', 1)

API

const b = new UnionBundle(bundles) · UnionBundle.require(...files)

Create a union from in-memory bundles, or load and union bundle files.

const layer = await b.add(root, entrypoint[, opts])

Add a new layer by traversing from entrypoint relative to root.

const bundle = b.checkout(index)

Extract a single layer as a standalone bundle.

const mod = b.load(root, entrypoint, index[, opts])

Load a module from layer index, resolving across the union back to root.

Builds on bare-bundle, bare-module, bare-module-traverse, and bare-fs (see Bare modules).

See also

On this page