What Are the Dependencies of ego‑lite? Complete Breakdown of the CDP Harness Package
The ego‑lite project has only one runtime dependency—acorn (v8.16.0)—while its nine development dependencies include Rollup, esbuild, TypeScript, and tooling for builds and code quality.
The ego‑lite repository provides a lightweight Chrome DevTools Protocol (CDP) harness for browser automation. According to the citrolabs/ego-lite source code, the entire dependency footprint lives in a single Node.js package located at package/ego-browser. This minimalist design keeps the runtime lean while relying on a robust toolchain for development and bundling.
Runtime Dependencies of ego‑lite
ego‑lite declares exactly one runtime dependency in its package.json:
| Dependency | Version | Purpose |
|---|---|---|
acorn |
^8.16.0 |
JavaScript parser for evaluating CDP‑executed scripts |
The acorn parser is used internally to parse JavaScript code dynamically within the CDP harness. In src/cdp-eval.ts, the project leverages acorn.parse() to evaluate expressions sent through the Chrome DevTools Protocol.
// Example: parsing a script with acorn (mirrors how ego‑lite uses it)
import * as acorn from 'acorn';
const source = `function hello() { console.log("Hi"); }`;
const ast = acorn.parse(source, { ecmaVersion: 'latest' });
console.log(ast.type); // → Program
This dependency is declared on [lines 37‑39 of package/ego-browser/package.json](https://github.com/citrolabs/ego-lite/blob/main/package/ego-browser/package.json#L37-L39).
Development Dependencies of ego‑lite
The build and development workflow depends on nine packages, all declared on [lines 26‑36 of package.json](https://github.com/citrolabs/ego-lite/blob/main/package/ego-browser/package.json#L26-L36):
| Dependency | Version | Purpose |
|---|---|---|
@rollup/plugin-node-resolve |
^16.0.3 |
Resolves Node.js modules for Rollup bundling |
@rollup/plugin-typescript |
^12.3.0 |
TypeScript compilation support in Rollup |
@types/node |
^22.15.29 |
Type definitions for Node.js APIs |
esbuild |
^0.28.1 |
Fast bundler for single‑file builds |
lefthook |
^2.1.9 |
Git hook manager for pre‑commit checks |
prettier |
^3.8.4 |
Code formatter |
rollup |
^4.60.4 |
Module bundler that produces the final dist bundle |
tslib |
^2.8.1 |
Runtime helpers for TypeScript‑compiled code |
typescript |
^5.8.3 |
TypeScript compiler |
These dependencies support a two‑stage build process: TypeScript compilation followed by bundling with Rollup and esbuild via scripts/build.mjs.
How Dependencies Are Used in the Source Code
The dependency structure directly maps to key source files in the repository:
Core Runtime Exposure: src/helpers.ts
The src/helpers.ts file serves as the injection point where the runtime—including the bundled acorn parser—is exposed to agent scripts executing within the browser context.
CDP Evaluation: src/cdp-eval.ts
This file contains the actual usage of acorn for parsing JavaScript expressions received through CDP. The parser enables dynamic code evaluation without relying on eval() or Function() constructors.
Build Orchestration: scripts/build.mjs
The build script coordinates Rollup and esbuild to produce a single‑file distributable that embeds the acorn dependency. Running the build produces dist/out/index.js:
npm run build # builds the single‑file bundle
node dist/out/index.js <<'JS'
// your ego‑lite script here
JS
Why ego‑lite Keeps Dependencies Minimal
The project intentionally limits runtime dependencies to reduce:
- Supply chain attack surface – fewer packages to audit and trust
- Installation footprint – faster
npm installin production environments - Bundle size – the single‑file output remains lightweight
All other functionality is implemented directly in TypeScript source code without external libraries.
Summary
ego‑litehas one runtime dependency:acornv8.16.0 for JavaScript parsing- Nine dev dependencies handle TypeScript, bundling, formatting, and Git hooks
- Dependencies are declared in
package/ego-browser/package.jsonwith clear separation betweendependenciesanddevDependencies - The
acornparser is used insrc/cdp-eval.tsfor CDP script evaluation - Build tooling in
scripts/build.mjsproduces a self‑contained bundle embedding the runtime dependency
Frequently Asked Questions
Does ego‑lite have any peer dependencies?
No. The package.json in package/ego-browser does not declare any peerDependencies. The project is self‑contained with its single runtime requirement.
Can I use ego‑lite without installing dev dependencies?
Yes. The dev dependencies are only required for building from source. Once built, the dist/ output is a standalone JavaScript file that requires only Node.js to run.
Why does ego‑lite use both Rollup and esbuild?
The build pipeline uses Rollup for tree‑shaking and module resolution, then esbuild for fast minification and final bundling. This hybrid approach balances optimization speed with output quality.
Is acorn the only external code executed at runtime?
Yes. According to the repository structure, all other runtime functionality is implemented in the project's own TypeScript source files (src/helpers.ts, src/cdp-eval.ts, and related modules).
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →