Skip to content

feat: implement deprecate flag to schema#20432

Merged
alexander-akait merged 11 commits intowebpack:mainfrom
bjohansebas:deprecated-options
Mar 6, 2026
Merged

feat: implement deprecate flag to schema#20432
alexander-akait merged 11 commits intowebpack:mainfrom
bjohansebas:deprecated-options

Conversation

@bjohansebas
Copy link
Copy Markdown
Member

Summary

As discussed on Discord, so that the autogenerated documentation can show that a certain property is deprecated.

What kind of change does this PR introduce?

Did you add tests for your changes?

Does this PR introduce a breaking change?

If relevant, what needs to be documented once your changes are merged or what have you already documented?

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 8, 2026

🦋 Changeset detected

Latest commit: 0cfe89f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
webpack Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, we need to improve our types generator to generate @deprecated

Comment thread package.json Outdated
"tinybench": "^5.0.0",
"toml": "^3.0.0",
"tooling": "webpack/tooling#v1.24.5",
"tooling": "bjohansebas/tooling-webpack#deprecated-linter",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s just for testing :), once it works I’ll send the PR to tooling.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Feb 8, 2026

Merging this PR will degrade performance by 24.63%

⚡ 3 improved benchmarks
❌ 2 regressed benchmarks
✅ 139 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory benchmark "css-modules", scenario '{"name":"mode-production","mode":"production"}' 10.6 MB 8 MB +32.48%
Memory benchmark "many-chunks-esm", scenario '{"name":"mode-production","mode":"production"}' 7.4 MB 9.8 MB -24.63%
Memory benchmark "lodash", scenario '{"name":"mode-development","mode":"development"}' 5.3 MB 4.1 MB +29.36%
Memory benchmark "devtool-eval-source-map", scenario '{"name":"mode-production","mode":"production"}' 6.2 MB 7.8 MB -20.76%
Memory benchmark "many-chunks-commonjs", scenario '{"name":"mode-production","mode":"production"}' 9.8 MB 7.9 MB +24.92%

Comparing bjohansebas:deprecated-options (0cfe89f) with main (3da7560)

Open in CodSpeed

Copy link
Copy Markdown
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I think we need to add @deprecated to your types too

@alexander-akait
Copy link
Copy Markdown
Member

@alexander-akait
Copy link
Copy Markdown
Member

@bjohansebas I updated tooling and add more @depreacted for methods, feel free to rebase and we can merge, here patterns we can't handle:

/**
 * @deprecated Use the `readResource` hook instead.
 * @typedef {HookMap<FakeHook<AsyncSeriesBailHook<[string, NormalModule], string | Buffer | null>>>} DeprecatedReadResourceForScheme
 */

/**
 * @typedef {object} NormalModuleCompilationHooks
 * @property {SyncHook<[AnyLoaderContext, NormalModule]>} loader
 * @property {SyncHook<[LoaderItem[], NormalModule, AnyLoaderContext]>} beforeLoaders
 * @property {SyncHook<[NormalModule]>} beforeParse
 * @property {SyncHook<[NormalModule]>} beforeSnapshot
 * @property {DeprecatedReadResourceForScheme} readResourceForScheme
 * @property {HookMap<AsyncSeriesBailHook<[AnyLoaderContext], string | Buffer | null>>} readResource
 * @property {SyncWaterfallHook<[Result, NormalModule]>} processResult
 * @property {AsyncSeriesBailHook<[NormalModule, NeedBuildContext], boolean>} needBuild
 */
 // TODO remove in webpack 6
Object.defineProperty(Module.prototype, "used", {
	/**
	 * @deprecated
	 * @returns {EXPECTED_ANY} throw an error
	 */
	get() {
		throw new Error(
			"Module.used was refactored (use ModuleGraph.getUsedExports instead)"
		);
	},
	/**
	 * @param {EXPECTED_ANY} value value
	 */
	set(value) {
		throw new Error(
			"Module.used was refactored (use ModuleGraph.setUsedExports instead)"
		);
	}
});

don't look deeply why it doesn't work, but will be great to handle them too

@bjohansebas bjohansebas marked this pull request as ready for review March 6, 2026 16:07
@bjohansebas
Copy link
Copy Markdown
Member Author

Okay, I’ll review it for a future PR. I’ve already pulled the changes from main.

@alexander-akait alexander-akait merged commit d6927b4 into webpack:main Mar 6, 2026
55 checks passed
@alexander-akait
Copy link
Copy Markdown
Member

Thanks

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 6, 2026

This PR is packaged and the instant preview is available (d6927b4).

Install it locally:

  • npm
npm i -D webpack@https://pkg.pr.new/webpack@d6927b4
  • yarn
yarn add -D webpack@https://pkg.pr.new/webpack@d6927b4
  • pnpm
pnpm add -D webpack@https://pkg.pr.new/webpack@d6927b4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants