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AAI,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAC/C,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;gBACT,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,gBAAgB,CACxB,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI,uBAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC;YAC3F,CAAC;YACD,MAAM,CAAC,eAAe,CAAC,aAAa,CAAC,QAAQ,CAAC;gBAC1C,YAAY,CAAC,aAAa,CAAC,QAAQ,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;QACrE,CAAC;QACD,0BAAQ,GAAR,UAAS,QAAgB;YACvB,IAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAC/C,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;gBACT,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI,uBAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC/C,CAAC;YACD,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACzC,CAAC;QAWH,cAAC;IAAD,CAAC,AAzDU,GAyDV,CAAC;AACJ,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 {AotCompiler, GeneratedFile, NgAnalyzedModules, createAotCompiler, getParseErrors, isSyntaxError, toTypeScript} from '@angular/compiler';\nimport {MetadataCollector, ModuleMetadata} from '@angular/tsc-wrapped';\nimport {writeFileSync} from 'fs';\nimport * as path from 'path';\nimport * as ts from 'typescript';\n\nimport {CompilerHost as AotCompilerHost, CompilerHostContext} from '../compiler_host';\nimport {TypeChecker} from '../diagnostics/check_types';\n\nimport {CompilerHost, CompilerOptions, Diagnostic, DiagnosticCategory, EmitFlags, Program} from './api';\nimport {getAngularEmitterTransformFactory} from './node_emitter_transform';\n\nconst GENERATED_FILES = /\\.ngfactory\\.js$|\\.ngstyle\\.js$|\\.ngsummary\\.js$/;\nconst SUMMARY_JSON_FILES = /\\.ngsummary.json$/;\n\nconst emptyModules: NgAnalyzedModules = {\n ngModules: [],\n ngModuleByPipeOrDirective: new Map(),\n files: []\n};\n\nclass AngularCompilerProgram implements Program {\n // Initialized in the constructor\n private oldTsProgram: ts.Program|undefined;\n private tsProgram: ts.Program;\n private aotCompilerHost: AotCompilerHost;\n private compiler: AotCompiler;\n private srcNames: string[];\n private collector: MetadataCollector;\n // Lazily initialized fields\n private _analyzedModules: NgAnalyzedModules|undefined;\n private _structuralDiagnostics: Diagnostic[] = [];\n private _stubs: GeneratedFile[]|undefined;\n private _stubFiles: string[]|undefined;\n private _programWithStubsHost: ts.CompilerHost|undefined;\n private _programWithStubs: ts.Program|undefined;\n private _generatedFiles: GeneratedFile[]|undefined;\n private _generatedFileDiagnostics: Diagnostic[]|undefined;\n private _typeChecker: TypeChecker|undefined;\n private _semanticDiagnostics: Diagnostic[]|undefined;\n\n constructor(\n private rootNames: string[], private options: CompilerOptions, private host: CompilerHost,\n private oldProgram?: Program) {\n this.oldTsProgram = oldProgram ? oldProgram.getTsProgram() : undefined;\n\n this.tsProgram = ts.createProgram(rootNames, options, host, this.oldTsProgram);\n this.srcNames = this.tsProgram.getSourceFiles().map(sf => sf.fileName);\n this.aotCompilerHost = new AotCompilerHost(this.tsProgram, options, host);\n if (host.readResource) {\n this.aotCompilerHost.loadResource = host.readResource.bind(host);\n }\n const {compiler} = createAotCompiler(this.aotCompilerHost, options);\n this.compiler = compiler;\n this.collector = new MetadataCollector({quotedNames: true});\n }\n\n // Program implementation\n getTsProgram(): ts.Program { return this.programWithStubs; }\n\n getTsOptionDiagnostics(cancellationToken?: ts.CancellationToken) {\n return this.tsProgram.getOptionsDiagnostics(cancellationToken);\n }\n\n getNgOptionDiagnostics(cancellationToken?: ts.CancellationToken): Diagnostic[] {\n return getNgOptionDiagnostics(this.options);\n }\n\n getTsSyntacticDiagnostics(sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken):\n ts.Diagnostic[] {\n return this.tsProgram.getSyntacticDiagnostics(sourceFile, cancellationToken);\n }\n\n getNgStructuralDiagnostics(cancellationToken?: ts.CancellationToken): Diagnostic[] {\n return this.structuralDiagnostics;\n }\n\n getTsSemanticDiagnostics(sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken):\n ts.Diagnostic[] {\n return this.programWithStubs.getSemanticDiagnostics(sourceFile, cancellationToken);\n }\n\n getNgSemanticDiagnostics(fileName?: string, cancellationToken?: ts.CancellationToken):\n Diagnostic[] {\n const compilerDiagnostics = this.generatedFileDiagnostics;\n\n // If we have diagnostics during the parser phase the type check phase is not meaningful so skip\n // it.\n if (compilerDiagnostics && compilerDiagnostics.length) return compilerDiagnostics;\n\n return this.typeChecker.getDiagnostics(fileName, cancellationToken);\n }\n\n loadNgStructureAsync(): Promise<void> {\n return this.compiler.analyzeModulesAsync(this.rootNames)\n .catch(this.catchAnalysisError.bind(this))\n .then(analyzedModules => {\n if (this._analyzedModules) {\n throw new Error('Angular structure loaded both synchronously and asynchronsly');\n }\n this._analyzedModules = analyzedModules;\n });\n }\n\n getLazyRoutes(cancellationToken?: ts.CancellationToken): {[route: string]: string} { return {}; }\n\n emit({emitFlags = EmitFlags.Default, cancellationToken}:\n {emitFlags?: EmitFlags, cancellationToken?: ts.CancellationToken}): ts.EmitResult {\n const emitMap = new Map<string, string>();\n const result = this.programWithStubs.emit(\n /* targetSourceFile */ undefined,\n createWriteFileCallback(emitFlags, this.host, this.collector, this.options, emitMap),\n cancellationToken, (emitFlags & (EmitFlags.DTS | EmitFlags.JS)) == EmitFlags.DTS, {\n after: this.options.skipTemplateCodegen ? [] : [getAngularEmitterTransformFactory(\n this.generatedFiles)]\n });\n\n this.generatedFiles.forEach(file => {\n if (file.source && file.source.length && SUMMARY_JSON_FILES.test(file.genFileUrl)) {\n // If we have emitted the ngsummary.ts file, ensure the ngsummary.json file is emitted to\n // the same location.\n const emittedFile = emitMap.get(file.srcFileUrl);\n const fileName = emittedFile ?\n path.join(path.dirname(emittedFile), path.basename(file.genFileUrl)) :\n file.genFileUrl;\n this.host.writeFile(fileName, file.source, false, error => {});\n }\n });\n return result;\n }\n\n // Private members\n private get analyzedModules(): NgAnalyzedModules {\n return this._analyzedModules || (this._analyzedModules = this.analyzeModules());\n }\n\n private get structuralDiagnostics(): Diagnostic[] {\n return this.analyzedModules && this._structuralDiagnostics;\n }\n\n private get stubs(): GeneratedFile[] {\n return this._stubs || (this._stubs = this.generateStubs());\n }\n\n private get stubFiles(): string[] {\n return this._stubFiles ||\n (this._stubFiles = this.stubs.reduce((files: string[], generatedFile) => {\n if (generatedFile.source || (generatedFile.stmts && generatedFile.stmts.length)) {\n return [...files, generatedFile.genFileUrl];\n }\n return files;\n }, []));\n }\n\n private get programWithStubsHost(): ts.CompilerHost {\n return this._programWithStubsHost || (this._programWithStubsHost = createProgramWithStubsHost(\n this.stubs, this.tsProgram, this.host));\n }\n\n private get programWithStubs(): ts.Program {\n return this._programWithStubs || (this._programWithStubs = this.createProgramWithStubs());\n }\n\n private get generatedFiles(): GeneratedFile[] {\n return this._generatedFiles || (this._generatedFiles = this.generateFiles());\n }\n\n private get typeChecker(): TypeChecker {\n return (this._typeChecker && !this._typeChecker.partialResults) ?\n this._typeChecker :\n (this._typeChecker = this.createTypeChecker());\n }\n\n private get generatedFileDiagnostics(): Diagnostic[]|undefined {\n return this.generatedFiles && this._generatedFileDiagnostics !;\n }\n\n private catchAnalysisError(e: any): NgAnalyzedModules {\n if (isSyntaxError(e)) {\n const parserErrors = getParseErrors(e);\n if (parserErrors && parserErrors.length) {\n this._structuralDiagnostics =\n parserErrors.map<Diagnostic>(e => ({\n message: e.contextualMessage(),\n category: DiagnosticCategory.Error,\n span: e.span\n }));\n } else {\n this._structuralDiagnostics = [{message: e.message, category: DiagnosticCategory.Error}];\n }\n this._analyzedModules = emptyModules;\n return emptyModules;\n }\n throw e;\n }\n\n private analyzeModules() {\n try {\n return this.compiler.analyzeModulesSync(this.srcNames);\n } catch (e) {\n return this.catchAnalysisError(e);\n }\n }\n\n private generateStubs() {\n return this.options.skipTemplateCodegen ? [] :\n this.options.generateCodeForLibraries === false ?\n this.compiler.emitAllStubs(this.analyzedModules) :\n this.compiler.emitPartialStubs(this.analyzedModules);\n }\n\n private generateFiles() {\n try {\n // Always generate the files if requested to ensure we capture any diagnostic errors but only\n // keep the results if we are not skipping template code generation.\n const result = this.compiler.emitAllImpls(this.analyzedModules);\n return this.options.skipTemplateCodegen ? [] : result;\n } catch (e) {\n if (isSyntaxError(e)) {\n this._generatedFileDiagnostics = [{message: e.message, category: DiagnosticCategory.Error}];\n return [];\n }\n throw e;\n }\n }\n\n private createTypeChecker(): TypeChecker {\n return new TypeChecker(\n this.tsProgram, this.options, this.host, this.aotCompilerHost, this.options,\n this.analyzedModules, this.generatedFiles);\n }\n\n private createProgramWithStubs(): ts.Program {\n // If we are skipping code generation just use the original program.\n // Otherwise, create a new program that includes the stub files.\n return this.options.skipTemplateCodegen ?\n this.tsProgram :\n ts.createProgram(\n [...this.rootNames, ...this.stubFiles], this.options, this.programWithStubsHost);\n }\n}\n\nexport function createProgram(\n {rootNames, options, host, oldProgram}:\n {rootNames: string[], options: CompilerOptions, host: CompilerHost, oldProgram?: Program}):\n Program {\n return new AngularCompilerProgram(rootNames, options, host, oldProgram);\n}\n\nfunction writeMetadata(\n emitFilePath: string, sourceFile: ts.SourceFile, collector: MetadataCollector,\n ngOptions: CompilerOptions) {\n if (/\\.js$/.test(emitFilePath)) {\n const path = emitFilePath.replace(/\\.js$/, '.metadata.json');\n\n // Beginning with 2.1, TypeScript transforms the source tree before emitting it.\n // We need the original, unmodified, tree which might be several levels back\n // depending on the number of transforms performed. All SourceFile's prior to 2.1\n // will appear to be the original source since they didn't include an original field.\n let collectableFile = sourceFile;\n while ((collectableFile as any).original) {\n collectableFile = (collectableFile as any).original;\n }\n\n const metadata = collector.getMetadata(collectableFile, !!ngOptions.strictMetadataEmit);\n if (metadata) {\n const metadataText = JSON.stringify([metadata]);\n writeFileSync(path, metadataText, {encoding: 'utf-8'});\n }\n }\n}\n\nfunction createWriteFileCallback(\n emitFlags: EmitFlags, host: ts.CompilerHost, collector: MetadataCollector,\n ngOptions: CompilerOptions, emitMap: Map<string, string>) {\n const withMetadata =\n (fileName: string, data: string, writeByteOrderMark: boolean,\n onError?: (message: string) => void, sourceFiles?: ts.SourceFile[]) => {\n const generatedFile = GENERATED_FILES.test(fileName);\n if (!generatedFile || data != '') {\n host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles);\n }\n if (!generatedFile && sourceFiles && sourceFiles.length == 1) {\n emitMap.set(sourceFiles[0].fileName, fileName);\n writeMetadata(fileName, sourceFiles[0], collector, ngOptions);\n }\n };\n const withoutMetadata =\n (fileName: string, data: string, writeByteOrderMark: boolean,\n onError?: (message: string) => void, sourceFiles?: ts.SourceFile[]) => {\n const generatedFile = GENERATED_FILES.test(fileName);\n if (!generatedFile || data != '') {\n host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles);\n }\n if (!generatedFile && sourceFiles && sourceFiles.length == 1) {\n emitMap.set(sourceFiles[0].fileName, fileName);\n }\n };\n return (emitFlags & EmitFlags.Metadata) != 0 ? withMetadata : withoutMetadata;\n}\n\nfunction getNgOptionDiagnostics(options: CompilerOptions): Diagnostic[] {\n if (options.annotationsAs) {\n switch (options.annotationsAs) {\n case 'decorators':\n case 'static fields':\n break;\n default:\n return [{\n message:\n 'Angular compiler options \"annotationsAs\" only supports \"static fields\" and \"decorators\"',\n category: DiagnosticCategory.Error\n }];\n }\n }\n return [];\n}\n\nfunction createProgramWithStubsHost(\n generatedFiles: GeneratedFile[], originalProgram: ts.Program,\n originalHost: ts.CompilerHost): ts.CompilerHost {\n interface FileData {\n g: GeneratedFile;\n s?: ts.SourceFile;\n }\n return new class implements ts.CompilerHost {\n private generatedFiles: Map<string, FileData>;\n writeFile: ts.WriteFileCallback;\n getCancellationToken: () => ts.CancellationToken;\n getDefaultLibLocation: () => string;\n trace: (s: string) => void;\n getDirectories: (path: string) => string[];\n directoryExists: (directoryName: string) => boolean;\n constructor() {\n this.generatedFiles =\n new Map(generatedFiles.filter(g => g.source || (g.stmts && g.stmts.length))\n .map<[string, FileData]>(g => [g.genFileUrl, {g}]));\n this.writeFile = originalHost.writeFile;\n if (originalHost.getDirectories) {\n this.getDirectories = path => originalHost.getDirectories !(path);\n }\n if (originalHost.directoryExists) {\n this.directoryExists = directoryName => originalHost.directoryExists !(directoryName);\n }\n if (originalHost.getCancellationToken) {\n this.getCancellationToken = () => originalHost.getCancellationToken !();\n }\n if (originalHost.getDefaultLibLocation) {\n this.getDefaultLibLocation = () => originalHost.getDefaultLibLocation !();\n }\n if (originalHost.trace) {\n this.trace = s => originalHost.trace !(s);\n }\n }\n getSourceFile(\n fileName: string, languageVersion: ts.ScriptTarget,\n onError?: ((message: string) => void)|undefined): ts.SourceFile {\n const data = this.generatedFiles.get(fileName);\n if (data) {\n return data.s || (data.s = ts.createSourceFile(\n fileName, data.g.source || toTypeScript(data.g), languageVersion));\n }\n return originalProgram.getSourceFile(fileName) ||\n originalHost.getSourceFile(fileName, languageVersion, onError);\n }\n readFile(fileName: string): string {\n const data = this.generatedFiles.get(fileName);\n if (data) {\n return data.g.source || toTypeScript(data.g);\n }\n return originalHost.readFile(fileName);\n }\n\n getDefaultLibFileName = (options: ts.CompilerOptions) =>\n originalHost.getDefaultLibFileName(options)\n getCurrentDirectory = () => originalHost.getCurrentDirectory();\n getCanonicalFileName = (fileName: string) => originalHost.getCanonicalFileName(fileName);\n useCaseSensitiveFileNames = () => originalHost.useCaseSensitiveFileNames();\n getNewLine = () => originalHost.getNewLine();\n realPath = (p: string) => p;\n fileExists = (fileName: string) =>\n this.generatedFiles.has(fileName) || originalHost.fileExists(fileName)\n };\n}\n"]}
|