Prebuilt browser bundle of freeze-dry (v1.0.0) for injecting into browser contexts via CDP or automation tools like agent-browser.
freeze-dry snapshots a live web page into a single, self-contained HTML file with all CSS inlined and images embedded as data URIs. It runs inside the browser context, so it captures the DOM after JavaScript execution — making it ideal for SPAs with CSS-in-JS (Emotion, styled-components, etc.).
The upstream package does not ship a prebuilt browser bundle, so this repo provides one.
# 1. Navigate to the page (already authenticated)
agent-browser open https://app.example.com/page
# 2. Inject the bundle
cat freeze-dry-bundle.js | agent-browser eval --stdin
# 3. Capture snapshot and trigger download
agent-browser eval --stdin <<'EOF'
(async () => {
const html = await window.freezeDry(document);
const blob = new Blob([html], { type: 'text/html' });
const a = document.createElement('a');
a.href = URL.createObjectURL(blob);
a.download = 'snapshot.html';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
})();
EOFconst fs = require('fs');
const bundle = fs.readFileSync('freeze-dry-bundle.js', 'utf-8');
// Inject into page
await page.evaluate(bundle);
// Capture snapshot
const html = await page.evaluate(async () => {
return await window.freezeDry(document);
});
fs.writeFileSync('snapshot.html', html);mkdir fd-build && cd fd-build
npm init -y
npm install freeze-dry util
cat > entry.js <<'EOF'
window.process = { env: {}, version: 'v16.0.0', versions: {} };
const { freezeDry } = require("freeze-dry");
window.freezeDry = freezeDry;
EOF
npx esbuild entry.js \
--bundle \
--format=iife \
--outfile=freeze-dry-bundle.js \
--platform=browser \
--define:process.env.NODE_ENV='"production"'window.process— freeze-dry depends onpostcss-values-parser, which imports Node.jsutilmodule. Theutilnpm polyfill checksprocess.versionat init time.utilnpm package — browser polyfill for Node.jsutil, required by postcss internals.
- freeze-dry v1.0.0
- Bundled with esbuild
freeze-dry is licensed under the MIT License.