sdc-build-wp 4.3.5 → 4.4.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/eslint.config.js +15 -13
- package/lib/components/scripts.js +7 -8
- package/lib/components/style.js +4 -2
- package/package.json +10 -7
package/eslint.config.js
CHANGED
@@ -1,23 +1,25 @@
|
|
1
|
-
|
1
|
+
import { defineConfig } from 'eslint/config';
|
2
|
+
|
3
|
+
export default defineConfig([
|
2
4
|
{
|
3
5
|
languageOptions: {
|
4
6
|
parserOptions: {
|
5
|
-
ecmaVersion:
|
6
|
-
sourceType:
|
7
|
+
ecmaVersion: 'latest',
|
8
|
+
sourceType: 'module',
|
7
9
|
ecmaFeatures: {
|
8
|
-
jsx: true
|
9
|
-
}
|
10
|
-
}
|
10
|
+
jsx: true
|
11
|
+
}
|
12
|
+
}
|
11
13
|
},
|
12
14
|
rules: {
|
13
15
|
semi: 1,
|
14
|
-
indent: [1,
|
15
|
-
|
16
|
+
indent: [1, 'tab'],
|
17
|
+
'no-multiple-empty-lines': [
|
16
18
|
1,
|
17
19
|
{
|
18
|
-
max: 1
|
19
|
-
}
|
20
|
-
]
|
21
|
-
}
|
20
|
+
max: 1
|
21
|
+
}
|
22
|
+
]
|
23
|
+
}
|
22
24
|
}
|
23
|
-
];
|
25
|
+
]);
|
@@ -7,14 +7,14 @@ export default class ScriptsComponent extends BaseComponent {
|
|
7
7
|
|
8
8
|
constructor() {
|
9
9
|
super();
|
10
|
-
this.description = `Process
|
10
|
+
this.description = `Process script files`;
|
11
11
|
}
|
12
12
|
|
13
13
|
async init() {
|
14
|
-
this.files = this.utils.addEntriesByFiletypes(['.js']);
|
14
|
+
this.files = this.utils.addEntriesByFiletypes(['.js', '.jsx', '.ts', '.tsx']);
|
15
15
|
this.globs = await Array.fromAsync(
|
16
|
-
this.glob(this.project.package?.sdc?.
|
17
|
-
`${this.project.path}/${this.project.paths.src.src}/${this.project.paths.src.scripts}/**/*.js`)
|
16
|
+
this.glob(this.project.package?.sdc?.scriptsGlobPath ||
|
17
|
+
`${this.project.path}/${this.project.paths.src.src}/${this.project.paths.src.scripts}/**/*.{js,jsx,ts,tsx}`)
|
18
18
|
);
|
19
19
|
await this.process();
|
20
20
|
}
|
@@ -23,7 +23,7 @@ export default class ScriptsComponent extends BaseComponent {
|
|
23
23
|
options = Object.assign({}, {
|
24
24
|
entriesToLint: null
|
25
25
|
}, options);
|
26
|
-
let entryLabel = `/${this.project.paths.dist}/${this.project.paths.src.scripts}/${this.utils.entryBasename(entry).replace(
|
26
|
+
let entryLabel = `/${this.project.paths.dist}/${this.project.paths.src.scripts}/${this.utils.entryBasename(entry).replace(/\.js$|\.jsx$|\.ts$|\.tsx$/g, '.min.js')}`;
|
27
27
|
|
28
28
|
this.start();
|
29
29
|
|
@@ -49,7 +49,6 @@ export default class ScriptsComponent extends BaseComponent {
|
|
49
49
|
platform: 'node',
|
50
50
|
entryPoints: [entry],
|
51
51
|
bundle: true,
|
52
|
-
loader: { '.js': 'jsx' },
|
53
52
|
minify: true,
|
54
53
|
outdir: `${this.project.paths.dist}/${this.project.paths.src.scripts}/`,
|
55
54
|
entryNames: '[dir]/[name].min',
|
@@ -71,8 +70,8 @@ export default class ScriptsComponent extends BaseComponent {
|
|
71
70
|
}
|
72
71
|
|
73
72
|
async process() {
|
74
|
-
const
|
75
|
-
await Promise.all(
|
73
|
+
const promisesScripts = this.files.map((block, index) => this.build(block.file, { entriesToLint: index == 0 ? this.globs : null }));
|
74
|
+
await Promise.all(promisesScripts);
|
76
75
|
}
|
77
76
|
|
78
77
|
watch() {
|
package/lib/components/style.js
CHANGED
@@ -11,7 +11,7 @@ export default class StyleComponent extends BaseComponent {
|
|
11
11
|
|
12
12
|
constructor() {
|
13
13
|
super();
|
14
|
-
this.description = `Process
|
14
|
+
this.description = `Process style files`;
|
15
15
|
}
|
16
16
|
|
17
17
|
async init() {
|
@@ -140,15 +140,17 @@ export default class StyleComponent extends BaseComponent {
|
|
140
140
|
if (options.buildTheme) {
|
141
141
|
await this.buildTheme();
|
142
142
|
}
|
143
|
+
let i = 0;
|
143
144
|
for (var block of this.files) {
|
144
145
|
if (!entry || entry == block.file) {
|
145
146
|
await this.build(block.file, {
|
146
147
|
name: block.name,
|
147
|
-
entriesToLint: this.globs
|
148
|
+
entriesToLint: i == 0 ? this.globs : null
|
148
149
|
});
|
149
150
|
if (entry == block.file) {
|
150
151
|
break;
|
151
152
|
}
|
153
|
+
i++;
|
152
154
|
}
|
153
155
|
}
|
154
156
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "sdc-build-wp",
|
3
|
-
"version": "4.
|
3
|
+
"version": "4.4.0",
|
4
4
|
"description": "Custom WordPress build process.",
|
5
5
|
"engines": {
|
6
6
|
"node": ">=22"
|
@@ -23,24 +23,27 @@
|
|
23
23
|
},
|
24
24
|
"dependencies": {
|
25
25
|
"@stylistic/stylelint-plugin": "^3.1.2",
|
26
|
-
"@
|
27
|
-
"
|
26
|
+
"@typescript-eslint/eslint-plugin": "^8.26.1",
|
27
|
+
"@typescript-eslint/parser": "^8.26.1",
|
28
|
+
"@wordpress/scripts": "^30.13.0",
|
29
|
+
"autoprefixer": "^10.4.21",
|
28
30
|
"browser-sync": "^3.0.3",
|
29
31
|
"chalk": "^5.4.1",
|
30
32
|
"chokidar": "^4.0.3",
|
31
|
-
"esbuild": "^0.25.
|
32
|
-
"eslint": "^9.
|
33
|
+
"esbuild": "^0.25.1",
|
34
|
+
"eslint": "^9.22.0",
|
33
35
|
"fs-extra": "^11.3.0",
|
34
|
-
"imagemin": "^9.0.
|
36
|
+
"imagemin": "^9.0.1",
|
35
37
|
"imagemin-jpegtran": "^8.0.0",
|
36
38
|
"imagemin-pngquant": "^10.0.0",
|
37
39
|
"imagemin-svgo": "^11.0.1",
|
40
|
+
"jiti": "^2.4.2",
|
38
41
|
"minimist": "^1.2.8",
|
39
42
|
"postcss": "^8.5.3",
|
40
43
|
"postcss-scss": "^4.0.9",
|
41
44
|
"postcss-sort-media-queries": "^5.2.0",
|
42
45
|
"sass": "^1.85.1",
|
43
|
-
"stylelint": "^16.
|
46
|
+
"stylelint": "^16.16.0",
|
44
47
|
"tail": "^2.2.6"
|
45
48
|
}
|
46
49
|
}
|