You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I was going through the source code, I found this in node.cc,
// "Linked" modules are included as part of the node project.
// Like builtins they are registered *before* node::Init runs.
mp->nm_flags = NM_F_LINKED;
Does anybody know what "Linked" modules are? @bnoordhuis maybe?
parser.add_option("--link-module",
action="append",
dest="linked_module",
help="Path to a JS file to be bundled in the binary as a builtin."
"This module will be referenced by path without extension."
"e.g. /root/x/y.js will be referenced via require('root/x/y')."
"Can be used multiple times")
@mscdex That’s something different. The linked modules the C++ source is talking about would be native modules that are compiled into (or LD_PRELOLADed into?) the node executable itself, not JS code.
The configure switch is for baking third-party JS source code into the binary, NM_F_LINKED is for bundling add-ons into the binary. Unfortunate name clash, yes.
Hi I'd like to work on this. This is my first time working on open source and I was wondering which part of the documentation this should go into, and generally the relevant parts of the source I should be looking at.
Activity
mscdex commentedon Apr 19, 2017
It's probably this in the build script:
addaleax commentedon Apr 19, 2017
@mscdex That’s something different. The linked modules the C++ source is talking about would be native modules that are compiled into (or
LD_PRELOLADed into?) the node executable itself, not JS code.mscdex commentedon Apr 19, 2017
Well, that's not confusing ;-)
bnoordhuis commentedon Apr 19, 2017
The configure switch is for baking third-party JS source code into the binary, NM_F_LINKED is for bundling add-ons into the binary. Unfortunate name clash, yes.
addaleax commentedon Apr 19, 2017
@bnoordhuis Is there anybody who uses that feature? Would documenting it be a good idea?
bnoordhuis commentedon Apr 19, 2017
I assume so, at least at the time, otherwise why bother making a pull request? Both features where requested and implemented by non-collaborators.
Documenting it: no reason not to, I suppose.
snggeng commentedon Oct 29, 2017
Hi I'd like to work on this. This is my first time working on open source and I was wondering which part of the documentation this should go into, and generally the relevant parts of the source I should be looking at.
gibfahn commentedon Oct 29, 2017
I guess it should go somewhere in https://nodejs.org/api/modules.html (source here)?
As mentioned above, for the Native module you probably want to start here:
node/src/node.cc
Lines 2595 to 2599 in 4359a93
For the js module you probably want to start here:
node/configure
Lines 152 to 158 in 201ecef
@bnoordhuis are the two features functionally identical, except for the fact that one is for native addons and one is for js addons?
snggeng commentedon Oct 30, 2017
Awesome, thanks for the tips @gibfahn I'll look into it.
6 remaining items
doc: add builtin module in building.md
doc: add builtin module in building.md
doc: add builtin module in building.md
doc: add builtin module in building.md
joyeecheung commentedon Mar 4, 2018
Reopen since the OP is asking about native modules and they are still not documented. Should be fixed by #19112
apapirovski commentedon Apr 14, 2018
Sounds like this was addressed by @joyeecheung above. Closing.
doc: add builtin module in building.md
doc: add builtin module in building.md