@ulpi/browse 2.3.3 → 2.4.0
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.
- package/README.md +8 -2
- package/dist/browse.cjs +3445 -1636
- package/dist/lib.mjs +29504 -0
- package/dist/types/a11y.d.ts +32 -0
- package/dist/types/a11y.d.ts.map +1 -0
- package/dist/types/app/android/bridge.d.ts +41 -0
- package/dist/types/app/android/bridge.d.ts.map +1 -0
- package/dist/types/app/android/emulator.d.ts +32 -0
- package/dist/types/app/android/emulator.d.ts.map +1 -0
- package/dist/types/app/android/manager.d.ts +62 -0
- package/dist/types/app/android/manager.d.ts.map +1 -0
- package/dist/types/app/android/protocol.d.ts +162 -0
- package/dist/types/app/android/protocol.d.ts.map +1 -0
- package/dist/types/app/android/sim-service.d.ts +33 -0
- package/dist/types/app/android/sim-service.d.ts.map +1 -0
- package/dist/types/app/index.d.ts +15 -0
- package/dist/types/app/index.d.ts.map +1 -0
- package/dist/types/app/ios/bridge.d.ts +53 -0
- package/dist/types/app/ios/bridge.d.ts.map +1 -0
- package/dist/types/app/ios/controller.d.ts +131 -0
- package/dist/types/app/ios/controller.d.ts.map +1 -0
- package/dist/types/app/ios/manager.d.ts +96 -0
- package/dist/types/app/ios/manager.d.ts.map +1 -0
- package/dist/types/app/ios/protocol.d.ts +122 -0
- package/dist/types/app/ios/protocol.d.ts.map +1 -0
- package/dist/types/app/ios/sim-service.d.ts +37 -0
- package/dist/types/app/ios/sim-service.d.ts.map +1 -0
- package/dist/types/app/macos/bridge.d.ts +22 -0
- package/dist/types/app/macos/bridge.d.ts.map +1 -0
- package/dist/types/app/manager.d.ts +50 -0
- package/dist/types/app/manager.d.ts.map +1 -0
- package/dist/types/app/normalize.d.ts +27 -0
- package/dist/types/app/normalize.d.ts.map +1 -0
- package/dist/types/app/resolve-app.d.ts +31 -0
- package/dist/types/app/resolve-app.d.ts.map +1 -0
- package/dist/types/app/types.d.ts +77 -0
- package/dist/types/app/types.d.ts.map +1 -0
- package/dist/types/automation/action-context.d.ts +110 -0
- package/dist/types/automation/action-context.d.ts.map +1 -0
- package/dist/types/automation/command.d.ts +138 -0
- package/dist/types/automation/command.d.ts.map +1 -0
- package/dist/types/automation/events.d.ts +72 -0
- package/dist/types/automation/events.d.ts.map +1 -0
- package/dist/types/automation/executor.d.ts +39 -0
- package/dist/types/automation/executor.d.ts.map +1 -0
- package/dist/types/automation/index.d.ts +11 -0
- package/dist/types/automation/index.d.ts.map +1 -0
- package/dist/types/automation/registry.d.ts +38 -0
- package/dist/types/automation/registry.d.ts.map +1 -0
- package/dist/types/automation/rules.d.ts +52 -0
- package/dist/types/automation/rules.d.ts.map +1 -0
- package/dist/types/automation/target.d.ts +76 -0
- package/dist/types/automation/target.d.ts.map +1 -0
- package/dist/types/browser/consent.d.ts +13 -0
- package/dist/types/browser/consent.d.ts.map +1 -0
- package/dist/types/browser/cookie-import.d.ts +94 -0
- package/dist/types/browser/cookie-import.d.ts.map +1 -0
- package/dist/types/browser/detection.d.ts +22 -0
- package/dist/types/browser/detection.d.ts.map +1 -0
- package/dist/types/browser/emulation.d.ts +30 -0
- package/dist/types/browser/emulation.d.ts.map +1 -0
- package/dist/types/browser/events.d.ts +19 -0
- package/dist/types/browser/events.d.ts.map +1 -0
- package/dist/types/browser/index.d.ts +17 -0
- package/dist/types/browser/index.d.ts.map +1 -0
- package/dist/types/browser/macros.d.ts +9 -0
- package/dist/types/browser/macros.d.ts.map +1 -0
- package/dist/types/browser/manager.d.ts +272 -0
- package/dist/types/browser/manager.d.ts.map +1 -0
- package/dist/types/browser/png-compare.d.ts +36 -0
- package/dist/types/browser/png-compare.d.ts.map +1 -0
- package/dist/types/browser/profiles.d.ts +29 -0
- package/dist/types/browser/profiles.d.ts.map +1 -0
- package/dist/types/browser/react-devtools.d.ts +75 -0
- package/dist/types/browser/react-devtools.d.ts.map +1 -0
- package/dist/types/browser/readiness.d.ts +19 -0
- package/dist/types/browser/readiness.d.ts.map +1 -0
- package/dist/types/browser/refs.d.ts +70 -0
- package/dist/types/browser/refs.d.ts.map +1 -0
- package/dist/types/browser/serp.d.ts +16 -0
- package/dist/types/browser/serp.d.ts.map +1 -0
- package/dist/types/browser/snapshot-window.d.ts +31 -0
- package/dist/types/browser/snapshot-window.d.ts.map +1 -0
- package/dist/types/browser/snapshot.d.ts +41 -0
- package/dist/types/browser/snapshot.d.ts.map +1 -0
- package/dist/types/browser/tabs.d.ts +67 -0
- package/dist/types/browser/tabs.d.ts.map +1 -0
- package/dist/types/browser/target.d.ts +106 -0
- package/dist/types/browser/target.d.ts.map +1 -0
- package/dist/types/browser/youtube.d.ts +26 -0
- package/dist/types/browser/youtube.d.ts.map +1 -0
- package/dist/types/cli.d.ts +14 -0
- package/dist/types/cli.d.ts.map +1 -0
- package/dist/types/cloud/auth.d.ts +80 -0
- package/dist/types/cloud/auth.d.ts.map +1 -0
- package/dist/types/cloud/docker.d.ts +76 -0
- package/dist/types/cloud/docker.d.ts.map +1 -0
- package/dist/types/cloud/firecracker.d.ts +142 -0
- package/dist/types/cloud/firecracker.d.ts.map +1 -0
- package/dist/types/cloud/golden-snapshot.d.ts +122 -0
- package/dist/types/cloud/golden-snapshot.d.ts.map +1 -0
- package/dist/types/cloud/index.d.ts +26 -0
- package/dist/types/cloud/index.d.ts.map +1 -0
- package/dist/types/cloud/orchestrator-interface.d.ts +63 -0
- package/dist/types/cloud/orchestrator-interface.d.ts.map +1 -0
- package/dist/types/cloud/orchestrator.d.ts +58 -0
- package/dist/types/cloud/orchestrator.d.ts.map +1 -0
- package/dist/types/cloud/proxy.d.ts +34 -0
- package/dist/types/cloud/proxy.d.ts.map +1 -0
- package/dist/types/cloud/reaper.d.ts +49 -0
- package/dist/types/cloud/reaper.d.ts.map +1 -0
- package/dist/types/cloud/server.d.ts +19 -0
- package/dist/types/cloud/server.d.ts.map +1 -0
- package/dist/types/cloud/sessions.d.ts +85 -0
- package/dist/types/cloud/sessions.d.ts.map +1 -0
- package/dist/types/cloud/vm-orchestrator.d.ts +133 -0
- package/dist/types/cloud/vm-orchestrator.d.ts.map +1 -0
- package/dist/types/cloud/vm-warm-pool.d.ts +104 -0
- package/dist/types/cloud/vm-warm-pool.d.ts.map +1 -0
- package/dist/types/cloud/warm-pool.d.ts +85 -0
- package/dist/types/cloud/warm-pool.d.ts.map +1 -0
- package/dist/types/cloud/ws.d.ts +61 -0
- package/dist/types/cloud/ws.d.ts.map +1 -0
- package/dist/types/commands/meta/auth.d.ts +6 -0
- package/dist/types/commands/meta/auth.d.ts.map +1 -0
- package/dist/types/commands/meta/flows.d.ts +15 -0
- package/dist/types/commands/meta/flows.d.ts.map +1 -0
- package/dist/types/commands/meta/index.d.ts +14 -0
- package/dist/types/commands/meta/index.d.ts.map +1 -0
- package/dist/types/commands/meta/inspection.d.ts +7 -0
- package/dist/types/commands/meta/inspection.d.ts.map +1 -0
- package/dist/types/commands/meta/profile.d.ts +11 -0
- package/dist/types/commands/meta/profile.d.ts.map +1 -0
- package/dist/types/commands/meta/recording.d.ts +7 -0
- package/dist/types/commands/meta/recording.d.ts.map +1 -0
- package/dist/types/commands/meta/screenshots.d.ts +7 -0
- package/dist/types/commands/meta/screenshots.d.ts.map +1 -0
- package/dist/types/commands/meta/sessions.d.ts +7 -0
- package/dist/types/commands/meta/sessions.d.ts.map +1 -0
- package/dist/types/commands/meta/sim.d.ts +10 -0
- package/dist/types/commands/meta/sim.d.ts.map +1 -0
- package/dist/types/commands/meta/system.d.ts +8 -0
- package/dist/types/commands/meta/system.d.ts.map +1 -0
- package/dist/types/commands/meta/tabs.d.ts +6 -0
- package/dist/types/commands/meta/tabs.d.ts.map +1 -0
- package/dist/types/commands/meta/youtube.d.ts +7 -0
- package/dist/types/commands/meta/youtube.d.ts.map +1 -0
- package/dist/types/commands/read.d.ts +16 -0
- package/dist/types/commands/read.d.ts.map +1 -0
- package/dist/types/commands/write.d.ts +17 -0
- package/dist/types/commands/write.d.ts.map +1 -0
- package/dist/types/config.d.ts +101 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/constants.d.ts +36 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/detection/frameworks.d.ts +27 -0
- package/dist/types/detection/frameworks.d.ts.map +1 -0
- package/dist/types/detection/index.d.ts +64 -0
- package/dist/types/detection/index.d.ts.map +1 -0
- package/dist/types/detection/infrastructure.d.ts +82 -0
- package/dist/types/detection/infrastructure.d.ts.map +1 -0
- package/dist/types/detection/saas.d.ts +39 -0
- package/dist/types/detection/saas.d.ts.map +1 -0
- package/dist/types/enable.d.ts +10 -0
- package/dist/types/enable.d.ts.map +1 -0
- package/dist/types/engine/chrome.d.ts +45 -0
- package/dist/types/engine/chrome.d.ts.map +1 -0
- package/dist/types/engine/index.d.ts +9 -0
- package/dist/types/engine/index.d.ts.map +1 -0
- package/dist/types/engine/providers.d.ts +36 -0
- package/dist/types/engine/providers.d.ts.map +1 -0
- package/dist/types/engine/resolver.d.ts +36 -0
- package/dist/types/engine/resolver.d.ts.map +1 -0
- package/dist/types/expect.d.ts +68 -0
- package/dist/types/expect.d.ts.map +1 -0
- package/dist/types/export/index.d.ts +8 -0
- package/dist/types/export/index.d.ts.map +1 -0
- package/dist/types/export/record.d.ts +28 -0
- package/dist/types/export/record.d.ts.map +1 -0
- package/dist/types/export/replay.d.ts +9 -0
- package/dist/types/export/replay.d.ts.map +1 -0
- package/dist/types/flow-parser.d.ts +32 -0
- package/dist/types/flow-parser.d.ts.map +1 -0
- package/dist/types/install-skill.d.ts +8 -0
- package/dist/types/install-skill.d.ts.map +1 -0
- package/dist/types/lib.d.ts +27 -0
- package/dist/types/lib.d.ts.map +1 -0
- package/dist/types/mcp/index.d.ts +10 -0
- package/dist/types/mcp/index.d.ts.map +1 -0
- package/dist/types/mcp/server.d.ts +9 -0
- package/dist/types/mcp/server.d.ts.map +1 -0
- package/dist/types/mcp/tools/index.d.ts +36 -0
- package/dist/types/mcp/tools/index.d.ts.map +1 -0
- package/dist/types/network/buffers.d.ts +53 -0
- package/dist/types/network/buffers.d.ts.map +1 -0
- package/dist/types/network/har.d.ts +10 -0
- package/dist/types/network/har.d.ts.map +1 -0
- package/dist/types/network/index.d.ts +6 -0
- package/dist/types/network/index.d.ts.map +1 -0
- package/dist/types/perf-audit/diff.d.ts +43 -0
- package/dist/types/perf-audit/diff.d.ts.map +1 -0
- package/dist/types/perf-audit/dom-analysis.d.ts +74 -0
- package/dist/types/perf-audit/dom-analysis.d.ts.map +1 -0
- package/dist/types/perf-audit/formatter.d.ts +34 -0
- package/dist/types/perf-audit/formatter.d.ts.map +1 -0
- package/dist/types/perf-audit/index.d.ts +128 -0
- package/dist/types/perf-audit/index.d.ts.map +1 -0
- package/dist/types/perf-audit/persist.d.ts +40 -0
- package/dist/types/perf-audit/persist.d.ts.map +1 -0
- package/dist/types/perf-audit/recommendations.d.ts +18 -0
- package/dist/types/perf-audit/recommendations.d.ts.map +1 -0
- package/dist/types/perf-audit/resource-analyzer.d.ts +46 -0
- package/dist/types/perf-audit/resource-analyzer.d.ts.map +1 -0
- package/dist/types/perf-audit/web-vitals.d.ts +73 -0
- package/dist/types/perf-audit/web-vitals.d.ts.map +1 -0
- package/dist/types/proxy/index.d.ts +6 -0
- package/dist/types/proxy/index.d.ts.map +1 -0
- package/dist/types/proxy/pool.d.ts +44 -0
- package/dist/types/proxy/pool.d.ts.map +1 -0
- package/dist/types/proxy/providers.d.ts +32 -0
- package/dist/types/proxy/providers.d.ts.map +1 -0
- package/dist/types/sdk/client.d.ts +37 -0
- package/dist/types/sdk/client.d.ts.map +1 -0
- package/dist/types/sdk/index.d.ts +17 -0
- package/dist/types/sdk/index.d.ts.map +1 -0
- package/dist/types/sdk/session.d.ts +95 -0
- package/dist/types/sdk/session.d.ts.map +1 -0
- package/dist/types/sdk/transports/cloud.d.ts +89 -0
- package/dist/types/sdk/transports/cloud.d.ts.map +1 -0
- package/dist/types/sdk/transports/index.d.ts +3 -0
- package/dist/types/sdk/transports/index.d.ts.map +1 -0
- package/dist/types/sdk/transports/local.d.ts +56 -0
- package/dist/types/sdk/transports/local.d.ts.map +1 -0
- package/dist/types/sdk.d.ts +35 -0
- package/dist/types/sdk.d.ts.map +1 -0
- package/dist/types/security/auth-vault.d.ts +32 -0
- package/dist/types/security/auth-vault.d.ts.map +1 -0
- package/dist/types/security/domain-filter.d.ts +31 -0
- package/dist/types/security/domain-filter.d.ts.map +1 -0
- package/dist/types/security/index.d.ts +10 -0
- package/dist/types/security/index.d.ts.map +1 -0
- package/dist/types/security/policy.d.ts +20 -0
- package/dist/types/security/policy.d.ts.map +1 -0
- package/dist/types/security/sanitize.d.ts +6 -0
- package/dist/types/security/sanitize.d.ts.map +1 -0
- package/dist/types/server.d.ts +13 -0
- package/dist/types/server.d.ts.map +1 -0
- package/dist/types/session/concurrency.d.ts +28 -0
- package/dist/types/session/concurrency.d.ts.map +1 -0
- package/dist/types/session/encryption.d.ts +8 -0
- package/dist/types/session/encryption.d.ts.map +1 -0
- package/dist/types/session/index.d.ts +7 -0
- package/dist/types/session/index.d.ts.map +1 -0
- package/dist/types/session/manager.d.ts +110 -0
- package/dist/types/session/manager.d.ts.map +1 -0
- package/dist/types/session/persist.d.ts +87 -0
- package/dist/types/session/persist.d.ts.map +1 -0
- package/dist/types/session/tab-lock.d.ts +26 -0
- package/dist/types/session/tab-lock.d.ts.map +1 -0
- package/dist/types/session/target-factory.d.ts +88 -0
- package/dist/types/session/target-factory.d.ts.map +1 -0
- package/dist/types/sim-cli.d.ts +8 -0
- package/dist/types/sim-cli.d.ts.map +1 -0
- package/dist/types/types.d.ts +45 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/visual.d.ts +79 -0
- package/dist/types/visual.d.ts.map +1 -0
- package/package.json +22 -3
- package/skill/browse/SKILL.md +286 -0
- package/skill/{references → browse/references}/commands.md +203 -18
- package/skill/browse-aeo/SKILL.md +148 -0
- package/skill/browse-config/SKILL.md +200 -0
- package/skill/browse-geo/SKILL.md +225 -0
- package/skill/browse-qa/SKILL.md +143 -0
- package/skill/browse-seo/SKILL.md +188 -0
- package/skill/browse-stealth/SKILL.md +246 -0
- package/skill/SKILL.md +0 -496
- /package/skill/{references → browse/references}/guides.md +0 -0
- /package/skill/{references → browse/references}/permissions.md +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser event wiring helpers.
|
|
3
|
+
*
|
|
4
|
+
* The wirePageEvents() method that wires console, network, dialog, and ref-
|
|
5
|
+
* invalidation events cannot be extracted as a standalone function because it
|
|
6
|
+
* closes over many BrowserManager private fields:
|
|
7
|
+
* - buffers (SessionBuffers) — console/network ring buffers
|
|
8
|
+
* - lastDialog / autoDialogAction / dialogPromptValue — dialog state
|
|
9
|
+
* - requestEntryMap (WeakMap) — request → NetworkEntry correlation
|
|
10
|
+
* - refTabId / refMap / clearRefs() — ref scoping + invalidation
|
|
11
|
+
* - getTabIdForPage() — reverse tab lookup
|
|
12
|
+
*
|
|
13
|
+
* TODO: When BrowserManager is decomposed into smaller collaborating objects
|
|
14
|
+
* (e.g. a DialogManager, a NetworkRecorder, a RefRegistry), move the
|
|
15
|
+
* corresponding event handlers here.
|
|
16
|
+
*
|
|
17
|
+
* For now this module serves as the documentation anchor for that future work.
|
|
18
|
+
*/
|
|
19
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/browser/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { BrowserManager, type CoverageEntry, } from './manager';
|
|
2
|
+
export type { BrowserTarget } from './target';
|
|
3
|
+
export { resolveDevice, listDevices, DEVICE_ALIASES, CUSTOM_DEVICES, type DeviceDescriptor, } from './emulation';
|
|
4
|
+
export { getProfileDir, listProfiles, deleteProfile, } from './profiles';
|
|
5
|
+
export { TabManager, type TabEntry } from './tabs';
|
|
6
|
+
export { RefManager } from './refs';
|
|
7
|
+
export { handleSnapshot, parseSnapshotArgs, type SnapshotOptions, } from './snapshot';
|
|
8
|
+
export { expandMacro, listMacros } from './macros';
|
|
9
|
+
export { ensureHook, injectHook, removeHook, isEnabled, requireEnabled, requireReact, getTree, getProps, getSuspense, getErrors, getProfiler, getHydration, getRenders, getOwners, getContext, } from './react-devtools';
|
|
10
|
+
export { isGoogleSearchUrl, isGoogleBlocked, formatGoogleBlockError } from './detection';
|
|
11
|
+
export { dismissConsentDialog } from './consent';
|
|
12
|
+
export { waitForPageReady, type ReadinessOptions } from './readiness';
|
|
13
|
+
export { applySnapshotWindow, formatWindowMetadata, type WindowResult } from './snapshot-window';
|
|
14
|
+
export { isGoogleSerp, extractGoogleSerp } from './serp';
|
|
15
|
+
export { parseNetscapeCookieFile } from './cookie-import';
|
|
16
|
+
export { detectYtDlp, hasYtDlp, extractVideoId, ytDlpTranscript, parseJson3, parseVtt, parseXml, } from './youtube';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,KAAK,aAAa,GACnB,MAAM,WAAW,CAAC;AAEnB,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,EACL,aAAa,EACb,WAAW,EACX,cAAc,EACd,cAAc,EACd,KAAK,gBAAgB,GACtB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,aAAa,EACb,YAAY,EACZ,aAAa,GACd,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,UAAU,EAAE,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,KAAK,eAAe,GACrB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEnD,OAAO,EACL,UAAU,EACV,UAAU,EACV,UAAU,EACV,SAAS,EACT,cAAc,EACd,YAAY,EACZ,OAAO,EACP,QAAQ,EACR,WAAW,EACX,SAAS,EACT,WAAW,EACX,YAAY,EACZ,UAAU,EACV,SAAS,EACT,UAAU,GACX,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAEzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEtE,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjG,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAEzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EACL,WAAW,EACX,QAAQ,EACR,cAAc,EACd,eAAe,EACf,UAAU,EACV,QAAQ,EACR,QAAQ,GACT,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search macros — expand @macro_name + query into search URLs.
|
|
3
|
+
* Runtime-agnostic. Used by goto handler to support `browse goto @google "query"`.
|
|
4
|
+
*/
|
|
5
|
+
/** Expand a macro URL. Returns the expanded URL or null if not a macro. */
|
|
6
|
+
export declare function expandMacro(url: string): string | null;
|
|
7
|
+
/** List all supported macro names. */
|
|
8
|
+
export declare function listMacros(): string[];
|
|
9
|
+
//# sourceMappingURL=macros.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"macros.d.ts","sourceRoot":"","sources":["../../../src/browser/macros.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmBH,2EAA2E;AAC3E,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAWtD;AAED,sCAAsC;AACtC,wBAAgB,UAAU,IAAI,MAAM,EAAE,CAErC"}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser lifecycle manager
|
|
3
|
+
*
|
|
4
|
+
* Chromium crash handling:
|
|
5
|
+
* browser.on('disconnected') → log error → process.exit(1)
|
|
6
|
+
* CLI detects dead server → auto-restarts on next command
|
|
7
|
+
* We do NOT try to self-heal — don't hide failure.
|
|
8
|
+
*/
|
|
9
|
+
import { type Browser, type BrowserContext, type BrowserType, type Page, type Locator, type Frame, type FrameLocator } from 'playwright';
|
|
10
|
+
import { SessionBuffers } from '../network/buffers';
|
|
11
|
+
import type { HarRecording } from '../network/har';
|
|
12
|
+
import type { DomainFilter } from '../security/domain-filter';
|
|
13
|
+
import type { TargetCapabilities } from '../automation/target';
|
|
14
|
+
import type { BrowserTarget } from './target';
|
|
15
|
+
import { resolveDevice, listDevices, type DeviceDescriptor } from './emulation';
|
|
16
|
+
import { getProfileDir, listProfiles, deleteProfile } from './profiles';
|
|
17
|
+
export type { DeviceDescriptor };
|
|
18
|
+
export { resolveDevice, listDevices, getProfileDir, listProfiles, deleteProfile };
|
|
19
|
+
export interface CoverageEntry {
|
|
20
|
+
url: string;
|
|
21
|
+
totalBytes: number;
|
|
22
|
+
usedBytes: number;
|
|
23
|
+
unusedBytes: number;
|
|
24
|
+
unusedPct: number;
|
|
25
|
+
}
|
|
26
|
+
export declare class BrowserManager implements BrowserTarget {
|
|
27
|
+
readonly targetType = "browser";
|
|
28
|
+
private browser;
|
|
29
|
+
private context;
|
|
30
|
+
private extraHeaders;
|
|
31
|
+
private customUserAgent;
|
|
32
|
+
private currentDevice;
|
|
33
|
+
private tabs;
|
|
34
|
+
private refs;
|
|
35
|
+
private activeFramePerTab;
|
|
36
|
+
private buffers;
|
|
37
|
+
private lastDialog;
|
|
38
|
+
private autoDialogAction;
|
|
39
|
+
private dialogPromptValue;
|
|
40
|
+
private requestEntryMap;
|
|
41
|
+
private offline;
|
|
42
|
+
private harRecording;
|
|
43
|
+
private videoRecording;
|
|
44
|
+
private coverageActive;
|
|
45
|
+
private captureNetworkBodies;
|
|
46
|
+
/** Per-session byte budget for captured response bodies (default 5MB) */
|
|
47
|
+
private bodyBudgetBytes;
|
|
48
|
+
private bodyBudgetUsed;
|
|
49
|
+
/** Per-entry body size limit (default 256KB) */
|
|
50
|
+
private bodyLimitBytes;
|
|
51
|
+
private initScript;
|
|
52
|
+
private userRoutes;
|
|
53
|
+
private domainFilter;
|
|
54
|
+
private ownsBrowser;
|
|
55
|
+
private isPersistent;
|
|
56
|
+
private contextProxy;
|
|
57
|
+
private isHeaded;
|
|
58
|
+
private consecutiveFailures;
|
|
59
|
+
private onCrashCallback;
|
|
60
|
+
constructor(buffers?: SessionBuffers);
|
|
61
|
+
getBuffers(): SessionBuffers;
|
|
62
|
+
getBrowser(): Browser | null;
|
|
63
|
+
getContext(): BrowserContext | null;
|
|
64
|
+
/**
|
|
65
|
+
* Launch a new Chromium browser (single-session / multi-process mode).
|
|
66
|
+
* This instance owns the browser and will close it on close().
|
|
67
|
+
*/
|
|
68
|
+
launch(onCrash?: () => void): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Attach to an existing Browser instance (session multiplexing mode).
|
|
71
|
+
* Creates a new BrowserContext on the shared browser.
|
|
72
|
+
* This instance does NOT own the browser — close() only closes the context.
|
|
73
|
+
*/
|
|
74
|
+
launchWithBrowser(browser: Browser, reuseContext?: boolean, contextOptions?: {
|
|
75
|
+
proxy?: {
|
|
76
|
+
server: string;
|
|
77
|
+
username?: string;
|
|
78
|
+
password?: string;
|
|
79
|
+
};
|
|
80
|
+
}): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Launch with a persistent browser profile directory.
|
|
83
|
+
* Data (cookies, localStorage, cache) persists across restarts.
|
|
84
|
+
* The context IS the browser — closing it closes everything.
|
|
85
|
+
*/
|
|
86
|
+
launchPersistent(profileDir: string, onCrash?: () => void, browserType?: BrowserType, extraLaunchOptions?: Record<string, unknown>): Promise<void>;
|
|
87
|
+
close(): Promise<void>;
|
|
88
|
+
isHealthy(): boolean;
|
|
89
|
+
getCapabilities(): TargetCapabilities;
|
|
90
|
+
getCurrentLocation(): string;
|
|
91
|
+
isReady(): boolean;
|
|
92
|
+
getIsPersistent(): boolean;
|
|
93
|
+
private reactDevToolsEnabled;
|
|
94
|
+
getReactDevToolsEnabled(): boolean;
|
|
95
|
+
setReactDevToolsEnabled(enabled: boolean): void;
|
|
96
|
+
getIsHeaded(): boolean;
|
|
97
|
+
incrementFailures(): void;
|
|
98
|
+
resetFailures(): void;
|
|
99
|
+
getFailureHint(): string | null;
|
|
100
|
+
private saveState;
|
|
101
|
+
private applyContextOptions;
|
|
102
|
+
private restoreState;
|
|
103
|
+
private handoffCleanup;
|
|
104
|
+
handoff(message: string, useChromium?: boolean): Promise<string>;
|
|
105
|
+
resume(): Promise<string>;
|
|
106
|
+
newTab(url?: string): Promise<number>;
|
|
107
|
+
closeTab(id?: number): Promise<void>;
|
|
108
|
+
switchTab(id: number): void;
|
|
109
|
+
getActiveTabId(): number;
|
|
110
|
+
hasTab(id: number): boolean;
|
|
111
|
+
getTabCount(): number;
|
|
112
|
+
getTabList(): Array<{
|
|
113
|
+
id: number;
|
|
114
|
+
url: string;
|
|
115
|
+
title: string;
|
|
116
|
+
active: boolean;
|
|
117
|
+
}>;
|
|
118
|
+
getTabListWithTitles(): Promise<Array<{
|
|
119
|
+
id: number;
|
|
120
|
+
url: string;
|
|
121
|
+
title: string;
|
|
122
|
+
active: boolean;
|
|
123
|
+
}>>;
|
|
124
|
+
getPage(): Page;
|
|
125
|
+
getPageById(id: number): Page | undefined;
|
|
126
|
+
getCurrentUrl(): string;
|
|
127
|
+
/**
|
|
128
|
+
* Set the active frame by CSS selector (e.g., '#my-iframe', 'iframe[name="content"]').
|
|
129
|
+
* Subsequent commands that use resolveRef, getLocatorRoot, or getFrameContext
|
|
130
|
+
* will target this frame's content instead of the main page.
|
|
131
|
+
*/
|
|
132
|
+
setFrame(selector: string): void;
|
|
133
|
+
/**
|
|
134
|
+
* Reset to main frame — clears the active frame selector for the current tab.
|
|
135
|
+
*/
|
|
136
|
+
resetFrame(): void;
|
|
137
|
+
/**
|
|
138
|
+
* Get the current active frame selector, or null if targeting main page.
|
|
139
|
+
*/
|
|
140
|
+
getActiveFrameSelector(): string | null;
|
|
141
|
+
/**
|
|
142
|
+
* Get a FrameLocator for the active frame.
|
|
143
|
+
* Returns null if no frame is active (targeting main page).
|
|
144
|
+
*/
|
|
145
|
+
getFrameLocator(): FrameLocator | null;
|
|
146
|
+
/**
|
|
147
|
+
* Get the Frame object for the active frame (needed for evaluate() calls).
|
|
148
|
+
* Returns null if no frame is active.
|
|
149
|
+
* Unlike FrameLocator, Frame supports evaluate(), querySelector, etc.
|
|
150
|
+
*/
|
|
151
|
+
getFrameContext(): Promise<Frame | null>;
|
|
152
|
+
/**
|
|
153
|
+
* Get a locator root scoped to the active frame (if any) or the page.
|
|
154
|
+
* Use this to create locators that respect the current frame context.
|
|
155
|
+
* Example: bm.getLocatorRoot().locator('button.submit')
|
|
156
|
+
*/
|
|
157
|
+
getLocatorRoot(): Page | FrameLocator;
|
|
158
|
+
setRefMap(refs: Map<string, Locator>): void;
|
|
159
|
+
clearRefs(): void;
|
|
160
|
+
/**
|
|
161
|
+
* Resolve a selector that may be a @ref (e.g., "@e3") or a CSS selector.
|
|
162
|
+
* Returns { locator } for refs or { selector } for CSS selectors.
|
|
163
|
+
*
|
|
164
|
+
* When a frame is active and a CSS selector is passed, returns { locator }
|
|
165
|
+
* scoped to the frame instead of { selector }, so callers automatically
|
|
166
|
+
* interact with elements inside the iframe.
|
|
167
|
+
*/
|
|
168
|
+
resolveRef(selector: string): {
|
|
169
|
+
locator: Locator;
|
|
170
|
+
} | {
|
|
171
|
+
selector: string;
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Resolve a ref with staleness detection. Throws immediately if the ref's
|
|
175
|
+
* element no longer exists in the DOM, instead of waiting for action timeout.
|
|
176
|
+
*/
|
|
177
|
+
resolveRefChecked(selector: string): Promise<{
|
|
178
|
+
locator: Locator;
|
|
179
|
+
} | {
|
|
180
|
+
selector: string;
|
|
181
|
+
}>;
|
|
182
|
+
getRefCount(): number;
|
|
183
|
+
getRefMap(): Map<string, Locator>;
|
|
184
|
+
/**
|
|
185
|
+
* Check if refs are valid for the currently active tab.
|
|
186
|
+
* Used by screenshot --annotate to avoid cross-tab ref leaks.
|
|
187
|
+
*/
|
|
188
|
+
areRefsValidForActiveTab(): boolean;
|
|
189
|
+
setLastSnapshot(text: string, opts?: string[]): void;
|
|
190
|
+
getLastSnapshot(): string | null;
|
|
191
|
+
getLastSnapshotOpts(): string[];
|
|
192
|
+
getLastDialog(): {
|
|
193
|
+
type: string;
|
|
194
|
+
message: string;
|
|
195
|
+
defaultValue?: string;
|
|
196
|
+
} | null;
|
|
197
|
+
setAutoDialogAction(action: 'accept' | 'dismiss', promptValue?: string): void;
|
|
198
|
+
getAutoDialogAction(): 'accept' | 'dismiss';
|
|
199
|
+
setViewport(width: number, height: number): Promise<void>;
|
|
200
|
+
setExtraHeader(name: string, value: string): Promise<void>;
|
|
201
|
+
setUserAgent(ua: string): void;
|
|
202
|
+
getUserAgent(): string | null;
|
|
203
|
+
/**
|
|
204
|
+
* Recreate the browser context with new options.
|
|
205
|
+
* Playwright requires a new context to change UA/device — existing pages are closed.
|
|
206
|
+
*
|
|
207
|
+
* Preserves: cookies, all tab URLs (not just active), active tab selection.
|
|
208
|
+
* Cannot preserve: localStorage/sessionStorage (bound to old context).
|
|
209
|
+
*/
|
|
210
|
+
private recreateContext;
|
|
211
|
+
applyUserAgent(): Promise<void>;
|
|
212
|
+
/**
|
|
213
|
+
* Emulate a device — recreates context with full device settings.
|
|
214
|
+
* Pass null to reset to desktop defaults.
|
|
215
|
+
*/
|
|
216
|
+
emulateDevice(device: DeviceDescriptor | null): Promise<void>;
|
|
217
|
+
getCurrentDevice(): DeviceDescriptor | null;
|
|
218
|
+
isOffline(): boolean;
|
|
219
|
+
setOffline(value: boolean): Promise<void>;
|
|
220
|
+
startHarRecording(): void;
|
|
221
|
+
stopHarRecording(): HarRecording | null;
|
|
222
|
+
getHarRecording(): HarRecording | null;
|
|
223
|
+
startVideoRecording(dir: string): Promise<void>;
|
|
224
|
+
stopVideoRecording(): Promise<{
|
|
225
|
+
dir: string;
|
|
226
|
+
startedAt: number;
|
|
227
|
+
paths: string[];
|
|
228
|
+
} | null>;
|
|
229
|
+
getVideoRecording(): {
|
|
230
|
+
dir: string;
|
|
231
|
+
startedAt: number;
|
|
232
|
+
} | null;
|
|
233
|
+
startCoverage(): Promise<void>;
|
|
234
|
+
stopCoverage(): Promise<{
|
|
235
|
+
js: CoverageEntry[];
|
|
236
|
+
css: CoverageEntry[];
|
|
237
|
+
}>;
|
|
238
|
+
isCoverageActive(): boolean;
|
|
239
|
+
private processJSCoverage;
|
|
240
|
+
private processCSSCoverage;
|
|
241
|
+
setInitScript(script: string): void;
|
|
242
|
+
getInitScript(): string | null;
|
|
243
|
+
addUserRoute(pattern: string, action: 'block' | 'fulfill', status?: number, body?: string): void;
|
|
244
|
+
clearUserRoutes(): void;
|
|
245
|
+
getUserRoutes(): {
|
|
246
|
+
pattern: string;
|
|
247
|
+
action: "block" | "fulfill";
|
|
248
|
+
status?: number;
|
|
249
|
+
body?: string;
|
|
250
|
+
}[];
|
|
251
|
+
setDomainFilter(filter: DomainFilter): void;
|
|
252
|
+
getDomainFilter(): DomainFilter | null;
|
|
253
|
+
setCaptureNetworkBodies(enabled: boolean): void;
|
|
254
|
+
getCaptureNetworkBodies(): boolean;
|
|
255
|
+
/**
|
|
256
|
+
* Returns the milliseconds since the last observed DOM mutation on the
|
|
257
|
+
* current page, or Infinity if no mutations have been seen since page load.
|
|
258
|
+
*
|
|
259
|
+
* Reads `window.__browseMutationAge` which is kept up-to-date by the
|
|
260
|
+
* MutationObserver injected via MUTATION_OBSERVER_SCRIPT.
|
|
261
|
+
*/
|
|
262
|
+
getLastMutationAge(): Promise<number>;
|
|
263
|
+
/**
|
|
264
|
+
* Reverse-lookup: find the tab ID that owns this page.
|
|
265
|
+
* Returns undefined if the page isn't committed to any tab yet (during newTab).
|
|
266
|
+
*/
|
|
267
|
+
private getTabIdForPage;
|
|
268
|
+
/** Evict oldest captured response bodies to stay within the per-session byte budget */
|
|
269
|
+
private evictOldestBodies;
|
|
270
|
+
private wirePageEvents;
|
|
271
|
+
}
|
|
272
|
+
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/browser/manager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAY,KAAK,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,KAAK,IAAI,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,YAAY,EAAqC,MAAM,YAAY,CAAC;AACtL,OAAO,EAAE,cAAc,EAAqB,MAAM,oBAAoB,CAAC;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C,OAAO,EACL,aAAa,EACb,WAAW,EACX,KAAK,gBAAgB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAqDxE,YAAY,EAAE,gBAAgB,EAAE,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAA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G;IACH,OAAO,CAAC,eAAe;IAKvB,uFAAuF;IACvF,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,cAAc;CAyHvB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-contained PNG decoder, encoder + pixel comparator.
|
|
3
|
+
* No external deps — uses only zlib (Node/Bun built-in).
|
|
4
|
+
* Works in both dev mode (bun run) and compiled binary ($bunfs).
|
|
5
|
+
*
|
|
6
|
+
* Decoder supports: 8-bit RGB (color type 2) and RGBA (color type 6).
|
|
7
|
+
* Handles all 5 PNG scanline filter types (None/Sub/Up/Average/Paeth).
|
|
8
|
+
* Encoder outputs: 8-bit RGBA (color type 6), filter None, zlib-compressed.
|
|
9
|
+
*/
|
|
10
|
+
export interface DecodedImage {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
data: Buffer;
|
|
14
|
+
}
|
|
15
|
+
export interface CompareResult {
|
|
16
|
+
totalPixels: number;
|
|
17
|
+
diffPixels: number;
|
|
18
|
+
mismatchPct: number;
|
|
19
|
+
passed: boolean;
|
|
20
|
+
diffImage?: Buffer;
|
|
21
|
+
}
|
|
22
|
+
export declare function decodePNG(buf: Buffer): DecodedImage;
|
|
23
|
+
/**
|
|
24
|
+
* Encode a DecodedImage (RGBA pixels) into a PNG buffer.
|
|
25
|
+
* Uses filter type None (0) for simplicity — zlib handles compression.
|
|
26
|
+
*/
|
|
27
|
+
export declare function encodePNG(img: DecodedImage): Buffer;
|
|
28
|
+
/**
|
|
29
|
+
* Generate a visual diff image highlighting pixel differences.
|
|
30
|
+
* - Pixels only in one image (size mismatch): bright red (255,0,0,255)
|
|
31
|
+
* - Pixels differing beyond threshold: red-tinted (255, g/3, b/3, 255)
|
|
32
|
+
* - Pixels matching: dimmed (r/3, g/3, b/3, 128)
|
|
33
|
+
*/
|
|
34
|
+
export declare function generateDiffImage(base: DecodedImage, curr: DecodedImage, colorThreshold: number): Buffer;
|
|
35
|
+
export declare function compareScreenshots(baselineBuf: Buffer, currentBuf: Buffer, thresholdPct?: number, colorThreshold?: number): CompareResult;
|
|
36
|
+
//# sourceMappingURL=png-compare.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"png-compare.d.ts","sourceRoot":"","sources":["../../../src/browser/png-compare.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAsEnD;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CA6CnD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CA8CxG;AAED,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,YAAY,GAAE,MAAY,EAC1B,cAAc,GAAE,MAAW,GAC1B,aAAa,CAoCf"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Profile lifecycle helpers — standalone functions for managing persistent
|
|
3
|
+
* browser profile directories.
|
|
4
|
+
*
|
|
5
|
+
* The BrowserManager.launchPersistent() method and getIsPersistent() remain
|
|
6
|
+
* in manager.ts because they depend on private BrowserManager state
|
|
7
|
+
* (context, browser, isPersistent, nextTabId, etc.).
|
|
8
|
+
*
|
|
9
|
+
* TODO: When BrowserManager is further decomposed, move launchPersistent /
|
|
10
|
+
* getIsPersistent here as well.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Get the profile directory path for a named profile.
|
|
14
|
+
* Profiles live in .browse/profiles/<name>/
|
|
15
|
+
*/
|
|
16
|
+
export declare function getProfileDir(localDir: string, name: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* List all profiles with metadata.
|
|
19
|
+
*/
|
|
20
|
+
export declare function listProfiles(localDir: string): Array<{
|
|
21
|
+
name: string;
|
|
22
|
+
size: string;
|
|
23
|
+
lastUsed: string;
|
|
24
|
+
}>;
|
|
25
|
+
/**
|
|
26
|
+
* Delete a profile directory.
|
|
27
|
+
*/
|
|
28
|
+
export declare function deleteProfile(localDir: string, name: string): void;
|
|
29
|
+
//# sourceMappingURL=profiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../../../src/browser/profiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAIpE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CA0BtG;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAIlE"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React DevTools integration — lazy download, hook injection, and fiber tree queries.
|
|
3
|
+
*
|
|
4
|
+
* Uses React DevTools' installHook.js to install __REACT_DEVTOOLS_GLOBAL_HOOK__
|
|
5
|
+
* before page JS runs. React auto-discovers the hook and registers renderers.
|
|
6
|
+
* All queries use page.evaluate() against the hook — no Chrome extension needed.
|
|
7
|
+
*/
|
|
8
|
+
import type { BrowserTarget } from './target';
|
|
9
|
+
import type { Page } from 'playwright';
|
|
10
|
+
/**
|
|
11
|
+
* Download installHook.js if not cached. Returns the script content.
|
|
12
|
+
*/
|
|
13
|
+
export declare function ensureHook(): Promise<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Inject the hook into the browser context via addInitScript.
|
|
16
|
+
* The hook runs before any page JS, so React discovers it on load.
|
|
17
|
+
*/
|
|
18
|
+
export declare function injectHook(bm: BrowserTarget): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Mark DevTools as disabled. Can't remove init scripts —
|
|
21
|
+
* takes effect on next context creation or page reload without the hook.
|
|
22
|
+
*/
|
|
23
|
+
export declare function removeHook(bm: BrowserTarget): void;
|
|
24
|
+
/**
|
|
25
|
+
* Check if React DevTools hook is currently injected.
|
|
26
|
+
*/
|
|
27
|
+
export declare function isEnabled(bm: BrowserTarget): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Helper: check that DevTools is enabled, throw actionable error if not.
|
|
30
|
+
*/
|
|
31
|
+
export declare function requireEnabled(bm: BrowserTarget): void;
|
|
32
|
+
/**
|
|
33
|
+
* Helper: check that React is detected on the page.
|
|
34
|
+
* Returns the renderer interface or throws.
|
|
35
|
+
*/
|
|
36
|
+
export declare function requireReact(page: Page): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Walk the fiber tree from root and return a formatted component tree.
|
|
39
|
+
*/
|
|
40
|
+
export declare function getTree(bm: BrowserTarget, page: Page): Promise<string>;
|
|
41
|
+
/**
|
|
42
|
+
* Get props and hook state of the React component that owns the given element.
|
|
43
|
+
*/
|
|
44
|
+
export declare function getProps(bm: BrowserTarget, page: Page, selector: string): Promise<string>;
|
|
45
|
+
/**
|
|
46
|
+
* Find all Suspense boundaries and report their resolution status.
|
|
47
|
+
*/
|
|
48
|
+
export declare function getSuspense(bm: BrowserTarget, page: Page): Promise<string>;
|
|
49
|
+
/**
|
|
50
|
+
* Find all error boundaries and report whether they have caught errors.
|
|
51
|
+
*/
|
|
52
|
+
export declare function getErrors(bm: BrowserTarget, page: Page): Promise<string>;
|
|
53
|
+
/**
|
|
54
|
+
* Report React Profiler timing data (actualDuration / selfBaseDuration).
|
|
55
|
+
* Requires React profiling build (react-dom/profiling).
|
|
56
|
+
*/
|
|
57
|
+
export declare function getProfiler(bm: BrowserTarget, page: Page): Promise<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Report hydration timing from performance entries or Next.js instrumentation.
|
|
60
|
+
*/
|
|
61
|
+
export declare function getHydration(bm: BrowserTarget, page: Page): Promise<string>;
|
|
62
|
+
/**
|
|
63
|
+
* Report which components re-rendered in the most recent commit.
|
|
64
|
+
* Uses actualDuration > 0 with an alternate fiber as the signal.
|
|
65
|
+
*/
|
|
66
|
+
export declare function getRenders(bm: BrowserTarget, page: Page): Promise<string>;
|
|
67
|
+
/**
|
|
68
|
+
* Walk up the fiber tree from an element to show the parent component chain.
|
|
69
|
+
*/
|
|
70
|
+
export declare function getOwners(bm: BrowserTarget, page: Page, selector: string): Promise<string>;
|
|
71
|
+
/**
|
|
72
|
+
* Read React Context values consumed by the component at the given element.
|
|
73
|
+
*/
|
|
74
|
+
export declare function getContext(bm: BrowserTarget, page: Page, selector: string): Promise<string>;
|
|
75
|
+
//# sourceMappingURL=react-devtools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-devtools.d.ts","sourceRoot":"","sources":["../../../src/browser/react-devtools.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAMvC;;GAEG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAkBlD;AAED;;;GAGG;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MAAM,CAAC,CA6B/E;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkChG;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA6CjG"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Page readiness — wait for page to be truly ready after navigation.
|
|
3
|
+
* Runtime-agnostic. Best-effort, never throws.
|
|
4
|
+
* Gated by BROWSE_READINESS env var (default '0' = disabled, opt-in only).
|
|
5
|
+
*/
|
|
6
|
+
import type { Page } from 'playwright';
|
|
7
|
+
export interface ReadinessOptions {
|
|
8
|
+
/** Max time to wait for network idle (ms). Default: 2000. */
|
|
9
|
+
networkTimeout?: number;
|
|
10
|
+
/** Settle time after rAF (ms). Default: 100. */
|
|
11
|
+
settleMs?: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Wait for page readiness: networkidle (soft) + rAF + settle.
|
|
15
|
+
* Never throws — all steps wrapped in try/catch.
|
|
16
|
+
* Total overhead bounded: networkTimeout + settleMs.
|
|
17
|
+
*/
|
|
18
|
+
export declare function waitForPageReady(page: Page, opts?: ReadinessOptions): Promise<void>;
|
|
19
|
+
//# sourceMappingURL=readiness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readiness.d.ts","sourceRoot":"","sources":["../../../src/browser/readiness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,WAAW,gBAAgB;IAC/B,6DAA6D;IAC7D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAezF"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RefManager — owns @ref state and per-tab snapshot baselines.
|
|
3
|
+
*
|
|
4
|
+
* Refs are tab-scoped: the refTabId records which tab produced them.
|
|
5
|
+
* BrowserManager must pass the current activeTabId to methods that
|
|
6
|
+
* need it (setRefMap, resolveRef, snapshot accessors).
|
|
7
|
+
*/
|
|
8
|
+
import type { Locator } from 'playwright';
|
|
9
|
+
export declare class RefManager {
|
|
10
|
+
private refMap;
|
|
11
|
+
/** Which tab owns the current refMap. */
|
|
12
|
+
private refTabId;
|
|
13
|
+
private tabSnapshots;
|
|
14
|
+
setRefMap(refs: Map<string, Locator>, activeTabId: number): void;
|
|
15
|
+
clearRefs(): void;
|
|
16
|
+
getRefMap(): Map<string, Locator>;
|
|
17
|
+
getRefCount(): number;
|
|
18
|
+
getRefTabId(): number;
|
|
19
|
+
/**
|
|
20
|
+
* Returns true if the ref belongs to the given active tab.
|
|
21
|
+
* Used by wirePageEvents to decide whether navigation should clear refs.
|
|
22
|
+
*/
|
|
23
|
+
isRefTab(tabId: number): boolean;
|
|
24
|
+
areRefsValidForActiveTab(activeTabId: number): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Resolve a selector that may be a @ref (e.g. "@e3") or a plain CSS selector.
|
|
27
|
+
* Returns { locator } for @refs, or { selector } for CSS selectors.
|
|
28
|
+
*
|
|
29
|
+
* `frameScopedLocator` should be non-null when a frame is active; it will be
|
|
30
|
+
* used to scope plain CSS selectors into the frame.
|
|
31
|
+
*/
|
|
32
|
+
resolveRef(selector: string, activeTabId: number, frameScopedLocator?: Locator | null): {
|
|
33
|
+
locator: Locator;
|
|
34
|
+
} | {
|
|
35
|
+
selector: string;
|
|
36
|
+
};
|
|
37
|
+
setLastSnapshot(text: string, activeTabId: number, opts?: string[]): void;
|
|
38
|
+
getLastSnapshot(activeTabId: number): string | null;
|
|
39
|
+
getLastSnapshotOpts(activeTabId: number): string[];
|
|
40
|
+
deleteSnapshot(tabId: number): void;
|
|
41
|
+
clearSnapshots(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Migrate snapshot entries from old tab IDs to new tab IDs.
|
|
44
|
+
* Used by recreateContext after tabs are rebuilt in the new context.
|
|
45
|
+
*/
|
|
46
|
+
migrateSnapshots(idMap: Map<number, number>): void;
|
|
47
|
+
/**
|
|
48
|
+
* Save snapshot map for rollback (e.g. recreateContext failure).
|
|
49
|
+
*/
|
|
50
|
+
snapshotState(): Map<number, {
|
|
51
|
+
text: string;
|
|
52
|
+
opts: string[];
|
|
53
|
+
}>;
|
|
54
|
+
/**
|
|
55
|
+
* Restore snapshot map from a saved copy (rollback).
|
|
56
|
+
*/
|
|
57
|
+
restoreState(saved: Map<number, {
|
|
58
|
+
text: string;
|
|
59
|
+
opts: string[];
|
|
60
|
+
}>): void;
|
|
61
|
+
/**
|
|
62
|
+
* Save refMap for rollback.
|
|
63
|
+
*/
|
|
64
|
+
snapshotRefMap(): Map<string, Locator>;
|
|
65
|
+
/**
|
|
66
|
+
* Restore refMap from a saved copy (rollback).
|
|
67
|
+
*/
|
|
68
|
+
restoreRefMap(saved: Map<string, Locator>): void;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=refs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../../../src/browser/refs.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,qBAAa,UAAU;IAErB,OAAO,CAAC,MAAM,CAAmC;IACjD,yCAAyC;IACzC,OAAO,CAAC,QAAQ,CAAa;IAG7B,OAAO,CAAC,YAAY,CAA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AC,GAAG,IAAI;IAIxE;;OAEG;IACH,cAAc,IAAI,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAItC;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAGjD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google SERP fast-path — DOM-based extraction of search results.
|
|
3
|
+
* Skips ariaSnapshot entirely for ~2x speed on Google search pages.
|
|
4
|
+
* Opt-in only: activated via --serp flag or BROWSE_SERP_FASTPATH=1.
|
|
5
|
+
*/
|
|
6
|
+
import type { Page } from 'playwright';
|
|
7
|
+
/**
|
|
8
|
+
* Check if a URL is a Google SERP (search results page).
|
|
9
|
+
*/
|
|
10
|
+
export declare function isGoogleSerp(url: string): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Extract structured Google search results via DOM evaluation.
|
|
13
|
+
* Returns formatted text or null on failure.
|
|
14
|
+
*/
|
|
15
|
+
export declare function extractGoogleSerp(page: Page): Promise<string | null>;
|
|
16
|
+
//# sourceMappingURL=serp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serp.d.ts","sourceRoot":"","sources":["../../../src/browser/serp.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAUjD;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAkE1E"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Snapshot windowing — truncate large accessibility snapshots while
|
|
3
|
+
* preserving pagination/navigation links at the tail.
|
|
4
|
+
*
|
|
5
|
+
* Cuts on line boundaries (never splits a line or @ref mid-token).
|
|
6
|
+
* Extracts actual navigation/pagination lines from the tail, not arbitrary chars.
|
|
7
|
+
*/
|
|
8
|
+
export interface WindowResult {
|
|
9
|
+
text: string;
|
|
10
|
+
truncated: boolean;
|
|
11
|
+
totalChars: number;
|
|
12
|
+
offset: number;
|
|
13
|
+
hasMore: boolean;
|
|
14
|
+
nextOffset: number | null;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Apply windowing to a snapshot string.
|
|
18
|
+
* - Splits on line boundaries (never cuts mid-line or mid-@ref).
|
|
19
|
+
* - offset is a LINE index, not char index.
|
|
20
|
+
* - Appends actual navigation/pagination tail lines.
|
|
21
|
+
* - Returns unchanged if under the char limit.
|
|
22
|
+
*/
|
|
23
|
+
export declare function applySnapshotWindow(snapshot: string, opts?: {
|
|
24
|
+
offset?: number;
|
|
25
|
+
maxChars?: number;
|
|
26
|
+
}): WindowResult;
|
|
27
|
+
/**
|
|
28
|
+
* Format window metadata as a human-readable line.
|
|
29
|
+
*/
|
|
30
|
+
export declare function formatWindowMetadata(result: WindowResult): string;
|
|
31
|
+
//# sourceMappingURL=snapshot-window.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot-window.d.ts","sourceRoot":"","sources":["../../../src/browser/snapshot-window.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AA4BD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5C,YAAY,CA4Cd;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAIjE"}
|