Angular Modernizer
    Preparing search index...

    WorkerPool manages a pool of Node.js worker threads for parallel analysis operations.

    The worker script is provided by the @angular-modernizer/worker package; pass getWorkerScriptPath() from that package as workerScriptPath.

    Key Features:

    • Worker lifecycle management (spawn, recycle on memory pressure, terminate)
    • Timeout handling per task
    • Per-worker Project instances (ts-morph cannot be serialized)
    • File path-based communication (not AST serialization)
    • Isolated worker state (no shared Project/API)
    • Graceful shutdown and error recovery
    const pool = new WorkerPool({
    tsConfigPath: '/path/to/tsconfig.json',
    maxWorkers: 4,
    workerHeapLimit: 512
    });

    const result = await pool.executeTask({
    id: 'task-1',
    type: 'analyze-rule',
    filePath: '/path/to/file.ts',
    ruleIds: ['rule-1', 'rule-2'],
    pluginIds: ['plugin-architecture']
    });

    await pool.terminate();

    The WorkerPool analysis path is deprecated since 1.1 and will be removed in 2.0; the MCP scans run in a scan worker instead.

    Index

    Constructors

    Methods

    • Terminate all workers and clean up resources.

      Returns Promise<void>