Skip to content
Mopsgamer edited this page Aug 23, 2026 · 2 revisions

Bun Target

The makeBun() target emulates Bun's native package packing engine (bun pm pack).

Source Code & Reference Links

Original Algorithm & CLI Logic

Bun's native implementation of bun pm pack mimics NPM's packing behavior but with subtle differences:

  • Validates the manifest (package.json).
  • Enforces hardcoded inclusions (package.json, standard documentation like README, LICENSE, COPYING, and bin file paths).
  • Excludes lockfiles (bun.lock, bun.lockb, package-lock.json, yarn.lock, pnpm-lock.yaml) and system environments by default.
  • Processes .npmignore and fallback .gitignore files.

How view-ignored Emulates Bun

  • Reads package.json to extract bin configurations and package entrypoints.
  • Enforces specific hardcoded defaults mapped inside Bun's Rust packer engine.
  • Matches ignore manifests and handles lockfile exclusions.

Verification CLI Command

To verify view-ignored results against native Bun on your system:

bun pm pack --dry-run

Diagnostic CLI command:

vign-diff bun

Usage Example

import * as vign from "view-ignored"
import { makeBun } from "view-ignored/targets"

const ctx = await vign.scan({
	target: makeBun(),
})

console.log(ctx.paths.has("package.json")) // true
console.log(ctx.paths.has("bun.lockb")) // false

Related Wiki Pages

Clone this wiki locally