webpacker 5.3.0 → 5.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +4 -24
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +26 -4
- data/CONTRIBUTING.md +1 -1
- data/Gemfile.lock +59 -59
- data/README.md +5 -1
- data/gemfiles/Gemfile-rails-edge +1 -1
- data/lib/install/config/babel.config.js +12 -0
- data/lib/install/examples/react/babel.config.js +12 -0
- data/lib/install/template.rb +3 -3
- data/lib/tasks/webpacker/check_yarn.rake +1 -1
- data/lib/webpacker/configuration.rb +15 -4
- data/lib/webpacker/env.rb +5 -1
- data/lib/webpacker/version.rb +1 -1
- data/package.json +21 -21
- data/test/helper_test.rb +21 -9
- data/yarn.lock +1991 -2822
- metadata +5 -6
- data/.travis.yml +0 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0370a980c6e40b16b54b814c08883722bd218a9dcfc8a7d6678cb2d93bba9a46
|
4
|
+
data.tar.gz: caa8625ecc6fd35bd5906007574671c542232d1fc899304d0de5dec507afbaf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a189c9360243cd577442a4373e2d10c98262730a0539dbfb35ea24f9fab45b365964b53f9184c3ee3c261bd561b2aa1bb504057318400b5bf94a87441ce1d1e
|
7
|
+
data.tar.gz: 53e0c0fcd2bd906ea5099c5d10bbccd6ef0e462c398b12345730dab201362e008d858c22bae89377144e4ddee18ae0942927f9c94b334816a137e79111581fa1
|
data/.github/workflows/ruby.yml
CHANGED
@@ -7,9 +7,6 @@ jobs:
|
|
7
7
|
name: Ruby specs
|
8
8
|
runs-on: ${{ matrix.os }}
|
9
9
|
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' || matrix.experimental }}
|
10
|
-
env:
|
11
|
-
BUNDLE_JOBS: 4
|
12
|
-
BUNDLE_RETRY: 3
|
13
10
|
strategy:
|
14
11
|
fail-fast: false
|
15
12
|
matrix:
|
@@ -29,38 +26,21 @@ jobs:
|
|
29
26
|
gemfile: gemfiles/Gemfile-rails.6.0.x
|
30
27
|
experimental: [false]
|
31
28
|
include:
|
32
|
-
- ruby: 2.5
|
33
|
-
os: ubuntu-latest
|
34
|
-
gemfile: gemfiles/Gemfile-rails-edge
|
35
|
-
experimental: true
|
36
|
-
- ruby: 2.6
|
37
|
-
os: ubuntu-latest
|
38
|
-
gemfile: gemfiles/Gemfile-rails-edge
|
39
|
-
experimental: true
|
40
29
|
- ruby: 2.7
|
41
30
|
os: ubuntu-latest
|
42
31
|
gemfile: gemfiles/Gemfile-rails-edge
|
43
32
|
experimental: true
|
44
33
|
|
34
|
+
env:
|
35
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
45
36
|
steps:
|
46
37
|
- uses: actions/checkout@v2
|
47
|
-
- uses: actions/cache@v2
|
48
|
-
with:
|
49
|
-
path: /home/runner/bundle
|
50
|
-
key: bundle-use-ruby-${{ matrix.ruby }}-${{ matrix.gemfile }}-gems-${{ hashFiles(matrix.gemfile) }}-${{ hashFiles('**/*.gemspec') }}
|
51
|
-
restore-keys: |
|
52
|
-
bundle-use-ruby-${{ matrix.ruby }}-${{ matrix.gemfile }}-gems-
|
53
38
|
|
54
39
|
- uses: ruby/setup-ruby@v1
|
55
40
|
with:
|
56
41
|
ruby-version: ${{ matrix.ruby }}
|
57
|
-
|
58
|
-
|
59
|
-
run: |
|
60
|
-
gem install bundler -v 2.1.4
|
61
|
-
bundle config path /home/runner/bundle
|
62
|
-
bundle config --global gemfile ${{ matrix.gemfile }}
|
63
|
-
bundle install --jobs 4 --retry 3
|
42
|
+
bundler-cache: true
|
43
|
+
rubygems: ${{ matrix.ruby < '2.6' && 'default' || 'latest' }}
|
64
44
|
|
65
45
|
- name: Ruby specs
|
66
46
|
run: bundle exec rake test
|
data/.rubocop.yml
CHANGED
@@ -109,6 +109,9 @@ Layout/TrailingWhitespace:
|
|
109
109
|
Style/RedundantPercentQ:
|
110
110
|
Enabled: true
|
111
111
|
|
112
|
+
Lint/DeprecatedClassMethods:
|
113
|
+
Enabled: true
|
114
|
+
|
112
115
|
# Align `end` with the matching keyword or starting expression except for
|
113
116
|
# assignments, where it should be aligned with the LHS.
|
114
117
|
Layout/EndAlignment:
|
data/CHANGELOG.md
CHANGED
@@ -2,21 +2,43 @@
|
|
2
2
|
|
3
3
|
**Please note that Webpacker 4.1.0 has an installer bug. Please use 4.2.0 or above**
|
4
4
|
|
5
|
-
## [[5.
|
5
|
+
## [[5.4.4]](https://github.com/rails/webpacker/compare/v5.4.3...v5.4.4) - 2023-01-31
|
6
|
+
|
7
|
+
- Fix compatibility with Ruby 3.2. (#3306)
|
8
|
+
|
9
|
+
## [[5.4.3]](https://github.com/rails/webpacker/compare/v5.4.2...v5.4.3) - 2021-09-14
|
10
|
+
|
11
|
+
- Specify webpack-dev-server to be v3, to avoid getting webpack-dev-server v4 (#3121)
|
12
|
+
|
13
|
+
## [[5.4.2]](https://github.com/rails/webpacker/compare/v5.4.1...v5.4.2) - 2021-08-20
|
14
|
+
|
15
|
+
- Fix babel warning about private-methods in @babel/plugin-proposal-private-property-in-object as well.
|
16
|
+
|
17
|
+
## [[5.4.1]](https://github.com/rails/webpacker/compare/v5.4.0...v5.4.1) - 2021-08-20
|
18
|
+
|
19
|
+
- Update all dependencies within the same major version (#3120)
|
20
|
+
|
21
|
+
- Fix babel warning about private-methods (#3016)
|
22
|
+
|
23
|
+
## [[5.4.0]](https://github.com/rails/webpacker/compare/v5.3.0...v5.4.0) - 2021-05-18
|
24
|
+
|
25
|
+
- Fix compatibility with Psych 4
|
26
|
+
|
27
|
+
## [[5.3.0]](https://github.com/rails/webpacker/compare/v5.2.1...v5.3.0) - 2021-04-27
|
6
28
|
|
7
29
|
- Adds experimental Yarn 2 support. Note you must manually set `nodeLinker: node-modules` in your `.yarnrc.yml`.
|
8
30
|
|
9
31
|
- Keep backups, even when they're old [#2912](https://github.com/rails/webpacker/pull/2912)
|
10
32
|
|
11
|
-
## [[5.2.2]](https://github.com/rails/webpacker/compare/v5.2.1...
|
33
|
+
## [[5.2.2]](https://github.com/rails/webpacker/compare/v5.2.1...v5.2.2) - 2021-04-27
|
12
34
|
|
13
35
|
- Bump deps and remove node-sass [#2997](https://github.com/rails/webpacker/pull/2997).
|
14
36
|
|
15
|
-
## [[5.2.1]](https://github.com/rails/webpacker/compare/v5.2.0...
|
37
|
+
## [[5.2.1]](https://github.com/rails/webpacker/compare/v5.2.0...v5.2.1) - 2020-08-17
|
16
38
|
|
17
39
|
- Revert [#1311](https://github.com/rails/webpacker/pull/1311).
|
18
40
|
|
19
|
-
## [[5.2.0]](https://github.com/rails/webpacker/compare/v5.1.1...
|
41
|
+
## [[5.2.0]](https://github.com/rails/webpacker/compare/v5.1.1...v5.2.0) - 2020-08-16
|
20
42
|
|
21
43
|
- Bump dependencies and fixes. See [diff](https://github.com/rails/webpacker/compare/v5.1.1...5-x-stable) for changes.
|
22
44
|
|
data/CONTRIBUTING.md
CHANGED
@@ -9,7 +9,7 @@ yarn
|
|
9
9
|
```
|
10
10
|
|
11
11
|
## Making sure your changes pass all tests
|
12
|
-
There are a number of automated checks which run on
|
12
|
+
There are a number of automated checks which run on Github Actions when a pull request is created.
|
13
13
|
You can run those checks on your own locally to make sure that your changes would not break the CI build.
|
14
14
|
|
15
15
|
### 1. Check the code for JavaScript style violations
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
webpacker (5.
|
4
|
+
webpacker (5.4.4)
|
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.3.
|
14
|
-
actionpack (= 6.1.3.
|
15
|
-
activesupport (= 6.1.3.
|
13
|
+
actioncable (6.1.3.2)
|
14
|
+
actionpack (= 6.1.3.2)
|
15
|
+
activesupport (= 6.1.3.2)
|
16
16
|
nio4r (~> 2.0)
|
17
17
|
websocket-driver (>= 0.6.1)
|
18
|
-
actionmailbox (6.1.3.
|
19
|
-
actionpack (= 6.1.3.
|
20
|
-
activejob (= 6.1.3.
|
21
|
-
activerecord (= 6.1.3.
|
22
|
-
activestorage (= 6.1.3.
|
23
|
-
activesupport (= 6.1.3.
|
18
|
+
actionmailbox (6.1.3.2)
|
19
|
+
actionpack (= 6.1.3.2)
|
20
|
+
activejob (= 6.1.3.2)
|
21
|
+
activerecord (= 6.1.3.2)
|
22
|
+
activestorage (= 6.1.3.2)
|
23
|
+
activesupport (= 6.1.3.2)
|
24
24
|
mail (>= 2.7.1)
|
25
|
-
actionmailer (6.1.3.
|
26
|
-
actionpack (= 6.1.3.
|
27
|
-
actionview (= 6.1.3.
|
28
|
-
activejob (= 6.1.3.
|
29
|
-
activesupport (= 6.1.3.
|
25
|
+
actionmailer (6.1.3.2)
|
26
|
+
actionpack (= 6.1.3.2)
|
27
|
+
actionview (= 6.1.3.2)
|
28
|
+
activejob (= 6.1.3.2)
|
29
|
+
activesupport (= 6.1.3.2)
|
30
30
|
mail (~> 2.5, >= 2.5.4)
|
31
31
|
rails-dom-testing (~> 2.0)
|
32
|
-
actionpack (6.1.3.
|
33
|
-
actionview (= 6.1.3.
|
34
|
-
activesupport (= 6.1.3.
|
32
|
+
actionpack (6.1.3.2)
|
33
|
+
actionview (= 6.1.3.2)
|
34
|
+
activesupport (= 6.1.3.2)
|
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.3.
|
40
|
-
actionpack (= 6.1.3.
|
41
|
-
activerecord (= 6.1.3.
|
42
|
-
activestorage (= 6.1.3.
|
43
|
-
activesupport (= 6.1.3.
|
39
|
+
actiontext (6.1.3.2)
|
40
|
+
actionpack (= 6.1.3.2)
|
41
|
+
activerecord (= 6.1.3.2)
|
42
|
+
activestorage (= 6.1.3.2)
|
43
|
+
activesupport (= 6.1.3.2)
|
44
44
|
nokogiri (>= 1.8.5)
|
45
|
-
actionview (6.1.3.
|
46
|
-
activesupport (= 6.1.3.
|
45
|
+
actionview (6.1.3.2)
|
46
|
+
activesupport (= 6.1.3.2)
|
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.3.
|
52
|
-
activesupport (= 6.1.3.
|
51
|
+
activejob (6.1.3.2)
|
52
|
+
activesupport (= 6.1.3.2)
|
53
53
|
globalid (>= 0.3.6)
|
54
|
-
activemodel (6.1.3.
|
55
|
-
activesupport (= 6.1.3.
|
56
|
-
activerecord (6.1.3.
|
57
|
-
activemodel (= 6.1.3.
|
58
|
-
activesupport (= 6.1.3.
|
59
|
-
activestorage (6.1.3.
|
60
|
-
actionpack (= 6.1.3.
|
61
|
-
activejob (= 6.1.3.
|
62
|
-
activerecord (= 6.1.3.
|
63
|
-
activesupport (= 6.1.3.
|
54
|
+
activemodel (6.1.3.2)
|
55
|
+
activesupport (= 6.1.3.2)
|
56
|
+
activerecord (6.1.3.2)
|
57
|
+
activemodel (= 6.1.3.2)
|
58
|
+
activesupport (= 6.1.3.2)
|
59
|
+
activestorage (6.1.3.2)
|
60
|
+
actionpack (= 6.1.3.2)
|
61
|
+
activejob (= 6.1.3.2)
|
62
|
+
activerecord (= 6.1.3.2)
|
63
|
+
activesupport (= 6.1.3.2)
|
64
64
|
marcel (~> 1.0.0)
|
65
65
|
mini_mime (~> 1.0.2)
|
66
|
-
activesupport (6.1.3.
|
66
|
+
activesupport (6.1.3.2)
|
67
67
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
68
68
|
i18n (>= 1.6, < 2)
|
69
69
|
minitest (>= 5.1)
|
@@ -87,14 +87,14 @@ GEM
|
|
87
87
|
marcel (1.0.1)
|
88
88
|
method_source (1.0.0)
|
89
89
|
mini_mime (1.0.3)
|
90
|
-
mini_portile2 (2.5.
|
90
|
+
mini_portile2 (2.5.1)
|
91
91
|
minitest (5.14.4)
|
92
92
|
nio4r (2.5.7)
|
93
|
-
nokogiri (1.11.
|
93
|
+
nokogiri (1.11.4)
|
94
94
|
mini_portile2 (~> 2.5.0)
|
95
95
|
racc (~> 1.4)
|
96
96
|
parallel (1.20.1)
|
97
|
-
parser (3.0.1.
|
97
|
+
parser (3.0.1.1)
|
98
98
|
ast (~> 2.4.1)
|
99
99
|
racc (1.5.2)
|
100
100
|
rack (2.2.3)
|
@@ -102,29 +102,29 @@ GEM
|
|
102
102
|
rack
|
103
103
|
rack-test (1.1.0)
|
104
104
|
rack (>= 1.0, < 3)
|
105
|
-
rails (6.1.3.
|
106
|
-
actioncable (= 6.1.3.
|
107
|
-
actionmailbox (= 6.1.3.
|
108
|
-
actionmailer (= 6.1.3.
|
109
|
-
actionpack (= 6.1.3.
|
110
|
-
actiontext (= 6.1.3.
|
111
|
-
actionview (= 6.1.3.
|
112
|
-
activejob (= 6.1.3.
|
113
|
-
activemodel (= 6.1.3.
|
114
|
-
activerecord (= 6.1.3.
|
115
|
-
activestorage (= 6.1.3.
|
116
|
-
activesupport (= 6.1.3.
|
105
|
+
rails (6.1.3.2)
|
106
|
+
actioncable (= 6.1.3.2)
|
107
|
+
actionmailbox (= 6.1.3.2)
|
108
|
+
actionmailer (= 6.1.3.2)
|
109
|
+
actionpack (= 6.1.3.2)
|
110
|
+
actiontext (= 6.1.3.2)
|
111
|
+
actionview (= 6.1.3.2)
|
112
|
+
activejob (= 6.1.3.2)
|
113
|
+
activemodel (= 6.1.3.2)
|
114
|
+
activerecord (= 6.1.3.2)
|
115
|
+
activestorage (= 6.1.3.2)
|
116
|
+
activesupport (= 6.1.3.2)
|
117
117
|
bundler (>= 1.15.0)
|
118
|
-
railties (= 6.1.3.
|
118
|
+
railties (= 6.1.3.2)
|
119
119
|
sprockets-rails (>= 2.0.0)
|
120
120
|
rails-dom-testing (2.0.3)
|
121
121
|
activesupport (>= 4.2.0)
|
122
122
|
nokogiri (>= 1.6)
|
123
123
|
rails-html-sanitizer (1.3.0)
|
124
124
|
loofah (~> 2.3)
|
125
|
-
railties (6.1.3.
|
126
|
-
actionpack (= 6.1.3.
|
127
|
-
activesupport (= 6.1.3.
|
125
|
+
railties (6.1.3.2)
|
126
|
+
actionpack (= 6.1.3.2)
|
127
|
+
activesupport (= 6.1.3.2)
|
128
128
|
method_source
|
129
129
|
rake (>= 0.8.7)
|
130
130
|
thor (~> 1.0)
|
@@ -141,8 +141,8 @@ GEM
|
|
141
141
|
rubocop-ast (>= 0.6.0)
|
142
142
|
ruby-progressbar (~> 1.7)
|
143
143
|
unicode-display_width (>= 1.4.0, < 2.0)
|
144
|
-
rubocop-ast (1.
|
145
|
-
parser (>=
|
144
|
+
rubocop-ast (1.5.0)
|
145
|
+
parser (>= 3.0.1.1)
|
146
146
|
rubocop-performance (1.10.2)
|
147
147
|
rubocop (>= 0.90.0, < 2.0)
|
148
148
|
rubocop-ast (>= 0.4.0)
|
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# Webpacker
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![Ruby specs](https://github.com/rails/webpacker/workflows/Ruby%20specs/badge.svg)](https://github.com/rails/webpacker/actions)
|
4
|
+
[![Jest specs](https://github.com/rails/webpacker/workflows/Jest%20specs/badge.svg)](https://github.com/rails/webpacker/actions)
|
5
|
+
[![Rubocop](https://github.com/rails/webpacker/workflows/Rubocop/badge.svg)](https://github.com/rails/webpacker/actions)
|
6
|
+
[![JS lint](https://github.com/rails/webpacker/workflows/JS%20lint/badge.svg)](https://github.com/rails/webpacker/actions)
|
7
|
+
|
4
8
|
[![node.js](https://img.shields.io/badge/node-%3E%3D%2010.17.0-brightgreen.svg)](https://www.npmjs.com/package/@rails/webpacker)
|
5
9
|
[![Gem](https://img.shields.io/gem/v/webpacker.svg)](https://rubygems.org/gems/webpacker)
|
6
10
|
|
data/gemfiles/Gemfile-rails-edge
CHANGED
@@ -4,7 +4,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
|
4
4
|
|
5
5
|
gemspec path: "../"
|
6
6
|
|
7
|
-
gem "rails", github: "rails/rails"
|
7
|
+
gem "rails", github: "rails/rails", branch: "main"
|
8
8
|
gem "arel", github: "rails/arel"
|
9
9
|
gem "rake", ">= 11.1"
|
10
10
|
gem "rack-proxy", require: false
|
@@ -53,6 +53,18 @@ module.exports = function(api) {
|
|
53
53
|
useBuiltIns: true
|
54
54
|
}
|
55
55
|
],
|
56
|
+
[
|
57
|
+
'@babel/plugin-proposal-private-methods',
|
58
|
+
{
|
59
|
+
loose: true
|
60
|
+
}
|
61
|
+
],
|
62
|
+
[
|
63
|
+
'@babel/plugin-proposal-private-property-in-object',
|
64
|
+
{
|
65
|
+
loose: true
|
66
|
+
}
|
67
|
+
],
|
56
68
|
[
|
57
69
|
'@babel/plugin-transform-runtime',
|
58
70
|
{
|
@@ -62,6 +62,18 @@ module.exports = function(api) {
|
|
62
62
|
useBuiltIns: true
|
63
63
|
}
|
64
64
|
],
|
65
|
+
[
|
66
|
+
'@babel/plugin-proposal-private-methods',
|
67
|
+
{
|
68
|
+
loose: true
|
69
|
+
}
|
70
|
+
],
|
71
|
+
[
|
72
|
+
'@babel/plugin-proposal-private-property-in-object',
|
73
|
+
{
|
74
|
+
loose: true
|
75
|
+
}
|
76
|
+
],
|
65
77
|
[
|
66
78
|
'@babel/plugin-transform-runtime',
|
67
79
|
{
|
data/lib/install/template.rb
CHANGED
@@ -13,7 +13,7 @@ copy_file "#{__dir__}/config/babel.config.js", "babel.config.js"
|
|
13
13
|
say "Copying .browserslistrc to app root directory"
|
14
14
|
copy_file "#{__dir__}/config/.browserslistrc", ".browserslistrc"
|
15
15
|
|
16
|
-
if Dir.
|
16
|
+
if Dir.exist?(Webpacker.config.source_path)
|
17
17
|
say "The JavaScript app source directory already exists"
|
18
18
|
else
|
19
19
|
say "Creating JavaScript app source directory"
|
@@ -22,7 +22,7 @@ end
|
|
22
22
|
|
23
23
|
apply "#{__dir__}/binstubs.rb"
|
24
24
|
|
25
|
-
if File.
|
25
|
+
if File.exist?(".gitignore")
|
26
26
|
append_to_file ".gitignore" do
|
27
27
|
"\n" +
|
28
28
|
"/public/packs\n" +
|
@@ -51,7 +51,7 @@ say "Installing webpack and webpack-cli as direct dependencies"
|
|
51
51
|
run "yarn add webpack@#{webpack_version} webpack-cli@#{webpack_cli_version}"
|
52
52
|
|
53
53
|
say "Installing dev server for live reloading"
|
54
|
-
run "yarn add --dev webpack-dev-server"
|
54
|
+
run "yarn add --dev webpack-dev-server@^3"
|
55
55
|
|
56
56
|
if Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR > 1
|
57
57
|
say "You need to allow webpack-dev-server host as allowed origin for connect-src.", :yellow
|
@@ -9,7 +9,7 @@ namespace :webpacker do
|
|
9
9
|
pkg_path = Pathname.new("#{__dir__}/../../../package.json").realpath
|
10
10
|
yarn_range = JSON.parse(pkg_path.read)["engines"]["yarn"]
|
11
11
|
is_valid = SemanticRange.satisfies?(yarn_version, yarn_range) rescue false
|
12
|
-
is_unsupported = SemanticRange.satisfies?(yarn_version, ">=
|
12
|
+
is_unsupported = SemanticRange.satisfies?(yarn_version, ">=4.0.0") rescue false
|
13
13
|
|
14
14
|
unless is_valid
|
15
15
|
$stderr.puts "Webpacker requires Yarn \"#{yarn_range}\" and you are using #{yarn_version}"
|
@@ -93,8 +93,12 @@ class Webpacker::Configuration
|
|
93
93
|
end
|
94
94
|
|
95
95
|
def load
|
96
|
-
|
97
|
-
|
96
|
+
config = begin
|
97
|
+
YAML.load_file(config_path.to_s, aliases: true)
|
98
|
+
rescue ArgumentError
|
99
|
+
YAML.load_file(config_path.to_s)
|
100
|
+
end
|
101
|
+
config[env].deep_symbolize_keys
|
98
102
|
rescue Errno::ENOENT => e
|
99
103
|
raise "Webpacker configuration file not found #{config_path}. " \
|
100
104
|
"Please run rails webpacker:install " \
|
@@ -107,8 +111,15 @@ class Webpacker::Configuration
|
|
107
111
|
end
|
108
112
|
|
109
113
|
def defaults
|
110
|
-
@defaults ||=
|
111
|
-
|
114
|
+
@defaults ||= begin
|
115
|
+
path = File.expand_path("../../install/config/webpacker.yml", __FILE__)
|
116
|
+
config = begin
|
117
|
+
YAML.load_file(path, aliases: true)
|
118
|
+
rescue ArgumentError
|
119
|
+
YAML.load_file(path)
|
120
|
+
end
|
121
|
+
HashWithIndifferentAccess.new(config[env])
|
122
|
+
end
|
112
123
|
end
|
113
124
|
|
114
125
|
def globbed_path_with_extensions(path)
|
data/lib/webpacker/env.rb
CHANGED
@@ -27,7 +27,11 @@ class Webpacker::Env
|
|
27
27
|
|
28
28
|
def available_environments
|
29
29
|
if config_path.exist?
|
30
|
-
|
30
|
+
begin
|
31
|
+
YAML.load_file(config_path.to_s, aliases: true)
|
32
|
+
rescue ArgumentError
|
33
|
+
YAML.load_file(config_path.to_s)
|
34
|
+
end
|
31
35
|
else
|
32
36
|
[].freeze
|
33
37
|
end
|
data/lib/webpacker/version.rb
CHANGED
data/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rails/webpacker",
|
3
|
-
"version": "5.3
|
3
|
+
"version": "5.4.3",
|
4
4
|
"description": "Use webpack to manage app-like JavaScript modules in Rails",
|
5
5
|
"main": "package/index.js",
|
6
6
|
"files": [
|
@@ -9,40 +9,40 @@
|
|
9
9
|
],
|
10
10
|
"engines": {
|
11
11
|
"node": ">=10.17.0",
|
12
|
-
"yarn": ">=1 <
|
12
|
+
"yarn": ">=1 <4"
|
13
13
|
},
|
14
14
|
"dependencies": {
|
15
|
-
"@babel/core": "^7.
|
16
|
-
"@babel/plugin-proposal-class-properties": "^7.
|
17
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.
|
15
|
+
"@babel/core": "^7.15.0",
|
16
|
+
"@babel/plugin-proposal-class-properties": "^7.14.5",
|
17
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.14.7",
|
18
18
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
19
|
-
"@babel/plugin-transform-destructuring": "^7.
|
20
|
-
"@babel/plugin-transform-regenerator": "^7.
|
21
|
-
"@babel/plugin-transform-runtime": "^7.
|
22
|
-
"@babel/preset-env": "^7.
|
23
|
-
"@babel/runtime": "^7.
|
19
|
+
"@babel/plugin-transform-destructuring": "^7.14.7",
|
20
|
+
"@babel/plugin-transform-regenerator": "^7.14.5",
|
21
|
+
"@babel/plugin-transform-runtime": "^7.15.0",
|
22
|
+
"@babel/preset-env": "^7.15.0",
|
23
|
+
"@babel/runtime": "^7.15.3",
|
24
24
|
"babel-loader": "^8.2.2",
|
25
25
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
26
26
|
"babel-plugin-macros": "^2.8.0",
|
27
27
|
"case-sensitive-paths-webpack-plugin": "^2.4.0",
|
28
28
|
"compression-webpack-plugin": "^4.0.1",
|
29
|
-
"core-js": "^3.
|
29
|
+
"core-js": "^3.16.2",
|
30
30
|
"css-loader": "^3.6.0",
|
31
31
|
"file-loader": "^6.2.0",
|
32
|
-
"flatted": "^3.
|
33
|
-
"glob": "^7.1.
|
32
|
+
"flatted": "^3.2.2",
|
33
|
+
"glob": "^7.1.7",
|
34
34
|
"js-yaml": "^3.14.1",
|
35
35
|
"mini-css-extract-plugin": "^0.9.0",
|
36
|
-
"optimize-css-assets-webpack-plugin": "^5.0.
|
36
|
+
"optimize-css-assets-webpack-plugin": "^5.0.8",
|
37
37
|
"path-complete-extname": "^1.0.0",
|
38
|
-
"pnp-webpack-plugin": "^1.
|
38
|
+
"pnp-webpack-plugin": "^1.7.0",
|
39
39
|
"postcss-flexbugs-fixes": "^4.2.1",
|
40
40
|
"postcss-import": "^12.0.1",
|
41
41
|
"postcss-loader": "^3.0.0",
|
42
42
|
"postcss-preset-env": "^6.7.0",
|
43
43
|
"postcss-safe-parser": "^4.0.2",
|
44
|
-
"regenerator-runtime": "^0.13.
|
45
|
-
"sass": "^1.
|
44
|
+
"regenerator-runtime": "^0.13.9",
|
45
|
+
"sass": "^1.38.0",
|
46
46
|
"sass-loader": "10.1.1",
|
47
47
|
"style-loader": "^1.3.0",
|
48
48
|
"terser-webpack-plugin": "^4.2.3",
|
@@ -52,12 +52,12 @@
|
|
52
52
|
"webpack-sources": "^1.4.3"
|
53
53
|
},
|
54
54
|
"devDependencies": {
|
55
|
-
"eslint": "^7.
|
55
|
+
"eslint": "^7.32.0",
|
56
56
|
"eslint-config-airbnb": "^18.2.1",
|
57
|
-
"eslint-plugin-import": "^2.
|
57
|
+
"eslint-plugin-import": "^2.24.0",
|
58
58
|
"eslint-plugin-jsx-a11y": "^6.4.1",
|
59
|
-
"eslint-plugin-react": "^7.
|
60
|
-
"jest": "^
|
59
|
+
"eslint-plugin-react": "^7.24.0",
|
60
|
+
"jest": "^27.0.6"
|
61
61
|
},
|
62
62
|
"jest": {
|
63
63
|
"testRegex": "(/__tests__/.*|(\\.|/))\\.jsx?$",
|
data/test/helper_test.rb
CHANGED
@@ -117,29 +117,41 @@ class HelperTest < ActionView::TestCase
|
|
117
117
|
end
|
118
118
|
|
119
119
|
def test_stylesheet_pack_tag_split_chunks
|
120
|
-
assert_equal
|
121
|
-
|
120
|
+
assert_equal stylesheet_packs_with_chunks_tag("application", "hello_stimulus").in?([
|
121
|
+
%(<link rel="stylesheet" href="/packs/1-c20632e7baf2c81200d3.chunk.css" media="screen" />\n) +
|
122
|
+
%(<link rel="stylesheet" href="/packs/application-k344a6d59eef8632c9d1.chunk.css" media="screen" />\n) +
|
123
|
+
%(<link rel="stylesheet" href="/packs/hello_stimulus-k344a6d59eef8632c9d1.chunk.css" media="screen" />),
|
124
|
+
|
125
|
+
%(<link rel="stylesheet" media="screen" href="/packs/1-c20632e7baf2c81200d3.chunk.css" />\n) +
|
122
126
|
%(<link rel="stylesheet" media="screen" href="/packs/application-k344a6d59eef8632c9d1.chunk.css" />\n) +
|
123
127
|
%(<link rel="stylesheet" media="screen" href="/packs/hello_stimulus-k344a6d59eef8632c9d1.chunk.css" />),
|
124
|
-
|
128
|
+
]),
|
129
|
+
true
|
125
130
|
end
|
126
131
|
|
127
132
|
def test_stylesheet_pack_tag
|
128
|
-
assert_equal
|
133
|
+
assert_equal stylesheet_pack_tag("bootstrap.css").in?([
|
134
|
+
%(<link rel="stylesheet" href="/packs/bootstrap-c38deda30895059837cf.css" media="screen" />),
|
135
|
+
|
129
136
|
%(<link rel="stylesheet" media="screen" href="/packs/bootstrap-c38deda30895059837cf.css" />),
|
130
|
-
|
137
|
+
]), true
|
131
138
|
end
|
132
139
|
|
133
140
|
def test_stylesheet_pack_tag_symbol
|
134
|
-
assert_equal
|
141
|
+
assert_equal stylesheet_pack_tag(:bootstrap).in?([
|
142
|
+
%(<link rel="stylesheet" href="/packs/bootstrap-c38deda30895059837cf.css" media="screen" />),
|
143
|
+
|
135
144
|
%(<link rel="stylesheet" media="screen" href="/packs/bootstrap-c38deda30895059837cf.css" />),
|
136
|
-
|
145
|
+
]), true
|
137
146
|
end
|
138
147
|
|
139
148
|
def test_stylesheet_pack_tag_splat
|
140
|
-
assert_equal
|
149
|
+
assert_equal stylesheet_pack_tag("bootstrap.css", "application.css", media: "all").in?([
|
150
|
+
%(<link rel="stylesheet" href="/packs/bootstrap-c38deda30895059837cf.css" media="all" />\n) +
|
151
|
+
%(<link rel="stylesheet" href="/packs/application-dd6b1cd38bfa093df600.css" media="all" />),
|
152
|
+
|
141
153
|
%(<link rel="stylesheet" media="all" href="/packs/bootstrap-c38deda30895059837cf.css" />\n) +
|
142
154
|
%(<link rel="stylesheet" media="all" href="/packs/application-dd6b1cd38bfa093df600.css" />),
|
143
|
-
|
155
|
+
]), true
|
144
156
|
end
|
145
157
|
end
|