Skip to content

Commit

Permalink
refactor(@angular-devkit/core): deprecate old terminal and resolve APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-agius4 authored and vikerman committed Oct 22, 2019
1 parent a384a98 commit 613f7db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/angular_devkit/core/node/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { isFile } from './fs';

/**
* Exception thrown when a module could not be resolved.
* @deprecated since version 8. Use `MODULE_NOT_FOUND` Node error code instead.
*/
export class ModuleNotFoundException extends BaseException {
public readonly code: string;
Expand Down Expand Up @@ -70,6 +71,7 @@ function _getGlobalNodeModules() {
}


/** @deprecated since version 8. Use `require.resolve` instead. */
export interface ResolveOptions {
/**
* The basedir to use from which to resolve.
Expand Down Expand Up @@ -111,6 +113,7 @@ export interface ResolveOptions {


let _resolveHook: ((x: string, options: ResolveOptions) => string | null) | null = null;
/** @deprecated since version 8. Use `require.resolve` instead. */
export function setResolveHook(
hook: ((x: string, options: ResolveOptions) => string | null) | null,
) {
Expand All @@ -125,6 +128,7 @@ export function setResolveHook(
* @returns {string} Path to the index to include, or if `resolvePackageJson` option was
* passed, a path to that file.
* @throws {ModuleNotFoundException} If no module with that name was found anywhere.
* @deprecated since version 8. Use `require.resolve` instead.
*/
export function resolve(packageName: string, options: ResolveOptions): string {
if (_resolveHook) {
Expand Down
6 changes: 4 additions & 2 deletions packages/angular_devkit/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@ import * as analytics from './analytics';
import * as experimental from './experimental';
import * as json from './json/index';
import * as logging from './logger/index';
import * as terminal from './terminal/index';
import * as ɵterminal from './terminal/index';
import * as workspaces from './workspace';

export * from './exception/exception';
export * from './json/index';
export * from './utils/index';
export * from './virtual-fs/index';

/** @deprecated since version 8 - Instead use other 3rd party libraries like `colors` and `chalk`. */
export const terminal = ɵterminal;

export {
analytics,
experimental,
json,
logging,
terminal,
workspaces,
};

0 comments on commit 613f7db

Please sign in to comment.