Skip to content

Commit d2622d0

Browse files
committed
feature #540 Update various dependencies and remove the LoaderOptionsPlugin (Lyrkan)
This PR was merged into the master branch. Discussion ---------- Update various dependencies and remove the LoaderOptionsPlugin This PR updates various dependencies that were either really outdated or subject to security issues. Since most of those packages are listed in our dev dependencies it shouldn't have a big impact on most users, but the following changes could be an issue for some of them: * The `css-loader` was updated from `^1.0.0` to `^2.1.1` ([breaking changes](https://github.com/webpack-contrib/css-loader/blob/master/CHANGELOG.md#200-2018-12-07)) * The `resolve-url-loader` was updated from `^2.3.0` to `^3.0.1` ([breaking changes](https://github.com/bholloway/resolve-url-loader/tree/master/packages/resolve-url-loader#version-3), closes #428 and closes #534) * The minimum version of NodeJS was bumped from 6 to 8 (needed to update `zombie`, and v6's end-of-life happening in less than a month anyway) * The [`LoaderOptionsPlugin`](https://webpack.js.org/plugins/loader-options-plugin/) was removed since it should not be needed anymore and caused a *really annoying* bug when used with the latest version of the `resolve-url-loader` (see #428 (comment)) Commits ------- aeea89b Update various dependencies and remove the LoaderOptionsPlugin
2 parents b91f16a + aeea89b commit d2622d0

File tree

14 files changed

+1306
-1921
lines changed

14 files changed

+1306
-1921
lines changed

.appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cache:
33
- "%LOCALAPPDATA%\\Yarn"
44

55
environment:
6-
nodejs_version: "6"
6+
nodejs_version: "8"
77

88
platform:
99
- x86

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ matrix:
3030
- os: linux
3131
node_js: "10"
3232
env: JOB_PART=travis:lint
33+
- os: linux
34+
node_js: "11"
35+
env: JOB_PART=test
3336
- os: linux
3437
node_js: "10"
3538
env: JOB_PART=test
@@ -39,8 +42,5 @@ matrix:
3942
- os: linux
4043
node_js: "8"
4144
env: JOB_PART=test
42-
- os: linux
43-
node_js: "6"
44-
env: JOB_PART=test
4545

4646
script: npm run $JOB_PART

index.js

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -164,25 +164,6 @@ class Encore {
164164
return this;
165165
}
166166

167-
/**
168-
* Allows you to configure the options passed to the LoaderOptionsPlugins.
169-
* A list of available options can be found at https://webpack.js.org/plugins/loader-options-plugin/
170-
*
171-
* For example:
172-
*
173-
* Encore.configureLoaderOptionsPlugin((options) => {
174-
* options.minimize = true;
175-
* })
176-
*
177-
* @param {function} loaderOptionsPluginOptionsCallback
178-
* @returns {Encore}
179-
*/
180-
configureLoaderOptionsPlugin(loaderOptionsPluginOptionsCallback = () => {}) {
181-
webpackConfig.configureLoaderOptionsPlugin(loaderOptionsPluginOptionsCallback);
182-
183-
return this;
184-
}
185-
186167
/**
187168
* Allows you to configure the options passed to webpack-manifest-plugin.
188169
* A list of available options can be found at https://github.com/danethurber/webpack-manifest-plugin
@@ -1297,6 +1278,14 @@ class Encore {
12971278
configureUglifyJsPlugin() {
12981279
throw new Error('The configureUglifyJsPlugin() method was removed from Encore due to uglify-js dropping ES6+ support in its latest version. Please use configureTerserPlugin() instead.');
12991280
}
1281+
1282+
/**
1283+
* @deprecated
1284+
* @return {void}
1285+
*/
1286+
configureLoaderOptionsPlugin() {
1287+
throw new Error('The configureLoaderOptionsPlugin() method was removed from Encore. The underlying plugin should not be needed anymore unless you are using outdated loaders. If that\'s the case you can still add it using addPlugin().');
1288+
}
13001289
}
13011290

13021291
// Proxy the API in order to prevent calls to most of its methods

lib/WebpackConfig.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ class WebpackConfig {
123123
this.definePluginOptionsCallback = () => {};
124124
this.forkedTypeScriptTypesCheckOptionsCallback = () => {};
125125
this.friendlyErrorsPluginOptionsCallback = () => {};
126-
this.loaderOptionsPluginOptionsCallback = () => {};
127126
this.manifestPluginOptionsCallback = () => {};
128127
this.terserPluginOptionsCallback = () => {};
129128
this.optimizeCssPluginOptionsCallback = () => {};
@@ -222,14 +221,6 @@ class WebpackConfig {
222221
this.friendlyErrorsPluginOptionsCallback = friendlyErrorsPluginOptionsCallback;
223222
}
224223

225-
configureLoaderOptionsPlugin(loaderOptionsPluginOptionsCallback = () => {}) {
226-
if (typeof loaderOptionsPluginOptionsCallback !== 'function') {
227-
throw new Error('Argument 1 to configureLoaderOptionsPlugin() must be a callback function');
228-
}
229-
230-
this.loaderOptionsPluginOptionsCallback = loaderOptionsPluginOptionsCallback;
231-
}
232-
233224
configureManifestPlugin(manifestPluginOptionsCallback = () => {}) {
234225
if (typeof manifestPluginOptionsCallback !== 'function') {
235226
throw new Error('Argument 1 to configureManifestPlugin() must be a callback function');

lib/config-generator.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const miniCssExtractPluginUtil = require('./plugins/mini-css-extract');
2727
const deleteUnusedEntriesPluginUtil = require('./plugins/delete-unused-entries');
2828
const entryFilesManifestPlugin = require('./plugins/entry-files-manifest');
2929
const manifestPluginUtil = require('./plugins/manifest');
30-
const loaderOptionsPluginUtil = require('./plugins/loader-options');
3130
const versioningPluginUtil = require('./plugins/versioning');
3231
const variableProviderPluginUtil = require('./plugins/variable-provider');
3332
const cleanPluginUtil = require('./plugins/clean');
@@ -409,8 +408,6 @@ class ConfigGenerator {
409408
// Dump the manifest.json file
410409
manifestPluginUtil(plugins, this.webpackConfig);
411410

412-
loaderOptionsPluginUtil(plugins, this.webpackConfig);
413-
414411
versioningPluginUtil(plugins, this.webpackConfig);
415412

416413
variableProviderPluginUtil(plugins, this.webpackConfig);

lib/loaders/css.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ module.exports = {
2222
const usePostCssLoader = webpackConfig.usePostCssLoader;
2323

2424
const options = {
25-
minimize: webpackConfig.isProduction(),
2625
sourceMap: webpackConfig.useSourceMaps,
2726
// when using @import, how many loaders *before* css-loader should
2827
// be applied to those imports? This defaults to 0. When postcss-loader

lib/plugins/loader-options.js

Lines changed: 0 additions & 45 deletions
This file was deleted.

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"url": "https://github.com/symfony/webpack-encore/issues"
2222
},
2323
"engines": {
24-
"node": ">=6.0.0"
24+
"node": ">=8.0.0"
2525
},
2626
"homepage": "https://github.com/symfony/webpack-encore",
2727
"dependencies": {
@@ -32,7 +32,7 @@
3232
"babel-loader": "^8.0.0",
3333
"chalk": "^2.4.1",
3434
"clean-webpack-plugin": "^0.1.19",
35-
"css-loader": "^1.0.0",
35+
"css-loader": "^2.1.1",
3636
"fast-levenshtein": "^2.0.6",
3737
"file-loader": "^1.1.10",
3838
"friendly-errors-webpack-plugin": "^1.7.0",
@@ -43,7 +43,7 @@
4343
"optimize-css-assets-webpack-plugin": "^5.0.1",
4444
"pkg-up": "^1.0.0",
4545
"pretty-error": "^2.1.1",
46-
"resolve-url-loader": "^2.3.0",
46+
"resolve-url-loader": "^3.0.1",
4747
"semver": "^5.5.0",
4848
"style-loader": "^0.21.0",
4949
"terser-webpack-plugin": "^1.1.0",
@@ -61,21 +61,21 @@
6161
"@babel/plugin-transform-react-jsx": "^7.0.0",
6262
"@babel/preset-react": "^7.0.0",
6363
"autoprefixer": "^8.5.0",
64-
"babel-eslint": "^8.2.1",
64+
"babel-eslint": "^10.0.1",
6565
"chai": "^3.5.0",
6666
"chai-fs": "^1.0.0",
67-
"eslint": "^4.15.0",
68-
"eslint-loader": "^1.9.0",
67+
"eslint": "^5.15.2",
68+
"eslint-loader": "^2.1.2",
6969
"eslint-plugin-header": "^1.0.0",
7070
"eslint-plugin-import": "^2.8.0",
7171
"eslint-plugin-node": "^4.2.2",
7272
"fork-ts-checker-webpack-plugin": "^0.4.1",
7373
"handlebars": "^4.0.11",
7474
"handlebars-loader": "^1.7.0",
75-
"http-server": "^0.9.0",
76-
"less": "^2.7.2",
75+
"http-server": "^0.11.1",
76+
"less": "^3.9.0",
7777
"less-loader": "^4.1.0",
78-
"mocha": "^3.2.0",
78+
"mocha": "^6.0.2",
7979
"node-sass": "^4.5.3",
8080
"postcss-loader": "^3.0.0",
8181
"preact": "^8.2.1",
@@ -93,7 +93,7 @@
9393
"vue-loader": "^15.0.11",
9494
"vue-template-compiler": "^2.3.4",
9595
"webpack-notifier": "^1.6.0",
96-
"zombie": "^5.0.5"
96+
"zombie": "^6.1.4"
9797
},
9898
"files": [
9999
"lib/",

test/WebpackConfig.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -283,24 +283,6 @@ describe('WebpackConfig object', () => {
283283
});
284284
});
285285

286-
describe('configureLoaderOptionsPlugin', () => {
287-
it('Setting callback', () => {
288-
const config = createConfig();
289-
const callback = () => {};
290-
config.configureLoaderOptionsPlugin(callback);
291-
292-
expect(config.loaderOptionsPluginOptionsCallback).to.equal(callback);
293-
});
294-
295-
it('Setting invalid callback argument', () => {
296-
const config = createConfig();
297-
298-
expect(() => {
299-
config.configureLoaderOptionsPlugin('foo');
300-
}).to.throw('Argument 1 to configureLoaderOptionsPlugin() must be a callback function');
301-
});
302-
});
303-
304286
describe('configureManifestPlugin', () => {
305287
it('Setting callback', () => {
306288
const config = createConfig();

test/config-generator.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,6 @@ describe('The config-generator function', () => {
220220
config.enableVersioning(true);
221221

222222
const actualConfig = configGenerator(config);
223-
224-
const loaderOptionsPlugin = findPlugin(webpack.LoaderOptionsPlugin, actualConfig.plugins);
225-
expect(loaderOptionsPlugin.options.debug).to.equal(true);
226-
expect(loaderOptionsPlugin.options.options.context).to.equal('/tmp/context');
227-
expect(loaderOptionsPlugin.options.options.output.path).to.equal('/tmp/output/public-path');
228-
229223
expect(actualConfig.optimization.namedModules).to.be.true;
230224
});
231225

@@ -239,9 +233,6 @@ describe('The config-generator function', () => {
239233

240234
const actualConfig = configGenerator(config);
241235

242-
const loaderOptionsPlugin = findPlugin(webpack.LoaderOptionsPlugin, actualConfig.plugins);
243-
expect(loaderOptionsPlugin.options.debug).to.equal(false);
244-
245236
const moduleHashedIdsPlugin = findPlugin(webpack.HashedModuleIdsPlugin, actualConfig.plugins);
246237
expect(moduleHashedIdsPlugin).to.not.be.undefined;
247238
expect(actualConfig.optimization.namedModules).to.be.undefined;

test/index.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -387,15 +387,6 @@ describe('Public API', () => {
387387

388388
});
389389

390-
describe('configureLoaderOptionsPlugin', () => {
391-
392-
it('should return the API object', () => {
393-
const returnedValue = api.configureLoaderOptionsPlugin(() => {});
394-
expect(returnedValue).to.equal(api);
395-
});
396-
397-
});
398-
399390
describe('configureManifestPlugin', () => {
400391

401392
it('should return the API object', () => {

test/loaders/css.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ describe('loaders/css', () => {
3030
const actualLoaders = cssLoader.getLoaders(config);
3131
expect(actualLoaders).to.have.lengthOf(1);
3232
expect(actualLoaders[0].options.sourceMap).to.be.true;
33-
expect(actualLoaders[0].options.minimize).to.be.false;
3433
expect(actualLoaders[0].options.modules).to.be.false;
3534
});
3635

@@ -42,21 +41,20 @@ describe('loaders/css', () => {
4241
const actualLoaders = cssLoader.getLoaders(config);
4342
expect(actualLoaders).to.have.lengthOf(1);
4443
expect(actualLoaders[0].options.sourceMap).to.be.false;
45-
expect(actualLoaders[0].options.minimize).to.be.true;
4644
expect(actualLoaders[0].options.modules).to.be.false;
4745
});
4846

4947
it('getLoaders() with options callback', () => {
5048
const config = createConfig();
5149

5250
config.configureCssLoader(function(options) {
53-
options.minimize = true;
51+
options.foo = true;
5452
options.url = false;
5553
});
5654

5755
const actualLoaders = cssLoader.getLoaders(config);
5856
expect(actualLoaders).to.have.lengthOf(1);
59-
expect(actualLoaders[0].options.minimize).to.be.true;
57+
expect(actualLoaders[0].options.foo).to.be.true;
6058
expect(actualLoaders[0].options.url).to.be.false;
6159
expect(actualLoaders[0].options.modules).to.be.false;
6260
});
@@ -65,13 +63,13 @@ describe('loaders/css', () => {
6563
const config = createConfig();
6664

6765
config.configureCssLoader(function(options) {
68-
options.minimize = true;
66+
options.foo = true;
6967
options.url = false;
7068
});
7169

7270
const actualLoaders = cssLoader.getLoaders(config, true);
7371
expect(actualLoaders).to.have.lengthOf(1);
74-
expect(actualLoaders[0].options.minimize).to.be.true;
72+
expect(actualLoaders[0].options.foo).to.be.true;
7573
expect(actualLoaders[0].options.url).to.be.false;
7674
expect(actualLoaders[0].options.modules).to.be.true;
7775
});

0 commit comments

Comments
 (0)