Skip to content

Commit 8fb7e58

Browse files
alan-agius4mgechev
authored andcommittedApr 27, 2020
refactor(@angular-devkit/build-angular): remove deprecated evalSourceMap, vendorSourceMap, profile and skipAppShell options
BREAKING CHANGE: The following deprecated devkit builders options have been removed: - `skipAppShell:` This has no effect - `evalSourceMap`: This done to improve performance in older versions of the CLI and is no longer needed - `vendorSourceMap`: Use `sourceMap.vendor` instead - `profile`: Use `NG_BUILD_PROFILING` environment variable instead
1 parent 254994d commit 8fb7e58

File tree

16 files changed

+26
-181
lines changed

16 files changed

+26
-181
lines changed
 

‎packages/angular/cli/lib/config/schema.json

-34
Original file line numberDiff line numberDiff line change
@@ -765,16 +765,6 @@
765765
}
766766
]
767767
},
768-
"vendorSourceMap": {
769-
"type": "boolean",
770-
"description": "Resolve vendor packages sourcemaps.",
771-
"default": false
772-
},
773-
"evalSourceMap": {
774-
"type": "boolean",
775-
"description": "Output in-file eval sourcemaps.",
776-
"default": false
777-
},
778768
"vendorChunk": {
779769
"type": "boolean",
780770
"description": "Use a separate bundle containing only vendor libraries.",
@@ -892,11 +882,6 @@
892882
"type": "string",
893883
"description": "Path to ngsw-config.json."
894884
},
895-
"skipAppShell": {
896-
"type": "boolean",
897-
"description": "Flag to prevent building an app shell.",
898-
"default": false
899-
},
900885
"index": {
901886
"description": "Configures the generation of the application's HTML index.",
902887
"oneOf": [
@@ -1290,15 +1275,6 @@
12901275
}
12911276
]
12921277
},
1293-
"vendorSourceMap": {
1294-
"type": "boolean",
1295-
"description": "When true, resolve vendor packages sourcemaps.",
1296-
"default": false
1297-
},
1298-
"evalSourceMap": {
1299-
"type": "boolean",
1300-
"description": "When true, output in-file eval sourcemaps."
1301-
},
13021278
"vendorChunk": {
13031279
"type": "boolean",
13041280
"description": "When true, use a separate bundle containing only vendor libraries."
@@ -1807,16 +1783,6 @@
18071783
}
18081784
]
18091785
},
1810-
"vendorSourceMap": {
1811-
"type": "boolean",
1812-
"description": "Resolve vendor packages sourcemaps.",
1813-
"default": false
1814-
},
1815-
"evalSourceMap": {
1816-
"type": "boolean",
1817-
"description": "Output in-file eval sourcemaps.",
1818-
"default": false
1819-
},
18201786
"vendorChunk": {
18211787
"type": "boolean",
18221788
"description": "Use a separate bundle containing only vendor libraries.",

‎packages/angular_devkit/build_angular/src/angular-cli-files/models/build-options.ts

-7
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ export interface BuildOptions {
2929
resourcesOutputPath?: string;
3030
aot?: boolean;
3131
sourceMap: SourceMapClass;
32-
/** @deprecated since version 8. use sourceMap instead. */
33-
vendorSourceMap?: boolean;
34-
/** @deprecated since version 8 */
35-
evalSourceMap?: boolean;
3632
vendorChunk?: boolean;
3733
commonChunk?: boolean;
3834
baseHref?: string;
@@ -63,11 +59,8 @@ export interface BuildOptions {
6359
subresourceIntegrity?: boolean;
6460
serviceWorker?: boolean;
6561
webWorkerTsConfig?: string;
66-
/** @deprecated since version 8 **/
67-
skipAppShell?: boolean;
6862
statsJson: boolean;
6963
forkTypeChecker: boolean;
70-
profile?: boolean;
7164

7265
main: string;
7366
polyfills?: string;

‎packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/browser.ts

+2-15
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,21 @@ export function getBrowserConfig(wco: WebpackConfigOptions): webpack.Configurati
1919
const {
2020
crossOrigin = 'none',
2121
subresourceIntegrity,
22-
evalSourceMap,
2322
extractLicenses,
2423
vendorChunk,
2524
commonChunk,
2625
styles,
2726
allowedCommonJsDependencies,
28-
optimization,
2927
} = buildOptions;
3028

3129
const extraPlugins = [];
3230

33-
let isEval = false;
34-
const { styles: stylesOptimization, scripts: scriptsOptimization } = optimization;
3531
const {
3632
styles: stylesSourceMap,
3733
scripts: scriptsSourceMap,
3834
hidden: hiddenSourceMap,
3935
} = buildOptions.sourceMap;
4036

41-
// See https://webpack.js.org/configuration/devtool/ for sourcemap types.
42-
if ((stylesSourceMap || scriptsSourceMap) &&
43-
evalSourceMap &&
44-
!stylesOptimization &&
45-
!scriptsOptimization) {
46-
// Produce eval sourcemaps for development with serve, which are faster.
47-
isEval = true;
48-
}
49-
5037
if (subresourceIntegrity) {
5138
extraPlugins.push(new SubresourceIntegrityPlugin({
5239
hashFuncNames: ['sha384'],
@@ -59,7 +46,7 @@ export function getBrowserConfig(wco: WebpackConfigOptions): webpack.Configurati
5946
}));
6047
}
6148

62-
if (!isEval && (scriptsSourceMap || stylesSourceMap)) {
49+
if (scriptsSourceMap || stylesSourceMap) {
6350
extraPlugins.push(getSourceMapDevTool(
6451
scriptsSourceMap,
6552
stylesSourceMap,
@@ -78,7 +65,7 @@ export function getBrowserConfig(wco: WebpackConfigOptions): webpack.Configurati
7865
}
7966

8067
return {
81-
devtool: isEval ? 'eval' : false,
68+
devtool: false,
8269
resolve: {
8370
mainFields: [
8471
...(wco.supportES2015 ? ['es2015'] : []),

‎packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
allowMangle,
3535
allowMinify,
3636
cachingDisabled,
37+
profilingEnabled,
3738
shouldBeautify,
3839
} from '../../../utils/environment-options';
3940
import {
@@ -189,7 +190,7 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
189190
}
190191
}
191192

192-
if (buildOptions.profile || process.env['NG_BUILD_PROFILING']) {
193+
if (profilingEnabled) {
193194
extraPlugins.push(
194195
new debug.ProfilingPlugin({
195196
outputPath: path.resolve(root, `chrome-profiler-events${targetInFileName}.json`),

‎packages/angular_devkit/build_angular/src/browser/schema.json

-24
Original file line numberDiff line numberDiff line change
@@ -139,18 +139,6 @@
139139
}
140140
]
141141
},
142-
"vendorSourceMap": {
143-
"type": "boolean",
144-
"description": "Resolve vendor packages sourcemaps.",
145-
"x-deprecated": true,
146-
"default": false
147-
},
148-
"evalSourceMap": {
149-
"type": "boolean",
150-
"description": "Output in-file eval sourcemaps.",
151-
"default": false,
152-
"x-deprecated": true
153-
},
154142
"vendorChunk": {
155143
"type": "boolean",
156144
"description": "Use a separate bundle containing only vendor libraries.",
@@ -284,12 +272,6 @@
284272
"type": "string",
285273
"description": "Path to ngsw-config.json."
286274
},
287-
"skipAppShell": {
288-
"type": "boolean",
289-
"description": "Flag to prevent building an app shell.",
290-
"default": false,
291-
"x-deprecated": true
292-
},
293275
"index": {
294276
"description": "Configures the generation of the application's HTML index.",
295277
"oneOf": [
@@ -344,12 +326,6 @@
344326
},
345327
"default": []
346328
},
347-
"profile": {
348-
"type": "boolean",
349-
"description": "Output profile events for Chrome profiler.",
350-
"default": false,
351-
"x-deprecated": "Use \"NG_BUILD_PROFILING\" environment variable instead."
352-
},
353329
"rebaseRootRelativeCssUrls": {
354330
"description": "Change root relative URLs in stylesheets to include base HREF and deploy URL. Use only for compatibility and transition. The behavior of this option is non-standard and will be removed in the next major release.",
355331
"type": "boolean",

‎packages/angular_devkit/build_angular/src/dev-server/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ const devServerBuildOverriddenKeys: (keyof DevServerBuilderOptions)[] = [
4545
'optimization',
4646
'aot',
4747
'sourceMap',
48-
'vendorSourceMap',
49-
'evalSourceMap',
5048
'vendorChunk',
5149
'commonChunk',
5250
'baseHref',

‎packages/angular_devkit/build_angular/src/dev-server/schema.json

-10
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,6 @@
156156
}
157157
]
158158
},
159-
"vendorSourceMap": {
160-
"type": "boolean",
161-
"description": "Resolve vendor packages sourcemaps.",
162-
"x-deprecated": true
163-
},
164-
"evalSourceMap": {
165-
"type": "boolean",
166-
"description": "Output in-file eval sourcemaps.",
167-
"x-deprecated": true
168-
},
169159
"vendorChunk": {
170160
"type": "boolean",
171161
"description": "Use a separate bundle containing only vendor libraries."

‎packages/angular_devkit/build_angular/src/karma/schema.json

-11
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,6 @@
101101
}
102102
]
103103
},
104-
"vendorSourceMap": {
105-
"type": "boolean",
106-
"description": "Resolve vendor packages sourcemaps.",
107-
"x-deprecated": true,
108-
"default": false
109-
},
110-
"evalSourceMap": {
111-
"type": "boolean",
112-
"description": "Output in-file eval sourcemaps.",
113-
"x-deprecated": true
114-
},
115104
"progress": {
116105
"type": "boolean",
117106
"description": "Log progress to the console while building."

‎packages/angular_devkit/build_angular/src/server/schema.json

-12
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,6 @@
105105
}
106106
]
107107
},
108-
"vendorSourceMap": {
109-
"type": "boolean",
110-
"description": "Resolve vendor packages sourcemaps.",
111-
"x-deprecated": true,
112-
"default": false
113-
},
114-
"evalSourceMap": {
115-
"type": "boolean",
116-
"description": "Output in-file eval sourcemaps.",
117-
"default": false,
118-
"x-deprecated": true
119-
},
120108
"vendorChunk": {
121109
"type": "boolean",
122110
"description": "Use a separate bundle containing only vendor libraries.",

‎packages/angular_devkit/build_angular/src/utils/environment-options.ts

+6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ function isPresent(variable: string | undefined): variable is string {
1919
return typeof variable === 'string' && variable !== '';
2020
}
2121

22+
// Optimization and mangling
2223
const debugOptimizeVariable = process.env['NG_BUILD_DEBUG_OPTIMIZE'];
2324
const debugOptimize = (() => {
2425
if (!isPresent(debugOptimizeVariable) || isDisabled(debugOptimizeVariable)) {
@@ -64,6 +65,7 @@ export const allowMangle = isPresent(mangleVariable)
6465
export const shouldBeautify = debugOptimize.beautify;
6566
export const allowMinify = debugOptimize.minify;
6667

68+
// Build cache
6769
const cacheVariable = process.env['NG_BUILD_CACHE'];
6870
export const cachingDisabled = isPresent(cacheVariable) && isDisabled(cacheVariable);
6971
export const cachingBasePath = (() => {
@@ -76,3 +78,7 @@ export const cachingBasePath = (() => {
7678

7779
return cacheVariable;
7880
})();
81+
82+
// Build profiling
83+
const profilingVariable = process.env['NG_BUILD_PROFILING'];
84+
export const profilingEnabled = isPresent(profilingVariable) && isEnabled(profilingVariable);

‎packages/angular_devkit/build_angular/src/utils/normalize-builder-schema.ts

-2
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ export function normalizeBrowserSchema(
4343
options: BrowserBuilderSchema,
4444
): NormalizedBrowserBuilderSchema {
4545
const syncHost = new virtualFs.SyncDelegateHost(host);
46-
4746
const normalizedSourceMapOptions = normalizeSourceMaps(options.sourceMap || false);
48-
normalizedSourceMapOptions.vendor = normalizedSourceMapOptions.vendor || options.vendorSourceMap;
4947

5048
return {
5149
...options,

‎packages/angular_devkit/build_angular/src/utils/webpack-browser-config.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
normalizeBrowserSchema,
2828
} from '../utils';
2929
import { BuildBrowserFeatures } from './build-browser-features';
30+
import { profilingEnabled } from './environment-options';
3031
import { I18nOptions, configureI18nBuild } from './i18n-options';
3132

3233
const SpeedMeasurePlugin = require('speed-measure-webpack-plugin');
@@ -113,7 +114,7 @@ export async function generateWebpackConfig(
113114
webpackConfig.resolve.alias['zone.js/dist/zone'] = 'zone.js/dist/zone-evergreen';
114115
}
115116

116-
if (options.profile || process.env['NG_BUILD_PROFILING']) {
117+
if (profilingEnabled) {
117118
const esVersionInFileName = getEsVersionForFileName(
118119
tsConfig.options.target,
119120
wco.buildOptions.esVersionInFileName,

‎packages/angular_devkit/build_angular/test/browser/profile_spec_large.ts

-38
This file was deleted.

‎packages/angular_devkit/build_angular/test/browser/source-map_spec_large.ts

-9
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,6 @@ describe('Browser Builder source map', () => {
7070
expect(files['main.js.map']).toBeUndefined();
7171
});
7272

73-
it('supports eval source map', async () => {
74-
const { files } = await browserBuild(architect, host, target, {
75-
sourceMap: true, evalSourceMap: true,
76-
});
77-
78-
expect(files['main.js.map']).toBeUndefined();
79-
expect(await files['main.js']).toContain('eval("function webpackEmptyAsyncContext');
80-
});
81-
8273
it('supports hidden sourcemaps', async () => {
8374
const overrides = {
8475
sourceMap: {

‎packages/angular_devkit/build_angular/test/browser/vendor-source-map_spec_large.ts

-15
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,6 @@ describe('Browser Builder external source map', () => {
3434
expect(hasTsSourcePaths).toBe(true, `vendor.js.map should have '.ts' extentions`);
3535
});
3636

37-
it(`works when using deprecated 'vendorSourceMap'`, async () => {
38-
const overrides = {
39-
sourceMap: {
40-
scripts: true,
41-
styles: true,
42-
},
43-
vendorSourceMap: true,
44-
};
45-
46-
const { files } = await browserBuild(architect, host, target, overrides);
47-
const sourcePaths: string[] = JSON.parse(await files['vendor.js.map']).sources;
48-
const hasTsSourcePaths = sourcePaths.some(p => path.extname(p) == '.ts');
49-
expect(hasTsSourcePaths).toBe(true, `vendor.js.map should have '.ts' extentions`);
50-
});
51-
5237
it('does not map sourcemaps from external library when disabled', async () => {
5338
const overrides = {
5439
sourceMap: {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { expectFileToExist, expectFileToMatch } from '../../utils/fs';
2+
import { ng } from '../../utils/process';
3+
4+
export default async function() {
5+
try {
6+
process.env['NG_BUILD_PROFILING'] = '1';
7+
await ng('build');
8+
await expectFileToExist('chrome-profiler-events-es2015.json');
9+
await expectFileToExist('speed-measure-plugin-es2015.json');
10+
await expectFileToMatch('speed-measure-plugin-es2015.json', 'plugins');
11+
} finally {
12+
process.env['NG_BUILD_PROFILING'] = undefined;
13+
}
14+
}

0 commit comments

Comments
 (0)
Please sign in to comment.