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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 615df0740a9931fc1b029ac2a8c77f4f5ff5c6bddacc3d188478d31ee5cc43d9
4
- data.tar.gz: 9ddabc5d8422088507b781cd117b28c6b79095b1b154ff56b31ad9633ddf90a2
3
+ metadata.gz: a391ad32c5709fedb1427c1802781700d9f71a7c9b18633369440246a89ade7e
4
+ data.tar.gz: db08da5b58547b4ec76874fdec3adecea88c99178f6aa863fc2e95c5e2f14942
5
5
  SHA512:
6
- metadata.gz: d6d5a1d436fa0dd77ae3bb59f6a81c0f58e68e22416dfe4a3a3832c95e049ed0b9ec35f8033a63b0642bca1f391291e7a1786e65771a342c285937408205e0cc
7
- data.tar.gz: 7b60876fe1baf69aba5b4b659e826cd95ede5bf8485e2feac17b4b0860374172f2e412b47068cda5b26305dea9982401d1d72e9f5aae09b501ccd48dd0caf7ac
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
@@ -9,7 +9,7 @@ class Wasmify::PwaGenerator < Rails::Generators::Base
9
9
 
10
10
  def configure_wasm_dist
11
11
  prepend_to_file "config/wasmify.yml", <<~EOF
12
- output_dir: pwa
12
+ output_dir: pwa/public
13
13
  EOF
14
14
  end
15
15
 
@@ -1,102 +1,134 @@
1
1
  <!doctype html>
2
2
  <html lang="en">
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
- #boot-console-output {
12
- background-color: #0c0c0c;
13
- color: #f8f8f2;
14
- font-family: monospace;
15
- font-size: 0.8em;
16
- padding: 1em;
17
- white-space: pre-wrap;
18
- min-height: 200px;
19
- overflow-y: scroll;
20
- }
21
- #launch-button {
22
- background-color: #007bff;
23
- color: #fff;
24
- border: none;
25
- padding: 0.5em 1em;
26
- font-size: 1em;
27
- cursor: pointer;
28
- border: 1px solid #ccc;
29
- }
30
- #launch-button:disabled {
31
- background-color: #ccc;
32
- color: #666;
33
- }
34
- #reboot-button {
35
- background-color: #dc3545;
36
- color: #fff;
37
- border: none;
38
- padding: 0.5em 1em;
39
- font-size: 1em;
40
- cursor: pointer;
41
- border: 1px solid #ccc;
42
- }
43
- #reboot-button:disabled {
44
- background-color: #ccc;
45
- color: #666;
46
- }
47
- #reload-button {
48
- background-color: #eeeeee;
49
- color: #333;
50
- border: none;
51
- padding: 0.5em 1em;
52
- font-size: 1em;
53
- cursor: pointer;
54
- border: 1px solid #333;
55
- }
56
- #reload-button:disabled {
57
- background-color: #ccc;
58
- color: #666;
59
- }
60
- #reload-debug-button {
61
- background-color: rgb(159, 166, 40);
62
- color: #000;
63
- border: none;
64
- padding: 0.5em 1em;
65
- font-size: 1em;
66
- cursor: pointer;
67
- border: 1px solid #000;
68
- }
69
- #reload-debug-button:disabled {
70
- background-color: #ccc;
71
- color: #666;
72
- }
73
- </style>
74
- </head>
75
- <body>
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
- <p>
78
- Wait for the Service Worker to install and boot the app. This may
79
- take a while.
80
- </p>
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
- <p>
83
- <button id="launch-button" disabled>Launch</button>
84
- <button id="reload-button" disabled>Reload Rails</button>
85
- <button id="reload-debug-button" disabled>
86
- Reload Rails (debug mode)
87
- </button>
88
- <button id="reboot-button" disabled>Hard Reset*</button>
89
- </p>
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
- <div id="boot-message"></div>
92
- <progress id="boot-progress" max="100" value="0"></progress>
93
- <pre id="boot-console-output"></pre>
94
- <hr />
95
- <p>
96
- <small>
97
- * Please ensure you close all tabs of this app before rebooting
98
- to unregister the old Service Worker.
99
- </small>
100
- </p>
101
- </body>
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
- # Reset excluded gems
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
- RubyWasm::Packager::EXCLUDED_GEMS << gem_name
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
- RubyWasm::Packager::EXCLUDED_GEMS << gem_name
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(
@@ -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
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Wasmify
4
4
  module Rails # :nodoc:
5
- VERSION = "0.2.1"
5
+ VERSION = "0.2.3"
6
6
  end
7
7
  end
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.1
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: 2024-12-17 00:00:00.000000000 Z
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: []