@vscode/component-explorer-cli 0.1.1-7 → 0.1.1-9
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/dist/commands/mcpCommand.d.ts +2 -0
- package/dist/commands/mcpCommand.d.ts.map +1 -1
- package/dist/commands/mcpCommand.js +34 -6
- package/dist/commands/mcpCommand.js.map +1 -1
- package/dist/commands/serveCommand.d.ts +3 -0
- package/dist/commands/serveCommand.d.ts.map +1 -1
- package/dist/commands/serveCommand.js +60 -10
- package/dist/commands/serveCommand.js.map +1 -1
- package/dist/component-explorer-config.schema.json +183 -0
- package/dist/componentExplorer.d.ts +10 -0
- package/dist/componentExplorer.d.ts.map +1 -1
- package/dist/componentExplorer.js +66 -14
- package/dist/componentExplorer.js.map +1 -1
- package/dist/daemon/DaemonContext.d.ts +4 -0
- package/dist/daemon/DaemonContext.d.ts.map +1 -0
- package/dist/daemon/DaemonService.d.ts +43 -20
- package/dist/daemon/DaemonService.d.ts.map +1 -1
- package/dist/daemon/DaemonService.js +56 -7
- package/dist/daemon/DaemonService.js.map +1 -1
- package/dist/daemon/lifecycle.d.ts +8 -3
- package/dist/daemon/lifecycle.d.ts.map +1 -1
- package/dist/daemon/lifecycle.js +27 -10
- package/dist/daemon/lifecycle.js.map +1 -1
- package/dist/daemon/pipeClient.d.ts +6 -1
- package/dist/daemon/pipeClient.d.ts.map +1 -1
- package/dist/daemon/pipeClient.js +19 -6
- package/dist/daemon/pipeClient.js.map +1 -1
- package/dist/daemon/pipeServer.d.ts.map +1 -1
- package/dist/daemon/pipeServer.js +5 -3
- package/dist/daemon/pipeServer.js.map +1 -1
- package/dist/dependencyInstaller.js +1 -1
- package/dist/dependencyInstaller.js.map +1 -1
- package/dist/external/vscode-observables/observables/dist/disposables.js +24 -1
- package/dist/external/vscode-observables/observables/dist/disposables.js.map +1 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/commonFacade/deps.js +1 -4
- package/dist/external/vscode-observables/observables/dist/observableInternal/commonFacade/deps.js.map +1 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/index.js +2 -5
- package/dist/external/vscode-observables/observables/dist/observableInternal/index.js.map +1 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/consoleObservableLogger.js +30 -6
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/consoleObservableLogger.js.map +1 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/baseObservable.js +1 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/baseObservable.js.map +1 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/derived.js +12 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/derived.js.map +1 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/utils/utilsCancellation.js +55 -0
- package/dist/external/vscode-observables/observables/dist/observableInternal/utils/utilsCancellation.js.map +1 -0
- package/dist/formatValue.d.ts +2 -0
- package/dist/formatValue.d.ts.map +1 -0
- package/dist/formatValue.js +96 -0
- package/dist/formatValue.js.map +1 -0
- package/dist/formatValue.test.d.ts +2 -0
- package/dist/formatValue.test.d.ts.map +1 -0
- package/dist/git/gitUtils.js +1 -1
- package/dist/git/gitUtils.js.map +1 -1
- package/dist/httpServer.js +4 -3
- package/dist/httpServer.js.map +1 -1
- package/dist/mcp/McpServer.d.ts +30 -4
- package/dist/mcp/McpServer.d.ts.map +1 -1
- package/dist/mcp/McpServer.js +433 -95
- package/dist/mcp/McpServer.js.map +1 -1
- package/dist/packages/simple-api/dist/{chunk-A5PE72HI.js → chunk-Q24JOMNK.js} +7 -1
- package/dist/packages/simple-api/dist/chunk-Q24JOMNK.js.map +1 -0
- package/dist/utils.d.ts +20 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +22 -1
- package/dist/utils.js.map +1 -1
- package/dist/watchConfig.d.ts +36 -0
- package/dist/watchConfig.d.ts.map +1 -1
- package/dist/watchConfig.js +32 -22
- package/dist/watchConfig.js.map +1 -1
- package/package.json +6 -4
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/debuggerRpc.js +0 -72
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/debuggerRpc.js.map +0 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/devToolsLogger.js +0 -447
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/devToolsLogger.js.map +0 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/rpc.js +0 -64
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/rpc.js.map +0 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/utils.js +0 -52
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugger/utils.js.map +0 -1
- package/dist/packages/simple-api/dist/chunk-A5PE72HI.js.map +0 -1
|
@@ -3,6 +3,8 @@ export declare class McpCommand extends Command {
|
|
|
3
3
|
static paths: string[][];
|
|
4
4
|
static usage: import("clipanion").Usage;
|
|
5
5
|
readonly project: string;
|
|
6
|
+
readonly noAutostart: boolean;
|
|
7
|
+
readonly noAutostartHint: string | undefined;
|
|
6
8
|
execute(): Promise<void>;
|
|
7
9
|
}
|
|
8
10
|
//# sourceMappingURL=mcpCommand.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpCommand.d.ts","sourceRoot":"","sources":["../../src/commands/mcpCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"mcpCommand.d.ts","sourceRoot":"","sources":["../../src/commands/mcpCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAO5C,qBAAa,UAAW,SAAQ,OAAO;IACtC,OAAgB,KAAK,aAAa;IAElC,OAAgB,KAAK,4BAMlB;IAEH,QAAQ,CAAC,OAAO,SAA2I;IAC3J,QAAQ,CAAC,WAAW,UAAoH;IACxI,QAAQ,CAAC,eAAe,qBAAyI;IAE3J,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAqC9B"}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { Command, Option } from 'clipanion';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import '../external/vscode-observables/observables/dist/observableInternal/index.js';
|
|
3
|
+
import { observableValue } from '../external/vscode-observables/observables/dist/observableInternal/observables/observableValue.js';
|
|
4
|
+
import '../external/vscode-observables/observables/dist/observableInternal/debugLocation.js';
|
|
5
|
+
import '../external/vscode-observables/observables/dist/observableInternal/observables/derived.js';
|
|
6
|
+
import '../external/vscode-observables/observables/dist/observableInternal/utils/utils.js';
|
|
7
|
+
import '../external/vscode-observables/observables/dist/observableInternal/observables/observableFromEvent.js';
|
|
8
|
+
import { ensureDaemon, tryConnect } from '../daemon/lifecycle.js';
|
|
9
|
+
import { daemonPipeName } from '../daemon/pipeName.js';
|
|
10
|
+
import { DaemonConnection, ComponentExplorerMcpServer } from '../mcp/McpServer.js';
|
|
4
11
|
import { resolveProject } from '../resolveProject.js';
|
|
5
12
|
|
|
6
13
|
class McpCommand extends Command {
|
|
@@ -9,20 +16,41 @@ class McpCommand extends Command {
|
|
|
9
16
|
description: 'Start an MCP server over stdio. Auto-starts a daemon if not already running.',
|
|
10
17
|
examples: [
|
|
11
18
|
['Start MCP server', '$0 mcp --project config.json'],
|
|
19
|
+
['Require existing daemon', '$0 mcp --project config.json --no-daemon-autostart'],
|
|
12
20
|
],
|
|
13
21
|
});
|
|
14
22
|
project = Option.String('-p,--project,-c', { required: true, description: 'Project: a directory, vite config file, or component-explorer.json' });
|
|
23
|
+
noAutostart = Option.Boolean('--no-daemon-autostart', false, { description: 'Do not auto-start daemon; poll for it instead' });
|
|
24
|
+
noAutostartHint = Option.String('--no-daemon-hint', { description: 'Hint message shown when daemon is not running (used with --no-daemon-autostart)' });
|
|
15
25
|
async execute() {
|
|
16
26
|
const resolved = await resolveProject(this.project);
|
|
17
27
|
if (resolved.kind !== 'explorerConfig') {
|
|
18
28
|
this.context.stderr.write('Error: mcp requires a component-explorer.json config file.\n');
|
|
19
29
|
return;
|
|
20
30
|
}
|
|
21
|
-
|
|
22
|
-
const
|
|
31
|
+
const daemonObservable = observableValue('daemon', undefined);
|
|
32
|
+
const mcpClientName = `mcp-${new Date().toISOString().replace(/[-:]/g, '').replace(/\.\d+Z$/, '')}`;
|
|
33
|
+
let pollFn;
|
|
34
|
+
if (this.noAutostart) {
|
|
35
|
+
const pipeName = daemonPipeName(resolved.configPath);
|
|
36
|
+
pollFn = async () => {
|
|
37
|
+
const client = await tryConnect(pipeName, { clientName: mcpClientName });
|
|
38
|
+
daemonObservable.set(client ? new DaemonConnection(client) : undefined, undefined);
|
|
39
|
+
};
|
|
40
|
+
await pollFn();
|
|
41
|
+
setInterval(pollFn, 5000);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
const daemon = await ensureDaemon(resolved.configPath, { clientName: mcpClientName });
|
|
45
|
+
daemonObservable.set(new DaemonConnection(daemon), undefined);
|
|
46
|
+
}
|
|
23
47
|
// Create and connect the MCP server over stdio
|
|
24
|
-
|
|
25
|
-
|
|
48
|
+
await ComponentExplorerMcpServer.create(daemonObservable, {
|
|
49
|
+
pollFn,
|
|
50
|
+
noAutostartHint: this.noAutostartHint,
|
|
51
|
+
});
|
|
52
|
+
// Keep the process alive until the MCP connection closes
|
|
53
|
+
await new Promise(() => { });
|
|
26
54
|
}
|
|
27
55
|
}
|
|
28
56
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpCommand.js","sources":["../../src/commands/mcpCommand.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mcpCommand.js","sources":["../../src/commands/mcpCommand.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;AAOM,MAAO,UAAW,SAAQ,OAAO,CAAA;IACtC,OAAgB,KAAK,GAAG,CAAC,C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AAM,MAAM,GAAG,MAAM,UAAU,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC;AACxE,gBAAA,gBAAgB,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,gBAAgB,CAAC,MAAM,CAAC,GAAG,SAAS,EAAE,SAAS,CAAC;AACnF,YAAA,CAAC;YACD,MAAM,MAAM,EAAE;AACd,YAAA,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC;QAC1B;aAAO;AACN,YAAA,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC;YACrF,gBAAgB,CAAC,GAAG,CAAC,IAAI,gBAAgB,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;QAC9D;;QAGe,MAAM,0BAA0B,CAAC,MAAM,CAAC,gBAAgB,EAAE;YACxE,MAAM;YACN,eAAe,EAAE,IAAI,CAAC,eAAe;AACrC,SAAA;;QAGD,MAAM,IAAI,OAAO,CAAO,MAAK,EAAE,CAAC,CAAC;IAClC;;;;;"}
|
|
@@ -7,10 +7,13 @@ export declare class ServeCommand extends Command {
|
|
|
7
7
|
readonly background: boolean;
|
|
8
8
|
readonly attach: boolean;
|
|
9
9
|
readonly kill: boolean;
|
|
10
|
+
readonly redirectionPort: string | undefined;
|
|
11
|
+
readonly redirectionHost: string | undefined;
|
|
10
12
|
execute(): Promise<void>;
|
|
11
13
|
private _ensureBackground;
|
|
12
14
|
private _attach;
|
|
13
15
|
private _printEvent;
|
|
14
16
|
private _startDaemon;
|
|
17
|
+
private _startRedirectionServer;
|
|
15
18
|
}
|
|
16
19
|
//# sourceMappingURL=serveCommand.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serveCommand.d.ts","sourceRoot":"","sources":["../../src/commands/serveCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"serveCommand.d.ts","sourceRoot":"","sources":["../../src/commands/serveCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAe5C,qBAAa,YAAa,SAAQ,OAAO;IACxC,OAAgB,KAAK,aAAe;IAEpC,OAAgB,KAAK,4BAgBlB;IAEH,QAAQ,CAAC,OAAO,SAAsG;IACtH,QAAQ,CAAC,OAAO,SAA2I;IAC3J,QAAQ,CAAC,UAAU,UAAoG;IACvH,QAAQ,CAAC,MAAM,UAAsG;IACrH,QAAQ,CAAC,IAAI,UAAkF;IAC/F,QAAQ,CAAC,eAAe,qBAA8H;IACtJ,QAAQ,CAAC,eAAe,qBAAsH;IAExI,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;YAuDhB,iBAAiB;YA0BjB,OAAO;IAgBrB,OAAO,CAAC,WAAW;YAeL,YAAY;IA+C1B,OAAO,CAAC,uBAAuB;CAyB/B"}
|
|
@@ -2,6 +2,7 @@ import { Command, Option } from 'clipanion';
|
|
|
2
2
|
import { spawn } from 'node:child_process';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import * as path from 'node:path';
|
|
5
|
+
import * as http from 'node:http';
|
|
5
6
|
import { ConsoleLogger, verbosityToLogLevel } from '../logger.js';
|
|
6
7
|
import { ResolvedWatchConfig } from '../watchConfig.js';
|
|
7
8
|
import { DaemonService } from '../daemon/DaemonService.js';
|
|
@@ -9,6 +10,7 @@ import { startPipeServer } from '../daemon/pipeServer.js';
|
|
|
9
10
|
import { daemonPipeName } from '../daemon/pipeName.js';
|
|
10
11
|
import { tryConnect, waitForDaemon } from '../daemon/lifecycle.js';
|
|
11
12
|
import { resolveProject } from '../resolveProject.js';
|
|
13
|
+
import { buildExplorerUrl } from '../utils.js';
|
|
12
14
|
|
|
13
15
|
class ServeCommand extends Command {
|
|
14
16
|
static paths = [['serve']];
|
|
@@ -34,6 +36,8 @@ Without flags: starts a foreground daemon. Errors if one is already running.
|
|
|
34
36
|
background = Option.Boolean('--background', false, { description: 'Spawn as a detached background process' });
|
|
35
37
|
attach = Option.Boolean('--attach', false, { description: 'Attach to a running daemon and stream events' });
|
|
36
38
|
kill = Option.Boolean('--kill', false, { description: 'Shut down a running daemon' });
|
|
39
|
+
redirectionPort = Option.String('--redirectionPort', { description: 'Start an HTTP server that redirects /___explorer to the session URL' });
|
|
40
|
+
redirectionHost = Option.String('--redirectionHost', { description: 'Host to bind the redirection server to (default: localhost)' });
|
|
37
41
|
async execute() {
|
|
38
42
|
const resolved = await resolveProject(this.project);
|
|
39
43
|
if (resolved.kind !== 'explorerConfig') {
|
|
@@ -43,7 +47,7 @@ Without flags: starts a foreground daemon. Errors if one is already running.
|
|
|
43
47
|
const configPath = resolved.configPath;
|
|
44
48
|
const pipeName = daemonPipeName(configPath);
|
|
45
49
|
if (this.kill) {
|
|
46
|
-
const client = await tryConnect(pipeName);
|
|
50
|
+
const client = await tryConnect(pipeName, { clientName: 'cli-kill' });
|
|
47
51
|
if (!client) {
|
|
48
52
|
this.context.stderr.write('No daemon running.\n');
|
|
49
53
|
return;
|
|
@@ -53,9 +57,8 @@ Without flags: starts a foreground daemon. Errors if one is already running.
|
|
|
53
57
|
return;
|
|
54
58
|
}
|
|
55
59
|
if (this.background && this.attach) {
|
|
56
|
-
// Ensure daemon is running, then attach
|
|
57
60
|
await this._ensureBackground(pipeName, configPath);
|
|
58
|
-
const client = await tryConnect(pipeName);
|
|
61
|
+
const client = await tryConnect(pipeName, { clientName: 'cli-attach' });
|
|
59
62
|
if (!client) {
|
|
60
63
|
this.context.stderr.write('Failed to connect after starting daemon.\n');
|
|
61
64
|
return;
|
|
@@ -66,7 +69,7 @@ Without flags: starts a foreground daemon. Errors if one is already running.
|
|
|
66
69
|
return this._ensureBackground(pipeName, configPath);
|
|
67
70
|
}
|
|
68
71
|
if (this.attach) {
|
|
69
|
-
const client = await tryConnect(pipeName);
|
|
72
|
+
const client = await tryConnect(pipeName, { clientName: 'cli-attach' });
|
|
70
73
|
if (!client) {
|
|
71
74
|
this.context.stderr.write(`No daemon running. Start one first:\n $0 serve --project ${this.project}\n`);
|
|
72
75
|
return;
|
|
@@ -74,22 +77,31 @@ Without flags: starts a foreground daemon. Errors if one is already running.
|
|
|
74
77
|
return this._attach(client, pipeName);
|
|
75
78
|
}
|
|
76
79
|
// Default: start foreground daemon
|
|
77
|
-
const existing = await tryConnect(pipeName);
|
|
80
|
+
const existing = await tryConnect(pipeName, { clientName: 'cli-serve' });
|
|
78
81
|
if (existing) {
|
|
79
|
-
this.context.stderr.write(`Daemon already running (pipe: ${pipeName}).\
|
|
82
|
+
this.context.stderr.write(`Daemon already running (pipe: ${pipeName}).\n`);
|
|
83
|
+
this.context.stderr.write(` Attach: component-explorer serve -c ${configPath} --attach\n`);
|
|
84
|
+
this.context.stderr.write(` Kill: component-explorer serve -c ${configPath} --kill\n`);
|
|
80
85
|
return;
|
|
81
86
|
}
|
|
82
87
|
return this._startDaemon(pipeName, configPath);
|
|
83
88
|
}
|
|
84
89
|
async _ensureBackground(pipeName, configPath) {
|
|
85
|
-
if (await tryConnect(pipeName)) {
|
|
90
|
+
if (await tryConnect(pipeName, { clientName: 'cli-serve' })) {
|
|
86
91
|
this.context.stdout.write('Daemon already running.\n');
|
|
87
92
|
return;
|
|
88
93
|
}
|
|
89
94
|
const cliEntryPoint = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../index.js');
|
|
90
|
-
const
|
|
95
|
+
const args = [cliEntryPoint, 'serve', '--project', configPath];
|
|
96
|
+
if (this.redirectionPort) {
|
|
97
|
+
args.push('--redirectionPort', this.redirectionPort);
|
|
98
|
+
}
|
|
99
|
+
if (this.redirectionHost) {
|
|
100
|
+
args.push('--redirectionHost', this.redirectionHost);
|
|
101
|
+
}
|
|
102
|
+
const child = spawn(process.execPath, args, { detached: true, stdio: 'ignore', windowsHide: true });
|
|
91
103
|
child.unref();
|
|
92
|
-
await waitForDaemon(pipeName, { timeoutMs: 30_000 });
|
|
104
|
+
await waitForDaemon(pipeName, { timeoutMs: 30_000, clientName: 'cli-serve' });
|
|
93
105
|
this.context.stdout.write(`Daemon started (pipe: ${pipeName})\n`);
|
|
94
106
|
}
|
|
95
107
|
async _attach(client, pipeName) {
|
|
@@ -127,17 +139,55 @@ Without flags: starts a foreground daemon. Errors if one is already running.
|
|
|
127
139
|
this.context.stdout.write('Press Ctrl+C to stop.\n\n');
|
|
128
140
|
const sessionInfos = service.getSessionInfos();
|
|
129
141
|
for (const s of sessionInfos) {
|
|
130
|
-
|
|
142
|
+
if (s.isLoading) {
|
|
143
|
+
this.context.stdout.write(` ${s.name}: (loading) (${s.sourceKind})\n`);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
const explorerUrl = buildExplorerUrl({ baseUrl: s.serverUrl });
|
|
147
|
+
this.context.stdout.write(` ${s.name}: ${explorerUrl} (${s.sourceKind})\n`);
|
|
148
|
+
}
|
|
131
149
|
}
|
|
132
150
|
this.context.stdout.write('\n');
|
|
151
|
+
let redirectServer;
|
|
152
|
+
const redirectPort = this.redirectionPort
|
|
153
|
+
? parseInt(this.redirectionPort, 10)
|
|
154
|
+
: resolvedConfig.redirection?.port;
|
|
155
|
+
const redirectHost = this.redirectionHost ?? resolvedConfig.redirection?.host ?? 'localhost';
|
|
156
|
+
if (redirectPort) {
|
|
157
|
+
redirectServer = this._startRedirectionServer(service, redirectPort, redirectHost);
|
|
158
|
+
}
|
|
133
159
|
process.on('SIGINT', () => {
|
|
134
160
|
service.requestShutdown();
|
|
135
161
|
});
|
|
136
162
|
await service.runEventLoop();
|
|
137
163
|
this.context.stdout.write('\nShutting down...\n');
|
|
164
|
+
redirectServer?.dispose();
|
|
138
165
|
server.close();
|
|
139
166
|
await service.dispose();
|
|
140
167
|
}
|
|
168
|
+
_startRedirectionServer(service, port, host) {
|
|
169
|
+
const server = http.createServer(async (req, res) => {
|
|
170
|
+
const url = new URL(req.url ?? '/', `http://${req.headers.host}`);
|
|
171
|
+
const sessionName = url.searchParams.get('sessionName');
|
|
172
|
+
try {
|
|
173
|
+
const session = await service.waitForSession(sessionName ?? undefined);
|
|
174
|
+
const target = new URL(session.serverUrl);
|
|
175
|
+
target.pathname = url.pathname;
|
|
176
|
+
url.searchParams.delete('sessionName');
|
|
177
|
+
target.search = url.search;
|
|
178
|
+
res.writeHead(302, { Location: target.href });
|
|
179
|
+
res.end();
|
|
180
|
+
}
|
|
181
|
+
catch {
|
|
182
|
+
res.writeHead(503);
|
|
183
|
+
res.end('Session not available.\\n');
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
server.listen(port, host, () => {
|
|
187
|
+
this.context.stdout.write(`Redirection server listening on http://${host}:${port}\\n`);
|
|
188
|
+
});
|
|
189
|
+
return { dispose: () => server.close() };
|
|
190
|
+
}
|
|
141
191
|
}
|
|
142
192
|
|
|
143
193
|
export { ServeCommand };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serveCommand.js","sources":["../../src/commands/serveCommand.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serveCommand.js","sources":["../../src/commands/serveCommand.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;AAeM,MAAO,YAAa,SAAQ,OAAO,CAAA;IACxC,OAAgB,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC;AAEnC,IAAA,OAAgB,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;AACrC,QAAA,WAAW,EAAE,iDAAiD;AAC9D,QAAA,OAAO,EAAE;;;;;;AAMR,EAAA,CAAA;AACD,QAAA,QAAQ,EAAE;YACT,CAAC,qBAAqB,EAAE,yBAAyB,CAAC;YAClD,CAAC,qBAAqB,EAAE,sCAAsC,CAAC;YAC/D,CAAC,0BAA0B,EAAE,kCAAkC,CAAC;YAChE,CAAC,wBAAwB,EAAE,+CAA+C,CAAC;YAC3E,CAAC,qBAAqB,EAAE,gCAAgC,CAAC;AACzD,SAAA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AAA,CAAC,CAAC;QAEF,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC,KAAK,EAAE,EAAE;IACzC;;;;;"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"screenshotDir": {
|
|
6
|
+
"description": "Directory for storing screenshots (default: .screenshots)",
|
|
7
|
+
"type": "string"
|
|
8
|
+
},
|
|
9
|
+
"sessions": {
|
|
10
|
+
"minItems": 1,
|
|
11
|
+
"type": "array",
|
|
12
|
+
"items": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"properties": {
|
|
15
|
+
"name": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "Unique session name"
|
|
18
|
+
},
|
|
19
|
+
"source": {
|
|
20
|
+
"anyOf": [
|
|
21
|
+
{
|
|
22
|
+
"type": "string",
|
|
23
|
+
"const": "current"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"type": "object",
|
|
27
|
+
"properties": {
|
|
28
|
+
"worktree": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"properties": {
|
|
31
|
+
"ref": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "Git ref (branch, tag, or commit) to check out"
|
|
34
|
+
},
|
|
35
|
+
"name": {
|
|
36
|
+
"description": "Directory name for the worktree (default: component-explorer-baseline)",
|
|
37
|
+
"type": "string"
|
|
38
|
+
},
|
|
39
|
+
"install": {
|
|
40
|
+
"anyOf": [
|
|
41
|
+
{
|
|
42
|
+
"type": "string",
|
|
43
|
+
"const": "auto"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"type": "string",
|
|
47
|
+
"const": "npm"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"type": "string",
|
|
51
|
+
"const": "pnpm"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"type": "string",
|
|
55
|
+
"const": "yarn"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"type": "object",
|
|
59
|
+
"properties": {
|
|
60
|
+
"command": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"description": "Custom install command to run in the worktree"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"required": [
|
|
66
|
+
"command"
|
|
67
|
+
],
|
|
68
|
+
"additionalProperties": false
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"type": "boolean",
|
|
72
|
+
"const": false
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"description": "Dependency install strategy for the worktree"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"required": [
|
|
79
|
+
"ref"
|
|
80
|
+
],
|
|
81
|
+
"additionalProperties": false,
|
|
82
|
+
"description": "Git worktree configuration for a baseline session"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"required": [
|
|
86
|
+
"worktree"
|
|
87
|
+
],
|
|
88
|
+
"additionalProperties": false
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
"description": "Session source: \"current\" for the working tree, or a worktree config for a baseline"
|
|
92
|
+
},
|
|
93
|
+
"viteConfig": {
|
|
94
|
+
"description": "Path to vite config file, relative to this config (overrides top-level viteConfig)",
|
|
95
|
+
"type": "string"
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"required": [
|
|
99
|
+
"name"
|
|
100
|
+
],
|
|
101
|
+
"additionalProperties": false,
|
|
102
|
+
"description": "A component explorer session"
|
|
103
|
+
},
|
|
104
|
+
"description": "List of explorer sessions"
|
|
105
|
+
},
|
|
106
|
+
"compare": {
|
|
107
|
+
"type": "object",
|
|
108
|
+
"properties": {
|
|
109
|
+
"baseline": {
|
|
110
|
+
"type": "string",
|
|
111
|
+
"description": "Session name to use as the baseline for comparisons"
|
|
112
|
+
},
|
|
113
|
+
"current": {
|
|
114
|
+
"type": "string",
|
|
115
|
+
"description": "Session name to use as the current version for comparisons"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"required": [
|
|
119
|
+
"baseline",
|
|
120
|
+
"current"
|
|
121
|
+
],
|
|
122
|
+
"additionalProperties": false,
|
|
123
|
+
"description": "Screenshot comparison configuration"
|
|
124
|
+
},
|
|
125
|
+
"viteConfig": {
|
|
126
|
+
"description": "Default vite config file path, relative to this config (default: vite.config.ts)",
|
|
127
|
+
"type": "string"
|
|
128
|
+
},
|
|
129
|
+
"vite": {
|
|
130
|
+
"type": "object",
|
|
131
|
+
"properties": {
|
|
132
|
+
"hmr": {
|
|
133
|
+
"type": "object",
|
|
134
|
+
"properties": {
|
|
135
|
+
"allowedPaths": {
|
|
136
|
+
"type": "array",
|
|
137
|
+
"items": {
|
|
138
|
+
"type": "string"
|
|
139
|
+
},
|
|
140
|
+
"description": "Glob patterns for files that keep HMR; everything else triggers a full reload"
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"required": [
|
|
144
|
+
"allowedPaths"
|
|
145
|
+
],
|
|
146
|
+
"additionalProperties": false,
|
|
147
|
+
"description": "Vite HMR configuration"
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
"additionalProperties": false,
|
|
151
|
+
"description": "Vite configuration overrides"
|
|
152
|
+
},
|
|
153
|
+
"redirection": {
|
|
154
|
+
"type": "object",
|
|
155
|
+
"properties": {
|
|
156
|
+
"port": {
|
|
157
|
+
"type": "integer",
|
|
158
|
+
"minimum": 1,
|
|
159
|
+
"maximum": 65535,
|
|
160
|
+
"description": "Port for the redirection HTTP server"
|
|
161
|
+
},
|
|
162
|
+
"host": {
|
|
163
|
+
"description": "Host to bind the redirection server to (default: localhost)",
|
|
164
|
+
"type": "string"
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"required": [
|
|
168
|
+
"port"
|
|
169
|
+
],
|
|
170
|
+
"additionalProperties": false,
|
|
171
|
+
"description": "HTTP redirection server that redirects to the session URL"
|
|
172
|
+
},
|
|
173
|
+
"$schema": {
|
|
174
|
+
"type": "string",
|
|
175
|
+
"description": "URL of the JSON Schema for this config file"
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
"required": [
|
|
179
|
+
"sessions"
|
|
180
|
+
],
|
|
181
|
+
"additionalProperties": false,
|
|
182
|
+
"description": "Component Explorer configuration"
|
|
183
|
+
}
|
|
@@ -49,9 +49,18 @@ export interface ScreenshotResult {
|
|
|
49
49
|
readonly image: Uint8Array;
|
|
50
50
|
readonly errors: ErrorInfo[];
|
|
51
51
|
}
|
|
52
|
+
export interface StabilityScreenshot {
|
|
53
|
+
readonly image: Uint8Array;
|
|
54
|
+
readonly delayMs: number;
|
|
55
|
+
}
|
|
56
|
+
export interface StabilityCheckResult {
|
|
57
|
+
readonly screenshots: readonly StabilityScreenshot[];
|
|
58
|
+
readonly errors: ErrorInfo[];
|
|
59
|
+
}
|
|
52
60
|
export interface ComponentExplorer {
|
|
53
61
|
listFixtures(): Promise<FixtureInfo[]>;
|
|
54
62
|
screenshotFixture(fixtureId: string): Promise<ScreenshotResult>;
|
|
63
|
+
screenshotFixtureStabilityCheck(fixtureId: string): Promise<StabilityCheckResult>;
|
|
55
64
|
evaluateJs(expression: string, fixtureId?: string): Promise<unknown>;
|
|
56
65
|
codeCoverage(id: FixtureId | FixtureGroupId): Promise<CoverageData>;
|
|
57
66
|
waitForUpdate(timeoutMs?: number): Promise<void>;
|
|
@@ -70,6 +79,7 @@ export declare class BrowserComponentExplorer implements ComponentExplorer {
|
|
|
70
79
|
private _getState;
|
|
71
80
|
listFixtures(): Promise<FixtureInfo[]>;
|
|
72
81
|
screenshotFixture(fixtureId: string): Promise<ScreenshotResult>;
|
|
82
|
+
screenshotFixtureStabilityCheck(fixtureId: string): Promise<StabilityCheckResult>;
|
|
73
83
|
evaluateJs(expression: string, fixtureId?: string): Promise<unknown>;
|
|
74
84
|
codeCoverage(_id: FixtureId | FixtureGroupId): Promise<CoverageData>;
|
|
75
85
|
waitForUpdate(timeoutMs?: number): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentExplorer.d.ts","sourceRoot":"","sources":["../src/componentExplorer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"componentExplorer.d.ts","sourceRoot":"","sources":["../src/componentExplorer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,aAAa,CAAC;AAGvD,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,OAAO,GAAG,MAAM,CAAC;CACtC;AAED,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AACvD,MAAM,MAAM,cAAc,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1D,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC7C;AAED,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3C;AAED;;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