Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/angular/cli/src/commands/mcp/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ export interface Host {
options: { cwd: string },
): AsyncIterable<{ name: string; parentPath: string; isFile(): boolean }>;

/**
* Resolves a module request from a given path.
* @param request The module request to resolve.
* @param from The path from which to resolve the request.
* @returns The resolved module path.
*/
resolveModule(request: string, from: string): string;
Comment thread
clydin marked this conversation as resolved.

/**
* Spawns a child process and returns a promise that resolves with the process's
* output or rejects with a structured error.
Expand Down Expand Up @@ -170,6 +178,10 @@ export const LocalWorkspaceHost: Host = {
return nodeGlob(pattern, { ...options, withFileTypes: true });
},

resolveModule(request: string, from: string): string {
return createRequire(from).resolve(request);
},
Comment thread
clydin marked this conversation as resolved.

runCommand: async (
command: string,
args: readonly string[],
Expand Down
1 change: 1 addition & 0 deletions packages/angular/cli/src/commands/mcp/testing/mock-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class MockHost implements Host {
existsSync = jasmine.createSpy('existsSync');
readFile = jasmine.createSpy('readFile').and.resolveTo('');
glob = jasmine.createSpy('glob').and.returnValue((async function* () {})());
resolveModule = jasmine.createSpy('resolveRequest').and.returnValue('/dev/null');
spawn = jasmine.createSpy('spawn');
getAvailablePort = jasmine.createSpy('getAvailablePort');
isPortAvailable = jasmine.createSpy('isPortAvailable').and.resolveTo(true);
Expand Down
Loading