js-routes 2.2.9 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -3
  3. data/Readme.md +16 -15
  4. data/lib/js_routes/configuration.rb +7 -5
  5. data/lib/js_routes/generators/base.rb +6 -1
  6. data/lib/js_routes/generators/middleware.rb +2 -3
  7. data/lib/js_routes/generators/webpacker.rb +2 -1
  8. data/lib/js_routes/instance.rb +21 -6
  9. data/lib/js_routes/middleware.rb +5 -4
  10. data/lib/js_routes/route.rb +7 -3
  11. data/lib/js_routes/types.rb +10 -0
  12. data/lib/js_routes/utils.rb +18 -0
  13. data/lib/js_routes/version.rb +1 -1
  14. data/lib/js_routes.rb +12 -4
  15. data/lib/routes.d.ts +7 -6
  16. data/lib/routes.js +19 -18
  17. data/lib/routes.ts +33 -27
  18. data/lib/tasks/js_routes.rake +4 -2
  19. metadata +12 -145
  20. data/.document +0 -5
  21. data/.eslintrc.js +0 -15
  22. data/.github/workflows/ci.yml +0 -36
  23. data/.gitignore +0 -65
  24. data/.nvmrc +0 -1
  25. data/.rspec +0 -1
  26. data/Appraisals +0 -17
  27. data/Gemfile +0 -9
  28. data/Rakefile +0 -37
  29. data/VERSION_2_UPGRADE.md +0 -66
  30. data/bin/tapioca +0 -27
  31. data/gemfiles/rails50_sprockets_3.gemfile +0 -8
  32. data/gemfiles/rails51_sprockets_3.gemfile +0 -8
  33. data/gemfiles/rails52_sprockets_3.gemfile +0 -8
  34. data/gemfiles/rails70_sprockets_4.gemfile +0 -8
  35. data/js-routes.gemspec +0 -42
  36. data/package.json +0 -38
  37. data/sorbet/config +0 -4
  38. data/sorbet/rbi/annotations/.gitattributes +0 -1
  39. data/sorbet/rbi/annotations/actionpack.rbi +0 -428
  40. data/sorbet/rbi/annotations/actionview.rbi +0 -75
  41. data/sorbet/rbi/annotations/activesupport.rbi +0 -421
  42. data/sorbet/rbi/annotations/railties.rbi +0 -61
  43. data/sorbet/rbi/gems/.gitattributes +0 -1
  44. data/sorbet/rbi/gems/actionpack@7.0.4.1.rbi +0 -303
  45. data/sorbet/rbi/gems/actionview@7.0.4.1.rbi +0 -8
  46. data/sorbet/rbi/gems/activesupport@7.0.4.1.rbi +0 -16424
  47. data/sorbet/rbi/gems/appraisal@2.4.1.rbi +0 -584
  48. data/sorbet/rbi/gems/builder@3.2.4.rbi +0 -8
  49. data/sorbet/rbi/gems/bump@0.10.0.rbi +0 -168
  50. data/sorbet/rbi/gems/byebug@11.1.3.rbi +0 -3606
  51. data/sorbet/rbi/gems/coderay@1.1.3.rbi +0 -3426
  52. data/sorbet/rbi/gems/concurrent-ruby@1.2.0.rbi +0 -11570
  53. data/sorbet/rbi/gems/crass@1.0.6.rbi +0 -8
  54. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +0 -1083
  55. data/sorbet/rbi/gems/erubi@1.12.0.rbi +0 -145
  56. data/sorbet/rbi/gems/i18n@1.12.0.rbi +0 -2296
  57. data/sorbet/rbi/gems/libv8-node@16.10.0.0.rbi +0 -8
  58. data/sorbet/rbi/gems/loofah@2.19.1.rbi +0 -8
  59. data/sorbet/rbi/gems/method_source@1.0.0.rbi +0 -272
  60. data/sorbet/rbi/gems/mini_racer@0.6.3.rbi +0 -224
  61. data/sorbet/rbi/gems/minitest@5.17.0.rbi +0 -1457
  62. data/sorbet/rbi/gems/netrc@0.11.0.rbi +0 -158
  63. data/sorbet/rbi/gems/nokogiri@1.14.0.rbi +0 -8
  64. data/sorbet/rbi/gems/parallel@1.24.0.rbi +0 -280
  65. data/sorbet/rbi/gems/prettier_print@1.2.1.rbi +0 -951
  66. data/sorbet/rbi/gems/prism@0.24.0.rbi +0 -29744
  67. data/sorbet/rbi/gems/pry-byebug@3.10.1.rbi +0 -1150
  68. data/sorbet/rbi/gems/pry@0.14.2.rbi +0 -10075
  69. data/sorbet/rbi/gems/racc@1.6.2.rbi +0 -150
  70. data/sorbet/rbi/gems/rack-test@2.0.2.rbi +0 -8
  71. data/sorbet/rbi/gems/rack@2.2.6.2.rbi +0 -5585
  72. data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +0 -8
  73. data/sorbet/rbi/gems/rails-html-sanitizer@1.5.0.rbi +0 -8
  74. data/sorbet/rbi/gems/railties@7.0.4.1.rbi +0 -1959
  75. data/sorbet/rbi/gems/rake@13.0.6.rbi +0 -3072
  76. data/sorbet/rbi/gems/rbi@0.1.9.rbi +0 -3006
  77. data/sorbet/rbi/gems/rspec-core@3.12.0.rbi +0 -10868
  78. data/sorbet/rbi/gems/rspec-expectations@3.12.2.rbi +0 -8100
  79. data/sorbet/rbi/gems/rspec-mocks@3.12.3.rbi +0 -5299
  80. data/sorbet/rbi/gems/rspec-support@3.12.0.rbi +0 -1611
  81. data/sorbet/rbi/gems/rspec@3.12.0.rbi +0 -82
  82. data/sorbet/rbi/gems/spoom@1.2.4.rbi +0 -3777
  83. data/sorbet/rbi/gems/sprockets-rails@3.4.2.rbi +0 -14
  84. data/sorbet/rbi/gems/sprockets@4.2.0.rbi +0 -8
  85. data/sorbet/rbi/gems/syntax_tree@6.2.0.rbi +0 -23136
  86. data/sorbet/rbi/gems/tapioca@0.12.0.rbi +0 -3510
  87. data/sorbet/rbi/gems/thor@1.2.1.rbi +0 -3956
  88. data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +0 -5914
  89. data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +0 -428
  90. data/sorbet/rbi/gems/yard@0.9.34.rbi +0 -18332
  91. data/sorbet/rbi/gems/zeitwerk@2.6.8.rbi +0 -8
  92. data/sorbet/rbi/todo.rbi +0 -31
  93. data/sorbet/tapioca/config.yml +0 -13
  94. data/sorbet/tapioca/require.rb +0 -4
  95. data/spec/dummy/app/assets/config/manifest.js +0 -2
  96. data/spec/dummy/app/assets/javascripts/.gitkeep +0 -0
  97. data/spec/dummy/config/routes.rb +0 -55
  98. data/spec/js_routes/default_serializer_spec.rb +0 -31
  99. data/spec/js_routes/module_types/amd_spec.rb +0 -35
  100. data/spec/js_routes/module_types/cjs_spec.rb +0 -15
  101. data/spec/js_routes/module_types/dts/routes.spec.d.ts +0 -115
  102. data/spec/js_routes/module_types/dts/test.spec.ts +0 -56
  103. data/spec/js_routes/module_types/dts_spec.rb +0 -126
  104. data/spec/js_routes/module_types/esm_spec.rb +0 -45
  105. data/spec/js_routes/module_types/nil_spec.rb +0 -87
  106. data/spec/js_routes/module_types/umd_spec.rb +0 -85
  107. data/spec/js_routes/options_spec.rb +0 -508
  108. data/spec/js_routes/rails_routes_compatibility_spec.rb +0 -473
  109. data/spec/js_routes/route_specification_spec.rb +0 -37
  110. data/spec/js_routes/zzz_sprockets_spec.rb +0 -152
  111. data/spec/spec_helper.rb +0 -135
  112. data/spec/support/routes.rb +0 -81
  113. data/spec/tsconfig.json +0 -4
  114. data/tsconfig.json +0 -28
  115. data/yarn.lock +0 -2457
data/lib/routes.ts CHANGED
@@ -4,6 +4,8 @@
4
4
  */
5
5
 
6
6
  type Optional<T> = { [P in keyof T]?: T[P] | null };
7
+ type Collection<T> = Record<string, T>;
8
+
7
9
  type BaseRouteParameter = string | boolean | Date | number;
8
10
  type MethodRouteParameter = BaseRouteParameter | (() => BaseRouteParameter);
9
11
  type ModelRouteParameter =
@@ -16,9 +18,9 @@ type QueryRouteParameter =
16
18
  | OptionalRouteParameter
17
19
  | QueryRouteParameter[]
18
20
  | { [k: string]: QueryRouteParameter };
19
- type RouteParameters = Record<string, QueryRouteParameter>;
21
+ type RouteParameters = Collection<QueryRouteParameter>;
20
22
 
21
- type Serializable = Record<string, unknown>;
23
+ type Serializable = Collection<unknown>;
22
24
  type Serializer = (value: Serializable) => string;
23
25
  type RouteHelperExtras = {
24
26
  requiredParams(): string[];
@@ -40,14 +42,14 @@ type RequiredParameters<T extends number> = T extends 1
40
42
  ]
41
43
  : RequiredRouteParameter[];
42
44
 
43
- type RouteHelperOptions = RouteOptions & Record<string, OptionalRouteParameter>;
45
+ type RouteHelperOptions = RouteOptions & Collection<OptionalRouteParameter>;
44
46
 
45
47
  type RouteHelper<T extends number = number> = ((
46
48
  ...args: [...RequiredParameters<T>, RouteHelperOptions]
47
49
  ) => string) &
48
50
  RouteHelperExtras;
49
51
 
50
- type RouteHelpers = Record<string, RouteHelper>;
52
+ type RouteHelpers = Collection<RouteHelper>;
51
53
 
52
54
  type Configuration = {
53
55
  prefix: string;
@@ -74,7 +76,7 @@ type KeywordUrlOptions = Optional<{
74
76
 
75
77
  type RouteOptions = KeywordUrlOptions & RouteParameters;
76
78
 
77
- type PartsTable = Record<string, { r?: boolean; d?: OptionalRouteParameter }>;
79
+ type PartsTable = Collection<{ r?: boolean; d?: OptionalRouteParameter }>;
78
80
 
79
81
  type ModuleType = "CJS" | "AMD" | "UMD" | "ESM" | "DTS" | "NIL";
80
82
 
@@ -94,7 +96,7 @@ declare const define:
94
96
  | undefined
95
97
  | (((arg: unknown[], callback: () => unknown) => void) & { amd?: unknown });
96
98
 
97
- declare const module: { exports: any } | undefined;
99
+ declare const module: { exports: unknown } | undefined;
98
100
 
99
101
  // eslint-disable-next-line
100
102
  RubyVariables.WRAPPER(
@@ -148,8 +150,9 @@ RubyVariables.WRAPPER(
148
150
  const ModuleReferences: Record<ModuleType, ModuleDefinition> = {
149
151
  CJS: {
150
152
  define(routes) {
151
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
152
- module!.exports = routes;
153
+ if (module) {
154
+ module.exports = routes;
155
+ }
153
156
  },
154
157
  isSupported() {
155
158
  return typeof module === "object";
@@ -157,10 +160,11 @@ RubyVariables.WRAPPER(
157
160
  },
158
161
  AMD: {
159
162
  define(routes) {
160
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
161
- define!([], function () {
162
- return routes;
163
- });
163
+ if (define) {
164
+ define([], function () {
165
+ return routes;
166
+ });
167
+ }
164
168
  },
165
169
  isSupported() {
166
170
  return typeof define === "function" && !!define.amd;
@@ -419,6 +423,7 @@ RubyVariables.WRAPPER(
419
423
  }
420
424
  return { keyword_parameters, query_parameters };
421
425
  }
426
+
422
427
  build_route(
423
428
  parts: string[],
424
429
  required_params: string[],
@@ -450,9 +455,9 @@ RubyVariables.WRAPPER(
450
455
  if (url_params.length) {
451
456
  result += "?" + url_params;
452
457
  }
453
- result += keyword_parameters.anchor
454
- ? "#" + keyword_parameters.anchor
455
- : "";
458
+ if (keyword_parameters.anchor) {
459
+ result += "#" + keyword_parameters.anchor;
460
+ }
456
461
  if (absolute) {
457
462
  result = this.route_url(keyword_parameters) + result;
458
463
  }
@@ -679,7 +684,7 @@ RubyVariables.WRAPPER(
679
684
  return (isBrowser && window?.location?.port) || "";
680
685
  }
681
686
 
682
- is_object(value: unknown): value is Record<string, unknown> {
687
+ is_object(value: unknown): value is Collection<unknown> {
683
688
  return (
684
689
  typeof value === "object" &&
685
690
  Object.prototype.toString.call(value) === "[object Object]"
@@ -717,13 +722,17 @@ RubyVariables.WRAPPER(
717
722
  }
718
723
  }
719
724
 
720
- define_module(name: ModuleType, module: RouterExposedMethods): void {
725
+ define_module(
726
+ name: ModuleType,
727
+ module: RouterExposedMethods
728
+ ): RouterExposedMethods {
721
729
  this.ensure_module_supported(name);
722
730
  ModuleReferences[name].define(module);
731
+ return module;
723
732
  }
724
733
  }
725
734
 
726
- const Utils = new UtilsClass();
735
+ const utils = new UtilsClass();
727
736
 
728
737
  // We want this helper name to be short
729
738
  const __jsr = {
@@ -732,25 +741,22 @@ RubyVariables.WRAPPER(
732
741
  route_spec: RouteTree,
733
742
  absolute?: boolean
734
743
  ): RouteHelper {
735
- return Utils.route(parts_table, route_spec, absolute);
744
+ return utils.route(parts_table, route_spec, absolute);
736
745
  },
737
746
  };
738
747
 
739
- const result = {
748
+ return utils.define_module(RubyVariables.MODULE_TYPE, {
740
749
  ...__jsr,
741
750
  configure: (config: Partial<Configuration>) => {
742
- return Utils.configure(config);
751
+ return utils.configure(config);
743
752
  },
744
753
  config: (): Configuration => {
745
- return Utils.config();
754
+ return utils.config();
746
755
  },
747
756
  serialize: (object: Serializable): string => {
748
- return Utils.serialize(object);
757
+ return utils.serialize(object);
749
758
  },
750
759
  ...RubyVariables.ROUTES_OBJECT,
751
- };
752
-
753
- Utils.define_module(RubyVariables.MODULE_TYPE, result);
754
- return result;
760
+ });
755
761
  }
756
762
  )();
@@ -2,13 +2,15 @@ namespace :js do
2
2
  desc "Make a js file with all rails route URL helpers"
3
3
  task routes: :environment do
4
4
  require "js-routes"
5
- JsRoutes.generate!
5
+ JsRoutes.generate!(typed: true)
6
6
  end
7
7
 
8
8
  namespace :routes do
9
9
  desc "Make a js file with all rails route URL helpers and typescript definitions for them"
10
10
  task typescript: "js:routes" do
11
- JsRoutes.definitions!
11
+ ActiveSupport::Deprecation.warn(
12
+ "`js:routes:typescript` task is deprecated. Please use `js:routes` instead."
13
+ )
12
14
  end
13
15
  end
14
16
  end
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.9
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bogdan Gusiev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-02 00:00:00.000000000 Z
11
+ date: 2024-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4'
19
+ version: '5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '4'
26
+ version: '5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sorbet-runtime
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -94,48 +94,6 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: 0.5.2
97
- - !ruby/object:Gem::Dependency
98
- name: bump
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: 0.10.0
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: 0.10.0
111
- - !ruby/object:Gem::Dependency
112
- name: byebug
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: pry-byebug
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
97
  - !ruby/object:Gem::Dependency
140
98
  name: mini_racer
141
99
  requirement: !ruby/object:Gem::Requirement
@@ -150,34 +108,17 @@ dependencies:
150
108
  - - ">="
151
109
  - !ruby/object:Gem::Version
152
110
  version: 0.4.0
153
- description: Generates javascript file that defines all Rails named routes as javascript
154
- helpers
111
+ description: Exposes all Rails Routes URL helpers as javascript module
155
112
  email: agresso@gmail.com
156
113
  executables: []
157
114
  extensions: []
158
115
  extra_rdoc_files:
159
116
  - LICENSE.txt
160
117
  files:
161
- - ".document"
162
- - ".eslintrc.js"
163
- - ".github/workflows/ci.yml"
164
- - ".gitignore"
165
- - ".nvmrc"
166
- - ".rspec"
167
- - Appraisals
168
118
  - CHANGELOG.md
169
- - Gemfile
170
119
  - LICENSE.txt
171
- - Rakefile
172
120
  - Readme.md
173
- - VERSION_2_UPGRADE.md
174
121
  - app/assets/javascripts/js-routes.js.erb
175
- - bin/tapioca
176
- - gemfiles/rails50_sprockets_3.gemfile
177
- - gemfiles/rails51_sprockets_3.gemfile
178
- - gemfiles/rails52_sprockets_3.gemfile
179
- - gemfiles/rails70_sprockets_4.gemfile
180
- - js-routes.gemspec
181
122
  - lib/js-routes.rb
182
123
  - lib/js_routes.rb
183
124
  - lib/js_routes/configuration.rb
@@ -189,6 +130,7 @@ files:
189
130
  - lib/js_routes/middleware.rb
190
131
  - lib/js_routes/route.rb
191
132
  - lib/js_routes/types.rb
133
+ - lib/js_routes/utils.rb
192
134
  - lib/js_routes/version.rb
193
135
  - lib/routes.d.ts
194
136
  - lib/routes.js
@@ -197,90 +139,15 @@ files:
197
139
  - lib/templates/erb.js
198
140
  - lib/templates/initializer.rb
199
141
  - lib/templates/routes.js.erb
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
259
- - spec/dummy/app/assets/config/manifest.js
260
- - spec/dummy/app/assets/javascripts/.gitkeep
261
- - spec/dummy/config/routes.rb
262
- - spec/js_routes/default_serializer_spec.rb
263
- - spec/js_routes/module_types/amd_spec.rb
264
- - spec/js_routes/module_types/cjs_spec.rb
265
- - spec/js_routes/module_types/dts/routes.spec.d.ts
266
- - spec/js_routes/module_types/dts/test.spec.ts
267
- - spec/js_routes/module_types/dts_spec.rb
268
- - spec/js_routes/module_types/esm_spec.rb
269
- - spec/js_routes/module_types/nil_spec.rb
270
- - spec/js_routes/module_types/umd_spec.rb
271
- - spec/js_routes/options_spec.rb
272
- - spec/js_routes/rails_routes_compatibility_spec.rb
273
- - spec/js_routes/route_specification_spec.rb
274
- - spec/js_routes/zzz_sprockets_spec.rb
275
- - spec/spec_helper.rb
276
- - spec/support/routes.rb
277
- - spec/tsconfig.json
278
- - tsconfig.json
279
- - yarn.lock
280
142
  homepage: http://github.com/railsware/js-routes
281
143
  licenses:
282
144
  - MIT
283
145
  metadata:
146
+ bug_tracker_uri: https://github.com/railsware/js-routes/issues
147
+ changelog_uri: https://github.com/railsware/js-routes/blob/v2.3.0/CHANGELOG.md
148
+ documentation_uri: https://github.com/railsware/js-routes
149
+ source_code_uri: https://github.com/railsware/js-routes/tree/v2.3.0/activerecord
150
+ rubygems_mfa_required: 'true'
284
151
  github_repo: ssh://github.com/railsware/js-routes
285
152
  post_install_message:
286
153
  rdoc_options: []
@@ -297,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
297
164
  - !ruby/object:Gem::Version
298
165
  version: '0'
299
166
  requirements: []
300
- rubygems_version: 3.2.22
167
+ rubygems_version: 3.5.11
301
168
  signing_key:
302
169
  specification_version: 4
303
170
  summary: Brings Rails named routes to javascript
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
data/.eslintrc.js DELETED
@@ -1,15 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- extends: [
4
- 'eslint:recommended',
5
- 'plugin:@typescript-eslint/eslint-recommended',
6
- 'plugin:@typescript-eslint/recommended',
7
- 'prettier',
8
- ],
9
- parser: '@typescript-eslint/parser',
10
- plugins: ['@typescript-eslint'],
11
- rules: {
12
- '@typescript-eslint/ban-types': 'off',
13
- '@typescript-eslint/no-explicit-any': 'off'
14
- },
15
- };
@@ -1,36 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- push:
5
- branches:
6
- - master
7
- pull_request:
8
-
9
- jobs:
10
- build:
11
- runs-on: ubuntu-latest
12
- strategy:
13
- matrix:
14
- ruby: ["2.7"]
15
- gemfile:
16
- - gemfiles/rails50_sprockets_3.gemfile
17
- - gemfiles/rails51_sprockets_3.gemfile
18
- - gemfiles/rails52_sprockets_3.gemfile
19
- - gemfiles/rails70_sprockets_4.gemfile
20
-
21
- env:
22
- BUNDLE_GEMFILE: ${{ matrix.gemfile }}
23
- steps:
24
- - uses: actions/checkout@v2
25
- - uses: ruby/setup-ruby@v1
26
- with:
27
- ruby-version: ${{ matrix.ruby }}
28
- - uses: actions/setup-node@v3
29
- with:
30
- node-version: "16"
31
- - name: install dependencies
32
- run: |
33
- bundle install --jobs 3 --retry 3
34
- yarn install
35
- - name: test
36
- run: bundle exec rake spec
data/.gitignore DELETED
@@ -1,65 +0,0 @@
1
- # rcov generated
2
- coverage
3
-
4
- # rdoc generated
5
- rdoc
6
-
7
- # yard generated
8
- doc
9
- .yardoc
10
- log
11
-
12
- # bundler
13
- .bundle
14
-
15
- # jeweler generated
16
- pkg
17
- tmp
18
-
19
- node_modules
20
-
21
- # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
22
- #
23
- # * Create a file at ~/.gitignore
24
- # * Include files you want ignored
25
- # * Run: git config --global core.excludesfile ~/.gitignore
26
- #
27
- # After doing this, these files will be ignored in all your git projects,
28
- # saving you from having to 'pollute' every project you touch with them
29
- #
30
- # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
31
- #
32
- # For MacOS:
33
- #
34
- #.DS_Store
35
-
36
- # For TextMate
37
- #*.tmproj
38
- #tmtags
39
-
40
- # For emacs:
41
- #*~
42
- #\#*
43
- #.\#*
44
-
45
- # For vim:
46
- #*.swp
47
-
48
- # For redcar:
49
- #.redcar
50
-
51
- # For rubinius:
52
- #*.rbc
53
- .rvmrc
54
- .ruby-version
55
-
56
- Gemfile.lock
57
- gemfiles/*.lock
58
-
59
- .DS_Store
60
-
61
- /spec/dummy/app/assets/javascripts/routes.js
62
- /spec/dummy/logs
63
- /spec/dummy/tmp
64
- node_modules
65
-
data/.nvmrc DELETED
@@ -1 +0,0 @@
1
- 14
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --color
data/Appraisals DELETED
@@ -1,17 +0,0 @@
1
- def define_appraisal(rails, version, sprockets)
2
- sprockets.each do |sprocket|
3
- appraise "#{rails}-sprockets-#{sprocket}" do
4
- gem "railties", "~> #{version}"
5
- gem "sprockets", "~> #{sprocket}.0"
6
- end
7
- end
8
- end
9
-
10
- [
11
- [:rails50, '5.0.5', [3]],
12
- [:rails51, '5.1.3', [3]],
13
- [:rails52, '5.2.3', [3]],
14
- [:rails70, '7.0.3.1', [4]]
15
- ].each do |name, version, sprockets|
16
- define_appraisal(name, version, sprockets)
17
- end
data/Gemfile DELETED
@@ -1,9 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- # Specify your gem's dependencies in js-routes.gemspec
4
- gemspec
5
-
6
- group :development do
7
- gem 'sorbet', '>= 0.5.11518'
8
- gem 'tapioca'
9
- end
data/Rakefile DELETED
@@ -1,37 +0,0 @@
1
- # encoding: utf-8
2
- require 'rubygems'
3
- require 'bundler'
4
- begin
5
- Bundler.setup(:default, :development)
6
- rescue Bundler::BundlerError => e
7
- $stderr.puts e.message
8
- $stderr.puts "Run `bundle install` to install missing gems"
9
- exit e.status_code
10
- end
11
- require 'bundler/gem_tasks'
12
- require 'rspec/core'
13
- require 'rspec/core/rake_task'
14
- require 'appraisal'
15
- require 'rails/version'
16
- if Rails.version < "6.1"
17
- load "rails/tasks/routes.rake"
18
- end
19
-
20
- RSpec::Core::RakeTask.new(:spec)
21
-
22
- task :test_all => :appraisal # test all rails
23
-
24
- task :default => :spec
25
-
26
-
27
- namespace :spec do
28
- desc "Print all routes defined in test env"
29
- task :routes do
30
- require './spec/spec_helper'
31
- require 'action_dispatch/routing/inspector'
32
- draw_routes
33
- all_routes = Rails.application.routes.routes
34
- inspector = ActionDispatch::Routing::RoutesInspector.new(all_routes)
35
- puts inspector.format(ActionDispatch::Routing::ConsoleFormatter::Sheet.new)
36
- end
37
- end
data/VERSION_2_UPGRADE.md DELETED
@@ -1,66 +0,0 @@
1
- ## Version 2.0 upgrade notes
2
-
3
- ### Using ESM module by default
4
-
5
- New version of JsRoutes doesn't try to guess your javascript environment module system because JS has generated a ton of legacy module systems in the past.
6
- [ESM+Webpacker](/Readme.md#webpacker) upgrade is recommended.
7
-
8
- However, if you don't want to follow that pass, specify `module_type` configuration option instead based on module system available in your JS environment.
9
- Here are supported values:
10
-
11
- * CJS
12
- * UMD
13
- * AMD
14
- * ESM
15
- * nil
16
-
17
- [Explaination Article](https://dev.to/iggredible/what-the-heck-are-cjs-amd-umd-and-esm-ikm)
18
-
19
- If you don't want to use any JS module system and make routes available via a **global variable**, specify `nil` as a `module_type` and use `namespace` option:
20
-
21
- ``` ruby
22
- JsRoutes.setup do |config|
23
- config.module_type = nil
24
- config.namespace = "Routes"
25
- end
26
- ```
27
-
28
- ### JSDoc comment
29
-
30
- New version of js-routes generates function comment in the [JSDoc](https://jsdoc.app) format.
31
- If you have any problems with that, you can disable it like this:
32
-
33
-
34
- ``` ruby
35
- JsRoutes.setup do |config|
36
- config.documentation = false
37
- end
38
- ```
39
-
40
- ### `required_params` renamed
41
-
42
- In case you are using `required_params` property, it is now renamed and converted to a method:
43
-
44
- ``` javascript
45
- // Old style
46
- Routes.post_path.required_params // => ['id']
47
- // New style
48
- Routes.post_path.requiredParams() // => ['id']
49
- ```
50
-
51
- ### ParameterMissing error rework
52
-
53
- `ParameterMissing` is renamed to `ParametersMissing` error and now list all missing parameters instead of just first encountered in its message. Missing parameters are now available via `ParametersMissing#keys` property.
54
-
55
- ``` javascript
56
- try {
57
- return Routes.inbox_path();
58
- } catch(error) {
59
- if (error.name === 'ParametersMissing') {
60
- console.warn(`Missing route keys ${error.keys.join(', ')}. Ignoring.`);
61
- return "#";
62
- } else {
63
- throw error;
64
- }
65
- }
66
- ```