sdc-build-wp 4.5.5 → 4.5.7

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'), {
@@ -1,21 +1,25 @@
1
1
  import BaseComponent from './base.js';
2
- import { create as bsCreate } from 'browser-sync';
2
+ import { create } from 'browser-sync';
3
3
 
4
4
  export default class ServerComponent extends BaseComponent {
5
5
 
6
6
  constructor() {
7
7
  super();
8
8
  this.description = `Run a dev proxy server for live reloading`;
9
- this.server = bsCreate();
9
+ this.server = create('SDC WP Build Server');
10
10
  this.watchedFiles = [
11
- `${this.project.path}/${this.project.paths.dist}/**/*`,
12
- `!**/*.map`,
13
- `${this.project.path}/**/*.html`,
14
- `${this.project.path}/**/*.json`,
11
+ `${this.project.paths.dist}/**/*`,
12
+ `**/*.html`,
13
+ `**/*.json`
15
14
  ];
16
15
  if (!this.project.shouldPHPLint) {
17
- this.watchedFiles.push(`${this.project.path}/**/*.php`);
16
+ this.watchedFiles.push(`**/*.php`);
18
17
  }
18
+ this.ignoredFiles = [
19
+ `node_modules/**/*`,
20
+ `vendor/**/*`,
21
+ `**/*.map`
22
+ ];
19
23
  }
20
24
 
21
25
  async init() {
@@ -25,9 +29,15 @@ export default class ServerComponent extends BaseComponent {
25
29
  serve(watch = false) {
26
30
  let bsOptions = {
27
31
  logPrefix: '',
32
+ logFileChanges: false,
28
33
  port: this.project.package.sdc?.port || 3000,
29
34
  proxy: this.project.package.sdc?.browsersync?.localProxyURL,
30
35
  files: watch ? this.watchedFiles : [],
36
+ watchOptions: {
37
+ cwd: this.project.path,
38
+ ignored: this.ignoredFiles,
39
+ ignoreInitial: true
40
+ },
31
41
  reloadDelay: 250,
32
42
  reloadDebounce: 1000,
33
43
  reloadOnRestart: true,
@@ -65,9 +75,12 @@ export default class ServerComponent extends BaseComponent {
65
75
 
66
76
  async watch() {
67
77
  this.server.watch(this.watchedFiles, (event, file) => {
68
- if (event === 'change' || event === 'add') {
78
+ if (['add', 'addDir', 'change'].includes(event)) {
69
79
  this.server.reload(file);
70
- } else if (event === 'unlink') {
80
+ if (file.split('.').pop() == 'css') {
81
+ this.server.notify('Style injected', 500);
82
+ }
83
+ } else if (['unlink', 'unlinkDir'].includes(event)) {
71
84
  this.server.reload();
72
85
  }
73
86
  });
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.7",
4
4
  "description": "Custom WordPress build process.",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -23,25 +23,24 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@stylistic/stylelint-plugin": "^3.1.2",
26
- "@typescript-eslint/eslint-plugin": "^8.33.0",
27
- "@typescript-eslint/parser": "^8.33.0",
28
- "@wordpress/scripts": "^30.17.0",
26
+ "@typescript-eslint/eslint-plugin": "^8.35.0",
27
+ "@typescript-eslint/parser": "^8.35.0",
28
+ "@wordpress/scripts": "^30.19.0",
29
29
  "autoprefixer": "^10.4.21",
30
30
  "browser-sync": "^3.0.4",
31
31
  "chalk": "^5.4.1",
32
32
  "chokidar": "^4.0.3",
33
33
  "esbuild": "^0.25.5",
34
- "eslint": "^9.28.0",
34
+ "eslint": "^9.29.0",
35
35
  "fs-extra": "^11.3.0",
36
- "jiti": "^2.4.2",
37
36
  "minimist": "^1.2.8",
38
- "postcss": "^8.5.4",
37
+ "postcss": "^8.5.6",
39
38
  "postcss-scss": "^4.0.9",
40
39
  "postcss-sort-media-queries": "^5.2.0",
41
- "sass": "^1.89.1",
40
+ "sass": "^1.89.2",
42
41
  "sharp": "^0.34.2",
43
- "stylelint": "^16.20.0",
44
- "svgo": "^3.3.2",
42
+ "stylelint": "^16.21.0",
43
+ "svgo": "^4.0.0",
45
44
  "tail": "^2.2.6"
46
45
  }
47
46
  }