webpacker 6.0.0.rc.2 → 6.0.0.rc.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +82 -82
- data/README.md +2 -2
- data/docs/v6_upgrade.md +2 -2
- data/lib/install/config/webpacker.yml +12 -11
- data/lib/webpacker/commands.rb +19 -15
- data/lib/webpacker/version.rb +1 -1
- data/package/__tests__/development.js +1 -1
- data/package/config.js +3 -3
- data/package/env.js +2 -2
- data/package/environments/development.js +34 -28
- data/package.json +8 -8
- data/test/command_test.rb +76 -0
- data/webpacker.gemspec +1 -1
- data/yarn.lock +719 -1725
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc94e50b751a536deec7042b74ce5dd87805d8d4d3a8198fe5425bb5c5a79966
|
4
|
+
data.tar.gz: c64f748c55db3a8a6a043cf584737a334bfc7b48e9461007b3b683300d8651f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fb68f94056bd76bf0cfe3940baf923cea8a1237686c68a354a6b0da777c70454dab195b555ab55821a2817de57855f33edc13c1076b18a5d607311fd92f61f8
|
7
|
+
data.tar.gz: 4c7d5d1bd2ea1cd54308805c7635c40b1daca70bc72ac7f0c3476d64bd02ddf563fb9e9dc98c2788a647121e29afd1353c8e5dc417b8463590369de4cdef4262
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
webpacker (6.0.0.rc.
|
4
|
+
webpacker (6.0.0.rc.3)
|
5
5
|
activesupport (>= 5.2)
|
6
6
|
rack-proxy (>= 0.6.1)
|
7
7
|
railties (>= 5.2)
|
@@ -10,60 +10,60 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
actioncable (6.1.
|
14
|
-
actionpack (= 6.1.
|
15
|
-
activesupport (= 6.1.
|
13
|
+
actioncable (6.1.4.1)
|
14
|
+
actionpack (= 6.1.4.1)
|
15
|
+
activesupport (= 6.1.4.1)
|
16
16
|
nio4r (~> 2.0)
|
17
17
|
websocket-driver (>= 0.6.1)
|
18
|
-
actionmailbox (6.1.
|
19
|
-
actionpack (= 6.1.
|
20
|
-
activejob (= 6.1.
|
21
|
-
activerecord (= 6.1.
|
22
|
-
activestorage (= 6.1.
|
23
|
-
activesupport (= 6.1.
|
18
|
+
actionmailbox (6.1.4.1)
|
19
|
+
actionpack (= 6.1.4.1)
|
20
|
+
activejob (= 6.1.4.1)
|
21
|
+
activerecord (= 6.1.4.1)
|
22
|
+
activestorage (= 6.1.4.1)
|
23
|
+
activesupport (= 6.1.4.1)
|
24
24
|
mail (>= 2.7.1)
|
25
|
-
actionmailer (6.1.
|
26
|
-
actionpack (= 6.1.
|
27
|
-
actionview (= 6.1.
|
28
|
-
activejob (= 6.1.
|
29
|
-
activesupport (= 6.1.
|
25
|
+
actionmailer (6.1.4.1)
|
26
|
+
actionpack (= 6.1.4.1)
|
27
|
+
actionview (= 6.1.4.1)
|
28
|
+
activejob (= 6.1.4.1)
|
29
|
+
activesupport (= 6.1.4.1)
|
30
30
|
mail (~> 2.5, >= 2.5.4)
|
31
31
|
rails-dom-testing (~> 2.0)
|
32
|
-
actionpack (6.1.
|
33
|
-
actionview (= 6.1.
|
34
|
-
activesupport (= 6.1.
|
32
|
+
actionpack (6.1.4.1)
|
33
|
+
actionview (= 6.1.4.1)
|
34
|
+
activesupport (= 6.1.4.1)
|
35
35
|
rack (~> 2.0, >= 2.0.9)
|
36
36
|
rack-test (>= 0.6.3)
|
37
37
|
rails-dom-testing (~> 2.0)
|
38
38
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
39
|
-
actiontext (6.1.
|
40
|
-
actionpack (= 6.1.
|
41
|
-
activerecord (= 6.1.
|
42
|
-
activestorage (= 6.1.
|
43
|
-
activesupport (= 6.1.
|
39
|
+
actiontext (6.1.4.1)
|
40
|
+
actionpack (= 6.1.4.1)
|
41
|
+
activerecord (= 6.1.4.1)
|
42
|
+
activestorage (= 6.1.4.1)
|
43
|
+
activesupport (= 6.1.4.1)
|
44
44
|
nokogiri (>= 1.8.5)
|
45
|
-
actionview (6.1.
|
46
|
-
activesupport (= 6.1.
|
45
|
+
actionview (6.1.4.1)
|
46
|
+
activesupport (= 6.1.4.1)
|
47
47
|
builder (~> 3.1)
|
48
48
|
erubi (~> 1.4)
|
49
49
|
rails-dom-testing (~> 2.0)
|
50
50
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
51
|
-
activejob (6.1.
|
52
|
-
activesupport (= 6.1.
|
51
|
+
activejob (6.1.4.1)
|
52
|
+
activesupport (= 6.1.4.1)
|
53
53
|
globalid (>= 0.3.6)
|
54
|
-
activemodel (6.1.
|
55
|
-
activesupport (= 6.1.
|
56
|
-
activerecord (6.1.
|
57
|
-
activemodel (= 6.1.
|
58
|
-
activesupport (= 6.1.
|
59
|
-
activestorage (6.1.
|
60
|
-
actionpack (= 6.1.
|
61
|
-
activejob (= 6.1.
|
62
|
-
activerecord (= 6.1.
|
63
|
-
activesupport (= 6.1.
|
54
|
+
activemodel (6.1.4.1)
|
55
|
+
activesupport (= 6.1.4.1)
|
56
|
+
activerecord (6.1.4.1)
|
57
|
+
activemodel (= 6.1.4.1)
|
58
|
+
activesupport (= 6.1.4.1)
|
59
|
+
activestorage (6.1.4.1)
|
60
|
+
actionpack (= 6.1.4.1)
|
61
|
+
activejob (= 6.1.4.1)
|
62
|
+
activerecord (= 6.1.4.1)
|
63
|
+
activesupport (= 6.1.4.1)
|
64
64
|
marcel (~> 1.0.0)
|
65
|
-
mini_mime (
|
66
|
-
activesupport (6.1.
|
65
|
+
mini_mime (>= 1.1.0)
|
66
|
+
activesupport (6.1.4.1)
|
67
67
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
68
68
|
i18n (>= 1.6, < 2)
|
69
69
|
minitest (>= 5.1)
|
@@ -72,79 +72,79 @@ GEM
|
|
72
72
|
ast (2.4.2)
|
73
73
|
builder (3.2.4)
|
74
74
|
byebug (11.1.3)
|
75
|
-
concurrent-ruby (1.1.
|
75
|
+
concurrent-ruby (1.1.9)
|
76
76
|
crass (1.0.6)
|
77
77
|
erubi (1.10.0)
|
78
|
-
globalid (0.
|
79
|
-
activesupport (>=
|
78
|
+
globalid (0.5.2)
|
79
|
+
activesupport (>= 5.0)
|
80
80
|
i18n (1.8.10)
|
81
81
|
concurrent-ruby (~> 1.0)
|
82
|
-
loofah (2.
|
82
|
+
loofah (2.12.0)
|
83
83
|
crass (~> 1.0.2)
|
84
84
|
nokogiri (>= 1.5.9)
|
85
85
|
mail (2.7.1)
|
86
86
|
mini_mime (>= 0.1.1)
|
87
87
|
marcel (1.0.1)
|
88
88
|
method_source (1.0.0)
|
89
|
-
mini_mime (1.
|
90
|
-
mini_portile2 (2.
|
89
|
+
mini_mime (1.1.1)
|
90
|
+
mini_portile2 (2.6.1)
|
91
91
|
minitest (5.14.4)
|
92
|
-
nio4r (2.5.
|
93
|
-
nokogiri (1.
|
94
|
-
mini_portile2 (~> 2.
|
92
|
+
nio4r (2.5.8)
|
93
|
+
nokogiri (1.12.3)
|
94
|
+
mini_portile2 (~> 2.6.1)
|
95
95
|
racc (~> 1.4)
|
96
|
-
parallel (1.20.
|
97
|
-
parser (3.0.
|
96
|
+
parallel (1.20.2)
|
97
|
+
parser (3.0.2.0)
|
98
98
|
ast (~> 2.4.1)
|
99
99
|
racc (1.5.2)
|
100
100
|
rack (2.2.3)
|
101
|
-
rack-proxy (0.
|
101
|
+
rack-proxy (0.7.0)
|
102
102
|
rack
|
103
103
|
rack-test (1.1.0)
|
104
104
|
rack (>= 1.0, < 3)
|
105
|
-
rails (6.1.
|
106
|
-
actioncable (= 6.1.
|
107
|
-
actionmailbox (= 6.1.
|
108
|
-
actionmailer (= 6.1.
|
109
|
-
actionpack (= 6.1.
|
110
|
-
actiontext (= 6.1.
|
111
|
-
actionview (= 6.1.
|
112
|
-
activejob (= 6.1.
|
113
|
-
activemodel (= 6.1.
|
114
|
-
activerecord (= 6.1.
|
115
|
-
activestorage (= 6.1.
|
116
|
-
activesupport (= 6.1.
|
105
|
+
rails (6.1.4.1)
|
106
|
+
actioncable (= 6.1.4.1)
|
107
|
+
actionmailbox (= 6.1.4.1)
|
108
|
+
actionmailer (= 6.1.4.1)
|
109
|
+
actionpack (= 6.1.4.1)
|
110
|
+
actiontext (= 6.1.4.1)
|
111
|
+
actionview (= 6.1.4.1)
|
112
|
+
activejob (= 6.1.4.1)
|
113
|
+
activemodel (= 6.1.4.1)
|
114
|
+
activerecord (= 6.1.4.1)
|
115
|
+
activestorage (= 6.1.4.1)
|
116
|
+
activesupport (= 6.1.4.1)
|
117
117
|
bundler (>= 1.15.0)
|
118
|
-
railties (= 6.1.
|
118
|
+
railties (= 6.1.4.1)
|
119
119
|
sprockets-rails (>= 2.0.0)
|
120
120
|
rails-dom-testing (2.0.3)
|
121
121
|
activesupport (>= 4.2.0)
|
122
122
|
nokogiri (>= 1.6)
|
123
|
-
rails-html-sanitizer (1.
|
123
|
+
rails-html-sanitizer (1.4.2)
|
124
124
|
loofah (~> 2.3)
|
125
|
-
railties (6.1.
|
126
|
-
actionpack (= 6.1.
|
127
|
-
activesupport (= 6.1.
|
125
|
+
railties (6.1.4.1)
|
126
|
+
actionpack (= 6.1.4.1)
|
127
|
+
activesupport (= 6.1.4.1)
|
128
128
|
method_source
|
129
|
-
rake (>= 0.
|
129
|
+
rake (>= 0.13)
|
130
130
|
thor (~> 1.0)
|
131
131
|
rainbow (3.0.0)
|
132
|
-
rake (13.0.
|
132
|
+
rake (13.0.6)
|
133
133
|
regexp_parser (2.1.1)
|
134
134
|
rexml (3.2.5)
|
135
|
-
rubocop (
|
135
|
+
rubocop (1.19.1)
|
136
136
|
parallel (~> 1.10)
|
137
|
-
parser (>=
|
137
|
+
parser (>= 3.0.0.0)
|
138
138
|
rainbow (>= 2.2.2, < 4.0)
|
139
|
-
regexp_parser (>= 1.8)
|
139
|
+
regexp_parser (>= 1.8, < 3.0)
|
140
140
|
rexml
|
141
|
-
rubocop-ast (>=
|
141
|
+
rubocop-ast (>= 1.9.1, < 2.0)
|
142
142
|
ruby-progressbar (~> 1.7)
|
143
|
-
unicode-display_width (>= 1.4.0, <
|
144
|
-
rubocop-ast (1.
|
145
|
-
parser (>=
|
146
|
-
rubocop-performance (1.
|
147
|
-
rubocop (>=
|
143
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
144
|
+
rubocop-ast (1.11.0)
|
145
|
+
parser (>= 3.0.1.1)
|
146
|
+
rubocop-performance (1.11.5)
|
147
|
+
rubocop (>= 1.7.0, < 2.0)
|
148
148
|
rubocop-ast (>= 0.4.0)
|
149
149
|
ruby-progressbar (1.11.0)
|
150
150
|
semantic_range (3.0.0)
|
@@ -158,8 +158,8 @@ GEM
|
|
158
158
|
thor (1.1.0)
|
159
159
|
tzinfo (2.0.4)
|
160
160
|
concurrent-ruby (~> 1.0)
|
161
|
-
unicode-display_width (
|
162
|
-
websocket-driver (0.7.
|
161
|
+
unicode-display_width (2.0.0)
|
162
|
+
websocket-driver (0.7.5)
|
163
163
|
websocket-extensions (>= 0.1.0)
|
164
164
|
websocket-extensions (0.1.5)
|
165
165
|
zeitwerk (2.4.2)
|
@@ -174,7 +174,7 @@ DEPENDENCIES
|
|
174
174
|
rack-proxy
|
175
175
|
rails
|
176
176
|
rake (>= 11.1)
|
177
|
-
rubocop
|
177
|
+
rubocop
|
178
178
|
rubocop-performance
|
179
179
|
semantic_range
|
180
180
|
webpacker!
|
data/README.md
CHANGED
data/docs/v6_upgrade.md
CHANGED
@@ -26,7 +26,7 @@ Example going to a specific version:
|
|
26
26
|
|
27
27
|
```ruby
|
28
28
|
# Gemfile
|
29
|
-
gem 'webpacker', '6.0.0.rc.
|
29
|
+
gem 'webpacker', '6.0.0.rc.3'
|
30
30
|
```
|
31
31
|
|
32
32
|
```bash
|
@@ -34,7 +34,7 @@ Example going to a specific version:
|
|
34
34
|
```
|
35
35
|
|
36
36
|
```bash
|
37
|
-
yarn add @rails/webpacker@6.0.0-rc.
|
37
|
+
yarn add @rails/webpacker@6.0.0-rc.3 --exact
|
38
38
|
```
|
39
39
|
|
40
40
|
```bash
|
@@ -24,25 +24,26 @@ development:
|
|
24
24
|
https: false
|
25
25
|
host: localhost
|
26
26
|
port: 3035
|
27
|
-
public: localhost:3035
|
28
27
|
# Hot Module Replacement updates modules while the application is running without a full reload
|
29
28
|
hmr: false
|
30
|
-
|
31
|
-
|
29
|
+
client:
|
30
|
+
# Should we show a full-screen overlay in the browser when there are compiler errors or warnings?
|
31
|
+
overlay: true
|
32
|
+
# May also be a string
|
33
|
+
# webSocketURL:
|
34
|
+
# hostname: "0.0.0.0"
|
35
|
+
# pathname: "/ws"
|
36
|
+
# port: 8080
|
32
37
|
# Should we use gzip compression?
|
33
38
|
compress: true
|
34
39
|
# Note that apps that do not check the host are vulnerable to DNS rebinding attacks
|
35
|
-
|
36
|
-
# This option lets the browser open with your local IP
|
37
|
-
use_local_ip: false
|
38
|
-
# When enabled, nothing except the initial startup information will be written to the console.
|
39
|
-
# This also means that errors or warnings from webpack are not visible.
|
40
|
-
quiet: false
|
40
|
+
allowed_hosts: "all"
|
41
41
|
pretty: true
|
42
42
|
headers:
|
43
43
|
'Access-Control-Allow-Origin': '*'
|
44
|
-
|
45
|
-
|
44
|
+
static:
|
45
|
+
watch:
|
46
|
+
ignored: '**/node_modules/**'
|
46
47
|
|
47
48
|
test:
|
48
49
|
<<: *default
|
data/lib/webpacker/commands.rb
CHANGED
@@ -17,20 +17,21 @@ class Webpacker::Commands
|
|
17
17
|
#
|
18
18
|
def clean(count = 2, age = 3600)
|
19
19
|
if config.public_output_path.exist? && config.public_manifest_path.exist?
|
20
|
-
|
21
|
-
.
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
packs
|
21
|
+
.map do |paths|
|
22
|
+
paths.map { |path| [Time.now - File.mtime(path), path] }
|
23
|
+
.sort
|
24
|
+
.reject.with_index do |(file_age, _), index|
|
25
|
+
file_age < age || index < count
|
26
|
+
end
|
27
|
+
.map { |_, path| path }
|
27
28
|
end
|
28
|
-
.
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
.flatten
|
30
|
+
.compact
|
31
|
+
.each do |file|
|
32
|
+
if File.file?(file)
|
33
|
+
File.delete(file)
|
34
|
+
logger.info "Removed #{file}"
|
34
35
|
end
|
35
36
|
end
|
36
37
|
end
|
@@ -54,12 +55,15 @@ class Webpacker::Commands
|
|
54
55
|
end
|
55
56
|
|
56
57
|
private
|
57
|
-
def
|
58
|
+
def packs
|
58
59
|
all_files = Dir.glob("#{config.public_output_path}/**/*")
|
59
60
|
manifest_config = Dir.glob("#{config.public_manifest_path}*")
|
60
61
|
|
61
62
|
packs = all_files - manifest_config - current_version
|
62
|
-
packs.reject { |file| File.directory?(file) }.group_by
|
63
|
+
packs.reject { |file| File.directory?(file) }.group_by do |path|
|
64
|
+
base, _, ext = File.basename(path).scan(/(.*)(-[\da-f]+)(\.\w+)/).flatten
|
65
|
+
"#{File.dirname(path)}/#{base}#{ext}"
|
66
|
+
end.values
|
63
67
|
end
|
64
68
|
|
65
69
|
def current_version
|
data/lib/webpacker/version.rb
CHANGED
data/package/config.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
const { resolve } = require('path')
|
2
|
-
const {
|
2
|
+
const { load } = require('js-yaml')
|
3
3
|
const { readFileSync } = require('fs')
|
4
4
|
const { merge } = require('webpack-merge')
|
5
5
|
const { ensureTrailingSlash } = require('./utils/helpers')
|
@@ -9,12 +9,12 @@ const configPath = require('./configPath')
|
|
9
9
|
const defaultConfigPath = require.resolve('../lib/install/config/webpacker.yml')
|
10
10
|
|
11
11
|
const getDefaultConfig = () => {
|
12
|
-
const defaultConfig =
|
12
|
+
const defaultConfig = load(readFileSync(defaultConfigPath), 'utf8')
|
13
13
|
return defaultConfig[railsEnv] || defaultConfig.production
|
14
14
|
}
|
15
15
|
|
16
16
|
const defaults = getDefaultConfig()
|
17
|
-
const app =
|
17
|
+
const app = load(readFileSync(configPath), 'utf8')[railsEnv]
|
18
18
|
|
19
19
|
const config = merge(defaults, app)
|
20
20
|
config.outputPath = resolve(config.public_root_path, config.public_output_path)
|
data/package/env.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
const {
|
1
|
+
const { load } = require('js-yaml')
|
2
2
|
const { readFileSync } = require('fs')
|
3
3
|
|
4
4
|
const NODE_ENVIRONMENTS = ['development', 'production', 'test']
|
@@ -12,7 +12,7 @@ const nodeEnv
|
|
12
12
|
const isProduction = nodeEnv === 'production'
|
13
13
|
const isDevelopment = nodeEnv === 'development'
|
14
14
|
|
15
|
-
const config =
|
15
|
+
const config = load(readFileSync(configPath), 'utf8')
|
16
16
|
const availableEnvironments = Object.keys(config).join('|')
|
17
17
|
const regex = new RegExp(`^(${availableEnvironments})$`, 'g')
|
18
18
|
|
@@ -18,35 +18,41 @@ if (runningWebpackDevServer) {
|
|
18
18
|
})
|
19
19
|
}
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
public: devServer.public,
|
37
|
-
publicPath,
|
38
|
-
historyApiFallback: { disableDotRule: true },
|
39
|
-
headers: devServer.headers,
|
40
|
-
overlay: devServer.overlay,
|
41
|
-
stats: {
|
42
|
-
colors: true,
|
43
|
-
entrypoints: false,
|
44
|
-
errorDetails: true,
|
45
|
-
modules: false,
|
46
|
-
moduleTrace: false
|
47
|
-
},
|
48
|
-
watchOptions: devServer.watch_options
|
21
|
+
const devServerConfig = {
|
22
|
+
devMiddleware: {
|
23
|
+
publicPath
|
24
|
+
},
|
25
|
+
compress: devServer.compress,
|
26
|
+
allowedHosts: devServer.allowed_hosts,
|
27
|
+
host: devServer.host,
|
28
|
+
port: devServer.port,
|
29
|
+
https: devServer.https,
|
30
|
+
hot: devServer.hmr,
|
31
|
+
liveReload: !devServer.hmr,
|
32
|
+
historyApiFallback: { disableDotRule: true },
|
33
|
+
headers: devServer.headers,
|
34
|
+
static: {
|
35
|
+
publicPath: contentBase
|
49
36
|
}
|
37
|
+
}
|
38
|
+
|
39
|
+
if (devServer.static) {
|
40
|
+
devServerConfig.static = { ...devServerConfig.static, ...devServer.static }
|
41
|
+
}
|
42
|
+
|
43
|
+
if (devServer.client) {
|
44
|
+
devServerConfig.client = devServer.client
|
45
|
+
}
|
46
|
+
|
47
|
+
devConfig = merge(devConfig, {
|
48
|
+
stats: {
|
49
|
+
colors: true,
|
50
|
+
entrypoints: false,
|
51
|
+
errorDetails: true,
|
52
|
+
modules: false,
|
53
|
+
moduleTrace: false
|
54
|
+
},
|
55
|
+
devServer: devServerConfig
|
50
56
|
})
|
51
57
|
}
|
52
58
|
|