isorun 0.1.10 → 0.1.11

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: 968cad4844c6646df5d3492b22e6077e2f36654337ba9cb19a87cd21f9af045e
4
- data.tar.gz: 49b653bbbcce1260640f9d3ac796c9d00eefe15e6d3c2bac6a4acca8d88cf700
3
+ metadata.gz: 724881750024f3660d4f7219113d5fe5a13bdb53c5e31edf8cad5bb4ef5bb5ff
4
+ data.tar.gz: 156a1e08ccf8613c5652c7414c305d2d55c3080de11a6414f07e72817dc48240
5
5
  SHA512:
6
- metadata.gz: a2fd42b1dbcbf4422c41625286a703a45f324e9a40fa50102b5a923a977b0db5f004e296221654c0686fdf2682b06cc5aca56ea94d7e01d97ca753e984793452
7
- data.tar.gz: 988fe5c9be7e93ee246376c169903845da2d36597316feea591ef03536b3bfdb09b60640153e7dfd6355dc8ae9adf16d088726a6e0aaa97c6526e8e263b3aba7
6
+ metadata.gz: '09398ad2ec130ec4a559a3bf78d063c0b6a5c15cc0cf7ad6b745048598c6eb4b8f3add11e3c2e58f841d78f802ff13ebfd13b4017a50c8f14a8cd396a84161b9'
7
+ data.tar.gz: cc650db902d6c942ec49743f76543a1812b5ef3772f953796902a27919a4ffd4a375ab0d5fc7c48c2d0bdc06ec44a96ff47993a9ca7a5e321eb10432208deced
@@ -19,14 +19,15 @@ module Isorun
19
19
  # convention, the target node (e.g. `<div id="my_app">`)
20
20
  # @param [Hash] options All valid tag options can also passed as options
21
21
  # to this method
22
+ # @param [Hash, nil] ctx Pass variables to render context
22
23
  # @return [String]
23
- def isorun_app(id, options = nil) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
24
+ def isorun_app(id, options = nil, ctx: nil) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
24
25
  ActiveSupport::Notifications.instrument "start.render.isorun", { ts: Time.current }
25
26
 
26
27
  module_path = Isorun.config.module_resolver.call(id)
27
28
 
28
29
  ssr_html = Isorun::Context.create(receiver: Isorun.config.receiver) do |context|
29
- render_context = { environment: Rails.env.to_s }
30
+ render_context = { environment: Rails.env.to_s }.merge(ctx)
30
31
  render_function = context.import.from(module_path)
31
32
 
32
33
  if render_function.blank?
@@ -20,8 +20,9 @@ module Isorun
20
20
  # convention, the target node (e.g. `<div id="my_app">`)
21
21
  # @param [Hash] options All valid tag options can also passed as options
22
22
  # to this method
23
+ # @param [Hash, nil] ctx Pass variables to render context
23
24
  # @return [String]
24
- def isorun_vite_app(id, options = nil)
25
+ def isorun_vite_app(id, options = nil, ctx: nil)
25
26
  ActiveSupport::Notifications.instrument "start.render.isorun", { ts: Time.current }
26
27
 
27
28
  # if id has a file extension, we extract the extension and reduce the ID
@@ -32,7 +33,7 @@ module Isorun
32
33
  module_path = Isorun.config.module_resolver.call(id)
33
34
 
34
35
  ssr_html = Isorun::Context.create(receiver: Isorun.config.receiver) do |context|
35
- render_context = { environment: Rails.env.to_s }
36
+ render_context = { environment: Rails.env.to_s }.merge(ctx)
36
37
  render_function = context.import.from(module_path)
37
38
 
38
39
  if render_function.blank?
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "isorun"
3
- version = "0.1.10"
3
+ version = "0.1.11"
4
4
  edition = "2021"
5
5
  authors = ["Hannes Moser <box@hannesmoser.at>"]
6
6
  homepage = "https://github.com/eliias/isorun"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Isorun
4
- VERSION = "0.1.10"
4
+ VERSION = "0.1.11"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isorun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hannes Moser