isomorfeus-asset-manager 0.14.14 → 0.14.18

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: c4b07819de863fa8a53961b51639d75af890f918afa5146055d9fa2d20327088
4
- data.tar.gz: 86d08e88357840a1d14765d46eb672a448b63efa97c15e68d3cec389c900493b
3
+ metadata.gz: bb5692cfccf4e21f3b11bcced2aa8af148990c7d19ade752ea87ddcf1f1bdcc5
4
+ data.tar.gz: af7ea87cb6b73ab1c532eba91d155770bd101ada53a3eeb3c3ef934fcd730328
5
5
  SHA512:
6
- metadata.gz: 9a798a04f6e2320f36ac42214160da4c7a1770214c0c0ce75768044264b6e3643878ed6949bcbca36bbfebf8b28d760556145acf06e3698c8342d2f29456d84a
7
- data.tar.gz: 1cf4476f4b5d6869230e4afd46d2c6d2764bd80d8f709b0bbbc92fc78fa4fddf8f6c7596d891bfa4e724f61c8098ef86485f26052c24f6793df82db2d1fb6273
6
+ metadata.gz: e2e9b716e6ab17554d8d2adcf799ca0267eecf42bbc8f6383c352dbfe2713ebda4d391ff3a257c88b007edd572d1528b47ba0f751af0cb8225c03fd41084dba9
7
+ data.tar.gz: 80e14c295ad90176cabb32d22d13bc6a324f4ff5e78743d9c0ce66a8458a00dd0a7f18a379662575c9d05deb56582c47bebdd8be75ef57ffa1ddd7d18e4f9d73
data/README.md CHANGED
@@ -6,10 +6,14 @@
6
6
 
7
7
  Convenient and well performing on demand asset bundling for the isomorfeus framework project, internally using esbuild (esbuild-wasm).
8
8
 
9
- Version follows esbuild version: 0.13.x comes with esbuild 0.13.y.
9
+ Version follows esbuild version: 0.14.x comes with esbuild 0.14.y.
10
10
 
11
11
  No need to install esbuild separately, everything bundled ready to go.
12
12
  However, if within the project the 'esbuild' npm package is installed in node_modules, that version will be used instead.
13
13
 
14
14
  ### Community and Support
15
15
  At the [Isomorfeus Framework Project](https://isomorfeus.com)
16
+
17
+ ### Targets
18
+ By default bundles for browsers using the 'es6' target of esbuild.
19
+ By default bundles for node using the 'node16' target of esbuild.
@@ -61,6 +61,18 @@ module Isomorfeus
61
61
  def test?
62
62
  @test
63
63
  end
64
+
65
+ def server_requires_reload?
66
+ @server_requires_reload
67
+ end
68
+
69
+ def server_reloaded!
70
+ @server_requires_reload = false
71
+ end
72
+
73
+ def server_requires_reload!
74
+ @server_requires_reload = true
75
+ end
64
76
  end
65
77
  end
66
78
 
@@ -71,8 +71,7 @@ module Isomorfeus
71
71
  if asset && asset.browser?
72
72
  headers = { Rack::CONTENT_TYPE => 'application/json' }
73
73
  asset_manager.transition(asset_key, asset)
74
- content = get_content(env, headers, asset, asset_key, asset.hash[:css][:map])
75
- return [200, headers, content]
74
+ return [200, headers, get_content(env, headers, asset, asset_key, asset.hash[:css][:map])]
76
75
  end
77
76
  end
78
77
  end
@@ -135,7 +134,7 @@ module Isomorfeus
135
134
  end
136
135
  headers[Rack::CONTENT_LENGTH] = content.size
137
136
  headers['Last-Modified'] = asset.mtime
138
- content
137
+ [content]
139
138
  end
140
139
  end
141
140
  end
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  class AssetManager
3
- VERSION = '0.14.14'
3
+ VERSION = '0.14.18'
4
4
  end
5
5
  end
@@ -53,7 +53,6 @@ module Isomorfeus
53
53
  return if asset.bundled?
54
54
  start = Time.now
55
55
  puts "Isomorfeus Asset Manager bundling #{asset_key} ..."
56
- asset.bundled!
57
56
  asset.touch
58
57
  asset_name = asset_key[0..-4]
59
58
  asset.build_ruby_and_save(asset_key, asset_name, @imports_path)
@@ -65,6 +64,7 @@ module Isomorfeus
65
64
  asset.bundle_css_map(asset_name, @output_path)
66
65
  asset.bundle_js_map(asset_key, @output_path)
67
66
  end
67
+ asset.bundled!
68
68
  puts "Isomorfeus Asset Manager bundling #{asset_key} took #{Time.now - start}s"
69
69
  end
70
70
  end
@@ -125,22 +125,27 @@ module Isomorfeus
125
125
  am_class = self.class
126
126
  Isomorfeus.hmr_listener = Listen.to(*listen_dirs) do |modified, added, _|
127
127
  (modified + added).each do |file|
128
- next if file.start_with?(@server_path)
129
- begin
130
- if file.end_with?('.rb')
131
- Isomorfeus.assets.each_value { |asset| asset.unbundle! }
132
- update = compile_ruby(file)
133
- update_json = Oj.dump(update, mode: :strict)
134
- elsif file.end_with?('.yml') || file.end_with?('.mo') || file.end_with?('.po')
135
- update_json = Oj.dump({ locale: file }, mode: :strict)
136
- else
137
- update_json = Oj.dump({ error: "Don't know how to update #{file}!" }, mode: :strict)
128
+ if file.start_with?(@server_path)
129
+ Isomorfeus.server_requires_reload!
130
+ else
131
+ begin
132
+ if file.end_with?('.rb')
133
+ Isomorfeus.server_requires_reload!
134
+ Isomorfeus.assets.each_value { |asset| asset.unbundle! }
135
+ update = compile_ruby(file)
136
+ update_json = Oj.dump(update, mode: :strict)
137
+ elsif file.end_with?('.yml') || file.end_with?('.mo') || file.end_with?('.po')
138
+ Isomorfeus.server_requires_reload!
139
+ update_json = Oj.dump({ locale: file }, mode: :strict)
140
+ else
141
+ update_json = Oj.dump({ error: "Don't know how to update #{file}!" }, mode: :strict)
142
+ end
143
+ Iodine.publish(Isomorfeus.asset_manager_hmr_channel, update_json)
144
+ rescue Exception => e
145
+ message = "Isomorfeus Asset Manager during hot module update:\n#{e.class}\n#{e.message}\n#{e.backtrace.join("\n")}"
146
+ STDERR.puts message
147
+ Iodine.publish(Isomorfeus.asset_manager_hmr_channel, Oj.dump({ error: message }, mode: :strict))
138
148
  end
139
- Iodine.publish(Isomorfeus.asset_manager_hmr_channel, update_json)
140
- rescue Exception => e
141
- message = "Isomorfeus Asset Manager during hot module update:\n#{e.class}\n#{e.message}\n#{e.backtrace.join("\n")}"
142
- STDERR.puts message
143
- Iodine.publish(Isomorfeus.asset_manager_hmr_channel, Oj.dump({ error: message }, mode: :strict))
144
149
  end
145
150
  end
146
151
  end
@@ -169,7 +174,7 @@ module Isomorfeus
169
174
  publicPath: '#{asset.browser? ? Isomorfeus.assets_path : @output_path}',
170
175
  sourcemap: #{(!Isomorfeus.production? && asset.browser?) ? 'true' : 'false'},
171
176
  splitting: false,
172
- target: 'es6',
177
+ target: '#{asset.browser? ? 'es6' : 'node16' }',
173
178
  write: true
174
179
  }).then((result) => { global.res_meta = result.metafile; return result; });
175
180
  JAVASCRIPT
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.14.14
4
+ version: 0.14.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-19 00:00:00.000000000 Z
11
+ date: 2022-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: brotli
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.5.0
47
+ version: 0.5.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.5.0
54
+ version: 0.5.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: listen
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -200,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
200
200
  - !ruby/object:Gem::Version
201
201
  version: '0'
202
202
  requirements: []
203
- rubygems_version: 3.3.3
203
+ rubygems_version: 3.3.7
204
204
  signing_key:
205
205
  specification_version: 4
206
206
  summary: Asset manager and bundler for Isomorfeus.