From dcb79fc62bdd4d9ec0cbdb2c97d3eb2b2dacdf22 Mon Sep 17 00:00:00 2001 From: amankumarsingh77 Date: Tue, 28 Jul 2026 22:41:18 +0530 Subject: refactor: merge nine files whose reason to exist was gone MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit src/ goes from 84 files to 75 at the same line count — every merge below had exactly one consumer. cdp/event-queue.ts and cdp/pending-requests.ts become daemon/queue.ts. I split these in the daemon-internals commit on the grounds that they held two unrelated concerns, but the transport commit had already deleted the second transport, so both halves had one consumer and the split bought nothing. They also sat in cdp/ while only daemon/ used them. cdp/transport.ts held only the CdpTransport interface after the second transport went; five of its six consumers import it type-only, so it moves to cdp/types.ts. cdp/evaluate.ts moves into cdp/session.ts rather than into its lone consumer isolated-tab.ts — it reaches session.call directly, so under src/domains/ it would trip the raw-cdp-call rule. util/keycodes.ts and util/time.ts fold into their only callers (keyboard.ts, page.ts); util/bytes.ts into util/truncate.ts, which already owns output-size formatting; readpage/capture.ts and search/extract.ts into the tools beside them; profile/picker.ts into profile/command.ts. Kept deliberately: mutex.ts and domains/target.ts each have their own test suite, and folding target.ts into click.ts would make a tool file export a helper. sharp-shim.ts is an isolation boundary carrying two allowlisted casts. result.ts, guards.ts, js-template.ts and paths.ts are small but have 44, 12, 8 and 3 consumers. Co-Authored-By: Claude Opus 5 (1M context) --- src/cdp/evaluate.ts | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 src/cdp/evaluate.ts (limited to 'src/cdp/evaluate.ts') diff --git a/src/cdp/evaluate.ts b/src/cdp/evaluate.ts deleted file mode 100644 index 733a11b..0000000 --- a/src/cdp/evaluate.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { type Result, err, ok } from "../util/result"; -import { type CdpError, cdpError } from "./errors"; -import type { CdpSession } from "./session"; - -export const evaluateJson = async ( - session: CdpSession, - expression: string, - check: (v: unknown) => v is T, - opts?: { sessionId?: string | undefined; timeoutMs?: number | undefined }, -): Promise> => { - const params = { - expression, - returnByValue: true, - awaitPromise: true, - }; - const callOpts = opts?.timeoutMs !== undefined ? { timeoutMs: opts.timeoutMs } : {}; - const r = opts?.sessionId !== undefined - ? await session.callOnTarget("Runtime.evaluate", params, opts.sessionId, callOpts) - : await session.call("Runtime.evaluate", params, callOpts); - if (!r.success) return r; - const { result, exceptionDetails } = r.data; - if (exceptionDetails !== undefined) { - return err(cdpError("remote_error", exceptionDetails.text, "Runtime.evaluate")); - } - const value = result.value; - if (!check(value)) { - return err(cdpError("invalid_response", `unexpected evaluate shape (type: ${result.type}) for: ${expression.slice(0, 60)}`, "Runtime.evaluate")); - } - return ok(value); -}; -- cgit v1.2.3