svelte-on-rails 2.1.2 → 3.0.1

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: 4002f622be27b2cee89f360cb18d02f063f4918208ecf433aeb85eee3e1b8ad3
4
- data.tar.gz: f91206ad19b1e982f583300036c00ae5061a2096cf6bf20ce4eaea9de2ca989f
3
+ metadata.gz: 0c5b4e8cde1b19cfbe2d91c9a8867b159344cd9381e99b0147886e7c949bd46c
4
+ data.tar.gz: 020dca3c6ad3c0eb45fc0062f9479034ab4fad9b914a8231c1f0d8833347ab6c
5
5
  SHA512:
6
- metadata.gz: f90f6082c7c97d672ca15c4c8d8c5c0576edb253ca35d02ca5857227365ccf52b1c4947aa28479aefd36351496a427a02976f0395e98ef63076b1d8a609c25c7
7
- data.tar.gz: afbd7c72cd186de0451e26f0216dcd310d92d277ec5bc7072bb1e61c67fcd483265cf5c598e5edeb99bc3afb392f66873c26aedd43753e2d365459c4223e3c3f
6
+ metadata.gz: 87b31439e3f82ed5add160503902440572c18aa450d0e9d8efd0c9750048402a07460cea9eeb357ca6494bacce24898528695ee008990c5a9136efff0886efae
7
+ data.tar.gz: 85259b03fc1a231b72b3e4ac5d2984ef1079d568e7e5abad67107a47c2b514cf47ce712af94112bf3a1071a2088f7c503accdf829160d6a83f35dee94a6afb6d
data/README.md CHANGED
@@ -1,17 +1,18 @@
1
1
  <div style="text-align: center;">
2
2
  <img src="./Svelte_Logo.svg.png" alt="Svelte Logo" height="120">
3
+ <img src="./vite-logo.svg" alt="Svelte Logo" height="120">
3
4
  </div>
4
5
 
5
6
  ---
6
7
 
7
- Do you want to combine DHH's [vision](https://rubyonrails.org/2021/12/15/Rails-7-fulfilling-a-vision)
8
- with modern front-end requirements?
8
+ Combining [DHH's vision](https://rubyonrails.org/2021/12/15/Rails-7-fulfilling-a-vision)
9
+ with modern front-end requirements:
9
10
 
10
11
  Svelte.
11
12
 
12
13
  Vite.
13
14
 
14
- Nothing else.
15
+ Hotwired.
15
16
 
16
17
  # Why Svelte?
17
18
 
@@ -64,9 +65,10 @@ performance optimized.
64
65
  Thanks to [shakacode](https://github.com/shakacode/react_on_rails)
65
66
  and [ElMassimo](https://github.com/ElMassimo) for inspiring and helping me with their gems.
66
67
 
67
- **STATUS** This gem is in early development but ready to use for curious developers.
68
- It has a nearly 100% test coverage, all tests pass and, since 2025-05-15 it is successfully
69
- implemented on my first customers app.
68
+ **STATUS:** This gem is in the early stages of development, but is ready for use.
69
+ It has nearly 100% test coverage and all tests pass. Since 15 May 2025, it has been successfully
70
+ implemented on my first customer's app: an ERP system with fat Svelte components that are crucial for the workflow.
71
+ of this company.
70
72
 
71
73
  If you have issues, please open one, and contributors are welcome!
72
74
 
@@ -121,7 +121,9 @@ module SvelteOnRails
121
121
  def self.puts_error(text)
122
122
  red_background = "\033[97;41m"
123
123
  clear_colors = "\033[0m"
124
- puts "#{red_background} ERROR #{clear_colors}"
124
+ # Get the caller method name from the call stack
125
+ caller_info = caller[1] =~ /`([^']*)'/ ? $1 : "unknown"
126
+ puts "#{red_background} [svelte-on-rails] #{caller_info} ERROR #{clear_colors}"
125
127
  text.split("\n").each do |line|
126
128
  puts "#{red_background} #{clear_colors} #{line}"
127
129
  end
@@ -130,12 +132,13 @@ module SvelteOnRails
130
132
  def self.puts_warning(text)
131
133
  black_background = "\033[97;40m"
132
134
  clear_colors = "\033[0m"
133
- puts "#{black_background} [svelte-on-rails] WARNING #{clear_colors}"
135
+ # Get the caller method name from the call stack
136
+ caller_info = caller[1] =~ /`([^']*)'/ ? $1 : "unknown"
137
+ puts "#{black_background} [svelte-on-rails] #{caller_info} WARNING #{clear_colors}"
134
138
  text.split("\n").each do |line|
135
- puts "#{black_background} #{clear_colors} #{line}"
139
+ puts "#{black_background} #{clear_colors} #{line}"
136
140
  end
137
141
  end
138
-
139
142
  end
140
143
  end
141
144
  end
@@ -37,14 +37,6 @@ module SvelteOnRails
37
37
 
38
38
  stdout, stderr, status = Open3.capture3(cmd, stdin_data: props.to_json, chdir: utils.gem_app_dir)
39
39
 
40
-
41
- unless status.to_s.match(/^pid [0-9]+ exit 0$/)
42
- cmp = "#{@component_files[:svelte_filename]} was returned «#{status.to_s}»\n\n"
43
- msg = "#{cmp}output from render.js (stderr) =>\n+++\n" + stderr + "+++\n\nRender Svelte Server-side =>\n#{cmd}\n\n"
44
- utils.puts_warning(msg)
45
- end
46
-
47
-
48
40
  begin
49
41
  res = JSON.parse(stdout)
50
42
  css_file = @component_files[:compiled_file] + '.css'
@@ -52,10 +44,20 @@ module SvelteOnRails
52
44
  res['css'] = File.read(css_file)
53
45
  end
54
46
 
47
+ unless status.to_s.match(/^pid [0-9]+ exit 0$/)
48
+ cmp = "#{@component_files[:svelte_filename]} was returned «#{status.to_s}»\n\n"
49
+ msg = "#{cmp}output from render.js (stderr) =>\n+++\n" + stderr + "+++\n\nRender Svelte Server-side =>\n#{cmd}\n\n"
50
+ utils.puts_warning(msg)
51
+ end
55
52
 
56
53
  return res
57
54
  rescue JSON::ParserError => e
58
- raise "Render Svelte Server-side: Expected JSON, got: «#{stdout}»\n\ncmd: «#{cmd}»"
55
+
56
+ cmp = "#{@component_files[:svelte_filename]} was returned «#{status.to_s}»\n\n"
57
+ msg = "#{cmp}output from render.js (stderr) =>\n+++\n" + stderr + "+++\n\nRender Svelte Server-side =>\n#{cmd}\n\n"
58
+ utils.puts_error(msg)
59
+
60
+ raise "[svelte-on-rails] Render Svelte Server-side: Expected JSON, got: «#{stdout}»\n\nstdout:\n+++\n#{stderr}+++\n\ncmd: «#{cmd}»"
59
61
  end
60
62
  end
61
63
 
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: 2.1.2
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Sedlmair