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

#1637 [Graaljs] allow import #2271

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tokou
Copy link
Contributor

@tokou tokou commented Jan 24, 2025

Proposed changes

This PR adds the option to use import directive from within JS scripts.
This can be helpful to better organize large scripts and avoid duplication between flows.
This is done through either the env var MAESTRO_GRAALJS_ALLOW_IO or the config graalJsAllowIo.

Specifications

  • Scripts that use imports (wether importing or exporting) should be defined with the mjs extension
  • The importing path is relative to the execution path of Maestro
  • See GraalJs documentation about Modules

Testing

Two integration tests have been added, in order to test cases where it's allowed and not allowed.

Issues fixed

#1637

@tokou
Copy link
Contributor Author

tokou commented Jan 24, 2025

@Fishbowler I don't understand why the E2E test fails. Would appreciate any help.

@Fishbowler
Copy link
Contributor

Does this replace #2022?

@tokou
Copy link
Contributor Author

tokou commented Feb 5, 2025

@Fishbowler No, they are 2 different features of the underlying JS engine.
One lets you call platform (i.e. JVM) classes from JS and interop with them
The other lets you allow access to files and thus use import and modules (which are enabled as part of the ECMAScript but impossible to use due to io restrictions in GraalJS)

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.

2 participants