jetpacker 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb8a3686b67bb46ee7205571d7004c0dcac165b1c130ec650f6a910896da06e7
4
- data.tar.gz: '092db6937cd4464fa2ea16a1e25c3809ae13aed46cffbcbd0825dad413e50067'
3
+ metadata.gz: 3ef376547e26a82a74b3db3f483c830b57a3b89cdf9fa378704ae4251950bdf9
4
+ data.tar.gz: 2440c2040096006e6b5e23a2a3f9bb0162091cfb2fb564f24024cdd33a0e9b82
5
5
  SHA512:
6
- metadata.gz: 48f3c698895bf3f3ac956ac47ec7683183b512297707c2494b909eb1a259e2e9c44c3f0d98a73f1e5a373dce7674f6ba2acc3f67cecf73eab60bafb59705672c
7
- data.tar.gz: d7353bd7fe82d3863f58cd8d810a97aef9084054e2bab5e26a59206117026dc2ebd778ea79ce752c87892cc26a4a55c6cc4ac3c70963c30cbdd91ca165a32700
6
+ metadata.gz: 690b360e1613dfcb6d3365384339b58d64681c28cc0681b59c6de9366a5b2660504a9d3da12dd72841f947f3b6fd0e9d3b6b8bf1d00ce4a2c5a09948b9b8ece9
7
+ data.tar.gz: 36120b5f42350a51bfc9e2288513326ab70db8ec9bd869d285be351ab4cdbeb48ae5504c2c24b5a7b8970cd16eb74169e8b4a7a13b64e8a67320063a971e914f
@@ -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
@@ -9,3 +9,4 @@ yarn-error.log*
9
9
  .yarn-integrity
10
10
  /log
11
11
  gemfiles/*.lock
12
+ Gemfile.lock
data/.rubocop.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  require: rubocop-performance
2
2
  AllCops:
3
- TargetRubyVersion: 2.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: rails
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/TrailingBlankLines:
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/UnneededPercentQ:
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.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.1]](https://github.com/rails/webpacker/compare/v5.2.0...5.2.1) - 2020-08-17
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...5.2.0) - 2020-08-16
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
 
@@ -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
  {
@@ -34,7 +34,7 @@ if File.exists?(".gitignore")
34
34
  end
35
35
  end
36
36
 
37
- if Webpacker::VERSION =~ /^[0-9]+\.[0-9]+\.[0-9]+$/
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
@@ -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"].keys.include?("react")
12
+ if package["dependencies"].key?("react")
13
13
  additional_packages = "@types/react @types/react-dom"
14
14
  example_source = "react"
15
15
  end
@@ -1,4 +1,4 @@
1
1
  # Separate version from Webpacker version for the jetpacker gem
2
2
  module Jetpacker
3
- VERSION = "0.5.0"
3
+ VERSION = "0.6.0"
4
4
  end
@@ -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, ">=2.0.0") rescue false
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
- system({ "NODE_ENV" => node_env }, "yarn install --no-progress --frozen-lockfile")
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
@@ -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 && index < count
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
- YAML.load(config_path.read)[env].deep_symbolize_keys
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
- HashWithIndifferentAccess.new(YAML.load_file(File.expand_path("../../install/config/webpacker.yml", __FILE__))[env])
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
- 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