@types/loader-utils
TypeScript definitions for loader-utils
Last updated 6 years ago by types .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install @types/loader-utils 
SYNC missed versions from official npm registry.

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 { loader } from "webpack";

export type Readonly<T> = {
    readonly [P in keyof T]: T[P];
};

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 HashType = "sha1" | "md4" | "md5" | "sha256" | "sha512";

export type DigestType = "hex" | "base26" | "base32" | "base36" | "base49" | "base52" | "base58" | "base62" | "base64";

/**
 * Recommended way to retrieve the options of a loader invocation
 * {@link https://github.com/webpack/loader-utils#getoptions}
 */
export function getOptions(loaderContext: loader.LoaderContext): Readonly<OptionObject>;

/**
 * Parses a passed string (e.g. loaderContext.resourceQuery) as a query string, and returns an object.
 * {@link https://github.com/webpack/loader-utils#parsequery}
 */
export function parseQuery(optionString: string): OptionObject;

/**
 * Turns a request into a string that can be used inside require() or import while avoiding absolute paths. Use it instead of JSON.stringify(...) if you're generating code inside a loader.
 * {@link https://github.com/webpack/loader-utils#stringifyrequest}
 */
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;

/**
 * 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: loader.LoaderContext, name: string, options?: any): string;

/**
 * @param buffer
 * @param [hashType='md4']
 * @param [digestType='hex']
 * @param [maxLength=9999]
 */
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.

Current Tags

  • 2.0.6                                ...           latest (2 years ago)
  • 1.1.1                                ...           ts2.0 (8 years ago)
  • 1.1.1                                ...           ts2.1 (8 years ago)
  • 1.1.2                                ...           ts2.2 (8 years ago)
  • 1.1.3                                ...           ts2.3 (8 years ago)
  • 1.1.3                                ...           ts2.4 (8 years ago)
  • 1.1.3                                ...           ts2.5 (8 years ago)
  • 1.1.3                                ...           ts2.6 (8 years ago)
  • 1.1.3                                ...           ts2.7 (8 years ago)
  • 1.1.3                                ...           ts2.8 (8 years ago)
  • 1.1.3                                ...           ts2.9 (8 years ago)
  • 2.0.1                                ...           ts3.0 (6 years ago)
  • 2.0.1                                ...           ts3.1 (6 years ago)
  • 2.0.1                                ...           ts3.2 (6 years ago)
  • 2.0.1                                ...           ts3.3 (6 years ago)
  • 2.0.1                                ...           ts3.4 (6 years ago)
  • 2.0.1                                ...           ts3.5 (6 years ago)
  • 2.0.1                                ...           ts3.6 (6 years ago)
  • 2.0.3                                ...           ts3.7 (5 years ago)
  • 2.0.3                                ...           ts3.8 (5 years ago)
  • 2.0.3                                ...           ts3.9 (5 years ago)
  • 2.0.3                                ...           ts4.0 (5 years ago)
  • 2.0.3                                ...           ts4.1 (5 years ago)
  • 2.0.3                                ...           ts4.2 (5 years ago)
  • 2.0.4                                ...           ts4.3 (3 years ago)
  • 2.0.4                                ...           ts4.4 (3 years ago)
  • 2.0.6                                ...           ts4.5 (2 years ago)
  • 2.0.6                                ...           ts4.6 (2 years ago)
  • 2.0.6                                ...           ts4.7 (2 years ago)
  • 2.0.6                                ...           ts4.8 (2 years ago)
  • 2.0.6                                ...           ts4.9 (2 years ago)
  • 2.0.6                                ...           ts5.0 (2 years ago)
  • 2.0.6                                ...           ts5.1 (2 years ago)
  • 2.0.6                                ...           ts5.2 (2 years ago)
  • 2.0.6                                ...           ts5.3 (2 years ago)
  • 2.0.6                                ...           ts5.4 (2 years ago)
  • 2.0.6                                ...           ts5.5 (2 years ago)
  • 2.0.6                                ...           ts5.6 (2 years ago)

17 Versions

  • 1.1.9                                ...           2 years ago
  • 2.0.6                                ...           2 years ago
  • 1.1.8                                ...           2 years ago
  • 2.0.5                                ...           2 years ago
  • 1.1.7                                ...           3 years ago
  • 2.0.4                                ...           3 years ago
  • 1.1.6                                ...           5 years ago
  • 2.0.3                                ...           5 years ago
  • 1.1.5                                ...           5 years ago
  • 2.0.2                                ...           5 years ago
  • 2.0.1                                ...           6 years ago
  • 1.1.4                                ...           6 years ago
  • 2.0.0                                ...           6 years ago
  • 1.1.3                                ...           8 years ago
  • 1.1.2                                ...           8 years ago
  • 1.1.1                                ...           8 years ago
  • 1.1.0                                ...           9 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dependencies (2)
Dev Dependencies (0)
None

Copyright 2013 - present © cnpmjs.org | Home |