source: trip-planner-front/node_modules/@schematics/angular/migrations/update-11/update-angular-config.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: 2.7 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 */
9Object.defineProperty(exports, "__esModule", { value: true });
10const core_1 = require("@angular-devkit/core");
11const workspace_1 = require("../../utility/workspace");
12function default_1() {
13 return workspace_1.updateWorkspace((workspace) => {
14 const optionsToRemove = {
15 environment: undefined,
16 extractCss: undefined,
17 tsconfigFileName: undefined,
18 rebaseRootRelativeCssUrls: undefined,
19 };
20 for (const [, project] of workspace.projects) {
21 for (const [, target] of project.targets) {
22 // Only interested in Angular Devkit builders
23 if (!(target === null || target === void 0 ? void 0 : target.builder.startsWith('@angular-devkit/build-angular'))) {
24 continue;
25 }
26 // Check options
27 if (target.options) {
28 target.options = {
29 ...updateLazyScriptsStyleOption(target.options),
30 ...optionsToRemove,
31 };
32 }
33 // Go through each configuration entry
34 if (!target.configurations) {
35 continue;
36 }
37 for (const configurationName of Object.keys(target.configurations)) {
38 target.configurations[configurationName] = {
39 ...updateLazyScriptsStyleOption(target.configurations[configurationName]),
40 ...optionsToRemove,
41 };
42 }
43 }
44 }
45 });
46}
47exports.default = default_1;
48function updateLazyScriptsStyleOption(options) {
49 function visitor(options, type) {
50 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
51 if (!options[type] || !core_1.isJsonArray(options[type])) {
52 return undefined;
53 }
54 const entries = [];
55 for (const entry of options[type]) {
56 if (core_1.isJsonObject(entry) && 'lazy' in entry) {
57 entries.push({
58 ...entry,
59 inject: !entry.lazy,
60 lazy: undefined,
61 });
62 }
63 else {
64 entries.push(entry);
65 }
66 }
67 return entries;
68 }
69 if (!options) {
70 return undefined;
71 }
72 return {
73 ...options,
74 styles: visitor(options, 'styles'),
75 scripts: visitor(options, 'scripts'),
76 };
77}
Note: See TracBrowser for help on using the repository browser.