Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Cleanup of 'NativeModule.require' calls in lib/module.js #2009

Closed
ghost opened this issue Nov 4, 2011 · 7 comments
Closed

Cleanup of 'NativeModule.require' calls in lib/module.js #2009

ghost opened this issue Nov 4, 2011 · 7 comments

Comments

@ghost
Copy link

ghost commented Nov 4, 2011

All calls to NativeModule.require called with string literal argument ('fs' and 'path') are unnecessarily explicitly referring to NativeModule and can and should be changed to plain require call. This matches with the way how any other native module perform these requires (module.js is in no way special in this).
Only call which should retain the explicit NativeModule.require is the one inside Module._load which calls with a variable argument id, not with a literal argument.

@ry
Copy link

ry commented Nov 4, 2011

please provide a patch

@ghost
Copy link
Author

ghost commented Nov 4, 2011

https://gist.github.com/1340039
tested, works (only a couple of tests fail, as is typical in freebsd)

@ghost
Copy link
Author

ghost commented Dec 26, 2011

Hello. Was the patch somehow inadequate or my answer only slipped somehow? @ry

@ghost
Copy link
Author

ghost commented Apr 5, 2012

Hello! I sent the patch as you requested. Is any other problem with this issue?

@bnoordhuis
Copy link
Member

@Herby: Can you submit it as a pull request? Thanks.

@ghost
Copy link
Author

ghost commented Oct 23, 2014

Is it possible to reopen this? I can then issue a PR that fixes it.

@ghost
Copy link
Author

ghost commented Oct 23, 2014

Ping @isaacs.

trevnorris pushed a commit that referenced this issue Feb 12, 2015
The NativeModule system passes NativeModule.require transparently and so
is unnecessary to call explicitly.

The only one which should have the prefix is the in line 295, where
actually implements a big fs-based module system and actually requires a
native module. That is left unchanged.

PR-URL: #9201
Ref: #2009
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
cjihrig pushed a commit to nodejs/node that referenced this issue Feb 13, 2015
The NativeModule system passes NativeModule.require transparently and so
is unnecessary to call explicitly.

The only one which should have the prefix is the in line 295, where
actually implements a big fs-based module system and actually requires a
native module. That is left unchanged.

PR-URL: nodejs/node-v0.x-archive#9201
Ref: nodejs/node-v0.x-archive#2009
Reviewed-by: Trevor Norris <trev.norris@gmail.com>

Conflicts:
	lib/module.js
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants