@angular-devkit/build-angular 13.2.0 → 13.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -8
- package/src/builders/karma/schema.d.ts +1 -1
- package/src/builders/karma/schema.json +1 -1
- package/src/utils/build-options.d.ts +2 -2
- package/src/webpack/configs/common.js +4 -2
- package/src/webpack/plugins/css-optimizer-plugin.js +3 -3
- package/src/webpack/plugins/karma/karma.js +26 -15
- package/src/webpack/utils/helpers.d.ts +2 -2
- package/src/webpack/utils/helpers.js +34 -18
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/build-angular",
|
|
3
|
-
"version": "13.2.
|
|
3
|
+
"version": "13.2.4",
|
|
4
4
|
"description": "Angular Webpack Build Facade",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"typings": "src/index.d.ts",
|
|
7
7
|
"builders": "builders.json",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@ampproject/remapping": "1.1.1",
|
|
10
|
-
"@angular-devkit/architect": "0.1302.
|
|
11
|
-
"@angular-devkit/build-webpack": "0.1302.
|
|
12
|
-
"@angular-devkit/core": "13.2.
|
|
10
|
+
"@angular-devkit/architect": "0.1302.4",
|
|
11
|
+
"@angular-devkit/build-webpack": "0.1302.4",
|
|
12
|
+
"@angular-devkit/core": "13.2.4",
|
|
13
13
|
"@babel/core": "7.16.12",
|
|
14
14
|
"@babel/generator": "7.16.8",
|
|
15
15
|
"@babel/helper-annotate-as-pure": "7.16.7",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@babel/runtime": "7.16.7",
|
|
21
21
|
"@babel/template": "7.16.7",
|
|
22
22
|
"@discoveryjs/json-ext": "0.5.6",
|
|
23
|
-
"@ngtools/webpack": "13.2.
|
|
23
|
+
"@ngtools/webpack": "13.2.4",
|
|
24
24
|
"ansi-colors": "4.1.1",
|
|
25
25
|
"babel-loader": "8.2.3",
|
|
26
26
|
"babel-plugin-istanbul": "6.1.1",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"core-js": "3.20.3",
|
|
32
32
|
"critters": "0.0.16",
|
|
33
33
|
"css-loader": "6.5.1",
|
|
34
|
-
"esbuild-wasm": "0.14.
|
|
34
|
+
"esbuild-wasm": "0.14.22",
|
|
35
35
|
"glob": "7.2.0",
|
|
36
36
|
"https-proxy-agent": "5.0.0",
|
|
37
37
|
"inquirer": "8.2.0",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"karma-source-map-support": "1.4.0",
|
|
40
40
|
"less": "4.1.2",
|
|
41
41
|
"less-loader": "10.2.0",
|
|
42
|
-
"license-webpack-plugin": "4.0.
|
|
42
|
+
"license-webpack-plugin": "4.0.2",
|
|
43
43
|
"loader-utils": "3.2.0",
|
|
44
44
|
"mini-css-extract-plugin": "2.5.3",
|
|
45
45
|
"minimatch": "3.0.4",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"webpack-subresource-integrity": "5.1.0"
|
|
73
73
|
},
|
|
74
74
|
"optionalDependencies": {
|
|
75
|
-
"esbuild": "0.14.
|
|
75
|
+
"esbuild": "0.14.22"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"@angular/compiler-cli": "^13.0.0",
|
|
@@ -28,7 +28,7 @@ export interface Schema {
|
|
|
28
28
|
* - when a path to directory is provided, all spec files ending ".spec.@(ts|tsx)" will be
|
|
29
29
|
* included
|
|
30
30
|
* - when a path to a file is provided, and a matching spec file exists it will be included
|
|
31
|
-
* instead
|
|
31
|
+
* instead.
|
|
32
32
|
*/
|
|
33
33
|
include?: string[];
|
|
34
34
|
/**
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"items": {
|
|
71
71
|
"type": "string"
|
|
72
72
|
},
|
|
73
|
-
"description": "Globs of files to include, relative to workspace or project root. \nThere are 2 special cases:\n - when a path to directory is provided, all spec files ending \".spec.@(ts|tsx)\" will be included\n - when a path to a file is provided, and a matching spec file exists it will be included instead"
|
|
73
|
+
"description": "Globs of files to include, relative to workspace or project root. \nThere are 2 special cases:\n - when a path to directory is provided, all spec files ending \".spec.@(ts|tsx)\" will be included\n - when a path to a file is provided, and a matching spec file exists it will be included instead."
|
|
74
74
|
},
|
|
75
75
|
"sourceMap": {
|
|
76
76
|
"description": "Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration.",
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { logging } from '@angular-devkit/core';
|
|
9
9
|
import type { ParsedConfiguration } from '@angular/compiler-cli';
|
|
10
|
-
import { AssetPatternClass, Budget, CrossOrigin, ExtraEntryPoint, I18NTranslation, IndexUnion, InlineStyleLanguage, Localize, SourceMapClass } from '../builders/browser/schema';
|
|
10
|
+
import { AssetPatternClass, Budget, CrossOrigin, ExtraEntryPoint, I18NTranslation, IndexUnion, InlineStyleLanguage, Localize, OutputHashing, SourceMapClass } from '../builders/browser/schema';
|
|
11
11
|
import { Schema as DevServerSchema } from '../builders/dev-server/schema';
|
|
12
12
|
import { NormalizedCachedOptions } from './normalize-cache';
|
|
13
13
|
import { NormalizedFileReplacement } from './normalize-file-replacements';
|
|
@@ -30,7 +30,7 @@ export interface BuildOptions {
|
|
|
30
30
|
bundleDependencies?: boolean;
|
|
31
31
|
externalDependencies?: string[];
|
|
32
32
|
watch?: boolean;
|
|
33
|
-
outputHashing?:
|
|
33
|
+
outputHashing?: OutputHashing;
|
|
34
34
|
poll?: number;
|
|
35
35
|
index?: IndexUnion;
|
|
36
36
|
deleteOutputPath?: boolean;
|
|
@@ -58,7 +58,7 @@ async function getCommonConfig(wco) {
|
|
|
58
58
|
// changed to a direct dynamic import.
|
|
59
59
|
const { GLOBAL_DEFS_FOR_TERSER, GLOBAL_DEFS_FOR_TERSER_WITH_AOT, VERSION: NG_VERSION, } = await (0, load_esm_1.loadEsmModule)('@angular/compiler-cli');
|
|
60
60
|
// determine hashing format
|
|
61
|
-
const hashFormat = (0, helpers_1.getOutputHashFormat)(buildOptions.outputHashing
|
|
61
|
+
const hashFormat = (0, helpers_1.getOutputHashFormat)(buildOptions.outputHashing);
|
|
62
62
|
if (buildOptions.progress) {
|
|
63
63
|
extraPlugins.push(new progress_plugin_1.ProgressPlugin(platform));
|
|
64
64
|
}
|
|
@@ -298,7 +298,9 @@ async function getCommonConfig(wco) {
|
|
|
298
298
|
test: /\.[cm]?[tj]sx?$/,
|
|
299
299
|
// The below is needed due to a bug in `@babel/runtime`. See: https://github.com/babel/babel/issues/12824
|
|
300
300
|
resolve: { fullySpecified: false },
|
|
301
|
-
exclude: [
|
|
301
|
+
exclude: [
|
|
302
|
+
/[/\\](?:core-js|@babel|tslib|web-animations-js|web-streams-polyfill|whatwg-url)[/\\]/,
|
|
303
|
+
],
|
|
302
304
|
use: [
|
|
303
305
|
{
|
|
304
306
|
loader: require.resolve('../../babel/webpack-loader'),
|
|
@@ -115,10 +115,10 @@ class CssOptimizerPlugin {
|
|
|
115
115
|
// browserslist uses the name `ios_saf` for iOS Safari whereas esbuild uses `ios`
|
|
116
116
|
if (browserName === 'ios_saf') {
|
|
117
117
|
browserName = 'ios';
|
|
118
|
-
// browserslist also uses ranges for iOS Safari versions but only the lowest is required
|
|
119
|
-
// to perform minimum supported feature checks. esbuild also expects a single version.
|
|
120
|
-
[version] = version.split('-');
|
|
121
118
|
}
|
|
119
|
+
// browserslist uses ranges `15.2-15.3` versions but only the lowest is required
|
|
120
|
+
// to perform minimum supported feature checks. esbuild also expects a single version.
|
|
121
|
+
[version] = version.split('-');
|
|
122
122
|
if (esBuildSupportedBrowsers.has(browserName)) {
|
|
123
123
|
if (browserName === 'safari' && version === 'TP') {
|
|
124
124
|
// esbuild only supports numeric versions so `TP` is converted to a high number (999) since
|
|
@@ -155,27 +155,38 @@ const init = (config, emitter) => {
|
|
|
155
155
|
compiler.hooks.invalid.tap('karma', () => handler());
|
|
156
156
|
compiler.hooks.watchRun.tapAsync('karma', (_, callback) => handler(callback));
|
|
157
157
|
compiler.hooks.run.tapAsync('karma', (_, callback) => handler(callback));
|
|
158
|
+
webpackMiddleware = (0, webpack_dev_middleware_1.default)(compiler, webpackMiddlewareConfig);
|
|
159
|
+
emitter.on('exit', (done) => {
|
|
160
|
+
webpackMiddleware.close();
|
|
161
|
+
done();
|
|
162
|
+
});
|
|
158
163
|
function unblock() {
|
|
159
164
|
isBlocked = false;
|
|
160
165
|
blocked.forEach((cb) => cb());
|
|
161
166
|
blocked = [];
|
|
162
167
|
}
|
|
163
168
|
let lastCompilationHash;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
169
|
+
let isFirstRun = true;
|
|
170
|
+
return new Promise((resolve) => {
|
|
171
|
+
compiler.hooks.done.tap('karma', (stats) => {
|
|
172
|
+
if (isFirstRun) {
|
|
173
|
+
// This is needed to block Karma from launching browsers before Webpack writes the assets in memory.
|
|
174
|
+
// See the below:
|
|
175
|
+
// https://github.com/karma-runner/karma-chrome-launcher/issues/154#issuecomment-986661937
|
|
176
|
+
// https://github.com/angular/angular-cli/issues/22495
|
|
177
|
+
isFirstRun = false;
|
|
178
|
+
resolve();
|
|
179
|
+
}
|
|
180
|
+
if (stats.hasErrors()) {
|
|
181
|
+
lastCompilationHash = undefined;
|
|
182
|
+
}
|
|
183
|
+
else if (stats.hash != lastCompilationHash) {
|
|
184
|
+
// Refresh karma only when there are no webpack errors, and if the compilation changed.
|
|
185
|
+
lastCompilationHash = stats.hash;
|
|
186
|
+
emitter.refreshFiles();
|
|
187
|
+
}
|
|
188
|
+
unblock();
|
|
189
|
+
});
|
|
179
190
|
});
|
|
180
191
|
};
|
|
181
192
|
init.$inject = ['config', 'emitter'];
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import type { ObjectPattern } from 'copy-webpack-plugin';
|
|
9
9
|
import { ScriptTarget } from 'typescript';
|
|
10
10
|
import type { Configuration, WebpackOptionsNormalized } from 'webpack';
|
|
11
|
-
import { AssetPatternClass, ExtraEntryPoint, ExtraEntryPointClass } from '../../builders/browser/schema';
|
|
11
|
+
import { AssetPatternClass, ExtraEntryPoint, ExtraEntryPointClass, OutputHashing } from '../../builders/browser/schema';
|
|
12
12
|
import { WebpackConfigOptions } from '../../utils/build-options';
|
|
13
13
|
export interface HashFormat {
|
|
14
14
|
chunk: string;
|
|
@@ -16,7 +16,7 @@ export interface HashFormat {
|
|
|
16
16
|
file: string;
|
|
17
17
|
script: string;
|
|
18
18
|
}
|
|
19
|
-
export declare function getOutputHashFormat(
|
|
19
|
+
export declare function getOutputHashFormat(outputHashing?: OutputHashing, length?: number): HashFormat;
|
|
20
20
|
export declare type NormalizedEntryPoint = Required<ExtraEntryPointClass>;
|
|
21
21
|
export declare function normalizeExtraEntryPoints(extraEntryPoints: ExtraEntryPoint[], defaultBundleName: string): NormalizedEntryPoint[];
|
|
22
22
|
export declare function assetNameTemplateFactory(hashFormat: HashFormat): (resourcePath: string) => string;
|
|
@@ -35,25 +35,41 @@ const fs_1 = require("fs");
|
|
|
35
35
|
const glob_1 = __importDefault(require("glob"));
|
|
36
36
|
const path = __importStar(require("path"));
|
|
37
37
|
const typescript_1 = require("typescript");
|
|
38
|
+
const schema_1 = require("../../builders/browser/schema");
|
|
38
39
|
const package_version_1 = require("../../utils/package-version");
|
|
39
|
-
function getOutputHashFormat(
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
40
|
+
function getOutputHashFormat(outputHashing = schema_1.OutputHashing.None, length = 20) {
|
|
41
|
+
const hashTemplate = `.[contenthash:${length}]`;
|
|
42
|
+
switch (outputHashing) {
|
|
43
|
+
case 'media':
|
|
44
|
+
return {
|
|
45
|
+
chunk: '',
|
|
46
|
+
extract: '',
|
|
47
|
+
file: hashTemplate,
|
|
48
|
+
script: '',
|
|
49
|
+
};
|
|
50
|
+
case 'bundles':
|
|
51
|
+
return {
|
|
52
|
+
chunk: hashTemplate,
|
|
53
|
+
extract: hashTemplate,
|
|
54
|
+
file: '',
|
|
55
|
+
script: hashTemplate,
|
|
56
|
+
};
|
|
57
|
+
case 'all':
|
|
58
|
+
return {
|
|
59
|
+
chunk: hashTemplate,
|
|
60
|
+
extract: hashTemplate,
|
|
61
|
+
file: hashTemplate,
|
|
62
|
+
script: hashTemplate,
|
|
63
|
+
};
|
|
64
|
+
case 'none':
|
|
65
|
+
default:
|
|
66
|
+
return {
|
|
67
|
+
chunk: '',
|
|
68
|
+
extract: '',
|
|
69
|
+
file: '',
|
|
70
|
+
script: '',
|
|
71
|
+
};
|
|
72
|
+
}
|
|
57
73
|
}
|
|
58
74
|
exports.getOutputHashFormat = getOutputHashFormat;
|
|
59
75
|
function normalizeExtraEntryPoints(extraEntryPoints, defaultBundleName) {
|