JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 219191
  • Score
    100M100P100Q169970F
  • License MIT

TypeScript definitions for loader-utils

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@types/loader-utils) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Installation

    npm install --save @types/loader-utils

    Summary

    This package contains type definitions for loader-utils (https://github.com/webpack/loader-utils#readme).

    Details

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

    index.d.ts

    /// <reference types="node" />
    
    import { LoaderContext } from "webpack";
    
    export type Readonly<T> = {
        readonly [P in keyof T]: T[P];
    };
    
    export interface LoaderInterpolateOption {
        customInterpolateName?: typeof interpolateName;
    }
    
    export interface InterpolateOption {
        context?: string | undefined;
        content?: string | Buffer | undefined;
        regExp?: string | RegExp | undefined;
    }
    
    export interface OptionObject {
        [key: string]: null | false | true | string;
    }
    
    export type InterpolateNameType = string | ((resourcePath: string, resourceQuery?: string) => string);
    
    export type HashType = "xxhash64" | "sha1" | "md4" | "native-md4" | "md5" | "sha256" | "sha512";
    
    export type DigestType =
        | "hex"
        | "base26"
        | "base32"
        | "base36"
        | "base49"
        | "base52"
        | "base58"
        | "base62"
        | "base64"
        | "base64safe";
    /**
     * {@link https://https://github.com/webpack/loader-utils#urltorequest}
     */
    export function isUrlRequest(url: string, root?: string): boolean;
    
    /**
     * Converts some resource URL to a webpack module request.
     * {@link https://github.com/webpack/loader-utils#urltorequest}
     */
    export function urlToRequest(url: string, root?: string): string;
    
    /**
     * Interpolates a filename template using multiple placeholders and/or a regular expression.
     * The template and regular expression are set as query params called name and regExp on the current loader's context.
     * {@link https://github.com/webpack/loader-utils#interpolatename}
     */
    export function interpolateName(
        loaderContext: LoaderContext<LoaderInterpolateOption>,
        name: InterpolateNameType,
        options?: InterpolateOption,
    ): string;
    
    /**
     * @param buffer the content that should be hashed
     * @param [hashType='xxhash64'] one of `xxhash64`, `sha1`, `md4`, `md5`, `sha256`, `sha512` or any other node.js supported hash type
     * @param [digestType='hex'] one of `hex`, `base26`, `base32`, `base36`, `base49`, `base52`, `base58`, `base62`, `base64`, `base64safe`
     * @param [maxLength=9999] the maximum length in chars
     * {@link https://github.com/webpack/loader-utils#gethashdigest}
     */
    export function getHashDigest(buffer: Buffer, hashType?: HashType, digestType?: DigestType, maxLength?: number): string;
    

    Additional Details

    Credits

    These definitions were written by Gyusun Yeom, Totooria Hyperion, Piotr Błażejewicz, and Jesse Katsumata.