@vscode/component-explorer-cli 0.1.1-2 → 0.1.1-21
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/LICENSE +21 -0
- package/README.md +177 -0
- package/SECURITY.md +14 -0
- package/dist/WorktreePool.d.ts +22 -0
- package/dist/WorktreePool.d.ts.map +1 -0
- package/dist/WorktreePool.js +58 -0
- package/dist/WorktreePool.js.map +1 -0
- package/dist/WorktreePool.test.d.ts +2 -0
- package/dist/WorktreePool.test.d.ts.map +1 -0
- package/dist/_virtual/_build-info.js +4 -0
- package/dist/_virtual/_build-info.js.map +1 -0
- package/dist/browserPage.d.ts +5 -0
- package/dist/browserPage.d.ts.map +1 -1
- package/dist/browserPage.js +28 -2
- package/dist/browserPage.js.map +1 -1
- package/dist/commands/acceptCommand.d.ts +2 -1
- package/dist/commands/acceptCommand.d.ts.map +1 -1
- package/dist/commands/acceptCommand.js +15 -8
- package/dist/commands/acceptCommand.js.map +1 -1
- package/dist/commands/checkStabilityCommand.d.ts +12 -0
- package/dist/commands/checkStabilityCommand.d.ts.map +1 -0
- package/dist/commands/checkStabilityCommand.js +84 -0
- package/dist/commands/checkStabilityCommand.js.map +1 -0
- package/dist/commands/compareCommand.d.ts +6 -1
- package/dist/commands/compareCommand.d.ts.map +1 -1
- package/dist/commands/compareCommand.js +64 -71
- package/dist/commands/compareCommand.js.map +1 -1
- package/dist/commands/mcpCommand.d.ts +4 -1
- package/dist/commands/mcpCommand.d.ts.map +1 -1
- package/dist/commands/mcpCommand.js +51 -8
- package/dist/commands/mcpCommand.js.map +1 -1
- package/dist/commands/screenshotCommand.d.ts +9 -2
- package/dist/commands/screenshotCommand.d.ts.map +1 -1
- package/dist/commands/screenshotCommand.js +73 -15
- package/dist/commands/screenshotCommand.js.map +1 -1
- package/dist/commands/serveCommand.d.ts +6 -1
- package/dist/commands/serveCommand.d.ts.map +1 -1
- package/dist/commands/serveCommand.js +104 -23
- package/dist/commands/serveCommand.js.map +1 -1
- package/dist/commands/watchCommand.d.ts +3 -2
- package/dist/commands/watchCommand.d.ts.map +1 -1
- package/dist/commands/watchCommand.js +28 -80
- package/dist/commands/watchCommand.js.map +1 -1
- package/dist/comparison.d.ts +70 -0
- package/dist/comparison.d.ts.map +1 -0
- package/dist/comparison.js +264 -0
- package/dist/comparison.js.map +1 -0
- package/dist/component-explorer-config.schema.json +222 -0
- package/dist/componentExplorer.d.ts +40 -2
- package/dist/componentExplorer.d.ts.map +1 -1
- package/dist/componentExplorer.js +118 -24
- 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 +146 -21
- package/dist/daemon/DaemonService.d.ts.map +1 -1
- package/dist/daemon/DaemonService.js +620 -123
- package/dist/daemon/DaemonService.js.map +1 -1
- package/dist/daemon/dynamicSessions.test.d.ts +2 -0
- package/dist/daemon/dynamicSessions.test.d.ts.map +1 -0
- 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 +101 -8
- package/dist/daemon/pipeClient.js.map +1 -1
- package/dist/daemon/pipeServer.d.ts +2 -1
- package/dist/daemon/pipeServer.d.ts.map +1 -1
- package/dist/daemon/pipeServer.js +56 -6
- package/dist/daemon/pipeServer.js.map +1 -1
- package/dist/daemon/types.d.ts +12 -0
- package/dist/daemon/types.d.ts.map +1 -0
- package/dist/daemon/version.d.ts +10 -0
- package/dist/daemon/version.d.ts.map +1 -0
- package/dist/daemon/version.js +17 -0
- package/dist/daemon/version.js.map +1 -0
- package/dist/dependencyInstaller.d.ts +2 -2
- package/dist/dependencyInstaller.d.ts.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/gitIndexResolver.d.ts +25 -0
- package/dist/git/gitIndexResolver.d.ts.map +1 -0
- package/dist/git/gitIndexResolver.js +91 -0
- package/dist/git/gitIndexResolver.js.map +1 -0
- package/dist/git/gitIndexResolver.test.d.ts +2 -0
- package/dist/git/gitIndexResolver.test.d.ts.map +1 -0
- package/dist/git/gitService.d.ts +2 -0
- package/dist/git/gitService.d.ts.map +1 -1
- package/dist/git/gitService.js +6 -0
- package/dist/git/gitService.js.map +1 -1
- package/dist/git/gitUtils.js +1 -1
- package/dist/git/gitUtils.js.map +1 -1
- package/dist/git/gitWorktreeManager.d.ts +6 -0
- package/dist/git/gitWorktreeManager.d.ts.map +1 -1
- package/dist/git/gitWorktreeManager.js +42 -13
- package/dist/git/gitWorktreeManager.js.map +1 -1
- package/dist/git/gitWorktreeManager.test.d.ts +2 -0
- package/dist/git/gitWorktreeManager.test.d.ts.map +1 -0
- package/dist/git/testUtils.d.ts +13 -0
- package/dist/git/testUtils.d.ts.map +1 -0
- package/dist/httpServer.d.ts +6 -1
- package/dist/httpServer.d.ts.map +1 -1
- package/dist/httpServer.js +30 -10
- package/dist/httpServer.js.map +1 -1
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +1 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +7 -1
- package/dist/logger.js.map +1 -1
- package/dist/mcp/McpServer.d.ts +47 -4
- package/dist/mcp/McpServer.d.ts.map +1 -1
- package/dist/mcp/McpServer.js +913 -155
- package/dist/mcp/McpServer.js.map +1 -1
- package/dist/mcp/TaskManager.d.ts +28 -0
- package/dist/mcp/TaskManager.d.ts.map +1 -0
- package/dist/mcp/TaskManager.js +54 -0
- package/dist/mcp/TaskManager.js.map +1 -0
- package/dist/packages/simple-api/dist/chunk-3R7GHWBM.js +137 -0
- package/dist/packages/simple-api/dist/chunk-3R7GHWBM.js.map +1 -0
- package/dist/packages/simple-api/dist/chunk-SGBCNXYH.js +24 -0
- package/dist/packages/simple-api/dist/chunk-SGBCNXYH.js.map +1 -0
- package/dist/packages/simple-api/dist/chunk-TAEFVNPN.js +27 -0
- package/dist/packages/simple-api/dist/chunk-TAEFVNPN.js.map +1 -0
- package/dist/packages/simple-api/dist/express.js +104 -0
- package/dist/packages/simple-api/dist/express.js.map +1 -0
- package/dist/resolveProject.d.ts +21 -0
- package/dist/resolveProject.d.ts.map +1 -0
- package/dist/resolveProject.js +39 -0
- package/dist/resolveProject.js.map +1 -0
- package/dist/utils.d.ts +31 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +49 -0
- package/dist/utils.js.map +1 -0
- package/dist/watchConfig.d.ts +52 -9
- package/dist/watchConfig.d.ts.map +1 -1
- package/dist/watchConfig.js +67 -62
- package/dist/watchConfig.js.map +1 -1
- package/package.json +31 -8
- 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
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import { ViteProjectRef } from './viteProjectRef.js';
|
|
4
|
+
|
|
5
|
+
const _viteConfigExtensions = new Set(['.ts', '.js', '.mts', '.mjs']);
|
|
6
|
+
async function resolveProject(projectPath) {
|
|
7
|
+
const absPath = path.resolve(projectPath);
|
|
8
|
+
const stat = await fs.promises.stat(absPath);
|
|
9
|
+
if (stat.isDirectory()) {
|
|
10
|
+
return { kind: 'directory', projectDir: absPath };
|
|
11
|
+
}
|
|
12
|
+
const ext = path.extname(absPath).toLowerCase();
|
|
13
|
+
const dir = path.dirname(absPath);
|
|
14
|
+
if (ext === '.json') {
|
|
15
|
+
const raw = JSON.parse(await fs.promises.readFile(absPath, 'utf-8'));
|
|
16
|
+
return { kind: 'explorerConfig', projectDir: dir, configPath: absPath, config: raw };
|
|
17
|
+
}
|
|
18
|
+
if (_viteConfigExtensions.has(ext)) {
|
|
19
|
+
return { kind: 'viteConfig', projectDir: dir, viteConfigPath: absPath };
|
|
20
|
+
}
|
|
21
|
+
return { kind: 'viteConfig', projectDir: dir, viteConfigPath: absPath };
|
|
22
|
+
}
|
|
23
|
+
function resolvedProjectToViteProjectRef(project) {
|
|
24
|
+
switch (project.kind) {
|
|
25
|
+
case 'directory':
|
|
26
|
+
return ViteProjectRef.fromSourceRootDir(project.projectDir);
|
|
27
|
+
case 'viteConfig':
|
|
28
|
+
return ViteProjectRef.fromViteConfigPath(project.viteConfigPath);
|
|
29
|
+
case 'explorerConfig': {
|
|
30
|
+
if (project.config.viteConfig) {
|
|
31
|
+
return ViteProjectRef.fromViteConfigPath(path.resolve(project.projectDir, project.config.viteConfig));
|
|
32
|
+
}
|
|
33
|
+
return ViteProjectRef.fromSourceRootDir(project.projectDir);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { resolveProject, resolvedProjectToViteProjectRef };
|
|
39
|
+
//# sourceMappingURL=resolveProject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveProject.js","sources":["../src/resolveProject.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAcA,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE9D,eAAe,cAAc,CAAC,WAAmB,EAAA;IACvD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;IACzC,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC;AAE5C,IAAA,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE;QACvB,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE;IAClD;IAEA,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAA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.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type ExplorerMode = 'headless' | 'embedded';
|
|
2
|
+
export interface ExplorerQueryParams {
|
|
3
|
+
readonly mode?: ExplorerMode;
|
|
4
|
+
readonly fixture?: string;
|
|
5
|
+
readonly file?: string;
|
|
6
|
+
readonly report?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The default route path for the Component Explorer.
|
|
10
|
+
* Must match the default in vite-plugin.
|
|
11
|
+
*/
|
|
12
|
+
export declare const EXPLORER_ROUTE = "/___explorer";
|
|
13
|
+
export interface ExplorerUrlOptions {
|
|
14
|
+
/** Base URL of the server (e.g. 'http://localhost:5173') */
|
|
15
|
+
readonly baseUrl: string;
|
|
16
|
+
/** Use raw render mode instead of the full Explorer UI */
|
|
17
|
+
readonly rawRender?: boolean;
|
|
18
|
+
/** Specific fixture to render (only relevant in raw render mode) */
|
|
19
|
+
readonly fixtureId?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Builds a URL for the Component Explorer.
|
|
23
|
+
* - Default: Explorer UI at `/___explorer`
|
|
24
|
+
* - rawRender: `/___explorer?mode=render`
|
|
25
|
+
* - rawRender + fixtureId: `/___explorer?mode=render&fixture=<id>`
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildExplorerUrl(options: ExplorerUrlOptions): string;
|
|
28
|
+
export declare function writeFile(filePath: string, data: Uint8Array): Promise<void>;
|
|
29
|
+
export declare function matchGlob(fixtureId: string, pattern: string): boolean;
|
|
30
|
+
export declare function listPngFiles(dir: string): Promise<string[]>;
|
|
31
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,UAAU,CAAC;AAEnD,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,IAAI,CAAC,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,iBAAiB,CAAC;AAE7C,MAAM,WAAW,kBAAkB;IAClC,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,0DAA0D;IAC1D,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,oEAAoE;IACpE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAUpE;AAED,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAGjF;AAED,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAKrE;AAED,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAajE"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as fs from 'node:fs/promises';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The default route path for the Component Explorer.
|
|
6
|
+
* Must match the default in vite-plugin.
|
|
7
|
+
*/
|
|
8
|
+
const EXPLORER_ROUTE = '/___explorer';
|
|
9
|
+
/**
|
|
10
|
+
* Builds a URL for the Component Explorer.
|
|
11
|
+
* - Default: Explorer UI at `/___explorer`
|
|
12
|
+
* - rawRender: `/___explorer?mode=render`
|
|
13
|
+
* - rawRender + fixtureId: `/___explorer?mode=render&fixture=<id>`
|
|
14
|
+
*/
|
|
15
|
+
function buildExplorerUrl(options) {
|
|
16
|
+
const base = `${options.baseUrl}${EXPLORER_ROUTE}`;
|
|
17
|
+
const query = options.rawRender
|
|
18
|
+
? { mode: 'headless', fixture: options.fixtureId }
|
|
19
|
+
: {};
|
|
20
|
+
const params = new URLSearchParams(Object.entries(query).filter((entry) => entry[1] !== undefined));
|
|
21
|
+
const queryString = params.toString();
|
|
22
|
+
return queryString ? `${base}?${queryString}` : base;
|
|
23
|
+
}
|
|
24
|
+
async function writeFile(filePath, data) {
|
|
25
|
+
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
26
|
+
await fs.writeFile(filePath, data);
|
|
27
|
+
}
|
|
28
|
+
function matchGlob(fixtureId, pattern) {
|
|
29
|
+
const regex = new RegExp('^' + pattern.replace(/\*/g, '.*').replace(/\?/g, '.') + '$');
|
|
30
|
+
return regex.test(fixtureId);
|
|
31
|
+
}
|
|
32
|
+
async function listPngFiles(dir) {
|
|
33
|
+
try {
|
|
34
|
+
const entries = await fs.readdir(dir, { recursive: true });
|
|
35
|
+
const results = [];
|
|
36
|
+
for (const entry of entries) {
|
|
37
|
+
if (entry.endsWith('.png')) {
|
|
38
|
+
results.push(entry.split(path.sep).join('/'));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return results;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { EXPLORER_ROUTE, buildExplorerUrl, listPngFiles, matchGlob, writeFile };
|
|
49
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAYA;;;AAGG;AACI,MAAM,cAAc,GAAG;AAW9B;;;;;AAKG;AACG,SAAU,gBAAgB,CAAC,OAA2B,EAAA;IAC3D,MAAM,IAAI,GAAG,CAAA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KAAK,IAAI,OAAO,EAAE;AAC5B,YAAA,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;AAC3B,gBAAA,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC9C;QACD;AACA,QAAA,OAAO,OAAO;IACf;AAAE,IAAA,MAAM;AACP,QAAA,OAAO,EAAE;IACV;AACD;;;;"}
|
package/dist/watchConfig.d.ts
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
import type { IGitRepo } from './git/gitService.js';
|
|
2
3
|
import { ViteProjectRef } from './viteProjectRef.js';
|
|
3
|
-
export
|
|
4
|
+
export declare const watchConfigSchema: z.ZodObject<{
|
|
5
|
+
screenshotDir: z.ZodOptional<z.ZodString>;
|
|
6
|
+
sessions: z.ZodArray<z.ZodObject<{
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
9
|
+
worktree: z.ZodObject<{
|
|
10
|
+
ref: z.ZodString;
|
|
11
|
+
install: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodLiteral<"npm">, z.ZodLiteral<"pnpm">, z.ZodLiteral<"yarn">, z.ZodObject<{
|
|
12
|
+
command: z.ZodString;
|
|
13
|
+
}, z.core.$strip>, z.ZodLiteral<false>]>>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
}, z.core.$strip>>;
|
|
16
|
+
viteConfig: z.ZodOptional<z.ZodString>;
|
|
17
|
+
}, z.core.$strip>>;
|
|
18
|
+
worktree: z.ZodOptional<z.ZodObject<{
|
|
19
|
+
setup: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodLiteral<"npm">, z.ZodLiteral<"pnpm">, z.ZodLiteral<"yarn">, z.ZodObject<{
|
|
20
|
+
command: z.ZodString;
|
|
21
|
+
}, z.core.$strip>, z.ZodLiteral<false>]>>;
|
|
22
|
+
maxSlots: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
}, z.core.$strip>>;
|
|
24
|
+
compare: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
baseline: z.ZodString;
|
|
26
|
+
current: z.ZodString;
|
|
27
|
+
}, z.core.$strip>>;
|
|
28
|
+
viteConfig: z.ZodOptional<z.ZodString>;
|
|
29
|
+
vite: z.ZodOptional<z.ZodObject<{
|
|
30
|
+
hmr: z.ZodOptional<z.ZodObject<{
|
|
31
|
+
allowedPaths: z.ZodArray<z.ZodString>;
|
|
32
|
+
}, z.core.$strip>>;
|
|
33
|
+
}, z.core.$strip>>;
|
|
34
|
+
redirection: z.ZodOptional<z.ZodObject<{
|
|
35
|
+
port: z.ZodNumber;
|
|
36
|
+
host: z.ZodOptional<z.ZodString>;
|
|
37
|
+
}, z.core.$strip>>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
export type WorktreeSetupConfig = {
|
|
4
40
|
readonly kind: 'auto';
|
|
5
41
|
} | {
|
|
6
42
|
readonly kind: 'npm';
|
|
@@ -14,17 +50,12 @@ export type WorktreeInstallConfig = {
|
|
|
14
50
|
} | {
|
|
15
51
|
readonly kind: 'skip';
|
|
16
52
|
};
|
|
17
|
-
export declare class ResolvedWorktreeConfig {
|
|
18
|
-
readonly ref: string;
|
|
19
|
-
readonly worktreePath: string;
|
|
20
|
-
readonly install: WorktreeInstallConfig;
|
|
21
|
-
constructor(ref: string, worktreePath: string, install: WorktreeInstallConfig);
|
|
22
|
-
}
|
|
23
53
|
export type ResolvedSourceConfig = {
|
|
24
54
|
readonly kind: 'current';
|
|
25
55
|
} | {
|
|
26
56
|
readonly kind: 'worktree';
|
|
27
|
-
readonly
|
|
57
|
+
readonly ref: string;
|
|
58
|
+
readonly install: WorktreeSetupConfig | undefined;
|
|
28
59
|
};
|
|
29
60
|
export declare class ResolvedSessionConfig {
|
|
30
61
|
readonly name: string;
|
|
@@ -32,21 +63,33 @@ export declare class ResolvedSessionConfig {
|
|
|
32
63
|
readonly viteProject: ViteProjectRef;
|
|
33
64
|
constructor(name: string, source: ResolvedSourceConfig, viteProject: ViteProjectRef);
|
|
34
65
|
}
|
|
66
|
+
export declare class ResolvedWorktreePoolConfig {
|
|
67
|
+
readonly setup: WorktreeSetupConfig;
|
|
68
|
+
readonly maxSlots: number;
|
|
69
|
+
constructor(setup: WorktreeSetupConfig, maxSlots: number);
|
|
70
|
+
}
|
|
35
71
|
export declare class ResolvedCompareConfig {
|
|
36
72
|
readonly baseline: string;
|
|
37
73
|
readonly current: string;
|
|
38
74
|
constructor(baseline: string, current: string);
|
|
39
75
|
}
|
|
40
76
|
export interface ResolvedViteHmrConfig {
|
|
41
|
-
/** Glob patterns for files that keep HMR. Everything else triggers a full reload. */
|
|
42
77
|
readonly allowedPaths: readonly string[];
|
|
43
78
|
}
|
|
79
|
+
export interface ResolvedRedirectionConfig {
|
|
80
|
+
readonly port: number;
|
|
81
|
+
readonly host: string;
|
|
82
|
+
}
|
|
44
83
|
export declare class ResolvedWatchConfig {
|
|
45
84
|
readonly screenshotDir: string;
|
|
46
85
|
readonly sessions: readonly ResolvedSessionConfig[];
|
|
86
|
+
readonly worktreePool: ResolvedWorktreePoolConfig | undefined;
|
|
47
87
|
readonly compare: ResolvedCompareConfig | undefined;
|
|
48
88
|
readonly repo: IGitRepo;
|
|
49
89
|
readonly viteHmr: ResolvedViteHmrConfig | undefined;
|
|
90
|
+
readonly redirection: ResolvedRedirectionConfig | undefined;
|
|
91
|
+
readonly configDir: string;
|
|
92
|
+
readonly defaultViteConfig: string;
|
|
50
93
|
private constructor();
|
|
51
94
|
static fromFile(configPath: string): Promise<ResolvedWatchConfig>;
|
|
52
95
|
static fromData(data: unknown, configDir: string, repo: IGitRepo): ResolvedWatchConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watchConfig.d.ts","sourceRoot":"","sources":["../src/watchConfig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5
5
|
import { ViteProjectRef } from './viteProjectRef.js';
|
|
6
6
|
|
|
7
7
|
// --- Zod schemas ---
|
|
8
|
-
const
|
|
8
|
+
const worktreeSetupSchema = z.union([
|
|
9
9
|
z.literal('auto'),
|
|
10
10
|
z.literal('npm'),
|
|
11
11
|
z.literal('pnpm'),
|
|
12
12
|
z.literal('yarn'),
|
|
13
|
-
z.object({ command: z.string() }),
|
|
13
|
+
z.object({ command: z.string().describe('Custom install command to run in the worktree') }),
|
|
14
14
|
z.literal(false),
|
|
15
|
-
]);
|
|
16
|
-
const
|
|
17
|
-
ref: z.string(),
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
z.object({ worktree: worktreeConfigSchema }),
|
|
24
|
-
]);
|
|
15
|
+
]).describe('Dependency install strategy for the worktree');
|
|
16
|
+
const sessionSourceWorktreeSchema = z.object({
|
|
17
|
+
ref: z.string().describe('Git ref to check out (branch, tag, commit, or "INDEX" for the git staging area)'),
|
|
18
|
+
install: worktreeSetupSchema.optional().describe('Dependency install strategy override for this session'),
|
|
19
|
+
}).describe('Worktree source configuration');
|
|
20
|
+
const sessionSourceSchema = z.object({
|
|
21
|
+
worktree: sessionSourceWorktreeSchema,
|
|
22
|
+
}).describe('Session source configuration');
|
|
25
23
|
const sessionConfigSchema = z.object({
|
|
26
|
-
name: z.string(),
|
|
27
|
-
source: sessionSourceSchema.optional(),
|
|
28
|
-
viteConfig: z.string().optional(),
|
|
29
|
-
});
|
|
24
|
+
name: z.string().describe('Unique session name'),
|
|
25
|
+
source: sessionSourceSchema.optional().describe('Source configuration (default: current working tree)'),
|
|
26
|
+
viteConfig: z.string().optional().describe('Path to vite config file, relative to this config (overrides top-level viteConfig)'),
|
|
27
|
+
}).describe('A component explorer session');
|
|
28
|
+
const worktreePoolConfigSchema = z.object({
|
|
29
|
+
setup: worktreeSetupSchema.optional().describe('Dependency install strategy for dynamic worktree sessions (default: auto)'),
|
|
30
|
+
maxSlots: z.number().int().min(1).max(3).optional().describe('Maximum number of simultaneous worktree sessions (default: 2, max: 3)'),
|
|
31
|
+
}).describe('Configuration for dynamic worktree sessions managed via MCP');
|
|
30
32
|
const compareConfigSchema = z.object({
|
|
31
|
-
baseline: z.string(),
|
|
32
|
-
current: z.string(),
|
|
33
|
-
});
|
|
33
|
+
baseline: z.string().describe('Session name to use as the baseline for comparisons'),
|
|
34
|
+
current: z.string().describe('Session name to use as the current version for comparisons'),
|
|
35
|
+
}).describe('Screenshot comparison configuration');
|
|
34
36
|
const viteHmrConfigSchema = z.object({
|
|
35
|
-
allowedPaths: z.array(z.string()),
|
|
36
|
-
});
|
|
37
|
+
allowedPaths: z.array(z.string()).describe('Glob patterns for files that keep HMR; everything else triggers a full reload'),
|
|
38
|
+
}).describe('Vite HMR configuration');
|
|
37
39
|
const viteConfigOverridesSchema = z.object({
|
|
38
40
|
hmr: viteHmrConfigSchema.optional(),
|
|
39
|
-
});
|
|
41
|
+
}).describe('Vite configuration overrides');
|
|
42
|
+
const redirectionConfigSchema = z.object({
|
|
43
|
+
port: z.number().int().min(1).max(65535).describe('Port for the redirection HTTP server'),
|
|
44
|
+
host: z.string().optional().describe('Host to bind the redirection server to (default: localhost)'),
|
|
45
|
+
}).describe('HTTP redirection server that redirects to the session URL');
|
|
40
46
|
const watchConfigSchema = z.object({
|
|
41
|
-
screenshotDir: z.string().optional(),
|
|
42
|
-
sessions: z.array(sessionConfigSchema).min(1),
|
|
47
|
+
screenshotDir: z.string().optional().describe('Directory for storing screenshots (default: .screenshots)'),
|
|
48
|
+
sessions: z.array(sessionConfigSchema).min(1).describe('List of explorer sessions (currently only "current" working tree sessions)'),
|
|
49
|
+
worktree: worktreePoolConfigSchema.optional().describe('Dynamic worktree session pool configuration'),
|
|
43
50
|
compare: compareConfigSchema.optional(),
|
|
44
|
-
viteConfig: z.string().optional(),
|
|
51
|
+
viteConfig: z.string().optional().describe('Default vite config file path, relative to this config (default: vite.config.ts)'),
|
|
45
52
|
vite: viteConfigOverridesSchema.optional(),
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
ref;
|
|
49
|
-
worktreePath;
|
|
50
|
-
install;
|
|
51
|
-
constructor(ref, worktreePath, install) {
|
|
52
|
-
this.ref = ref;
|
|
53
|
-
this.worktreePath = worktreePath;
|
|
54
|
-
this.install = install;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
53
|
+
redirection: redirectionConfigSchema.optional(),
|
|
54
|
+
}).describe('Component Explorer configuration');
|
|
57
55
|
class ResolvedSessionConfig {
|
|
58
56
|
name;
|
|
59
57
|
source;
|
|
@@ -64,6 +62,14 @@ class ResolvedSessionConfig {
|
|
|
64
62
|
this.viteProject = viteProject;
|
|
65
63
|
}
|
|
66
64
|
}
|
|
65
|
+
class ResolvedWorktreePoolConfig {
|
|
66
|
+
setup;
|
|
67
|
+
maxSlots;
|
|
68
|
+
constructor(setup, maxSlots) {
|
|
69
|
+
this.setup = setup;
|
|
70
|
+
this.maxSlots = maxSlots;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
67
73
|
class ResolvedCompareConfig {
|
|
68
74
|
baseline;
|
|
69
75
|
current;
|
|
@@ -75,15 +81,23 @@ class ResolvedCompareConfig {
|
|
|
75
81
|
class ResolvedWatchConfig {
|
|
76
82
|
screenshotDir;
|
|
77
83
|
sessions;
|
|
84
|
+
worktreePool;
|
|
78
85
|
compare;
|
|
79
86
|
repo;
|
|
80
87
|
viteHmr;
|
|
81
|
-
|
|
88
|
+
redirection;
|
|
89
|
+
configDir;
|
|
90
|
+
defaultViteConfig;
|
|
91
|
+
constructor(screenshotDir, sessions, worktreePool, compare, repo, viteHmr, redirection, configDir, defaultViteConfig) {
|
|
82
92
|
this.screenshotDir = screenshotDir;
|
|
83
93
|
this.sessions = sessions;
|
|
94
|
+
this.worktreePool = worktreePool;
|
|
84
95
|
this.compare = compare;
|
|
85
96
|
this.repo = repo;
|
|
86
97
|
this.viteHmr = viteHmr;
|
|
98
|
+
this.redirection = redirection;
|
|
99
|
+
this.configDir = configDir;
|
|
100
|
+
this.defaultViteConfig = defaultViteConfig;
|
|
87
101
|
}
|
|
88
102
|
static async fromFile(configPath) {
|
|
89
103
|
const absConfigPath = path.resolve(configPath);
|
|
@@ -97,32 +111,15 @@ class ResolvedWatchConfig {
|
|
|
97
111
|
const parsed = watchConfigSchema.parse(data);
|
|
98
112
|
const screenshotDir = path.resolve(configDir, parsed.screenshotDir ?? '.screenshots');
|
|
99
113
|
const defaultViteConfig = parsed.viteConfig ?? 'vite.config.ts';
|
|
100
|
-
const wtRoot = repo.worktreeRootPath();
|
|
101
|
-
// Config dir's position relative to the git root — needed to mirror
|
|
102
|
-
// the same path inside a worktree (which replicates the repo structure).
|
|
103
|
-
const configDirRelToGitRoot = path.relative(repo.gitRoot, configDir);
|
|
104
114
|
const sessions = parsed.sessions.map(session => {
|
|
105
115
|
const viteConfigRel = session.viteConfig ?? defaultViteConfig;
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
source = { kind: 'current' };
|
|
111
|
-
viteProject = ViteProjectRef.fromViteConfigPath(path.resolve(configDir, viteConfigRel));
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
const wt = sourceRaw.worktree;
|
|
115
|
-
const worktreeName = wt.name ?? 'component-explorer-baseline';
|
|
116
|
-
const worktreePath = path.resolve(wtRoot, worktreeName);
|
|
117
|
-
const install = resolveInstallConfig(wt.install);
|
|
118
|
-
const worktreeConfig = new ResolvedWorktreeConfig(wt.ref, worktreePath, install);
|
|
119
|
-
source = { kind: 'worktree', worktree: worktreeConfig };
|
|
120
|
-
// Mirror the config dir inside the worktree, then resolve viteConfig from there
|
|
121
|
-
const worktreeConfigDir = path.resolve(worktreePath, configDirRelToGitRoot);
|
|
122
|
-
viteProject = ViteProjectRef.fromViteConfigPath(path.resolve(worktreeConfigDir, viteConfigRel));
|
|
123
|
-
}
|
|
116
|
+
const source = session.source
|
|
117
|
+
? { kind: 'worktree', ref: session.source.worktree.ref, install: session.source.worktree.install ? resolveSetupConfig(session.source.worktree.install) : undefined }
|
|
118
|
+
: { kind: 'current' };
|
|
119
|
+
const viteProject = ViteProjectRef.fromViteConfigPath(path.resolve(configDir, viteConfigRel));
|
|
124
120
|
return new ResolvedSessionConfig(session.name, source, viteProject);
|
|
125
121
|
});
|
|
122
|
+
const needsWorktreePool = sessions.some(s => s.source.kind === 'worktree');
|
|
126
123
|
const sessionNames = new Set(sessions.map(s => s.name));
|
|
127
124
|
let compare;
|
|
128
125
|
if (parsed.compare) {
|
|
@@ -134,13 +131,21 @@ class ResolvedWatchConfig {
|
|
|
134
131
|
}
|
|
135
132
|
compare = new ResolvedCompareConfig(parsed.compare.baseline, parsed.compare.current);
|
|
136
133
|
}
|
|
134
|
+
const worktreePool = parsed.worktree
|
|
135
|
+
? new ResolvedWorktreePoolConfig(resolveSetupConfig(parsed.worktree.setup), parsed.worktree.maxSlots ?? 2)
|
|
136
|
+
: needsWorktreePool
|
|
137
|
+
? new ResolvedWorktreePoolConfig({ kind: 'auto' }, 2)
|
|
138
|
+
: undefined;
|
|
137
139
|
const viteHmr = parsed.vite?.hmr
|
|
138
140
|
? { allowedPaths: parsed.vite.hmr.allowedPaths }
|
|
139
141
|
: undefined;
|
|
140
|
-
|
|
142
|
+
const redirection = parsed.redirection
|
|
143
|
+
? { port: parsed.redirection.port, host: parsed.redirection.host ?? 'localhost' }
|
|
144
|
+
: undefined;
|
|
145
|
+
return new ResolvedWatchConfig(screenshotDir, sessions, worktreePool, compare, repo, viteHmr, redirection, configDir, defaultViteConfig);
|
|
141
146
|
}
|
|
142
147
|
}
|
|
143
|
-
function
|
|
148
|
+
function resolveSetupConfig(raw) {
|
|
144
149
|
if (raw === undefined || raw === 'auto') {
|
|
145
150
|
return { kind: 'auto' };
|
|
146
151
|
}
|
|
@@ -159,5 +164,5 @@ function resolveInstallConfig(raw) {
|
|
|
159
164
|
return { kind: 'custom', command: raw.command };
|
|
160
165
|
}
|
|
161
166
|
|
|
162
|
-
export { ResolvedCompareConfig, ResolvedSessionConfig, ResolvedWatchConfig,
|
|
167
|
+
export { ResolvedCompareConfig, ResolvedSessionConfig, ResolvedWatchConfig, ResolvedWorktreePoolConfig, watchConfigSchema };
|
|
163
168
|
//# sourceMappingURL=watchConfig.js.map
|
package/dist/watchConfig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watchConfig.js","sources":["../src/watchConfig.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AAOA;AAEA,MAAM,
|
|
1
|
+
{"version":3,"file":"watchConfig.js","sources":["../src/watchConfig.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AAOA;AAEA,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC;AACnC,IAAA,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;AACjB,IAAA,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;AAChB,IAAA,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;AACjB,IAAA,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;AACjB,IAAA,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+CAA+C,CAAC,EAAE,CAAC;AAC3F,IAAA,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;AAChB,CAAA,CAAC,CAAC,QAAQ,CAAC,8CAA8C,CAAC;AAE3D,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iFAAiF,CAAC;IAC3G,OAAO,EAAE,mBAAmB,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uDAAuD,CAAC;AACzG,CAAA,CAAC,CAAC,QAAQ,CAAC,+BAA+B,CAAC;AAE5C,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;AACpC,IAAA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;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vscode/component-explorer-cli",
|
|
3
|
-
"version": "0.1.1-
|
|
3
|
+
"version": "0.1.1-21",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/microsoft/vscode-packages.git",
|
|
8
|
+
"directory": "js-component-explorer/packages/cli"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/microsoft/vscode-packages/tree/main/js-component-explorer/packages/cli",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/microsoft/vscode-packages/issues"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
5
15
|
"bin": {
|
|
6
16
|
"component-explorer": "./dist/index.js"
|
|
7
17
|
},
|
|
@@ -11,18 +21,31 @@
|
|
|
11
21
|
".": {
|
|
12
22
|
"import": "./dist/index.js",
|
|
13
23
|
"types": "./dist/index.d.ts"
|
|
14
|
-
}
|
|
24
|
+
},
|
|
25
|
+
"./daemon-types": {
|
|
26
|
+
"import": "./dist/daemon/DaemonService.js",
|
|
27
|
+
"types": "./dist/daemon/DaemonService.d.ts"
|
|
28
|
+
},
|
|
29
|
+
"./explorer-types": {
|
|
30
|
+
"import": "./dist/utils.js",
|
|
31
|
+
"types": "./dist/utils.d.ts"
|
|
32
|
+
},
|
|
33
|
+
"./config-schema.json": "./dist/component-explorer-config.schema.json"
|
|
15
34
|
},
|
|
16
35
|
"files": [
|
|
17
|
-
"dist"
|
|
36
|
+
"dist",
|
|
37
|
+
"README.md",
|
|
38
|
+
"LICENSE",
|
|
39
|
+
"SECURITY.md"
|
|
18
40
|
],
|
|
19
41
|
"scripts": {
|
|
20
|
-
"build": "rollup -c",
|
|
42
|
+
"build": "rollup -c && node --experimental-strip-types scripts/generate-json-schema.ts",
|
|
21
43
|
"dev": "rollup -c -w",
|
|
22
|
-
"test": "vitest --run"
|
|
44
|
+
"test": "vitest --run",
|
|
45
|
+
"generate-schema": "node --experimental-strip-types scripts/generate-json-schema.ts"
|
|
23
46
|
},
|
|
24
47
|
"dependencies": {
|
|
25
|
-
"@hediet/
|
|
48
|
+
"@hediet/semver": "^0.2.2",
|
|
26
49
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
27
50
|
"clipanion": "^4.0.0-rc.4",
|
|
28
51
|
"express": "^5.0.0",
|
|
@@ -33,18 +56,18 @@
|
|
|
33
56
|
"vite": ">=5.0.0"
|
|
34
57
|
},
|
|
35
58
|
"devDependencies": {
|
|
59
|
+
"@hediet/simple-api": "workspace:*",
|
|
36
60
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
37
61
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
38
62
|
"@types/express": "^5.0.0",
|
|
39
63
|
"@types/node": "^20.0.0",
|
|
40
64
|
"@vitejs/plugin-react": "^4.3.0",
|
|
41
|
-
"@vscode/component-explorer": "workspace:*",
|
|
42
65
|
"@vscode/component-explorer-vite-plugin": "workspace:*",
|
|
43
66
|
"@vscode/observables": "workspace:*",
|
|
44
67
|
"playwright": "^1.40.0",
|
|
45
68
|
"react": "^18.3.0",
|
|
46
69
|
"react-dom": "^18.3.0",
|
|
47
|
-
"rollup": "^4.
|
|
70
|
+
"rollup": "^4.59.0",
|
|
48
71
|
"typescript": "^5.4.0",
|
|
49
72
|
"vite": "^6.0.0",
|
|
50
73
|
"vitest": "^1.3.0"
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { SimpleTypedRpcConnection } from './rpc.js';
|
|
2
|
-
|
|
3
|
-
/*---------------------------------------------------------------------------------------------
|
|
4
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
6
|
-
*--------------------------------------------------------------------------------------------*/
|
|
7
|
-
|
|
8
|
-
/*---------------------------------------------------------------------------------------------
|
|
9
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
11
|
-
*--------------------------------------------------------------------------------------------*/
|
|
12
|
-
function registerDebugChannel(channelId, createClient) {
|
|
13
|
-
const g = globalThis;
|
|
14
|
-
let queuedNotifications = [];
|
|
15
|
-
let curHost = undefined;
|
|
16
|
-
const { channel, handler } = createChannelFactoryFromDebugChannel({
|
|
17
|
-
sendNotification: (data) => {
|
|
18
|
-
if (curHost) {
|
|
19
|
-
curHost.sendNotification(data);
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
queuedNotifications.push(data);
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
let curClient = undefined;
|
|
27
|
-
(g.$$debugValueEditor_debugChannels ?? (g.$$debugValueEditor_debugChannels = {}))[channelId] = (host) => {
|
|
28
|
-
curClient = createClient();
|
|
29
|
-
curHost = host;
|
|
30
|
-
for (const n of queuedNotifications) {
|
|
31
|
-
host.sendNotification(n);
|
|
32
|
-
}
|
|
33
|
-
queuedNotifications = [];
|
|
34
|
-
return handler;
|
|
35
|
-
};
|
|
36
|
-
return SimpleTypedRpcConnection.createClient(channel, () => {
|
|
37
|
-
if (!curClient) {
|
|
38
|
-
throw new Error('Not supported');
|
|
39
|
-
}
|
|
40
|
-
return curClient;
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
function createChannelFactoryFromDebugChannel(host) {
|
|
44
|
-
let h;
|
|
45
|
-
const channel = (handler) => {
|
|
46
|
-
h = handler;
|
|
47
|
-
return {
|
|
48
|
-
sendNotification: data => {
|
|
49
|
-
host.sendNotification(data);
|
|
50
|
-
},
|
|
51
|
-
sendRequest: data => {
|
|
52
|
-
throw new Error('not supported');
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
return {
|
|
57
|
-
channel: channel,
|
|
58
|
-
handler: {
|
|
59
|
-
handleRequest: (data) => {
|
|
60
|
-
if (data.type === 'notification') {
|
|
61
|
-
return h?.handleNotification(data.data);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
return h?.handleRequest(data.data);
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export { registerDebugChannel };
|
|
72
|
-
//# sourceMappingURL=debuggerRpc.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debuggerRpc.js","sources":["../../../../../../../../../../external/vscode-observables/observables/dist/observableInternal/logging/debugger/debuggerRpc.js"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { SimpleTypedRpcConnection } from './rpc.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction registerDebugChannel(channelId, createClient) {\n const g = globalThis;\n let queuedNotifications = [];\n let curHost = undefined;\n const { channel, handler } = createChannelFactoryFromDebugChannel({\n sendNotification: (data) => {\n if (curHost) {\n curHost.sendNotification(data);\n }\n else {\n queuedNotifications.push(data);\n }\n },\n });\n let curClient = undefined;\n (g.$$debugValueEditor_debugChannels ?? (g.$$debugValueEditor_debugChannels = {}))[channelId] = (host) => {\n curClient = createClient();\n curHost = host;\n for (const n of queuedNotifications) {\n host.sendNotification(n);\n }\n queuedNotifications = [];\n return handler;\n };\n return SimpleTypedRpcConnection.createClient(channel, () => {\n if (!curClient) {\n throw new Error('Not supported');\n }\n return curClient;\n });\n}\nfunction createChannelFactoryFromDebugChannel(host) {\n let h;\n const channel = (handler) => {\n h = handler;\n return {\n sendNotification: data => {\n host.sendNotification(data);\n },\n sendRequest: data => {\n throw new Error('not supported');\n },\n };\n };\n return {\n channel: channel,\n handler: {\n handleRequest: (data) => {\n if (data.type === 'notification') {\n return h?.handleNotification(data.data);\n }\n else {\n return h?.handleRequest(data.data);\n }\n },\n },\n };\n}\n\nexport { registerDebugChannel };\n//# sourceMappingURL=debuggerRpc.js.map\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA,SAAS,oBAAoB,CAAC,SAAS,EAAE,YAAY,EAAE;AACvD,IAAI,MAAM,CAAC,GAAG,UAAU;AACxB,IAAI,IAAI,mBAAmB,GAAG,EAAE;AAChC,IAAI,IAAI,OAAO,GAAG,SAAS;AAC3B,IAAI,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,oCAAoC,CAAC;AACtE,QAAQ,gBAAgB,EAAE,CAAC,IAAI,KAAK;AACpC,YAAY,IAAI,OAAO,EAAE;AACzB,gBAAgB,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC;AAC9C,YAAY;AACZ,iBAAiB;AACjB,gBAAgB,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC;AAC9C,YAAY;AACZ,QAAQ,CAAC;AACT,KAAK,CAAC;AACN,IAAI,IAAI,SAAS,GAAG,SAAS;AAC7B,IAAI,CAAC,CAAC,CAAC,gCAAgC,KAAK,CAAC,CAAC,gCAAgC,GAAG,EAAE,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,IAAI,KAAK;AAC7G,QAAQ,SAAS,GAAG,YAAY,EAAE;AAClC,QAAQ,OAAO,GAAG,IAAI;AACtB,QAAQ,KAAK,MAAM,CAAC,IAAI,mBAAmB,EAAE;AAC7C,YAAY,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;AACpC,QAAQ;AACR,QAAQ,mBAAmB,GAAG,EAAE;AAChC,QAAQ,OAAO,OAAO;AACtB,IAAI,CAAC;AACL,IAAI,OAAO,wBAAwB,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM;AAChE,QAAQ,IAAI,CAAC,SAAS,EAAE;AACxB,YAAY,MAAM,IAAI,KA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