wasmify-rails 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d34168c0b9ab6af658deb9e91559fc45ff5d17bb7d015ef8859c216ab9736b41
4
- data.tar.gz: 7049aa93891ea2fde7f911ed87d5f0356f01f99769b77a430aae69dd9db2b8c4
3
+ metadata.gz: 0ec3282837b68355a92061618b21324e72476610f34c9a99538f7af28461836e
4
+ data.tar.gz: 195c3113bfa6d07d8e8f589739e415bbeff0518d5fb3248b8450c997c084fd4e
5
5
  SHA512:
6
- metadata.gz: 43003eafb292715b34a9360426a2f8cd4bc572f8ce9f0494a19999abe48487fa766656bfa6da57bfa3a9e1ab74bb2b1e41db9191208015a85699364e1a9eda29
7
- data.tar.gz: 8879ab43592abc34a0675d7e80763e9030b86cd2145535ec26fe0446465379d0c10f3a7c685d47b4a8165abe6e94714987ad8774ff3e16ce781abaea21699a35
6
+ metadata.gz: 3429caf51620abc60aa2de1ec5b0a81743e15cf95bfc2c39081c48e764e738ae7ec78a6bc8e3b44e0b213238593abf774dbd5a2260217d820e887f663d75c26e
7
+ data.tar.gz: 47907d81582be81de0e2ac6225d70356ca2157a42e627af19dde13dbbe2e59105736c953ac8e7d45acd49f1442423398256adb3a140c15a64f498c53134fad45
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.1.5
6
+
7
+ - Added async mode to rack.js.
8
+
9
+ - Added ability to pass env vars to Ruby VM.
10
+
11
+ - Rails 8 support for `sqlite3_wasm` adapter.
12
+
5
13
  ## 0.1.4
6
14
 
7
15
  - Improve `wasmify:install`.
data/README.md CHANGED
@@ -4,6 +4,9 @@
4
4
 
5
5
  This gem provides tools and extensions to compile Rails applications to WebAssembly.
6
6
 
7
+ > [!NOTE]
8
+ > Read more in our handbook: [Rails on Wasm](https://writebook-on-wasm.fly.dev/5/ruby-on-rails-on-webassembly)
9
+
7
10
  ## Installation
8
11
 
9
12
  Adding to your Gemfile:
@@ -1,12 +1,12 @@
1
- # Stub: SQLite3::ForkSafety.suppress_warnings!
1
+ # Rails 8 compatibility
2
2
  module SQLite3
3
- class BusyException < StandardError
4
- end
5
-
6
3
  module ForkSafety
7
4
  def self.suppress_warnings!
8
5
  end
9
6
  end
7
+
8
+ class BusyException < StandardError
9
+ end
10
10
  end
11
11
 
12
12
  require "active_record/connection_adapters/sqlite3_adapter"
@@ -44,6 +44,12 @@ module ActiveRecord
44
44
  JS.global[js_interface].exec(...)
45
45
  end
46
46
 
47
+ def execute_batch2(...)
48
+ # TODO: it's used by fixtures and truncate_all, so
49
+ # we don't need it right now
50
+ raise NotImplementedError, "sqlite3_wasm#execute_batch2 is not implemented yet"
51
+ end
52
+
47
53
  def busy_timeout(...) = nil
48
54
 
49
55
  def execute(sql)
@@ -195,6 +201,29 @@ module ActiveRecord
195
201
  def database_exists? = true
196
202
 
197
203
  def database_version = SQLite3Adapter::Version.new("3.45.1")
204
+
205
+ # Rails 8 interface
206
+ def perform_query(raw_connection, sql, binds, type_casted_binds, prepare:, notification_payload:, batch: false)
207
+ if batch
208
+ raw_connection.execute_batch2(sql)
209
+ elsif prepare
210
+ raise NotImplementedError, "sqlite3_wasm prepared statements are not implemented yet"
211
+ else
212
+ stmt = raw_connection.prepare(sql)
213
+ result =
214
+ if stmt.column_count.zero?
215
+ ActiveRecord::Result.empty
216
+ else
217
+ ActiveRecord::Result.new(stmt.columns, stmt.to_a)
218
+ end
219
+ end
220
+
221
+ @last_affected_rows = raw_connection.changes
222
+ verified!
223
+
224
+ notification_payload[:row_count] = result&.length || 0
225
+ result
226
+ end
198
227
  end
199
228
  end
200
229
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Wasmify
4
4
  module Rails # :nodoc:
5
- VERSION = "0.1.4"
5
+ VERSION = "0.1.5"
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.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-27 00:00:00.000000000 Z
11
+ date: 2024-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties