@angular/compiler-cli

  • Version 13.3.8
  • Published
  • 2.7 MB
  • 10 dependencies
  • MIT license

Install

npm i @angular/compiler-cli
yarn add @angular/compiler-cli
pnpm add @angular/compiler-cli

Overview

Angular - the compiler CLI for Node.js

Index

Variables

Functions

Classes

Interfaces

Enums

Type Aliases

Variables

variable DEFAULT_ERROR_CODE

const DEFAULT_ERROR_CODE: number;

    variable GLOBAL_DEFS_FOR_TERSER

    const GLOBAL_DEFS_FOR_TERSER: { ngDevMode: boolean; ngI18nClosureMode: boolean };
    • Known values for global variables in @angular/core that Terser should set using https://github.com/terser-js/terser#conditional-compilation

    variable GLOBAL_DEFS_FOR_TERSER_WITH_AOT

    const GLOBAL_DEFS_FOR_TERSER_WITH_AOT: {
    ngJitMode: boolean;
    ngDevMode: boolean;
    ngI18nClosureMode: boolean;
    };

      variable LogicalProjectPath

      const LogicalProjectPath: {
      relativePathBetween: (
      from: LogicalProjectPath,
      to: LogicalProjectPath
      ) => PathSegment;
      };

        variable SOURCE

        const SOURCE: string;

          variable UNKNOWN_ERROR_CODE

          const UNKNOWN_ERROR_CODE: number;

            variable VERSION

            const VERSION: Version;

              Functions

              function absoluteFrom

              absoluteFrom: (path: string) => AbsoluteFsPath;
              • Convert the path path to an AbsoluteFsPath, throwing an error if it's not an absolute path.

              function absoluteFromSourceFile

              absoluteFromSourceFile: (sf: { fileName: string }) => AbsoluteFsPath;
              • Extract an AbsoluteFsPath from a ts.SourceFile-like object.

              function basename

              basename: (filePath: PathString, extension?: string) => PathSegment;
              • Static access to basename.

              function calcProjectFileAndBasePath

              calcProjectFileAndBasePath: (
              project: string,
              host?: ConfigurationHost
              ) => { projectFile: AbsoluteFsPath; basePath: AbsoluteFsPath };

                function constructorParametersDownlevelTransform

                constructorParametersDownlevelTransform: (
                program: ts.Program
                ) => ts.TransformerFactory<ts.SourceFile>;
                • Transform for downleveling Angular decorators and Angular-decorated class constructor parameters for dependency injection. This transform can be used by the CLI for JIT-mode compilation where constructor parameters and associated Angular decorators should be downleveled so that apps are not exposed to the ES2015 temporal dead zone limitation in TypeScript. See https://github.com/angular/angular-cli/pull/14473 for more details.

                function createCompilerHost

                createCompilerHost: ({
                options,
                tsHost,
                }: {
                options: CompilerOptions;
                tsHost?: ts.CompilerHost;
                }) => CompilerHost;

                  function createProgram

                  createProgram: ({
                  rootNames,
                  options,
                  host,
                  oldProgram,
                  }: {
                  rootNames: ReadonlyArray<string>;
                  options: CompilerOptions;
                  host: CompilerHost;
                  oldProgram?: Program;
                  }) => Program;

                    function defaultGatherDiagnostics

                    defaultGatherDiagnostics: (program: api.Program) => ReadonlyArray<ts.Diagnostic>;

                      function dirname

                      dirname: <T extends PathString>(file: T) => T;
                      • Static access to dirname.

                      function exitCodeFromResult

                      exitCodeFromResult: (diags: ReadonlyArray<ts.Diagnostic> | undefined) => number;

                        function formatDiagnostics

                        formatDiagnostics: (
                        diags: ReadonlyArray<ts.Diagnostic>,
                        host?: ts.FormatDiagnosticsHost
                        ) => string;

                          function getFileSystem

                          getFileSystem: () => FileSystem;

                            function getSourceFileOrError

                            getSourceFileOrError: (
                            program: ts.Program,
                            fileName: AbsoluteFsPath
                            ) => ts.SourceFile;

                              function isLocalRelativePath

                              isLocalRelativePath: (relativePath: string) => boolean;
                              • Returns true if the given path is locally relative.

                                This is used to work out if the given path is relative (i.e. not absolute) but also is not escaping the current directory.

                              function isRoot

                              isRoot: (path: AbsoluteFsPath) => boolean;
                              • Returns true when the path provided is the root path.

                              function isRooted

                              isRooted: (path: string) => boolean;
                              • Static access to isRooted.

                              function isTsDiagnostic

                              isTsDiagnostic: (diagnostic: any) => diagnostic is ts.Diagnostic;

                                function join

                                join: <T extends PathString>(basePath: T, ...paths: string[]) => T;
                                • Static access to join.

                                function performCompilation

                                performCompilation: ({
                                rootNames,
                                options,
                                host,
                                oldProgram,
                                emitCallback,
                                mergeEmitResultsCallback,
                                gatherDiagnostics,
                                customTransformers,
                                emitFlags,
                                modifiedResourceFiles,
                                }: {
                                rootNames: string[];
                                options: api.CompilerOptions;
                                host?: api.CompilerHost;
                                oldProgram?: api.Program;
                                emitCallback?: api.TsEmitCallback;
                                mergeEmitResultsCallback?: api.TsMergeEmitResultsCallback;
                                gatherDiagnostics?: (program: api.Program) => ReadonlyArray<ts.Diagnostic>;
                                customTransformers?: api.CustomTransformers;
                                emitFlags?: api.EmitFlags;
                                modifiedResourceFiles?: Set<string> | null;
                                }) => PerformCompilationResult;

                                  function readConfiguration

                                  readConfiguration: (
                                  project: string,
                                  existingOptions?: api.CompilerOptions,
                                  host?: ConfigurationHost
                                  ) => ParsedConfiguration;

                                    function relative

                                    relative: <T extends PathString>(from: T, to: T) => PathSegment | AbsoluteFsPath;
                                    • Static access to relative.

                                    function relativeFrom

                                    relativeFrom: (path: string) => PathSegment;
                                    • Convert the path path to a PathSegment, throwing an error if it's not a relative path.

                                    function resolve

                                    resolve: (basePath: string, ...paths: string[]) => AbsoluteFsPath;
                                    • Static access to resolves.

                                    function setFileSystem

                                    setFileSystem: (fileSystem: FileSystem) => void;

                                      function toRelativeImport

                                      toRelativeImport: (
                                      relativePath: PathSegment | AbsoluteFsPath
                                      ) => PathSegment | AbsoluteFsPath;
                                      • Converts a path to a form suitable for use as a relative module import specifier.

                                        In other words it adds the ./ to the path if it is locally relative.

                                      Classes

                                      class ConsoleLogger

                                      class ConsoleLogger implements Logger {}
                                      • A simple logger that outputs directly to the Console.

                                        The log messages can be filtered based on severity via the logLevel constructor parameter.

                                      constructor

                                      constructor(level: LogLevel);

                                        property level

                                        level: LogLevel;

                                          method debug

                                          debug: (...args: string[]) => void;

                                            method error

                                            error: (...args: string[]) => void;

                                              method info

                                              info: (...args: string[]) => void;

                                                method warn

                                                warn: (...args: string[]) => void;

                                                  class LogicalFileSystem

                                                  class LogicalFileSystem {}
                                                  • A utility class which can translate absolute paths to source files into logical paths in TypeScript's logical file system, based on the root directories of the project.

                                                  constructor

                                                  constructor(
                                                  rootDirs: AbsoluteFsPath[],
                                                  compilerHost: Pick<ts.CompilerHost, 'getCanonicalFileName'>
                                                  );

                                                    method logicalPathOfFile

                                                    logicalPathOfFile: (physicalFile: AbsoluteFsPath) => LogicalProjectPath | null;
                                                    • Get the logical path in the project of a source file.

                                                      Returns

                                                      A LogicalProjectPath to the source file, or null if the source file is not in any of the TS project's root directories.

                                                    method logicalPathOfSf

                                                    logicalPathOfSf: (sf: ts.SourceFile) => LogicalProjectPath | null;
                                                    • Get the logical path in the project of a ts.SourceFile.

                                                      This method is provided as a convenient alternative to calling logicalPathOfFile(absoluteFromSourceFile(sf)).

                                                    class NgtscCompilerHost

                                                    class NgtscCompilerHost implements ts.CompilerHost {}

                                                      constructor

                                                      constructor(fs: FileSystem, options?: ts.CompilerOptions);

                                                        property fs

                                                        protected fs: FileSystem;

                                                          property options

                                                          protected options: ts.CompilerOptions;

                                                            method fileExists

                                                            fileExists: (fileName: string) => boolean;

                                                              method getCanonicalFileName

                                                              getCanonicalFileName: (fileName: string) => string;

                                                                method getCurrentDirectory

                                                                getCurrentDirectory: () => string;

                                                                  method getDefaultLibFileName

                                                                  getDefaultLibFileName: (options: ts.CompilerOptions) => string;

                                                                    method getDefaultLibLocation

                                                                    getDefaultLibLocation: () => string;

                                                                      method getNewLine

                                                                      getNewLine: () => string;

                                                                        method getSourceFile

                                                                        getSourceFile: (
                                                                        fileName: string,
                                                                        languageVersion: ts.ScriptTarget
                                                                        ) => ts.SourceFile | undefined;

                                                                          method readFile

                                                                          readFile: (fileName: string) => string | undefined;

                                                                            method realpath

                                                                            realpath: (path: string) => string;

                                                                              method useCaseSensitiveFileNames

                                                                              useCaseSensitiveFileNames: () => boolean;

                                                                                method writeFile

                                                                                writeFile: (
                                                                                fileName: string,
                                                                                data: string,
                                                                                writeByteOrderMark: boolean,
                                                                                onError: (message: string) => void,
                                                                                sourceFiles?: ReadonlyArray<ts.SourceFile>
                                                                                ) => void;

                                                                                  class NgTscPlugin

                                                                                  class NgTscPlugin implements TscPlugin {}
                                                                                  • A plugin for tsc_wrapped which allows Angular compilation from a plain ts_library.

                                                                                  constructor

                                                                                  constructor(ngOptions: {});

                                                                                    property compiler

                                                                                    readonly compiler: NgCompiler;

                                                                                      property name

                                                                                      name: string;

                                                                                        method createTransformers

                                                                                        createTransformers: () => ts.CustomTransformers;

                                                                                          method getDiagnostics

                                                                                          getDiagnostics: (file?: ts.SourceFile) => ts.Diagnostic[];

                                                                                            method getNextProgram

                                                                                            getNextProgram: () => ts.Program;

                                                                                              method getOptionDiagnostics

                                                                                              getOptionDiagnostics: () => ts.Diagnostic[];

                                                                                                method setupCompilation

                                                                                                setupCompilation: (
                                                                                                program: ts.Program,
                                                                                                oldProgram?: ts.Program
                                                                                                ) => {
                                                                                                ignoreForDiagnostics: Set<ts.SourceFile>;
                                                                                                ignoreForEmit: Set<ts.SourceFile>;
                                                                                                };

                                                                                                  method wrapHost

                                                                                                  wrapHost: (
                                                                                                  host: ts.CompilerHost & Partial<UnifiedModulesHost>,
                                                                                                  inputFiles: readonly string[],
                                                                                                  options: ts.CompilerOptions
                                                                                                  ) => PluginCompilerHost;

                                                                                                    class NgtscProgram

                                                                                                    class NgtscProgram implements api.Program {}
                                                                                                    • Entrypoint to the Angular Compiler (Ivy+) which sits behind the api.Program interface, allowing it to be a drop-in replacement for the legacy View Engine compiler to tooling such as the command-line main() function or the Angular CLI.

                                                                                                    constructor

                                                                                                    constructor(
                                                                                                    rootNames: readonly string[],
                                                                                                    options: NgCompilerOptions,
                                                                                                    delegateHost: api.CompilerHost,
                                                                                                    oldProgram?: NgtscProgram
                                                                                                    );

                                                                                                      property compiler

                                                                                                      readonly compiler: NgCompiler;

                                                                                                        method emit

                                                                                                        emit: (
                                                                                                        opts?:
                                                                                                        | {
                                                                                                        emitFlags?: api.EmitFlags | undefined;
                                                                                                        cancellationToken?: ts.CancellationToken | undefined;
                                                                                                        customTransformers?: api.CustomTransformers | undefined;
                                                                                                        emitCallback?: api.TsEmitCallback | undefined;
                                                                                                        mergeEmitResultsCallback?:
                                                                                                        | api.TsMergeEmitResultsCallback
                                                                                                        | undefined;
                                                                                                        }
                                                                                                        | undefined
                                                                                                        ) => ts.EmitResult;

                                                                                                          method getEmittedSourceFiles

                                                                                                          getEmittedSourceFiles: () => Map<string, ts.SourceFile>;

                                                                                                            method getIndexedComponents

                                                                                                            getIndexedComponents: () => Map<DeclarationNode, IndexedComponent>;

                                                                                                              method getNgOptionDiagnostics

                                                                                                              getNgOptionDiagnostics: (
                                                                                                              cancellationToken?: ts.CancellationToken | undefined
                                                                                                              ) => readonly ts.Diagnostic[];

                                                                                                                method getNgSemanticDiagnostics

                                                                                                                getNgSemanticDiagnostics: (
                                                                                                                fileName?: string | undefined,
                                                                                                                cancellationToken?: ts.CancellationToken | undefined
                                                                                                                ) => readonly ts.Diagnostic[];

                                                                                                                  method getNgStructuralDiagnostics

                                                                                                                  getNgStructuralDiagnostics: (
                                                                                                                  cancellationToken?: ts.CancellationToken | undefined
                                                                                                                  ) => readonly ts.Diagnostic[];

                                                                                                                    method getReuseTsProgram

                                                                                                                    getReuseTsProgram: () => ts.Program;

                                                                                                                      method getTsOptionDiagnostics

                                                                                                                      getTsOptionDiagnostics: (
                                                                                                                      cancellationToken?: ts.CancellationToken | undefined
                                                                                                                      ) => readonly ts.Diagnostic[];

                                                                                                                        method getTsProgram

                                                                                                                        getTsProgram: () => ts.Program;

                                                                                                                          method getTsSemanticDiagnostics

                                                                                                                          getTsSemanticDiagnostics: (
                                                                                                                          sourceFile?: ts.SourceFile | undefined,
                                                                                                                          cancellationToken?: ts.CancellationToken | undefined
                                                                                                                          ) => readonly ts.Diagnostic[];

                                                                                                                            method getTsSyntacticDiagnostics

                                                                                                                            getTsSyntacticDiagnostics: (
                                                                                                                            sourceFile?: ts.SourceFile | undefined,
                                                                                                                            cancellationToken?: ts.CancellationToken | undefined
                                                                                                                            ) => readonly ts.Diagnostic[];

                                                                                                                              method listLazyRoutes

                                                                                                                              listLazyRoutes: (entryRoute?: string | undefined) => api.LazyRoute[];

                                                                                                                                method loadNgStructureAsync

                                                                                                                                loadNgStructureAsync: () => Promise<void>;
                                                                                                                                • Ensure that the NgCompiler has properly analyzed the program, and allow for the asynchronous loading of any resources during the process.

                                                                                                                                  This is used by the Angular CLI to allow for spawning (async) child compilations for things like SASS files used in styleUrls.

                                                                                                                                class NodeJSFileSystem

                                                                                                                                class NodeJSFileSystem extends NodeJSReadonlyFileSystem implements FileSystem {}
                                                                                                                                • A wrapper around the Node.js file-system (i.e. the fs package).

                                                                                                                                method copyFile

                                                                                                                                copyFile: (from: AbsoluteFsPath, to: AbsoluteFsPath) => void;

                                                                                                                                  method ensureDir

                                                                                                                                  ensureDir: (path: AbsoluteFsPath) => void;

                                                                                                                                    method moveFile

                                                                                                                                    moveFile: (from: AbsoluteFsPath, to: AbsoluteFsPath) => void;

                                                                                                                                      method removeDeep

                                                                                                                                      removeDeep: (path: AbsoluteFsPath) => void;

                                                                                                                                        method removeFile

                                                                                                                                        removeFile: (path: AbsoluteFsPath) => void;
                                                                                                                                          symlink: (target: AbsoluteFsPath, path: AbsoluteFsPath) => void;

                                                                                                                                            method writeFile

                                                                                                                                            writeFile: (
                                                                                                                                            path: AbsoluteFsPath,
                                                                                                                                            data: string | Uint8Array,
                                                                                                                                            exclusive?: boolean
                                                                                                                                            ) => void;

                                                                                                                                              Interfaces

                                                                                                                                              interface AngularCompilerOptions

                                                                                                                                              interface CompilerOptions extends NgCompilerOptions, ts.CompilerOptions {}

                                                                                                                                                property annotationsAs

                                                                                                                                                annotationsAs?: 'decorators' | 'static fields';

                                                                                                                                                  property basePath

                                                                                                                                                  basePath?: string;

                                                                                                                                                    property createExternalSymbolFactoryReexports

                                                                                                                                                    createExternalSymbolFactoryReexports?: boolean;
                                                                                                                                                    • Whether NGC should generate re-exports for external symbols which are referenced in Angular metadata (e.g. @Component, @Inject, @ViewChild). This can be enabled in order to avoid dynamically generated module dependencies which can break strict dependency enforcements. This is not enabled by default. Read more about this here: https://github.com/angular/angular/issues/25644.

                                                                                                                                                    property disableExpressionLowering

                                                                                                                                                    disableExpressionLowering?: boolean;

                                                                                                                                                      property enableResourceInlining

                                                                                                                                                      enableResourceInlining?: boolean;
                                                                                                                                                      • Whether to replace the templateUrl and styleUrls property in all decorators with inlined contents in template and styles properties. When enabled, the .js output of ngc will have no lazy-loaded templateUrl or styleUrls. Note that this requires that resources be available to load statically at compile-time.

                                                                                                                                                      property enableSummariesForJit

                                                                                                                                                      enableSummariesForJit?: boolean;
                                                                                                                                                      • Whether to generate .ngsummary.ts files that allow to use AOTed artifacts in JIT mode. This is off by default.

                                                                                                                                                      property flatModulePrivateSymbolPrefix

                                                                                                                                                      flatModulePrivateSymbolPrefix?: string;

                                                                                                                                                        property genDir

                                                                                                                                                        genDir?: string;

                                                                                                                                                          property generateCodeForLibraries

                                                                                                                                                          generateCodeForLibraries?: boolean;

                                                                                                                                                            property i18nInFile

                                                                                                                                                            i18nInFile?: string;

                                                                                                                                                              property i18nInFormat

                                                                                                                                                              i18nInFormat?: string;

                                                                                                                                                                property i18nInMissingTranslations

                                                                                                                                                                i18nInMissingTranslations?: 'error' | 'warning' | 'ignore';

                                                                                                                                                                  property skipMetadataEmit

                                                                                                                                                                  skipMetadataEmit?: boolean;

                                                                                                                                                                    property skipTemplateCodegen

                                                                                                                                                                    skipTemplateCodegen?: boolean;

                                                                                                                                                                      property strictMetadataEmit

                                                                                                                                                                      strictMetadataEmit?: boolean;

                                                                                                                                                                        property trace

                                                                                                                                                                        trace?: boolean;

                                                                                                                                                                          interface CompilerHost

                                                                                                                                                                          interface CompilerHost extends ts.CompilerHost, ExtendedTsCompilerHost {}

                                                                                                                                                                            method amdModuleName

                                                                                                                                                                            amdModuleName: (sf: ts.SourceFile) => string | undefined;
                                                                                                                                                                            • Produce an AMD module name for the source file. Used in Bazel.

                                                                                                                                                                              An AMD module can have an arbitrary name, so that it is require'd by name rather than by path. See https://requirejs.org/docs/whyamd.html#namedmodules

                                                                                                                                                                            method fromSummaryFileName

                                                                                                                                                                            fromSummaryFileName: (fileName: string, referringLibFileName: string) => string;
                                                                                                                                                                            • Converts a fileName that was processed by toSummaryFileName back into a real fileName given the fileName of the library that is referrig to it.

                                                                                                                                                                            method moduleNameToFileName

                                                                                                                                                                            moduleNameToFileName: (
                                                                                                                                                                            moduleName: string,
                                                                                                                                                                            containingFile: string
                                                                                                                                                                            ) => string | null;
                                                                                                                                                                            • Converts a module name that is used in an import to a file path. I.e. path/to/containingFile.ts containing import {...} from 'module-name'.

                                                                                                                                                                            method toSummaryFileName

                                                                                                                                                                            toSummaryFileName: (fileName: string, referringSrcFileName: string) => string;
                                                                                                                                                                            • Converts a file name into a representation that should be stored in a summary file. This has to include changing the suffix as well. E.g. some_file.ts -> some_file.d.ts

                                                                                                                                                                              Parameter referringSrcFileName

                                                                                                                                                                              the soure file that refers to fileName

                                                                                                                                                                            interface CompilerOptions

                                                                                                                                                                            interface CompilerOptions extends NgCompilerOptions, ts.CompilerOptions {}

                                                                                                                                                                              property annotationsAs

                                                                                                                                                                              annotationsAs?: 'decorators' | 'static fields';

                                                                                                                                                                                property basePath

                                                                                                                                                                                basePath?: string;

                                                                                                                                                                                  property createExternalSymbolFactoryReexports

                                                                                                                                                                                  createExternalSymbolFactoryReexports?: boolean;
                                                                                                                                                                                  • Whether NGC should generate re-exports for external symbols which are referenced in Angular metadata (e.g. @Component, @Inject, @ViewChild). This can be enabled in order to avoid dynamically generated module dependencies which can break strict dependency enforcements. This is not enabled by default. Read more about this here: https://github.com/angular/angular/issues/25644.

                                                                                                                                                                                  property disableExpressionLowering

                                                                                                                                                                                  disableExpressionLowering?: boolean;

                                                                                                                                                                                    property enableResourceInlining

                                                                                                                                                                                    enableResourceInlining?: boolean;
                                                                                                                                                                                    • Whether to replace the templateUrl and styleUrls property in all decorators with inlined contents in template and styles properties. When enabled, the .js output of ngc will have no lazy-loaded templateUrl or styleUrls. Note that this requires that resources be available to load statically at compile-time.

                                                                                                                                                                                    property enableSummariesForJit

                                                                                                                                                                                    enableSummariesForJit?: boolean;
                                                                                                                                                                                    • Whether to generate .ngsummary.ts files that allow to use AOTed artifacts in JIT mode. This is off by default.

                                                                                                                                                                                    property flatModulePrivateSymbolPrefix

                                                                                                                                                                                    flatModulePrivateSymbolPrefix?: string;

                                                                                                                                                                                      property genDir

                                                                                                                                                                                      genDir?: string;

                                                                                                                                                                                        property generateCodeForLibraries

                                                                                                                                                                                        generateCodeForLibraries?: boolean;

                                                                                                                                                                                          property i18nInFile

                                                                                                                                                                                          i18nInFile?: string;

                                                                                                                                                                                            property i18nInFormat

                                                                                                                                                                                            i18nInFormat?: string;

                                                                                                                                                                                              property i18nInMissingTranslations

                                                                                                                                                                                              i18nInMissingTranslations?: 'error' | 'warning' | 'ignore';

                                                                                                                                                                                                property skipMetadataEmit

                                                                                                                                                                                                skipMetadataEmit?: boolean;

                                                                                                                                                                                                  property skipTemplateCodegen

                                                                                                                                                                                                  skipTemplateCodegen?: boolean;

                                                                                                                                                                                                    property strictMetadataEmit

                                                                                                                                                                                                    strictMetadataEmit?: boolean;

                                                                                                                                                                                                      property trace

                                                                                                                                                                                                      trace?: boolean;

                                                                                                                                                                                                        interface CustomTransformers

                                                                                                                                                                                                        interface CustomTransformers {}

                                                                                                                                                                                                          property afterTs

                                                                                                                                                                                                          afterTs?: ts.TransformerFactory<ts.SourceFile>[];

                                                                                                                                                                                                            property beforeTs

                                                                                                                                                                                                            beforeTs?: ts.TransformerFactory<ts.SourceFile>[];

                                                                                                                                                                                                              interface FileStats

                                                                                                                                                                                                              interface FileStats {}
                                                                                                                                                                                                              • Information about an object in the FileSystem. This is analogous to the fs.Stats class in Node.js.

                                                                                                                                                                                                              method isDirectory

                                                                                                                                                                                                              isDirectory: () => boolean;

                                                                                                                                                                                                                method isFile

                                                                                                                                                                                                                isFile: () => boolean;
                                                                                                                                                                                                                  isSymbolicLink: () => boolean;

                                                                                                                                                                                                                    interface FileSystem

                                                                                                                                                                                                                    interface FileSystem extends ReadonlyFileSystem {}
                                                                                                                                                                                                                    • A basic interface to abstract the underlying file-system.

                                                                                                                                                                                                                      This makes it easier to provide mock file-systems in unit tests, but also to create clever file-systems that have features such as caching.

                                                                                                                                                                                                                    method copyFile

                                                                                                                                                                                                                    copyFile: (from: AbsoluteFsPath, to: AbsoluteFsPath) => void;

                                                                                                                                                                                                                      method ensureDir

                                                                                                                                                                                                                      ensureDir: (path: AbsoluteFsPath) => void;

                                                                                                                                                                                                                        method moveFile

                                                                                                                                                                                                                        moveFile: (from: AbsoluteFsPath, to: AbsoluteFsPath) => void;

                                                                                                                                                                                                                          method removeDeep

                                                                                                                                                                                                                          removeDeep: (path: AbsoluteFsPath) => void;

                                                                                                                                                                                                                            method removeFile

                                                                                                                                                                                                                            removeFile: (path: AbsoluteFsPath) => void;
                                                                                                                                                                                                                              symlink: (target: AbsoluteFsPath, path: AbsoluteFsPath) => void;

                                                                                                                                                                                                                                method writeFile

                                                                                                                                                                                                                                writeFile: (
                                                                                                                                                                                                                                path: AbsoluteFsPath,
                                                                                                                                                                                                                                data: string | Uint8Array,
                                                                                                                                                                                                                                exclusive?: boolean
                                                                                                                                                                                                                                ) => void;

                                                                                                                                                                                                                                  interface LazyRoute

                                                                                                                                                                                                                                  interface LazyRoute {}

                                                                                                                                                                                                                                    property module

                                                                                                                                                                                                                                    module: {
                                                                                                                                                                                                                                    name: string;
                                                                                                                                                                                                                                    filePath: string;
                                                                                                                                                                                                                                    };

                                                                                                                                                                                                                                      property referencedModule

                                                                                                                                                                                                                                      referencedModule: {
                                                                                                                                                                                                                                      name: string;
                                                                                                                                                                                                                                      filePath: string;
                                                                                                                                                                                                                                      };

                                                                                                                                                                                                                                        property route

                                                                                                                                                                                                                                        route: string;

                                                                                                                                                                                                                                          interface Logger

                                                                                                                                                                                                                                          interface Logger {}
                                                                                                                                                                                                                                          • Implement this interface if you want to provide different logging output from the standard ConsoleLogger.

                                                                                                                                                                                                                                          property level

                                                                                                                                                                                                                                          level: LogLevel;

                                                                                                                                                                                                                                            method debug

                                                                                                                                                                                                                                            debug: (...args: string[]) => void;

                                                                                                                                                                                                                                              method error

                                                                                                                                                                                                                                              error: (...args: string[]) => void;

                                                                                                                                                                                                                                                method info

                                                                                                                                                                                                                                                info: (...args: string[]) => void;

                                                                                                                                                                                                                                                  method warn

                                                                                                                                                                                                                                                  warn: (...args: string[]) => void;

                                                                                                                                                                                                                                                    interface ParsedConfiguration

                                                                                                                                                                                                                                                    interface ParsedConfiguration {}

                                                                                                                                                                                                                                                      property emitFlags

                                                                                                                                                                                                                                                      emitFlags: api.EmitFlags;

                                                                                                                                                                                                                                                        property errors

                                                                                                                                                                                                                                                        errors: ts.Diagnostic[];

                                                                                                                                                                                                                                                          property options

                                                                                                                                                                                                                                                          options: api.CompilerOptions;

                                                                                                                                                                                                                                                            property project

                                                                                                                                                                                                                                                            project: string;

                                                                                                                                                                                                                                                              property projectReferences

                                                                                                                                                                                                                                                              projectReferences?: readonly ts.ProjectReference[] | undefined;

                                                                                                                                                                                                                                                                property rootNames

                                                                                                                                                                                                                                                                rootNames: string[];

                                                                                                                                                                                                                                                                  interface PathManipulation

                                                                                                                                                                                                                                                                  interface PathManipulation {}
                                                                                                                                                                                                                                                                  • An abstraction over the path manipulation aspects of a file-system.

                                                                                                                                                                                                                                                                  method basename

                                                                                                                                                                                                                                                                  basename: (filePath: string, extension?: string) => PathSegment;

                                                                                                                                                                                                                                                                    method chdir

                                                                                                                                                                                                                                                                    chdir: (path: AbsoluteFsPath) => void;

                                                                                                                                                                                                                                                                      method dirname

                                                                                                                                                                                                                                                                      dirname: <T extends PathString>(file: T) => T;

                                                                                                                                                                                                                                                                        method extname

                                                                                                                                                                                                                                                                        extname: {
                                                                                                                                                                                                                                                                        (path: AbsoluteFsPath | PathSegment): string;
                                                                                                                                                                                                                                                                        (path: AbsoluteFsPath | PathSegment): string;
                                                                                                                                                                                                                                                                        };

                                                                                                                                                                                                                                                                          method isRoot

                                                                                                                                                                                                                                                                          isRoot: (path: AbsoluteFsPath) => boolean;

                                                                                                                                                                                                                                                                            method isRooted

                                                                                                                                                                                                                                                                            isRooted: (path: string) => boolean;

                                                                                                                                                                                                                                                                              method join

                                                                                                                                                                                                                                                                              join: <T extends PathString>(basePath: T, ...paths: string[]) => T;

                                                                                                                                                                                                                                                                                method normalize

                                                                                                                                                                                                                                                                                normalize: <T extends PathString>(path: T) => T;

                                                                                                                                                                                                                                                                                  method pwd

                                                                                                                                                                                                                                                                                  pwd: () => AbsoluteFsPath;

                                                                                                                                                                                                                                                                                    method relative

                                                                                                                                                                                                                                                                                    relative: <T extends PathString>(from: T, to: T) => PathSegment | AbsoluteFsPath;
                                                                                                                                                                                                                                                                                    • Compute the relative path between from and to.

                                                                                                                                                                                                                                                                                      In file-systems that can have multiple file trees the returned path may not actually be "relative" (i.e. PathSegment). For example, Windows can have multiple drives : relative('c:/a/b', 'd:/a/c') would be `d:/a/c'.

                                                                                                                                                                                                                                                                                    method resolve

                                                                                                                                                                                                                                                                                    resolve: (...paths: string[]) => AbsoluteFsPath;

                                                                                                                                                                                                                                                                                      interface PerformCompilationResult

                                                                                                                                                                                                                                                                                      interface PerformCompilationResult {}

                                                                                                                                                                                                                                                                                        property diagnostics

                                                                                                                                                                                                                                                                                        diagnostics: ReadonlyArray<ts.Diagnostic>;

                                                                                                                                                                                                                                                                                          property emitResult

                                                                                                                                                                                                                                                                                          emitResult?: ts.EmitResult;

                                                                                                                                                                                                                                                                                            property program

                                                                                                                                                                                                                                                                                            program?: api.Program;

                                                                                                                                                                                                                                                                                              interface Program

                                                                                                                                                                                                                                                                                              interface Program {}

                                                                                                                                                                                                                                                                                                method emit

                                                                                                                                                                                                                                                                                                emit: ({
                                                                                                                                                                                                                                                                                                emitFlags,
                                                                                                                                                                                                                                                                                                cancellationToken,
                                                                                                                                                                                                                                                                                                customTransformers,
                                                                                                                                                                                                                                                                                                emitCallback,
                                                                                                                                                                                                                                                                                                mergeEmitResultsCallback,
                                                                                                                                                                                                                                                                                                }?: {
                                                                                                                                                                                                                                                                                                emitFlags?: EmitFlags;
                                                                                                                                                                                                                                                                                                cancellationToken?: ts.CancellationToken;
                                                                                                                                                                                                                                                                                                customTransformers?: CustomTransformers;
                                                                                                                                                                                                                                                                                                emitCallback?: TsEmitCallback;
                                                                                                                                                                                                                                                                                                mergeEmitResultsCallback?: TsMergeEmitResultsCallback;
                                                                                                                                                                                                                                                                                                }) => ts.EmitResult;
                                                                                                                                                                                                                                                                                                • Emit the files requested by emitFlags implied by the program.

                                                                                                                                                                                                                                                                                                  Angular structural information is required to emit files.

                                                                                                                                                                                                                                                                                                method getNgOptionDiagnostics

                                                                                                                                                                                                                                                                                                getNgOptionDiagnostics: (
                                                                                                                                                                                                                                                                                                cancellationToken?: ts.CancellationToken
                                                                                                                                                                                                                                                                                                ) => ReadonlyArray<ts.Diagnostic>;
                                                                                                                                                                                                                                                                                                • Retrieve options diagnostics for the Angular options used to create the program.

                                                                                                                                                                                                                                                                                                method getNgSemanticDiagnostics

                                                                                                                                                                                                                                                                                                getNgSemanticDiagnostics: (
                                                                                                                                                                                                                                                                                                fileName?: string,
                                                                                                                                                                                                                                                                                                cancellationToken?: ts.CancellationToken
                                                                                                                                                                                                                                                                                                ) => ReadonlyArray<ts.Diagnostic>;
                                                                                                                                                                                                                                                                                                • Retrieve the Angular semantic diagnostics.

                                                                                                                                                                                                                                                                                                  Angular structural information is required to produce these diagnostics.

                                                                                                                                                                                                                                                                                                method getNgStructuralDiagnostics

                                                                                                                                                                                                                                                                                                getNgStructuralDiagnostics: (
                                                                                                                                                                                                                                                                                                cancellationToken?: ts.CancellationToken
                                                                                                                                                                                                                                                                                                ) => ReadonlyArray<ts.Diagnostic>;
                                                                                                                                                                                                                                                                                                • Retrieve the diagnostics for the structure of an Angular application is correctly formed. This includes validating Angular annotations and the syntax of referenced and imbedded HTML and CSS.

                                                                                                                                                                                                                                                                                                  Note it is important to displaying TypeScript semantic diagnostics along with Angular structural diagnostics as an error in the program structure might cause errors detected in semantic analysis and a semantic error might cause errors in specifying the program structure.

                                                                                                                                                                                                                                                                                                  Angular structural information is required to produce these diagnostics.

                                                                                                                                                                                                                                                                                                method getTsOptionDiagnostics

                                                                                                                                                                                                                                                                                                getTsOptionDiagnostics: (
                                                                                                                                                                                                                                                                                                cancellationToken?: ts.CancellationToken
                                                                                                                                                                                                                                                                                                ) => ReadonlyArray<ts.Diagnostic>;
                                                                                                                                                                                                                                                                                                • Retrieve options diagnostics for the TypeScript options used to create the program. This is faster than calling getTsProgram().getOptionsDiagnostics() since it does not need to collect Angular structural information to produce the errors.

                                                                                                                                                                                                                                                                                                method getTsProgram

                                                                                                                                                                                                                                                                                                getTsProgram: () => ts.Program;
                                                                                                                                                                                                                                                                                                • Retrieve the TypeScript program used to produce semantic diagnostics and emit the sources.

                                                                                                                                                                                                                                                                                                  Angular structural information is required to produce the program.

                                                                                                                                                                                                                                                                                                method getTsSemanticDiagnostics

                                                                                                                                                                                                                                                                                                getTsSemanticDiagnostics: (
                                                                                                                                                                                                                                                                                                sourceFile?: ts.SourceFile,
                                                                                                                                                                                                                                                                                                cancellationToken?: ts.CancellationToken
                                                                                                                                                                                                                                                                                                ) => ReadonlyArray<ts.Diagnostic>;
                                                                                                                                                                                                                                                                                                • Retrieve the semantic diagnostics from TypeScript. This is equivalent to calling getTsProgram().getSemanticDiagnostics() directly and is included for completeness.

                                                                                                                                                                                                                                                                                                method getTsSyntacticDiagnostics

                                                                                                                                                                                                                                                                                                getTsSyntacticDiagnostics: (
                                                                                                                                                                                                                                                                                                sourceFile?: ts.SourceFile,
                                                                                                                                                                                                                                                                                                cancellationToken?: ts.CancellationToken
                                                                                                                                                                                                                                                                                                ) => ReadonlyArray<ts.Diagnostic>;
                                                                                                                                                                                                                                                                                                • Retrieve the syntax diagnostics from TypeScript. This is faster than calling getTsProgram().getSyntacticDiagnostics() since it does not need to collect Angular structural information to produce the errors.

                                                                                                                                                                                                                                                                                                method listLazyRoutes

                                                                                                                                                                                                                                                                                                listLazyRoutes: (entryRoute?: string) => LazyRoute[];
                                                                                                                                                                                                                                                                                                • This method is obsolete and always returns an empty array.

                                                                                                                                                                                                                                                                                                method loadNgStructureAsync

                                                                                                                                                                                                                                                                                                loadNgStructureAsync: () => Promise<void>;
                                                                                                                                                                                                                                                                                                • Load Angular structural information asynchronously. If this method is not called then the Angular structural information, including referenced HTML and CSS files, are loaded synchronously. If the supplied Angular compiler host returns a promise from loadResource() will produce a diagnostic error message or, getTsProgram() or emit to throw.

                                                                                                                                                                                                                                                                                                interface ReadonlyFileSystem

                                                                                                                                                                                                                                                                                                interface ReadonlyFileSystem extends PathManipulation {}
                                                                                                                                                                                                                                                                                                • An abstraction over the read-only aspects of a file-system.

                                                                                                                                                                                                                                                                                                method exists

                                                                                                                                                                                                                                                                                                exists: (path: AbsoluteFsPath) => boolean;

                                                                                                                                                                                                                                                                                                  method getDefaultLibLocation

                                                                                                                                                                                                                                                                                                  getDefaultLibLocation: () => AbsoluteFsPath;

                                                                                                                                                                                                                                                                                                    method isCaseSensitive

                                                                                                                                                                                                                                                                                                    isCaseSensitive: () => boolean;

                                                                                                                                                                                                                                                                                                      method lstat

                                                                                                                                                                                                                                                                                                      lstat: (path: AbsoluteFsPath) => FileStats;

                                                                                                                                                                                                                                                                                                        method readdir

                                                                                                                                                                                                                                                                                                        readdir: (path: AbsoluteFsPath) => PathSegment[];

                                                                                                                                                                                                                                                                                                          method readFile

                                                                                                                                                                                                                                                                                                          readFile: (path: AbsoluteFsPath) => string;

                                                                                                                                                                                                                                                                                                            method readFileBuffer

                                                                                                                                                                                                                                                                                                            readFileBuffer: (path: AbsoluteFsPath) => Uint8Array;

                                                                                                                                                                                                                                                                                                              method realpath

                                                                                                                                                                                                                                                                                                              realpath: (filePath: AbsoluteFsPath) => AbsoluteFsPath;

                                                                                                                                                                                                                                                                                                                method stat

                                                                                                                                                                                                                                                                                                                stat: (path: AbsoluteFsPath) => FileStats;

                                                                                                                                                                                                                                                                                                                  interface TsEmitArguments

                                                                                                                                                                                                                                                                                                                  interface TsEmitArguments {}

                                                                                                                                                                                                                                                                                                                    property cancellationToken

                                                                                                                                                                                                                                                                                                                    cancellationToken?: ts.CancellationToken;

                                                                                                                                                                                                                                                                                                                      property customTransformers

                                                                                                                                                                                                                                                                                                                      customTransformers?: ts.CustomTransformers;

                                                                                                                                                                                                                                                                                                                        property emitOnlyDtsFiles

                                                                                                                                                                                                                                                                                                                        emitOnlyDtsFiles?: boolean;

                                                                                                                                                                                                                                                                                                                          property host

                                                                                                                                                                                                                                                                                                                          host: CompilerHost;

                                                                                                                                                                                                                                                                                                                            property options

                                                                                                                                                                                                                                                                                                                            options: CompilerOptions;

                                                                                                                                                                                                                                                                                                                              property program

                                                                                                                                                                                                                                                                                                                              program: ts.Program;

                                                                                                                                                                                                                                                                                                                                property targetSourceFile

                                                                                                                                                                                                                                                                                                                                targetSourceFile?: ts.SourceFile;

                                                                                                                                                                                                                                                                                                                                  property writeFile

                                                                                                                                                                                                                                                                                                                                  writeFile?: ts.WriteFileCallback;

                                                                                                                                                                                                                                                                                                                                    interface TsEmitCallback

                                                                                                                                                                                                                                                                                                                                    interface TsEmitCallback {}

                                                                                                                                                                                                                                                                                                                                      call signature

                                                                                                                                                                                                                                                                                                                                      (args: TsEmitArguments): ts.EmitResult;

                                                                                                                                                                                                                                                                                                                                        interface TsMergeEmitResultsCallback

                                                                                                                                                                                                                                                                                                                                        interface TsMergeEmitResultsCallback {}

                                                                                                                                                                                                                                                                                                                                          call signature

                                                                                                                                                                                                                                                                                                                                          (results: ts.EmitResult[]): ts.EmitResult;

                                                                                                                                                                                                                                                                                                                                            Enums

                                                                                                                                                                                                                                                                                                                                            enum EmitFlags

                                                                                                                                                                                                                                                                                                                                            enum EmitFlags {
                                                                                                                                                                                                                                                                                                                                            DTS = 1,
                                                                                                                                                                                                                                                                                                                                            JS = 2,
                                                                                                                                                                                                                                                                                                                                            Metadata = 4,
                                                                                                                                                                                                                                                                                                                                            I18nBundle = 8,
                                                                                                                                                                                                                                                                                                                                            Codegen = 16,
                                                                                                                                                                                                                                                                                                                                            Default = 19,
                                                                                                                                                                                                                                                                                                                                            All = 31,
                                                                                                                                                                                                                                                                                                                                            }

                                                                                                                                                                                                                                                                                                                                              member All

                                                                                                                                                                                                                                                                                                                                              All = 31

                                                                                                                                                                                                                                                                                                                                                member Codegen

                                                                                                                                                                                                                                                                                                                                                Codegen = 16

                                                                                                                                                                                                                                                                                                                                                  member Default

                                                                                                                                                                                                                                                                                                                                                  Default = 19

                                                                                                                                                                                                                                                                                                                                                    member DTS

                                                                                                                                                                                                                                                                                                                                                    DTS = 1

                                                                                                                                                                                                                                                                                                                                                      member I18nBundle

                                                                                                                                                                                                                                                                                                                                                      I18nBundle = 8

                                                                                                                                                                                                                                                                                                                                                        member JS

                                                                                                                                                                                                                                                                                                                                                        JS = 2

                                                                                                                                                                                                                                                                                                                                                          member Metadata

                                                                                                                                                                                                                                                                                                                                                          Metadata = 4

                                                                                                                                                                                                                                                                                                                                                            enum LogLevel

                                                                                                                                                                                                                                                                                                                                                            enum LogLevel {
                                                                                                                                                                                                                                                                                                                                                            debug = 0,
                                                                                                                                                                                                                                                                                                                                                            info = 1,
                                                                                                                                                                                                                                                                                                                                                            warn = 2,
                                                                                                                                                                                                                                                                                                                                                            error = 3,
                                                                                                                                                                                                                                                                                                                                                            }

                                                                                                                                                                                                                                                                                                                                                              member debug

                                                                                                                                                                                                                                                                                                                                                              debug = 0

                                                                                                                                                                                                                                                                                                                                                                member error

                                                                                                                                                                                                                                                                                                                                                                error = 3

                                                                                                                                                                                                                                                                                                                                                                  member info

                                                                                                                                                                                                                                                                                                                                                                  info = 1

                                                                                                                                                                                                                                                                                                                                                                    member warn

                                                                                                                                                                                                                                                                                                                                                                    warn = 2

                                                                                                                                                                                                                                                                                                                                                                      enum OptimizeFor

                                                                                                                                                                                                                                                                                                                                                                      enum OptimizeFor {
                                                                                                                                                                                                                                                                                                                                                                      SingleFile = 0,
                                                                                                                                                                                                                                                                                                                                                                      WholeProgram = 1,
                                                                                                                                                                                                                                                                                                                                                                      }
                                                                                                                                                                                                                                                                                                                                                                      • Describes the scope of the caller's interest in template type-checking results.

                                                                                                                                                                                                                                                                                                                                                                      member SingleFile

                                                                                                                                                                                                                                                                                                                                                                      SingleFile = 0
                                                                                                                                                                                                                                                                                                                                                                      • Indicates that a consumer of a TemplateTypeChecker is only interested in results for a given file, and wants them as fast as possible.

                                                                                                                                                                                                                                                                                                                                                                        Calling TemplateTypeChecker methods successively for multiple files while specifying OptimizeFor.SingleFile can result in significant unnecessary overhead overall.

                                                                                                                                                                                                                                                                                                                                                                      member WholeProgram

                                                                                                                                                                                                                                                                                                                                                                      WholeProgram = 1
                                                                                                                                                                                                                                                                                                                                                                      • Indicates that a consumer of a TemplateTypeChecker intends to query for results pertaining to the entire user program, and so the type-checker should internally optimize for this case.

                                                                                                                                                                                                                                                                                                                                                                        Initial calls to retrieve type-checking information may take longer, but repeated calls to gather information for the whole user program will be significantly faster with this mode of optimization.

                                                                                                                                                                                                                                                                                                                                                                      Type Aliases

                                                                                                                                                                                                                                                                                                                                                                      type AbsoluteFsPath

                                                                                                                                                                                                                                                                                                                                                                      type AbsoluteFsPath = BrandedPath<'AbsoluteFsPath'>;
                                                                                                                                                                                                                                                                                                                                                                      • A fully qualified path in the file system, in POSIX form.

                                                                                                                                                                                                                                                                                                                                                                      type ConfigurationHost

                                                                                                                                                                                                                                                                                                                                                                      type ConfigurationHost = Pick<
                                                                                                                                                                                                                                                                                                                                                                      ReadonlyFileSystem,
                                                                                                                                                                                                                                                                                                                                                                      | 'readFile'
                                                                                                                                                                                                                                                                                                                                                                      | 'exists'
                                                                                                                                                                                                                                                                                                                                                                      | 'lstat'
                                                                                                                                                                                                                                                                                                                                                                      | 'resolve'
                                                                                                                                                                                                                                                                                                                                                                      | 'join'
                                                                                                                                                                                                                                                                                                                                                                      | 'dirname'
                                                                                                                                                                                                                                                                                                                                                                      | 'extname'
                                                                                                                                                                                                                                                                                                                                                                      | 'pwd'
                                                                                                                                                                                                                                                                                                                                                                      >;
                                                                                                                                                                                                                                                                                                                                                                      • Used to read configuration files.

                                                                                                                                                                                                                                                                                                                                                                      type LogicalProjectPath

                                                                                                                                                                                                                                                                                                                                                                      type LogicalProjectPath = BrandedPath<'LogicalProjectPath'>;
                                                                                                                                                                                                                                                                                                                                                                      • A path that's relative to the logical root of a TypeScript project (one of the project's rootDirs).

                                                                                                                                                                                                                                                                                                                                                                        Paths in the type system use POSIX format.

                                                                                                                                                                                                                                                                                                                                                                      type PathSegment

                                                                                                                                                                                                                                                                                                                                                                      type PathSegment = BrandedPath<'PathSegment'>;
                                                                                                                                                                                                                                                                                                                                                                      • A path that's relative to another (unspecified) root.

                                                                                                                                                                                                                                                                                                                                                                        This does not necessarily have to refer to a physical file.

                                                                                                                                                                                                                                                                                                                                                                      type PathString

                                                                                                                                                                                                                                                                                                                                                                      type PathString = string | AbsoluteFsPath | PathSegment;

                                                                                                                                                                                                                                                                                                                                                                        Package Files (18)

                                                                                                                                                                                                                                                                                                                                                                        Dependencies (10)

                                                                                                                                                                                                                                                                                                                                                                        Dev Dependencies (0)

                                                                                                                                                                                                                                                                                                                                                                        No dev dependencies.

                                                                                                                                                                                                                                                                                                                                                                        Peer Dependencies (2)

                                                                                                                                                                                                                                                                                                                                                                        Badge

                                                                                                                                                                                                                                                                                                                                                                        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                                                                                                                                                                                        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@angular/compiler-cli.

                                                                                                                                                                                                                                                                                                                                                                        • Markdown
                                                                                                                                                                                                                                                                                                                                                                          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@angular/compiler-cli)
                                                                                                                                                                                                                                                                                                                                                                        • HTML
                                                                                                                                                                                                                                                                                                                                                                          <a href="https://www.jsdocs.io/package/@angular/compiler-cli"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>