@angular-devkit/build-angular 13.2.3 → 14.0.0-next.2
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 +28 -29
- package/src/babel/webpack-loader.js +2 -22
- package/src/builders/browser/schema.d.ts +20 -11
- package/src/builders/browser/schema.json +59 -38
- package/src/builders/karma/find-tests.d.ts +1 -1
- package/src/builders/karma/find-tests.js +43 -29
- package/src/builders/karma/index.js +11 -6
- package/src/builders/karma/schema.d.ts +19 -4
- package/src/builders/karma/schema.json +58 -31
- package/src/builders/server/schema.d.ts +0 -6
- package/src/builders/server/schema.json +0 -6
- package/src/index.d.ts +1 -1
- package/src/utils/build-options.d.ts +3 -4
- package/src/utils/package-chunk-sort.d.ts +3 -3
- package/src/webpack/configs/common.js +0 -6
- package/src/webpack/configs/styles.js +1 -0
- package/src/webpack/utils/helpers.d.ts +4 -4
- package/src/utils/is-directory.d.ts +0 -8
- package/src/utils/is-directory.js +0 -40
package/package.json
CHANGED
|
@@ -1,37 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/build-angular",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.0-next.2",
|
|
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
|
-
"@ampproject/remapping": "
|
|
10
|
-
"@angular-devkit/architect": "0.
|
|
11
|
-
"@angular-devkit/build-webpack": "0.
|
|
12
|
-
"@angular-devkit/core": "
|
|
13
|
-
"@babel/core": "7.
|
|
14
|
-
"@babel/generator": "7.
|
|
9
|
+
"@ampproject/remapping": "2.1.2",
|
|
10
|
+
"@angular-devkit/architect": "0.1400.0-next.2",
|
|
11
|
+
"@angular-devkit/build-webpack": "0.1400.0-next.2",
|
|
12
|
+
"@angular-devkit/core": "14.0.0-next.2",
|
|
13
|
+
"@babel/core": "7.17.5",
|
|
14
|
+
"@babel/generator": "7.17.3",
|
|
15
15
|
"@babel/helper-annotate-as-pure": "7.16.7",
|
|
16
16
|
"@babel/plugin-proposal-async-generator-functions": "7.16.8",
|
|
17
17
|
"@babel/plugin-transform-async-to-generator": "7.16.8",
|
|
18
|
-
"@babel/plugin-transform-runtime": "7.
|
|
18
|
+
"@babel/plugin-transform-runtime": "7.17.0",
|
|
19
19
|
"@babel/preset-env": "7.16.11",
|
|
20
|
-
"@babel/runtime": "7.
|
|
20
|
+
"@babel/runtime": "7.17.2",
|
|
21
21
|
"@babel/template": "7.16.7",
|
|
22
22
|
"@discoveryjs/json-ext": "0.5.6",
|
|
23
|
-
"@ngtools/webpack": "
|
|
23
|
+
"@ngtools/webpack": "14.0.0-next.2",
|
|
24
24
|
"ansi-colors": "4.1.1",
|
|
25
25
|
"babel-loader": "8.2.3",
|
|
26
26
|
"babel-plugin-istanbul": "6.1.1",
|
|
27
27
|
"browserslist": "^4.9.1",
|
|
28
28
|
"cacache": "15.3.0",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"core-js": "3.20.3",
|
|
29
|
+
"copy-webpack-plugin": "10.2.4",
|
|
30
|
+
"core-js": "3.21.1",
|
|
32
31
|
"critters": "0.0.16",
|
|
33
|
-
"css-loader": "6.
|
|
34
|
-
"esbuild-wasm": "0.14.
|
|
32
|
+
"css-loader": "6.6.0",
|
|
33
|
+
"esbuild-wasm": "0.14.22",
|
|
35
34
|
"glob": "7.2.0",
|
|
36
35
|
"https-proxy-agent": "5.0.0",
|
|
37
36
|
"inquirer": "8.2.0",
|
|
@@ -39,23 +38,23 @@
|
|
|
39
38
|
"karma-source-map-support": "1.4.0",
|
|
40
39
|
"less": "4.1.2",
|
|
41
40
|
"less-loader": "10.2.0",
|
|
42
|
-
"license-webpack-plugin": "4.0.
|
|
41
|
+
"license-webpack-plugin": "4.0.2",
|
|
43
42
|
"loader-utils": "3.2.0",
|
|
44
43
|
"mini-css-extract-plugin": "2.5.3",
|
|
45
|
-
"minimatch": "
|
|
44
|
+
"minimatch": "5.0.0",
|
|
46
45
|
"open": "8.4.0",
|
|
47
46
|
"ora": "5.4.1",
|
|
48
47
|
"parse5-html-rewriting-stream": "6.0.1",
|
|
49
48
|
"piscina": "3.2.0",
|
|
50
|
-
"postcss": "8.4.
|
|
49
|
+
"postcss": "8.4.6",
|
|
51
50
|
"postcss-import": "14.0.2",
|
|
52
51
|
"postcss-loader": "6.2.1",
|
|
53
|
-
"postcss-preset-env": "7.
|
|
52
|
+
"postcss-preset-env": "7.4.1",
|
|
54
53
|
"regenerator-runtime": "0.13.9",
|
|
55
54
|
"resolve-url-loader": "5.0.0",
|
|
56
55
|
"rxjs": "6.6.7",
|
|
57
|
-
"sass": "1.49.
|
|
58
|
-
"sass-loader": "12.
|
|
56
|
+
"sass": "1.49.7",
|
|
57
|
+
"sass-loader": "12.6.0",
|
|
59
58
|
"semver": "7.3.5",
|
|
60
59
|
"source-map-loader": "3.0.1",
|
|
61
60
|
"source-map-support": "0.5.21",
|
|
@@ -65,21 +64,21 @@
|
|
|
65
64
|
"text-table": "0.2.0",
|
|
66
65
|
"tree-kill": "1.2.2",
|
|
67
66
|
"tslib": "2.3.1",
|
|
68
|
-
"webpack": "5.
|
|
69
|
-
"webpack-dev-middleware": "5.3.
|
|
70
|
-
"webpack-dev-server": "4.7.
|
|
67
|
+
"webpack": "5.69.1",
|
|
68
|
+
"webpack-dev-middleware": "5.3.1",
|
|
69
|
+
"webpack-dev-server": "4.7.4",
|
|
71
70
|
"webpack-merge": "5.8.0",
|
|
72
71
|
"webpack-subresource-integrity": "5.1.0"
|
|
73
72
|
},
|
|
74
73
|
"optionalDependencies": {
|
|
75
|
-
"esbuild": "0.14.
|
|
74
|
+
"esbuild": "0.14.22"
|
|
76
75
|
},
|
|
77
76
|
"peerDependencies": {
|
|
78
|
-
"@angular/compiler-cli": "^
|
|
79
|
-
"@angular/localize": "^
|
|
80
|
-
"@angular/service-worker": "^
|
|
77
|
+
"@angular/compiler-cli": "^14.0.0 || ^14.0.0-next",
|
|
78
|
+
"@angular/localize": "^14.0.0 || ^14.0.0-next",
|
|
79
|
+
"@angular/service-worker": "^14.0.0 || ^14.0.0-next",
|
|
81
80
|
"karma": "^6.3.0",
|
|
82
|
-
"ng-packagr": "^
|
|
81
|
+
"ng-packagr": "^14.0.0 || ^14.0.0-next",
|
|
83
82
|
"protractor": "^7.0.0",
|
|
84
83
|
"tailwindcss": "^2.0.0 || ^3.0.0",
|
|
85
84
|
"typescript": ">=4.4.3 <4.6"
|
|
@@ -6,11 +6,7 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
-
};
|
|
12
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
const remapping_1 = __importDefault(require("@ampproject/remapping"));
|
|
14
10
|
const babel_loader_1 = require("babel-loader");
|
|
15
11
|
const typescript_1 = require("typescript");
|
|
16
12
|
const load_esm_1 = require("../utils/load-esm");
|
|
@@ -166,12 +162,13 @@ exports.default = (0, babel_loader_1.custom)(() => {
|
|
|
166
162
|
return { custom: customOptions, loader: loaderOptions };
|
|
167
163
|
},
|
|
168
164
|
config(configuration, { customOptions }) {
|
|
165
|
+
var _a;
|
|
169
166
|
return {
|
|
170
167
|
...configuration.options,
|
|
171
168
|
// Using `false` disables babel from attempting to locate sourcemaps or process any inline maps.
|
|
172
169
|
// The babel types do not include the false option even though it is valid
|
|
173
170
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
174
|
-
inputSourceMap: false,
|
|
171
|
+
inputSourceMap: (_a = configuration.options.inputSourceMap) !== null && _a !== void 0 ? _a : false,
|
|
175
172
|
presets: [
|
|
176
173
|
...(configuration.options.presets || []),
|
|
177
174
|
[
|
|
@@ -195,22 +192,5 @@ exports.default = (0, babel_loader_1.custom)(() => {
|
|
|
195
192
|
],
|
|
196
193
|
};
|
|
197
194
|
},
|
|
198
|
-
result(result, { map: inputSourceMap }) {
|
|
199
|
-
if (result.map && inputSourceMap) {
|
|
200
|
-
// Merge the intermediate sourcemap generated by babel with the input source map.
|
|
201
|
-
// The casting is required due to slight differences in the types for babel and
|
|
202
|
-
// `@ampproject/remapping` source map objects but both are compatible with Webpack.
|
|
203
|
-
// This method for merging is used because it provides more accurate output
|
|
204
|
-
// and is faster while using less memory.
|
|
205
|
-
result.map = {
|
|
206
|
-
// Convert the SourceMap back to simple plain object.
|
|
207
|
-
// This is needed because otherwise code-coverage will fail with `don't know how to turn this value into a node`
|
|
208
|
-
// Which is thrown by Babel if it is invoked again from `istanbul-lib-instrument`.
|
|
209
|
-
// https://github.com/babel/babel/blob/780aa48d2a34dc55f556843074b6aed45e7eabeb/packages/babel-types/src/converters/valueToNode.ts#L115-L130
|
|
210
|
-
...(0, remapping_1.default)([result.map, inputSourceMap], () => null),
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
return result;
|
|
214
|
-
},
|
|
215
195
|
};
|
|
216
196
|
});
|
|
@@ -24,7 +24,7 @@ export interface Schema {
|
|
|
24
24
|
*/
|
|
25
25
|
budgets?: Budget[];
|
|
26
26
|
/**
|
|
27
|
-
* Enables
|
|
27
|
+
* Enables advanced build optimizations when using the 'aot' option.
|
|
28
28
|
*/
|
|
29
29
|
buildOptimizer?: boolean;
|
|
30
30
|
/**
|
|
@@ -126,17 +126,11 @@ export interface Schema {
|
|
|
126
126
|
/**
|
|
127
127
|
* Global scripts to be included in the build.
|
|
128
128
|
*/
|
|
129
|
-
scripts?:
|
|
129
|
+
scripts?: ScriptElement[];
|
|
130
130
|
/**
|
|
131
131
|
* Generates a service worker config for production builds.
|
|
132
132
|
*/
|
|
133
133
|
serviceWorker?: boolean;
|
|
134
|
-
/**
|
|
135
|
-
* Show circular dependency warnings on builds.
|
|
136
|
-
* @deprecated The recommended method to detect circular dependencies in project code is to
|
|
137
|
-
* use either a lint rule or other external tooling.
|
|
138
|
-
*/
|
|
139
|
-
showCircularDependencies?: boolean;
|
|
140
134
|
/**
|
|
141
135
|
* Output source maps for scripts and styles. For more information, see
|
|
142
136
|
* https://angular.io/guide/workspace-config#source-map-configuration.
|
|
@@ -154,7 +148,7 @@ export interface Schema {
|
|
|
154
148
|
/**
|
|
155
149
|
* Global styles to be included in the build.
|
|
156
150
|
*/
|
|
157
|
-
styles?:
|
|
151
|
+
styles?: StyleElement[];
|
|
158
152
|
/**
|
|
159
153
|
* Enables the use of subresource integrity validation.
|
|
160
154
|
*/
|
|
@@ -366,8 +360,8 @@ export declare enum OutputHashing {
|
|
|
366
360
|
Media = "media",
|
|
367
361
|
None = "none"
|
|
368
362
|
}
|
|
369
|
-
export declare type
|
|
370
|
-
export interface
|
|
363
|
+
export declare type ScriptElement = ScriptClass | string;
|
|
364
|
+
export interface ScriptClass {
|
|
371
365
|
/**
|
|
372
366
|
* The bundle name for this extra entry point.
|
|
373
367
|
*/
|
|
@@ -413,3 +407,18 @@ export interface StylePreprocessorOptions {
|
|
|
413
407
|
*/
|
|
414
408
|
includePaths?: string[];
|
|
415
409
|
}
|
|
410
|
+
export declare type StyleElement = StyleClass | string;
|
|
411
|
+
export interface StyleClass {
|
|
412
|
+
/**
|
|
413
|
+
* The bundle name for this extra entry point.
|
|
414
|
+
*/
|
|
415
|
+
bundleName?: string;
|
|
416
|
+
/**
|
|
417
|
+
* If the bundle will be referenced in the HTML file.
|
|
418
|
+
*/
|
|
419
|
+
inject?: boolean;
|
|
420
|
+
/**
|
|
421
|
+
* The file to include.
|
|
422
|
+
*/
|
|
423
|
+
input: string;
|
|
424
|
+
}
|
|
@@ -29,7 +29,35 @@
|
|
|
29
29
|
"type": "array",
|
|
30
30
|
"default": [],
|
|
31
31
|
"items": {
|
|
32
|
-
"
|
|
32
|
+
"oneOf": [
|
|
33
|
+
{
|
|
34
|
+
"type": "object",
|
|
35
|
+
"properties": {
|
|
36
|
+
"input": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"description": "The file to include.",
|
|
39
|
+
"pattern": "\\.[cm]?jsx?$"
|
|
40
|
+
},
|
|
41
|
+
"bundleName": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"pattern": "^[\\w\\-.]*$",
|
|
44
|
+
"description": "The bundle name for this extra entry point."
|
|
45
|
+
},
|
|
46
|
+
"inject": {
|
|
47
|
+
"type": "boolean",
|
|
48
|
+
"description": "If the bundle will be referenced in the HTML file.",
|
|
49
|
+
"default": true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"additionalProperties": false,
|
|
53
|
+
"required": ["input"]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"type": "string",
|
|
57
|
+
"description": "The file to include.",
|
|
58
|
+
"pattern": "\\.[cm]?jsx?$"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
33
61
|
}
|
|
34
62
|
},
|
|
35
63
|
"styles": {
|
|
@@ -37,7 +65,35 @@
|
|
|
37
65
|
"type": "array",
|
|
38
66
|
"default": [],
|
|
39
67
|
"items": {
|
|
40
|
-
"
|
|
68
|
+
"oneOf": [
|
|
69
|
+
{
|
|
70
|
+
"type": "object",
|
|
71
|
+
"properties": {
|
|
72
|
+
"input": {
|
|
73
|
+
"type": "string",
|
|
74
|
+
"description": "The file to include.",
|
|
75
|
+
"pattern": "\\.(?:css|scss|sass|less|styl)$"
|
|
76
|
+
},
|
|
77
|
+
"bundleName": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"pattern": "^[\\w\\-.]*$",
|
|
80
|
+
"description": "The bundle name for this extra entry point."
|
|
81
|
+
},
|
|
82
|
+
"inject": {
|
|
83
|
+
"type": "boolean",
|
|
84
|
+
"description": "If the bundle will be referenced in the HTML file.",
|
|
85
|
+
"default": true
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"additionalProperties": false,
|
|
89
|
+
"required": ["input"]
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"type": "string",
|
|
93
|
+
"description": "The file to include.",
|
|
94
|
+
"pattern": "\\.(?:css|scss|sass|less|styl)$"
|
|
95
|
+
}
|
|
96
|
+
]
|
|
41
97
|
}
|
|
42
98
|
},
|
|
43
99
|
"inlineStyleLanguage": {
|
|
@@ -273,15 +329,9 @@
|
|
|
273
329
|
"description": "Extract all licenses in a separate file.",
|
|
274
330
|
"default": true
|
|
275
331
|
},
|
|
276
|
-
"showCircularDependencies": {
|
|
277
|
-
"type": "boolean",
|
|
278
|
-
"description": "Show circular dependency warnings on builds.",
|
|
279
|
-
"default": false,
|
|
280
|
-
"x-deprecated": "The recommended method to detect circular dependencies in project code is to use either a lint rule or other external tooling."
|
|
281
|
-
},
|
|
282
332
|
"buildOptimizer": {
|
|
283
333
|
"type": "boolean",
|
|
284
|
-
"description": "Enables
|
|
334
|
+
"description": "Enables advanced build optimizations when using the 'aot' option.",
|
|
285
335
|
"default": true
|
|
286
336
|
},
|
|
287
337
|
"namedChunks": {
|
|
@@ -437,35 +487,6 @@
|
|
|
437
487
|
}
|
|
438
488
|
]
|
|
439
489
|
},
|
|
440
|
-
"extraEntryPoint": {
|
|
441
|
-
"oneOf": [
|
|
442
|
-
{
|
|
443
|
-
"type": "object",
|
|
444
|
-
"properties": {
|
|
445
|
-
"input": {
|
|
446
|
-
"type": "string",
|
|
447
|
-
"description": "The file to include."
|
|
448
|
-
},
|
|
449
|
-
"bundleName": {
|
|
450
|
-
"type": "string",
|
|
451
|
-
"pattern": "^[\\w\\-.]*$",
|
|
452
|
-
"description": "The bundle name for this extra entry point."
|
|
453
|
-
},
|
|
454
|
-
"inject": {
|
|
455
|
-
"type": "boolean",
|
|
456
|
-
"description": "If the bundle will be referenced in the HTML file.",
|
|
457
|
-
"default": true
|
|
458
|
-
}
|
|
459
|
-
},
|
|
460
|
-
"additionalProperties": false,
|
|
461
|
-
"required": ["input"]
|
|
462
|
-
},
|
|
463
|
-
{
|
|
464
|
-
"type": "string",
|
|
465
|
-
"description": "The file to include."
|
|
466
|
-
}
|
|
467
|
-
]
|
|
468
|
-
},
|
|
469
490
|
"budget": {
|
|
470
491
|
"type": "object",
|
|
471
492
|
"properties": {
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
-
export declare function findTests(patterns: string[],
|
|
8
|
+
export declare function findTests(patterns: string[], workspaceRoot: string, projectSourceRoot: string): Promise<string[]>;
|
|
@@ -28,48 +28,62 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.findTests = void 0;
|
|
30
30
|
const fs_1 = require("fs");
|
|
31
|
-
const
|
|
31
|
+
const glob_1 = __importStar(require("glob"));
|
|
32
32
|
const path_1 = require("path");
|
|
33
|
-
const
|
|
33
|
+
const util_1 = require("util");
|
|
34
|
+
const globPromise = (0, util_1.promisify)(glob_1.default);
|
|
34
35
|
// go through all patterns and find unique list of files
|
|
35
|
-
function findTests(patterns,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (!files.includes(file)) {
|
|
41
|
-
files.push(file);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
return files;
|
|
45
|
-
}, []);
|
|
36
|
+
async function findTests(patterns, workspaceRoot, projectSourceRoot) {
|
|
37
|
+
const matchingTestsPromises = patterns.map((pattern) => findMatchingTests(pattern, workspaceRoot, projectSourceRoot));
|
|
38
|
+
const files = await Promise.all(matchingTestsPromises);
|
|
39
|
+
// Unique file names
|
|
40
|
+
return [...new Set(files.flat())];
|
|
46
41
|
}
|
|
47
42
|
exports.findTests = findTests;
|
|
48
|
-
|
|
43
|
+
const normalizePath = (path) => path.replace(/\\/g, '/');
|
|
44
|
+
async function findMatchingTests(pattern, workspaceRoot, projectSourceRoot) {
|
|
49
45
|
// normalize pattern, glob lib only accepts forward slashes
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
// remove
|
|
46
|
+
let normalizedPattern = normalizePath(pattern);
|
|
47
|
+
const relativeProjectRoot = normalizePath((0, path_1.relative)(workspaceRoot, projectSourceRoot) + '/');
|
|
48
|
+
// remove relativeProjectRoot to support relative paths from root
|
|
53
49
|
// such paths are easy to get when running scripts via IDEs
|
|
54
|
-
if (
|
|
55
|
-
|
|
50
|
+
if (normalizedPattern.startsWith(relativeProjectRoot)) {
|
|
51
|
+
normalizedPattern = normalizedPattern.substring(relativeProjectRoot.length);
|
|
56
52
|
}
|
|
57
53
|
// special logic when pattern does not look like a glob
|
|
58
|
-
if (!
|
|
59
|
-
if (
|
|
60
|
-
|
|
54
|
+
if (!(0, glob_1.hasMagic)(normalizedPattern)) {
|
|
55
|
+
if (await isDirectory((0, path_1.join)(projectSourceRoot, normalizedPattern))) {
|
|
56
|
+
normalizedPattern = `${normalizedPattern}/**/*.spec.@(ts|tsx)`;
|
|
61
57
|
}
|
|
62
58
|
else {
|
|
63
59
|
// see if matching spec file exists
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
60
|
+
const fileExt = (0, path_1.extname)(normalizedPattern);
|
|
61
|
+
// Replace extension to `.spec.ext`. Example: `src/app/app.component.ts`-> `src/app/app.component.spec.ts`
|
|
62
|
+
const potentialSpec = (0, path_1.join)((0, path_1.dirname)(normalizedPattern), `${(0, path_1.basename)(normalizedPattern, fileExt)}.spec${fileExt}`);
|
|
63
|
+
if (await exists((0, path_1.join)(projectSourceRoot, potentialSpec))) {
|
|
64
|
+
return [normalizePath(potentialSpec)];
|
|
68
65
|
}
|
|
69
66
|
}
|
|
70
67
|
}
|
|
71
|
-
|
|
72
|
-
cwd,
|
|
68
|
+
return globPromise(normalizedPattern, {
|
|
69
|
+
cwd: projectSourceRoot,
|
|
73
70
|
});
|
|
74
|
-
|
|
71
|
+
}
|
|
72
|
+
async function isDirectory(path) {
|
|
73
|
+
try {
|
|
74
|
+
const stats = await fs_1.promises.stat(path);
|
|
75
|
+
return stats.isDirectory();
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async function exists(path) {
|
|
82
|
+
try {
|
|
83
|
+
await fs_1.promises.access(path, fs_1.constants.F_OK);
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
75
89
|
}
|
|
@@ -80,7 +80,7 @@ function execute(options, context, transforms = {}) {
|
|
|
80
80
|
singleRun = !options.watch;
|
|
81
81
|
}
|
|
82
82
|
return (0, rxjs_1.from)(initialize(options, context, transforms.webpackConfiguration)).pipe((0, operators_1.switchMap)(async ([karma, webpackConfig]) => {
|
|
83
|
-
var _a;
|
|
83
|
+
var _a, _b, _c, _d, _e;
|
|
84
84
|
const karmaOptions = {
|
|
85
85
|
singleRun,
|
|
86
86
|
};
|
|
@@ -98,15 +98,20 @@ function execute(options, context, transforms = {}) {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
// prepend special webpack loader that will transform test.ts
|
|
101
|
-
if (
|
|
102
|
-
const
|
|
103
|
-
|
|
101
|
+
if ((_a = options.include) === null || _a === void 0 ? void 0 : _a.length) {
|
|
102
|
+
const projectName = (_b = context.target) === null || _b === void 0 ? void 0 : _b.project;
|
|
103
|
+
if (!projectName) {
|
|
104
|
+
throw new Error('The builder requires a target.');
|
|
105
|
+
}
|
|
106
|
+
const projectMetadata = await context.getProjectMetadata(projectName);
|
|
107
|
+
const projectSourceRoot = (0, core_1.getSystemPath)((0, core_1.join)((0, core_1.normalize)(context.workspaceRoot), (_c = projectMetadata.root) !== null && _c !== void 0 ? _c : '', (_d = projectMetadata.sourceRoot) !== null && _d !== void 0 ? _d : ''));
|
|
108
|
+
const files = await (0, find_tests_1.findTests)(options.include, context.workspaceRoot, projectSourceRoot);
|
|
104
109
|
// early exit, no reason to start karma
|
|
105
110
|
if (!files.length) {
|
|
106
111
|
throw new Error(`Specified patterns: "${options.include.join(', ')}" did not match any spec files.`);
|
|
107
112
|
}
|
|
108
113
|
// Get the rules and ensure the Webpack configuration is setup properly
|
|
109
|
-
const rules = ((
|
|
114
|
+
const rules = ((_e = webpackConfig.module) === null || _e === void 0 ? void 0 : _e.rules) || [];
|
|
110
115
|
if (!webpackConfig.module) {
|
|
111
116
|
webpackConfig.module = { rules };
|
|
112
117
|
}
|
|
@@ -114,7 +119,7 @@ function execute(options, context, transforms = {}) {
|
|
|
114
119
|
webpackConfig.module.rules = rules;
|
|
115
120
|
}
|
|
116
121
|
rules.unshift({
|
|
117
|
-
test:
|
|
122
|
+
test: (0, path_1.resolve)(context.workspaceRoot, options.main),
|
|
118
123
|
use: {
|
|
119
124
|
// cannot be a simple path as it differs between environments
|
|
120
125
|
loader: single_test_transform_1.SingleTestTransformLoader,
|
|
@@ -67,7 +67,7 @@ export interface Schema {
|
|
|
67
67
|
/**
|
|
68
68
|
* Global scripts to be included in the build.
|
|
69
69
|
*/
|
|
70
|
-
scripts?:
|
|
70
|
+
scripts?: ScriptElement[];
|
|
71
71
|
/**
|
|
72
72
|
* Output source maps for scripts and styles. For more information, see
|
|
73
73
|
* https://angular.io/guide/workspace-config#source-map-configuration.
|
|
@@ -80,7 +80,7 @@ export interface Schema {
|
|
|
80
80
|
/**
|
|
81
81
|
* Global styles to be included in the build.
|
|
82
82
|
*/
|
|
83
|
-
styles?:
|
|
83
|
+
styles?: StyleElement[];
|
|
84
84
|
/**
|
|
85
85
|
* The name of the TypeScript configuration file.
|
|
86
86
|
*/
|
|
@@ -128,8 +128,8 @@ export declare enum InlineStyleLanguage {
|
|
|
128
128
|
Sass = "sass",
|
|
129
129
|
Scss = "scss"
|
|
130
130
|
}
|
|
131
|
-
export declare type
|
|
132
|
-
export interface
|
|
131
|
+
export declare type ScriptElement = ScriptClass | string;
|
|
132
|
+
export interface ScriptClass {
|
|
133
133
|
/**
|
|
134
134
|
* The bundle name for this extra entry point.
|
|
135
135
|
*/
|
|
@@ -171,3 +171,18 @@ export interface StylePreprocessorOptions {
|
|
|
171
171
|
*/
|
|
172
172
|
includePaths?: string[];
|
|
173
173
|
}
|
|
174
|
+
export declare type StyleElement = StyleClass | string;
|
|
175
|
+
export interface StyleClass {
|
|
176
|
+
/**
|
|
177
|
+
* The bundle name for this extra entry point.
|
|
178
|
+
*/
|
|
179
|
+
bundleName?: string;
|
|
180
|
+
/**
|
|
181
|
+
* If the bundle will be referenced in the HTML file.
|
|
182
|
+
*/
|
|
183
|
+
inject?: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* The file to include.
|
|
186
|
+
*/
|
|
187
|
+
input: string;
|
|
188
|
+
}
|
|
@@ -33,7 +33,35 @@
|
|
|
33
33
|
"type": "array",
|
|
34
34
|
"default": [],
|
|
35
35
|
"items": {
|
|
36
|
-
"
|
|
36
|
+
"oneOf": [
|
|
37
|
+
{
|
|
38
|
+
"type": "object",
|
|
39
|
+
"properties": {
|
|
40
|
+
"input": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"description": "The file to include.",
|
|
43
|
+
"pattern": "\\.[cm]?jsx?$"
|
|
44
|
+
},
|
|
45
|
+
"bundleName": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"pattern": "^[\\w\\-.]*$",
|
|
48
|
+
"description": "The bundle name for this extra entry point."
|
|
49
|
+
},
|
|
50
|
+
"inject": {
|
|
51
|
+
"type": "boolean",
|
|
52
|
+
"description": "If the bundle will be referenced in the HTML file.",
|
|
53
|
+
"default": true
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"additionalProperties": false,
|
|
57
|
+
"required": ["input"]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"type": "string",
|
|
61
|
+
"description": "The file to include.",
|
|
62
|
+
"pattern": "\\.[cm]?jsx?$"
|
|
63
|
+
}
|
|
64
|
+
]
|
|
37
65
|
}
|
|
38
66
|
},
|
|
39
67
|
"styles": {
|
|
@@ -41,7 +69,35 @@
|
|
|
41
69
|
"type": "array",
|
|
42
70
|
"default": [],
|
|
43
71
|
"items": {
|
|
44
|
-
"
|
|
72
|
+
"oneOf": [
|
|
73
|
+
{
|
|
74
|
+
"type": "object",
|
|
75
|
+
"properties": {
|
|
76
|
+
"input": {
|
|
77
|
+
"type": "string",
|
|
78
|
+
"description": "The file to include.",
|
|
79
|
+
"pattern": "\\.(?:css|scss|sass|less|styl)$"
|
|
80
|
+
},
|
|
81
|
+
"bundleName": {
|
|
82
|
+
"type": "string",
|
|
83
|
+
"pattern": "^[\\w\\-.]*$",
|
|
84
|
+
"description": "The bundle name for this extra entry point."
|
|
85
|
+
},
|
|
86
|
+
"inject": {
|
|
87
|
+
"type": "boolean",
|
|
88
|
+
"description": "If the bundle will be referenced in the HTML file.",
|
|
89
|
+
"default": true
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"additionalProperties": false,
|
|
93
|
+
"required": ["input"]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"type": "string",
|
|
97
|
+
"description": "The file to include.",
|
|
98
|
+
"pattern": "\\.(?:css|scss|sass|less|styl)$"
|
|
99
|
+
}
|
|
100
|
+
]
|
|
45
101
|
}
|
|
46
102
|
},
|
|
47
103
|
"inlineStyleLanguage": {
|
|
@@ -218,35 +274,6 @@
|
|
|
218
274
|
"type": "string"
|
|
219
275
|
}
|
|
220
276
|
]
|
|
221
|
-
},
|
|
222
|
-
"extraEntryPoint": {
|
|
223
|
-
"oneOf": [
|
|
224
|
-
{
|
|
225
|
-
"type": "object",
|
|
226
|
-
"properties": {
|
|
227
|
-
"input": {
|
|
228
|
-
"type": "string",
|
|
229
|
-
"description": "The file to include."
|
|
230
|
-
},
|
|
231
|
-
"bundleName": {
|
|
232
|
-
"type": "string",
|
|
233
|
-
"pattern": "^[\\w\\-.]*$",
|
|
234
|
-
"description": "The bundle name for this extra entry point."
|
|
235
|
-
},
|
|
236
|
-
"inject": {
|
|
237
|
-
"type": "boolean",
|
|
238
|
-
"description": "If the bundle will be referenced in the HTML file.",
|
|
239
|
-
"default": true
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
"additionalProperties": false,
|
|
243
|
-
"required": ["input"]
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
"type": "string",
|
|
247
|
-
"description": "The file to include."
|
|
248
|
-
}
|
|
249
|
-
]
|
|
250
277
|
}
|
|
251
278
|
}
|
|
252
279
|
}
|
|
@@ -83,12 +83,6 @@ export interface Schema {
|
|
|
83
83
|
* The path where style resources will be placed, relative to outputPath.
|
|
84
84
|
*/
|
|
85
85
|
resourcesOutputPath?: string;
|
|
86
|
-
/**
|
|
87
|
-
* Show circular dependency warnings on builds.
|
|
88
|
-
* @deprecated The recommended method to detect circular dependencies in project code is to
|
|
89
|
-
* use either a lint rule or other external tooling.
|
|
90
|
-
*/
|
|
91
|
-
showCircularDependencies?: boolean;
|
|
92
86
|
/**
|
|
93
87
|
* Output source maps for scripts and styles. For more information, see
|
|
94
88
|
* https://angular.io/guide/workspace-config#source-map-configuration.
|
|
@@ -177,12 +177,6 @@
|
|
|
177
177
|
"description": "Extract all licenses in a separate file, in the case of production builds only.",
|
|
178
178
|
"default": true
|
|
179
179
|
},
|
|
180
|
-
"showCircularDependencies": {
|
|
181
|
-
"type": "boolean",
|
|
182
|
-
"description": "Show circular dependency warnings on builds.",
|
|
183
|
-
"default": false,
|
|
184
|
-
"x-deprecated": "The recommended method to detect circular dependencies in project code is to use either a lint rule or other external tooling."
|
|
185
|
-
},
|
|
186
180
|
"namedChunks": {
|
|
187
181
|
"type": "boolean",
|
|
188
182
|
"description": "Use file name for lazy loaded chunks.",
|
package/src/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
export * from './transforms';
|
|
9
|
-
export { AssetPattern, AssetPatternClass as AssetPatternObject, Budget, CrossOrigin,
|
|
9
|
+
export { AssetPattern, AssetPatternClass as AssetPatternObject, Budget, CrossOrigin, FileReplacement, OptimizationClass as OptimizationObject, OptimizationUnion, OutputHashing, Schema as BrowserBuilderOptions, SourceMapClass as SourceMapObject, SourceMapUnion, StylePreprocessorOptions, Type, } from './builders/browser/schema';
|
|
10
10
|
export { buildWebpackBrowser as executeBrowserBuilder, BrowserBuilderOutput, } from './builders/browser';
|
|
11
11
|
export { serveWebpackBrowser as executeDevServerBuilder, DevServerBuilderOptions, DevServerBuilderOutput, } from './builders/dev-server';
|
|
12
12
|
export { execute as executeExtractI18nBuilder, ExtractI18nBuilderOptions, } from './builders/extract-i18n';
|
|
@@ -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,
|
|
10
|
+
import { AssetPatternClass, Budget, CrossOrigin, I18NTranslation, IndexUnion, InlineStyleLanguage, Localize, OutputHashing, ScriptElement, SourceMapClass, StyleElement } 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';
|
|
@@ -36,7 +36,6 @@ export interface BuildOptions {
|
|
|
36
36
|
deleteOutputPath?: boolean;
|
|
37
37
|
preserveSymlinks?: boolean;
|
|
38
38
|
extractLicenses?: boolean;
|
|
39
|
-
showCircularDependencies?: boolean;
|
|
40
39
|
buildOptimizer?: boolean;
|
|
41
40
|
namedChunks?: boolean;
|
|
42
41
|
crossOrigin?: CrossOrigin;
|
|
@@ -49,8 +48,8 @@ export interface BuildOptions {
|
|
|
49
48
|
polyfills?: string;
|
|
50
49
|
budgets: Budget[];
|
|
51
50
|
assets: AssetPatternClass[];
|
|
52
|
-
scripts:
|
|
53
|
-
styles:
|
|
51
|
+
scripts: ScriptElement[];
|
|
52
|
+
styles: StyleElement[];
|
|
54
53
|
stylePreprocessorOptions?: {
|
|
55
54
|
includePaths: string[];
|
|
56
55
|
};
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import { ScriptElement, StyleElement } from '../builders/browser/schema';
|
|
9
9
|
export declare type EntryPointsType = [name: string, isModule: boolean];
|
|
10
10
|
export declare function generateEntryPoints(options: {
|
|
11
|
-
styles:
|
|
12
|
-
scripts:
|
|
11
|
+
styles: StyleElement[];
|
|
12
|
+
scripts: ScriptElement[];
|
|
13
13
|
isHMREnabled?: boolean;
|
|
14
14
|
}): EntryPointsType[];
|
|
@@ -116,12 +116,6 @@ async function getCommonConfig(wco) {
|
|
|
116
116
|
patterns: (0, helpers_1.assetPatterns)(root, buildOptions.assets),
|
|
117
117
|
}));
|
|
118
118
|
}
|
|
119
|
-
if (buildOptions.showCircularDependencies) {
|
|
120
|
-
const CircularDependencyPlugin = require('circular-dependency-plugin');
|
|
121
|
-
extraPlugins.push(new CircularDependencyPlugin({
|
|
122
|
-
exclude: /[\\/]node_modules[\\/]/,
|
|
123
|
-
}));
|
|
124
|
-
}
|
|
125
119
|
if (buildOptions.extractLicenses) {
|
|
126
120
|
const LicenseWebpackPlugin = require('license-webpack-plugin').LicenseWebpackPlugin;
|
|
127
121
|
extraPlugins.push(new LicenseWebpackPlugin({
|
|
@@ -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,
|
|
11
|
+
import { AssetPatternClass, OutputHashing, ScriptElement, StyleElement } from '../../builders/browser/schema';
|
|
12
12
|
import { WebpackConfigOptions } from '../../utils/build-options';
|
|
13
13
|
export interface HashFormat {
|
|
14
14
|
chunk: string;
|
|
@@ -17,12 +17,12 @@ export interface HashFormat {
|
|
|
17
17
|
script: string;
|
|
18
18
|
}
|
|
19
19
|
export declare function getOutputHashFormat(outputHashing?: OutputHashing, length?: number): HashFormat;
|
|
20
|
-
export declare type NormalizedEntryPoint = Required<
|
|
21
|
-
export declare function normalizeExtraEntryPoints(extraEntryPoints:
|
|
20
|
+
export declare type NormalizedEntryPoint = Required<Exclude<ScriptElement | StyleElement, string>>;
|
|
21
|
+
export declare function normalizeExtraEntryPoints(extraEntryPoints: (ScriptElement | StyleElement)[], defaultBundleName: string): NormalizedEntryPoint[];
|
|
22
22
|
export declare function assetNameTemplateFactory(hashFormat: HashFormat): (resourcePath: string) => string;
|
|
23
23
|
export declare function getInstrumentationExcludedPaths(sourceRoot: string, excludedPaths: string[]): Set<string>;
|
|
24
24
|
export declare function getCacheSettings(wco: WebpackConfigOptions, angularVersion: string): WebpackOptionsNormalized['cache'];
|
|
25
|
-
export declare function globalScriptsByBundleName(root: string, scripts:
|
|
25
|
+
export declare function globalScriptsByBundleName(root: string, scripts: ScriptElement[]): {
|
|
26
26
|
bundleName: string;
|
|
27
27
|
inject: boolean;
|
|
28
28
|
paths: string[];
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7
|
-
*/
|
|
8
|
-
export declare function isDirectory(path: string): boolean;
|
|
@@ -1,40 +0,0 @@
|
|
|
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
|
-
*/
|
|
9
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
-
}) : function(o, v) {
|
|
19
|
-
o["default"] = v;
|
|
20
|
-
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
-
if (mod && mod.__esModule) return mod;
|
|
23
|
-
var result = {};
|
|
24
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
-
__setModuleDefault(result, mod);
|
|
26
|
-
return result;
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.isDirectory = void 0;
|
|
30
|
-
// TODO: cleanup this file, it's copied as is from Angular CLI.
|
|
31
|
-
const fs = __importStar(require("fs"));
|
|
32
|
-
function isDirectory(path) {
|
|
33
|
-
try {
|
|
34
|
-
return fs.statSync(path).isDirectory();
|
|
35
|
-
}
|
|
36
|
-
catch (_) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.isDirectory = isDirectory;
|