isomorfeus-asset-manager 0.19.0 → 0.19.1

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: 3be74c17ce1066deb5e6ffabafa764e302b774b63cb422f31d2fbd3e2dad4d8d
4
- data.tar.gz: 2a9d0d59aa6eb50bc0bac4ee34b3a37aea493fcea6bb529a7084f521a7f7b5fa
3
+ metadata.gz: d3342cc6c4c4b8cb604bf6e7b53043aa534688a06bd5f3c2be536cee51de0334
4
+ data.tar.gz: 51c294beb9e50397d60b20b90b2ee4381e5c4f56f9e06a070b0ec89ebe2ee35a
5
5
  SHA512:
6
- metadata.gz: 396084c4a4060958d3bb2035463b3d62a1aa2036a91f0e9fa3d9311643d8fe1b4e691dde7f9f854b9328f5858e727fffd27e2164772d087e9964024b16d5c467
7
- data.tar.gz: 83a6fe4edc1183c56154fa449560771741164239a4863c1822b2708121f132121a8d004d1d9210a31965d668fa39ea42f49d2008fd8b332dcda830cc742d2721
6
+ metadata.gz: c981a9cc7ba7a26e1ea8b0fc167351c8f1c03d755ffeecd0a1e3b6a62d803e2524b91927c39acf7a1f04047189a675fb1c4572c2df4bc9ffe46293e30b7897b4
7
+ data.tar.gz: 73e4d8aac8cc7b1a55ecca4f91d00611b901ebd02e0ba551b360e2a7146b15bfc70b38b4506e0bf0c34157e92358cebc4be14e788d79c8bfbadc6ae9d9285abb
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  class AssetManager
3
- VERSION = '0.19.0'
3
+ VERSION = '0.19.1'
4
4
  end
5
5
  end
@@ -26,8 +26,6 @@ module Isomorfeus
26
26
  @server_path = File.join(Isomorfeus.app_root, 'server')
27
27
  self.class.add_app_imports
28
28
 
29
- @context = ExecJS.permissive_compile(init_js)
30
-
31
29
  init_hmr_listener if Isomorfeus.development? && !Isomorfeus.hmr_listener
32
30
  end
33
31
 
@@ -55,6 +53,14 @@ module Isomorfeus
55
53
 
56
54
  private
57
55
 
56
+ def get_context
57
+ @context ||= ExecJS.permissive_compile(init_js)
58
+ end
59
+
60
+ def delete_context
61
+ @context = nil
62
+ end
63
+
58
64
  def compile_ruby(file)
59
65
  source = File.binread(file)
60
66
  module_file = file[(Isomorfeus.app_root.size + 1)..-1]
@@ -62,7 +68,6 @@ module Isomorfeus
62
68
  { javascript: compiler.compile }
63
69
  end
64
70
 
65
-
66
71
  def handle_errors(asset_key, result)
67
72
  result = result['result']
68
73
  if result && !(result['errors'].nil? || result['errors'].empty?)
@@ -135,7 +140,9 @@ module Isomorfeus
135
140
  resolve_paths << 'node_modules'
136
141
  resolve_paths.uniq!
137
142
 
138
- result = @context.await <<~JAVASCRIPT
143
+ context = get_context
144
+
145
+ result = context.await <<~JAVASCRIPT
139
146
  esbuild.build({
140
147
  entryPoints: [path.resolve(global.imports_path, '#{entry}')],
141
148
  bundle: true,
@@ -159,11 +166,14 @@ module Isomorfeus
159
166
  .catch((error) => { return { result: { errors: [{text: error.message}]}}; });
160
167
  JAVASCRIPT
161
168
  if analyze
162
- analysis = @context.await <<~JAVASCRIPT
169
+ analysis = context.await <<~JAVASCRIPT
163
170
  esbuild.analyzeMetafile(global.res_meta, { verbose: true });
164
171
  JAVASCRIPT
165
172
  puts "\n#{analysis}\n"
166
173
  end
174
+
175
+ delete_context if Isomorfeus.production? # no need to keep node running, let it get garbage collected
176
+
167
177
  handle_errors(asset_key, result)
168
178
  end
169
179
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isomorfeus-asset-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0
4
+ version: 0.19.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-14 00:00:00.000000000 Z
11
+ date: 2023-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: brotli