Skip to content

Commit

Permalink
doc: align module resolve algorithm with implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayase-252 committed May 29, 2021
1 parent f1cbaea commit 74d80b0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions doc/api/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,14 @@ 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
d. let I = I - 1
5. return DIRS
5. DIRS = DIRS.concat(GLOBAL_FOLDERS)
6. return DIRS

LOAD_PACKAGE_IMPORTS(X, DIR)
1. Find the closest package scope SCOPE to DIR.
Expand Down

0 comments on commit 74d80b0

Please sign in to comment.