doc: align module resolve algorithm with implementation
Fixes: https://github.com/nodejs/node/issues/38128 PR-URL: https://github.com/nodejs/node/pull/38837 Reviewed-By: Guy Bedford <guybedford@gmail.com>
This commit is contained in:
parent
ced5fc3930
commit
ea977fca14
@ -197,13 +197,13 @@ LOAD_NODE_MODULES(X, START)
|
|||||||
NODE_MODULES_PATHS(START)
|
NODE_MODULES_PATHS(START)
|
||||||
1. let PARTS = path split(START)
|
1. let PARTS = path split(START)
|
||||||
2. let I = count of PARTS - 1
|
2. let I = count of PARTS - 1
|
||||||
3. let DIRS = [GLOBAL_FOLDERS]
|
3. let DIRS = []
|
||||||
4. while I >= 0,
|
4. while I >= 0,
|
||||||
a. if PARTS[I] = "node_modules" CONTINUE
|
a. if PARTS[I] = "node_modules" CONTINUE
|
||||||
b. DIR = path join(PARTS[0 .. I] + "node_modules")
|
b. DIR = path join(PARTS[0 .. I] + "node_modules")
|
||||||
c. DIRS = DIRS + DIR
|
c. DIRS = DIR + DIRS
|
||||||
d. let I = I - 1
|
d. let I = I - 1
|
||||||
5. return DIRS
|
5. return DIRS + GLOBAL_FOLDERS
|
||||||
|
|
||||||
LOAD_PACKAGE_IMPORTS(X, DIR)
|
LOAD_PACKAGE_IMPORTS(X, DIR)
|
||||||
1. Find the closest package scope SCOPE to DIR.
|
1. Find the closest package scope SCOPE to DIR.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user