shakapacker 8.0.2 → 8.2.0
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/.github/workflows/dummy.yml +1 -0
- data/.github/workflows/generator.yml +20 -1
- data/.github/workflows/ruby.yml +22 -2
- data/CHANGELOG.md +24 -2
- data/Gemfile.lock +82 -88
- data/README.md +40 -2
- data/docs/react.md +4 -4
- data/docs/troubleshooting.md +29 -0
- data/docs/v8_upgrade.md +3 -5
- data/gemfiles/Gemfile-rails.6.0.x +2 -1
- data/gemfiles/Gemfile-rails.6.1.x +1 -1
- data/gemfiles/Gemfile-rails.7.0.x +2 -2
- data/gemfiles/Gemfile-rails.7.1.x +1 -2
- data/gemfiles/Gemfile-rails.7.2.x +11 -0
- data/gemfiles/Gemfile-rails.8.0.x +11 -0
- data/lib/shakapacker/compiler.rb +2 -1
- data/lib/shakapacker/compiler_strategy.rb +2 -2
- data/lib/shakapacker/dev_server_runner.rb +4 -3
- data/lib/shakapacker/digest_strategy.rb +2 -1
- data/lib/shakapacker/helper.rb +27 -15
- data/lib/shakapacker/mtime_strategy.rb +1 -1
- data/lib/shakapacker/railtie.rb +4 -4
- data/lib/shakapacker/runner.rb +17 -8
- data/lib/shakapacker/utils/manager.rb +13 -2
- data/lib/shakapacker/version.rb +1 -1
- data/lib/shakapacker/version_checker.rb +1 -1
- data/lib/shakapacker/webpack_runner.rb +2 -1
- data/lib/shakapacker.rb +10 -10
- data/package.json +3 -3
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e79664eb847e6cd529faef7596863300465e9ae31cccde5042e86363d3bf8a66
|
4
|
+
data.tar.gz: 57c9eb85b20b964f80bf458a1a6f8f0db79c5bf394819f7e687b973e10839a77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed317c5485ff9db1aabc55ce8ac2e9a53975882f180faa65e1cb4565175956c416e9543d8e5683906d77d3b992f282159a049ef689d6b03de6a90c76d9269a6b
|
7
|
+
data.tar.gz: 557c44369b8af2c300f8bb71810fead6ab59b37770cd7b6898a11b901c73c4da241df82591190ccc65ec3d5b5b3e7b4ce4e055cee51e03bd297d585efd49ba3e
|
data/.github/workflows/dummy.yml
CHANGED
@@ -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
|
data/.github/workflows/ruby.yml
CHANGED
@@ -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.
|
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,9 +10,29 @@ _next_ branch is for v8 changes
|
|
10
10
|
## [Unreleased]
|
11
11
|
Changes since the last non-beta release.
|
12
12
|
|
13
|
+
### Added
|
14
|
+
|
15
|
+
- Support for `async` attribute in `javascript_pack_tag`, `append_javascript_pack_tag`, and `prepend_javascript_pack_tag`. [PR 554](https://github.com/shakacode/shakapacker/pull/554) by [AbanoubGhadban](https://github.com/abanoubghadban).
|
16
|
+
- Allow `babel-loader` v10. [PR 552](https://github.com/shakacode/shakapacker/pull/552) by [shoeyn](https://github.com/shoeyn).
|
17
|
+
|
18
|
+
## [v8.1.0] - January 20, 2025
|
19
|
+
|
20
|
+
### Added
|
21
|
+
|
22
|
+
- Allow `webpack-cli` v6. [PR 533](https://github.com/shakacode/shakapacker/pull/533) by [tagliala](https://github.com/tagliala).
|
23
|
+
|
13
24
|
### Changed
|
25
|
+
- 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).
|
26
|
+
- 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).
|
27
|
+
|
28
|
+
### Fixed
|
29
|
+
- Fix error when rails environment is required from outside the rails root directory [PR 520](https://github.com/shakacode/shakapacker/pull/520)
|
14
30
|
|
15
|
-
|
31
|
+
## [v8.0.2] - August 28, 2024
|
32
|
+
|
33
|
+
### Fixed
|
34
|
+
- Fix wrong instruction in esbuild loader documentation [PR 504](https://github.com/shakacode/shakapacker/pull/504) by [adriangohjw](https://github.com/adriangohjw).
|
35
|
+
- 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).
|
16
36
|
|
17
37
|
## [v8.0.1] - July 10, 2024
|
18
38
|
|
@@ -386,7 +406,9 @@ Note: [Rubygem is 6.3.0.pre.rc.1](https://rubygems.org/gems/shakapacker/versions
|
|
386
406
|
## v5.4.3 and prior changes from rails/webpacker
|
387
407
|
See [CHANGELOG.md in rails/webpacker (up to v5.4.3)](https://github.com/rails/webpacker/blob/master/CHANGELOG.md)
|
388
408
|
|
389
|
-
[Unreleased]: https://github.com/shakacode/shakapacker/compare/v8.0
|
409
|
+
[Unreleased]: https://github.com/shakacode/shakapacker/compare/v8.1.0...main
|
410
|
+
[v8.1.0]: https://github.com/shakacode/shakapacker/compare/v8.0.2...v8.1.0
|
411
|
+
[v8.0.2]: https://github.com/shakacode/shakapacker/compare/v8.0.1...v8.0.2
|
390
412
|
[v8.0.1]: https://github.com/shakacode/shakapacker/compare/v8.0.0...v8.0.1
|
391
413
|
[v8.0.0]: https://github.com/shakacode/shakapacker/compare/v7.2.3...v8.0.0
|
392
414
|
[v7.2.3]: https://github.com/shakacode/shakapacker/compare/v7.2.2...v7.2.3
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
shakapacker (8.0
|
4
|
+
shakapacker (8.2.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
|
15
|
-
actionpack (= 7.1
|
16
|
-
activesupport (= 7.1
|
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
|
21
|
-
actionpack (= 7.1
|
22
|
-
activejob (= 7.1
|
23
|
-
activerecord (= 7.1
|
24
|
-
activestorage (= 7.1
|
25
|
-
activesupport (= 7.1
|
26
|
-
mail (>= 2.
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
41
|
-
actionview (= 7.1
|
42
|
-
activesupport (= 7.1
|
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
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
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
|
58
|
-
activesupport (= 7.1
|
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
|
64
|
-
activesupport (= 7.1
|
58
|
+
activejob (7.2.1)
|
59
|
+
activesupport (= 7.2.1)
|
65
60
|
globalid (>= 0.3.6)
|
66
|
-
activemodel (7.1
|
67
|
-
activesupport (= 7.1
|
68
|
-
activerecord (7.1
|
69
|
-
activemodel (= 7.1
|
70
|
-
activesupport (= 7.1
|
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
|
73
|
-
actionpack (= 7.1
|
74
|
-
activejob (= 7.1
|
75
|
-
activerecord (= 7.1
|
76
|
-
activesupport (= 7.1
|
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
|
73
|
+
activesupport (7.2.1)
|
79
74
|
base64
|
80
75
|
bigdecimal
|
81
|
-
concurrent-ruby (~> 1.0, >= 1.
|
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
|
-
|
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.
|
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.
|
122
|
-
|
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.
|
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.
|
138
|
-
parser (3.3.
|
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.
|
144
|
-
rack (3.1.
|
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
|
155
|
-
actioncable (= 7.1
|
156
|
-
actionmailbox (= 7.1
|
157
|
-
actionmailer (= 7.1
|
158
|
-
actionpack (= 7.1
|
159
|
-
actiontext (= 7.1
|
160
|
-
actionview (= 7.1
|
161
|
-
activejob (= 7.1
|
162
|
-
activemodel (= 7.1
|
163
|
-
activerecord (= 7.1
|
164
|
-
activestorage (= 7.1
|
165
|
-
activesupport (= 7.1
|
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
|
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
|
176
|
-
actionpack (= 7.1
|
177
|
-
activesupport (= 7.1
|
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.
|
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.
|
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 (>=
|
216
|
-
|
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.
|
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
|
-
|
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.
|
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.
|
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.
|
@@ -275,7 +275,7 @@ You can provide multiple packs and other attributes. Note, `defer` defaults to s
|
|
275
275
|
```
|
276
276
|
|
277
277
|
The resulting HTML would look like this:
|
278
|
-
```
|
278
|
+
```html
|
279
279
|
<script src="/packs/vendor-16838bab065ae1e314.js" data-turbo-track="reload" defer></script>
|
280
280
|
<script src="/packs/calendar~runtime-16838bab065ae1e314.js" data-turbo-track="reload" defer></script>
|
281
281
|
<script src="/packs/calendar-1016838bab065ae1e314.js" data-turbo-track="reload" defer"></script>
|
@@ -287,6 +287,26 @@ In this output, both the calendar and map codes might refer to other common libr
|
|
287
287
|
|
288
288
|
Note, the default of "defer" for the `javascript_pack_tag`. You can override that to `false`. If you expose jquery globally with `expose-loader,` by using `import $ from "expose-loader?exposes=$,jQuery!jquery"` in your `app/javascript/application.js`, pass the option `defer: false` to your `javascript_pack_tag`.
|
289
289
|
|
290
|
+
The `javascript_pack_tag` also supports the `async` attribute, which you can enable by passing `async: true`:
|
291
|
+
|
292
|
+
```erb
|
293
|
+
<%= javascript_pack_tag 'application', async: true %>
|
294
|
+
```
|
295
|
+
|
296
|
+
This will generate script tags with the `async` attribute, which allows the browser to download and execute the script asynchronously without blocking HTML parsing:
|
297
|
+
|
298
|
+
```html
|
299
|
+
<script src="/packs/vendor-16838bab065ae1e314.js" async></script>
|
300
|
+
<script src="/packs/application~runtime-16838bab065ae1e314.js" async></script>
|
301
|
+
<script src="/packs/application-1016838bab065ae1e314.js" async></script>
|
302
|
+
```
|
303
|
+
|
304
|
+
Note that when using `async: true`, scripts may execute in any order as soon as they're downloaded, which could cause issues if your code has dependencies between files. In most cases, `defer` (the default) is preferred as it maintains execution order.
|
305
|
+
|
306
|
+
> [!NOTE]
|
307
|
+
>
|
308
|
+
> When both `async` and `defer` attributes are specified, `async` takes precedence according to HTML5 specifications. So if you pass both `async: true` and `defer: true`, the script tag will use `async`.
|
309
|
+
|
290
310
|
**Important:** Pass all your pack names as multiple arguments, not multiple calls, when using `javascript_pack_tag` and the `stylesheet_pack_tag`. Otherwise, you will get duplicated chunks on the page.
|
291
311
|
|
292
312
|
```erb
|
@@ -675,6 +695,24 @@ module.exports = generateWebpackConfig({
|
|
675
695
|
});
|
676
696
|
```
|
677
697
|
|
698
|
+
Optionally, your webpack config file itself can be written in Typescript:
|
699
|
+
|
700
|
+
``` bash
|
701
|
+
npm install ts-node @types/node @types/webpack
|
702
|
+
```
|
703
|
+
|
704
|
+
```ts
|
705
|
+
// config/webpack/webpack.config.ts
|
706
|
+
import { generateWebpackConfig } from "shakapacker";
|
707
|
+
import ForkTSCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
|
708
|
+
|
709
|
+
const config = generateWebpackConfig({
|
710
|
+
plugins: [new ForkTSCheckerWebpackPlugin()],
|
711
|
+
});
|
712
|
+
|
713
|
+
export default config;
|
714
|
+
```
|
715
|
+
|
678
716
|
#### CSS
|
679
717
|
|
680
718
|
To enable CSS support in your application, add the following packages:
|
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 '
|
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
|
data/docs/troubleshooting.md
CHANGED
@@ -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.
|
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
|
-
|
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 --
|
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 --
|
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")
|
@@ -5,8 +5,8 @@ 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"
|
12
11
|
gem "byebug"
|
12
|
+
gem "concurrent-ruby", "1.3.4"
|
@@ -5,8 +5,8 @@ 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", "~>
|
10
|
+
gem "rspec-rails", "~> 7.0"
|
12
11
|
gem "byebug"
|
12
|
+
gem "concurrent-ruby", "1.3.4"
|
@@ -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", "~>
|
10
|
+
gem "rspec-rails", "~> 7.0"
|
12
11
|
gem "byebug"
|
data/lib/shakapacker/compiler.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
require "open3"
|
2
|
-
require "shakapacker/compiler_strategy"
|
3
2
|
require "fileutils"
|
4
3
|
|
4
|
+
require_relative "compiler_strategy"
|
5
|
+
|
5
6
|
class Shakapacker::Compiler
|
6
7
|
# Additional environment variables that the compiler is being run with
|
7
8
|
# Shakapacker::Compiler.env['FRONTEND_API_KEY'] = 'your_secret_key'
|
@@ -1,8 +1,9 @@
|
|
1
1
|
require "shellwords"
|
2
2
|
require "socket"
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
|
4
|
+
require_relative "configuration"
|
5
|
+
require_relative "dev_server"
|
6
|
+
require_relative "runner"
|
6
7
|
|
7
8
|
module Shakapacker
|
8
9
|
class DevServerRunner < Shakapacker::Runner
|
data/lib/shakapacker/helper.rb
CHANGED
@@ -95,22 +95,25 @@ module Shakapacker::Helper
|
|
95
95
|
#
|
96
96
|
# <%= javascript_pack_tag 'calendar' %>
|
97
97
|
# <%= javascript_pack_tag 'map' %>
|
98
|
-
def javascript_pack_tag(*names, defer: true, **options)
|
98
|
+
def javascript_pack_tag(*names, defer: true, async: false, **options)
|
99
99
|
if @javascript_pack_tag_loaded
|
100
100
|
raise "To prevent duplicated chunks on the page, you should call javascript_pack_tag only once on the page. " \
|
101
101
|
"Please refer to https://github.com/shakacode/shakapacker/blob/main/README.md#view-helpers-javascript_pack_tag-and-stylesheet_pack_tag for the usage guide"
|
102
102
|
end
|
103
103
|
|
104
|
-
append_javascript_pack_tag(*names, defer: defer)
|
105
|
-
|
106
|
-
|
104
|
+
append_javascript_pack_tag(*names, defer: defer, async: async)
|
105
|
+
sync = sources_from_manifest_entrypoints(javascript_pack_tag_queue[:sync], type: :javascript)
|
106
|
+
async = sources_from_manifest_entrypoints(javascript_pack_tag_queue[:async], type: :javascript) - sync
|
107
|
+
deferred = sources_from_manifest_entrypoints(javascript_pack_tag_queue[:deferred], type: :javascript) - sync - async
|
107
108
|
|
108
109
|
@javascript_pack_tag_loaded = true
|
109
110
|
|
110
111
|
capture do
|
111
|
-
concat javascript_include_tag(*
|
112
|
-
concat "\n" if
|
113
|
-
concat javascript_include_tag(*
|
112
|
+
concat javascript_include_tag(*async, **options.dup.tap { |o| o[:async] = true })
|
113
|
+
concat "\n" if async.any? && deferred.any?
|
114
|
+
concat javascript_include_tag(*deferred, **options.dup.tap { |o| o[:defer] = true })
|
115
|
+
concat "\n" if sync.any? && deferred.any?
|
116
|
+
concat javascript_include_tag(*sync, **options)
|
114
117
|
end
|
115
118
|
end
|
116
119
|
|
@@ -179,27 +182,35 @@ module Shakapacker::Helper
|
|
179
182
|
nil
|
180
183
|
end
|
181
184
|
|
182
|
-
def append_javascript_pack_tag(*names, defer: true)
|
183
|
-
update_javascript_pack_tag_queue(defer: defer) do |hash_key|
|
185
|
+
def append_javascript_pack_tag(*names, defer: true, async: false)
|
186
|
+
update_javascript_pack_tag_queue(defer: defer, async: async) do |hash_key|
|
184
187
|
javascript_pack_tag_queue[hash_key] |= names
|
185
188
|
end
|
186
189
|
end
|
187
190
|
|
188
|
-
def prepend_javascript_pack_tag(*names, defer: true)
|
189
|
-
update_javascript_pack_tag_queue(defer: defer) do |hash_key|
|
191
|
+
def prepend_javascript_pack_tag(*names, defer: true, async: false)
|
192
|
+
update_javascript_pack_tag_queue(defer: defer, async: async) do |hash_key|
|
190
193
|
javascript_pack_tag_queue[hash_key].unshift(*names)
|
191
194
|
end
|
192
195
|
end
|
193
196
|
|
194
197
|
private
|
195
198
|
|
196
|
-
def update_javascript_pack_tag_queue(defer:)
|
199
|
+
def update_javascript_pack_tag_queue(defer:, async:)
|
197
200
|
if @javascript_pack_tag_loaded
|
198
|
-
raise "You can only call #{caller_locations(1..1).first.
|
201
|
+
raise "You can only call #{caller_locations(1..1).first.base_label} before javascript_pack_tag helper. " \
|
199
202
|
"Please refer to https://github.com/shakacode/shakapacker/blob/main/README.md#view-helper-append_javascript_pack_tag-prepend_javascript_pack_tag-and-append_stylesheet_pack_tag for the usage guide"
|
200
203
|
end
|
201
204
|
|
202
|
-
|
205
|
+
# When both async and defer are specified, async takes precedence per HTML5 spec
|
206
|
+
hash_key = if async
|
207
|
+
:async
|
208
|
+
elsif defer
|
209
|
+
:deferred
|
210
|
+
else
|
211
|
+
:sync
|
212
|
+
end
|
213
|
+
yield(hash_key)
|
203
214
|
|
204
215
|
# prevent rendering Array#to_s representation when used with <%= … %> syntax
|
205
216
|
nil
|
@@ -207,8 +218,9 @@ module Shakapacker::Helper
|
|
207
218
|
|
208
219
|
def javascript_pack_tag_queue
|
209
220
|
@javascript_pack_tag_queue ||= {
|
221
|
+
async: [],
|
210
222
|
deferred: [],
|
211
|
-
|
223
|
+
sync: []
|
212
224
|
}
|
213
225
|
end
|
214
226
|
|
data/lib/shakapacker/railtie.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require "rails/railtie"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
require_relative "helper"
|
4
|
+
require_relative "dev_server_proxy"
|
5
|
+
require_relative "version_checker"
|
6
|
+
require_relative "utils/manager"
|
7
7
|
|
8
8
|
class Shakapacker::Engine < ::Rails::Engine
|
9
9
|
# Allows Shakapacker config values to be set via Rails env config files
|
data/lib/shakapacker/runner.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require_relative "utils/misc"
|
2
|
+
require_relative "utils/manager"
|
3
|
+
|
3
4
|
require "package_json"
|
4
5
|
|
5
6
|
module Shakapacker
|
@@ -14,13 +15,8 @@ module Shakapacker
|
|
14
15
|
@argv = argv
|
15
16
|
|
16
17
|
@app_path = File.expand_path(".", Dir.pwd)
|
17
|
-
@webpack_config = File.join(@app_path, "config/webpack/webpack.config.js")
|
18
18
|
@shakapacker_config = ENV["SHAKAPACKER_CONFIG"] || File.join(@app_path, "config/shakapacker.yml")
|
19
|
-
|
20
|
-
unless File.exist?(@webpack_config)
|
21
|
-
$stderr.puts "webpack config #{@webpack_config} not found, please run 'bundle exec rails shakapacker:install' to install Shakapacker with default configs or add the missing config file for your custom environment."
|
22
|
-
exit!
|
23
|
-
end
|
19
|
+
@webpack_config = find_webpack_config
|
24
20
|
|
25
21
|
Shakapacker::Utils::Manager.error_unless_package_manager_is_obvious!
|
26
22
|
end
|
@@ -28,5 +24,18 @@ module Shakapacker
|
|
28
24
|
def package_json
|
29
25
|
@package_json ||= PackageJson.read(@app_path)
|
30
26
|
end
|
27
|
+
|
28
|
+
private
|
29
|
+
def find_webpack_config
|
30
|
+
possible_paths = %w[ts js].map do |ext|
|
31
|
+
File.join(@app_path, "config/webpack/webpack.config.#{ext}")
|
32
|
+
end
|
33
|
+
path = possible_paths.find { |f| File.exist?(f) }
|
34
|
+
unless path
|
35
|
+
$stderr.puts "webpack config #{possible_paths.last} not found, please run 'bundle exec rails shakapacker:install' to install Shakapacker with default configs or add the missing config file for your custom environment."
|
36
|
+
exit!
|
37
|
+
end
|
38
|
+
path
|
39
|
+
end
|
31
40
|
end
|
32
41
|
end
|
@@ -16,7 +16,7 @@ module Shakapacker
|
|
16
16
|
|
17
17
|
# Emits a warning if it's not obvious what package manager to use
|
18
18
|
def self.error_unless_package_manager_is_obvious!
|
19
|
-
return unless PackageJson.read.fetch("packageManager", nil).nil?
|
19
|
+
return unless PackageJson.read(rails_root).fetch("packageManager", nil).nil?
|
20
20
|
|
21
21
|
guessed_binary = guess_binary
|
22
22
|
|
@@ -35,7 +35,7 @@ module Shakapacker
|
|
35
35
|
#
|
36
36
|
# @return [String]
|
37
37
|
def self.guess_binary
|
38
|
-
MANAGER_LOCKS.find { |_, lock| File.exist?(lock) }&.first || "npm"
|
38
|
+
MANAGER_LOCKS.find { |_, lock| File.exist?(rails_root.join(lock)) }&.first || "npm"
|
39
39
|
end
|
40
40
|
|
41
41
|
# Guesses the version of the package manager to use by calling `<manager> --version`
|
@@ -53,6 +53,17 @@ module Shakapacker
|
|
53
53
|
|
54
54
|
stdout.chomp
|
55
55
|
end
|
56
|
+
|
57
|
+
private
|
58
|
+
def self.rails_root
|
59
|
+
if defined?(APP_ROOT)
|
60
|
+
Pathname.new(APP_ROOT)
|
61
|
+
elsif defined?(Rails)
|
62
|
+
Rails.root
|
63
|
+
else
|
64
|
+
raise "can only be called from a rails environment or with APP_ROOT defined"
|
65
|
+
end
|
66
|
+
end
|
56
67
|
end
|
57
68
|
end
|
58
69
|
end
|
data/lib/shakapacker/version.rb
CHANGED
data/lib/shakapacker.rb
CHANGED
@@ -37,13 +37,13 @@ module Shakapacker
|
|
37
37
|
delegate :bootstrap, :clean, :clobber, :compile, to: :commands
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
40
|
+
require_relative "shakapacker/instance"
|
41
|
+
require_relative "shakapacker/env"
|
42
|
+
require_relative "shakapacker/configuration"
|
43
|
+
require_relative "shakapacker/manifest"
|
44
|
+
require_relative "shakapacker/compiler"
|
45
|
+
require_relative "shakapacker/commands"
|
46
|
+
require_relative "shakapacker/dev_server"
|
47
|
+
require_relative "shakapacker/deprecation_helper"
|
48
|
+
|
49
|
+
require_relative "shakapacker/railtie" if defined?(Rails)
|
data/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "shakapacker",
|
3
|
-
"version": "8.0
|
3
|
+
"version": "8.2.0",
|
4
4
|
"description": "Use webpack to manage app-like JavaScript modules in Rails",
|
5
5
|
"homepage": "https://github.com/shakacode/shakapacker",
|
6
6
|
"bugs": {
|
@@ -55,12 +55,12 @@
|
|
55
55
|
"@babel/runtime": "^7.17.9",
|
56
56
|
"@types/babel__core": "^7.0.0",
|
57
57
|
"@types/webpack": "^5.0.0",
|
58
|
-
"babel-loader": "^8.2.4 || ^9.0.0",
|
58
|
+
"babel-loader": "^8.2.4 || ^9.0.0 || ^10.0.0",
|
59
59
|
"compression-webpack-plugin": "^9.0.0 || ^10.0.0|| ^11.0.0",
|
60
60
|
"terser-webpack-plugin": "^5.3.1",
|
61
61
|
"webpack": "^5.72.0",
|
62
62
|
"webpack-assets-manifest": "^5.0.6",
|
63
|
-
"webpack-cli": "^4.9.2 || ^5.0.0",
|
63
|
+
"webpack-cli": "^4.9.2 || ^5.0.0 || ^6.0.0",
|
64
64
|
"webpack-dev-server": "^4.9.0 || ^5.0.0",
|
65
65
|
"webpack-merge": "^5.8.0 || ^6.0.0"
|
66
66
|
},
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shakapacker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.0
|
4
|
+
version: 8.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2025-03-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -176,6 +176,8 @@ files:
|
|
176
176
|
- gemfiles/Gemfile-rails.6.1.x
|
177
177
|
- gemfiles/Gemfile-rails.7.0.x
|
178
178
|
- gemfiles/Gemfile-rails.7.1.x
|
179
|
+
- gemfiles/Gemfile-rails.7.2.x
|
180
|
+
- gemfiles/Gemfile-rails.8.0.x
|
179
181
|
- jest.config.js
|
180
182
|
- lib/install/application.js
|
181
183
|
- lib/install/bin/shakapacker
|
@@ -282,7 +284,7 @@ homepage: https://github.com/shakacode/shakapacker
|
|
282
284
|
licenses:
|
283
285
|
- MIT
|
284
286
|
metadata:
|
285
|
-
source_code_uri: https://github.com/shakacode/shakapacker/tree/v8.0
|
287
|
+
source_code_uri: https://github.com/shakacode/shakapacker/tree/v8.2.0
|
286
288
|
post_install_message:
|
287
289
|
rdoc_options: []
|
288
290
|
require_paths:
|
@@ -298,7 +300,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
298
300
|
- !ruby/object:Gem::Version
|
299
301
|
version: '0'
|
300
302
|
requirements: []
|
301
|
-
rubygems_version: 3.5.
|
303
|
+
rubygems_version: 3.5.11
|
302
304
|
signing_key:
|
303
305
|
specification_version: 4
|
304
306
|
summary: Use webpack to manage app-like JavaScript modules in Rails
|