stimulus_reflex 3.4.0.pre2 → 3.4.0.pre3

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.

Potentially problematic release.


This version of stimulus_reflex might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b151dbe96ba7014f31215a419b430c62dd44887dbd3d5c6cce93f32c738523c
4
- data.tar.gz: f1279d2c57eaf8be1be8915b00e476be06958ad5a8b57b8f8f996517ad49c68e
3
+ metadata.gz: 344e0b60c7f18f467821263a5758cc37843cfae000430754ed89d34214363ff3
4
+ data.tar.gz: a49f8d18df8d0e2f4d664a70690fd562fd7d4fcc9db3f22d7821f96f67dee03d
5
5
  SHA512:
6
- metadata.gz: 53bc87673b0019845548f6f5c41f741154a64ced9314d6799c9725faea5a03d1b2d1e55a6d9f812d96dc7fa72b0a8b89c51bbe9547da29b9680483bf689754c7
7
- data.tar.gz: b7b5bff6e3d19d9eb1557a55dc2924986fcc125c14b54c25e2737d9513ea2bd22cdcf63282b25139f1081ff097d3a45e5fbeb9c476d291f2d9ee2715cecf7d26
6
+ metadata.gz: cd85f6455c20f2cad48a8e4c7bda0fe6e46e50fa6bb39d2c67c128a899edd96d815798b913b928ae08c75fb8f55421483249f6acec34e26428a7114fa7e3eb67
7
+ data.tar.gz: 3fbb2e6be0b867db5c05997aa0727642e0298d0c13ad14e31c3f811ca4e6b4188db5154ea0c7ada5aeca8a3fb456c6998e35d0f4616e3fa03c636fc710b33056
@@ -2,7 +2,21 @@
2
2
 
3
3
  ## [Unreleased](https://github.com/hopsoft/stimulus_reflex/tree/HEAD)
4
4
 
5
- [Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.4.0.pre1...HEAD)
5
+ [Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.4.0.pre2...HEAD)
6
+
7
+ **Merged pull requests:**
8
+
9
+ - Allow to supress warnings for sanity checks [\#359](https://github.com/hopsoft/stimulus_reflex/pull/359) ([RolandStuder](https://github.com/RolandStuder))
10
+ - serializeForm: only append given input if element is submit button [\#357](https://github.com/hopsoft/stimulus_reflex/pull/357) ([marcoroth](https://github.com/marcoroth))
11
+ - Update package.json to 3.4.0-pre2 [\#356](https://github.com/hopsoft/stimulus_reflex/pull/356) ([marcoroth](https://github.com/marcoroth))
12
+ - Fix elementToXPath import [\#355](https://github.com/hopsoft/stimulus_reflex/pull/355) ([julianrubisch](https://github.com/julianrubisch))
13
+ - Add guard clause to return valid empty form data [\#354](https://github.com/hopsoft/stimulus_reflex/pull/354) ([julianrubisch](https://github.com/julianrubisch))
14
+ - simplify xpath functions [\#353](https://github.com/hopsoft/stimulus_reflex/pull/353) ([leastbad](https://github.com/leastbad))
15
+ - pass reflex id to reflex [\#352](https://github.com/hopsoft/stimulus_reflex/pull/352) ([joshleblanc](https://github.com/joshleblanc))
16
+
17
+ ## [v3.4.0.pre2](https://github.com/hopsoft/stimulus_reflex/tree/v3.4.0.pre2) (2020-11-06)
18
+
19
+ [Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.4.0.pre1...v3.4.0.pre2)
6
20
 
7
21
  **Closed issues:**
8
22
 
@@ -351,7 +365,7 @@
351
365
 
352
366
  **Fixed bugs:**
353
367
 
354
- - Pluralize the generated class name, so that will match with the file name [\#178](https://github.com/hopsoft/stimulus_reflex/pull/178) ([darkrubyist](https://github.com/darkrubyist))
368
+ - Pluralize the generated class name, so that will match with the file name [\#178](https://github.com/hopsoft/stimulus_reflex/pull/178) ([dark88888](https://github.com/dark88888))
355
369
 
356
370
  **Closed issues:**
357
371
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stimulus_reflex (3.4.0.pre2)
4
+ stimulus_reflex (3.4.0.pre3)
5
5
  nokogiri
6
6
  rack
7
7
  rails (>= 5.2)
@@ -92,7 +92,7 @@ GEM
92
92
  nio4r (2.5.4)
93
93
  nokogiri (1.10.10)
94
94
  mini_portile2 (~> 2.4.0)
95
- parallel (1.19.2)
95
+ parallel (1.20.0)
96
96
  parser (2.7.2.0)
97
97
  ast (~> 2.4.1)
98
98
  pry (0.12.2)
@@ -134,13 +134,13 @@ GEM
134
134
  redis (4.2.2)
135
135
  regexp_parser (1.8.2)
136
136
  rexml (3.2.4)
137
- rubocop (1.0.0)
137
+ rubocop (1.2.0)
138
138
  parallel (~> 1.10)
139
139
  parser (>= 2.7.1.5)
140
140
  rainbow (>= 2.2.2, < 4.0)
141
141
  regexp_parser (>= 1.8)
142
142
  rexml
143
- rubocop-ast (>= 0.6.0)
143
+ rubocop-ast (>= 1.0.1)
144
144
  ruby-progressbar (~> 1.7)
145
145
  unicode-display_width (>= 1.4.0, < 2.0)
146
146
  rubocop-ast (1.1.1)
@@ -156,14 +156,14 @@ GEM
156
156
  actionpack (>= 4.0)
157
157
  activesupport (>= 4.0)
158
158
  sprockets (>= 3.0.0)
159
- standard (0.8.1)
160
- rubocop (= 1.0.0)
159
+ standard (0.9.0)
160
+ rubocop (= 1.2.0)
161
161
  rubocop-performance (= 1.8.1)
162
162
  standardrb (1.0.0)
163
163
  standard
164
164
  thor (1.0.1)
165
165
  thread_safe (0.3.6)
166
- tzinfo (1.2.7)
166
+ tzinfo (1.2.8)
167
167
  thread_safe (~> 0.1)
168
168
  unicode-display_width (1.7.0)
169
169
  websocket-driver (0.7.3)
data/README.md CHANGED
@@ -54,7 +54,7 @@ And, it's fast.
54
54
 
55
55
  It works seamlessly with the Rails tooling you already know and love.
56
56
 
57
- - Server-rendered HTML, delivered in miliseconds over the wire via Websockets
57
+ - Server-rendered HTML, delivered in milliseconds over the wire via Websockets
58
58
  - ERB templates and partials, with first-class [ViewComponent](https://github.com/github/view_component) support
59
59
  - [Russian doll caching](https://edgeguides.rubyonrails.org/caching_with_rails.html#russian-doll-caching) and [ActiveJob](https://guides.rubyonrails.org/active_job_basics.html)
60
60
  - [StimulusJS](https://stimulusjs.org/) and [Turbolinks](https://www.youtube.com/watch?v=SWEts0rlezA)
@@ -32,7 +32,14 @@ class StimulusReflex::Channel < StimulusReflex.configuration.parent_channel.cons
32
32
  begin
33
33
  begin
34
34
  reflex_class = reflex_name.constantize.tap { |klass| raise ArgumentError.new("#{reflex_name} is not a StimulusReflex::Reflex") unless is_reflex?(klass) }
35
- reflex = reflex_class.new(self, url: url, element: element, selectors: selectors, method_name: method_name, permanent_attribute_name: permanent_attribute_name, params: params)
35
+ reflex = reflex_class.new(self,
36
+ url: url,
37
+ element: element,
38
+ selectors: selectors,
39
+ method_name: method_name,
40
+ permanent_attribute_name: permanent_attribute_name,
41
+ params: params,
42
+ reflex_id: data["reflexId"])
36
43
  delegate_call_to_reflex reflex, method_name, arguments
37
44
  rescue => invoke_error
38
45
  message = exception_message_with_backtrace(invoke_error)
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  StimulusReflex.configure do |config|
4
- # Enable/disable whether startup should be aborted when the sanity checks fail
5
- # config.exit_on_failed_sanity_checks = true
4
+ # Enable/disable exiting / warning when the sanity checks fail options:
5
+ # `:exit` or `:warn` or `:ignore`
6
+ # config.on_failed_sanity_checks = :exit
6
7
 
7
8
  # Override the parent class that the StimulusReflex ActionCable channel inherits from
8
9
  # config.parent_channel = "ApplicationCable::Channel"
@@ -14,10 +14,10 @@ module StimulusReflex
14
14
  end
15
15
 
16
16
  class Configuration
17
- attr_accessor :exit_on_failed_sanity_checks, :parent_channel
17
+ attr_accessor :on_failed_sanity_checks, :parent_channel
18
18
 
19
19
  def initialize
20
- @exit_on_failed_sanity_checks = true
20
+ @on_failed_sanity_checks = :exit
21
21
  @parent_channel = "ApplicationCable::Channel"
22
22
  end
23
23
  end
@@ -43,7 +43,7 @@ class StimulusReflex::Reflex
43
43
  end
44
44
  end
45
45
 
46
- attr_reader :channel, :url, :element, :selectors, :method_name, :broadcaster, :permanent_attribute_name
46
+ attr_reader :channel, :url, :element, :selectors, :method_name, :broadcaster, :permanent_attribute_name, :reflex_id
47
47
 
48
48
  alias_method :action_name, :method_name # for compatibility with controller libraries like Pundit that expect an action name
49
49
 
@@ -51,7 +51,7 @@ class StimulusReflex::Reflex
51
51
  delegate :flash, :session, to: :request
52
52
  delegate :broadcast, :broadcast_message, to: :broadcaster
53
53
 
54
- def initialize(channel, url: nil, element: nil, selectors: [], method_name: nil, permanent_attribute_name: nil, params: {})
54
+ def initialize(channel, url: nil, element: nil, selectors: [], method_name: nil, permanent_attribute_name: nil, params: {}, reflex_id: nil)
55
55
  @channel = channel
56
56
  @url = url
57
57
  @element = element
@@ -60,6 +60,7 @@ class StimulusReflex::Reflex
60
60
  @params = params
61
61
  @permanent_attribute_name = permanent_attribute_name
62
62
  @broadcaster = StimulusReflex::PageBroadcaster.new(self)
63
+ @reflex_id = reflex_id
63
64
  self.params
64
65
  end
65
66
 
@@ -4,6 +4,8 @@ class StimulusReflex::SanityChecker
4
4
  JSON_VERSION_FORMAT = /(\d+\.\d+\.\d+.*)"/
5
5
 
6
6
  def self.check!
7
+ return if StimulusReflex.config.on_failed_sanity_checks == :ignore
8
+
7
9
  instance = new
8
10
  instance.check_caching_enabled
9
11
  instance.check_javascript_package_version
@@ -80,19 +82,50 @@ class StimulusReflex::SanityChecker
80
82
  Rails.root.join("node_modules", "stimulus_reflex", "package.json")
81
83
  end
82
84
 
85
+ def initializer_path
86
+ @_initializer_path ||= Rails.root.join("config", "initializers", "stimulus_reflex.rb")
87
+ end
88
+
83
89
  def warn_and_exit(text)
84
90
  puts "WARNING:"
85
91
  puts text
86
- exit_with_info if StimulusReflex.config.exit_on_failed_sanity_checks
92
+ exit_with_info if StimulusReflex.config.on_failed_sanity_checks == :exit
87
93
  end
88
94
 
89
95
  def exit_with_info
90
96
  puts
91
- puts <<~INFO
92
- If you know what you are doing and you want to start the application anyway,
93
- you can add the following directive to an initializer:
94
- StimulusReflex.config.exit_on_failed_sanity_checks = false
95
- INFO
97
+
98
+ # bundle exec rails generate stimulus_reflex:config
99
+ if File.exist?(initializer_path)
100
+ puts <<~INFO
101
+ If you know what you are doing and you want to start the application anyway,
102
+ you can add the following directive to the StimulusReflex initializer,
103
+ which is located at #{initializer_path}
104
+
105
+ StimulusReflex.configure do |config|
106
+ config.on_failed_sanity_checks = :warn
107
+ end
108
+
109
+ INFO
110
+ else
111
+ puts <<~INFO
112
+ If you know what you are doing and you want to start the application anyway,
113
+ you can create a StimulusReflex initializer with the command:
114
+
115
+ bundle exec rails generate stimulus_reflex:config
116
+
117
+ Then open your initializer at
118
+
119
+ <RAILS_ROOT>/config/initializers/stimulus_reflex.rb
120
+
121
+ and then add the following directive:
122
+
123
+ StimulusReflex.configure do |config|
124
+ config.on_failed_sanity_checks = :warn
125
+ end
126
+
127
+ INFO
128
+ end
96
129
  exit
97
130
  end
98
131
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StimulusReflex
4
- VERSION = "3.4.0.pre2"
4
+ VERSION = "3.4.0.pre3"
5
5
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stimulus_reflex",
3
- "version": "3.3.0",
3
+ "version": "3.4.0-pre2",
4
4
  "description": "Build reactive applications with the Rails tooling you already know and love.",
5
5
  "keywords": [
6
6
  "ruby",
data/yarn.lock CHANGED
@@ -1534,10 +1534,10 @@ builtin-modules@^3.1.0:
1534
1534
  resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484"
1535
1535
  integrity sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==
1536
1536
 
1537
- cable_ready@^4.4.0-pre0:
1538
- version "4.4.0-pre1"
1539
- resolved "https://registry.yarnpkg.com/cable_ready/-/cable_ready-4.4.0-pre1.tgz#b9a262cefb539a9a87bd71da56835a7ba7d93653"
1540
- integrity sha512-V71BpFB9Q9KCHEWH3kzz3umaFpafMb7khr3TTZclO1xnepwPTiWgWEMqSv2afaQlPtqH6FEpr0UNK6dH4GwrSA==
1537
+ cable_ready@^4.4.0-pre2:
1538
+ version "4.4.0-pre2"
1539
+ resolved "https://registry.yarnpkg.com/cable_ready/-/cable_ready-4.4.0-pre2.tgz#8a970f9117425c5346218a900e24b74fd5d1ddea"
1540
+ integrity sha512-p1PVlVpGW7WVQNrttcaStJ1c+wuoG4fRuyoJJ7hAloZPQu2koPpeO0R48J+iomq4ZRfOmCGTe6I49r/cg/8DJw==
1541
1541
  dependencies:
1542
1542
  morphdom "^2.6.1"
1543
1543
 
@@ -2695,11 +2695,6 @@ form-data@~2.3.2:
2695
2695
  combined-stream "^1.0.6"
2696
2696
  mime-types "^2.1.12"
2697
2697
 
2698
- "form-serialize@>= 0.7.2":
2699
- version "0.7.2"
2700
- resolved "https://registry.yarnpkg.com/form-serialize/-/form-serialize-0.7.2.tgz#b0a2ff0c22026fb6d3d15c9d33f6de6a432e4732"
2701
- integrity sha1-sKL/DCICb7bT0VydM/beakMuRzI=
2702
-
2703
2698
  fs-extra@8.1.0:
2704
2699
  version "8.1.0"
2705
2700
  resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stimulus_reflex
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0.pre2
4
+ version: 3.4.0.pre3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Hopkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-06 00:00:00.000000000 Z
11
+ date: 2020-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack