feat: implement deprecate flag to schema#20432
feat: implement deprecate flag to schema#20432alexander-akait merged 11 commits intowebpack:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 0cfe89f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
alexander-akait
left a comment
There was a problem hiding this comment.
Looks good, we need to improve our types generator to generate @deprecated
| "tinybench": "^5.0.0", | ||
| "toml": "^3.0.0", | ||
| "tooling": "webpack/tooling#v1.24.5", | ||
| "tooling": "bjohansebas/tooling-webpack#deprecated-linter", |
There was a problem hiding this comment.
It’s just for testing :), once it works I’ll send the PR to tooling.
7ba69a4 to
10f3f00
Compare
Merging this PR will degrade performance by 24.63%
Performance Changes
Comparing |
alexander-akait
left a comment
There was a problem hiding this comment.
Hm, I think we need to add @deprecated to your types too
|
@bjohansebas Released - https://github.com/webpack/tooling/releases/tag/v1.25.0, feel free to switch on our original tooling |
|
@bjohansebas I updated tooling and add more /**
* @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 |
|
Okay, I’ll review it for a future PR. I’ve already pulled the changes from |
|
Thanks |
|
This PR is packaged and the instant preview is available (d6927b4). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@d6927b4
yarn add -D webpack@https://pkg.pr.new/webpack@d6927b4
pnpm add -D webpack@https://pkg.pr.new/webpack@d6927b4 |
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?