1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
10 | exports.maxWorkers = exports.profilingEnabled = exports.cachingBasePath = exports.cachingDisabled = exports.allowMinify = exports.shouldBeautify = exports.allowMangle = void 0;
|
11 | const path = require("path");
|
12 | function isDisabled(variable) {
|
13 | return variable === '0' || variable.toLowerCase() === 'false';
|
14 | }
|
15 | function isEnabled(variable) {
|
16 | return variable === '1' || variable.toLowerCase() === 'true';
|
17 | }
|
18 | function isPresent(variable) {
|
19 | return typeof variable === 'string' && variable !== '';
|
20 | }
|
21 |
|
22 | const debugOptimizeVariable = process.env['NG_BUILD_DEBUG_OPTIMIZE'];
|
23 | const debugOptimize = (() => {
|
24 | if (!isPresent(debugOptimizeVariable) || isDisabled(debugOptimizeVariable)) {
|
25 | return {
|
26 | mangle: true,
|
27 | minify: true,
|
28 | beautify: false,
|
29 | };
|
30 | }
|
31 | const debugValue = {
|
32 | mangle: false,
|
33 | minify: false,
|
34 | beautify: true,
|
35 | };
|
36 | if (isEnabled(debugOptimizeVariable)) {
|
37 | return debugValue;
|
38 | }
|
39 | for (const part of debugOptimizeVariable.split(',')) {
|
40 | switch (part.trim().toLowerCase()) {
|
41 | case 'mangle':
|
42 | debugValue.mangle = true;
|
43 | break;
|
44 | case 'minify':
|
45 | debugValue.minify = true;
|
46 | break;
|
47 | case 'beautify':
|
48 | debugValue.beautify = true;
|
49 | break;
|
50 | }
|
51 | }
|
52 | return debugValue;
|
53 | })();
|
54 | const mangleVariable = process.env['NG_BUILD_MANGLE'];
|
55 | exports.allowMangle = isPresent(mangleVariable)
|
56 | ? !isDisabled(mangleVariable)
|
57 | : debugOptimize.mangle;
|
58 | exports.shouldBeautify = debugOptimize.beautify;
|
59 | exports.allowMinify = debugOptimize.minify;
|
60 |
|
61 | const cacheVariable = process.env['NG_BUILD_CACHE'];
|
62 | exports.cachingDisabled = isPresent(cacheVariable) && isDisabled(cacheVariable);
|
63 | exports.cachingBasePath = (() => {
|
64 | if (exports.cachingDisabled || !isPresent(cacheVariable) || isEnabled(cacheVariable)) {
|
65 | return null;
|
66 | }
|
67 | if (!path.isAbsolute(cacheVariable)) {
|
68 | throw new Error('NG_BUILD_CACHE path value must be absolute.');
|
69 | }
|
70 | return cacheVariable;
|
71 | })();
|
72 |
|
73 | const profilingVariable = process.env['NG_BUILD_PROFILING'];
|
74 | exports.profilingEnabled = isPresent(profilingVariable) && isEnabled(profilingVariable);
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 | const maxWorkersVariable = process.env['NG_BUILD_MAX_WORKERS'];
|
85 | exports.maxWorkers = isPresent(maxWorkersVariable) ? +maxWorkersVariable : 4;
|