Repository navigation
Emit watch changes as a plugin hook - #2405
Conversation
shellscape
left a comment
There was a problem hiding this comment.
Tangential question: Should we start using emitWarning for use of deprecated hooks?
| resolveId: ResolveIdHook; | ||
| isExternal: IsExternal; | ||
| parse: (input: string, options: any) => ESTree.Program; | ||
| // deprecate asset dependencies |
There was a problem hiding this comment.
I didn't even know that assets could have dependencies and it's already being deprecated 🤔😞
|
This'll be a big help, thanks so much @guybedford! |
b884b63 to
3b7e31d
Compare
| footer?: AddonHook; | ||
| intro?: AddonHook; | ||
| outro?: AddonHook; | ||
| watchChange?: (id: string) => void; |
There was a problem hiding this comment.
So the idea is to deprecate asset dependencies in favour of the watchChange handler? Sounds really good to me, much clearer and easier to reason about.
In order to start the actual deprecation soon, should we
- Remove the "dependencies" version
emitAssetsfrom the types, or at least - Add an @deprecated JSDoc comment above the type which should be picked up by many IDEs? (would be an interesting thing to do for other deprecations as well. Not 100% sure about VSCode but I know WebStorm/IntelliJ uses these
@deprecatedtags to visually mark usages as deprecated).
Also I agree with @shellscape that a warning would make sense considering asset dependencies are not widely known yet anyway (thanks @tivac for pointing that out 😉)
|
I was going to do a PR specifically just on the deprecations for 1.0 (adding warnings, but not actually making them breaking). This asset dependencies one could be one we deprecate before 1.0 though potentially, as I don't think anyone is using this feature yet as it's been very early for this. I could add the removal here if you like? |
|
Asset dependencies were not documented for stability reasons (I like to give all new APIs a grace period personally), so removing it should be fine actually. |
|
I've added the asset dependencies removal. |
f7f8335 to
c5d0f89
Compare
c5d0f89 to
b558402
Compare
This PR contains:
Breaking Changes?
Please Describe Your Changes
Fixes #2383 adding a watch hook for change events.
The idea here as well is to then deprecate the
this.watcheras we should now have all the info we need here.