-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
Extend Node-API to libnode
#43542
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
Open
mmomtchev
wants to merge
16
commits into
nodejs:main
Choose a base branch
from
mmomtchev:napi-libnode
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Extend Node-API to libnode
#43542
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
c55bf50
node-api: libnode embedding
mmomtchev 414c501
new linter rules
mmomtchev 1fb6c8e
remove unintented change
mmomtchev bd223ae
restore require/import in main_script
mmomtchev 890bfcb
rectify napi_destroy_platform
mmomtchev 23ddf96
catch up with main
mmomtchev 213aea4
the linter was not happy with this indentation
mmomtchev fc34203
the underlying libuv issue has been resolved
mmomtchev a4b2b90
remove the deps/uv patch
mmomtchev 5220a89
remove the custom main script arg and use execPath
mmomtchev a0b3b25
Update lib/internal/bootstrap/switches/is_embedded_env.js
mmomtchev ccd228b
adapt to the new embedding API
mmomtchev 7a566b7
move code to node_api_embedding.cc
vmoroz b7adf10
comment typo fix
vmoroz ebe1c55
delete compiled binary file from test
vmoroz fc3f0ad
Remove ShutdownProcess from napi_destroy_environment
vmoroz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| 'use strict'; | ||
|
|
||
| // This is the bootstrapping code used when creating a new environment | ||
| // through Node-API | ||
|
|
||
| // Set up globalThis.require and globalThis.import so that they can | ||
| // be easily accessed from C/C++ | ||
|
|
||
| /* global primordials */ | ||
|
|
||
| const { globalThis } = primordials; | ||
| const cjsLoader = require('internal/modules/cjs/loader'); | ||
| const esmLoader = require('internal/process/esm_loader').esmLoader; | ||
|
|
||
| globalThis.module = new cjsLoader.Module(); | ||
| globalThis.require = require('module').createRequire(process.execPath); | ||
|
|
||
| const parent_path = require('url').pathToFileURL(process.execPath); | ||
| globalThis.import = (mod) => esmLoader.import(mod, parent_path, { __proto__: null }); | ||
| globalThis.import.meta = { url: parent_path }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nit: Could we please change
napi_*tonode_api_*for all newly introduced elements across the entire PR?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.
@gabrielschulhof this is the name of the unit test, most unit tests / benchmarks that test Node-API use the
napiabbreviation