@@ -8,20 +8,20 @@ Resolve things like Node.js.
88
99## Contents
1010
11- * [ What is this?] ( #what-is-this )
12- * [ When to use this?] ( #when-to-use-this )
13- * [ Install] ( #install )
14- * [ Use] ( #use )
15- * [ API] ( #api )
16- * [ ` resolve(specifier, parent) ` ] ( #resolvespecifier-parent )
17- * [ ` moduleResolve(specifier, parent, conditions, preserveSymlinks) ` ] ( #moduleresolvespecifier-parent-conditions-preservesymlinks )
18- * [ ` ErrnoException ` ] ( #errnoexception )
19- * [ Algorithm] ( #algorithm )
20- * [ Differences to Node] ( #differences-to-node )
21- * [ Types] ( #types )
22- * [ Compatibility] ( #compatibility )
23- * [ Contribute] ( #contribute )
24- * [ License] ( #license )
11+ * [ What is this?] ( #what-is-this )
12+ * [ When to use this?] ( #when-to-use-this )
13+ * [ Install] ( #install )
14+ * [ Use] ( #use )
15+ * [ API] ( #api )
16+ * [ ` resolve(specifier, parent) ` ] ( #resolvespecifier-parent )
17+ * [ ` moduleResolve(specifier, parent, conditions, preserveSymlinks) ` ] ( #moduleresolvespecifier-parent-conditions-preservesymlinks )
18+ * [ ` ErrnoException ` ] ( #errnoexception )
19+ * [ Algorithm] ( #algorithm )
20+ * [ Differences to Node] ( #differences-to-node )
21+ * [ Types] ( #types )
22+ * [ Compatibility] ( #compatibility )
23+ * [ Contribute] ( #contribute )
24+ * [ License] ( #license )
2525
2626## What is this?
2727
@@ -82,12 +82,12 @@ Match `import.meta.resolve` except that `parent` is required (you can pass
8282
8383###### Parameters
8484
85- * ` specifier` (` string` )
86- — the module specifier to resolve relative to parent
87- (` /example.js` , ` ./example.js` , ` ../example.js` , ` some-package` , ` fs` , etc)
88- * ` parent` (` string` , example: ` import.meta.url` )
89- — the absolute parent module URL to resolve from; you must pass
90- ` import.meta.url` or something else
85+ * ` specifier` (` string` )
86+ — the module specifier to resolve relative to parent
87+ (` /example.js` , ` ./example.js` , ` ../example.js` , ` some-package` , ` fs` , etc)
88+ * ` parent` (` string` , example: ` import.meta.url` )
89+ — the absolute parent module URL to resolve from; you must pass
90+ ` import.meta.url` or something else
9191
9292###### Returns
9393
@@ -104,14 +104,14 @@ The [“Resolver Algorithm Specification”][algo] as detailed in the Node docs
104104
105105###### Parameters
106106
107- * ` specifier` (` string` )
108- — ` /example.js` , ` ./example.js` , ` ../example.js` , ` some-package` , ` fs` , etc
109- * ` parent` (` URL` , example: ` import.meta.url` )
110- — full URL (to a file) that ` specifier ` is resolved relative from
111- * ` conditions` (` Set<string>` , default: ` new Set([' node' , ' import' ])` )
112- — conditions
113- * ` preserveSymlinks` (` boolean` , default: ` false` )
114- — keep symlinks instead of resolving them
107+ * ` specifier` (` string` )
108+ — ` /example.js` , ` ./example.js` , ` ../example.js` , ` some-package` , ` fs` , etc
109+ * ` parent` (` URL` , example: ` import.meta.url` )
110+ — full URL (to a file) that ` specifier ` is resolved relative from
111+ * ` conditions` (` Set<string>` , default: ` new Set([' node' , ' import' ])` )
112+ — conditions
113+ * ` preserveSymlinks` (` boolean` , default: ` false` )
114+ — keep symlinks instead of resolving them
115115
116116###### Returns
117117
@@ -139,30 +139,30 @@ type ErrnoExceptionFields = Error & {
139139
140140The ` code` field on errors is one of the following strings:
141141
142- * ` ' ERR_INVALID_MODULE_SPECIFIER' `
143- — when ` specifier` is invalid (example: ` ' #' ` )
144- * ` ' ERR_INVALID_PACKAGE_CONFIG' `
145- — when a ` package .json ` is invalid (example: invalid JSON)
146- * ` ' ERR_INVALID_PACKAGE_TARGET' `
147- — when a ` package .json ` ` exports ` or ` imports` is invalid (example: when it
148- does not start with ` ' ./' ` )
149- * ` ' ERR_MODULE_NOT_FOUND' `
150- — when ` specifier` cannot be found in ` parent` (example: ` ' some-missing-package' ` )
151- * ` ' ERR_NETWORK_IMPORT_DISALLOWED' `
152- — thrown when trying to resolve a local file or builtin from a remote file
153- (` node: fs` relative to ` ' https://example.com' ` )
154- * ` ' ERR_PACKAGE_IMPORT_NOT_DEFINED' `
155- — when a local import is not defined in an import map (example: ` ' #local' `
156- when not defined)
157- * ` ' ERR_PACKAGE_PATH_NOT_EXPORTED' `
158- — when an export is not defined in an export map (example: ` ' tape/index.js' ` ,
159- which is not in its export map)
160- * ` ' ERR_UNSUPPORTED_DIR_IMPORT' `
161- — when attempting to import a directory (example: ` ' ./lib/' ` )
162- * ` ' ERR_UNKNOWN_FILE_EXTENSION' `
163- — when somehow reading a file that has an unexpected extensions (` ' ./readme.md' ` )
164- * ` ' ERR_INVALID_ARG_VALUE' `
165- — when ` conditions` is incorrect
142+ * ` ' ERR_INVALID_MODULE_SPECIFIER' `
143+ — when ` specifier` is invalid (example: ` ' #' ` )
144+ * ` ' ERR_INVALID_PACKAGE_CONFIG' `
145+ — when a ` package .json ` is invalid (example: invalid JSON)
146+ * ` ' ERR_INVALID_PACKAGE_TARGET' `
147+ — when a ` package .json ` ` exports ` or ` imports` is invalid (example: when it
148+ does not start with ` ' ./' ` )
149+ * ` ' ERR_MODULE_NOT_FOUND' `
150+ — when ` specifier` cannot be found in ` parent` (example: ` ' some-missing-package' ` )
151+ * ` ' ERR_NETWORK_IMPORT_DISALLOWED' `
152+ — thrown when trying to resolve a local file or builtin from a remote file
153+ (` node: fs` relative to ` ' https://example.com' ` )
154+ * ` ' ERR_PACKAGE_IMPORT_NOT_DEFINED' `
155+ — when a local import is not defined in an import map (example: ` ' #local' `
156+ when not defined)
157+ * ` ' ERR_PACKAGE_PATH_NOT_EXPORTED' `
158+ — when an export is not defined in an export map (example: ` ' tape/index.js' ` ,
159+ which is not in its export map)
160+ * ` ' ERR_UNSUPPORTED_DIR_IMPORT' `
161+ — when attempting to import a directory (example: ` ' ./lib/' ` )
162+ * ` ' ERR_UNKNOWN_FILE_EXTENSION' `
163+ — when somehow reading a file that has an unexpected extensions (` ' ./readme.md' ` )
164+ * ` ' ERR_INVALID_ARG_VALUE' `
165+ — when ` conditions` is incorrect
166166
167167## Algorithm
168168
@@ -175,26 +175,26 @@ lower-level than `resolve`).
175175
176176## Differences to Node
177177
178- * ` parent` defaulting to ` import.meta.url` cannot be ponyfilled: you have to
179- explicitly pass it
180- * no support for loaders (that would mean implementing all of loaders)
181- * no support for CLI flags:
182- ` --conditions` ,
183- ` --experimental-default -type` ,
184- ` --experimental-json-modules` ,
185- ` --experimental-network-imports` ,
186- ` --experimental-policy` ,
187- ` --experimental-wasm-modules` ,
188- ` --input-type` ,
189- ` --no-addons` ,
190- ` --preserve-symlinks` , nor
191- ` --preserve-symlinks-main`
192- work
193- * no support for ` WATCH_REPORT_DEPENDENCIES` env variable
194- * no attempt is made to add a suggestion based on how things used to work in
195- CJS before to not-found errors
196- * prototypal methods are not guarded: Node protects for example ` String#slice`
197- or so from being tampered with, whereas this doesn’t
178+ * ` parent` defaulting to ` import.meta.url` cannot be ponyfilled: you have to
179+ explicitly pass it
180+ * no support for loaders (that would mean implementing all of loaders)
181+ * no support for CLI flags:
182+ ` --conditions` ,
183+ ` --experimental-default -type` ,
184+ ` --experimental-json-modules` ,
185+ ` --experimental-network-imports` ,
186+ ` --experimental-policy` ,
187+ ` --experimental-wasm-modules` ,
188+ ` --input-type` ,
189+ ` --no-addons` ,
190+ ` --preserve-symlinks` , nor
191+ ` --preserve-symlinks-main`
192+ work
193+ * no support for ` WATCH_REPORT_DEPENDENCIES` env variable
194+ * no attempt is made to add a suggestion based on how things used to work in
195+ CJS before to not-found errors
196+ * prototypal methods are not guarded: Node protects for example ` String#slice`
197+ or so from being tampered with, whereas this doesn’t
198198
199199## Types
200200
0 commit comments