webpacker 6.0.0.beta.2 → 6.0.0.beta.7

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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/jest.yml +1 -1
  3. data/.github/workflows/js-lint.yml +1 -1
  4. data/.github/workflows/ruby.yml +9 -6
  5. data/.rubocop.yml +105 -0
  6. data/CHANGELOG.md +6 -4
  7. data/CONTRIBUTING.md +1 -1
  8. data/Gemfile.lock +93 -90
  9. data/README.md +133 -58
  10. data/config/README.md +3 -0
  11. data/config/webpacker.yml +1 -0
  12. data/docs/deployment.md +128 -0
  13. data/docs/troubleshooting.md +160 -0
  14. data/docs/v6_upgrade.md +86 -0
  15. data/lib/install/config/webpacker.yml +5 -3
  16. data/lib/install/{javascript/packs → packs/entrypoints}/application.js +1 -1
  17. data/lib/install/template.rb +16 -9
  18. data/lib/tasks/webpacker/binstubs.rake +2 -2
  19. data/lib/tasks/webpacker/check_node.rake +1 -0
  20. data/lib/tasks/webpacker/check_yarn.rake +1 -0
  21. data/lib/tasks/webpacker/install.rake +2 -2
  22. data/lib/webpacker/commands.rb +2 -1
  23. data/lib/webpacker/compiler.rb +2 -2
  24. data/lib/webpacker/configuration.rb +4 -4
  25. data/lib/webpacker/dev_server_runner.rb +2 -0
  26. data/lib/webpacker/helper.rb +13 -43
  27. data/lib/webpacker/manifest.rb +1 -1
  28. data/lib/webpacker/version.rb +1 -1
  29. data/lib/webpacker/webpack_runner.rb +1 -0
  30. data/package.json +1 -1
  31. data/package/__tests__/development.js +2 -1
  32. data/package/__tests__/index.js +9 -0
  33. data/package/environments/__tests__/base.js +4 -4
  34. data/package/environments/base.js +3 -8
  35. data/package/environments/development.js +1 -0
  36. data/package/environments/production.js +1 -1
  37. data/package/index.js +3 -3
  38. data/package/rules/babel.js +1 -1
  39. data/package/rules/stylus.js +1 -1
  40. data/package/utils/helpers.js +4 -2
  41. data/test/configuration_test.rb +2 -2
  42. data/test/dev_server_runner_test.rb +10 -2
  43. data/test/helper_test.rb +33 -39
  44. data/test/manifest_test.rb +8 -0
  45. data/test/mounted_app/test/dummy/config/webpacker.yml +3 -3
  46. data/test/test_app/app/{javascript/packs → packs/entrypoints}/application.js +1 -1
  47. data/test/test_app/app/{javascript/packs → packs/entrypoints}/multi_entry.css +0 -0
  48. data/test/test_app/app/{javascript/packs → packs/entrypoints}/multi_entry.js +0 -0
  49. data/test/test_app/config/webpacker.yml +3 -3
  50. data/test/test_app/public/packs/manifest.json +7 -0
  51. metadata +18 -14
  52. data/6_0_upgrade.md +0 -43
  53. data/lib/install/javascript/packs/application.css +0 -9
@@ -25,6 +25,14 @@ class ManifestTest < Minitest::Test
25
25
  assert_equal Webpacker.manifest.lookup!("bootstrap.js"), "/packs/bootstrap-300631c4f0e0f9c865bc.js"
26
26
  end
27
27
 
28
+ def test_lookup_with_chunks_without_extension_success!
29
+ assert_equal Webpacker.manifest.lookup_pack_with_chunks!("bootstrap", type: :javascript), ["/packs/bootstrap-300631c4f0e0f9c865bc.js"]
30
+ end
31
+
32
+ def test_lookup_with_chunks_with_extension_success!
33
+ assert_equal Webpacker.manifest.lookup_pack_with_chunks!("bootstrap.js", type: :javascript), ["/packs/bootstrap-300631c4f0e0f9c865bc.js"]
34
+ end
35
+
28
36
  def test_lookup_nil
29
37
  assert_nil Webpacker.manifest.lookup("foo.js")
30
38
  end
@@ -1,12 +1,12 @@
1
1
  # Note: You must restart bin/webpack-dev-server for changes to take effect
2
2
 
3
3
  default: &default
4
- source_path: app/javascript
5
- source_entry_path: packs
4
+ source_path: app/packs
5
+ source_entry_path: entrypoints
6
6
  public_output_path: packs
7
7
  cache_path: tmp/cache/webpacker
8
8
 
9
- # Additional paths webpack should lookup modules
9
+ # Additional paths webpack should look up modules
10
10
  # ['app/assets', 'engine/foo/app/assets']
11
11
  additional_paths:
12
12
  - app/assets
@@ -1,7 +1,7 @@
1
1
  /* eslint no-console:0 */
2
2
  // This file is automatically compiled by Webpack, along with any other files
3
3
  // present in this directory. You're encouraged to place your actual application logic in
4
- // a relevant structure within app/javascript and only use these pack files to reference
4
+ // a relevant structure within app/packs and only use these pack files to reference
5
5
  // that code so it'll be compiled.
6
6
  //
7
7
  // To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
@@ -1,14 +1,14 @@
1
1
  # Note: You must restart bin/webpack-dev-server for changes to take effect
2
2
 
3
3
  default: &default
4
- source_path: app/javascript
5
- source_entry_path: packs
4
+ source_path: app/packs
5
+ source_entry_path: entrypoints
6
6
  public_root_path: public
7
7
  public_output_path: packs
8
8
  cache_path: tmp/cache/webpacker
9
9
  webpack_compile_output: false
10
10
 
11
- # Additional paths webpack should lookup modules
11
+ # Additional paths webpack should look up modules
12
12
  # ['app/assets', 'engine/foo/app/assets']
13
13
  additional_paths:
14
14
  - app/assets
@@ -24,6 +24,13 @@
24
24
  ]
25
25
  }
26
26
  },
27
+ "bootstrap": {
28
+ "assets": {
29
+ "js": [
30
+ "/packs/bootstrap-300631c4f0e0f9c865bc.js"
31
+ ]
32
+ }
33
+ },
27
34
  "hello_stimulus": {
28
35
  "assets": {
29
36
  "css": [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webpacker
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0.beta.2
4
+ version: 6.0.0.beta.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-12-24 00:00:00.000000000 Z
12
+ date: 2021-04-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -126,7 +126,6 @@ files:
126
126
  - ".gitignore"
127
127
  - ".node-version"
128
128
  - ".rubocop.yml"
129
- - 6_0_upgrade.md
130
129
  - CHANGELOG.md
131
130
  - CONTRIBUTING.md
132
131
  - Gemfile
@@ -134,6 +133,11 @@ files:
134
133
  - MIT-LICENSE
135
134
  - README.md
136
135
  - Rakefile
136
+ - config/README.md
137
+ - config/webpacker.yml
138
+ - docs/deployment.md
139
+ - docs/troubleshooting.md
140
+ - docs/v6_upgrade.md
137
141
  - gemfiles/Gemfile-rails-edge
138
142
  - gemfiles/Gemfile-rails.5.2.x
139
143
  - gemfiles/Gemfile-rails.6.0.x
@@ -145,8 +149,7 @@ files:
145
149
  - lib/install/config/webpack/production.js
146
150
  - lib/install/config/webpack/test.js
147
151
  - lib/install/config/webpacker.yml
148
- - lib/install/javascript/packs/application.css
149
- - lib/install/javascript/packs/application.js
152
+ - lib/install/packs/entrypoints/application.js
150
153
  - lib/install/template.rb
151
154
  - lib/tasks/webpacker.rake
152
155
  - lib/tasks/webpacker/binstubs.rake
@@ -180,6 +183,7 @@ files:
180
183
  - package/__tests__/dev_server.js
181
184
  - package/__tests__/development.js
182
185
  - package/__tests__/env.js
186
+ - package/__tests__/index.js
183
187
  - package/__tests__/production.js
184
188
  - package/__tests__/staging.js
185
189
  - package/__tests__/test.js
@@ -226,9 +230,9 @@ files:
226
230
  - test/mounted_app/test/dummy/package.json
227
231
  - test/rake_tasks_test.rb
228
232
  - test/test_app/Rakefile
229
- - test/test_app/app/javascript/packs/application.js
230
- - test/test_app/app/javascript/packs/multi_entry.css
231
- - test/test_app/app/javascript/packs/multi_entry.js
233
+ - test/test_app/app/packs/entrypoints/application.js
234
+ - test/test_app/app/packs/entrypoints/multi_entry.css
235
+ - test/test_app/app/packs/entrypoints/multi_entry.js
232
236
  - test/test_app/bin/webpack
233
237
  - test/test_app/bin/webpack-dev-server
234
238
  - test/test_app/config.ru
@@ -250,8 +254,8 @@ homepage: https://github.com/rails/webpacker
250
254
  licenses:
251
255
  - MIT
252
256
  metadata:
253
- source_code_uri: https://github.com/rails/webpacker/tree/v6.0.0.beta.2
254
- changelog_uri: https://github.com/rails/webpacker/blob/v6.0.0.beta.2/CHANGELOG.md
257
+ source_code_uri: https://github.com/rails/webpacker/tree/v6.0.0.beta.7
258
+ changelog_uri: https://github.com/rails/webpacker/blob/v6.0.0.beta.7/CHANGELOG.md
255
259
  post_install_message:
256
260
  rdoc_options: []
257
261
  require_paths:
@@ -267,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
267
271
  - !ruby/object:Gem::Version
268
272
  version: 1.3.1
269
273
  requirements: []
270
- rubygems_version: 3.0.3
274
+ rubygems_version: 3.2.3
271
275
  signing_key:
272
276
  specification_version: 4
273
277
  summary: Use webpack to manage app-like JavaScript modules in Rails
@@ -292,9 +296,9 @@ test_files:
292
296
  - test/mounted_app/test/dummy/package.json
293
297
  - test/rake_tasks_test.rb
294
298
  - test/test_app/Rakefile
295
- - test/test_app/app/javascript/packs/application.js
296
- - test/test_app/app/javascript/packs/multi_entry.css
297
- - test/test_app/app/javascript/packs/multi_entry.js
299
+ - test/test_app/app/packs/entrypoints/application.js
300
+ - test/test_app/app/packs/entrypoints/multi_entry.css
301
+ - test/test_app/app/packs/entrypoints/multi_entry.js
298
302
  - test/test_app/bin/webpack
299
303
  - test/test_app/bin/webpack-dev-server
300
304
  - test/test_app/config.ru
data/6_0_upgrade.md DELETED
@@ -1,43 +0,0 @@
1
- # To webpacker v6 from v5
2
-
3
- This guide aims to help you migrating to webpacker 6. If you are using
4
- vanilla webpacker install then hopefully, the upgrade should be really
5
- straightforward.
6
-
7
- ## Preparation
8
-
9
- - Rename `config/webpack` to `config/webpack_old`
10
- - Rename `config/webpacker.yml` to `config/webpacker_old.yml`
11
- - Upgrade webpacker
12
-
13
- ```ruby
14
- # Gemfile
15
- gem 'webpacker', '~> 6.x'
16
- ```
17
-
18
- ```
19
- bundle
20
- ```
21
-
22
- ```bash
23
- yarn add @rails/webpacker@next
24
- ```
25
-
26
- ```bash
27
- bundle exec rails webpacker:install
28
- ```
29
-
30
- - Change `javascript_pack_tag` and `stylesheet_pack_tag` to `javascript_packs_with_chunks_tag` and
31
- `stylesheet_packs_with_chunks_tag`
32
-
33
- - If you are using any integrations like css, react or typescript. Please see https://github.com/rails/webpacker#integrations section on how they work in v6.0
34
-
35
- - Copy over any custom webpack config from `config/webpack_old`
36
-
37
- ```js
38
- // config/webpack/base.js
39
- const { webpackConfig, merge } = require('@rails/webpacker')
40
- const customConfig = require('./custom')
41
-
42
- module.exports = merge(webpackConfig, customConfig)
43
- ```
@@ -1,9 +0,0 @@
1
- /*
2
- Any CSS added to this file or imported from this file, e.g. `@import '../stylesheets/my-css.css'`,
3
- will be included in the "application" pack. Any CSS imported from application.js or as part of the
4
- application.js dependency graph, e.g. `import '../stylesheets/my-css.css'` will also be included
5
- in the "application" pack.
6
-
7
- To reference this file, add <%= stylesheet_pack_tag 'application' %> to the appropriate
8
- layout file, like app/views/layouts/application.html.erb
9
- */