view_component 4.0.0.rc5 → 4.0.1
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/docs/CHANGELOG.md +91 -5
- data/lib/view_component/base.rb +8 -0
- data/lib/view_component/collection.rb +8 -0
- data/lib/view_component/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c8e5b159f5df04cb7bb7e4477670ef3953ec682d7167658e1a4d180302d5366
|
4
|
+
data.tar.gz: bfdfb839583d7e7e27f020fcce04baefeaad676e1ca3ae23864e633e343d5b26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f262abd83ace33712a19c8fa38d6aff0c1853c59647c8edd916a079e6398537ae3201eb9fd5cf1ad08836d9835868d0fae52aff307609220930bf59040c8976
|
7
|
+
data.tar.gz: 303778089d5c4621a1ac038b0a240552332cef8e8acc7c1b08ede206b03b51a11c7727a6e42714db307844f86ec2c78e519eaf5fad49fcac461e8f90cc0e73ee
|
data/docs/CHANGELOG.md
CHANGED
@@ -10,6 +10,92 @@ nav_order: 6
|
|
10
10
|
|
11
11
|
## main
|
12
12
|
|
13
|
+
## 4.0.1
|
14
|
+
|
15
|
+
* Setup Trusted Publishing to RubyGems to improve software supply chain safety.
|
16
|
+
|
17
|
+
*Hans Lemuet*
|
18
|
+
|
19
|
+
* Conditionally add the `ViewComponent::Base#format` method back for Rails 7.1 only.
|
20
|
+
* Compute and check lockfiles into source control.
|
21
|
+
* Constrain Rails versions in gemfiles to only allow the patch version to vary, eg. `~> 7.1.0` instead of `~> 7.1`.
|
22
|
+
|
23
|
+
*Cameron Dutro*
|
24
|
+
|
25
|
+
## 4.0.0
|
26
|
+
|
27
|
+
Two years after releasing [3.0.0](https://github.com/ViewComponent/view_component/releases/tag/v3.0.0) and almost six years since [1.0.0](https://github.com/ViewComponent/view_component/releases/tag/v1.0.0), we're proud to ship ViewComponent 4. This release marks a shift towards a Long Term Support model for the project, having reached significant feature maturity. While contributions are always welcome, we're unlikely to accept further breaking changes or major feature additions.
|
28
|
+
|
29
|
+
Please report any issues at [https://github.com/ViewComponent/view_component/issues](https://github.com/ViewComponent/view_component/issues).
|
30
|
+
|
31
|
+
### Breaking changes (production)
|
32
|
+
|
33
|
+
* Remove dependency on `ActionView::Base`, eliminating the need for capture compatibility patch. In some edge cases, this change may require switching to use the `helpers.` proxy.
|
34
|
+
* Require [non-EOL](https://endoflife.date/rails) Rails (`>= 7.1.0`) and Ruby (`>= 3.2.0`).
|
35
|
+
* Remove `render_component` and `render` monkey patch configured with `render_monkey_patch_enabled`.
|
36
|
+
* Remove deprecated `use_helper(s)`. Use `include MyHelper` or `helpers.` proxy instead.
|
37
|
+
* Support compatibility with `Dry::Initializer`. As a result, `EmptyOrInvalidInitializerError` will no longer be raised.
|
38
|
+
* Remove default initializer from `ViewComponent::Base`. Previously, `ViewComponent::Base` defined a catch-all initializer that allowed components without an initializer defined to be passed arbitrary arguments.
|
39
|
+
* Remove `use_deprecated_instrumentation_name` configuration option. Events will always use `render.view_component` name.
|
40
|
+
* Remove unnecessary `#format` methods that returned `nil`.
|
41
|
+
* Remove support for variant names containing `.` to be consistent with Rails.
|
42
|
+
* Rename internal methods to have `__vc_` prefix if they shouldn't be used by consumers. Make internal constants private. Make `Collection#components`, `Slotable#register_polymorphic_slot` private. Remove unused `ComponentError` class.
|
43
|
+
* Use ActionView's `lookup_context` for picking templates instead of the request format.
|
44
|
+
|
45
|
+
3.15 added support for using templates that match the request format, that is if `/resource.csv` is requested then
|
46
|
+
ViewComponents would pick `_component.csv.erb` over `_component.html.erb`.
|
47
|
+
|
48
|
+
With this release, the request format is no longer considered and instead ViewComponent will use the Rails logic for picking the most appropriate template type, that is the csv template will be used if it matches the `Accept` header or because the controller uses a `respond_to` block to pick the response format.
|
49
|
+
|
50
|
+
### Breaking changes (dev/test)
|
51
|
+
|
52
|
+
* Remove `config.view_component.test_controller` in favor of `vc_test_controller_class` test helper method.
|
53
|
+
* `config.view_component.component_parent_class` is now `config.view_component.generate.parent_class`, moving the generator-specific option to the generator configuration namespace.
|
54
|
+
* `config.view_component.view_component_path` is now `config.view_component.generate.path`, as components have long since been able to exist in any directory.
|
55
|
+
* Move previews-related configuration (`enabled`, `route`, `paths`, `default_layout`, `controller`) to under `previews` namespace.
|
56
|
+
* `--inline` generator option now generates inline template. Use `--call` to generate `#call` method.
|
57
|
+
* Remove broken integration with `rails stats` that ignored components outside of `app/components`.
|
58
|
+
* Remove `preview_source` functionality. Consider using [Lookbook](https://lookbook.build/) instead.
|
59
|
+
* Use `Nokogiri::HTML5` instead of `Nokogiri::HTML4` for test helpers.
|
60
|
+
* Move generators to a ViewComponent namespace.
|
61
|
+
|
62
|
+
Before, ViewComponent generators pollute the generator namespace with a bunch of top level items, and claim the generic "component" name.
|
63
|
+
|
64
|
+
Now, generators live in a "view_component" module/namespace, so what was before `rails g
|
65
|
+
component` is now `rails g view_component:component`.
|
66
|
+
|
67
|
+
### New features
|
68
|
+
|
69
|
+
* Add `SystemSpecHelpers` for use with RSpec.
|
70
|
+
* Add support for including `Turbo::StreamsHelper`.
|
71
|
+
* Add template annotations for components with `def call`.
|
72
|
+
* Graduate `SlotableDefault` to be included by default.
|
73
|
+
* Add `#current_template` accessor and `Template#path` for diagnostic usage.
|
74
|
+
* Reduce string allocations during compilation.
|
75
|
+
* Add `around_render` lifecyle method for wrapping component rendering in custom instrumentation, etc.
|
76
|
+
|
77
|
+
### Bug fixes
|
78
|
+
|
79
|
+
* Fix bug where virtual path wasn't reset, breaking translations outside of components.
|
80
|
+
* Fix bug where `config.view_component.previews.enabled` didn't function properly in production environments.
|
81
|
+
* Fix bug in `SlotableDefault` where default couldn't be overridden when content was passed as a block.
|
82
|
+
* Fix bug where request-aware helpers didn't work outside of the request context.
|
83
|
+
* `ViewComponentsSystemTestController` shouldn't be useable outside of test environment
|
84
|
+
|
85
|
+
### Non-functional changes
|
86
|
+
|
87
|
+
* Remove unnecessary usage of `ruby2_keywords`.
|
88
|
+
* Remove unnecessary `respond_to` checks.
|
89
|
+
* Require MFA when publishing to RubyGems.
|
90
|
+
* Clean up project dependencies, relaxing versions of development gems.
|
91
|
+
* Add test case for absolute URL path helpers in mailers.
|
92
|
+
* Update documentation on performance to reflect more representative benchmark showing 2-3x speed increase over partials.
|
93
|
+
* Add documentation note about instrumentation negatively affecting performance.
|
94
|
+
* Remove unnecessary ENABLE_RELOADING test suite flag.
|
95
|
+
* `config.view_component.previews.default_layout` should default to nil.
|
96
|
+
* Add test coverage for uncovered code.
|
97
|
+
* Test against `turbo-rails` `v2` and `rspec-rails` `v7`.
|
98
|
+
|
13
99
|
## 4.0.0.rc5
|
14
100
|
|
15
101
|
* Revert change setting `#format`. In GitHub's codebase, the change led to hard-to-detect failures. For example, components rendered from controllers included layouts when they didn't before. In other cases, the response `content_type` changed, breaking downstream consumers. For cases where a specific content type is needed, use:
|
@@ -56,7 +142,7 @@ Almost six years after releasing [v1.0.0](https://github.com/ViewComponent/view_
|
|
56
142
|
|
57
143
|
Please report any issues at [https://github.com/ViewComponent/view_component/issues](https://github.com/ViewComponent/view_component/issues).
|
58
144
|
|
59
|
-
### Breaking changes (production)
|
145
|
+
### 4.0.0.rc1 Breaking changes (production)
|
60
146
|
|
61
147
|
* Remove dependency on `ActionView::Base`, eliminating the need for capture compatibility patch. In some edge cases, this change may require switching to use the `helpers.` proxy.
|
62
148
|
* Require [non-EOL](https://endoflife.date/rails) Rails (`>= 7.1.0`) and Ruby (`>= 3.2.0`).
|
@@ -75,7 +161,7 @@ Please report any issues at [https://github.com/ViewComponent/view_component/iss
|
|
75
161
|
|
76
162
|
With this release, the request format is no longer considered and instead ViewComponent will use the Rails logic for picking the most appropriate template type, that is the csv template will be used if it matches the `Accept` header or because the controller uses a `respond_to` block to pick the response format.
|
77
163
|
|
78
|
-
### Breaking changes (dev/test)
|
164
|
+
### 4.0.0.rc1 Breaking changes (dev/test)
|
79
165
|
|
80
166
|
* Rename `config.generate.component_parent_class` to `config.generate.parent_class`.
|
81
167
|
* Remove `config.test_controller` in favor of `vc_test_controller_class` test helper method.
|
@@ -93,7 +179,7 @@ Please report any issues at [https://github.com/ViewComponent/view_component/iss
|
|
93
179
|
Now, generators live in a "view_component" module/namespace, so what was before `rails g
|
94
180
|
component` is now `rails g view_component:component`.
|
95
181
|
|
96
|
-
### New features
|
182
|
+
### 4.0.0.rc1 New features
|
97
183
|
|
98
184
|
* Add `SystemSpecHelpers` for use with RSpec.
|
99
185
|
* Add support for including `Turbo::StreamsHelper`.
|
@@ -102,7 +188,7 @@ Please report any issues at [https://github.com/ViewComponent/view_component/iss
|
|
102
188
|
* Add `#current_template` accessor and `Template#path` for diagnostic usage.
|
103
189
|
* Reduce string allocations during compilation.
|
104
190
|
|
105
|
-
### Bug fixes
|
191
|
+
### 4.0.0.rc1 Bug fixes
|
106
192
|
|
107
193
|
* Fix bug where virtual path wasn't reset, breaking translations outside of components.
|
108
194
|
* Fix bug where `config.previews.enabled` didn't function properly in production environments.
|
@@ -111,7 +197,7 @@ Please report any issues at [https://github.com/ViewComponent/view_component/iss
|
|
111
197
|
* Fix bug where request-aware helpers didn't work outside of the request context.
|
112
198
|
* `ViewComponentsSystemTestController` shouldn't be useable outside of test environment
|
113
199
|
|
114
|
-
### Non-functional changes
|
200
|
+
### 4.0.0.rc1 Non-functional changes
|
115
201
|
|
116
202
|
* Remove unnecessary usage of `ruby2_keywords`.
|
117
203
|
* Remove unnecessary `respond_to` checks.
|
data/lib/view_component/base.rb
CHANGED
@@ -316,6 +316,14 @@ module ViewComponent
|
|
316
316
|
[]
|
317
317
|
end
|
318
318
|
|
319
|
+
if Rails::VERSION::MAJOR == 7 && Rails::VERSION::MINOR == 1
|
320
|
+
# Rails expects us to define `format` on all renderables,
|
321
|
+
# but we do not know the `format` of a ViewComponent until runtime.
|
322
|
+
def format
|
323
|
+
nil
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
319
327
|
# The current request. Use sparingly as doing so introduces coupling that
|
320
328
|
# inhibits encapsulation & reuse, often making testing difficult.
|
321
329
|
#
|
@@ -19,6 +19,14 @@ module ViewComponent
|
|
19
19
|
components.each(&block)
|
20
20
|
end
|
21
21
|
|
22
|
+
if Rails::VERSION::MAJOR == 7 && Rails::VERSION::MINOR == 1
|
23
|
+
# Rails expects us to define `format` on all renderables,
|
24
|
+
# but we do not know the `format` of a ViewComponent until runtime.
|
25
|
+
def format
|
26
|
+
nil
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
22
30
|
private
|
23
31
|
|
24
32
|
def components
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: view_component
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ViewComponent Team
|
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
127
|
- !ruby/object:Gem::Version
|
128
128
|
version: '0'
|
129
129
|
requirements: []
|
130
|
-
rubygems_version: 3.6.
|
130
|
+
rubygems_version: 3.6.9
|
131
131
|
specification_version: 4
|
132
132
|
summary: A framework for building reusable, testable & encapsulated view components
|
133
133
|
in Ruby on Rails.
|