Repository navigation
Vendoring
estrogen build copies files into the built tree before it obfuscates, so a site
declares its vendoring in the config instead of keeping a hand-written copy
script. Each [[vendor]] table is one input: where it comes from, where it
lands, and whether it is obfuscated on the way in.
A plain estrogen <dir> run obfuscates what the bundler already wrote. Some files
are never bundled: a whole package from node_modules, a transport runtime, a
folder of assets. estrogen build <dir> brings those in first, under stamped
neutral names, then obfuscates the app chunks. This replaces the per-site copy
step that each build kept by hand (SystemYA's prepare scripts are the prior art).
# estrogen.toml
[[vendor]]
from = 'node_modules/ruffle' # a package dir, a folder, or a glob
to = 'assets' # the destination under the dist root
mode = 'verbatim' # or 'obfuscate'
stamp = true # insert the per-build stamp before the extension
[[vendor.rewrite]] # optional: rewrite references in the copied text
find = 'epoxy.wasm'
to = 'ln.{stamp}.wasm'-
fromis a package directory, a folder, or a glob, relative to the working directory. A directory is copied whole; a glob copies its matches. -
tois the destination under the dist root. -
modeisverbatim(the default) orobfuscate. A verbatim file is copied as is, which is what a vendored transport runtime wants; an obfuscate file runs the same pass as an app chunk on the way in. -
stampinserts the per-build stamp before the extension, sosw.jslands assw.<stamp>.js, a fresh URL each build. To drop a package name from a file as well, give that input atothat names a neutral file. - each
[[vendor.rewrite]]replacesfindwithtoin the copied file's text.{stamp}intoexpands to the build stamp, so a reference points at the stamped name the file lands under.
The stamp is a short neutral token, minted once per build and reused across every
input, so a reference rewritten to a stamped name matches the file that lands
under it. With --seed it is deterministic, so a build repeats byte for byte;
without a seed it is drawn fresh each build. It never spells a canary, so a
stamped name cannot reintroduce one.
estrogen build -c estrogen.toml distestrogen build vendors every [[vendor]] input into each dist, then obfuscates
the rest of the tree. estrogen dist with no build stays obfuscate-only and
vendors nothing. From Rust the same work is Obfuscator::build(dist), and
obfuscate_dir stays obfuscate-only.
Every vendored file is canary checked, verbatim ones included, and the build fails closed if a listed literal survives. The source-map comment is stripped from the files estrogen copies, the same as the files it obfuscates. The limit is the same too: this raises the cost of reading the build, it is not secrecy. 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.