From 1274a25b143c53560be4fc7512e06899f141bcaf Mon Sep 17 00:00:00 2001 From: Qingyu Deng Date: Wed, 15 Dec 2021 02:51:24 +0800 Subject: [PATCH] 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 --- doc/api/modules.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/api/modules.md b/doc/api/modules.md index 0730cc119717e3..bd975d273e2366 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -197,13 +197,13 @@ LOAD_NODE_MODULES(X, START) NODE_MODULES_PATHS(START) 1. let PARTS = path split(START) 2. let I = count of PARTS - 1 -3. let DIRS = [GLOBAL_FOLDERS] +3. let DIRS = [] 4. while I >= 0, a. if PARTS[I] = "node_modules" CONTINUE b. DIR = path join(PARTS[0 .. I] + "node_modules") - c. DIRS = DIRS + DIR + c. DIRS = DIR + DIRS d. let I = I - 1 -5. return DIRS +5. return DIRS + GLOBAL_FOLDERS LOAD_PACKAGE_IMPORTS(X, DIR) 1. Find the closest package scope SCOPE to DIR.