1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | (function (factory) {
|
---|
9 | if (typeof module === "object" && typeof module.exports === "object") {
|
---|
10 | var v = factory(require, exports);
|
---|
11 | if (v !== undefined) module.exports = v;
|
---|
12 | }
|
---|
13 | else if (typeof define === "function" && define.amd) {
|
---|
14 | define("@angular/compiler-cli/ngcc/src/main", ["require", "exports", "tslib", "@angular/compiler-cli/ngcc/src/dependencies/commonjs_dependency_host", "@angular/compiler-cli/ngcc/src/dependencies/dependency_resolver", "@angular/compiler-cli/ngcc/src/dependencies/dts_dependency_host", "@angular/compiler-cli/ngcc/src/dependencies/esm_dependency_host", "@angular/compiler-cli/ngcc/src/dependencies/module_resolver", "@angular/compiler-cli/ngcc/src/dependencies/umd_dependency_host", "@angular/compiler-cli/ngcc/src/entry_point_finder/directory_walker_entry_point_finder", "@angular/compiler-cli/ngcc/src/entry_point_finder/entry_point_collector", "@angular/compiler-cli/ngcc/src/entry_point_finder/program_based_entry_point_finder", "@angular/compiler-cli/ngcc/src/entry_point_finder/targeted_entry_point_finder", "@angular/compiler-cli/ngcc/src/execution/analyze_entry_points", "@angular/compiler-cli/ngcc/src/execution/cluster/executor", "@angular/compiler-cli/ngcc/src/execution/create_compile_function", "@angular/compiler-cli/ngcc/src/execution/single_process_executor", "@angular/compiler-cli/ngcc/src/execution/tasks/completion", "@angular/compiler-cli/ngcc/src/locking/async_locker", "@angular/compiler-cli/ngcc/src/locking/lock_file_with_child_process/index", "@angular/compiler-cli/ngcc/src/locking/sync_locker", "@angular/compiler-cli/ngcc/src/ngcc_options", "@angular/compiler-cli/ngcc/src/packages/configuration", "@angular/compiler-cli/ngcc/src/packages/entry_point", "@angular/compiler-cli/ngcc/src/packages/entry_point_manifest", "@angular/compiler-cli/ngcc/src/writing/package_json_updater"], factory);
|
---|
15 | }
|
---|
16 | })(function (require, exports) {
|
---|
17 | "use strict";
|
---|
18 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
19 | exports.mainNgcc = void 0;
|
---|
20 | var tslib_1 = require("tslib");
|
---|
21 | var commonjs_dependency_host_1 = require("@angular/compiler-cli/ngcc/src/dependencies/commonjs_dependency_host");
|
---|
22 | var dependency_resolver_1 = require("@angular/compiler-cli/ngcc/src/dependencies/dependency_resolver");
|
---|
23 | var dts_dependency_host_1 = require("@angular/compiler-cli/ngcc/src/dependencies/dts_dependency_host");
|
---|
24 | var esm_dependency_host_1 = require("@angular/compiler-cli/ngcc/src/dependencies/esm_dependency_host");
|
---|
25 | var module_resolver_1 = require("@angular/compiler-cli/ngcc/src/dependencies/module_resolver");
|
---|
26 | var umd_dependency_host_1 = require("@angular/compiler-cli/ngcc/src/dependencies/umd_dependency_host");
|
---|
27 | var directory_walker_entry_point_finder_1 = require("@angular/compiler-cli/ngcc/src/entry_point_finder/directory_walker_entry_point_finder");
|
---|
28 | var entry_point_collector_1 = require("@angular/compiler-cli/ngcc/src/entry_point_finder/entry_point_collector");
|
---|
29 | var program_based_entry_point_finder_1 = require("@angular/compiler-cli/ngcc/src/entry_point_finder/program_based_entry_point_finder");
|
---|
30 | var targeted_entry_point_finder_1 = require("@angular/compiler-cli/ngcc/src/entry_point_finder/targeted_entry_point_finder");
|
---|
31 | var analyze_entry_points_1 = require("@angular/compiler-cli/ngcc/src/execution/analyze_entry_points");
|
---|
32 | var executor_1 = require("@angular/compiler-cli/ngcc/src/execution/cluster/executor");
|
---|
33 | var create_compile_function_1 = require("@angular/compiler-cli/ngcc/src/execution/create_compile_function");
|
---|
34 | var single_process_executor_1 = require("@angular/compiler-cli/ngcc/src/execution/single_process_executor");
|
---|
35 | var completion_1 = require("@angular/compiler-cli/ngcc/src/execution/tasks/completion");
|
---|
36 | var async_locker_1 = require("@angular/compiler-cli/ngcc/src/locking/async_locker");
|
---|
37 | var lock_file_with_child_process_1 = require("@angular/compiler-cli/ngcc/src/locking/lock_file_with_child_process/index");
|
---|
38 | var sync_locker_1 = require("@angular/compiler-cli/ngcc/src/locking/sync_locker");
|
---|
39 | var ngcc_options_1 = require("@angular/compiler-cli/ngcc/src/ngcc_options");
|
---|
40 | var configuration_1 = require("@angular/compiler-cli/ngcc/src/packages/configuration");
|
---|
41 | var entry_point_1 = require("@angular/compiler-cli/ngcc/src/packages/entry_point");
|
---|
42 | var entry_point_manifest_1 = require("@angular/compiler-cli/ngcc/src/packages/entry_point_manifest");
|
---|
43 | var package_json_updater_1 = require("@angular/compiler-cli/ngcc/src/writing/package_json_updater");
|
---|
44 | function mainNgcc(options) {
|
---|
45 | var _a = ngcc_options_1.getSharedSetup(options), basePath = _a.basePath, targetEntryPointPath = _a.targetEntryPointPath, propertiesToConsider = _a.propertiesToConsider, typingsOnly = _a.typingsOnly, compileAllFormats = _a.compileAllFormats, logger = _a.logger, pathMappings = _a.pathMappings, async = _a.async, errorOnFailedEntryPoint = _a.errorOnFailedEntryPoint, enableI18nLegacyMessageIdFormat = _a.enableI18nLegacyMessageIdFormat, invalidateEntryPointManifest = _a.invalidateEntryPointManifest, fileSystem = _a.fileSystem, absBasePath = _a.absBasePath, projectPath = _a.projectPath, tsConfig = _a.tsConfig, getFileWriter = _a.getFileWriter;
|
---|
46 | var config = new configuration_1.NgccConfiguration(fileSystem, projectPath);
|
---|
47 | var dependencyResolver = getDependencyResolver(fileSystem, logger, config, pathMappings);
|
---|
48 | var entryPointManifest = invalidateEntryPointManifest ?
|
---|
49 | new entry_point_manifest_1.InvalidatingEntryPointManifest(fileSystem, config, logger) :
|
---|
50 | new entry_point_manifest_1.EntryPointManifest(fileSystem, config, logger);
|
---|
51 | // Bail out early if the work is already done.
|
---|
52 | var supportedPropertiesToConsider = ensureSupportedProperties(propertiesToConsider);
|
---|
53 | var absoluteTargetEntryPointPath = targetEntryPointPath !== undefined ?
|
---|
54 | fileSystem.resolve(basePath, targetEntryPointPath) :
|
---|
55 | null;
|
---|
56 | var finder = getEntryPointFinder(fileSystem, logger, dependencyResolver, config, entryPointManifest, absBasePath, absoluteTargetEntryPointPath, pathMappings, options.findEntryPointsFromTsConfigProgram ? tsConfig : null, projectPath);
|
---|
57 | if (finder instanceof targeted_entry_point_finder_1.TargetedEntryPointFinder &&
|
---|
58 | !finder.targetNeedsProcessingOrCleaning(supportedPropertiesToConsider, compileAllFormats)) {
|
---|
59 | logger.debug('The target entry-point has already been processed');
|
---|
60 | return;
|
---|
61 | }
|
---|
62 | // Determine the number of workers to use and whether ngcc should run in parallel.
|
---|
63 | var workerCount = async ? ngcc_options_1.getMaxNumberOfWorkers() : 1;
|
---|
64 | var inParallel = workerCount > 1;
|
---|
65 | var analyzeEntryPoints = analyze_entry_points_1.getAnalyzeEntryPointsFn(logger, finder, fileSystem, supportedPropertiesToConsider, typingsOnly, compileAllFormats, propertiesToConsider, inParallel);
|
---|
66 | // Create an updater that will actually write to disk.
|
---|
67 | var pkgJsonUpdater = new package_json_updater_1.DirectPackageJsonUpdater(fileSystem);
|
---|
68 | var fileWriter = getFileWriter(pkgJsonUpdater);
|
---|
69 | // The function for creating the `compile()` function.
|
---|
70 | var createCompileFn = create_compile_function_1.getCreateCompileFn(fileSystem, logger, fileWriter, enableI18nLegacyMessageIdFormat, tsConfig, pathMappings);
|
---|
71 | // The executor for actually planning and getting the work done.
|
---|
72 | var createTaskCompletedCallback = getCreateTaskCompletedCallback(pkgJsonUpdater, errorOnFailedEntryPoint, logger, fileSystem);
|
---|
73 | var executor = getExecutor(async, workerCount, logger, fileWriter, pkgJsonUpdater, fileSystem, config, createTaskCompletedCallback);
|
---|
74 | return executor.execute(analyzeEntryPoints, createCompileFn);
|
---|
75 | }
|
---|
76 | exports.mainNgcc = mainNgcc;
|
---|
77 | function ensureSupportedProperties(properties) {
|
---|
78 | var e_1, _a;
|
---|
79 | // Short-circuit the case where `properties` has fallen back to the default value:
|
---|
80 | // `SUPPORTED_FORMAT_PROPERTIES`
|
---|
81 | if (properties === entry_point_1.SUPPORTED_FORMAT_PROPERTIES)
|
---|
82 | return entry_point_1.SUPPORTED_FORMAT_PROPERTIES;
|
---|
83 | var supportedProperties = [];
|
---|
84 | try {
|
---|
85 | for (var _b = tslib_1.__values(properties), _c = _b.next(); !_c.done; _c = _b.next()) {
|
---|
86 | var prop = _c.value;
|
---|
87 | if (entry_point_1.SUPPORTED_FORMAT_PROPERTIES.indexOf(prop) !== -1) {
|
---|
88 | supportedProperties.push(prop);
|
---|
89 | }
|
---|
90 | }
|
---|
91 | }
|
---|
92 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
---|
93 | finally {
|
---|
94 | try {
|
---|
95 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
---|
96 | }
|
---|
97 | finally { if (e_1) throw e_1.error; }
|
---|
98 | }
|
---|
99 | if (supportedProperties.length === 0) {
|
---|
100 | throw new Error("No supported format property to consider among [" + properties.join(', ') + "]. " +
|
---|
101 | ("Supported properties: " + entry_point_1.SUPPORTED_FORMAT_PROPERTIES.join(', ')));
|
---|
102 | }
|
---|
103 | return supportedProperties;
|
---|
104 | }
|
---|
105 | function getCreateTaskCompletedCallback(pkgJsonUpdater, errorOnFailedEntryPoint, logger, fileSystem) {
|
---|
106 | return function (taskQueue) {
|
---|
107 | var _a;
|
---|
108 | return completion_1.composeTaskCompletedCallbacks((_a = {},
|
---|
109 | _a[0 /* Processed */] = completion_1.createMarkAsProcessedHandler(fileSystem, pkgJsonUpdater),
|
---|
110 | _a[1 /* Failed */] = errorOnFailedEntryPoint ? completion_1.createThrowErrorHandler(fileSystem) :
|
---|
111 | completion_1.createLogErrorHandler(logger, fileSystem, taskQueue),
|
---|
112 | _a));
|
---|
113 | };
|
---|
114 | }
|
---|
115 | function getExecutor(async, workerCount, logger, fileWriter, pkgJsonUpdater, fileSystem, config, createTaskCompletedCallback) {
|
---|
116 | var lockFile = new lock_file_with_child_process_1.LockFileWithChildProcess(fileSystem, logger);
|
---|
117 | if (async) {
|
---|
118 | // Execute asynchronously (either serially or in parallel)
|
---|
119 | var _a = config.getLockingConfig(), retryAttempts = _a.retryAttempts, retryDelay = _a.retryDelay;
|
---|
120 | var locker = new async_locker_1.AsyncLocker(lockFile, logger, retryDelay, retryAttempts);
|
---|
121 | if (workerCount > 1) {
|
---|
122 | // Execute in parallel.
|
---|
123 | return new executor_1.ClusterExecutor(workerCount, fileSystem, logger, fileWriter, pkgJsonUpdater, locker, createTaskCompletedCallback);
|
---|
124 | }
|
---|
125 | else {
|
---|
126 | // Execute serially, on a single thread (async).
|
---|
127 | return new single_process_executor_1.SingleProcessExecutorAsync(logger, locker, createTaskCompletedCallback);
|
---|
128 | }
|
---|
129 | }
|
---|
130 | else {
|
---|
131 | // Execute serially, on a single thread (sync).
|
---|
132 | return new single_process_executor_1.SingleProcessExecutorSync(logger, new sync_locker_1.SyncLocker(lockFile), createTaskCompletedCallback);
|
---|
133 | }
|
---|
134 | }
|
---|
135 | function getDependencyResolver(fileSystem, logger, config, pathMappings) {
|
---|
136 | var moduleResolver = new module_resolver_1.ModuleResolver(fileSystem, pathMappings);
|
---|
137 | var esmDependencyHost = new esm_dependency_host_1.EsmDependencyHost(fileSystem, moduleResolver);
|
---|
138 | var umdDependencyHost = new umd_dependency_host_1.UmdDependencyHost(fileSystem, moduleResolver);
|
---|
139 | var commonJsDependencyHost = new commonjs_dependency_host_1.CommonJsDependencyHost(fileSystem, moduleResolver);
|
---|
140 | var dtsDependencyHost = new dts_dependency_host_1.DtsDependencyHost(fileSystem, pathMappings);
|
---|
141 | return new dependency_resolver_1.DependencyResolver(fileSystem, logger, config, {
|
---|
142 | esm5: esmDependencyHost,
|
---|
143 | esm2015: esmDependencyHost,
|
---|
144 | umd: umdDependencyHost,
|
---|
145 | commonjs: commonJsDependencyHost
|
---|
146 | }, dtsDependencyHost);
|
---|
147 | }
|
---|
148 | function getEntryPointFinder(fs, logger, resolver, config, entryPointManifest, basePath, absoluteTargetEntryPointPath, pathMappings, tsConfig, projectPath) {
|
---|
149 | if (absoluteTargetEntryPointPath !== null) {
|
---|
150 | return new targeted_entry_point_finder_1.TargetedEntryPointFinder(fs, config, logger, resolver, basePath, pathMappings, absoluteTargetEntryPointPath);
|
---|
151 | }
|
---|
152 | else {
|
---|
153 | var entryPointCollector = new entry_point_collector_1.EntryPointCollector(fs, config, logger, resolver);
|
---|
154 | if (tsConfig !== null) {
|
---|
155 | return new program_based_entry_point_finder_1.ProgramBasedEntryPointFinder(fs, config, logger, resolver, entryPointCollector, entryPointManifest, basePath, tsConfig, projectPath);
|
---|
156 | }
|
---|
157 | else {
|
---|
158 | return new directory_walker_entry_point_finder_1.DirectoryWalkerEntryPointFinder(logger, resolver, entryPointCollector, entryPointManifest, basePath, pathMappings);
|
---|
159 | }
|
---|
160 | }
|
---|
161 | }
|
---|
162 | });
|
---|
163 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFpbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyLWNsaS9uZ2NjL3NyYy9tYWluLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRzs7Ozs7Ozs7Ozs7Ozs7SUFRSCxpSEFBK0U7SUFDL0UsdUdBQXNFO0lBQ3RFLHVHQUFxRTtJQUNyRSx1R0FBcUU7SUFDckUsK0ZBQThEO0lBQzlELHVHQUFxRTtJQUNyRSw2SUFBeUc7SUFDekcsaUhBQStFO0lBRS9FLHVJQUFtRztJQUNuRyw2SEFBMEY7SUFDMUYsc0dBQXlFO0lBRXpFLHNGQUE2RDtJQUM3RCw0R0FBdUU7SUFDdkUsNEdBQTBHO0lBRTFHLHdGQUF5SjtJQUN6SixvRkFBbUQ7SUFDbkQsMEhBQWdGO0lBQ2hGLGtGQUFpRDtJQUNqRCw0RUFBd0c7SUFDeEcsd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