-
Notifications
You must be signed in to change notification settings - Fork 5.1k
node:vm compatibility #19703
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
Merged
Merged
node:vm compatibility #19703
Changes from all commits
Commits
Show all changes
85 commits
Select commit
Hold shift + click to select a range
2c9f4b6
Implement createCachedData
heimskr b0b7b85
Produce a proper Buffer
heimskr 6f41459
Fix wrong SourceCodeType
heimskr 3263005
Add support for produceCachedData and cachedDataProduced
heimskr 737b04e
Some progress on supporting the cachedData option in node:vm
heimskr 9fa3989
Add cachedData support in node:vm (test-vm-cached-data.js)
heimskr 0e35e73
Add test-vm-createcacheddata.js
heimskr 0708bae
Add test for createCachedData
heimskr 618c7c3
Merge branch 'main' into kai/vm-compat-2
heimskr 20769c4
Update WebKit version
heimskr bae2771
Merge branch 'main' into kai/vm-compat-2
heimskr fed7962
Address feedback
heimskr e58a36f
More cachedData tests
heimskr cb482b3
You can never have too many tests
heimskr 8009728
Address feedback
heimskr fe6c6ef
Address feedback again
heimskr 6b31f98
Check for parser errors too
heimskr 0bc2397
Add some RETURN_IF_EXCEPTIONs
heimskr cbd5e1b
Add some more RETURN_IF_EXCEPTIONs
heimskr 6635571
Adjust lifetimes and fix incorrect use of ParserError::isValid()
heimskr 32a094d
Initial work on vm.Module
heimskr 10d14a3
Add a null check
heimskr 2c1888d
Merge branch 'kai/vm-compat-2' into kai/vm-compat-modules
heimskr bc1654b
Some more work on vm.Module
heimskr 62dfa74
yay, it links
heimskr a8cae28
A couple slight changes
heimskr a58c2a9
getModuleRequests
heimskr c787145
Implement validateInternalField
heimskr a0384f6
Custom inspection for vm.Module
heimskr c59f7ad
Reorganize node:vm native code
heimskr 94db5f9
WIP slop
heimskr 9ee4d46
Merge branch 'main' into kai/vm-compat-modules
heimskr 4359ef2
More work on vm.Module linking
heimskr d3b6ec6
Merge kai/vm-compat
heimskr 550eea3
Progress on SourceTextModule evaluation
heimskr a8854f8
Fix contextual store detection
heimskr 68866ab
Get breakOnSigint working for SourceTextModule
heimskr 1b07336
Support timeouts in SourceTextModule evaluation
heimskr dd0d08e
Add test-vm-timeout-escape-promise-module.js
heimskr a7e3f31
Safety nitpicks in ZigGlobalObject.cpp that probably make no differen…
heimskr 72d0151
Pass declared/lexical module variables
heimskr d12d0b9
Remove some garbage
heimskr e2d5bfa
Recursive module evaluation support (sync-only for now) + namespace o…
heimskr dbf3897
test-vm-module-link.js
heimskr d6c1de3
Fix vm.runInContext options
heimskr b72cf78
Match Node's weird error message
heimskr be5e817
vm.compileFunction: handle parser errors better
heimskr 6fb80d2
Support produceCachedData option in vm.compileFunction
heimskr 4e5cd8f
Don't support produceCachedData option in vm.compileFunction (oops)
heimskr a0ba651
it's a miracle
heimskr 305fccd
Support options.breakOnSigint in vm.Script.runInContext
heimskr 09648f3
Support options.breakOnSigint in vm.Script.runInThisContext
heimskr e68ada0
test-vm-sigint.js
heimskr 761b5aa
oops
heimskr f2c1d22
test-vm-module-cached-data.js
heimskr 50a9728
vm.Module.error
heimskr aec3c9b
test-vm-module-errors.js
heimskr afe9816
Support timeouts better, fix runInNewContext, add test-vm-timeout.js
heimskr bbf99ad
Add test-vm-timeout-escape-promise.js
heimskr b0ba847
static –> runtime assert in SigintWatcher
heimskr 6c67a50
Change WebKit version
heimskr ea39f03
Merge branch 'main' into kai/vm-compat-modules
heimskr 1c6a18d
Update WebKit version
heimskr a71b080
Update WebKit version again
heimskr 5dcf255
Merge branch 'main' into kai/vm-compat-modules
heimskr 02827d3
Merge branch 'main' into kai/vm-compat-modules
heimskr 659b198
`bun scripts/glob-sources.mjs`
heimskr 4ba1336
Fix some includes, probably
heimskr 7ee9a03
Merge branch 'kai/vm-compat-modules' of github.com:oven-sh/bun into k…
heimskr cb47360
Can't initialize std::atomic_flag with a boolean
heimskr dc509c7
pls don't tear out my new .cpps this time
heimskr fc44f65
`bun scripts/glob-sources.mjs`
heimskr e27507c
Fix missing root.h include
heimskr c463154
"fix" SigintWatcher
heimskr 6c08fd8
SigintWatcher on Windows, perchance?
heimskr 59541fd
Fix options.displayErrors validation (allow it to be present but unde…
heimskr e34fd75
Remove a static initializer
heimskr e930e31
Or I could just do this
heimskr be56093
breakOnSigint too I suppose
heimskr ed8f576
Remove another static initializer
heimskr c2ba7ef
Don't allow null context values
heimskr 4a08366
Don't allow null context values in createContext
heimskr 174a0fc
Merge branch 'main' into kai/vm-compat-modules
heimskr dbdc63e
Use WTF::Thread, WTF::Lock and WTF::Locker instead of std::thread, st…
heimskr 76a3ed5
Remove some unused includes
heimskr 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
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
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2224,6 +2224,26 @@ JSC_DEFINE_HOST_FUNCTION(Bun::jsFunctionMakeErrorWithCode, (JSC::JSGlobalObject | |||||
| return JSC::JSValue::encode(createError(globalObject, ErrorCode::ERR_CHILD_PROCESS_STDIO_MAXBUFFER, message)); | ||||||
| } | ||||||
|
|
||||||
| case Bun::ErrorCode::ERR_VM_MODULE_STATUS: { | ||||||
| auto arg0 = callFrame->argument(1); | ||||||
| auto str0 = arg0.toWTFString(globalObject); | ||||||
| RETURN_IF_EXCEPTION(scope, {}); | ||||||
| auto message = makeString("Module status "_s, str0); | ||||||
| return JSC::JSValue::encode(createError(globalObject, ErrorCode::ERR_VM_MODULE_STATUS, message)); | ||||||
| } | ||||||
|
|
||||||
| case Bun::ErrorCode::ERR_VM_MODULE_LINK_FAILURE: { | ||||||
| auto arg0 = callFrame->argument(1); | ||||||
| auto message = arg0.toWTFString(globalObject); | ||||||
| RETURN_IF_EXCEPTION(scope, {}); | ||||||
| auto cause = callFrame->argument(2); | ||||||
| JSObject* error = createError(globalObject, ErrorCode::ERR_VM_MODULE_LINK_FAILURE, message); | ||||||
| RETURN_IF_EXCEPTION(scope, {}); | ||||||
| error->putDirect(vm, Identifier::fromString(vm, "cause"_s), cause); | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| RETURN_IF_EXCEPTION(scope, {}); | ||||||
| return JSC::JSValue::encode(error); | ||||||
| } | ||||||
|
|
||||||
| case ErrorCode::ERR_IPC_DISCONNECTED: | ||||||
| return JSC::JSValue::encode(createError(globalObject, ErrorCode::ERR_IPC_DISCONNECTED, "IPC channel is already disconnected"_s)); | ||||||
| case ErrorCode::ERR_SERVER_NOT_RUNNING: | ||||||
|
|
@@ -2332,6 +2352,14 @@ JSC_DEFINE_HOST_FUNCTION(Bun::jsFunctionMakeErrorWithCode, (JSC::JSGlobalObject | |||||
| return JSC::JSValue::encode(createError(globalObject, ErrorCode::ERR_HTTP_SOCKET_ASSIGNED, "Socket already assigned"_s)); | ||||||
| case ErrorCode::ERR_STREAM_RELEASE_LOCK: | ||||||
| return JSC::JSValue::encode(createError(globalObject, ErrorCode::ERR_STREAM_RELEASE_LOCK, "Stream reader cancelled via releaseLock()"_s)); | ||||||
| case ErrorCode::ERR_VM_MODULE_ALREADY_LINKED: | ||||||
| return JSC::JSValue::encode(createError(globalObject, ErrorCode::ERR_VM_MODULE_ALREADY_LINKED, "Module has already been linked"_s)); | ||||||
| case ErrorCode::ERR_VM_MODULE_CANNOT_CREATE_CACHED_DATA: | ||||||
| return JSC::JSValue::encode(createError(globalObject, ErrorCode::ERR_VM_MODULE_CANNOT_CREATE_CACHED_DATA, "Cached data cannot be created for a module which has been evaluated"_s)); | ||||||
| case ErrorCode::ERR_VM_MODULE_NOT_MODULE: | ||||||
| return JSC::JSValue::encode(createError(globalObject, ErrorCode::ERR_VM_MODULE_NOT_MODULE, "Provided module is not an instance of Module"_s)); | ||||||
| case ErrorCode::ERR_VM_MODULE_DIFFERENT_CONTEXT: | ||||||
| return JSC::JSValue::encode(createError(globalObject, ErrorCode::ERR_VM_MODULE_DIFFERENT_CONTEXT, "Linked modules must use the same context"_s)); | ||||||
|
|
||||||
| default: { | ||||||
| break; | ||||||
|
|
||||||
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
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.
Let's undo this diff