-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src: fix module search path for preload modules #1812
Conversation
assert.ok(module.parent); | ||
var expectedPaths = require('module')._nodeModulePaths(process.cwd()); | ||
assert.ok(module.parent.paths.length === expectedPaths.length && | ||
module.parent.paths.every(function(e,i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space after the ,
. I think module
should line up with module
on the previous line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed by replacing with assert.deepEquals.
When the preload module is not a abs/relative path, we should use the standard search mechanism of looking into the node_modules folders outwards. The current working directory is deemed to be the 'requiring module', i.e. parent. The search path starts from cwd outwards. Fixes: nodejs#1803
FWIW, I pulled this down locally and was able to |
Thx for tackling this @ofrobots, LGTM. |
When the preload module is not a abs/relative path, we should use the standard search mechanism of looking into the node_modules folders outwards. The current working directory is deemed to be the 'requiring module', i.e. parent. The search path starts from cwd outwards. Fixes: #1803 PR-URL: #1812 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Thanks, landed in 5759722 :) |
marking this as semver-minor, let me know if you disagree |
Notable Changes: * node: Speed-up require() by replacing usage of fs.statSync() and fs.readFileSync() with internal variants that are faster for this use-case and do not create as many objects for the garbage collector to clean up. The primary two benefits are: significant increase in application start-up time on typical applications and better start-up time for the debugger by eliminating almost all of the thousands of exception events. (Ben Noordhuis) nodejs#1801. * node: Resolution of pre-load modules (-r or --require) now follows the standard require() rules rather than just resolving paths, so you can now pre-load modules in node_modules. (Ali Ijaz Sheikh) nodejs#1812. * npm: Upgraded npm to v2.11.0. New hooks for preversion, version, and postversion lifecycle events, some SPDX-related license changes and license file inclusions. See the release notes for full details.
PR-URL: nodejs#1808 Notable Changes: * node: Speed-up require() by replacing usage of fs.statSync() and fs.readFileSync() with internal variants that are faster for this use-case and do not create as many objects for the garbage collector to clean up. The primary two benefits are: significant increase in application start-up time on typical applications and better start-up time for the debugger by eliminating almost all of the thousands of exception events. (Ben Noordhuis) nodejs#1801. * node: Resolution of pre-load modules (-r or --require) now follows the standard require() rules rather than just resolving paths, so you can now pre-load modules in node_modules. (Ali Ijaz Sheikh) nodejs#1812. * npm: Upgraded npm to v2.11.0. New hooks for preversion, version, and postversion lifecycle events, some SPDX-related license changes and license file inclusions. See the release notes for full details.
When the preload module is not a abs/relative path, we should use the standard search mechanism of looking into the node_modules folders outwards. The current working directory is deemed to be the 'requiring module', i.e. parent. The search path starts from cwd outwards. Fixes: nodejs/node#1803 PR-URL: nodejs/node#1812 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
When the preload module is not a abs/relative path, we should use
the standard search mechanism of looking into the node_modules folders
outwards. The current working directory is deemed to be the 'requiring
module', i.e. parent. The search path starts from cwd outwards.
Fixes: #1803