@pixolith/webpack-sw6-config 6.1.5 → 7.0.0

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.
package/package.json CHANGED
@@ -1,93 +1,95 @@
1
1
  {
2
- "name": "@pixolith/webpack-sw6-config",
3
- "public": true,
4
- "version": "6.1.5",
5
- "description": "",
6
- "main": "src/index.js",
7
- "scripts": {},
8
- "files": [
9
- "src/"
10
- ],
11
- "engines": {
12
- "node": ">=8.10.0"
13
- },
14
- "repository": {
15
- "type": "git",
16
- "url": "git+https://github.com/pixolith/webpack-plugins.git"
17
- },
18
- "author": "",
19
- "license": "MIT",
20
- "bugs": {
21
- "url": "https://github.com/pixolith/webpack-plugins/issues"
22
- },
23
- "homepage": "https://github.com/pixolith/webpack-plugins/tree/master/packages/webpack-hook-plugin/#readme",
24
- "gitHead": "47cfadc943f7467427b0cad68856eb09da1f5d77",
25
- "dependencies": {
26
- "@babel/core": "^7.16.12",
27
- "@babel/plugin-proposal-class-properties": "^7.16.7",
28
- "@babel/plugin-proposal-object-rest-spread": "^7.16.7",
29
- "@babel/plugin-proposal-optional-chaining": "^7.16.7",
30
- "@babel/plugin-syntax-dynamic-import": "^7.8.3",
31
- "@babel/plugin-transform-classes": "^7.16.7",
32
- "@babel/plugin-transform-runtime": "^7.16.10",
33
- "@babel/preset-env": "^7.16.11",
34
- "@pixolith/eslint-config-sw6": "^6.0.1",
35
- "@pixolith/external-svg-sprite-loader": "^6.0.1",
36
- "@pixolith/stylelint-config-standard": "^6.0.1",
37
- "@pixolith/webpack-assets-copy-plugin": "^6.0.1",
38
- "@pixolith/webpack-filename-linter-plugin": "^6.0.1",
39
- "@pixolith/webpack-hook-plugin": "^6.0.1",
40
- "@pixolith/webpack-twig-assets-emitter-plugin": "^6.1.0",
41
- "@pixolith/webpack-watcher": "^6.0.1",
42
- "autoprefixer": "^9.7.4",
43
- "babel-eslint": "^10.0.3",
44
- "babel-loader": "^8.2.3",
45
- "change-case": "^4.1.1",
46
- "chokidar": "^3.5.3",
47
- "concurrently": "^5.2.0",
48
- "consola": "^2.15.3",
49
- "core-js": "^3.20.3",
50
- "cross-env": "^7.0.3",
51
- "css-loader": "^3.4.2",
52
- "deepmerge": "^4.2.2",
53
- "eslint": "^6.8.0",
54
- "eslint-friendly-formatter": "^4.0.1",
55
- "eslint-loader": "^3.0.3",
56
- "eslint-plugin-filenames": "^1.3.2",
57
- "eslint-plugin-spellcheck": "0.0.19",
58
- "execa": "^4.0.0",
59
- "external-svg-sprite-loader": "^5.0.1",
60
- "extract-css-chunks-webpack-plugin": "^4.7.4",
61
- "file-loader": "^5.0.2",
62
- "glob": "^7.2.0",
63
- "html-loader": "^0.5.5",
64
- "optimize-css-assets-webpack-plugin": "^5.0.3",
65
- "postcss": "^7.0.26",
66
- "postcss-loader": "^3.0.0",
67
- "prettier": "^1.19.1",
68
- "rimraf": "^3.0.2",
69
- "sass": "^1.49.0",
70
- "sass-loader": "^10.2.0",
71
- "sass-resources-loader": "^2.2.4",
72
- "string-replace-loader": "^2.2.0",
73
- "style-loader": "^1.1.3",
74
- "stylelint": "^13.0.0",
75
- "stylelint-config-prettier": "^8.0.1",
76
- "stylelint-config-standard": "^19.0.0",
77
- "stylelint-prettier": "^1.1.2",
78
- "stylelint-webpack-plugin": "^1.2.1",
79
- "svg-sprite-loader": "^4.2.1",
80
- "svg-transform-loader": "^2.0.8",
81
- "svgo-loader": "^2.2.1",
82
- "terser-webpack-plugin": "^2.3.3",
83
- "time-fix-plugin": "^2.0.7",
84
- "url-loader": "^3.0.0",
85
- "webpack": "^4.41.5",
86
- "webpack-cli": "^3.3.10",
87
- "webpack-dev-server": "^3.10.1",
88
- "webpack-glob-entry": "^2.1.1",
89
- "webpack-merge": "^4.2.2",
90
- "webpackbar": "^4.0.0",
91
- "write-file-webpack-plugin": "^4.5.1"
92
- }
2
+ "name": "@pixolith/webpack-sw6-config",
3
+ "public": true,
4
+ "version": "7.0.0",
5
+ "description": "",
6
+ "main": "src/index.js",
7
+ "scripts": {},
8
+ "files": [
9
+ "src/"
10
+ ],
11
+ "engines": {
12
+ "node": ">=8.10.0"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/pixolith/webpack-plugins.git"
17
+ },
18
+ "author": "",
19
+ "license": "MIT",
20
+ "bugs": {
21
+ "url": "https://github.com/pixolith/webpack-plugins/issues"
22
+ },
23
+ "homepage": "https://github.com/pixolith/webpack-plugins/tree/master/packages/webpack-hook-plugin/#readme",
24
+ "gitHead": "15bac739d58808391fc621377b75bde5479639b5",
25
+ "dependencies": {
26
+ "@babel/core": "^7.21.3",
27
+ "@babel/eslint-parser": "^7.21.3",
28
+ "@babel/plugin-proposal-class-properties": "^7.18.6",
29
+ "@babel/plugin-proposal-object-rest-spread": "^7.20.7",
30
+ "@babel/plugin-proposal-optional-chaining": "^7.21.0",
31
+ "@babel/plugin-syntax-dynamic-import": "^7.8.3",
32
+ "@babel/plugin-transform-classes": "^7.21.0",
33
+ "@babel/plugin-transform-runtime": "^7.21.0",
34
+ "@babel/preset-env": "^7.20.2",
35
+ "@pixolith/eslint-config-sw6": "^7.0.0",
36
+ "@pixolith/external-svg-sprite-loader": "^6.0.1",
37
+ "@pixolith/stylelint-config-standard": "^7.0.0",
38
+ "@pixolith/webpack-assets-copy-plugin": "^7.0.0",
39
+ "@pixolith/webpack-filename-linter-plugin": "^7.0.0",
40
+ "@pixolith/webpack-hook-plugin": "^7.0.0",
41
+ "@pixolith/webpack-twig-assets-emitter-plugin": "^7.0.0",
42
+ "@pixolith/webpack-watcher": "^7.0.0",
43
+ "autoprefixer": "^10.4.14",
44
+ "babel-loader": "^9.1.2",
45
+ "change-case": "^4.1.2",
46
+ "chokidar": "^3.5.3",
47
+ "concurrently": "^7.6.0",
48
+ "consola": "^2.15.3",
49
+ "core-js": "^3.29.1",
50
+ "cross-env": "^7.0.3",
51
+ "css-loader": "^6.7.3",
52
+ "css-minimizer-webpack-plugin": "^4.2.2",
53
+ "deepmerge": "^4.3.0",
54
+ "eslint": "^8.36.0",
55
+ "eslint-friendly-formatter": "^4.0.1",
56
+ "eslint-plugin-filenames": "^1.3.2",
57
+ "eslint-plugin-spellcheck": "0.0.20",
58
+ "eslint-webpack-plugin": "^4.0.0",
59
+ "execa": "^7.1.1",
60
+ "external-svg-sprite-loader": "^7.2.0",
61
+ "extract-css-chunks-webpack-plugin": "^4.9.0",
62
+ "file-loader": "^6.2.0",
63
+ "glob": "^9.3.0",
64
+ "html-loader": "^4.2.0",
65
+ "media-query-plugin": "^1.5.0",
66
+ "postcss": "^8.4.21",
67
+ "postcss-loader": "^7.0.2",
68
+ "postcss-scss": "^4.0.6",
69
+ "prettier": "^2.8.4",
70
+ "rimraf": "^4.4.0",
71
+ "sass": "^1.59.3",
72
+ "sass-loader": "^13.2.0",
73
+ "sass-resources-loader": "^2.2.5",
74
+ "string-replace-loader": "^3.1.0",
75
+ "style-loader": "^3.3.2",
76
+ "stylelint": "^15.2.0",
77
+ "stylelint-config-standard": "^30.0.1",
78
+ "stylelint-config-standard-scss": "^7.0.1",
79
+ "stylelint-prettier": "^3.0.0",
80
+ "stylelint-webpack-plugin": "^4.1.0",
81
+ "svg-sprite-loader": "^6.0.11",
82
+ "svg-transform-loader": "^2.0.13",
83
+ "svgo-loader": "^4.0.0",
84
+ "terser-webpack-plugin": "^5.3.7",
85
+ "time-fix-plugin": "^2.0.7",
86
+ "url-loader": "^4.1.1",
87
+ "webpack": "^5.76.1",
88
+ "webpack-cli": "^5.0.1",
89
+ "webpack-dev-server": "^4.12.0",
90
+ "webpack-glob-entry": "^2.1.1",
91
+ "webpack-merge": "^5.8.0",
92
+ "webpackbar": "^5.0.2",
93
+ "write-file-webpack-plugin": "^4.5.1"
94
+ }
93
95
  }
package/src/index.js CHANGED
@@ -6,7 +6,7 @@ const isProd = process.env.NODE_ENV === 'production';
6
6
  const pkg = require('./../package.json');
7
7
  const isModern = process.env.MODE === 'modern';
8
8
  const watcher = require('@pixolith/webpack-watcher');
9
- const merge = require('webpack-merge');
9
+ const { merge } = require('webpack-merge');
10
10
  const Consola = require('consola');
11
11
 
12
12
  const setup = () => {
@@ -5,14 +5,11 @@ const Path = require('path'),
5
5
  entry = require('webpack-glob-entry'),
6
6
  publicPath = process.env.PUBLIC_PATH,
7
7
  spritePath = process.env.SPRITE_PATH ?? 'custom/plugins/PxswTheme/src/Resources/views/administration',
8
- swNodePath = process.env.SW_NODE_PATH ?? 'vendor/shopware/administration/Resources/app/administration/src',
9
- swAliasPath = process.env.SW_ALIAS_PATH ?? 'vendor/shopware/administration/Resources/app/administration/src',
10
8
  ExtractCssChunks = require('extract-css-chunks-webpack-plugin'),
11
9
  AssetsCopyPlugin = require('@pixolith/webpack-assets-copy-plugin'),
12
10
  isProd = process.env.NODE_ENV === 'production',
13
11
  SvgStorePlugin = require('@pixolith/external-svg-sprite-loader'),
14
12
  HookPlugin = require('@pixolith/webpack-hook-plugin'),
15
- //isModern = process.env.MODE === 'modern',
16
13
  outputPath = Path.resolve(process.cwd(), publicPath),
17
14
  outputConfig = {
18
15
  path: outputPath,
@@ -50,26 +47,6 @@ module.exports = {
50
47
 
51
48
  return { ...entriesPlugins };
52
49
  },
53
- performance: {
54
- maxEntrypointSize: 300000,
55
- hints: false,
56
- },
57
- resolve: {
58
- modules: [
59
- 'node_modules',
60
- Path.resolve(privatePath, 'js'),
61
- Path.resolve(
62
- process.cwd(),
63
- swNodePath,
64
- ),
65
- ],
66
- alias: {
67
- src: Path.join(
68
- process.cwd(),
69
- swAliasPath,
70
- ),
71
- },
72
- },
73
50
  module: {
74
51
  // loader order is from right to left or from bottom to top depending on the notation but basicly always reverse
75
52
  rules: [
@@ -82,28 +59,18 @@ module.exports = {
82
59
  },
83
60
  },
84
61
  {
85
- test: /\.png|\.jpg$/,
86
- use: [
87
- {
88
- loader: 'url-loader',
89
- options: {
90
- limit: 100000,
91
- outputPath: '../images',
92
- },
93
- },
94
- ],
62
+ test: /\.(jpe?g|png|gif|ico)(\?v=\d+\.\d+\.\d+)?$/,
63
+ type: 'asset/resource',
64
+ generator: {
65
+ filename: '../img/[name][ext]'
66
+ }
95
67
  },
96
68
  {
97
- test: /(\.woff|\.woff2)$/,
98
- use: [
99
- {
100
- loader: 'file-loader',
101
- options: {
102
- outputPath: '../fonts',
103
- name: '[name].[ext]',
104
- },
105
- },
106
- ],
69
+ test: /\.(eot|ttf|woff2?)(\?v=\d+\.\d+\.\d+)?$/,
70
+ type: 'asset/resource',
71
+ generator: {
72
+ filename: '../fonts/[name][ext]'
73
+ }
107
74
  },
108
75
  {
109
76
  test: /\.svg$/,
@@ -120,26 +87,23 @@ module.exports = {
120
87
  loader: 'svgo-loader',
121
88
  options: {
122
89
  plugins: [
123
- // don't enable this
124
- { removeViewBox: false },
125
- //
126
- { cleanupAttrs: true },
127
- { removeDoctype: true },
128
- { removeXMLProcInst: true },
129
- { cleanupEnableBackground: true },
130
- { convertStyleToAttrs: true },
131
- { convertPathData: true },
132
- { cleanupIDs: false },
133
- { minifyStyles: true },
134
- { removeUselessDefs: true },
135
- { convertShapeToPath: true },
136
- { removeUnusedNS: true },
137
- { removeDimensions: true },
138
- { convertTransform: true },
139
- { collapseGroups: true },
140
- { removeComments: true },
141
- { removeEditorsNSData: true },
142
- { removeUnknownsAndDefaults: true },
90
+ 'cleanupAttrs',
91
+ 'removeDoctype',
92
+ 'removeXMLProcInst',
93
+ 'cleanupEnableBackground',
94
+ 'convertStyleToAttrs',
95
+ 'convertPathData',
96
+ 'cleanupIds',
97
+ 'minifyStyles',
98
+ 'removeUselessDefs',
99
+ 'convertShapeToPath',
100
+ 'removeUnusedNS',
101
+ 'removeDimensions',
102
+ 'convertTransform',
103
+ 'collapseGroups',
104
+ 'removeComments',
105
+ 'removeEditorsNSData',
106
+ 'removeUnknownsAndDefaults',
143
107
  ],
144
108
  },
145
109
  },
@@ -3,15 +3,16 @@ const webpack = require('webpack'),
3
3
  Consola = require('consola'),
4
4
  fs = require('fs'),
5
5
  ASSET_URL = process.env.ASSET_URL || '/',
6
- OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin'),
6
+ CssMinimizerPlugin = require('css-minimizer-webpack-plugin'),
7
7
  StyleLintPlugin = require('stylelint-webpack-plugin'),
8
8
  isProd = process.env.NODE_ENV === 'production',
9
9
  privatePath = process.env.PLUGIN_PATH,
10
10
  ExtractCssChunks = require('extract-css-chunks-webpack-plugin'),
11
+ //MediaQueryPlugin = require('media-query-plugin'),
11
12
  FilenameLinterPlugin = require('@pixolith/webpack-filename-linter-plugin'),
13
+ ESLintPlugin = require('eslint-webpack-plugin'),
12
14
  watcher = require('@pixolith/webpack-watcher'),
13
15
  Glob = require('glob'),
14
- isModern = process.env.MODE === 'modern',
15
16
  HookPlugin = require('@pixolith/webpack-hook-plugin'),
16
17
  sass = require('sass'),
17
18
  TimeFixPlugin = require('time-fix-plugin');
@@ -38,16 +39,6 @@ module.exports = {
38
39
  module: {
39
40
  // loader order is from right to left or from bottom to top depending on the notation but basicly always reverse
40
41
  rules: [
41
- {
42
- enforce: 'pre',
43
- test: /\.js$/,
44
- loader: 'eslint-loader',
45
- exclude: (file) => /node_modules/.test(file),
46
- options: {
47
- formatter: require('eslint-friendly-formatter'),
48
- configFile: Path.resolve(__dirname, '.eslintrc.js'),
49
- },
50
- },
51
42
  {
52
43
  test: /(\.scss|\.css)$/,
53
44
  use: [
@@ -59,17 +50,13 @@ module.exports = {
59
50
  sourceMap: !isProd,
60
51
  },
61
52
  },
53
+ //{
54
+ // loader: MediaQueryPlugin.loader
55
+ //},
62
56
  {
63
57
  loader: 'postcss-loader',
64
58
  options: {
65
59
  sourceMap: !isProd,
66
- config: {
67
- path: Path.join(__dirname),
68
- ctx: {
69
- mode: process.env.SHOPWARE_MODE,
70
- isModern: isModern,
71
- },
72
- },
73
60
  },
74
61
  },
75
62
  {
@@ -91,6 +78,7 @@ module.exports = {
91
78
  ).filter((path) => {
92
79
  return Glob.sync(path).length > 0;
93
80
  }),
81
+ hoistUseStatements: true
94
82
  },
95
83
  },
96
84
  ],
@@ -166,6 +154,13 @@ module.exports = {
166
154
  },
167
155
  },
168
156
  plugins: [
157
+ new ESLintPlugin({
158
+ exclude: [
159
+ 'node_modules',
160
+ 'vendor/pxsw/enterprise-cms/node_modules',
161
+ 'vendor/shopware'
162
+ ]
163
+ }),
169
164
  new HookPlugin({
170
165
  beforeCompile(compiler, callback) {
171
166
  let path = Path.join(process.cwd(), 'public/sprite'),
@@ -191,7 +186,7 @@ module.exports = {
191
186
  }),
192
187
 
193
188
  new FilenameLinterPlugin({
194
- ignoreFiles: [/node_modules/, /custom\/apps/, /vendor\/shopware/, /.*\.plugin\.js/],
189
+ ignoreFiles: [/node_modules/, /custom\/apps/, /vendor\/shopware/],
195
190
  rules: {
196
191
  // check cases here https://github.com/blakeembrey/change-case
197
192
  scss: 'paramCase',
@@ -211,19 +206,17 @@ module.exports = {
211
206
  'process.env.ASSET_URL': JSON.stringify(ASSET_URL),
212
207
  }),
213
208
 
214
- new OptimizeCssAssetsPlugin({
215
- cssProcessor: require('cssnano'),
216
- cssProcessorOptions: {
217
- preset: [
218
- 'default',
219
- {
220
- discardComments: {
221
- removeAll: true,
222
- },
223
- },
224
- ],
225
- },
226
- }),
209
+ //new MediaQueryPlugin({
210
+ // include: [
211
+ // 'example'
212
+ // ],
213
+ // queries: {
214
+ // '@media(min-width:768px)': 'desktop',
215
+ // '@media(min-width:1024px)': 'desktop',
216
+ // '@media(min-width:1280px)': 'desktop',
217
+ // }
218
+ //}),
219
+ new CssMinimizerPlugin(),
227
220
  ].concat(
228
221
  Glob.sync(Path.join(privatePath, '/**/*.s?(a|c)ss')).length
229
222
  ? new StyleLintPlugin({
@@ -2,7 +2,7 @@ const webpack = require('webpack'),
2
2
  TerserPlugin = require('terser-webpack-plugin'),
3
3
  isModern = process.env.MODE === 'modern',
4
4
  config = {
5
- devtool: 'none',
5
+ devtool: 'nosources-source-map',
6
6
  performance: {
7
7
  maxEntrypointSize: 300000,
8
8
  maxAssetSize: 250000,
@@ -11,19 +11,17 @@ const webpack = require('webpack'),
11
11
  mode: 'production',
12
12
  optimization: {
13
13
  concatenateModules: true,
14
- namedModules: false,
15
14
  removeAvailableModules: true,
16
15
  removeEmptyChunks: true,
17
16
  sideEffects: false,
18
17
  minimizer: [
19
18
  new TerserPlugin({
20
19
  terserOptions: {
21
- extractComments: false,
22
20
  compress: {
23
21
  drop_console: true,
24
22
  },
25
23
  mangle: true,
26
- ecma: isModern ? 6 : 5, // specify one of: 5, 6, 7 or 8
24
+ ecma: isModern ? 8 : 5,
27
25
  keep_classnames: false,
28
26
  keep_fnames: false,
29
27
  ie8: false,
@@ -33,6 +31,7 @@ const webpack = require('webpack'),
33
31
  toplevel: false,
34
32
  warnings: false,
35
33
  },
34
+ extractComments: false,
36
35
  }),
37
36
  ],
38
37
  },
@@ -113,28 +113,18 @@ module.exports = {
113
113
  ],
114
114
  },
115
115
  {
116
- test: /\.png|\.jpg$/,
117
- use: [
118
- {
119
- loader: 'url-loader',
120
- options: {
121
- limit: 100000,
122
- outputPath: 'images',
123
- },
124
- },
125
- ],
116
+ test: /\.(jpe?g|png|gif|ico)(\?v=\d+\.\d+\.\d+)?$/,
117
+ type: 'asset/resource',
118
+ generator: {
119
+ filename: 'img/[name][ext]'
120
+ }
126
121
  },
127
122
  {
128
- test: /(\.woff|\.woff2)$/,
129
- use: [
130
- {
131
- loader: 'file-loader',
132
- options: {
133
- outputPath: 'fonts',
134
- name: '[name].[ext]',
135
- },
136
- },
137
- ],
123
+ test: /\.(eot|ttf|woff2?)(\?v=\d+\.\d+\.\d+)?$/,
124
+ type: 'asset/resource',
125
+ generator: {
126
+ filename: 'fonts/[name][ext]'
127
+ }
138
128
  },
139
129
  {
140
130
  test: /\.svg$/,
@@ -151,26 +141,23 @@ module.exports = {
151
141
  loader: 'svgo-loader',
152
142
  options: {
153
143
  plugins: [
154
- // don't enable this
155
- { removeViewBox: false },
156
- //
157
- { cleanupAttrs: true },
158
- { removeDoctype: true },
159
- { removeXMLProcInst: true },
160
- { cleanupEnableBackground: true },
161
- { convertStyleToAttrs: true },
162
- { convertPathData: true },
163
- { cleanupIDs: false },
164
- { minifyStyles: true },
165
- { removeUselessDefs: true },
166
- { convertShapeToPath: true },
167
- { removeUnusedNS: true },
168
- { removeDimensions: true },
169
- { convertTransform: true },
170
- { collapseGroups: true },
171
- { removeComments: true },
172
- { removeEditorsNSData: true },
173
- { removeUnknownsAndDefaults: true },
144
+ 'cleanupAttrs',
145
+ 'removeDoctype',
146
+ 'removeXMLProcInst',
147
+ 'cleanupEnableBackground',
148
+ 'convertStyleToAttrs',
149
+ 'convertPathData',
150
+ 'cleanupIds',
151
+ 'minifyStyles',
152
+ 'removeUselessDefs',
153
+ 'convertShapeToPath',
154
+ 'removeUnusedNS',
155
+ 'removeDimensions',
156
+ 'convertTransform',
157
+ 'collapseGroups',
158
+ 'removeComments',
159
+ 'removeEditorsNSData',
160
+ 'removeUnknownsAndDefaults',
174
161
  ],
175
162
  },
176
163
  },