@vforsh/argus 0.1.8 → 0.1.10
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 +11 -314
- package/dist/.tsbuildinfo +1 -1
- package/dist/argus.js +23749 -887
- package/dist/bin.js +4 -0
- package/dist/bin.js.map +1 -1
- package/dist/cli/register/registerAuth.d.ts +3 -0
- package/dist/cli/register/registerAuth.d.ts.map +1 -0
- package/dist/cli/register/registerAuth.js +29 -0
- package/dist/cli/register/registerAuth.js.map +1 -0
- package/dist/cli/register/registerCode.d.ts +3 -0
- package/dist/cli/register/registerCode.d.ts.map +1 -0
- package/dist/cli/register/registerCode.js +55 -0
- package/dist/cli/register/registerCode.js.map +1 -0
- package/dist/cli/register/registerDom.d.ts.map +1 -1
- package/dist/cli/register/registerDom.js +0 -17
- package/dist/cli/register/registerDom.js.map +1 -1
- package/dist/cli/register/registerEval.d.ts.map +1 -1
- package/dist/cli/register/registerEval.js +1 -0
- package/dist/cli/register/registerEval.js.map +1 -1
- package/dist/cli/register/registerTrace.d.ts.map +1 -1
- package/dist/cli/register/registerTrace.js +25 -7
- package/dist/cli/register/registerTrace.js.map +1 -1
- package/dist/cli/register/registerWatcher.js +2 -2
- package/dist/cli/register/registerWatcher.js.map +1 -1
- package/dist/commands/auth.d.ts +22 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +168 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/chrome.d.ts.map +1 -1
- package/dist/commands/chrome.js +38 -11
- package/dist/commands/chrome.js.map +1 -1
- package/dist/commands/code.d.ts +32 -0
- package/dist/commands/code.d.ts.map +1 -0
- package/dist/commands/code.js +315 -0
- package/dist/commands/code.js.map +1 -0
- package/dist/commands/domSetFile.d.ts.map +1 -1
- package/dist/commands/domSetFile.js +0 -5
- package/dist/commands/domSetFile.js.map +1 -1
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +1 -0
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/trace.d.ts +1 -0
- package/dist/commands/trace.d.ts.map +1 -1
- package/dist/commands/trace.js +7 -5
- package/dist/commands/trace.js.map +1 -1
- package/dist/commands/watcherNativeHost.d.ts.map +1 -1
- package/dist/commands/watcherNativeHost.js +2 -1
- package/dist/commands/watcherNativeHost.js.map +1 -1
- package/dist/commands/watcherStart.d.ts.map +1 -1
- package/dist/commands/watcherStart.js +2 -1
- package/dist/commands/watcherStart.js.map +1 -1
- package/dist/eval/evalClient.d.ts +1 -0
- package/dist/eval/evalClient.d.ts.map +1 -1
- package/dist/eval/evalClient.js +2 -0
- package/dist/eval/evalClient.js.map +1 -1
- package/dist/output/code.d.ts +7 -0
- package/dist/output/code.d.ts.map +1 -0
- package/dist/output/code.js +16 -0
- package/dist/output/code.js.map +1 -0
- package/dist/runtime-code/format.d.ts +6 -0
- package/dist/runtime-code/format.d.ts.map +1 -0
- package/dist/runtime-code/format.js +89 -0
- package/dist/runtime-code/format.js.map +1 -0
- package/dist/runtime-code/strings.d.ts +13 -0
- package/dist/runtime-code/strings.d.ts.map +1 -0
- package/dist/runtime-code/strings.js +225 -0
- package/dist/runtime-code/strings.js.map +1 -0
- package/dist/runtime-code/types.d.ts +31 -0
- package/dist/runtime-code/types.d.ts.map +1 -0
- package/dist/runtime-code/types.js +2 -0
- package/dist/runtime-code/types.js.map +1 -0
- package/package.json +5 -3
- package/dist/commands/contexts.d.ts +0 -7
- package/dist/commands/contexts.d.ts.map +0 -1
- package/dist/commands/contexts.js +0 -54
- package/dist/commands/contexts.js.map +0 -1
- package/dist/commands/domDiff.d.ts +0 -43
- package/dist/commands/domDiff.d.ts.map +0 -1
- package/dist/commands/domDiff.js +0 -279
- package/dist/commands/domDiff.js.map +0 -1
- package/dist/commands/domSubmit.d.ts +0 -10
- package/dist/commands/domSubmit.d.ts.map +0 -1
- package/dist/commands/domSubmit.js +0 -78
- package/dist/commands/domSubmit.js.map +0 -1
- package/dist/commands/extension/attach.d.ts +0 -8
- package/dist/commands/extension/attach.d.ts.map +0 -1
- package/dist/commands/extension/attach.js +0 -171
- package/dist/commands/extension/attach.js.map +0 -1
- package/dist/commands/extension/detach.d.ts +0 -6
- package/dist/commands/extension/detach.d.ts.map +0 -1
- package/dist/commands/extension/detach.js +0 -132
- package/dist/commands/extension/detach.js.map +0 -1
- package/dist/commands/extension/targets.d.ts +0 -13
- package/dist/commands/extension/targets.d.ts.map +0 -1
- package/dist/commands/extension/targets.js +0 -77
- package/dist/commands/extension/targets.js.map +0 -1
- package/dist/commands/frames.d.ts +0 -7
- package/dist/commands/frames.d.ts.map +0 -1
- package/dist/commands/frames.js +0 -90
- package/dist/commands/frames.js.map +0 -1
- package/dist/frame/frameSelector.d.ts +0 -14
- package/dist/frame/frameSelector.d.ts.map +0 -1
- package/dist/frame/frameSelector.js +0 -31
- package/dist/frame/frameSelector.js.map +0 -1
- package/dist/output/domDiff.d.ts +0 -14
- package/dist/output/domDiff.d.ts.map +0 -1
- package/dist/output/domDiff.js +0 -151
- package/dist/output/domDiff.js.map +0 -1
- package/dist/throttle/networkPresets.d.ts +0 -6
- package/dist/throttle/networkPresets.d.ts.map +0 -1
- package/dist/throttle/networkPresets.js +0 -24
- package/dist/throttle/networkPresets.js.map +0 -1
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { fetchJson } from '../../httpClient.js';
|
|
2
|
-
import { createOutput } from '../../output/io.js';
|
|
3
|
-
import { resolveWatcher } from '../../watchers/resolveWatcher.js';
|
|
4
|
-
import { writeWatcherCandidates } from '../../watchers/candidates.js';
|
|
5
|
-
export const runExtensionAttach = async (id, options) => {
|
|
6
|
-
const output = createOutput(options);
|
|
7
|
-
const resolved = await resolveWatcher({ id });
|
|
8
|
-
if (!resolved.ok) {
|
|
9
|
-
output.writeWarn(resolved.error);
|
|
10
|
-
if (resolved.candidates && resolved.candidates.length > 0) {
|
|
11
|
-
writeWatcherCandidates(resolved.candidates, output);
|
|
12
|
-
}
|
|
13
|
-
process.exitCode = resolved.exitCode;
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
const { watcher } = resolved;
|
|
17
|
-
const baseUrl = `http://${watcher.host}:${watcher.port}`;
|
|
18
|
-
// If tabId is provided directly, use it
|
|
19
|
-
if (options.tabId) {
|
|
20
|
-
const tabIdNum = parseInt(options.tabId, 10);
|
|
21
|
-
if (isNaN(tabIdNum)) {
|
|
22
|
-
output.writeWarn(`Invalid tabId: ${options.tabId}`);
|
|
23
|
-
process.exitCode = 2;
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
await attachToTab(baseUrl, tabIdNum, options.tabId, output, options.json);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
// Otherwise, we need to find a matching tab
|
|
30
|
-
if (!options.url && !options.title) {
|
|
31
|
-
output.writeWarn('Either --tab-id, --url, or --title is required.');
|
|
32
|
-
output.writeWarn('');
|
|
33
|
-
output.writeWarn('Examples:');
|
|
34
|
-
output.writeWarn(' argus ext attach app --tab-id 123456789');
|
|
35
|
-
output.writeWarn(' argus ext attach app --url localhost:3000');
|
|
36
|
-
output.writeWarn(' argus ext attach app --title "My App"');
|
|
37
|
-
process.exitCode = 2;
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
// Fetch available targets
|
|
41
|
-
let targetsResponse;
|
|
42
|
-
try {
|
|
43
|
-
targetsResponse = await fetchJson(`${baseUrl}/targets`, { timeoutMs: 5_000, returnErrorResponse: true });
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
output.writeWarn(`Failed to fetch targets: ${error instanceof Error ? error.message : error}`);
|
|
47
|
-
process.exitCode = 1;
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
if (!targetsResponse.ok || !targetsResponse.targets) {
|
|
51
|
-
const message = targetsResponse.error?.message ?? 'Unknown error';
|
|
52
|
-
if (targetsResponse.error?.code === 'not_available' || targetsResponse.error?.code === 'not_found') {
|
|
53
|
-
output.writeWarn(`Watcher "${watcher.id}" is not in extension mode.`);
|
|
54
|
-
output.writeWarn('Start the watcher with --source extension to use this command.');
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
output.writeWarn(`Failed to list targets: ${message}`);
|
|
58
|
-
}
|
|
59
|
-
process.exitCode = 1;
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const { targets } = targetsResponse;
|
|
63
|
-
// Filter to non-attached targets
|
|
64
|
-
const available = targets.filter((t) => !t.attached);
|
|
65
|
-
if (available.length === 0) {
|
|
66
|
-
output.writeWarn('No available tabs to attach.');
|
|
67
|
-
const attached = targets.filter((t) => t.attached);
|
|
68
|
-
if (attached.length > 0) {
|
|
69
|
-
output.writeWarn(`Already attached to ${attached.length} tab(s).`);
|
|
70
|
-
}
|
|
71
|
-
process.exitCode = 1;
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
// Find matching tabs
|
|
75
|
-
const matches = available.filter((target) => {
|
|
76
|
-
if (options.url && !target.url.toLowerCase().includes(options.url.toLowerCase())) {
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
if (options.title && !target.title.toLowerCase().includes(options.title.toLowerCase())) {
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
return true;
|
|
83
|
-
});
|
|
84
|
-
if (matches.length === 0) {
|
|
85
|
-
output.writeWarn('No tabs match the specified criteria.');
|
|
86
|
-
output.writeWarn('');
|
|
87
|
-
output.writeWarn('Available tabs:');
|
|
88
|
-
for (const target of available.slice(0, 5)) {
|
|
89
|
-
output.writeWarn(` [${target.id}] ${truncate(target.title, 40)} - ${truncate(target.url, 50)}`);
|
|
90
|
-
}
|
|
91
|
-
if (available.length > 5) {
|
|
92
|
-
output.writeWarn(` ... and ${available.length - 5} more`);
|
|
93
|
-
}
|
|
94
|
-
process.exitCode = 1;
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
if (matches.length > 1) {
|
|
98
|
-
output.writeWarn(`Multiple tabs match (${matches.length}). Be more specific or use --tab-id.`);
|
|
99
|
-
output.writeWarn('');
|
|
100
|
-
output.writeWarn('Matching tabs:');
|
|
101
|
-
for (const target of matches.slice(0, 5)) {
|
|
102
|
-
output.writeWarn(` [${target.id}] ${truncate(target.title, 40)} - ${truncate(target.url, 50)}`);
|
|
103
|
-
}
|
|
104
|
-
if (matches.length > 5) {
|
|
105
|
-
output.writeWarn(` ... and ${matches.length - 5} more`);
|
|
106
|
-
}
|
|
107
|
-
process.exitCode = 1;
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
// Attach to the single match
|
|
111
|
-
const target = matches[0];
|
|
112
|
-
const tabIdNum = parseInt(target.id, 10);
|
|
113
|
-
await attachToTab(baseUrl, tabIdNum, target.id, output, options.json, target);
|
|
114
|
-
};
|
|
115
|
-
const attachToTab = async (baseUrl, tabId, tabIdStr, output, json, target) => {
|
|
116
|
-
let response;
|
|
117
|
-
try {
|
|
118
|
-
response = await fetchJson(`${baseUrl}/attach`, {
|
|
119
|
-
method: 'POST',
|
|
120
|
-
body: { tabId },
|
|
121
|
-
timeoutMs: 5_000,
|
|
122
|
-
returnErrorResponse: true,
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
catch (error) {
|
|
126
|
-
if (json) {
|
|
127
|
-
output.writeJson({ success: false, error: error instanceof Error ? error.message : String(error) });
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
output.writeWarn(`Failed to attach: ${error instanceof Error ? error.message : error}`);
|
|
131
|
-
}
|
|
132
|
-
process.exitCode = 1;
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
if (!response.ok) {
|
|
136
|
-
const message = response.error?.message ?? 'Unknown error';
|
|
137
|
-
if (json) {
|
|
138
|
-
output.writeJson({ success: false, error: message });
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
output.writeWarn(`Failed to attach: ${message}`);
|
|
142
|
-
}
|
|
143
|
-
process.exitCode = 1;
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
if (json) {
|
|
147
|
-
output.writeJson({
|
|
148
|
-
success: true,
|
|
149
|
-
tabId: tabIdStr,
|
|
150
|
-
title: target?.title ?? null,
|
|
151
|
-
url: target?.url ?? null,
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
output.writeHuman('');
|
|
156
|
-
output.writeHuman(`Attach request sent for tab ${tabIdStr}`);
|
|
157
|
-
if (target) {
|
|
158
|
-
output.writeHuman(` Title: ${target.title}`);
|
|
159
|
-
output.writeHuman(` URL: ${target.url}`);
|
|
160
|
-
}
|
|
161
|
-
output.writeHuman('');
|
|
162
|
-
output.writeHuman('The extension will attach shortly. Chrome will show a debugging indicator.');
|
|
163
|
-
output.writeHuman('');
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
const truncate = (str, maxLen) => {
|
|
167
|
-
if (str.length <= maxLen)
|
|
168
|
-
return str;
|
|
169
|
-
return str.slice(0, maxLen - 3) + '...';
|
|
170
|
-
};
|
|
171
|
-
//# sourceMappingURL=attach.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attach.js","sourceRoot":"","sources":["../../../src/commands/extension/attach.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAsBrE,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EAAE,EAAsB,EAAE,OAA+B,EAAiB,EAAE;IAClH,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,CAAA;IACpC,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;IAC7C,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CA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AAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"detach.d.ts","sourceRoot":"","sources":["../../../src/commands/extension/detach.ts"],"names":[],"mappings":"AAkBA,MAAM,MAAM,sBAAsB,GAAG;IACpC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,OAAO,CAAA;CACd,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAU,IAAI,MAAM,GAAG,SAAS,EAAE,SAAS,sBAAsB,KAAG,OAAO,CAAC,IAAI,CA6E9G,CAAA"}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { fetchJson } from '../../httpClient.js';
|
|
2
|
-
import { createOutput } from '../../output/io.js';
|
|
3
|
-
import { resolveWatcher } from '../../watchers/resolveWatcher.js';
|
|
4
|
-
import { writeWatcherCandidates } from '../../watchers/candidates.js';
|
|
5
|
-
export const runExtensionDetach = async (id, options) => {
|
|
6
|
-
const output = createOutput(options);
|
|
7
|
-
const resolved = await resolveWatcher({ id });
|
|
8
|
-
if (!resolved.ok) {
|
|
9
|
-
output.writeWarn(resolved.error);
|
|
10
|
-
if (resolved.candidates && resolved.candidates.length > 0) {
|
|
11
|
-
writeWatcherCandidates(resolved.candidates, output);
|
|
12
|
-
}
|
|
13
|
-
process.exitCode = resolved.exitCode;
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
const { watcher } = resolved;
|
|
17
|
-
const baseUrl = `http://${watcher.host}:${watcher.port}`;
|
|
18
|
-
// If tabId is provided directly, use it
|
|
19
|
-
if (options.tabId) {
|
|
20
|
-
const tabIdNum = parseInt(options.tabId, 10);
|
|
21
|
-
if (isNaN(tabIdNum)) {
|
|
22
|
-
output.writeWarn(`Invalid tabId: ${options.tabId}`);
|
|
23
|
-
process.exitCode = 2;
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
await detachFromTab(baseUrl, tabIdNum, options.tabId, output, options.json);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
// Otherwise, find attached tabs and detach from the first one (or all)
|
|
30
|
-
let targetsResponse;
|
|
31
|
-
try {
|
|
32
|
-
targetsResponse = await fetchJson(`${baseUrl}/targets`, { timeoutMs: 5_000, returnErrorResponse: true });
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
output.writeWarn(`Failed to fetch targets: ${error instanceof Error ? error.message : error}`);
|
|
36
|
-
process.exitCode = 1;
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
if (!targetsResponse.ok || !targetsResponse.targets) {
|
|
40
|
-
const message = targetsResponse.error?.message ?? 'Unknown error';
|
|
41
|
-
if (targetsResponse.error?.code === 'not_available' || targetsResponse.error?.code === 'not_found') {
|
|
42
|
-
output.writeWarn(`Watcher "${watcher.id}" is not in extension mode.`);
|
|
43
|
-
output.writeWarn('Start the watcher with --source extension to use this command.');
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
output.writeWarn(`Failed to list targets: ${message}`);
|
|
47
|
-
}
|
|
48
|
-
process.exitCode = 1;
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const { targets } = targetsResponse;
|
|
52
|
-
const attached = targets.filter((t) => t.attached);
|
|
53
|
-
if (attached.length === 0) {
|
|
54
|
-
if (options.json) {
|
|
55
|
-
output.writeJson({ success: false, error: 'No tabs currently attached' });
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
output.writeWarn('No tabs currently attached.');
|
|
59
|
-
}
|
|
60
|
-
process.exitCode = 1;
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
if (attached.length > 1) {
|
|
64
|
-
output.writeWarn(`Multiple tabs attached (${attached.length}). Use --tab-id to specify which one.`);
|
|
65
|
-
output.writeWarn('');
|
|
66
|
-
output.writeWarn('Attached tabs:');
|
|
67
|
-
for (const target of attached) {
|
|
68
|
-
output.writeWarn(` [${target.id}] ${truncate(target.title, 40)} - ${truncate(target.url, 50)}`);
|
|
69
|
-
}
|
|
70
|
-
process.exitCode = 1;
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
// Detach from the single attached tab
|
|
74
|
-
const target = attached[0];
|
|
75
|
-
const tabIdNum = parseInt(target.id, 10);
|
|
76
|
-
await detachFromTab(baseUrl, tabIdNum, target.id, output, options.json, target);
|
|
77
|
-
};
|
|
78
|
-
const detachFromTab = async (baseUrl, tabId, tabIdStr, output, json, target) => {
|
|
79
|
-
let response;
|
|
80
|
-
try {
|
|
81
|
-
response = await fetchJson(`${baseUrl}/detach`, {
|
|
82
|
-
method: 'POST',
|
|
83
|
-
body: { tabId },
|
|
84
|
-
timeoutMs: 5_000,
|
|
85
|
-
returnErrorResponse: true,
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
if (json) {
|
|
90
|
-
output.writeJson({ success: false, error: error instanceof Error ? error.message : String(error) });
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
output.writeWarn(`Failed to detach: ${error instanceof Error ? error.message : error}`);
|
|
94
|
-
}
|
|
95
|
-
process.exitCode = 1;
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
if (!response.ok) {
|
|
99
|
-
const message = response.error?.message ?? 'Unknown error';
|
|
100
|
-
if (json) {
|
|
101
|
-
output.writeJson({ success: false, error: message });
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
output.writeWarn(`Failed to detach: ${message}`);
|
|
105
|
-
}
|
|
106
|
-
process.exitCode = 1;
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
if (json) {
|
|
110
|
-
output.writeJson({
|
|
111
|
-
success: true,
|
|
112
|
-
tabId: tabIdStr,
|
|
113
|
-
title: target?.title ?? null,
|
|
114
|
-
url: target?.url ?? null,
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
output.writeHuman('');
|
|
119
|
-
output.writeHuman(`Detach request sent for tab ${tabIdStr}`);
|
|
120
|
-
if (target) {
|
|
121
|
-
output.writeHuman(` Title: ${target.title}`);
|
|
122
|
-
output.writeHuman(` URL: ${target.url}`);
|
|
123
|
-
}
|
|
124
|
-
output.writeHuman('');
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
const truncate = (str, maxLen) => {
|
|
128
|
-
if (str.length <= maxLen)
|
|
129
|
-
return str;
|
|
130
|
-
return str.slice(0, maxLen - 3) + '...';
|
|
131
|
-
};
|
|
132
|
-
//# sourceMappingURL=detach.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"detach.js","sourceRoot":"","sources":["../../../src/commands/extension/detach.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAoBrE,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EAAE,EAAsB,EAAE,OAA+B,EAAiB,EAAE;IAClH,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,CAAA;IACpC,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;IAC7C,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QAClB,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QAChC,IAAI,QAAQ,CAAC,UAAU,IAAI,QAAQ,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3D,sBAAsB,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;QACpD,CAAC;QACD,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAA;QACpC,OAAM;IACP,CAAC;IAED,MAAM,EAAE,OAAO,EAAE,GAAG,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,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,KAAK,CAAA;AACxC,CAAC,CAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type ExtensionTarget = {
|
|
2
|
-
id: string;
|
|
3
|
-
title: string;
|
|
4
|
-
url: string;
|
|
5
|
-
type?: string;
|
|
6
|
-
faviconUrl?: string;
|
|
7
|
-
attached?: boolean;
|
|
8
|
-
};
|
|
9
|
-
export type ExtensionTargetsOptions = {
|
|
10
|
-
json?: boolean;
|
|
11
|
-
};
|
|
12
|
-
export declare const runExtensionTargets: (id: string | undefined, options: ExtensionTargetsOptions) => Promise<void>;
|
|
13
|
-
//# sourceMappingURL=targets.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"targets.d.ts","sourceRoot":"","sources":["../../../src/commands/extension/targets.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,eAAe,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAQD,MAAM,MAAM,uBAAuB,GAAG;IACrC,IAAI,CAAC,EAAE,OAAO,CAAA;CACd,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAU,IAAI,MAAM,GAAG,SAAS,EAAE,SAAS,uBAAuB,KAAG,OAAO,CAAC,IAAI,CA0EhH,CAAA"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { fetchJson } from '../../httpClient.js';
|
|
2
|
-
import { createOutput } from '../../output/io.js';
|
|
3
|
-
import { resolveWatcher } from '../../watchers/resolveWatcher.js';
|
|
4
|
-
import { writeWatcherCandidates } from '../../watchers/candidates.js';
|
|
5
|
-
export const runExtensionTargets = async (id, options) => {
|
|
6
|
-
const output = createOutput(options);
|
|
7
|
-
const resolved = await resolveWatcher({ id });
|
|
8
|
-
if (!resolved.ok) {
|
|
9
|
-
output.writeWarn(resolved.error);
|
|
10
|
-
if (resolved.candidates && resolved.candidates.length > 0) {
|
|
11
|
-
writeWatcherCandidates(resolved.candidates, output);
|
|
12
|
-
}
|
|
13
|
-
process.exitCode = resolved.exitCode;
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
const { watcher } = resolved;
|
|
17
|
-
const url = `http://${watcher.host}:${watcher.port}/targets`;
|
|
18
|
-
let response;
|
|
19
|
-
try {
|
|
20
|
-
response = await fetchJson(url, { timeoutMs: 5_000, returnErrorResponse: true });
|
|
21
|
-
}
|
|
22
|
-
catch (error) {
|
|
23
|
-
output.writeWarn(`Failed to fetch targets: ${error instanceof Error ? error.message : error}`);
|
|
24
|
-
process.exitCode = 1;
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
if (!response.ok || !response.targets) {
|
|
28
|
-
const message = response.error?.message ?? 'Unknown error';
|
|
29
|
-
if (response.error?.code === 'not_available' || response.error?.code === 'not_found') {
|
|
30
|
-
output.writeWarn(`Watcher "${watcher.id}" is not in extension mode.`);
|
|
31
|
-
output.writeWarn('Start the watcher with --source extension to use this command.');
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
output.writeWarn(`Failed to list targets: ${message}`);
|
|
35
|
-
}
|
|
36
|
-
process.exitCode = 1;
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const { targets } = response;
|
|
40
|
-
if (options.json) {
|
|
41
|
-
output.writeJson({ targets });
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
if (targets.length === 0) {
|
|
45
|
-
output.writeHuman('No tabs available.');
|
|
46
|
-
output.writeHuman('');
|
|
47
|
-
output.writeHuman('Make sure Chrome has tabs open and the extension is connected.');
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
const attached = targets.filter((t) => t.attached);
|
|
51
|
-
const available = targets.filter((t) => !t.attached);
|
|
52
|
-
output.writeHuman('');
|
|
53
|
-
if (attached.length > 0) {
|
|
54
|
-
output.writeHuman('ATTACHED:');
|
|
55
|
-
for (const target of attached) {
|
|
56
|
-
output.writeHuman(` [${target.id}] ${truncate(target.title, 50)}`);
|
|
57
|
-
output.writeHuman(` ${truncate(target.url, 60)}`);
|
|
58
|
-
}
|
|
59
|
-
output.writeHuman('');
|
|
60
|
-
}
|
|
61
|
-
if (available.length > 0) {
|
|
62
|
-
output.writeHuman('AVAILABLE:');
|
|
63
|
-
for (const target of available) {
|
|
64
|
-
output.writeHuman(` [${target.id}] ${truncate(target.title, 50)}`);
|
|
65
|
-
output.writeHuman(` ${truncate(target.url, 60)}`);
|
|
66
|
-
}
|
|
67
|
-
output.writeHuman('');
|
|
68
|
-
}
|
|
69
|
-
output.writeHuman(`${attached.length} attached, ${available.length} available`);
|
|
70
|
-
output.writeHuman('');
|
|
71
|
-
};
|
|
72
|
-
const truncate = (str, maxLen) => {
|
|
73
|
-
if (str.length <= maxLen)
|
|
74
|
-
return str;
|
|
75
|
-
return str.slice(0, maxLen - 3) + '...';
|
|
76
|
-
};
|
|
77
|
-
//# sourceMappingURL=targets.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"targets.js","sourceRoot":"","sources":["../../../src/commands/extension/targets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAqBrE,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EAAE,EAAsB,EAAE,OAAgC,EAAiB,EAAE;IACpH,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,CAAA;IACpC,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,EAA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,UAAU,CAAC,cAAc,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,CAAA;QAC5D,CAAC;QACD,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;IACtB,CAAC;IAED,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAA;QAC/B,KAAK,MAAM,MAAM,IAAI,SAAS,EAAE,CAAC;YAChC,MAAM,CAAC,UAAU,CAAC,MAAM,MAAM,CAAC,EAAE,KAAK,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,CAAA;YACnE,MAAM,CAAC,UAAU,CAAC,cAAc,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,CAAA;QAC5D,CAAC;QACD,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;IACtB,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC,MAAM,cAAc,SAAS,CAAC,MAAM,YAAY,CAAC,CAAA;IAC/E,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;AACtB,CAAC,CAAA;AAED,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,MAAc,EAAU,EAAE;IACxD,IAAI,GAAG,CAAC,MAAM,IAAI,MAAM;QAAE,OAAO,GAAG,CAAA;IACpC,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,KAAK,CAAA;AACxC,CAAC,CAAA"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/** Options for the frame list command. */
|
|
2
|
-
export type FrameListOptions = {
|
|
3
|
-
json?: boolean;
|
|
4
|
-
};
|
|
5
|
-
/** Execute the frame list command for a watcher id. */
|
|
6
|
-
export declare const runFramesList: (id: string | undefined, options: FrameListOptions) => Promise<void>;
|
|
7
|
-
//# sourceMappingURL=frames.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"frames.d.ts","sourceRoot":"","sources":["../../src/commands/frames.ts"],"names":[],"mappings":"AAMA,0CAA0C;AAC1C,MAAM,MAAM,gBAAgB,GAAG;IAC9B,IAAI,CAAC,EAAE,OAAO,CAAA;CACd,CAAA;AAED,uDAAuD;AACvD,eAAO,MAAM,aAAa,GAAU,IAAI,MAAM,GAAG,SAAS,EAAE,SAAS,gBAAgB,KAAG,OAAO,CAAC,IAAI,CA2DnG,CAAA"}
|
package/dist/commands/frames.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { fetchJson } from '../httpClient.js';
|
|
2
|
-
import { createOutput } from '../output/io.js';
|
|
3
|
-
import { writeWatcherCandidates } from '../watchers/candidates.js';
|
|
4
|
-
import { resolveWatcher } from '../watchers/resolveWatcher.js';
|
|
5
|
-
/** Execute the frame list command for a watcher id. */
|
|
6
|
-
export const runFramesList = async (id, options) => {
|
|
7
|
-
const output = createOutput(options);
|
|
8
|
-
const resolved = await resolveWatcher({ id });
|
|
9
|
-
if (!resolved.ok) {
|
|
10
|
-
output.writeWarn(resolved.error);
|
|
11
|
-
if (resolved.candidates && resolved.candidates.length > 0) {
|
|
12
|
-
writeWatcherCandidates(resolved.candidates, output);
|
|
13
|
-
output.writeWarn('Hint: run `argus list` to see all watchers.');
|
|
14
|
-
}
|
|
15
|
-
process.exitCode = resolved.exitCode;
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const { watcher } = resolved;
|
|
19
|
-
const url = `http://${watcher.host}:${watcher.port}/frames`;
|
|
20
|
-
let response;
|
|
21
|
-
try {
|
|
22
|
-
response = await fetchJson(url, {
|
|
23
|
-
method: 'GET',
|
|
24
|
-
timeoutMs: 30_000,
|
|
25
|
-
returnErrorResponse: true,
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
output.writeWarn(`${watcher.id}: failed to reach watcher (${formatError(error)})`);
|
|
30
|
-
process.exitCode = 1;
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
if (!response.ok) {
|
|
34
|
-
const errorResp = response;
|
|
35
|
-
if (options.json) {
|
|
36
|
-
output.writeJson(response);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
output.writeWarn(`Error: ${errorResp.error.message}`);
|
|
40
|
-
}
|
|
41
|
-
process.exitCode = 1;
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const successResp = response;
|
|
45
|
-
if (options.json) {
|
|
46
|
-
output.writeJson(successResp);
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
if (successResp.frames.length === 0) {
|
|
50
|
-
output.writeHuman('No frames found');
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
// Pretty print frames
|
|
54
|
-
output.writeHuman(`Found ${successResp.frames.length} frame(s):\n`);
|
|
55
|
-
for (let i = 0; i < successResp.frames.length; i++) {
|
|
56
|
-
const frame = successResp.frames[i];
|
|
57
|
-
output.writeHuman(formatFrame(i, frame));
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
const formatFrame = (index, frame) => {
|
|
61
|
-
const lines = [];
|
|
62
|
-
const indent = ' ';
|
|
63
|
-
const main = frame.isMainFrame ? ' (main)' : '';
|
|
64
|
-
lines.push(`[${index}] ${frame.frameId}${main}`);
|
|
65
|
-
lines.push(`${indent}url: ${frame.url || '(empty)'}`);
|
|
66
|
-
if (frame.name) {
|
|
67
|
-
lines.push(`${indent}name: ${frame.name}`);
|
|
68
|
-
}
|
|
69
|
-
if (frame.securityOrigin) {
|
|
70
|
-
lines.push(`${indent}origin: ${frame.securityOrigin}`);
|
|
71
|
-
}
|
|
72
|
-
if (frame.contextId != null) {
|
|
73
|
-
lines.push(`${indent}contextId: ${frame.contextId}`);
|
|
74
|
-
}
|
|
75
|
-
if (frame.parentId) {
|
|
76
|
-
lines.push(`${indent}parent: ${frame.parentId}`);
|
|
77
|
-
}
|
|
78
|
-
lines.push('');
|
|
79
|
-
return lines.join('\n');
|
|
80
|
-
};
|
|
81
|
-
const formatError = (error) => {
|
|
82
|
-
if (!error) {
|
|
83
|
-
return 'unknown error';
|
|
84
|
-
}
|
|
85
|
-
if (error instanceof Error) {
|
|
86
|
-
return error.message;
|
|
87
|
-
}
|
|
88
|
-
return String(error);
|
|
89
|
-
};
|
|
90
|
-
//# sourceMappingURL=frames.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"frames.js","sourceRoot":"","sources":["../../src/commands/frames.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAO9D,uDAAuD;AACvD,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,EAAsB,EAAE,OAAyB,EAAiB,EAAE;IACvG,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,CAAA;IAEpC,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;IAC7C,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QAClB,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QAChC,IAAI,QAAQ,CAAC,UAAU,IAAI,QAAQ,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3D,sBAAsB,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;YACnD,MAAM,CAAC,SAAS,CAAC,6CAA6C,CAAC,CAAA;QAChE,CAAC;QACD,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAA;QACpC,OAAM;IACP,C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,CAAC;QACpB,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,WAAW,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAA;IACjD,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACd,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACxB,CAAC,CAAA;AAED,MAAM,WAAW,GAAG,CAAC,KAAc,EAAU,EAAE;IAC9C,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,OAAO,eAAe,CAAA;IACvB,CAAC;IACD,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC,OAAO,CAAA;IACrB,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAA;AACrB,CAAC,CAAA"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { FrameSelector } from '@vforsh/argus-core';
|
|
2
|
-
/** Options that contain frame targeting parameters. */
|
|
3
|
-
export type FrameOptions = {
|
|
4
|
-
frame?: string;
|
|
5
|
-
frameName?: string;
|
|
6
|
-
frameId?: string;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Parse frame options into a FrameSelector.
|
|
10
|
-
* Returns null if no frame targeting specified.
|
|
11
|
-
* Returns error message string if invalid options.
|
|
12
|
-
*/
|
|
13
|
-
export declare const parseFrameSelector: (options: FrameOptions) => FrameSelector | null | string;
|
|
14
|
-
//# sourceMappingURL=frameSelector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"frameSelector.d.ts","sourceRoot":"","sources":["../../src/frame/frameSelector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,uDAAuD;AACvD,MAAM,MAAM,YAAY,GAAG;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,YAAY,KAAG,aAAa,GAAG,IAAI,GAAG,MA4BjF,CAAA"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parse frame options into a FrameSelector.
|
|
3
|
-
* Returns null if no frame targeting specified.
|
|
4
|
-
* Returns error message string if invalid options.
|
|
5
|
-
*/
|
|
6
|
-
export const parseFrameSelector = (options) => {
|
|
7
|
-
const optionCount = [options.frame, options.frameName, options.frameId].filter(Boolean).length;
|
|
8
|
-
if (optionCount === 0) {
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
if (optionCount > 1) {
|
|
12
|
-
return 'Cannot combine --frame, --frame-name, and --frame-id; use only one';
|
|
13
|
-
}
|
|
14
|
-
if (options.frame != null) {
|
|
15
|
-
// Check if it's a number (index)
|
|
16
|
-
const parsed = Number(options.frame);
|
|
17
|
-
if (Number.isInteger(parsed) && parsed >= 0) {
|
|
18
|
-
return { type: 'index', value: parsed };
|
|
19
|
-
}
|
|
20
|
-
// Otherwise treat as URL pattern
|
|
21
|
-
return { type: 'url', value: options.frame };
|
|
22
|
-
}
|
|
23
|
-
if (options.frameName != null) {
|
|
24
|
-
return { type: 'name', value: options.frameName };
|
|
25
|
-
}
|
|
26
|
-
if (options.frameId != null) {
|
|
27
|
-
return { type: 'id', value: options.frameId };
|
|
28
|
-
}
|
|
29
|
-
return null;
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=frameSelector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"frameSelector.js","sourceRoot":"","sources":["../../src/frame/frameSelector.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAqB,EAAiC,EAAE;IAC1F,MAAM,WAAW,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAA;IAC9F,IAAI,WAAW,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,IAAI,CAAA;IACZ,CAAC;IACD,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;QACrB,OAAO,oEAAoE,CAAA;IAC5E,CAAC;IAED,IAAI,OAAO,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC;QAC3B,iCAAiC;QACjC,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QACpC,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;YAC7C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;QACxC,CAAC;QACD,iCAAiC;QACjC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAA;IAC7C,CAAC;IAED,IAAI,OAAO,CAAC,SAAS,IAAI,IAAI,EAAE,CAAC;QAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,SAAS,EAAE,CAAA;IAClD,CAAC;IAED,IAAI,OAAO,CAAC,OAAO,IAAI,IAAI,EAAE,CAAC;QAC7B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE,CAAA;IAC9C,CAAC;IAED,OAAO,IAAI,CAAA;AACZ,CAAC,CAAA"}
|
package/dist/output/domDiff.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { DomDiffResponse, DomSnapshotSummary } from '@vforsh/argus-core';
|
|
2
|
-
/**
|
|
3
|
-
* Format a DomDiffResponse for human-readable output.
|
|
4
|
-
*/
|
|
5
|
-
export declare const formatDomDiff: (response: DomDiffResponse) => string;
|
|
6
|
-
/**
|
|
7
|
-
* Format a list of snapshots for human-readable output.
|
|
8
|
-
*/
|
|
9
|
-
export declare const formatSnapshotList: (snapshots: DomSnapshotSummary[]) => string;
|
|
10
|
-
/**
|
|
11
|
-
* Format a snapshot creation result for human-readable output.
|
|
12
|
-
*/
|
|
13
|
-
export declare const formatSnapshotCreated: (name: string | undefined, elementCount: number, file?: string) => string;
|
|
14
|
-
//# sourceMappingURL=domDiff.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"domDiff.d.ts","sourceRoot":"","sources":["../../src/output/domDiff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAkB,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAE7F;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,UAAU,eAAe,KAAG,MAqDzD,CAAA;AA6ED;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,WAAW,kBAAkB,EAAE,KAAG,MAmBpE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,GAAG,SAAS,EAAE,cAAc,MAAM,EAAE,OAAO,MAAM,KAAG,MAcrG,CAAA"}
|