isomorfeus-asset-manager 0.13.7 → 0.13.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be010df3a50e5e269faac6199f11ae7ac6908af167c5abdb6dd51ce2c346bf3b
4
- data.tar.gz: c693e47aa3df6073524bfd8795f62ddc270c9699084d318097396c0fc8b82030
3
+ metadata.gz: 21a755b3c964b1e4463ac86d3a107bfa96cf1e3711013f3d27ab360805e54a52
4
+ data.tar.gz: a61345d86fd03993f9eeb0f27528731285135a200208e3065c0e2cd2737bcb5a
5
5
  SHA512:
6
- metadata.gz: e14e3dcfe2cb812a581ba6715d3bf1b0c3365f54fe4133bacd602b1acdcb31602ad91fa33f687e2b5e756ed7f0b7c8e18884d8e0b5bad4bf31e55f4b2066f5f5
7
- data.tar.gz: 809cb32e666acbdb5eddb810352694b9ea54184d991c2b7631bc08b5d630d86aef9be41e039bb868dbf397b4e11b19cab725e903abd415f51b93e9793b47cb18
6
+ metadata.gz: 7847d671507e887ae60b0577b3b9bbe2811dc004ca5ada5392d04df064e9bb58f1d80fd6af79d5d20d6611788d27351e5b5e467d155039ad07b0e19e917aa4ef
7
+ data.tar.gz: 55e4afab66c907df3655198dd52271be34d8f2a43b77ebc3dc4881a48df64bb29980c05013057c71a5653105b431922dbbad063f3573413b280ac1534e5b3fa8
@@ -93,7 +93,7 @@ module Isomorfeus
93
93
  end
94
94
 
95
95
  def touch
96
- @mtime = Time.now
96
+ @mtime = (Time.now.to_f * (10 ** 9)).to_i
97
97
  end
98
98
 
99
99
  def to_s
@@ -112,7 +112,7 @@ module Isomorfeus
112
112
  hmr_ws.onmessage = function(event) {
113
113
  let update = JSON.parse(event.data);
114
114
  if (typeof update.error !== 'undefined') { console.error(update.error); return; }
115
- let start_index = '/* Generated by Opal 1.2.0 */\\nOpal.modules[\\"'.length;
115
+ let start_index = 'Opal.modules[\\"'.length;
116
116
  let end_index = update.javascript.indexOf('"', start_index);
117
117
  let opal_module_name = update.javascript.substr(start_index, end_index - start_index);
118
118
  console.log('Updating ', opal_module_name);
@@ -8,7 +8,7 @@ module Isomorfeus
8
8
  attr_accessor :root
9
9
  attr_accessor :app_root
10
10
  attr_accessor :assets_path
11
- attr_accessor :assets_websocket_path
11
+ attr_accessor :assets_websocket_path
12
12
  attr_accessor :asset_manager_tmpdir
13
13
  attr_accessor :asset_manager_hmr_channel
14
14
  attr_accessor :asset_manager_hmr_dirs
@@ -19,24 +19,24 @@ module Isomorfeus
19
19
  def add_web_js_import(*args)
20
20
  Isomorfeus.assets['web.js'].add_js_import(*args)
21
21
  end
22
-
22
+
23
23
  def add_ssr_js_import(*args)
24
24
  Isomorfeus.assets['ssr.js'].add_js_import(*args)
25
25
  end
26
-
26
+
27
27
  def add_common_js_import(*args)
28
28
  Isomorfeus.assets['web.js'].add_js_import(*args)
29
29
  Isomorfeus.assets['ssr.js'].add_js_import(*args)
30
30
  end
31
-
31
+
32
32
  def add_web_ruby_import(*args)
33
33
  Isomorfeus.assets['web.js'].add_ruby_import(*args)
34
34
  end
35
-
35
+
36
36
  def add_ssr_ruby_import(*args)
37
37
  Isomorfeus.assets['ssr.js'].add_ruby_import(*args)
38
38
  end
39
-
39
+
40
40
  def add_common_ruby_import(*args)
41
41
  Isomorfeus.assets['web.js'].add_ruby_import(*args)
42
42
  Isomorfeus.assets['ssr.js'].add_ruby_import(*args)
@@ -66,7 +66,7 @@ module Isomorfeus
66
66
 
67
67
  self.hmr_listener = nil
68
68
  self.asset_manager_hmr_channel = :isomorfeus_asset_manager_module_updates
69
- self.asset_manager_hmr_dirs = %w[channels, components, data, operations, policies]
69
+ self.asset_manager_hmr_dirs = %w[channels components data operations policies]
70
70
  self.assets_websocket_path = '/_assets_websocket'
71
71
  self.assets_path = '/assets'
72
72
  self.assets = {
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  class AssetManager
3
- VERSION = '0.13.7'
3
+ VERSION = '0.13.8'
4
4
  end
5
5
  end
@@ -31,6 +31,14 @@ module Isomorfeus
31
31
  end
32
32
  end
33
33
 
34
+ def self.last_updated
35
+ @last_updated
36
+ end
37
+
38
+ def self.last_updated=(l)
39
+ @last_updated = l
40
+ end
41
+
34
42
  def initialize
35
43
  Isomorfeus.set_node_paths
36
44
 
@@ -51,6 +59,7 @@ module Isomorfeus
51
59
  return if !Isomorfeus.development? && asset.bundled?
52
60
  asset.mutex.synchronize do
53
61
  return if !Isomorfeus.development? && asset.bundled?
62
+ return if Isomorfeus.development? && asset.bundled? && (self.class.last_updated.nil? || (asset.mtime > self.class.last_updated))
54
63
  asset.touch
55
64
  build_ruby_and_save(asset_key, asset)
56
65
  save_imports(asset_key, asset)
@@ -153,8 +162,10 @@ module Isomorfeus
153
162
  listen_dirs << listen_dir if Dir.exist?(listen_dir)
154
163
  end
155
164
  end
165
+ am_class = self.class
156
166
  Isomorfeus.hmr_listener = Listen.to(*listen_dirs) do |modified, added, _|
157
167
  (modified + added).each do |file|
168
+ am_class.last_updated = (Time.now.to_f * (10 ** 9)).to_i
158
169
  next if file.start_with?(@server_path)
159
170
  begin
160
171
  update = compile_ruby(file)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isomorfeus-asset-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.7
4
+ version: 0.13.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann