source: trip-planner-front/node_modules/@angular-devkit/build-angular/src/utils/environment-options.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: 4.2 KB
Line 
1"use strict";
2/**
3 * @license
4 * Copyright Google LLC All Rights Reserved.
5 *
6 * Use of this source code is governed by an MIT-style license that can be
7 * found in the LICENSE file at https://angular.io/license
8 */
9var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10 if (k2 === undefined) k2 = k;
11 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12}) : (function(o, m, k, k2) {
13 if (k2 === undefined) k2 = k;
14 o[k2] = m[k];
15}));
16var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17 Object.defineProperty(o, "default", { enumerable: true, value: v });
18}) : function(o, v) {
19 o["default"] = v;
20});
21var __importStar = (this && this.__importStar) || function (mod) {
22 if (mod && mod.__esModule) return mod;
23 var result = {};
24 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25 __setModuleDefault(result, mod);
26 return result;
27};
28Object.defineProperty(exports, "__esModule", { value: true });
29exports.maxWorkers = exports.profilingEnabled = exports.persistentBuildCacheEnabled = exports.cachingBasePath = exports.cachingDisabled = exports.allowMinify = exports.shouldBeautify = exports.allowMangle = void 0;
30const path = __importStar(require("path"));
31function isDisabled(variable) {
32 return variable === '0' || variable.toLowerCase() === 'false';
33}
34function isEnabled(variable) {
35 return variable === '1' || variable.toLowerCase() === 'true';
36}
37function isPresent(variable) {
38 return typeof variable === 'string' && variable !== '';
39}
40// Optimization and mangling
41const debugOptimizeVariable = process.env['NG_BUILD_DEBUG_OPTIMIZE'];
42const debugOptimize = (() => {
43 if (!isPresent(debugOptimizeVariable) || isDisabled(debugOptimizeVariable)) {
44 return {
45 mangle: true,
46 minify: true,
47 beautify: false,
48 };
49 }
50 const debugValue = {
51 mangle: false,
52 minify: false,
53 beautify: true,
54 };
55 if (isEnabled(debugOptimizeVariable)) {
56 return debugValue;
57 }
58 for (const part of debugOptimizeVariable.split(',')) {
59 switch (part.trim().toLowerCase()) {
60 case 'mangle':
61 debugValue.mangle = true;
62 break;
63 case 'minify':
64 debugValue.minify = true;
65 break;
66 case 'beautify':
67 debugValue.beautify = true;
68 break;
69 }
70 }
71 return debugValue;
72})();
73const mangleVariable = process.env['NG_BUILD_MANGLE'];
74exports.allowMangle = isPresent(mangleVariable)
75 ? !isDisabled(mangleVariable)
76 : debugOptimize.mangle;
77exports.shouldBeautify = debugOptimize.beautify;
78exports.allowMinify = debugOptimize.minify;
79// Build cache
80const cacheVariable = process.env['NG_BUILD_CACHE'];
81exports.cachingDisabled = isPresent(cacheVariable) && isDisabled(cacheVariable);
82exports.cachingBasePath = (() => {
83 if (exports.cachingDisabled || !isPresent(cacheVariable) || isEnabled(cacheVariable)) {
84 return null;
85 }
86 if (!path.isAbsolute(cacheVariable)) {
87 throw new Error('NG_BUILD_CACHE path value must be absolute.');
88 }
89 return cacheVariable;
90})();
91// Persistent build cache
92const persistentBuildCacheVariable = process.env['NG_PERSISTENT_BUILD_CACHE'];
93exports.persistentBuildCacheEnabled = !exports.cachingDisabled &&
94 isPresent(persistentBuildCacheVariable) &&
95 isEnabled(persistentBuildCacheVariable);
96// Build profiling
97const profilingVariable = process.env['NG_BUILD_PROFILING'];
98exports.profilingEnabled = isPresent(profilingVariable) && isEnabled(profilingVariable);
99/**
100 * Some environments, like CircleCI which use Docker report a number of CPUs by the host and not the count of available.
101 * This cause `Error: Call retries were exceeded` errors when trying to use them.
102 *
103 * @see https://github.com/nodejs/node/issues/28762
104 * @see https://github.com/webpack-contrib/terser-webpack-plugin/issues/143
105 * @see https://ithub.com/angular/angular-cli/issues/16860#issuecomment-588828079
106 *
107 */
108const maxWorkersVariable = process.env['NG_BUILD_MAX_WORKERS'];
109exports.maxWorkers = isPresent(maxWorkersVariable) ? +maxWorkersVariable : 4;
Note: See TracBrowser for help on using the repository browser.