diff --git a/lib/opal/cli_runners.rb b/lib/opal/cli_runners.rb index ce81bd9c8d..5d341e2284 100644 --- a/lib/opal/cli_runners.rb +++ b/lib/opal/cli_runners.rb @@ -76,7 +76,6 @@ def self.alias_runner(new_name, old_name) register_runner :compiler, :Compiler, 'opal/cli_runners/compiler' register_runner :deno, :Deno, 'opal/cli_runners/deno' register_runner :firefox, :Firefox, 'opal/cli_runners/firefox' - register_runner :nashorn, :Nashorn, 'opal/cli_runners/nashorn' register_runner :nodejs, :Nodejs, 'opal/cli_runners/nodejs' register_runner :quickjs, :Quickjs, 'opal/cli_runners/quickjs' register_runner :server, :Server, 'opal/cli_runners/server' diff --git a/lib/opal/cli_runners/nashorn.rb b/lib/opal/cli_runners/nashorn.rb deleted file mode 100644 index a6baecd1ba..0000000000 --- a/lib/opal/cli_runners/nashorn.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -require 'opal/paths' -require 'opal/cli_runners/system_runner' - -module Opal - module CliRunners - class Nashorn - def self.call(data) - # Allow to change path if using GraalVM, see: - # https://github.com/graalvm/graaljs/blob/master/docs/user/NashornMigrationGuide.md#launcher-name-js - exe = ENV['NASHORN_PATH'] || 'jjs' - - SystemRunner.call(data) do |tempfile| - [exe, tempfile.path, *data[:argv]] - end - rescue Errno::ENOENT - raise MissingNashorn, 'Please install JDK or GraalVM to be able to run Opal scripts.' - end - - class MissingNashorn < RunnerError - end - end - end -end diff --git a/stdlib/nashorn.rb b/stdlib/nashorn.rb deleted file mode 100644 index 9ee60f3ea3..0000000000 --- a/stdlib/nashorn.rb +++ /dev/null @@ -1,5 +0,0 @@ -module Nashorn -end - -require 'nashorn/io' -require 'nashorn/file' diff --git a/stdlib/nashorn/file.rb b/stdlib/nashorn/file.rb deleted file mode 100644 index 46bbbde819..0000000000 --- a/stdlib/nashorn/file.rb +++ /dev/null @@ -1,32 +0,0 @@ -# backtick_javascript: true - -`/* global Java */` - -require 'corelib/file' - -class File - def self.read(path) - %x( - var Paths = Java.type('java.nio.file.Paths'); - var Files = Java.type('java.nio.file.Files'); - var lines = Files.readAllLines(Paths.get(path), Java.type('java.nio.charset.StandardCharsets').UTF_8); - var data = []; - lines.forEach(function(line) { data.push(line); }); - return data.join("\n"); - ) - end - - def self.file?(path) - %x{ - var Files = Java.type('java.nio.file.Files'); - return Files.exists(path) && Files.isRegularFile(path); - } - end - - def self.readable?(path) - %x{ - var Files = Java.type('java.nio.file.Files'); - return Files.exists(path) && Files.isReadable(path); - } - end -end diff --git a/stdlib/nashorn/io.rb b/stdlib/nashorn/io.rb deleted file mode 100644 index d70850c818..0000000000 --- a/stdlib/nashorn/io.rb +++ /dev/null @@ -1,4 +0,0 @@ -# backtick_javascript: true - -$stdout.write_proc = `function(s){print(s)}` -$stderr.write_proc = `function(s){print(s)}` diff --git a/stdlib/opal-platform.rb b/stdlib/opal-platform.rb index 2b4bdcbb21..1ee8ae726d 100644 --- a/stdlib/opal-platform.rb +++ b/stdlib/opal-platform.rb @@ -1,12 +1,11 @@ # backtick_javascript: true -`/* global Java, GjsFileImporter, Deno, Bun */` +`/* global GjsFileImporter, Deno, Bun */` browser = `typeof(document) !== "undefined"` bun = `typeof(Bun) === "object" && typeof(Bun.version) === "string"` deno = `typeof(Deno) === "object" && typeof(Deno.version) === "object"` node = `typeof(process) !== "undefined" && process.versions && process.versions.node` -nashorn = `typeof(Java) !== "undefined" && Java.type` headless_chrome = `typeof(opalheadlesschrome) !== "undefined"` headless_firefox = `typeof(opalheadlessfirefox) !== "undefined"` safari = `typeof(opalsafari) !== "undefined"` @@ -14,9 +13,7 @@ quickjs = `typeof(window) === "undefined" && typeof(__loadScript) !== "undefined"` opal_miniracer = `typeof(opalminiracer) !== "undefined"` -OPAL_PLATFORM = if nashorn - 'nashorn' - elsif bun +OPAL_PLATFORM = if bun 'bun' elsif deno 'deno' diff --git a/stdlib/opal/platform.rb b/stdlib/opal/platform.rb index 13321cfb1b..857f82629d 100644 --- a/stdlib/opal/platform.rb +++ b/stdlib/opal/platform.rb @@ -1,7 +1,6 @@ require 'opal-platform' case OPAL_PLATFORM -when 'nashorn' then require 'nashorn' when 'gjs' then require 'gjs' when 'quickjs' then require 'quickjs' when 'deno' then require 'deno/base'