lib/hyper-react.rb in hyper-react-0.11.0 vs lib/hyper-react.rb in hyper-react-0.12.0

- old
+ new

@@ -1,16 +1,27 @@ +require 'hyperloop-config' +Hyperloop.require_gem 'react/react-source-browser' +Hyperloop.require_gem 'react/react-source-server', server_only: true +Hyperloop.require_gem 'opal-jquery', client_only: true +Hyperloop.require_gem 'browser/delay', client_only: true +Hyperloop.require_gem 'react_ujs', client_only: true - if RUBY_ENGINE == 'opal' + + module Hyperloop + class Component + end + end + if `Opal.global.React === undefined || Opal.global.React.version === undefined` raise [ "No React.js Available", "", "A global `React` must be defined before requiring 'hyper-react'", "", "To USE THE BUILT-IN SOURCE: ", - " add 'require \"react/react-source\"' immediately before the 'require \"hyper-react\" directive.", + " add 'require \"react/react-source-browser\"' immediately before the 'require \"hyper-react\" directive.", "IF USING WEBPACK:", " add 'react' to your webpack manifest." ].join("\n") end require 'react/hash' @@ -30,11 +41,21 @@ require 'react/object' require "react/ext/opal-jquery/element" require 'reactive-ruby/isomorphic_helpers' require 'rails-helpers/top_level_rails_component' require 'reactive-ruby/version' - + module Hyperloop + class Component + def self.inherited(child) + child.include(Mixin) + end + end + end + React::Component.deprecation_warning( + 'components.rb', + "Requiring 'hyper-react' is deprecated. Use gem 'hyper-component', and require 'hyper-component' instead." + ) unless defined? Hyperloop::Component::VERSION else require 'opal' # rubocop:disable Lint/HandleExceptions begin require 'opal-jquery' @@ -46,8 +67,7 @@ require 'reactive-ruby/rails' if defined?(Rails) require 'reactive-ruby/isomorphic_helpers' require 'reactive-ruby/serializers' Opal.append_path File.expand_path('../', __FILE__).untaint - Opal.append_path File.expand_path('../sources/', __FILE__).untaint require "react/react-source" end