Skip to content

Commit 6ce969a

Browse files
authored
webpack plugin updates for v5 (#2087)
* Initial GenerateSW changes. * WIP. * Basic InjectManifest functionality. * Normalize webpack option validation. * Working-ish? * Copy over some compiler options. * More mode magic * Manifest transformations should work * Normalized error reporting a bit. * Switch to Proxx's loadz0r config * Tweak the default exclude * Play nicely with SplitChunkPlugin * Add a warning about missing chunks. * Rename a test. * Updated a few comments. * Test-related updates * Further test fixes. * Pretty complete GenerateSW test suite. * InjectManifest tests. * Linting. * Copyright dates. * Update jsdoc-baseline * lockfile update * Fix the generate-sw test on Windows. * Switch to upath * Fix a proxied call to upath * Missed a @Private * A few nits.
1 parent 7b52dc4 commit 6ce969a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+4078
-3185
lines changed

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,10 @@ module.exports = {
9090
},
9191
}, {
9292
files: [
93-
'test/workbox-build/static/**/*.js',
93+
'test/*/static/**/*.js',
9494
],
9595
rules: {
96+
'no-console': 0,
9697
'no-unused-vars': 0,
9798
'no-undef': 0,
9899
},
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
Copyright 2019 Google LLC
3+
4+
Use of this source code is governed by an MIT-style
5+
license that can be found in the LICENSE file or at
6+
https://opensource.org/licenses/MIT.
7+
*/
8+
9+
const expect = require('chai').expect;
10+
const globby = require('globby');
11+
const path = require('path');
12+
13+
module.exports = async (directory, expectedContents) => {
14+
const globbedFiles = await globby(directory);
15+
const filesWithNativeSeparator =
16+
globbedFiles.map((file) => file.replace(/\//g, path.sep));
17+
expect(filesWithNativeSeparator).to.have.members(expectedContents);
18+
};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
Copyright 2019 Google LLC
3+
4+
Use of this source code is governed by an MIT-style
5+
license that can be found in the LICENSE file or at
6+
https://opensource.org/licenses/MIT.
7+
*/
8+
9+
10+
module.exports = (webpackError, stats) => {
11+
if (webpackError) {
12+
throw new Error(webpackError.message);
13+
}
14+
15+
const statsJson = stats.toJson('verbose');
16+
17+
if (statsJson.errors.length > 0) {
18+
throw new Error(statsJson.errors.join('\n'));
19+
}
20+
21+
if (statsJson.warnings.length > 0) {
22+
throw new Error(statsJson.warnings.join('\n'));
23+
}
24+
};

package-lock.json

Lines changed: 19 additions & 51 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"gzip-size": "^5.0.0",
8181
"html-webpack-plugin": "^3.2.0",
8282
"jsdoc": "^3.5.5",
83-
"jsdoc-baseline": "https://github.com/hegemonic/baseline/tarball/master",
83+
"jsdoc-baseline": "git://github.com/hegemonic/baseline.git#c492ee17",
8484
"lerna": "^3.4.0",
8585
"minimist": "^1.2.0",
8686
"mocha": "^5.2.0",

packages/workbox-build/package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/workbox-build/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"fs-extra": "^4.0.2",
2929
"glob": "^7.1.3",
3030
"lodash.template": "^4.4.0",
31-
"pretty-bytes": "^5.1.0",
31+
"pretty-bytes": "^5.2.0",
3232
"rollup": "^1.12.3",
3333
"rollup-plugin-babel": "^4.3.2",
3434
"rollup-plugin-loadz0r": "^0.7.1",
@@ -38,6 +38,7 @@
3838
"stringify-object": "^3.3.0",
3939
"strip-comments": "^1.0.2",
4040
"tempy": "^0.3.0",
41+
"upath": "^1.1.2",
4142
"workbox-background-sync": "^4.3.1",
4243
"workbox-broadcast-update": "^4.3.1",
4344
"workbox-cacheable-response": "^4.3.1",

0 commit comments

Comments
 (0)