Skip to content

Commit

Permalink
refactor(@angular-devkit/core): remove resolve methods and options
Browse files Browse the repository at this point in the history
BREAKING CHANGE: deprecated API's `ModuleNotFoundException`, `ResolveOptions`, `resolve` have been removed. Use `MODULE_NOT_FOUND` and `require.resolve` instead.

**Note**: this change only effect users using `@angular-devkit/core` public API and not application developers.
  • Loading branch information
alan-agius4 authored and mgechev committed Sep 2, 2020
1 parent 5d73e9d commit 208336d
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 388 deletions.
19 changes: 0 additions & 19 deletions etc/api/angular_devkit/core/node/_golden-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ export declare function isDirectory(filePath: string): boolean;

export declare function isFile(filePath: string): boolean;

export declare class ModuleNotFoundException extends BaseException {
readonly basePath: string;
readonly code: string;
readonly moduleName: string;
constructor(moduleName: string, basePath: string);
}

export declare class NodeJsAsyncHost implements virtualFs.Host<fs.Stats> {
get capabilities(): virtualFs.HostCapabilities;
delete(path: Path): Observable<void>;
Expand Down Expand Up @@ -47,15 +40,3 @@ export declare class NodeModuleJobRegistry<MinimumArgumentValueT extends JsonVal
export interface ProcessOutput {
write(buffer: string | Buffer): boolean;
}

export declare function resolve(packageName: string, options: ResolveOptions): string;

export interface ResolveOptions {
basedir: string;
checkGlobal?: boolean;
checkLocal?: boolean;
extensions?: string[];
paths?: string[];
preserveSymlinks?: boolean;
resolvePackageJson?: boolean;
}
26 changes: 0 additions & 26 deletions lib/bootstrap-local.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,29 +190,3 @@ if (!__dirname.match(new RegExp(`\\${path.sep}node_modules\\${path.sep}`))) {
}
};
}


// Set the resolve hook to allow resolution of packages from a local dev environment.
require('@angular-devkit/core/node/resolve').setResolveHook(function(request, options) {
try {
if (request in packages) {
if (options.resolvePackageJson) {
return path.join(packages[request].root, 'package.json');
} else {
return packages[request].main;
}
} else {
const match = Object.keys(packages).find(function(pkgName) {
return request.startsWith(pkgName + '/');
});

if (match) {
return path.join(packages[match].root, request.substr(match[0].length));
} else {
return null;
}
}
} catch (_) {
return null;
}
});
1 change: 0 additions & 1 deletion packages/angular_devkit/core/node/_golden-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ export * from './experimental/jobs/job-registry';
export * from './fs';
export * from './cli-logger';
export * from './host';
export { ModuleNotFoundException, ResolveOptions, resolve } from './resolve';
1 change: 0 additions & 1 deletion packages/angular_devkit/core/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import * as experimental from './experimental/jobs/job-registry';
import * as fs from './fs';
export * from './cli-logger';
export * from './host';
export { ModuleNotFoundException, ResolveOptions, resolve } from './resolve';

export {
experimental,
Expand Down
316 changes: 0 additions & 316 deletions packages/angular_devkit/core/node/resolve.ts

This file was deleted.

Loading

0 comments on commit 208336d

Please sign in to comment.