webpacker 5.2.1 → 5.4.3
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/ruby.yml +0 -12
- data/.rubocop.yml +113 -13
- data/CHANGELOG.md +26 -2
- data/Gemfile.lock +103 -94
- 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 +10 -2
- data/lib/install/typescript.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/webpacker.gemspec +1 -1
- data/yarn.lock +2556 -3175
- metadata +9 -9
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
|
data/webpacker.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_dependency "semantic_range", ">= 2.3.0"
|
24
24
|
|
25
25
|
s.add_development_dependency "bundler", ">= 1.3.0"
|
26
|
-
s.add_development_dependency "rubocop", "
|
26
|
+
s.add_development_dependency "rubocop", "0.93.1"
|
27
27
|
s.add_development_dependency "rubocop-performance"
|
28
28
|
|
29
29
|
s.files = `git ls-files`.split("\n")
|