PuppeteerProvider drives a real headless Chromium browser through the Puppeteer library. Unlike FetchProvider, it executes JavaScript on every page it visits, which means single-page applications, lazy-loaded content, and client-side-rendered portfolios are all resolved correctly. A single browser process is launched on first use and reused across multiple getPageContent calls; each URL gets its own fresh page that is closed immediately after.
Installation
Puppeteer is listed as a direct dependency of@clyrisai/gitresolve and is downloaded automatically:
BROWSER_PROVIDER=puppeteer gitresolve reports that the provider is unavailable, install Puppeteer globally alongside it:
Usage
Direct instantiation
Always callprovider.cleanup() in a finally block so the browser process is terminated even if an error occurs:
Via the factory
CLI
To usePuppeteerProvider from the command line, set the BROWSER_PROVIDER environment variable:
How it works
1
Lazy browser launch
The first call to
getPageContent triggers ensureBrowser(), which imports Puppeteer dynamically and launches Chromium with the flags --no-sandbox and --disable-setuid-sandbox. Subsequent calls reuse the same browser instance.2
New page per URL
For every
getPageContent call, a fresh browser page (browser.newPage()) is created. This prevents cookies, local storage, and cached state from leaking between requests.3
Navigation and content extraction
Puppeteer navigates to the URL using
page.goto(url, { waitUntil, timeout }) and then calls page.content() to retrieve the fully rendered HTML — including all content injected by JavaScript.4
Page teardown
The page is closed in a
finally block after each call, regardless of whether navigation succeeded or threw an error.5
Browser cleanup
Calling
provider.cleanup() closes the Chromium process and sets the internal reference to null. After cleanup, the next getPageContent call will re-launch the browser automatically.