Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Bedford <guybedford@gmail.com>2020-06-28 08:09:24 +0300
committerGuy Bedford <guybedford@gmail.com>2020-07-10 05:19:35 +0300
commit1237955d4149ce0d9445ca707bc824322fc8c15c (patch)
treef1511ef9cde4ad416e7431f0cb955664da529b77 /doc/api/modules.md
parent1198aebd2db710b22bfed003edcf8cca2db8a174 (diff)
module: package "imports" field
PR-URL: https://github.com/nodejs/node/pull/34117 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Diffstat (limited to 'doc/api/modules.md')
-rw-r--r--doc/api/modules.md13
1 files changed, 12 insertions, 1 deletions
diff --git a/doc/api/modules.md b/doc/api/modules.md
index 394e1330ecb..b4301b366cd 100644
--- a/doc/api/modules.md
+++ b/doc/api/modules.md
@@ -160,7 +160,9 @@ require(X) from module at path Y
a. LOAD_AS_FILE(Y + X)
b. LOAD_AS_DIRECTORY(Y + X)
c. THROW "not found"
-4. LOAD_SELF_REFERENCE(X, dirname(Y))
+4. If X begins with '#'
+ a. LOAD_INTERAL_IMPORT(X, Y)
+4. LOAD_SELF_REFERENCE(X, Y)
5. LOAD_NODE_MODULES(X, dirname(Y))
6. THROW "not found"
@@ -236,6 +238,15 @@ LOAD_PACKAGE_EXPORTS(DIR, X)
12. Otherwise
a. If RESOLVED is a file, load it as its file extension format. STOP
13. Throw "not found"
+
+LOAD_INTERNAL_IMPORT(X, START)
+1. Find the closest package scope to START.
+2. If no scope was found or the `package.json` has no "imports", return.
+3. let RESOLVED =
+ fileURLToPath(PACKAGE_INTERNAL_RESOLVE(X, pathToFileURL(START)), as defined
+ in the ESM resolver.
+4. If RESOLVED is not a valid file, throw "not found"
+5. Load RESOLVED as its file extension format. STOP
```
## Caching