@ricsam/r5d-browser 0.0.51 → 0.0.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,36 @@
1
+ import type { BrowserContext } from "playwright-core";
2
+ export type BrowserAction = "list_tabs" | "list_downloads" | "get_download" | "open_tab" | "close_tab" | "navigate" | "screenshot" | "move_mouse" | "mouse_click" | "keyboard" | "keyboard_type" | "run_js";
3
+ export type TabInfo = {
4
+ tabId: string;
5
+ windowId: string;
6
+ title: string;
7
+ url: string;
8
+ };
9
+ export type DownloadInfo = {
10
+ downloadId: string;
11
+ filename: string;
12
+ size: number;
13
+ modifiedAt: string;
14
+ };
15
+ export declare class BrowserRuntime {
16
+ private readonly context;
17
+ private readonly downloadsPath;
18
+ private readonly ids;
19
+ private readonly pages;
20
+ private readonly cursor;
21
+ private downloadSaveQueue;
22
+ constructor(context: BrowserContext, downloadsPath: string);
23
+ private track;
24
+ private safeDownloadFilename;
25
+ private availableDownloadPath;
26
+ private persistDownload;
27
+ private downloadId;
28
+ private resolveDownload;
29
+ private listDownloads;
30
+ private getDownloadChunk;
31
+ private page;
32
+ private tabInfo;
33
+ listTabs(): Promise<TabInfo[]>;
34
+ drainDownloads(): Promise<void>;
35
+ execute(action: BrowserAction, input: Record<string, unknown>): Promise<unknown>;
36
+ }
@@ -0,0 +1,53 @@
1
+ import { type Browser, type BrowserContext } from "playwright-core";
2
+ export type ChromeExit = {
3
+ code: number | null;
4
+ signal: NodeJS.Signals | null;
5
+ };
6
+ export type LaunchStableChromeOptions = {
7
+ chromePath?: string;
8
+ profilePath: string;
9
+ playwrightDownloadsPath: string;
10
+ lockPath?: string;
11
+ startupTimeoutMs?: number;
12
+ };
13
+ export type StableChromeSession = {
14
+ browser: Browser;
15
+ context: BrowserContext;
16
+ chromeVersion: string;
17
+ chromePid: number;
18
+ debuggingPort: number;
19
+ profilePath: string;
20
+ exited: Promise<ChromeExit>;
21
+ disconnected: Promise<void>;
22
+ close(): Promise<void>;
23
+ };
24
+ export type ChromeRunLock = {
25
+ lockPath: string;
26
+ token: string;
27
+ release(): void;
28
+ };
29
+ export declare function defaultChromeProfilePath(homeDirectory?: string): string;
30
+ export declare function defaultChromeLockPath(homeDirectory?: string): string;
31
+ export declare function resolveChromeExecutable(options?: {
32
+ chromePath?: string;
33
+ env?: NodeJS.ProcessEnv;
34
+ homeDirectory?: string;
35
+ systemChromePath?: string;
36
+ }): string;
37
+ export declare function validateChromeProfilePath(profilePath: string, homeDirectory?: string): string;
38
+ export declare function acquireChromeRunLock(lockPath: string, profilePath: string, ownerPid?: number): ChromeRunLock;
39
+ export declare function assertChromeProfileAvailable(profilePath: string): void;
40
+ export declare function buildChromeLaunchArgs(profilePath: string, debuggingPort: number): string[];
41
+ export declare function validateDebuggerWebSocketUrl(webSocketDebuggerUrl: string, debuggingPort: number): string;
42
+ export declare function validateEndpointOwnership(params: {
43
+ chromePid: number;
44
+ chromePath: string;
45
+ launchArgs: string[];
46
+ processInfo: Array<{
47
+ type?: unknown;
48
+ id?: unknown;
49
+ }> | undefined;
50
+ product: unknown;
51
+ commandLine: unknown;
52
+ }): string;
53
+ export declare function launchStableChrome(options: LaunchStableChromeOptions): Promise<StableChromeSession>;
@@ -0,0 +1,16 @@
1
+ export type BrowserCliOptions = {
2
+ baseUrl?: string;
3
+ token?: string;
4
+ apiKey?: string;
5
+ configPath: string;
6
+ profilePath?: string;
7
+ chromePath?: string;
8
+ help: boolean;
9
+ version: boolean;
10
+ };
11
+ export type BrowserCommand = "start" | "help" | "version";
12
+ export declare function defaultConfigPath(): string;
13
+ export declare function parseBrowserArgs(argv: string[]): {
14
+ command: BrowserCommand;
15
+ options: BrowserCliOptions;
16
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-browser",
3
- "version": "0.0.51",
3
+ "version": "0.0.53",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/main.cjs",
6
6
  "module": "./dist/mjs/main.mjs",
@@ -21,7 +21,7 @@
21
21
  "r5d-browser": "dist/cjs/main.cjs"
22
22
  },
23
23
  "dependencies": {
24
- "playwright": "1.62.1",
24
+ "playwright-core": "1.62.1",
25
25
  "ws": "^8.18.3"
26
26
  },
27
27
  "files": [
@@ -1,49 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var playwright_install_exports = {};
30
- __export(playwright_install_exports, {
31
- resolvePlaywrightCliPath: () => resolvePlaywrightCliPath
32
- });
33
- module.exports = __toCommonJS(playwright_install_exports);
34
- var import_node_fs = __toESM(require("node:fs"), 1);
35
- var import_node_path = __toESM(require("node:path"), 1);
36
- var import_node_module = require("node:module");
37
- function resolvePlaywrightCliPath(fromPath = process.argv[1] ?? import_node_path.default.join(process.cwd(), "package.json")) {
38
- const require2 = (0, import_node_module.createRequire)(fromPath);
39
- const packageJsonPath = require2.resolve("playwright/package.json");
40
- const cliPath = import_node_path.default.join(import_node_path.default.dirname(packageJsonPath), "cli.js");
41
- if (!import_node_fs.default.existsSync(cliPath)) {
42
- throw new Error(`The Playwright CLI was not found next to ${packageJsonPath}. Reinstall @ricsam/r5d-browser.`);
43
- }
44
- return cliPath;
45
- }
46
- // Annotate the CommonJS export names for ESM import in node:
47
- 0 && (module.exports = {
48
- resolvePlaywrightCliPath
49
- });
@@ -1,15 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import { createRequire } from "node:module";
4
- function resolvePlaywrightCliPath(fromPath = process.argv[1] ?? path.join(process.cwd(), "package.json")) {
5
- const require2 = createRequire(fromPath);
6
- const packageJsonPath = require2.resolve("playwright/package.json");
7
- const cliPath = path.join(path.dirname(packageJsonPath), "cli.js");
8
- if (!fs.existsSync(cliPath)) {
9
- throw new Error(`The Playwright CLI was not found next to ${packageJsonPath}. Reinstall @ricsam/r5d-browser.`);
10
- }
11
- return cliPath;
12
- }
13
- export {
14
- resolvePlaywrightCliPath
15
- };
@@ -1 +0,0 @@
1
- export declare function resolvePlaywrightCliPath(fromPath?: string): string;