sdc-build-wp 4.5.5 → 4.5.6

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.
@@ -8,6 +8,7 @@ export default class ImagesComponent extends BaseComponent {
8
8
  constructor() {
9
9
  super();
10
10
  this.description = `Compress image files`;
11
+ this.compressableFileFormats = ['.jpg', '.jpeg', '.png', '.svg'];
11
12
  }
12
13
 
13
14
  async init() {
@@ -33,12 +34,13 @@ export default class ImagesComponent extends BaseComponent {
33
34
  for (const file of files) {
34
35
  const filePath = this.path.join(entry, file);
35
36
  const destFilePath = `${dest}/${this.path.basename(file)}`;
36
- if (this.path.extname(file).toLowerCase() == '.webmanifest') {
37
- await fs.copyFile(filePath, destFilePath);
38
- copiedFilesCount++;
37
+ if (!this.compressableFileFormats.includes(this.path.extname(file).toLowerCase())) {
38
+ if (this.path.extname(file)) {
39
+ await fs.copyFile(filePath, destFilePath);
40
+ copiedFilesCount++;
41
+ }
39
42
  continue;
40
43
  }
41
- if (!['.jpg', '.jpeg', '.png', '.svg'].includes(this.path.extname(file).toLowerCase())) { continue; }
42
44
  try {
43
45
  if (this.path.extname(file) == '.svg') {
44
46
  const result = optimize(await fs.readFile(filePath, 'utf8'), {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sdc-build-wp",
3
- "version": "4.5.5",
3
+ "version": "4.5.6",
4
4
  "description": "Custom WordPress build process.",
5
5
  "engines": {
6
6
  "node": ">=22"