@pixolith/webpack-sw6-config 8.1.6 → 8.2.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": "8.1.6",
4
+ "version": "8.2.0",
5
5
  "description": "",
6
6
  "main": "src/index.js",
7
7
  "scripts": {},
@@ -21,7 +21,7 @@
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": "29093a6ab1223007b4e1e8a5752a5f40b69570c3",
24
+ "gitHead": "599d1595463fb7783af832b4c804a990d6fd9a8c",
25
25
  "dependencies": {
26
26
  "@babel/cli": "7.23.4",
27
27
  "@babel/core": "^7.23.7",
@@ -30,7 +30,7 @@
30
30
  "@babel/preset-env": "7.23.7",
31
31
  "@babel/preset-typescript": "7.23.3",
32
32
  "@pixolith/eslint-config-sw6": "^8.0.0",
33
- "@pixolith/external-svg-sprite-loader": "^8.0.0",
33
+ "@pixolith/external-svg-sprite-loader": "^8.2.0",
34
34
  "@pixolith/stylelint-config-standard": "^8.0.0",
35
35
  "@pixolith/webpack-assets-copy-plugin": "^8.0.0",
36
36
  "@pixolith/webpack-filename-linter-plugin": "^8.0.0",
@@ -4,14 +4,14 @@ const Path = require('path'),
4
4
  privatePath = process.env.PLUGIN_PATH,
5
5
  vendorPath = process.env.VENDOR_PATH,
6
6
  publicPath = process.env.PUBLIC_PATH,
7
- spritePath = process.env.SPRITE_PATH ?? 'custom/static-plugins/PxswTheme/src/Resources/views/administration',
7
+ spriteOrder = process.env.SPRITE_ORDER ?? ['pxsw/basic-theme', 'PxswBasicTheme', '**', 'pxsw/customer-theme', 'PxswCustomerTheme'],
8
+ ignoreIcons = process.env.IGNORE_ICONS ?? [],
8
9
  isProd = process.env.NODE_ENV === 'production',
9
10
  ChangeCase = require('change-case'),
10
11
  MiniCssExtractPlugin = require('mini-css-extract-plugin'),
11
12
  Consola = require('consola'),
12
13
  AssetsCopyPlugin = require('@pixolith/webpack-assets-copy-plugin'),
13
14
  SvgStorePlugin = require('@pixolith/external-svg-sprite-loader'),
14
- HookPlugin = require('@pixolith/webpack-hook-plugin'),
15
15
  outputPath = Path.resolve(process.cwd(), publicPath),
16
16
  outputConfig = {
17
17
  path: outputPath,
@@ -96,9 +96,11 @@ module.exports = {
96
96
  {
97
97
  loader: SvgStorePlugin.loader,
98
98
  options: {
99
- name: 'sprite/sprite_uses.svg',
99
+ name: 'sprite/sprite.svg',
100
100
  iconName: '[name]',
101
- onlySymbols: false,
101
+ overrideOrder: spriteOrder,
102
+ ignoreIconsByName: ignoreIcons,
103
+ onlySymbols: true,
102
104
  },
103
105
  },
104
106
  {
@@ -131,70 +133,13 @@ module.exports = {
131
133
  },
132
134
  output: outputConfig,
133
135
  plugins: [
134
- new HookPlugin({
135
- beforeCompile(compiler, callback) {
136
- let path = Path.join(process.cwd(), publicPath, 'sprite'),
137
- filename = 'sprite_uses.svg',
138
- exists = Fs.existsSync(Path.join(path, filename));
139
-
140
- if (!exists) {
141
- Fs.mkdirSync(path, {
142
- recursive: true,
143
- });
144
- Fs.appendFile(Path.join(path, filename), '#', (err) => {
145
- if (err) {
146
- throw err;
147
- }
148
- });
149
- }
150
-
151
- callback();
152
- },
153
-
154
- afterEmit(compiler, callback) {
155
- let spriteInputPath = Path.join(
156
- process.cwd(),
157
- publicPath,
158
- 'sprite/sprite_uses.svg',
159
- );
160
- let spriteOutputPath = Path.join(
161
- process.cwd(),
162
- spritePath,
163
- ),
164
- spritOutputFilename = '_sprite_uses.svg';
165
-
166
- let exists = Fs.existsSync(spriteOutputPath);
167
-
168
- if (!exists) {
169
- Fs.mkdirSync(spriteOutputPath, {
170
- recursive: true,
171
- });
172
- }
173
-
174
- Fs.copyFileSync(
175
- spriteInputPath,
176
- Path.join(spriteOutputPath, spritOutputFilename),
177
- );
178
- callback();
179
- },
180
- }),
181
-
182
- new SvgStorePlugin({
183
- sprite: {
184
- startX: 10,
185
- startY: 10,
186
- deltaX: 20,
187
- deltaY: 20,
188
- iconHeight: 48,
189
- },
190
- }),
191
-
136
+ new SvgStorePlugin(),
192
137
  new MiniCssExtractPlugin(miniCssChunksConfig),
193
138
  ].concat(
194
139
  isProd ?
195
140
  new AssetsCopyPlugin({
196
141
  includes: ['js', 'css'],
197
- ignoreFiles: [/[-\w.]*.hot-update.js/, /sprite\/sprite_uses.svg/],
142
+ ignoreFiles: [/[-\w.]*.hot-update.js/],
198
143
  files: [
199
144
  {
200
145
  from: publicPath,
@@ -3,7 +3,8 @@ const Path = require('path'),
3
3
  MiniCssExtractPlugin = require('mini-css-extract-plugin'),
4
4
  privatePath = process.env.PLUGIN_PATH,
5
5
  vendorPath = process.env.VENDOR_PATH,
6
- spritePath = process.env.SPRITE_PATH ?? 'custom/static-plugins/PxswTheme/src/Resources/views/storefront',
6
+ spriteOrder = process.env.SPRITE_ORDER ?? ['pxsw/basic-theme', 'PxswBasicTheme', '**', 'pxsw/customer-theme', 'PxswCustomerTheme'],
7
+ ignoreIcons = process.env.IGNORE_ICONS ?? [],
7
8
  swNodePath = process.env.SW_NODE_PATH ?? './vendor/shopware/storefront/Resources/app/storefront/vendor',
8
9
  swAliasPath = process.env.SW_ALIAS_PATH ?? '/vendor/shopware/storefront/Resources/app/storefront/src',
9
10
  isProd = process.env.NODE_ENV === 'production',
@@ -14,7 +15,6 @@ const Path = require('path'),
14
15
  SvgStorePlugin = require('@pixolith/external-svg-sprite-loader'),
15
16
  publicPath = process.env.PUBLIC_PATH,
16
17
  ASSET_URL = process.env.ASSET_URL || '/',
17
- HookPlugin = require('@pixolith/webpack-hook-plugin'),
18
18
  outputConfig = {
19
19
  path: Path.join(process.cwd(), publicPath),
20
20
  publicPath: ASSET_URL,
@@ -132,6 +132,8 @@ module.exports = {
132
132
  options: {
133
133
  name: 'sprite/sprite.svg',
134
134
  iconName: '[name]',
135
+ overrideOrder: spriteOrder,
136
+ ignoreIconsByName: ignoreIcons,
135
137
  onlySymbols: true,
136
138
  },
137
139
  },
@@ -165,68 +167,12 @@ module.exports = {
165
167
  },
166
168
  output: outputConfig,
167
169
  plugins: [
168
- new HookPlugin({
169
- beforeCompile(compiler, callback) {
170
- let path = Path.join(process.cwd(), publicPath, 'sprite'),
171
- filename = 'sprite.svg',
172
- exists = Fs.existsSync(Path.join(path, filename));
173
-
174
- if (!exists) {
175
- Fs.mkdirSync(path, {
176
- recursive: true,
177
- });
178
- Fs.appendFile(Path.join(path, filename), '#', (err) => {
179
- if (err) {
180
- throw err;
181
- }
182
- });
183
- }
184
-
185
- callback();
186
- },
187
-
188
- afterEmit(compiler, callback) {
189
- let spriteInputPath = Path.join(
190
- process.cwd(),
191
- publicPath,
192
- 'sprite/sprite.svg',
193
- );
194
- let spriteOutputPath = Path.join(
195
- process.cwd(),
196
- spritePath,
197
- ),
198
- spritOutputFilename = '_sprite.svg';
199
-
200
- let exists = Fs.existsSync(spriteOutputPath);
201
-
202
- if (!exists) {
203
- Fs.mkdirSync(spriteOutputPath, {
204
- recursive: true,
205
- });
206
- }
207
-
208
- Fs.copyFileSync(
209
- spriteInputPath,
210
- Path.join(spriteOutputPath, spritOutputFilename),
211
- );
212
- callback();
213
- },
214
- }),
215
-
216
170
  new Sw6PluginMapEmitterPlugin({
217
171
  includes: ['js', 'css'],
218
172
  ignoreFiles: [/.*icons.*\.js/, /.*chunk.*\.js/],
219
173
  }),
220
174
 
221
- new SvgStorePlugin({
222
- sprite: {
223
- startX: 10,
224
- startY: 10,
225
- deltaX: 20,
226
- deltaY: 20,
227
- iconHeight: 48,
228
- },
229
- }),
175
+ new SvgStorePlugin(),
230
176
 
231
177
  new MiniCssExtractPlugin(miniCssChunksConfig),
232
178
  ],