docs: public Scriptable requireMain(Context cx, String mainModuleId) {
          if(this.mainModuleId != null) {
              if (!this.mainModuleId.equals(mainModuleId)) {
                  throw new IllegalStateException("Main module already set to " +
                      this.mainModuleId);
              }
              return mainExports;
          }
  
          ModuleScript moduleScript;
          try {
              // try to get the module script to see if it is on the module path
              moduleScript = moduleScriptProvider.getModuleScript(
                      cx, mainModuleId, null, null, paths);
          } catch (RuntimeException x) {
              throw x;
          } catch (Exception x) {
              throw new RuntimeException(x);
          }
  
          if (moduleScript != null) {
              mainExports = getExportedModuleInterface(cx, mainModuleId,
                      null, null, true);
          } else if (!sandboxed) {
  
              URI mainUri = null;
  
              // try to resolve to an absolute URI or file path
              try {
                  mainUri = new URI(mainModuleId);
              } catch (URISyntaxException usx) {
                  // fall through
              }
  
              // if not an absolute uri resolve to a file path
              if (mainUri == null || !mainUri.isAbsolute()) {
                  File file = new File(mainModuleId);
                  if (!file.isFile()) {
                      throw ScriptRuntime.throwError(cx, nativeScope,
                              "Module \"" + mainModuleId + "\" not found.");
                  }
                  mainUri = file.toURI();
              }
              mainExports = getExportedModuleInterface(cx, mainUri.toString(),
                      mainUri, null, true);
          }
  
          this.mainModuleId = mainModuleId;
          return mainExports;
      }