1 | # Installation
|
2 | > `npm install --save @types/loader-runner`
|
3 |
|
4 | # Summary
|
5 | This package contains type definitions for loader-runner (https://github.com/webpack/loader-runner.git).
|
6 |
|
7 | # Details
|
8 | Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/loader-runner.
|
9 | ## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/loader-runner/index.d.ts)
|
10 | ````ts
|
11 | /// <reference types="node" />
|
12 |
|
13 | export interface Loader {
|
14 | path: string;
|
15 | query: string;
|
16 | request: string;
|
17 | options: any;
|
18 | normal: null | ((request: string) => string);
|
19 | pitch: null | ((request: string) => string);
|
20 | raw: string;
|
21 | data: any;
|
22 | pitchExecuted: boolean;
|
23 | normalExecuted: boolean;
|
24 | }
|
25 |
|
26 | export interface RunLoaderOption {
|
27 | resource: string;
|
28 | loaders: any[];
|
29 | context: any;
|
30 | readResource: (
|
31 | filename: string,
|
32 | callback: (err: NodeJS.ErrnoException | null, data: Buffer | null) => void,
|
33 | ) => void;
|
34 | }
|
35 |
|
36 | export interface RunLoaderResult {
|
37 | result?: Array<Buffer | null> | undefined;
|
38 | resourceBuffer?: Buffer | null | undefined;
|
39 | cacheable: boolean;
|
40 | fileDependencies: string[];
|
41 | contextDependencies: string[];
|
42 | }
|
43 |
|
44 | export interface ExtendedLoaderContext {
|
45 | context: string | null;
|
46 | loaderIndex: number;
|
47 | loaders: Loader[];
|
48 | resourcePath: string | undefined;
|
49 | resourceQuery: string | undefined;
|
50 | async: (() => (() => void) | undefined) | null;
|
51 | callback: (() => void) | null;
|
52 | cacheable: (flag: boolean) => void;
|
53 | dependency: (file: string) => void;
|
54 | addDependency: (file: string) => void;
|
55 | addContextDependency: (context: string) => void;
|
56 | getDependencies: () => string[];
|
57 | getContextDependencies: () => string[];
|
58 | clearDependencies: () => void;
|
59 | resource: string;
|
60 | request: string;
|
61 | remainingRequest: string;
|
62 | currentRequest: string;
|
63 | previousRequest: string;
|
64 | query: {
|
65 | [key: string]: any;
|
66 | } | string;
|
67 | data: any;
|
68 | }
|
69 |
|
70 | export function getContext(resource: string): string;
|
71 |
|
72 | export function runLoaders(
|
73 | options: RunLoaderOption,
|
74 | callback: (err: NodeJS.ErrnoException | null, result: RunLoaderResult) => any,
|
75 | ): void;
|
76 |
|
77 | ````
|
78 |
|
79 | ### Additional Details
|
80 | * Last updated: Mon, 20 Nov 2023 23:36:24 GMT
|
81 | * Dependencies: [@types/node](https://npmjs.com/package/@types/node)
|
82 |
|
83 | # Credits
|
84 | These definitions were written by [e-cloud](https://github.com/e-cloud).
|
85 |
|
\ | No newline at end of file |