run method

dynamic run(
  1. String filepath
)
override

Run a JS script which would be find from fileSystems, and the script would be treat as a module.

The result is the default module exports.

Implementation

run(String filepath) {
  String? path = fileSystems.findPath("/", filepath);
  if (path != null) {
    String? code = fileSystems.loadCode(path);
    if (code != null) {
      _arguments[0].setString(code, this);
      _arguments[1].setString(path, this);
      return _action(JS_ACTION_RUN, 2, block: (results, length) => results[0].get(this));
    }
  }
  throw Exception("File not found. $filepath");
}