← Commit history

ffpup v0.1.0: lazy-install puppeteer-core, tiny zip

barrett-land ·7427cfa957 ·4mo ago ·parent 126907e
3 files changed +21−7
ffpup-bridge-v0.1.0.zipadded
⋯ 1 unchanged line ⋯
ffpup-manifest.json+3−3
@@ -2,7 +2,7 @@   "manifest_version": 1,   "version": "0.1.0",   "url": "ffpup-bridge-v0.1.0.zip",-  "sha256": "43c6584e5584e13ea36581fe47ed4d998795cea020d3748d4bbdc8b0535d9059",-  "size": 9547472,+  "sha256": "2cb6750c594450f778828a3723c05e678fb5292df284ec4713a5672b72e97a29",+  "size": 6617,   "released_at": "2026-06-29T16:53:57Z"-}+}\ No newline at end of file
server.js+18−4
@@ -17,10 +17,23 @@ const http = require('http'); const fs = require('fs'); const path = require('path'); -// puppeteer-core (no bundled-browser download); fall back to full puppeteer in dev.-let puppeteer;-try { puppeteer = require('puppeteer-core'); }-catch { puppeteer = require('puppeteer'); }+const { execSync } = require('child_process');++// puppeteer-core is loaded LAZILY (on the first browser verb), and auto-installed+// into this bridge dir if missing. This keeps the published bridge zip tiny — the+// ~50MB node_modules is fetched once, on first use, on the user's machine. /status+// never touches it, so the bridge passes its health check instantly.+let _puppeteer = null;+function getPuppeteer() {+  if (_puppeteer) return _puppeteer;+  try { _puppeteer = require('puppeteer-core'); return _puppeteer; } catch { /* not installed */ }+  try { _puppeteer = require('puppeteer'); return _puppeteer; } catch { /* dev fallback */ }+  console.log('[ffpup] first run — installing puppeteer-core (one-time)…');+  execSync('npm install puppeteer-core@^24 --no-audit --no-fund --loglevel=error',+           { cwd: __dirname, stdio: 'inherit' });+  _puppeteer = require('puppeteer-core');+  return _puppeteer;+}  const PORT = (() => {   const i = process.argv.indexOf('--port');@@ -81,6 +94,7 @@ function getTab(session, tabId) { }  async function getOrLaunchBrowser(profileName, freshProfile) {+  const puppeteer = getPuppeteer();   const existing = browsers.get(profileName);   if (existing && existing.browser.isConnected()) {     try {