source: trip-planner-front/node_modules/@angular/compiler-cli/ngcc/src/packages/entry_point_manifest.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: 27.2 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/packages/entry_point_manifest", ["require", "exports", "tslib", "crypto", "@angular/compiler-cli/ngcc/src/packages/build_marker", "@angular/compiler-cli/ngcc/src/packages/entry_point"], factory);
8 }
9})(function (require, exports) {
10 "use strict";
11 Object.defineProperty(exports, "__esModule", { value: true });
12 exports.InvalidatingEntryPointManifest = exports.EntryPointManifest = void 0;
13 var tslib_1 = require("tslib");
14 /**
15 * @license
16 * Copyright Google LLC All Rights Reserved.
17 *
18 * Use of this source code is governed by an MIT-style license that can be
19 * found in the LICENSE file at https://angular.io/license
20 */
21 var crypto_1 = require("crypto");
22 var build_marker_1 = require("@angular/compiler-cli/ngcc/src/packages/build_marker");
23 var entry_point_1 = require("@angular/compiler-cli/ngcc/src/packages/entry_point");
24 /**
25 * Manages reading and writing a manifest file that contains a list of all the entry-points that
26 * were found below a given basePath.
27 *
28 * This is a super-set of the entry-points that are actually processed for a given run of ngcc,
29 * since some may already be processed, or excluded if they do not have the required format.
30 */
31 var EntryPointManifest = /** @class */ (function () {
32 function EntryPointManifest(fs, config, logger) {
33 this.fs = fs;
34 this.config = config;
35 this.logger = logger;
36 }
37 /**
38 * Try to get the entry-point info from a manifest file for the given `basePath` if it exists and
39 * is not out of date.
40 *
41 * Reasons for the manifest to be out of date are:
42 *
43 * * the file does not exist
44 * * the ngcc version has changed
45 * * the package lock-file (i.e. yarn.lock or package-lock.json) has changed
46 * * the project configuration has changed
47 * * one or more entry-points in the manifest are not valid
48 *
49 * @param basePath The path that would contain the entry-points and the manifest file.
50 * @returns an array of entry-point information for all entry-points found below the given
51 * `basePath` or `null` if the manifest was out of date.
52 */
53 EntryPointManifest.prototype.readEntryPointsUsingManifest = function (basePath) {
54 var e_1, _a;
55 try {
56 if (this.fs.basename(basePath) !== 'node_modules') {
57 return null;
58 }
59 var manifestPath = this.getEntryPointManifestPath(basePath);
60 if (!this.fs.exists(manifestPath)) {
61 return null;
62 }
63 var computedLockFileHash = this.computeLockFileHash(basePath);
64 if (computedLockFileHash === null) {
65 return null;
66 }
67 var _b = JSON.parse(this.fs.readFile(manifestPath)), ngccVersion = _b.ngccVersion, configFileHash = _b.configFileHash, lockFileHash = _b.lockFileHash, entryPointPaths = _b.entryPointPaths;
68 if (ngccVersion !== build_marker_1.NGCC_VERSION || configFileHash !== this.config.hash ||
69 lockFileHash !== computedLockFileHash) {
70 return null;
71 }
72 this.logger.debug("Entry-point manifest found for " + basePath + " so loading entry-point information directly.");
73 var startTime = Date.now();
74 var entryPoints = [];
75 try {
76 for (var entryPointPaths_1 = tslib_1.__values(entryPointPaths), entryPointPaths_1_1 = entryPointPaths_1.next(); !entryPointPaths_1_1.done; entryPointPaths_1_1 = entryPointPaths_1.next()) {
77 var _c = tslib_1.__read(entryPointPaths_1_1.value, 5), packagePath = _c[0], entryPointPath = _c[1], _d = _c[2], dependencyPaths = _d === void 0 ? [] : _d, _e = _c[3], missingPaths = _e === void 0 ? [] : _e, _f = _c[4], deepImportPaths = _f === void 0 ? [] : _f;
78 var result = entry_point_1.getEntryPointInfo(this.fs, this.config, this.logger, this.fs.resolve(basePath, packagePath), this.fs.resolve(basePath, entryPointPath));
79 if (!entry_point_1.isEntryPoint(result)) {
80 throw new Error("The entry-point manifest at " + manifestPath + " contained an invalid pair of package paths: [" + packagePath + ", " + entryPointPath + "]");
81 }
82 else {
83 entryPoints.push({
84 entryPoint: result,
85 depInfo: {
86 dependencies: new Set(dependencyPaths),
87 missing: new Set(missingPaths),
88 deepImports: new Set(deepImportPaths),
89 }
90 });
91 }
92 }
93 }
94 catch (e_1_1) { e_1 = { error: e_1_1 }; }
95 finally {
96 try {
97 if (entryPointPaths_1_1 && !entryPointPaths_1_1.done && (_a = entryPointPaths_1.return)) _a.call(entryPointPaths_1);
98 }
99 finally { if (e_1) throw e_1.error; }
100 }
101 var duration = Math.round((Date.now() - startTime) / 100) / 10;
102 this.logger.debug("Reading entry-points using the manifest entries took " + duration + "s.");
103 return entryPoints;
104 }
105 catch (e) {
106 this.logger.warn("Unable to read the entry-point manifest for " + basePath + ":\n", e.stack || e.toString());
107 return null;
108 }
109 };
110 /**
111 * Write a manifest file at the given `basePath`.
112 *
113 * The manifest includes the current ngcc version and hashes of the package lock-file and current
114 * project config. These will be used to check whether the manifest file is out of date. See
115 * `readEntryPointsUsingManifest()`.
116 *
117 * @param basePath The path where the manifest file is to be written.
118 * @param entryPoints A collection of entry-points to record in the manifest.
119 */
120 EntryPointManifest.prototype.writeEntryPointManifest = function (basePath, entryPoints) {
121 var _this = this;
122 if (this.fs.basename(basePath) !== 'node_modules') {
123 return;
124 }
125 var lockFileHash = this.computeLockFileHash(basePath);
126 if (lockFileHash === null) {
127 return;
128 }
129 var manifest = {
130 ngccVersion: build_marker_1.NGCC_VERSION,
131 configFileHash: this.config.hash,
132 lockFileHash: lockFileHash,
133 entryPointPaths: entryPoints.map(function (e) {
134 var entryPointPaths = [
135 _this.fs.relative(basePath, e.entryPoint.packagePath),
136 _this.fs.relative(basePath, e.entryPoint.path),
137 ];
138 // Only add depInfo arrays if needed.
139 if (e.depInfo.dependencies.size > 0) {
140 entryPointPaths[2] = Array.from(e.depInfo.dependencies);
141 }
142 else if (e.depInfo.missing.size > 0 || e.depInfo.deepImports.size > 0) {
143 entryPointPaths[2] = [];
144 }
145 if (e.depInfo.missing.size > 0) {
146 entryPointPaths[3] = Array.from(e.depInfo.missing);
147 }
148 else if (e.depInfo.deepImports.size > 0) {
149 entryPointPaths[3] = [];
150 }
151 if (e.depInfo.deepImports.size > 0) {
152 entryPointPaths[4] = Array.from(e.depInfo.deepImports);
153 }
154 return entryPointPaths;
155 }),
156 };
157 this.fs.writeFile(this.getEntryPointManifestPath(basePath), JSON.stringify(manifest));
158 };
159 EntryPointManifest.prototype.getEntryPointManifestPath = function (basePath) {
160 return this.fs.resolve(basePath, '__ngcc_entry_points__.json');
161 };
162 EntryPointManifest.prototype.computeLockFileHash = function (basePath) {
163 var e_2, _a;
164 var directory = this.fs.dirname(basePath);
165 try {
166 for (var _b = tslib_1.__values(['yarn.lock', 'package-lock.json']), _c = _b.next(); !_c.done; _c = _b.next()) {
167 var lockFileName = _c.value;
168 var lockFilePath = this.fs.resolve(directory, lockFileName);
169 if (this.fs.exists(lockFilePath)) {
170 var lockFileContents = this.fs.readFile(lockFilePath);
171 return crypto_1.createHash(this.config.hashAlgorithm).update(lockFileContents).digest('hex');
172 }
173 }
174 }
175 catch (e_2_1) { e_2 = { error: e_2_1 }; }
176 finally {
177 try {
178 if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
179 }
180 finally { if (e_2) throw e_2.error; }
181 }
182 return null;
183 };
184 return EntryPointManifest;
185 }());
186 exports.EntryPointManifest = EntryPointManifest;
187 /**
188 * A specialized implementation of the `EntryPointManifest` that can be used to invalidate the
189 * current manifest file.
190 *
191 * It always returns `null` from the `readEntryPointsUsingManifest()` method, which forces a new
192 * manifest to be created, which will overwrite the current file when `writeEntryPointManifest()`
193 * is called.
194 */
195 var InvalidatingEntryPointManifest = /** @class */ (function (_super) {
196 tslib_1.__extends(InvalidatingEntryPointManifest, _super);
197 function InvalidatingEntryPointManifest() {
198 return _super !== null && _super.apply(this, arguments) || this;
199 }
200 InvalidatingEntryPointManifest.prototype.readEntryPointsUsingManifest = function (_basePath) {
201 return null;
202 };
203 return InvalidatingEntryPointManifest;
204 }(EntryPointManifest));
205 exports.InvalidatingEntryPointManifest = InvalidatingEntryPointManifest;
206});
207//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW50cnlfcG9pbnRfbWFuaWZlc3QuanMiLCJzb3Vy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Qb2ludEluZm8oXG4gICAgICAgICAgICB0aGlzLmZzLCB0aGlzLmNvbmZpZywgdGhpcy5sb2dnZXIsIHRoaXMuZnMucmVzb2x2ZShiYXNlUGF0aCwgcGFja2FnZVBhdGgpLFxuICAgICAgICAgICAgdGhpcy5mcy5yZXNvbHZlKGJhc2VQYXRoLCBlbnRyeVBvaW50UGF0aCkpO1xuICAgICAgICBpZiAoIWlzRW50cnlQb2ludChyZXN1bHQpKSB7XG4gICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBUaGUgZW50cnktcG9pbnQgbWFuaWZlc3QgYXQgJHtcbiAgICAgICAgICAgICAgbWFuaWZlc3RQYXRofSBjb250YWluZWQgYW4gaW52YWxpZCBwYWlyIG9mIHBhY2thZ2UgcGF0aHM6IFske3BhY2thZ2VQYXRofSwgJHtcbiAgICAgICAgICAgICAgZW50cnlQb2ludFBhdGh9XWApO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIGVudHJ5UG9pbnRzLnB1c2goe1xuICAgICAgICAgICAgZW50cnlQb2ludDogcmVzdWx0LFxuICAgICAgICAgICAgZGVwSW5mbzoge1xuICAgICAgICAgICAgICBkZXBlbmRlbmNpZXM6IG5ldyBTZXQoZGVwZW5kZW5jeVBhdGhzKSxcbiAgICAgICAgICAgICAgbWlzc2luZzogbmV3IFNldChtaXNzaW5nUGF0aHMpLFxuICAgICAgICAgICAgICBkZWVwSW1wb3J0czogbmV3IFNldChkZWVwSW1wb3J0UGF0aHMpLFxuICAgICAgICAgICAgfVxuICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICBjb25zdCBkdXJhdGlvbiA9IE1hdGgucm91bmQoKERhdGUubm93KCkgLSBzdGFydFRpbWUpIC8gMTAwKSAvIDEwO1xuICAgICAgdGhpcy5sb2dnZXIuZGVidWcoYFJlYWRpbmcgZW50cnktcG9pbnRzIHVzaW5nIHRoZSBtYW5pZmVzdCBlbnRyaWVzIHRvb2sgJHtkdXJhdGl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