Class: Opal::CliRunners::Nodejs
- Inherits:
-
Object
- Object
- Opal::CliRunners::Nodejs
- Defined in:
- opal/lib/opal/cli_runners/nodejs.rb
Defined Under Namespace
Classes: MissingNodeJS
Constant Summary collapse
Class Method Summary collapse
- .call(data) ⇒ Object
-
.node_modules ⇒ Object
Ensure stdlib node_modules is among NODE_PATHs.
Class Method Details
.call(data) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'opal/lib/opal/cli_runners/nodejs.rb', line 11 def self.call(data) (data[:options] ||= {})[:env] = { 'NODE_PATH' => node_modules } argv = data[:argv].dup.to_a argv.unshift('--') if argv.any? SystemRunner.call(data) do |tempfile| [ 'node', '--require', "#{__dir__}/source-map-support", tempfile.path, *argv ] end rescue Errno::ENOENT raise MissingNodeJS, 'Please install Node.js to be able to run Opal scripts.' end |