jetpacker 0.5.0 → 0.7.0
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 +0 -12
- data/.gitignore +1 -0
- data/.rubocop.yml +113 -13
- data/CHANGELOG.jetpacker.md +3 -0
- data/CHANGELOG.md +26 -2
- data/gemfiles/Gemfile-rails-edge +1 -1
- data/jetpacker.gemspec +1 -0
- data/lib/install/config/babel.config.js +1 -4
- data/lib/install/examples/react/babel.config.js +12 -0
- data/lib/install/template.rb +10 -2
- data/lib/install/typescript.rb +1 -1
- data/lib/jetpacker/version.rb +1 -1
- data/lib/tasks/webpacker/check_yarn.rake +1 -2
- data/lib/tasks/webpacker/yarn_install.rake +7 -1
- data/lib/webpacker/commands.rb +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/rules/file.js +2 -2
- data/package/rules/sass.js +3 -0
- data/package.json +33 -33
- data/test/helper_test.rb +21 -9
- data/yarn.lock +2556 -3175
- metadata +19 -6
- data/Gemfile.lock +0 -185
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab6f9a6eac9735fdeed0d2e919a542d22e7aa9c3895e6686285cbe7667709a71
|
4
|
+
data.tar.gz: b2866d0796f5dbd39974ac36f0574ba43fa4a69263eed30c9d4779feaccfef5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20f8788e2d0b448cb845c2b03d2b5bfbdf26517d75bf8cb0c12d30de03209df1233a51a0c59e7e2bb67cbf52ae20bdfac97e9b3ba940bc56b50f529b89be3efa
|
7
|
+
data.tar.gz: 1ffdb63c73e2374e0aba1f3258b69ba42aecff30af5bc9b379db014e711629e3654fe09e393a2ed82004ce1922414016ee8a03c070d40bd5d533d6c088053709
|
data/.github/workflows/ruby.yml
CHANGED
@@ -29,18 +29,6 @@ jobs:
|
|
29
29
|
gemfile: gemfiles/Gemfile-rails.6.0.x
|
30
30
|
experimental: [false]
|
31
31
|
include:
|
32
|
-
- ruby: head
|
33
|
-
os: ubuntu-latest
|
34
|
-
gemfile: gemfiles/Gemfile-rails.6.0.x
|
35
|
-
experimental: true
|
36
|
-
- ruby: head
|
37
|
-
os: ubuntu-latest
|
38
|
-
gemfile: gemfiles/Gemfile-rails-edge
|
39
|
-
experimental: true
|
40
|
-
- ruby: 2.6
|
41
|
-
os: ubuntu-latest
|
42
|
-
gemfile: gemfiles/Gemfile-rails-edge
|
43
|
-
experimental: true
|
44
32
|
- ruby: 2.7
|
45
33
|
os: ubuntu-latest
|
46
34
|
gemfile: gemfiles/Gemfile-rails-edge
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require: rubocop-performance
|
2
2
|
AllCops:
|
3
|
-
TargetRubyVersion: 2.
|
3
|
+
TargetRubyVersion: 2.4
|
4
4
|
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
|
5
5
|
# to ignore them, so only the ones explicitly set in this file are enabled.
|
6
6
|
DisabledByDefault: true
|
@@ -13,11 +13,6 @@ AllCops:
|
|
13
13
|
Style/AndOr:
|
14
14
|
Enabled: true
|
15
15
|
|
16
|
-
# Do not use braces for hash literals when they are the last argument of a
|
17
|
-
# method call.
|
18
|
-
Style/BracesAroundHashParameters:
|
19
|
-
Enabled: true
|
20
|
-
|
21
16
|
# Align `when` with `case`.
|
22
17
|
Layout/CaseIndentation:
|
23
18
|
Enabled: true
|
@@ -50,7 +45,11 @@ Style/HashSyntax:
|
|
50
45
|
# extra level of indentation.
|
51
46
|
Layout/IndentationConsistency:
|
52
47
|
Enabled: true
|
53
|
-
EnforcedStyle:
|
48
|
+
EnforcedStyle: indented_internal_methods
|
49
|
+
|
50
|
+
# Detect hard tabs, no hard tabs.
|
51
|
+
Layout/IndentationStyle:
|
52
|
+
Enabled: true
|
54
53
|
|
55
54
|
# Two spaces, no tabs (for indentation).
|
56
55
|
Layout/IndentationWidth:
|
@@ -98,12 +97,8 @@ Style/StringLiterals:
|
|
98
97
|
Enabled: true
|
99
98
|
EnforcedStyle: double_quotes
|
100
99
|
|
101
|
-
# Detect hard tabs, no hard tabs.
|
102
|
-
Layout/Tab:
|
103
|
-
Enabled: true
|
104
|
-
|
105
100
|
# Blank lines should not have any spaces.
|
106
|
-
Layout/
|
101
|
+
Layout/TrailingEmptyLines:
|
107
102
|
Enabled: true
|
108
103
|
|
109
104
|
# No trailing whitespace.
|
@@ -111,7 +106,7 @@ Layout/TrailingWhitespace:
|
|
111
106
|
Enabled: true
|
112
107
|
|
113
108
|
# Use quotes for string literals when they are enough.
|
114
|
-
Style/
|
109
|
+
Style/RedundantPercentQ:
|
115
110
|
Enabled: true
|
116
111
|
|
117
112
|
# Align `end` with the matching keyword or starting expression except for
|
@@ -123,3 +118,108 @@ Layout/EndAlignment:
|
|
123
118
|
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
124
119
|
Lint/RequireParentheses:
|
125
120
|
Enabled: true
|
121
|
+
|
122
|
+
# Use `bind_call(obj, args, ...)` instead of `bind(obj).call(args, ...)`.
|
123
|
+
Performance/BindCall:
|
124
|
+
Enabled: true
|
125
|
+
|
126
|
+
# Use `caller(n..n)` instead of `caller`.
|
127
|
+
Performance/Caller:
|
128
|
+
Enabled: true
|
129
|
+
|
130
|
+
# Use `casecmp` for case comparison.
|
131
|
+
Performance/Casecmp:
|
132
|
+
Enabled: true
|
133
|
+
|
134
|
+
# Extract Array and Hash literals outside of loops into local variables or constants.
|
135
|
+
Performance/CollectionLiteralInLoop:
|
136
|
+
Enabled: true
|
137
|
+
|
138
|
+
# Prefer `sort_by(&:foo)` instead of `sort { |a, b| a.foo <=> b.foo }`.
|
139
|
+
Performance/CompareWithBlock:
|
140
|
+
Enabled: true
|
141
|
+
|
142
|
+
# Use `count` instead of `{select,find_all,filter,reject}...{size,count,length}`.
|
143
|
+
Performance/Count:
|
144
|
+
Enabled: true
|
145
|
+
|
146
|
+
# Use `delete_prefix` instead of `gsub`.
|
147
|
+
Performance/DeletePrefix:
|
148
|
+
Enabled: true
|
149
|
+
|
150
|
+
# Use `delete_suffix` instead of `gsub`.
|
151
|
+
Performance/DeleteSuffix:
|
152
|
+
Enabled: true
|
153
|
+
|
154
|
+
# Use `detect` instead of `select.first`, `find_all.first`, `filter.first`, `select.last`, `find_all.last`, and `filter.last`.
|
155
|
+
Performance/Detect:
|
156
|
+
Enabled: true
|
157
|
+
|
158
|
+
# Use `str.{start,end}_with?(x, ..., y, ...)` instead of `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
|
159
|
+
Performance/DoubleStartEndWith:
|
160
|
+
Enabled: true
|
161
|
+
|
162
|
+
# Use `end_with?` instead of a regex match anchored to the end of a string.
|
163
|
+
Performance/EndWith:
|
164
|
+
Enabled: true
|
165
|
+
|
166
|
+
# Do not compute the size of statically sized objects except in constants.
|
167
|
+
Performance/FixedSize:
|
168
|
+
Enabled: true
|
169
|
+
|
170
|
+
# Use `Enumerable#flat_map` instead of `Enumerable#map...Array#flatten(1).
|
171
|
+
Performance/FlatMap:
|
172
|
+
Enabled: true
|
173
|
+
|
174
|
+
# Use `key?` or `value?` instead of `keys.include?` or `values.include?`.
|
175
|
+
Performance/InefficientHashSearch:
|
176
|
+
Enabled: true
|
177
|
+
|
178
|
+
# Use `Range#cover?` instead of `Range#include?` (or `Range#member?`).
|
179
|
+
Performance/RangeInclude:
|
180
|
+
Enabled: true
|
181
|
+
|
182
|
+
# Use `yield` instead of `block.call`.
|
183
|
+
Performance/RedundantBlockCall:
|
184
|
+
Enabled: true
|
185
|
+
|
186
|
+
# Use `=~` instead of `String#match` or `Regexp#match` in a context where the returned `MatchData` is not needed.
|
187
|
+
Performance/RedundantMatch:
|
188
|
+
Enabled: true
|
189
|
+
|
190
|
+
# Use Hash#[]=, rather than Hash#merge! with a single key-value pair.
|
191
|
+
Performance/RedundantMerge:
|
192
|
+
Enabled: true
|
193
|
+
|
194
|
+
# Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`, `Regexp#===`, or `=~` when `MatchData` is not used.
|
195
|
+
Performance/RegexpMatch:
|
196
|
+
Enabled: true
|
197
|
+
|
198
|
+
# Use `reverse_each` instead of `reverse.each`.
|
199
|
+
Performance/ReverseEach:
|
200
|
+
Enabled: true
|
201
|
+
|
202
|
+
# Use `size` instead of `count` for counting the number of elements in `Array` and `Hash`.
|
203
|
+
Performance/Size:
|
204
|
+
Enabled: true
|
205
|
+
|
206
|
+
# Use `start_with?` instead of a regex match anchored to the beginning of a string.
|
207
|
+
Performance/StartWith:
|
208
|
+
Enabled: true
|
209
|
+
|
210
|
+
# Use `tr` instead of `gsub` when you are replacing the same number of characters.
|
211
|
+
# Use `delete` instead of `gsub` when you are deleting characters.
|
212
|
+
Performance/StringReplacement:
|
213
|
+
Enabled: true
|
214
|
+
|
215
|
+
# Checks for .times.map calls.
|
216
|
+
Performance/TimesMap:
|
217
|
+
Enabled: true
|
218
|
+
|
219
|
+
# Use unary plus to get an unfrozen string literal.
|
220
|
+
Performance/UnfreezeString:
|
221
|
+
Enabled: true
|
222
|
+
|
223
|
+
# Use `URI::DEFAULT_PARSER` instead of `URI::Parser.new`.
|
224
|
+
Performance/UriDefaultParser:
|
225
|
+
Enabled: true
|
data/CHANGELOG.jetpacker.md
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [0.7.0]
|
7
|
+
- [#4](https://github.com/tongueroo/jetpacker/pull/4) update babel.config.js to work with latest versions of webpack node modules #4
|
8
|
+
|
6
9
|
## [0.5.0]
|
7
10
|
- merge upstream webpacker v5.2.1
|
8
11
|
- jetpacker v0.5.x ~ webpacker v5.x
|
data/CHANGELOG.md
CHANGED
@@ -2,11 +2,35 @@
|
|
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.2
|
5
|
+
## [[5.4.2]](https://github.com/rails/webpacker/compare/v5.4.0...v5.4.1) - 2021-08-20
|
6
|
+
|
7
|
+
- Fix babel warning about private-methods in @babel/plugin-proposal-private-property-in-object as well.
|
8
|
+
|
9
|
+
## [[5.4.1]](https://github.com/rails/webpacker/compare/v5.4.0...v5.4.1) - 2021-08-20
|
10
|
+
|
11
|
+
- Update all dependencies within the same major version (#3120)
|
12
|
+
|
13
|
+
- Fix babel warning about private-methods (#3016)
|
14
|
+
|
15
|
+
## [[5.4.0]](https://github.com/rails/webpacker/compare/v5.3.0...v5.4.0) - 2021-05-18
|
16
|
+
|
17
|
+
- Fix compatibility with Psych 4
|
18
|
+
|
19
|
+
## [[5.3.0]](https://github.com/rails/webpacker/compare/v5.2.1...v5.3.0) - 2021-04-27
|
20
|
+
|
21
|
+
- Adds experimental Yarn 2 support. Note you must manually set `nodeLinker: node-modules` in your `.yarnrc.yml`.
|
22
|
+
|
23
|
+
- Keep backups, even when they're old [#2912](https://github.com/rails/webpacker/pull/2912)
|
24
|
+
|
25
|
+
## [[5.2.2]](https://github.com/rails/webpacker/compare/v5.2.1...v5.2.2) - 2021-04-27
|
26
|
+
|
27
|
+
- Bump deps and remove node-sass [#2997](https://github.com/rails/webpacker/pull/2997).
|
28
|
+
|
29
|
+
## [[5.2.1]](https://github.com/rails/webpacker/compare/v5.2.0...v5.2.1) - 2020-08-17
|
6
30
|
|
7
31
|
- Revert [#1311](https://github.com/rails/webpacker/pull/1311).
|
8
32
|
|
9
|
-
## [[5.2.0]](https://github.com/rails/webpacker/compare/v5.1.1...
|
33
|
+
## [[5.2.0]](https://github.com/rails/webpacker/compare/v5.1.1...v5.2.0) - 2020-08-16
|
10
34
|
|
11
35
|
- Bump dependencies and fixes. See [diff](https://github.com/rails/webpacker/compare/v5.1.1...5-x-stable) for changes.
|
12
36
|
|
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
|
data/jetpacker.gemspec
CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
|
|
29
29
|
s.add_development_dependency "bundler", ">= 1.3.0"
|
30
30
|
s.add_development_dependency "rubocop", "< 0.69"
|
31
31
|
s.add_development_dependency "rubocop-performance"
|
32
|
+
s.add_development_dependency "rspec-core"
|
32
33
|
|
33
34
|
s.files = `git ls-files`.split("\n")
|
34
35
|
s.test_files = `git ls-files -- test/*`.split("\n")
|
@@ -42,10 +42,7 @@ module.exports = function(api) {
|
|
42
42
|
isTestEnv && 'babel-plugin-dynamic-import-node',
|
43
43
|
'@babel/plugin-transform-destructuring',
|
44
44
|
[
|
45
|
-
'@babel/plugin-proposal-class-properties'
|
46
|
-
{
|
47
|
-
loose: true
|
48
|
-
}
|
45
|
+
'@babel/plugin-proposal-class-properties'
|
49
46
|
],
|
50
47
|
[
|
51
48
|
'@babel/plugin-proposal-object-rest-spread',
|
@@ -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
@@ -34,7 +34,7 @@ if File.exists?(".gitignore")
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
if Webpacker::VERSION
|
37
|
+
if Webpacker::VERSION.match?(/^[0-9]+\.[0-9]+\.[0-9]+$/)
|
38
38
|
say "Installing all JavaScript dependencies [#{Webpacker::VERSION}]"
|
39
39
|
run "yarn add @rails/webpacker@#{Webpacker::VERSION}"
|
40
40
|
else
|
@@ -42,8 +42,16 @@ else
|
|
42
42
|
run "yarn add @rails/webpacker@next"
|
43
43
|
end
|
44
44
|
|
45
|
+
package_json = File.read("#{__dir__}/../../package.json")
|
46
|
+
webpack_version = package_json.match(/"webpack": "(.*)"/)[1]
|
47
|
+
webpack_cli_version = package_json.match(/"webpack-cli": "(.*)"/)[1]
|
48
|
+
|
49
|
+
# needed for experimental Yarn 2 support and should not harm Yarn 1
|
50
|
+
say "Installing webpack and webpack-cli as direct dependencies"
|
51
|
+
run "yarn add webpack@#{webpack_version} webpack-cli@#{webpack_cli_version}"
|
52
|
+
|
45
53
|
say "Installing dev server for live reloading"
|
46
|
-
run "yarn add --dev webpack-dev-server"
|
54
|
+
run "yarn add --dev webpack-dev-server@^3"
|
47
55
|
|
48
56
|
if Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR > 1
|
49
57
|
say "You need to allow webpack-dev-server host as allowed origin for connect-src.", :yellow
|
data/lib/install/typescript.rb
CHANGED
@@ -9,7 +9,7 @@ if File.exist?(package_json)
|
|
9
9
|
package = JSON.parse(File.read(package_json))
|
10
10
|
package["dependencies"] ||= {}
|
11
11
|
|
12
|
-
if package["dependencies"].
|
12
|
+
if package["dependencies"].key?("react")
|
13
13
|
additional_packages = "@types/react @types/react-dom"
|
14
14
|
example_source = "react"
|
15
15
|
end
|
data/lib/jetpacker/version.rb
CHANGED
@@ -9,13 +9,12 @@ 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}"
|
16
16
|
if is_unsupported
|
17
17
|
$stderr.puts "This version of Webpacker does not support Yarn #{yarn_version}. Please downgrade to a supported version of Yarn https://yarnpkg.com/lang/en/docs/install/"
|
18
|
-
$stderr.puts "For information on using Webpacker with Yarn 2.0, see https://github.com/rails/webpacker/issues/2112"
|
19
18
|
else
|
20
19
|
$stderr.puts "Please upgrade Yarn https://yarnpkg.com/lang/en/docs/install/"
|
21
20
|
end
|
@@ -5,6 +5,12 @@ namespace :webpacker do
|
|
5
5
|
node_env = ENV.fetch("NODE_ENV") do
|
6
6
|
valid_node_envs.include?(Jets.env) ? Jets.env : "production"
|
7
7
|
end
|
8
|
-
|
8
|
+
yarn_flags =
|
9
|
+
if `yarn --version`.start_with?("1")
|
10
|
+
"--no-progress --frozen-lockfile"
|
11
|
+
else
|
12
|
+
"--immutable"
|
13
|
+
end
|
14
|
+
system({ "NODE_ENV" => node_env }, "yarn install #{yarn_flags}")
|
9
15
|
end
|
10
16
|
end
|
data/lib/webpacker/commands.rb
CHANGED
@@ -23,7 +23,7 @@ class Webpacker::Commands
|
|
23
23
|
.each_with_index
|
24
24
|
.drop_while do |(mtime, _), index|
|
25
25
|
max_age = [0, Time.now - Time.at(mtime)].max
|
26
|
-
max_age < age
|
26
|
+
max_age < age || index < count
|
27
27
|
end
|
28
28
|
.each do |(_, files), index|
|
29
29
|
files.each do |file|
|
@@ -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/rules/file.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
const { join } = require('path')
|
1
|
+
const { join, normalize } = require('path')
|
2
2
|
const { source_path: sourcePath, static_assets_extensions: fileExtensions } = require('../config')
|
3
3
|
|
4
4
|
module.exports = {
|
@@ -8,7 +8,7 @@ module.exports = {
|
|
8
8
|
loader: 'file-loader',
|
9
9
|
options: {
|
10
10
|
name(file) {
|
11
|
-
if (file.includes(sourcePath)) {
|
11
|
+
if (file.includes(normalize(sourcePath))) {
|
12
12
|
return 'media/[path][name]-[hash].[ext]'
|
13
13
|
}
|
14
14
|
return 'media/[folder]/[name]-[hash:8].[ext]'
|
data/package/rules/sass.js
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
/* eslint global-require: 0 */
|
2
|
+
|
1
3
|
const getStyleRule = require('../utils/get_style_rule')
|
2
4
|
const { additional_paths: includePaths } = require('../config')
|
3
5
|
|
@@ -6,6 +8,7 @@ module.exports = getStyleRule(/\.(scss|sass)(\.erb)?$/i, false, [
|
|
6
8
|
loader: 'sass-loader',
|
7
9
|
options: {
|
8
10
|
sourceMap: true,
|
11
|
+
implementation: require('sass'),
|
9
12
|
sassOptions: {
|
10
13
|
includePaths
|
11
14
|
}
|
data/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rails/webpacker",
|
3
|
-
"version": "5.
|
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,55 +9,55 @@
|
|
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.
|
24
|
-
"babel-loader": "^8.
|
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
|
+
"babel-loader": "^8.2.2",
|
25
25
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
26
26
|
"babel-plugin-macros": "^2.8.0",
|
27
|
-
"case-sensitive-paths-webpack-plugin": "^2.
|
28
|
-
"compression-webpack-plugin": "^4.0.
|
29
|
-
"core-js": "^3.
|
30
|
-
"css-loader": "^3.
|
31
|
-
"file-loader": "^6.
|
32
|
-
"flatted": "^3.
|
33
|
-
"glob": "^7.1.
|
34
|
-
"js-yaml": "^3.14.
|
27
|
+
"case-sensitive-paths-webpack-plugin": "^2.4.0",
|
28
|
+
"compression-webpack-plugin": "^4.0.1",
|
29
|
+
"core-js": "^3.16.2",
|
30
|
+
"css-loader": "^3.6.0",
|
31
|
+
"file-loader": "^6.2.0",
|
32
|
+
"flatted": "^3.2.2",
|
33
|
+
"glob": "^7.1.7",
|
34
|
+
"js-yaml": "^3.14.1",
|
35
35
|
"mini-css-extract-plugin": "^0.9.0",
|
36
|
-
"
|
37
|
-
"optimize-css-assets-webpack-plugin": "^5.0.3",
|
36
|
+
"optimize-css-assets-webpack-plugin": "^5.0.8",
|
38
37
|
"path-complete-extname": "^1.0.0",
|
39
|
-
"pnp-webpack-plugin": "^1.
|
38
|
+
"pnp-webpack-plugin": "^1.7.0",
|
40
39
|
"postcss-flexbugs-fixes": "^4.2.1",
|
41
40
|
"postcss-import": "^12.0.1",
|
42
41
|
"postcss-loader": "^3.0.0",
|
43
42
|
"postcss-preset-env": "^6.7.0",
|
44
43
|
"postcss-safe-parser": "^4.0.2",
|
45
|
-
"regenerator-runtime": "^0.13.
|
46
|
-
"sass
|
47
|
-
"
|
48
|
-
"
|
49
|
-
"webpack": "^4.
|
44
|
+
"regenerator-runtime": "^0.13.9",
|
45
|
+
"sass": "^1.38.0",
|
46
|
+
"sass-loader": "10.1.1",
|
47
|
+
"style-loader": "^1.3.0",
|
48
|
+
"terser-webpack-plugin": "^4.2.3",
|
49
|
+
"webpack": "^4.46.0",
|
50
50
|
"webpack-assets-manifest": "^3.1.1",
|
51
51
|
"webpack-cli": "^3.3.12",
|
52
52
|
"webpack-sources": "^1.4.3"
|
53
53
|
},
|
54
54
|
"devDependencies": {
|
55
|
-
"eslint": "^7.
|
56
|
-
"eslint-config-airbnb": "^18.2.
|
57
|
-
"eslint-plugin-import": "^2.
|
58
|
-
"eslint-plugin-jsx-a11y": "^6.
|
59
|
-
"eslint-plugin-react": "^7.
|
60
|
-
"jest": "^
|
55
|
+
"eslint": "^7.32.0",
|
56
|
+
"eslint-config-airbnb": "^18.2.1",
|
57
|
+
"eslint-plugin-import": "^2.24.0",
|
58
|
+
"eslint-plugin-jsx-a11y": "^6.4.1",
|
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
|