source: trip-planner-front/node_modules/@angular/compiler-cli/ngcc/src/packages/configuration.js@ 76712b2

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

initial commit

  • Property mode set to 100644
File size: 46.0 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/configuration", ["require", "exports", "tslib", "crypto", "semver", "vm"], factory);
8 }
9})(function (require, exports) {
10 "use strict";
11 Object.defineProperty(exports, "__esModule", { value: true });
12 exports.NgccConfiguration = exports.ProcessedNgccPackageConfig = exports.DEFAULT_NGCC_CONFIG = exports.PartiallyProcessedConfig = 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 semver_1 = require("semver");
23 var vm = require("vm");
24 /**
25 * The internal representation of a configuration file. Configured packages are transformed into
26 * `ProcessedNgccPackageConfig` when a certain version is requested.
27 */
28 var PartiallyProcessedConfig = /** @class */ (function () {
29 function PartiallyProcessedConfig(projectConfig) {
30 /**
31 * The packages that are configured by this project config, keyed by package name.
32 */
33 this.packages = new Map();
34 /**
35 * Options that control how locking the process is handled.
36 */
37 this.locking = {};
38 /**
39 * Name of hash algorithm used to generate hashes of the configuration.
40 *
41 * Defaults to `sha256`.
42 */
43 this.hashAlgorithm = 'sha256';
44 // locking configuration
45 if (projectConfig.locking !== undefined) {
46 this.locking = projectConfig.locking;
47 }
48 // packages configuration
49 for (var packageNameAndVersion in projectConfig.packages) {
50 var packageConfig = projectConfig.packages[packageNameAndVersion];
51 if (packageConfig) {
52 var _a = tslib_1.__read(this.splitNameAndVersion(packageNameAndVersion), 2), packageName = _a[0], _b = _a[1], versionRange = _b === void 0 ? '*' : _b;
53 this.addPackageConfig(packageName, tslib_1.__assign(tslib_1.__assign({}, packageConfig), { versionRange: versionRange }));
54 }
55 }
56 // hash algorithm config
57 if (projectConfig.hashAlgorithm !== undefined) {
58 this.hashAlgorithm = projectConfig.hashAlgorithm;
59 }
60 }
61 PartiallyProcessedConfig.prototype.splitNameAndVersion = function (packageNameAndVersion) {
62 var versionIndex = packageNameAndVersion.lastIndexOf('@');
63 // Note that > 0 is because we don't want to match @ at the start of the line
64 // which is what you would have with a namespaced package, e.g. `@angular/common`.
65 return versionIndex > 0 ?
66 [
67 packageNameAndVersion.substring(0, versionIndex),
68 packageNameAndVersion.substring(versionIndex + 1),
69 ] :
70 [packageNameAndVersion, undefined];
71 };
72 /**
73 * Registers the configuration for a particular version of the provided package.
74 */
75 PartiallyProcessedConfig.prototype.addPackageConfig = function (packageName, config) {
76 if (!this.packages.has(packageName)) {
77 this.packages.set(packageName, []);
78 }
79 this.packages.get(packageName).push(config);
80 };
81 /**
82 * Finds the configuration for a particular version of the provided package.
83 */
84 PartiallyProcessedConfig.prototype.findPackageConfig = function (packageName, version) {
85 var _a;
86 if (!this.packages.has(packageName)) {
87 return null;
88 }
89 var configs = this.packages.get(packageName);
90 if (version === null) {
91 // The package has no version (!) - perhaps the entry-point was from a deep import, which made
92 // it impossible to find the package.json.
93 // So just return the first config that matches the package name.
94 return configs[0];
95 }
96 return (_a = configs.find(function (config) { return semver_1.satisfies(version, config.versionRange, { includePrerelease: true }); })) !== null && _a !== void 0 ? _a : null;
97 };
98 /**
99 * Converts the configuration into a JSON representation that is used to compute a hash of the
100 * configuration.
101 */
102 PartiallyProcessedConfig.prototype.toJson = function () {
103 return JSON.stringify(this, function (key, value) {
104 var e_1, _a;
105 if (value instanceof Map) {
106 var res = {};
107 try {
108 for (var value_1 = tslib_1.__values(value), value_1_1 = value_1.next(); !value_1_1.done; value_1_1 = value_1.next()) {
109 var _b = tslib_1.__read(value_1_1.value, 2), k = _b[0], v = _b[1];
110 res[k] = v;
111 }
112 }
113 catch (e_1_1) { e_1 = { error: e_1_1 }; }
114 finally {
115 try {
116 if (value_1_1 && !value_1_1.done && (_a = value_1.return)) _a.call(value_1);
117 }
118 finally { if (e_1) throw e_1.error; }
119 }
120 return res;
121 }
122 else {
123 return value;
124 }
125 });
126 };
127 return PartiallyProcessedConfig;
128 }());
129 exports.PartiallyProcessedConfig = PartiallyProcessedConfig;
130 /**
131 * The default configuration for ngcc.
132 *
133 * This is the ultimate fallback configuration that ngcc will use if there is no configuration
134 * for a package at the package level or project level.
135 *
136 * This configuration is for packages that are "dead" - i.e. no longer maintained and so are
137 * unlikely to be fixed to work with ngcc, nor provide a package level config of their own.
138 *
139 * The fallback process for looking up configuration is:
140 *
141 * Project -> Package -> Default
142 *
143 * If a package provides its own configuration then that would override this default one.
144 *
145 * Also application developers can always provide configuration at their project level which
146 * will override everything else.
147 *
148 * Note that the fallback is package based not entry-point based.
149 * For example, if a there is configuration for a package at the project level this will replace all
150 * entry-point configurations that may have been provided in the package level or default level
151 * configurations, even if the project level configuration does not provide for a given entry-point.
152 */
153 exports.DEFAULT_NGCC_CONFIG = {
154 packages: {
155 // Add default package configuration here. For example:
156 // '@angular/fire@^5.2.0': {
157 // entryPoints: {
158 // './database-deprecated': {ignore: true},
159 // },
160 // },
161 // The package does not contain any `.metadata.json` files in the root directory but only inside
162 // `dist/`. Without this config, ngcc does not realize this is a ViewEngine-built Angular
163 // package that needs to be compiled to Ivy.
164 'angular2-highcharts': {
165 entryPoints: {
166 '.': {
167 override: {
168 main: './index.js',
169 },
170 },
171 },
172 },
173 // The `dist/` directory has a duplicate `package.json` pointing to the same files, which (under
174 // certain configurations) can causes ngcc to try to process the files twice and fail.
175 // Ignore the `dist/` entry-point.
176 'ng2-dragula': {
177 entryPoints: {
178 './dist': { ignore: true },
179 },
180 },
181 },
182 locking: {
183 retryDelay: 500,
184 retryAttempts: 500,
185 }
186 };
187 var NGCC_CONFIG_FILENAME = 'ngcc.config.js';
188 /**
189 * The processed package level configuration as a result of processing a raw package level config.
190 */
191 var ProcessedNgccPackageConfig = /** @class */ (function () {
192 function ProcessedNgccPackageConfig(fs, packagePath, _a) {
193 var _b = _a.entryPoints, entryPoints = _b === void 0 ? {} : _b, _c = _a.ignorableDeepImportMatchers, ignorableDeepImportMatchers = _c === void 0 ? [] : _c;
194 var absolutePathEntries = Object.entries(entryPoints).map(function (_a) {
195 var _b = tslib_1.__read(_a, 2), relativePath = _b[0], config = _b[1];
196 return [fs.resolve(packagePath, relativePath), config];
197 });
198 this.packagePath = packagePath;
199 this.entryPoints = new Map(absolutePathEntries);
200 this.ignorableDeepImportMatchers = ignorableDeepImportMatchers;
201 }
202 return ProcessedNgccPackageConfig;
203 }());
204 exports.ProcessedNgccPackageConfig = ProcessedNgccPackageConfig;
205 /**
206 * Ngcc has a hierarchical configuration system that lets us "fix up" packages that do not
207 * work with ngcc out of the box.
208 *
209 * There are three levels at which configuration can be declared:
210 *
211 * * Default level - ngcc comes with built-in configuration for well known cases.
212 * * Package level - a library author publishes a configuration with their package to fix known
213 * issues.
214 * * Project level - the application developer provides a configuration that fixes issues specific
215 * to the libraries used in their application.
216 *
217 * Ngcc will match configuration based on the package name but also on its version. This allows
218 * configuration to provide different fixes to different version ranges of a package.
219 *
220 * * Package level configuration is specific to the package version where the configuration is
221 * found.
222 * * Default and project level configuration should provide version ranges to ensure that the
223 * configuration is only applied to the appropriate versions of a package.
224 *
225 * When getting a configuration for a package (via `getConfig()`) the caller should provide the
226 * version of the package in question, if available. If it is not provided then the first available
227 * configuration for a package is returned.
228 */
229 var NgccConfiguration = /** @class */ (function () {
230 function NgccConfiguration(fs, baseDir) {
231 this.fs = fs;
232 this.cache = new Map();
233 this.defaultConfig = new PartiallyProcessedConfig(exports.DEFAULT_NGCC_CONFIG);
234 this.projectConfig = new PartiallyProcessedConfig(this.loadProjectConfig(baseDir));
235 this.hashAlgorithm = this.projectConfig.hashAlgorithm;
236 this.hash = this.computeHash();
237 }
238 /**
239 * Get the configuration options for locking the ngcc process.
240 */
241 NgccConfiguration.prototype.getLockingConfig = function () {
242 var _a = this.projectConfig.locking, retryAttempts = _a.retryAttempts, retryDelay = _a.retryDelay;
243 if (retryAttempts === undefined) {
244 retryAttempts = this.defaultConfig.locking.retryAttempts;
245 }
246 if (retryDelay === undefined) {
247 retryDelay = this.defaultConfig.locking.retryDelay;
248 }
249 return { retryAttempts: retryAttempts, retryDelay: retryDelay };
250 };
251 /**
252 * Get a configuration for the given `version` of a package at `packagePath`.
253 *
254 * @param packageName The name of the package whose config we want.
255 * @param packagePath The path to the package whose config we want.
256 * @param version The version of the package whose config we want, or `null` if the package's
257 * package.json did not exist or was invalid.
258 */
259 NgccConfiguration.prototype.getPackageConfig = function (packageName, packagePath, version) {
260 var rawPackageConfig = this.getRawPackageConfig(packageName, packagePath, version);
261 return new ProcessedNgccPackageConfig(this.fs, packagePath, rawPackageConfig);
262 };
263 NgccConfiguration.prototype.getRawPackageConfig = function (packageName, packagePath, version) {
264 var cacheKey = packageName + (version !== null ? "@" + version : '');
265 if (this.cache.has(cacheKey)) {
266 return this.cache.get(cacheKey);
267 }
268 var projectLevelConfig = this.projectConfig.findPackageConfig(packageName, version);
269 if (projectLevelConfig !== null) {
270 this.cache.set(cacheKey, projectLevelConfig);
271 return projectLevelConfig;
272 }
273 var packageLevelConfig = this.loadPackageConfig(packagePath, version);
274 if (packageLevelConfig !== null) {
275 this.cache.set(cacheKey, packageLevelConfig);
276 return packageLevelConfig;
277 }
278 var defaultLevelConfig = this.defaultConfig.findPackageConfig(packageName, version);
279 if (defaultLevelConfig !== null) {
280 this.cache.set(cacheKey, defaultLevelConfig);
281 return defaultLevelConfig;
282 }
283 return { versionRange: '*' };
284 };
285 NgccConfiguration.prototype.loadProjectConfig = function (baseDir) {
286 var configFilePath = this.fs.join(baseDir, NGCC_CONFIG_FILENAME);
287 if (this.fs.exists(configFilePath)) {
288 try {
289 return this.evalSrcFile(configFilePath);
290 }
291 catch (e) {
292 throw new Error("Invalid project configuration file at \"" + configFilePath + "\": " + e.message);
293 }
294 }
295 else {
296 return { packages: {} };
297 }
298 };
299 NgccConfiguration.prototype.loadPackageConfig = function (packagePath, version) {
300 var configFilePath = this.fs.join(packagePath, NGCC_CONFIG_FILENAME);
301 if (this.fs.exists(configFilePath)) {
302 try {
303 var packageConfig = this.evalSrcFile(configFilePath);
304 return tslib_1.__assign(tslib_1.__assign({}, packageConfig), { versionRange: version || '*' });
305 }
306 catch (e) {
307 throw new Error("Invalid package configuration file at \"" + configFilePath + "\": " + e.message);
308 }
309 }
310 else {
311 return null;
312 }
313 };
314 NgccConfiguration.prototype.evalSrcFile = function (srcPath) {
315 var src = this.fs.readFile(srcPath);
316 var theExports = {};
317 var sandbox = {
318 module: { exports: theExports },
319 exports: theExports,
320 require: require,
321 __dirname: this.fs.dirname(srcPath),
322 __filename: srcPath
323 };
324 vm.runInNewContext(src, sandbox, { filename: srcPath });
325 return sandbox.module.exports;
326 };
327 NgccConfiguration.prototype.computeHash = function () {
328 return crypto_1.createHash(this.hashAlgorithm).update(this.projectConfig.toJson()).digest('hex');
329 };
330 return NgccConfiguration;
331 }());
332 exports.NgccConfiguration = NgccConfiguration;
333});
334//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlndXJhdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyLWNsaS9uZ2NjL3NyYy9wYWNrYWdlcy9jb25maWd1cmF0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7SUFBQTs7Ozs7O09BTUc7SUFDSCxpQ0FBa0M7SUFDbEMsaUNBQWlDO0lBQ2pDLHVCQUF5QjtJQStGekI7OztPQUdHO0lBQ0g7UUFnQkUsa0NBQVksYUFBZ0M7WUFmNUM7O2VBRUc7WUFDSCxhQUFRL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