Runtime support
sensored is designed to run anywhere JavaScript runs. The core library has zero runtime-specific dependencies — no node: imports, no Bun built-ins, no browser-only APIs.
Supported runtimes
| Runtime | Supported | CI tested |
|---|---|---|
| Node.js 20+ | Yes | Yes (smoke test) |
| Bun | Yes | Yes (full test suite) |
| Deno | Yes | Yes (smoke test) |
| Browser | Yes | Yes (static analysis) |
| Cloudflare Workers | Yes | Yes (static analysis) |
| Vercel Edge | Yes | Yes (static analysis) |
Importing
Node.js / Bun
import { createRedactor } from "sensored";Deno
import { createRedactor } from "npm:sensored";Browser / Edge
import { createRedactor } from "sensored";Bundlers (Vite, webpack, esbuild) will pick up the ESM build automatically.
What works everywhere
createRedactor()— synchronous redactionredactValue()— recursive object traversalredactor.stream()— streaming redactionrestore()— placeholder restoration- All 131 built-in detectors
- All 10 presets
- Custom detectors
- Allowlist
detectOnlymode
Runtime-specific notes
person_name detector
The person_name detector uses compromise for NER, which is an optional peer dependency. Load it explicitly before creating a redactor that enables person_name:
import { createRedactor, preloadPersonNameDetector } from "sensored";
await preloadPersonNameDetector();
const redactor = createRedactor({
rules: { person_name: { action: "redact" } },
});The dynamic import runs once, only when requested. If compromise is not installed, preloading rejects with INVALID_CONFIG.
Semantic confirmation
The semantic feature uses @typesafe-ai/sdk (optional peer dependency). It requires network access to the TypeSafe API and works in all runtimes that support fetch().
CLI
The sensored CLI is Bun-only. The core library and all adapters work in any runtime.
CI verification
The runtime-smoke.yml workflow runs on every push and pull request:
- Build — builds
dist/with Bun - Node.js — imports
dist/src/index.mjsin Node.js 20 and verifies redaction works - Deno — imports
dist/src/index.mjsin Deno and verifies redaction works - Edge/Browser — scans
dist/src/fornode:imports to verify browser/edge compatibility