Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package rubygem-js-routes for 
openSUSE:Factory checked in at 2021-01-21 21:55:47
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-js-routes (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-js-routes.new.28504 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-js-routes"

Thu Jan 21 21:55:47 2021 rev:21 rq:865199 version:1.4.14

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-js-routes/rubygem-js-routes.changes      
2020-03-07 21:38:37.240287631 +0100
+++ 
/work/SRC/openSUSE:Factory/.rubygem-js-routes.new.28504/rubygem-js-routes.changes
   2021-01-21 21:55:48.845813100 +0100
@@ -1,0 +2,25 @@
+Wed Jan 20 12:51:18 UTC 2021 - Stephan Kulow <co...@suse.com>
+
+updated to version 1.4.14
+ see installed CHANGELOG.md
+
+  ## v1.4.14
+  
+  * Fix compatibility with UMD modules #237 
[Comment](https://github.com/railsware/js-routes/issues/237#issuecomment-752754679)
+  
+  ## v1.4.13
+  
+  * Improve compatibility with node environment #269.
+  * Change default file location configuration to Webpacker if both Webpacker 
and Sprockets are loaded
+  
+  ## v1.4.11
+  
+  * Use app/javascript/routes.js as a default file location if app/javascript 
directory exists
+  * Add `default` export for better experience when used as es6 module
+  
+  ## v1.4.10
+  
+  * Require engine only when sprockets is loaded #257.
+  
+
+-------------------------------------------------------------------

Old:
----
  js-routes-1.4.9.gem

New:
----
  js-routes-1.4.14.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-js-routes.spec ++++++
--- /var/tmp/diff_new_pack.Sr71Fp/_old  2021-01-21 21:55:49.633813650 +0100
+++ /var/tmp/diff_new_pack.Sr71Fp/_new  2021-01-21 21:55:49.637813652 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package rubygem-js-routes
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-js-routes
-Version:        1.4.9
+Version:        1.4.14
 Release:        0
 %define mod_name js-routes
 %define mod_full_name %{mod_name}-%{version}

++++++ js-routes-1.4.9.gem -> js-routes-1.4.14.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/.gitignore new/.gitignore
--- old/.gitignore      2019-07-19 17:19:33.000000000 +0200
+++ new/.gitignore      2021-01-04 15:41:51.000000000 +0100
@@ -15,6 +15,8 @@
 # jeweler generated
 pkg
 
+node_modules
+
 # Have editor/IDE/OS specific files you need to ignore? Consider using a 
global gitignore:
 #
 # * Create a file at ~/.gitignore
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md    2019-07-19 17:19:33.000000000 +0200
+++ new/CHANGELOG.md    2021-01-04 15:41:51.000000000 +0100
@@ -1,5 +1,23 @@
 ## master
 
+## v1.4.14
+
+* Fix compatibility with UMD modules #237 
[Comment](https://github.com/railsware/js-routes/issues/237#issuecomment-752754679)
+
+## v1.4.13
+
+* Improve compatibility with node environment #269.
+* Change default file location configuration to Webpacker if both Webpacker 
and Sprockets are loaded
+
+## v1.4.11
+
+* Use app/javascript/routes.js as a default file location if app/javascript 
directory exists
+* Add `default` export for better experience when used as es6 module
+
+## v1.4.10
+
+* Require engine only when sprockets is loaded #257.
+
 ## v1.4.9
 
 * Allow to specify null namespace and receive routes as an object without 
assigning it anywhere #247
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Readme.md new/Readme.md
--- old/Readme.md       2019-07-19 17:19:33.000000000 +0200
+++ new/Readme.md       2021-01-04 15:41:51.000000000 +0100
@@ -12,9 +12,80 @@
 gem "js-routes"
 ```
 
-### Basic Setup
+## Setup
 
-Require JsRoutes in `application.js` or other bundle
+Run:
+
+```
+rake js:routes 
+```
+
+Make routes available globally in `app/javascript/packs/application.js`: 
+
+``` javascript
+window.Routes = require('routes');
+```
+
+Individual routes can be imported using:
+
+``` javascript
+import {edit_post_path, new_post_path} from 'routes';
+```
+
+**Note**: that this setup requires `rake js:routes` to be run each time routes 
file is updated.
+
+#### Webpacker + automatic updates
+
+This setup can automatically update your routes without `rake js:routes` being 
called manually.
+It requires 
[rails-erb-loader](https://github.com/usabilityhub/rails-erb-loader) npm 
package to work.
+
+Add `erb` loader to webpacker:
+
+``` sh
+yarn add rails-erb-loader
+rm -f app/javascript/routes.js # delete static file if any
+```
+
+Create webpack ERB config `config/webpack/loaders/erb.js`:
+
+``` javascript
+module.exports = {
+  test: /\.js\.erb$/,
+  enforce: 'pre',
+  exclude: /node_modules/,
+  use: [{
+    loader: 'rails-erb-loader',
+    options: {
+      runner: (/^win/.test(process.platform) ? 'ruby ' : '') + 'bin/rails 
runner'
+    }
+  }]
+}
+```
+
+Enable `erb` extension in `config/webpacker/environment.js`:
+
+```
+const erb = require('./loaders/erb')
+environment.loaders.append('erb', erb)
+```
+
+Create routes file `app/javascript/routes.js.erb`:
+
+``` erb
+<%= JsRoutes.generate() %>
+```
+
+Use routes wherever you need them `app/javascript/packs/application.js`: 
+
+``` javascript
+window.Routes = require('routes.js.erb');
+```
+
+#### Sprockets (Deprecated)
+
+If you are using [Sprockets](https://github.com/rails/sprockets-rails) you may 
configure js-routes in the following way.
+
+Require JsRoutes in `app/assets/javascripts/application.js` or other bundle
 
 ``` js
 //= require js-routes
@@ -32,7 +103,7 @@
 
 ### Configuration
 
-You can configure JsRoutes in two main ways. Either with an initializer (e.g. 
`config/initializers/jsroutes.rb`):
+You can configure JsRoutes in two main ways. Either with an initializer (e.g. 
`config/initializers/js_routes.rb`):
 
 ``` ruby
 JsRoutes.setup do |config|
@@ -40,7 +111,7 @@
 end
 ```
 
-Or dynamically in JavaScript, although not all configuration options are 
supported:
+Or dynamically in JavaScript, although only [Formatter 
Options](#formatter-options) are supported (see below)
 
 ``` js
 Routes.configure({
@@ -49,93 +120,84 @@
 Routes.config(); // current config
 ```
 
-Available options:
+#### Available Options
+
+##### Generator Options
+
+Options to configure JavaScript file generator. These options are only 
available in Ruby context but not JavaScript.
 
-* `default_url_options` - default parameters used when generating URLs
-  * Option is configurable at JS level with `Routes.configure()`
-  * Example: {:format => "json", :trailing\_slash => true, :protocol => 
"https", :subdomain => "api", :host => "example.com", :port => 3000}
-  * Default: {}
 * `exclude` - Array of regexps to exclude from routes.
-  * Default: []
+  * Default: `[]`
   * The regexp applies only to the name before the `_path` suffix, eg: you 
want to match exactly `settings_path`, the regexp should be `/^settings$/`
 * `include` - Array of regexps to include in routes.
-  * Default: []
+  * Default: `[]`
   * The regexp applies only to the name before the `_path` suffix, eg: you 
want to match exactly `settings_path`, the regexp should be `/^settings$/`
 * `namespace` - global object used to access routes.
   * Supports nested namespace like `MyProject.routes`
   * Default: `Routes`
-* `prefix` - String representing a url path to prepend to all paths.
-  * Option is configurable at JS level with `Routes.configure()`
-  * Example: `http://yourdomain.com`. This will cause route helpers to 
generate full path only.
-  * Default: `Rails.application.config.relative_url_root`
-* `camel_case` (version >= 0.8.8) - Generate camel case route names.
-  * Default: false
-* `url_links` (version >= 0.8.9) - Generate `*_url` helpers (in addition to 
the default `*_path` helpers).
-  * Example: true
-  * Default: false
+* `camel_case` - Generate camel case route names.
+  * Default: `false`
+* `url_links` - Generate `*_url` helpers (in addition to the default `*_path` 
helpers).
+  * Example: `true`
+  * Default: `false`
   * Note: generated URLs will first use the protocol, host, and port options 
specified in the route definition. Otherwise, the URL will be based on the 
option specified in the `default_url_options` config. If no default option has 
been set, then the URL will fallback to the current URL based on 
`window.location`.
-* `compact` (version > 0.9.9) - Remove `_path` suffix in path routes(`*_url` 
routes stay untouched if they were enabled)
-  * Default: false
+* `compact` - Remove `_path` suffix in path routes(`*_url` routes stay 
untouched if they were enabled)
+  * Default: `false`
   * Sample route call when option is set to true: Routes.users() => `/users`
-* `serializer` (version >= 1.1.0) - Puts a JS function here that serializes a 
Javascript Hash object into URL paramters: `{a: 1, b: 2} => "a=1&b=2"`.
-  * Default: `nil`. Uses built-in serializer
-  * Option is configurable at JS level with `Routes.configure()`
-  * Example: `jQuery.param` - use jQuery's serializer algorithm. You can 
attach serialize function from your favorite AJAX framework.
-  * Example: `MyApp.custom_serialize` - use completely custom serializer of 
your application.
-
-* `special_options_key` - a special key that helps JsRoutes to destinguish 
serialized model from options hash
-  * This option is required because JS doesn't provide a difference between an 
object and a hash
-  * Option is configurable at JS level with `Routes.configure()`
-  * Default: `_options`
 * `application` - a key to specify which rails engine you want to generate 
routes too.
   * This option allows to only generate routes for a specific rails engine, 
that is mounted into routes instead of all Rails app routes
   * Default: `Rails.application`
+* `file` - a file location where generated routes are stored
+  * Default: `app/javascript/routes.js` if setup with Webpacker, otherwise 
`app/assets/javascripts/routes.js` if setup with Sprockets.
+
+##### Formatter Options
+
+Options to configure routes formatting. These options are available both in 
Ruby and JavaScript context.
 
-### Very Advanced Setup
+* `default_url_options` - default parameters used when generating URLs
+  * Example: `{format: "json", trailing_slash: true, protocol: "https", 
subdomain: "api", host: "example.com", port: 3000}`
+  * Default: `{}`
+* `prefix` - string that will prepend any generated URL. Usually used when app 
URL root includes a path component.
+  * Example: `/rails-app`
+  * Default: `Rails.application.config.relative_url_root`
+* `serializer` - a JS function that serializes a Javascript Hash object into 
URL paramters like `{a: 1, b: 2} => "a=1&b=2"`.
+  * Default: `nil`. Uses built-in serializer compatible with Rails
+  * Example: `jQuery.param` - use jQuery's serializer algorithm. You can 
attach serialize function from your favorite AJAX framework.
+  * Example: `function (object) { ... }` - use completely custom serializer of 
your application.
+* `special_options_key` - a special key that helps JsRoutes to destinguish 
serialized model from options hash
+  * This option exists because JS doesn't provide a difference between an 
object and a hash
+  * Default: `_options`
+
+### Advanced Setup
 
 In case you need multiple route files for different parts of your application, 
you have to create the files manually.
 If your application has an `admin` and an `application` namespace for example:
 
 ```
-# app/assets/javascripts/admin/routes.js.erb
+# app/javascript/admin/routes.js.erb
 <%= JsRoutes.generate(namespace: "AdminRoutes", include: /admin/) %>
-
-# app/assets/javascripts/admin.js.coffee
-#= require admin/routes
 ```
 
 ```
-# app/assets/javascripts/application/routes.js.erb
-<%= JsRoutes.generate(namespace: "AppRoutes", exclude: /admin/) %>
-
-# app/assets/javascripts/application.js.coffee
-#= require application/routes
+# app/javascript/customer/routes.js.erb
+<%= JsRoutes.generate(namespace: "CustomerRoutes", exclude: /admin/) %>
 ```
 
 In order to generate the routes JS code to a string:
 
-```ruby
+``` ruby
 routes_js = JsRoutes.generate(options)
 ```
 
 If you want to generate the routes files outside of the asset pipeline, you 
can use `JsRoutes.generate!`:
 
 ``` ruby
-path = "app/assets/javascripts"
-JsRoutes.generate!("#{path}/app_routes.js", :namespace => "AppRoutes", 
:exclude => [/^admin_/, /^api_/])
-JsRoutes.generate!("#{path}/adm_routes.js", :namespace => "AdmRoutes", 
:include => /^admin_/)
-JsRoutes.generate!("#{path}/api_routes.js", :namespace => "ApiRoutes", 
:include => /^api_/, :default_url_options => {:format => "json"})
+path = "app/javascript"
+JsRoutes.generate!("#{path}/app_routes.js", namespace: "AppRoutes", exclude: 
[/^admin_/, /^api_/])
+JsRoutes.generate!("#{path}/adm_routes.js", namespace: "AdmRoutes", include: 
/^admin_/)
+JsRoutes.generate!("#{path}/api_routes.js", namespace: "ApiRoutes", include: 
/^api_/, default_url_options: {format: "json"})
 ```
 
-### Rails relative URL root
-
-If you've installed your application in a sub-path or sub-URI of your server 
instead of at the root, you need to set the `RAILS_RELATIVE_URL_ROOT` 
environment variable to the correct path prefix for your application when you 
precompile assets. Eg., if your application's base URL is 
"https://appl.example.com/Application1";, the command to precompile assets would 
be:
-```
-RAILS_RELATIVE_URL_ROOT=/Application1 RAILS_ENV=production bundle exec rake 
assets:precompile
-```
-The environment variable is only needed for precompilation of assets, at any 
other time (eg. when assets are compiled on-the-fly as in the development 
environment) Rails will set the relative URL root correctly on it's own.
-
-
 ## Usage
 
 Configuration above will create a nice javascript file with `Routes` object 
that has all the rails routes available:
@@ -206,7 +268,7 @@
 
 ## What about security?
 
-JsRoutes itself do not have security holes. It makes URLs
+JsRoutes itself does not have security holes. It makes URLs
 without access protection more reachable by potential attacker.
 In order to prevent this use `:exclude` option for sensitive urls like 
`/admin_/`
 
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/js-routes.gemspec new/js-routes.gemspec
--- old/js-routes.gemspec       2019-07-19 17:19:33.000000000 +0200
+++ new/js-routes.gemspec       2021-01-04 15:41:51.000000000 +0100
@@ -21,7 +21,7 @@
   s.summary = %q{Brings Rails named routes to javascript}
 
   s.add_runtime_dependency(%q<railties>, [">= 4"])
-  s.add_runtime_dependency(%q<sprockets-rails>)
+  s.add_development_dependency(%q<sprockets-rails>)
   s.add_development_dependency(%q<rspec>, [">= 3.0.0"])
   s.add_development_dependency(%q<bundler>, [">= 1.1.0"])
   s.add_development_dependency(%q<coffee-script>, [">= 0"])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/js_routes/engine.rb new/lib/js_routes/engine.rb
--- old/lib/js_routes/engine.rb 2019-07-19 17:19:33.000000000 +0200
+++ new/lib/js_routes/engine.rb 2021-01-04 15:41:51.000000000 +0100
@@ -47,7 +47,6 @@
       when  -> (v) { v2.match?('', v) },
             -> (v) { vgte3.match?('', v) }
 
-      # Other rails version, assumed newer
       Rails.application.config.assets.configure do |config|
         config.register_preprocessor(
           "application/javascript",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/js_routes/version.rb new/lib/js_routes/version.rb
--- old/lib/js_routes/version.rb        2019-07-19 17:19:33.000000000 +0200
+++ new/lib/js_routes/version.rb        2021-01-04 15:41:51.000000000 +0100
@@ -1,3 +1,3 @@
 class JsRoutes
-  VERSION = "1.4.9"
+  VERSION = "1.4.14"
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/js_routes.rb new/lib/js_routes.rb
--- old/lib/js_routes.rb        2019-07-19 17:19:33.000000000 +0200
+++ new/lib/js_routes.rb        2021-01-04 15:41:51.000000000 +0100
@@ -1,5 +1,7 @@
 require 'uri'
-require 'js_routes/engine' if defined?(Rails)
+if defined?(::Rails) && defined?(::Sprockets::Railtie)
+  require 'js_routes/engine'
+end
 require 'js_routes/version'
 
 class JsRoutes
@@ -8,13 +10,17 @@
   # OPTIONS
   #
 
-  DEFAULT_PATH = File.join('app','assets','javascripts','routes.js')
-
   DEFAULTS = {
-    namespace: "Routes",
+    namespace: -> { defined?(Webpacker) ? nil : "Routes" },
     exclude: [],
     include: //,
-    file: DEFAULT_PATH,
+    file: -> do
+      webpacker_dir = Rails.root.join('app', 'javascript')
+      sprockets_dir = Rails.root.join('app','assets','javascripts')
+      sprockets_file = sprockets_dir.join('routes.js')
+      webpacker_file = webpacker_dir.join('routes.js')
+      !Dir.exists?(webpacker_dir) && defined?(::Sprockets) ? sprockets_file : 
webpacker_file
+    end,
     prefix: -> { Rails.application.config.relative_url_root || "" },
     url_links: false,
     camel_case: false,
@@ -23,7 +29,7 @@
     serializer: nil,
     special_options_key: "_options",
     application: -> { Rails.application }
-  }
+  } #:nodoc:
 
   NODE_TYPES = {
     GROUP: 1,
@@ -34,11 +40,11 @@
     LITERAL: 6,
     SLASH: 7,
     DOT: 8
-  }
+  } #:nodoc:
 
-  LAST_OPTIONS_KEY = "options".freeze
-  FILTERED_DEFAULT_PARTS = [:controller, :action]
-  URL_OPTIONS = [:protocol, :domain, :host, :port, :subdomain]
+  LAST_OPTIONS_KEY = "options".freeze #:nodoc:
+  FILTERED_DEFAULT_PARTS = [:controller, :action] #:nodoc:
+  URL_OPTIONS = [:protocol, :domain, :host, :port, :subdomain] #:nodoc:
 
   class Configuration < Struct.new(*DEFAULTS.keys)
     def initialize(attributes = nil)
@@ -215,7 +221,7 @@
     parent_spec = parent_route.try(:path).try(:spec)
     route_arguments = route_js_arguments(route, parent_spec)
     url_link = generate_url_link(name, route_arguments)
-    _ = <<-JS.strip!
+    <<-JS.strip!
   // #{name.join('.')} => #{parent_spec}#{route.path.spec}
   // function(#{build_params(route.required_parts)})
   #{route_name}: Utils.route(#{route_arguments})#{",\n" + url_link if 
url_link.length > 0}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/routes.js new/lib/routes.js
--- old/lib/routes.js   2019-07-19 17:19:33.000000000 +0200
+++ new/lib/routes.js   2021-01-04 15:41:51.000000000 +0100
@@ -4,12 +4,10 @@
  */
 
 (function() {
-  var DeprecatedGlobbingBehavior, NodeTypes, ParameterMissing, 
ReservedOptions, SpecialOptionsKey, UriEncoderSegmentRegex, Utils, result, root,
+  var DeprecatedGlobbingBehavior, NodeTypes, ParameterMissing, 
ReservedOptions, SpecialOptionsKey, UriEncoderSegmentRegex, Utils, error, 
result,
     hasProp = {}.hasOwnProperty,
     slice = [].slice;
 
-  root = typeof exports !== "undefined" && exports !== null ? exports : this;
-
   ParameterMissing = function(message, fileName, lineNumber) {
     var instance;
     instance = new Error(message, fileName, lineNumber);
@@ -437,8 +435,8 @@
       return this._classToTypeCache;
     },
     get_object_type: function(obj) {
-      if (root.jQuery && (root.jQuery.type != null)) {
-        return root.jQuery.type(obj);
+      if (this.jQuery && (this.jQuery.type != null)) {
+        return this.jQuery.type(obj);
       }
       if (obj == null) {
         return "" + obj;
@@ -497,16 +495,12 @@
       routes.config = function() {
         return Utils.config();
       };
-      Object.defineProperty(routes, 'defaults', {
-        get: function() {
-          throw new Error(NAMESPACE + ".defaults is removed. Use " + NAMESPACE 
+ ".configure() instead.");
-        },
-        set: function(value) {}
-      });
       routes.default_serializer = function(object, prefix) {
         return Utils.default_serializer(object, prefix);
       };
-      return Utils.namespace(root, NAMESPACE, routes);
+      return Object.assign({
+        "default": routes
+      }, routes);
     }
   };
 
@@ -516,6 +510,17 @@
     define([], function() {
       return result;
     });
+  } else if (typeof module !== "undefined" && module !== null) {
+    try {
+      module.exports = result;
+    } catch (error1) {
+      error = error1;
+      if (error.name !== 'TypeError') {
+        throw error;
+      }
+    }
+  } else {
+    Utils.namespace(this, NAMESPACE, result);
   }
 
   return result;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/routes.js.coffee new/lib/routes.js.coffee
--- old/lib/routes.js.coffee    2019-07-19 17:19:33.000000000 +0200
+++ new/lib/routes.js.coffee    2021-01-04 15:41:51.000000000 +0100
@@ -2,7 +2,6 @@
 File generated by js-routes GEM_VERSION
 Based on Rails RAILS_VERSION routes of APP_CLASS
 ###
-root = (exports ? this)
 
 ParameterMissing = (message, fileName, lineNumber) ->
   instance = new Error(message, fileName, lineNumber)
@@ -363,7 +362,7 @@
       @_classToTypeCache["[object #{name}]"] = name.toLowerCase()
     @_classToTypeCache
   get_object_type: (obj) ->
-    return root.jQuery.type(obj) if root.jQuery and root.jQuery.type?
+    return this.jQuery.type(obj) if this.jQuery and this.jQuery.type?
     return "#{obj}" unless obj?
     (if typeof obj is "object" or typeof obj is "function" then 
@_classToType()[Object::toString.call(obj)] or "object" else typeof obj)
 
@@ -393,19 +392,25 @@
     routes = ROUTES
     routes.configure = (config) -> Utils.configure(config)
     routes.config = -> Utils.config()
-    Object.defineProperty routes, 'defaults',
-      get: ->
-        throw new Error("#{NAMESPACE}.defaults is removed. Use 
#{NAMESPACE}.configure() instead.")
-      set: (value) ->
-
     routes.default_serializer = (object, prefix) ->
       Utils.default_serializer(object, prefix)
-    # Browser globals
-    Utils.namespace(root, NAMESPACE, routes)
+    Object.assign({default: routes}, routes)
 
 result = Utils.make()
+
 # Set up Routes appropriately for the environment.
 if typeof define is "function" and define.amd
   # AMD
   define [], -> result
+else if module?
+  # CommonJS
+  try
+    module.exports = result
+  catch error
+    unless error.name == 'TypeError'
+      throw error
+else
+  # Browser globals
+  Utils.namespace(this, NAMESPACE, result)
+
 return result
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2019-07-19 17:19:33.000000000 +0200
+++ new/metadata        2021-01-04 15:41:51.000000000 +0100
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: js-routes
 version: !ruby/object:Gem::Version
-  version: 1.4.9
+  version: 1.4.14
 platform: ruby
 authors:
 - Bogdan Gusiev
-autorequire: 
+autorequire:
 bindir: bin
 cert_chain: []
-date: 2019-07-19 00:00:00.000000000 Z
+date: 2021-01-04 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: railties
@@ -31,7 +31,7 @@
     - - ">="
       - !ruby/object:Gem::Version
         version: '0'
-  type: :runtime
+  type: :development
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
@@ -172,9 +172,11 @@
 - lib/routes.js
 - lib/routes.js.coffee
 - lib/tasks/js_routes.rake
+- spec/dummy/app/assets/config/manifest.js
 - spec/dummy/app/assets/javascripts/.gitkeep
 - spec/dummy/config/routes.rb
 - spec/js_routes/amd_compatibility_spec.rb
+- spec/js_routes/common_js_compatibility_spec.rb
 - spec/js_routes/default_serializer_spec.rb
 - spec/js_routes/generated_javascript_spec.rb
 - spec/js_routes/options_spec.rb
@@ -186,7 +188,7 @@
 licenses:
 - MIT
 metadata: {}
-post_install_message: 
+post_install_message:
 rdoc_options: []
 require_paths:
 - lib
@@ -201,9 +203,8 @@
     - !ruby/object:Gem::Version
       version: '0'
 requirements: []
-rubyforge_project: 
-rubygems_version: 2.7.8
-signing_key: 
+rubygems_version: 3.2.0
+signing_key:
 specification_version: 4
 summary: Brings Rails named routes to javascript
 test_files: []
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/dummy/app/assets/config/manifest.js 
new/spec/dummy/app/assets/config/manifest.js
--- old/spec/dummy/app/assets/config/manifest.js        1970-01-01 
01:00:00.000000000 +0100
+++ new/spec/dummy/app/assets/config/manifest.js        2021-01-04 
15:41:51.000000000 +0100
@@ -0,0 +1,2 @@
+//= link_tree ../images
+//= link_directory ../stylesheets .css
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/js_routes/amd_compatibility_spec.rb 
new/spec/js_routes/amd_compatibility_spec.rb
--- old/spec/js_routes/amd_compatibility_spec.rb        2019-07-19 
17:19:33.000000000 +0200
+++ new/spec/js_routes/amd_compatibility_spec.rb        2021-01-04 
15:41:51.000000000 +0100
@@ -27,16 +27,11 @@
     evaljs(JsRoutes.generate({}))
   end
 
-  it "should working from global scope" do
-    expect(evaljs("Routes.inboxes_path()")).to eq(test_routes.inboxes_path())
-  end
-
-  it "should working from define function" do
-    expect(evaljs("Routes.inboxes_path()")).to 
eq(evaljs("GlobalCheck['js-routes'].inboxes_path()"))
-  end
-
   it "should working from require" do
     expect(evaljs("require(['js-routes'], function(r){ return 
r.inboxes_path(); })")).to eq(test_routes.inboxes_path())
   end
 
+  it "should define default export for es6 modules" do
+    expect(evaljs("require(['js-routes'], function(r){ return 
r.default.inboxes_path(); })")).to eq(test_routes.inboxes_path())
+  end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/js_routes/common_js_compatibility_spec.rb 
new/spec/js_routes/common_js_compatibility_spec.rb
--- old/spec/js_routes/common_js_compatibility_spec.rb  1970-01-01 
01:00:00.000000000 +0100
+++ new/spec/js_routes/common_js_compatibility_spec.rb  2021-01-04 
15:41:51.000000000 +0100
@@ -0,0 +1,12 @@
+require "spec_helper"
+
+describe JsRoutes, "compatibility with CommonJS (node)"  do
+  before(:each) do
+    evaljs("module = { exports: null }")
+    evaljs(JsRoutes.generate({}))
+  end
+
+  it "should define module exports" do
+    expect(evaljs("module.exports.inboxes_path()")).to 
eq(test_routes.inboxes_path())
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/js_routes/generated_javascript_spec.rb 
new/spec/js_routes/generated_javascript_spec.rb
--- old/spec/js_routes/generated_javascript_spec.rb     2019-07-19 
17:19:33.000000000 +0200
+++ new/spec/js_routes/generated_javascript_spec.rb     2021-01-04 
15:41:51.000000000 +0100
@@ -60,11 +60,6 @@
     end
 
     it "should not generate file before initialization" do
-      # This method is alread fixed in Rails master
-      # But in 3.2 stable we need to hack it like this
-      if Rails.application.instance_variable_get("@initialized")
-        pending
-      end
       expect(File.exists?(name)).to be_falsey
     end
 

Reply via email to