1 | (function (factory) {
|
---|
2 | if (typeof module === "object" && typeof module.exports === "object") {
|
---|
3 | var v = factory(require, exports);
|
---|
4 | if (v !== undefined) module.exports = v;
|
---|
5 | }
|
---|
6 | else if (typeof define === "function" && define.amd) {
|
---|
7 | define("@angular/compiler-cli/ngcc/src/ngcc_options", ["require", "exports", "os", "@angular/compiler-cli/src/ngtsc/file_system", "@angular/compiler-cli/src/ngtsc/logging", "@angular/compiler-cli/src/perform_compile", "@angular/compiler-cli/ngcc/src/packages/entry_point", "@angular/compiler-cli/ngcc/src/path_mappings", "@angular/compiler-cli/ngcc/src/writing/in_place_file_writer", "@angular/compiler-cli/ngcc/src/writing/new_entry_point_file_writer"], factory);
|
---|
8 | }
|
---|
9 | })(function (require, exports) {
|
---|
10 | "use strict";
|
---|
11 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
12 | exports.getMaxNumberOfWorkers = exports.clearTsConfigCache = exports.getSharedSetup = void 0;
|
---|
13 | /**
|
---|
14 | * @license
|
---|
15 | * Copyright Google LLC All Rights Reserved.
|
---|
16 | *
|
---|
17 | * Use of this source code is governed by an MIT-style license that can be
|
---|
18 | * found in the LICENSE file at https://angular.io/license
|
---|
19 | */
|
---|
20 | var os = require("os");
|
---|
21 | var file_system_1 = require("@angular/compiler-cli/src/ngtsc/file_system");
|
---|
22 | var logging_1 = require("@angular/compiler-cli/src/ngtsc/logging");
|
---|
23 | var perform_compile_1 = require("@angular/compiler-cli/src/perform_compile");
|
---|
24 | var entry_point_1 = require("@angular/compiler-cli/ngcc/src/packages/entry_point");
|
---|
25 | var path_mappings_1 = require("@angular/compiler-cli/ngcc/src/path_mappings");
|
---|
26 | var in_place_file_writer_1 = require("@angular/compiler-cli/ngcc/src/writing/in_place_file_writer");
|
---|
27 | var new_entry_point_file_writer_1 = require("@angular/compiler-cli/ngcc/src/writing/new_entry_point_file_writer");
|
---|
28 | /**
|
---|
29 | * Instantiate common utilities that are always used and fix up options with defaults, as necessary.
|
---|
30 | *
|
---|
31 | * NOTE: Avoid eagerly instantiating anything that might not be used when running sync/async.
|
---|
32 | */
|
---|
33 | function getSharedSetup(options) {
|
---|
34 | var fileSystem = file_system_1.getFileSystem();
|
---|
35 | var absBasePath = file_system_1.absoluteFrom(options.basePath);
|
---|
36 | var projectPath = fileSystem.dirname(absBasePath);
|
---|
37 | var tsConfig = options.tsConfigPath !== null ? getTsConfig(options.tsConfigPath || projectPath) : null;
|
---|
38 | var basePath = options.basePath, targetEntryPointPath = options.targetEntryPointPath, _a = options.propertiesToConsider, propertiesToConsider = _a === void 0 ? entry_point_1.SUPPORTED_FORMAT_PROPERTIES : _a, _b = options.typingsOnly, typingsOnly = _b === void 0 ? false : _b, _c = options.compileAllFormats, compileAllFormats = _c === void 0 ? true : _c, _d = options.createNewEntryPointFormats, createNewEntryPointFormats = _d === void 0 ? false : _d, _e = options.logger, logger = _e === void 0 ? new logging_1.ConsoleLogger(logging_1.LogLevel.info) : _e, _f = options.pathMappings, pathMappings = _f === void 0 ? path_mappings_1.getPathMappingsFromTsConfig(fileSystem, tsConfig, projectPath) : _f, _g = options.async, async = _g === void 0 ? false : _g, _h = options.errorOnFailedEntryPoint, errorOnFailedEntryPoint = _h === void 0 ? false : _h, _j = options.enableI18nLegacyMessageIdFormat, enableI18nLegacyMessageIdFormat = _j === void 0 ? true : _j, _k = options.invalidateEntryPointManifest, invalidateEntryPointManifest = _k === void 0 ? false : _k, tsConfigPath = options.tsConfigPath;
|
---|
39 | if (!!targetEntryPointPath) {
|
---|
40 | // targetEntryPointPath forces us to error if an entry-point fails.
|
---|
41 | errorOnFailedEntryPoint = true;
|
---|
42 | }
|
---|
43 | if (typingsOnly) {
|
---|
44 | // If we only want to process the typings then we do not want to waste time trying to process
|
---|
45 | // multiple JS formats.
|
---|
46 | compileAllFormats = false;
|
---|
47 | }
|
---|
48 | checkForSolutionStyleTsConfig(fileSystem, logger, projectPath, options.tsConfigPath, tsConfig);
|
---|
49 | return {
|
---|
50 | basePath: basePath,
|
---|
51 | targetEntryPointPath: targetEntryPointPath,
|
---|
52 | propertiesToConsider: propertiesToConsider,
|
---|
53 | typingsOnly: typingsOnly,
|
---|
54 | compileAllFormats: compileAllFormats,
|
---|
55 | createNewEntryPointFormats: createNewEntryPointFormats,
|
---|
56 | logger: logger,
|
---|
57 | pathMappings: pathMappings,
|
---|
58 | async: async,
|
---|
59 | errorOnFailedEntryPoint: errorOnFailedEntryPoint,
|
---|
60 | enableI18nLegacyMessageIdFormat: enableI18nLegacyMessageIdFormat,
|
---|
61 | invalidateEntryPointManifest: invalidateEntryPointManifest,
|
---|
62 | tsConfigPath: tsConfigPath,
|
---|
63 | fileSystem: fileSystem,
|
---|
64 | absBasePath: absBasePath,
|
---|
65 | projectPath: projectPath,
|
---|
66 | tsConfig: tsConfig,
|
---|
67 | getFileWriter: function (pkgJsonUpdater) { return createNewEntryPointFormats ?
|
---|
68 | new new_entry_point_file_writer_1.NewEntryPointFileWriter(fileSystem, logger, errorOnFailedEntryPoint, pkgJsonUpdater) :
|
---|
69 | new in_place_file_writer_1.InPlaceFileWriter(fileSystem, logger, errorOnFailedEntryPoint); },
|
---|
70 | };
|
---|
71 | }
|
---|
72 | exports.getSharedSetup = getSharedSetup;
|
---|
73 | var tsConfigCache = null;
|
---|
74 | var tsConfigPathCache = null;
|
---|
75 | /**
|
---|
76 | * Get the parsed configuration object for the given `tsConfigPath`.
|
---|
77 | *
|
---|
78 | * This function will cache the previous parsed configuration object to avoid unnecessary processing
|
---|
79 | * of the tsconfig.json in the case that it is requested repeatedly.
|
---|
80 | *
|
---|
81 | * This makes the assumption, which is true as of writing, that the contents of tsconfig.json and
|
---|
82 | * its dependencies will not change during the life of the process running ngcc.
|
---|
83 | */
|
---|
84 | function getTsConfig(tsConfigPath) {
|
---|
85 | if (tsConfigPath !== tsConfigPathCache) {
|
---|
86 | tsConfigPathCache = tsConfigPath;
|
---|
87 | tsConfigCache = perform_compile_1.readConfiguration(tsConfigPath);
|
---|
88 | }
|
---|
89 | return tsConfigCache;
|
---|
90 | }
|
---|
91 | function clearTsConfigCache() {
|
---|
92 | tsConfigPathCache = null;
|
---|
93 | tsConfigCache = null;
|
---|
94 | }
|
---|
95 | exports.clearTsConfigCache = clearTsConfigCache;
|
---|
96 | function checkForSolutionStyleTsConfig(fileSystem, logger, projectPath, tsConfigPath, tsConfig) {
|
---|
97 | if (tsConfigPath !== null && !tsConfigPath && tsConfig !== null &&
|
---|
98 | tsConfig.rootNames.length === 0 && tsConfig.projectReferences !== undefined &&
|
---|
99 | tsConfig.projectReferences.length > 0) {
|
---|
100 | logger.warn("The inferred tsconfig file \"" + tsConfig.project + "\" appears to be \"solution-style\" " +
|
---|
101 | "since it contains no root files but does contain project references.\n" +
|
---|
102 | "This is probably not wanted, since ngcc is unable to infer settings like \"paths\" mappings from such a file.\n" +
|
---|
103 | "Perhaps you should have explicitly specified one of the referenced projects using the --tsconfig option. For example:\n\n" +
|
---|
104 | tsConfig.projectReferences.map(function (ref) { return " ngcc ... --tsconfig \"" + ref.originalPath + "\"\n"; })
|
---|
105 | .join('') +
|
---|
106 | "\nFind out more about solution-style tsconfig at https://devblogs.microsoft.com/typescript/announcing-typescript-3-9/#solution-style-tsconfig.\n" +
|
---|
107 | "If you did intend to use this file, then you can hide this warning by providing it explicitly:\n\n" +
|
---|
108 | (" ngcc ... --tsconfig \"" + fileSystem.relative(projectPath, tsConfig.project) + "\""));
|
---|
109 | }
|
---|
110 | }
|
---|
111 | /**
|
---|
112 | * Determines the maximum number of workers to use for parallel execution. This can be set using the
|
---|
113 | * NGCC_MAX_WORKERS environment variable, or is computed based on the number of available CPUs. One
|
---|
114 | * CPU core is always reserved for the master process, so we take the number of CPUs minus one, with
|
---|
115 | * a maximum of 4 workers. We don't scale the number of workers beyond 4 by default, as it takes
|
---|
116 | * considerably more memory and CPU cycles while not offering a substantial improvement in time.
|
---|
117 | */
|
---|
118 | function getMaxNumberOfWorkers() {
|
---|
119 | var maxWorkers = process.env.NGCC_MAX_WORKERS;
|
---|
120 | if (maxWorkers === undefined) {
|
---|
121 | // Use up to 4 CPU cores for workers, always reserving one for master.
|
---|
122 | return Math.max(1, Math.min(4, os.cpus().length - 1));
|
---|
123 | }
|
---|
124 | var numericMaxWorkers = +maxWorkers.trim();
|
---|
125 | if (!Number.isInteger(numericMaxWorkers)) {
|
---|
126 | throw new Error('NGCC_MAX_WORKERS should be an integer.');
|
---|
127 | }
|
---|
128 | else if (numericMaxWorkers < 1) {
|
---|
129 | throw new Error('NGCC_MAX_WORKERS should be at least 1.');
|
---|
130 | }
|
---|
131 | return numericMaxWorkers;
|
---|
132 | }
|
---|
133 | exports.getMaxNumberOfWorkers = getMaxNumberOfWorkers;
|
---|
134 | });
|
---|
135 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmdjY19vcHRpb25zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY29tcGlsZXItY2xpL25nY2Mvc3JjL25nY2Nfb3B0aW9ucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7SUFBQTs7Ozs7O09BTUc7SUFDSCx1QkFBeUI7SUFFekIsMkVBQXNIO0lBQ3RILG1FQUF3RTtJQUN4RSw2RUFBaUY7SUFFakYsbUZBQW1FO0lBQ25FLDhFQUEwRTtJQUUxRSxvR0FBaUU7SUFDakUsa0hBQThFO0lBd0o5RTs7OztPQUlHO0lBQ0gsU0FBZ0IsY0FBYyxDQUFDLE9BQW9CO1FBRWpELElBQU0sVUFBVSxHQUFHLDJCQUFhLEVBQUUsQ0FBQztRQUNuQyxJQUFNLFdBQVcsR0FBRywwQkFBWSxDQUFDLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQztRQUNuRCxJQUFNLFdBQVcsR0FBRyxVQUFVLENBQUMsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUFDO1FBQ3BEL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