-
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
refactor src/node.js into internal files #5103
Conversation
scheduleMicrotasks = sMt; | ||
NativeModule = NM; | ||
return exports | ||
} |
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.
I dunno how to get around some of this dependancy injection for now... Maybe add these to process and then remove them after boot?
2e216f1
to
0d88fc8
Compare
(fixed linting) |
|
||
exports.setup = setupNextTick; | ||
|
||
function setupNextTick(NativeModule) { |
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.
Why do you need NativeModule
? I think you can just use require
at this point
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.
@vkurchatkin We don't want this in the regular module cache.
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.
what do you mean? require
and NativeModule.require
are literally the same thing in built-in modules: https://github.com/nodejs/node/blob/master/src/node.js#L1004
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.
Ooooh good catch
Very interesting! This should go a long way towards clearing things up. It might be worthwhile to CC folks from NW.js and electron to make sure this is compatible with their projects, but if so I'm generally in favor of this. |
cc @zcbenz / @rogerwang ^^^ |
scheduleMicrotasks = sMt; | ||
NativeModule = NM; | ||
return exports; | ||
}; |
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.
(Looks like my previous comment got squashed)
I dunno how to get around some of this dependancy injection for now... Maybe add these to process and then remove them after boot?
e5888b1
to
65b9481
Compare
Thanks for CCing @chrisdickinson @Fishrock123 . It's fine for NW.js. |
65b9481
to
bf99893
Compare
Rebased on I have work that will be sitting ontop of this since it's easier to tell what needs modification, and as such I'd sorta like to get this merged. cc @trevnorris |
function setupNextTick() { | ||
const promises = require('internal/process/promises'); | ||
const emitPendingUnhandledRejections = promises.setup(scheduleMicrotasks); | ||
var nextTickQueue = []; |
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.
could be made const.
EDIT: nope. sorry.
going to add the ctc meeting tag. only b/c it relocates so much code, would like a decisive ok from everyone. |
sigh I should have added it today. Already CC'd everyone though with almost no response? |
Sorry, saw the ctc mention just hadn't had any time to review. Will look
|
And before anyone asks, yes this is totally just moving some code around, that's the point haha. :P |
At a high level this LGTM if CI is green. |
Could you point to where you think it could be Do addons need the file location? I've already heard from two embedders (nw.js and N|Solid) that this doesn't cause significant issues either. |
As I said, I'm just being conservative. It shouldn't break anything but it's worth being cautious. One impact this will have is changing the stack trace on certain errors, e.g:
While that shouldn't have an impact, I think it's at least worth being cautious. I've kicked off a CITGM run here: https://ci.nodejs.org/job/thealphanerd-smoker/66/ |
This is not so terribly uncommon and I definitely do not think we guarantee stacktraces. That's like guaranteeing See: https://github.com/nodejs/node/commits/master/test/message -- 8830797 modifies the same traces but is scheduled for LTS. |
Grrr... CITGM smoke testing is currently broken due to the npm/graceful-fs issue on master. |
Also see @rvagg's comment here: #5092 (comment) ... so I'm not alone in my caution on this. |
The one failure appears to be unrelated. Land it! |
PR-URL: nodejs#5103 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: nodejs#5103 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: nodejs#5103 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: James M Snell <[email protected]>
2edd8f1
to
ec6af31
Compare
landed, thanks everyone! |
@Fishrock123 ... woot! |
Clarify comments re invoking bootstrap_node.js. Fix filename to bootstrap_node.js per nodejs#5103. Fix tests `node.js` -> `bootstrap_node.js` Fix comment on why we check the loop again before exiting. `context-inl.h` -> `env-inl.h`
PR-URL: nodejs#5103 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: James M Snell <[email protected]> Conflicts: node.gyp src/node.js
PR-URL: nodejs#5103 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: nodejs#5103 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #5103 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #5103 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #5103 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #5103 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #5103 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #5103 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: James M Snell <[email protected]>
Ok so, this is definitely a bit nuts. Just a bit. Well, the second commit that is.
I figure what this costs us in the short term will be made up for by ease of contribution in the future.
node.js
src/node.js
tolib/internal/node.js
This PR is mostly about the first set of changes. Although I'd also like to do the second.
src/node.js
is very big and it's fairly hard to figure out what you all might need to change for any specific patch.CI: https://ci.nodejs.org/job/node-test-pull-request/1562/
R=@nodejs/ctc