@angular/compiler-cli 5.1.3 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"ngtools_api2.js","sourceRoot":"","sources":["../../../../packages/compiler-cli/src/ngtools_api2.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAkBH,+BAAiC;AAEjC,qDAA6E;AAE7E,8DAAsF;AACtF,kDAA0E;AA4C1E,IAAY,SASX;AATD,WAAY,SAAS;IACnB,uCAAY,CAAA;IACZ,qCAAW,CAAA;IACX,iDAAiB,CAAA;IACjB,qDAAmB,CAAA;IACnB,gDAAgB,CAAA;IAEhB,gDAA4B,CAAA;IAC5B,wCAAgD,CAAA;AAClD,CAAC,EATW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QASpB;AA+CD,6BAA6B;AAC7B,uBACI,EAC6F;QAD5F,wBAAS,EAAE,oBAAO,EAAE,cAAI,EAAE,0BAAU;IAGvC,MAAM,CAAC,uBAAiB,CAAC,EAAC,SAAS,WAAA,EAAE,OAAO,SAAA,EAAE,IAAI,MAAA,EAAE,UAAU,EAAE,UAAyB,EAAC,CAAC,CAAC;AAC9F,CAAC;AALD,sCAKC;AAED,kCAAkC;AAClC,4BACI,EACwD;QADvD,oBAAO,EAAE,cAA6C,EAA7C,kEAA6C;IAEzD,MAAM,CAAC,kCAAkB,CAAC,EAAC,OAAO,SAAA,EAAE,MAAM,QAAA,EAAC,CAAC,CAAC;AAC/C,CAAC;AAJD,gDAIC;AAID,2BAAkC,KAAkB;IAClD,MAAM,CAAC,mCAAqB,CAAC,KAAK,CAAC,CAAC;AACtC,CAAC;AAFD,8CAEC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * This is a private API for @ngtools/webpack. This API should be stable for NG 5.\n *\n * It contains copies of the interfaces needed and wrapper functions to ensure that\n * they are not broken accidentally.\n *\n * Once the ngc api is public and stable, this can be removed.\n */\n\n/**\n *********************************************************************\n * Changes to this file need to be approved by the Angular CLI team. *\n *********************************************************************\n */\n\nimport {ParseSourceSpan} from '@angular/compiler';\nimport * as ts from 'typescript';\n\nimport {formatDiagnostics as formatDiagnosticsOrig} from './perform_compile';\nimport {Program as ProgramOrig} from './transformers/api';\nimport {createCompilerHost as createCompilerOrig} from './transformers/compiler_host';\nimport {createProgram as createProgramOrig} from './transformers/program';\n\n\n// Interfaces from ./transformers/api;\nexport interface Diagnostic {\n messageText: string;\n span?: ParseSourceSpan;\n category: ts.DiagnosticCategory;\n code: number;\n source: 'angular';\n}\n\nexport interface CompilerOptions extends ts.CompilerOptions {\n basePath?: string;\n skipMetadataEmit?: boolean;\n strictMetadataEmit?: boolean;\n skipTemplateCodegen?: boolean;\n flatModuleOutFile?: string;\n flatModuleId?: string;\n generateCodeForLibraries?: boolean;\n annotateForClosureCompiler?: boolean;\n annotationsAs?: 'decorators'|'static fields';\n trace?: boolean;\n enableLegacyTemplate?: boolean;\n disableExpressionLowering?: boolean;\n i18nOutLocale?: string;\n i18nOutFormat?: string;\n i18nOutFile?: string;\n i18nInFormat?: string;\n i18nInLocale?: string;\n i18nInFile?: string;\n i18nInMissingTranslations?: 'error'|'warning'|'ignore';\n preserveWhitespaces?: boolean;\n}\n\nexport interface CompilerHost extends ts.CompilerHost {\n moduleNameToFileName?(moduleName: string, containingFile?: string): string|null;\n fileNameToModuleName?(importedFilePath: string, containingFilePath: string): string;\n resourceNameToFileName?(resourceName: string, containingFilePath: string): string|null;\n toSummaryFileName?(fileName: string, referringSrcFileName: string): string;\n fromSummaryFileName?(fileName: string, referringLibFileName: string): string;\n readResource?(fileName: string): Promise<string>|string;\n}\n\nexport enum EmitFlags {\n DTS = 1 << 0,\n JS = 1 << 1,\n Metadata = 1 << 2,\n I18nBundle = 1 << 3,\n Codegen = 1 << 4,\n\n Default = DTS | JS | Codegen,\n All = DTS | JS | Metadata | I18nBundle | Codegen,\n}\n\nexport interface CustomTransformers {\n beforeTs?: ts.TransformerFactory<ts.SourceFile>[];\n afterTs?: ts.TransformerFactory<ts.SourceFile>[];\n}\n\nexport interface TsEmitArguments {\n program: ts.Program;\n host: CompilerHost;\n options: CompilerOptions;\n targetSourceFile?: ts.SourceFile;\n writeFile?: ts.WriteFileCallback;\n cancellationToken?: ts.CancellationToken;\n emitOnlyDtsFiles?: boolean;\n customTransformers?: ts.CustomTransformers;\n}\n\nexport interface TsEmitCallback { (args: TsEmitArguments): ts.EmitResult; }\n\nexport interface LazyRoute {\n module: {name: string, filePath: string};\n route: string;\n referencedModule: {name: string, filePath: string};\n}\n\nexport interface Program {\n getTsProgram(): ts.Program;\n getTsOptionDiagnostics(cancellationToken?: ts.CancellationToken): ts.Diagnostic[];\n getNgOptionDiagnostics(cancellationToken?: ts.CancellationToken): Diagnostic[];\n getTsSyntacticDiagnostics(sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken):\n ts.Diagnostic[];\n getNgStructuralDiagnostics(cancellationToken?: ts.CancellationToken): Diagnostic[];\n getTsSemanticDiagnostics(sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken):\n ts.Diagnostic[];\n getNgSemanticDiagnostics(fileName?: string, cancellationToken?: ts.CancellationToken):\n Diagnostic[];\n loadNgStructureAsync(): Promise<void>;\n listLazyRoutes(entryRoute?: string): LazyRoute[];\n emit({emitFlags, cancellationToken, customTransformers, emitCallback}: {\n emitFlags?: EmitFlags,\n cancellationToken?: ts.CancellationToken,\n customTransformers?: CustomTransformers,\n emitCallback?: TsEmitCallback\n }): ts.EmitResult;\n}\n\n// Wrapper for createProgram.\nexport function createProgram(\n {rootNames, options, host, oldProgram}:\n {rootNames: string[], options: CompilerOptions, host: CompilerHost, oldProgram?: Program}):\n Program {\n return createProgramOrig({rootNames, options, host, oldProgram: oldProgram as ProgramOrig});\n}\n\n// Wrapper for createCompilerHost.\nexport function createCompilerHost(\n {options, tsHost = ts.createCompilerHost(options, true)}:\n {options: CompilerOptions, tsHost?: ts.CompilerHost}): CompilerHost {\n return createCompilerOrig({options, tsHost});\n}\n\n// Wrapper for formatDiagnostics.\nexport type Diagnostics = Array<ts.Diagnostic|Diagnostic>;\nexport function formatDiagnostics(diags: Diagnostics): string {\n return formatDiagnosticsOrig(diags);\n}"]}
1
+ {"version":3,"file":"ngtools_api2.js","sourceRoot":"","sources":["../../../../packages/compiler-cli/src/ngtools_api2.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAkBH,+BAAiC;AAEjC,qDAA6E;AAE7E,8DAAsF;AACtF,kDAA0E;AA4C1E,IAAY,SASX;AATD,WAAY,SAAS;IACnB,uCAAY,CAAA;IACZ,qCAAW,CAAA;IACX,iDAAiB,CAAA;IACjB,qDAAmB,CAAA;IACnB,gDAAgB,CAAA;IAEhB,gDAA4B,CAAA;IAC5B,wCAAgD,CAAA;AAClD,CAAC,EATW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QASpB;AA+CD,6BAA6B;AAC7B,uBACI,EAC6F;QAD5F,wBAAS,EAAE,oBAAO,EAAE,cAAI,EAAE,0BAAU;IAGvC,MAAM,CAAC,uBAAiB,CAAC,EAAC,SAAS,WAAA,EAAE,OAAO,SAAA,EAAE,IAAI,MAAA,EAAE,UAAU,EAAE,UAAiB,EAAC,CAAC,CAAC;AACtF,CAAC;AALD,sCAKC;AAED,kCAAkC;AAClC,4BACI,EACwD;QADvD,oBAAO,EAAE,cAA6C,EAA7C,kEAA6C;IAEzD,MAAM,CAAC,kCAAkB,CAAC,EAAC,OAAO,SAAA,EAAE,MAAM,QAAA,EAAC,CAAC,CAAC;AAC/C,CAAC;AAJD,gDAIC;AAID,2BAAkC,KAAkB;IAClD,MAAM,CAAC,mCAAqB,CAAC,KAAK,CAAC,CAAC;AACtC,CAAC;AAFD,8CAEC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * This is a private API for @ngtools/webpack. This API should be stable for NG 5.\n *\n * It contains copies of the interfaces needed and wrapper functions to ensure that\n * they are not broken accidentally.\n *\n * Once the ngc api is public and stable, this can be removed.\n */\n\n/**\n *********************************************************************\n * Changes to this file need to be approved by the Angular CLI team. *\n *********************************************************************\n */\n\nimport {ParseSourceSpan} from '@angular/compiler';\nimport * as ts from 'typescript';\n\nimport {formatDiagnostics as formatDiagnosticsOrig} from './perform_compile';\nimport {Program as ProgramOrig} from './transformers/api';\nimport {createCompilerHost as createCompilerOrig} from './transformers/compiler_host';\nimport {createProgram as createProgramOrig} from './transformers/program';\n\n\n// Interfaces from ./transformers/api;\nexport interface Diagnostic {\n messageText: string;\n span?: ParseSourceSpan;\n category: ts.DiagnosticCategory;\n code: number;\n source: 'angular';\n}\n\nexport interface CompilerOptions extends ts.CompilerOptions {\n basePath?: string;\n skipMetadataEmit?: boolean;\n strictMetadataEmit?: boolean;\n skipTemplateCodegen?: boolean;\n flatModuleOutFile?: string;\n flatModuleId?: string;\n generateCodeForLibraries?: boolean;\n annotateForClosureCompiler?: boolean;\n annotationsAs?: 'decorators'|'static fields';\n trace?: boolean;\n enableLegacyTemplate?: boolean;\n disableExpressionLowering?: boolean;\n i18nOutLocale?: string;\n i18nOutFormat?: string;\n i18nOutFile?: string;\n i18nInFormat?: string;\n i18nInLocale?: string;\n i18nInFile?: string;\n i18nInMissingTranslations?: 'error'|'warning'|'ignore';\n preserveWhitespaces?: boolean;\n}\n\nexport interface CompilerHost extends ts.CompilerHost {\n moduleNameToFileName?(moduleName: string, containingFile?: string): string|null;\n fileNameToModuleName?(importedFilePath: string, containingFilePath: string): string;\n resourceNameToFileName?(resourceName: string, containingFilePath: string): string|null;\n toSummaryFileName?(fileName: string, referringSrcFileName: string): string;\n fromSummaryFileName?(fileName: string, referringLibFileName: string): string;\n readResource?(fileName: string): Promise<string>|string;\n}\n\nexport enum EmitFlags {\n DTS = 1 << 0,\n JS = 1 << 1,\n Metadata = 1 << 2,\n I18nBundle = 1 << 3,\n Codegen = 1 << 4,\n\n Default = DTS | JS | Codegen,\n All = DTS | JS | Metadata | I18nBundle | Codegen,\n}\n\nexport interface CustomTransformers {\n beforeTs?: ts.TransformerFactory<ts.SourceFile>[];\n afterTs?: ts.TransformerFactory<ts.SourceFile>[];\n}\n\nexport interface TsEmitArguments {\n program: ts.Program;\n host: CompilerHost;\n options: CompilerOptions;\n targetSourceFile?: ts.SourceFile;\n writeFile?: ts.WriteFileCallback;\n cancellationToken?: ts.CancellationToken;\n emitOnlyDtsFiles?: boolean;\n customTransformers?: ts.CustomTransformers;\n}\n\nexport interface TsEmitCallback { (args: TsEmitArguments): ts.EmitResult; }\n\nexport interface LazyRoute {\n module: {name: string, filePath: string};\n route: string;\n referencedModule: {name: string, filePath: string};\n}\n\nexport interface Program {\n getTsProgram(): ts.Program;\n getTsOptionDiagnostics(cancellationToken?: ts.CancellationToken): ReadonlyArray<ts.Diagnostic>;\n getNgOptionDiagnostics(cancellationToken?: ts.CancellationToken): ReadonlyArray<Diagnostic>;\n getTsSyntacticDiagnostics(sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken):\n ReadonlyArray<ts.Diagnostic>;\n getNgStructuralDiagnostics(cancellationToken?: ts.CancellationToken): ReadonlyArray<Diagnostic>;\n getTsSemanticDiagnostics(sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken):\n ReadonlyArray<ts.Diagnostic>;\n getNgSemanticDiagnostics(fileName?: string, cancellationToken?: ts.CancellationToken):\n ReadonlyArray<Diagnostic>;\n loadNgStructureAsync(): Promise<void>;\n listLazyRoutes(entryRoute?: string): LazyRoute[];\n emit({emitFlags, cancellationToken, customTransformers, emitCallback}: {\n emitFlags?: EmitFlags,\n cancellationToken?: ts.CancellationToken,\n customTransformers?: CustomTransformers,\n emitCallback?: TsEmitCallback\n }): ts.EmitResult;\n}\n\n// Wrapper for createProgram.\nexport function createProgram(\n {rootNames, options, host, oldProgram}:\n {rootNames: string[], options: CompilerOptions, host: CompilerHost, oldProgram?: Program}):\n Program {\n return createProgramOrig({rootNames, options, host, oldProgram: oldProgram as any});\n}\n\n// Wrapper for createCompilerHost.\nexport function createCompilerHost(\n {options, tsHost = ts.createCompilerHost(options, true)}:\n {options: CompilerOptions, tsHost?: ts.CompilerHost}): CompilerHost {\n return createCompilerOrig({options, tsHost});\n}\n\n// Wrapper for formatDiagnostics.\nexport type Diagnostics = ReadonlyArray<ts.Diagnostic|Diagnostic>;\nexport function formatDiagnostics(diags: Diagnostics): string {\n return formatDiagnosticsOrig(diags);\n}\n"]}
@@ -8,7 +8,7 @@
8
8
  import { Position } from '@angular/compiler';
9
9
  import * as ts from 'typescript';
10
10
  import * as api from './transformers/api';
11
- export declare type Diagnostics = Array<ts.Diagnostic | api.Diagnostic>;
11
+ export declare type Diagnostics = ReadonlyArray<ts.Diagnostic | api.Diagnostic>;
12
12
  export declare function filterErrorsAndWarnings(diagnostics: Diagnostics): Diagnostics;
13
13
  export declare function formatDiagnosticPosition(position: Position, host?: ts.FormatDiagnosticsHost): string;
14
14
  export declare function flattenDiagnosticMessageChain(chain: api.DiagnosticMessageChain, host?: ts.FormatDiagnosticsHost): string;
@@ -1 +1 @@
1
- {"version":3,"file":"perform_compile.js","sourceRoot":"","sources":["../../../../packages/compiler-cli/src/perform_compile.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;AAEH,8CAAuE;AACvE,uBAAyB;AACzB,2BAA6B;AAC7B,+BAAiC;AAEjC,wCAA0C;AAC1C,gDAAkD;AAClD,4CAA4D;AAE5D,IAAM,MAAM,GAAG,OAAO,CAAC;AAIvB,iCAAwC,WAAwB;IAC9D,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,QAAQ,KAAK,EAAE,CAAC,kBAAkB,CAAC,OAAO,EAA5C,CAA4C,CAAC,CAAC;AAC/E,CA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CAAC;YACV,cAAc,CAAC,IAAI,OAAnB,cAAc,EAAS,KAAK,EAAE;YAC9B,MAAM,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;QACD,MAAM,CAAC,IAAI,CAAC;IACd,CAAC;IAED,IAAI,qBAAqB,GAAG,IAAI,CAAC;IACjC,8BAA8B;IAC9B,qBAAqB,GAAG,qBAAqB;QACzC,gBAAgB,CAAK,OAAO,CAAC,sBAAsB,EAAE,QAAK,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC;IAEjG,8BAA8B;IAC9B,qBAAqB;QACjB,qBAAqB,IAAI,gBAAgB,CAAC,OAAO,CAAC,yBAAyB,EAAE,CAAC,CAAC;IAEnF,8DAA8D;IAC9D,qBAAqB;QACjB,qBAAqB;YACrB,gBAAgB,CACR,OAAO,CAAC,wBAAwB,EAAE,QAAK,OAAO,CAAC,0BAA0B,EAAE,EAAE,CAAC;IAE1F,qCAAqC;IACrC,qBAAqB;QACjB,qBAAqB,IAAI,gBAAgB,CAAC,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAAC;IAElF,MAAM,CAAC,cAAc,CAAC;AACxB,CAAC;AAED,mBAAmB,KAAkB;IACnC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,QAAQ,KAAK,EAAE,CAAC,kBAAkB,CAAC,KAAK,EAA1C,CAA0C,CAAC,CAAC;AACrE,CAAC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Position, isSyntaxError, syntaxError} from '@angular/compiler';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as ts from 'typescript';\n\nimport * as api from './transformers/api';\nimport * as ng from './transformers/entry_points';\nimport {createMessageDiagnostic} from './transformers/util';\n\nconst TS_EXT = /\\.ts$/;\n\nexport type Diagnostics = Array<ts.Diagnostic|api.Diagnostic>;\n\nexport function filterErrorsAndWarnings(diagnostics: Diagnostics): Diagnostics {\n return diagnostics.filter(d => d.category !== ts.DiagnosticCategory.Message);\n}\n\nconst defaultFormatHost: ts.FormatDiagnosticsHost = {\n getCurrentDirectory: () => ts.sys.getCurrentDirectory(),\n getCanonicalFileName: fileName => fileName,\n getNewLine: () => ts.sys.newLine\n};\n\nfunction displayFileName(fileName: string, host: ts.FormatDiagnosticsHost): string {\n return path.relative(host.getCurrentDirectory(), host.getCanonicalFileName(fileName));\n}\n\nexport function formatDiagnosticPosition(\n position: Position, host: ts.FormatDiagnosticsHost = defaultFormatHost): string {\n return `${displayFileName(position.fileName, host)}(${position.line + 1},${position.column+1})`;\n}\n\nexport function flattenDiagnosticMessageChain(\n chain: api.DiagnosticMessageChain, host: ts.FormatDiagnosticsHost = defaultFormatHost): string {\n let result = chain.messageText;\n let indent = 1;\n let current = chain.next;\n const newLine = host.getNewLine();\n while (current) {\n result += newLine;\n for (let i = 0; i < indent; i++) {\n result += ' ';\n }\n result += current.messageText;\n const position = current.position;\n if (position) {\n result += ` at ${formatDiagnosticPosition(position, host)}`;\n }\n current = current.next;\n indent++;\n }\n return result;\n}\n\nexport function formatDiagnostic(\n diagnostic: api.Diagnostic, host: ts.FormatDiagnosticsHost = defaultFormatHost) {\n let result = '';\n const newLine = host.getNewLine();\n const span = diagnostic.span;\n if (span) {\n result += `${formatDiagnosticPosition({\n fileName: span.start.file.url,\n line: span.start.line,\n column: span.start.col\n }, host)}: `;\n } else if (diagnostic.position) {\n result += `${formatDiagnosticPosition(diagnostic.position, host)}: `;\n }\n if (diagnostic.span && diagnostic.span.details) {\n result += `: ${diagnostic.span.details}, ${diagnostic.messageText}${newLine}`;\n } else if (diagnostic.chain) {\n result += `${flattenDiagnosticMessageChain(diagnostic.chain, host)}.${newLine}`;\n } else {\n result += `: ${diagnostic.messageText}${newLine}`;\n }\n return result;\n}\n\nexport function formatDiagnostics(\n diags: Diagnostics, host: ts.FormatDiagnosticsHost = defaultFormatHost): string {\n if (diags && diags.length) {\n return diags\n .map(diagnostic => {\n if (api.isTsDiagnostic(diagnostic)) {\n return ts.formatDiagnostics([diagnostic], host);\n } else {\n return formatDiagnostic(diagnostic, host);\n }\n })\n .join('');\n } else {\n return '';\n }\n}\n\nexport interface ParsedConfiguration {\n project: string;\n options: api.CompilerOptions;\n rootNames: string[];\n emitFlags: api.EmitFlags;\n errors: Diagnostics;\n}\n\nexport function calcProjectFileAndBasePath(project: string):\n {projectFile: string, basePath: string} {\n const projectIsDir = fs.lstatSync(project).isDirectory();\n const projectFile = projectIsDir ? path.join(project, 'tsconfig.json') : project;\n const projectDir = projectIsDir ? project : path.dirname(project);\n const basePath = path.resolve(process.cwd(), projectDir);\n return {projectFile, basePath};\n}\n\nexport function createNgCompilerOptions(\n basePath: string, config: any, tsOptions: ts.CompilerOptions): api.CompilerOptions {\n return {...tsOptions, ...config.angularCompilerOptions, genDir: basePath, basePath};\n}\n\nexport function readConfiguration(\n project: string, existingOptions?: ts.CompilerOptions): ParsedConfiguration {\n try {\n const {projectFile, basePath} = calcProjectFileAndBasePath(project);\n\n let {config, error} = ts.readConfigFile(projectFile, ts.sys.readFile);\n\n if (error) {\n return {\n project,\n errors: [error],\n rootNames: [],\n options: {},\n emitFlags: api.EmitFlags.Default\n };\n }\n const parseConfigHost = {\n useCaseSensitiveFileNames: true,\n fileExists: fs.existsSync,\n readDirectory: ts.sys.readDirectory,\n readFile: ts.sys.readFile\n };\n const parsed =\n ts.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingOptions);\n const rootNames = parsed.fileNames.map(f => path.normalize(f));\n\n const options = createNgCompilerOptions(basePath, config, parsed.options);\n let emitFlags = api.EmitFlags.Default;\n if (!(options.skipMetadataEmit || options.flatModuleOutFile)) {\n emitFlags |= api.EmitFlags.Metadata;\n }\n if (options.skipTemplateCodegen) {\n emitFlags = emitFlags & ~api.EmitFlags.Codegen;\n }\n return {project: projectFile, rootNames, options, errors: parsed.errors, emitFlags};\n } catch (e) {\n const errors: Diagnostics = [{\n category: ts.DiagnosticCategory.Error,\n messageText: e.stack,\n source: api.SOURCE,\n code: api.UNKNOWN_ERROR_CODE\n }];\n return {project: '', errors, rootNames: [], options: {}, emitFlags: api.EmitFlags.Default};\n }\n}\n\nexport interface PerformCompilationResult {\n diagnostics: Diagnostics;\n program?: api.Program;\n emitResult?: ts.EmitResult;\n}\n\nexport function exitCodeFromResult(diags: Diagnostics | undefined): number {\n if (!diags || filterErrorsAndWarnings(diags).length === 0) {\n // If we have a result and didn't get any errors, we succeeded.\n return 0;\n }\n\n // Return 2 if any of the errors were unknown.\n return diags.some(d => d.source === 'angular' && d.code === api.UNKNOWN_ERROR_CODE) ? 2 : 1;\n}\n\nexport function performCompilation({rootNames, options, host, oldProgram, emitCallback,\n gatherDiagnostics = defaultGatherDiagnostics,\n customTransformers, emitFlags = api.EmitFlags.Default}: {\n rootNames: string[],\n options: api.CompilerOptions,\n host?: api.CompilerHost,\n oldProgram?: api.Program,\n emitCallback?: api.TsEmitCallback,\n gatherDiagnostics?: (program: api.Program) => Diagnostics,\n customTransformers?: api.CustomTransformers,\n emitFlags?: api.EmitFlags\n}): PerformCompilationResult {\n let program: api.Program|undefined;\n let emitResult: ts.EmitResult|undefined;\n let allDiagnostics: Diagnostics = [];\n try {\n if (!host) {\n host = ng.createCompilerHost({options});\n }\n\n program = ng.createProgram({rootNames, host, options, oldProgram});\n\n const beforeDiags = Date.now();\n allDiagnostics.push(...gatherDiagnostics(program !));\n if (options.diagnostics) {\n const afterDiags = Date.now();\n allDiagnostics.push(\n createMessageDiagnostic(`Time for diagnostics: ${afterDiags - beforeDiags}ms.`));\n }\n\n if (!hasErrors(allDiagnostics)) {\n emitResult = program !.emit({emitCallback, customTransformers, emitFlags});\n allDiagnostics.push(...emitResult.diagnostics);\n return {diagnostics: allDiagnostics, program, emitResult};\n }\n return {diagnostics: allDiagnostics, program};\n } catch (e) {\n let errMsg: string;\n let code: number;\n if (isSyntaxError(e)) {\n // don't report the stack for syntax errors as they are well known errors.\n errMsg = e.message;\n code = api.DEFAULT_ERROR_CODE;\n } else {\n errMsg = e.stack;\n // It is not a syntax error we might have a program with unknown state, discard it.\n program = undefined;\n code = api.UNKNOWN_ERROR_CODE;\n }\n allDiagnostics.push(\n {category: ts.DiagnosticCategory.Error, messageText: errMsg, code, source: api.SOURCE});\n return {diagnostics: allDiagnostics, program};\n }\n}\nfunction defaultGatherDiagnostics(program: api.Program): Diagnostics {\n const allDiagnostics: Diagnostics = [];\n\n function checkDiagnostics(diags: Diagnostics | undefined) {\n if (diags) {\n allDiagnostics.push(...diags);\n return !hasErrors(diags);\n }\n return true;\n }\n\n let checkOtherDiagnostics = true;\n // Check parameter diagnostics\n checkOtherDiagnostics = checkOtherDiagnostics &&\n checkDiagnostics([...program.getTsOptionDiagnostics(), ...program.getNgOptionDiagnostics()]);\n\n // Check syntactic diagnostics\n checkOtherDiagnostics =\n checkOtherDiagnostics && checkDiagnostics(program.getTsSyntacticDiagnostics());\n\n // Check TypeScript semantic and Angular structure diagnostics\n checkOtherDiagnostics =\n checkOtherDiagnostics &&\n checkDiagnostics(\n [...program.getTsSemanticDiagnostics(), ...program.getNgStructuralDiagnostics()]);\n\n // Check Angular semantic diagnostics\n checkOtherDiagnostics =\n checkOtherDiagnostics && checkDiagnostics(program.getNgSemanticDiagnostics());\n\n return allDiagnostics;\n}\n\nfunction hasErrors(diags: Diagnostics) {\n return diags.some(d => d.category === ts.DiagnosticCategory.Error);\n}\n"]}
1
+ {"version":3,"file":"perform_compile.js","sourceRoot":"","sources":["../../../../packages/compiler-cli/src/perform_compile.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;AAEH,8CAAuE;AACvE,uBAAyB;AACzB,2BAA6B;AAC7B,+BAAiC;AAEjC,wCAA0C;AAC1C,gDAAkD;AAClD,4CAA4D;AAE5D,IAAM,MAAM,GAAG,OAAO,CAAC;AAIvB,iCAAwC,WAAwB;IAC9D,M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CAAC;AACH,CAAC;AArDD,gDAqDC;AACD,kCAAkC,OAAoB;IACpD,IAAM,cAAc,GAAwC,EAAE,CAAC;IAE/D,0BAA0B,KAA8B;QACtD,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;YACV,cAAc,CAAC,IAAI,OAAnB,cAAc,EAAS,KAAK,EAAE;YAC9B,MAAM,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;QACD,MAAM,CAAC,IAAI,CAAC;IACd,CAAC;IAED,IAAI,qBAAqB,GAAG,IAAI,CAAC;IACjC,8BAA8B;IAC9B,qBAAqB,GAAG,qBAAqB;QACzC,gBAAgB,CAAK,OAAO,CAAC,sBAAsB,EAAE,QAAK,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC;IAEjG,8BAA8B;IAC9B,qBAAqB;QACjB,qBAAqB,IAAI,gBAAgB,CAAC,OAAO,CAAC,yBAAyB,EAAiB,CAAC,CAAC;IAElG,8DAA8D;IAC9D,qBAAqB;QACjB,qBAAqB;YACrB,gBAAgB,CACR,OAAO,CAAC,wBAAwB,EAAE,QAAK,OAAO,CAAC,0BAA0B,EAAE,EAAE,CAAC;IAE1F,qCAAqC;IACrC,qBAAqB;QACjB,qBAAqB,IAAI,gBAAgB,CAAC,OAAO,CAAC,wBAAwB,EAAiB,CAAC,CAAC;IAEjG,MAAM,CAAC,cAAc,CAAC;AACxB,CAAC;AAED,mBAAmB,KAAkB;IACnC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,QAAQ,KAAK,EAAE,CAAC,kBAAkB,CAAC,KAAK,EAA1C,CAA0C,CAAC,CAAC;AACrE,CAAC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Position, isSyntaxError, syntaxError} from '@angular/compiler';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as ts from 'typescript';\n\nimport * as api from './transformers/api';\nimport * as ng from './transformers/entry_points';\nimport {createMessageDiagnostic} from './transformers/util';\n\nconst TS_EXT = /\\.ts$/;\n\nexport type Diagnostics = ReadonlyArray<ts.Diagnostic|api.Diagnostic>;\n\nexport function filterErrorsAndWarnings(diagnostics: Diagnostics): Diagnostics {\n return diagnostics.filter(d => d.category !== ts.DiagnosticCategory.Message);\n}\n\nconst defaultFormatHost: ts.FormatDiagnosticsHost = {\n getCurrentDirectory: () => ts.sys.getCurrentDirectory(),\n getCanonicalFileName: fileName => fileName,\n getNewLine: () => ts.sys.newLine\n};\n\nfunction displayFileName(fileName: string, host: ts.FormatDiagnosticsHost): string {\n return path.relative(host.getCurrentDirectory(), host.getCanonicalFileName(fileName));\n}\n\nexport function formatDiagnosticPosition(\n position: Position, host: ts.FormatDiagnosticsHost = defaultFormatHost): string {\n return `${displayFileName(position.fileName, host)}(${position.line + 1},${position.column+1})`;\n}\n\nexport function flattenDiagnosticMessageChain(\n chain: api.DiagnosticMessageChain, host: ts.FormatDiagnosticsHost = defaultFormatHost): string {\n let result = chain.messageText;\n let indent = 1;\n let current = chain.next;\n const newLine = host.getNewLine();\n while (current) {\n result += newLine;\n for (let i = 0; i < indent; i++) {\n result += ' ';\n }\n result += current.messageText;\n const position = current.position;\n if (position) {\n result += ` at ${formatDiagnosticPosition(position, host)}`;\n }\n current = current.next;\n indent++;\n }\n return result;\n}\n\nexport function formatDiagnostic(\n diagnostic: api.Diagnostic, host: ts.FormatDiagnosticsHost = defaultFormatHost) {\n let result = '';\n const newLine = host.getNewLine();\n const span = diagnostic.span;\n if (span) {\n result += `${formatDiagnosticPosition({\n fileName: span.start.file.url,\n line: span.start.line,\n column: span.start.col\n }, host)}: `;\n } else if (diagnostic.position) {\n result += `${formatDiagnosticPosition(diagnostic.position, host)}: `;\n }\n if (diagnostic.span && diagnostic.span.details) {\n result += `: ${diagnostic.span.details}, ${diagnostic.messageText}${newLine}`;\n } else if (diagnostic.chain) {\n result += `${flattenDiagnosticMessageChain(diagnostic.chain, host)}.${newLine}`;\n } else {\n result += `: ${diagnostic.messageText}${newLine}`;\n }\n return result;\n}\n\nexport function formatDiagnostics(\n diags: Diagnostics, host: ts.FormatDiagnosticsHost = defaultFormatHost): string {\n if (diags && diags.length) {\n return diags\n .map(diagnostic => {\n if (api.isTsDiagnostic(diagnostic)) {\n return ts.formatDiagnostics([diagnostic], host);\n } else {\n return formatDiagnostic(diagnostic, host);\n }\n })\n .join('');\n } else {\n return '';\n }\n}\n\nexport interface ParsedConfiguration {\n project: string;\n options: api.CompilerOptions;\n rootNames: string[];\n emitFlags: api.EmitFlags;\n errors: Diagnostics;\n}\n\nexport function calcProjectFileAndBasePath(project: string):\n {projectFile: string, basePath: string} {\n const projectIsDir = fs.lstatSync(project).isDirectory();\n const projectFile = projectIsDir ? path.join(project, 'tsconfig.json') : project;\n const projectDir = projectIsDir ? project : path.dirname(project);\n const basePath = path.resolve(process.cwd(), projectDir);\n return {projectFile, basePath};\n}\n\nexport function createNgCompilerOptions(\n basePath: string, config: any, tsOptions: ts.CompilerOptions): api.CompilerOptions {\n return {...tsOptions, ...config.angularCompilerOptions, genDir: basePath, basePath};\n}\n\nexport function readConfiguration(\n project: string, existingOptions?: ts.CompilerOptions): ParsedConfiguration {\n try {\n const {projectFile, basePath} = calcProjectFileAndBasePath(project);\n\n let {config, error} = ts.readConfigFile(projectFile, ts.sys.readFile);\n\n if (error) {\n return {\n project,\n errors: [error],\n rootNames: [],\n options: {},\n emitFlags: api.EmitFlags.Default\n };\n }\n const parseConfigHost = {\n useCaseSensitiveFileNames: true,\n fileExists: fs.existsSync,\n readDirectory: ts.sys.readDirectory,\n readFile: ts.sys.readFile\n };\n const parsed =\n ts.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingOptions);\n const rootNames = parsed.fileNames.map(f => path.normalize(f));\n\n const options = createNgCompilerOptions(basePath, config, parsed.options);\n let emitFlags = api.EmitFlags.Default;\n if (!(options.skipMetadataEmit || options.flatModuleOutFile)) {\n emitFlags |= api.EmitFlags.Metadata;\n }\n if (options.skipTemplateCodegen) {\n emitFlags = emitFlags & ~api.EmitFlags.Codegen;\n }\n return {project: projectFile, rootNames, options, errors: parsed.errors, emitFlags};\n } catch (e) {\n const errors: Diagnostics = [{\n category: ts.DiagnosticCategory.Error,\n messageText: e.stack,\n source: api.SOURCE,\n code: api.UNKNOWN_ERROR_CODE\n }];\n return {project: '', errors, rootNames: [], options: {}, emitFlags: api.EmitFlags.Default};\n }\n}\n\nexport interface PerformCompilationResult {\n diagnostics: Diagnostics;\n program?: api.Program;\n emitResult?: ts.EmitResult;\n}\n\nexport function exitCodeFromResult(diags: Diagnostics | undefined): number {\n if (!diags || filterErrorsAndWarnings(diags).length === 0) {\n // If we have a result and didn't get any errors, we succeeded.\n return 0;\n }\n\n // Return 2 if any of the errors were unknown.\n return diags.some(d => d.source === 'angular' && d.code === api.UNKNOWN_ERROR_CODE) ? 2 : 1;\n}\n\nexport function performCompilation({rootNames, options, host, oldProgram, emitCallback,\n gatherDiagnostics = defaultGatherDiagnostics,\n customTransformers, emitFlags = api.EmitFlags.Default}: {\n rootNames: string[],\n options: api.CompilerOptions,\n host?: api.CompilerHost,\n oldProgram?: api.Program,\n emitCallback?: api.TsEmitCallback,\n gatherDiagnostics?: (program: api.Program) => Diagnostics,\n customTransformers?: api.CustomTransformers,\n emitFlags?: api.EmitFlags\n}): PerformCompilationResult {\n let program: api.Program|undefined;\n let emitResult: ts.EmitResult|undefined;\n let allDiagnostics: Array<ts.Diagnostic|api.Diagnostic> = [];\n try {\n if (!host) {\n host = ng.createCompilerHost({options});\n }\n\n program = ng.createProgram({rootNames, host, options, oldProgram});\n\n const beforeDiags = Date.now();\n allDiagnostics.push(...gatherDiagnostics(program !));\n if (options.diagnostics) {\n const afterDiags = Date.now();\n allDiagnostics.push(\n createMessageDiagnostic(`Time for diagnostics: ${afterDiags - beforeDiags}ms.`));\n }\n\n if (!hasErrors(allDiagnostics)) {\n emitResult = program !.emit({emitCallback, customTransformers, emitFlags});\n allDiagnostics.push(...emitResult.diagnostics);\n return {diagnostics: allDiagnostics, program, emitResult};\n }\n return {diagnostics: allDiagnostics, program};\n } catch (e) {\n let errMsg: string;\n let code: number;\n if (isSyntaxError(e)) {\n // don't report the stack for syntax errors as they are well known errors.\n errMsg = e.message;\n code = api.DEFAULT_ERROR_CODE;\n } else {\n errMsg = e.stack;\n // It is not a syntax error we might have a program with unknown state, discard it.\n program = undefined;\n code = api.UNKNOWN_ERROR_CODE;\n }\n allDiagnostics.push(\n {category: ts.DiagnosticCategory.Error, messageText: errMsg, code, source: api.SOURCE});\n return {diagnostics: allDiagnostics, program};\n }\n}\nfunction defaultGatherDiagnostics(program: api.Program): Diagnostics {\n const allDiagnostics: Array<ts.Diagnostic|api.Diagnostic> = [];\n\n function checkDiagnostics(diags: Diagnostics | undefined) {\n if (diags) {\n allDiagnostics.push(...diags);\n return !hasErrors(diags);\n }\n return true;\n }\n\n let checkOtherDiagnostics = true;\n // Check parameter diagnostics\n checkOtherDiagnostics = checkOtherDiagnostics &&\n checkDiagnostics([...program.getTsOptionDiagnostics(), ...program.getNgOptionDiagnostics()]);\n\n // Check syntactic diagnostics\n checkOtherDiagnostics =\n checkOtherDiagnostics && checkDiagnostics(program.getTsSyntacticDiagnostics() as Diagnostics);\n\n // Check TypeScript semantic and Angular structure diagnostics\n checkOtherDiagnostics =\n checkOtherDiagnostics &&\n checkDiagnostics(\n [...program.getTsSemanticDiagnostics(), ...program.getNgStructuralDiagnostics()]);\n\n // Check Angular semantic diagnostics\n checkOtherDiagnostics =\n checkOtherDiagnostics && checkDiagnostics(program.getNgSemanticDiagnostics() as Diagnostics);\n\n return allDiagnostics;\n}\n\nfunction hasErrors(diags: Diagnostics) {\n return diags.some(d => d.category === ts.DiagnosticCategory.Error);\n}\n"]}
@@ -129,6 +129,7 @@ function performWatchCompilation(host) {
129
129
  cachedCompilerHost = host.createCompilerHost(cachedOptions.options);
130
130
  var originalWriteFileCallback_1 = cachedCompilerHost.writeFile;
131
131
  cachedCompilerHost.writeFile = function (fileName, data, writeByteOrderMark, onError, sourceFiles) {
132
+ if (sourceFiles === void 0) { sourceFiles = []; }
132
133
  ingoreFilesForWatch.add(path.normalize(fileName));
133
134
  return originalWriteFileCallback_1(fileName, data, writeByteOrderMark, onError, sourceFiles);
134
135
  };
@@ -1 +1 @@
1
- {"version":3,"file":"perform_watch.js","sourceRoot":"","sources":["../../../../packages/compiler-cli/src/perform_watch.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAEH,mCAAqC;AACrC,2BAA6B;AAC7B,+BAAiC;AAEjC,qDAAwJ;AACxJ,wCAA0C;AAC1C,4DAA+D;AAC/D,4CAA4D;AAE5D,wCAAwC,YAAoB;IAC1D,IAAI,QAAgB,CAAC;IACrB,EAAE,CAAC,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC;QACxB,QAAQ,GAAM,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAG,CAAC;IACxD,CAAC;IAAC,IAAI,CAAC,CAAC;QACN,QAAQ,GAAM,YAAY,OAAI,CAAC;IACjC,CAAC;IACD,MAAM,CAAC;QACL,QAAQ,EAAE,EAAE,CAAC,kBAAkB,CAAC,OAAO;QACvC,WAAW,EAAE,iBAAe,QAAU;QACtC,IAAI,EAAE,GAAG,CAAC,kBAAkB;QAC5B,MAAM,EAAE,GAAG,CAAC,MAAM;KACnB,CAAC;AACJ,CAAC;AAED,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,yDAAM,CAAA;IACN,qEAAY,CAAA;IACZ,2EAAe,CAAA;AACjB,CAAC,EAJW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAI1B;AAcD,gCACI,cAAsB,EAAE,iBAAqD,EAC7E,eAAoC,EAAE,kBACkC;IAC1E,MAAM,CAAC;QACL,iBAAiB,EAAE,iBAAiB;QACpC,kBAAkB,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C,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC7C,CAAC;QAED,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;YACvD,uEAAuE;YACvE,0BAA0B,EAAE,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,kGAAkG;IAClG,kGAAkG;IAClG,yBAAyB;IACzB;QACE,EAAE,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC;YAChC,IAAI,CAAC,YAAY,CAAC,2BAA2B,CAAC,CAAC;QACjD,CAAC;QACD,2BAA2B,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IAChE,CAAC;IAED;QACE,2BAA2B,GAAG,SAAS,CAAC;QACxC,IAAI,CAAC,iBAAiB,CAClB,CAAC,8BAAuB,CAAC,yDAAyD,CAAC,CAAC,CAAC,CAAC;QAC1F,aAAa,EAAE,CAAC;IAClB,CAAC;AACH,CAAC;AAzKD,0DAyKC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport * as chokidar from 'chokidar';\nimport * as path from 'path';\nimport * as ts from 'typescript';\n\nimport {Diagnostics, ParsedConfiguration, PerformCompilationResult, exitCodeFromResult, performCompilation, readConfiguration} from './perform_compile';\nimport * as api from './transformers/api';\nimport {createCompilerHost} from './transformers/entry_points';\nimport {createMessageDiagnostic} from './transformers/util';\n\nfunction totalCompilationTimeDiagnostic(timeInMillis: number): api.Diagnostic {\n let duration: string;\n if (timeInMillis > 1000) {\n duration = `${(timeInMillis / 1000).toPrecision(2)}s`;\n } else {\n duration = `${timeInMillis}ms`;\n }\n return {\n category: ts.DiagnosticCategory.Message,\n messageText: `Total time: ${duration}`,\n code: api.DEFAULT_ERROR_CODE,\n source: api.SOURCE,\n };\n}\n\nexport enum FileChangeEvent {\n Change,\n CreateDelete,\n CreateDeleteDir,\n}\n\nexport interface PerformWatchHost {\n reportDiagnostics(diagnostics: Diagnostics): void;\n readConfiguration(): ParsedConfiguration;\n createCompilerHost(options: api.CompilerOptions): api.CompilerHost;\n createEmitCallback(options: api.CompilerOptions): api.TsEmitCallback|undefined;\n onFileChange(\n options: api.CompilerOptions, listener: (event: FileChangeEvent, fileName: string) => void,\n ready: () => void): {close: () => void};\n setTimeout(callback: () => void, ms: number): any;\n clearTimeout(timeoutId: any): void;\n}\n\nexport function createPerformWatchHost(\n configFileName: string, reportDiagnostics: (diagnostics: Diagnostics) => void,\n existingOptions?: ts.CompilerOptions, createEmitCallback?: (options: api.CompilerOptions) =>\n api.TsEmitCallback | undefined): PerformWatchHost {\n return {\n reportDiagnostics: reportDiagnostics,\n createCompilerHost: options => createCompilerHost({options}),\n readConfiguration: () => readConfiguration(configFileName, existingOptions),\n createEmitCallback: options => createEmitCallback ? createEmitCallback(options) : undefined,\n onFileChange: (options, listener, ready: () => void) => {\n if (!options.basePath) {\n reportDiagnostics([{\n category: ts.DiagnosticCategory.Error,\n messageText: 'Invalid configuration option. baseDir not specified',\n source: api.SOURCE,\n code: api.DEFAULT_ERROR_CODE\n }]);\n return {close: () => {}};\n }\n const watcher = chokidar.watch(options.basePath, {\n // ignore .dotfiles, .js and .map files.\n // can't ignore other files as we e.g. want to recompile if an `.html` file changes as well.\n ignored: /((^[\\/\\\\])\\..)|(\\.js$)|(\\.map$)|(\\.metadata\\.json)/,\n ignoreInitial: true,\n persistent: true,\n });\n watcher.on('all', (event: string, path: string) => {\n switch (event) {\n case 'change':\n listener(FileChangeEvent.Change, path);\n break;\n case 'unlink':\n case 'add':\n listener(FileChangeEvent.CreateDelete, path);\n break;\n case 'unlinkDir':\n case 'addDir':\n listener(FileChangeEvent.CreateDeleteDir, path);\n break;\n }\n });\n watcher.on('ready', ready);\n return {close: () => watcher.close(), ready};\n },\n setTimeout: (ts.sys.clearTimeout && ts.sys.setTimeout) || setTimeout,\n clearTimeout: (ts.sys.setTimeout && ts.sys.clearTimeout) || clearTimeout,\n };\n}\n\ninterface CacheEntry {\n exists?: boolean;\n sf?: ts.SourceFile;\n content?: string;\n}\n\n/**\n * The logic in this function is adapted from `tsc.ts` from TypeScript.\n */\nexport function performWatchCompilation(host: PerformWatchHost):\n {close: () => void, ready: (cb: () => void) => void, firstCompileResult: Diagnostics} {\n let cachedProgram: api.Program|undefined; // Program cached from last compilation\n let cachedCompilerHost: api.CompilerHost|undefined; // CompilerHost cached from last compilation\n let cachedOptions: ParsedConfiguration|undefined; // CompilerOptions cached from last compilation\n let timerHandleForRecompilation: any; // Handle for 0.25s wait timer to trigger recompilation\n\n const ingoreFilesForWatch = new Set<string>();\n const fileCache = new Map<string, CacheEntry>();\n\n const firstCompileResult = doCompilation();\n\n // Watch basePath, ignoring .dotfiles\n let resolveReadyPromise: () => void;\n const readyPromise = new Promise(resolve => resolveReadyPromise = resolve);\n // Note: ! is ok as options are filled after the first compilation\n // Note: ! is ok as resolvedReadyPromise is filled by the previous call\n const fileWatcher =\n host.onFileChange(cachedOptions !.options, watchedFileChanged, resolveReadyPromise !);\n\n return {close, ready: cb => readyPromise.then(cb), firstCompileResult};\n\n function cacheEntry(fileName: string): CacheEntry {\n fileName = path.normalize(fileName);\n let entry = fileCache.get(fileName);\n if (!entry) {\n entry = {};\n fileCache.set(fileName, entry);\n }\n return entry;\n }\n\n function close() {\n fileWatcher.close();\n if (timerHandleForRecompilation) {\n host.clearTimeout(timerHandleForRecompilation);\n timerHandleForRecompilation = undefined;\n }\n }\n\n // Invoked to perform initial compilation or re-compilation in watch mode\n function doCompilation(): Diagnostics {\n if (!cachedOptions) {\n cachedOptions = host.readConfiguration();\n }\n if (cachedOptions.errors && cachedOptions.errors.length) {\n host.reportDiagnostics(cachedOptions.errors);\n return cachedOptions.errors;\n }\n const startTime = Date.now();\n if (!cachedCompilerHost) {\n cachedCompilerHost = host.createCompilerHost(cachedOptions.options);\n const originalWriteFileCallback = cachedCompilerHost.writeFile;\n cachedCompilerHost.writeFile = function(\n fileName: string, data: string, writeByteOrderMark: boolean,\n onError?: (message: string) => void, sourceFiles?: ts.SourceFile[]) {\n ingoreFilesForWatch.add(path.normalize(fileName));\n return originalWriteFileCallback(fileName, data, writeByteOrderMark, onError, sourceFiles);\n };\n const originalFileExists = cachedCompilerHost.fileExists;\n cachedCompilerHost.fileExists = function(fileName: string) {\n const ce = cacheEntry(fileName);\n if (ce.exists == null) {\n ce.exists = originalFileExists.call(this, fileName);\n }\n return ce.exists !;\n };\n const originalGetSourceFile = cachedCompilerHost.getSourceFile;\n cachedCompilerHost.getSourceFile = function(\n fileName: string, languageVersion: ts.ScriptTarget) {\n const ce = cacheEntry(fileName);\n if (!ce.sf) {\n ce.sf = originalGetSourceFile.call(this, fileName, languageVersion);\n }\n return ce.sf !;\n };\n const originalReadFile = cachedCompilerHost.readFile;\n cachedCompilerHost.readFile = function(fileName: string) {\n const ce = cacheEntry(fileName);\n if (ce.content == null) {\n ce.content = originalReadFile.call(this, fileName);\n }\n return ce.content !;\n };\n }\n ingoreFilesForWatch.clear();\n const oldProgram = cachedProgram;\n // We clear out the `cachedProgram` here as a\n // program can only be used as `oldProgram` 1x\n cachedProgram = undefined;\n const compileResult = performCompilation({\n rootNames: cachedOptions.rootNames,\n options: cachedOptions.options,\n host: cachedCompilerHost,\n oldProgram: cachedProgram,\n emitCallback: host.createEmitCallback(cachedOptions.options)\n });\n\n if (compileResult.diagnostics.length) {\n host.reportDiagnostics(compileResult.diagnostics);\n }\n\n const endTime = Date.now();\n if (cachedOptions.options.diagnostics) {\n const totalTime = (endTime - startTime) / 1000;\n host.reportDiagnostics([totalCompilationTimeDiagnostic(endTime - startTime)]);\n }\n const exitCode = exitCodeFromResult(compileResult.diagnostics);\n if (exitCode == 0) {\n cachedProgram = compileResult.program;\n host.reportDiagnostics(\n [createMessageDiagnostic('Compilation complete. Watching for file changes.')]);\n } else {\n host.reportDiagnostics(\n [createMessageDiagnostic('Compilation failed. Watching for file changes.')]);\n }\n\n return compileResult.diagnostics;\n }\n\n function resetOptions() {\n cachedProgram = undefined;\n cachedCompilerHost = undefined;\n cachedOptions = undefined;\n }\n\n function watchedFileChanged(event: FileChangeEvent, fileName: string) {\n if (cachedOptions && event === FileChangeEvent.Change &&\n // TODO(chuckj): validate that this is sufficient to skip files that were written.\n // This assumes that the file path we write is the same file path we will receive in the\n // change notification.\n path.normalize(fileName) === path.normalize(cachedOptions.project)) {\n // If the configuration file changes, forget everything and start the recompilation timer\n resetOptions();\n } else if (\n event === FileChangeEvent.CreateDelete || event === FileChangeEvent.CreateDeleteDir) {\n // If a file was added or removed, reread the configuration\n // to determine the new list of root files.\n cachedOptions = undefined;\n }\n\n if (event === FileChangeEvent.CreateDeleteDir) {\n fileCache.clear();\n } else {\n fileCache.delete(path.normalize(fileName));\n }\n\n if (!ingoreFilesForWatch.has(path.normalize(fileName))) {\n // Ignore the file if the file is one that was written by the compiler.\n startTimerForRecompilation();\n }\n }\n\n // Upon detecting a file change, wait for 250ms and then perform a recompilation. This gives batch\n // operations (such as saving all modified files in an editor) a chance to complete before we kick\n // off a new compilation.\n function startTimerForRecompilation() {\n if (timerHandleForRecompilation) {\n host.clearTimeout(timerHandleForRecompilation);\n }\n timerHandleForRecompilation = host.setTimeout(recompile, 250);\n }\n\n function recompile() {\n timerHandleForRecompilation = undefined;\n host.reportDiagnostics(\n [createMessageDiagnostic('File change detected. Starting incremental compilation.')]);\n doCompilation();\n }\n}"]}
1
+ {"version":3,"file":"perform_watch.js","sourceRoot":"","sources":["../../../../packages/compiler-cli/src/perform_watch.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAEH,mCAAqC;AACrC,2BAA6B;AAC7B,+BAAiC;AAEjC,qDAAwJ;AACxJ,wCAA0C;AAC1C,4DAA+D;AAC/D,4CAA4D;AAE5D,wCAAwC,YAAoB;IAC1D,IAAI,QAAgB,CAAC;IACrB,EAAE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2B,GAAG,SAAS,CAAC;QACxC,IAAI,CAAC,iBAAiB,CAClB,CAAC,8BAAuB,CAAC,yDAAyD,CAAC,CAAC,CAAC,CAAC;QAC1F,aAAa,EAAE,CAAC;IAClB,CAAC;AACH,CAAC;AAzKD,0DAyKC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport * as chokidar from 'chokidar';\nimport * as path from 'path';\nimport * as ts from 'typescript';\n\nimport {Diagnostics, ParsedConfiguration, PerformCompilationResult, exitCodeFromResult, performCompilation, readConfiguration} from './perform_compile';\nimport * as api from './transformers/api';\nimport {createCompilerHost} from './transformers/entry_points';\nimport {createMessageDiagnostic} from './transformers/util';\n\nfunction totalCompilationTimeDiagnostic(timeInMillis: number): api.Diagnostic {\n let duration: string;\n if (timeInMillis > 1000) {\n duration = `${(timeInMillis / 1000).toPrecision(2)}s`;\n } else {\n duration = `${timeInMillis}ms`;\n }\n return {\n category: ts.DiagnosticCategory.Message,\n messageText: `Total time: ${duration}`,\n code: api.DEFAULT_ERROR_CODE,\n source: api.SOURCE,\n };\n}\n\nexport enum FileChangeEvent {\n Change,\n CreateDelete,\n CreateDeleteDir,\n}\n\nexport interface PerformWatchHost {\n reportDiagnostics(diagnostics: Diagnostics): void;\n readConfiguration(): ParsedConfiguration;\n createCompilerHost(options: api.CompilerOptions): api.CompilerHost;\n createEmitCallback(options: api.CompilerOptions): api.TsEmitCallback|undefined;\n onFileChange(\n options: api.CompilerOptions, listener: (event: FileChangeEvent, fileName: string) => void,\n ready: () => void): {close: () => void};\n setTimeout(callback: () => void, ms: number): any;\n clearTimeout(timeoutId: any): void;\n}\n\nexport function createPerformWatchHost(\n configFileName: string, reportDiagnostics: (diagnostics: Diagnostics) => void,\n existingOptions?: ts.CompilerOptions, createEmitCallback?: (options: api.CompilerOptions) =>\n api.TsEmitCallback | undefined): PerformWatchHost {\n return {\n reportDiagnostics: reportDiagnostics,\n createCompilerHost: options => createCompilerHost({options}),\n readConfiguration: () => readConfiguration(configFileName, existingOptions),\n createEmitCallback: options => createEmitCallback ? createEmitCallback(options) : undefined,\n onFileChange: (options, listener, ready: () => void) => {\n if (!options.basePath) {\n reportDiagnostics([{\n category: ts.DiagnosticCategory.Error,\n messageText: 'Invalid configuration option. baseDir not specified',\n source: api.SOURCE,\n code: api.DEFAULT_ERROR_CODE\n }]);\n return {close: () => {}};\n }\n const watcher = chokidar.watch(options.basePath, {\n // ignore .dotfiles, .js and .map files.\n // can't ignore other files as we e.g. want to recompile if an `.html` file changes as well.\n ignored: /((^[\\/\\\\])\\..)|(\\.js$)|(\\.map$)|(\\.metadata\\.json)/,\n ignoreInitial: true,\n persistent: true,\n });\n watcher.on('all', (event: string, path: string) => {\n switch (event) {\n case 'change':\n listener(FileChangeEvent.Change, path);\n break;\n case 'unlink':\n case 'add':\n listener(FileChangeEvent.CreateDelete, path);\n break;\n case 'unlinkDir':\n case 'addDir':\n listener(FileChangeEvent.CreateDeleteDir, path);\n break;\n }\n });\n watcher.on('ready', ready);\n return {close: () => watcher.close(), ready};\n },\n setTimeout: (ts.sys.clearTimeout && ts.sys.setTimeout) || setTimeout,\n clearTimeout: (ts.sys.setTimeout && ts.sys.clearTimeout) || clearTimeout,\n };\n}\n\ninterface CacheEntry {\n exists?: boolean;\n sf?: ts.SourceFile;\n content?: string;\n}\n\n/**\n * The logic in this function is adapted from `tsc.ts` from TypeScript.\n */\nexport function performWatchCompilation(host: PerformWatchHost):\n {close: () => void, ready: (cb: () => void) => void, firstCompileResult: Diagnostics} {\n let cachedProgram: api.Program|undefined; // Program cached from last compilation\n let cachedCompilerHost: api.CompilerHost|undefined; // CompilerHost cached from last compilation\n let cachedOptions: ParsedConfiguration|undefined; // CompilerOptions cached from last compilation\n let timerHandleForRecompilation: any; // Handle for 0.25s wait timer to trigger recompilation\n\n const ingoreFilesForWatch = new Set<string>();\n const fileCache = new Map<string, CacheEntry>();\n\n const firstCompileResult = doCompilation();\n\n // Watch basePath, ignoring .dotfiles\n let resolveReadyPromise: () => void;\n const readyPromise = new Promise(resolve => resolveReadyPromise = resolve);\n // Note: ! is ok as options are filled after the first compilation\n // Note: ! is ok as resolvedReadyPromise is filled by the previous call\n const fileWatcher =\n host.onFileChange(cachedOptions !.options, watchedFileChanged, resolveReadyPromise !);\n\n return {close, ready: cb => readyPromise.then(cb), firstCompileResult};\n\n function cacheEntry(fileName: string): CacheEntry {\n fileName = path.normalize(fileName);\n let entry = fileCache.get(fileName);\n if (!entry) {\n entry = {};\n fileCache.set(fileName, entry);\n }\n return entry;\n }\n\n function close() {\n fileWatcher.close();\n if (timerHandleForRecompilation) {\n host.clearTimeout(timerHandleForRecompilation);\n timerHandleForRecompilation = undefined;\n }\n }\n\n // Invoked to perform initial compilation or re-compilation in watch mode\n function doCompilation(): Diagnostics {\n if (!cachedOptions) {\n cachedOptions = host.readConfiguration();\n }\n if (cachedOptions.errors && cachedOptions.errors.length) {\n host.reportDiagnostics(cachedOptions.errors);\n return cachedOptions.errors;\n }\n const startTime = Date.now();\n if (!cachedCompilerHost) {\n cachedCompilerHost = host.createCompilerHost(cachedOptions.options);\n const originalWriteFileCallback = cachedCompilerHost.writeFile;\n cachedCompilerHost.writeFile = function(\n fileName: string, data: string, writeByteOrderMark: boolean,\n onError?: (message: string) => void, sourceFiles: ReadonlyArray<ts.SourceFile> = []) {\n ingoreFilesForWatch.add(path.normalize(fileName));\n return originalWriteFileCallback(fileName, data, writeByteOrderMark, onError, sourceFiles);\n };\n const originalFileExists = cachedCompilerHost.fileExists;\n cachedCompilerHost.fileExists = function(fileName: string) {\n const ce = cacheEntry(fileName);\n if (ce.exists == null) {\n ce.exists = originalFileExists.call(this, fileName);\n }\n return ce.exists !;\n };\n const originalGetSourceFile = cachedCompilerHost.getSourceFile;\n cachedCompilerHost.getSourceFile = function(\n fileName: string, languageVersion: ts.ScriptTarget) {\n const ce = cacheEntry(fileName);\n if (!ce.sf) {\n ce.sf = originalGetSourceFile.call(this, fileName, languageVersion);\n }\n return ce.sf !;\n };\n const originalReadFile = cachedCompilerHost.readFile;\n cachedCompilerHost.readFile = function(fileName: string) {\n const ce = cacheEntry(fileName);\n if (ce.content == null) {\n ce.content = originalReadFile.call(this, fileName);\n }\n return ce.content !;\n };\n }\n ingoreFilesForWatch.clear();\n const oldProgram = cachedProgram;\n // We clear out the `cachedProgram` here as a\n // program can only be used as `oldProgram` 1x\n cachedProgram = undefined;\n const compileResult = performCompilation({\n rootNames: cachedOptions.rootNames,\n options: cachedOptions.options,\n host: cachedCompilerHost,\n oldProgram: cachedProgram,\n emitCallback: host.createEmitCallback(cachedOptions.options)\n });\n\n if (compileResult.diagnostics.length) {\n host.reportDiagnostics(compileResult.diagnostics);\n }\n\n const endTime = Date.now();\n if (cachedOptions.options.diagnostics) {\n const totalTime = (endTime - startTime) / 1000;\n host.reportDiagnostics([totalCompilationTimeDiagnostic(endTime - startTime)]);\n }\n const exitCode = exitCodeFromResult(compileResult.diagnostics);\n if (exitCode == 0) {\n cachedProgram = compileResult.program;\n host.reportDiagnostics(\n [createMessageDiagnostic('Compilation complete. Watching for file changes.')]);\n } else {\n host.reportDiagnostics(\n [createMessageDiagnostic('Compilation failed. Watching for file changes.')]);\n }\n\n return compileResult.diagnostics;\n }\n\n function resetOptions() {\n cachedProgram = undefined;\n cachedCompilerHost = undefined;\n cachedOptions = undefined;\n }\n\n function watchedFileChanged(event: FileChangeEvent, fileName: string) {\n if (cachedOptions && event === FileChangeEvent.Change &&\n // TODO(chuckj): validate that this is sufficient to skip files that were written.\n // This assumes that the file path we write is the same file path we will receive in the\n // change notification.\n path.normalize(fileName) === path.normalize(cachedOptions.project)) {\n // If the configuration file changes, forget everything and start the recompilation timer\n resetOptions();\n } else if (\n event === FileChangeEvent.CreateDelete || event === FileChangeEvent.CreateDeleteDir) {\n // If a file was added or removed, reread the configuration\n // to determine the new list of root files.\n cachedOptions = undefined;\n }\n\n if (event === FileChangeEvent.CreateDeleteDir) {\n fileCache.clear();\n } else {\n fileCache.delete(path.normalize(fileName));\n }\n\n if (!ingoreFilesForWatch.has(path.normalize(fileName))) {\n // Ignore the file if the file is one that was written by the compiler.\n startTimerForRecompilation();\n }\n }\n\n // Upon detecting a file change, wait for 250ms and then perform a recompilation. This gives batch\n // operations (such as saving all modified files in an editor) a chance to complete before we kick\n // off a new compilation.\n function startTimerForRecompilation() {\n if (timerHandleForRecompilation) {\n host.clearTimeout(timerHandleForRecompilation);\n }\n timerHandleForRecompilation = host.setTimeout(recompile, 250);\n }\n\n function recompile() {\n timerHandleForRecompilation = undefined;\n host.reportDiagnostics(\n [createMessageDiagnostic('File change detected. Starting incremental compilation.')]);\n doCompilation();\n }\n}\n"]}
@@ -163,17 +163,17 @@ export interface Program {
163
163
  * faster than calling `getTsProgram().getOptionsDiagnostics()` since it does not need to
164
164
  * collect Angular structural information to produce the errors.
165
165
  */
166
- getTsOptionDiagnostics(cancellationToken?: ts.CancellationToken): ts.Diagnostic[];
166
+ getTsOptionDiagnostics(cancellationToken?: ts.CancellationToken): ReadonlyArray<ts.Diagnostic>;
167
167
  /**
168
168
  * Retrieve options diagnostics for the Angular options used to create the program.
169
169
  */
170
- getNgOptionDiagnostics(cancellationToken?: ts.CancellationToken): Diagnostic[];
170
+ getNgOptionDiagnostics(cancellationToken?: ts.CancellationToken): ReadonlyArray<Diagnostic>;
171
171
  /**
172
172
  * Retrieve the syntax diagnostics from TypeScript. This is faster than calling
173
173
  * `getTsProgram().getSyntacticDiagnostics()` since it does not need to collect Angular structural
174
174
  * information to produce the errors.
175
175
  */
176
- getTsSyntacticDiagnostics(sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken): ts.Diagnostic[];
176
+ getTsSyntacticDiagnostics(sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken): ReadonlyArray<ts.Diagnostic>;
177
177
  /**
178
178
  * Retrieve the diagnostics for the structure of an Angular application is correctly formed.
179
179
  * This includes validating Angular annotations and the syntax of referenced and imbedded HTML
@@ -185,18 +185,18 @@ export interface Program {
185
185
  *
186
186
  * Angular structural information is required to produce these diagnostics.
187
187
  */
188
- getNgStructuralDiagnostics(cancellationToken?: ts.CancellationToken): Diagnostic[];
188
+ getNgStructuralDiagnostics(cancellationToken?: ts.CancellationToken): ReadonlyArray<Diagnostic>;
189
189
  /**
190
190
  * Retrieve the semantic diagnostics from TypeScript. This is equivilent to calling
191
191
  * `getTsProgram().getSemanticDiagnostics()` directly and is included for completeness.
192
192
  */
193
- getTsSemanticDiagnostics(sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken): ts.Diagnostic[];
193
+ getTsSemanticDiagnostics(sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken): ReadonlyArray<ts.Diagnostic>;
194
194
  /**
195
195
  * Retrieve the Angular semantic diagnostics.
196
196
  *
197
197
  * Angular structural information is required to produce these diagnostics.
198
198
  */
199
- getNgSemanticDiagnostics(fileName?: string, cancellationToken?: ts.CancellationToken): Diagnostic[];
199
+ getNgSemanticDiagnostics(fileName?: string, cancellationToken?: ts.CancellationToken): ReadonlyArray<Diagnostic>;
200
200
  /**
201
201
  * Load Angular structural information asynchronously. If this method is not called then the
202
202
  * Angular structural information, including referenced HTML and CSS files, are loaded
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../../packages/compiler-cli/src/transformers/api.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAKU,QAAA,kBAAkB,GAAG,GAAG,CAAC;AACzB,QAAA,kBAAkB,GAAG,GAAG,CAAC;AACzB,QAAA,MAAM,GAAG,SAAsB,CAAC;AAkB7C,wBAA+B,UAAe;IAC5C,MAAM,CAAC,UAAU,IAAI,IAAI,IAAI,UAAU,CAAC,MAAM,KAAK,SAAS,CAAC;AAC/D,CAAC;AAFD,wCAEC;AAED,wBAA+B,UAAe;IAC5C,MAAM,CAAC,UAAU,IAAI,IAAI,IAAI,UAAU,CAAC,MAAM,KAAK,SAAS,CAAC;AAC/D,CAAC;AAFD,wCAEC;AA8KD,IAAY,SASX;AATD,WAAY,SAAS;IACnB,uCAAY,CAAA;IACZ,qCAAW,CAAA;IACX,iDAAiB,CAAA;IACjB,qDAAmB,CAAA;IACnB,gDAAgB,CAAA;IAEhB,gDAA4B,CAAA;IAC5B,wCAAgD,CAAA;AAClD,CAAC,EATW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QASpB","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {GeneratedFile, ParseSourceSpan, Position} from '@angular/compiler';\nimport * as ts from 'typescript';\n\nexport const DEFAULT_ERROR_CODE = 100;\nexport const UNKNOWN_ERROR_CODE = 500;\nexport const SOURCE = 'angular' as 'angular';\n\nexport interface DiagnosticMessageChain {\n messageText: string;\n position?: Position;\n next?: DiagnosticMessageChain;\n}\n\nexport interface Diagnostic {\n messageText: string;\n span?: ParseSourceSpan;\n position?: Position;\n chain?: DiagnosticMessageChain;\n category: ts.DiagnosticCategory;\n code: number;\n source: 'angular';\n}\n\nexport function isTsDiagnostic(diagnostic: any): diagnostic is ts.Diagnostic {\n return diagnostic != null && diagnostic.source !== 'angular';\n}\n\nexport function isNgDiagnostic(diagnostic: any): diagnostic is Diagnostic {\n return diagnostic != null && diagnostic.source === 'angular';\n}\n\nexport interface CompilerOptions extends ts.CompilerOptions {\n // Write statistics about compilation (e.g. total time, ...)\n // Note: this is the --diagnostics command line option from TS (which is @internal\n // on ts.CompilerOptions interface).\n diagnostics?: boolean;\n\n // Absolute path to a directory where generated file structure is written.\n // If unspecified, generated files will be written alongside sources.\n // @deprecated - no effect\n genDir?: string;\n\n // Path to the directory containing the tsconfig.json file.\n basePath?: string;\n\n // Don't produce .metadata.json files (they don't work for bundled emit with --out)\n skipMetadataEmit?: boolean;\n\n // Produce an error if the metadata written for a class would produce an error if used.\n strictMetadataEmit?: boolean;\n\n // Don't produce .ngfactory.ts or .ngstyle.ts files\n skipTemplateCodegen?: boolean;\n\n // Always report errors when the type of a parameter supplied whose injection type cannot\n // be determined. When this value option is not provided or is `false`, constructor\n // parameters of classes marked with `@Injectable` whose type cannot be resolved will\n // produce a warning. With this option `true`, they produce an error. When this option is\n // not provided is treated as if it were `false`. In Angular 6.0, if this option is not\n // provided, it will be treated as `true`.\n strictInjectionParameters?: boolean;\n\n // Whether to generate a flat module index of the given name and the corresponding\n // flat module metadata. This option is intended to be used when creating flat\n // modules similar to how `@angular/core` and `@angular/common` are packaged.\n // When this option is used the `package.json` for the library should refered to the\n // generated flat module index instead of the library index file. When using this\n // option only one .metadata.json file is produced that contains all the metadata\n // necessary for symbols exported from the library index.\n // In the generated .ngfactory.ts files flat module index is used to import symbols\n // includes both the public API from the library index as well as shrowded internal\n // symbols.\n // By default the .ts file supplied in the `files` files field is assumed to be\n // library index. If more than one is specified, uses `libraryIndex` to select the\n // file to use. If more than on .ts file is supplied and no `libraryIndex` is supplied\n // an error is produced.\n // A flat module index .d.ts and .js will be created with the given `flatModuleOutFile`\n // name in the same location as the library index .d.ts file is emitted.\n // For example, if a library uses `public_api.ts` file as the library index of the\n // module the `tsconfig.json` `files` field would be `[\"public_api.ts\"]`. The\n // `flatModuleOutFile` options could then be set to, for example `\"index.js\"`, which\n // produces `index.d.ts` and `index.metadata.json` files. The library's\n // `package.json`'s `module` field would be `\"index.js\"` and the `typings` field would\n // be `\"index.d.ts\"`.\n flatModuleOutFile?: string;\n\n // Preferred module id to use for importing flat module. References generated by `ngc`\n // will use this module name when importing symbols from the flat module. This is only\n // meaningful when `flatModuleOutFile` is also supplied. It is otherwise ignored.\n flatModuleId?: string;\n\n // Whether to generate code for library code.\n // If true, produce .ngfactory.ts and .ngstyle.ts files for .d.ts inputs.\n // Default is true.\n generateCodeForLibraries?: boolean;\n\n // Whether to enable all type checks for templates.\n // This will be true be default in Angular 6.\n fullTemplateTypeCheck?: boolean;\n\n // Insert JSDoc type annotations needed by Closure Compiler\n annotateForClosureCompiler?: boolean;\n\n // Modify how angular annotations are emitted to improve tree-shaking.\n // Default is static fields.\n // decorators: Leave the Decorators in-place. This makes compilation faster.\n // TypeScript will emit calls to the __decorate helper.\n // `--emitDecoratorMetadata` can be used for runtime reflection.\n // However, the resulting code will not properly tree-shake.\n // static fields: Replace decorators with a static field in the class.\n // Allows advanced tree-shakers like Closure Compiler to remove\n // unused classes.\n annotationsAs?: 'decorators'|'static fields';\n\n // Print extra information while running the compiler\n trace?: boolean;\n\n // Whether to enable support for <template> and the template attribute (false by default)\n enableLegacyTemplate?: boolean;\n\n // Whether to enable lowering expressions lambdas and expressions in a reference value\n // position.\n disableExpressionLowering?: boolean;\n\n // Locale of the application\n i18nOutLocale?: string;\n // Export format (xlf, xlf2 or xmb)\n i18nOutFormat?: string;\n // Path to the extracted message file\n i18nOutFile?: string;\n\n // Import format if different from `i18nFormat`\n i18nInFormat?: string;\n // Locale of the imported translations\n i18nInLocale?: string;\n // Path to the translation file\n i18nInFile?: string;\n // How to handle missing messages\n i18nInMissingTranslations?: 'error'|'warning'|'ignore';\n\n // Whether to remove blank text nodes from compiled templates. It is `true` by default\n // in Angular 5 and will be re-visited in Angular 6.\n preserveWhitespaces?: boolean;\n\n /** generate all possible generated files */\n allowEmptyCodegenFiles?: boolean;\n\n /**\n * Whether to generate .ngsummary.ts files that allow to use AOTed artifacts\n * in JIT mode. This is off by default.\n */\n enableSummariesForJit?: boolean;\n\n /** @internal */\n collectAllErrors?: boolean;\n}\n\nexport interface CompilerHost extends ts.CompilerHost {\n /**\n * Converts a module name that is used in an `import` to a file path.\n * I.e. `path/to/containingFile.ts` containing `import {...} from 'module-name'`.\n */\n moduleNameToFileName?(moduleName: string, containingFile: string): string|null;\n /**\n * Converts a file path to a module name that can be used as an `import ...`\n * I.e. `path/to/importedFile.ts` should be imported by `path/to/containingFile.ts`.\n */\n fileNameToModuleName?(importedFilePath: string, containingFilePath: string): string;\n /**\n * Converts a file path for a resource that is used in a source file or another resource\n * into a filepath.\n */\n resourceNameToFileName?(resourceName: string, containingFilePath: string): string|null;\n /**\n * Converts a file name into a representation that should be stored in a summary file.\n * This has to include changing the suffix as well.\n * E.g.\n * `some_file.ts` -> `some_file.d.ts`\n *\n * @param referringSrcFileName the soure file that refers to fileName\n */\n toSummaryFileName?(fileName: string, referringSrcFileName: string): string;\n /**\n * Converts a fileName that was processed by `toSummaryFileName` back into a real fileName\n * given the fileName of the library that is referrig to it.\n */\n fromSummaryFileName?(fileName: string, referringLibFileName: string): string;\n /**\n * Load a referenced resource either statically or asynchronously. If the host returns a\n * `Promise<string>` it is assumed the user of the corresponding `Program` will call\n * `loadNgStructureAsync()`. Returing `Promise<string>` outside `loadNgStructureAsync()` will\n * cause a diagnostics diagnostic error or an exception to be thrown.\n */\n readResource?(fileName: string): Promise<string>|string;\n /**\n * Produce an AMD module name for the source file. Used in Bazel.\n *\n * An AMD module can have an arbitrary name, so that it is require'd by name\n * rather than by path. See http://requirejs.org/docs/whyamd.html#namedmodules\n */\n amdModuleName?(sf: ts.SourceFile): string|undefined;\n}\n\nexport enum EmitFlags {\n DTS = 1 << 0,\n JS = 1 << 1,\n Metadata = 1 << 2,\n I18nBundle = 1 << 3,\n Codegen = 1 << 4,\n\n Default = DTS | JS | Codegen,\n All = DTS | JS | Metadata | I18nBundle | Codegen,\n}\n\nexport interface CustomTransformers {\n beforeTs?: ts.TransformerFactory<ts.SourceFile>[];\n afterTs?: ts.TransformerFactory<ts.SourceFile>[];\n}\n\nexport interface TsEmitArguments {\n program: ts.Program;\n host: CompilerHost;\n options: CompilerOptions;\n targetSourceFile?: ts.SourceFile;\n writeFile?: ts.WriteFileCallback;\n cancellationToken?: ts.CancellationToken;\n emitOnlyDtsFiles?: boolean;\n customTransformers?: ts.CustomTransformers;\n}\n\nexport interface TsEmitCallback { (args: TsEmitArguments): ts.EmitResult; }\n\n/**\n * @internal\n */\nexport interface LibrarySummary {\n fileName: string;\n text: string;\n sourceFile?: ts.SourceFile;\n}\n\nexport interface LazyRoute {\n route: string;\n module: {name: string, filePath: string};\n referencedModule: {name: string, filePath: string};\n}\n\nexport interface Program {\n /**\n * Retrieve the TypeScript program used to produce semantic diagnostics and emit the sources.\n *\n * Angular structural information is required to produce the program.\n */\n getTsProgram(): ts.Program;\n\n /**\n * Retrieve options diagnostics for the TypeScript options used to create the program. This is\n * faster than calling `getTsProgram().getOptionsDiagnostics()` since it does not need to\n * collect Angular structural information to produce the errors.\n */\n getTsOptionDiagnostics(cancellationToken?: ts.CancellationToken): ts.Diagnostic[];\n\n /**\n * Retrieve options diagnostics for the Angular options used to create the program.\n */\n getNgOptionDiagnostics(cancellationToken?: ts.CancellationToken): Diagnostic[];\n\n /**\n * Retrieve the syntax diagnostics from TypeScript. This is faster than calling\n * `getTsProgram().getSyntacticDiagnostics()` since it does not need to collect Angular structural\n * information to produce the errors.\n */\n getTsSyntacticDiagnostics(sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken):\n ts.Diagnostic[];\n\n /**\n * Retrieve the diagnostics for the structure of an Angular application is correctly formed.\n * This includes validating Angular annotations and the syntax of referenced and imbedded HTML\n * and CSS.\n *\n * Note it is important to displaying TypeScript semantic diagnostics along with Angular\n * structural diagnostics as an error in the program strucutre might cause errors detected in\n * semantic analysis and a semantic error might cause errors in specifying the program structure.\n *\n * Angular structural information is required to produce these diagnostics.\n */\n getNgStructuralDiagnostics(cancellationToken?: ts.CancellationToken): Diagnostic[];\n\n /**\n * Retrieve the semantic diagnostics from TypeScript. This is equivilent to calling\n * `getTsProgram().getSemanticDiagnostics()` directly and is included for completeness.\n */\n getTsSemanticDiagnostics(sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken):\n ts.Diagnostic[];\n\n /**\n * Retrieve the Angular semantic diagnostics.\n *\n * Angular structural information is required to produce these diagnostics.\n */\n getNgSemanticDiagnostics(fileName?: string, cancellationToken?: ts.CancellationToken):\n Diagnostic[];\n\n /**\n * Load Angular structural information asynchronously. If this method is not called then the\n * Angular structural information, including referenced HTML and CSS files, are loaded\n * synchronously. If the supplied Angular compiler host returns a promise from `loadResource()`\n * will produce a diagnostic error message or, `getTsProgram()` or `emit` to throw.\n */\n loadNgStructureAsync(): Promise<void>;\n\n /**\n * Returns the lazy routes in the program.\n * @param entryRoute A reference to an NgModule like `someModule#name`. If given,\n * will recursively analyze routes starting from this symbol only.\n * Otherwise will list all routes for all NgModules in the program/\n */\n listLazyRoutes(entryRoute?: string): LazyRoute[];\n\n /**\n * Emit the files requested by emitFlags implied by the program.\n *\n * Angular structural information is required to emit files.\n */\n emit({emitFlags, cancellationToken, customTransformers, emitCallback}?: {\n emitFlags?: EmitFlags,\n cancellationToken?: ts.CancellationToken,\n customTransformers?: CustomTransformers,\n emitCallback?: TsEmitCallback\n }): ts.EmitResult;\n\n /**\n * Returns the .d.ts / .ngsummary.json / .ngfactory.d.ts files of libraries that have been emitted\n * in this program or previous programs with paths that emulate the fact that these libraries\n * have been compiled before with no outDir.\n *\n * @internal\n */\n getLibrarySummaries(): Map<string, LibrarySummary>;\n\n /**\n * @internal\n */\n getEmittedGeneratedFiles(): Map<string, GeneratedFile>;\n\n /**\n * @internal\n */\n getEmittedSourceFiles(): Map<string, ts.SourceFile>;\n}\n"]}
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../../packages/compiler-cli/src/transformers/api.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAKU,QAAA,kBAAkB,GAAG,GAAG,CAAC;AACzB,QAAA,kBAAkB,GAAG,GAAG,CAAC;AACzB,QAAA,MAAM,GAAG,SAAsB,CAAC;AAkB7C,wBAA+B,UAAe;IAC5C,MAAM,CAAC,UAAU,IAAI,IAAI,IAAI,UAAU,CAAC,MAAM,KAAK,SAAS,CAAC;AAC/D,CAAC;AAFD,wCAEC;AAED,wBAA+B,UAAe;IAC5C,MAAM,CAAC,UAAU,IAAI,IAAI,IAAI,UAAU,CAAC,MAAM,KAAK,SAAS,CAAC;AAC/D,CAAC;AAFD,wCAEC;AA8KD,IAAY,SASX;AATD,WAAY,SAAS;IACnB,uCAAY,CAAA;IACZ,qCAAW,CAAA;IACX,iDAAiB,CAAA;IACjB,qDAAmB,CAAA;IACnB,gDAAgB,CAAA;IAEhB,gDAA4B,CAAA;IAC5B,wCAAgD,CAAA;AAClD,CAAC,EATW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QASpB","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {GeneratedFile, ParseSourceSpan, Position} from '@angular/compiler';\nimport * as ts from 'typescript';\n\nexport const DEFAULT_ERROR_CODE = 100;\nexport const UNKNOWN_ERROR_CODE = 500;\nexport const SOURCE = 'angular' as 'angular';\n\nexport interface DiagnosticMessageChain {\n messageText: string;\n position?: Position;\n next?: DiagnosticMessageChain;\n}\n\nexport interface Diagnostic {\n messageText: string;\n span?: ParseSourceSpan;\n position?: Position;\n chain?: DiagnosticMessageChain;\n category: ts.DiagnosticCategory;\n code: number;\n source: 'angular';\n}\n\nexport function isTsDiagnostic(diagnostic: any): diagnostic is ts.Diagnostic {\n return diagnostic != null && diagnostic.source !== 'angular';\n}\n\nexport function isNgDiagnostic(diagnostic: any): diagnostic is Diagnostic {\n return diagnostic != null && diagnostic.source === 'angular';\n}\n\nexport interface CompilerOptions extends ts.CompilerOptions {\n // Write statistics about compilation (e.g. total time, ...)\n // Note: this is the --diagnostics command line option from TS (which is @internal\n // on ts.CompilerOptions interface).\n diagnostics?: boolean;\n\n // Absolute path to a directory where generated file structure is written.\n // If unspecified, generated files will be written alongside sources.\n // @deprecated - no effect\n genDir?: string;\n\n // Path to the directory containing the tsconfig.json file.\n basePath?: string;\n\n // Don't produce .metadata.json files (they don't work for bundled emit with --out)\n skipMetadataEmit?: boolean;\n\n // Produce an error if the metadata written for a class would produce an error if used.\n strictMetadataEmit?: boolean;\n\n // Don't produce .ngfactory.js or .ngstyle.js files\n skipTemplateCodegen?: boolean;\n\n // Always report errors when the type of a parameter supplied whose injection type cannot\n // be determined. When this value option is not provided or is `false`, constructor\n // parameters of classes marked with `@Injectable` whose type cannot be resolved will\n // produce a warning. With this option `true`, they produce an error. When this option is\n // not provided is treated as if it were `false`. In Angular 6.0, if this option is not\n // provided, it will be treated as `true`.\n strictInjectionParameters?: boolean;\n\n // Whether to generate a flat module index of the given name and the corresponding\n // flat module metadata. This option is intended to be used when creating flat\n // modules similar to how `@angular/core` and `@angular/common` are packaged.\n // When this option is used the `package.json` for the library should refered to the\n // generated flat module index instead of the library index file. When using this\n // option only one .metadata.json file is produced that contains all the metadata\n // necessary for symbols exported from the library index.\n // In the generated .ngfactory.ts files flat module index is used to import symbols\n // includes both the public API from the library index as well as shrowded internal\n // symbols.\n // By default the .ts file supplied in the `files` files field is assumed to be\n // library index. If more than one is specified, uses `libraryIndex` to select the\n // file to use. If more than on .ts file is supplied and no `libraryIndex` is supplied\n // an error is produced.\n // A flat module index .d.ts and .js will be created with the given `flatModuleOutFile`\n // name in the same location as the library index .d.ts file is emitted.\n // For example, if a library uses `public_api.ts` file as the library index of the\n // module the `tsconfig.json` `files` field would be `[\"public_api.ts\"]`. The\n // `flatModuleOutFile` options could then be set to, for example `\"index.js\"`, which\n // produces `index.d.ts` and `index.metadata.json` files. The library's\n // `package.json`'s `module` field would be `\"index.js\"` and the `typings` field would\n // be `\"index.d.ts\"`.\n flatModuleOutFile?: string;\n\n // Preferred module id to use for importing flat module. References generated by `ngc`\n // will use this module name when importing symbols from the flat module. This is only\n // meaningful when `flatModuleOutFile` is also supplied. It is otherwise ignored.\n flatModuleId?: string;\n\n // Whether to generate code for library code.\n // If true, produce .ngfactory.ts and .ngstyle.ts files for .d.ts inputs.\n // Default is true.\n generateCodeForLibraries?: boolean;\n\n // Whether to enable all type checks for templates.\n // This will be true be default in Angular 6.\n fullTemplateTypeCheck?: boolean;\n\n // Insert JSDoc type annotations needed by Closure Compiler\n annotateForClosureCompiler?: boolean;\n\n // Modify how angular annotations are emitted to improve tree-shaking.\n // Default is static fields.\n // decorators: Leave the Decorators in-place. This makes compilation faster.\n // TypeScript will emit calls to the __decorate helper.\n // `--emitDecoratorMetadata` can be used for runtime reflection.\n // However, the resulting code will not properly tree-shake.\n // static fields: Replace decorators with a static field in the class.\n // Allows advanced tree-shakers like Closure Compiler to remove\n // unused classes.\n annotationsAs?: 'decorators'|'static fields';\n\n // Print extra information while running the compiler\n trace?: boolean;\n\n // Whether to enable support for <template> and the template attribute (false by default)\n enableLegacyTemplate?: boolean;\n\n // Whether to enable lowering expressions lambdas and expressions in a reference value\n // position.\n disableExpressionLowering?: boolean;\n\n // Locale of the application\n i18nOutLocale?: string;\n // Export format (xlf, xlf2 or xmb)\n i18nOutFormat?: string;\n // Path to the extracted message file\n i18nOutFile?: string;\n\n // Import format if different from `i18nFormat`\n i18nInFormat?: string;\n // Locale of the imported translations\n i18nInLocale?: string;\n // Path to the translation file\n i18nInFile?: string;\n // How to handle missing messages\n i18nInMissingTranslations?: 'error'|'warning'|'ignore';\n\n // Whether to remove blank text nodes from compiled templates. It is `true` by default\n // in Angular 5 and will be re-visited in Angular 6.\n preserveWhitespaces?: boolean;\n\n /** generate all possible generated files */\n allowEmptyCodegenFiles?: boolean;\n\n /**\n * Whether to generate .ngsummary.ts files that allow to use AOTed artifacts\n * in JIT mode. This is off by default.\n */\n enableSummariesForJit?: boolean;\n\n /** @internal */\n collectAllErrors?: boolean;\n}\n\nexport interface CompilerHost extends ts.CompilerHost {\n /**\n * Converts a module name that is used in an `import` to a file path.\n * I.e. `path/to/containingFile.ts` containing `import {...} from 'module-name'`.\n */\n moduleNameToFileName?(moduleName: string, containingFile: string): string|null;\n /**\n * Converts a file path to a module name that can be used as an `import ...`\n * I.e. `path/to/importedFile.ts` should be imported by `path/to/containingFile.ts`.\n */\n fileNameToModuleName?(importedFilePath: string, containingFilePath: string): string;\n /**\n * Converts a file path for a resource that is used in a source file or another resource\n * into a filepath.\n */\n resourceNameToFileName?(resourceName: string, containingFilePath: string): string|null;\n /**\n * Converts a file name into a representation that should be stored in a summary file.\n * This has to include changing the suffix as well.\n * E.g.\n * `some_file.ts` -> `some_file.d.ts`\n *\n * @param referringSrcFileName the soure file that refers to fileName\n */\n toSummaryFileName?(fileName: string, referringSrcFileName: string): string;\n /**\n * Converts a fileName that was processed by `toSummaryFileName` back into a real fileName\n * given the fileName of the library that is referrig to it.\n */\n fromSummaryFileName?(fileName: string, referringLibFileName: string): string;\n /**\n * Load a referenced resource either statically or asynchronously. If the host returns a\n * `Promise<string>` it is assumed the user of the corresponding `Program` will call\n * `loadNgStructureAsync()`. Returing `Promise<string>` outside `loadNgStructureAsync()` will\n * cause a diagnostics diagnostic error or an exception to be thrown.\n */\n readResource?(fileName: string): Promise<string>|string;\n /**\n * Produce an AMD module name for the source file. Used in Bazel.\n *\n * An AMD module can have an arbitrary name, so that it is require'd by name\n * rather than by path. See http://requirejs.org/docs/whyamd.html#namedmodules\n */\n amdModuleName?(sf: ts.SourceFile): string|undefined;\n}\n\nexport enum EmitFlags {\n DTS = 1 << 0,\n JS = 1 << 1,\n Metadata = 1 << 2,\n I18nBundle = 1 << 3,\n Codegen = 1 << 4,\n\n Default = DTS | JS | Codegen,\n All = DTS | JS | Metadata | I18nBundle | Codegen,\n}\n\nexport interface CustomTransformers {\n beforeTs?: ts.TransformerFactory<ts.SourceFile>[];\n afterTs?: ts.TransformerFactory<ts.SourceFile>[];\n}\n\nexport interface TsEmitArguments {\n program: ts.Program;\n host: CompilerHost;\n options: CompilerOptions;\n targetSourceFile?: ts.SourceFile;\n writeFile?: ts.WriteFileCallback;\n cancellationToken?: ts.CancellationToken;\n emitOnlyDtsFiles?: boolean;\n customTransformers?: ts.CustomTransformers;\n}\n\nexport interface TsEmitCallback { (args: TsEmitArguments): ts.EmitResult; }\n\n/**\n * @internal\n */\nexport interface LibrarySummary {\n fileName: string;\n text: string;\n sourceFile?: ts.SourceFile;\n}\n\nexport interface LazyRoute {\n route: string;\n module: {name: string, filePath: string};\n referencedModule: {name: string, filePath: string};\n}\n\nexport interface Program {\n /**\n * Retrieve the TypeScript program used to produce semantic diagnostics and emit the sources.\n *\n * Angular structural information is required to produce the program.\n */\n getTsProgram(): ts.Program;\n\n /**\n * Retrieve options diagnostics for the TypeScript options used to create the program. This is\n * faster than calling `getTsProgram().getOptionsDiagnostics()` since it does not need to\n * collect Angular structural information to produce the errors.\n */\n getTsOptionDiagnostics(cancellationToken?: ts.CancellationToken): ReadonlyArray<ts.Diagnostic>;\n\n /**\n * Retrieve options diagnostics for the Angular options used to create the program.\n */\n getNgOptionDiagnostics(cancellationToken?: ts.CancellationToken): ReadonlyArray<Diagnostic>;\n\n /**\n * Retrieve the syntax diagnostics from TypeScript. This is faster than calling\n * `getTsProgram().getSyntacticDiagnostics()` since it does not need to collect Angular structural\n * information to produce the errors.\n */\n getTsSyntacticDiagnostics(sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken):\n ReadonlyArray<ts.Diagnostic>;\n\n /**\n * Retrieve the diagnostics for the structure of an Angular application is correctly formed.\n * This includes validating Angular annotations and the syntax of referenced and imbedded HTML\n * and CSS.\n *\n * Note it is important to displaying TypeScript semantic diagnostics along with Angular\n * structural diagnostics as an error in the program strucutre might cause errors detected in\n * semantic analysis and a semantic error might cause errors in specifying the program structure.\n *\n * Angular structural information is required to produce these diagnostics.\n */\n getNgStructuralDiagnostics(cancellationToken?: ts.CancellationToken): ReadonlyArray<Diagnostic>;\n\n /**\n * Retrieve the semantic diagnostics from TypeScript. This is equivilent to calling\n * `getTsProgram().getSemanticDiagnostics()` directly and is included for completeness.\n */\n getTsSemanticDiagnostics(sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken):\n ReadonlyArray<ts.Diagnostic>;\n\n /**\n * Retrieve the Angular semantic diagnostics.\n *\n * Angular structural information is required to produce these diagnostics.\n */\n getNgSemanticDiagnostics(fileName?: string, cancellationToken?: ts.CancellationToken):\n ReadonlyArray<Diagnostic>;\n\n /**\n * Load Angular structural information asynchronously. If this method is not called then the\n * Angular structural information, including referenced HTML and CSS files, are loaded\n * synchronously. If the supplied Angular compiler host returns a promise from `loadResource()`\n * will produce a diagnostic error message or, `getTsProgram()` or `emit` to throw.\n */\n loadNgStructureAsync(): Promise<void>;\n\n /**\n * Returns the lazy routes in the program.\n * @param entryRoute A reference to an NgModule like `someModule#name`. If given,\n * will recursively analyze routes starting from this symbol only.\n * Otherwise will list all routes for all NgModules in the program/\n */\n listLazyRoutes(entryRoute?: string): LazyRoute[];\n\n /**\n * Emit the files requested by emitFlags implied by the program.\n *\n * Angular structural information is required to emit files.\n */\n emit({emitFlags, cancellationToken, customTransformers, emitCallback}?: {\n emitFlags?: EmitFlags,\n cancellationToken?: ts.CancellationToken,\n customTransformers?: CustomTransformers,\n emitCallback?: TsEmitCallback\n }): ts.EmitResult;\n\n /**\n * Returns the .d.ts / .ngsummary.json / .ngfactory.d.ts files of libraries that have been emitted\n * in this program or previous programs with paths that emulate the fact that these libraries\n * have been compiled before with no outDir.\n *\n * @internal\n */\n getLibrarySummaries(): Map<string, LibrarySummary>;\n\n /**\n * @internal\n */\n getEmittedGeneratedFiles(): Map<string, GeneratedFile>;\n\n /**\n * @internal\n */\n getEmittedSourceFiles(): Map<string, ts.SourceFile>;\n}\n"]}
@@ -51,7 +51,7 @@ export declare class TsCompilerAotCompilerTypeCheckHostAdapter implements ts.Com
51
51
  trace: (s: string) => void;
52
52
  getDirectories: (path: string) => string[];
53
53
  directoryExists?: (directoryName: string) => boolean;
54
- constructor(rootFiles: string[], options: CompilerOptions, context: CompilerHost, metadataProvider: MetadataProvider, codeGenerator: CodeGenerator, librarySummaries?: Map<string, LibrarySummary>);
54
+ constructor(rootFiles: ReadonlyArray<string>, options: CompilerOptions, context: CompilerHost, metadataProvider: MetadataProvider, codeGenerator: CodeGenerator, librarySummaries?: Map<string, LibrarySummary>);
55
55
  private resolveModuleName(moduleName, containingFile);
56
56
  resolveModuleNames(moduleNames: string[], containingFile: string): ts.ResolvedModule[];
57
57
  moduleNameToFileName(m: string, containingFile?: string): string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"compiler_host.js","sourceRoot":"","sources":["../../../../../packages/compiler-cli/src/transformers/compiler_host.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAEH,8CAAuL;AACvL,2BAA6B;AAC7B,+BAAiC;AAMjC,qDAA8F;AAC9F,+BAA6E;AAE7E,IAAM,yBAAyB,GAAG,6CAA6C,CAAC;AAChF,IAAM,GAAG,GAAG,kCAAkC,CAAC;AAE/C,4BACI,EACwD;QADvD,oBAAO,EAAE,cAA6C,EAA7C,kEAA6C;IAEzD,MAAM,CAAC,MAAM,CAAC;AAChB,CAAC;AAJD,gDAIC;AAiBD,gBAAmB,SAA+B;IAChD,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;QACf,qCAAqC;IACvC,CAAC;IACD,MAAM,CAAC,SAAW,CAAC;AACrB,CAAC;AAED;;;;;GAKG;AACH;IAqBE,mDACY,SAAmB,EAAU,OAAwB,EAAU,OAAqB,EACpF,gBAAkC,EAAU,aAA4B,EACxE,gBAAoD;QAApD,iCAAA,EAAA,uBAAuB,GAAG,EAA0B;QAHhE,iBA+CC;QA9CW,cAAS,GAAT,SAAS,CAAU;QAAU,YAAO,GAAP,OAAO,CAAiB;QAAU,YAAO,GAAP,OAAO,CAAc;QACpF,qBAAgB,GAAhB,gBAAgB,CAAkB;QAAU,kBAAa,GAAb,aAAa,CAAe;QACxE,qBAAgB,GAAhB,gBAAgB,CAAoC;QAtBxD,wBAAmB,GAAG,2CAAyB,EAAE,CAAC;QAClD,yBAAoB,GAAG,IAAI,GAAG,EAAmB,CAAC;QAClD,yBAAoB,GAAG,IAAI,GAAG,EAAU,CAAC;QACzC,iCAA4B,GAAG,IAAI,GAAG,EAAU,CAAC;QAGjD,wBAAmB,GAAG,IAAI,GAAG,EAAmC,CAAC;QACjE,4B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CAAC;AAED,+BAA+B,QAAgB;IAC7C,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;AACpD,CAAC;AAED,6BAA6B,QAAgB;IAC3C,MAAM,CAAI,QAAQ,kBAAe,CAAC;AACpC,CAAC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {AotCompilerHost, EmitterVisitorContext, ExternalReference, GeneratedFile, ParseSourceSpan, TypeScriptEmitter, collectExternalReferences, syntaxError} from '@angular/compiler';\nimport * as path from 'path';\nimport * as ts from 'typescript';\n\nimport {TypeCheckHost} from '../diagnostics/translate_diagnostics';\nimport {METADATA_VERSION, ModuleMetadata} from '../metadata/index';\n\nimport {CompilerHost, CompilerOptions, LibrarySummary} from './api';\nimport {MetadataReaderHost, createMetadataReaderCache, readMetadata} from './metadata_reader';\nimport {DTS, GENERATED_FILES, isInRootDir, relativeToRootDirs} from './util';\n\nconst NODE_MODULES_PACKAGE_NAME = /node_modules\\/((\\w|-)+|(@(\\w|-)+\\/(\\w|-)+))/;\nconst EXT = /(\\.ts|\\.d\\.ts|\\.js|\\.jsx|\\.tsx)$/;\n\nexport function createCompilerHost(\n {options, tsHost = ts.createCompilerHost(options, true)}:\n {options: CompilerOptions, tsHost?: ts.CompilerHost}): CompilerHost {\n return tsHost;\n}\n\nexport interface MetadataProvider {\n getMetadata(sourceFile: ts.SourceFile): ModuleMetadata|undefined;\n}\n\ninterface GenSourceFile {\n externalReferences: Set<string>;\n sourceFile: ts.SourceFile;\n emitCtx: EmitterVisitorContext;\n}\n\nexport interface CodeGenerator {\n generateFile(genFileName: string, baseFileName?: string): GeneratedFile;\n findGeneratedFileNames(fileName: string): string[];\n}\n\nfunction assert<T>(condition: T | null | undefined) {\n if (!condition) {\n // TODO(chuckjaz): do the right thing\n }\n return condition !;\n}\n\n/**\n * Implements the following hosts based on an api.CompilerHost:\n * - ts.CompilerHost to be consumed by a ts.Program\n * - AotCompilerHost for @angular/compiler\n * - TypeCheckHost for mapping ts errors to ng errors (via translateDiagnostics)\n */\nexport class TsCompilerAotCompilerTypeCheckHostAdapter implements ts.CompilerHost, AotCompilerHost,\n TypeCheckHost {\n private metadataReaderCache = createMetadataReaderCache();\n private flatModuleIndexCache = new Map<string, boolean>();\n private flatModuleIndexNames = new Set<string>();\n private flatModuleIndexRedirectNames = new Set<string>();\n private rootDirs: string[];\n private moduleResolutionCache: ts.ModuleResolutionCache;\n private originalSourceFiles = new Map<string, ts.SourceFile|undefined>();\n private originalFileExistsCache = new Map<string, boolean>();\n private generatedSourceFiles = new Map<string, GenSourceFile>();\n private generatedCodeFor = new Map<string, string[]>();\n private emitter = new TypeScriptEmitter();\n private metadataReaderHost: MetadataReaderHost;\n\n getCancellationToken: () => ts.CancellationToken;\n getDefaultLibLocation: () => string;\n trace: (s: string) => void;\n getDirectories: (path: string) => string[];\n directoryExists?: (directoryName: string) => boolean;\n\n constructor(\n private rootFiles: string[], private options: CompilerOptions, private context: CompilerHost,\n private metadataProvider: MetadataProvider, private codeGenerator: CodeGenerator,\n private librarySummaries = new Map<string, LibrarySummary>()) {\n this.moduleResolutionCache = ts.createModuleResolutionCache(\n this.context.getCurrentDirectory !(), this.context.getCanonicalFileName.bind(this.context));\n const basePath = this.options.basePath !;\n this.rootDirs =\n (this.options.rootDirs || [this.options.basePath !]).map(p => path.resolve(basePath, p));\n if (context.getDirectories) {\n this.getDirectories = path => context.getDirectories !(path);\n }\n if (context.directoryExists) {\n this.directoryExists = directoryName => context.directoryExists !(directoryName);\n }\n if (context.getCancellationToken) {\n this.getCancellationToken = () => context.getCancellationToken !();\n }\n if (context.getDefaultLibLocation) {\n this.getDefaultLibLocation = () => context.getDefaultLibLocation !();\n }\n if (context.trace) {\n this.trace = s => context.trace !(s);\n }\n if (context.fileNameToModuleName) {\n this.fileNameToModuleName = context.fileNameToModuleName.bind(context);\n }\n // Note: don't copy over context.moduleNameToFileName as we first\n // normalize undefined containingFile to a filled containingFile.\n if (context.resourceNameToFileName) {\n this.resourceNameToFileName = context.resourceNameToFileName.bind(context);\n }\n if (context.toSummaryFileName) {\n this.toSummaryFileName = context.toSummaryFileName.bind(context);\n }\n if (context.fromSummaryFileName) {\n this.fromSummaryFileName = context.fromSummaryFileName.bind(context);\n }\n this.metadataReaderHost = {\n cacheMetadata: () => true,\n getSourceFileMetadata: (filePath) => {\n const sf = this.getOriginalSourceFile(filePath);\n return sf ? this.metadataProvider.getMetadata(sf) : undefined;\n },\n fileExists: (filePath) => this.originalFileExists(filePath),\n readFile: (filePath) => assert(this.context.readFile(filePath)),\n };\n }\n\n private resolveModuleName(moduleName: string, containingFile: string): ts.ResolvedModule\n |undefined {\n const rm = ts.resolveModuleName(\n moduleName, containingFile.replace(/\\\\/g, '/'), this.options, this,\n this.moduleResolutionCache)\n .resolvedModule;\n if (rm && this.isSourceFile(rm.resolvedFileName) && DTS.test(rm.resolvedFileName)) {\n // Case: generateCodeForLibraries = true and moduleName is\n // a .d.ts file in a node_modules folder.\n // Need to set isExternalLibraryImport to false so that generated files for that file\n // are emitted.\n rm.isExternalLibraryImport = false;\n }\n return rm;\n }\n\n // Note: We implement this method so that TypeScript and Angular share the same\n // ts.ModuleResolutionCache\n // and that we can tell ts.Program about our different opinion about\n // ResolvedModule.isExternalLibraryImport\n // (see our isSourceFile method).\n resolveModuleNames(moduleNames: string[], containingFile: string): ts.ResolvedModule[] {\n // TODO(tbosch): this seems to be a typing error in TypeScript,\n // as it contains assertions that the result contains the same number of entries\n // as the given module names.\n return <ts.ResolvedModule[]>moduleNames.map(\n moduleName => this.resolveModuleName(moduleName, containingFile));\n }\n\n moduleNameToFileName(m: string, containingFile?: string): string|null {\n if (!containingFile) {\n if (m.indexOf('.') === 0) {\n throw new Error('Resolution of relative paths requires a containing file.');\n }\n // Any containing file gives the same result for absolute imports\n containingFile = this.rootFiles[0];\n }\n if (this.context.moduleNameToFileName) {\n return this.context.moduleNameToFileName(m, containingFile);\n }\n const resolved = this.resolveModuleName(m, containingFile);\n return resolved ? resolved.resolvedFileName : null;\n }\n\n /**\n * We want a moduleId that will appear in import statements in the generated code\n * which will be written to `containingFile`.\n *\n * Note that we also generate files for files in node_modules, as libraries\n * only ship .metadata.json files but not the generated code.\n *\n * Logic:\n * 1. if the importedFile and the containingFile are from the project sources\n * or from the same node_modules package, use a relative path\n * 2. if the importedFile is in a node_modules package,\n * use a path that starts with the package name.\n * 3. Error if the containingFile is in the node_modules package\n * and the importedFile is in the project soures,\n * as that is a violation of the principle that node_modules packages cannot\n * import project sources.\n */\n fileNameToModuleName(importedFile: string, containingFile: string): string {\n const originalImportedFile = importedFile;\n if (this.options.traceResolution) {\n console.error(\n 'fileNameToModuleName from containingFile', containingFile, 'to importedFile',\n importedFile);\n }\n\n // drop extension\n importedFile = importedFile.replace(EXT, '');\n const importedFilePackagName = getPackageName(importedFile);\n const containingFilePackageName = getPackageName(containingFile);\n\n let moduleName: string;\n if (importedFilePackagName === containingFilePackageName ||\n GENERATED_FILES.test(originalImportedFile)) {\n const rootedContainingFile = relativeToRootDirs(containingFile, this.rootDirs);\n const rootedImportedFile = relativeToRootDirs(importedFile, this.rootDirs);\n\n if (rootedContainingFile !== containingFile && rootedImportedFile !== importedFile) {\n // if both files are contained in the `rootDirs`, then strip the rootDirs\n containingFile = rootedContainingFile;\n importedFile = rootedImportedFile;\n }\n moduleName = dotRelative(path.dirname(containingFile), importedFile);\n } else if (importedFilePackagName) {\n moduleName = stripNodeModulesPrefix(importedFile);\n } else {\n throw new Error(\n `Trying to import a source file from a node_modules package: import ${originalImportedFile} from ${containingFile}`);\n }\n return moduleName;\n }\n\n resourceNameToFileName(resourceName: string, containingFile: string): string|null {\n // Note: we convert package paths into relative paths to be compatible with the the\n // previous implementation of UrlResolver.\n const firstChar = resourceName[0];\n if (firstChar === '/') {\n resourceName = resourceName.slice(1);\n } else if (firstChar !== '.') {\n resourceName = `./${resourceName}`;\n }\n const filePathWithNgResource =\n this.moduleNameToFileName(addNgResourceSuffix(resourceName), containingFile);\n return filePathWithNgResource ? stripNgResourceSuffix(filePathWithNgResource) : null;\n }\n\n toSummaryFileName(fileName: string, referringSrcFileName: string): string {\n return this.fileNameToModuleName(fileName, referringSrcFileName);\n }\n\n fromSummaryFileName(fileName: string, referringLibFileName: string): string {\n const resolved = this.moduleNameToFileName(fileName, referringLibFileName);\n if (!resolved) {\n throw new Error(`Could not resolve ${fileName} from ${referringLibFileName}`);\n }\n return resolved;\n }\n\n parseSourceSpanOf(fileName: string, line: number, character: number): ParseSourceSpan|null {\n const data = this.generatedSourceFiles.get(fileName);\n if (data && data.emitCtx) {\n return data.emitCtx.spanOf(line, character);\n }\n return null;\n }\n\n private getOriginalSourceFile(\n filePath: string, languageVersion?: ts.ScriptTarget,\n onError?: ((message: string) => void)|undefined): ts.SourceFile|null {\n // Note: we need the explicit check via `has` as we also cache results\n // that were null / undefined.\n if (this.originalSourceFiles.has(filePath)) {\n return this.originalSourceFiles.get(filePath) !;\n }\n if (!languageVersion) {\n languageVersion = this.options.target || ts.ScriptTarget.Latest;\n }\n // Note: This can also return undefined,\n // as the TS typings are not correct!\n const sf = this.context.getSourceFile(filePath, languageVersion, onError) || null;\n this.originalSourceFiles.set(filePath, sf);\n return sf;\n }\n\n updateGeneratedFile(genFile: GeneratedFile): ts.SourceFile {\n if (!genFile.stmts) {\n throw new Error(\n `Invalid Argument: Expected a GenerateFile with statements. ${genFile.genFileUrl}`);\n }\n const oldGenFile = this.generatedSourceFiles.get(genFile.genFileUrl);\n if (!oldGenFile) {\n throw new Error(`Illegal State: previous GeneratedFile not found for ${genFile.genFileUrl}.`);\n }\n const newRefs = genFileExternalReferences(genFile);\n const oldRefs = oldGenFile.externalReferences;\n let refsAreEqual = oldRefs.size === newRefs.size;\n if (refsAreEqual) {\n newRefs.forEach(r => refsAreEqual = refsAreEqual && oldRefs.has(r));\n }\n if (!refsAreEqual) {\n throw new Error(\n `Illegal State: external references changed in ${genFile.genFileUrl}.\\nOld: ${Array.from(oldRefs)}.\\nNew: ${Array.from(newRefs)}`);\n }\n return this.addGeneratedFile(genFile, newRefs);\n }\n\n private addGeneratedFile(genFile: GeneratedFile, externalReferences: Set<string>): ts.SourceFile {\n if (!genFile.stmts) {\n throw new Error(\n `Invalid Argument: Expected a GenerateFile with statements. ${genFile.genFileUrl}`);\n }\n const {sourceText, context} = this.emitter.emitStatementsAndContext(\n genFile.genFileUrl, genFile.stmts, /* preamble */ '',\n /* emitSourceMaps */ false);\n const sf = ts.createSourceFile(\n genFile.genFileUrl, sourceText, this.options.target || ts.ScriptTarget.Latest);\n if ((this.options.module === ts.ModuleKind.AMD || this.options.module === ts.ModuleKind.UMD) &&\n this.context.amdModuleName) {\n const moduleName = this.context.amdModuleName(sf);\n if (moduleName) sf.moduleName = moduleName;\n }\n this.generatedSourceFiles.set(genFile.genFileUrl, {\n sourceFile: sf,\n emitCtx: context, externalReferences,\n });\n return sf;\n }\n\n shouldGenerateFile(fileName: string): {generate: boolean, baseFileName?: string} {\n // TODO(tbosch): allow generating files that are not in the rootDir\n // See https://github.com/angular/angular/issues/19337\n if (!isInRootDir(fileName, this.options)) {\n return {generate: false};\n }\n const genMatch = GENERATED_FILES.exec(fileName);\n if (!genMatch) {\n return {generate: false};\n }\n const [, base, genSuffix, suffix] = genMatch;\n if (suffix !== 'ts' && suffix !== 'tsx') {\n return {generate: false};\n }\n let baseFileName: string|undefined;\n if (genSuffix.indexOf('ngstyle') >= 0) {\n // Note: ngstyle files have names like `afile.css.ngstyle.ts`\n if (!this.originalFileExists(base)) {\n return {generate: false};\n }\n } else {\n // Note: on-the-fly generated files always have a `.ts` suffix,\n // but the file from which we generated it can be a `.ts`/ `.tsx`/ `.d.ts`\n // (see options.generateCodeForLibraries).\n baseFileName = [`${base}.ts`, `${base}.tsx`, `${base}.d.ts`].find(\n baseFileName => this.isSourceFile(baseFileName) && this.originalFileExists(baseFileName));\n if (!baseFileName) {\n return {generate: false};\n }\n }\n return {generate: true, baseFileName};\n }\n\n shouldGenerateFilesFor(fileName: string) {\n // TODO(tbosch): allow generating files that are not in the rootDir\n // See https://github.com/angular/angular/issues/19337\n return !GENERATED_FILES.test(fileName) && this.isSourceFile(fileName) &&\n isInRootDir(fileName, this.options);\n }\n\n getSourceFile(\n fileName: string, languageVersion: ts.ScriptTarget,\n onError?: ((message: string) => void)|undefined): ts.SourceFile {\n // Note: Don't exit early in this method to make sure\n // we always have up to date references on the file!\n let genFileNames: string[] = [];\n let sf = this.getGeneratedFile(fileName);\n if (!sf) {\n const summary = this.librarySummaries.get(fileName);\n if (summary) {\n if (!summary.sourceFile) {\n summary.sourceFile = ts.createSourceFile(\n fileName, summary.text, this.options.target || ts.ScriptTarget.Latest);\n }\n sf = summary.sourceFile;\n genFileNames = [];\n }\n }\n if (!sf) {\n sf = this.getOriginalSourceFile(fileName);\n const cachedGenFiles = this.generatedCodeFor.get(fileName);\n if (cachedGenFiles) {\n genFileNames = cachedGenFiles;\n } else {\n if (!this.options.noResolve && this.shouldGenerateFilesFor(fileName)) {\n genFileNames = this.codeGenerator.findGeneratedFileNames(fileName).filter(\n fileName => this.shouldGenerateFile(fileName).generate);\n }\n this.generatedCodeFor.set(fileName, genFileNames);\n }\n }\n if (sf) {\n addReferencesToSourceFile(sf, genFileNames);\n }\n // TODO(tbosch): TypeScript's typings for getSourceFile are incorrect,\n // as it can very well return undefined.\n return sf !;\n }\n\n private getGeneratedFile(fileName: string): ts.SourceFile|null {\n const genSrcFile = this.generatedSourceFiles.get(fileName);\n if (genSrcFile) {\n return genSrcFile.sourceFile;\n }\n const {generate, baseFileName} = this.shouldGenerateFile(fileName);\n if (generate) {\n const genFile = this.codeGenerator.generateFile(fileName, baseFileName);\n return this.addGeneratedFile(genFile, genFileExternalReferences(genFile));\n }\n return null;\n }\n\n private originalFileExists(fileName: string): boolean {\n let fileExists = this.originalFileExistsCache.get(fileName);\n if (fileExists == null) {\n fileExists = this.context.fileExists(fileName);\n this.originalFileExistsCache.set(fileName, fileExists);\n }\n return fileExists;\n }\n\n fileExists(fileName: string): boolean {\n fileName = stripNgResourceSuffix(fileName);\n if (this.librarySummaries.has(fileName) || this.generatedSourceFiles.has(fileName)) {\n return true;\n }\n if (this.shouldGenerateFile(fileName).generate) {\n return true;\n }\n return this.originalFileExists(fileName);\n }\n\n loadSummary(filePath: string): string|null {\n const summary = this.librarySummaries.get(filePath);\n if (summary) {\n return summary.text;\n }\n if (this.originalFileExists(filePath)) {\n return assert(this.context.readFile(filePath));\n }\n return null;\n }\n\n isSourceFile(filePath: string): boolean {\n // Don't generate any files nor typecheck them\n // if skipTemplateCodegen is set and fullTemplateTypeCheck is not yet set,\n // for backwards compatibility.\n if (this.options.skipTemplateCodegen && !this.options.fullTemplateTypeCheck) {\n return false;\n }\n // If we have a summary from a previous compilation,\n // treat the file never as a source file.\n if (this.librarySummaries.has(filePath)) {\n return false;\n }\n if (GENERATED_FILES.test(filePath)) {\n return false;\n }\n if (this.options.generateCodeForLibraries === false && DTS.test(filePath)) {\n return false;\n }\n if (DTS.test(filePath)) {\n // Check for a bundle index.\n if (this.hasBundleIndex(filePath)) {\n const normalFilePath = path.normalize(filePath);\n return this.flatModuleIndexNames.has(normalFilePath) ||\n this.flatModuleIndexRedirectNames.has(normalFilePath);\n }\n }\n return true;\n }\n\n readFile(fileName: string) {\n const summary = this.librarySummaries.get(fileName);\n if (summary) {\n return summary.text;\n }\n return this.context.readFile(fileName);\n }\n\n getMetadataFor(filePath: string): ModuleMetadata[]|undefined {\n return readMetadata(filePath, this.metadataReaderHost, this.metadataReaderCache);\n }\n\n loadResource(filePath: string): Promise<string>|string {\n if (this.context.readResource) return this.context.readResource(filePath);\n if (!this.originalFileExists(filePath)) {\n throw syntaxError(`Error: Resource file not found: ${filePath}`);\n }\n return assert(this.context.readFile(filePath));\n }\n\n private hasBundleIndex(filePath: string): boolean {\n const checkBundleIndex = (directory: string): boolean => {\n let result = this.flatModuleIndexCache.get(directory);\n if (result == null) {\n if (path.basename(directory) == 'node_module') {\n // Don't look outside the node_modules this package is installed in.\n result = false;\n } else {\n // A bundle index exists if the typings .d.ts file has a metadata.json that has an\n // importAs.\n try {\n const packageFile = path.join(directory, 'package.json');\n if (this.originalFileExists(packageFile)) {\n // Once we see a package.json file, assume false until it we find the bundle index.\n result = false;\n const packageContent: any = JSON.parse(assert(this.context.readFile(packageFile)));\n if (packageContent.typings) {\n const typings = path.normalize(path.join(directory, packageContent.typings));\n if (DTS.test(typings)) {\n const metadataFile = typings.replace(DTS, '.metadata.json');\n if (this.originalFileExists(metadataFile)) {\n const metadata = JSON.parse(assert(this.context.readFile(metadataFile)));\n if (metadata.flatModuleIndexRedirect) {\n this.flatModuleIndexRedirectNames.add(typings);\n // Note: don't set result = true,\n // as this would mark this folder\n // as having a bundleIndex too early without\n // filling the bundleIndexNames.\n } else if (metadata.importAs) {\n this.flatModuleIndexNames.add(typings);\n result = true;\n }\n }\n }\n }\n } else {\n const parent = path.dirname(directory);\n if (parent != directory) {\n // Try the parent directory.\n result = checkBundleIndex(parent);\n } else {\n result = false;\n }\n }\n } catch (e) {\n // If we encounter any errors assume we this isn't a bundle index.\n result = false;\n }\n }\n this.flatModuleIndexCache.set(directory, result);\n }\n return result;\n };\n\n return checkBundleIndex(path.dirname(filePath));\n }\n\n getDefaultLibFileName = (options: ts.CompilerOptions) =>\n this.context.getDefaultLibFileName(options)\n getCurrentDirectory = () => this.context.getCurrentDirectory();\n getCanonicalFileName = (fileName: string) => this.context.getCanonicalFileName(fileName);\n useCaseSensitiveFileNames = () => this.context.useCaseSensitiveFileNames();\n getNewLine = () => this.context.getNewLine();\n // Make sure we do not `host.realpath()` from TS as we do not want to resolve symlinks.\n // https://github.com/Microsoft/TypeScript/issues/9552\n realPath = (p: string) => p;\n writeFile = this.context.writeFile.bind(this.context);\n}\n\nfunction genFileExternalReferences(genFile: GeneratedFile): Set<string> {\n return new Set(collectExternalReferences(genFile.stmts !).map(er => er.moduleName !));\n}\n\nfunction addReferencesToSourceFile(sf: ts.SourceFile, genFileNames: string[]) {\n // Note: as we modify ts.SourceFiles we need to keep the original\n // value for `referencedFiles` around in cache the original host is caching ts.SourceFiles.\n // Note: cloning the ts.SourceFile is expensive as the nodes in have parent pointers,\n // i.e. we would also need to clone and adjust all nodes.\n let originalReferencedFiles: ts.FileReference[]|undefined = (sf as any).originalReferencedFiles;\n if (!originalReferencedFiles) {\n originalReferencedFiles = sf.referencedFiles;\n (sf as any).originalReferencedFiles = originalReferencedFiles;\n }\n const newReferencedFiles = [...originalReferencedFiles];\n genFileNames.forEach(gf => newReferencedFiles.push({fileName: gf, pos: 0, end: 0}));\n sf.referencedFiles = newReferencedFiles;\n}\n\nexport function getOriginalReferences(sourceFile: ts.SourceFile): ts.FileReference[]|undefined {\n return sourceFile && (sourceFile as any).originalReferencedFiles;\n}\n\nfunction dotRelative(from: string, to: string): string {\n const rPath: string = path.relative(from, to).replace(/\\\\/g, '/');\n return rPath.startsWith('.') ? rPath : './' + rPath;\n}\n\n/**\n * Moves the path into `genDir` folder while preserving the `node_modules` directory.\n */\nfunction getPackageName(filePath: string): string|null {\n const match = NODE_MODULES_PACKAGE_NAME.exec(filePath);\n return match ? match[1] : null;\n}\n\nfunction stripNodeModulesPrefix(filePath: string): string {\n return filePath.replace(/.*node_modules\\//, '');\n}\n\nfunction getNodeModulesPrefix(filePath: string): string|null {\n const match = /.*node_modules\\//.exec(filePath);\n return match ? match[1] : null;\n}\n\nfunction stripNgResourceSuffix(fileName: string): string {\n return fileName.replace(/\\.\\$ngresource\\$.*/, '');\n}\n\nfunction addNgResourceSuffix(fileName: string): string {\n return `${fileName}.$ngresource$`;\n}\n"]}
1
+ {"version":3,"file":"compiler_host.js","sourceRoot":"","sources":["../../../../../packages/compiler-cli/src/transformers/compiler_host.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAEH,8CAAuL;AACvL,2BAA6B;AAC7B,+BAAiC;AAMjC,qDAA8F;AAC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EAAE,CAAC,eAAe,GAAG,kBAAkB,CAAC;AAC1C,CAAC;AAED,+BAAsC,UAAyB;IAC7D,MAAM,CAAC,UAAU,IAAK,UAAkB,CAAC,uBAAuB,CAAC;AACnE,CAAC;AAFD,sDAEC;AAED,qBAAqB,IAAY,EAAE,EAAU;IAC3C,IAAM,KAAK,GAAW,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAClE,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC;AACtD,CAAC;AAED;;GAEG;AACH,wBAAwB,QAAgB;IACtC,IAAM,KAAK,GAAG,yBAAyB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvD,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACjC,CAAC;AAED,gCAAgC,QAAgB;IAC9C,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;AAClD,CAAC;AAED,8BAA8B,QAAgB;IAC5C,IAAM,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACjC,CAAC;AAED,+BAA+B,QAAgB;IAC7C,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;AACpD,CAAC;AAED,6BAA6B,QAAgB;IAC3C,MAAM,CAAI,QAAQ,kBAAe,CAAC;AACpC,CAAC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {AotCompilerHost, EmitterVisitorContext, ExternalReference, GeneratedFile, ParseSourceSpan, TypeScriptEmitter, collectExternalReferences, syntaxError} from '@angular/compiler';\nimport * as path from 'path';\nimport * as ts from 'typescript';\n\nimport {TypeCheckHost} from '../diagnostics/translate_diagnostics';\nimport {METADATA_VERSION, ModuleMetadata} from '../metadata/index';\n\nimport {CompilerHost, CompilerOptions, LibrarySummary} from './api';\nimport {MetadataReaderHost, createMetadataReaderCache, readMetadata} from './metadata_reader';\nimport {DTS, GENERATED_FILES, isInRootDir, relativeToRootDirs} from './util';\n\nconst NODE_MODULES_PACKAGE_NAME = /node_modules\\/((\\w|-)+|(@(\\w|-)+\\/(\\w|-)+))/;\nconst EXT = /(\\.ts|\\.d\\.ts|\\.js|\\.jsx|\\.tsx)$/;\n\nexport function createCompilerHost(\n {options, tsHost = ts.createCompilerHost(options, true)}:\n {options: CompilerOptions, tsHost?: ts.CompilerHost}): CompilerHost {\n return tsHost;\n}\n\nexport interface MetadataProvider {\n getMetadata(sourceFile: ts.SourceFile): ModuleMetadata|undefined;\n}\n\ninterface GenSourceFile {\n externalReferences: Set<string>;\n sourceFile: ts.SourceFile;\n emitCtx: EmitterVisitorContext;\n}\n\nexport interface CodeGenerator {\n generateFile(genFileName: string, baseFileName?: string): GeneratedFile;\n findGeneratedFileNames(fileName: string): string[];\n}\n\nfunction assert<T>(condition: T | null | undefined) {\n if (!condition) {\n // TODO(chuckjaz): do the right thing\n }\n return condition !;\n}\n\n/**\n * Implements the following hosts based on an api.CompilerHost:\n * - ts.CompilerHost to be consumed by a ts.Program\n * - AotCompilerHost for @angular/compiler\n * - TypeCheckHost for mapping ts errors to ng errors (via translateDiagnostics)\n */\nexport class TsCompilerAotCompilerTypeCheckHostAdapter implements ts.CompilerHost, AotCompilerHost,\n TypeCheckHost {\n private metadataReaderCache = createMetadataReaderCache();\n private flatModuleIndexCache = new Map<string, boolean>();\n private flatModuleIndexNames = new Set<string>();\n private flatModuleIndexRedirectNames = new Set<string>();\n private rootDirs: string[];\n private moduleResolutionCache: ts.ModuleResolutionCache;\n private originalSourceFiles = new Map<string, ts.SourceFile|null>();\n private originalFileExistsCache = new Map<string, boolean>();\n private generatedSourceFiles = new Map<string, GenSourceFile>();\n private generatedCodeFor = new Map<string, string[]>();\n private emitter = new TypeScriptEmitter();\n private metadataReaderHost: MetadataReaderHost;\n\n getCancellationToken: () => ts.CancellationToken;\n getDefaultLibLocation: () => string;\n trace: (s: string) => void;\n getDirectories: (path: string) => string[];\n directoryExists?: (directoryName: string) => boolean;\n\n constructor(\n private rootFiles: ReadonlyArray<string>, private options: CompilerOptions,\n private context: CompilerHost, private metadataProvider: MetadataProvider,\n private codeGenerator: CodeGenerator,\n private librarySummaries = new Map<string, LibrarySummary>()) {\n this.moduleResolutionCache = ts.createModuleResolutionCache(\n this.context.getCurrentDirectory !(), this.context.getCanonicalFileName.bind(this.context));\n const basePath = this.options.basePath !;\n this.rootDirs =\n (this.options.rootDirs || [this.options.basePath !]).map(p => path.resolve(basePath, p));\n if (context.getDirectories) {\n this.getDirectories = path => context.getDirectories !(path);\n }\n if (context.directoryExists) {\n this.directoryExists = directoryName => context.directoryExists !(directoryName);\n }\n if (context.getCancellationToken) {\n this.getCancellationToken = () => context.getCancellationToken !();\n }\n if (context.getDefaultLibLocation) {\n this.getDefaultLibLocation = () => context.getDefaultLibLocation !();\n }\n if (context.trace) {\n this.trace = s => context.trace !(s);\n }\n if (context.fileNameToModuleName) {\n this.fileNameToModuleName = context.fileNameToModuleName.bind(context);\n }\n // Note: don't copy over context.moduleNameToFileName as we first\n // normalize undefined containingFile to a filled containingFile.\n if (context.resourceNameToFileName) {\n this.resourceNameToFileName = context.resourceNameToFileName.bind(context);\n }\n if (context.toSummaryFileName) {\n this.toSummaryFileName = context.toSummaryFileName.bind(context);\n }\n if (context.fromSummaryFileName) {\n this.fromSummaryFileName = context.fromSummaryFileName.bind(context);\n }\n this.metadataReaderHost = {\n cacheMetadata: () => true,\n getSourceFileMetadata: (filePath) => {\n const sf = this.getOriginalSourceFile(filePath);\n return sf ? this.metadataProvider.getMetadata(sf) : undefined;\n },\n fileExists: (filePath) => this.originalFileExists(filePath),\n readFile: (filePath) => assert(this.context.readFile(filePath)),\n };\n }\n\n private resolveModuleName(moduleName: string, containingFile: string): ts.ResolvedModule\n |undefined {\n const rm = ts.resolveModuleName(\n moduleName, containingFile.replace(/\\\\/g, '/'), this.options, this,\n this.moduleResolutionCache)\n .resolvedModule;\n if (rm && this.isSourceFile(rm.resolvedFileName) && DTS.test(rm.resolvedFileName)) {\n // Case: generateCodeForLibraries = true and moduleName is\n // a .d.ts file in a node_modules folder.\n // Need to set isExternalLibraryImport to false so that generated files for that file\n // are emitted.\n rm.isExternalLibraryImport = false;\n }\n return rm;\n }\n\n // Note: We implement this method so that TypeScript and Angular share the same\n // ts.ModuleResolutionCache\n // and that we can tell ts.Program about our different opinion about\n // ResolvedModule.isExternalLibraryImport\n // (see our isSourceFile method).\n resolveModuleNames(moduleNames: string[], containingFile: string): ts.ResolvedModule[] {\n // TODO(tbosch): this seems to be a typing error in TypeScript,\n // as it contains assertions that the result contains the same number of entries\n // as the given module names.\n return <ts.ResolvedModule[]>moduleNames.map(\n moduleName => this.resolveModuleName(moduleName, containingFile));\n }\n\n moduleNameToFileName(m: string, containingFile?: string): string|null {\n if (!containingFile) {\n if (m.indexOf('.') === 0) {\n throw new Error('Resolution of relative paths requires a containing file.');\n }\n // Any containing file gives the same result for absolute imports\n containingFile = this.rootFiles[0];\n }\n if (this.context.moduleNameToFileName) {\n return this.context.moduleNameToFileName(m, containingFile);\n }\n const resolved = this.resolveModuleName(m, containingFile);\n return resolved ? resolved.resolvedFileName : null;\n }\n\n /**\n * We want a moduleId that will appear in import statements in the generated code\n * which will be written to `containingFile`.\n *\n * Note that we also generate files for files in node_modules, as libraries\n * only ship .metadata.json files but not the generated code.\n *\n * Logic:\n * 1. if the importedFile and the containingFile are from the project sources\n * or from the same node_modules package, use a relative path\n * 2. if the importedFile is in a node_modules package,\n * use a path that starts with the package name.\n * 3. Error if the containingFile is in the node_modules package\n * and the importedFile is in the project soures,\n * as that is a violation of the principle that node_modules packages cannot\n * import project sources.\n */\n fileNameToModuleName(importedFile: string, containingFile: string): string {\n const originalImportedFile = importedFile;\n if (this.options.traceResolution) {\n console.error(\n 'fileNameToModuleName from containingFile', containingFile, 'to importedFile',\n importedFile);\n }\n\n // drop extension\n importedFile = importedFile.replace(EXT, '');\n const importedFilePackagName = getPackageName(importedFile);\n const containingFilePackageName = getPackageName(containingFile);\n\n let moduleName: string;\n if (importedFilePackagName === containingFilePackageName ||\n GENERATED_FILES.test(originalImportedFile)) {\n const rootedContainingFile = relativeToRootDirs(containingFile, this.rootDirs);\n const rootedImportedFile = relativeToRootDirs(importedFile, this.rootDirs);\n\n if (rootedContainingFile !== containingFile && rootedImportedFile !== importedFile) {\n // if both files are contained in the `rootDirs`, then strip the rootDirs\n containingFile = rootedContainingFile;\n importedFile = rootedImportedFile;\n }\n moduleName = dotRelative(path.dirname(containingFile), importedFile);\n } else if (importedFilePackagName) {\n moduleName = stripNodeModulesPrefix(importedFile);\n } else {\n throw new Error(\n `Trying to import a source file from a node_modules package: import ${originalImportedFile} from ${containingFile}`);\n }\n return moduleName;\n }\n\n resourceNameToFileName(resourceName: string, containingFile: string): string|null {\n // Note: we convert package paths into relative paths to be compatible with the the\n // previous implementation of UrlResolver.\n const firstChar = resourceName[0];\n if (firstChar === '/') {\n resourceName = resourceName.slice(1);\n } else if (firstChar !== '.') {\n resourceName = `./${resourceName}`;\n }\n const filePathWithNgResource =\n this.moduleNameToFileName(addNgResourceSuffix(resourceName), containingFile);\n return filePathWithNgResource ? stripNgResourceSuffix(filePathWithNgResource) : null;\n }\n\n toSummaryFileName(fileName: string, referringSrcFileName: string): string {\n return this.fileNameToModuleName(fileName, referringSrcFileName);\n }\n\n fromSummaryFileName(fileName: string, referringLibFileName: string): string {\n const resolved = this.moduleNameToFileName(fileName, referringLibFileName);\n if (!resolved) {\n throw new Error(`Could not resolve ${fileName} from ${referringLibFileName}`);\n }\n return resolved;\n }\n\n parseSourceSpanOf(fileName: string, line: number, character: number): ParseSourceSpan|null {\n const data = this.generatedSourceFiles.get(fileName);\n if (data && data.emitCtx) {\n return data.emitCtx.spanOf(line, character);\n }\n return null;\n }\n\n private getOriginalSourceFile(\n filePath: string, languageVersion?: ts.ScriptTarget,\n onError?: ((message: string) => void)|undefined): ts.SourceFile|null {\n // Note: we need the explicit check via `has` as we also cache results\n // that were null / undefined.\n if (this.originalSourceFiles.has(filePath)) {\n return this.originalSourceFiles.get(filePath) !;\n }\n if (!languageVersion) {\n languageVersion = this.options.target || ts.ScriptTarget.Latest;\n }\n // Note: This can also return undefined,\n // as the TS typings are not correct!\n const sf = this.context.getSourceFile(filePath, languageVersion, onError) || null;\n this.originalSourceFiles.set(filePath, sf);\n return sf;\n }\n\n updateGeneratedFile(genFile: GeneratedFile): ts.SourceFile {\n if (!genFile.stmts) {\n throw new Error(\n `Invalid Argument: Expected a GenerateFile with statements. ${genFile.genFileUrl}`);\n }\n const oldGenFile = this.generatedSourceFiles.get(genFile.genFileUrl);\n if (!oldGenFile) {\n throw new Error(`Illegal State: previous GeneratedFile not found for ${genFile.genFileUrl}.`);\n }\n const newRefs = genFileExternalReferences(genFile);\n const oldRefs = oldGenFile.externalReferences;\n let refsAreEqual = oldRefs.size === newRefs.size;\n if (refsAreEqual) {\n newRefs.forEach(r => refsAreEqual = refsAreEqual && oldRefs.has(r));\n }\n if (!refsAreEqual) {\n throw new Error(\n `Illegal State: external references changed in ${genFile.genFileUrl}.\\nOld: ${Array.from(oldRefs)}.\\nNew: ${Array.from(newRefs)}`);\n }\n return this.addGeneratedFile(genFile, newRefs);\n }\n\n private addGeneratedFile(genFile: GeneratedFile, externalReferences: Set<string>): ts.SourceFile {\n if (!genFile.stmts) {\n throw new Error(\n `Invalid Argument: Expected a GenerateFile with statements. ${genFile.genFileUrl}`);\n }\n const {sourceText, context} = this.emitter.emitStatementsAndContext(\n genFile.genFileUrl, genFile.stmts, /* preamble */ '',\n /* emitSourceMaps */ false);\n const sf = ts.createSourceFile(\n genFile.genFileUrl, sourceText, this.options.target || ts.ScriptTarget.Latest);\n if ((this.options.module === ts.ModuleKind.AMD || this.options.module === ts.ModuleKind.UMD) &&\n this.context.amdModuleName) {\n const moduleName = this.context.amdModuleName(sf);\n if (moduleName) sf.moduleName = moduleName;\n }\n this.generatedSourceFiles.set(genFile.genFileUrl, {\n sourceFile: sf,\n emitCtx: context, externalReferences,\n });\n return sf;\n }\n\n shouldGenerateFile(fileName: string): {generate: boolean, baseFileName?: string} {\n // TODO(tbosch): allow generating files that are not in the rootDir\n // See https://github.com/angular/angular/issues/19337\n if (!isInRootDir(fileName, this.options)) {\n return {generate: false};\n }\n const genMatch = GENERATED_FILES.exec(fileName);\n if (!genMatch) {\n return {generate: false};\n }\n const [, base, genSuffix, suffix] = genMatch;\n if (suffix !== 'ts' && suffix !== 'tsx') {\n return {generate: false};\n }\n let baseFileName: string|undefined;\n if (genSuffix.indexOf('ngstyle') >= 0) {\n // Note: ngstyle files have names like `afile.css.ngstyle.ts`\n if (!this.originalFileExists(base)) {\n return {generate: false};\n }\n } else {\n // Note: on-the-fly generated files always have a `.ts` suffix,\n // but the file from which we generated it can be a `.ts`/ `.tsx`/ `.d.ts`\n // (see options.generateCodeForLibraries).\n baseFileName = [`${base}.ts`, `${base}.tsx`, `${base}.d.ts`].find(\n baseFileName => this.isSourceFile(baseFileName) && this.originalFileExists(baseFileName));\n if (!baseFileName) {\n return {generate: false};\n }\n }\n return {generate: true, baseFileName};\n }\n\n shouldGenerateFilesFor(fileName: string) {\n // TODO(tbosch): allow generating files that are not in the rootDir\n // See https://github.com/angular/angular/issues/19337\n return !GENERATED_FILES.test(fileName) && this.isSourceFile(fileName) &&\n isInRootDir(fileName, this.options);\n }\n\n getSourceFile(\n fileName: string, languageVersion: ts.ScriptTarget,\n onError?: ((message: string) => void)|undefined): ts.SourceFile {\n // Note: Don't exit early in this method to make sure\n // we always have up to date references on the file!\n let genFileNames: string[] = [];\n let sf = this.getGeneratedFile(fileName);\n if (!sf) {\n const summary = this.librarySummaries.get(fileName);\n if (summary) {\n if (!summary.sourceFile) {\n summary.sourceFile = ts.createSourceFile(\n fileName, summary.text, this.options.target || ts.ScriptTarget.Latest);\n }\n sf = summary.sourceFile;\n genFileNames = [];\n }\n }\n if (!sf) {\n sf = this.getOriginalSourceFile(fileName);\n const cachedGenFiles = this.generatedCodeFor.get(fileName);\n if (cachedGenFiles) {\n genFileNames = cachedGenFiles;\n } else {\n if (!this.options.noResolve && this.shouldGenerateFilesFor(fileName)) {\n genFileNames = this.codeGenerator.findGeneratedFileNames(fileName).filter(\n fileName => this.shouldGenerateFile(fileName).generate);\n }\n this.generatedCodeFor.set(fileName, genFileNames);\n }\n }\n if (sf) {\n addReferencesToSourceFile(sf, genFileNames);\n }\n // TODO(tbosch): TypeScript's typings for getSourceFile are incorrect,\n // as it can very well return undefined.\n return sf !;\n }\n\n private getGeneratedFile(fileName: string): ts.SourceFile|null {\n const genSrcFile = this.generatedSourceFiles.get(fileName);\n if (genSrcFile) {\n return genSrcFile.sourceFile;\n }\n const {generate, baseFileName} = this.shouldGenerateFile(fileName);\n if (generate) {\n const genFile = this.codeGenerator.generateFile(fileName, baseFileName);\n return this.addGeneratedFile(genFile, genFileExternalReferences(genFile));\n }\n return null;\n }\n\n private originalFileExists(fileName: string): boolean {\n let fileExists = this.originalFileExistsCache.get(fileName);\n if (fileExists == null) {\n fileExists = this.context.fileExists(fileName);\n this.originalFileExistsCache.set(fileName, fileExists);\n }\n return fileExists;\n }\n\n fileExists(fileName: string): boolean {\n fileName = stripNgResourceSuffix(fileName);\n if (this.librarySummaries.has(fileName) || this.generatedSourceFiles.has(fileName)) {\n return true;\n }\n if (this.shouldGenerateFile(fileName).generate) {\n return true;\n }\n return this.originalFileExists(fileName);\n }\n\n loadSummary(filePath: string): string|null {\n const summary = this.librarySummaries.get(filePath);\n if (summary) {\n return summary.text;\n }\n if (this.originalFileExists(filePath)) {\n return assert(this.context.readFile(filePath));\n }\n return null;\n }\n\n isSourceFile(filePath: string): boolean {\n // Don't generate any files nor typecheck them\n // if skipTemplateCodegen is set and fullTemplateTypeCheck is not yet set,\n // for backwards compatibility.\n if (this.options.skipTemplateCodegen && !this.options.fullTemplateTypeCheck) {\n return false;\n }\n // If we have a summary from a previous compilation,\n // treat the file never as a source file.\n if (this.librarySummaries.has(filePath)) {\n return false;\n }\n if (GENERATED_FILES.test(filePath)) {\n return false;\n }\n if (this.options.generateCodeForLibraries === false && DTS.test(filePath)) {\n return false;\n }\n if (DTS.test(filePath)) {\n // Check for a bundle index.\n if (this.hasBundleIndex(filePath)) {\n const normalFilePath = path.normalize(filePath);\n return this.flatModuleIndexNames.has(normalFilePath) ||\n this.flatModuleIndexRedirectNames.has(normalFilePath);\n }\n }\n return true;\n }\n\n readFile(fileName: string) {\n const summary = this.librarySummaries.get(fileName);\n if (summary) {\n return summary.text;\n }\n return this.context.readFile(fileName);\n }\n\n getMetadataFor(filePath: string): ModuleMetadata[]|undefined {\n return readMetadata(filePath, this.metadataReaderHost, this.metadataReaderCache);\n }\n\n loadResource(filePath: string): Promise<string>|string {\n if (this.context.readResource) return this.context.readResource(filePath);\n if (!this.originalFileExists(filePath)) {\n throw syntaxError(`Error: Resource file not found: ${filePath}`);\n }\n return assert(this.context.readFile(filePath));\n }\n\n private hasBundleIndex(filePath: string): boolean {\n const checkBundleIndex = (directory: string): boolean => {\n let result = this.flatModuleIndexCache.get(directory);\n if (result == null) {\n if (path.basename(directory) == 'node_module') {\n // Don't look outside the node_modules this package is installed in.\n result = false;\n } else {\n // A bundle index exists if the typings .d.ts file has a metadata.json that has an\n // importAs.\n try {\n const packageFile = path.join(directory, 'package.json');\n if (this.originalFileExists(packageFile)) {\n // Once we see a package.json file, assume false until it we find the bundle index.\n result = false;\n const packageContent: any = JSON.parse(assert(this.context.readFile(packageFile)));\n if (packageContent.typings) {\n const typings = path.normalize(path.join(directory, packageContent.typings));\n if (DTS.test(typings)) {\n const metadataFile = typings.replace(DTS, '.metadata.json');\n if (this.originalFileExists(metadataFile)) {\n const metadata = JSON.parse(assert(this.context.readFile(metadataFile)));\n if (metadata.flatModuleIndexRedirect) {\n this.flatModuleIndexRedirectNames.add(typings);\n // Note: don't set result = true,\n // as this would mark this folder\n // as having a bundleIndex too early without\n // filling the bundleIndexNames.\n } else if (metadata.importAs) {\n this.flatModuleIndexNames.add(typings);\n result = true;\n }\n }\n }\n }\n } else {\n const parent = path.dirname(directory);\n if (parent != directory) {\n // Try the parent directory.\n result = checkBundleIndex(parent);\n } else {\n result = false;\n }\n }\n } catch (e) {\n // If we encounter any errors assume we this isn't a bundle index.\n result = false;\n }\n }\n this.flatModuleIndexCache.set(directory, result);\n }\n return result;\n };\n\n return checkBundleIndex(path.dirname(filePath));\n }\n\n getDefaultLibFileName = (options: ts.CompilerOptions) =>\n this.context.getDefaultLibFileName(options)\n getCurrentDirectory = () => this.context.getCurrentDirectory();\n getCanonicalFileName = (fileName: string) => this.context.getCanonicalFileName(fileName);\n useCaseSensitiveFileNames = () => this.context.useCaseSensitiveFileNames();\n getNewLine = () => this.context.getNewLine();\n // Make sure we do not `host.realpath()` from TS as we do not want to resolve symlinks.\n // https://github.com/Microsoft/TypeScript/issues/9552\n realPath = (p: string) => p;\n writeFile = this.context.writeFile.bind(this.context);\n}\n\nfunction genFileExternalReferences(genFile: GeneratedFile): Set<string> {\n return new Set(collectExternalReferences(genFile.stmts !).map(er => er.moduleName !));\n}\n\nfunction addReferencesToSourceFile(sf: ts.SourceFile, genFileNames: string[]) {\n // Note: as we modify ts.SourceFiles we need to keep the original\n // value for `referencedFiles` around in cache the original host is caching ts.SourceFiles.\n // Note: cloning the ts.SourceFile is expensive as the nodes in have parent pointers,\n // i.e. we would also need to clone and adjust all nodes.\n let originalReferencedFiles: ReadonlyArray<ts.FileReference> =\n (sf as any).originalReferencedFiles;\n if (!originalReferencedFiles) {\n originalReferencedFiles = sf.referencedFiles;\n (sf as any).originalReferencedFiles = originalReferencedFiles;\n }\n const newReferencedFiles = [...originalReferencedFiles];\n genFileNames.forEach(gf => newReferencedFiles.push({fileName: gf, pos: 0, end: 0}));\n sf.referencedFiles = newReferencedFiles;\n}\n\nexport function getOriginalReferences(sourceFile: ts.SourceFile): ts.FileReference[]|undefined {\n return sourceFile && (sourceFile as any).originalReferencedFiles;\n}\n\nfunction dotRelative(from: string, to: string): string {\n const rPath: string = path.relative(from, to).replace(/\\\\/g, '/');\n return rPath.startsWith('.') ? rPath : './' + rPath;\n}\n\n/**\n * Moves the path into `genDir` folder while preserving the `node_modules` directory.\n */\nfunction getPackageName(filePath: string): string|null {\n const match = NODE_MODULES_PACKAGE_NAME.exec(filePath);\n return match ? match[1] : null;\n}\n\nfunction stripNodeModulesPrefix(filePath: string): string {\n return filePath.replace(/.*node_modules\\//, '');\n}\n\nfunction getNodeModulesPrefix(filePath: string): string|null {\n const match = /.*node_modules\\//.exec(filePath);\n return match ? match[1] : null;\n}\n\nfunction stripNgResourceSuffix(fileName: string): string {\n return fileName.replace(/\\.\\$ngresource\\$.*/, '');\n}\n\nfunction addNgResourceSuffix(fileName: string): string {\n return `${fileName}.$ngresource$`;\n}\n"]}