Skip to content

Commit

Permalink
doc: package main can be directory with an index
Browse files Browse the repository at this point in the history
This behavior dates back to 2011 but was not documented.

PR-URL: #11581
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: James Snell <jasnell@gmail.com>
  • Loading branch information
bmeck authored and MylesBorins committed Apr 19, 2017
1 parent cd98f5d commit be537d0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions doc/api/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,18 @@ LOAD_AS_FILE(X)
3. If X.json is a file, parse X.json to a JavaScript Object. STOP
4. If X.node is a file, load X.node as binary addon. STOP
LOAD_INDEX(X)
1. If X/index.js is a file, load X/index.js as JavaScript text. STOP
2. If X/index.json is a file, parse X/index.json to a JavaScript object. STOP
3. If X/index.node is a file, load X/index.node as binary addon. STOP
LOAD_AS_DIRECTORY(X)
1. If X/package.json is a file,
a. Parse X/package.json, and look for "main" field.
b. let M = X + (json main field)
c. LOAD_AS_FILE(M)
2. If X/index.js is a file, load X/index.js as JavaScript text. STOP
3. If X/index.json is a file, parse X/index.json to a JavaScript object. STOP
4. If X/index.node is a file, load X/index.node as binary addon. STOP
d. LOAD_INDEX(M)
2. LOAD_INDEX(X)
LOAD_NODE_MODULES(X, START)
1. let DIRS=NODE_MODULES_PATHS(START)
Expand Down

0 comments on commit be537d0

Please sign in to comment.