webpacker 5.2.1 → 5.4.3

Sign up to get free protection for your applications and to get access to all the features.
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
- YAML.load(config_path.read).keys
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
@@ -1,4 +1,4 @@
1
1
  module Webpacker
2
2
  # Change the version in package.json too, please!
3
- VERSION = "5.2.1".freeze
3
+ VERSION = "5.4.3".freeze
4
4
  end
@@ -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]'
@@ -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.2.1",
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 <2"
12
+ "yarn": ">=1 <4"
13
13
  },
14
14
  "dependencies": {
15
- "@babel/core": "^7.11.1",
16
- "@babel/plugin-proposal-class-properties": "^7.10.4",
17
- "@babel/plugin-proposal-object-rest-spread": "^7.10.1",
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.10.1",
20
- "@babel/plugin-transform-regenerator": "^7.10.1",
21
- "@babel/plugin-transform-runtime": "^7.11.0",
22
- "@babel/preset-env": "^7.11.0",
23
- "@babel/runtime": "^7.11.2",
24
- "babel-loader": "^8.1.0",
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.3.0",
28
- "compression-webpack-plugin": "^4.0.0",
29
- "core-js": "^3.6.5",
30
- "css-loader": "^3.5.3",
31
- "file-loader": "^6.0.0",
32
- "flatted": "^3.0.4",
33
- "glob": "^7.1.6",
34
- "js-yaml": "^3.14.0",
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
- "node-sass": "^4.14.1",
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.6.4",
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.7",
46
- "sass-loader": "^8.0.2",
47
- "style-loader": "^1.2.1",
48
- "terser-webpack-plugin": "^4.0.0",
49
- "webpack": "^4.44.1",
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.6.0",
56
- "eslint-config-airbnb": "^18.2.0",
57
- "eslint-plugin-import": "^2.22.0",
58
- "eslint-plugin-jsx-a11y": "^6.3.1",
59
- "eslint-plugin-react": "^7.20.5",
60
- "jest": "^26.2.2"
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
- %(<link rel="stylesheet" media="screen" href="/packs/1-c20632e7baf2c81200d3.chunk.css" />\n) +
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
- stylesheet_packs_with_chunks_tag("application", "hello_stimulus")
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
- stylesheet_pack_tag("bootstrap.css")
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
- stylesheet_pack_tag(:bootstrap)
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
- stylesheet_pack_tag("bootstrap.css", "application.css", media: "all")
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", "< 0.69"
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")