Sha256: 8df394a6d74235108f2262a0f46fac4dbfd5a6cb83e2c977bc70a2c73f64e4b3

Contents?: true

Size: 701 Bytes

Versions: 12

Compression:

Stored size: 701 Bytes

Contents

module Hyperstack
  class << self
    def js_import(value, client_only: nil, server_only: nil, defines:)
      defines = [*defines]
      if RUBY_ENGINE != 'opal'
        import(value, client_only: client_only, server_only: server_only, js_import: true)
      else
        on_server = `typeof Opal.global.document === 'undefined'`
        return if (server_only && !on_server) || (client_only && on_server)
        defines.each do |name|
          next unless `Opal.global[#{name}] === undefined`
          raise "The package #{name} was not found. Add it to the webpack "\
                "#{client_only ? 'client_only.js' : 'client_and_server.js'} manifest."
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
hyperstack-config-1.0.alpha1.8 lib/hyperstack/js_imports.rb
hyperstack-config-1.0.alpha1.7 lib/hyperstack/js_imports.rb
hyperstack-config-1.0.alpha1.6 lib/hyperstack/js_imports.rb
hyperstack-config-1.0.alpha1.5 lib/hyperstack/js_imports.rb
hyperstack-config-1.0.alpha1.4 lib/hyperstack/js_imports.rb
hyperstack-config-1.0.alpha1.3 lib/hyperstack/js_imports.rb
hyperstack-config-1.0.alpha1.2 lib/hyperstack/js_imports.rb
hyperstack-config-1.0.alpha1.1 lib/hyperstack/js_imports.rb
hyperstack-config-1.0.0.pre.alpha1 lib/hyperstack/js_imports.rb
hyperstack-config-1.0.alpha1 lib/hyperstack/js_imports.rb
hyperstack-config-1.0.pre.alpha1 lib/hyperstack/js_imports.rb
hyperstack-config-0.1 lib/hyperstack/js_imports.rb