2.0.6 • Published 6 months ago

@types/loader-utils v2.0.6

Weekly downloads
145,363
License
MIT
Repository
github
Last release
6 months ago

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/v1.

index.d.ts

// Type definitions for loader-utils 1.1
// Project: https://github.com/webpack/loader-utils#readme
// Definitions by: Gyusun Yeom <https://github.com/Perlmint>
//                 Totooria Hyperion <https://github.com/TotooriaHyperion>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.7

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

import { loader } from 'webpack';

export interface InterpolateOption {
    context?: string | undefined;
    content?: string | Buffer | undefined;
    regExp?: string | RegExp | undefined;
}
export interface OptionObject {
    [key: string]: any;
}
export type HashType = "sha1" | "md5" | "sha256" | "sha512";
export type DigestType = "hex" | "base26" | "base32" | "base36" | "base49" | "base52" | "base58" | "base62" | "base64";

export function getOptions(loaderContext: loader.LoaderContext): OptionObject;
export function parseQuery(optionString: string): OptionObject;
export function stringifyRequest(loaderContext: loader.LoaderContext, resource: string): string;
export function getRemainingRequest(loaderContext: loader.LoaderContext): string;
export function getCurrentRequest(loaderContext: loader.LoaderContext): string;
export function isUrlRequest(url: string, root?: string): boolean;
export function parseString(str: string): string;
export function urlToRequest(url: string, root?: string): string;
export function interpolateName(loaderContext: loader.LoaderContext, name: string, options?: any): string;
export function getHashDigest(buffer: Buffer, hashType: HashType, digestType: DigestType, maxLength: number): string;

Additional Details

Credits

These definitions were written by Gyusun Yeom, and Totooria Hyperion.