Repository navigation
Node API
The package @sysce/estrogen has three entry points: the main module, an esbuild
plugin, and an rsbuild plugin. All three run the native binary over a built
directory.
import { obfuscate } from '@sysce/estrogen';
const report = await obfuscate({ dirs: ['dist'] });obfuscate(options): Promise<Report> runs the whole pass over one or more
directories and resolves with a Report. It rejects if any file fails,
the same fail-closed rule as the CLI: no partial output for a failing file, and
the error names the file and the reason.
import estrogen from '@sysce/estrogen/esbuild';
// plugins: [estrogen()]The default export is estrogen(options?): esbuild.Plugin. It runs after the build
over the output directory. See esbuild.
import { pluginEstrogen } from '@sysce/estrogen/rsbuild';
// plugins: [pluginEstrogen()]pluginEstrogen(options?): RsbuildPlugin runs after the build over the dist path.
See rsbuild.
The same options object is accepted by obfuscate() and, as overrides, by both
plugins. Every field is optional for the plugins, which infer dirs from the
build. obfuscate() needs at least dirs.
-
dirs: string[]: the built directories to process. -
config?: string: path to a TOML config file. Fields set on the options object override the file. -
canary?: string: path to the canary list (JSON). -
names?: string: path to the name map. -
sourcemap?: string: write maps into this directory, outside the build. Omitted means no map and strippedsourceMappingURLcomments. -
seed?: string: fixed hex seed for deterministic output. Tests only. -
jobs?: number: maximum files in parallel. Default is the CPU count. -
check?: boolean: run the passes and the canary check without writing. -
quiet?: boolean: suppress progress output. -
verbose?: boolean: emit per-file detail.
See Configuration for the config file and Source maps for
the sourcemap behavior.
obfuscate() resolves with a Report. The shape is stable; the numbers are the
files obfuscated, vendored and skipped.
interface Report {
formatVersion: number;
dirs: string[];
filesProcessed: number;
filesSkipped: number;
durationMs: number;
check: boolean;
}filesSkipped counts files estrogen left untouched (a .map, an already-processed
file, a vendored transport asset). check is true when the run wrote nothing. A
failing file rejects the promise with an Error that names the file and the
reason; estrogen does not resolve with a partial report.
The package ships type declarations for all three entry points. Options and
Report are exported from @sysce/estrogen.
@sysce/estrogen ·
Fracital/estrogen · ISC · by David Reed.
estrogen raises the cost of reading a build; it does not make it secret.