UNPKG

2.06 kBJavaScriptView Raw
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 */
9Object.defineProperty(exports, "__esModule", { value: true });
10exports.normalizeBrowserSchema = void 0;
11const normalize_asset_patterns_1 = require("./normalize-asset-patterns");
12const normalize_file_replacements_1 = require("./normalize-file-replacements");
13const normalize_optimization_1 = require("./normalize-optimization");
14const normalize_source_maps_1 = require("./normalize-source-maps");
15function normalizeBrowserSchema(root, projectRoot, sourceRoot, options) {
16 const normalizedSourceMapOptions = normalize_source_maps_1.normalizeSourceMaps(options.sourceMap || false);
17 return {
18 ...options,
19 assets: normalize_asset_patterns_1.normalizeAssetPatterns(options.assets || [], root, projectRoot, sourceRoot),
20 fileReplacements: normalize_file_replacements_1.normalizeFileReplacements(options.fileReplacements || [], root),
21 optimization: normalize_optimization_1.normalizeOptimization(options.optimization),
22 sourceMap: normalizedSourceMapOptions,
23 preserveSymlinks: options.preserveSymlinks === undefined
24 ? process.execArgv.includes('--preserve-symlinks')
25 : options.preserveSymlinks,
26 statsJson: options.statsJson || false,
27 budgets: options.budgets || [],
28 scripts: options.scripts || [],
29 styles: options.styles || [],
30 stylePreprocessorOptions: {
31 includePaths: (options.stylePreprocessorOptions && options.stylePreprocessorOptions.includePaths) || [],
32 },
33 // Using just `--poll` will result in a value of 0 which is very likely not the intention
34 // A value of 0 is falsy and will disable polling rather then enable
35 // 500 ms is a sensible default in this case
36 poll: options.poll === 0 ? 500 : options.poll,
37 };
38}
39exports.normalizeBrowserSchema = normalizeBrowserSchema;