Skip to content

Commit b2456a9

Browse files
committed
feature #1033 Allowing new major versions of outdated dependencies (weaverryan)
This PR was squashed before being merged into the main branch. Discussion ---------- Allowing new major versions of outdated dependencies Fixes #1029 ~~A bit more work to do. For now, I'm focused only on the main dependencies (not the `devDependencies`).~~ ~~You could argue that this will require a new major version of webpack-encore. However, there is a precedence for allowing major dependency upgrades on minor versions in the past: https://github.com/symfony/webpack-encore/releases/tag/v1.2.0. Assuming none of the libraries have underlying changes that are likely to affect users, I'd like to do that again.~~ Edit: likely we should have a new major release. ## Dependencies * ~`chalk`~: kept at v4 because v5 requires esm. v4 is stable. * `clean-webpack-plugin`: `3->4` No breaking changes * `css-loader`: `5->6`: Min node to 12.3.0, other changes: [CHANGELOG](https://github.com/webpack-contrib/css-loader/blob/master/CHANGELOG.md#-breaking-changes) * `css-minimizer-webpack-plugin`: `2->3` Min node to 12.3.0 * `loader-utils`: REMOVED * mini-css-extract-plugin `1.5->2.2.1` Min node to 12.13.0, Webpack to 5.0.0, other changes: [CHANGELOG](https://github.com/webpack-contrib/mini-css-extract-plugin/blob/master/CHANGELOG.md#-breaking-changes) - ~`pkg-up`~: Keeping version `3.1` because `4` requires esm. - `pretty-error`: `3.0->4.0` Min node to 12.0 - `resolve-url-loader` `3.0->5.0` Min node to 12.0, postcss ^8.0, remove `rework` engine, other changes: [CHANGELOG](https://github.com/bholloway/resolve-url-loader/blob/v4-maintenance/packages/resolve-url-loader/CHANGELOG.md) - `style-loader`: `2->3` Min node to 12.13, Min webpack to 5.0 other changes: [CHANGELOG](https://github.com/webpack-contrib/style-loader/blob/master/CHANGELOG.md#-breaking-changes) - `yargs-parser`: `20.2->21` Min node to 12.0 ## Dev Dependencies - `eslint`: `7->8` Min node to `12.22` - `eslint-webpack-plugin`: `2.5->3` min node to `12`. Min webpack `5` - `fork-ts-checker-webpack-plugin`: `5->6` [CHANGELOG](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/releases/tag/v6.0.0) - `fs-extra`: `9->10` Min node to `12`. Potentially breaking changes: [CHANGELOG](https://github.com/jprichardson/node-fs-extra/blob/master/CHANGELOG.md#breaking-changes****) - `http-server`: `0.12->14` Min node to `12`. - `less-loader`: `7->10`: Min node to `12`. Min webpack to `5`. `less.webpackLoaderContext` was removed, please use `pluginManager.webpackLoaderContext` - `mocha`: `8->9`: min node to `12`. [CHANGELOG](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md#boom-breaking-changes) - `postcss-loader`: `4-5->6`: min node to `12`. min webpack to `5`. - `preact`: `8->10`: [CHANGELOG](https://github.com/preactjs/preact/releases/tag/10.0.0) - `sass-loader`: `9-10-11->12` min node to `12.13`. Min webpack to `5` - `sinon`: `9->12` - ~`strip-ansi`~: Need to keep `6` because `7` is esm only. Min node to `12` - `stylus`: `0.54->0.56` - `stylus-loader`: `3-4-5->6`: Min node to `12.13`. Min webpack to `5`. Other breaking changes: [CHANGELOG](https://github.com/webpack-contrib/stylus-loader/blob/master/CHANGELOG.md#400-2020-09-29) * `vue-loader`: `16-17` No important changes: https://github.com/vuejs/vue-loader/blob/next/CHANGELOG.md#1700-2021-12-12 TODOs: * [x] A) Check CHANGELOG of each library to see what changes, if any, we need. * [x] B) Bump *our* CHANGELOG for changes people should watch out for * [x] C) Get tests passing Commits ------- f1a1db6 Updating Changelog for #960 e8c6d25 bumping preact min to fix test e4495aa upgrading babel to work with eslint plugin e853d9e Bumping eslint-webpack-plugin support to fix bugs a7d817d Writing out babel.config.js for users when using eslint plugin a4aec57 Converting warning to error, which is consistent with babel env config method 1dc344c dropping Node 10 in CI c4351d8 removing already unused, deprecated option 69ecce9 Removing deprecated Encore.enableEslintLoader() 993e364 allowing new major versions of outdated dependencies
2 parents ffb7f20 + f1a1db6 commit b2456a9

18 files changed

+2110
-3100
lines changed

.github/workflows/high-depends.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
os: [ubuntu-latest, windows-2019]
17-
node-versions: [ '10', '16']
17+
node-versions: [ '12', '16']
1818

1919
steps:
2020
- name: Checkout
@@ -30,11 +30,6 @@ jobs:
3030

3131
- name: Install Yarn Dependencies
3232
run: yarn install
33-
if: matrix.node-versions != 10
34-
35-
- name: Install Yarn Dependencies Ignore Engines (Node 10)
36-
run: yarn install --ignore-engines
37-
if: matrix.node-versions == 10
3833

3934
- name: Show Installed Versions
4035
run: yarn list --depth=0

.github/workflows/low-depends.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
os: [ubuntu-latest, windows-2019]
17-
node-versions: [ '10', '16']
17+
node-versions: [ '12', '16']
1818

1919
steps:
2020
- name: Checkout
@@ -33,11 +33,6 @@ jobs:
3333

3434
- name: Install Yarn Dependencies
3535
run: yarn install
36-
if: matrix.node-versions != 10
37-
38-
- name: Install Yarn Dependencies Ignore Engines (Node 10)
39-
run: yarn install --ignore-engines
40-
if: matrix.node-versions == 10
4136

4237
- name: Show Installed Versions
4338
run: yarn list --depth=0

.github/workflows/stable-tests.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
os: [ubuntu-latest, windows-2019]
17-
node-versions: [ '10', '12', '14', '16']
17+
node-versions: [ '12', '14', '16']
1818

1919
steps:
2020
- name: Checkout
@@ -27,11 +27,6 @@ jobs:
2727

2828
- name: Install Yarn Dependencies
2929
run: yarn install
30-
if: matrix.node-versions != 10
31-
32-
- name: Install Yarn Dependencies Ignore Engines (Node 10)
33-
run: yarn install --ignore-engines
34-
if: matrix.node-versions == 10
3530

3631
- name: Show Installed Versions
3732
run: yarn list --depth=0

CHANGELOG.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,59 @@
11
# CHANGELOG
22

3+
## [v2.0.0](https://github.com/symfony/webpack-encore/releases/tag/v2.0.0)
4+
5+
*TBD, 2022*
6+
7+
This is a new major version that contains several backwards-compatibility breaks.
8+
9+
### BC Breaks
10+
11+
The following dependencies were upgraded a major version. It's unlikely
12+
these will cause problems, unless you were further configuring this part
13+
of Encore:
14+
15+
* `clean-webpack-plugin` Version `3` to `4`: dropped old Node & Webpack version support
16+
* `css-loader` Version `5` to `6`: dropped old Node version support & [CHANGELOG](https://github.com/webpack-contrib/css-loader/blob/master/CHANGELOG.md#-breaking-changes)
17+
* `css-minimizer-webpack-plugin` Version `2` to `3`: dropped old Node version support
18+
* `loader-utils` REMOVED
19+
* `mini-css-extract-plugin` Version `1.5` to `2.2.1`: dropped old Node & Webpack version support & [CHANGELOG](https://github.com/webpack-contrib/mini-css-extract-plugin/blob/master/CHANGELOG.md#-breaking-changes)
20+
* `pretty-error` Version `3.0` to `4.0`: dropped old Node version support
21+
* `resolve-url-loader` Version `3.0` to `5.0`: dropped old Node version support, requires postcss `^8.0`, remove `rework` engine & [CHANGELOG](https://github.com/bholloway/resolve-url-loader/blob/v4-maintenance/packages/resolve-url-loader/CHANGELOG.md)
22+
* `style-loader` Version `2` to `3`: dropped old Node and Webpack version support & [CHANGELOG](https://github.com/webpack-contrib/style-loader/blob/master/CHANGELOG.md#-breaking-changes)
23+
* `yargs-parser` Version `20.2` to `21`: dropped old Node version support
24+
25+
Additionally, Encore changed the supported versions of the following packages,
26+
which you may have installed to enable extra features:
27+
28+
* `eslint` Minimum version increased from `7` to `8`
29+
* `eslint-webpack-plugin` Minimum version increased from `2.5` to `3`
30+
* `fork-ts-checker-webpack-plugin` Minimum version increased from `5` to `6` [CHANGELOG](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/releases/tag/v6.0.0)
31+
* `less-loader` Minimum version increased from `7` to `10`
32+
* `postcss-loader` Minimum version increased from `4` to `6`
33+
* `preact` Minimum version increased from `8` to `10` [CHANGELOG](https://github.com/preactjs/preact/releases/tag/10.0.0)
34+
* `sass-loader` Minimum version increased from `9` to `12`
35+
* `stylus` Minimum version increased from `0.54` to `0.56`
36+
* `stylus-loader` Minimum version increased from `3` to `6` [CHANGELOG](https://github.com/webpack-contrib/stylus-loader/blob/master/CHANGELOG.md#400-2020-09-29)
37+
* `vue-loader` Minimum version increased from `16` to `17` [CHANGELOG](https://github.com/vuejs/vue-loader/blob/next/CHANGELOG.md#1700-2021-12-12)
38+
39+
* Removed `Encore.enableEslintLoader()`: use `Encore.enableEslintPlugin()`.
40+
41+
* If using `enableEslintPlugin()` with the `@babel/eslint-parser` parser,
42+
you may now need to create an external Babel configuration file. To see
43+
an example, temporarily delete your `.eslintrc.js` file and run Encore.
44+
The error will show you a Babel configuration file you can use.
45+
46+
* With `configureDefinePlugin()`, the `options['process.env']` key format
47+
passed to the callback has changed (see #960). If you are using `configureDefinePlugin()`
48+
to add more items to `process.env`, your code will need to change:
49+
50+
```diff
51+
Encore.configureDefinePlugin((options) => {
52+
- options['process.env']['SOME_VAR'] = JSON.stringify('the value');
53+
+ options['process.env.SOME_VAR'] = JSON.stringify('the value');
54+
})
55+
````
56+
357
## [v1.8.2](https://github.com/symfony/webpack-encore/releases/tag/v1.8.2)
458

559
*Mar 17th, 2022*

index.js

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,53 +1260,6 @@ class Encore {
12601260
return this;
12611261
}
12621262

1263-
/**
1264-
* If enabled, the eslint-loader is enabled.
1265-
*
1266-
* https://github.com/MoOx/eslint-loader
1267-
*
1268-
* ```
1269-
* // enables the eslint loaded using the default eslint configuration.
1270-
* Encore.enableEslintLoader();
1271-
*
1272-
* // You can also pass in an object of options
1273-
* // that will be passed on to the eslint-loader
1274-
* Encore.enableEslintLoader({
1275-
* emitWarning: false
1276-
* });
1277-
*
1278-
* // For a more advanced usage you can pass in a callback
1279-
* // https://github.com/webpack-contrib/eslint-loader#options
1280-
* Encore.enableEslintLoader((options) => {
1281-
* options.extends = 'airbnb';
1282-
* options.emitWarning = false;
1283-
* });
1284-
*
1285-
* // configure Encore-specific options
1286-
* Encore.enableEslintLoader(() => {}, {
1287-
* // set optional Encore-specific options, for instance:
1288-
*
1289-
* // lint `.vue` files
1290-
* lintVue: true
1291-
* });
1292-
* ```
1293-
*
1294-
* Supported options:
1295-
* * {boolean} lintVue (default=false)
1296-
* Configure the loader to lint `.vue` files
1297-
* ```
1298-
*
1299-
* @deprecated Prefer using "Encore.enableEslintPlugin()" instead.
1300-
* @param {string|object|function} eslintLoaderOptionsOrCallback
1301-
* @param {object} encoreOptions
1302-
* @returns {Encore}
1303-
*/
1304-
enableEslintLoader(eslintLoaderOptionsOrCallback = () => {}, encoreOptions = {}) {
1305-
webpackConfig.enableEslintLoader(eslintLoaderOptionsOrCallback, encoreOptions);
1306-
1307-
return this;
1308-
}
1309-
13101263
/**
13111264
* If enabled, the eslint-webpack-plugin is enabled.
13121265
*
@@ -1546,15 +1499,11 @@ class Encore {
15461499
*
15471500
* https://webpack.js.org/concepts/loaders/#configuration
15481501
*
1549-
* For example, if you are using Vue and ESLint loader,
1550-
* this is how you can configure ESLint to lint Vue files:
1551-
*
15521502
* ```
15531503
* Encore
1554-
* .enableEslintLoader()
15551504
* .enableVueLoader()
1556-
* .configureLoaderRule('eslint', (loaderRule) => {
1557-
* loaderRule.test = /\.(jsx?|vue)/;
1505+
* .configureLoaderRule('vue', (loaderRule) => {
1506+
* // some custom config for vue-loader
15581507
* });
15591508
* ```
15601509
*

lib/WebpackConfig.js

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ class WebpackConfig {
119119
this.useReact = false;
120120
this.usePreact = false;
121121
this.useVueLoader = false;
122-
this.useEslintLoader = false;
123122
this.useEslintPlugin = false;
124123
this.useTypeScriptLoader = false;
125124
this.useForkedTypeScriptTypeChecking = false;
@@ -133,10 +132,6 @@ class WebpackConfig {
133132
resolveUrlLoader: true,
134133
resolveUrlLoaderOptions: {}
135134
};
136-
/** @deprecated */
137-
this.stimulusOptions = {
138-
controllerJsonPath: null,
139-
};
140135
this.preactOptions = {
141136
preactCompat: false
142137
};
@@ -151,9 +146,6 @@ class WebpackConfig {
151146
version: null,
152147
runtimeCompilerBuild: null
153148
};
154-
this.eslintOptions = {
155-
lintVue: false,
156-
};
157149
this.persistentCacheBuildDependencies = {};
158150

159151
// Features/Loaders options callbacks
@@ -171,7 +163,6 @@ class WebpackConfig {
171163
this.watchOptionsConfigurationCallback = () => {};
172164
this.devServerOptionsConfigurationCallback = () => {};
173165
this.vueLoaderOptionsCallback = () => {};
174-
this.eslintLoaderOptionsCallback = () => {};
175166
this.eslintPluginOptionsCallback = () => {};
176167
this.tsConfigurationCallback = () => {};
177168
this.handlebarsConfigurationCallback = () => {};
@@ -419,7 +410,7 @@ class WebpackConfig {
419410
}
420411

421412
if (this.doesBabelRcFileExist()) {
422-
logger.warning('The "callback" argument of configureBabel() will not be used because your app already provides an external Babel configuration (e.g. a ".babelrc" or "babel.config.js" file or "babel" key in "package.json"). Use null as a first argument to remove that warning.');
413+
throw new Error('The "callback" argument of configureBabel() will not be used because your app already provides an external Babel configuration (e.g. a ".babelrc" or "babel.config.js" file or "babel" key in "package.json"). Use null as the first argument to remove this error.');
423414
}
424415
}
425416

@@ -691,7 +682,6 @@ class WebpackConfig {
691682
this.addEntry(name, rootDir + '/' + controllersData.entrypoints[name]);
692683
}
693684

694-
this.stimulusOptions.controllersJsonPath = controllerJsonPath;
695685
this.addAliases({
696686
'@symfony/stimulus-bridge/controllers.json': path.resolve(controllerJsonPath),
697687
});
@@ -804,46 +794,7 @@ class WebpackConfig {
804794
}
805795
}
806796

807-
enableEslintLoader(eslintLoaderOptionsOrCallback = () => {}, eslintOptions = {}) {
808-
logger.deprecation('Encore.enableEslintLoader() is deprecated, please use Encore.enableEslintPlugin() instead.');
809-
810-
if (this.useEslintPlugin) {
811-
throw new Error('Encore.enableEslintLoader() can not be called when Encore.enableEslintPlugin() has been called.');
812-
}
813-
814-
this.useEslintLoader = true;
815-
816-
if (typeof eslintLoaderOptionsOrCallback === 'function') {
817-
this.eslintLoaderOptionsCallback = eslintLoaderOptionsOrCallback;
818-
} else if (typeof eslintLoaderOptionsOrCallback === 'string') {
819-
logger.deprecation('enableEslintLoader: Extending from a configuration is deprecated, please use a configuration file instead. See https://eslint.org/docs/user-guide/configuring for more information.');
820-
821-
this.eslintLoaderOptionsCallback = (options) => {
822-
options.extends = eslintLoaderOptionsOrCallback;
823-
};
824-
} else if (typeof eslintLoaderOptionsOrCallback === 'object') {
825-
this.eslintLoaderOptionsCallback = (options) => {
826-
Object.assign(options, eslintLoaderOptionsOrCallback);
827-
};
828-
} else {
829-
throw new Error('Argument 1 to enableEslintLoader() must be either a string, object or callback function.');
830-
}
831-
832-
// Check allowed keys
833-
for (const key of Object.keys(eslintOptions)) {
834-
if (!(key in this.eslintOptions)) {
835-
throw new Error(`"${key}" is not a valid key for enableEslintLoader(). Valid keys: ${Object.keys(this.eslintOptions).join(', ')}.`);
836-
}
837-
}
838-
839-
this.eslintOptions = eslintOptions;
840-
}
841-
842797
enableEslintPlugin(eslintPluginOptionsOrCallback = () => {}) {
843-
if (this.useEslintLoader) {
844-
throw new Error('Encore.enableEslintPlugin() can not be called when Encore.enableEslintLoader() has been called.');
845-
}
846-
847798
this.useEslintPlugin = true;
848799

849800
if (typeof eslintPluginOptionsOrCallback === 'function') {

lib/config-generator.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const babelLoaderUtil = require('./loaders/babel');
2222
const tsLoaderUtil = require('./loaders/typescript');
2323
const vueLoaderUtil = require('./loaders/vue');
2424
const handlebarsLoaderUtil = require('./loaders/handlebars');
25-
const eslintLoaderUtil = require('./loaders/eslint');
2625
// plugins utils
2726
const miniCssExtractPluginUtil = require('./plugins/mini-css-extract');
2827
const deleteUnusedEntriesPluginUtil = require('./plugins/delete-unused-entries');
@@ -400,16 +399,6 @@ class ConfigGenerator {
400399
}));
401400
}
402401

403-
if (this.webpackConfig.useEslintLoader) {
404-
rules.push(applyRuleConfigurationCallback('eslint', {
405-
test: eslintLoaderUtil.getTest(this.webpackConfig),
406-
loader: require.resolve('eslint-loader'), //eslint-disable-line node/no-unpublished-require
407-
exclude: /node_modules/,
408-
enforce: 'pre',
409-
options: eslintLoaderUtil.getOptions(this.webpackConfig)
410-
}));
411-
}
412-
413402
if (this.webpackConfig.useTypeScriptLoader) {
414403
rules.push(applyRuleConfigurationCallback('typescript', {
415404
test: /\.tsx?$/,

lib/features.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,6 @@ const features = {
117117
],
118118
description: 'use Vue with JSX support'
119119
},
120-
eslint: {
121-
method: 'enableEslintLoader()',
122-
// eslint is needed so the end-user can do things
123-
packages: [
124-
{ name: 'eslint' },
125-
{ name: 'eslint-loader', enforce_version: true },
126-
],
127-
description: 'Enable ESLint checks'
128-
},
129120
eslint_plugin: {
130121
method: 'enableEslintPlugin()',
131122
// eslint is needed so the end-user can do things

0 commit comments

Comments
 (0)