source: trip-planner-front/node_modules/@angular/compiler-cli/ngcc/src/execution/tasks/completion.js

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

initial commit

  • Property mode set to 100644
File size: 11.5 KB
Line 
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/execution/tasks/completion", ["require", "exports", "tslib", "@angular/compiler-cli/ngcc/src/packages/build_marker", "@angular/compiler-cli/ngcc/src/packages/entry_point", "@angular/compiler-cli/ngcc/src/execution/tasks/api"], factory);
8 }
9})(function (require, exports) {
10 "use strict";
11 Object.defineProperty(exports, "__esModule", { value: true });
12 exports.createLogErrorHandler = exports.createThrowErrorHandler = exports.createMarkAsProcessedHandler = exports.composeTaskCompletedCallbacks = void 0;
13 var tslib_1 = require("tslib");
14 var build_marker_1 = require("@angular/compiler-cli/ngcc/src/packages/build_marker");
15 var entry_point_1 = require("@angular/compiler-cli/ngcc/src/packages/entry_point");
16 var api_1 = require("@angular/compiler-cli/ngcc/src/execution/tasks/api");
17 /**
18 * Compose a group of TaskCompletedHandlers into a single TaskCompletedCallback.
19 *
20 * The compose callback will receive an outcome and will delegate to the appropriate handler based
21 * on this outcome.
22 *
23 * @param callbacks a map of outcomes to handlers.
24 */
25 function composeTaskCompletedCallbacks(callbacks) {
26 return function (task, outcome, message) {
27 var callback = callbacks[outcome];
28 if (callback === undefined) {
29 throw new Error("Unknown task outcome: \"" + outcome + "\" - supported outcomes: " + JSON.stringify(Object.keys(callbacks)));
30 }
31 callback(task, message);
32 };
33 }
34 exports.composeTaskCompletedCallbacks = composeTaskCompletedCallbacks;
35 /**
36 * Create a handler that will mark the entry-points in a package as being processed.
37 *
38 * @param pkgJsonUpdater The service used to update the package.json
39 */
40 function createMarkAsProcessedHandler(fs, pkgJsonUpdater) {
41 return function (task) {
42 var entryPoint = task.entryPoint, formatPropertiesToMarkAsProcessed = task.formatPropertiesToMarkAsProcessed, processDts = task.processDts;
43 var packageJsonPath = fs.resolve(entryPoint.path, 'package.json');
44 var propsToMarkAsProcessed = tslib_1.__spreadArray([], tslib_1.__read(formatPropertiesToMarkAsProcessed));
45 if (processDts !== api_1.DtsProcessing.No) {
46 propsToMarkAsProcessed.push('typings');
47 }
48 build_marker_1.markAsProcessed(pkgJsonUpdater, entryPoint.packageJson, packageJsonPath, propsToMarkAsProcessed);
49 };
50 }
51 exports.createMarkAsProcessedHandler = createMarkAsProcessedHandler;
52 /**
53 * Create a handler that will throw an error.
54 */
55 function createThrowErrorHandler(fs) {
56 return function (task, message) {
57 throw new Error(createErrorMessage(fs, task, message));
58 };
59 }
60 exports.createThrowErrorHandler = createThrowErrorHandler;
61 /**
62 * Create a handler that logs an error and marks the task as failed.
63 */
64 function createLogErrorHandler(logger, fs, taskQueue) {
65 return function (task, message) {
66 taskQueue.markAsFailed(task);
67 logger.error(createErrorMessage(fs, task, message));
68 };
69 }
70 exports.createLogErrorHandler = createLogErrorHandler;
71 function createErrorMessage(fs, task, message) {
72 var _a;
73 var jsFormat = "`" + task.formatProperty + "` as " + ((_a = entry_point_1.getEntryPointFormat(fs, task.entryPoint, task.formatProperty)) !== null && _a !== void 0 ? _a : 'unknown format');
74 var format = task.typingsOnly ? "typings only using " + jsFormat : jsFormat;
75 message = message !== null ? " due to " + message : '';
76 return "Failed to compile entry-point " + task.entryPoint.name + " (" + format + ")" + message;
77 }
78});
79//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcGxldGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyLWNsaS9uZ2NjL3NyYy9leGVjdXRpb24vdGFza3MvY29tcGxldGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Oz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