webpacker 6.0.0.beta.1 → 6.0.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +8 -2
- data/lib/webpacker/version.rb +1 -1
- data/package.json +1 -1
- data/package/environments/__tests__/base.js +2 -2
- data/package/environments/base.js +6 -3
- data/package/environments/production.js +29 -22
- data/package/rules/file.js +6 -2
- data/package/rules/index.js +2 -2
- data/package/rules/stylus.js +26 -0
- metadata +5 -5
- data/package/rules/svg.js +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70198a585cf22360094497e860a23dcd172c7926820eaa905b00eaf15c997010
|
4
|
+
data.tar.gz: a1ff9f0cc031d1fffc69813b071b10947aa1648fbedaee826be547bd03adcdc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e16cfe7311345f9e2af7e4b821ada9acdaff357ff64cbbbebf038a43199dcafa3b82c403bec1f9ab182ff456efd9ff14eb9756b4edbd76c68beba3cf8543cdc
|
7
|
+
data.tar.gz: de893725da86a372346c6c552a49a4efb078e24343e16a173b6d51230dc2ccb8bc26d5fbf8726d6d8f8d1a7277eea81d3ed29a06c76998db98cb5970c040bcb0
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -334,13 +334,19 @@ yarn add postcss-loader
|
|
334
334
|
#### Sass
|
335
335
|
|
336
336
|
```
|
337
|
-
yarn add sass-loader
|
337
|
+
yarn add sass sass-loader
|
338
338
|
```
|
339
339
|
|
340
340
|
#### Less
|
341
341
|
|
342
342
|
```
|
343
|
-
yarn add less-loader
|
343
|
+
yarn add less less-loader
|
344
|
+
```
|
345
|
+
|
346
|
+
#### Less
|
347
|
+
|
348
|
+
```
|
349
|
+
yarn add stylus stylus-loader
|
344
350
|
```
|
345
351
|
|
346
352
|
#### React
|
data/lib/webpacker/version.rb
CHANGED
data/package.json
CHANGED
@@ -39,8 +39,8 @@ describe('Base config', () => {
|
|
39
39
|
const defaultRules = Object.keys(rules)
|
40
40
|
const configRules = baseConfig.module.rules
|
41
41
|
|
42
|
-
expect(defaultRules.length).toEqual(
|
43
|
-
expect(configRules.length).toEqual(
|
42
|
+
expect(defaultRules.length).toEqual(3)
|
43
|
+
expect(configRules.length).toEqual(3)
|
44
44
|
})
|
45
45
|
|
46
46
|
test('should return default plugins', () => {
|
@@ -67,8 +67,12 @@ const getPlugins = () => {
|
|
67
67
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
68
68
|
plugins.push(
|
69
69
|
new MiniCssExtractPlugin({
|
70
|
-
filename: isDevelopment
|
71
|
-
|
70
|
+
filename: isDevelopment
|
71
|
+
? 'css/[name].css'
|
72
|
+
: 'css/[name]-[contenthash:8].css',
|
73
|
+
chunkFilename: isDevelopment
|
74
|
+
? 'css/[id].css'
|
75
|
+
: 'css/[id]-[contenthash:8].css'
|
72
76
|
})
|
73
77
|
)
|
74
78
|
}
|
@@ -82,7 +86,6 @@ module.exports = {
|
|
82
86
|
filename: 'js/[name]-[contenthash].js',
|
83
87
|
chunkFilename: 'js/[name]-[contenthash].chunk.js',
|
84
88
|
hotUpdateChunkFilename: 'js/[id]-[hash].hot-update.js',
|
85
|
-
assetModuleFilename: 'static/[hash][ext][query]',
|
86
89
|
path: config.outputPath,
|
87
90
|
publicPath: config.publicPath
|
88
91
|
},
|
@@ -8,21 +8,39 @@ const baseConfig = require('./base')
|
|
8
8
|
const { moduleExists } = require('../utils/helpers')
|
9
9
|
|
10
10
|
const getPlugins = () => {
|
11
|
-
|
12
|
-
filename: '[path].gz[query]',
|
13
|
-
algorithm: 'gzip',
|
14
|
-
test: /\.(js|css|html|json|ico|svg|eot|otf|ttf|map)$/
|
15
|
-
})
|
11
|
+
const plugins = []
|
16
12
|
|
17
|
-
|
18
|
-
|
19
|
-
filename: '[path].
|
20
|
-
algorithm: '
|
13
|
+
plugins.push(
|
14
|
+
new CompressionPlugin({
|
15
|
+
filename: '[path][base].gz[query]',
|
16
|
+
algorithm: 'gzip',
|
21
17
|
test: /\.(js|css|html|json|ico|svg|eot|otf|ttf|map)$/
|
22
18
|
})
|
19
|
+
)
|
20
|
+
|
21
|
+
if ('brotli' in process.versions) {
|
22
|
+
plugins.push(
|
23
|
+
new CompressionPlugin({
|
24
|
+
filename: '[path][base].br[query]',
|
25
|
+
algorithm: 'brotliCompress',
|
26
|
+
test: /\.(js|css|html|json|ico|svg|eot|otf|ttf|map)$/
|
27
|
+
})
|
28
|
+
)
|
23
29
|
}
|
24
30
|
|
25
|
-
return
|
31
|
+
return plugins
|
32
|
+
}
|
33
|
+
|
34
|
+
const tryCssMinimizer = () => {
|
35
|
+
if (
|
36
|
+
moduleExists('css-loader') &&
|
37
|
+
moduleExists('css-minimizer-webpack-plugin')
|
38
|
+
) {
|
39
|
+
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
|
40
|
+
return new CssMinimizerPlugin({ sourceMap: true })
|
41
|
+
}
|
42
|
+
|
43
|
+
return null
|
26
44
|
}
|
27
45
|
|
28
46
|
const productionConfig = {
|
@@ -32,18 +50,7 @@ const productionConfig = {
|
|
32
50
|
plugins: getPlugins(),
|
33
51
|
optimization: {
|
34
52
|
minimizer: [
|
35
|
-
()
|
36
|
-
if (
|
37
|
-
moduleExists('css-loader') &&
|
38
|
-
moduleExists('css-minimizer-webpack-plugin')
|
39
|
-
) {
|
40
|
-
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
|
41
|
-
return new CssMinimizerPlugin({ sourceMap: true })
|
42
|
-
}
|
43
|
-
|
44
|
-
return false
|
45
|
-
},
|
46
|
-
|
53
|
+
tryCssMinimizer(),
|
47
54
|
new TerserPlugin({
|
48
55
|
parallel: Number.parseInt(process.env.WEBPACKER_PARALLEL, 10) || true,
|
49
56
|
terserOptions: {
|
data/package/rules/file.js
CHANGED
@@ -12,8 +12,12 @@ module.exports = {
|
|
12
12
|
/\.otf$/,
|
13
13
|
/\.ttf$/,
|
14
14
|
/\.woff$/,
|
15
|
-
/\.woff2
|
15
|
+
/\.woff2$/,
|
16
|
+
/\.svg$/
|
16
17
|
],
|
17
18
|
exclude: [/\.(js|mjs|jsx|ts|tsx)$/],
|
18
|
-
type: 'asset/resource'
|
19
|
+
type: 'asset/resource',
|
20
|
+
generator: {
|
21
|
+
filename: 'media/images/[hash][ext][query]'
|
22
|
+
}
|
19
23
|
}
|
data/package/rules/index.js
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
/* eslint import/no-dynamic-require: 0 */
|
3
3
|
|
4
4
|
const rules = {
|
5
|
+
raw: require('./raw'),
|
5
6
|
file: require('./file'),
|
6
|
-
svg: require('./svg'),
|
7
7
|
css: require('./css'),
|
8
8
|
sass: require('./sass'),
|
9
9
|
babel: require('./babel'),
|
10
10
|
erb: require('./erb'),
|
11
11
|
coffee: require('./coffee'),
|
12
12
|
less: require('./less'),
|
13
|
-
|
13
|
+
stylus: require('./stylus')
|
14
14
|
}
|
15
15
|
|
16
16
|
module.exports = Object.keys(rules)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
const path = require('path')
|
2
|
+
const { canProcess } = require('../utils/helpers')
|
3
|
+
const getStyleRule = require('../utils/get_style_rule')
|
4
|
+
|
5
|
+
const {
|
6
|
+
additional_paths: paths,
|
7
|
+
source_path: sourcePath
|
8
|
+
} = require('../config')
|
9
|
+
|
10
|
+
module.exports = canProcess('stylus-loader', (resolvedPath) =>
|
11
|
+
getStyleRule(/\.(styl)(\.erb)?$/i, [
|
12
|
+
{
|
13
|
+
loader: resolvedPath,
|
14
|
+
options: {
|
15
|
+
stylusOptions: {
|
16
|
+
include: [
|
17
|
+
path.resolve(__dirname, 'node_modules'),
|
18
|
+
sourcePath,
|
19
|
+
...paths
|
20
|
+
]
|
21
|
+
},
|
22
|
+
sourceMap: true
|
23
|
+
}
|
24
|
+
}
|
25
|
+
])
|
26
|
+
)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webpacker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.0.beta.
|
4
|
+
version: 6.0.0.beta.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-12-
|
12
|
+
date: 2020-12-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -203,7 +203,7 @@ files:
|
|
203
203
|
- package/rules/less.js
|
204
204
|
- package/rules/raw.js
|
205
205
|
- package/rules/sass.js
|
206
|
-
- package/rules/
|
206
|
+
- package/rules/stylus.js
|
207
207
|
- package/utils/get_style_rule.js
|
208
208
|
- package/utils/helpers.js
|
209
209
|
- test/command_test.rb
|
@@ -250,8 +250,8 @@ homepage: https://github.com/rails/webpacker
|
|
250
250
|
licenses:
|
251
251
|
- MIT
|
252
252
|
metadata:
|
253
|
-
source_code_uri: https://github.com/rails/webpacker/tree/v6.0.0.beta.
|
254
|
-
changelog_uri: https://github.com/rails/webpacker/blob/v6.0.0.beta.
|
253
|
+
source_code_uri: https://github.com/rails/webpacker/tree/v6.0.0.beta.2
|
254
|
+
changelog_uri: https://github.com/rails/webpacker/blob/v6.0.0.beta.2/CHANGELOG.md
|
255
255
|
post_install_message:
|
256
256
|
rdoc_options: []
|
257
257
|
require_paths:
|
data/package/rules/svg.js
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
/* eslint global-require: 0 */
|
2
|
-
/* eslint import/no-dynamic-require: 0 */
|
3
|
-
const { moduleExists } = require('../utils/helpers')
|
4
|
-
|
5
|
-
module.exports = {
|
6
|
-
test: /\.svg$/i,
|
7
|
-
type: 'asset/inline',
|
8
|
-
generator: {
|
9
|
-
dataUrl: (content) => {
|
10
|
-
let optimisedContent = content
|
11
|
-
|
12
|
-
if (moduleExists('mini-svg-data-uri')) {
|
13
|
-
const svgToMiniDataURI = require('mini-svg-data-uri')
|
14
|
-
optimisedContent = svgToMiniDataURI(content.toString())
|
15
|
-
}
|
16
|
-
|
17
|
-
return optimisedContent
|
18
|
-
}
|
19
|
-
}
|
20
|
-
}
|