Hi,
looking at the node documentation i can't quite figure out how the resolve
works
i have index.js requiring a domhandler via
DomHandler = require("domhandler");
full path to index is
/node_modules/htmlparser2/lib/index.js
thie domhandler directory is found in
/node_modules/htmlparser2/node_modules/domhandler, it contains
a package.json pointing to the index.js file in the same directory.
If I read the documentation right, the described function node_module_path
would never give me the path to
the domhandler directory because "node_module" is not added to the
directory array - the pseudo code never
adds a part to the directory entry if its name is node_modules (see code
below or at https://nodejs.org/api/modules.html)
the code would filter all the node_modules folder from the directory pathes
and I would end up with pathes like
/node_modules/
/htmlparser2/node_modules/
/htmlparser2/lib/node_modules
is this a problem of the documentation or am I missing something?
I assume that " path split(START) " would give me an Array like
["node_modules", "htmlparser2", "lib"]
thanks for hints
bernhard
NODE_MODULES_PATHS(START)1. let PARTS = path split(START)2. let I = count of
PARTS - 13. let DIRS = []4. while I >= 0,
a. if PARTS[I] = "node_modules" CONTINUE
c. DIR = path join(PARTS[0 .. I] + "node_modules")
b. DIRS = DIRS + DIR
c. let I = I - 15. return DIRS
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/3c14be12-9936-40c9-8268-39d4a85f052a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.