File tree Expand file tree Collapse file tree
packages/angular/cli/src/commands/mcp Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,6 +71,14 @@ export interface Host {
7171 options: { cwd: string },
7272 ): AsyncIterable<{ name: string; parentPath: string; isFile(): boolean }>;
7373
74+ /**
75+ * Resolves a module request from a given path.
76+ * @param request The module request to resolve.
77+ * @param from The path from which to resolve the request.
78+ * @returns The resolved module path.
79+ */
80+ resolveModule(request: string, from: string): string;
81+
7482 /**
7583 * Spawns a child process and returns a promise that resolves with the process's
7684 * output or rejects with a structured error.
@@ -170,6 +178,10 @@ export const LocalWorkspaceHost: Host = {
170178 return nodeGlob(pattern, { ...options, withFileTypes: true });
171179 },
172180
181+ resolveModule(request: string, from: string): string {
182+ return createRequire(from).resolve(request);
183+ },
184+
173185 runCommand: async (
174186 command: string,
175187 args: readonly string[],
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ export class MockHost implements Host {
1818 existsSync = jasmine.createSpy('existsSync');
1919 readFile = jasmine.createSpy('readFile').and.resolveTo('');
2020 glob = jasmine.createSpy('glob').and.returnValue((async function* () {})());
21+ resolveModule = jasmine.createSpy('resolveRequest').and.returnValue('/dev/null');
2122 spawn = jasmine.createSpy('spawn');
2223 getAvailablePort = jasmine.createSpy('getAvailablePort');
2324 isPortAvailable = jasmine.createSpy('isPortAvailable').and.resolveTo(true);
You can’t perform that action at this time.
0 commit comments