@types/resolve
- Version 1.20.6
- Published
- 10.1 kB
- No dependencies
- MIT license
Install
npm i @types/resolve
yarn add @types/resolve
pnpm add @types/resolve
Overview
TypeScript definitions for resolve
Index
Variables
Functions
Interfaces
Type Aliases
Variables
Functions
function resolve
resolve: typeof resolve;
Asynchronously resolve the module path string id into cb(err, res [, pkg]), where pkg (if defined) is the data from package.json
Parameter id
Identifier to resolve
Parameter callback
Asynchronously resolve the module path string id into cb(err, res [, pkg]), where pkg (if defined) is the data from package.json
Parameter id
Identifier to resolve
Parameter options
Options to use for resolving, optional.
Parameter callback
function resolveIsCore
resolveIsCore: (id: string) => boolean | undefined;
Return whether a package is in core
function resolveSync
resolveSync: (id: string, opts?: resolve.SyncOpts) => string;
Synchronously resolve the module path string id, returning the result and throwing an error when id can't be resolved.
Parameter id
Identifier to resolve
Parameter options
Options to use for resolving, optional.
Interfaces
interface BaseAsyncOpts
interface BaseAsyncOpts extends Opts {}
property isDirectory
isDirectory?: ((directory: string, cb: existsCallback) => void) | undefined;
function to asynchronously test whether a directory exists
property isFile
isFile?: ((file: string, cb: existsCallback) => void) | undefined;
function to asynchronously test whether a file exists
property realpath
realpath?: ((file: string, cb: realpathCallback) => void) | undefined;
function to asynchronously resolve a potential symlink to its real path
interface BaseSyncOpts
interface BaseSyncOpts extends Opts {}
property isDirectory
isDirectory?: ((directory: string) => boolean) | undefined;
function to synchronously test whether a directory exists
property isFile
isFile?: ((file: string) => boolean) | undefined;
function to synchronously test whether a file exists
property realpathSync
realpathSync?: ((file: string) => string) | undefined;
function to synchronously resolve a potential symlink to its real path
interface Opts
interface Opts {}
property basedir
basedir?: string | undefined;
directory to begin resolving from (defaults to __dirname)
property extensions
extensions?: string | readonly string[] | undefined;
array of file extensions to search in order (defaults to ['.js'])
property includeCoreModules
includeCoreModules?: boolean | undefined;
set to false to exclude node core modules (e.g. fs) from the search
property moduleDirectory
moduleDirectory?: string | readonly string[] | undefined;
directory (or directories) in which to recursively look for modules. (default to 'node_modules')
property package
package?: any;
package.json data applicable to the module being loaded
property packageFilter
packageFilter?: | ((pkg: PackageJSON, pkgFile: string, dir: string) => PackageJSON) | undefined;
transform the parsed package.json contents before looking at the "main" field
property packageIterator
packageIterator?: | (( request: string, start: string, getPackageCandidates: () => string[], opts: Opts ) => string[]) | undefined;
return the list of candidate paths where the packages sources may be found (probably don't use this)
property pathFilter
pathFilter?: | ((pkg: PackageJSON, path: string, relativePath: string) => string) | undefined;
transform a path within a package
property paths
paths?: string | readonly string[] | undefined;
require.paths array to use if nothing is found on the normal node_modules recursive walk (probably don't use this)
property preserveSymlinks
preserveSymlinks?: boolean | undefined;
if true, doesn't resolve
basedir
to real path before resolving. This is the way Node resolves dependencies when executed with the --preserve-symlinks flag.Note: this property is currently true by default but it will be changed to false in the next major version because Node's resolution algorithm does not preserve symlinks by default.
Type Aliases
type AsyncOpts
type AsyncOpts = BaseAsyncOpts & ( | { /** how to read files asynchronously (defaults to fs.readFile) */ readFile?: ((file: string, cb: readFileCallback) => void) | undefined; /** function to asynchronously read and parse a package.json file */ readPackage?: never | undefined; } | { /** how to read files asynchronously (defaults to fs.readFile) */ readFile?: never | undefined; /** function to asynchronously read and parse a package.json file */ readPackage?: | (( readFile: (file: string, cb: readFileCallback) => void, pkgfile: string, cb: readPackageCallback ) => void) | undefined; } );
type PackageJSON
type PackageJSON = JSONObject;
type SyncOpts
type SyncOpts = BaseSyncOpts & ( | { /** how to read files synchronously (defaults to fs.readFileSync) */ readFileSync?: ((file: string) => StringOrToString) | undefined; /** function to synchronously read and parse a package.json file */ readPackageSync?: never | undefined; } | { /** how to read files synchronously (defaults to fs.readFileSync) */ readFileSync?: never | undefined; /** function to synchronously read and parse a package.json file */ readPackageSync?: | (( readFileSync: (file: string) => StringOrToString, pkgfile: string ) => Record<string, unknown> | undefined) | undefined; } );
Package Files (1)
Dependencies (0)
No dependencies.
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto 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/@types/resolve
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/resolve)
- HTML<a href="https://www.jsdocs.io/package/@types/resolve"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3423 ms. - Missing or incorrect documentation? Open an issue for this package.