source: trip-planner-front/node_modules/@angular/compiler-cli/src/main.js@ 8d391a1

Last change on this file since 8d391a1 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 31.1 KB
RevLine 
[6a3a178]1#!/usr/bin/env node
2/**
3 * @license
4 * Copyright Google LLC All Rights Reserved.
5 *
6 * Use of this source code is governed by an MIT-style license that can be
7 * found in the LICENSE file at https://angular.io/license
8 */
9(function (factory) {
10 if (typeof module === "object" && typeof module.exports === "object") {
11 var v = factory(require, exports);
12 if (v !== undefined) module.exports = v;
13 }
14 else if (typeof define === "function" && define.amd) {
15 define("@angular/compiler-cli/src/main", ["require", "exports", "tslib", "reflect-metadata", "typescript", "@angular/compiler-cli/src/transformers/api", "@angular/compiler-cli/src/transformers/util", "@angular/compiler-cli/src/perform_compile", "@angular/compiler-cli/src/perform_watch", "@angular/compiler-cli/src/ngtsc/file_system"], factory);
16 }
17})(function (require, exports) {
18 "use strict";
19 Object.defineProperty(exports, "__esModule", { value: true });
20 exports.watchMode = exports.readCommandLineAndConfiguration = exports.readNgcCommandLineAndConfiguration = exports.mainDiagnosticsForTest = exports.main = void 0;
21 var tslib_1 = require("tslib");
22 // Must be imported first, because Angular decorators throw on load.
23 require("reflect-metadata");
24 var ts = require("typescript");
25 var api = require("@angular/compiler-cli/src/transformers/api");
26 var util_1 = require("@angular/compiler-cli/src/transformers/util");
27 var perform_compile_1 = require("@angular/compiler-cli/src/perform_compile");
28 var perform_watch_1 = require("@angular/compiler-cli/src/perform_watch");
29 var file_system_1 = require("@angular/compiler-cli/src/ngtsc/file_system");
30 function main(args, consoleError, config, customTransformers, programReuse, modifiedResourceFiles) {
31 if (consoleError === void 0) { consoleError = console.error; }
32 var _a = config || readNgcCommandLineAndConfiguration(args), project = _a.project, rootNames = _a.rootNames, options = _a.options, configErrors = _a.errors, watch = _a.watch, emitFlags = _a.emitFlags;
33 if (configErrors.length) {
34 return reportErrorsAndExit(configErrors, /*options*/ undefined, consoleError);
35 }
36 if (watch) {
37 var result = watchMode(project, options, consoleError);
38 return reportErrorsAndExit(result.firstCompileResult, options, consoleError);
39 }
40 var oldProgram;
41 if (programReuse !== undefined) {
42 oldProgram = programReuse.program;
43 }
44 var _b = perform_compile_1.performCompilation({
45 rootNames: rootNames,
46 options: options,
47 emitFlags: emitFlags,
48 oldProgram: oldProgram,
49 emitCallback: createEmitCallback(options),
50 customTransformers: customTransformers,
51 modifiedResourceFiles: modifiedResourceFiles
52 }), compileDiags = _b.diagnostics, program = _b.program;
53 if (programReuse !== undefined) {
54 programReuse.program = program;
55 }
56 return reportErrorsAndExit(compileDiags, options, consoleError);
57 }
58 exports.main = main;
59 function mainDiagnosticsForTest(args, config, programReuse, modifiedResourceFiles) {
60 var _a = config || readNgcCommandLineAndConfiguration(args), project = _a.project, rootNames = _a.rootNames, options = _a.options, configErrors = _a.errors, watch = _a.watch, emitFlags = _a.emitFlags;
61 if (configErrors.length) {
62 return configErrors;
63 }
64 var oldProgram;
65 if (programReuse !== undefined) {
66 oldProgram = programReuse.program;
67 }
68 var _b = perform_compile_1.performCompilation({
69 rootNames: rootNames,
70 options: options,
71 emitFlags: emitFlags,
72 oldProgram: oldProgram,
73 modifiedResourceFiles: modifiedResourceFiles,
74 emitCallback: createEmitCallback(options),
75 }), compileDiags = _b.diagnostics, program = _b.program;
76 if (programReuse !== undefined) {
77 programReuse.program = program;
78 }
79 return compileDiags;
80 }
81 exports.mainDiagnosticsForTest = mainDiagnosticsForTest;
82 function createEmitCallback(options) {
83 if (!options.annotateForClosureCompiler) {
84 return undefined;
85 }
86 var tsickleHost = {
87 shouldSkipTsickleProcessing: function (fileName) { return /\.d\.ts$/.test(fileName) ||
88 // View Engine's generated files were never intended to be processed with tsickle.
89 (!options.enableIvy && util_1.GENERATED_FILES.test(fileName)); },
90 pathToModuleName: function (context, importPath) { return ''; },
91 shouldIgnoreWarningsForPath: function (filePath) { return false; },
92 fileNameToModuleId: function (fileName) { return fileName; },
93 googmodule: false,
94 untyped: true,
95 convertIndexImportShorthand: false,
96 // Decorators are transformed as part of the Angular compiler programs. To avoid
97 // conflicts, we disable decorator transformations for tsickle.
98 transformDecorators: false,
99 transformTypesToClosure: true,
100 };
101 return function (_a) {
102 var program = _a.program, targetSourceFile = _a.targetSourceFile, writeFile = _a.writeFile, cancellationToken = _a.cancellationToken, emitOnlyDtsFiles = _a.emitOnlyDtsFiles, _b = _a.customTransformers, customTransformers = _b === void 0 ? {} : _b, host = _a.host, options = _a.options;
103 // tslint:disable-next-line:no-require-imports only depend on tsickle if requested
104 return require('tsickle').emitWithTsickle(program, tslib_1.__assign(tslib_1.__assign({}, tsickleHost), { options: options, host: host, moduleResolutionHost: host }), host, options, targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, {
105 beforeTs: customTransformers.before,
106 afterTs: customTransformers.after,
107 });
108 };
109 }
110 function readNgcCommandLineAndConfiguration(args) {
111 var options = {};
112 var parsedArgs = require('minimist')(args);
113 if (parsedArgs.i18nFile)
114 options.i18nInFile = parsedArgs.i18nFile;
115 if (parsedArgs.i18nFormat)
116 options.i18nInFormat = parsedArgs.i18nFormat;
117 if (parsedArgs.locale)
118 options.i18nInLocale = parsedArgs.locale;
119 var mt = parsedArgs.missingTranslation;
120 if (mt === 'error' || mt === 'warning' || mt === 'ignore') {
121 options.i18nInMissingTranslations = mt;
122 }
123 var config = readCommandLineAndConfiguration(args, options, ['i18nFile', 'i18nFormat', 'locale', 'missingTranslation', 'watch']);
124 var watch = parsedArgs.w || parsedArgs.watch;
125 return tslib_1.__assign(tslib_1.__assign({}, config), { watch: watch });
126 }
127 exports.readNgcCommandLineAndConfiguration = readNgcCommandLineAndConfiguration;
128 function readCommandLineAndConfiguration(args, existingOptions, ngCmdLineOptions) {
129 if (existingOptions === void 0) { existingOptions = {}; }
130 if (ngCmdLineOptions === void 0) { ngCmdLineOptions = []; }
131 var cmdConfig = ts.parseCommandLine(args);
132 var project = cmdConfig.options.project || '.';
133 var cmdErrors = cmdConfig.errors.filter(function (e) {
134 if (typeof e.messageText === 'string') {
135 var msg_1 = e.messageText;
136 return !ngCmdLineOptions.some(function (o) { return msg_1.indexOf(o) >= 0; });
137 }
138 return true;
139 });
140 if (cmdErrors.length) {
141 return {
142 project: project,
143 rootNames: [],
144 options: cmdConfig.options,
145 errors: cmdErrors,
146 emitFlags: api.EmitFlags.Default
147 };
148 }
149 var config = perform_compile_1.readConfiguration(project, cmdConfig.options);
150 var options = tslib_1.__assign(tslib_1.__assign({}, config.options), existingOptions);
151 if (options.locale) {
152 options.i18nInLocale = options.locale;
153 }
154 return {
155 project: project,
156 rootNames: config.rootNames,
157 options: options,
158 errors: config.errors,
159 emitFlags: config.emitFlags
160 };
161 }
162 exports.readCommandLineAndConfiguration = readCommandLineAndConfiguration;
163 function getFormatDiagnosticsHost(options) {
164 var basePath = options ? options.basePath : undefined;
165 return {
166 getCurrentDirectory: function () { return basePath || ts.sys.getCurrentDirectory(); },
167 // We need to normalize the path separators here because by default, TypeScript
168 // compiler hosts use posix canonical paths. In order to print consistent diagnostics,
169 // we also normalize the paths.
170 getCanonicalFileName: function (fileName) { return fileName.replace(/\\/g, '/'); },
171 getNewLine: function () {
172 // Manually determine the proper new line string based on the passed compiler
173 // options. There is no public TypeScript function that returns the corresponding
174 // new line string. see: https://github.com/Microsoft/TypeScript/issues/29581
175 if (options && options.newLine !== undefined) {
176 return options.newLine === ts.NewLineKind.LineFeed ? '\n' : '\r\n';
177 }
178 return ts.sys.newLine;
179 },
180 };
181 }
182 function reportErrorsAndExit(allDiagnostics, options, consoleError) {
183 if (consoleError === void 0) { consoleError = console.error; }
184 var errorsAndWarnings = perform_compile_1.filterErrorsAndWarnings(allDiagnostics);
185 printDiagnostics(errorsAndWarnings, options, consoleError);
186 return perform_compile_1.exitCodeFromResult(allDiagnostics);
187 }
188 function watchMode(project, options, consoleError) {
189 return perform_watch_1.performWatchCompilation(perform_watch_1.createPerformWatchHost(project, function (diagnostics) {
190 printDiagnostics(diagnostics, options, consoleError);
191 }, options, function (options) { return createEmitCallback(options); }));
192 }
193 exports.watchMode = watchMode;
194 function printDiagnostics(diagnostics, options, consoleError) {
195 if (diagnostics.length === 0) {
196 return;
197 }
198 var formatHost = getFormatDiagnosticsHost(options);
199 consoleError(perform_compile_1.formatDiagnostics(diagnostics, formatHost));
200 }
201 // CLI entry point
202 if (require.main === module) {
203 process.title = 'Angular Compiler (ngc)';
204 var args = process.argv.slice(2);
205 // We are running the real compiler so run against the real file-system
206 file_system_1.setFileSystem(new file_system_1.NodeJSFileSystem());
207 process.exitCode = main(args);
208 }
209});
210//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFpbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyLWNsaS9zcmMvbWFpbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQ0E7Ozs7OztHQU1HOzs7Ozs7Ozs7Ozs7OztJQUVILG9FQUFvRTtJQUNwRSw0QkFBMEI7SUFFMUIsK0JBQWlDO0lBSWpDLGdFQUEwQztJQUMxQyxvRUFBb0Q7SUFFcEQsNkVBQTBLO0lBQzFLLHlFQUFnRjtJQUNoRiwyRUFBb0U7SUFFcEUsU0FBZ0IsSUFBSSxDQUNoQixJQUFjLEVBQUUsWUFBaUQsRUFDakUsTUFBK0IsRUFBRSxrQkFBMkMsRUFBRSxZQUU3RSxFQUNELHFCQUF3QztRQUp4Qiw2QkFBQSxFQUFBLGVBQW9DLE9BQU8sQ0FBQyxLQUFLO1FBSy9ELElBQUEsS0FDQSxNQUFNLElBQUksa0NBQWtDLENBQUMsSUFBSSxDQUFDLEVBRGpELE9BQU8sYUFBQSxFQUFFLFNBQVMsZUFBQSxFQUFFLE9BQU8sYUFBQSxFQUFVLFlBQVksWUFBQSxFQUFFLEtBQUssV0FBQSxFQUFFLFNBQVMsZUFDbEIsQ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