Sha256: ff97def7a3020487568e05f82ebab7f32789d636d197a78fb1114e9ba091789d
Contents?: true
Size: 686 Bytes
Versions: 34
Compression:
Stored size: 686 Bytes
Contents
require 'opal-parser' module Kernel def __prepare_require__(path) name = `Opal.normalize(#{path})` full_path = name.end_with?('.rb') ? name : name + '.rb' if `!Opal.modules[#{name}]` ruby = File.read(full_path) compiler = Opal::Compiler.new(ruby, requirable: true, file: name) js = compiler.compile compiler.requires.each do |sub_path| __prepare_require__(sub_path) end `eval(#{js})` end name rescue => e raise [path, name, full_path].inspect + e.message end def require(path) `Opal.require(#{__prepare_require__(path)})` end def load(path) `Opal.load(#{__prepare_require__(path)})` end end
Version data entries
34 entries across 34 versions & 1 rubygems