Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit be537d0

Browse filesBrowse files
bmeckMylesBorins
authored andcommitted
doc: package main can be directory with an index
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>
1 parent cd98f5d commit be537d0
Copy full SHA for be537d0

File tree

Expand file treeCollapse file tree

1 file changed

+7
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-3
lines changed
Open diff view settings
Collapse file

‎doc/api/modules.md‎

Copy file name to clipboardExpand all lines: doc/api/modules.md
+7-3Lines changed: 7 additions & 3 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,18 @@ LOAD_AS_FILE(X)
161161
3. If X.json is a file, parse X.json to a JavaScript Object. STOP
162162
4. If X.node is a file, load X.node as binary addon. STOP
163163
164+
LOAD_INDEX(X)
165+
1. If X/index.js is a file, load X/index.js as JavaScript text. STOP
166+
2. If X/index.json is a file, parse X/index.json to a JavaScript object. STOP
167+
3. If X/index.node is a file, load X/index.node as binary addon. STOP
168+
164169
LOAD_AS_DIRECTORY(X)
165170
1. If X/package.json is a file,
166171
a. Parse X/package.json, and look for "main" field.
167172
b. let M = X + (json main field)
168173
c. LOAD_AS_FILE(M)
169-
2. If X/index.js is a file, load X/index.js as JavaScript text. STOP
170-
3. If X/index.json is a file, parse X/index.json to a JavaScript object. STOP
171-
4. If X/index.node is a file, load X/index.node as binary addon. STOP
174+
d. LOAD_INDEX(M)
175+
2. LOAD_INDEX(X)
172176
173177
LOAD_NODE_MODULES(X, START)
174178
1. let DIRS=NODE_MODULES_PATHS(START)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.