Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[resolve]: update to v1.17 #44137

Merged
merged 2 commits into from
May 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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