File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ contributors:
99 - EugeneHlushko
1010 - chenxsan
1111 - snitin315
12+ - moshams272
1213---
1314
1415The ` parser ` instance, found in the ` compiler ` , is used to parse each module
@@ -24,9 +25,17 @@ compiler.hooks.normalModuleFactory.tap("MyPlugin", (factory) => {
2425 factory .hooks .parser
2526 .for (" javascript/auto" )
2627 .tap (" MyPlugin" , (parser , options ) => {
27- parser .hooks .someHook .tap (" MyPlugin" , (data ) => {
28- // ...
29- });
28+ // The `parser` provides many hooks, which are explained in detail below.
29+ // Here is a practical example using the `call` hook to detect and warn
30+ // about a deprecated API function when a developer calls it
31+ // (e.g., `myCustomApiFunction()`):
32+ parser .hooks .call
33+ .for (" myCustomApiFunction" )
34+ .tap (" MyPlugin" , (expression ) => {
35+ console .warn (
36+ ` Warning: 'myCustomApiFunction' is deprecated. Found call at line ${ expression .loc .start .line } .` ,
37+ );
38+ });
3039 });
3140});
3241```
You can’t perform that action at this time.
0 commit comments