svelte-on-rails 11.0.6 → 11.0.7

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: 0ec326a2b40b841ab1b261971b8719429aaf41860939b222c100c86888e410db
4
- data.tar.gz: 279f835892871c7a61bb8d6c7fe5ea02181f948ae27ca970f1f18ae785329df2
3
+ metadata.gz: e04a25d3bcc9557f181a14529761a7fa0c5e9b6bd6d68a89680a660495822a58
4
+ data.tar.gz: bdfa056a4b6d06bad4f24271c8da88fcf011c5c653b1453ef9d3b54f7008653b
5
5
  SHA512:
6
- metadata.gz: a3ad2129ff7a86f5203a97ccb38ee4cac9da09f4cf52dadd1399427bba958550a85c94790c41cde07fdc16f35f972505dc20513efd682fdfa1cee95493d7d214
7
- data.tar.gz: b1b44c5ad2550792aae8cf69b9e97851765f9113321dfe2aff6e1c50538ccfaa764b03f029a0afe3a8fe035e5b904f6a276aa5008566916f39e1ec94e823bf62
6
+ metadata.gz: 0c23b04fdc8c6a5ff0852d2c20ef128c2766a034c73107ac554e14cc149dcd2808d62645c6c2f0e7596b4deac9faebc125ddcae12713539e4747c18780c60d5e
7
+ data.tar.gz: b7257de3179f1afca8e48aeb50d10cbff5ed960685e291f3adb040ca2f8b929e582770400bdbcb0e8ad4b70e9c325ea4cccece386b1410db0320f07569d95fe1
@@ -30,6 +30,8 @@ module SvelteOnRails
30
30
  end
31
31
 
32
32
  def fingerprint(component_path)
33
+ # We do not cache this as this function is only for development.
34
+ # Therefore, it is fast enough.
33
35
  build_fingerprint(component_path)
34
36
  end
35
37
 
@@ -37,12 +39,12 @@ module SvelteOnRails
37
39
 
38
40
  # ensure we have a current manifest loaded
39
41
 
40
- if watch_changes? && File.mtime(manifest_json_path) != @manifest_mtime
42
+ if watch_changes? && File.mtime(manifest_json_path).to_f.round(3) != @manifest_mtime
41
43
  @manifest = {}
42
44
  end
43
45
 
44
46
  if !@manifest.present?
45
- @manifest_mtime = File.mtime(manifest_json_path)
47
+ @manifest_mtime = File.mtime(manifest_json_path).to_f.round(3)
46
48
  @manifest = JSON.parse(File.read(manifest_json_path))
47
49
  else
48
50
  @manifest
@@ -53,14 +55,20 @@ module SvelteOnRails
53
55
  private
54
56
 
55
57
  def last_build
56
- if watch_changes? && !@last_build.present?
57
- unless File.exist?(manifest_json_path)
58
+ if watch_changes? && (!@last_build.present? || @last_build != File.mtime(manifest_json_path).to_f.round(3))
59
+ if File.exist?(manifest_json_path)
60
+ # we assume the developer has run a build manually
61
+ else
58
62
  raise "File not found: #{manifest_json_path}"
59
63
  end
64
+ @manifest = {}
65
+ @component_files = {}
66
+ @dev_modules_map = {}
67
+
60
68
  @last_build = (File.mtime(manifest_json_path).to_f.round(3) - 1.0)
61
- else
62
- @last_build
63
69
  end
70
+
71
+ @last_build
64
72
  end
65
73
 
66
74
  def fetch_source_files(component, files = [])
@@ -11,6 +11,14 @@ module SvelteOnRails
11
11
  cnf = SvelteOnRails::Configuration.instance
12
12
  manifest = cnf.manifest[component_path]
13
13
 
14
+ if manifest.nil? && cnf.watch_changes?
15
+ cnf.vite_build
16
+ manifest = cnf.manifest[component_path]
17
+ end
18
+ if manifest.nil?
19
+ raise "[svelte-on-rails] ERROR: No manifest found for component: «#{component_path}»\nAvailable keys in current manifest.json are:\n\n+++\n • #{cnf.manifest.keys.join("\n • ")}\n+++\n."
20
+ end
21
+
14
22
  cmd = [
15
23
  cnf.node_bin_path,
16
24
  cnf.rails_root.join('node_modules/@csedl/svelte-on-rails/src/ssr/render.js'),
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svelte-on-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.0.6
4
+ version: 11.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Sedlmair