wasmify-rails 0.2.1 → 0.2.3
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 +14 -0
- data/lib/generators/wasmify/pwa/pwa_generator.rb +1 -1
- data/lib/generators/wasmify/pwa/templates/pwa/boot.html +128 -96
- data/lib/generators/wasmify/pwa/templates/pwa/vite.config.js +10 -0
- data/lib/rack/data_uri_uploads.rb +3 -0
- data/lib/wasmify/rails/builder.rb +11 -6
- data/lib/wasmify/rails/packer.rb +1 -1
- data/lib/wasmify/rails/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a391ad32c5709fedb1427c1802781700d9f71a7c9b18633369440246a89ade7e
|
4
|
+
data.tar.gz: db08da5b58547b4ec76874fdec3adecea88c99178f6aa863fc2e95c5e2f14942
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b823f898970c450844294c43bcbb2776c0ce6c0ec1953213a798cf203d3f42b61d503a768a1f74a0173a9f4a7c72346612ace29a7caea39020c52ad9cc133e6
|
7
|
+
data.tar.gz: 4c3b55592d56940b857a9b6424dbefa859435630a53f9ef05b6e71351e96788084ced7b4cdddc801d4fc8c8fd3893c91e2e339b362f59af33a4c23e39eecc71f
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,20 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 0.2.3
|
6
|
+
|
7
|
+
- Add `skipInitialize` option to `initVM`.
|
8
|
+
|
9
|
+
- Only skip extensions building for excluded gems.
|
10
|
+
|
11
|
+
## 0.2.2
|
12
|
+
|
13
|
+
- Fix handling multipart uploads in Data URI middleware.
|
14
|
+
|
15
|
+
- PWA template improvements.
|
16
|
+
|
17
|
+
## 0.2.1
|
18
|
+
|
5
19
|
- Minor generators updates.
|
6
20
|
|
7
21
|
## 0.2.0
|
@@ -1,102 +1,134 @@
|
|
1
1
|
<!doctype html>
|
2
2
|
<html lang="en">
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8" />
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
6
|
+
<meta name="og:title" content="Rails on Wasm" />
|
7
|
+
<meta name="og:description" content="Rails on Wasm launcher" />
|
8
|
+
<title>Rails on Wasm | Launch</title>
|
9
|
+
<script type="module" src="/boot.js"></script>
|
10
|
+
<style>
|
11
|
+
main {
|
12
|
+
max-width: 800px;
|
13
|
+
margin: 0 auto;
|
14
|
+
padding: 1em;
|
15
|
+
}
|
16
|
+
|
17
|
+
#boot-console-output {
|
18
|
+
background-color: #0c0c0c;
|
19
|
+
color: #f8f8f2;
|
20
|
+
font-family: monospace;
|
21
|
+
font-size: 0.8em;
|
22
|
+
padding: 1em;
|
23
|
+
white-space: pre-wrap;
|
24
|
+
min-height: 200px;
|
25
|
+
overflow-y: scroll;
|
26
|
+
margin-top: 0;
|
27
|
+
}
|
28
|
+
|
29
|
+
#buttons {
|
30
|
+
display: flex;
|
31
|
+
justify-content: flex-start;
|
32
|
+
gap: 0.5em;
|
33
|
+
}
|
34
|
+
|
35
|
+
#launch-button {
|
36
|
+
background-color: #007bff;
|
37
|
+
color: #fff;
|
38
|
+
border: none;
|
39
|
+
padding: 0.5em 1em;
|
40
|
+
font-size: 1em;
|
41
|
+
cursor: pointer;
|
42
|
+
border: 1px solid #007bff;
|
43
|
+
}
|
44
|
+
#launch-button:disabled {
|
45
|
+
background-color: #ccc;
|
46
|
+
border-color: #000;
|
47
|
+
color: #666;
|
48
|
+
}
|
49
|
+
#reboot-button {
|
50
|
+
background-color: #dc3545;
|
51
|
+
color: #fff;
|
52
|
+
border: none;
|
53
|
+
padding: 0.5em 1em;
|
54
|
+
font-size: 1em;
|
55
|
+
cursor: pointer;
|
56
|
+
border: 1px solid #dc3545;
|
57
|
+
}
|
58
|
+
#reboot-button:disabled {
|
59
|
+
background-color: #ccc;
|
60
|
+
color: #666;
|
61
|
+
border-color: #000;
|
62
|
+
}
|
63
|
+
#reload-button {
|
64
|
+
background-color: #eeeeee;
|
65
|
+
color: #333;
|
66
|
+
border: none;
|
67
|
+
padding: 0.5em 1em;
|
68
|
+
font-size: 1em;
|
69
|
+
cursor: pointer;
|
70
|
+
border: 1px solid #333;
|
71
|
+
}
|
72
|
+
#reload-button:disabled {
|
73
|
+
background-color: #ccc;
|
74
|
+
color: #666;
|
75
|
+
}
|
76
|
+
#reload-debug-button {
|
77
|
+
background-color: rgb(159, 166, 40);
|
78
|
+
color: #000;
|
79
|
+
border: none;
|
80
|
+
padding: 0.5em 1em;
|
81
|
+
font-size: 1em;
|
82
|
+
cursor: pointer;
|
83
|
+
border: 1px solid #000;
|
84
|
+
}
|
85
|
+
#reload-debug-button:disabled {
|
86
|
+
background-color: #ccc;
|
87
|
+
color: #666;
|
88
|
+
}
|
89
|
+
|
90
|
+
header {
|
91
|
+
display: flex;
|
92
|
+
justify-content: space-between;
|
93
|
+
align-items: center;
|
94
|
+
margin-bottom: 1em;
|
95
|
+
}
|
96
|
+
|
97
|
+
.header--links {
|
98
|
+
display: flex;
|
99
|
+
gap: 1em;
|
100
|
+
}
|
101
|
+
</style>
|
102
|
+
</head>
|
103
|
+
<body>
|
104
|
+
<main>
|
105
|
+
<header>
|
76
106
|
<h1>Rails on Wasm 🚀</h1>
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
107
|
+
</header>
|
108
|
+
<p>
|
109
|
+
Wait for the Service Worker to install and boot the app, and then hit
|
110
|
+
the "Launch" button to run a Rails application in your browser!
|
111
|
+
</p>
|
81
112
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
113
|
+
<p id="buttons">
|
114
|
+
<button id="launch-button" disabled>Launch</button>
|
115
|
+
<button id="reload-button" disabled>Reload Rails</button>
|
116
|
+
<button id="reload-debug-button" disabled>
|
117
|
+
Reload Rails (debug mode)
|
118
|
+
</button>
|
119
|
+
<button id="reboot-button" disabled>Hard Reset*</button>
|
120
|
+
</p>
|
90
121
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
</
|
122
|
+
<div id="boot-message"></div>
|
123
|
+
<progress id="boot-progress" max="100" value="0"></progress>
|
124
|
+
<pre id="boot-console-output"></pre>
|
125
|
+
<hr />
|
126
|
+
<p>
|
127
|
+
<small>
|
128
|
+
* Please ensure you close all tabs of this app before rebooting to
|
129
|
+
unregister the old Service Worker.
|
130
|
+
</small>
|
131
|
+
</p>
|
132
|
+
</main>
|
133
|
+
</body>
|
102
134
|
</html>
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import path from "path";
|
2
|
+
|
1
3
|
import { defineConfig } from "vite";
|
2
4
|
import { VitePWA } from "vite-plugin-pwa";
|
3
5
|
|
@@ -11,6 +13,14 @@ export default defineConfig({
|
|
11
13
|
optimizeDeps: {
|
12
14
|
exclude: ["@sqlite.org/sqlite-wasm"],
|
13
15
|
},
|
16
|
+
build: {
|
17
|
+
rollupOptions: {
|
18
|
+
input: {
|
19
|
+
main: path.resolve(__dirname, 'index.html'),
|
20
|
+
boot: path.resolve(__dirname, 'boot.html'),
|
21
|
+
},
|
22
|
+
},
|
23
|
+
},
|
14
24
|
plugins: [
|
15
25
|
VitePWA({
|
16
26
|
srcDir: ".",
|
@@ -21,6 +21,7 @@ module Rack
|
|
21
21
|
|
22
22
|
if request.post? || request.put? || request.patch?
|
23
23
|
transform_params(request.params)
|
24
|
+
env["action_dispatch.request.request_parameters"] = request.params
|
24
25
|
end
|
25
26
|
|
26
27
|
@app.call(env)
|
@@ -48,6 +49,8 @@ module Rack
|
|
48
49
|
encoding = matches[2]
|
49
50
|
data = matches[3]
|
50
51
|
|
52
|
+
return if data.empty?
|
53
|
+
|
51
54
|
file_data = Base64.decode64(data)
|
52
55
|
|
53
56
|
file = Tempfile.new(["upload", mime_to_extension(content_type)])
|
@@ -9,8 +9,6 @@ module Wasmify
|
|
9
9
|
module Rails
|
10
10
|
# A wrapper for rbwasm build command
|
11
11
|
class Builder
|
12
|
-
ORIGINAL_EXCLUDED_GEMS = RubyWasm::Packager::EXCLUDED_GEMS.dup.freeze
|
13
|
-
|
14
12
|
attr_reader :output_dir, :target
|
15
13
|
|
16
14
|
def initialize(output_dir: Wasmify::Rails.config.tmp_dir, target: Wasmify::Rails.config.wasm_target)
|
@@ -19,19 +17,26 @@ module Wasmify
|
|
19
17
|
end
|
20
18
|
|
21
19
|
def run(name:, exclude_gems: [], opts: "")
|
22
|
-
|
23
|
-
RubyWasm::Packager::EXCLUDED_GEMS.replace(ORIGINAL_EXCLUDED_GEMS)
|
20
|
+
$exclude_exts = []
|
24
21
|
|
25
22
|
# Add configured excluded gems
|
26
23
|
Wasmify::Rails.config.exclude_gems.each do |gem_name|
|
27
|
-
|
24
|
+
$exclude_exts << gem_name
|
28
25
|
end
|
29
26
|
|
30
27
|
# Add additional excluded gems
|
31
28
|
exclude_gems.each do |gem_name|
|
32
|
-
|
29
|
+
$exclude_exts << gem_name
|
33
30
|
end
|
34
31
|
|
32
|
+
RubyWasm::Packager::Core::BuildStrategy.prepend(Module.new do
|
33
|
+
def specs_with_extensions
|
34
|
+
super.reject do |spec|
|
35
|
+
$exclude_exts.include?(spec.first.name)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end)
|
39
|
+
|
35
40
|
opts = opts&.split(" ") || []
|
36
41
|
|
37
42
|
args = %W(
|
data/lib/wasmify/rails/packer.rb
CHANGED
@@ -20,7 +20,7 @@ module Wasmify
|
|
20
20
|
|
21
21
|
def run(ruby_wasm_path:, name:, directories: Wasmify::Rails.config.pack_directories, storage_dir: nil)
|
22
22
|
unless system("which wasi-vfs > /dev/null 2>&1")
|
23
|
-
raise "wasi-vfs is required to pack the application.\n"
|
23
|
+
raise "wasi-vfs is required to pack the application.\n" +
|
24
24
|
"Please see installations instructions at: https://github.com/kateinoigakukun/wasi-vfs"
|
25
25
|
end
|
26
26
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wasmify-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Dementyev
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -181,7 +181,7 @@ metadata:
|
|
181
181
|
documentation_uri: https://github.com/palkan/wasmify-rails
|
182
182
|
homepage_uri: https://github.com/palkan/wasmify-rails
|
183
183
|
source_code_uri: https://github.com/palkan/wasmify-rails
|
184
|
-
post_install_message:
|
184
|
+
post_install_message:
|
185
185
|
rdoc_options: []
|
186
186
|
require_paths:
|
187
187
|
- lib
|
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
197
|
version: '0'
|
198
198
|
requirements: []
|
199
199
|
rubygems_version: 3.5.22
|
200
|
-
signing_key:
|
200
|
+
signing_key:
|
201
201
|
specification_version: 4
|
202
202
|
summary: Tools and extensions to package Rails apps as Wasm modules
|
203
203
|
test_files: []
|