@angular-devkit/build-webpack 0.1200.0-rc.0 → 0.1200.0
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/README.md +3 -1
- package/package.json +3 -3
- package/src/index.d.ts +1 -1
- package/src/index.js +7 -7
- package/src/utils.d.ts +1 -1
- package/src/utils.js +3 -3
- package/src/webpack/index.d.ts +1 -1
- package/src/webpack/index.js +5 -5
- package/src/webpack/schema.json +1 -3
- package/src/webpack-dev-server/index.d.ts +1 -1
- package/src/webpack-dev-server/index.js +10 -11
- package/src/webpack-dev-server/schema.json +1 -3
package/README.md
CHANGED
|
@@ -7,6 +7,7 @@ To use it on your Angular CLI app, follow these steps:
|
|
|
7
7
|
- run `npm install @angular-devkit/build-webpack`.
|
|
8
8
|
- create a webpack configuration.
|
|
9
9
|
- add the following targets inside `angular.json`.
|
|
10
|
+
|
|
10
11
|
```
|
|
11
12
|
"projects": {
|
|
12
13
|
"app": {
|
|
@@ -27,6 +28,7 @@ To use it on your Angular CLI app, follow these steps:
|
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
```
|
|
31
|
+
|
|
30
32
|
- run `ng run app:build-webpack` to build, and `ng run app:serve-webpack` to serve.
|
|
31
33
|
|
|
32
|
-
All options, including `watch` and `stats`, are looked up inside the webpack configuration.
|
|
34
|
+
All options, including `watch` and `stats`, are looked up inside the webpack configuration.
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/build-webpack",
|
|
3
|
-
"version": "0.1200.0
|
|
3
|
+
"version": "0.1200.0",
|
|
4
4
|
"description": "Webpack Builder for Architect",
|
|
5
5
|
"experimental": true,
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"typings": "src/index.d.ts",
|
|
8
8
|
"builders": "builders.json",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@angular-devkit/architect": "0.1200.0
|
|
10
|
+
"@angular-devkit/architect": "0.1200.0",
|
|
11
11
|
"rxjs": "6.6.7"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"url": "https://github.com/angular/angular-cli.git"
|
|
27
27
|
},
|
|
28
28
|
"engines": {
|
|
29
|
-
"node": "
|
|
29
|
+
"node": "^12.14.1 || ^14.0.0",
|
|
30
30
|
"npm": "^6.11.0 || ^7.5.6",
|
|
31
31
|
"yarn": ">= 1.13.0"
|
|
32
32
|
},
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
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
|
+
*/
|
|
2
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
10
|
if (k2 === undefined) k2 = k;
|
|
4
11
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
@@ -10,12 +17,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
17
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
18
|
};
|
|
12
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
/**
|
|
14
|
-
* @license
|
|
15
|
-
* Copyright Google Inc. All Rights Reserved.
|
|
16
|
-
*
|
|
17
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
18
|
-
* found in the LICENSE file at https://angular.io/license
|
|
19
|
-
*/
|
|
20
20
|
__exportStar(require("./webpack"), exports);
|
|
21
21
|
__exportStar(require("./webpack-dev-server"), exports);
|
package/src/utils.d.ts
CHANGED
package/src/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
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
|
|
@@ -16,7 +16,7 @@ function getEmittedFiles(compilation) {
|
|
|
16
16
|
for (const file of chunk.files) {
|
|
17
17
|
files.push({
|
|
18
18
|
// The id is guaranteed to exist at this point in the compilation process
|
|
19
|
-
//
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
20
20
|
id: chunk.id.toString(),
|
|
21
21
|
name: chunk.name,
|
|
22
22
|
file,
|
|
@@ -30,6 +30,6 @@ function getEmittedFiles(compilation) {
|
|
|
30
30
|
files.push({ file, extension: path.extname(file), initial: false, asset: true });
|
|
31
31
|
}
|
|
32
32
|
// dedupe
|
|
33
|
-
return files.filter(({ file, name }, index) => files.findIndex(f => f.file === file && (!name || name === f.name)) === index);
|
|
33
|
+
return files.filter(({ file, name }, index) => files.findIndex((f) => f.file === file && (!name || name === f.name)) === index);
|
|
34
34
|
}
|
|
35
35
|
exports.getEmittedFiles = getEmittedFiles;
|
package/src/webpack/index.d.ts
CHANGED
package/src/webpack/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runWebpack = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.runWebpack = void 0;
|
|
11
11
|
const architect_1 = require("@angular-devkit/architect");
|
|
12
12
|
const path_1 = require("path");
|
|
13
13
|
const rxjs_1 = require("rxjs");
|
|
@@ -30,7 +30,7 @@ function runWebpack(config, context, options = {}) {
|
|
|
30
30
|
return rxjs_1.of(webpack(c));
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
-
return createWebpack({ ...config, watch: false }).pipe(operators_1.switchMap(webpackCompiler => new rxjs_1.Observable(obs => {
|
|
33
|
+
return createWebpack({ ...config, watch: false }).pipe(operators_1.switchMap((webpackCompiler) => new rxjs_1.Observable((obs) => {
|
|
34
34
|
var _a;
|
|
35
35
|
// Webpack 5 has a compiler level close function
|
|
36
36
|
const compilerClose = (_a = webpackCompiler.close) === null || _a === void 0 ? void 0 : _a.bind(webpackCompiler);
|
|
@@ -74,7 +74,7 @@ function runWebpack(config, context, options = {}) {
|
|
|
74
74
|
}
|
|
75
75
|
catch (err) {
|
|
76
76
|
if (err) {
|
|
77
|
-
context.logger.error(`\nAn error occurred during the build:\n${err && err.stack || err}`);
|
|
77
|
+
context.logger.error(`\nAn error occurred during the build:\n${(err && err.stack) || err}`);
|
|
78
78
|
}
|
|
79
79
|
throw err;
|
|
80
80
|
}
|
package/src/webpack/schema.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runWebpackDevServer = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.runWebpackDevServer = void 0;
|
|
11
11
|
const architect_1 = require("@angular-devkit/architect");
|
|
12
12
|
const path_1 = require("path");
|
|
13
13
|
const rxjs_1 = require("rxjs");
|
|
@@ -33,23 +33,22 @@ function runWebpackDevServer(config, context, options = {}) {
|
|
|
33
33
|
const createWebpackDevServer = (webpack, config) => {
|
|
34
34
|
if (options.webpackDevServerFactory) {
|
|
35
35
|
// webpack-dev-server types currently do not support Webpack 5
|
|
36
|
-
//
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
37
37
|
return new options.webpackDevServerFactory(webpack, config);
|
|
38
38
|
}
|
|
39
39
|
// webpack-dev-server types currently do not support Webpack 5
|
|
40
|
-
//
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
41
|
return new WebpackDevServer(webpack, config);
|
|
42
42
|
};
|
|
43
|
-
const log = options.logging
|
|
44
|
-
|
|
45
|
-
// tslint:disable-next-line: no-any
|
|
43
|
+
const log = options.logging || ((stats, config) => context.logger.info(stats.toString(config.stats)));
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46
45
|
const devServerConfig = options.devServerConfig || config.devServer || {};
|
|
47
46
|
if (devServerConfig.stats) {
|
|
48
47
|
config.stats = devServerConfig.stats;
|
|
49
48
|
}
|
|
50
49
|
// Disable stats reporting by the devserver, we have our own logger.
|
|
51
50
|
devServerConfig.stats = false;
|
|
52
|
-
return createWebpack({ ...config, watch: false }).pipe(operators_1.switchMap(webpackCompiler => new rxjs_1.Observable(obs => {
|
|
51
|
+
return createWebpack({ ...config, watch: false }).pipe(operators_1.switchMap((webpackCompiler) => new rxjs_1.Observable((obs) => {
|
|
53
52
|
const server = createWebpackDevServer(webpackCompiler, devServerConfig);
|
|
54
53
|
let result;
|
|
55
54
|
webpackCompiler.hooks.done.tap('build-webpack', (stats) => {
|
|
@@ -81,11 +80,11 @@ function runWebpackDevServer(config, context, options = {}) {
|
|
|
81
80
|
}
|
|
82
81
|
});
|
|
83
82
|
// Teardown logic. Close the server when unsubscribed from.
|
|
84
|
-
return (
|
|
83
|
+
return () => {
|
|
85
84
|
var _a;
|
|
86
85
|
server.close();
|
|
87
86
|
(_a = webpackCompiler.close) === null || _a === void 0 ? void 0 : _a.call(webpackCompiler, () => { });
|
|
88
|
-
}
|
|
87
|
+
};
|
|
89
88
|
})));
|
|
90
89
|
}
|
|
91
90
|
exports.runWebpackDevServer = runWebpackDevServer;
|