opal-vite-rails 0.3.14 → 0.3.16
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/README.md +3 -2
- data/lib/opal/vite/rails/engine.rb +2 -3
- data/lib/opal/vite/rails/version.rb +1 -1
- data/lib/tasks/opal_vite.rake +6 -23
- 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: 4324653e587faaeb544294659054bd01b0815ac4056950d8ee8de78c62fd8778
|
|
4
|
+
data.tar.gz: 00333bbe532cced98a84165a037bbd7df9247ed4cf06c568b0dce4e98cc79b5c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0a7a1739693c6aa93583d2bb0dc48c6dacf18ba215bd0b371d69ee9df396a5774838d9b234918b719d0b07b561c531f925cfe61079a93b9735bc2d4e4f38332e
|
|
7
|
+
data.tar.gz: 6d36e9693f19c772a3f91609a63104bbcbc6cab6bf267b3f542fc3142e218b21836d29200278bfeaac250f1bfe3d8f31fbf86e9b73b68f5ad5567a3a56599466
|
data/README.md
CHANGED
|
@@ -197,9 +197,9 @@ Compile Opal assets:
|
|
|
197
197
|
rake opal_vite:compile
|
|
198
198
|
```
|
|
199
199
|
|
|
200
|
-
This runs Vite build and creates optimized bundles in `public/vite/`.
|
|
200
|
+
This runs the Vite build (through vite_ruby, like `rake vite:build`) and creates optimized bundles in `public/vite/`.
|
|
201
201
|
|
|
202
|
-
|
|
202
|
+
You usually don't need to run it yourself: vite_rails already runs the Vite build, which compiles the Opal sources, as part of `rake assets:precompile`, so deployment on platforms like Heroku works without an extra step.
|
|
203
203
|
|
|
204
204
|
## Rake Tasks
|
|
205
205
|
|
|
@@ -326,6 +326,7 @@ The npm plugin runs the gem's Ruby code, so keep the two in step:
|
|
|
326
326
|
|
|
327
327
|
| vite-plugin-opal (npm) | opal-vite (gem) | opal-vite-rails (gem) | Notes |
|
|
328
328
|
|------------------------|-----------------|-----------------------|-------|
|
|
329
|
+
| >= 0.3.19 | >= 0.3.18 | >= 0.3.14 | `loadPaths` / `arityCheck` / `freezing` are applied when compiling |
|
|
329
330
|
| >= 0.3.16 | >= 0.3.15 | >= 0.3.14 | Shared runtime: corelib is loaded once |
|
|
330
331
|
| >= 0.3.16 | 0.3.12 – 0.3.14 | — | Works; each `.rb` bundle carries its own corelib (warning at startup) |
|
|
331
332
|
| >= 0.3.16 | < 0.3.12 | — | Works without the `stubs` option (using it fails with a clear error) |
|
|
@@ -49,9 +49,8 @@ module Opal
|
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
end
|
|
52
|
+
# lib/tasks/*.rake is loaded by Rails::Engine automatically; loading it
|
|
53
|
+
# again here would define every task action twice.
|
|
55
54
|
|
|
56
55
|
generators do
|
|
57
56
|
require_relative "generators/install_generator"
|
data/lib/tasks/opal_vite.rake
CHANGED
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
namespace :opal_vite do
|
|
2
|
-
|
|
2
|
+
# Opal sources are compiled by the Vite build (vite-plugin-opal), so this
|
|
3
|
+
# delegates to vite_ruby, the same build `rake vite:build` runs. vite_rails
|
|
4
|
+
# already hooks that build into `assets:precompile`, so nothing is added
|
|
5
|
+
# there.
|
|
6
|
+
desc "Compile Opal assets for production (runs the Vite build)"
|
|
3
7
|
task compile: :environment do
|
|
4
|
-
require "opal/vite/rails"
|
|
5
|
-
|
|
6
8
|
puts "Compiling Opal assets..."
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
unless system("which vite > /dev/null 2>&1")
|
|
10
|
-
puts "Error: Vite is not installed. Run 'npm install' first."
|
|
11
|
-
exit 1
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
# Run Vite build
|
|
15
|
-
puts "Running Vite build..."
|
|
16
|
-
system("npm run build") || system("npx vite build")
|
|
10
|
+
abort "❌ Vite build failed" unless ViteRuby.commands.build
|
|
17
11
|
|
|
18
12
|
puts "✅ Opal assets compiled successfully!"
|
|
19
13
|
end
|
|
20
14
|
|
|
21
15
|
desc "Clean compiled Opal assets"
|
|
22
16
|
task clean: :environment do
|
|
23
|
-
require "opal/vite/rails"
|
|
24
|
-
|
|
25
17
|
puts "Cleaning Opal assets..."
|
|
26
18
|
|
|
27
19
|
vite_dir = Rails.public_path.join("vite")
|
|
@@ -35,8 +27,6 @@ namespace :opal_vite do
|
|
|
35
27
|
|
|
36
28
|
desc "Show Opal-Vite configuration"
|
|
37
29
|
task info: :environment do
|
|
38
|
-
require "opal/vite/rails"
|
|
39
|
-
|
|
40
30
|
puts "\n" + "="*60
|
|
41
31
|
puts "Opal-Vite Rails Configuration"
|
|
42
32
|
puts "="*60
|
|
@@ -56,10 +46,3 @@ namespace :opal_vite do
|
|
|
56
46
|
puts "\n" + "="*60
|
|
57
47
|
end
|
|
58
48
|
end
|
|
59
|
-
|
|
60
|
-
# Add compile task to assets:precompile
|
|
61
|
-
if Rake::Task.task_defined?("assets:precompile")
|
|
62
|
-
Rake::Task["assets:precompile"].enhance do
|
|
63
|
-
Rake::Task["opal_vite:compile"].invoke
|
|
64
|
-
end
|
|
65
|
-
end
|