You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 03016f9
Browse filesBrowse the repository at this point in the historyBrowse files
Allow the path-like resolve options `roots`, `modules`, `alias`/`fallback` targets, `restrictions`, and `tsconfig` (the config file, `configFile`, `baseUrl`, and `references`) to accept file `URL` instances (such as `new URL("./dir/", import.meta.url)`), converting them to filesystem paths. Plain strings are still treated as literal paths, matching Node's `fs`.
* @property {string=} baseUrl Override baseUrl from tsconfig.json. If provided, this value will be used instead of the baseUrl in the tsconfig file
63
66
*/
64
67
68
+
/**
69
+
* @typedef {object} UserTsconfigOptions
70
+
* @property {(string | URL)=} configFile A path, or `file:` `URL` instance, pointing at the tsconfig file
71
+
* @property {((string | URL)[] | "auto")=} references References to other tsconfig files. 'auto' inherits from TypeScript config, or an array of relative/absolute paths or `file:` `URL` instances
72
+
* @property {(string | URL)=} baseUrl Override baseUrl from tsconfig.json with a path or `file:` `URL` instance
73
+
*/
74
+
65
75
/**
66
76
* @typedef {object} UserResolveOptions
67
-
* @property {(AliasOptions | AliasOptionEntry[])=} alias A list of module alias configurations or an object which maps key to value
68
-
* @property {(AliasOptions | AliasOptionEntry[])=} fallback A list of module alias configurations or an object which maps key to value, applied only after modules option
77
+
* @property {(UserAliasOptions | UserAliasOptionEntry[])=} alias A list of module alias configurations or an object which maps key to value
78
+
* @property {(UserAliasOptions | UserAliasOptionEntry[])=} fallback A list of module alias configurations or an object which maps key to value, applied only after modules option
69
79
* @property {ExtensionAliasOptions=} extensionAlias An object which maps extension to extension aliases
70
80
* @property {boolean=} extensionAliasForExports Also apply `extensionAlias` to paths resolved through the package.json `exports` field. Off by default (Node.js-aligned); when enabled, matches TypeScript's behavior for packages that ship TS sources alongside compiled JS.
71
81
* @property {(string | string[])[]=} aliasFields A list of alias fields in description files
* @property {(Cache | boolean)=} unsafeCache Use this cache object to unsafely cache the successful requests
82
92
* @property {boolean=} symlinks Resolve symlinks to their symlinked location
83
93
* @property {Resolver=} resolver A prepared Resolver to which the plugins are attached
84
-
* @property {string[] | string=} modules A list of directories to resolve modules from, can be absolute path or folder name
94
+
* @property {(string | URL)[] | string | URL=} modules A list of directories to resolve modules from, can be absolute path, folder name, or a `file:` `URL` instance
85
95
* @property {(string | string[] | { name: string | string[], forceRelative: boolean })[]=} mainFields A list of main fields in description files
86
96
* @property {string[]=} mainFiles A list of main files in directories
87
97
* @property {Plugin[]=} plugins A list of additional resolve plugins which should be applied
88
98
* @property {PnpApi | null=} pnpApi A PnP API that should be used - null is "never", undefined is "auto"
89
-
* @property {string[]=} roots A list of root paths
99
+
* @property {(string | URL)[]=} roots A list of root paths, each an absolute path or a `file:` `URL` instance
90
100
* @property {boolean=} fullySpecified The request is already fully specified and no extensions or directories are resolved for it
91
101
* @property {boolean=} resolveToContext Resolve to a context instead of a file
92
-
* @property {(string | RegExp)[]=} restrictions A list of resolve restrictions
102
+
* @property {(string | URL | RegExp)[]=} restrictions A list of resolve restrictions, each an absolute path, a `file:` `URL` instance, or a RegExp
93
103
* @property {boolean=} useSyncFileSystemCalls Use only the sync constraints of the file system calls
94
104
* @property {boolean=} preferRelative Prefer to resolve module requests as relative requests before falling back to modules
95
105
* @property {boolean=} preferAbsolute Prefer to resolve server-relative urls as absolute paths before falling back to resolve in roots
96
-
* @property {string | boolean | TsconfigOptions=} tsconfig TypeScript config file path or config object with configFile and references
106
+
* @property {string | URL | boolean | UserTsconfigOptions=} tsconfig TypeScript config file path (or `file:` `URL` instance) or config object with configFile and references
97
107
*/
98
108
99
109
/**
@@ -165,23 +175,69 @@ function processPnpApiOption(option) {
165
175
}
166
176
167
177
/**
168
-
* @param {AliasOptions | AliasOptionEntry[] | undefined} alias alias
178
+
* @param {UserAliasOptionNewRequest} alias alias target(s)
179
+
* @returns {AliasOptionNewRequest} target(s) with file `URL` instances converted to paths
0 commit comments