Repository navigation
Recipes
estrogen fits a handful of build shapes. Each recipe is a full setup: the config, the command or plugin, and what lands. For the config file see Configuration, for the flags CLI, and for each plugin its own page.
The job SystemYA's prepare scripts did by hand: pull a proxy transport out of
node_modules into the served tree under a stamped name, rewrite its wasm
reference, and obfuscate the app chunks, in one estrogen build.
estrogen.toml:
[[vendor]]
from = 'node_modules/@mercuryworkshop/epoxy-transport/dist'
to = 'assets'
mode = 'verbatim' # a transport runs on the hot path, so do not encrypt it
stamp = true
[[vendor.rewrite]]
find = 'epoxy.wasm'
to = 'ln.{stamp}.wasm'
[[canary]]
value = 'epoxy'
reason = 'transport package name'estrogen build -c estrogen.toml distThe transport lands under dist/assets with a per-build stamp in its name, its
epoxy.wasm reference rewritten to the stamped name, and the app chunks in dist
obfuscated. The build fails closed if epoxy survives in plaintext anywhere.
A site that emits more than one tree (an AWS build, a jsDelivr cloak, a single-file build) obfuscates them in one run:
estrogen aws/dist svg/jsdelivr singlefileEach dir is walked and rewritten in place. estrogen with no build vendors
nothing; it obfuscates what the bundler already wrote.
import { defineConfig } from 'vite';
import { pluginEstrogen } from '@sysce/estrogen/vite';
export default defineConfig({
plugins: [pluginEstrogen({ config: 'estrogen.toml' })],
});Runs after vite build writes the output, over build.outDir. See Vite.
import { pluginEstrogen } from '@sysce/estrogen/rollup';
export default {
input: 'src/index.js',
output: { dir: 'dist', format: 'es' },
plugins: [pluginEstrogen({ config: 'estrogen.toml' })],
};See Rollup.
import { build } from 'esbuild';
import estrogen from '@sysce/estrogen/esbuild';
await build({
entryPoints: ['src/index.js'],
bundle: true,
outdir: 'dist',
plugins: [estrogen({ config: 'estrogen.toml' })],
});See esbuild.
import estrogen from '@sysce/estrogen/astro';
import { defineConfig } from 'astro/config';
export default defineConfig({
integrations: [estrogen({ config: 'estrogen.toml' })],
});Runs on astro:build:done, over the final static output directory (the client
output directory for an SSR build). See Astro.
Run the bundler's own watch build and estrogen's watcher beside it, so each rebuild is re-obfuscated:
vite build --watch &
estrogen --watch distestrogen re-runs on each debounced change and obfuscates only the fresh chunks the bundler wrote; its own output carries a marker and is skipped. Dev-server hot reload through a plugin is a separate seam, so run the watcher beside the dev server for now. See Watcher.
Every recipe here raises the cost of reading the build; none makes it secret. A decoder key ships in each file. See Security and limits.
@sysce/estrogen ·
Fracital/estrogen · ISC · by David Reed.
estrogen raises the cost of reading a build; it does not make it secret.