shakapacker 6.0.0.rc.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. checksums.yaml +7 -0
  2. data/.eslintignore +4 -0
  3. data/.eslintrc.js +14 -0
  4. data/.github/ISSUE_TEMPLATE/bug_report.md +20 -0
  5. data/.github/ISSUE_TEMPLATE/feature-request.md +18 -0
  6. data/.github/workflows/jest.yml +30 -0
  7. data/.github/workflows/js-lint.yml +31 -0
  8. data/.github/workflows/rubocop.yml +39 -0
  9. data/.github/workflows/ruby.yml +48 -0
  10. data/.gitignore +13 -0
  11. data/.node-version +1 -0
  12. data/.rubocop.yml +229 -0
  13. data/CHANGELOG.md +32 -0
  14. data/CONTRIBUTING.md +62 -0
  15. data/Gemfile +13 -0
  16. data/Gemfile.lock +183 -0
  17. data/MIT-LICENSE +20 -0
  18. data/README.md +666 -0
  19. data/Rakefile +11 -0
  20. data/config/README.md +3 -0
  21. data/config/webpacker.yml +1 -0
  22. data/docs/customizing_babel_config.md +59 -0
  23. data/docs/deployment.md +116 -0
  24. data/docs/developing_webpacker.md +29 -0
  25. data/docs/troubleshooting.md +212 -0
  26. data/docs/v6_upgrade.md +158 -0
  27. data/gemfiles/Gemfile-rails-edge +12 -0
  28. data/gemfiles/Gemfile-rails.5.2.x +9 -0
  29. data/gemfiles/Gemfile-rails.6.0.x +9 -0
  30. data/gemfiles/Gemfile-rails.6.1.x +12 -0
  31. data/lib/install/application.js +15 -0
  32. data/lib/install/bin/webpacker +15 -0
  33. data/lib/install/bin/webpacker-dev-server +18 -0
  34. data/lib/install/bin/yarn +18 -0
  35. data/lib/install/binstubs.rb +4 -0
  36. data/lib/install/config/webpack/webpack.config.js +5 -0
  37. data/lib/install/config/webpacker.yml +64 -0
  38. data/lib/install/package.json +15 -0
  39. data/lib/install/template.rb +100 -0
  40. data/lib/shakapacker/utils/git_utils.rb +23 -0
  41. data/lib/shakapacker/utils/version_syntax_converter.rb +24 -0
  42. data/lib/tasks/webpacker/binstubs.rake +15 -0
  43. data/lib/tasks/webpacker/check_binstubs.rake +12 -0
  44. data/lib/tasks/webpacker/check_node.rake +31 -0
  45. data/lib/tasks/webpacker/check_yarn.rake +33 -0
  46. data/lib/tasks/webpacker/clean.rake +25 -0
  47. data/lib/tasks/webpacker/clobber.rake +20 -0
  48. data/lib/tasks/webpacker/compile.rake +45 -0
  49. data/lib/tasks/webpacker/info.rake +21 -0
  50. data/lib/tasks/webpacker/install.rake +17 -0
  51. data/lib/tasks/webpacker/verify_config.rake +14 -0
  52. data/lib/tasks/webpacker/verify_install.rake +4 -0
  53. data/lib/tasks/webpacker/yarn_install.rake +18 -0
  54. data/lib/tasks/webpacker.rake +19 -0
  55. data/lib/tasks/yarn.rake +38 -0
  56. data/lib/webpacker/commands.rb +79 -0
  57. data/lib/webpacker/compiler.rb +130 -0
  58. data/lib/webpacker/configuration.rb +111 -0
  59. data/lib/webpacker/dev_server.rb +72 -0
  60. data/lib/webpacker/dev_server_proxy.rb +33 -0
  61. data/lib/webpacker/dev_server_runner.rb +96 -0
  62. data/lib/webpacker/env.rb +43 -0
  63. data/lib/webpacker/helper.rb +161 -0
  64. data/lib/webpacker/instance.rb +41 -0
  65. data/lib/webpacker/manifest.rb +120 -0
  66. data/lib/webpacker/railtie.rb +63 -0
  67. data/lib/webpacker/runner.rb +23 -0
  68. data/lib/webpacker/version.rb +4 -0
  69. data/lib/webpacker/webpack_runner.rb +58 -0
  70. data/lib/webpacker.rb +46 -0
  71. data/package/__tests__/config.js +34 -0
  72. data/package/__tests__/dev_server.js +45 -0
  73. data/package/__tests__/development.js +35 -0
  74. data/package/__tests__/env.js +58 -0
  75. data/package/__tests__/index.js +9 -0
  76. data/package/__tests__/production.js +29 -0
  77. data/package/__tests__/staging.js +30 -0
  78. data/package/__tests__/test.js +25 -0
  79. data/package/babel/preset.js +41 -0
  80. data/package/config.js +32 -0
  81. data/package/configPath.js +3 -0
  82. data/package/dev_server.js +20 -0
  83. data/package/env.js +27 -0
  84. data/package/environments/__tests__/base.js +69 -0
  85. data/package/environments/base.js +116 -0
  86. data/package/environments/development.js +55 -0
  87. data/package/environments/production.js +79 -0
  88. data/package/environments/test.js +3 -0
  89. data/package/index.js +33 -0
  90. data/package/inliningCss.js +7 -0
  91. data/package/rules/babel.js +30 -0
  92. data/package/rules/coffee.js +6 -0
  93. data/package/rules/css.js +3 -0
  94. data/package/rules/erb.js +15 -0
  95. data/package/rules/file.js +23 -0
  96. data/package/rules/index.js +18 -0
  97. data/package/rules/less.js +22 -0
  98. data/package/rules/raw.js +5 -0
  99. data/package/rules/sass.js +16 -0
  100. data/package/rules/stylus.js +26 -0
  101. data/package/utils/get_style_rule.js +37 -0
  102. data/package/utils/helpers.js +51 -0
  103. data/package.json +71 -0
  104. data/rakelib/release.rake +57 -0
  105. data/test/command_test.rb +109 -0
  106. data/test/compiler_test.rb +68 -0
  107. data/test/configuration_test.rb +78 -0
  108. data/test/dev_server_runner_test.rb +81 -0
  109. data/test/dev_server_test.rb +47 -0
  110. data/test/engine_rake_tasks_test.rb +39 -0
  111. data/test/env_test.rb +23 -0
  112. data/test/helper_test.rb +159 -0
  113. data/test/manifest_test.rb +89 -0
  114. data/test/mounted_app/Rakefile +4 -0
  115. data/test/mounted_app/test/dummy/Rakefile +3 -0
  116. data/test/mounted_app/test/dummy/bin/rails +3 -0
  117. data/test/mounted_app/test/dummy/bin/rake +3 -0
  118. data/test/mounted_app/test/dummy/config/application.rb +10 -0
  119. data/test/mounted_app/test/dummy/config/environment.rb +3 -0
  120. data/test/mounted_app/test/dummy/config/webpacker.yml +75 -0
  121. data/test/mounted_app/test/dummy/config.ru +5 -0
  122. data/test/mounted_app/test/dummy/package.json +7 -0
  123. data/test/rake_tasks_test.rb +71 -0
  124. data/test/test_app/Rakefile +3 -0
  125. data/test/test_app/app/packs/entrypoints/application.js +10 -0
  126. data/test/test_app/app/packs/entrypoints/multi_entry.css +4 -0
  127. data/test/test_app/app/packs/entrypoints/multi_entry.js +4 -0
  128. data/test/test_app/bin/webpacker +14 -0
  129. data/test/test_app/bin/webpacker-dev-server +14 -0
  130. data/test/test_app/config/application.rb +11 -0
  131. data/test/test_app/config/environment.rb +4 -0
  132. data/test/test_app/config/initializers/inspect_autoload_paths.rb +1 -0
  133. data/test/test_app/config/webpack/webpack.config.js +0 -0
  134. data/test/test_app/config/webpacker.yml +77 -0
  135. data/test/test_app/config/webpacker_other_location.yml +79 -0
  136. data/test/test_app/config/webpacker_public_root.yml +18 -0
  137. data/test/test_app/config.ru +5 -0
  138. data/test/test_app/package.json +13 -0
  139. data/test/test_app/public/packs/manifest.json +50 -0
  140. data/test/test_app/some.config.js +0 -0
  141. data/test/test_app/yarn.lock +11 -0
  142. data/test/test_helper.rb +33 -0
  143. data/test/webpack_runner_test.rb +57 -0
  144. data/test/webpacker_test.rb +34 -0
  145. data/webpacker.gemspec +31 -0
  146. data/yarn.lock +4029 -0
  147. metadata +331 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e3e0b9296c62375b6e7861a599485d262020e8b58ff601a75e136094e8278100
4
+ data.tar.gz: 14883fa657938740c400e202f02ddeb72d5fd45dd54bef8d44307ca34915af6e
5
+ SHA512:
6
+ metadata.gz: 18d3205c3f77361b2cde0c3e8dc2509cee255ba1a4145f0f689d9829366b84ffa6dee038e06b32df695a1754d0c893147fe151203b5d055452521795794110c1
7
+ data.tar.gz: 7e88035668059940af4a9edf2a4e4e76fc1d0c9f978ac689c64db9cf3ac8d4c7a50d065bbac293f45e944c75fd3907b5409d166cff592ddb36bb60815c4c9559
data/.eslintignore ADDED
@@ -0,0 +1,4 @@
1
+ lib/*
2
+ node_modules/*
3
+ vendor/*
4
+ **/__tests__/**/*
data/.eslintrc.js ADDED
@@ -0,0 +1,14 @@
1
+ module.exports = {
2
+ extends: ['airbnb', 'prettier'],
3
+ rules: {
4
+ 'comma-dangle': ['error', 'never'],
5
+ 'import/no-unresolved': 'off',
6
+ 'import/no-extraneous-dependencies': 'off',
7
+ 'import/extensions': 'off',
8
+ semi: ['error', 'never']
9
+ },
10
+ env: {
11
+ browser: true,
12
+ node: true
13
+ }
14
+ }
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report for a crash or unexpected behavior.
4
+ title: ''
5
+ labels: bug
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ A bug is a crash or incorrect behavior. If you have a debugging or troubleshooting question, please open a discussion on the [Rails forum, category webpacker](https://discuss.rubyonrails.org/c/webpacker/10)
11
+
12
+ Ruby version:
13
+ Rails version:
14
+ Webpacker version:
15
+
16
+ Expected behavior:
17
+
18
+ Actual behavior:
19
+
20
+ Small, reproducible repo:
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: Feature request
3
+ about: Create a request for new functionality
4
+ title: ''
5
+ labels: enhancement
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ A feature request is describes a suggested improvement. If you have a debugging or troubleshooting question, please open a discussion on the [Rails forum, category webpacker](https://discuss.rubyonrails.org/c/webpacker/10)
11
+
12
+ Ruby version:
13
+ Rails version:
14
+ Webpacker version:
15
+
16
+ Desired behavior:
17
+
18
+ Actual behavior:
@@ -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 ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle
2
+ /pkg
3
+ /test/mounted_app/test/dummy/log
4
+ /test/test_app/log
5
+ node_modules
6
+ .byebug_history
7
+ /test/test_app/tmp
8
+ yarn-debug.log*
9
+ yarn-error.log*
10
+ .yarn-integrity
11
+ /log
12
+ gemfiles/*.lock
13
+ .DS_Store
data/.node-version ADDED
@@ -0,0 +1 @@
1
+ 16.7.0
data/.rubocop.yml ADDED
@@ -0,0 +1,229 @@
1
+ require: rubocop-performance
2
+ AllCops:
3
+ TargetRubyVersion: 2.7
4
+ # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
5
+ # to ignore them, so only the ones explicitly set in this file are enabled.
6
+ DisabledByDefault: true
7
+ Exclude:
8
+ - "lib/install/templates/**"
9
+ - "vendor/**/*"
10
+ - "node_modules/**/*"
11
+ - "_actions/**/*"
12
+
13
+ # Prefer &&/|| over and/or.
14
+ Style/AndOr:
15
+ Enabled: true
16
+
17
+ # Align `when` with `case`.
18
+ Layout/CaseIndentation:
19
+ Enabled: true
20
+
21
+ # Align comments with method definitions.
22
+ Layout/CommentIndentation:
23
+ Enabled: true
24
+
25
+ # No extra empty lines.
26
+ Layout/EmptyLines:
27
+ Enabled: true
28
+
29
+ # In a regular class definition, no empty lines around the body.
30
+ Layout/EmptyLinesAroundClassBody:
31
+ Enabled: true
32
+
33
+ # In a regular method definition, no empty lines around the body.
34
+ Layout/EmptyLinesAroundMethodBody:
35
+ Enabled: true
36
+
37
+ # In a regular module definition, no empty lines around the body.
38
+ Layout/EmptyLinesAroundModuleBody:
39
+ Enabled: true
40
+
41
+ # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
42
+ Style/HashSyntax:
43
+ Enabled: true
44
+
45
+ # Method definitions after `private` or `protected` isolated calls need one
46
+ # extra level of indentation.
47
+ Layout/IndentationConsistency:
48
+ Enabled: true
49
+ EnforcedStyle: indented_internal_methods
50
+
51
+ # Detect hard tabs, no hard tabs.
52
+ Layout/IndentationStyle:
53
+ Enabled: true
54
+
55
+ # Two spaces, no tabs (for indentation).
56
+ Layout/IndentationWidth:
57
+ Enabled: true
58
+
59
+ Layout/SpaceAfterColon:
60
+ Enabled: true
61
+
62
+ Layout/SpaceAfterComma:
63
+ Enabled: true
64
+
65
+ Layout/SpaceAroundEqualsInParameterDefault:
66
+ Enabled: true
67
+
68
+ Layout/SpaceAroundKeyword:
69
+ Enabled: true
70
+
71
+ Layout/SpaceAroundOperators:
72
+ Enabled: true
73
+
74
+ Layout/SpaceBeforeFirstArg:
75
+ Enabled: true
76
+
77
+ # Defining a method with parameters needs parentheses.
78
+ Style/MethodDefParentheses:
79
+ Enabled: true
80
+
81
+ # Use `foo {}` not `foo{}`.
82
+ Layout/SpaceBeforeBlockBraces:
83
+ Enabled: true
84
+
85
+ # Use `foo { bar }` not `foo {bar}`.
86
+ Layout/SpaceInsideBlockBraces:
87
+ Enabled: true
88
+
89
+ # Use `{ a: 1 }` not `{a:1}`.
90
+ Layout/SpaceInsideHashLiteralBraces:
91
+ Enabled: true
92
+
93
+ Layout/SpaceInsideParens:
94
+ Enabled: true
95
+
96
+ # Check quotes usage according to lint rule below.
97
+ Style/StringLiterals:
98
+ Enabled: true
99
+ EnforcedStyle: double_quotes
100
+
101
+ # Blank lines should not have any spaces.
102
+ Layout/TrailingEmptyLines:
103
+ Enabled: true
104
+
105
+ # No trailing whitespace.
106
+ Layout/TrailingWhitespace:
107
+ Enabled: true
108
+
109
+ # Use quotes for string literals when they are enough.
110
+ Style/RedundantPercentQ:
111
+ Enabled: true
112
+
113
+ Lint/DeprecatedClassMethods:
114
+ Enabled: true
115
+
116
+ # Align `end` with the matching keyword or starting expression except for
117
+ # assignments, where it should be aligned with the LHS.
118
+ Layout/EndAlignment:
119
+ Enabled: true
120
+ EnforcedStyleAlignWith: variable
121
+
122
+ # Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
123
+ Lint/RequireParentheses:
124
+ Enabled: true
125
+
126
+ # Use `bind_call(obj, args, ...)` instead of `bind(obj).call(args, ...)`.
127
+ Performance/BindCall:
128
+ Enabled: true
129
+
130
+ # Use `caller(n..n)` instead of `caller`.
131
+ Performance/Caller:
132
+ Enabled: true
133
+
134
+ # Use `casecmp` for case comparison.
135
+ Performance/Casecmp:
136
+ Enabled: true
137
+
138
+ # Extract Array and Hash literals outside of loops into local variables or constants.
139
+ Performance/CollectionLiteralInLoop:
140
+ Enabled: true
141
+
142
+ # Prefer `sort_by(&:foo)` instead of `sort { |a, b| a.foo <=> b.foo }`.
143
+ Performance/CompareWithBlock:
144
+ Enabled: true
145
+
146
+ # Use `count` instead of `{select,find_all,filter,reject}...{size,count,length}`.
147
+ Performance/Count:
148
+ Enabled: true
149
+
150
+ # Use `delete_prefix` instead of `gsub`.
151
+ Performance/DeletePrefix:
152
+ Enabled: true
153
+
154
+ # Use `delete_suffix` instead of `gsub`.
155
+ Performance/DeleteSuffix:
156
+ Enabled: true
157
+
158
+ # Use `detect` instead of `select.first`, `find_all.first`, `filter.first`, `select.last`, `find_all.last`, and `filter.last`.
159
+ Performance/Detect:
160
+ Enabled: true
161
+
162
+ # Use `str.{start,end}_with?(x, ..., y, ...)` instead of `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
163
+ Performance/DoubleStartEndWith:
164
+ Enabled: true
165
+
166
+ # Use `end_with?` instead of a regex match anchored to the end of a string.
167
+ Performance/EndWith:
168
+ Enabled: true
169
+
170
+ # Do not compute the size of statically sized objects except in constants.
171
+ Performance/FixedSize:
172
+ Enabled: true
173
+
174
+ # Use `Enumerable#flat_map` instead of `Enumerable#map...Array#flatten(1).
175
+ Performance/FlatMap:
176
+ Enabled: true
177
+
178
+ # Use `key?` or `value?` instead of `keys.include?` or `values.include?`.
179
+ Performance/InefficientHashSearch:
180
+ Enabled: true
181
+
182
+ # Use `Range#cover?` instead of `Range#include?` (or `Range#member?`).
183
+ Performance/RangeInclude:
184
+ Enabled: true
185
+
186
+ # Use `yield` instead of `block.call`.
187
+ Performance/RedundantBlockCall:
188
+ Enabled: true
189
+
190
+ # Use `=~` instead of `String#match` or `Regexp#match` in a context where the returned `MatchData` is not needed.
191
+ Performance/RedundantMatch:
192
+ Enabled: true
193
+
194
+ # Use Hash#[]=, rather than Hash#merge! with a single key-value pair.
195
+ Performance/RedundantMerge:
196
+ Enabled: true
197
+
198
+ # Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`, `Regexp#===`, or `=~` when `MatchData` is not used.
199
+ Performance/RegexpMatch:
200
+ Enabled: true
201
+
202
+ # Use `reverse_each` instead of `reverse.each`.
203
+ Performance/ReverseEach:
204
+ Enabled: true
205
+
206
+ # Use `size` instead of `count` for counting the number of elements in `Array` and `Hash`.
207
+ Performance/Size:
208
+ Enabled: true
209
+
210
+ # Use `start_with?` instead of a regex match anchored to the beginning of a string.
211
+ Performance/StartWith:
212
+ Enabled: true
213
+
214
+ # Use `tr` instead of `gsub` when you are replacing the same number of characters.
215
+ # Use `delete` instead of `gsub` when you are deleting characters.
216
+ Performance/StringReplacement:
217
+ Enabled: true
218
+
219
+ # Checks for .times.map calls.
220
+ Performance/TimesMap:
221
+ Enabled: true
222
+
223
+ # Use unary plus to get an unfrozen string literal.
224
+ Performance/UnfreezeString:
225
+ Enabled: true
226
+
227
+ # Use `URI::DEFAULT_PARSER` instead of `URI::Parser.new`.
228
+ Performance/UriDefaultParser:
229
+ Enabled: true
data/CHANGELOG.md ADDED
@@ -0,0 +1,32 @@
1
+ For versions prior to v6, see the [5.x stable branch of rails/webpacker](https://github.com/rails/webpacker/tree/5-x-stable).
2
+
3
+ ## [[6.0.0]](https://github.com/rails/webpacker/compare/v5.4.3...master) - 2022
4
+
5
+ Latest is rc.9.
6
+
7
+ Please see [UPGRADE GUIDE](./docs/v6_upgrade.md) for more information.
8
+ - Single default configuration file of `config/webpack/webpack.config.js`. Previously, the config file was set
9
+ to `config/webpack/#{NODE_ENV}.js`.
10
+
11
+ - `node_modules` will no longer be babel transfomed 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:
12
+
13
+ ```js
14
+ const nodeModules = require('@rails/webpacker/rules/node_modules.js')
15
+ environment.loaders.append('nodeModules', nodeModules)
16
+ ```
17
+
18
+ - 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`).
19
+ - `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.
20
+ - 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).
21
+ - Changes `@babel/preset-env` modules option to `'auto'` per recommendation in the Babel docs [#2709](https://github.com/rails/webpacker/pull/2709)
22
+ - Adds experimental Yarn 2 support. Note you must manually set `nodeLinker: node-modules` in your `.yarnrc.yml`.
23
+ - Fixes dev server issues [#2898](https://github.com/rails/webpacker/pull/2898)
24
+ - Update static files path to from `media/` to `static/`.
25
+ - Changed all package.json dependencies to peerDependencies, so upgrading requires adding the dependencies, per the [UPGRADE GUIDE](./docs/v6_upgrade.md).
26
+ - Deprecated configuration option `watched_paths`. Use `additional_paths` instead in `webpacker.yml`.
27
+
28
+ ### Breaking changes
29
+ - Renamed `/bin/webpack` to `/bin/webpacker` and `/bin/webpack-dev-server` to `bin/webpacker-dev-server` to avoid confusion with underlying webpack executables.
30
+ - Removed integration installers
31
+ - Splitchunks enabled by default
32
+ - CSS extraction enabled by default, except when devServer is configured and running
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,62 @@
1
+ ## Setting Up a Development Environment
2
+
3
+ 1. Install [Yarn](https://yarnpkg.com/)
4
+
5
+ 2. Run the following commands to set up the development environment.
6
+
7
+ ```
8
+ bundle install
9
+ yarn
10
+ ```
11
+
12
+ ## Making sure your changes pass all tests
13
+
14
+ There are a number of automated checks which run on GitHub Actions when a pull request is created.
15
+
16
+ You can run those checks on your own locally to make sure that your changes would not break the CI build.
17
+
18
+ ### 1. Check the code for JavaScript style violations
19
+
20
+ ```
21
+ yarn lint
22
+ ```
23
+
24
+ ### 2. Check the code for Ruby style violations
25
+
26
+ ```
27
+ bundle exec rubocop
28
+ ```
29
+
30
+ ### 3. Run the JavaScript test suite
31
+
32
+ ```
33
+ yarn test
34
+ ```
35
+
36
+ ### 4. Run the Ruby test suite
37
+
38
+ ```
39
+ bundle exec rake test
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
+ bundle exec ruby -I test test/rake_tasks_test.rb -n test_rake_webpacker_install
52
+ ```
53
+
54
+ # Testing the generator
55
+ If you change the generator, check that install instructions work.
56
+
57
+ 1. Update the gemfile so that gem "webpacker" has a line like this, pointing to your install of webpacker
58
+ ```ruby
59
+ gem 'webpacker', path: "~/shakacode/forks/webpacker"
60
+ ```
61
+ 2. `bundle`
62
+ 3. Run the generator confirm that you got the right changes.
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem "rails"
6
+ gem "rake", ">= 11.1"
7
+ gem "rack-proxy", require: false
8
+ gem "semantic_range", require: false
9
+
10
+ group :test do
11
+ gem "minitest", "~> 5.0"
12
+ gem "byebug"
13
+ end