@angular-devkit/build-webpack 0.900.0-rc.7 → 0.900.1
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 +3 -4
- package/src/index.d.ts +0 -1
- package/src/index.js +4 -5
- package/src/utils.js +2 -0
- package/src/plugins/architect.d.ts +0 -17
- package/src/plugins/architect.js +0 -137
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/build-webpack",
|
|
3
|
-
"version": "0.900.
|
|
3
|
+
"version": "0.900.1",
|
|
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.900.
|
|
11
|
-
"@angular-devkit/core": "9.0.
|
|
10
|
+
"@angular-devkit/architect": "0.900.1",
|
|
11
|
+
"@angular-devkit/core": "9.0.1",
|
|
12
12
|
"rxjs": "6.5.3"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"engines": {
|
|
30
30
|
"node": ">= 10.13.0",
|
|
31
31
|
"npm": ">= 6.11.0",
|
|
32
|
-
"pnpm": ">= 3.2.0",
|
|
33
32
|
"yarn": ">= 1.13.0"
|
|
34
33
|
},
|
|
35
34
|
"author": "Angular Authors",
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
function __export(m) {
|
|
3
|
+
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
4
|
+
}
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
6
|
/**
|
|
3
7
|
* @license
|
|
4
8
|
* Copyright Google Inc. All Rights Reserved.
|
|
@@ -6,10 +10,5 @@
|
|
|
6
10
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
11
|
* found in the LICENSE file at https://angular.io/license
|
|
8
12
|
*/
|
|
9
|
-
function __export(m) {
|
|
10
|
-
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__export(require("./webpack"));
|
|
14
14
|
__export(require("./webpack-dev-server"));
|
|
15
|
-
__export(require("./plugins/architect"));
|
package/src/utils.js
CHANGED
|
@@ -14,6 +14,8 @@ function getEmittedFiles(compilation) {
|
|
|
14
14
|
for (const chunk of compilation.chunks) {
|
|
15
15
|
for (const file of chunk.files) {
|
|
16
16
|
files.push({
|
|
17
|
+
// The id is guaranteed to exist at this point in the compilation process
|
|
18
|
+
// tslint:disable-next-line: no-non-null-assertion
|
|
17
19
|
id: chunk.id.toString(),
|
|
18
20
|
name: chunk.name,
|
|
19
21
|
file,
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright Google Inc. 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
|
-
import { BuilderContext } from '@angular-devkit/architect';
|
|
9
|
-
import * as webpack from 'webpack';
|
|
10
|
-
/**
|
|
11
|
-
* A webpack plugin that reports status and progress to Architect.
|
|
12
|
-
*/
|
|
13
|
-
export declare class ArchitectPlugin {
|
|
14
|
-
protected context: BuilderContext;
|
|
15
|
-
constructor(context: BuilderContext);
|
|
16
|
-
apply(compiler: webpack.Compiler): void;
|
|
17
|
-
}
|
package/src/plugins/architect.js
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const core_1 = require("@angular-devkit/core");
|
|
4
|
-
const path = require("path");
|
|
5
|
-
/**
|
|
6
|
-
* This list was taken from a list of events we want to listen to, from the list of hooks in
|
|
7
|
-
* webpack's typings.
|
|
8
|
-
*/
|
|
9
|
-
const hookSafelist = [
|
|
10
|
-
'seal',
|
|
11
|
-
'optimizeDependenciesBasic',
|
|
12
|
-
'optimizeDependencies',
|
|
13
|
-
'optimizeDependenciesAdvanced',
|
|
14
|
-
'afterOptimizeDependencies',
|
|
15
|
-
'optimize',
|
|
16
|
-
'optimizeModulesBasic',
|
|
17
|
-
'optimizeModules',
|
|
18
|
-
'optimizeModulesAdvanced',
|
|
19
|
-
'afterOptimizeModules',
|
|
20
|
-
'optimizeChunksBasic',
|
|
21
|
-
'optimizeChunks',
|
|
22
|
-
'optimizeChunksAdvanced',
|
|
23
|
-
'afterOptimizeChunks',
|
|
24
|
-
'optimizeTree',
|
|
25
|
-
'afterOptimizeTree',
|
|
26
|
-
'optimizeChunkModulesBasic',
|
|
27
|
-
'optimizeChunkModules',
|
|
28
|
-
'optimizeChunkModulesAdvanced',
|
|
29
|
-
'afterOptimizeChunkModules',
|
|
30
|
-
'reviveModules',
|
|
31
|
-
'optimizeModuleOrder',
|
|
32
|
-
'advancedOptimizeModuleOrder',
|
|
33
|
-
'beforeModuleIds',
|
|
34
|
-
'moduleIds',
|
|
35
|
-
'optimizeModuleIds',
|
|
36
|
-
'afterOptimizeModuleIds',
|
|
37
|
-
'reviveChunks',
|
|
38
|
-
'optimizeChunkOrder',
|
|
39
|
-
'beforeChunkIds',
|
|
40
|
-
'optimizeChunkIds',
|
|
41
|
-
'afterOptimizeChunkIds',
|
|
42
|
-
'recordModules',
|
|
43
|
-
'recordChunks',
|
|
44
|
-
'beforeHash',
|
|
45
|
-
'afterHash',
|
|
46
|
-
'recordHash',
|
|
47
|
-
'record',
|
|
48
|
-
'beforeModuleAssets',
|
|
49
|
-
'shouldGenerateChunkAssets',
|
|
50
|
-
'beforeChunkAssets',
|
|
51
|
-
'additionalChunkAssets',
|
|
52
|
-
'additionalAssets',
|
|
53
|
-
'optimizeChunkAssets',
|
|
54
|
-
'afterOptimizeChunkAssets',
|
|
55
|
-
'optimizeAssets',
|
|
56
|
-
'afterOptimizeAssets',
|
|
57
|
-
'afterSeal',
|
|
58
|
-
'optimizeExtractedChunksBasic',
|
|
59
|
-
'optimizeExtractedChunks',
|
|
60
|
-
'optimizeExtractedChunksAdvanced',
|
|
61
|
-
'afterOptimizeExtractedChunks',
|
|
62
|
-
];
|
|
63
|
-
/**
|
|
64
|
-
* A webpack plugin that reports status and progress to Architect.
|
|
65
|
-
*/
|
|
66
|
-
class ArchitectPlugin {
|
|
67
|
-
constructor(context) {
|
|
68
|
-
this.context = context;
|
|
69
|
-
}
|
|
70
|
-
apply(compiler) {
|
|
71
|
-
const context = this.context;
|
|
72
|
-
let modulesCount = 0;
|
|
73
|
-
let modulesDone = 0;
|
|
74
|
-
let hooksDone = 0;
|
|
75
|
-
let numberOfHooks = 0;
|
|
76
|
-
let reset = false; // Will be true when a full compilation is done.
|
|
77
|
-
function done() {
|
|
78
|
-
modulesDone = modulesCount;
|
|
79
|
-
hooksDone = Math.max(hooksDone, numberOfHooks);
|
|
80
|
-
update('Done.');
|
|
81
|
-
reset = true;
|
|
82
|
-
}
|
|
83
|
-
function update(status) {
|
|
84
|
-
context.reportProgress(modulesDone + hooksDone, modulesCount + Math.max(hooksDone, numberOfHooks), status);
|
|
85
|
-
}
|
|
86
|
-
function updateModule(module) {
|
|
87
|
-
// This is safe since we still verify it.
|
|
88
|
-
const m = module;
|
|
89
|
-
const moduleId = '' + (typeof m.identifier == 'function' ? m.identifier() : '');
|
|
90
|
-
const id = moduleId.split(/!|\s+|\bmulti\b/).slice(-1)[0].trim();
|
|
91
|
-
const p = path.relative(context.workspaceRoot, id);
|
|
92
|
-
update(`Building ${p}`);
|
|
93
|
-
}
|
|
94
|
-
function buildModule(module) {
|
|
95
|
-
modulesCount++;
|
|
96
|
-
updateModule(module);
|
|
97
|
-
}
|
|
98
|
-
function failedModule(module) {
|
|
99
|
-
modulesDone++;
|
|
100
|
-
updateModule(module);
|
|
101
|
-
}
|
|
102
|
-
function succeedModule(module) {
|
|
103
|
-
modulesDone++;
|
|
104
|
-
updateModule(module);
|
|
105
|
-
}
|
|
106
|
-
// On the start of a new compilation, maybe reset the counters (and update the total), then
|
|
107
|
-
// listen to all hooks we're interested in.
|
|
108
|
-
compiler.hooks.compilation.tap('ArchitectPlugin', compilation => {
|
|
109
|
-
const hooks = hookSafelist;
|
|
110
|
-
if (reset) {
|
|
111
|
-
reset = false;
|
|
112
|
-
modulesCount = modulesDone = hooksDone = numberOfHooks = 0;
|
|
113
|
-
}
|
|
114
|
-
// Need to add hooks for each compilation.
|
|
115
|
-
numberOfHooks += hooks.length;
|
|
116
|
-
// Pre-emptively tell the user.
|
|
117
|
-
context.reportRunning();
|
|
118
|
-
update('Preparing...');
|
|
119
|
-
compilation.hooks.buildModule.tap('ArchitectPlugin', buildModule);
|
|
120
|
-
compilation.hooks.failedModule.tap('ArchitectPlugin', failedModule);
|
|
121
|
-
compilation.hooks.succeedModule.tap('ArchitectPlugin', succeedModule);
|
|
122
|
-
for (const name of hooks) {
|
|
123
|
-
// Transforms `camelCase` into `Camel case`. decamelize() transforms it into `camel_case`
|
|
124
|
-
// and then we replace the `_` with spaces.
|
|
125
|
-
const title = core_1.strings.capitalize(core_1.strings.decamelize(name).replace(/_/g, ' '));
|
|
126
|
-
compilation.hooks[name].intercept({
|
|
127
|
-
call: () => {
|
|
128
|
-
hooksDone++;
|
|
129
|
-
update(title);
|
|
130
|
-
},
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
compiler.hooks.done.tap('ArchitectPlugin', done);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
exports.ArchitectPlugin = ArchitectPlugin;
|