@@ -37,10 +37,45 @@ export type Resolver = LegacyResolver | NewResolver
37
37
38
38
export type ResolvedResult = ResultFound | ResultNotFound
39
39
40
- export interface NodeResolverOptions {
41
- extensions ?: readonly string [ ]
42
- moduleDirectory ?: string [ ]
43
- paths ?: string [ ]
40
+ // based on https://github.com/DefinitelyTyped/DefinitelyTyped/blob/157f2565d64cbc03165a2284bf0e5176af18d991/types/resolve/index.d.ts#L93-L122
41
+ export interface NodeResolverOptions
42
+ extends Omit < NapiResolveOptions , 'extensions' > {
43
+ /** Directory to begin resolving from (defaults to __dirname) */
44
+ basedir ?: string
45
+ /** Set to false to exclude node core modules (e.g. fs) from the search */
46
+ includeCoreModules ?: boolean
47
+ /** Array of file extensions to search in order (defaults to ['.js']) */
48
+ extensions ?: string | readonly string [ ]
49
+ /**
50
+ * Require.paths array to use if nothing is found on the normal node_modules
51
+ * recursive walk (probably don't use this)
52
+ */
53
+ paths ?: string | readonly string [ ]
54
+ /**
55
+ * Directory (or directories) in which to recursively look for modules.
56
+ * (default to 'node_modules')
57
+ */
58
+ moduleDirectory ?: string | readonly string [ ]
59
+ /**
60
+ * If true, doesn't resolve `basedir` to real path before resolving. This is
61
+ * the way Node resolves dependencies when executed with the
62
+ * --preserve-symlinks flag.
63
+ *
64
+ * Note: this property is currently true by default but it will be changed to
65
+ * false in the next major version because Node's resolution algorithm does
66
+ * not preserve symlinks by default.
67
+ */
68
+ preserveSymlinks ?: boolean
69
+
70
+ // The following options are not supported anymore, but kept for compatibility
71
+ /** @deprecated */
72
+ package ?: unknown
73
+ /** @deprecated */
74
+ packageFilter ?: unknown
75
+ /** @deprecated */
76
+ pathFilter ?: unknown
77
+ /** @deprecated */
78
+ packageIterator ?: unknown
44
79
}
45
80
46
81
export interface WebpackResolverOptions {
@@ -126,7 +161,7 @@ export interface LegacyResolverRecord {
126
161
[ resolve : string ] : unknown
127
162
node ?: NodeResolverOptions | boolean
128
163
typescript ?: TsResolverOptions | boolean
129
- webpack ?: WebpackResolverOptions
164
+ webpack ?: WebpackResolverOptions | boolean
130
165
}
131
166
132
167
export type LegacyImportResolver =
0 commit comments