shakapacker 8.0.1 → 8.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/dummy.yml +1 -0
  3. data/.github/workflows/generator.yml +20 -1
  4. data/.github/workflows/ruby.yml +22 -2
  5. data/CHANGELOG.md +25 -1
  6. data/Gemfile.lock +82 -88
  7. data/README.md +19 -1
  8. data/__mocks__/nonexistent/package.json +4 -0
  9. data/__mocks__/sass-loader/package.json +4 -0
  10. data/docs/react.md +4 -4
  11. data/docs/troubleshooting.md +29 -0
  12. data/docs/using_esbuild_loader.md +1 -1
  13. data/docs/v8_upgrade.md +3 -5
  14. data/gemfiles/Gemfile-rails.6.0.x +1 -1
  15. data/gemfiles/Gemfile-rails.6.1.x +0 -1
  16. data/gemfiles/Gemfile-rails.7.0.x +1 -2
  17. data/gemfiles/Gemfile-rails.7.1.x +1 -2
  18. data/gemfiles/Gemfile-rails.7.2.x +11 -0
  19. data/gemfiles/Gemfile-rails.8.0.x +11 -0
  20. data/jest.config.js +2 -1
  21. data/lib/shakapacker/compiler.rb +2 -1
  22. data/lib/shakapacker/compiler_strategy.rb +2 -2
  23. data/lib/shakapacker/dev_server_runner.rb +4 -3
  24. data/lib/shakapacker/digest_strategy.rb +2 -1
  25. data/lib/shakapacker/helper.rb +1 -1
  26. data/lib/shakapacker/mtime_strategy.rb +1 -1
  27. data/lib/shakapacker/railtie.rb +4 -4
  28. data/lib/shakapacker/runner.rb +17 -8
  29. data/lib/shakapacker/utils/manager.rb +13 -2
  30. data/lib/shakapacker/version.rb +1 -1
  31. data/lib/shakapacker/version_checker.rb +1 -1
  32. data/lib/shakapacker/webpack_runner.rb +2 -1
  33. data/lib/shakapacker.rb +10 -10
  34. data/package/rules/sass.js +8 -6
  35. data/package/utils/helpers.js +9 -1
  36. data/package.json +2 -2
  37. data/test/package/development.test.js +9 -0
  38. data/test/package/environments/base.test.js +9 -0
  39. data/test/package/environments/development.test.js +9 -0
  40. data/test/package/environments/production.test.js +9 -0
  41. data/test/package/helpers.test.js +11 -0
  42. data/test/package/index.test.js +9 -0
  43. data/test/package/production.test.js +9 -0
  44. data/test/package/rules/index.test.js +9 -0
  45. data/test/package/rules/sass.test.js +23 -0
  46. data/test/package/rules/sass1.test.js +23 -0
  47. data/test/package/staging.test.js +9 -0
  48. data/test/package/test.test.js +9 -0
  49. data/test/resolver.js +13 -0
  50. metadata +16 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11198f6552ef8050f8946a58ebdf5ff5cffa7a79a9dd8aec3932afd1b7befdc3
4
- data.tar.gz: 7b50eca8202c5f2bcadabd61d5f9dfb15c48a91d5b4c45125beb58c5e1943ce1
3
+ metadata.gz: 50df828db39af7e84673e9ab8bd4569d644084e428902d02084574b77db9bd8e
4
+ data.tar.gz: 6aac530ddb579fc7f92888a1e65282bbf69c98bc2773fcd27d77ec19671ec74d
5
5
  SHA512:
6
- metadata.gz: 82d676202bfbd8d99d0192e91f1215715094122f32e3776c9ab394cb9f35c7e0bbc67f31aacc88b07c4081b059c46011be883c7bf4f48988f82d3f18a9b99024
7
- data.tar.gz: dac55e80ee92fa06ba53580b0555a677788dfb0d061148db7fef18bd34b9ad11cbe3350b4ee84609b3207d0f2dc45a9e6a454f21eb2dbf3688e17eaf7861bf44
6
+ metadata.gz: e6250e22762bd47aaf6dc0d2b93354bea65e3ca2e5d629177bec478495de3e6eaba5a458e3f0feda712bf08bf2b48f2f0a6f003baa6b2ffb354e49fb042e65d3
7
+ data.tar.gz: 45f445078b0d50f1eebc6d27f8a76ceeb3c8eb38cce4a4881562ab77d3a47f6e86d293f5c46a468a8fc4566bc217b39105cec85a78b5fdc1e77112c22a1d3ff8
@@ -25,6 +25,7 @@ jobs:
25
25
  - uses: ruby/setup-ruby@v1
26
26
  with:
27
27
  ruby-version: '3.1.2'
28
+ rubygems: latest
28
29
  - name: Install dependencies
29
30
  run: |
30
31
  bundle install
@@ -18,24 +18,42 @@ jobs:
18
18
  strategy:
19
19
  matrix:
20
20
  os: [ubuntu-latest]
21
- ruby: ['2.7', '3.0', '3.1', '3.2', '3.3']
21
+ ruby: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4']
22
22
  gemfile:
23
23
  - gemfiles/Gemfile-rails.6.0.x
24
24
  - gemfiles/Gemfile-rails.6.1.x
25
25
  - gemfiles/Gemfile-rails.7.0.x
26
26
  - gemfiles/Gemfile-rails.7.1.x
27
+ - gemfiles/Gemfile-rails.7.2.x
28
+ - gemfiles/Gemfile-rails.8.0.x
27
29
  # Uncomment the following line only to ensure compatibility with the
28
30
  # upcomming Rails versions, maybe before a release.
29
31
  #- gemfiles/Gemfile-rails-edge
30
32
  exclude:
33
+ - ruby: '2.7'
34
+ gemfile: gemfiles/Gemfile-rails.7.2.x
35
+ - ruby: '2.7'
36
+ gemfile: gemfiles/Gemfile-rails.8.0.x
37
+ - ruby: '3.0'
38
+ gemfile: gemfiles/Gemfile-rails.7.2.x
39
+ - ruby: '3.0'
40
+ gemfile: gemfiles/Gemfile-rails.8.0.x
31
41
  - ruby: '3.1'
32
42
  gemfile: gemfiles/Gemfile-rails.6.0.x
43
+ - ruby: '3.1'
44
+ gemfile: gemfiles/Gemfile-rails.8.0.x
33
45
  - ruby: '3.2'
34
46
  gemfile: gemfiles/Gemfile-rails.6.0.x
35
47
  - ruby: '3.3'
36
48
  gemfile: gemfiles/Gemfile-rails.6.0.x
37
49
  - ruby: '3.3'
38
50
  gemfile: gemfiles/Gemfile-rails.6.1.x
51
+ - ruby: '3.4'
52
+ gemfile: gemfiles/Gemfile-rails.6.0.x
53
+ - ruby: '3.4'
54
+ gemfile: gemfiles/Gemfile-rails.6.1.x
55
+ - ruby: '3.4'
56
+ gemfile: gemfiles/Gemfile-rails.7.0.x
39
57
 
40
58
  env:
41
59
  BUNDLE_GEMFILE: ${{ matrix.gemfile }}
@@ -47,5 +65,6 @@ jobs:
47
65
  - uses: ruby/setup-ruby@v1
48
66
  with:
49
67
  ruby-version: ${{ matrix.ruby }}
68
+ rubygems: latest
50
69
  bundler-cache: true
51
70
  - run: bundle exec rake run_spec:generator
@@ -23,7 +23,8 @@ jobs:
23
23
  run: rm -f Gemfile.lock
24
24
  - uses: ruby/setup-ruby@v1
25
25
  with:
26
- ruby-version: '3.3'
26
+ ruby-version: '3.4'
27
+ rubygems: latest
27
28
  bundler-cache: true
28
29
 
29
30
  - name: Ruby rubocop
@@ -35,24 +36,42 @@ jobs:
35
36
  strategy:
36
37
  matrix:
37
38
  os: [ubuntu-latest]
38
- ruby: ['2.7', '3.0', '3.1', '3.2', '3.3']
39
+ ruby: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4']
39
40
  gemfile:
40
41
  - gemfiles/Gemfile-rails.6.0.x
41
42
  - gemfiles/Gemfile-rails.6.1.x
42
43
  - gemfiles/Gemfile-rails.7.0.x
43
44
  - gemfiles/Gemfile-rails.7.1.x
45
+ - gemfiles/Gemfile-rails.7.2.x
46
+ - gemfiles/Gemfile-rails.8.0.x
44
47
  # Uncomment the following line only to ensure compatibility with the
45
48
  # upcomming Rails versions, maybe before a release.
46
49
  #- gemfiles/Gemfile-rails-edge
47
50
  exclude:
51
+ - ruby: '2.7'
52
+ gemfile: gemfiles/Gemfile-rails.7.2.x
53
+ - ruby: '2.7'
54
+ gemfile: gemfiles/Gemfile-rails.8.0.x
55
+ - ruby: '3.0'
56
+ gemfile: gemfiles/Gemfile-rails.7.2.x
57
+ - ruby: '3.0'
58
+ gemfile: gemfiles/Gemfile-rails.8.0.x
48
59
  - ruby: '3.1'
49
60
  gemfile: gemfiles/Gemfile-rails.6.0.x
61
+ - ruby: '3.1'
62
+ gemfile: gemfiles/Gemfile-rails.8.0.x
50
63
  - ruby: '3.2'
51
64
  gemfile: gemfiles/Gemfile-rails.6.0.x
52
65
  - ruby: '3.3'
53
66
  gemfile: gemfiles/Gemfile-rails.6.0.x
54
67
  - ruby: '3.3'
55
68
  gemfile: gemfiles/Gemfile-rails.6.1.x
69
+ - ruby: '3.4'
70
+ gemfile: gemfiles/Gemfile-rails.6.0.x
71
+ - ruby: '3.4'
72
+ gemfile: gemfiles/Gemfile-rails.6.1.x
73
+ - ruby: '3.4'
74
+ gemfile: gemfiles/Gemfile-rails.7.0.x
56
75
 
57
76
  env:
58
77
  BUNDLE_GEMFILE: ${{ matrix.gemfile }}
@@ -64,6 +83,7 @@ jobs:
64
83
  - uses: ruby/setup-ruby@v1
65
84
  with:
66
85
  ruby-version: ${{ matrix.ruby }}
86
+ rubygems: latest
67
87
  bundler-cache: true
68
88
 
69
89
  - name: Ruby specs
data/CHANGELOG.md CHANGED
@@ -10,6 +10,27 @@ _next_ branch is for v8 changes
10
10
  ## [Unreleased]
11
11
  Changes since the last non-beta release.
12
12
 
13
+ ## [v8.1.0] - January 20, 2025
14
+
15
+ ### Added
16
+
17
+ - Allow `webpack-cli` v6. [PR 533](https://github.com/shakacode/shakapacker/pull/533) by [tagliala](https://github.com/tagliala).
18
+
19
+ ### Changed
20
+ - Changed internal `require`s to `require_relative` to make code less dependent on the load path. [PR 516](https://github.com/shakacode/shakapacker/pull/516) by [tagliala](https://github.com/tagliala).
21
+ - Allow configuring webpack from a Typescript file (`config/webpack/webpack.config.ts`). [PR 524](https://github.com/shakacode/shakapacker/pull/524) by [jdelStrother](https://github.com/jdelStrother).
22
+
23
+ ### Fixed
24
+ - Fix error when rails environment is required from outside the rails root directory [PR 520](https://github.com/shakacode/shakapacker/pull/520)
25
+
26
+ ## [v8.0.2] - August 28, 2024
27
+
28
+ ### Fixed
29
+ - Fix wrong instruction in esbuild loader documentation [PR 504](https://github.com/shakacode/shakapacker/pull/504) by [adriangohjw](https://github.com/adriangohjw).
30
+ - Add logic to sass rule conditional on sass-loader version [PR 508](https://github.com/shakacode/shakapacker/pull/508) by [Judahmeek](https://github.com/Judahmeek).
31
+
32
+ ## [v8.0.1] - July 10, 2024
33
+
13
34
  ### Changed
14
35
  - Update outdated GitHub Actions to use Node.js 20.0 versions instead [PR 497](https://github.com/shakacode/shakapacker/pull/497) by [adriangohjw](https://github.com/adriangohjw).
15
36
  - Allow `webpack-merge` v6 to be used [PR 502](https://github.com/shakacode/shakapacker/pull/502) by [G-Rath](https://github.com/g-rath).
@@ -380,7 +401,10 @@ Note: [Rubygem is 6.3.0.pre.rc.1](https://rubygems.org/gems/shakapacker/versions
380
401
  ## v5.4.3 and prior changes from rails/webpacker
381
402
  See [CHANGELOG.md in rails/webpacker (up to v5.4.3)](https://github.com/rails/webpacker/blob/master/CHANGELOG.md)
382
403
 
383
- [Unreleased]: https://github.com/shakacode/shakapacker/compare/v8.0.0...main
404
+ [Unreleased]: https://github.com/shakacode/shakapacker/compare/v8.1.0...main
405
+ [v8.1.0]: https://github.com/shakacode/shakapacker/compare/v8.0.2...v8.1.0
406
+ [v8.0.2]: https://github.com/shakacode/shakapacker/compare/v8.0.1...v8.0.2
407
+ [v8.0.1]: https://github.com/shakacode/shakapacker/compare/v8.0.0...v8.0.1
384
408
  [v8.0.0]: https://github.com/shakacode/shakapacker/compare/v7.2.3...v8.0.0
385
409
  [v7.2.3]: https://github.com/shakacode/shakapacker/compare/v7.2.2...v7.2.3
386
410
  [v7.2.2]: https://github.com/shakacode/shakapacker/compare/v7.2.1...v7.2.2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shakapacker (8.0.1)
4
+ shakapacker (8.1.0)
5
5
  activesupport (>= 5.2)
6
6
  package_json
7
7
  rack-proxy (>= 0.6.1)
@@ -11,86 +11,82 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- actioncable (7.1.3.4)
15
- actionpack (= 7.1.3.4)
16
- activesupport (= 7.1.3.4)
14
+ actioncable (7.2.1)
15
+ actionpack (= 7.2.1)
16
+ activesupport (= 7.2.1)
17
17
  nio4r (~> 2.0)
18
18
  websocket-driver (>= 0.6.1)
19
19
  zeitwerk (~> 2.6)
20
- actionmailbox (7.1.3.4)
21
- actionpack (= 7.1.3.4)
22
- activejob (= 7.1.3.4)
23
- activerecord (= 7.1.3.4)
24
- activestorage (= 7.1.3.4)
25
- activesupport (= 7.1.3.4)
26
- mail (>= 2.7.1)
27
- net-imap
28
- net-pop
29
- net-smtp
30
- actionmailer (7.1.3.4)
31
- actionpack (= 7.1.3.4)
32
- actionview (= 7.1.3.4)
33
- activejob (= 7.1.3.4)
34
- activesupport (= 7.1.3.4)
35
- mail (~> 2.5, >= 2.5.4)
36
- net-imap
37
- net-pop
38
- net-smtp
20
+ actionmailbox (7.2.1)
21
+ actionpack (= 7.2.1)
22
+ activejob (= 7.2.1)
23
+ activerecord (= 7.2.1)
24
+ activestorage (= 7.2.1)
25
+ activesupport (= 7.2.1)
26
+ mail (>= 2.8.0)
27
+ actionmailer (7.2.1)
28
+ actionpack (= 7.2.1)
29
+ actionview (= 7.2.1)
30
+ activejob (= 7.2.1)
31
+ activesupport (= 7.2.1)
32
+ mail (>= 2.8.0)
39
33
  rails-dom-testing (~> 2.2)
40
- actionpack (7.1.3.4)
41
- actionview (= 7.1.3.4)
42
- activesupport (= 7.1.3.4)
34
+ actionpack (7.2.1)
35
+ actionview (= 7.2.1)
36
+ activesupport (= 7.2.1)
43
37
  nokogiri (>= 1.8.5)
44
38
  racc
45
- rack (>= 2.2.4)
39
+ rack (>= 2.2.4, < 3.2)
46
40
  rack-session (>= 1.0.1)
47
41
  rack-test (>= 0.6.3)
48
42
  rails-dom-testing (~> 2.2)
49
43
  rails-html-sanitizer (~> 1.6)
50
- actiontext (7.1.3.4)
51
- actionpack (= 7.1.3.4)
52
- activerecord (= 7.1.3.4)
53
- activestorage (= 7.1.3.4)
54
- activesupport (= 7.1.3.4)
44
+ useragent (~> 0.16)
45
+ actiontext (7.2.1)
46
+ actionpack (= 7.2.1)
47
+ activerecord (= 7.2.1)
48
+ activestorage (= 7.2.1)
49
+ activesupport (= 7.2.1)
55
50
  globalid (>= 0.6.0)
56
51
  nokogiri (>= 1.8.5)
57
- actionview (7.1.3.4)
58
- activesupport (= 7.1.3.4)
52
+ actionview (7.2.1)
53
+ activesupport (= 7.2.1)
59
54
  builder (~> 3.1)
60
55
  erubi (~> 1.11)
61
56
  rails-dom-testing (~> 2.2)
62
57
  rails-html-sanitizer (~> 1.6)
63
- activejob (7.1.3.4)
64
- activesupport (= 7.1.3.4)
58
+ activejob (7.2.1)
59
+ activesupport (= 7.2.1)
65
60
  globalid (>= 0.3.6)
66
- activemodel (7.1.3.4)
67
- activesupport (= 7.1.3.4)
68
- activerecord (7.1.3.4)
69
- activemodel (= 7.1.3.4)
70
- activesupport (= 7.1.3.4)
61
+ activemodel (7.2.1)
62
+ activesupport (= 7.2.1)
63
+ activerecord (7.2.1)
64
+ activemodel (= 7.2.1)
65
+ activesupport (= 7.2.1)
71
66
  timeout (>= 0.4.0)
72
- activestorage (7.1.3.4)
73
- actionpack (= 7.1.3.4)
74
- activejob (= 7.1.3.4)
75
- activerecord (= 7.1.3.4)
76
- activesupport (= 7.1.3.4)
67
+ activestorage (7.2.1)
68
+ actionpack (= 7.2.1)
69
+ activejob (= 7.2.1)
70
+ activerecord (= 7.2.1)
71
+ activesupport (= 7.2.1)
77
72
  marcel (~> 1.0)
78
- activesupport (7.1.3.4)
73
+ activesupport (7.2.1)
79
74
  base64
80
75
  bigdecimal
81
- concurrent-ruby (~> 1.0, >= 1.0.2)
76
+ concurrent-ruby (~> 1.0, >= 1.3.1)
82
77
  connection_pool (>= 2.2.5)
83
78
  drb
84
79
  i18n (>= 1.6, < 2)
80
+ logger (>= 1.4.2)
85
81
  minitest (>= 5.1)
86
- mutex_m
87
- tzinfo (~> 2.0)
82
+ securerandom (>= 0.3)
83
+ tzinfo (~> 2.0, >= 2.0.5)
88
84
  ast (2.4.2)
89
85
  base64 (0.2.0)
90
86
  bigdecimal (3.1.8)
91
87
  builder (3.3.0)
92
88
  byebug (11.1.3)
93
- concurrent-ruby (1.3.3)
89
+ concurrent-ruby (1.3.4)
94
90
  connection_pool (2.4.1)
95
91
  crass (1.0.6)
96
92
  date (3.3.4)
@@ -107,6 +103,7 @@ GEM
107
103
  reline (>= 0.4.2)
108
104
  json (2.7.2)
109
105
  language_server-protocol (3.17.0.3)
106
+ logger (1.6.0)
110
107
  loofah (2.22.0)
111
108
  crass (~> 1.0.2)
112
109
  nokogiri (>= 1.12.0)
@@ -118,9 +115,8 @@ GEM
118
115
  marcel (1.0.4)
119
116
  mini_mime (1.1.5)
120
117
  mini_portile2 (2.8.7)
121
- minitest (5.24.1)
122
- mutex_m (0.2.0)
123
- net-imap (0.4.14)
118
+ minitest (5.25.1)
119
+ net-imap (0.4.15)
124
120
  date
125
121
  net-protocol
126
122
  net-pop (0.1.2)
@@ -130,18 +126,18 @@ GEM
130
126
  net-smtp (0.5.0)
131
127
  net-protocol
132
128
  nio4r (2.7.3)
133
- nokogiri (1.16.6)
129
+ nokogiri (1.16.7)
134
130
  mini_portile2 (~> 2.8.2)
135
131
  racc (~> 1.4)
136
132
  package_json (0.1.0)
137
- parallel (1.25.1)
138
- parser (3.3.3.0)
133
+ parallel (1.26.3)
134
+ parser (3.3.4.2)
139
135
  ast (~> 2.4.1)
140
136
  racc
141
137
  psych (5.1.2)
142
138
  stringio
143
- racc (1.8.0)
144
- rack (3.1.6)
139
+ racc (1.8.1)
140
+ rack (3.1.7)
145
141
  rack-proxy (0.7.7)
146
142
  rack
147
143
  rack-session (2.0.0)
@@ -151,20 +147,20 @@ GEM
151
147
  rackup (2.1.0)
152
148
  rack (>= 3)
153
149
  webrick (~> 1.8)
154
- rails (7.1.3.4)
155
- actioncable (= 7.1.3.4)
156
- actionmailbox (= 7.1.3.4)
157
- actionmailer (= 7.1.3.4)
158
- actionpack (= 7.1.3.4)
159
- actiontext (= 7.1.3.4)
160
- actionview (= 7.1.3.4)
161
- activejob (= 7.1.3.4)
162
- activemodel (= 7.1.3.4)
163
- activerecord (= 7.1.3.4)
164
- activestorage (= 7.1.3.4)
165
- activesupport (= 7.1.3.4)
150
+ rails (7.2.1)
151
+ actioncable (= 7.2.1)
152
+ actionmailbox (= 7.2.1)
153
+ actionmailer (= 7.2.1)
154
+ actionpack (= 7.2.1)
155
+ actiontext (= 7.2.1)
156
+ actionview (= 7.2.1)
157
+ activejob (= 7.2.1)
158
+ activemodel (= 7.2.1)
159
+ activerecord (= 7.2.1)
160
+ activestorage (= 7.2.1)
161
+ activesupport (= 7.2.1)
166
162
  bundler (>= 1.15.0)
167
- railties (= 7.1.3.4)
163
+ railties (= 7.2.1)
168
164
  rails-dom-testing (2.2.0)
169
165
  activesupport (>= 5.0.0)
170
166
  minitest
@@ -172,10 +168,10 @@ GEM
172
168
  rails-html-sanitizer (1.6.0)
173
169
  loofah (~> 2.21)
174
170
  nokogiri (~> 1.14)
175
- railties (7.1.3.4)
176
- actionpack (= 7.1.3.4)
177
- activesupport (= 7.1.3.4)
178
- irb
171
+ railties (7.2.1)
172
+ actionpack (= 7.2.1)
173
+ activesupport (= 7.2.1)
174
+ irb (~> 1.13)
179
175
  rackup (>= 1.0.0)
180
176
  rake (>= 12.2)
181
177
  thor (~> 1.0, >= 1.2.2)
@@ -187,11 +183,9 @@ GEM
187
183
  regexp_parser (2.9.2)
188
184
  reline (0.5.9)
189
185
  io-console (~> 0.5)
190
- rexml (3.3.1)
191
- strscan
192
186
  rspec-core (3.13.0)
193
187
  rspec-support (~> 3.13.0)
194
- rspec-expectations (3.13.1)
188
+ rspec-expectations (3.13.2)
195
189
  diff-lcs (>= 1.2.0, < 2.0)
196
190
  rspec-support (~> 3.13.0)
197
191
  rspec-mocks (3.13.1)
@@ -206,36 +200,36 @@ GEM
206
200
  rspec-mocks (~> 3.12)
207
201
  rspec-support (~> 3.12)
208
202
  rspec-support (3.13.1)
209
- rubocop (1.64.1)
203
+ rubocop (1.66.0)
210
204
  json (~> 2.3)
211
205
  language_server-protocol (>= 3.17.0)
212
206
  parallel (~> 1.10)
213
207
  parser (>= 3.3.0.2)
214
208
  rainbow (>= 2.2.2, < 4.0)
215
- regexp_parser (>= 1.8, < 3.0)
216
- rexml (>= 3.2.5, < 4.0)
217
- rubocop-ast (>= 1.31.1, < 2.0)
209
+ regexp_parser (>= 2.4, < 3.0)
210
+ rubocop-ast (>= 1.32.1, < 2.0)
218
211
  ruby-progressbar (~> 1.7)
219
212
  unicode-display_width (>= 2.4.0, < 3.0)
220
- rubocop-ast (1.31.3)
213
+ rubocop-ast (1.32.1)
221
214
  parser (>= 3.3.1.0)
222
215
  rubocop-performance (1.21.1)
223
216
  rubocop (>= 1.48.1, < 2.0)
224
217
  rubocop-ast (>= 1.31.1, < 2.0)
225
218
  ruby-progressbar (1.13.0)
219
+ securerandom (0.3.1)
226
220
  semantic_range (3.0.0)
227
221
  stringio (3.1.1)
228
- strscan (3.1.0)
229
- thor (1.3.1)
222
+ thor (1.3.2)
230
223
  timeout (0.4.1)
231
224
  tzinfo (2.0.6)
232
225
  concurrent-ruby (~> 1.0)
233
226
  unicode-display_width (2.5.0)
227
+ useragent (0.16.10)
234
228
  webrick (1.8.1)
235
229
  websocket-driver (0.7.6)
236
230
  websocket-extensions (>= 0.1.0)
237
231
  websocket-extensions (0.1.5)
238
- zeitwerk (2.6.16)
232
+ zeitwerk (2.6.17)
239
233
 
240
234
  PLATFORMS
241
235
  ruby
@@ -254,4 +248,4 @@ DEPENDENCIES
254
248
  shakapacker!
255
249
 
256
250
  BUNDLED WITH
257
- 2.5.9
251
+ 2.5.18
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Shakapacker (v8)
2
2
 
3
- _Official, actively maintained successor to [rails/webpacker](https://github.com/rails/webpacker).ShakaCode stands behind the long-term maintenance and development of this project for the Rails community._
3
+ _Official, actively maintained successor to [rails/webpacker](https://github.com/rails/webpacker). ShakaCode stands behind the long-term maintenance and development of this project for the Rails community._
4
4
 
5
5
  * ⚠️ See the [6-stable](https://github.com/shakacode/shakapacker/tree/6-stable) branch for Shakapacker v6.x code and documentation. :warning:
6
6
  * See [V8 Upgrade](./docs/v8_upgrade.md) for upgrading from the v7 release.
@@ -675,6 +675,24 @@ module.exports = generateWebpackConfig({
675
675
  });
676
676
  ```
677
677
 
678
+ Optionally, your webpack config file itself can be written in Typescript:
679
+
680
+ ``` bash
681
+ npm install ts-node @types/node @types/webpack
682
+ ```
683
+
684
+ ```ts
685
+ // config/webpack/webpack.config.ts
686
+ import { generateWebpackConfig } from "shakapacker";
687
+ import ForkTSCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
688
+
689
+ const config = generateWebpackConfig({
690
+ plugins: [new ForkTSCheckerWebpackPlugin()],
691
+ });
692
+
693
+ export default config;
694
+ ```
695
+
678
696
  #### CSS
679
697
 
680
698
  To enable CSS support in your application, add the following packages:
@@ -0,0 +1,4 @@
1
+ {
2
+ "main": "./wat",
3
+ "version": "12.0.0"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "main": "./lib/api.js",
3
+ "version": "16.56.81"
4
+ }
data/docs/react.md CHANGED
@@ -34,7 +34,7 @@ Update the Babel configuration in the `package.json` file:
34
34
  },
35
35
  ```
36
36
 
37
- And that's it. You can now create a React app using `app/javascript/application.js` as your entry point.
37
+ And that's it. You can now create a React app using `app/javascript/packs/application.js` as your entry point.
38
38
 
39
39
  ## Enabling Hot Module Replacement (HMR)
40
40
 
@@ -152,11 +152,11 @@ echo '<div id="root"></div>' > app/views/site/index.html.erb
152
152
  touch app/javascript/App.css app/javascript/App.js
153
153
  ```
154
154
 
155
- 4. Edit `app/javascript/application.js` like so:
155
+ 4. Edit `app/javascript/packs/application.js` like so:
156
156
  ```jsx
157
157
  import React from 'react';
158
158
  import { createRoot } from 'react-dom/client';
159
- import HelloMessage from './App';
159
+ import HelloMessage from '../App';
160
160
 
161
161
  const container = document.getElementById('root');
162
162
  const root = createRoot(container);
@@ -267,4 +267,4 @@ rails s
267
267
 
268
268
  11. Edit either the React component at `app/javascript/App.js` or the CSS file at `app/javascript/App.css` and observe the HMR goodness.
269
269
 
270
- Note that HMR will not work if you edit `app/javascript/application.js` and experience a full refresh with a warning in the console. For more info on this, see here: https://github.com/pmmmwh/react-refresh-webpack-plugin/issues/177
270
+ Note that HMR will not work if you edit `app/javascript/packs/application.js` and experience a full refresh with a warning in the console. For more info on this, see here: https://github.com/pmmmwh/react-refresh-webpack-plugin/issues/177
@@ -228,3 +228,32 @@ issue.
228
228
 
229
229
  See [this issue](https://github.com/rails/webpacker/issues/3005) for more
230
230
  details.
231
+
232
+ ## Static file dependencies emitted outside of public output path
233
+
234
+ For static file assets (images, fonts), we use [a Webpack rule](https://github.com/shakacode/shakapacker/blob/main/package/rules/file.js) to handle those files as `asset/resource` type and output them in the `static` folder in the public output path.
235
+
236
+ In order to generate the storage path, we rely on the filename that's [provided by webpack internals](https://webpack.js.org/configuration/output/#outputfilename).
237
+
238
+ This usually works out of the box. There's a potential problem however, if you use the [context setting](https://webpack.js.org/configuration/entry-context/#context) in your webpack config. By default this is set to current Node working directory/project root.
239
+
240
+ If you were to override it like:
241
+ ```
242
+ {
243
+ context: path.resolve(__dirname, '../../app/javascript')
244
+ }
245
+ ```
246
+
247
+ Then the filename available in the rule generator will be relative to that directory.
248
+
249
+ This means for example:
250
+ - a static asset from `node_modules` folder could end up being referenced with path of `../../node_modules/some_module/static_file.jpg` rather than simply `node_modules/some_module/static_file.jpg`.
251
+ - a static asset in one of the `additional_paths`, example `app/assets/images/image.jpg`, would end up being referenced with path of `../assets/images/image.jpg`.
252
+
253
+ Those paths are later passed to [output path generation in the rule](https://github.com/shakacode/shakapacker/blob/e52b335dbabfb934fe7d3076a8322b97d5ef3470/package/rules/file.js#L25-L26), where we would end up with a path like `static/../../node_modules/some_module/static_file.jpg`, resulting in the file being output in a location two directories above the desired path.
254
+
255
+ You can avoid this by:
256
+ - not using overridden `context` in your webpack config, if there's no good reason for it.
257
+ - using custom Webpack config to modify the static file rule, following a similar process as outlined in the [Webpack Configuration](https://github.com/shakacode/shakapacker/blob/main/README.md#webpack-configuration) section of the readme.
258
+
259
+ See [this issue](https://github.com/shakacode/shakapacker/issues/538) for more details.
@@ -27,7 +27,7 @@ To use esbuild as your transpiler today. You need to do two things:
27
27
  npm install esbuild esbuild-loader
28
28
  ```
29
29
 
30
- 2. Add or change `shakapacker_loader` value in your default `shakapacker.yml` config to `esbuild`
30
+ 2. Add or change `webpack_loader` value in your default `shakapacker.yml` config to `esbuild`
31
31
  The default configuration of babel is done by using `package.json` to use the file within the `shakapacker` package.
32
32
 
33
33
  ```yml
data/docs/v8_upgrade.md CHANGED
@@ -21,9 +21,7 @@ If your host might differ, between various environments for example, you will ei
21
21
  - Ensure the assets are specifically rebuilt for each environment (Heroku pipeline promote feature for example does not do that by default).
22
22
  - Make sure the assets are compiled with `SHAKAPACKER_ASSET_HOST=''` ENV variable to avoid hardcording URLs in packs output.
23
23
 
24
- Second option has got a certain gotcha - dynamic imports and static asset references (like image paths in CSS) will end up without host reference and the app will try and fetch them from your app host rather than defined `config.asset_host`.
25
-
26
- Make sure the assets are compiled with `SHAKAPACKER_ASSET_HOST=''` ENV variable to avoid hardcoding URLs in packs output.
24
+ The second option has got a certain gotcha - dynamic imports and static asset references (like image paths in CSS) will end up without a host reference and the app will try and fetch them from your app host rather than defined `config.asset_host`.
27
25
 
28
26
  To get around that, you can use dynamic override as outlined by [Webpack documentation](https://webpack.js.org/guides/asset-modules/#on-the-fly-override).
29
27
 
@@ -102,10 +100,10 @@ namespace :assets do
102
100
  raise if File.exist?("package.json") && !(system "npm ci")
103
101
 
104
102
  # yarn v1.x (classic)
105
- raise if File.exist?("package.json") && !(system "yarn install --immutable")
103
+ raise if File.exist?("package.json") && !(system "yarn install --frozen-lockfile")
106
104
 
107
105
  # yarn v2+ (berry)
108
- raise if File.exist?("package.json") && !(system "yarn install --frozen-lockfile")
106
+ raise if File.exist?("package.json") && !(system "yarn install --immutable")
109
107
 
110
108
  # bun v1+
111
109
  raise if File.exist?("package.json") && !(system "bun install --frozen-lockfile")
@@ -2,7 +2,7 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec path: "../"
4
4
 
5
- gem "rails", "~> 6.0.0.rc2"
5
+ gem "rails", "~> 6.0.0"
6
6
  gem "rake", ">= 11.1"
7
7
  gem "rack-proxy", require: false
8
8
  gem "rspec-rails", "~> 5.0.0"
@@ -5,7 +5,6 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
5
5
  gemspec path: "../"
6
6
 
7
7
  gem "rails", '~>6.1.0'
8
- gem "arel", github: "rails/arel"
9
8
  gem "rake", ">= 11.1"
10
9
  gem "rack-proxy", require: false
11
10
  gem "rspec-rails", "~> 6.0.0"
@@ -5,8 +5,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
5
5
  gemspec path: "../"
6
6
 
7
7
  gem "rails", '~>7.0.0'
8
- gem "arel", github: "rails/arel"
9
8
  gem "rake", ">= 11.1"
10
9
  gem "rack-proxy", require: false
11
- gem "rspec-rails", "~> 6.0.0"
10
+ gem "rspec-rails", "~> 7.0"
12
11
  gem "byebug"
@@ -5,8 +5,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
5
5
  gemspec path: "../"
6
6
 
7
7
  gem "rails", '~>7.1.0'
8
- gem "arel", github: "rails/arel"
9
8
  gem "rake", ">= 11.1"
10
9
  gem "rack-proxy", require: false
11
- gem "rspec-rails", "~> 6.0.0"
10
+ gem "rspec-rails", "~> 7.0"
12
11
  gem "byebug"