enhanced-resolve

  • Version 5.8.3
  • Published
  • 157 kB
  • 2 dependencies
  • MIT license

Install

npm i enhanced-resolve
yarn add enhanced-resolve
pnpm add enhanced-resolve

Overview

Offers a async require.resolve function. It's highly configurable.

Index

Functions

function create

create: typeof create;

    function exports

    exports: typeof exports;

      function forEachBail

      forEachBail: (array?: any, iterator?: any, callback?: any) => any;

        function sync

        sync: (context?: any, path?: any, request?: any) => string | false;

          Classes

          class CachedInputFileSystem

          class CachedInputFileSystem {}

            constructor

            constructor(fileSystem?: any, duration?: any);

              property fileSystem

              fileSystem: any;

                property lstat

                lstat?: {
                (arg0: string, arg1: FileSystemCallback<FileSystemStats>): void;
                (
                arg0: string,
                arg1: object,
                arg2: FileSystemCallback<string | Buffer>
                ): void;
                };

                  property lstatSync

                  lstatSync?: (arg0: string, arg1?: object) => FileSystemStats;

                    property readdir

                    readdir: {
                    (
                    arg0: string,
                    arg1: FileSystemCallback<(string | Buffer)[] | FileSystemDirent[]>
                    ): void;
                    (
                    arg0: string,
                    arg1: object,
                    arg2: FileSystemCallback<(string | Buffer)[] | FileSystemDirent[]>
                    ): void;
                    };

                      property readdirSync

                      readdirSync: (
                      arg0: string,
                      arg1?: object
                      ) => (string | Buffer)[] | FileSystemDirent[];

                        property readFile

                        readFile: {
                        (arg0: string, arg1: FileSystemCallback<string | Buffer>): void;
                        (
                        arg0: string,
                        arg1: object,
                        arg2: FileSystemCallback<string | Buffer>
                        ): void;
                        };

                          property readFileSync

                          readFileSync: (arg0: string, arg1?: object) => string | Buffer;

                            property readJson

                            readJson?: {
                            (arg0: string, arg1: FileSystemCallback<object>): void;
                            (arg0: string, arg1: object, arg2: FileSystemCallback<object>): void;
                            };

                              property readJsonSync

                              readJsonSync?: (arg0: string, arg1?: object) => object;
                                readlink: {
                                (arg0: string, arg1: FileSystemCallback<string | Buffer>): void;
                                (
                                arg0: string,
                                arg1: object,
                                arg2: FileSystemCallback<string | Buffer>
                                ): void;
                                };

                                  property readlinkSync

                                  readlinkSync: (arg0: string, arg1?: object) => string | Buffer;

                                    property stat

                                    stat: {
                                    (arg0: string, arg1: FileSystemCallback<FileSystemStats>): void;
                                    (
                                    arg0: string,
                                    arg1: object,
                                    arg2: FileSystemCallback<string | Buffer>
                                    ): void;
                                    };

                                      property statSync

                                      statSync: (arg0: string, arg1?: object) => FileSystemStats;

                                        method purge

                                        purge: (what?: any) => void;

                                          class CloneBasenamePlugin

                                          class CloneBasenamePlugin {}

                                            constructor

                                            constructor(source?: any, target?: any);

                                              property source

                                              source: any;

                                                property target

                                                target: any;

                                                  method apply

                                                  apply: (resolver: Resolver) => void;

                                                    class LogInfoPlugin

                                                    class LogInfoPlugin {}

                                                      constructor

                                                      constructor(source?: any);

                                                        property source

                                                        source: any;

                                                          method apply

                                                          apply: (resolver: Resolver) => void;

                                                            class Resolver

                                                            abstract class Resolver {}

                                                              property fileSystem

                                                              fileSystem: FileSystem;

                                                                property hooks

                                                                hooks: { resolveStep: any; noResolve: any; resolve: any; result: any };

                                                                  property options

                                                                  options: ResolveOptions;

                                                                    method doResolve

                                                                    doResolve: (
                                                                    hook?: any,
                                                                    request?: any,
                                                                    message?: any,
                                                                    resolveContext?: any,
                                                                    callback?: any
                                                                    ) => any;

                                                                      method ensureHook

                                                                      ensureHook: (
                                                                      name:
                                                                      | string
                                                                      | AsyncSeriesBailHook<
                                                                      [ResolveRequest, ResolveContext],
                                                                      null | ResolveRequest
                                                                      >
                                                                      ) => any;

                                                                        method getHook

                                                                        getHook: (
                                                                        name:
                                                                        | string
                                                                        | AsyncSeriesBailHook<
                                                                        [ResolveRequest, ResolveContext],
                                                                        null | ResolveRequest
                                                                        >
                                                                        ) => any;

                                                                          method isDirectory

                                                                          isDirectory: (path: string) => boolean;

                                                                            method isModule

                                                                            isModule: (path?: any) => boolean;

                                                                              method isPrivate

                                                                              isPrivate: (path?: any) => boolean;

                                                                                method join

                                                                                join: (path?: any, request?: any) => string;

                                                                                  method normalize

                                                                                  normalize: (path?: any) => string;

                                                                                    method parse

                                                                                    parse: (identifier: string) => ParsedIdentifier;

                                                                                      method resolve

                                                                                      resolve: (
                                                                                      context: object,
                                                                                      path: string,
                                                                                      request: string,
                                                                                      resolveContext: ResolveContext,
                                                                                      callback: (
                                                                                      arg0: null | Error,
                                                                                      arg1?: string | false,
                                                                                      arg2?: ResolveRequest
                                                                                      ) => void
                                                                                      ) => void;

                                                                                        method resolveSync

                                                                                        resolveSync: (context: object, path: string, request: string) => string | false;

                                                                                          Interfaces

                                                                                          interface FileSystem

                                                                                          interface FileSystem {}

                                                                                            property lstat

                                                                                            lstat?: {
                                                                                            (arg0: string, arg1: FileSystemCallback<FileSystemStats>): void;
                                                                                            (
                                                                                            arg0: string,
                                                                                            arg1: object,
                                                                                            arg2: FileSystemCallback<string | Buffer>
                                                                                            ): void;
                                                                                            };

                                                                                              property readdir

                                                                                              readdir: {
                                                                                              (
                                                                                              arg0: string,
                                                                                              arg1: FileSystemCallback<(string | Buffer)[] | FileSystemDirent[]>
                                                                                              ): void;
                                                                                              (
                                                                                              arg0: string,
                                                                                              arg1: object,
                                                                                              arg2: FileSystemCallback<(string | Buffer)[] | FileSystemDirent[]>
                                                                                              ): void;
                                                                                              };

                                                                                                property readFile

                                                                                                readFile: {
                                                                                                (arg0: string, arg1: FileSystemCallback<string | Buffer>): void;
                                                                                                (
                                                                                                arg0: string,
                                                                                                arg1: object,
                                                                                                arg2: FileSystemCallback<string | Buffer>
                                                                                                ): void;
                                                                                                };

                                                                                                  property readJson

                                                                                                  readJson?: {
                                                                                                  (arg0: string, arg1: FileSystemCallback<object>): void;
                                                                                                  (arg0: string, arg1: object, arg2: FileSystemCallback<object>): void;
                                                                                                  };
                                                                                                    readlink: {
                                                                                                    (arg0: string, arg1: FileSystemCallback<string | Buffer>): void;
                                                                                                    (
                                                                                                    arg0: string,
                                                                                                    arg1: object,
                                                                                                    arg2: FileSystemCallback<string | Buffer>
                                                                                                    ): void;
                                                                                                    };

                                                                                                      property stat

                                                                                                      stat: {
                                                                                                      (arg0: string, arg1: FileSystemCallback<FileSystemStats>): void;
                                                                                                      (
                                                                                                      arg0: string,
                                                                                                      arg1: object,
                                                                                                      arg2: FileSystemCallback<string | Buffer>
                                                                                                      ): void;
                                                                                                      };

                                                                                                        interface PnpApi

                                                                                                        interface PnpApiImpl {}

                                                                                                          property resolveToUnqualified

                                                                                                          resolveToUnqualified: (arg0: string, arg1: string, arg2: object) => string;

                                                                                                            interface ResolveContext

                                                                                                            interface ResolveContext {}
                                                                                                            • Resolve context

                                                                                                            property contextDependencies

                                                                                                            contextDependencies?: WriteOnlySet<string>;

                                                                                                              property fileDependencies

                                                                                                              fileDependencies?: WriteOnlySet<string>;
                                                                                                              • files that was found on file system

                                                                                                              property log

                                                                                                              log?: (arg0: string) => void;
                                                                                                              • log function

                                                                                                              property missingDependencies

                                                                                                              missingDependencies?: WriteOnlySet<string>;
                                                                                                              • dependencies that was not found on file system

                                                                                                              property stack

                                                                                                              stack?: Set<string>;
                                                                                                              • set of hooks' calls. For instance, resolve → parsedResolve → describedResolve,

                                                                                                              interface ResolveOptions

                                                                                                              interface UserResolveOptions {}

                                                                                                                property alias

                                                                                                                alias?: AliasOptions | AliasOption[];
                                                                                                                • A list of module alias configurations or an object which maps key to value

                                                                                                                property aliasFields

                                                                                                                aliasFields?: (string | string[])[];
                                                                                                                • A list of alias fields in description files

                                                                                                                property cachePredicate

                                                                                                                cachePredicate?: (arg0: ResolveRequest) => boolean;
                                                                                                                • A function which decides whether a request should be cached or not. An object is passed with at least path and request properties.

                                                                                                                property cacheWithContext

                                                                                                                cacheWithContext?: boolean;
                                                                                                                • Whether or not the unsafeCache should include request context as part of the cache key.

                                                                                                                property conditionNames

                                                                                                                conditionNames?: string[];
                                                                                                                • A list of exports field condition names.

                                                                                                                property descriptionFiles

                                                                                                                descriptionFiles?: string[];
                                                                                                                • A list of description files to read from

                                                                                                                property enforceExtension

                                                                                                                enforceExtension?: boolean;
                                                                                                                • Enforce that a extension from extensions must be used

                                                                                                                property exportsFields

                                                                                                                exportsFields?: (string | string[])[];
                                                                                                                • A list of exports fields in description files

                                                                                                                property extensions

                                                                                                                extensions?: string[];
                                                                                                                • A list of extensions which should be tried for files

                                                                                                                property fallback

                                                                                                                fallback?: AliasOptions | AliasOption[];
                                                                                                                • A list of module alias configurations or an object which maps key to value, applied only after modules option

                                                                                                                property fileSystem

                                                                                                                fileSystem: FileSystem;
                                                                                                                • The file system which should be used

                                                                                                                property fullySpecified

                                                                                                                fullySpecified?: boolean;
                                                                                                                • The request is already fully specified and no extensions or directories are resolved for it

                                                                                                                property importsFields

                                                                                                                importsFields?: (string | string[])[];
                                                                                                                • A list of imports fields in description files

                                                                                                                property mainFields

                                                                                                                mainFields?: (
                                                                                                                | string
                                                                                                                | string[]
                                                                                                                | { name: string | string[]; forceRelative: boolean }
                                                                                                                )[];
                                                                                                                • A list of main fields in description files

                                                                                                                property mainFiles

                                                                                                                mainFiles?: string[];
                                                                                                                • A list of main files in directories

                                                                                                                property modules

                                                                                                                modules?: string | string[];
                                                                                                                • A list of directories to resolve modules from, can be absolute path or folder name

                                                                                                                property plugins

                                                                                                                plugins?: Plugin[];
                                                                                                                • A list of additional resolve plugins which should be applied

                                                                                                                property pnpApi

                                                                                                                pnpApi?: null | PnpApiImpl;
                                                                                                                • A PnP API that should be used - null is "never", undefined is "auto"

                                                                                                                property preferAbsolute

                                                                                                                preferAbsolute?: boolean;
                                                                                                                • Prefer to resolve server-relative urls as absolute paths before falling back to resolve in roots

                                                                                                                property preferRelative

                                                                                                                preferRelative?: boolean;
                                                                                                                • Prefer to resolve module requests as relative requests before falling back to modules

                                                                                                                property resolver

                                                                                                                resolver?: Resolver;
                                                                                                                • A prepared Resolver to which the plugins are attached

                                                                                                                property resolveToContext

                                                                                                                resolveToContext?: boolean;
                                                                                                                • Resolve to a context instead of a file

                                                                                                                property restrictions

                                                                                                                restrictions?: (string | RegExp)[];
                                                                                                                • A list of resolve restrictions

                                                                                                                property roots

                                                                                                                roots?: string[];
                                                                                                                • A list of root paths

                                                                                                                symlinks?: boolean;
                                                                                                                • Resolve symlinks to their symlinked location

                                                                                                                property unsafeCache

                                                                                                                unsafeCache?: boolean | object;
                                                                                                                • Use this cache object to unsafely cache the successful requests

                                                                                                                property useSyncFileSystemCalls

                                                                                                                useSyncFileSystemCalls?: boolean;
                                                                                                                • Use only the sync constiants of the file system calls

                                                                                                                Type Aliases

                                                                                                                type Plugin

                                                                                                                type Plugin =
                                                                                                                | { apply: (arg0: Resolver) => void }
                                                                                                                | ((this: Resolver, arg1: Resolver) => void);

                                                                                                                  type ResolveRequest

                                                                                                                  type ResolveRequest = BaseResolveRequest & Partial<ParsedIdentifier>;

                                                                                                                    Namespaces

                                                                                                                    namespace create

                                                                                                                    namespace create {}

                                                                                                                      function sync

                                                                                                                      sync: (
                                                                                                                      options?: any
                                                                                                                      ) => (context?: any, path?: any, request?: any) => string | false;

                                                                                                                        namespace ResolverFactory

                                                                                                                        namespace ResolverFactory {}

                                                                                                                          function createResolver

                                                                                                                          createResolver: (options: UserResolveOptions) => Resolver;

                                                                                                                            Package Files (1)

                                                                                                                            Dependencies (2)

                                                                                                                            Dev Dependencies (16)

                                                                                                                            Peer Dependencies (0)

                                                                                                                            No peer dependencies.

                                                                                                                            Badge

                                                                                                                            To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                            You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/enhanced-resolve.

                                                                                                                            • Markdown
                                                                                                                              [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/enhanced-resolve)
                                                                                                                            • HTML
                                                                                                                              <a href="https://www.jsdocs.io/package/enhanced-resolve"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>