@types/loader-runner
TypeScript icon, indicating that this package has built-in type declarations

2.2.8 • Public • Published

Installation

npm install --save @types/loader-runner

Summary

This package contains type definitions for loader-runner (https://github.com/webpack/loader-runner.git).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/loader-runner.

index.d.ts

/// <reference types="node" />

export interface Loader {
    path: string;
    query: string;
    request: string;
    options: any;
    normal: null | ((request: string) => string);
    pitch: null | ((request: string) => string);
    raw: string;
    data: any;
    pitchExecuted: boolean;
    normalExecuted: boolean;
}

export interface RunLoaderOption {
    resource: string;
    loaders: any[];
    context: any;
    readResource: (
        filename: string,
        callback: (err: NodeJS.ErrnoException | null, data: Buffer | null) => void,
    ) => void;
}

export interface RunLoaderResult {
    result?: Array<Buffer | null> | undefined;
    resourceBuffer?: Buffer | null | undefined;
    cacheable: boolean;
    fileDependencies: string[];
    contextDependencies: string[];
}

export interface ExtendedLoaderContext {
    context: string | null;
    loaderIndex: number;
    loaders: Loader[];
    resourcePath: string | undefined;
    resourceQuery: string | undefined;
    async: (() => (() => void) | undefined) | null;
    callback: (() => void) | null;
    cacheable: (flag: boolean) => void;
    dependency: (file: string) => void;
    addDependency: (file: string) => void;
    addContextDependency: (context: string) => void;
    getDependencies: () => string[];
    getContextDependencies: () => string[];
    clearDependencies: () => void;
    resource: string;
    request: string;
    remainingRequest: string;
    currentRequest: string;
    previousRequest: string;
    query: {
        [key: string]: any;
    } | string;
    data: any;
}

export function getContext(resource: string): string;

export function runLoaders(
    options: RunLoaderOption,
    callback: (err: NodeJS.ErrnoException | null, result: RunLoaderResult) => any,
): void;

Additional Details

  • Last updated: Mon, 20 Nov 2023 23:36:24 GMT
  • Dependencies: @types/node

Credits

These definitions were written by e-cloud.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/loader-runner

Weekly Downloads

41,771

Version

2.2.8

License

MIT

Unpacked Size

6.19 kB

Total Files

5

Last publish

Collaborators

  • types