Update webpack to version 5
Showing 1 of 9 files from the diff.
src/clean-webpack-plugin.ts
changed.
Other files ignored by Codecov
package.json
has changed.
dev-utils/node-version.test.js
has changed.
.circleci/config.yml
has changed.
dev-utils/test-supported-webpack-versions.js
has changed.
dev-utils/node-version.js
has changed.
appveyor.yml
has changed.
src/clean-webpack-plugin.test.ts
has changed.
README.md
has changed.
@@ -1,8 +1,6 @@
Loading
1 | - | import path from 'path'; |
|
2 | 1 | import { sync as delSync } from 'del'; |
|
3 | - | import { Compiler, Stats, compilation as compilationType } from 'webpack'; |
|
4 | - | ||
5 | - | type Compilation = compilationType.Compilation; |
|
2 | + | import path from 'path'; |
|
3 | + | import { Compilation, Compiler, Stats } from 'webpack'; |
|
6 | 4 | ||
7 | 5 | export interface Options { |
|
8 | 6 | /** |
@@ -180,36 +178,19 @@
Loading
180 | 178 | * webpack 4+ comes with a new plugin system. |
|
181 | 179 | * |
|
182 | 180 | * Check for hooks in-order to support old plugin system |
|
181 | + | * webpack 5+ removed the old system, the check now breaks |
|
183 | 182 | */ |
|
184 | 183 | const hooks = compiler.hooks; |
|
185 | 184 | ||
186 | 185 | if (this.cleanOnceBeforeBuildPatterns.length !== 0) { |
|
187 | - | if (hooks) { |
|
188 | - | hooks.emit.tap('clean-webpack-plugin', (compilation) => { |
|
189 | - | this.handleInitial(compilation); |
|
190 | - | }); |
|
191 | - | } else { |
|
192 | - | compiler.plugin('emit', (compilation, callback) => { |
|
193 | - | try { |
|
194 | - | this.handleInitial(compilation); |
|
195 | - | ||
196 | - | callback(); |
|
197 | - | } catch (error) { |
|
198 | - | callback(error); |
|
199 | - | } |
|
200 | - | }); |
|
201 | - | } |
|
202 | - | } |
|
203 | - | ||
204 | - | if (hooks) { |
|
205 | - | hooks.done.tap('clean-webpack-plugin', (stats) => { |
|
206 | - | this.handleDone(stats); |
|
207 | - | }); |
|
208 | - | } else { |
|
209 | - | compiler.plugin('done', (stats) => { |
|
210 | - | this.handleDone(stats); |
|
186 | + | hooks.emit.tap('clean-webpack-plugin', (compilation) => { |
|
187 | + | this.handleInitial(compilation); |
|
211 | 188 | }); |
|
212 | 189 | } |
|
190 | + | ||
191 | + | hooks.done.tap('clean-webpack-plugin', (stats) => { |
|
192 | + | this.handleDone(stats); |
|
193 | + | }); |
|
213 | 194 | } |
|
214 | 195 | ||
215 | 196 | /** |
@@ -257,16 +238,7 @@
Loading
257 | 238 | /** |
|
258 | 239 | * Fetch Webpack's output asset files |
|
259 | 240 | */ |
|
260 | - | const assets = |
|
261 | - | stats.toJson( |
|
262 | - | { |
|
263 | - | assets: true, |
|
264 | - | }, |
|
265 | - | true, |
|
266 | - | ).assets || []; |
|
267 | - | const assetList = assets.map((asset: { name: string }) => { |
|
268 | - | return asset.name; |
|
269 | - | }); |
|
241 | + | const assetList = Object.keys(stats.compilation.assets); |
|
270 | 242 | ||
271 | 243 | /** |
|
272 | 244 | * Get all files that were in the previous build but not the current |
@@ -348,6 +320,7 @@
Loading
348 | 320 | throw new Error(message); |
|
349 | 321 | } |
|
350 | 322 | ||
323 | + | /* istanbul ignore next */ |
|
351 | 324 | throw error; |
|
352 | 325 | } |
|
353 | 326 | } |
Files | Coverage |
---|---|
src/clean-webpack-plugin.ts | 100.00% |
Project Totals (1 files) | 100.00% |
pgq94095mfr4hxwb
pgq94095mfr4hxwb
bi5b9bgpk8ui28c9
bi5b9bgpk8ui28c9
310hnai925evltec
bi5b9bgpk8ui28c9
310hnai925evltec
310hnai925evltec
46pkpl8bvgkftw77
46pkpl8bvgkftw77
g7u27mqcabw0s6rq
46pkpl8bvgkftw77
g7u27mqcabw0s6rq
g7u27mqcabw0s6rq
8xf3553xiwwi8n6e
8xf3553xiwwi8n6e
pgq94095mfr4hxwb
8xf3553xiwwi8n6e
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.