|
1 | 1 | import type webpack from 'webpack';
|
2 | 2 |
|
3 | 3 | export type LoaderThis<Options> = {
|
4 |
| - /** Path to the file being loaded */ |
| 4 | + /** |
| 5 | + * Path to the file being loaded |
| 6 | + * |
| 7 | + * https://webpack.js.org/api/loaders/#thisresourcepath |
| 8 |
10000
+ */ |
5 | 9 | resourcePath: string;
|
6 | 10 |
|
7 |
| - /** Query at the end of resolved file name ("../some-folder/some-module?foobar" -> resourceQuery: "?foobar") */ |
| 11 | + /** |
| 12 | + * Query at the end of resolved file name ("../some-folder/some-module?foobar" -> resourceQuery: "?foobar") |
| 13 | + * |
| 14 | + * https://webpack.js.org/api/loaders/#thisresourcequery |
| 15 | + */ |
8 | 16 | resourceQuery: string;
|
9 | 17 |
|
10 |
| - // Function to add outside file used by loader to `watch` process |
| 18 | + /** |
| 19 | + * Function to add outside file used by loader to `watch` process |
| 20 | + * |
| 21 | + * https://webpack.js.org/api/loaders/#thisadddependency |
| 22 | + */ |
11 | 23 | addDependency: (filepath: string) => void;
|
12 | 24 |
|
13 |
| - // Marks a loader as asynchronous |
| 25 | + /** |
| 26 | + * Marks a loader result as cacheable. |
| 27 | + * |
| 28 | + * https://webpack.js.org/api/loaders/#thiscacheable |
| 29 | + */ |
| 30 | + cacheable: (flag: boolean) => void; |
| 31 | + |
| 32 | + /** |
| 33 | + * Marks a loader as asynchronous |
| 34 | + * |
| 35 | + * https://webpack.js.org/api/loaders/#thisasync |
| 36 | + */ |
14 | 37 | async: webpack.loader.LoaderContext['async'];
|
15 | 38 |
|
16 |
| - // Return errors, code, and sourcemaps from an asynchronous loader |
| 39 | + /** |
| 40 | + * Return errors, code, and sourcemaps from an asynchronous loader |
| 41 | + * |
| 42 | + * https://webpack.js.org/api/loaders/#thiscallback |
| 43 | + */ |
17 | 44 | callback: webpack.loader.LoaderContext['callback'];
|
18 | 45 | } & (
|
19 | 46 | | {
|
20 |
| - // Loader options in Webpack 4 |
| 47 | + /** |
| 48 | + * Loader options in Webpack 4 |
| 49 | + * |
| 50 | + * https://webpack.js.org/api/loaders/#thisquery |
| 51 | + */ |
21 | 52 | query: Options;
|
22 | 53 | }
|
23 | 54 | | {
|
24 |
| - // Loader options in Webpack 5 |
| 55 | + /** |
| 56 | + * Loader options in Webpack 5 |
| 57 | + * |
| 58 | + * https://webpack.js.org/api/loaders/#thisgetoptionsschema |
| 59 | + */ |
25 | 60 | getOptions: () => Options;
|
26 | 61 | }
|
27 | 62 | );
|
0 commit comments