Skip to content

Commit

Permalink
[resolve]: update to v1.17 (#44137)
Browse files Browse the repository at this point in the history
* [resolve]: update to v1.17

* chore: update comment
  • Loading branch information
SimenB committed May 4, 2020
1 parent af62dec commit daf6457
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions types/resolve/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Type definitions for resolve 1.14.1
// Project: https://github.com/substack/node-resolve
// Type definitions for resolve 1.17.0
// Project: https://github.com/browserify/resolve
// Definitions by: Mario Nebl <https://github.com/marionebl>
// Klaus Meinhardt <https://github.com/ajafff>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
Expand Down Expand Up @@ -36,6 +36,14 @@ type existsCallback = (err: Error | null, isFile?: boolean) => void;
*/
type readFileCallback = (err: Error | null, file?: Buffer) => void;

/**
* Callback invoked when resolving a potential symlink
*
* @param error
* @param resolved Absolute path to the resolved file
*/
type realpathCallback = (err: Error | null, resolved?: string) => void;

/**
* Asynchronously resolve the module path string id into cb(err, res [, pkg]), where pkg (if defined) is the data from package.json
*
Expand Down Expand Up @@ -80,8 +88,10 @@ declare namespace resolve {
pathFilter?: (pkg: any, path: string, relativePath: string) => string;
/** require.paths array to use if nothing is found on the normal node_modules recursive walk (probably don't use this) */
paths?: string | ReadonlyArray<string>;
/** return the list of candidate paths where the packages sources may be found (probably don't use this) */
packageIterator?: (request: string, start: string, getPackageCandidates: () => string[], opts: Opts) => string[];
/** directory (or directories) in which to recursively look for modules. (default to 'node_modules') */
moduleDirectory?: string | ReadonlyArray<string>
moduleDirectory?: string | ReadonlyArray<string>;
/**
* 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.
Expand All @@ -99,6 +109,8 @@ declare namespace resolve {
isFile?: (file: string, cb: existsCallback) => void;
/** function to asynchronously test whether a directory exists */
isDirectory?: (directory: string, cb: existsCallback) => void;
/** function to asynchronously resolve a potential symlink to its real path */
realpath?: (file: string, cb: realpathCallback) => void;
}

export interface SyncOpts extends Opts {
Expand All @@ -108,6 +120,8 @@ declare namespace resolve {
isFile?: (file: string) => boolean;
/** function to synchronously test whether a directory exists */
isDirectory?: (directory: string) => boolean;
/** function to synchronously resolve a potential symlink to its real path */
realpathSync?: (file: string) => string;
}

export var sync: typeof resolveSync;
Expand Down

0 comments on commit daf6457

Please sign in to comment.