js_from_routes 2.1.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -0
- data/lib/js_from_routes/generator.rb +3 -2
- data/lib/js_from_routes/template.js.erb +1 -1
- data/lib/js_from_routes/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5be06720d112b28716ce584184abba22d15b44917d3032bc6bb926781a028a9
|
4
|
+
data.tar.gz: 6bc27e4de388e7e1420b598ca53f51bcf5d04feea736ad491c8de3c0195516da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23722e80af9943f268a65ae51c93856a70b16fc192146b3f83bb6d2fb81ab1c3c62671912380348f0398e26548b3798654797d78c575aa7839f90c29c1433b83
|
7
|
+
data.tar.gz: dd3702554cb2f815d2efa3f4733b83698e46efd0c05ef12999a39e7e026f1c1cb6b871dac3e1e6e4b46df94833cc64157c6ea49cc5e589fa5d4d75e7d60bc393
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,29 @@
|
|
1
|
+
## [3.0.1](https://github.com/ElMassimo/js_from_routes/compare/js_from_routes@3.0.0...js_from_routes@3.0.1) (2023-10-09)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* allow rollup to tree-shake unused path helpers ([150ccd9](https://github.com/ElMassimo/js_from_routes/commit/150ccd9dd616ce448b50ae6c2807dd7f5678479d))
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
# [3.0.0](https://github.com/ElMassimo/js_from_routes/compare/js_from_routes@2.1.0...js_from_routes@3.0.0) (2023-10-09)
|
11
|
+
|
12
|
+
|
13
|
+
### Features
|
14
|
+
|
15
|
+
* add `export_if` to allow using custom `:export` values ([fd1776c](https://github.com/ElMassimo/js_from_routes/commit/fd1776cc91402f1e9a9003031cb9fd6c3a0d63f9))
|
16
|
+
|
17
|
+
* **breaking:** no longer map `index` to `list` and `show` to `get` ([5eb3f48](https://github.com/ElMassimo/js_from_routes/commit/5eb3f48de71fe38ee1c67d9b91a81d71a437e1a8))
|
18
|
+
|
19
|
+
If you want to preserve the old behavior:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
JsFromRoutes.config do |config|
|
23
|
+
config.helper_mappings = {"index" => "list", "show" => "get"}
|
24
|
+
end
|
25
|
+
```
|
26
|
+
|
1
27
|
# [2.1.0](https://github.com/ElMassimo/js_from_routes/compare/js_from_routes@2.0.6...js_from_routes@2.1.0) (2023-02-07)
|
2
28
|
|
3
29
|
|
@@ -174,8 +174,9 @@ module JsFromRoutes
|
|
174
174
|
{
|
175
175
|
all_helpers_file: true,
|
176
176
|
client_library: "@js-from-routes/client",
|
177
|
+
export_if: ->(route) { route.defaults.fetch(:export, nil) },
|
177
178
|
file_suffix: "Api.js",
|
178
|
-
helper_mappings: {
|
179
|
+
helper_mappings: {},
|
179
180
|
output_folder: root.join("app", dir, "api"),
|
180
181
|
template_path: File.expand_path("template.js.erb", __dir__),
|
181
182
|
template_all_path: File.expand_path("template_all.js.erb", __dir__),
|
@@ -186,7 +187,7 @@ module JsFromRoutes
|
|
186
187
|
# Internal: Returns exported routes grouped by controller name.
|
187
188
|
def exported_routes_by_controller(routes)
|
188
189
|
routes.select { |route|
|
189
|
-
|
190
|
+
config.export_if.call(route) && route.requirements[:controller]
|
190
191
|
}.group_by { |route|
|
191
192
|
route.requirements.fetch(:controller)
|
192
193
|
}
|
@@ -4,6 +4,6 @@ import { definePathHelper } from '<%= client_library %>'
|
|
4
4
|
|
5
5
|
export default {
|
6
6
|
<% routes.each do |route| %>
|
7
|
-
<%= route.helper %>: definePathHelper('<%= route.verb %>', '<%= route.path %>'),
|
7
|
+
<%= route.helper %>: /* #__PURE__ */ definePathHelper('<%= route.verb %>', '<%= route.path %>'),
|
8
8
|
<% end %>
|
9
9
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: js_from_routes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Máximo Mussini
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -167,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
167
|
- !ruby/object:Gem::Version
|
168
168
|
version: '0'
|
169
169
|
requirements: []
|
170
|
-
rubygems_version: 3.
|
170
|
+
rubygems_version: 3.4.10
|
171
171
|
signing_key:
|
172
172
|
specification_version: 4
|
173
173
|
summary: Generate JS automatically from Rails routes.
|