js-routes 2.0.4 → 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36f0c94e92ba86ebe6ba251255f56188798b0e3617f4327f1b378178af064ceb
4
- data.tar.gz: 22ad68234c70b70a0ec9053427eb1f84a3d940262259662f04b574c22e269c7d
3
+ metadata.gz: 4f78bfaf0cba479c48245d0606cc10b262481e854f3fc82e7195a8b58548bf7a
4
+ data.tar.gz: 118cafad50e73568ba4b1758821af072194e9570178f1f9caf067785e9f5a0f5
5
5
  SHA512:
6
- metadata.gz: 2cdf3b85d580c7008d99e2bf20e722b1264b3207d9f7fa12b1ae17ab46a5eb041635047fb42139f0194d9cd2d73a8b6b1c5c63dd7ded8479c3af83d98c4eea62
7
- data.tar.gz: ac97b0989e491ea830ea4a4c4a00dee9fb3ccf0f83ecb104f6c3341bd188c53e81453626fa8329cdc5751df4cb4db2bd814aa7c4b0b1e6dc78b54e56c4e71fcf
6
+ metadata.gz: 95490b886a00861b0fe4a5e2419c67ec804bbb94a916edefe333acd2e0c94b407137952b97e4bf70d928ad1ebc5cf47333b5b5083f0dc227a43be2d3ebba7648
7
+ data.tar.gz: 666d2862d8a86e760176afdfdd62711a34202a4725d08609e5f5bf69732becb8829826ddeccaca0f8cacffa6a78022e69a05872ea26ce550e7352a9bfde0d0e4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  ## master
2
2
 
3
+ ## v2.0.8
4
+
5
+ * Forbid usage of `namespace` option if `module_type` is not `nil`. [#281](https://github.com/railsware/js-routes/issues/281).
6
+
7
+ ## v2.0.7
8
+
9
+ * Remove source map annotation from JS file. Fixes [#277](https://github.com/railsware/js-routes/issues/277)
10
+ * Generated file is not minified, so it is better to use app side bundler/compressor for source maps
11
+
12
+
13
+ ## v2.0.6
14
+
15
+ * Disable `namespace` option default for all envs [#278](https://github.com/railsware/js-routes/issues/278)
16
+
17
+ ## v2.0.5
18
+
19
+ * Fixed backward compatibility issue [#276](https://github.com/railsware/js-routes/issues/276)
20
+
3
21
  ## v2.0.4
4
22
 
5
23
  * Fixed backward compatibility issue [#275](https://github.com/railsware/js-routes/issues/275)
data/Readme.md CHANGED
@@ -159,6 +159,7 @@ Options to configure JavaScript file generator. These options are only available
159
159
  * Default: `[]`
160
160
  * The regexp applies only to the name before the `_path` suffix, eg: you want to match exactly `settings_path`, the regexp should be `/^settings$/`
161
161
  * `namespace` - global object used to access routes.
162
+ * Only available if `module_type` option is set to `nil`.
162
163
  * Supports nested namespace like `MyProject.routes`
163
164
  * Default: `nil`
164
165
  * `camel_case` - specifies if route helpers should be generated in camel case instead of underscore case.
@@ -314,6 +315,9 @@ import {
314
315
  } from 'routes.js.erb'
315
316
  ```
316
317
 
318
+ Such import structure allows for moddern JS bundlers like [Webpack](https://webpack.js.org/) to only include explicitly imported routes into JS bundle file.
319
+ See [Tree Shaking](https://webpack.js.org/guides/tree-shaking/) for more information.
320
+
317
321
  ### Exclude option
318
322
 
319
323
  Split your routes into multiple files related to each section of your website like:
@@ -325,18 +329,6 @@ Split your routes into multiple files related to each section of your website li
325
329
  <%= JsRoutes.generate(exclude: /^admin_/)
326
330
  ```
327
331
 
328
- ## JsRoutes and Heroku
329
-
330
- When using this setup on Heroku, it is impossible to use the asset pipeline. You should use the "Very Advanced Setup" schema in this case.
331
-
332
- For example create routes.js.erb in assets folder with needed content:
333
-
334
- ``` erb
335
- <%= JsRoutes.generate(options) %>
336
- ```
337
-
338
- This should just work.
339
-
340
332
  ## Advantages over alternatives
341
333
 
342
334
  There are some alternatives available. Most of them has only basic feature and don't reach the level of quality I accept.
data/VERSION_2_UPGRADE.md CHANGED
@@ -2,23 +2,40 @@
2
2
 
3
3
  ### Using ESM module by default
4
4
 
5
- The default setting are now changed:
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.
6
7
 
7
- Setting | Old | New
8
- --- | --- | ---
9
- module\_type | nil | ESM
10
- namespace | Routes | nil
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:
11
10
 
12
- This is more optimized setup for WebPacker. You can restore the old configuration like this:
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:
13
20
 
14
21
  ``` ruby
15
22
  JsRoutes.setup do |config|
16
23
  config.module_type = nil
17
- config.namespace = 'Routes'
24
+ config.namespace = "Routes"
18
25
  end
19
26
  ```
20
27
 
21
- However, [ESM+Webpacker](/Readme.md#webpacker) upgrade is recommended.
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
+ ```
22
39
 
23
40
  ### `required_params` renamed
24
41
 
@@ -47,15 +64,3 @@ try {
47
64
  }
48
65
  }
49
66
  ```
50
-
51
- ### JSDoc comment format
52
-
53
- New version of js-routes generates function comment in the [JSDoc](https://jsdoc.app) format.
54
- If you have any problems with that disable the annotation:
55
-
56
- ``` ruby
57
- JsRoutes.setup do |config|
58
- config.documentation = false
59
- end
60
- ```
61
-
data/lib/js_routes.rb CHANGED
@@ -12,7 +12,7 @@ class JsRoutes
12
12
  #
13
13
 
14
14
  DEFAULTS = {
15
- namespace: -> { defined?(Webpacker) ? nil : "Routes" },
15
+ namespace: nil,
16
16
  exclude: [],
17
17
  include: //,
18
18
  file: -> do
@@ -60,6 +60,7 @@ class JsRoutes
60
60
  value = value.call if value.is_a?(Proc)
61
61
  send(:"#{attribute}=", value)
62
62
  end
63
+ normalize_and_verify
63
64
  self
64
65
  end
65
66
 
@@ -76,7 +77,24 @@ class JsRoutes
76
77
  end
77
78
 
78
79
  def esm?
79
- self.module_type === 'ESM'
80
+ module_type === 'ESM'
81
+ end
82
+
83
+ def normalize_and_verify
84
+ normalize
85
+ verify
86
+ end
87
+
88
+ protected
89
+
90
+ def normalize
91
+ self.module_type = module_type&.upcase || 'NIL'
92
+ end
93
+
94
+ def verify
95
+ if module_type != 'NIL' && namespace
96
+ raise "JsRoutes namespace option can only be used if module_type is nil"
97
+ end
80
98
  end
81
99
  end
82
100
 
@@ -87,6 +105,7 @@ class JsRoutes
87
105
  class << self
88
106
  def setup(&block)
89
107
  configuration.tap(&block) if block
108
+ configuration.normalize_and_verify
90
109
  end
91
110
 
92
111
  def configuration
@@ -248,12 +267,14 @@ class JsRoutes
248
267
  end
249
268
  end
250
269
 
270
+ protected
271
+
251
272
  def body(absolute)
252
- "__jsr.r(#{arguments(absolute).join(', ')})"
273
+ "__jsr.r(#{arguments(absolute).map{|a| json(a)}.join(', ')})"
253
274
  end
254
275
 
255
276
  def arguments(absolute)
256
- absolute ? base_arguments + [json(true)] : base_arguments
277
+ absolute ? base_arguments + [true] : base_arguments
257
278
  end
258
279
 
259
280
  def match_configuration?
@@ -261,7 +282,8 @@ class JsRoutes
261
282
  end
262
283
 
263
284
  def base_name
264
- @base_name ||= apply_case(parent_route&.name, route.name)
285
+ @base_name ||= parent_route ?
286
+ [parent_route.name, route.name].join('_') : route.name
265
287
  end
266
288
 
267
289
  def parent_spec
@@ -278,7 +300,7 @@ class JsRoutes
278
300
 
279
301
  def helper_name(absolute)
280
302
  suffix = absolute ? :url : @configuration[:compact] ? nil : :path
281
- suffix ? apply_case(base_name, suffix) : base_name
303
+ apply_case(base_name, suffix)
282
304
  end
283
305
 
284
306
  def documentation
@@ -297,10 +319,11 @@ JS
297
319
  route.required_parts
298
320
  end
299
321
 
300
- protected
301
-
302
322
  def base_arguments
303
- return @base_arguments if defined?(@base_arguments)
323
+ @base_arguments ||= [parts_table, serialize(spec, parent_spec)]
324
+ end
325
+
326
+ def parts_table
304
327
  parts_table = {}
305
328
  route.parts.each do |part, hash|
306
329
  parts_table[part] ||= {}
@@ -317,11 +340,7 @@ JS
317
340
  parts_table[part][:d] = value
318
341
  end
319
342
  end
320
- @base_arguments = [
321
- parts_table, serialize(spec, parent_spec)
322
- ].map do |argument|
323
- json(argument)
324
- end
343
+ parts_table
325
344
  end
326
345
 
327
346
  def documentation_params
@@ -1,3 +1,3 @@
1
1
  class JsRoutes
2
- VERSION = "2.0.4"
2
+ VERSION = "2.0.8"
3
3
  end
data/lib/routes.d.ts CHANGED
@@ -6,59 +6,52 @@ declare type RouteParameter = unknown;
6
6
  declare type RouteParameters = Record<string, RouteParameter>;
7
7
  declare type Serializer = (value: unknown) => string;
8
8
  declare type RouteHelper = {
9
- (...args: RouteParameter[]): string;
10
- requiredParams(): string[];
11
- toString(): string;
9
+ (...args: RouteParameter[]): string;
10
+ requiredParams(): string[];
11
+ toString(): string;
12
12
  };
13
13
  declare type RouteHelpers = Record<string, RouteHelper>;
14
14
  declare type Configuration = {
15
- prefix: string;
16
- default_url_options: RouteParameters;
17
- special_options_key: string;
18
- serializer: Serializer;
15
+ prefix: string;
16
+ default_url_options: RouteParameters;
17
+ special_options_key: string;
18
+ serializer: Serializer;
19
19
  };
20
20
  declare type Optional<T> = {
21
- [P in keyof T]?: T[P] | null;
21
+ [P in keyof T]?: T[P] | null;
22
22
  };
23
23
  interface RouterExposedMethods {
24
- config(): Configuration;
25
- configure(arg: Partial<Configuration>): Configuration;
26
- serialize: Serializer;
24
+ config(): Configuration;
25
+ configure(arg: Partial<Configuration>): Configuration;
26
+ serialize: Serializer;
27
27
  }
28
28
  declare type KeywordUrlOptions = Optional<{
29
- host: string;
30
- protocol: string;
31
- subdomain: string;
32
- port: string;
33
- anchor: string;
34
- trailing_slash: boolean;
29
+ host: string;
30
+ protocol: string;
31
+ subdomain: string;
32
+ port: string;
33
+ anchor: string;
34
+ trailing_slash: boolean;
35
35
  }>;
36
- declare type PartsTable = Record<
37
- string,
38
- {
36
+ declare type PartsTable = Record<string, {
39
37
  r?: boolean;
40
38
  d?: unknown;
41
- }
42
- >;
43
- declare type ModuleType = "CJS" | "AMD" | "UMD" | "ESM";
39
+ }>;
40
+ declare type ModuleType = "CJS" | "AMD" | "UMD" | "ESM" | "NIL";
44
41
  declare const RubyVariables: {
45
- PREFIX: string;
46
- DEPRECATED_GLOBBING_BEHAVIOR: boolean;
47
- SPECIAL_OPTIONS_KEY: string;
48
- DEFAULT_URL_OPTIONS: RouteParameters;
49
- SERIALIZER: Serializer;
50
- NAMESPACE: string;
51
- ROUTES_OBJECT: RouteHelpers;
52
- MODULE_TYPE: ModuleType | null;
53
- WRAPPER: <T>(callback: T) => T;
42
+ PREFIX: string;
43
+ DEPRECATED_GLOBBING_BEHAVIOR: boolean;
44
+ SPECIAL_OPTIONS_KEY: string;
45
+ DEFAULT_URL_OPTIONS: RouteParameters;
46
+ SERIALIZER: Serializer;
47
+ NAMESPACE: string;
48
+ ROUTES_OBJECT: RouteHelpers;
49
+ MODULE_TYPE: ModuleType;
50
+ WRAPPER: <T>(callback: T) => T;
54
51
  };
55
- declare const define:
56
- | undefined
57
- | (((arg: unknown[], callback: () => unknown) => void) & {
58
- amd?: unknown;
59
- });
60
- declare const module:
61
- | {
62
- exports: any;
63
- }
64
- | undefined;
52
+ declare const define: undefined | (((arg: unknown[], callback: () => unknown) => void) & {
53
+ amd?: unknown;
54
+ });
55
+ declare const module: {
56
+ exports: any;
57
+ } | undefined;
data/lib/routes.js CHANGED
@@ -18,25 +18,32 @@ RubyVariables.WRAPPER((that) => {
18
18
  const Root = that;
19
19
  const ModuleReferences = {
20
20
  CJS: {
21
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
22
- define: (routes) => (module.exports = routes),
23
- support: () => typeof module === "object",
21
+ define(routes) {
22
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
23
+ module.exports = routes;
24
+ },
25
+ isSupported() {
26
+ return typeof module === "object";
27
+ },
24
28
  },
25
29
  AMD: {
26
- define: (routes) =>
27
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
28
- define([], function () {
29
- return routes;
30
- }),
31
- support: () => typeof define === "function" && !!define.amd,
30
+ define(routes) {
31
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
32
+ define([], function () {
33
+ return routes;
34
+ });
35
+ },
36
+ isSupported() {
37
+ return typeof define === "function" && !!define.amd;
38
+ },
32
39
  },
33
40
  UMD: {
34
- define: (routes) => {
35
- if (ModuleReferences.AMD.support()) {
41
+ define(routes) {
42
+ if (ModuleReferences.AMD.isSupported()) {
36
43
  ModuleReferences.AMD.define(routes);
37
44
  }
38
45
  else {
39
- if (ModuleReferences.CJS.support()) {
46
+ if (ModuleReferences.CJS.isSupported()) {
40
47
  try {
41
48
  ModuleReferences.CJS.define(routes);
42
49
  }
@@ -47,11 +54,27 @@ RubyVariables.WRAPPER((that) => {
47
54
  }
48
55
  }
49
56
  },
50
- support: () => ModuleReferences.AMD.support() || ModuleReferences.CJS.support(),
57
+ isSupported() {
58
+ return (ModuleReferences.AMD.isSupported() ||
59
+ ModuleReferences.CJS.isSupported());
60
+ },
51
61
  },
52
62
  ESM: {
53
- define: () => null,
54
- support: () => true,
63
+ define() {
64
+ // Module can only be defined using ruby code generation
65
+ },
66
+ isSupported() {
67
+ // Its impossible to check if "export" keyword is supported
68
+ return true;
69
+ },
70
+ },
71
+ NIL: {
72
+ define(routes) {
73
+ Utils.namespace(Root, RubyVariables.NAMESPACE, routes);
74
+ },
75
+ isSupported() {
76
+ return !!Root;
77
+ },
55
78
  },
56
79
  };
57
80
  class ParametersMissing extends Error {
@@ -62,7 +85,6 @@ RubyVariables.WRAPPER((that) => {
62
85
  this.name = ParametersMissing.name;
63
86
  }
64
87
  }
65
- const DeprecatedGlobbingBehavior = RubyVariables.DEPRECATED_GLOBBING_BEHAVIOR;
66
88
  const UriEncoderSegmentRegex = /[^a-zA-Z0-9\-._~!$&'()*+,;=:@]/g;
67
89
  const ReservedOptions = [
68
90
  "anchor",
@@ -275,7 +297,7 @@ RubyVariables.WRAPPER((that) => {
275
297
  return "";
276
298
  }
277
299
  // if left_part ends on '/' and right_part starts on '/'
278
- if (left_part[left_part.length - 1] === '/' && right_part[0] === '/') {
300
+ if (left_part[left_part.length - 1] === "/" && right_part[0] === "/") {
279
301
  // strip slash from right_part
280
302
  // to prevent double slash
281
303
  right_part = right_part.substring(1);
@@ -342,7 +364,9 @@ RubyVariables.WRAPPER((that) => {
342
364
  value = value.join("/");
343
365
  }
344
366
  const result = this.path_identifier(value);
345
- return DeprecatedGlobbingBehavior ? result : encodeURI(result);
367
+ return RubyVariables.DEPRECATED_GLOBBING_BEHAVIOR
368
+ ? result
369
+ : encodeURI(result);
346
370
  }
347
371
  get_prefix() {
348
372
  const prefix = this.configuration.prefix;
@@ -449,7 +473,7 @@ RubyVariables.WRAPPER((that) => {
449
473
  return { ...this.configuration };
450
474
  }
451
475
  is_module_supported(name) {
452
- return ModuleReferences[name].support();
476
+ return ModuleReferences[name].isSupported();
453
477
  }
454
478
  ensure_module_supported(name) {
455
479
  if (!this.is_module_supported(name)) {
@@ -457,9 +481,6 @@ RubyVariables.WRAPPER((that) => {
457
481
  }
458
482
  }
459
483
  define_module(name, module) {
460
- if (!name) {
461
- return;
462
- }
463
484
  this.ensure_module_supported(name);
464
485
  ModuleReferences[name].define(module);
465
486
  }
@@ -484,10 +505,6 @@ RubyVariables.WRAPPER((that) => {
484
505
  },
485
506
  ...RubyVariables.ROUTES_OBJECT,
486
507
  };
487
- Utils.namespace(Root, RubyVariables.NAMESPACE, result);
488
- if (RubyVariables.MODULE_TYPE) {
489
- Utils.define_module(RubyVariables.MODULE_TYPE, result);
490
- }
508
+ Utils.define_module(RubyVariables.MODULE_TYPE, result);
491
509
  return result;
492
510
  })(this);
493
- //# sourceMappingURL=routes.js.map
data/lib/routes.ts CHANGED
@@ -39,7 +39,7 @@ type KeywordUrlOptions = Optional<{
39
39
 
40
40
  type PartsTable = Record<string, { r?: boolean; d?: unknown }>;
41
41
 
42
- type ModuleType = "CJS" | "AMD" | "UMD" | "ESM";
42
+ type ModuleType = "CJS" | "AMD" | "UMD" | "ESM" | "NIL";
43
43
 
44
44
  declare const RubyVariables: {
45
45
  PREFIX: string;
@@ -49,7 +49,7 @@ declare const RubyVariables: {
49
49
  SERIALIZER: Serializer;
50
50
  NAMESPACE: string;
51
51
  ROUTES_OBJECT: RouteHelpers;
52
- MODULE_TYPE: ModuleType | null;
52
+ MODULE_TYPE: ModuleType;
53
53
  WRAPPER: <T>(callback: T) => T;
54
54
  };
55
55
 
@@ -94,28 +94,35 @@ RubyVariables.WRAPPER(
94
94
  const Root = that;
95
95
  type ModuleDefinition = {
96
96
  define: (routes: unknown) => void;
97
- support: () => boolean;
97
+ isSupported: () => boolean;
98
98
  };
99
99
  const ModuleReferences: Record<ModuleType, ModuleDefinition> = {
100
100
  CJS: {
101
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
102
- define: (routes) => (module!.exports = routes),
103
- support: () => typeof module === "object",
101
+ define(routes) {
102
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
103
+ module!.exports = routes;
104
+ },
105
+ isSupported() {
106
+ return typeof module === "object";
107
+ },
104
108
  },
105
109
  AMD: {
106
- define: (routes) =>
110
+ define(routes) {
107
111
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
108
112
  define!([], function () {
109
113
  return routes;
110
- }),
111
- support: () => typeof define === "function" && !!define.amd,
114
+ });
115
+ },
116
+ isSupported() {
117
+ return typeof define === "function" && !!define.amd;
118
+ },
112
119
  },
113
120
  UMD: {
114
- define: (routes) => {
115
- if (ModuleReferences.AMD.support()) {
121
+ define(routes) {
122
+ if (ModuleReferences.AMD.isSupported()) {
116
123
  ModuleReferences.AMD.define(routes);
117
124
  } else {
118
- if (ModuleReferences.CJS.support()) {
125
+ if (ModuleReferences.CJS.isSupported()) {
119
126
  try {
120
127
  ModuleReferences.CJS.define(routes);
121
128
  } catch (error) {
@@ -124,12 +131,29 @@ RubyVariables.WRAPPER(
124
131
  }
125
132
  }
126
133
  },
127
- support: () =>
128
- ModuleReferences.AMD.support() || ModuleReferences.CJS.support(),
134
+ isSupported() {
135
+ return (
136
+ ModuleReferences.AMD.isSupported() ||
137
+ ModuleReferences.CJS.isSupported()
138
+ );
139
+ },
129
140
  },
130
141
  ESM: {
131
- define: () => null,
132
- support: () => true,
142
+ define() {
143
+ // Module can only be defined using ruby code generation
144
+ },
145
+ isSupported() {
146
+ // Its impossible to check if "export" keyword is supported
147
+ return true;
148
+ },
149
+ },
150
+ NIL: {
151
+ define(routes) {
152
+ Utils.namespace(Root, RubyVariables.NAMESPACE, routes);
153
+ },
154
+ isSupported() {
155
+ return !!Root;
156
+ },
133
157
  },
134
158
  };
135
159
 
@@ -143,9 +167,6 @@ RubyVariables.WRAPPER(
143
167
  }
144
168
  }
145
169
 
146
- const DeprecatedGlobbingBehavior =
147
- RubyVariables.DEPRECATED_GLOBBING_BEHAVIOR;
148
-
149
170
  const UriEncoderSegmentRegex = /[^a-zA-Z0-9\-._~!$&'()*+,;=:@]/g;
150
171
 
151
172
  const ReservedOptions = [
@@ -498,7 +519,9 @@ RubyVariables.WRAPPER(
498
519
  value = value.join("/");
499
520
  }
500
521
  const result = this.path_identifier(value as any);
501
- return DeprecatedGlobbingBehavior ? result : encodeURI(result);
522
+ return RubyVariables.DEPRECATED_GLOBBING_BEHAVIOR
523
+ ? result
524
+ : encodeURI(result);
502
525
  }
503
526
 
504
527
  get_prefix(): string {
@@ -635,7 +658,7 @@ RubyVariables.WRAPPER(
635
658
  }
636
659
 
637
660
  is_module_supported(name: ModuleType): boolean {
638
- return ModuleReferences[name].support();
661
+ return ModuleReferences[name].isSupported();
639
662
  }
640
663
 
641
664
  ensure_module_supported(name: ModuleType): void {
@@ -644,13 +667,7 @@ RubyVariables.WRAPPER(
644
667
  }
645
668
  }
646
669
 
647
- define_module(
648
- name: ModuleType | null,
649
- module: RouterExposedMethods
650
- ): void {
651
- if (!name) {
652
- return;
653
- }
670
+ define_module(name: ModuleType, module: RouterExposedMethods): void {
654
671
  this.ensure_module_supported(name);
655
672
  ModuleReferences[name].define(module);
656
673
  }
@@ -683,11 +700,7 @@ RubyVariables.WRAPPER(
683
700
  ...RubyVariables.ROUTES_OBJECT,
684
701
  };
685
702
 
686
- Utils.namespace(Root, RubyVariables.NAMESPACE, result);
687
-
688
- if (RubyVariables.MODULE_TYPE) {
689
- Utils.define_module(RubyVariables.MODULE_TYPE, result);
690
- }
703
+ Utils.define_module(RubyVariables.MODULE_TYPE, result);
691
704
  return result;
692
705
  }
693
706
  )(this);
data/package.json CHANGED
@@ -21,6 +21,7 @@
21
21
  "prettier": "^2.2.1"
22
22
  },
23
23
  "scripts": {
24
+ "build": "tsc && yarn lint:fix",
24
25
  "lint:fix": "yarn eslint --fix && yarn prettier --write lib/routes.ts",
25
26
  "postinstall": "yarn husky-upgrade"
26
27
  },
@@ -30,7 +31,7 @@
30
31
  }
31
32
  },
32
33
  "lint-staged": {
33
- "*.ts": ["yarn lint:fix" ]
34
+ "./lib/routes.ts": ["yarn lint:fix" ]
34
35
  }
35
36
 
36
37
  }
@@ -3,7 +3,7 @@ require "spec_helper"
3
3
  describe JsRoutes, "#serialize" do
4
4
 
5
5
  before(:each) do
6
- evaljs(JsRoutes.generate({module_type: nil}))
6
+ evaljs(JsRoutes.generate({module_type: nil, namespace: 'Routes'}))
7
7
  end
8
8
 
9
9
  it "should provide this method" do
@@ -3,7 +3,11 @@ require 'spec_helper'
3
3
  describe JsRoutes, "options" do
4
4
 
5
5
  let(:generated_js) do
6
- JsRoutes.generate({module_type: nil, **_options})
6
+ JsRoutes.generate({
7
+ module_type: nil,
8
+ namespace: 'Routes',
9
+ **_options
10
+ })
7
11
  end
8
12
 
9
13
  before(:each) do
@@ -91,6 +95,18 @@ describe JsRoutes, "options" do
91
95
  expect(evaljs("Routes.inboxes_path")).to be_nil
92
96
  end
93
97
 
98
+ context "with camel_case option" do
99
+ let(:_options) { {include: /^admin_/, camel_case: true} }
100
+
101
+ it "should exclude specified routes from file" do
102
+ expect(evaljs("Routes.adminUsersPath()")).not_to be_nil
103
+ end
104
+
105
+ it "should not exclude routes not under specified pattern" do
106
+ expect(evaljs("Routes.inboxesPath")).to be_nil
107
+ end
108
+ end
109
+
94
110
  context "for rails engine" do
95
111
  let(:_options) { {:include => /^blog_app_posts/} }
96
112
 
@@ -180,9 +196,9 @@ describe JsRoutes, "options" do
180
196
  end
181
197
 
182
198
  context "is nil" do
183
- let(:_options) { {:namespace => nil} }
199
+ let(:_options) { {:namespace => nil, include: /^inbox$/} }
184
200
  it "should use this namespace for routing" do
185
- evaljs("window.zz = #{JsRoutes.generate(module_type: nil, namespace: nil)}")
201
+ evaljs("window.zz = #{generated_js}")
186
202
  expect(evaljs("window.zz.inbox_path")).not_to be_nil
187
203
  end
188
204
 
@@ -3,7 +3,7 @@ require "spec_helper"
3
3
  describe JsRoutes, "compatibility with Rails" do
4
4
 
5
5
  before(:each) do
6
- evaljs(JsRoutes.generate({module_type: nil}))
6
+ evaljs(JsRoutes.generate({module_type: nil, namespace: 'Routes'}))
7
7
  end
8
8
 
9
9
  it "should generate collection routing" do
data/spec/spec_helper.rb CHANGED
@@ -8,7 +8,7 @@ require 'js-routes'
8
8
  require 'active_support/core_ext/hash/slice'
9
9
 
10
10
  unless ENV['TRAVIS_CI']
11
- code = system("yarn tsc")
11
+ code = system("yarn build")
12
12
  unless code
13
13
  exit(1)
14
14
  end
data/tsconfig.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "lib": ["es2020", "dom"],
5
5
  "module": "commonjs",
6
6
  "outDir": "lib",
7
- "sourceMap": true,
7
+ "sourceMap": false,
8
8
  "declaration": true,
9
9
  "allowSyntheticDefaultImports": true,
10
10
  "resolveJsonModule": true,
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.0.4
4
+ version: 2.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bogdan Gusiev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-31 00:00:00.000000000 Z
11
+ date: 2021-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -174,7 +174,6 @@ files:
174
174
  - lib/js_routes/version.rb
175
175
  - lib/routes.d.ts
176
176
  - lib/routes.js
177
- - lib/routes.js.map
178
177
  - lib/routes.ts
179
178
  - lib/tasks/js_routes.rake
180
179
  - package.json
data/lib/routes.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"routes.js","sourceRoot":"","sources":["routes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA0DH,aAAa,CAAC,OAAO,CACnB,CAAC,IAAa,EAAwB,EAAE;IACtC,MAAM,OAAO,GAAG,CAAC,KAAc,EAAE,GAAW,EAAE,EAAE,CAC9C,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACnD,IAAK,SASJ;IATD,WAAK,SAAS;QACZ,2CAAS,CAAA;QACT,uCAAO,CAAA;QACP,6CAAU,CAAA;QACV,qCAAM,CAAA;QACN,yCAAQ,CAAA;QACR,+CAAW,CAAA;QACX,2CAAS,CAAA;QACT,uCAAO,CAAA;IACT,CAAC,EATI,SAAS,KAAT,SAAS,QASb;IAmBD,MAAM,IAAI,GAAG,IAAI,CAAC;IAKlB,MAAM,gBAAgB,GAAyC;QAC7D,GAAG,EAAE;YACH,oEAAoE;YACpE,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAO,CAAC,OAAO,GAAG,MAAM,CAAC;YAC9C,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,MAAM,KAAK,QAAQ;SAC1C;QACD,GAAG,EAAE;YACH,MA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