Skip to content

Allowing new major versions of outdated dependencies #1033

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .github/workflows/high-depends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-2019]
node-versions: [ '10', '16']
node-versions: [ '12', '16']

steps:
- name: Checkout
Expand All @@ -30,11 +30,6 @@ jobs:

- name: Install Yarn Dependencies
run: yarn install
if: matrix.node-versions != 10

- name: Install Yarn Dependencies Ignore Engines (Node 10)
run: yarn install --ignore-engines
if: matrix.node-versions == 10

- name: Show Installed Versions
run: yarn list --depth=0
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/low-depends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-2019]
node-versions: [ '10', '16']
node-versions: [ '12', '16']

steps:
- name: Checkout
Expand All @@ -33,11 +33,6 @@ jobs:

- name: Install Yarn Dependencies
run: yarn install
if: matrix.node-versions != 10

- name: Install Yarn Dependencies Ignore Engines (Node 10)
run: yarn install --ignore-engines
if: matrix.node-versions == 10

- name: Show Installed Versions
run: yarn list --depth=0
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/stable-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-2019]
node-versions: [ '10', '12', '14', '16']
node-versions: [ '12', '14', '16']

steps:
- name: Checkout
Expand All @@ -27,11 +27,6 @@ jobs:

- name: Install Yarn Dependencies
run: yarn install
if: matrix.node-versions != 10

- name: Install Yarn Dependencies Ignore Engines (Node 10)
run: yarn install --ignore-engines
if: matrix.node-versions == 10

- name: Show Installed Versions
run: yarn list --depth=0
Expand Down
54 changes: 54 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,59 @@
# CHANGELOG

## [v2.0.0](https://github.com/symfony/webpack-encore/releases/tag/v2.0.0)

*TBD, 2022*

This is a new major version that contains several backwards-compatibility breaks.

### BC Breaks

The following dependencies were upgraded a major version. It's unlikely
these will cause problems, unless you were further configuring this part
of Encore:

* `clean-webpack-plugin` Version `3` to `4`: dropped old Node & Webpack version support
* `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)
* `css-minimizer-webpack-plugin` Version `2` to `3`: dropped old Node version support
* `loader-utils` REMOVED
* `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)
* `pretty-error` Version `3.0` to `4.0`: dropped old Node version support
* `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)
* `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)
* `yargs-parser` Version `20.2` to `21`: dropped old Node version support

Additionally, Encore changed the supported versions of the following packages,
which you may have installed to enable extra features:

* `eslint` Minimum version increased from `7` to `8`
* `eslint-webpack-plugin` Minimum version increased from `2.5` to `3`
* `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)
* `less-loader` Minimum version increased from `7` to `10`
* `postcss-loader` Minimum version increased from `4` to `6`
* `preact` Minimum version increased from `8` to `10` [CHANGELOG](https://github.com/preactjs/preact/releases/tag/10.0.0)
* `sass-loader` Minimum version increased from `9` to `12`
* `stylus` Minimum version increased from `0.54` to `0.56`
* `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)
* `vue-loader` Minimum version increased from `16` to `17` [CHANGELOG](https://github.com/vuejs/vue-loader/blob/next/CHANGELOG.md#1700-2021-12-12)

* Removed `Encore.enableEslintLoader()`: use `Encore.enableEslintPlugin()`.

* If using `enableEslintPlugin()` with the `@babel/eslint-parser` parser,
you may now need to create an external Babel configuration file. To see
an example, temporarily delete your `.eslintrc.js` file and run Encore.
The error will show you a Babel configuration file you can use.

* With `configureDefinePlugin()`, the `options['process.env']` key format
passed to the callback has changed (see #960). If you are using `configureDefinePlugin()`
to add more items to `process.env`, your code will need to change:

```diff
Encore.configureDefinePlugin((options) => {
- options['process.env']['SOME_VAR'] = JSON.stringify('the value');
+ options['process.env.SOME_VAR'] = JSON.stringify('the value');
})
````

## [v1.8.2](https://github.com/symfony/webpack-encore/releases/tag/v1.8.2)

*Mar 17th, 2022*
Expand Down
55 changes: 2 additions & 53 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1260,53 +1260,6 @@ class Encore {
return this;
}

/**
* If enabled, the eslint-loader is enabled.
*
* https://github.com/MoOx/eslint-loader
*
* ```
* // enables the eslint loaded using the default eslint configuration.
* Encore.enableEslintLoader();
*
* // You can also pass in an object of options
* // that will be passed on to the eslint-loader
* Encore.enableEslintLoader({
* emitWarning: false
* });
*
* // For a more advanced usage you can pass in a callback
* // https://github.com/webpack-contrib/eslint-loader#options
* Encore.enableEslintLoader((options) => {
* options.extends = 'airbnb';
* options.emitWarning = false;
* });
*
* // configure Encore-specific options
* Encore.enableEslintLoader(() => {}, {
* // set optional Encore-specific options, for instance:
*
* // lint `.vue` files
* lintVue: true
* });
* ```
*
* Supported options:
* * {boolean} lintVue (default=false)
* Configure the loader to lint `.vue` files
* ```
*
* @deprecated Prefer using "Encore.enableEslintPlugin()" instead.
* @param {string|object|function} eslintLoaderOptionsOrCallback
* @param {object} encoreOptions
* @returns {Encore}
*/
enableEslintLoader(eslintLoaderOptionsOrCallback = () => {}, encoreOptions = {}) {
webpackConfig.enableEslintLoader(eslintLoaderOptionsOrCallback, encoreOptions);

return this;
}

/**
* If enabled, the eslint-webpack-plugin is enabled.
*
Expand Down Expand Up @@ -1546,15 +1499,11 @@ class Encore {
*
* https://webpack.js.org/concepts/loaders/#configuration
*
* For example, if you are using Vue and ESLint loader,
* this is how you can configure ESLint to lint Vue files:
*
* ```
* Encore
* .enableEslintLoader()
* .enableVueLoader()
* .configureLoaderRule('eslint', (loaderRule) => {
* loaderRule.test = /\.(jsx?|vue)/;
* .configureLoaderRule('vue', (loaderRule) => {
* // some custom config for vue-loader
* });
* ```
*
Expand Down
51 changes: 1 addition & 50 deletions lib/WebpackConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ class WebpackConfig {
this.useReact = false;
this.usePreact = false;
this.useVueLoader = false;
this.useEslintLoader = false;
this.useEslintPlugin = false;
this.useTypeScriptLoader = false;
this.useForkedTypeScriptTypeChecking = false;
Expand All @@ -133,10 +132,6 @@ class WebpackConfig {
resolveUrlLoader: true,
resolveUrlLoaderOptions: {}
};
/** @deprecated */
this.stimulusOptions = {
controllerJsonPath: null,
};
this.preactOptions = {
preactCompat: false
};
Expand All @@ -151,9 +146,6 @@ class WebpackConfig {
version: null,
runtimeCompilerBuild: null
};
this.eslintOptions = {
lintVue: false,
};
this.persistentCacheBuildDependencies = {};

// Features/Loaders options callbacks
Expand All @@ -171,7 +163,6 @@ class WebpackConfig {
this.watchOptionsConfigurationCallback = () => {};
this.devServerOptionsConfigurationCallback = () => {};
this.vueLoaderOptionsCallback = () => {};
this.eslintLoaderOptionsCallback = () => {};
this.eslintPluginOptionsCallback = () => {};
this.tsConfigurationCallback = () => {};
this.handlebarsConfigurationCallback = () => {};
Expand Down Expand Up @@ -419,7 +410,7 @@ class WebpackConfig {
}

if (this.doesBabelRcFileExist()) {
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.');
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.');
}
}

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

this.stimulusOptions.controllersJsonPath = controllerJsonPath;
this.addAliases({
'@symfony/stimulus-bridge/controllers.json': path.resolve(controllerJsonPath),
});
Expand Down Expand Up @@ -804,46 +794,7 @@ class WebpackConfig {
}
}

enableEslintLoader(eslintLoaderOptionsOrCallback = () => {}, eslintOptions = {}) {
logger.deprecation('Encore.enableEslintLoader() is deprecated, please use Encore.enableEslintPlugin() instead.');

if (this.useEslintPlugin) {
throw new Error('Encore.enableEslintLoader() can not be called when Encore.enableEslintPlugin() has been called.');
}

this.useEslintLoader = true;

if (typeof eslintLoaderOptionsOrCallback === 'function') {
this.eslintLoaderOptionsCallback = eslintLoaderOptionsOrCallback;
} else if (typeof eslintLoaderOptionsOrCallback === 'string') {
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.');

this.eslintLoaderOptionsCallback = (options) => {
options.extends = eslintLoaderOptionsOrCallback;
};
} else if (typeof eslintLoaderOptionsOrCallback === 'object') {
this.eslintLoaderOptionsCallback = (options) => {
Object.assign(options, eslintLoaderOptionsOrCallback);
};
} else {
throw new Error('Argument 1 to enableEslintLoader() must be either a string, object or callback function.');
}

// Check allowed keys
for (const key of Object.keys(eslintOptions)) {
if (!(key in this.eslintOptions)) {
throw new Error(`"${key}" is not a valid key for enableEslintLoader(). Valid keys: ${Object.keys(this.eslintOptions).join(', ')}.`);
}
}

this.eslintOptions = eslintOptions;
}

enableEslintPlugin(eslintPluginOptionsOrCallback = () => {}) {
if (this.useEslintLoader) {
throw new Error('Encore.enableEslintPlugin() can not be called when Encore.enableEslintLoader() has been called.');
}

this.useEslintPlugin = true;

if (typeof eslintPluginOptionsOrCallback === 'function') {
Expand Down
11 changes: 0 additions & 11 deletions lib/config-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const babelLoaderUtil = require('./loaders/babel');
const tsLoaderUtil = require('./loaders/typescript');
const vueLoaderUtil = require('./loaders/vue');
const handlebarsLoaderUtil = require('./loaders/handlebars');
const eslintLoaderUtil = require('./loaders/eslint');
// plugins utils
const miniCssExtractPluginUtil = require('./plugins/mini-css-extract');
const deleteUnusedEntriesPluginUtil = require('./plugins/delete-unused-entries');
Expand Down Expand Up @@ -400,16 +399,6 @@ class ConfigGenerator {
}));
}

if (this.webpackConfig.useEslintLoader) {
rules.push(applyRuleConfigurationCallback('eslint', {
test: eslintLoaderUtil.getTest(this.webpackConfig),
loader: require.resolve('eslint-loader'), //eslint-disable-line node/no-unpublished-require
exclude: /node_modules/,
enforce: 'pre',
options: eslintLoaderUtil.getOptions(this.webpackConfig)
}));
}

if (this.webpackConfig.useTypeScriptLoader) {
rules.push(applyRuleConfigurationCallback('typescript', {
test: /\.tsx?$/,
Expand Down
9 changes: 0 additions & 9 deletions lib/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,6 @@ const features = {
],
description: 'use Vue with JSX support'
},
eslint: {
method: 'enableEslintLoader()',
// eslint is needed so the end-user can do things
packages: [
{ name: 'eslint' },
{ name: 'eslint-loader', enforce_version: true },
],
description: 'Enable ESLint checks'
},
eslint_plugin: {
method: 'enableEslintPlugin()',
// eslint is needed so the end-user can do things
Expand Down
Loading