webpacker 4.3.0 → 6.0.0.rc.6

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.
Files changed (200) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.js +8 -8
  3. data/.github/workflows/jest.yml +30 -0
  4. data/.github/workflows/js-lint.yml +31 -0
  5. data/.github/workflows/rubocop.yml +39 -0
  6. data/.github/workflows/ruby.yml +48 -0
  7. data/.gitignore +2 -0
  8. data/.node-version +1 -1
  9. data/.rubocop.yml +117 -16
  10. data/CHANGELOG.md +91 -5
  11. data/CONTRIBUTING.md +20 -1
  12. data/Gemfile +1 -0
  13. data/Gemfile.lock +121 -109
  14. data/README.md +365 -387
  15. data/config/README.md +3 -0
  16. data/config/webpacker.yml +1 -0
  17. data/docs/deployment.md +9 -11
  18. data/docs/developing_webpacker.md +29 -0
  19. data/docs/troubleshooting.md +64 -26
  20. data/docs/v6_upgrade.md +113 -0
  21. data/gemfiles/Gemfile-rails-edge +1 -1
  22. data/gemfiles/{Gemfile-rails.4.2.x → Gemfile-rails.6.1.x} +4 -1
  23. data/lib/install/{javascript/packs/application.js → application.js} +2 -5
  24. data/lib/install/bin/webpack +4 -7
  25. data/lib/install/bin/yarn +18 -0
  26. data/lib/install/config/webpack/base.js +3 -0
  27. data/lib/install/config/webpack/development.js +2 -2
  28. data/lib/install/config/webpack/production.js +2 -2
  29. data/lib/install/config/webpack/test.js +2 -2
  30. data/lib/install/config/webpacker.yml +22 -54
  31. data/lib/install/package.json +15 -0
  32. data/lib/install/template.rb +66 -23
  33. data/lib/tasks/webpacker/binstubs.rake +6 -4
  34. data/lib/tasks/webpacker/check_binstubs.rake +4 -4
  35. data/lib/tasks/webpacker/check_node.rake +18 -8
  36. data/lib/tasks/webpacker/check_yarn.rake +19 -10
  37. data/lib/tasks/webpacker/clean.rake +12 -6
  38. data/lib/tasks/webpacker/clobber.rake +9 -5
  39. data/lib/tasks/webpacker/compile.rake +4 -2
  40. data/lib/tasks/webpacker/info.rake +12 -10
  41. data/lib/tasks/webpacker/install.rake +6 -4
  42. data/lib/tasks/webpacker/verify_config.rake +14 -0
  43. data/lib/tasks/webpacker/verify_install.rake +1 -10
  44. data/lib/tasks/webpacker/yarn_install.rake +13 -16
  45. data/lib/tasks/webpacker.rake +2 -11
  46. data/lib/tasks/yarn.rake +38 -0
  47. data/lib/webpacker/commands.rb +40 -11
  48. data/lib/webpacker/compiler.rb +23 -12
  49. data/lib/webpacker/configuration.rb +24 -33
  50. data/lib/webpacker/dev_server.rb +6 -0
  51. data/lib/webpacker/dev_server_proxy.rb +3 -1
  52. data/lib/webpacker/dev_server_runner.rb +34 -10
  53. data/lib/webpacker/env.rb +5 -1
  54. data/lib/webpacker/helper.rb +72 -87
  55. data/lib/webpacker/instance.rb +4 -0
  56. data/lib/webpacker/manifest.rb +6 -7
  57. data/lib/webpacker/railtie.rb +8 -45
  58. data/lib/webpacker/runner.rb +1 -0
  59. data/lib/webpacker/version.rb +1 -1
  60. data/lib/webpacker/webpack_runner.rb +30 -4
  61. data/lib/webpacker.rb +1 -1
  62. data/package/__tests__/config.js +6 -27
  63. data/package/__tests__/dev_server.js +2 -0
  64. data/package/__tests__/development.js +18 -13
  65. data/package/__tests__/env.js +16 -4
  66. data/package/__tests__/index.js +9 -0
  67. data/package/__tests__/production.js +6 -6
  68. data/package/__tests__/staging.js +7 -6
  69. data/package/__tests__/test.js +4 -5
  70. data/package/babel/preset.js +54 -0
  71. data/package/config.js +7 -12
  72. data/package/configPath.js +3 -0
  73. data/package/dev_server.js +1 -1
  74. data/package/env.js +14 -6
  75. data/package/environments/__tests__/base.js +26 -31
  76. data/package/environments/base.js +78 -128
  77. data/package/environments/development.js +47 -43
  78. data/package/environments/production.js +66 -66
  79. data/package/environments/test.js +2 -2
  80. data/package/index.js +15 -8
  81. data/package/inliningCss.js +7 -0
  82. data/package/rules/babel.js +20 -11
  83. data/package/rules/coffee.js +6 -0
  84. data/package/rules/erb.js +15 -0
  85. data/package/rules/file.js +21 -18
  86. data/package/rules/index.js +16 -18
  87. data/package/rules/less.js +22 -0
  88. data/package/rules/raw.js +5 -0
  89. data/package/rules/sass.js +14 -6
  90. data/package/rules/stylus.js +26 -0
  91. data/package/utils/get_style_rule.js +28 -36
  92. data/package/utils/helpers.js +28 -35
  93. data/package.json +26 -46
  94. data/test/command_test.rb +76 -0
  95. data/test/compiler_test.rb +4 -11
  96. data/test/configuration_test.rb +5 -35
  97. data/test/dev_server_runner_test.rb +36 -6
  98. data/test/engine_rake_tasks_test.rb +39 -0
  99. data/test/helper_test.rb +77 -60
  100. data/test/manifest_test.rb +53 -6
  101. data/test/mounted_app/Rakefile +4 -0
  102. data/test/mounted_app/test/dummy/Rakefile +3 -0
  103. data/test/mounted_app/test/dummy/bin/rails +3 -0
  104. data/test/mounted_app/test/dummy/bin/rake +3 -0
  105. data/test/mounted_app/test/dummy/config/application.rb +10 -0
  106. data/test/mounted_app/test/dummy/config/environment.rb +3 -0
  107. data/test/mounted_app/test/dummy/config/webpacker.yml +75 -0
  108. data/test/mounted_app/test/dummy/config.ru +5 -0
  109. data/test/mounted_app/test/dummy/package.json +7 -0
  110. data/test/rake_tasks_test.rb +12 -10
  111. data/test/test_app/app/{javascript/packs → packs/entrypoints}/application.js +1 -1
  112. data/test/test_app/app/packs/entrypoints/multi_entry.css +4 -0
  113. data/test/test_app/app/packs/entrypoints/multi_entry.js +4 -0
  114. data/test/test_app/config/application.rb +0 -1
  115. data/test/test_app/config/initializers/inspect_autoload_paths.rb +1 -0
  116. data/test/test_app/config/webpacker.yml +7 -27
  117. data/test/test_app/config/webpacker_other_location.yml +79 -0
  118. data/test/test_app/config/webpacker_public_root.yml +0 -1
  119. data/test/test_app/public/packs/manifest.json +36 -17
  120. data/test/test_app/some.config.js +0 -0
  121. data/test/webpack_runner_test.rb +10 -4
  122. data/test/webpacker_test.rb +21 -0
  123. data/webpacker.gemspec +5 -4
  124. data/yarn.lock +3387 -6898
  125. metadata +90 -99
  126. data/.travis.yml +0 -57
  127. data/docs/assets.md +0 -119
  128. data/docs/cloud9.md +0 -310
  129. data/docs/css.md +0 -254
  130. data/docs/docker.md +0 -68
  131. data/docs/engines.md +0 -200
  132. data/docs/env.md +0 -65
  133. data/docs/es6.md +0 -72
  134. data/docs/folder-structure.md +0 -66
  135. data/docs/misc.md +0 -23
  136. data/docs/props.md +0 -223
  137. data/docs/testing.md +0 -137
  138. data/docs/typescript.md +0 -126
  139. data/docs/v4-upgrade.md +0 -142
  140. data/docs/webpack-dev-server.md +0 -92
  141. data/docs/webpack.md +0 -364
  142. data/docs/yarn.md +0 -23
  143. data/gemfiles/Gemfile-rails.5.0.x +0 -9
  144. data/gemfiles/Gemfile-rails.5.1.x +0 -9
  145. data/lib/install/angular.rb +0 -23
  146. data/lib/install/coffee.rb +0 -25
  147. data/lib/install/config/.browserslistrc +0 -1
  148. data/lib/install/config/babel.config.js +0 -72
  149. data/lib/install/config/postcss.config.js +0 -12
  150. data/lib/install/config/webpack/environment.js +0 -3
  151. data/lib/install/elm.rb +0 -39
  152. data/lib/install/erb.rb +0 -25
  153. data/lib/install/examples/angular/hello_angular/app/app.component.ts +0 -9
  154. data/lib/install/examples/angular/hello_angular/app/app.module.ts +0 -16
  155. data/lib/install/examples/angular/hello_angular/index.ts +0 -8
  156. data/lib/install/examples/angular/hello_angular/polyfills.ts +0 -73
  157. data/lib/install/examples/angular/hello_angular.js +0 -7
  158. data/lib/install/examples/coffee/hello_coffee.coffee +0 -4
  159. data/lib/install/examples/elm/Main.elm +0 -55
  160. data/lib/install/examples/elm/hello_elm.js +0 -16
  161. data/lib/install/examples/erb/hello_erb.js.erb +0 -6
  162. data/lib/install/examples/react/babel.config.js +0 -87
  163. data/lib/install/examples/react/hello_react.jsx +0 -26
  164. data/lib/install/examples/react/tsconfig.json +0 -20
  165. data/lib/install/examples/stimulus/application.js +0 -1
  166. data/lib/install/examples/stimulus/controllers/hello_controller.js +0 -18
  167. data/lib/install/examples/stimulus/controllers/index.js +0 -9
  168. data/lib/install/examples/svelte/app.svelte +0 -11
  169. data/lib/install/examples/svelte/hello_svelte.js +0 -20
  170. data/lib/install/examples/typescript/hello_typescript.ts +0 -4
  171. data/lib/install/examples/typescript/tsconfig.json +0 -23
  172. data/lib/install/examples/vue/app.vue +0 -22
  173. data/lib/install/examples/vue/hello_vue.js +0 -72
  174. data/lib/install/loaders/coffee.js +0 -6
  175. data/lib/install/loaders/elm.js +0 -25
  176. data/lib/install/loaders/erb.js +0 -11
  177. data/lib/install/loaders/svelte.js +0 -9
  178. data/lib/install/loaders/typescript.js +0 -11
  179. data/lib/install/loaders/vue.js +0 -6
  180. data/lib/install/react.rb +0 -18
  181. data/lib/install/stimulus.rb +0 -12
  182. data/lib/install/svelte.rb +0 -29
  183. data/lib/install/typescript.rb +0 -46
  184. data/lib/install/vue.rb +0 -49
  185. data/lib/tasks/installers.rake +0 -42
  186. data/package/config_types/__tests__/config_list.js +0 -118
  187. data/package/config_types/__tests__/config_object.js +0 -43
  188. data/package/config_types/config_list.js +0 -75
  189. data/package/config_types/config_object.js +0 -55
  190. data/package/config_types/index.js +0 -7
  191. data/package/rules/module.css.js +0 -3
  192. data/package/rules/module.sass.js +0 -8
  193. data/package/rules/node_modules.js +0 -24
  194. data/package/utils/__tests__/deep_assign.js +0 -32
  195. data/package/utils/__tests__/deep_merge.js +0 -10
  196. data/package/utils/__tests__/get_style_rule.js +0 -65
  197. data/package/utils/__tests__/objectify.js +0 -9
  198. data/package/utils/deep_assign.js +0 -22
  199. data/package/utils/deep_merge.js +0 -22
  200. data/package/utils/objectify.js +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d92899958cdfa5fa810905a4d9dcb06573e691d7ef871492518265aadd78463
4
- data.tar.gz: '09cd698dd32daab4502e16e16e6c01577cf5af704e687ff3cb631aee7855596c'
3
+ metadata.gz: bb700e8975b2ec865da84e152fea23586c8e7a2a428465230255ab97ebe482ce
4
+ data.tar.gz: c2a023d554364442cd356771cad8b42226a3d6ce3a4708b6a5603151aad886ba
5
5
  SHA512:
6
- metadata.gz: df99f4799cb78e62a18299f8bfd429ced64ee9b0eb7a46f3ca21014e2a634649013659c3681e0b7f79071cccdeb91e57430bfb93af4f379ba14215debf807d47
7
- data.tar.gz: 5d23ef89dded82e78f0c5a5c84a103118fb6fba7feefbcdb4770f861e22c3fcdcb33ea0125178b0ba80d97d72a1e48c61bae77eaf8c442ace6c5992c6bf69d6d
6
+ metadata.gz: bb863173d2577d304c03a4e6d66eddc385a62950bf30af00ed29c4abb9039b0290402771f58c9ede11cf9f26d5945136997d78148590871b7247e13b4d3db7cf
7
+ data.tar.gz: a624efeabf2bdbd7b83b59aa2854e4ebda00c5c476849c03fc585d967810b30fd5d118fbf13f412c40cb6e7fa1fe020f619cc9ede0cd72989c25504f3f8e0e53
data/.eslintrc.js CHANGED
@@ -1,14 +1,14 @@
1
1
  module.exports = {
2
- 'extends': 'airbnb',
3
- 'rules': {
2
+ extends: ['airbnb', 'prettier'],
3
+ rules: {
4
4
  'comma-dangle': ['error', 'never'],
5
5
  'import/no-unresolved': 'off',
6
6
  'import/no-extraneous-dependencies': 'off',
7
7
  'import/extensions': 'off',
8
- semi: ['error', 'never'],
8
+ semi: ['error', 'never']
9
9
  },
10
- 'env': {
11
- 'browser': true,
12
- 'node': true,
13
- },
14
- };
10
+ env: {
11
+ browser: true,
12
+ node: true
13
+ }
14
+ }
@@ -0,0 +1,30 @@
1
+ name: Jest specs
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ jest:
7
+ name: Jest specs
8
+ strategy:
9
+ matrix:
10
+ os: [ubuntu-latest]
11
+ node: [12.x, 14.x, 16.x]
12
+
13
+ runs-on: ${{ matrix.os }}
14
+
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - name: Use Node.js ${{ matrix.node }}
18
+ uses: actions/setup-node@v2
19
+ with:
20
+ node-version: ${{ matrix.node }}
21
+ cache: yarn
22
+
23
+ - name: Install yarn maybe
24
+ run: which yarn || npm install -g yarn
25
+
26
+ - name: Install dependencies
27
+ run: yarn --frozen-lockfile
28
+
29
+ - name: Jest Specs
30
+ run: yarn test
@@ -0,0 +1,31 @@
1
+ name: JS lint
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ js-lint:
7
+ name: JS Lint
8
+
9
+ strategy:
10
+ matrix:
11
+ os: [ubuntu-latest]
12
+ node: [14]
13
+
14
+ runs-on: ${{ matrix.os }}
15
+
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ - name: Use Node.js ${{ matrix.node }}
19
+ uses: actions/setup-node@v2
20
+ with:
21
+ node-version: ${{ matrix.node }}
22
+ cache: yarn
23
+
24
+ - name: Install yarn maybe
25
+ run: which yarn || npm install -g yarn
26
+
27
+ - name: Install dependencies
28
+ run: yarn --frozen-lockfile
29
+
30
+ - name: Lint
31
+ run: yarn lint
@@ -0,0 +1,39 @@
1
+ name: Rubocop
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ rubocop:
7
+ name: Rubocop
8
+ runs-on: ${{ matrix.os }}
9
+ env:
10
+ BUNDLE_JOBS: 4
11
+ BUNDLE_RETRY: 3
12
+ strategy:
13
+ matrix:
14
+ os: [ubuntu-latest]
15
+ ruby: [
16
+ 2.7
17
+ ]
18
+
19
+ steps:
20
+ - uses: actions/checkout@v2
21
+ - uses: actions/cache@v2
22
+ with:
23
+ path: /home/runner/bundle
24
+ key: bundle-use-ruby-gems-${{ hashFiles('**/Gemfile.lock') }}
25
+ restore-keys: |
26
+ bundle-use-ruby-gems-
27
+
28
+ - uses: ruby/setup-ruby@v1
29
+ with:
30
+ ruby-version: ${{ matrix.ruby }}
31
+
32
+ - name: Bundle install
33
+ run: |
34
+ gem install bundler -v 2.1.4
35
+ bundle config path /home/runner/bundle
36
+ bundle install
37
+
38
+ - name: Ruby linter
39
+ run: bundle exec rubocop
@@ -0,0 +1,48 @@
1
+ name: Ruby specs
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ name: Ruby specs
8
+ runs-on: ${{ matrix.os }}
9
+ continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' || matrix.experimental }}
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ os: [ubuntu-latest]
14
+ ruby:
15
+ - 2.7
16
+ - "3.0"
17
+ gemfile:
18
+ - gemfiles/Gemfile-rails.5.2.x
19
+ - gemfiles/Gemfile-rails.6.0.x
20
+ - gemfiles/Gemfile-rails.6.1.x
21
+ exclude:
22
+ - ruby: 2.5
23
+ gemfile: gemfiles/Gemfile-rails.6.1.x
24
+ - ruby: "3.0"
25
+ gemfile: gemfiles/Gemfile-rails.5.2.x
26
+ experimental: [false]
27
+ include:
28
+ - ruby: 2.7
29
+ os: ubuntu-latest
30
+ gemfile: gemfiles/Gemfile-rails-edge
31
+ experimental: true
32
+ - ruby: "3.0"
33
+ os: ubuntu-latest
34
+ gemfile: gemfiles/Gemfile-rails-edge
35
+ experimental: true
36
+
37
+ env:
38
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
39
+ steps:
40
+ - uses: actions/checkout@v2
41
+
42
+ - uses: ruby/setup-ruby@v1
43
+ with:
44
+ ruby-version: ${{ matrix.ruby }}
45
+ bundler-cache: true # Run "bundle install", and cache the result automatically.
46
+
47
+ - name: Ruby specs
48
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  /.bundle
2
2
  /pkg
3
+ /test/mounted_app/test/dummy/log
3
4
  /test/test_app/log
4
5
  node_modules
5
6
  .byebug_history
@@ -9,3 +10,4 @@ yarn-error.log*
9
10
  .yarn-integrity
10
11
  /log
11
12
  gemfiles/*.lock
13
+ .DS_Store
data/.node-version CHANGED
@@ -1 +1 @@
1
- 8.16.0
1
+ 16.7.0
data/.rubocop.yml CHANGED
@@ -1,23 +1,19 @@
1
1
  require: rubocop-performance
2
2
  AllCops:
3
- TargetRubyVersion: 2.2
3
+ TargetRubyVersion: 2.7
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
7
7
  Exclude:
8
- - 'lib/install/templates/**'
9
- - 'vendor/**/*'
10
- - 'node_modules/**/*'
8
+ - "lib/install/templates/**"
9
+ - "vendor/**/*"
10
+ - "node_modules/**/*"
11
+ - "_actions/**/*"
11
12
 
12
13
  # Prefer &&/|| over and/or.
13
14
  Style/AndOr:
14
15
  Enabled: true
15
16
 
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
17
  # Align `when` with `case`.
22
18
  Layout/CaseIndentation:
23
19
  Enabled: true
@@ -50,7 +46,11 @@ Style/HashSyntax:
50
46
  # extra level of indentation.
51
47
  Layout/IndentationConsistency:
52
48
  Enabled: true
53
- EnforcedStyle: rails
49
+ EnforcedStyle: indented_internal_methods
50
+
51
+ # Detect hard tabs, no hard tabs.
52
+ Layout/IndentationStyle:
53
+ Enabled: true
54
54
 
55
55
  # Two spaces, no tabs (for indentation).
56
56
  Layout/IndentationWidth:
@@ -98,12 +98,8 @@ Style/StringLiterals:
98
98
  Enabled: true
99
99
  EnforcedStyle: double_quotes
100
100
 
101
- # Detect hard tabs, no hard tabs.
102
- Layout/Tab:
103
- Enabled: true
104
-
105
101
  # Blank lines should not have any spaces.
106
- Layout/TrailingBlankLines:
102
+ Layout/TrailingEmptyLines:
107
103
  Enabled: true
108
104
 
109
105
  # No trailing whitespace.
@@ -111,7 +107,7 @@ Layout/TrailingWhitespace:
111
107
  Enabled: true
112
108
 
113
109
  # Use quotes for string literals when they are enough.
114
- Style/UnneededPercentQ:
110
+ Style/RedundantPercentQ:
115
111
  Enabled: true
116
112
 
117
113
  # Align `end` with the matching keyword or starting expression except for
@@ -123,3 +119,108 @@ Layout/EndAlignment:
123
119
  # Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
124
120
  Lint/RequireParentheses:
125
121
  Enabled: true
122
+
123
+ # Use `bind_call(obj, args, ...)` instead of `bind(obj).call(args, ...)`.
124
+ Performance/BindCall:
125
+ Enabled: true
126
+
127
+ # Use `caller(n..n)` instead of `caller`.
128
+ Performance/Caller:
129
+ Enabled: true
130
+
131
+ # Use `casecmp` for case comparison.
132
+ Performance/Casecmp:
133
+ Enabled: true
134
+
135
+ # Extract Array and Hash literals outside of loops into local variables or constants.
136
+ Performance/CollectionLiteralInLoop:
137
+ Enabled: true
138
+
139
+ # Prefer `sort_by(&:foo)` instead of `sort { |a, b| a.foo <=> b.foo }`.
140
+ Performance/CompareWithBlock:
141
+ Enabled: true
142
+
143
+ # Use `count` instead of `{select,find_all,filter,reject}...{size,count,length}`.
144
+ Performance/Count:
145
+ Enabled: true
146
+
147
+ # Use `delete_prefix` instead of `gsub`.
148
+ Performance/DeletePrefix:
149
+ Enabled: true
150
+
151
+ # Use `delete_suffix` instead of `gsub`.
152
+ Performance/DeleteSuffix:
153
+ Enabled: true
154
+
155
+ # Use `detect` instead of `select.first`, `find_all.first`, `filter.first`, `select.last`, `find_all.last`, and `filter.last`.
156
+ Performance/Detect:
157
+ Enabled: true
158
+
159
+ # Use `str.{start,end}_with?(x, ..., y, ...)` instead of `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
160
+ Performance/DoubleStartEndWith:
161
+ Enabled: true
162
+
163
+ # Use `end_with?` instead of a regex match anchored to the end of a string.
164
+ Performance/EndWith:
165
+ Enabled: true
166
+
167
+ # Do not compute the size of statically sized objects except in constants.
168
+ Performance/FixedSize:
169
+ Enabled: true
170
+
171
+ # Use `Enumerable#flat_map` instead of `Enumerable#map...Array#flatten(1).
172
+ Performance/FlatMap:
173
+ Enabled: true
174
+
175
+ # Use `key?` or `value?` instead of `keys.include?` or `values.include?`.
176
+ Performance/InefficientHashSearch:
177
+ Enabled: true
178
+
179
+ # Use `Range#cover?` instead of `Range#include?` (or `Range#member?`).
180
+ Performance/RangeInclude:
181
+ Enabled: true
182
+
183
+ # Use `yield` instead of `block.call`.
184
+ Performance/RedundantBlockCall:
185
+ Enabled: true
186
+
187
+ # Use `=~` instead of `String#match` or `Regexp#match` in a context where the returned `MatchData` is not needed.
188
+ Performance/RedundantMatch:
189
+ Enabled: true
190
+
191
+ # Use Hash#[]=, rather than Hash#merge! with a single key-value pair.
192
+ Performance/RedundantMerge:
193
+ Enabled: true
194
+
195
+ # Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`, `Regexp#===`, or `=~` when `MatchData` is not used.
196
+ Performance/RegexpMatch:
197
+ Enabled: true
198
+
199
+ # Use `reverse_each` instead of `reverse.each`.
200
+ Performance/ReverseEach:
201
+ Enabled: true
202
+
203
+ # Use `size` instead of `count` for counting the number of elements in `Array` and `Hash`.
204
+ Performance/Size:
205
+ Enabled: true
206
+
207
+ # Use `start_with?` instead of a regex match anchored to the beginning of a string.
208
+ Performance/StartWith:
209
+ Enabled: true
210
+
211
+ # Use `tr` instead of `gsub` when you are replacing the same number of characters.
212
+ # Use `delete` instead of `gsub` when you are deleting characters.
213
+ Performance/StringReplacement:
214
+ Enabled: true
215
+
216
+ # Checks for .times.map calls.
217
+ Performance/TimesMap:
218
+ Enabled: true
219
+
220
+ # Use unary plus to get an unfrozen string literal.
221
+ Performance/UnfreezeString:
222
+ Enabled: true
223
+
224
+ # Use `URI::DEFAULT_PARSER` instead of `URI::Parser.new`.
225
+ Performance/UriDefaultParser:
226
+ Enabled: true
data/CHANGELOG.md CHANGED
@@ -2,9 +2,95 @@
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
- ## [[4.3.0]](https://github.com/rails/webpacker/compare/v4.2.2...v4.3.0) - 2019-08-16
5
+ ## [[6.0.0]](https://github.com/rails/webpacker/compare/v5.4.3...master) - 2021-TBD
6
6
 
7
- - Bump dependencies
7
+ Please see [UPGRADE GUIDE](./docs/v6_upgrade.md) for more information.
8
+
9
+ - `node_modules` will no longer be compiled by default. This primarily fixes [rails issue #35501](https://github.com/rails/rails/issues/35501) as well as [numerous other webpacker issues](https://github.com/rails/webpacker/issues/2131#issuecomment-581618497). The disabled loader can still be required explicitly via:
10
+
11
+ ```js
12
+ const nodeModules = require('@rails/webpacker/rules/node_modules.js')
13
+ environment.loaders.append('nodeModules', nodeModules)
14
+ ```
15
+
16
+ - If you have added `environment.loaders.delete('nodeModules')` to your `environment.js`, this must be removed or you will receive an error (`Item nodeModules not found`).
17
+ - `extract_css` option was removed. Webpacker will generate a separate `application.css` file for the default `application` pack, as supported by multiple files per entry introduced in 5.0.0. [#2608](https://github.com/rails/webpacker/pull/2608). However, CSS will be inlined when the webpack-dev-server is used with `hmr: true`. JS package exports `inliningCss`. This is useful to enable HMR for React.
18
+ - Webpacker's wrapper to the `splitChunks()` API will now default `runtimeChunk: 'single'` which will help prevent potential issues when using multiple entry points per page [#2708](https://github.com/rails/webpacker/pull/2708).
19
+ - Changes `@babel/preset-env` modules option to `'auto'` per recommendation in the Babel docs [#2709](https://github.com/rails/webpacker/pull/2709)
20
+ - Adds experimental Yarn 2 support. Note you must manually set `nodeLinker: node-modules` in your `.yarnrc.yml`.
21
+ - Fixes dev server issues [#2898](https://github.com/rails/webpacker/pull/2898)
22
+ - Update static files path to from `media/` to `static/`.
23
+
24
+ ### Breaking changes
25
+ - Removed integration installers
26
+ - Splitchunks enabled by default
27
+ - CSS extraction enabled by default, except when devServer is configured and running
28
+
29
+ ## [[5.4.3]](https://github.com/rails/webpacker/compare/v5.4.2...v5.4.3) - 2021-09-14
30
+
31
+ - Specify webpack-dev-server to be v3, to avoid getting webpack-dev-server v4 ([#3121](https://github.com/rails/webpacker/pull/3121))
32
+
33
+ ## [[5.4.2]](https://github.com/rails/webpacker/compare/v5.4.1...v5.4.2) - 2021-08-20
34
+
35
+ - Fix babel warning about private-methods in `@babel/plugin-proposal-private-property-in-object` as well ([67fa6edf](https://github.com/rails/webpacker/commit/67fa6edf697340cbd5a5518afebac871ef74769b)).
36
+
37
+ ## [[5.4.1]](https://github.com/rails/webpacker/compare/v5.4.0...v5.4.1) - 2021-08-20
38
+
39
+ - Update all dependencies within the same major version ([#3120](https://github.com/rails/webpacker/pull/3120))
40
+ - Fix babel warning about private-methods ([#3016](https://github.com/rails/webpacker/pull/3016))
41
+
42
+ ## [[5.4.0]](https://github.com/rails/webpacker/compare/v5.3.0...v5.4.0) - 2021-05-18
43
+
44
+ - Fix compatibility with Psych 4 ([ceaf826d](https://github.com/rails/webpacker/commit/ceaf826d84230aaadbefdbaaf560d474a96affcc))
45
+
46
+ ## [[5.3.0]](https://github.com/rails/webpacker/compare/v5.2.1...v5.3.0) - 2021-04-27
47
+
48
+ - Adds experimental Yarn 2 support. Note you must manually set `nodeLinker: node-modules` in your `.yarnrc.yml`.
49
+ - Keep backups, even when they're old [#2912](https://github.com/rails/webpacker/pull/2912)
50
+
51
+ ## [[5.2.2]](https://github.com/rails/webpacker/compare/v5.2.1...v5.2.2) - 2021-04-27
52
+
53
+ - Bump deps and remove node-sass [#2997](https://github.com/rails/webpacker/pull/2997).
54
+
55
+ ## [[5.2.1]](https://github.com/rails/webpacker/compare/v5.2.0...v5.2.1) - 2020-08-17
56
+
57
+ - Revert [#1311](https://github.com/rails/webpacker/pull/1311).
58
+
59
+ ## [[5.2.0]](https://github.com/rails/webpacker/compare/v5.1.1...v5.2.0) - 2020-08-16
60
+
61
+ - Bump dependencies and fixes. See [diff](https://github.com/rails/webpacker/compare/v5.1.1...5-x-stable) for changes.
62
+
63
+ ## [[5.1.1]](https://github.com/rails/webpacker/compare/v5.1.0...v5.1.1) - 2020-04-20
64
+
65
+ - Update [TypeScript documentation](https://github.com/rails/webpacker/blob/master/docs/typescript.md) and installer to use babel-loader for typescript.[(#2541](https://github.com/rails/webpacker/pull/2541)
66
+
67
+ ## [[5.1.0]](https://github.com/rails/webpacker/compare/v5.0.1...v5.1.0) - 2020-04-19
68
+
69
+ - Remove yarn integrity check [#2518](https://github.com/rails/webpacker/pull/2518)
70
+ - Switch from ts-loader to babel-loader [#2449](https://github.com/rails/webpacker/pull/2449)
71
+ Please see the [TypeScript documentation](https://github.com/rails/webpacker/blob/master/docs/typescript.md) to upgrade existing projects to use typescript with 5.1
72
+ - Resolve multi-word snakecase WEBPACKER_DEV_SERVER env values [#2528](https://github.com/rails/webpacker/pull/2528)
73
+
74
+ ## [[5.0.1]](https://github.com/rails/webpacker/compare/v5.0.0...v5.0.1) - 2020-03-22
75
+
76
+ - Upgrade deps and fix sass loader config options bug [#2508](https://github.com/rails/webpacker/pull/2508)
77
+
78
+ ## [[5.0.0]](https://github.com/rails/webpacker/compare/v4.2.2...v5.0.0) - 2020-03-22
79
+
80
+ - Bump minimum node version [#2428](https://github.com/rails/webpacker/pull/2428)
81
+ - Bump minimum ruby/rails version [#2415](https://github.com/rails/webpacker/pull/2415)
82
+ - Add support for multiple files per entry [#2476](https://github.com/rails/webpacker/pull/2476)
83
+
84
+ ```js
85
+ entry: {
86
+ home: ['./home.js', './home.scss'],
87
+ account: ['./account.js', './account.scss']
88
+ }
89
+ ```
90
+
91
+ You can now have two entry files with same names inside packs folder, `home.scss` and `home.js`
92
+
93
+ And, other minor fixes, please see a list of changes [here](https://github.com/rails/webpacker/compare/v4.2.2...v5.0.0)
8
94
 
9
95
  ## [[4.2.2]](https://github.com/rails/webpacker/compare/v4.2.1...v4.2.2) - 2019-12-09
10
96
 
@@ -349,7 +435,7 @@ See changes: https://github.com/rails/webpacker/compare/e8b197e36c77181ca2e4765c
349
435
 
350
436
  ### Added
351
437
 
352
- - On CI, sort files & check modified w/ digest intead of mtime[#1522](https://github.com/rails/webpacker/pull/1522)
438
+ - On CI, sort files & check modified w/ digest instead of mtime[#1522](https://github.com/rails/webpacker/pull/1522)
353
439
 
354
440
  ## [3.5.3] - 2018-05-03
355
441
 
@@ -743,11 +829,11 @@ yarn add coffeescript
743
829
 
744
830
  ### Added
745
831
 
746
- - `resolved_paths` option to allow adding additional paths webpack should lookup when resolving modules
832
+ - `resolved_paths` option to allow adding additional paths webpack should look up when resolving modules
747
833
 
748
834
  ```yml
749
835
  # config/webpacker.yml
750
- # Additional paths webpack should lookup modules
836
+ # Additional paths webpack should look up modules
751
837
  resolved_paths: [] # empty by default
752
838
  ```
753
839
 
data/CONTRIBUTING.md CHANGED
@@ -3,31 +3,50 @@
3
3
  1. Install [Yarn](https://yarnpkg.com/)
4
4
 
5
5
  2. Run the following commands to set up the development environment.
6
+
6
7
  ```
7
8
  bundle install
8
9
  yarn
9
10
  ```
10
11
 
11
12
  ## Making sure your changes pass all tests
12
- There are a number of automated checks which run on Travis CI when a pull request is created.
13
+
14
+ There are a number of automated checks which run on GitHub Actions when a pull request is created.
15
+
13
16
  You can run those checks on your own locally to make sure that your changes would not break the CI build.
14
17
 
15
18
  ### 1. Check the code for JavaScript style violations
19
+
16
20
  ```
17
21
  yarn lint
18
22
  ```
19
23
 
20
24
  ### 2. Check the code for Ruby style violations
25
+
21
26
  ```
22
27
  bundle exec rubocop
23
28
  ```
24
29
 
25
30
  ### 3. Run the JavaScript test suite
31
+
26
32
  ```
27
33
  yarn test
28
34
  ```
29
35
 
30
36
  ### 4. Run the Ruby test suite
37
+
31
38
  ```
32
39
  bundle exec rake test
33
40
  ```
41
+
42
+ #### 4.1 Run a single ruby test file
43
+
44
+ ```
45
+ bundle exec rake test TEST=test/rake_tasks_test.rb
46
+ ```
47
+
48
+ #### 4.2 Run a single ruby test
49
+
50
+ ```
51
+ ruby -I test test/rake_tasks_test.rb -n test_rake_webpacker_install
52
+ ```
data/Gemfile CHANGED
@@ -5,6 +5,7 @@ gemspec
5
5
  gem "rails"
6
6
  gem "rake", ">= 11.1"
7
7
  gem "rack-proxy", require: false
8
+ gem "semantic_range", require: false
8
9
 
9
10
  group :test do
10
11
  gem "minitest", "~> 5.0"