doc: package main can be directory with an index
This behavior dates back to 2011 but was not documented. PR-URL: https://github.com/nodejs/node/pull/11581 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: James Snell <jasnell@gmail.com>
This commit is contained in:
parent
c6cbbf9263
commit
608ea94272
@ -161,14 +161,18 @@ LOAD_AS_FILE(X)
|
|||||||
3. If X.json is a file, parse X.json to a JavaScript Object. STOP
|
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
|
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)
|
LOAD_AS_DIRECTORY(X)
|
||||||
1. If X/package.json is a file,
|
1. If X/package.json is a file,
|
||||||
a. Parse X/package.json, and look for "main" field.
|
a. Parse X/package.json, and look for "main" field.
|
||||||
b. let M = X + (json main field)
|
b. let M = X + (json main field)
|
||||||
c. LOAD_AS_FILE(M)
|
c. LOAD_AS_FILE(M)
|
||||||
2. If X/index.js is a file, load X/index.js as JavaScript text. STOP
|
d. LOAD_INDEX(M)
|
||||||
3. If X/index.json is a file, parse X/index.json to a JavaScript object. STOP
|
2. LOAD_INDEX(X)
|
||||||
4. If X/index.node is a file, load X/index.node as binary addon. STOP
|
|
||||||
|
|
||||||
LOAD_NODE_MODULES(X, START)
|
LOAD_NODE_MODULES(X, START)
|
||||||
1. let DIRS=NODE_MODULES_PATHS(START)
|
1. let DIRS=NODE_MODULES_PATHS(START)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user