Skip to content

Commit

Permalink
feature #878 [Webpack5] Using old watchOptions regexp & removing Node…
Browse files Browse the repository at this point in the history
… 13 support (weaverryan)

This PR was squashed before being merged into the main branch.

Discussion
----------

[Webpack5] Using old watchOptions regexp & removing Node 13 support

2 quick, minor follow-ups from #645.

* Removed Node 13, as it is no longer supported
* Changed the ignored back to a regular expression, which it was originally and once again a regexp works: #645 (comment)
* Upgraded to Stimulus 2, which the stimulus bridge now depends on

Commits
-------

816003e updating hashes for latest deps
ad714b7 upgrading to stimulus 2
3a4005c upgrading deps
4e0aa70 fixing tests
3c43cea removing support for Node 13
343a4fe changing watch options ignored back to a regexp to match previous behavior
  • Loading branch information
weaverryan committed Jan 1, 2021
2 parents 6cca5b8 + 816003e commit 7a4794d
Show file tree
Hide file tree
Showing 6 changed files with 675 additions and 711 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ matrix:
node_js: "12"
env: JOB_PART=test
- os: linux
node_js: "13"
node_js: "14"
env: JOB_PART=test

script: npm run $JOB_PART
2 changes: 1 addition & 1 deletion lib/config-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ class ConfigGenerator {

buildWatchOptionsConfig() {
const watchOptions = {
ignored: 'node_modules'
ignored: /node_modules/
};

return applyOptionsCallback(
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"url": "https://github.com/symfony/webpack-encore/issues"
},
"engines": {
"node": "^10.22.1 || >=12.0.0"
"node": "^10.22.1 || ^12.0.0 || >=14.0.0"
},
"homepage": "https://github.com/symfony/webpack-encore",
"dependencies": {
Expand Down Expand Up @@ -91,7 +91,7 @@
"sass": "^1.17.0",
"sass-loader": "^9.0.1 || ^10.0.0",
"sinon": "^9.0.2",
"stimulus": "^1.1.1",
"stimulus": "^2.0.0",
"strip-ansi": "^6.0.0",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.2",
Expand Down
10 changes: 5 additions & 5 deletions test/config-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -681,11 +681,11 @@ describe('The config-generator function', () => {
const actualConfig = configGenerator(config);

expect(actualConfig.watchOptions).to.deep.equals({
'ignored': 'node_modules',
'ignored': /node_modules/,
'poll': 250,
});
expect(actualConfig.devServer.watchOptions).to.deep.equals({
'ignored': 'node_modules',
'ignored': /node_modules/,
'poll': 250,
});
});
Expand All @@ -709,11 +709,11 @@ describe('The config-generator function', () => {

const actualConfig = configGenerator(config);
expect(actualConfig.watchOptions).to.deep.equals({
'ignored': 'node_modules',
'ignored': /node_modules/,
'poll': 250,
});
expect(actualConfig.devServer.watchOptions).to.deep.equals({
'ignored': 'node_modules',
'ignored': /node_modules/,
'poll': 500,
});
});
Expand Down Expand Up @@ -1139,7 +1139,7 @@ describe('The config-generator function', () => {

const actualConfig = configGenerator(config);
expect(actualConfig.watchOptions).to.deep.equals({
ignored: 'node_modules',
ignored: /node_modules/,
poll: 250,
});
});
Expand Down
46 changes: 23 additions & 23 deletions test/functional.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,24 +421,24 @@ describe('Functional tests using webpack', function() {
if (!process.env.DISABLE_UNSTABLE_CHECKS) {
expect(config.outputPath).to.be.a.directory()
.with.files([
'main.afbd5350.js',
'styles.622a49c8.css',
'main.8b8ca4a9.js',
'styles.79943add.css',
'manifest.json',
'entrypoints.json',
'runtime.f18eb18e.js',
'runtime.49688a3c.js',
]);
}

webpackAssert.assertOutputFileContains(
'styles.622a49c8.css',
'styles.79943add.css',
'font-size: 50px;'
);
webpackAssert.assertManifestPathDoesNotExist(
'styles.js'
);
webpackAssert.assertManifestPath(
'styles.css',
'/styles.622a49c8.css'
'/styles.79943add.css'
);

done();
Expand Down Expand Up @@ -469,7 +469,7 @@ describe('Functional tests using webpack', function() {
);
webpackAssert.assertManifestPath(
'styles.css',
'/styles.css?622a49c83650a792'
'/styles.css?79943addbc894efe'
);

done();
Expand Down Expand Up @@ -524,14 +524,14 @@ describe('Functional tests using webpack', function() {
if (!process.env.DISABLE_UNSTABLE_CHECKS) {
expect(config.outputPath).to.be.a.directory()
.with.files([
'js_no_require_js-css_h1_style_css.141b339c.js', // chunks are also versioned
'js_no_require_js-css_h1_style_css.622a49c8.css',
'main.fb2d11f3.js',
'h1.622a49c8.css',
'bg.b7945d2f.css',
'js_no_require_js-css_h1_style_css.456c237a.js', // chunks are also versioned
'js_no_require_js-css_h1_style_css.79943add.css',
'main.04316e30.js',
'h1.79943add.css',
'bg.2eff0999.css',
'manifest.json',
'entrypoints.json',
'runtime.3f2b2a52.js',
'runtime.d0652ec8.js',
]);
}

Expand All @@ -541,7 +541,7 @@ describe('Functional tests using webpack', function() {
]);

webpackAssert.assertOutputFileContains(
'bg.b7945d2f.css',
'bg.2eff0999.css',
'/build/images/symfony_logo.91beba37.png'
);

Expand Down Expand Up @@ -2172,7 +2172,7 @@ module.exports = {
expect(config.outputPath).to.be.a.directory()
.with.files([
'entrypoints.json',
'runtime.4f76f3db.js',
'runtime.fbc90386.js',
'main.06a6c20f.js',
'manifest.json',
'symfony_logo.91beba37.png',
Expand Down Expand Up @@ -2856,9 +2856,9 @@ module.exports = {
testSetup.runWebpack(config, () => {
const integrityData = getIntegrityData(config);
const expectedHashes = {
'/build/runtime.js': 'sha384-p8aiVYzE72gFU9tbAEAWeKJ6VZRy/rNimQvHS2wmt7g8P0bpWep5mi7fHbopcq4q',
'/build/main.js': 'sha384-lWnwnMxveuaL9u9aGsZK+d3ATMcuoBnniCpQjRmvIsdf3IpqBRJSXIwE4lYz9V2o',
'/build/css_roboto_font_css.js': 'sha384-lHK1hVSXZOP/PriXKAfoTLCWrOt8hdzSd7oAP4Nck7oVCTwsrzdi4ucbT/F08go6',
'/build/runtime.js': 'sha384-sWtvs9g2amKt9La790kUHfXRL3/D/4EVnpCBTGwhEnFk2qB5M6utpeyUG1iastim',
'/build/main.js': 'sha384-T5WVgtgFWOxq1ht+51tv1dEyU9N9sd654EW4hkYTSe3Y0S6S0GsqT0vQqEqgXplJ',
'/build/css_roboto_font_css.js': 'sha384-ezqcmKZI0XEQOrt/3ujcoi6QVOBXmwUTg3FaQrapMoCIfqcBR4UeA1VFFk/TC7pr',
'/build/css_roboto_font_css.css': 'sha384-CwxeOsagC0TZKZIMFU7gd1fQG1nbF7wHg/uLJSsU/5Soa9JwEOZcAzAFMmctn6kX',
'/build/other.js': 'sha384-7N+Gb+SIHbD7k6HUnvgewUaa5bsFMWAgT1W0JZfxRmapgmaWl/CjFBdflUIkHbN2',

Expand Down Expand Up @@ -2889,9 +2889,9 @@ module.exports = {
testSetup.runWebpack(config, () => {
const integrityData = getIntegrityData(config);
const expectedHashes = {
'http://localhost:8090/assets/runtime.js': 'sha256-cYoqouDllgl1kNHvSud4dSR/flqOaVHy7AsT+NFsno4=',
'http://localhost:8090/assets/main.js': 'sha256-dC3oNzx4D+im2fP3VerzmerPhl8v+PwY4/v/Si29AAE=',
'http://localhost:8090/assets/css_roboto_font_css.js': 'sha256-WRRXgEBenC+Jq0wieUXHRPSk3eEbJOSprTSCAwtDmoo=',
'http://localhost:8090/assets/runtime.js': 'sha256-w0M8cHCCwzEXG16d6iF4p8Lw5k/VdyTrAq11y7r1G6s=',
'http://localhost:8090/assets/main.js': 'sha256-bQvagKObeH+zUckvtNx9iGP4H+6LfSLVulHU2W2lNiI=',
'http://localhost:8090/assets/css_roboto_font_css.js': 'sha256-CF+O0Dp/km2nfjreZlnMSkZInJqzyU9Pyd0iw6d5jtE=',
'http://localhost:8090/assets/css_roboto_font_css.css': 'sha256-GyGOCV1nJYunb8s/DT5wICbruabZcqzDFJRnXIlZ9I4=',
'http://localhost:8090/assets/other.js': 'sha256-whQp2WqCTuFelVuYVjRY2aulbtVDlNhu8+FmsAYLTrs=',

Expand Down Expand Up @@ -2921,9 +2921,9 @@ module.exports = {
testSetup.runWebpack(config, () => {
const integrityData = getIntegrityData(config);
const expectedHashes = {
'/build/runtime.js': 'sha256-cYoqouDllgl1kNHvSud4dSR/flqOaVHy7AsT+NFsno4= sha512-jSemykJUp8rsdyGuSTqLI8ucgU9/z7si0zGl05K1AS24J5PnVm70ARjI3xpgtuLTqtsIPj/c6EoYB7Zyr7aJcA==',
'/build/main.js': 'sha256-dC3oNzx4D+im2fP3VerzmerPhl8v+PwY4/v/Si29AAE= sha512-ukzKOjdNhea8dzllJTSNwiqw4HUSrv71AOm3gf4oB4ciQ8SMVXZFCFg04TEeAscsnXOSsTSrTTCkpTA4rdg00Q==',
'/build/css_roboto_font_css.js': 'sha256-WRRXgEBenC+Jq0wieUXHRPSk3eEbJOSprTSCAwtDmoo= sha512-uFFiXMiYSFeTKqkCDTKnIfRrwpSSRPZap+TxknjRMXOZl9UEWKOLKl8I+vW6HiNC/E9duy9lzGd9KpyotQOagw==',
'/build/runtime.js': 'sha256-w0M8cHCCwzEXG16d6iF4p8Lw5k/VdyTrAq11y7r1G6s= sha512-cYIvzvPfRcY04V5yPYT3xFuPFgia8H/cdX5NHhWUXDNt9xoCooYAuodt69WT9R4OK4c9gYNY7tEaX2K+zMnpPw==',
'/build/main.js': 'sha256-bQvagKObeH+zUckvtNx9iGP4H+6LfSLVulHU2W2lNiI= sha512-hoVM8C7Iuvv9I+tQ6VXR3i5EiSv1IUmcefJBYX6gfGNirdvLI7GbxohtqOkXLIOV2n56nVk3zVh3tLVmen5snQ==',
'/build/css_roboto_font_css.js': 'sha256-CF+O0Dp/km2nfjreZlnMSkZInJqzyU9Pyd0iw6d5jtE= sha512-0MeLokYDlL6kv7nwE21SU0Rsa/om9+qXEkD2nCavkXx2y3usGO42dUjqnozwo4XSCs6TZnMsk61Me1vfnGyREA==',
'/build/css_roboto_font_css.css': 'sha256-bsTMZz4D7wBon35PnVm0dN51OH4EMq79NRecjZVoJ0A= sha512-kUbxtlmFlqBd+mB0P2HfsGoTZDGjdPz/BT9wc7l5fdSkML8CCNGg/ccrWXglUNIdgH10y92Jf8zIOHTRygXwxQ==',
'/build/other.js': 'sha256-whQp2WqCTuFelVuYVjRY2aulbtVDlNhu8+FmsAYLTrs= sha512-cCUSLiPQTh5YN3iNdkrac880//+i9mhgTT5CdGUfe8oBVR+WjeIOIqqTEsalGiFraaSKFfuRUSsMMoBhUpAdcw==',

Expand Down

0 comments on commit 7a4794d

Please sign in to comment.