@pixolith/webpack-sw6-config 7.0.7 → 7.1.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,7 +1,7 @@
1
1
  {
2
2
  "name": "@pixolith/webpack-sw6-config",
3
3
  "public": true,
4
- "version": "7.0.7",
4
+ "version": "7.1.0",
5
5
  "description": "",
6
6
  "main": "src/index.js",
7
7
  "scripts": {},
@@ -21,21 +21,22 @@
21
21
  "url": "https://github.com/pixolith/webpack-plugins/issues"
22
22
  },
23
23
  "homepage": "https://github.com/pixolith/webpack-plugins/tree/master/packages/webpack-hook-plugin/#readme",
24
- "gitHead": "78ed65601ed89ebc70b2faa41f3f1a6be5f3e11a",
24
+ "gitHead": "d1c8c9bce9e830dca447d2faff20a857bce9e771",
25
25
  "dependencies": {
26
- "@babel/core": "^7.21.3",
27
- "@babel/eslint-parser": "^7.21.3",
26
+ "@babel/core": "^7.22.1",
27
+ "@babel/eslint-parser": "^7.21.8",
28
28
  "@babel/plugin-proposal-class-properties": "^7.18.6",
29
29
  "@babel/plugin-proposal-object-rest-spread": "^7.20.7",
30
30
  "@babel/plugin-proposal-optional-chaining": "^7.21.0",
31
31
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
32
32
  "@babel/plugin-transform-classes": "^7.21.0",
33
- "@babel/plugin-transform-runtime": "^7.21.0",
34
- "@babel/preset-env": "^7.20.2",
33
+ "@babel/plugin-transform-runtime": "^7.22.4",
34
+ "@babel/preset-env": "^7.22.4",
35
+ "@babel/preset-typescript": "^7.21.5",
35
36
  "@pixolith/eslint-config-sw6": "^7.0.6",
36
- "@pixolith/external-svg-sprite-loader": "^6.0.1",
37
+ "@pixolith/external-svg-sprite-loader": "^7.0.0",
37
38
  "@pixolith/stylelint-config-standard": "^7.0.7",
38
- "@pixolith/webpack-assets-copy-plugin": "^7.0.0",
39
+ "@pixolith/webpack-assets-copy-plugin": "^7.1.0",
39
40
  "@pixolith/webpack-filename-linter-plugin": "^7.0.0",
40
41
  "@pixolith/webpack-hook-plugin": "^7.0.0",
41
42
  "@pixolith/webpack-twig-assets-emitter-plugin": "^7.0.0",
@@ -44,54 +45,51 @@
44
45
  "babel-loader": "^9.1.2",
45
46
  "change-case": "^4.1.2",
46
47
  "chokidar": "^3.5.3",
47
- "concurrently": "^7.6.0",
48
- "consola": "^2.15.3",
49
- "core-js": "^3.29.1",
48
+ "concurrently": "^8.1.0",
49
+ "consola": "^3.1.0",
50
+ "core-js": "^3.30.2",
50
51
  "cross-env": "^7.0.3",
51
- "css-loader": "^6.7.3",
52
- "css-minimizer-webpack-plugin": "^4.2.2",
53
- "cssnano-preset-advanced": "^6.0.0",
54
- "deepmerge": "^4.3.0",
55
- "eslint": "^8.36.0",
52
+ "css-loader": "^6.8.1",
53
+ "css-minimizer-webpack-plugin": "^5.0.0",
54
+ "deepmerge": "^4.3.1",
55
+ "eslint": "^8.42.0",
56
56
  "eslint-friendly-formatter": "^4.0.1",
57
57
  "eslint-plugin-filenames": "^1.3.2",
58
58
  "eslint-plugin-spellcheck": "0.0.20",
59
- "eslint-webpack-plugin": "^4.0.0",
59
+ "eslint-webpack-plugin": "^4.0.1",
60
60
  "execa": "^7.1.1",
61
61
  "external-svg-sprite-loader": "^7.2.0",
62
62
  "extract-css-chunks-webpack-plugin": "^4.9.0",
63
63
  "file-loader": "^6.2.0",
64
- "glob": "^9.3.0",
64
+ "glob": "^10.2.7",
65
65
  "html-loader": "^4.2.0",
66
66
  "media-query-plugin": "^1.5.0",
67
- "postcss": "^8.4.21",
68
- "postcss-loader": "^7.0.2",
69
- "postcss-pxtorem": "^6.0.0",
67
+ "postcss": "^8.4.24",
68
+ "postcss-loader": "^7.3.2",
70
69
  "postcss-scss": "^4.0.6",
71
- "prettier": "^2.8.4",
72
- "process": "^0.11.10",
73
- "rimraf": "^4.4.0",
74
- "sass": "^1.59.3",
75
- "sass-loader": "^13.2.0",
70
+ "prettier": "^2.8.8",
71
+ "rimraf": "^5.0.1",
72
+ "sass": "^1.62.1",
73
+ "sass-loader": "^13.3.1",
76
74
  "sass-resources-loader": "^2.2.5",
77
75
  "string-replace-loader": "^3.1.0",
78
- "style-loader": "^3.3.2",
79
- "stylelint": "^15.2.0",
80
- "stylelint-config-standard": "^30.0.1",
81
- "stylelint-config-standard-scss": "^7.0.1",
76
+ "style-loader": "^3.3.3",
77
+ "stylelint": "^15.7.0",
78
+ "stylelint-config-standard": "^33.0.0",
79
+ "stylelint-config-standard-scss": "^9.0.0",
82
80
  "stylelint-prettier": "^3.0.0",
83
- "stylelint-webpack-plugin": "^4.1.0",
81
+ "stylelint-webpack-plugin": "^4.1.1",
84
82
  "svg-sprite-loader": "^6.0.11",
85
83
  "svg-transform-loader": "^2.0.13",
86
84
  "svgo-loader": "^4.0.0",
87
- "terser-webpack-plugin": "^5.3.7",
85
+ "terser-webpack-plugin": "^5.3.9",
88
86
  "time-fix-plugin": "^2.0.7",
89
87
  "url-loader": "^4.1.1",
90
- "webpack": "^5.76.1",
91
- "webpack-cli": "^5.0.1",
92
- "webpack-dev-server": "^4.12.0",
88
+ "webpack": "^5.85.1",
89
+ "webpack-cli": "^5.1.3",
90
+ "webpack-dev-server": "^4.15.0",
93
91
  "webpack-glob-entry": "^2.1.1",
94
- "webpack-merge": "^5.8.0",
92
+ "webpack-merge": "^5.9.0",
95
93
  "webpackbar": "^5.0.2",
96
94
  "write-file-webpack-plugin": "^4.5.1"
97
95
  }
@@ -0,0 +1,22 @@
1
+ module.exports = ({ file, options, env }) => {
2
+ return {
3
+ plugins: {
4
+ // to edit target browsers: use "browserslist" field in package.json
5
+ autoprefixer: {
6
+ grid: true,
7
+ env: options.mode + (options.isModern ? ':modern' : ''),
8
+ },
9
+ cssnano: {
10
+ preset: [
11
+ 'default',
12
+ {
13
+ discardComments: {
14
+ removeAll: true,
15
+ },
16
+ },
17
+ ],
18
+ zindex: false,
19
+ },
20
+ },
21
+ };
22
+ };
@@ -1,21 +1,10 @@
1
1
  module.exports = {
2
2
  presets: [
3
- [
4
- '@babel/preset-env',
5
- {
6
- shippedProposals: true,
7
- corejs: 3,
8
- debug: false,
9
- useBuiltIns: 'usage',
10
- },
11
- ],
12
- ],
13
- plugins: [
14
- '@babel/syntax-dynamic-import',
15
- '@babel/plugin-transform-runtime',
16
- '@babel/proposal-object-rest-spread',
17
- '@babel/plugin-proposal-class-properties',
18
- '@babel/plugin-transform-classes',
19
- '@babel/plugin-proposal-optional-chaining',
20
- ],
3
+ ['@babel/preset-env', {
4
+ useBuiltIns: 'entry',
5
+ corejs: '3.27',
6
+ bugfixes: true,
7
+ }],
8
+ '@babel/preset-typescript',
9
+ ]
21
10
  };
@@ -166,8 +166,8 @@ module.exports = {
166
166
  files: [
167
167
  {
168
168
  from: publicPath,
169
- to: 'custom/plugins/$plugin/src/Resources/public',
170
- replace: (fromPath, toPath) => {
169
+ to: 'custom/$pluginFolder/$plugin/src/Resources/public',
170
+ replace: async (fromPath, toPath) => {
171
171
  let pluginName = changeCase.pascalCase(
172
172
  Path.basename(fromPath).replace(
173
173
  Path.extname(fromPath),
@@ -175,6 +175,11 @@ module.exports = {
175
175
  ),
176
176
  );
177
177
 
178
+ const pluginOrStaticPlugin = await Fs.existsSync('custom/plugins/$plugin/src'.replace('$plugin', pluginName));
179
+
180
+ let pluginFolder = pluginOrStaticPlugin ? 'plugins' : 'static-plugins';
181
+
182
+ toPath = toPath.replace('$pluginFolder', pluginFolder);
178
183
  toPath = toPath.replace('$plugin', pluginName);
179
184
  return toPath;
180
185
  },
@@ -3,6 +3,7 @@ const webpack = require('webpack'),
3
3
  Consola = require('consola'),
4
4
  fs = require('fs'),
5
5
  ASSET_URL = process.env.ASSET_URL || '/',
6
+ CssMinimizerPlugin = require('css-minimizer-webpack-plugin'),
6
7
  StyleLintPlugin = require('stylelint-webpack-plugin'),
7
8
  isProd = process.env.NODE_ENV === 'production',
8
9
  privatePath = process.env.PLUGIN_PATH,
@@ -56,9 +57,6 @@ module.exports = {
56
57
  loader: 'postcss-loader',
57
58
  options: {
58
59
  sourceMap: !isProd,
59
- postcssOptions: {
60
- config: Path.resolve(__dirname, 'postcss.config.js'),
61
- },
62
60
  },
63
61
  },
64
62
  {
@@ -93,22 +91,29 @@ module.exports = {
93
91
  },
94
92
  ],
95
93
  },
94
+ {
95
+ test: /\.js$/,
96
+ loader: 'string-replace-loader',
97
+ options: {
98
+ search:
99
+ "import PluginManager from 'src/plugin-system/plugin.manager'",
100
+ //match, p1, offset, string
101
+ replace: () => 'const PluginManager = window.PluginManager',
102
+ flags: 'g',
103
+ },
104
+ },
96
105
  ],
97
106
  },
98
- stats: 'errors-warnings',
99
107
  devServer: {
100
- allowedHosts: 'all',
101
- client: {
102
- webSocketURL: {
103
- hostname: 'node.px-staging.de',
104
- protocol: 'wss',
105
- port: 8080,
106
- },
107
- overlay: {
108
- warnings: false,
109
- errors: true,
110
- },
108
+ disableHostCheck: true,
109
+ sockHost: 'node.px-staging.de',
110
+ watchContentBase: false,
111
+ sockPort: 8080,
112
+ overlay: {
113
+ warnings: false,
114
+ errors: true,
111
115
  },
116
+ writeToDisk: true,
112
117
  headers: {
113
118
  'Access-Control-Allow-Origin': '*',
114
119
  'Access-Control-Allow-Methods':
@@ -116,35 +121,30 @@ module.exports = {
116
121
  'Access-Control-Allow-Headers':
117
122
  'X-Requested-With, content-type, Authorization',
118
123
  },
119
- server: !isProd
124
+ stats: 'errors-warnings',
125
+ https: !isProd
120
126
  ? {
121
- type: 'https',
122
- options: {
123
- ca: fs.readFileSync(
124
- Path.join(
125
- process.cwd() +
126
- '/.ddev/ssl/_wildcard.px-staging.de+1-client.pem',
127
- ),
128
- ),
129
- key: fs.readFileSync(
130
- Path.join(
131
- process.cwd() +
132
- '/.ddev/ssl/_wildcard.px-staging.de+1-key.pem',
133
- ),
134
- ),
135
- cert: fs.readFileSync(
136
- Path.join(
137
- process.cwd() +
138
- '/.ddev/ssl/_wildcard.px-staging.de+1.pem',
139
- ),
140
- ),
141
- }
142
- }
143
- : 'http',
144
- devMiddleware: {
145
- writeToDisk: true,
146
- },
147
- onAfterSetupMiddleware: function(devServer) {
127
+ ca: fs.readFileSync(
128
+ Path.join(
129
+ process.cwd() +
130
+ '/.ddev/ssl/_wildcard.px-staging.de+1-client.pem',
131
+ ),
132
+ ),
133
+ key: fs.readFileSync(
134
+ Path.join(
135
+ process.cwd() +
136
+ '/.ddev/ssl/_wildcard.px-staging.de+1-key.pem',
137
+ ),
138
+ ),
139
+ cert: fs.readFileSync(
140
+ Path.join(
141
+ process.cwd() +
142
+ '/.ddev/ssl/_wildcard.px-staging.de+1.pem',
143
+ ),
144
+ ),
145
+ }
146
+ : false,
147
+ after() {
148
148
  if (!isProd) {
149
149
  Consola.success(
150
150
  `Starting webpack in [${process.env.NODE_ENV}] with [${process.env.SHOPWARE_MODE}]`,
@@ -156,8 +156,9 @@ module.exports = {
156
156
  plugins: [
157
157
  new ESLintPlugin({
158
158
  exclude: [
159
- '**/node_modules/**',
160
- 'vendor'
159
+ 'node_modules',
160
+ 'vendor/pxsw/enterprise-cms/node_modules',
161
+ 'vendor/shopware'
161
162
  ]
162
163
  }),
163
164
  new HookPlugin({
@@ -185,7 +186,7 @@ module.exports = {
185
186
  }),
186
187
 
187
188
  new FilenameLinterPlugin({
188
- ignoreFiles: [/node_modules/, /custom\/apps/, /vendor/],
189
+ ignoreFiles: [/node_modules/, /custom\/apps/, /vendor\/shopware/, /vendor\/store.shopware.com/],
189
190
  rules: {
190
191
  // check cases here https://github.com/blakeembrey/change-case
191
192
  scss: 'paramCase',
@@ -195,6 +196,7 @@ module.exports = {
195
196
  svg: 'paramCase',
196
197
  },
197
198
  }),
199
+
198
200
  new TimeFixPlugin(),
199
201
 
200
202
  new webpack.DefinePlugin({
@@ -214,15 +216,17 @@ module.exports = {
214
216
  // '@media(min-width:1280px)': 'desktop',
215
217
  // }
216
218
  //}),
219
+ new CssMinimizerPlugin(),
217
220
  ].concat(
218
221
  Glob.sync(Path.join(privatePath, '/**/*.s?(a|c)ss')).length
219
222
  ? new StyleLintPlugin({
220
- files: '**/Pxsw*/**/*.s?(a|c)ss',
221
- failOnError: false,
222
- fix: false,
223
- configFile: Path.join(__dirname, 'stylelint.config.js'),
224
- })
223
+ files: '**/Pxsw*/**/*.s?(a|c)ss',
224
+ failOnError: false,
225
+ fix: false,
226
+ configFile: Path.join(__dirname, 'stylelint.config.js'),
227
+ })
225
228
  : [],
226
229
  ),
227
230
  watch: false,
231
+ stats: 'errors-warnings',
228
232
  };
@@ -1,6 +1,5 @@
1
1
  const webpack = require('webpack'),
2
2
  TerserPlugin = require('terser-webpack-plugin'),
3
- CssMinimizerPlugin = require('css-minimizer-webpack-plugin'),
4
3
  isModern = process.env.MODE === 'modern',
5
4
  config = {
6
5
  devtool: 'nosources-source-map',
@@ -15,21 +14,7 @@ const webpack = require('webpack'),
15
14
  removeAvailableModules: true,
16
15
  removeEmptyChunks: true,
17
16
  sideEffects: false,
18
- minimize: true,
19
17
  minimizer: [
20
- new CssMinimizerPlugin({
21
- minimizerOptions: {
22
- preset: [
23
- "advanced",
24
- {
25
- zIndex: false,
26
- },
27
- ],
28
- },
29
- minify: [
30
- CssMinimizerPlugin.cssnanoMinify,
31
- ]
32
- }),
33
18
  new TerserPlugin({
34
19
  terserOptions: {
35
20
  compress: {
@@ -1,15 +0,0 @@
1
- module.exports = ({ file, options, env }) => {
2
- return {
3
- plugins: {
4
- // to edit target browsers: use "browserslist" field in package.json
5
- autoprefixer: {
6
- env: options.mode + (options.isModern ? ':modern' : ''),
7
- },
8
- 'postcss-pxtorem': {
9
- rootValue: 16,
10
- unitPrecision: 5,
11
- propList: ['*']
12
- }
13
- },
14
- };
15
- };