isomorfeus-preact 10.5.3 → 10.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c84542b099035d06c1d7bf1f747c5401f6bc018e58df19e9a9069837c10c9aa9
4
- data.tar.gz: 52df4e83da5364fa38eaf114761c3d35aa5f9a33acda150cc65969beecedffe5
3
+ metadata.gz: 92daeaa6f6973b4d2e753e7466d900292a636fedb636d6c1534c541a746113a6
4
+ data.tar.gz: 7a7ac6a939db1a8c9b10daf4a167971bcf19908b9ae9aaf960fb1a8d6243a876
5
5
  SHA512:
6
- metadata.gz: '038dd71dffe873621c6a4c11f6c18094084927d01f761da8a55d34777893f9c3fb59068f7c91c69d572ab8dd0bd6696d4f848267b2d75b4b9e74b7018c93899f'
7
- data.tar.gz: 9c4ce74166cbe4bd96d9ade961827b46a9d90106a51bb3be76c1577b74b09bf00bfe0053ca959955ec94e3350541340af5a533b5c82692046fc6c752718b0106
6
+ metadata.gz: c62d10cd9ece7a8ba65b02f5e2e84b8c36279216dfdaf9365a193701522228bf7cbd98e4b933784ea9a86ca27b9a074d5e0807be4f367d0252efe3dd169e6089
7
+ data.tar.gz: 64891193627696400afa83c1cad10e47eca8cd12f89c4fe9cae4aeb5f58b70de77cfc54b4ba02859c7436519848aa5254253d2804bfe089c9b440e937e28b17e
@@ -142,14 +142,12 @@ module Isomorfeus
142
142
 
143
143
  class << self
144
144
  def raise_error(error: nil, error_class: nil, message: nil, stack: nil)
145
- error_class = error.class unless error == nil
145
+ error_class = error.class if error
146
146
 
147
147
  error_class = RuntimeError unless error_class
148
148
  execution_environment = if on_browser? then 'on Browser'
149
149
  elsif on_ssr? then 'in Server Side Rendering'
150
150
  elsif on_server? then 'on Server'
151
- elsif on_mobile? then 'on Mobile'
152
- elsif on_database? then 'on Database'
153
151
  else
154
152
  'on Client'
155
153
  end
@@ -16,12 +16,12 @@ module Isomorfeus
16
16
  render_result
17
17
  end
18
18
 
19
- def mount_component(component_name, props = {}, asset_key = 'ssr.js')
19
+ def mount_component(component_name, props = {}, asset_key = 'ssr.js', skip_ssr: false)
20
20
  @ssr_response_status = nil
21
21
  @ssr_styles = nil
22
22
  thread_id_asset = "#{Thread.current.object_id}#{asset_key}"
23
23
  render_result = "<div data-iso-env=\"#{Isomorfeus.env}\" data-iso-root=\"#{component_name}\" data-iso-props='#{Oj.dump(props, mode: :strict)}'"
24
- if Isomorfeus.server_side_rendering
24
+ if !skip_ssr && Isomorfeus.server_side_rendering
25
25
  if Isomorfeus.development?
26
26
  # always create a new context, effectively reloading code
27
27
  # delete the existing context first, saves memory
@@ -47,6 +47,14 @@ module Isomorfeus
47
47
  Isomorfeus.ssr_contexts[thread_id_asset] = ExecJS.permissive_compile(asset.bundle)
48
48
  end
49
49
  end
50
+
51
+ # if location_host and scheme are given and if Transport is loaded, connect and then render,
52
+ # otherwise do not render because only one pass is required
53
+ ws_scheme = props[:location_scheme] == 'https:' ? 'wss:' : 'ws:'
54
+ location_host = props[:location_host] ? props[:location_host] : 'localhost'
55
+ api_ws_path = Isomorfeus.respond_to?(:api_websocket_path) ? Isomorfeus.api_websocket_path : ''
56
+ transport_ws_url = ws_scheme + location_host + api_ws_path
57
+
50
58
  # build javascript for rendering first pass
51
59
  # it will initialize buffers to guard against leaks, maybe caused by previous exceptions
52
60
  javascript = <<~JAVASCRIPT
@@ -63,14 +71,6 @@ module Isomorfeus
63
71
  global.Opal.Isomorfeus['$force_init!']();
64
72
  global.Opal.Isomorfeus['$ssr_response_status='](200);
65
73
  global.Opal.Isomorfeus.TopLevel['$ssr_route_path=']('#{props[:location]}');
66
- JAVASCRIPT
67
- # if location_host and scheme are given and if Transport is loaded, connect and then render,
68
- # otherwise do not render because only one pass is required
69
- ws_scheme = props[:location_scheme] == 'https:' ? 'wss:' : 'ws:'
70
- location_host = props[:location_host] ? props[:location_host] : 'localhost'
71
- api_ws_path = Isomorfeus.respond_to?(:api_websocket_path) ? Isomorfeus.api_websocket_path : ''
72
- transport_ws_url = ws_scheme + location_host + api_ws_path
73
- javascript << <<~JAVASCRIPT
74
74
  let api_ws_path = '#{api_ws_path}';
75
75
  let exception;
76
76
  if (typeof global.Opal.Isomorfeus.Transport !== 'undefined' && api_ws_path !== '') {
@@ -1,3 +1,3 @@
1
1
  module Preact
2
- VERSION = '10.5.3'
2
+ VERSION = '10.5.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isomorfeus-preact
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.5.3
4
+ version: 10.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-06 00:00:00.000000000 Z
11
+ date: 2021-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 3.13.3
33
+ version: 3.13.4
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 3.13.3
40
+ version: 3.13.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: opal
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -86,28 +86,28 @@ dependencies:
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 0.12.1
89
+ version: 0.12.2
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 0.12.1
96
+ version: 0.12.2
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: isomorfeus-redux
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 4.1.5
103
+ version: 4.1.6
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 4.1.5
110
+ version: 4.1.6
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: isomorfeus-speednode
113
113
  requirement: !ruby/object:Gem::Requirement