js-routes 2.2.8 → 2.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -9
  3. data/Gemfile +5 -0
  4. data/Readme.md +60 -45
  5. data/bin/tapioca +27 -0
  6. data/js-routes.gemspec +4 -1
  7. data/lib/js_routes/configuration.rb +80 -34
  8. data/lib/js_routes/engine.rb +2 -0
  9. data/lib/js_routes/generators/base.rb +14 -0
  10. data/lib/js_routes/generators/middleware.rb +3 -6
  11. data/lib/js_routes/generators/webpacker.rb +1 -3
  12. data/lib/js_routes/instance.rb +42 -15
  13. data/lib/js_routes/middleware.rb +14 -3
  14. data/lib/js_routes/route.rb +57 -16
  15. data/lib/js_routes/types.rb +28 -0
  16. data/lib/js_routes/version.rb +2 -1
  17. data/lib/js_routes.rb +20 -7
  18. data/sorbet/config +4 -0
  19. data/sorbet/rbi/annotations/.gitattributes +1 -0
  20. data/sorbet/rbi/annotations/actionpack.rbi +428 -0
  21. data/sorbet/rbi/annotations/actionview.rbi +75 -0
  22. data/sorbet/rbi/annotations/activesupport.rbi +421 -0
  23. data/sorbet/rbi/annotations/railties.rbi +61 -0
  24. data/sorbet/rbi/gems/.gitattributes +1 -0
  25. data/sorbet/rbi/gems/actionpack@7.0.4.1.rbi +303 -0
  26. data/sorbet/rbi/gems/actionview@7.0.4.1.rbi +8 -0
  27. data/sorbet/rbi/gems/activesupport@7.0.4.1.rbi +16424 -0
  28. data/sorbet/rbi/gems/appraisal@2.4.1.rbi +584 -0
  29. data/sorbet/rbi/gems/builder@3.2.4.rbi +8 -0
  30. data/sorbet/rbi/gems/bump@0.10.0.rbi +168 -0
  31. data/sorbet/rbi/gems/byebug@11.1.3.rbi +3606 -0
  32. data/sorbet/rbi/gems/coderay@1.1.3.rbi +3426 -0
  33. data/sorbet/rbi/gems/concurrent-ruby@1.2.0.rbi +11570 -0
  34. data/sorbet/rbi/gems/crass@1.0.6.rbi +8 -0
  35. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1083 -0
  36. data/sorbet/rbi/gems/erubi@1.12.0.rbi +145 -0
  37. data/sorbet/rbi/gems/i18n@1.12.0.rbi +2296 -0
  38. data/sorbet/rbi/gems/libv8-node@16.10.0.0.rbi +8 -0
  39. data/sorbet/rbi/gems/loofah@2.19.1.rbi +8 -0
  40. data/sorbet/rbi/gems/method_source@1.0.0.rbi +272 -0
  41. data/sorbet/rbi/gems/mini_racer@0.6.3.rbi +224 -0
  42. data/sorbet/rbi/gems/minitest@5.17.0.rbi +1457 -0
  43. data/sorbet/rbi/gems/netrc@0.11.0.rbi +158 -0
  44. data/sorbet/rbi/gems/nokogiri@1.14.0.rbi +8 -0
  45. data/sorbet/rbi/gems/parallel@1.24.0.rbi +280 -0
  46. data/sorbet/rbi/gems/prettier_print@1.2.1.rbi +951 -0
  47. data/sorbet/rbi/gems/prism@0.24.0.rbi +29744 -0
  48. data/sorbet/rbi/gems/pry-byebug@3.10.1.rbi +1150 -0
  49. data/sorbet/rbi/gems/pry@0.14.2.rbi +10075 -0
  50. data/sorbet/rbi/gems/racc@1.6.2.rbi +150 -0
  51. data/sorbet/rbi/gems/rack-test@2.0.2.rbi +8 -0
  52. data/sorbet/rbi/gems/rack@2.2.6.2.rbi +5585 -0
  53. data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +8 -0
  54. data/sorbet/rbi/gems/rails-html-sanitizer@1.5.0.rbi +8 -0
  55. data/sorbet/rbi/gems/railties@7.0.4.1.rbi +1959 -0
  56. data/sorbet/rbi/gems/rake@13.0.6.rbi +3072 -0
  57. data/sorbet/rbi/gems/rbi@0.1.9.rbi +3006 -0
  58. data/sorbet/rbi/gems/rspec-core@3.12.0.rbi +10868 -0
  59. data/sorbet/rbi/gems/rspec-expectations@3.12.2.rbi +8100 -0
  60. data/sorbet/rbi/gems/rspec-mocks@3.12.3.rbi +5299 -0
  61. data/sorbet/rbi/gems/rspec-support@3.12.0.rbi +1611 -0
  62. data/sorbet/rbi/gems/rspec@3.12.0.rbi +82 -0
  63. data/sorbet/rbi/gems/spoom@1.2.4.rbi +3777 -0
  64. data/sorbet/rbi/gems/sprockets-rails@3.4.2.rbi +14 -0
  65. data/sorbet/rbi/gems/sprockets@4.2.0.rbi +8 -0
  66. data/sorbet/rbi/gems/syntax_tree@6.2.0.rbi +23136 -0
  67. data/sorbet/rbi/gems/tapioca@0.12.0.rbi +3510 -0
  68. data/sorbet/rbi/gems/thor@1.2.1.rbi +3956 -0
  69. data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +5914 -0
  70. data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +428 -0
  71. data/sorbet/rbi/gems/yard@0.9.34.rbi +18332 -0
  72. data/sorbet/rbi/gems/zeitwerk@2.6.8.rbi +8 -0
  73. data/sorbet/rbi/todo.rbi +31 -0
  74. data/sorbet/tapioca/config.yml +13 -0
  75. data/sorbet/tapioca/require.rb +4 -0
  76. data/spec/js_routes/module_types/dts_spec.rb +17 -2
  77. data/spec/js_routes/module_types/umd_spec.rb +1 -1
  78. data/spec/js_routes/options_spec.rb +6 -6
  79. metadata +81 -6
@@ -0,0 +1,8 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `zeitwerk` gem.
5
+ # Please instead update this file by running `bin/tapioca gem zeitwerk`.
6
+
7
+ # THIS IS AN EMPTY RBI FILE.
8
+ # see https://github.com/Shopify/tapioca#manually-requiring-parts-of-a-gem
@@ -0,0 +1,31 @@
1
+ # DO NOT EDIT MANUALLY
2
+ # This is an autogenerated file for unresolved constants.
3
+ # Please instead update this file by running `bin/tapioca todo`.
4
+
5
+ # typed: false
6
+
7
+ module ::Rhino; end
8
+ module ActionController::MimeResponds::Collector; end
9
+ module ActionDispatch::Flash::FlashHash; end
10
+ module ActionDispatch::Http::Headers; end
11
+ module ActionDispatch::Request::Session; end
12
+ module ActionDispatch::Response; end
13
+ module ActionDispatch::Response::Header; end
14
+ module ActionDispatch::TestRequest; end
15
+ module ActionDispatch::TestResponse; end
16
+ module ActionView::Base; end
17
+ module ActionView::Helpers::SanitizeHelper::ClassMethods; end
18
+ module ActionView::Helpers::TagHelper; end
19
+ module ActionView::Helpers::UrlHelper::ClassMethods; end
20
+ module ActionView::Layouts::ClassMethods; end
21
+ module ActionView::Rendering::ClassMethods; end
22
+ module ActionView::Template::Error; end
23
+ module ActiveSupport::HashWithIndifferentAccess; end
24
+ module MiniRacer::JSError; end
25
+ module Rack::Test::CookieJar; end
26
+ module Sprockets::Context; end
27
+ module Sprockets::VERSION; end
28
+ module Webpacker; end
29
+ class ActionView::ActionViewError; end
30
+ class AbstractController::Base; end
31
+ class ActionController::Base; end
@@ -0,0 +1,13 @@
1
+ gem:
2
+ # Add your `gem` command parameters here:
3
+ #
4
+ # exclude:
5
+ # - gem_name
6
+ # doc: true
7
+ # workers: 5
8
+ dsl:
9
+ # Add your `dsl` command parameters here:
10
+ #
11
+ # exclude:
12
+ # - SomeGeneratorName
13
+ # workers: 5
@@ -0,0 +1,4 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ # Add your extra requires here (`bin/tapioca require` can be used to bootstrap this list)
@@ -6,13 +6,19 @@ require "spec_helper"
6
6
 
7
7
  describe JsRoutes, "compatibility with DTS" do
8
8
 
9
- OPTIONS = {module_type: 'DTS', include: [/^inboxes$/, /^inbox_message_attachment$/]}
9
+ INCLUDE_OPTION = [/^inboxes$/, /^inbox_message_attachment$/]
10
+ OPTIONS = {module_type: 'DTS', include: INCLUDE_OPTION}
11
+
10
12
  let(:extra_options) do
11
13
  {}
12
14
  end
13
15
 
16
+ let(:options) do
17
+ { module_type: 'DTS', include: INCLUDE_OPTION, **extra_options }
18
+ end
19
+
14
20
  let(:generated_js) do
15
- JsRoutes.generate(**OPTIONS, **extra_options)
21
+ JsRoutes.generate(**options)
16
22
  end
17
23
 
18
24
  context "when file is generated" do
@@ -108,4 +114,13 @@ DOC
108
114
  is_expected.to include("export const inbox_message_path = /*#__PURE__*/ __jsr.r(")
109
115
  end
110
116
  end
117
+
118
+ describe ".definitions" do
119
+ let(:extra_options) { { module_type: 'ESM' } }
120
+
121
+ it "uses DTS module automatically" do
122
+ generated_js = JsRoutes.definitions(**options)
123
+ expect(generated_js).to include('export {};')
124
+ end
125
+ end
111
126
  end
@@ -15,7 +15,7 @@ describe JsRoutes, "compatibility with UMD" do
15
15
  app_class = "App"
16
16
 
17
17
  is_expected.to include("File generated by js-routes #{JsRoutes::VERSION}")
18
- is_expected.to include("Based on Rails #{ActionPack.version} routes of #{app_class}")
18
+ is_expected.to include("Based on Rails #{Rails.version} routes of #{app_class}")
19
19
  end
20
20
 
21
21
  it "should call route function for each route" do
@@ -64,7 +64,7 @@ describe JsRoutes, "options" do
64
64
 
65
65
  context "when exclude is specified" do
66
66
 
67
- let(:_options) { {:exclude => /^admin_/} }
67
+ let(:_options) { {exclude: [/^admin_/]} }
68
68
 
69
69
  it "should exclude specified routes from file" do
70
70
  expectjs("Routes.admin_users_path").to be_nil
@@ -75,7 +75,7 @@ describe JsRoutes, "options" do
75
75
  end
76
76
 
77
77
  context "for rails engine" do
78
- let(:_options) { {:exclude => /^blog_app_posts/} }
78
+ let(:_options) { {:exclude => [/^blog_app_posts/]} }
79
79
 
80
80
  it "should exclude specified engine route" do
81
81
  expectjs("Routes.blog_app_posts_path").to be_nil
@@ -85,7 +85,7 @@ describe JsRoutes, "options" do
85
85
 
86
86
  context "when include is specified" do
87
87
 
88
- let(:_options) { {:include => /^admin_/} }
88
+ let(:_options) { {include: [/^admin_/]} }
89
89
 
90
90
  it "should exclude specified routes from file" do
91
91
  expectjs("Routes.admin_users_path()").not_to be_nil
@@ -96,7 +96,7 @@ describe JsRoutes, "options" do
96
96
  end
97
97
 
98
98
  context "with camel_case option" do
99
- let(:_options) { {include: /^admin_/, camel_case: true} }
99
+ let(:_options) { {include: [/^admin_/], camel_case: true} }
100
100
 
101
101
  it "should exclude specified routes from file" do
102
102
  expectjs("Routes.adminUsersPath()").not_to be_nil
@@ -108,7 +108,7 @@ describe JsRoutes, "options" do
108
108
  end
109
109
 
110
110
  context "for rails engine" do
111
- let(:_options) { {:include => /^blog_app_posts/} }
111
+ let(:_options) { {include: [/^blog_app_posts/]} }
112
112
 
113
113
  it "should include specified engine route" do
114
114
  expectjs("Routes.blog_app_posts_path()").not_to be_nil
@@ -490,7 +490,7 @@ describe JsRoutes, "options" do
490
490
  end
491
491
 
492
492
  describe "when application is specified" do
493
- let(:_options) { {:application => BlogEngine::Engine} }
493
+ let(:_options) { {application: -> {BlogEngine::Engine}} }
494
494
 
495
495
  it "should include specified engine route" do
496
496
  expectjs("Routes.posts_path()").not_to be_nil
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: js-routes
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.8
4
+ version: 2.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bogdan Gusiev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-16 00:00:00.000000000 Z
11
+ date: 2024-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sorbet-runtime
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: sprockets-rails
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +72,14 @@ dependencies:
58
72
  requirements:
59
73
  - - ">="
60
74
  - !ruby/object:Gem::Version
61
- version: 1.1.0
75
+ version: 2.2.25
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - ">="
67
81
  - !ruby/object:Gem::Version
68
- version: 1.1.0
82
+ version: 2.2.25
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: appraisal
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -158,6 +172,7 @@ files:
158
172
  - Readme.md
159
173
  - VERSION_2_UPGRADE.md
160
174
  - app/assets/javascripts/js-routes.js.erb
175
+ - bin/tapioca
161
176
  - gemfiles/rails50_sprockets_3.gemfile
162
177
  - gemfiles/rails51_sprockets_3.gemfile
163
178
  - gemfiles/rails52_sprockets_3.gemfile
@@ -173,6 +188,7 @@ files:
173
188
  - lib/js_routes/instance.rb
174
189
  - lib/js_routes/middleware.rb
175
190
  - lib/js_routes/route.rb
191
+ - lib/js_routes/types.rb
176
192
  - lib/js_routes/version.rb
177
193
  - lib/routes.d.ts
178
194
  - lib/routes.js
@@ -182,6 +198,64 @@ files:
182
198
  - lib/templates/initializer.rb
183
199
  - lib/templates/routes.js.erb
184
200
  - package.json
201
+ - sorbet/config
202
+ - sorbet/rbi/annotations/.gitattributes
203
+ - sorbet/rbi/annotations/actionpack.rbi
204
+ - sorbet/rbi/annotations/actionview.rbi
205
+ - sorbet/rbi/annotations/activesupport.rbi
206
+ - sorbet/rbi/annotations/railties.rbi
207
+ - sorbet/rbi/gems/.gitattributes
208
+ - sorbet/rbi/gems/actionpack@7.0.4.1.rbi
209
+ - sorbet/rbi/gems/actionview@7.0.4.1.rbi
210
+ - sorbet/rbi/gems/activesupport@7.0.4.1.rbi
211
+ - sorbet/rbi/gems/appraisal@2.4.1.rbi
212
+ - sorbet/rbi/gems/builder@3.2.4.rbi
213
+ - sorbet/rbi/gems/bump@0.10.0.rbi
214
+ - sorbet/rbi/gems/byebug@11.1.3.rbi
215
+ - sorbet/rbi/gems/coderay@1.1.3.rbi
216
+ - sorbet/rbi/gems/concurrent-ruby@1.2.0.rbi
217
+ - sorbet/rbi/gems/crass@1.0.6.rbi
218
+ - sorbet/rbi/gems/diff-lcs@1.5.0.rbi
219
+ - sorbet/rbi/gems/erubi@1.12.0.rbi
220
+ - sorbet/rbi/gems/i18n@1.12.0.rbi
221
+ - sorbet/rbi/gems/libv8-node@16.10.0.0.rbi
222
+ - sorbet/rbi/gems/loofah@2.19.1.rbi
223
+ - sorbet/rbi/gems/method_source@1.0.0.rbi
224
+ - sorbet/rbi/gems/mini_racer@0.6.3.rbi
225
+ - sorbet/rbi/gems/minitest@5.17.0.rbi
226
+ - sorbet/rbi/gems/netrc@0.11.0.rbi
227
+ - sorbet/rbi/gems/nokogiri@1.14.0.rbi
228
+ - sorbet/rbi/gems/parallel@1.24.0.rbi
229
+ - sorbet/rbi/gems/prettier_print@1.2.1.rbi
230
+ - sorbet/rbi/gems/prism@0.24.0.rbi
231
+ - sorbet/rbi/gems/pry-byebug@3.10.1.rbi
232
+ - sorbet/rbi/gems/pry@0.14.2.rbi
233
+ - sorbet/rbi/gems/racc@1.6.2.rbi
234
+ - sorbet/rbi/gems/rack-test@2.0.2.rbi
235
+ - sorbet/rbi/gems/rack@2.2.6.2.rbi
236
+ - sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi
237
+ - sorbet/rbi/gems/rails-html-sanitizer@1.5.0.rbi
238
+ - sorbet/rbi/gems/railties@7.0.4.1.rbi
239
+ - sorbet/rbi/gems/rake@13.0.6.rbi
240
+ - sorbet/rbi/gems/rbi@0.1.9.rbi
241
+ - sorbet/rbi/gems/rspec-core@3.12.0.rbi
242
+ - sorbet/rbi/gems/rspec-expectations@3.12.2.rbi
243
+ - sorbet/rbi/gems/rspec-mocks@3.12.3.rbi
244
+ - sorbet/rbi/gems/rspec-support@3.12.0.rbi
245
+ - sorbet/rbi/gems/rspec@3.12.0.rbi
246
+ - sorbet/rbi/gems/spoom@1.2.4.rbi
247
+ - sorbet/rbi/gems/sprockets-rails@3.4.2.rbi
248
+ - sorbet/rbi/gems/sprockets@4.2.0.rbi
249
+ - sorbet/rbi/gems/syntax_tree@6.2.0.rbi
250
+ - sorbet/rbi/gems/tapioca@0.12.0.rbi
251
+ - sorbet/rbi/gems/thor@1.2.1.rbi
252
+ - sorbet/rbi/gems/tzinfo@2.0.5.rbi
253
+ - sorbet/rbi/gems/yard-sorbet@0.8.1.rbi
254
+ - sorbet/rbi/gems/yard@0.9.34.rbi
255
+ - sorbet/rbi/gems/zeitwerk@2.6.8.rbi
256
+ - sorbet/rbi/todo.rbi
257
+ - sorbet/tapioca/config.yml
258
+ - sorbet/tapioca/require.rb
185
259
  - spec/dummy/app/assets/config/manifest.js
186
260
  - spec/dummy/app/assets/javascripts/.gitkeep
187
261
  - spec/dummy/config/routes.rb
@@ -206,7 +280,8 @@ files:
206
280
  homepage: http://github.com/railsware/js-routes
207
281
  licenses:
208
282
  - MIT
209
- metadata: {}
283
+ metadata:
284
+ github_repo: ssh://github.com/railsware/js-routes
210
285
  post_install_message:
211
286
  rdoc_options: []
212
287
  require_paths:
@@ -222,7 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
297
  - !ruby/object:Gem::Version
223
298
  version: '0'
224
299
  requirements: []
225
- rubygems_version: 3.4.15
300
+ rubygems_version: 3.2.22
226
301
  signing_key:
227
302
  specification_version: 4
228
303
  summary: Brings Rails named routes to javascript