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 | // Type definitions for loader-runner v2.2.0
|
12 | // Project: https://github.com/webpack/loader-runner.git
|
13 | // Definitions by: e-cloud <https://github.com/e-cloud>
|
14 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
15 |
|
16 | /// <reference types="node" />
|
17 |
|
18 | export interface Loader {
|
19 | path: string;
|
20 | query: string;
|
21 | request: string;
|
22 | options: any;
|
23 | normal: null | ((request: string) => string);
|
24 | pitch: null | ((request: string) => string);
|
25 | raw: string;
|
26 | data: any;
|
27 | pitchExecuted: boolean;
|
28 | normalExecuted: boolean;
|
29 | }
|
30 |
|
31 | export interface RunLoaderOption {
|
32 | resource: string;
|
33 | loaders: any[];
|
34 | context: any;
|
35 | readResource: (
|
36 | filename: string,
|
37 | callback: (err: NodeJS.ErrnoException | null, data: Buffer | null) => void
|
38 | ) => void;
|
39 | }
|
40 |
|
41 | export interface RunLoaderResult {
|
42 | result?: (Buffer | null)[] | undefined;
|
43 | resourceBuffer?: Buffer | null | undefined;
|
44 | cacheable: boolean;
|
45 | fileDependencies: string[];
|
46 | contextDependencies: string[];
|
47 | }
|
48 |
|
49 | export interface ExtendedLoaderContext {
|
50 | context: string | null;
|
51 | loaderIndex: number;
|
52 | loaders: Loader[];
|
53 | resourcePath: string | undefined;
|
54 | resourceQuery: string | undefined;
|
55 | async: (() => (() => void) | undefined) | null;
|
56 | callback: (() => void) | null;
|
57 | cacheable: (flag: boolean) => void;
|
58 | dependency: (file: string) => void;
|
59 | addDependency: (file: string) => void;
|
60 | addContextDependency: (context: string) => void;
|
61 | getDependencies: () => string[];
|
62 | getContextDependencies: () => string[];
|
63 | clearDependencies: () => void;
|
64 | resource: string;
|
65 | request: string;
|
66 | remainingRequest: string;
|
67 | currentRequest: string;
|
68 | previousRequest: string;
|
69 | query: {
|
70 | [key: string]: any;
|
71 | } | string;
|
72 | data: any;
|
73 | }
|
74 |
|
75 | export function getContext(resource: string): string;
|
76 |
|
77 | export function runLoaders(
|
78 | options: RunLoaderOption,
|
79 | callback: (err: NodeJS.ErrnoException | null, result: RunLoaderResult) => any
|
80 | ): void;
|
81 |
|
82 |
|
83 |
|
84 | ````
|
85 |
|
86 | ### Additional Details
|
87 | * Last updated: Tue, 06 Jul 2021 22:02:42 GMT
|
88 | * Dependencies: [@types/node](https://npmjs.com/package/@types/node)
|
89 | * Global values: none
|
90 |
|
91 | # Credits
|
92 | These definitions were written by [e-cloud](https://github.com/e-cloud).
|
93 |
|
\ | No newline at end of file |