-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
fix(ext/node): add stubbed process.report #21373
Conversation
Run |
Pushed format fix, |
osRelease: todoUnimplemented, | ||
osVersion: todoUnimplemented, |
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 think we should return empty values here instead of throwing
javascriptStack: todoUnimplemented, | ||
javascriptHeap: todoUnimplemented, | ||
nativeStack: todoUnimplemented, | ||
resourceUsage: todoUnimplemented, | ||
uvthreadResourceUsage: todoUnimplemented, | ||
libuv: todoUnimplemented, | ||
workers: [], | ||
environmentVariables: todoUnimplemented, | ||
userLimits: todoUnimplemented, | ||
sharedObjects: todoUnimplemented, |
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.
Ditto
ext/node/lib.rs
Outdated
@@ -350,6 +350,7 @@ deno_core::extension!(deno_node, | |||
"_next_tick.ts", | |||
"_process/exiting.ts", | |||
"_process/process.ts", | |||
"_process/report.ts", |
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 think the path should be internal/process/report.ts
to align the file structure as close to Node.js lib
directory as possible. https://github.com/nodejs/node/tree/main/lib/internal/process
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 wasn't aware of it, will do!
I would like to ask for another round of reviews @bartlomieju @kt3k |
@Danielduel could you try your local Deno build with this change and check if it solves the problem from the reported issue? |
Hi @bartlomieju, I've done import { report as importReport, arch as importArch } from "node:process";
import { createRequire } from "node:module";
console.log("Imported:")
console.log(importReport, importArch);
const require = createRequire(import.meta.url);
const { report, arch } = require("node:process");
console.log("Required:");
console.log(report, arch) Imported deps are fine - report is defined, arch is an empty string. |
I have a feeling that |
Okay, I see, the deconstruction on require works as a decostruction on default export, not in the same way as import syntax. Fixed. |
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.
@Danielduel that's great to see!
Could you add some basic tests to cli/test/unit_node/process_test.ts
that checks that this function is present and asserting some of the values? Especially the ones that are currently marked as undefined
.
31bf24d
to
77b728d
Compare
4521174
to
230604f
Compare
Removed reexport since node doesn't seem to provide anything else than a getter on |
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.
LGTM!
Could you fix the lint errors like the below?:
primordials (safer versions of builtin classes/functions) are available like: const primordials = globalThis.__bootstrap.primordials;
const { Error } = primordials; |
I've updated everything that was calling for primodial... with a primodial. |
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.
Thanks for updating!
LGTM. Nice work!
Targets #21355, #21304
Issues with vite are caused by the missing node's process report object.
I've stubbed most of it for starter and replaced trivial spots with stubs.
I am not sure how to run compiled binary with built-in node polyfills, but things like
--no-remote
or declaring those deps in the import map and leading them to the deno's source doesn't work.cargo build -vv
produces build without a problemcargo test
hangs on build step and I need help with that (whole system hang, no output in journalctl)tools/format.js
andtools/lint.js
tell me thattest_util/std/path/mod.ts
can't be found.