opal_stimulus 0.1.5 → 0.1.6
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +0 -4
- data/lib/install/install_opal_stimulus.rb +0 -9
- data/lib/opal_stimulus/version.rb +1 -1
- data/lib/tasks/build.rake +6 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 669d38bd3eaad485f44b8347ca5008ee6d6001a7d622f305ad78a413f2fbee43
|
4
|
+
data.tar.gz: 36bd60dc686ef27c23e1db07a3359679f1b6de0fc9ef28e11ef79f891bc79303
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ff23a23826bb81e640c712da250e950053376312a5af7bd6dc10e5175ab2480257ec859868e8c24dc8f7ba7d343f9147bf119852e9475d927e44fd893a3da90
|
7
|
+
data.tar.gz: 422ab1172b497502b34b1369118ed10669e59b8a830ae9539fc7a7c289ae743bc9ed68919fab0eb666a3a88c679a13dbe43a9c8f6c3514e462e58607f07e629f
|
data/CHANGELOG.md
CHANGED
@@ -32,3 +32,9 @@
|
|
32
32
|
- Reduce installed new lines for Rails
|
33
33
|
- Skip importmap in production
|
34
34
|
- Add `bin/rails generate opal_stimulus <CONTROLLER_NAME>`, usage: `bin/rails g opal_stimulus -h`
|
35
|
+
|
36
|
+
## [0.1.6] - 2025-08-17
|
37
|
+
|
38
|
+
- Simplify installation importing `application` and `Controller` with ESM
|
39
|
+
Now `app/javascript/controllers/application.js` will be not modified,
|
40
|
+
and only compiled code will be imported inside application layout.
|
data/README.md
CHANGED
@@ -64,10 +64,6 @@ end
|
|
64
64
|
</div>
|
65
65
|
```
|
66
66
|
|
67
|
-
**Result**
|
68
|
-
|
69
|
-
https://github.com/user-attachments/assets/c51ed28c-13d2-4e06-b882-1cc997e9627b
|
70
|
-
|
71
67
|
**Notes:**
|
72
68
|
|
73
69
|
- In general any reference method is snake cased, so `container` target will produce `container_target` and not ~`containerTarget`~
|
@@ -7,7 +7,6 @@ if File.exist? APPLICATION_LAYOUT_PATH
|
|
7
7
|
insert_into_file APPLICATION_LAYOUT_PATH, after: "<%= javascript_importmap_tags %>\n" do
|
8
8
|
<<-ERB
|
9
9
|
<script type="module">
|
10
|
-
import "application"
|
11
10
|
import "<%= javascript_path("opal") %>"
|
12
11
|
</script>
|
13
12
|
ERB
|
@@ -23,14 +22,6 @@ if File.exist? APPLICATION_LAYOUT_PATH
|
|
23
22
|
say "Ensure foreman is installed"
|
24
23
|
run "gem install foreman"
|
25
24
|
end
|
26
|
-
insert_into_file Rails.root.join("app/javascript/controllers/application.js") do
|
27
|
-
<<-JS
|
28
|
-
import { Controller } from "@hotwired/stimulus";
|
29
|
-
|
30
|
-
window.application = application;
|
31
|
-
window.Controller = Controller;
|
32
|
-
JS
|
33
|
-
end
|
34
25
|
append_to_file ".gitignore", "/.opal-cache\n"
|
35
26
|
append_to_file ".gitignore", "app/assets/builds/opal.js\n"
|
36
27
|
append_to_file ".gitignore", "app/assets/builds/opal.js.map\n"
|
data/lib/tasks/build.rake
CHANGED
@@ -14,10 +14,15 @@ namespace :opal_stimulus do
|
|
14
14
|
def compile
|
15
15
|
puts "🔨 Compiling Opal..."
|
16
16
|
|
17
|
+
Opal::Config.esm = true
|
17
18
|
builder = Opal::Builder.new
|
18
19
|
result = builder.build("application")
|
19
20
|
output_path = Rails.root.join("app/assets/builds/opal.js")
|
20
|
-
code =
|
21
|
+
code = [
|
22
|
+
"import { application } from 'controllers/application';",
|
23
|
+
"import { Controller } from '@hotwired/stimulus';",
|
24
|
+
result.to_s
|
25
|
+
].join("\n")
|
21
26
|
|
22
27
|
if Rails.env.development?
|
23
28
|
code += "//# sourceMappingURL=/assets/opal.js.map"
|