@@ -38,6 +38,30 @@ the [event loop][] and other operation system abstractions to Node.js.
38
38
39
39
There is a [ reference documentation for the libuv API] [ ] .
40
40
41
+ ## File structure
42
+
43
+ The Node.js C++ files follow this structure:
44
+
45
+ The ` .h ` header files contain declarations, and sometimes definitions that don’t
46
+ require including other headers (e.g. getters, setters, etc.). They should only
47
+ include other ` .h ` header files and nothing else.
48
+
49
+ The ` -inl.h ` header files contain definitions of inline functions from the
50
+ corresponding ` .h ` header file (e.g. functions marked ` inline ` in the
51
+ declaration or ` template ` functions). They always include the corresponding
52
+ ` .h ` header file, and can include other ` .h ` and ` -inl.h ` header files as
53
+ needed. It is not mandatory to split out the definitions from the ` .h ` file
54
+ into an ` -inl.h ` file, but it becomes necessary when there are multiple
55
+ definitions and contents of other ` -inl.h ` files start being used. Therefore, it
56
+ is recommended to split a ` -inl.h ` file when inline functions become longer than
57
+ a few lines to keep the corresponding ` .h ` file readable and clean. All visible
58
+ definitions from the ` -inl.h ` file should be declared in the corresponding ` .h `
59
+ header file.
60
+
61
+ The ` .cc ` files contain definitions of non-inline functions from the
62
+ corresponding ` .h ` header file. They always include the corresponding ` .h `
63
+ header file, and can include other ` .h ` and ` -inl.h ` header files as needed.
64
+
41
65
## Helpful concepts
42
66
43
67
A number of concepts are involved in putting together Node.js on top of V8 and
0 commit comments