UNPKG

15.2 kBSource Map (JSON)View Raw
1{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../../../tools/@angular/tsc-wrapped/src/main.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAEH,uBAAyB;AACzB,2BAA6B;AAC7B,iCAAmC;AACnC,+BAAiC;AAEjC,qCAA+D;AAC/D,6CAAyC;AACzC,iDAAuE;AACvE,+CAAqD;AAErD,6BAAiC;AACjC,2CAAoD;AAEpD,6BAAgC;AAAxB,0BAAA,SAAS,CAAA;AAEjB,IAAM,GAAG,GAAG,UAAU,CAAC;AACvB,IAAM,MAAM,GAAG,UAAU,CAAC;AAC1B,IAAM,MAAM,GAAG,OAAO,CAAC;AAUvB,+BACI,SAAoB,EAAE,SAAmB,EACzC,IAAqB;IACvB,IAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAZ,CAAY,CAAC,CAAC;IAClD,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC;QACtB,MAAM,CAAC;YACL,IAAI,MAAA;YACJ,MAAM,EAAE,CAAC;oBACP,IAAI,EAAE,IAAI;oBACV,KAAK,EAAE,IAAI;oBACX,MAAM,EAAE,IAAI;oBACZ,WAAW,EACP,oGAAoG;oBACxG,QAAQ,EAAE,EAAE,CAAC,kBAAkB,CAAC,KAAK;oBACrC,IAAI,EAAE,CAAC;iBACR,CAAC;SACH,CAAC;IACJ,CAAC;IACD,IAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACtB,IAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC9C,IAAM,OAAO,GACT,IAAI,yBAAe,CAAC,WAAW,EAAE,SAAS,CAAC,YAAY,EAAE,IAAI,6BAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5F,IAAM,c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oBAAO,EAAE,kBAAM,CAAuC;IAC3D,WAAK,CAAC,MAAM,CAAC,CAAC;IACd,IAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,GAAG,CAAC;IACvC,mFAAmF;IACnF,IAAM,UAAU,GAAG,IAAI,wBAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,MAAI,CAAC,CAAC,CAAC;IAC7D,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,CAAC;SACnC,IAAI,CAAC,UAAC,QAAa,IAAK,OAAA,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAtB,CAAsB,CAAC;SAC/C,KAAK,CAAC,UAAC,CAAM;QACZ,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACvB,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACT,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 * as fs from 'fs';\nimport * as path from 'path';\nimport * as tsickle from 'tsickle';\nimport * as ts from 'typescript';\n\nimport {CompilerHostAdapter, MetadataBundler} from './bundler';\nimport {CliOptions} from './cli_options';\nimport {MetadataWriterHost, SyntheticIndexHost} from './compiler_host';\nimport {privateEntriesToIndex} from './index_writer';\nimport NgOptions from './options';\nimport {check, tsc} from './tsc';\nimport {isVinylFile, VinylFile} from './vinyl_file';\n\nexport {UserError} from './tsc';\n\nconst DTS = /\\.d\\.ts$/;\nconst JS_EXT = /(\\.js|)$/;\nconst TS_EXT = /\\.ts$/;\n\nexport interface CodegenExtension {\n /**\n * Returns the generated file names.\n */\n (ngOptions: NgOptions, cliOptions: CliOptions, program: ts.Program,\n host: ts.CompilerHost): Promise<string[]>;\n}\n\nexport function createBundleIndexHost(\n ngOptions: NgOptions, rootFiles: string[],\n host: ts.CompilerHost): {host: ts.CompilerHost, indexName?: string, errors?: ts.Diagnostic[]} {\n const files = rootFiles.filter(f => !DTS.test(f));\n if (files.length != 1) {\n return {\n host,\n errors: [{\n file: null,\n start: null,\n length: null,\n messageText:\n 'Angular compiler option \"flatModuleIndex\" requires one and only one .ts file in the \"files\" field.',\n category: ts.DiagnosticCategory.Error,\n code: 0\n }]\n };\n }\n const file = files[0];\n const indexModule = file.replace(/\\.ts$/, '');\n const bundler =\n new MetadataBundler(indexModule, ngOptions.flatModuleId, new CompilerHostAdapter(host));\n const metadataBundle = bundler.getMetadataBundle();\n const metadata = JSON.stringify(metadataBundle.metadata);\n const name =\n path.join(path.dirname(indexModule), ngOptions.flatModuleOutFile.replace(JS_EXT, '.ts'));\n const libraryIndex = `./${path.basename(indexModule)}`;\n const content = privateEntriesToIndex(libraryIndex, metadataBundle.privates);\n host = new SyntheticIndexHost(host, {name, content, metadata});\n return {host, indexName: name};\n}\n\nexport function main(\n project: string | VinylFile, cliOptions: CliOptions, codegen?: CodegenExtension,\n options?: ts.CompilerOptions): Promise<any> {\n try {\n let projectDir = project;\n // project is vinyl like file object\n if (isVinylFile(project)) {\n projectDir = path.dirname(project.path);\n }\n // project is path to project file\n else if (fs.lstatSync(project).isFile()) {\n projectDir = path.dirname(project);\n }\n\n // file names in tsconfig are resolved relative to this absolute path\n const basePath = path.resolve(process.cwd(), cliOptions.basePath || projectDir);\n\n // read the configuration options from wherever you store them\n let {parsed, ngOptions} = tsc.readConfiguration(project, basePath, options);\n ngOptions.basePath = basePath;\n let rootFileNames: string[] = parsed.fileNames.slice(0);\n const createProgram = (host: ts.CompilerHost, oldProgram?: ts.Program) => {\n return ts.createProgram(rootFileNames.slice(0), parsed.options, host, oldProgram);\n };\n const addGeneratedFileName = (genFileName: string) => {\n if (genFileName.startsWith(basePath) && TS_EXT.exec(genFileName)) {\n rootFileNames.push(genFileName);\n }\n };\n\n const diagnostics = (parsed.options as any).diagnostics;\n if (diagnostics) (ts as any).performance.enable();\n\n let host = ts.createCompilerHost(parsed.options, true);\n\n // If the compilation is a flat module index then produce the flat module index\n // metadata and the synthetic flat module index.\n if (ngOptions.flatModuleOutFile && !ngOptions.skipMetadataEmit) {\n const {host: bundleHost, indexName, errors} =\n createBundleIndexHost(ngOptions, rootFileNames, host);\n if (errors) check(errors);\n if (indexName) addGeneratedFileName(indexName);\n host = bundleHost;\n }\n\n const tsickleCompilerHostOptions:\n tsickle.Options = {googmodule: false, untyped: true, convertIndexImportShorthand: false};\n\n const tsickleHost: tsickle.TsickleHost = {\n shouldSkipTsickleProcessing: (fileName) => /\\.d\\.ts$/.test(fileName),\n pathToModuleName: (context, importPath) => '',\n shouldIgnoreWarningsForPath: (filePath) => false,\n fileNameToModuleId: (fileName) => fileName,\n };\n\n const tsickleCompilerHost =\n new tsickle.TsickleCompilerHost(host, ngOptions, tsickleCompilerHostOptions, tsickleHost);\n\n const program = createProgram(tsickleCompilerHost);\n\n const errors = program.getOptionsDiagnostics();\n check(errors);\n\n if (ngOptions.skipTemplateCodegen || !codegen) {\n codegen = () => Promise.resolve([]);\n }\n\n if (diagnostics) console.time('NG codegen');\n return codegen(ngOptions, cliOptions, program, host).then((genFiles) => {\n if (diagnostics) console.timeEnd('NG codegen');\n\n // Add the generated files to the configuration so they will become part of the program.\n if (ngOptions.alwaysCompileGeneratedCode) {\n genFiles.forEach(genFileName => addGeneratedFileName(genFileName));\n }\n let definitionsHost: ts.CompilerHost = tsickleCompilerHost;\n if (!ngOptions.skipMetadataEmit) {\n // if tsickle is not not used for emitting, but we do use the MetadataWriterHost,\n // it also needs to emit the js files.\n const emitJsFiles =\n ngOptions.annotationsAs === 'decorators' && !ngOptions.annotateForClosureCompiler;\n definitionsHost = new MetadataWriterHost(tsickleCompilerHost, ngOptions, emitJsFiles);\n }\n\n // Create a new program since codegen files were created after making the old program\n let programWithCodegen = createProgram(definitionsHost, program);\n tsc.typeCheck(host, programWithCodegen);\n\n let programForJsEmit = programWithCodegen;\n\n if (ngOptions.annotationsAs !== 'decorators') {\n if (diagnostics) console.time('NG downlevel');\n tsickleCompilerHost.reconfigureForRun(programForJsEmit, tsickle.Pass.DECORATOR_DOWNLEVEL);\n // A program can be re-used only once; save the programWithCodegen to be reused by\n // metadataWriter\n programForJsEmit = createProgram(tsickleCompilerHost);\n check(tsickleCompilerHost.diagnostics);\n if (diagnostics) console.timeEnd('NG downlevel');\n }\n\n if (ngOptions.annotateForClosureCompiler) {\n if (diagnostics) console.time('NG JSDoc');\n tsickleCompilerHost.reconfigureForRun(programForJsEmit, tsickle.Pass.CLOSURIZE);\n programForJsEmit = createProgram(tsickleCompilerHost);\n check(tsickleCompilerHost.diagnostics);\n if (diagnostics) console.timeEnd('NG JSDoc');\n }\n\n // Emit *.js and *.js.map\n tsc.emit(programForJsEmit);\n\n // Emit *.d.ts and maybe *.metadata.json\n // Not in the same emit pass with above, because tsickle erases\n // decorators which we want to read or document.\n // Do this emit second since TypeScript will create missing directories for us\n // in the standard emit.\n tsc.emit(programWithCodegen);\n\n if (diagnostics) {\n (ts as any).performance.forEachMeasure(\n (name: string, duration: number) => { console.error(`TS ${name}: ${duration}ms`); });\n }\n });\n } catch (e) {\n return Promise.reject(e);\n }\n}\n\n// CLI entry point\nif (require.main === module) {\n const args = process.argv.slice(2);\n let {options, errors} = (ts as any).parseCommandLine(args);\n check(errors);\n const project = options.project || '.';\n // TODO(alexeagle): command line should be TSC-compatible, remove \"CliOptions\" here\n const cliOptions = new CliOptions(require('minimist')(args));\n main(project, cliOptions, null, options)\n .then((exitCode: any) => process.exit(exitCode))\n .catch((e: any) => {\n console.error(e.stack);\n console.error('Compilation failed');\n process.exit(1);\n });\n}\n"]}
\No newline at end of file