diff --git a/packages/compiler-cli/index.ts b/packages/compiler-cli/index.ts index db4e16f2ce1..6fcdf482cf2 100644 --- a/packages/compiler-cli/index.ts +++ b/packages/compiler-cli/index.ts @@ -21,12 +21,19 @@ export * from './src/perform_compile'; export {CompilerOptions as AngularCompilerOptions} from './src/transformers/api'; export {ngToTsDiagnostic} from './src/transformers/util'; -export {NgTscPlugin} from './src/ngtsc/tsc_plugin'; -export {NgtscProgram} from './src/ngtsc/program'; // Internal exports needed for packages relying on the compiler-cli. // TODO: Consider moving into `@angular/compiler-cli/private`. This would // help with a consistent pattern for cross package imports for Angular. export * from './src/tooling'; +// Exposed as they are needed for relying on the `linker`. +export * from './src/ngtsc/logging'; +export * from './src/ngtsc/file_system'; + +// Exports for dealing with the `ngtsc` program. +export {NgTscPlugin} from './src/ngtsc/tsc_plugin'; +export {NgtscProgram} from './src/ngtsc/program'; +export {OptimizeFor} from './src/ngtsc/typecheck/api'; + setFileSystem(new NodeJSFileSystem()); diff --git a/packages/compiler-cli/ngcc/index.ts b/packages/compiler-cli/ngcc/index.ts index 2dfa3002b97..dc1ea337953 100644 --- a/packages/compiler-cli/ngcc/index.ts +++ b/packages/compiler-cli/ngcc/index.ts @@ -5,6 +5,8 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ + +import {join} from 'path'; import {NodeJSFileSystem, setFileSystem} from '../src/ngtsc/file_system'; import {mainNgcc} from './src/main'; @@ -20,3 +22,11 @@ export function process(options: AsyncNgccOptions|SyncNgccOptions): void|Promise setFileSystem(new NodeJSFileSystem()); return mainNgcc(options); } + +/** + * Absolute file path that points to the `ngcc` entry-point. + * + * This can be used by the Angular CLI to spawn a process running ngcc using + * command line options. + */ +export const ngccMainFilePath = join(__dirname, './main-ngcc.js'); diff --git a/packages/compiler-cli/package.json b/packages/compiler-cli/package.json index 98e05363fa7..c89b4bc3cb2 100644 --- a/packages/compiler-cli/package.json +++ b/packages/compiler-cli/package.json @@ -17,6 +17,10 @@ "./package.json": { "default": "./package.json" }, + "./ngcc": { + "types": "./ngcc/index.d.ts", + "default": "./bundles/ngcc/index.js" + }, "./linker": { "types": "./linker/index.d.ts", "default": "./bundles/linker/index.js"