process: add process.entrypoint - #64800
Conversation
Signed-off-by: avivkeller <me@aviv.sh>
|
Review requested:
|
|
@nodejs/process |
|
in worker threadsx this is set to the entrypoint of the worker? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #64800 +/- ##
==========================================
+ Coverage 90.16% 90.27% +0.10%
==========================================
Files 744 762 +18
Lines 242518 247563 +5045
Branches 45705 46699 +994
==========================================
+ Hits 218670 223483 +4813
- Misses 15357 15502 +145
- Partials 8491 8578 +87
🚀 New features to boost your workflow:
|
This is set to the entrypoint of the process that created the worker, not the worker itself. So if |
this is behaviorally different from the old "require.main". Can we have the same? |
|
IMO it makes more sense to show the entrypoint of the process, not the worker |
|
I'm saying this is not identical to require.main, or what import.main is defined. The issue linked refers to require.main. |
|
Okay, I've changed |
|
Opened #64903 with the thread-scoped counterpart ( |
|
Awesome! Aside from that, is this good to go? |
Add `module.entrypoint`, a property exposing the resolved URL of the entry point of the current thread. Unlike `require.main`, it works regardless of whether the entry point is a CommonJS or an ECMAScript module, and inside worker threads it reflects the entry point of the worker itself, matching the semantics of `require.main` and `import.meta.main`. Refs: nodejs#51840 Refs: nodejs#64800 Signed-off-by: Matteo Collina <hello@matteocollina.com>
|
bump @nodejs/process |
Ref: #51840
Adds a
process.entrypointnon-configurable property to theprocessobject during bootstrap. This property reflects the executable's main entrypoint (i.e. not--requireor--import-ed files, the main file).Additionally, this entrypoint is passed to workers, so it reflects the entrypoint of the process that created the worker, not the entrypoint of the worker itself.