2.0.4 • Published 6 months ago

@types/browser-resolve v2.0.4

Weekly downloads
49,549
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/browser-resolve

Summary

This package contains type definitions for browser-resolve (https://github.com/defunctzombie/node-browser-resolve).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/browser-resolve.

index.d.ts

// Type definitions for browser-resolve 2.0
// Project: https://github.com/defunctzombie/node-browser-resolve
// Definitions by: Mario Nebl <https://github.com/marionebl>
//                 Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

import * as resv from 'resolve';

/**
 * Resolve a module path and call cb(err, path)
 *
 * @param id Identifier to resolve
 * @param callback
 */
declare function resolve(id: string, cb: resolve.Callback): void;

/**
 * Resolve a module path and call cb(err, path)
 *
 * @param id Identifier to resolve
 * @param options Options to use for resolving, optional.
 * @param callback
 */
declare function resolve(id: string, opts: resolve.AsyncOpts, cb: resolve.Callback): void;

declare namespace resolve {
    interface Opts {
        /**
         * directory to begin resolving from
         */
        basedir?: string | undefined;
        /**
         * the 'browser' property to use from package.json
         * @default 'browser'
         */
        browser?: string | undefined;
        /**
         * the calling filename where the require() call originated (in the source)
         */
        filename?: string | undefined;
        /**
         * modules object with id to path mappings to consult before doing manual resolution
         * (use to provide core modules)
         */
        modules?: { [id: string]: string } | undefined;
        /**
         * transform the parsed package.json contents before looking at the main field
         */
        packageFilter?: ((info: any, pkgdir: string) => any) | undefined;
        /**
         * require.paths array to use if nothing is found on the normal node_modules recursive walk
         */
        paths?: string[] | undefined;
    }

    type AsyncOpts = resv.AsyncOpts & Opts;
    type SyncOpts = resv.SyncOpts & Opts;

    /**
     * Callback invoked when resolving asynchronously
     * @param error
     * @param resolved Absolute path to resolved identifier
     */
    type Callback = (err: Error | null, resolved?: string) => void;

    /**
     * Returns a module path
     * @param id Identifier to resolve
     * @param options Options to use for resolving.
     */
    function sync(id: string, opts?: SyncOpts): string;
}

export = resolve;

Additional Details

  • Last updated: Tue, 06 Jul 2021 18:05:45 GMT
  • Dependencies: @types/resolve
  • Global values: none

Credits

These definitions were written by Mario Nebl, and Piotr Błażejewicz.

2.0.3

7 months ago

2.0.2

8 months ago

2.0.4

6 months ago

2.0.1

3 years ago

2.0.0

4 years ago

1.11.0

4 years ago

0.0.5

7 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago