Uh oh!
There was an error while loading. Please reload this page.
lib: expose primordials object - #36872
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
devsnek
commented
Jan 10, 2021
Can you move this to |
Uh oh!
There was an error while loading. Please reload this page.
aduh95
commented
Jan 10, 2021
@devsnek Note that the current implementation requires to use two flags: |
targos
commented
Jan 11, 2021
I don't really like this solution for the referenced issue. The fact that we use built-in functions like |
bmeck
commented
Jan 11, 2021
A lot of the purpose in making the slow migration to |
bmeck
left a comment
There was a problem hiding this comment.
primordials was introduced exactly to prevent mutating the internals of node core and to allow robustness in the core. I don't think this approach to solve the referenced issue is the way we should approach it.
bmeck
commented
Jan 11, 2021
It looks like |
addaleax
commented
Jan 11, 2021
@bmeck is right – this PR would basically make having primordials pointless (which, yay, I think removing them would be a great idea, but I don’t think that’s happening). However, I’m commenting because I saw the issue title and thought “hey, maybe this is just exposing the deep-frozen object as-is”, which I think I’d like because it would help with Node.js core development (it answers questions like “What is in the primordials object” and “What happens when I run this piece of Node.js core source code”) and wouldn’t really hurt anyone. |
ExE-Boss
commented
Jan 13, 2021
Actually, this won’t work the way it’s intended due to the way the This is because all code that uses the |
aduh95
commented
Jan 14, 2021
Thank you everyone for the reviews, I've rolled back the "altering primordials" part, this PR is now only exposing the Note to whoever lands this: the commit message will need to be amended before landing to remove the reference to sinonjs/fake-timers#344. |
Uh oh!
There was an error while loading. Please reload this page.
bmeck
commented
Jan 14, 2021
I do think we can address the timer issue somewhere else; even if we didn't use primordials, early destructuring would have broken that as well like @ExE-Boss points out. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot
commented
Jan 14, 2021
nodejs-github-bot
commented
Jan 14, 2021
Uh oh!
There was an error while loading. Please reload this page.
a18f3ca to
ba79489CompareBased on feedback shared by several persons, I've updated this PR to remove the The intended use of this feature is to use $ node lib/fs.js…/node/lib/fs.js:51} = primordials; ^ReferenceError: primordials is not defined at Object.<anonymous> (…/node/lib/fs.js:51:5) at Module._compile (node:internal/modules/cjs/loader:1108:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10) at Module.load (node:internal/modules/cjs/loader:973:32) at Function.Module._load (node:internal/modules/cjs/loader:813:14) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12) at node:internal/main/run_main_module:17:47
$ node --expose-internals -r internal/test/binding lib/fs.js(node:5299) internal/test/binding: These APIs are for internal testing only. Do not use them.(Use `node --trace-warnings ...` to show where the warning was created) |
aduh95
commented
Jan 15, 2021
On a side note, we might want to rename |
ba79489 to
b74793fComparenodejs-github-bot
commented
Jan 15, 2021
mscdex
commented
Jan 16, 2021
Where do we use the |
aduh95
commented
Jan 16, 2021
Not sure what you mean,
The idea is to give the ability for a |
nodejs-github-bot
commented
Jan 16, 2021
nodejs-github-bot
commented
Jan 16, 2021
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot
commented
Jan 17, 2021
Expose the internal `primordials` object to help with Node.js core development. ```console $ node --expose-internals -r internal/test/binding lib/fs.js (node:5299) internal/test/binding: These APIs are for internal testing only. Do not use them. (Use `node --trace-warnings ...` to show where the warning was created) ``` PR-URL: nodejs#36872 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2f67dae to
983e922Compareaduh95
commented
Jan 18, 2021
Landed in 983e922 |
Expose the internal `primordials` object to help with Node.js core development. ```console $ node --expose-internals -r internal/test/binding lib/fs.js (node:5299) internal/test/binding: These APIs are for internal testing only. Do not use them. (Use `node --trace-warnings ...` to show where the warning was created) ``` PR-URL: #36872 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Expose the internal `primordials` object to help with Node.js core development. ```console $ node --expose-internals -r internal/test/binding lib/fs.js (node:5299) internal/test/binding: These APIs are for internal testing only. Do not use them. (Use `node --trace-warnings ...` to show where the warning was created) ``` PR-URL: #36872 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Expose the internal `primordials` object to help with Node.js core development. ```console $ node --expose-internals -r internal/test/binding lib/fs.js (node:5299) internal/test/binding: These APIs are for internal testing only. Do not use them. (Use `node --trace-warnings ...` to show where the warning was created) ``` PR-URL: #36872 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Expose the internal `primordials` object to help with Node.js core development. ```console $ node --expose-internals -r internal/test/binding lib/fs.js (node:5299) internal/test/binding: These APIs are for internal testing only. Do not use them. (Use `node --trace-warnings ...` to show where the warning was created) ``` PR-URL: #36872 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Expose the internal `primordials` object to help with Node.js core development. ```console $ node --expose-internals -r internal/test/binding lib/fs.js (node:5299) internal/test/binding: These APIs are for internal testing only. Do not use them. (Use `node --trace-warnings ...` to show where the warning was created) ``` PR-URL: #36872 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Provide a way to expose the
primordialson the global object. This is useful to run Node.js internals modules to help with Node.js core development.