maestro icon indicating copy to clipboard operation
maestro copied to clipboard

#1637 [Graaljs] allow import

Open tokou opened this issue 11 months ago • 3 comments

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 avatar Jan 24 '25 09:01 tokou

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

tokou avatar Jan 24 '25 16:01 tokou

Does this replace #2022?

Fishbowler avatar Feb 05 '25 10:02 Fishbowler

@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)

tokou avatar Feb 05 '25 12:02 tokou