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.
- checksums.yaml +4 -4
- data/.eslintrc.js +8 -8
- data/.github/workflows/jest.yml +30 -0
- data/.github/workflows/js-lint.yml +31 -0
- data/.github/workflows/rubocop.yml +39 -0
- data/.github/workflows/ruby.yml +48 -0
- data/.gitignore +2 -0
- data/.node-version +1 -1
- data/.rubocop.yml +117 -16
- data/CHANGELOG.md +91 -5
- data/CONTRIBUTING.md +20 -1
- data/Gemfile +1 -0
- data/Gemfile.lock +121 -109
- data/README.md +365 -387
- data/config/README.md +3 -0
- data/config/webpacker.yml +1 -0
- data/docs/deployment.md +9 -11
- data/docs/developing_webpacker.md +29 -0
- data/docs/troubleshooting.md +64 -26
- data/docs/v6_upgrade.md +113 -0
- data/gemfiles/Gemfile-rails-edge +1 -1
- data/gemfiles/{Gemfile-rails.4.2.x → Gemfile-rails.6.1.x} +4 -1
- data/lib/install/{javascript/packs/application.js → application.js} +2 -5
- data/lib/install/bin/webpack +4 -7
- data/lib/install/bin/yarn +18 -0
- data/lib/install/config/webpack/base.js +3 -0
- data/lib/install/config/webpack/development.js +2 -2
- data/lib/install/config/webpack/production.js +2 -2
- data/lib/install/config/webpack/test.js +2 -2
- data/lib/install/config/webpacker.yml +22 -54
- data/lib/install/package.json +15 -0
- data/lib/install/template.rb +66 -23
- data/lib/tasks/webpacker/binstubs.rake +6 -4
- data/lib/tasks/webpacker/check_binstubs.rake +4 -4
- data/lib/tasks/webpacker/check_node.rake +18 -8
- data/lib/tasks/webpacker/check_yarn.rake +19 -10
- data/lib/tasks/webpacker/clean.rake +12 -6
- data/lib/tasks/webpacker/clobber.rake +9 -5
- data/lib/tasks/webpacker/compile.rake +4 -2
- data/lib/tasks/webpacker/info.rake +12 -10
- data/lib/tasks/webpacker/install.rake +6 -4
- data/lib/tasks/webpacker/verify_config.rake +14 -0
- data/lib/tasks/webpacker/verify_install.rake +1 -10
- data/lib/tasks/webpacker/yarn_install.rake +13 -16
- data/lib/tasks/webpacker.rake +2 -11
- data/lib/tasks/yarn.rake +38 -0
- data/lib/webpacker/commands.rb +40 -11
- data/lib/webpacker/compiler.rb +23 -12
- data/lib/webpacker/configuration.rb +24 -33
- data/lib/webpacker/dev_server.rb +6 -0
- data/lib/webpacker/dev_server_proxy.rb +3 -1
- data/lib/webpacker/dev_server_runner.rb +34 -10
- data/lib/webpacker/env.rb +5 -1
- data/lib/webpacker/helper.rb +72 -87
- data/lib/webpacker/instance.rb +4 -0
- data/lib/webpacker/manifest.rb +6 -7
- data/lib/webpacker/railtie.rb +8 -45
- data/lib/webpacker/runner.rb +1 -0
- data/lib/webpacker/version.rb +1 -1
- data/lib/webpacker/webpack_runner.rb +30 -4
- data/lib/webpacker.rb +1 -1
- data/package/__tests__/config.js +6 -27
- data/package/__tests__/dev_server.js +2 -0
- data/package/__tests__/development.js +18 -13
- data/package/__tests__/env.js +16 -4
- data/package/__tests__/index.js +9 -0
- data/package/__tests__/production.js +6 -6
- data/package/__tests__/staging.js +7 -6
- data/package/__tests__/test.js +4 -5
- data/package/babel/preset.js +54 -0
- data/package/config.js +7 -12
- data/package/configPath.js +3 -0
- data/package/dev_server.js +1 -1
- data/package/env.js +14 -6
- data/package/environments/__tests__/base.js +26 -31
- data/package/environments/base.js +78 -128
- data/package/environments/development.js +47 -43
- data/package/environments/production.js +66 -66
- data/package/environments/test.js +2 -2
- data/package/index.js +15 -8
- data/package/inliningCss.js +7 -0
- data/package/rules/babel.js +20 -11
- data/package/rules/coffee.js +6 -0
- data/package/rules/erb.js +15 -0
- data/package/rules/file.js +21 -18
- data/package/rules/index.js +16 -18
- data/package/rules/less.js +22 -0
- data/package/rules/raw.js +5 -0
- data/package/rules/sass.js +14 -6
- data/package/rules/stylus.js +26 -0
- data/package/utils/get_style_rule.js +28 -36
- data/package/utils/helpers.js +28 -35
- data/package.json +26 -46
- data/test/command_test.rb +76 -0
- data/test/compiler_test.rb +4 -11
- data/test/configuration_test.rb +5 -35
- data/test/dev_server_runner_test.rb +36 -6
- data/test/engine_rake_tasks_test.rb +39 -0
- data/test/helper_test.rb +77 -60
- data/test/manifest_test.rb +53 -6
- data/test/mounted_app/Rakefile +4 -0
- data/test/mounted_app/test/dummy/Rakefile +3 -0
- data/test/mounted_app/test/dummy/bin/rails +3 -0
- data/test/mounted_app/test/dummy/bin/rake +3 -0
- data/test/mounted_app/test/dummy/config/application.rb +10 -0
- data/test/mounted_app/test/dummy/config/environment.rb +3 -0
- data/test/mounted_app/test/dummy/config/webpacker.yml +75 -0
- data/test/mounted_app/test/dummy/config.ru +5 -0
- data/test/mounted_app/test/dummy/package.json +7 -0
- data/test/rake_tasks_test.rb +12 -10
- data/test/test_app/app/{javascript/packs → packs/entrypoints}/application.js +1 -1
- data/test/test_app/app/packs/entrypoints/multi_entry.css +4 -0
- data/test/test_app/app/packs/entrypoints/multi_entry.js +4 -0
- data/test/test_app/config/application.rb +0 -1
- data/test/test_app/config/initializers/inspect_autoload_paths.rb +1 -0
- data/test/test_app/config/webpacker.yml +7 -27
- data/test/test_app/config/webpacker_other_location.yml +79 -0
- data/test/test_app/config/webpacker_public_root.yml +0 -1
- data/test/test_app/public/packs/manifest.json +36 -17
- data/test/test_app/some.config.js +0 -0
- data/test/webpack_runner_test.rb +10 -4
- data/test/webpacker_test.rb +21 -0
- data/webpacker.gemspec +5 -4
- data/yarn.lock +3387 -6898
- metadata +90 -99
- data/.travis.yml +0 -57
- data/docs/assets.md +0 -119
- data/docs/cloud9.md +0 -310
- data/docs/css.md +0 -254
- data/docs/docker.md +0 -68
- data/docs/engines.md +0 -200
- data/docs/env.md +0 -65
- data/docs/es6.md +0 -72
- data/docs/folder-structure.md +0 -66
- data/docs/misc.md +0 -23
- data/docs/props.md +0 -223
- data/docs/testing.md +0 -137
- data/docs/typescript.md +0 -126
- data/docs/v4-upgrade.md +0 -142
- data/docs/webpack-dev-server.md +0 -92
- data/docs/webpack.md +0 -364
- data/docs/yarn.md +0 -23
- data/gemfiles/Gemfile-rails.5.0.x +0 -9
- data/gemfiles/Gemfile-rails.5.1.x +0 -9
- data/lib/install/angular.rb +0 -23
- data/lib/install/coffee.rb +0 -25
- data/lib/install/config/.browserslistrc +0 -1
- data/lib/install/config/babel.config.js +0 -72
- data/lib/install/config/postcss.config.js +0 -12
- data/lib/install/config/webpack/environment.js +0 -3
- data/lib/install/elm.rb +0 -39
- data/lib/install/erb.rb +0 -25
- data/lib/install/examples/angular/hello_angular/app/app.component.ts +0 -9
- data/lib/install/examples/angular/hello_angular/app/app.module.ts +0 -16
- data/lib/install/examples/angular/hello_angular/index.ts +0 -8
- data/lib/install/examples/angular/hello_angular/polyfills.ts +0 -73
- data/lib/install/examples/angular/hello_angular.js +0 -7
- data/lib/install/examples/coffee/hello_coffee.coffee +0 -4
- data/lib/install/examples/elm/Main.elm +0 -55
- data/lib/install/examples/elm/hello_elm.js +0 -16
- data/lib/install/examples/erb/hello_erb.js.erb +0 -6
- data/lib/install/examples/react/babel.config.js +0 -87
- data/lib/install/examples/react/hello_react.jsx +0 -26
- data/lib/install/examples/react/tsconfig.json +0 -20
- data/lib/install/examples/stimulus/application.js +0 -1
- data/lib/install/examples/stimulus/controllers/hello_controller.js +0 -18
- data/lib/install/examples/stimulus/controllers/index.js +0 -9
- data/lib/install/examples/svelte/app.svelte +0 -11
- data/lib/install/examples/svelte/hello_svelte.js +0 -20
- data/lib/install/examples/typescript/hello_typescript.ts +0 -4
- data/lib/install/examples/typescript/tsconfig.json +0 -23
- data/lib/install/examples/vue/app.vue +0 -22
- data/lib/install/examples/vue/hello_vue.js +0 -72
- data/lib/install/loaders/coffee.js +0 -6
- data/lib/install/loaders/elm.js +0 -25
- data/lib/install/loaders/erb.js +0 -11
- data/lib/install/loaders/svelte.js +0 -9
- data/lib/install/loaders/typescript.js +0 -11
- data/lib/install/loaders/vue.js +0 -6
- data/lib/install/react.rb +0 -18
- data/lib/install/stimulus.rb +0 -12
- data/lib/install/svelte.rb +0 -29
- data/lib/install/typescript.rb +0 -46
- data/lib/install/vue.rb +0 -49
- data/lib/tasks/installers.rake +0 -42
- data/package/config_types/__tests__/config_list.js +0 -118
- data/package/config_types/__tests__/config_object.js +0 -43
- data/package/config_types/config_list.js +0 -75
- data/package/config_types/config_object.js +0 -55
- data/package/config_types/index.js +0 -7
- data/package/rules/module.css.js +0 -3
- data/package/rules/module.sass.js +0 -8
- data/package/rules/node_modules.js +0 -24
- data/package/utils/__tests__/deep_assign.js +0 -32
- data/package/utils/__tests__/deep_merge.js +0 -10
- data/package/utils/__tests__/get_style_rule.js +0 -65
- data/package/utils/__tests__/objectify.js +0 -9
- data/package/utils/deep_assign.js +0 -22
- data/package/utils/deep_merge.js +0 -22
- data/package/utils/objectify.js +0 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bb700e8975b2ec865da84e152fea23586c8e7a2a428465230255ab97ebe482ce
|
|
4
|
+
data.tar.gz: c2a023d554364442cd356771cad8b42226a3d6ce3a4708b6a5603151aad886ba
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bb863173d2577d304c03a4e6d66eddc385a62950bf30af00ed29c4abb9039b0290402771f58c9ede11cf9f26d5945136997d78148590871b7247e13b4d3db7cf
|
|
7
|
+
data.tar.gz: a624efeabf2bdbd7b83b59aa2854e4ebda00c5c476849c03fc585d967810b30fd5d118fbf13f412c40cb6e7fa1fe020f619cc9ede0cd72989c25504f3f8e0e53
|
data/.eslintrc.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
data/.node-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
16.7.0
|
data/.rubocop.yml
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
require: rubocop-performance
|
|
2
2
|
AllCops:
|
|
3
|
-
TargetRubyVersion: 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
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
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:
|
|
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/
|
|
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/
|
|
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
|
-
## [[
|
|
5
|
+
## [[6.0.0]](https://github.com/rails/webpacker/compare/v5.4.3...master) - 2021-TBD
|
|
6
6
|
|
|
7
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
+
```
|