browser-debugger-cli 0.13.0 → 0.15.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/.claude/skills/bdg/SKILL.md +101 -187
- package/README.md +4 -4
- package/dist/commands/cdp.js +1 -0
- package/dist/commands/cleanup.js +3 -0
- package/dist/commands/console.js +5 -1
- package/dist/commands/dom/a11y.d.ts +1 -1
- package/dist/commands/dom/a11y.js +20 -20
- package/dist/commands/dom/eval.d.ts +3 -1
- package/dist/commands/dom/eval.js +8 -5
- package/dist/commands/dom/formInteraction.js +1 -1
- package/dist/commands/dom/get.js +25 -7
- package/dist/commands/dom/helpers/evalResult.d.ts +36 -0
- package/dist/commands/dom/helpers/evalResult.js +59 -0
- package/dist/commands/dom/index.js +7 -2
- package/dist/commands/dom/query.d.ts +2 -1
- package/dist/commands/dom/query.js +5 -3
- package/dist/commands/dom/screenshot.js +1 -0
- package/dist/commands/helpJson.d.ts +1 -1
- package/dist/commands/helpJson.js +4 -4
- package/dist/commands/helpTopic.js +10 -4
- package/dist/commands/network/har.js +18 -14
- package/dist/commands/network/list.js +46 -3
- package/dist/commands/optionBehaviors.d.ts +25 -2
- package/dist/commands/optionBehaviors.js +60 -42
- package/dist/commands/peek.js +3 -0
- package/dist/commands/shared/CommandRunner.js +13 -13
- package/dist/commands/shared/daemonErrorHandler.js +2 -2
- package/dist/commands/shared/dataFetcher.d.ts +4 -2
- package/dist/commands/shared/dataFetcher.js +11 -3
- package/dist/commands/shared/handleValidationError.js +3 -3
- package/dist/commands/shared/optionTypes.d.ts +15 -3
- package/dist/commands/shared/outputFile.d.ts +2 -1
- package/dist/commands/shared/outputFile.js +7 -4
- package/dist/commands/shared/startHelpers.js +3 -3
- package/dist/commands/status.js +3 -1
- package/dist/commands/stop.js +2 -1
- package/dist/connection/chromeIdentity.d.ts +8 -2
- package/dist/connection/chromeIdentity.js +85 -13
- package/dist/connection/launcher/flagsBuilder.d.ts +46 -0
- package/dist/connection/launcher/flagsBuilder.js +107 -23
- package/dist/connection/launcher.d.ts +1 -1
- package/dist/connection/launcher.js +1 -2
- package/dist/constants.d.ts +31 -5
- package/dist/constants.js +37 -5
- package/dist/daemon/SessionController.js +2 -0
- package/dist/daemon/launcher.d.ts +17 -3
- package/dist/daemon/launcher.js +37 -7
- package/dist/daemon/session/Session.d.ts +2 -1
- package/dist/daemon/session/Session.js +10 -2
- package/dist/daemon/session/TelemetryStore.d.ts +7 -0
- package/dist/daemon/session/TelemetryStore.js +6 -0
- package/dist/daemon/session/commandRegistry.js +25 -7
- package/dist/daemon/session/matchedStylesReset.d.ts +26 -0
- package/dist/daemon/session/matchedStylesReset.js +46 -0
- package/dist/daemon/session/plugins.js +1 -0
- package/dist/daemon/session/triggeredRequests.d.ts +0 -5
- package/dist/daemon/session/triggeredRequests.js +13 -7
- package/dist/daemon.js +8742 -8315
- package/dist/errors/messages.d.ts +31 -0
- package/dist/errors/messages.js +96 -6
- package/dist/index.js +1129 -548
- package/dist/ipc/client.d.ts +6 -1
- package/dist/ipc/client.js +11 -2
- package/dist/ipc/protocol/commands.d.ts +8 -0
- package/dist/ipc/protocol/inspectTypes.d.ts +5 -2
- package/dist/ipc/session/types.d.ts +5 -1
- package/dist/ipc/transport/index.d.ts +6 -0
- package/dist/ipc/transport/index.js +16 -1
- package/dist/program.d.ts +14 -0
- package/dist/program.js +53 -0
- package/dist/runtime/dom/elementGeometry.d.ts +23 -0
- package/dist/runtime/dom/elementGeometry.js +17 -15
- package/dist/runtime/dom/elementInfo.d.ts +13 -4
- package/dist/runtime/dom/elementInfo.js +15 -5
- package/dist/runtime/dom/evalHelpers.d.ts +24 -4
- package/dist/runtime/dom/evalHelpers.js +40 -12
- package/dist/runtime/dom/frameScopedConnection.d.ts +7 -0
- package/dist/runtime/dom/frameScopedConnection.js +2 -2
- package/dist/runtime/dom/frames.d.ts +2 -1
- package/dist/runtime/dom/frames.js +3 -1
- package/dist/runtime/dom/inspect.d.ts +17 -3
- package/dist/runtime/dom/inspect.js +40 -26
- package/dist/runtime/dom/inspectModel.d.ts +3 -3
- package/dist/runtime/dom/inspectRules.d.ts +29 -3
- package/dist/runtime/dom/inspectRules.js +205 -11
- package/dist/runtime/dom/layout.d.ts +0 -2
- package/dist/runtime/dom/layout.js +1 -2
- package/dist/runtime/dom/reactEventHelpers.d.ts +4 -1
- package/dist/runtime/dom/reactEventHelpers.js +9 -2
- package/dist/runtime/dom/targetNode.d.ts +10 -6
- package/dist/runtime/dom/targetNode.js +15 -8
- package/dist/runtime/page/emulation.js +6 -5
- package/dist/runtime/page/userAgent.d.ts +86 -2
- package/dist/runtime/page/userAgent.js +154 -33
- package/dist/session/paths.d.ts +38 -3
- package/dist/session/paths.js +154 -7
- package/dist/session/portClaims.d.ts +0 -8
- package/dist/session/portClaims.js +1 -22
- package/dist/session/sessionList.d.ts +5 -1
- package/dist/session/sessionList.js +5 -1
- package/dist/telemetry/a11y.d.ts +15 -1
- package/dist/telemetry/a11y.js +83 -0
- package/dist/telemetry/har/builder.d.ts +12 -1
- package/dist/telemetry/har/builder.js +11 -3
- package/dist/telemetry/har/sanitize.d.ts +24 -0
- package/dist/telemetry/har/sanitize.js +138 -0
- package/dist/telemetry/har/sanitizeBody.d.ts +38 -0
- package/dist/telemetry/har/sanitizeBody.js +168 -0
- package/dist/telemetry/network.d.ts +13 -16
- package/dist/telemetry/network.js +30 -52
- package/dist/telemetry/networkRetention.d.ts +83 -0
- package/dist/telemetry/networkRetention.js +117 -0
- package/dist/types.d.ts +26 -0
- package/dist/ui/OutputBuilder.d.ts +10 -0
- package/dist/ui/OutputBuilder.js +12 -0
- package/dist/ui/formatters/a11y.d.ts +5 -7
- package/dist/ui/formatters/a11y.js +7 -61
- package/dist/ui/formatters/console/chronological.js +4 -4
- package/dist/ui/formatters/console/follow.d.ts +4 -2
- package/dist/ui/formatters/console/follow.js +6 -3
- package/dist/ui/formatters/console/json.d.ts +3 -6
- package/dist/ui/formatters/console/json.js +9 -13
- package/dist/ui/formatters/console/shared.d.ts +17 -2
- package/dist/ui/formatters/console/shared.js +17 -0
- package/dist/ui/formatters/console/summarize.d.ts +2 -2
- package/dist/ui/formatters/console/summarize.js +22 -7
- package/dist/ui/formatters/console.d.ts +1 -1
- package/dist/ui/formatters/console.js +1 -5
- package/dist/ui/formatters/details.js +1 -1
- package/dist/ui/formatters/dom.d.ts +13 -4
- package/dist/ui/formatters/dom.js +25 -7
- package/dist/ui/formatters/layout.js +2 -1
- package/dist/ui/formatters/longValues.d.ts +14 -0
- package/dist/ui/formatters/longValues.js +23 -0
- package/dist/ui/formatters/networkList.d.ts +8 -2
- package/dist/ui/formatters/networkList.js +11 -2
- package/dist/ui/formatters/preview.d.ts +4 -1
- package/dist/ui/formatters/preview.js +55 -13
- package/dist/ui/formatters/sessions.d.ts +3 -2
- package/dist/ui/formatters/sessions.js +10 -3
- package/dist/ui/formatters/status.js +7 -0
- package/dist/ui/formatters/triggeredRequests.js +2 -1
- package/dist/ui/messages/chrome.d.ts +34 -7
- package/dist/ui/messages/chrome.js +81 -15
- package/dist/ui/messages/commands.d.ts +29 -8
- package/dist/ui/messages/commands.js +36 -8
- package/dist/ui/messages/networkMessages.d.ts +50 -0
- package/dist/ui/messages/networkMessages.js +66 -0
- package/dist/ui/messages/session.d.ts +8 -0
- package/dist/ui/messages/session.js +10 -0
- package/dist/utils/atomicFile.d.ts +2 -1
- package/dist/utils/atomicFile.js +5 -2
- package/dist/utils/directories.d.ts +41 -0
- package/dist/utils/directories.js +48 -0
- package/dist/utils/http.d.ts +9 -2
- package/dist/utils/http.js +4 -3
- package/dist/utils/strings.d.ts +19 -0
- package/dist/utils/strings.js +16 -0
- package/package.json +2 -2
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Long values in human output: cut, with a pointer naming `--full`.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* A value for human output: its first `maxLength` characters followed by
|
|
6
|
+
* how many more there are, or all of it with `--full`.
|
|
7
|
+
*
|
|
8
|
+
* @param text - Value
|
|
9
|
+
* @param maxLength - Characters printed
|
|
10
|
+
* @param full - `--full`: print it whole
|
|
11
|
+
* @returns Text to print
|
|
12
|
+
*/
|
|
13
|
+
export declare function capForDisplay(text: string, maxLength: number, full?: boolean): string;
|
|
14
|
+
//# sourceMappingURL=longValues.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Long values in human output: cut, with a pointer naming `--full`.
|
|
3
|
+
*/
|
|
4
|
+
import { moreCharsNote } from '../messages/commands.js';
|
|
5
|
+
import { capLength } from '../../utils/strings.js';
|
|
6
|
+
/**
|
|
7
|
+
* A value for human output: its first `maxLength` characters followed by
|
|
8
|
+
* how many more there are, or all of it with `--full`.
|
|
9
|
+
*
|
|
10
|
+
* @param text - Value
|
|
11
|
+
* @param maxLength - Characters printed
|
|
12
|
+
* @param full - `--full`: print it whole
|
|
13
|
+
* @returns Text to print
|
|
14
|
+
*/
|
|
15
|
+
export function capForDisplay(text, maxLength, full) {
|
|
16
|
+
if (full)
|
|
17
|
+
return text;
|
|
18
|
+
const capped = capLength(text, maxLength);
|
|
19
|
+
return capped.truncatedFrom === undefined
|
|
20
|
+
? text
|
|
21
|
+
: `${capped.text}${moreCharsNote(capped.truncatedFrom - capped.text.length)}`;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=longValues.js.map
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* with support for filtering results display.
|
|
6
6
|
*/
|
|
7
7
|
import type { NetworkRequest } from '../../types.js';
|
|
8
|
+
import { type NetworkEvictionCounts } from '../messages/networkMessages.js';
|
|
8
9
|
export interface NetworkListOptions {
|
|
9
10
|
verbose?: boolean;
|
|
10
11
|
/** Start of the current page, which the START column counts from ({@link pageStartOf}) */
|
|
@@ -13,6 +14,8 @@ export interface NetworkListOptions {
|
|
|
13
14
|
totalCount?: number;
|
|
14
15
|
/** Requests matching the filters, before --last (defaults to totalCount) */
|
|
15
16
|
filteredCount?: number;
|
|
17
|
+
/** Requests dropped and bodies evicted at the session's capture limits */
|
|
18
|
+
evictions?: NetworkEvictionCounts;
|
|
16
19
|
}
|
|
17
20
|
/**
|
|
18
21
|
* When the current page started loading: the request of its document, in
|
|
@@ -41,16 +44,19 @@ export declare function pageStartOf(requests: NetworkRequest[]): PageStart | und
|
|
|
41
44
|
export declare function formatStartOffset(request: NetworkRequest, pageStart: PageStart | undefined): string;
|
|
42
45
|
/**
|
|
43
46
|
* Rows of the network stream: requests that finished since the last poll,
|
|
44
|
-
* with the column header the first time (the stream banner is on stderr)
|
|
47
|
+
* with the column header the first time (the stream banner is on stderr),
|
|
48
|
+
* after the dropped/evicted note when the counts changed.
|
|
45
49
|
*
|
|
46
50
|
* @param requests - Newly finished requests
|
|
47
|
-
* @param options - `header` the first time; `verbose` for full URLs; the page start for
|
|
51
|
+
* @param options - `header` the first time; `verbose` for full URLs; the page start for
|
|
52
|
+
* START; `evictions` only when the session's counts changed since the last poll
|
|
48
53
|
* @returns Text to print (empty when there is nothing new)
|
|
49
54
|
*/
|
|
50
55
|
export declare function formatNetworkFollowRows(requests: NetworkRequest[], options?: {
|
|
51
56
|
header?: boolean;
|
|
52
57
|
verbose?: boolean;
|
|
53
58
|
pageStart?: PageStart;
|
|
59
|
+
evictions?: NetworkEvictionCounts;
|
|
54
60
|
}): string;
|
|
55
61
|
/**
|
|
56
62
|
* Format network requests for display.
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { getResourceTypeAbbr } from './preview.js';
|
|
8
8
|
import { getRequestState } from './requestStatus.js';
|
|
9
9
|
import { OutputFormatter, truncateUrl } from '../formatting.js';
|
|
10
|
+
import { networkEvictedNote } from '../messages/networkMessages.js';
|
|
10
11
|
const SIZE_UNITS = ['B', 'KB', 'MB', 'GB'];
|
|
11
12
|
const SEPARATOR_WIDTH = 80;
|
|
12
13
|
function formatSize(bytes) {
|
|
@@ -154,6 +155,9 @@ function formatNetworkListHuman(requests, options) {
|
|
|
154
155
|
const header = buildHeader(requests.length, options.filteredCount ?? totalCount, totalCount);
|
|
155
156
|
fmt.text(header);
|
|
156
157
|
fmt.separator('─', SEPARATOR_WIDTH);
|
|
158
|
+
const evictedNote = options.evictions && networkEvictedNote(options.evictions);
|
|
159
|
+
if (evictedNote)
|
|
160
|
+
fmt.text(evictedNote);
|
|
157
161
|
if (requests.length === 0) {
|
|
158
162
|
fmt.text('No matching requests found.');
|
|
159
163
|
return fmt.build();
|
|
@@ -170,15 +174,20 @@ function formatNetworkListHuman(requests, options) {
|
|
|
170
174
|
const FOLLOW_ID_WIDTH = 14;
|
|
171
175
|
/**
|
|
172
176
|
* Rows of the network stream: requests that finished since the last poll,
|
|
173
|
-
* with the column header the first time (the stream banner is on stderr)
|
|
177
|
+
* with the column header the first time (the stream banner is on stderr),
|
|
178
|
+
* after the dropped/evicted note when the counts changed.
|
|
174
179
|
*
|
|
175
180
|
* @param requests - Newly finished requests
|
|
176
|
-
* @param options - `header` the first time; `verbose` for full URLs; the page start for
|
|
181
|
+
* @param options - `header` the first time; `verbose` for full URLs; the page start for
|
|
182
|
+
* START; `evictions` only when the session's counts changed since the last poll
|
|
177
183
|
* @returns Text to print (empty when there is nothing new)
|
|
178
184
|
*/
|
|
179
185
|
export function formatNetworkFollowRows(requests, options = {}) {
|
|
180
186
|
const fmt = new OutputFormatter();
|
|
181
187
|
const widths = columnWidths(requests, FOLLOW_ID_WIDTH);
|
|
188
|
+
const evictedNote = options.evictions && networkEvictedNote(options.evictions);
|
|
189
|
+
if (evictedNote)
|
|
190
|
+
fmt.text(evictedNote);
|
|
182
191
|
if (options.header) {
|
|
183
192
|
fmt.text(formatColumnHeader(widths));
|
|
184
193
|
fmt.separator('─', SEPARATOR_WIDTH);
|
|
@@ -39,6 +39,8 @@ export interface PreviewOptions {
|
|
|
39
39
|
filteredTypes?: string[] | undefined;
|
|
40
40
|
/** Total network requests before filtering (for showing feedback when no matches). */
|
|
41
41
|
unfilteredNetworkCount?: number | undefined;
|
|
42
|
+
/** Console message texts whole instead of cut (`--full`). */
|
|
43
|
+
full?: boolean | undefined;
|
|
42
44
|
}
|
|
43
45
|
/**
|
|
44
46
|
* Format preview output (peek command)
|
|
@@ -59,7 +61,8 @@ export interface PreviewJsonData {
|
|
|
59
61
|
console?: BdgOutput['data']['console'];
|
|
60
62
|
}
|
|
61
63
|
/**
|
|
62
|
-
* Build the JSON payload for a preview, honoring the section and `--last`
|
|
64
|
+
* Build the JSON payload for a preview, honoring the section and `--last`
|
|
65
|
+
* filters; console texts are cut with `truncatedFrom` unless `--full`.
|
|
63
66
|
*
|
|
64
67
|
* @param output - Preview output from the daemon
|
|
65
68
|
* @param options - Preview options (section filters, last N)
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { buildSuccessResponse } from '../OutputBuilder.js';
|
|
3
|
-
import { formatTimestamp } from './console/shared.js';
|
|
1
|
+
import { MAX_CONSOLE_TEXT_LENGTH, MIME_TYPE_RULES, RESOURCE_TYPE_ABBREVIATIONS, } from '../../constants.js';
|
|
2
|
+
import { buildSuccessResponse, stringifyEnvelope } from '../OutputBuilder.js';
|
|
3
|
+
import { capMessageText, formatTimestamp } from './console/shared.js';
|
|
4
|
+
import { capForDisplay } from './longValues.js';
|
|
4
5
|
import { failureReason, formatRequestStatus, getRequestState, } from './requestStatus.js';
|
|
5
6
|
import { OutputFormatter, truncateUrl, truncateText } from '../formatting.js';
|
|
6
|
-
import { withPageCrashedNote } from '../messages/commands.js';
|
|
7
|
-
import { PREVIEW_EMPTY_STATES, PREVIEW_HEADERS, compactTipsMessage, verboseCommandsMessage, } from '../messages/preview.js';
|
|
7
|
+
import { moreCharsNote, withPageCrashedNote } from '../messages/commands.js';
|
|
8
8
|
import { consoleDroppedNote } from '../messages/consoleMessages.js';
|
|
9
|
+
import { networkEvictedNote } from '../messages/networkMessages.js';
|
|
10
|
+
import { PREVIEW_EMPTY_STATES, PREVIEW_HEADERS, compactTipsMessage, verboseCommandsMessage, } from '../messages/preview.js';
|
|
9
11
|
import { sessionCommand } from '../messages/sessionCommand.js';
|
|
12
|
+
import { capLength } from '../../utils/strings.js';
|
|
10
13
|
/**
|
|
11
14
|
* Infer resource type from MIME type when CDP doesn't provide it.
|
|
12
15
|
*
|
|
@@ -55,7 +58,8 @@ export function formatPreview(output, options) {
|
|
|
55
58
|
return formatPreviewHumanReadable(output, options);
|
|
56
59
|
}
|
|
57
60
|
/**
|
|
58
|
-
* Build the JSON payload for a preview, honoring the section and `--last`
|
|
61
|
+
* Build the JSON payload for a preview, honoring the section and `--last`
|
|
62
|
+
* filters; console texts are cut with `truncatedFrom` unless `--full`.
|
|
59
63
|
*
|
|
60
64
|
* @param output - Preview output from the daemon
|
|
61
65
|
* @param options - Preview options (section filters, last N)
|
|
@@ -73,7 +77,10 @@ export function buildPreviewJsonData(output, options) {
|
|
|
73
77
|
...(output.totals && { totals: output.totals }),
|
|
74
78
|
...(output.pageCrashedAt !== undefined && { pageCrashedAt: output.pageCrashedAt }),
|
|
75
79
|
...(pick('network') && output.data.network && { network: last(output.data.network) }),
|
|
76
|
-
...(pick('console') &&
|
|
80
|
+
...(pick('console') &&
|
|
81
|
+
output.data.console && {
|
|
82
|
+
console: last(output.data.console)?.map((message) => capMessageText(message, options.full)),
|
|
83
|
+
}),
|
|
77
84
|
};
|
|
78
85
|
}
|
|
79
86
|
/**
|
|
@@ -81,12 +88,12 @@ export function buildPreviewJsonData(output, options) {
|
|
|
81
88
|
*
|
|
82
89
|
* @param output - Preview output
|
|
83
90
|
* @param options - Preview options
|
|
84
|
-
* @returns `{ version, success, data }` envelope,
|
|
85
|
-
* line in follow mode (one object per line, NDJSON)
|
|
91
|
+
* @returns `{ version, success, data }` envelope, indented on a terminal, and
|
|
92
|
+
* always on one line in follow mode (one object per line, NDJSON)
|
|
86
93
|
*/
|
|
87
94
|
function formatPreviewAsJson(output, options) {
|
|
88
95
|
const envelope = buildSuccessResponse(buildPreviewJsonData(output, options));
|
|
89
|
-
return options.follow ? JSON.stringify(envelope) :
|
|
96
|
+
return options.follow ? JSON.stringify(envelope) : stringifyEnvelope(envelope);
|
|
90
97
|
}
|
|
91
98
|
/**
|
|
92
99
|
* Format preview as human-readable output, after a warning when the page
|
|
@@ -98,6 +105,24 @@ function formatPreviewHumanReadable(output, options) {
|
|
|
98
105
|
: formatPreviewCompact(output, options);
|
|
99
106
|
return withPageCrashedNote(body, output.pageCrashedAt);
|
|
100
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* A console message text in the compact preview: cut like `console --list`
|
|
110
|
+
* cuts it and to its first two lines, or whole with `--full`. The pointer
|
|
111
|
+
* naming `--full` comes after the line cut, so it is always shown.
|
|
112
|
+
*
|
|
113
|
+
* @param text - Message text
|
|
114
|
+
* @param full - `--full`
|
|
115
|
+
* @returns Text to print
|
|
116
|
+
*/
|
|
117
|
+
function compactConsoleText(text, full) {
|
|
118
|
+
if (full)
|
|
119
|
+
return text;
|
|
120
|
+
const capped = capLength(text, MAX_CONSOLE_TEXT_LENGTH);
|
|
121
|
+
const shown = truncateText(capped.text, 2);
|
|
122
|
+
return capped.truncatedFrom === undefined
|
|
123
|
+
? shown
|
|
124
|
+
: `${shown}${moreCharsNote(capped.truncatedFrom - capped.text.length)}`;
|
|
125
|
+
}
|
|
101
126
|
/**
|
|
102
127
|
* Format preview in compact format (default)
|
|
103
128
|
* Token-efficient output optimized for AI agents
|
|
@@ -119,6 +144,9 @@ function formatPreviewCompact(output, options) {
|
|
|
119
144
|
const totalCount = output.totals?.network ?? output.data.network.length;
|
|
120
145
|
const limitHint = formatLimitHint(showingCount, totalCount);
|
|
121
146
|
fmt.text(`NETWORK (${showingCount}/${totalCount})${limitHint}:`);
|
|
147
|
+
const evictedNote = previewEvictedNote(output);
|
|
148
|
+
if (evictedNote)
|
|
149
|
+
fmt.text(` ${evictedNote}`);
|
|
122
150
|
if (requests.length === 0) {
|
|
123
151
|
if (options.filteredTypes &&
|
|
124
152
|
options.filteredTypes.length > 0 &&
|
|
@@ -159,8 +187,7 @@ function formatPreviewCompact(output, options) {
|
|
|
159
187
|
else {
|
|
160
188
|
const consoleLines = messages.map((msg) => {
|
|
161
189
|
const prefix = msg.type.toUpperCase().padEnd(5);
|
|
162
|
-
|
|
163
|
-
return `${prefix} ${text}`;
|
|
190
|
+
return `${prefix} ${compactConsoleText(msg.text, options.full)}`;
|
|
164
191
|
});
|
|
165
192
|
fmt.list(consoleLines, 2);
|
|
166
193
|
}
|
|
@@ -172,6 +199,18 @@ function formatPreviewCompact(output, options) {
|
|
|
172
199
|
}
|
|
173
200
|
return fmt.build();
|
|
174
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* Note that the session dropped requests or evicted bodies at its capture limits.
|
|
204
|
+
*
|
|
205
|
+
* @param output - Preview output with its totals
|
|
206
|
+
* @returns Note text, or undefined when nothing was let go
|
|
207
|
+
*/
|
|
208
|
+
function previewEvictedNote(output) {
|
|
209
|
+
return networkEvictedNote({
|
|
210
|
+
requestsDropped: output.totals?.networkDropped ?? 0,
|
|
211
|
+
bodiesEvicted: output.totals?.networkBodiesEvicted ?? 0,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
175
214
|
/**
|
|
176
215
|
* Format preview in verbose format (opt-in with --verbose)
|
|
177
216
|
* Original human-friendly output with Unicode formatting
|
|
@@ -198,6 +237,9 @@ function formatPreviewVerbose(output, options) {
|
|
|
198
237
|
? `Network Requests (all ${requests.length})`
|
|
199
238
|
: `Network Requests (last ${requests.length} of ${output.totals?.network ?? output.data.network.length})`;
|
|
200
239
|
fmt.text(title).separator('━', 50);
|
|
240
|
+
const evictedNote = previewEvictedNote(output);
|
|
241
|
+
if (evictedNote)
|
|
242
|
+
fmt.text(evictedNote);
|
|
201
243
|
if (requests.length === 0) {
|
|
202
244
|
if (options.filteredTypes &&
|
|
203
245
|
options.filteredTypes.length > 0 &&
|
|
@@ -248,7 +290,7 @@ function formatPreviewVerbose(output, options) {
|
|
|
248
290
|
else {
|
|
249
291
|
messages.forEach((msg) => {
|
|
250
292
|
const icon = msg.type === 'error' ? 'ERR' : msg.type === 'warning' ? 'WARN' : 'INFO';
|
|
251
|
-
fmt.text(`${icon} [${msg.type}] ${msg.text}`);
|
|
293
|
+
fmt.text(`${icon} [${msg.type}] ${capForDisplay(msg.text, MAX_CONSOLE_TEXT_LENGTH, options.full)}`);
|
|
252
294
|
});
|
|
253
295
|
}
|
|
254
296
|
fmt.blank();
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { RunningSessionInfo } from '../../session/sessionList.js';
|
|
2
2
|
/**
|
|
3
|
-
* Format the sessions as a table, followed by why ended sessions ended
|
|
4
|
-
*
|
|
3
|
+
* Format the sessions as a table, followed by why ended sessions ended, why
|
|
4
|
+
* untrusted sessions' directories are not safe to use, and the cleanup
|
|
5
|
+
* commands of crashed and stale sessions.
|
|
5
6
|
*
|
|
6
7
|
* @param data - Sessions
|
|
7
8
|
* @returns Human-readable list
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { OutputFormatter } from '../formatting.js';
|
|
2
|
-
import { endedSessionText } from '../messages/session.js';
|
|
2
|
+
import { endedSessionText, untrustedSessionText } from '../messages/session.js';
|
|
3
3
|
/** Label of the default session in the list */
|
|
4
4
|
const DEFAULT_SESSION_LABEL = '(default)';
|
|
5
5
|
/**
|
|
6
|
-
* Format the sessions as a table, followed by why ended sessions ended
|
|
7
|
-
*
|
|
6
|
+
* Format the sessions as a table, followed by why ended sessions ended, why
|
|
7
|
+
* untrusted sessions' directories are not safe to use, and the cleanup
|
|
8
|
+
* commands of crashed and stale sessions.
|
|
8
9
|
*
|
|
9
10
|
* @param data - Sessions
|
|
10
11
|
* @returns Human-readable list
|
|
@@ -38,6 +39,12 @@ export function formatSessionList(data) {
|
|
|
38
39
|
if (ended.length > 0) {
|
|
39
40
|
fmt.blank().section('Ended without bdg stop:', ended);
|
|
40
41
|
}
|
|
42
|
+
const untrusted = data.sessions.flatMap(({ name, untrusted: why }) => why ? [untrustedSessionText(name ?? DEFAULT_SESSION_LABEL, why)] : []);
|
|
43
|
+
if (untrusted.length > 0) {
|
|
44
|
+
fmt
|
|
45
|
+
.blank()
|
|
46
|
+
.section('Directory not safe to use (not asked; bdg status --session <name> says how to fix it):', untrusted);
|
|
47
|
+
}
|
|
41
48
|
const cleanups = data.sessions.flatMap((session) => (session.cleanup ? [session.cleanup] : []));
|
|
42
49
|
if (cleanups.length > 0) {
|
|
43
50
|
fmt.hints('Crashed or stale sessions; clean up with:', cleanups);
|
|
@@ -2,6 +2,7 @@ import { describeRunningChrome } from '../../session/chrome.js';
|
|
|
2
2
|
import { calculateDuration, formatTimeAgo } from '../../session/statusData.js';
|
|
3
3
|
import { OutputFormatter } from '../formatting.js';
|
|
4
4
|
import { colorSchemeLabel, sessionActiveLine } from '../messages/commands.js';
|
|
5
|
+
import { networkEvictedNote } from '../messages/networkMessages.js';
|
|
5
6
|
import { lastSessionEndText } from '../messages/session.js';
|
|
6
7
|
import { noActiveSessionMessage, sessionCommand } from '../messages/sessionCommand.js';
|
|
7
8
|
import { isProcessAlive } from '../../utils/process.js';
|
|
@@ -51,6 +52,12 @@ export function formatSessionStatus(metadata, pid, activity, pageState, verbose
|
|
|
51
52
|
if (activity.lastNetworkRequestAt) {
|
|
52
53
|
fmt.keyValue(' Last Request', formatTimeAgo(activity.lastNetworkRequestAt), 18);
|
|
53
54
|
}
|
|
55
|
+
const evictedNote = networkEvictedNote({
|
|
56
|
+
requestsDropped: activity.networkRequestsDropped ?? 0,
|
|
57
|
+
bodiesEvicted: activity.networkBodiesEvicted ?? 0,
|
|
58
|
+
});
|
|
59
|
+
if (evictedNote)
|
|
60
|
+
fmt.text(` ${evictedNote}`);
|
|
54
61
|
fmt.keyValue('Console Messages', `${activity.consoleMessagesCaptured} captured`, 18);
|
|
55
62
|
if (activity.lastConsoleMessageAt) {
|
|
56
63
|
fmt.keyValue(' Last Message', formatTimeAgo(activity.lastConsoleMessageAt), 18);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Human output of the network requests a DOM action triggered.
|
|
3
3
|
*/
|
|
4
|
+
import { MAX_TRIGGERED_REQUESTS } from '../../constants.js';
|
|
4
5
|
import { assetTypeNames, isNotableRequest } from '../../telemetry/requestKinds.js';
|
|
5
6
|
import { formatRequestStatus } from './requestStatus.js';
|
|
6
7
|
import { formatDuration, truncateUrl } from '../formatting.js';
|
|
@@ -57,7 +58,7 @@ export function formatTriggeredRequestLines(requests, omitted = 0) {
|
|
|
57
58
|
const lines = notable.slice(0, MAX_TRIGGERED_REQUESTS_SHOWN).map(formatTriggeredRequest);
|
|
58
59
|
const hidden = notable.length - lines.length + omitted;
|
|
59
60
|
if (hidden > 0)
|
|
60
|
-
lines.push(omitted > 0 ? moreRequestsNote(hidden) : moreMatchesNote(hidden));
|
|
61
|
+
lines.push(omitted > 0 ? moreRequestsNote(hidden) : moreMatchesNote(hidden, MAX_TRIGGERED_REQUESTS));
|
|
61
62
|
if (assets.length > 0)
|
|
62
63
|
lines.push(assetRequestsNote(assets.length, assetTypeNames(assets)));
|
|
63
64
|
return lines;
|
|
@@ -20,8 +20,12 @@ export declare function formatChromeNotice(notice: NoticeDetails<ChromeNoticeCod
|
|
|
20
20
|
* Called at the UI boundary when a ChromeLaunchError with `issue` details
|
|
21
21
|
* reaches a CLI or daemon log sink. Core modules produce the IssueDetails;
|
|
22
22
|
* this function is the only place wording is assembled.
|
|
23
|
+
*
|
|
24
|
+
* @param issue - Structured issue
|
|
25
|
+
* @param diagnostics - Source of Chrome installation diagnostics (tests stub it)
|
|
26
|
+
* @returns User-facing message
|
|
23
27
|
*/
|
|
24
|
-
export declare function formatChromeIssue(issue: IssueDetails): string;
|
|
28
|
+
export declare function formatChromeIssue(issue: IssueDetails, diagnostics?: () => ChromeDiagnostics): string;
|
|
25
29
|
/**
|
|
26
30
|
* Chrome exited before its debugging port opened.
|
|
27
31
|
*
|
|
@@ -33,15 +37,19 @@ export declare function formatChromeIssue(issue: IssueDetails): string;
|
|
|
33
37
|
*/
|
|
34
38
|
export declare function chromeExitedDuringStartupError(exitCode: number | null, output: string[], userDataDir: string, profileInUse: boolean): string;
|
|
35
39
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* @returns Array of formatted diagnostic strings
|
|
40
|
+
* Options of {@link formatDiagnosticsForError}.
|
|
39
41
|
*/
|
|
40
|
-
export
|
|
42
|
+
export interface DiagnosticsFormatOptions {
|
|
43
|
+
/** OS the CHROME_PATH example is for (default: this one) */
|
|
44
|
+
platform?: NodeJS.Platform;
|
|
45
|
+
/** Suggest CHROME_PATH when no Chrome is found (off when CHROME_PATH is the problem) */
|
|
46
|
+
suggestChromePath?: boolean;
|
|
47
|
+
}
|
|
41
48
|
/**
|
|
42
49
|
* Format Chrome diagnostics for error reporting when Chrome launch fails.
|
|
43
50
|
*
|
|
44
51
|
* @param diagnostics - Chrome diagnostics information
|
|
52
|
+
* @param options - Platform of the example and whether to suggest CHROME_PATH
|
|
45
53
|
* @returns Formatted error message lines with troubleshooting steps
|
|
46
54
|
*
|
|
47
55
|
* @example
|
|
@@ -51,7 +59,7 @@ export declare function getFormattedDiagnostics(): string[];
|
|
|
51
59
|
* console.error(errorLines.join('\n'));
|
|
52
60
|
* ```
|
|
53
61
|
*/
|
|
54
|
-
export declare function formatDiagnosticsForError(diagnostics: ChromeDiagnostics): string[];
|
|
62
|
+
export declare function formatDiagnosticsForError(diagnostics: ChromeDiagnostics, { platform, suggestChromePath }?: DiagnosticsFormatOptions): string[];
|
|
55
63
|
/**
|
|
56
64
|
* Generate invalid port error message.
|
|
57
65
|
*
|
|
@@ -158,9 +166,28 @@ export declare function chromeBinaryOverrideIsDirectory(path: string, source: st
|
|
|
158
166
|
* Generate error when CDP port is already in use.
|
|
159
167
|
*
|
|
160
168
|
* @param port - Port number that is in use
|
|
169
|
+
* @param reason - What was found on the port, when known
|
|
161
170
|
* @returns Multi-line formatted error message with troubleshooting steps
|
|
162
171
|
*/
|
|
163
|
-
export declare function portInUseError(port: number): string;
|
|
172
|
+
export declare function portInUseError(port: number, reason?: string): string;
|
|
173
|
+
/**
|
|
174
|
+
* Why a launched Chrome is not the one answering on 127.0.0.1:<port>.
|
|
175
|
+
*
|
|
176
|
+
* @param answeredBy - What answers there: a different browser, another
|
|
177
|
+
* process, or nothing (the address is held but does not answer)
|
|
178
|
+
* @param chromeHost - Address the launched Chrome listens on
|
|
179
|
+
* @returns Reason for the PORT_IN_USE issue
|
|
180
|
+
*/
|
|
181
|
+
export declare function portTakenByReason(answeredBy: 'browser' | 'process' | 'nothing', chromeHost: string): string;
|
|
182
|
+
/**
|
|
183
|
+
* Why a launch failed when Chrome announced its port but did not answer on
|
|
184
|
+
* it in time (a slow start, not a port conflict).
|
|
185
|
+
*
|
|
186
|
+
* @param port - Port Chrome announced
|
|
187
|
+
* @param waitedMs - How long bdg waited
|
|
188
|
+
* @returns Reason for the CHROME_LAUNCH_FAILED issue
|
|
189
|
+
*/
|
|
190
|
+
export declare function chromeNotAnsweringReason(port: number, waitedMs: number): string;
|
|
164
191
|
/**
|
|
165
192
|
* Warning when bdg's Chrome preferences (password manager and leak check
|
|
166
193
|
* off, etc.) could not be written into the profile.
|
|
@@ -32,12 +32,16 @@ export function formatChromeNotice(notice) {
|
|
|
32
32
|
* Called at the UI boundary when a ChromeLaunchError with `issue` details
|
|
33
33
|
* reaches a CLI or daemon log sink. Core modules produce the IssueDetails;
|
|
34
34
|
* this function is the only place wording is assembled.
|
|
35
|
+
*
|
|
36
|
+
* @param issue - Structured issue
|
|
37
|
+
* @param diagnostics - Source of Chrome installation diagnostics (tests stub it)
|
|
38
|
+
* @returns User-facing message
|
|
35
39
|
*/
|
|
36
|
-
export function formatChromeIssue(issue) {
|
|
40
|
+
export function formatChromeIssue(issue, diagnostics = getChromeDiagnostics) {
|
|
37
41
|
const ctx = issue.context ?? {};
|
|
38
42
|
switch (issue.code) {
|
|
39
43
|
case 'PORT_IN_USE':
|
|
40
|
-
return portInUseError(ctx['port']);
|
|
44
|
+
return portInUseError(ctx['port'], ctx['reason']);
|
|
41
45
|
case 'INVALID_PORT':
|
|
42
46
|
return invalidPortError(ctx['port']);
|
|
43
47
|
case 'USER_DATA_DIR_CREATE_FAILED':
|
|
@@ -52,16 +56,18 @@ export function formatChromeIssue(issue) {
|
|
|
52
56
|
: reason
|
|
53
57
|
? chromeLaunchFailedError(reason)
|
|
54
58
|
: `Chrome failed to launch`;
|
|
55
|
-
const
|
|
56
|
-
|
|
59
|
+
const found = diagnostics();
|
|
60
|
+
const diagnosticLines = formatDiagnosticsForError(found);
|
|
61
|
+
if (noChromeFound(found))
|
|
62
|
+
return joinLines(header, '', ...diagnosticLines);
|
|
63
|
+
return joinLines(header, '', 'Possible causes:', ` - Port ${port} conflict (check: lsof -ti:${port})`, ` - Chrome binary not found`, ` - Insufficient permissions`, ` - Chrome crashed on startup`, '', ...diagnosticLines, '', 'Try:', ` - ${sessionCommand('bdg cleanup')}`, ` - See what uses the port: lsof -i :${port}`, ` - Use different port: ${sessionCommand(`bdg <url> --port ${port + 1}`)}`, ` - In a container where Chrome's sandbox fails: BDG_NO_SANDBOX=1 ${sessionCommand('bdg <url>')}`);
|
|
57
64
|
}
|
|
58
65
|
case 'CHROME_EXITED_DURING_STARTUP':
|
|
59
66
|
return chromeExitedDuringStartupError(ctx['exitCode'], ctx['output'] ?? [], ctx['userDataDir'], ctx['profileInUse'] === true);
|
|
60
67
|
case 'NO_PAGE_TARGET_FOUND':
|
|
61
68
|
return noPageTargetFoundError(ctx['port'], ctx['availableTargets']);
|
|
62
69
|
case 'CHROME_BINARY_NOT_FOUND': {
|
|
63
|
-
|
|
64
|
-
return joinLines(chromeBinaryOverrideNotFound(ctx['chromePath'], ctx['source']), '', ...diagnostics);
|
|
70
|
+
return joinLines(chromeBinaryOverrideNotFound(ctx['chromePath'], ctx['source']), '', ...formatDiagnosticsForError(diagnostics(), { suggestChromePath: false }));
|
|
65
71
|
}
|
|
66
72
|
case 'CHROME_BINARY_IS_DIRECTORY':
|
|
67
73
|
return chromeBinaryOverrideIsDirectory(ctx['chromePath'], ctx['source']);
|
|
@@ -96,17 +102,49 @@ export function chromeExitedDuringStartupError(exitCode, output, userDataDir, pr
|
|
|
96
102
|
return joinLines(`Chrome exited during startup (exit code ${exitCode ?? 'none'})`, ...(output.length > 0 ? ['Chrome said:', ...output.map((line) => ` ${line}`)] : []), 'Check --chrome-flags and BDG_CHROME_FLAGS (an unknown flag or value can stop Chrome)');
|
|
97
103
|
}
|
|
98
104
|
/**
|
|
99
|
-
*
|
|
105
|
+
* Whether no Chrome was found at all: no installation and no default binary
|
|
106
|
+
* (chrome-launcher's default honors a valid CHROME_PATH).
|
|
107
|
+
*
|
|
108
|
+
* @param diagnostics - Chrome diagnostics
|
|
109
|
+
* @returns True when there is nothing to launch
|
|
110
|
+
*/
|
|
111
|
+
function noChromeFound(diagnostics) {
|
|
112
|
+
return diagnostics.installationCount === 0 && !diagnostics.defaultPath;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* A Chromium-based browser binary that chrome-launcher does not find on its
|
|
116
|
+
* own, as an example value for CHROME_PATH.
|
|
117
|
+
*
|
|
118
|
+
* @param platform - OS the path is for
|
|
119
|
+
* @returns Microsoft Edge's binary on macOS or Linux; none on other systems
|
|
120
|
+
*/
|
|
121
|
+
function exampleChromePath(platform) {
|
|
122
|
+
if (platform === 'darwin')
|
|
123
|
+
return '/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge';
|
|
124
|
+
if (platform === 'linux')
|
|
125
|
+
return '/usr/bin/microsoft-edge';
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* How to point bdg at another Chromium-based browser through CHROME_PATH.
|
|
100
130
|
*
|
|
101
|
-
* @
|
|
131
|
+
* @param platform - OS the example is for
|
|
132
|
+
* @returns Message lines, with an example command where one is known
|
|
102
133
|
*/
|
|
103
|
-
|
|
104
|
-
|
|
134
|
+
function chromePathSuggestion(platform) {
|
|
135
|
+
const example = exampleChromePath(platform);
|
|
136
|
+
if (!example)
|
|
137
|
+
return ['Set CHROME_PATH to a Chromium-based browser (Edge, Brave, Chromium)\n'];
|
|
138
|
+
return [
|
|
139
|
+
'Set CHROME_PATH to a Chromium-based browser (Edge, Brave, Chromium), e.g.:',
|
|
140
|
+
` CHROME_PATH="${example}" ${sessionCommand('bdg <url>')}\n`,
|
|
141
|
+
];
|
|
105
142
|
}
|
|
106
143
|
/**
|
|
107
144
|
* Format Chrome diagnostics for error reporting when Chrome launch fails.
|
|
108
145
|
*
|
|
109
146
|
* @param diagnostics - Chrome diagnostics information
|
|
147
|
+
* @param options - Platform of the example and whether to suggest CHROME_PATH
|
|
110
148
|
* @returns Formatted error message lines with troubleshooting steps
|
|
111
149
|
*
|
|
112
150
|
* @example
|
|
@@ -116,11 +154,13 @@ export function getFormattedDiagnostics() {
|
|
|
116
154
|
* console.error(errorLines.join('\n'));
|
|
117
155
|
* ```
|
|
118
156
|
*/
|
|
119
|
-
export function formatDiagnosticsForError(diagnostics) {
|
|
157
|
+
export function formatDiagnosticsForError(diagnostics, { platform = process.platform, suggestChromePath = true } = {}) {
|
|
120
158
|
const lines = [];
|
|
121
|
-
if (diagnostics
|
|
159
|
+
if (noChromeFound(diagnostics)) {
|
|
122
160
|
lines.push('Error: No Chrome installations detected\n');
|
|
123
|
-
|
|
161
|
+
if (suggestChromePath)
|
|
162
|
+
lines.push(...chromePathSuggestion(platform));
|
|
163
|
+
lines.push(suggestChromePath ? 'Or install Chrome from:' : 'Install Chrome from:');
|
|
124
164
|
lines.push(' https://www.google.com/chrome/\n');
|
|
125
165
|
}
|
|
126
166
|
else {
|
|
@@ -274,10 +314,36 @@ export function chromeBinaryOverrideIsDirectory(path, source) {
|
|
|
274
314
|
* Generate error when CDP port is already in use.
|
|
275
315
|
*
|
|
276
316
|
* @param port - Port number that is in use
|
|
317
|
+
* @param reason - What was found on the port, when known
|
|
277
318
|
* @returns Multi-line formatted error message with troubleshooting steps
|
|
278
319
|
*/
|
|
279
|
-
export function portInUseError(port) {
|
|
280
|
-
return joinLines(`Port ${port} is already in use.\n`, 'Another program (or a Chrome left from a previous session) is listening on it.\n', 'Try:', ` - Use a different port: ${sessionCommand(`bdg <url> --port ${port + 1}`)}`, ` - If a bdg session holds it: find it with bdg sessions, then end that one: bdg stop --session <name> (bdg cleanup --force --session <name> if it is stuck)`, ` - See what uses the port: lsof -i :${port}`);
|
|
320
|
+
export function portInUseError(port, reason) {
|
|
321
|
+
return joinLines(reason ? `Port ${port} is already in use: ${reason}.\n` : `Port ${port} is already in use.\n`, 'Another program (or a Chrome left from a previous session) is listening on it.\n', 'Try:', ` - Use a different port: ${sessionCommand(`bdg <url> --port ${port + 1}`)}`, ` - If a bdg session holds it: find it with bdg sessions, then end that one: bdg stop --session <name> (bdg cleanup --force --session <name> if it is stuck)`, ` - See what uses the port: lsof -i :${port}`);
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Why a launched Chrome is not the one answering on 127.0.0.1:<port>.
|
|
325
|
+
*
|
|
326
|
+
* @param answeredBy - What answers there: a different browser, another
|
|
327
|
+
* process, or nothing (the address is held but does not answer)
|
|
328
|
+
* @param chromeHost - Address the launched Chrome listens on
|
|
329
|
+
* @returns Reason for the PORT_IN_USE issue
|
|
330
|
+
*/
|
|
331
|
+
export function portTakenByReason(answeredBy, chromeHost) {
|
|
332
|
+
if (answeredBy === 'nothing')
|
|
333
|
+
return `something holds 127.0.0.1 (Chrome fell back to ${chromeHost})`;
|
|
334
|
+
const other = answeredBy === 'browser' ? 'another browser' : 'another process';
|
|
335
|
+
return `${other} answers on 127.0.0.1 (Chrome listens on ${chromeHost})`;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Why a launch failed when Chrome announced its port but did not answer on
|
|
339
|
+
* it in time (a slow start, not a port conflict).
|
|
340
|
+
*
|
|
341
|
+
* @param port - Port Chrome announced
|
|
342
|
+
* @param waitedMs - How long bdg waited
|
|
343
|
+
* @returns Reason for the CHROME_LAUNCH_FAILED issue
|
|
344
|
+
*/
|
|
345
|
+
export function chromeNotAnsweringReason(port, waitedMs) {
|
|
346
|
+
return `Chrome announced port ${port} but did not answer on 127.0.0.1 within ${(waitedMs / 1000).toFixed(1)}s (slow start)`;
|
|
281
347
|
}
|
|
282
348
|
/**
|
|
283
349
|
* Warning when bdg's Chrome preferences (password manager and leak check
|
|
@@ -134,14 +134,13 @@ export declare function valueMismatchWarning(mismatch: FillValueMismatch): strin
|
|
|
134
134
|
*/
|
|
135
135
|
export declare const CLICK_NOT_RECEIVED_WARNING = "The click may not have reached the element: the page saw no mouse press (the browser may be showing a dialog or bubble that captures input)";
|
|
136
136
|
/**
|
|
137
|
-
* Note under a shortened list
|
|
137
|
+
* Note under a shortened human list whose JSON output lists more, up to a cap.
|
|
138
138
|
*
|
|
139
|
-
* @param hidden -
|
|
140
|
-
* @param jsonLimit -
|
|
141
|
-
* @returns e.g. "... and
|
|
142
|
-
* "... and 8980 more (--json lists the first 100)"
|
|
139
|
+
* @param hidden - Items not listed
|
|
140
|
+
* @param jsonLimit - Most items the JSON output lists
|
|
141
|
+
* @returns e.g. "... and 8980 more (--json lists up to 100)"
|
|
143
142
|
*/
|
|
144
|
-
export declare function moreMatchesNote(hidden: number, jsonLimit
|
|
143
|
+
export declare function moreMatchesNote(hidden: number, jsonLimit: number): string;
|
|
145
144
|
/**
|
|
146
145
|
* Note under `dom query` matches cut by `--limit`.
|
|
147
146
|
*
|
|
@@ -158,6 +157,20 @@ export declare function queryMoreMatchesNote(omitted: number, indexed?: number):
|
|
|
158
157
|
* @returns e.g. `Visibility is checked for the first 100 matches only; bdg dom layout <index> checks any of them`
|
|
159
158
|
*/
|
|
160
159
|
export declare function queryViewportCheckedNote(checked: number): string;
|
|
160
|
+
/**
|
|
161
|
+
* First line under an accessibility tree cut by `--limit` or `--depth`.
|
|
162
|
+
*
|
|
163
|
+
* @param listed - Nodes listed
|
|
164
|
+
* @returns e.g. "Showing the first 50 nodes (text boxes and repeated text left out)"
|
|
165
|
+
*/
|
|
166
|
+
export declare function a11yTreeShownNote(listed: number): string;
|
|
167
|
+
/**
|
|
168
|
+
* How to see the rest of an accessibility tree cut by `--limit` or `--depth`.
|
|
169
|
+
*
|
|
170
|
+
* @param omitted - Nodes left out
|
|
171
|
+
* @returns e.g. "51391 more: --limit 0 lists all, --depth <n> limits the levels, or search with bdg dom a11y query \"role:<role>\""
|
|
172
|
+
*/
|
|
173
|
+
export declare function a11yTreeMoreNote(omitted: number): string;
|
|
161
174
|
/**
|
|
162
175
|
* Note under a list of a11y query matches cut by `--limit`.
|
|
163
176
|
*
|
|
@@ -362,10 +375,11 @@ export declare function coverText(cover: string, transparent: boolean | undefine
|
|
|
362
375
|
* Note when `bdg dom inspect` could not read the element's matched rules, so
|
|
363
376
|
* no hints, rules or why were computed.
|
|
364
377
|
*
|
|
365
|
-
* @param reason - `timeout` (very large stylesheets)
|
|
378
|
+
* @param reason - `timeout` (very large stylesheets), `failed` (Chrome reported
|
|
379
|
+
* an error) or `skipped` (hints not read: an earlier read on this page timed out)
|
|
366
380
|
* @returns Note
|
|
367
381
|
*/
|
|
368
|
-
export declare function inspectCascadeNote(reason: 'timeout' | 'failed'): string;
|
|
382
|
+
export declare function inspectCascadeNote(reason: 'timeout' | 'failed' | 'skipped'): string;
|
|
369
383
|
/**
|
|
370
384
|
* Note of `bdg dom inspect` when the selector named a pseudo-element: its
|
|
371
385
|
* element is inspected and the pseudo-element is on the `pseudo` line.
|
|
@@ -835,5 +849,12 @@ export declare const CSS_SEARCH_HELP_EXAMPLES = "\nExamples:\n bdg css search -
|
|
|
835
849
|
* @returns Note
|
|
836
850
|
*/
|
|
837
851
|
export declare function helpJsonDetailsNote(): string;
|
|
852
|
+
/**
|
|
853
|
+
* Pointer after a value cut for human output.
|
|
854
|
+
*
|
|
855
|
+
* @param count - Characters left out
|
|
856
|
+
* @returns e.g. `… 299800 more chars (use --full)`
|
|
857
|
+
*/
|
|
858
|
+
export declare function moreCharsNote(count: number): string;
|
|
838
859
|
export {};
|
|
839
860
|
//# sourceMappingURL=commands.d.ts.map
|