webpacker 4.0.7 → 4.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.node-version +1 -1
 - data/.rubocop.yml +2 -1
 - data/.travis.yml +7 -4
 - data/CHANGELOG.md +226 -137
 - data/Gemfile.lock +78 -59
 - data/README.md +110 -3
 - data/docs/css.md +12 -0
 - data/docs/deployment.md +38 -9
 - data/docs/docker.md +25 -6
 - data/docs/engines.md +40 -3
 - data/docs/es6.md +19 -1
 - data/docs/troubleshooting.md +37 -9
 - data/docs/typescript.md +8 -5
 - data/docs/webpack-dev-server.md +1 -1
 - data/docs/webpack.md +18 -3
 - data/gemfiles/Gemfile-rails.6.0.x +9 -0
 - data/lib/install/bin/webpack +0 -1
 - data/lib/install/bin/webpack-dev-server +0 -1
 - data/lib/install/coffee.rb +1 -1
 - data/lib/install/config/babel.config.js +10 -10
 - data/lib/install/config/webpacker.yml +2 -1
 - data/lib/install/elm.rb +1 -1
 - data/lib/install/erb.rb +2 -2
 - data/lib/install/examples/angular/hello_angular/polyfills.ts +2 -2
 - data/lib/install/examples/react/babel.config.js +16 -14
 - data/lib/install/examples/svelte/app.svelte +11 -0
 - data/lib/install/examples/svelte/hello_svelte.js +20 -0
 - data/lib/install/loaders/elm.js +9 -6
 - data/lib/install/loaders/svelte.js +9 -0
 - data/lib/install/loaders/typescript.js +1 -1
 - data/lib/install/svelte.rb +29 -0
 - data/lib/install/template.rb +1 -1
 - data/lib/install/typescript.rb +1 -1
 - data/lib/install/vue.rb +1 -1
 - data/lib/tasks/installers.rake +1 -0
 - data/lib/tasks/webpacker.rake +2 -0
 - data/lib/tasks/webpacker/clean.rake +19 -0
 - data/lib/tasks/webpacker/compile.rake +2 -10
 - data/lib/tasks/webpacker/yarn_install.rake +15 -0
 - data/lib/webpacker.rb +9 -1
 - data/lib/webpacker/commands.rb +29 -1
 - data/lib/webpacker/compiler.rb +15 -8
 - data/lib/webpacker/configuration.rb +9 -1
 - data/lib/webpacker/dev_server.rb +1 -1
 - data/lib/webpacker/dev_server_proxy.rb +2 -8
 - data/lib/webpacker/env.rb +1 -1
 - data/lib/webpacker/helper.rb +39 -13
 - data/lib/webpacker/railtie.rb +6 -0
 - data/lib/webpacker/version.rb +1 -1
 - data/package.json +36 -36
 - data/package/__tests__/config.js +0 -23
 - data/package/config.js +2 -10
 - data/package/config_types/config_list.js +3 -3
 - data/package/config_types/config_object.js +1 -1
 - data/package/environments/base.js +2 -2
 - data/package/environments/development.js +1 -1
 - data/package/environments/production.js +12 -0
 - data/package/rules/babel.js +1 -1
 - data/package/rules/node_modules.js +2 -2
 - data/package/rules/sass.js +1 -1
 - data/package/utils/__tests__/get_style_rule.js +9 -0
 - data/package/utils/deep_merge.js +5 -5
 - data/package/utils/get_style_rule.js +7 -12
 - data/package/utils/helpers.js +9 -9
 - data/test/command_test.rb +6 -0
 - data/test/compiler_test.rb +5 -6
 - data/test/configuration_test.rb +36 -27
 - data/test/dev_server_test.rb +22 -0
 - data/test/helper_test.rb +34 -0
 - data/test/rake_tasks_test.rb +6 -0
 - data/test/test_app/bin/webpack +0 -1
 - data/test/test_app/bin/webpack-dev-server +0 -1
 - data/test/test_app/config/webpacker.yml +1 -0
 - data/test/test_app/public/packs/manifest.json +3 -0
 - data/webpacker.gemspec +1 -0
 - data/yarn.lock +1934 -1634
 - metadata +24 -4
 
    
        data/lib/webpacker/dev_server.rb
    CHANGED
    
    
| 
         @@ -5,16 +5,10 @@ class Webpacker::DevServerProxy < Rack::Proxy 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
              def initialize(app = nil, opts = {})
         
     | 
| 
       7 
7 
     | 
    
         
             
                @webpacker = opts.delete(:webpacker) || Webpacker.instance
         
     | 
| 
      
 8 
     | 
    
         
            +
                opts[:streaming] = false if Rails.env.test? && !opts.key?(:streaming)
         
     | 
| 
       8 
9 
     | 
    
         
             
                super
         
     | 
| 
       9 
10 
     | 
    
         
             
              end
         
     | 
| 
       10 
11 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
              def rewrite_response(response)
         
     | 
| 
       12 
     | 
    
         
            -
                _status, headers, _body = response
         
     | 
| 
       13 
     | 
    
         
            -
                headers.delete "transfer-encoding"
         
     | 
| 
       14 
     | 
    
         
            -
                headers.delete "content-length" if dev_server.running? && dev_server.https?
         
     | 
| 
       15 
     | 
    
         
            -
                response
         
     | 
| 
       16 
     | 
    
         
            -
              end
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
12 
     | 
    
         
             
              def perform_request(env)
         
     | 
| 
       19 
13 
     | 
    
         
             
                if env["PATH_INFO"].start_with?("/#{public_output_uri_path}") && dev_server.running?
         
     | 
| 
       20 
14 
     | 
    
         
             
                  env["HTTP_HOST"] = env["HTTP_X_FORWARDED_HOST"] = env["HTTP_X_FORWARDED_SERVER"] = dev_server.host_with_port
         
     | 
| 
         @@ -32,6 +26,6 @@ class Webpacker::DevServerProxy < Rack::Proxy 
     | 
|
| 
       32 
26 
     | 
    
         | 
| 
       33 
27 
     | 
    
         
             
              private
         
     | 
| 
       34 
28 
     | 
    
         
             
                def public_output_uri_path
         
     | 
| 
       35 
     | 
    
         
            -
                  config.public_output_path.relative_path_from(config.public_path)
         
     | 
| 
      
 29 
     | 
    
         
            +
                  config.public_output_path.relative_path_from(config.public_path).to_s + "/"
         
     | 
| 
       36 
30 
     | 
    
         
             
                end
         
     | 
| 
       37 
31 
     | 
    
         
             
            end
         
     | 
    
        data/lib/webpacker/env.rb
    CHANGED
    
    
    
        data/lib/webpacker/helper.rb
    CHANGED
    
    | 
         @@ -1,13 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Webpacker::Helper
         
     | 
| 
       2 
     | 
    
         
            -
              # Returns current Webpacker instance.
         
     | 
| 
      
 2 
     | 
    
         
            +
              # Returns the current Webpacker instance.
         
     | 
| 
       3 
3 
     | 
    
         
             
              # Could be overridden to use multiple Webpacker
         
     | 
| 
       4 
     | 
    
         
            -
              # configurations within the same app (e.g. with engines)
         
     | 
| 
      
 4 
     | 
    
         
            +
              # configurations within the same app (e.g. with engines).
         
     | 
| 
       5 
5 
     | 
    
         
             
              def current_webpacker_instance
         
     | 
| 
       6 
6 
     | 
    
         
             
                Webpacker.instance
         
     | 
| 
       7 
7 
     | 
    
         
             
              end
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
              # Computes the relative path for a given Webpacker asset.
         
     | 
| 
       10 
     | 
    
         
            -
              #  
     | 
| 
      
 10 
     | 
    
         
            +
              # Returns the relative path using manifest.json and passes it to asset_path helper.
         
     | 
| 
       11 
11 
     | 
    
         
             
              # This will use asset_path internally, so most of their behaviors will be the same.
         
     | 
| 
       12 
12 
     | 
    
         
             
              #
         
     | 
| 
       13 
13 
     | 
    
         
             
              # Example:
         
     | 
| 
         @@ -19,12 +19,12 @@ module Webpacker::Helper 
     | 
|
| 
       19 
19 
     | 
    
         
             
              #   <%= asset_pack_path 'calendar.css' %> # => "/packs/calendar-1016838bab065ae1e122.css"
         
     | 
| 
       20 
20 
     | 
    
         
             
              def asset_pack_path(name, **options)
         
     | 
| 
       21 
21 
     | 
    
         
             
                if current_webpacker_instance.config.extract_css? || !stylesheet?(name)
         
     | 
| 
       22 
     | 
    
         
            -
                  asset_path(current_webpacker_instance.manifest.lookup!(name),  
     | 
| 
      
 22 
     | 
    
         
            +
                  asset_path(current_webpacker_instance.manifest.lookup!(name), options)
         
     | 
| 
       23 
23 
     | 
    
         
             
                end
         
     | 
| 
       24 
24 
     | 
    
         
             
              end
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
              # Computes the absolute path for a given Webpacker asset.
         
     | 
| 
       27 
     | 
    
         
            -
              #  
     | 
| 
      
 27 
     | 
    
         
            +
              # Returns the absolute path using manifest.json and passes it to asset_url helper.
         
     | 
| 
       28 
28 
     | 
    
         
             
              # This will use asset_url internally, so most of their behaviors will be the same.
         
     | 
| 
       29 
29 
     | 
    
         
             
              #
         
     | 
| 
       30 
30 
     | 
    
         
             
              # Example:
         
     | 
| 
         @@ -36,18 +36,28 @@ module Webpacker::Helper 
     | 
|
| 
       36 
36 
     | 
    
         
             
              #   <%= asset_pack_url 'calendar.css' %> # => "http://example.com/packs/calendar-1016838bab065ae1e122.css"
         
     | 
| 
       37 
37 
     | 
    
         
             
              def asset_pack_url(name, **options)
         
     | 
| 
       38 
38 
     | 
    
         
             
                if current_webpacker_instance.config.extract_css? || !stylesheet?(name)
         
     | 
| 
       39 
     | 
    
         
            -
                  asset_url(current_webpacker_instance.manifest.lookup!(name),  
     | 
| 
      
 39 
     | 
    
         
            +
                  asset_url(current_webpacker_instance.manifest.lookup!(name), options)
         
     | 
| 
       40 
40 
     | 
    
         
             
                end
         
     | 
| 
       41 
41 
     | 
    
         
             
              end
         
     | 
| 
       42 
42 
     | 
    
         | 
| 
       43 
     | 
    
         
            -
              # Creates  
     | 
| 
      
 43 
     | 
    
         
            +
              # Creates an image tag that references the named pack file.
         
     | 
| 
       44 
44 
     | 
    
         
             
              #
         
     | 
| 
       45 
45 
     | 
    
         
             
              # Example:
         
     | 
| 
       46 
46 
     | 
    
         
             
              #
         
     | 
| 
       47 
47 
     | 
    
         
             
              #  <%= image_pack_tag 'application.png', size: '16x10', alt: 'Edit Entry' %>
         
     | 
| 
       48 
48 
     | 
    
         
             
              #  <img alt='Edit Entry' src='/packs/application-k344a6d59eef8632c9d1.png' width='16' height='10' />
         
     | 
| 
       49 
49 
     | 
    
         
             
              def image_pack_tag(name, **options)
         
     | 
| 
       50 
     | 
    
         
            -
                image_tag(resolve_path_to_image(name),  
     | 
| 
      
 50 
     | 
    
         
            +
                image_tag(resolve_path_to_image(name), options)
         
     | 
| 
      
 51 
     | 
    
         
            +
              end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
              # Creates a link tag for a favicon that references the named pack file.
         
     | 
| 
      
 54 
     | 
    
         
            +
              #
         
     | 
| 
      
 55 
     | 
    
         
            +
              # Example:
         
     | 
| 
      
 56 
     | 
    
         
            +
              #
         
     | 
| 
      
 57 
     | 
    
         
            +
              #  <%= favicon_pack_tag 'mb-icon.png', rel: 'apple-touch-icon', type: 'image/png' %>
         
     | 
| 
      
 58 
     | 
    
         
            +
              #  <link href="/packs/mb-icon-k344a6d59eef8632c9d1.png" rel="apple-touch-icon" type="image/png" />
         
     | 
| 
      
 59 
     | 
    
         
            +
              def favicon_pack_tag(name, **options)
         
     | 
| 
      
 60 
     | 
    
         
            +
                favicon_link_tag(resolve_path_to_image(name), options)
         
     | 
| 
       51 
61 
     | 
    
         
             
              end
         
     | 
| 
       52 
62 
     | 
    
         | 
| 
       53 
63 
     | 
    
         
             
              # Creates a script tag that references the named pack file, as compiled by webpack per the entries list
         
     | 
| 
         @@ -62,7 +72,7 @@ module Webpacker::Helper 
     | 
|
| 
       62 
72 
     | 
    
         
             
                javascript_include_tag(*sources_from_manifest_entries(names, type: :javascript), **options)
         
     | 
| 
       63 
73 
     | 
    
         
             
              end
         
     | 
| 
       64 
74 
     | 
    
         | 
| 
       65 
     | 
    
         
            -
              # Creates script tags that  
     | 
| 
      
 75 
     | 
    
         
            +
              # Creates script tags that reference the js chunks from entrypoints when using split chunks API,
         
     | 
| 
       66 
76 
     | 
    
         
             
              # as compiled by webpack per the entries list in config/webpack/shared.js.
         
     | 
| 
       67 
77 
     | 
    
         
             
              # By default, this list is auto-generated to match everything in
         
     | 
| 
       68 
78 
     | 
    
         
             
              # app/javascript/packs/*.js and all the dependent chunks. In production mode, the digested reference is automatically looked up.
         
     | 
| 
         @@ -78,12 +88,27 @@ module Webpacker::Helper 
     | 
|
| 
       78 
88 
     | 
    
         
             
              # DO:
         
     | 
| 
       79 
89 
     | 
    
         
             
              # <%= javascript_packs_with_chunks_tag 'calendar', 'map' %>
         
     | 
| 
       80 
90 
     | 
    
         
             
              # DON'T:
         
     | 
| 
       81 
     | 
    
         
            -
              # 
     | 
| 
      
 91 
     | 
    
         
            +
              # <%= javascript_packs_with_chunks_tag 'calendar' %>
         
     | 
| 
       82 
92 
     | 
    
         
             
              # <%= javascript_packs_with_chunks_tag 'map' %>
         
     | 
| 
       83 
93 
     | 
    
         
             
              def javascript_packs_with_chunks_tag(*names, **options)
         
     | 
| 
       84 
94 
     | 
    
         
             
                javascript_include_tag(*sources_from_manifest_entrypoints(names, type: :javascript), **options)
         
     | 
| 
       85 
95 
     | 
    
         
             
              end
         
     | 
| 
       86 
96 
     | 
    
         | 
| 
      
 97 
     | 
    
         
            +
              # Creates a link tag, for preloading, that references a given Webpacker asset.
         
     | 
| 
      
 98 
     | 
    
         
            +
              # In production mode, the digested reference is automatically looked up.
         
     | 
| 
      
 99 
     | 
    
         
            +
              # See: https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content
         
     | 
| 
      
 100 
     | 
    
         
            +
              # Example:
         
     | 
| 
      
 101 
     | 
    
         
            +
              #
         
     | 
| 
      
 102 
     | 
    
         
            +
              #   <%= preload_pack_asset 'fonts/fa-regular-400.woff2' %> # =>
         
     | 
| 
      
 103 
     | 
    
         
            +
              #   <link rel="preload" href="/packs/fonts/fa-regular-400-944fb546bd7018b07190a32244f67dc9.woff2" as="font" type="font/woff2" crossorigin="anonymous">
         
     | 
| 
      
 104 
     | 
    
         
            +
              def preload_pack_asset(name, **options)
         
     | 
| 
      
 105 
     | 
    
         
            +
                if self.class.method_defined?(:preload_link_tag)
         
     | 
| 
      
 106 
     | 
    
         
            +
                  preload_link_tag(current_webpacker_instance.manifest.lookup!(name), options)
         
     | 
| 
      
 107 
     | 
    
         
            +
                else
         
     | 
| 
      
 108 
     | 
    
         
            +
                  raise "You need Rails >= 5.2 to use this tag."
         
     | 
| 
      
 109 
     | 
    
         
            +
                end
         
     | 
| 
      
 110 
     | 
    
         
            +
              end
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
       87 
112 
     | 
    
         
             
              # Creates a link tag that references the named pack file, as compiled by webpack per the entries list
         
     | 
| 
       88 
113 
     | 
    
         
             
              # in config/webpack/shared.js. By default, this list is auto-generated to match everything in
         
     | 
| 
       89 
114 
     | 
    
         
             
              # app/javascript/packs/*.js. In production mode, the digested reference is automatically looked up.
         
     | 
| 
         @@ -106,12 +131,13 @@ module Webpacker::Helper 
     | 
|
| 
       106 
131 
     | 
    
         
             
                end
         
     | 
| 
       107 
132 
     | 
    
         
             
              end
         
     | 
| 
       108 
133 
     | 
    
         | 
| 
       109 
     | 
    
         
            -
              # Creates link tags that  
     | 
| 
      
 134 
     | 
    
         
            +
              # Creates link tags that reference the css chunks from entrypoints when using split chunks API,
         
     | 
| 
       110 
135 
     | 
    
         
             
              # as compiled by webpack per the entries list in config/webpack/shared.js.
         
     | 
| 
       111 
136 
     | 
    
         
             
              # By default, this list is auto-generated to match everything in
         
     | 
| 
       112 
137 
     | 
    
         
             
              # app/javascript/packs/*.js and all the dependent chunks. In production mode, the digested reference is automatically looked up.
         
     | 
| 
       113 
138 
     | 
    
         
             
              # See: https://webpack.js.org/plugins/split-chunks-plugin/
         
     | 
| 
       114 
     | 
    
         
            -
              # 
     | 
| 
      
 139 
     | 
    
         
            +
              #
         
     | 
| 
      
 140 
     | 
    
         
            +
              # Examples:
         
     | 
| 
       115 
141 
     | 
    
         
             
              #
         
     | 
| 
       116 
142 
     | 
    
         
             
              #   <%= stylesheet_packs_with_chunks_tag 'calendar', 'map' %> # =>
         
     | 
| 
       117 
143 
     | 
    
         
             
              #   <link rel="stylesheet" media="screen" href="/packs/3-8c7ce31a.chunk.css" />
         
     | 
| 
         @@ -120,7 +146,7 @@ module Webpacker::Helper 
     | 
|
| 
       120 
146 
     | 
    
         
             
              # DO:
         
     | 
| 
       121 
147 
     | 
    
         
             
              # <%= stylesheet_packs_with_chunks_tag 'calendar', 'map' %>
         
     | 
| 
       122 
148 
     | 
    
         
             
              # DON'T:
         
     | 
| 
       123 
     | 
    
         
            -
              # 
     | 
| 
      
 149 
     | 
    
         
            +
              # <%= stylesheet_packs_with_chunks_tag 'calendar' %>
         
     | 
| 
       124 
150 
     | 
    
         
             
              # <%= stylesheet_packs_with_chunks_tag 'map' %>
         
     | 
| 
       125 
151 
     | 
    
         
             
              def stylesheet_packs_with_chunks_tag(*names, **options)
         
     | 
| 
       126 
152 
     | 
    
         
             
                if current_webpacker_instance.config.extract_css?
         
     | 
    
        data/lib/webpacker/railtie.rb
    CHANGED
    
    | 
         @@ -89,4 +89,10 @@ class Webpacker::Engine < ::Rails::Engine 
     | 
|
| 
       89 
89 
     | 
    
         
             
                  end
         
     | 
| 
       90 
90 
     | 
    
         
             
                end
         
     | 
| 
       91 
91 
     | 
    
         
             
              end
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
              initializer "webpacker.set_source" do |app|
         
     | 
| 
      
 94 
     | 
    
         
            +
                if Webpacker.config.config_path.exist?
         
     | 
| 
      
 95 
     | 
    
         
            +
                  app.config.javascript_path = Webpacker.config.source_path.relative_path_from(Rails.root.join("app")).to_s
         
     | 
| 
      
 96 
     | 
    
         
            +
                end
         
     | 
| 
      
 97 
     | 
    
         
            +
              end
         
     | 
| 
       92 
98 
     | 
    
         
             
            end
         
     | 
    
        data/lib/webpacker/version.rb
    CHANGED
    
    
    
        data/package.json
    CHANGED
    
    | 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            {
         
     | 
| 
       2 
2 
     | 
    
         
             
              "name": "@rails/webpacker",
         
     | 
| 
       3 
     | 
    
         
            -
              "version": "4. 
     | 
| 
      
 3 
     | 
    
         
            +
              "version": "4.2.2",
         
     | 
| 
       4 
4 
     | 
    
         
             
              "description": "Use webpack to manage app-like JavaScript modules in Rails",
         
     | 
| 
       5 
5 
     | 
    
         
             
              "main": "package/index.js",
         
     | 
| 
       6 
6 
     | 
    
         
             
              "files": [
         
     | 
| 
         @@ -8,56 +8,56 @@ 
     | 
|
| 
       8 
8 
     | 
    
         
             
                "lib/install/config/webpacker.yml"
         
     | 
| 
       9 
9 
     | 
    
         
             
              ],
         
     | 
| 
       10 
10 
     | 
    
         
             
              "engines": {
         
     | 
| 
       11 
     | 
    
         
            -
                "node": ">= 
     | 
| 
      
 11 
     | 
    
         
            +
                "node": ">=8.16.0",
         
     | 
| 
       12 
12 
     | 
    
         
             
                "yarn": ">=1.0.0"
         
     | 
| 
       13 
13 
     | 
    
         
             
              },
         
     | 
| 
       14 
14 
     | 
    
         
             
              "dependencies": {
         
     | 
| 
       15 
     | 
    
         
            -
                "@babel/core": "^7. 
     | 
| 
       16 
     | 
    
         
            -
                "@babel/plugin-proposal-class-properties": "^7. 
     | 
| 
       17 
     | 
    
         
            -
                "@babel/plugin-proposal-object-rest-spread": "^7. 
     | 
| 
      
 15 
     | 
    
         
            +
                "@babel/core": "^7.7.2",
         
     | 
| 
      
 16 
     | 
    
         
            +
                "@babel/plugin-proposal-class-properties": "^7.7.0",
         
     | 
| 
      
 17 
     | 
    
         
            +
                "@babel/plugin-proposal-object-rest-spread": "^7.6.2",
         
     | 
| 
       18 
18 
     | 
    
         
             
                "@babel/plugin-syntax-dynamic-import": "^7.2.0",
         
     | 
| 
       19 
     | 
    
         
            -
                "@babel/plugin-transform-destructuring": "^7. 
     | 
| 
       20 
     | 
    
         
            -
                "@babel/plugin-transform-regenerator": "^7. 
     | 
| 
       21 
     | 
    
         
            -
                "@babel/plugin-transform-runtime": "^7. 
     | 
| 
       22 
     | 
    
         
            -
                "@babel/preset-env": "^7. 
     | 
| 
       23 
     | 
    
         
            -
                "@babel/runtime": "^7. 
     | 
| 
      
 19 
     | 
    
         
            +
                "@babel/plugin-transform-destructuring": "^7.6.0",
         
     | 
| 
      
 20 
     | 
    
         
            +
                "@babel/plugin-transform-regenerator": "^7.7.0",
         
     | 
| 
      
 21 
     | 
    
         
            +
                "@babel/plugin-transform-runtime": "^7.6.2",
         
     | 
| 
      
 22 
     | 
    
         
            +
                "@babel/preset-env": "^7.7.1",
         
     | 
| 
      
 23 
     | 
    
         
            +
                "@babel/runtime": "^7.7.2",
         
     | 
| 
       24 
24 
     | 
    
         
             
                "babel-loader": "^8.0.6",
         
     | 
| 
       25 
     | 
    
         
            -
                "babel-plugin-dynamic-import-node": "^2. 
     | 
| 
       26 
     | 
    
         
            -
                "babel-plugin-macros": "^2. 
     | 
| 
      
 25 
     | 
    
         
            +
                "babel-plugin-dynamic-import-node": "^2.3.0",
         
     | 
| 
      
 26 
     | 
    
         
            +
                "babel-plugin-macros": "^2.6.1",
         
     | 
| 
       27 
27 
     | 
    
         
             
                "case-sensitive-paths-webpack-plugin": "^2.2.0",
         
     | 
| 
       28 
     | 
    
         
            -
                "compression-webpack-plugin": "^ 
     | 
| 
       29 
     | 
    
         
            -
                "core-js": "^3. 
     | 
| 
       30 
     | 
    
         
            -
                "css-loader": "^2. 
     | 
| 
       31 
     | 
    
         
            -
                "file-loader": "^ 
     | 
| 
       32 
     | 
    
         
            -
                "flatted": "^2.0. 
     | 
| 
       33 
     | 
    
         
            -
                "glob": "^7.1. 
     | 
| 
      
 28 
     | 
    
         
            +
                "compression-webpack-plugin": "^3.0.0",
         
     | 
| 
      
 29 
     | 
    
         
            +
                "core-js": "^3.4.0",
         
     | 
| 
      
 30 
     | 
    
         
            +
                "css-loader": "^3.2.0",
         
     | 
| 
      
 31 
     | 
    
         
            +
                "file-loader": "^4.2.0",
         
     | 
| 
      
 32 
     | 
    
         
            +
                "flatted": "^2.0.1",
         
     | 
| 
      
 33 
     | 
    
         
            +
                "glob": "^7.1.6",
         
     | 
| 
       34 
34 
     | 
    
         
             
                "js-yaml": "^3.13.1",
         
     | 
| 
       35 
     | 
    
         
            -
                "mini-css-extract-plugin": "^0. 
     | 
| 
       36 
     | 
    
         
            -
                "node-sass": "^4. 
     | 
| 
       37 
     | 
    
         
            -
                "optimize-css-assets-webpack-plugin": "^5.0. 
     | 
| 
      
 35 
     | 
    
         
            +
                "mini-css-extract-plugin": "^0.8.0",
         
     | 
| 
      
 36 
     | 
    
         
            +
                "node-sass": "^4.13.0",
         
     | 
| 
      
 37 
     | 
    
         
            +
                "optimize-css-assets-webpack-plugin": "^5.0.3",
         
     | 
| 
       38 
38 
     | 
    
         
             
                "path-complete-extname": "^1.0.0",
         
     | 
| 
       39 
     | 
    
         
            -
                "pnp-webpack-plugin": "^1. 
     | 
| 
      
 39 
     | 
    
         
            +
                "pnp-webpack-plugin": "^1.5.0",
         
     | 
| 
       40 
40 
     | 
    
         
             
                "postcss-flexbugs-fixes": "^4.1.0",
         
     | 
| 
       41 
41 
     | 
    
         
             
                "postcss-import": "^12.0.1",
         
     | 
| 
       42 
42 
     | 
    
         
             
                "postcss-loader": "^3.0.0",
         
     | 
| 
       43 
     | 
    
         
            -
                "postcss-preset-env": "^6. 
     | 
| 
      
 43 
     | 
    
         
            +
                "postcss-preset-env": "^6.7.0",
         
     | 
| 
       44 
44 
     | 
    
         
             
                "postcss-safe-parser": "^4.0.1",
         
     | 
| 
       45 
     | 
    
         
            -
                "regenerator-runtime": "^0.13. 
     | 
| 
       46 
     | 
    
         
            -
                "sass-loader": " 
     | 
| 
       47 
     | 
    
         
            -
                "style-loader": "^0. 
     | 
| 
       48 
     | 
    
         
            -
                "terser-webpack-plugin": "^ 
     | 
| 
       49 
     | 
    
         
            -
                "webpack": "^4. 
     | 
| 
      
 45 
     | 
    
         
            +
                "regenerator-runtime": "^0.13.3",
         
     | 
| 
      
 46 
     | 
    
         
            +
                "sass-loader": "7.3.1",
         
     | 
| 
      
 47 
     | 
    
         
            +
                "style-loader": "^1.0.0",
         
     | 
| 
      
 48 
     | 
    
         
            +
                "terser-webpack-plugin": "^2.2.1",
         
     | 
| 
      
 49 
     | 
    
         
            +
                "webpack": "^4.41.2",
         
     | 
| 
       50 
50 
     | 
    
         
             
                "webpack-assets-manifest": "^3.1.1",
         
     | 
| 
       51 
     | 
    
         
            -
                "webpack-cli": "^3.3. 
     | 
| 
       52 
     | 
    
         
            -
                "webpack-sources": "^1.3 
     | 
| 
      
 51 
     | 
    
         
            +
                "webpack-cli": "^3.3.10",
         
     | 
| 
      
 52 
     | 
    
         
            +
                "webpack-sources": "^1.4.3"
         
     | 
| 
       53 
53 
     | 
    
         
             
              },
         
     | 
| 
       54 
54 
     | 
    
         
             
              "devDependencies": {
         
     | 
| 
       55 
     | 
    
         
            -
                "eslint": "^ 
     | 
| 
       56 
     | 
    
         
            -
                "eslint-config-airbnb": "^ 
     | 
| 
       57 
     | 
    
         
            -
                "eslint-plugin-import": "^2. 
     | 
| 
       58 
     | 
    
         
            -
                "eslint-plugin-jsx-a11y": "^6.2. 
     | 
| 
       59 
     | 
    
         
            -
                "eslint-plugin-react": "^7. 
     | 
| 
       60 
     | 
    
         
            -
                "jest": "^24. 
     | 
| 
      
 55 
     | 
    
         
            +
                "eslint": "^6.6.0",
         
     | 
| 
      
 56 
     | 
    
         
            +
                "eslint-config-airbnb": "^18.0.1",
         
     | 
| 
      
 57 
     | 
    
         
            +
                "eslint-plugin-import": "^2.18.2",
         
     | 
| 
      
 58 
     | 
    
         
            +
                "eslint-plugin-jsx-a11y": "^6.2.3",
         
     | 
| 
      
 59 
     | 
    
         
            +
                "eslint-plugin-react": "^7.16.0",
         
     | 
| 
      
 60 
     | 
    
         
            +
                "jest": "^24.9.0"
         
     | 
| 
       61 
61 
     | 
    
         
             
              },
         
     | 
| 
       62 
62 
     | 
    
         
             
              "jest": {
         
     | 
| 
       63 
63 
     | 
    
         
             
                "testRegex": "(/__tests__/.*|(\\.|/))\\.jsx?$",
         
     | 
    
        data/package/__tests__/config.js
    CHANGED
    
    | 
         @@ -16,29 +16,6 @@ describe('Config', () => { 
     | 
|
| 
       16 
16 
     | 
    
         
             
                expect(config.publicPath).toEqual('/packs/')
         
     | 
| 
       17 
17 
     | 
    
         
             
              })
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
              // also tests removal of extra slashes
         
     | 
| 
       20 
     | 
    
         
            -
              test('public path with relative root', () => {
         
     | 
| 
       21 
     | 
    
         
            -
                process.env.RAILS_ENV = 'development'
         
     | 
| 
       22 
     | 
    
         
            -
                process.env.RAILS_RELATIVE_URL_ROOT = '/foo'
         
     | 
| 
       23 
     | 
    
         
            -
                const config = require('../config')
         
     | 
| 
       24 
     | 
    
         
            -
                expect(config.publicPath).toEqual('/foo/packs/')
         
     | 
| 
       25 
     | 
    
         
            -
              })
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
              test('public path with relative root without slash', () => {
         
     | 
| 
       28 
     | 
    
         
            -
                process.env.RAILS_ENV = 'development'
         
     | 
| 
       29 
     | 
    
         
            -
                process.env.RAILS_RELATIVE_URL_ROOT = 'foo'
         
     | 
| 
       30 
     | 
    
         
            -
                const config = require('../config')
         
     | 
| 
       31 
     | 
    
         
            -
                expect(config.publicPath).toEqual('/foo/packs/')
         
     | 
| 
       32 
     | 
    
         
            -
              })
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
              test('public path with asset host and relative root', () => {
         
     | 
| 
       35 
     | 
    
         
            -
                process.env.RAILS_ENV = 'development'
         
     | 
| 
       36 
     | 
    
         
            -
                process.env.RAILS_RELATIVE_URL_ROOT = '/foo/'
         
     | 
| 
       37 
     | 
    
         
            -
                process.env.WEBPACKER_ASSET_HOST = 'http://foo.com/'
         
     | 
| 
       38 
     | 
    
         
            -
                const config = require('../config')
         
     | 
| 
       39 
     | 
    
         
            -
                expect(config.publicPath).toEqual('http://foo.com/foo/packs/')
         
     | 
| 
       40 
     | 
    
         
            -
              })
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
19 
     | 
    
         
             
              test('public path with asset host', () => {
         
     | 
| 
       43 
20 
     | 
    
         
             
                process.env.RAILS_ENV = 'development'
         
     | 
| 
       44 
21 
     | 
    
         
             
                process.env.WEBPACKER_ASSET_HOST = 'http://foo.com/'
         
     | 
    
        data/package/config.js
    CHANGED
    
    | 
         @@ -27,16 +27,8 @@ config.outputPath = resolve(config.public_root_path, config.public_output_path) 
     | 
|
| 
       27 
27 
     | 
    
         
             
            // Ensure that the publicPath includes our asset host so dynamic imports
         
     | 
| 
       28 
28 
     | 
    
         
             
            // (code-splitting chunks and static assets) load from the CDN instead of a relative path.
         
     | 
| 
       29 
29 
     | 
    
         
             
            const getPublicPath = () => {
         
     | 
| 
       30 
     | 
    
         
            -
              const rootUrl = process.env.WEBPACKER_ASSET_HOST || '/'
         
     | 
| 
       31 
     | 
    
         
            -
               
     | 
| 
       32 
     | 
    
         
            -
              // Add relative root prefix to pack path.
         
     | 
| 
       33 
     | 
    
         
            -
              if (process.env.RAILS_RELATIVE_URL_ROOT) {
         
     | 
| 
       34 
     | 
    
         
            -
                let relativeRoot = process.env.RAILS_RELATIVE_URL_ROOT
         
     | 
| 
       35 
     | 
    
         
            -
                relativeRoot = relativeRoot.startsWith('/') ? relativeRoot.substr(1) : relativeRoot
         
     | 
| 
       36 
     | 
    
         
            -
                packPath = `${ensureTrailingSlash(relativeRoot)}${packPath}`
         
     | 
| 
       37 
     | 
    
         
            -
              }
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
              return ensureTrailingSlash(rootUrl) + packPath
         
     | 
| 
      
 30 
     | 
    
         
            +
              const rootUrl = ensureTrailingSlash(process.env.WEBPACKER_ASSET_HOST || '/')
         
     | 
| 
      
 31 
     | 
    
         
            +
              return `${rootUrl}${config.public_output_path}/`
         
     | 
| 
       40 
32 
     | 
    
         
             
            }
         
     | 
| 
       41 
33 
     | 
    
         | 
| 
       42 
34 
     | 
    
         
             
            config.publicPath = getPublicPath()
         
     | 
| 
         @@ -38,7 +38,7 @@ class ConfigList extends Array { 
     | 
|
| 
       38 
38 
     | 
    
         
             
              }
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
       40 
40 
     | 
    
         
             
              getIndex(key, shouldThrow = false) {
         
     | 
| 
       41 
     | 
    
         
            -
                const index = this.findIndex(entry => (
         
     | 
| 
      
 41 
     | 
    
         
            +
                const index = this.findIndex((entry) => (
         
     | 
| 
       42 
42 
     | 
    
         
             
                  entry === key
         
     | 
| 
       43 
43 
     | 
    
         
             
                    || entry.key === key
         
     | 
| 
       44 
44 
     | 
    
         
             
                    || (entry.constructor && entry.constructor.name === key)
         
     | 
| 
         @@ -64,11 +64,11 @@ class ConfigList extends Array { 
     | 
|
| 
       64 
64 
     | 
    
         
             
              }
         
     | 
| 
       65 
65 
     | 
    
         | 
| 
       66 
66 
     | 
    
         
             
              values() {
         
     | 
| 
       67 
     | 
    
         
            -
                return this.map(item => item.value)
         
     | 
| 
      
 67 
     | 
    
         
            +
                return this.map((item) => item.value)
         
     | 
| 
       68 
68 
     | 
    
         
             
              }
         
     | 
| 
       69 
69 
     | 
    
         | 
| 
       70 
70 
     | 
    
         
             
              keys() {
         
     | 
| 
       71 
     | 
    
         
            -
                return this.map(item => item.key)
         
     | 
| 
      
 71 
     | 
    
         
            +
                return this.map((item) => item.key)
         
     | 
| 
       72 
72 
     | 
    
         
             
              }
         
     | 
| 
       73 
73 
     | 
    
         
             
            }
         
     | 
| 
       74 
74 
     | 
    
         | 
| 
         @@ -42,7 +42,7 @@ class ConfigObject extends Object { 
     | 
|
| 
       42 
42 
     | 
    
         
             
              toObject() {
         
     | 
| 
       43 
43 
     | 
    
         
             
                const object = {}
         
     | 
| 
       44 
44 
     | 
    
         
             
                /* eslint no-return-assign: 0 */
         
     | 
| 
       45 
     | 
    
         
            -
                Object.keys(this).forEach(key => (object[key] = this[key]))
         
     | 
| 
      
 45 
     | 
    
         
            +
                Object.keys(this).forEach((key) => (object[key] = this[key]))
         
     | 
| 
       46 
46 
     | 
    
         
             
                return object
         
     | 
| 
       47 
47 
     | 
    
         
             
              }
         
     | 
| 
       48 
48 
     | 
    
         | 
| 
         @@ -22,7 +22,7 @@ const config = require('../config') 
     | 
|
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
            const getLoaderList = () => {
         
     | 
| 
       24 
24 
     | 
    
         
             
              const result = new ConfigList()
         
     | 
| 
       25 
     | 
    
         
            -
              Object.keys(rules).forEach(key => result.append(key, rules[key]))
         
     | 
| 
      
 25 
     | 
    
         
            +
              Object.keys(rules).forEach((key) => result.append(key, rules[key]))
         
     | 
| 
       26 
26 
     | 
    
         
             
              return result
         
     | 
| 
       27 
27 
     | 
    
         
             
            }
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
         @@ -74,7 +74,7 @@ const getModulePaths = () => { 
     | 
|
| 
       74 
74 
     | 
    
         
             
              const result = new ConfigList()
         
     | 
| 
       75 
75 
     | 
    
         
             
              result.append('source', resolve(config.source_path))
         
     | 
| 
       76 
76 
     | 
    
         
             
              if (config.resolved_paths) {
         
     | 
| 
       77 
     | 
    
         
            -
                config.resolved_paths.forEach(path => result.append(path, resolve(path)))
         
     | 
| 
      
 77 
     | 
    
         
            +
                config.resolved_paths.forEach((path) => result.append(path, resolve(path)))
         
     | 
| 
       78 
78 
     | 
    
         
             
              }
         
     | 
| 
       79 
79 
     | 
    
         
             
              result.append('node_modules', 'node_modules')
         
     | 
| 
       80 
80 
     | 
    
         
             
              return result
         
     | 
| 
         @@ -18,6 +18,18 @@ module.exports = class extends Base { 
     | 
|
| 
       18 
18 
     | 
    
         
             
                  })
         
     | 
| 
       19 
19 
     | 
    
         
             
                )
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
      
 21 
     | 
    
         
            +
                if ('brotli' in process.versions) {
         
     | 
| 
      
 22 
     | 
    
         
            +
                  this.plugins.append(
         
     | 
| 
      
 23 
     | 
    
         
            +
                    'Compression Brotli',
         
     | 
| 
      
 24 
     | 
    
         
            +
                    new CompressionPlugin({
         
     | 
| 
      
 25 
     | 
    
         
            +
                      filename: '[path].br[query]',
         
     | 
| 
      
 26 
     | 
    
         
            +
                      algorithm: 'brotliCompress',
         
     | 
| 
      
 27 
     | 
    
         
            +
                      cache: true,
         
     | 
| 
      
 28 
     | 
    
         
            +
                      test: /\.(js|css|html|json|ico|svg|eot|otf|ttf|map)$/
         
     | 
| 
      
 29 
     | 
    
         
            +
                    })
         
     | 
| 
      
 30 
     | 
    
         
            +
                  )
         
     | 
| 
      
 31 
     | 
    
         
            +
                }
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
       21 
33 
     | 
    
         
             
                this.plugins.append(
         
     | 
| 
       22 
34 
     | 
    
         
             
                  'OptimizeCSSAssets',
         
     | 
| 
       23 
35 
     | 
    
         
             
                  new OptimizeCSSAssetsPlugin({
         
     | 
    
        data/package/rules/babel.js
    CHANGED
    
    | 
         @@ -6,7 +6,7 @@ const { nodeEnv } = require('../env') 
     | 
|
| 
       6 
6 
     | 
    
         
             
            // Uses application .babelrc to apply any transformations
         
     | 
| 
       7 
7 
     | 
    
         
             
            module.exports = {
         
     | 
| 
       8 
8 
     | 
    
         
             
              test: /\.(js|jsx|mjs)?(\.erb)?$/,
         
     | 
| 
       9 
     | 
    
         
            -
              include: [sourcePath, ...resolvedPaths].map(p => resolve(p)),
         
     | 
| 
      
 9 
     | 
    
         
            +
              include: [sourcePath, ...resolvedPaths].map((p) => resolve(p)),
         
     | 
| 
       10 
10 
     | 
    
         
             
              exclude: /node_modules/,
         
     | 
| 
       11 
11 
     | 
    
         
             
              use: [
         
     | 
| 
       12 
12 
     | 
    
         
             
                {
         
     | 
| 
         @@ -3,11 +3,11 @@ const { cache_path: cachePath } = require('../config') 
     | 
|
| 
       3 
3 
     | 
    
         
             
            const { nodeEnv } = require('../env')
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            // Compile standard ES features for JS in node_modules with Babel.
         
     | 
| 
       6 
     | 
    
         
            -
            //   Regex details for exclude: https://regex101.com/r/ 
     | 
| 
      
 6 
     | 
    
         
            +
            //   Regex details for exclude: https://regex101.com/r/SKPnnv/1
         
     | 
| 
       7 
7 
     | 
    
         
             
            module.exports = {
         
     | 
| 
       8 
8 
     | 
    
         
             
              test: /\.(js|mjs)$/,
         
     | 
| 
       9 
9 
     | 
    
         
             
              include: /node_modules/,
         
     | 
| 
       10 
     | 
    
         
            -
              exclude: /(?:@?babel(?:\/|\\{1,2}|-).+)|regenerator-runtime|core-js 
     | 
| 
      
 10 
     | 
    
         
            +
              exclude: /(?:@?babel(?:\/|\\{1,2}|-).+)|regenerator-runtime|core-js|^webpack$|^webpack-assets-manifest$|^webpack-cli$|^webpack-sources$|^@rails\/webpacker$/,
         
     | 
| 
       11 
11 
     | 
    
         
             
              use: [
         
     | 
| 
       12 
12 
     | 
    
         
             
                {
         
     | 
| 
       13 
13 
     | 
    
         
             
                  loader: 'babel-loader',
         
     | 
    
        data/package/rules/sass.js
    CHANGED