shakapacker 6.2.1 → 6.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +53 -4
  3. data/CONTRIBUTING.md +2 -2
  4. data/Gemfile +2 -1
  5. data/Gemfile.lock +84 -74
  6. data/README.md +172 -65
  7. data/docs/react.md +262 -0
  8. data/docs/sprockets.md +10 -0
  9. data/docs/v6_upgrade.md +1 -1
  10. data/lib/install/config/webpacker.yml +14 -0
  11. data/lib/tasks/webpacker/clean.rake +1 -3
  12. data/lib/tasks/webpacker/clobber.rake +1 -3
  13. data/lib/tasks/webpacker/compile.rake +3 -14
  14. data/lib/tasks/webpacker.rake +0 -1
  15. data/lib/webpacker/base_strategy.rb +24 -0
  16. data/lib/webpacker/compiler.rb +4 -67
  17. data/lib/webpacker/compiler_strategy.rb +20 -0
  18. data/lib/webpacker/configuration.rb +13 -0
  19. data/lib/webpacker/digest_strategy.rb +59 -0
  20. data/lib/webpacker/helper.rb +26 -1
  21. data/lib/webpacker/instance.rb +4 -0
  22. data/lib/webpacker/manifest.rb +2 -2
  23. data/lib/webpacker/mtime_strategy.rb +40 -0
  24. data/lib/webpacker/version.rb +1 -1
  25. data/package/babel/preset.js +0 -1
  26. data/package/environments/__tests__/base.js +30 -3
  27. data/package/environments/base.js +8 -1
  28. data/package/rules/file.js +2 -2
  29. data/package.json +13 -12
  30. data/test/compiler_strategy_test.rb +27 -0
  31. data/test/compiler_test.rb +26 -34
  32. data/test/configuration_test.rb +24 -4
  33. data/test/digest_strategy_test.rb +33 -0
  34. data/test/helper_test.rb +22 -0
  35. data/test/manifest_test.rb +3 -3
  36. data/test/mtime_strategy_test.rb +42 -0
  37. data/test/rake_tasks_test.rb +0 -34
  38. data/test/test_app/app/packs/entrypoints/generated/something.js +2 -0
  39. data/test/test_app/config/webpacker.yml +1 -0
  40. data/test/test_app/config/webpacker_nested_entries.yml +83 -0
  41. data/test/test_app/config/webpacker_no_precompile.yml +7 -0
  42. data/yarn.lock +917 -884
  43. metadata +21 -5
  44. data/lib/tasks/webpacker/yarn_install.rake +0 -18
  45. data/lib/tasks/yarn.rake +0 -38
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd1ab6b39f1ae6a30d35edb3ce88f505aa982751ce798cbc02a7ff1e6d1b1fd4
4
- data.tar.gz: 389b31b8cd3e24b9cbe39e7fef24257037ec3195229d2fae9d35146f82f6c594
3
+ metadata.gz: 41d452e91baefc4e4235ab82c30a8a5fb6cfa98854016124f8214b8b2f475986
4
+ data.tar.gz: '08fb5cd0691f29a12862b827d1fc247565300256e21ba2dead9a2e1d128cc2a2'
5
5
  SHA512:
6
- metadata.gz: 44e0784025695f8d6686c9c4fecd551da50f4c47c48939abe0c93b55e6e6f9407b68fba15e88c7dfe2169e981248e31c93e240fa1be342f58ffa368a1a6dc4ac
7
- data.tar.gz: 8b51a5b4c2870bea948801afe3db35f24bf79bdfb543f098e63bbdc62dd3be1a23241dc8ebccefceb0a92d0c51e50bc0d75553e1eb9c93f0c362ae7a91ea3b47
6
+ metadata.gz: c39f8cd91ea7a0a786341ddbc115d91c30dee7826914c0fcb85ab1f9e52b0719706b4d7343922184f8beefaa20de7fa7d7fa760a36bb06e2f73c38a6d965d792
7
+ data.tar.gz: c70a8973e7f69d60ceab67055b6c597b8ace1ba72137b2dc4a3902f9e3fae71f393aaa4dc82f5253f57c3e559b56b0d2a12f4f3234f0249c234b8f3106162b3c
data/CHANGELOG.md CHANGED
@@ -1,11 +1,57 @@
1
- * For versions prior to v6, see the [5.x stable branch of rails/webpacker](https://github.com/rails/webpacker/tree/5-x-stable).
2
- * Please see [v6 Upgrade Guide](./docs/v6_upgrade.md) to go from version prior to v6.
1
+ * For the changelog of versions prior to v6, see the [5.x stable branch of rails/webpacker](https://github.com/rails/webpacker/tree/5-x-stable).
2
+ * Please see the [v6 Upgrade Guide](./docs/v6_upgrade.md) to go from versions prior to v6.
3
+ * [ShakaCode](https://www.shakacode.com) offers support for upgrading from webpacker or using Shakapacker. If interested, contact [justin@shakacode.com](mailto:justin@shakacode.com).
3
4
 
4
5
  ## Versions
5
6
  ## [Unreleased]
6
7
  Changes since last non-beta release.
7
8
 
8
- *Please add entries here for your pull requests that are not yet released.*
9
+ _Please add entries here for your pull requests that are not yet released._
10
+
11
+ ## [v6.4.0] - June 2, 2022
12
+ ### Fixed
13
+ - Fixed [Issue 123: Rails 7.0.3 - Webpacker configuration file not found when running rails webpacker:install (shakapacker v6.3)](https://github.com/shakacode/shakapacker/issues/123) in [PR 136: Don't enhance precompile if no config #136](https://github.com/shakacode/shakapacker/pull/136) by [justin808](https://github.com/justin808).
14
+
15
+ ### Added
16
+ - Configuration boolean option `nested_entries` to use nested entries. This was the default prior to v6.0. Because entries maybe generated, it's useful to allow a `generated` subdirectory. [PR 121](https://github.com/shakacode/shakapacker/pull/121) by [justin808](https://github.com/justin808).
17
+
18
+ ### Improved
19
+ - Allow v10 of `compression-webpack-plugin` as a peer dependency. [PR 117](https://github.com/shakacode/shakapacker/pull/117) by [aried3r](https://github.com/aried3r).
20
+
21
+ - [Remove assets:precompile task enhancement #131](https://github.com/shakacode/shakapacker/pull/131) by [James Herdman](https://github.com/jherdman): Removed the `yarn:install` Rake task, and no longer enhance `assets:precompile` with said task. These tasks were used to ensure required NPM packages were installed before asset precompilation. Going forward you will need to ensure these packages are already installed yourself. Should you wish to restore this behaviour you'll need to [reimplement the task](https://github.com/shakacode/shakapacker/blob/bee661422f2c902aa8ac9cf8fa1f7ccb8142c914/lib/tasks/yarn.rake) in your own application.
22
+
23
+ ## [v6.3.0] - May 19, 2022
24
+
25
+ ### Improved
26
+ - Add ability to configure usage of either last modified timestamp and digest strategies when checking asset freshness. [PR 112](https://github.com/shakacode/shakapacker/pull/112) by [tomdracz](https://github.com/tomdracz).
27
+
28
+ ### Fixed
29
+ - On Windows CSS urls no longer contain backslashes resulting in 404 errors. [PR 115](https://github.com/shakacode/shakapacker/pull/115) by [daniel-rikowski](https://github.com/daniel-rikowski).
30
+
31
+ ## [v6.3.0-rc.1] - April 24, 2022
32
+
33
+ Note: [Rubygem is 6.3.0.pre.rc.1](https://rubygems.org/gems/shakapacker/versions/6.3.0.pre.rc.1) and [NPM is 6.3.0-rc.1](https://www.npmjs.com/package/shakapacker/v/6.3.0-rc.1).
34
+
35
+ ### Changed
36
+ - Remove Loose mode from the default @babel-preset/env configuration. [PR 107](https://github.com/shakacode/shakapacker/pull/107) by [Jeremy Liberman](https://github.com/MrLeebo).
37
+
38
+ Loose mode compiles the bundle down to be compatible with ES5, but saves space by skipping over behaviors that are considered edge cases. Loose mode can affect how your code runs in a variety of ways, but in newer versions of Babel it's better to use [Compiler Assumptions](https://babeljs.io/docs/en/assumptions) to have finer-grained control over which edge cases you're choosing to ignore.
39
+
40
+ This change may increase the file size of your bundles, and may change some behavior in your app if your code touches upon one of the edge cases where Loose mode differs from native JavaScript. There are notes in the linked PR about how to turn Loose mode back on if you need to, but consider migrating to Compiler Assumptions when you can. If you have already customized your babel config, this change probably won't affect you.
41
+
42
+ ### Added
43
+ - Adds `webpacker_precompile` setting to `webpacker.yml` to allow controlling precompile behaviour, similar to existing `ENV["WEBPACKER_PRECOMPILE"]` variable. [PR 102](https://github.com/shakacode/shakapacker/pull/102) by [Judahmeek](https://github.com/Judahmeek).
44
+ - Adds `append_javascript_pack_tag` helper. Allows for easier usage and coordination of multiple javascript packs. [PR 94](https://github.com/shakacode/shakapacker/pull/94) by [tomdracz](https://github.com/tomdracz).
45
+
46
+ ### Improved
47
+ - Use last modified timestamps rather than file digest to determine compiler freshness. [PR 97](https://github.com/shakacode/shakapacker/pull/97) by [tomdracz](https://github.com/tomdracz).
48
+
49
+ Rather than calculating SHA digest of all the files in the paths watched by the compiler, we are now comparing the modified time of the `manifest.json` file versus the latest modified timestamp of files and directories in watched paths. Unlike calculating digest, which only looked at the files, the new calculation also considers directory timestamps, including the parent ones (i.e. `config.source_path` folder timestamp will be checked together will timestamps of all files and directories inside of it).
50
+
51
+ This change should result in improved compiler checks performance but might be breaking for certain setups and edge cases. If you encounter any issues, please report them at https://github.com/shakacode/shakapacker/issues.
52
+
53
+ - Bump dependency versions in package.json to address security vulnerabilities. [PR 109](https://github.com/shakacode/shakapacker/pull/109) by [tomdracz](https://github.com/tomdracz).
54
+ - Add `webpack-dev-server` as `peerDependency` to make its usage clear. [PR 109](https://github.com/shakacode/shakapacker/pull/109) by [tomdracz](https://github.com/tomdracz).
9
55
 
10
56
  ## [v6.2.1] - April 15, 2022
11
57
  ### Fixed
@@ -91,7 +137,10 @@ Changes since last non-beta release.
91
137
  ## v5.4.3 and prior changes from rails/webpacker
92
138
  See [CHANGELOG.md in rails/webpacker (up to v5.4.3)](https://github.com/rails/webpacker/blob/master/CHANGELOG.md)
93
139
 
94
- [Unreleased]: https://github.com/shakacode/shakapacker/compare/v6.2.0...master
140
+ [Unreleased]: https://github.com/shakacode/shakapacker/compare/v6.4.0...master
141
+ [v6.4.0]: https://github.com/shakacode/shakapacker/compare/v6.3.0...v6.4.0
142
+ [v6.3.0]: https://github.com/shakacode/shakapacker/compare/v6.2.1...v6.3.0
143
+ [v6.2.1]: https://github.com/shakacode/shakapacker/compare/v6.2.0...v6.2.1
95
144
  [v6.2.0]: https://github.com/shakacode/shakapacker/compare/v6.1.1...v6.2.0
96
145
  [v6.1.1]: https://github.com/shakacode/shakapacker/compare/v6.1.0...v6.1.1
97
146
  [v6.1.0]: https://github.com/shakacode/shakapacker/compare/v6.0.2...v6.1.0
data/CONTRIBUTING.md CHANGED
@@ -56,7 +56,7 @@ If you change the generator, check that install instructions work.
56
56
 
57
57
  1. Update the gemfile so that gem "webpacker" has a line like this, pointing to your install of webpacker
58
58
  ```ruby
59
- gem 'webpacker', path: "~/shakacode/forks/webpacker"
60
- ```
59
+ gem 'webpacker', path: "~/shakacode/forks/shakapacker"
60
+ ```
61
61
  2. `bundle`
62
62
  3. Run the generator confirm that you got the right changes.
data/Gemfile CHANGED
@@ -2,10 +2,11 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- gem "rails"
5
+ gem "rails", ">= 6.1.6"
6
6
  gem "rake", ">= 11.1"
7
7
  gem "rack-proxy", require: false
8
8
  gem "semantic_range", require: false
9
+ gem "nokogiri", "~> 1.13", ">= 1.13.6"
9
10
 
10
11
  group :test do
11
12
  gem "minitest", "~> 5.0"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shakapacker (6.2.0)
4
+ shakapacker (6.3.0)
5
5
  activesupport (>= 5.2)
6
6
  rack-proxy (>= 0.6.1)
7
7
  railties (>= 5.2)
@@ -10,60 +10,60 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- actioncable (6.1.4.1)
14
- actionpack (= 6.1.4.1)
15
- activesupport (= 6.1.4.1)
13
+ actioncable (6.1.6)
14
+ actionpack (= 6.1.6)
15
+ activesupport (= 6.1.6)
16
16
  nio4r (~> 2.0)
17
17
  websocket-driver (>= 0.6.1)
18
- actionmailbox (6.1.4.1)
19
- actionpack (= 6.1.4.1)
20
- activejob (= 6.1.4.1)
21
- activerecord (= 6.1.4.1)
22
- activestorage (= 6.1.4.1)
23
- activesupport (= 6.1.4.1)
18
+ actionmailbox (6.1.6)
19
+ actionpack (= 6.1.6)
20
+ activejob (= 6.1.6)
21
+ activerecord (= 6.1.6)
22
+ activestorage (= 6.1.6)
23
+ activesupport (= 6.1.6)
24
24
  mail (>= 2.7.1)
25
- actionmailer (6.1.4.1)
26
- actionpack (= 6.1.4.1)
27
- actionview (= 6.1.4.1)
28
- activejob (= 6.1.4.1)
29
- activesupport (= 6.1.4.1)
25
+ actionmailer (6.1.6)
26
+ actionpack (= 6.1.6)
27
+ actionview (= 6.1.6)
28
+ activejob (= 6.1.6)
29
+ activesupport (= 6.1.6)
30
30
  mail (~> 2.5, >= 2.5.4)
31
31
  rails-dom-testing (~> 2.0)
32
- actionpack (6.1.4.1)
33
- actionview (= 6.1.4.1)
34
- activesupport (= 6.1.4.1)
32
+ actionpack (6.1.6)
33
+ actionview (= 6.1.6)
34
+ activesupport (= 6.1.6)
35
35
  rack (~> 2.0, >= 2.0.9)
36
36
  rack-test (>= 0.6.3)
37
37
  rails-dom-testing (~> 2.0)
38
38
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
39
- actiontext (6.1.4.1)
40
- actionpack (= 6.1.4.1)
41
- activerecord (= 6.1.4.1)
42
- activestorage (= 6.1.4.1)
43
- activesupport (= 6.1.4.1)
39
+ actiontext (6.1.6)
40
+ actionpack (= 6.1.6)
41
+ activerecord (= 6.1.6)
42
+ activestorage (= 6.1.6)
43
+ activesupport (= 6.1.6)
44
44
  nokogiri (>= 1.8.5)
45
- actionview (6.1.4.1)
46
- activesupport (= 6.1.4.1)
45
+ actionview (6.1.6)
46
+ activesupport (= 6.1.6)
47
47
  builder (~> 3.1)
48
48
  erubi (~> 1.4)
49
49
  rails-dom-testing (~> 2.0)
50
50
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
51
- activejob (6.1.4.1)
52
- activesupport (= 6.1.4.1)
51
+ activejob (6.1.6)
52
+ activesupport (= 6.1.6)
53
53
  globalid (>= 0.3.6)
54
- activemodel (6.1.4.1)
55
- activesupport (= 6.1.4.1)
56
- activerecord (6.1.4.1)
57
- activemodel (= 6.1.4.1)
58
- activesupport (= 6.1.4.1)
59
- activestorage (6.1.4.1)
60
- actionpack (= 6.1.4.1)
61
- activejob (= 6.1.4.1)
62
- activerecord (= 6.1.4.1)
63
- activesupport (= 6.1.4.1)
64
- marcel (~> 1.0.0)
54
+ activemodel (6.1.6)
55
+ activesupport (= 6.1.6)
56
+ activerecord (6.1.6)
57
+ activemodel (= 6.1.6)
58
+ activesupport (= 6.1.6)
59
+ activestorage (6.1.6)
60
+ actionpack (= 6.1.6)
61
+ activejob (= 6.1.6)
62
+ activerecord (= 6.1.6)
63
+ activesupport (= 6.1.6)
64
+ marcel (~> 1.0)
65
65
  mini_mime (>= 1.1.0)
66
- activesupport (6.1.4.1)
66
+ activesupport (6.1.6)
67
67
  concurrent-ruby (~> 1.0, >= 1.0.2)
68
68
  i18n (>= 1.6, < 2)
69
69
  minitest (>= 5.1)
@@ -72,61 +72,67 @@ GEM
72
72
  ast (2.4.2)
73
73
  builder (3.2.4)
74
74
  byebug (11.1.3)
75
- concurrent-ruby (1.1.9)
75
+ concurrent-ruby (1.1.10)
76
76
  crass (1.0.6)
77
77
  erubi (1.10.0)
78
- globalid (0.5.2)
78
+ globalid (1.0.0)
79
79
  activesupport (>= 5.0)
80
- i18n (1.8.10)
80
+ i18n (1.10.0)
81
81
  concurrent-ruby (~> 1.0)
82
- loofah (2.12.0)
82
+ loofah (2.18.0)
83
83
  crass (~> 1.0.2)
84
84
  nokogiri (>= 1.5.9)
85
85
  mail (2.7.1)
86
86
  mini_mime (>= 0.1.1)
87
87
  marcel (1.0.2)
88
88
  method_source (1.0.0)
89
- mini_mime (1.1.1)
90
- mini_portile2 (2.6.1)
91
- minitest (5.14.4)
89
+ mini_mime (1.1.2)
90
+ mini_portile2 (2.8.0)
91
+ minitest (5.15.0)
92
92
  nio4r (2.5.8)
93
- nokogiri (1.12.4)
94
- mini_portile2 (~> 2.6.1)
93
+ nokogiri (1.13.6)
94
+ mini_portile2 (~> 2.8.0)
95
+ racc (~> 1.4)
96
+ nokogiri (1.13.6-arm64-darwin)
97
+ racc (~> 1.4)
98
+ nokogiri (1.13.6-x86_64-darwin)
99
+ racc (~> 1.4)
100
+ nokogiri (1.13.6-x86_64-linux)
95
101
  racc (~> 1.4)
96
102
  parallel (1.21.0)
97
103
  parser (3.0.2.0)
98
104
  ast (~> 2.4.1)
99
- racc (1.5.2)
100
- rack (2.2.3)
105
+ racc (1.6.0)
106
+ rack (2.2.3.1)
101
107
  rack-proxy (0.7.0)
102
108
  rack
103
109
  rack-test (1.1.0)
104
110
  rack (>= 1.0, < 3)
105
- rails (6.1.4.1)
106
- actioncable (= 6.1.4.1)
107
- actionmailbox (= 6.1.4.1)
108
- actionmailer (= 6.1.4.1)
109
- actionpack (= 6.1.4.1)
110
- actiontext (= 6.1.4.1)
111
- actionview (= 6.1.4.1)
112
- activejob (= 6.1.4.1)
113
- activemodel (= 6.1.4.1)
114
- activerecord (= 6.1.4.1)
115
- activestorage (= 6.1.4.1)
116
- activesupport (= 6.1.4.1)
111
+ rails (6.1.6)
112
+ actioncable (= 6.1.6)
113
+ actionmailbox (= 6.1.6)
114
+ actionmailer (= 6.1.6)
115
+ actionpack (= 6.1.6)
116
+ actiontext (= 6.1.6)
117
+ actionview (= 6.1.6)
118
+ activejob (= 6.1.6)
119
+ activemodel (= 6.1.6)
120
+ activerecord (= 6.1.6)
121
+ activestorage (= 6.1.6)
122
+ activesupport (= 6.1.6)
117
123
  bundler (>= 1.15.0)
118
- railties (= 6.1.4.1)
124
+ railties (= 6.1.6)
119
125
  sprockets-rails (>= 2.0.0)
120
126
  rails-dom-testing (2.0.3)
121
127
  activesupport (>= 4.2.0)
122
128
  nokogiri (>= 1.6)
123
129
  rails-html-sanitizer (1.4.2)
124
130
  loofah (~> 2.3)
125
- railties (6.1.4.1)
126
- actionpack (= 6.1.4.1)
127
- activesupport (= 6.1.4.1)
131
+ railties (6.1.6)
132
+ actionpack (= 6.1.6)
133
+ activesupport (= 6.1.6)
128
134
  method_source
129
- rake (>= 0.13)
135
+ rake (>= 12.2)
130
136
  thor (~> 1.0)
131
137
  rainbow (3.0.0)
132
138
  rake (13.0.6)
@@ -148,31 +154,35 @@ GEM
148
154
  rubocop-ast (>= 0.4.0)
149
155
  ruby-progressbar (1.11.0)
150
156
  semantic_range (3.0.0)
151
- sprockets (4.0.2)
157
+ sprockets (4.0.3)
152
158
  concurrent-ruby (~> 1.0)
153
159
  rack (> 1, < 3)
154
- sprockets-rails (3.2.2)
155
- actionpack (>= 4.0)
156
- activesupport (>= 4.0)
160
+ sprockets-rails (3.4.2)
161
+ actionpack (>= 5.2)
162
+ activesupport (>= 5.2)
157
163
  sprockets (>= 3.0.0)
158
- thor (1.1.0)
164
+ thor (1.2.1)
159
165
  tzinfo (2.0.4)
160
166
  concurrent-ruby (~> 1.0)
161
167
  unicode-display_width (2.1.0)
162
168
  websocket-driver (0.7.5)
163
169
  websocket-extensions (>= 0.1.0)
164
170
  websocket-extensions (0.1.5)
165
- zeitwerk (2.4.2)
171
+ zeitwerk (2.5.4)
166
172
 
167
173
  PLATFORMS
174
+ arm64-darwin-20
168
175
  ruby
176
+ x86_64-darwin-20
177
+ x86_64-linux
169
178
 
170
179
  DEPENDENCIES
171
180
  bundler (>= 1.3.0)
172
181
  byebug
173
182
  minitest (~> 5.0)
183
+ nokogiri (~> 1.13, >= 1.13.6)
174
184
  rack-proxy
175
- rails
185
+ rails (>= 6.1.6)
176
186
  rake (>= 11.1)
177
187
  rubocop
178
188
  rubocop-performance