Skip to content
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

context.evalCode(..., filename, { type: "module" }) returns module exports #154

Merged
merged 16 commits into from
Feb 19, 2024

Conversation

justjake
Copy link
Owner

@justjake justjake commented Feb 10, 2024

Fixes #148

  • Evaluating code with { mode: 'module' } now returns the module exports or a promise of the module exports.
  • introduce context.getPromiseState(handle) for synchronous access to promise contents. This can be used with context.unwrapResult to expect a promise to be resolved. Example usage: context.runtime.executePendingJobs(); resolved = context.unwrapResult(context.getPromiseState(promiseHandle))

@justjake justjake force-pushed the jake--getModuleExports branch from 8040da4 to eac3ac8 Compare February 19, 2024 00:11
@justjake justjake marked this pull request as ready for review February 19, 2024 18:41
@justjake justjake changed the title Support getting ESModule exports context.evalCode(..., filename, { type: "module" }) returns module exports Feb 19, 2024
@justjake justjake enabled auto-merge (squash) February 19, 2024 19:45
@justjake justjake merged commit 0b334ae into main Feb 19, 2024
1 check passed
@justjake justjake deleted the jake--getModuleExports branch February 19, 2024 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Expose GetModuleExport APIs
1 participant