js-library-detector is an npm package that provides programmatic access to the detection logic used by the 'Library Detector for Chrome' browser extension. It identifies various JavaScript frameworks and libraries in use on a given webpage by inspecting the `window` object and other global properties. The current stable version is 6.7.0, and the project demonstrates an active release cadence with frequent updates adding new library detections (e.g., WordPress, Gatsby, Shopify, Wix, Magento) and refining existing ones. Its key differentiator is its comprehensive list of supported libraries and its origin as a widely used browser extension, providing robust, battle-tested detection capabilities in a headless or server-side rendering context via tools like JSDOM or Puppeteer.
npm install js-library-detectorVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use js-library-detector in a Node.js environment by simulating a browser window with JSDOM, loading HTML content, and then executing the detection logic to identify JavaScript libraries present on the page.
Update your detection logic to not expect 'Create React App' to be reported. Consider alternative, more robust methods if this specific detection is critical for your use case.
When using `js-library-detector` in Node.js, ensure you're passing a `window` object from a JSDOM instance or a Puppeteer page context to the `detect` function, typically by using `detect.call(window, options)`.
Ensure you are either running the detection in a browser environment, or providing a simulated browser `window` object when using it in Node.js, e.g., `detect.call(dom.window, options);`.
Set up a JSDOM instance in your Node.js environment and pass its `window` object to the `detect` function's `this` context, or execute the code within a browser or headless browser context.
When using JSDOM or Puppeteer, ensure you wait sufficiently for the page's scripts to execute and for all dynamic content to render before invoking the `detect` function. In JSDOM, use `dom.window.addEventListener('load', ...)` or a `setTimeout` with a reasonable delay after `runScripts: 'dangerously'` is enabled. In Puppeteer, use `page.goto(url, { waitUntil: 'networkidle0' })` or `page.waitForSelector()`.No dependency data recorded yet.