opal_stimulus 0.1.1 → 0.1.2

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: 22842799923c6a3bad9030dd9971a4819c7c2fe37cb729c42c9780500b8ddbd4
4
- data.tar.gz: c1055d0c8854bef13a168eae8740f71b851d1488d39199bc4c4fc388cc72115c
3
+ metadata.gz: 300ef0df34590b96644f09bec7f618c308189700c8b91c909bccb4bd7cb48760
4
+ data.tar.gz: 4d405702dc56dcd9a0fd980c6c834dce308303a4e73f950239ed33c58493bd56
5
5
  SHA512:
6
- metadata.gz: a97cccb1708103c33bb3deb915d4bf505bd0ef1c016aa8e4e4fcd28eedd71db2e9ad2a66911188eb2c21479e86607921bb3e8d40b79ed61733e1e03f4d6c0772
7
- data.tar.gz: 1c03b955c9528e34fcd8489e2be91c1eb15f9ba8f6013815ec7e5169d48a281be9722919203fa72ba9b4360b20f380777f8aa40e2ce09f1c49e5120e7db8241c
6
+ metadata.gz: 320be88eef00e84f254a120dd0c3029f6027daacba7aeab96c74af79de26b1150034de44200d299fad77d1817e9f298e1f1111d7c608fb076cf4db9ef571831b
7
+ data.tar.gz: 548d689d02602637832156e6e88be3ff29224ce12dd5cba5de985d04c1567eabc1ad539120b9f6cd7dee41c687ec86324ac3179c4ffac04ed5cc15f79f5fb524
data/CHANGELOG.md CHANGED
@@ -7,3 +7,7 @@
7
7
  ## [0.1.1] - 2025-07-02
8
8
 
9
9
  - Generate better stimulus controller name replacing controller class's namespace resolution operators to --
10
+
11
+ ## [0.1.2] - 2025-07-29
12
+
13
+ - Implement Opal Source maps https://opalrb.com/docs/guides/v1.4.1/source_maps.html
data/README.md CHANGED
@@ -14,7 +14,7 @@ Execute:
14
14
 
15
15
  ```bash
16
16
  bundle install
17
- rails generate opal_stimulus:install
17
+ rails opal_stimulus:install
18
18
  ```
19
19
 
20
20
  Start application:
data/lib/install/opal CHANGED
@@ -15,9 +15,18 @@ Opal.append_path("app/opal")
15
15
  build = -> {
16
16
  puts "🔨 Compiling Opal..."
17
17
 
18
- builder = Opal::Builder.build("application", requirable: false)
18
+ builder = Opal::Builder.new
19
+
20
+ result = builder.build("application")
21
+
19
22
  output_path = "app/assets/builds/opal.js"
20
- File.write(output_path, builder.to_s)
23
+ sourcemap_path = "#{output_path}.map"
24
+
25
+ js_code = result.to_s
26
+ source_map_json = result.source_map.to_json
27
+
28
+ File.write(output_path, js_code + "\n//# sourceMappingURL=/assets/opal.js.map")
29
+ File.write(sourcemap_path, source_map_json)
21
30
 
22
31
  puts "✅ Compiled to #{output_path}"
23
32
  }
@@ -30,7 +30,11 @@ class StimulusController < `Controller`
30
30
 
31
31
  %x{
32
32
  #{self.stimulus_controller}.prototype[name] = function (...args) {
33
- return #{self.stimulus_controller}.prototype['$' + name].apply(this, args);
33
+ try {
34
+ return this['$' + name].apply(this, args);
35
+ } catch (e) {
36
+ console.error("Uncaught", e);
37
+ }
34
38
  }
35
39
  }
36
40
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpalStimulus
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal_stimulus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joseph Schito