@ideasonpurpose/build-tools-wordpress 2.10.1 → 2.10.3
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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/lib/AfterDoneReporterPlugin.js +47 -3
- package/lib/WatchRunReporterPlugin.js +14 -7
- package/lib/prettier-hrtime.js +12 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
#### v2.10.2
|
|
8
|
+
|
|
9
|
+
> 16 July 2026
|
|
10
|
+
|
|
11
|
+
- tweak reporting
|
|
12
|
+
|
|
13
|
+
#### v2.10.1
|
|
14
|
+
|
|
15
|
+
> 15 July 2026
|
|
16
|
+
|
|
17
|
+
- remove infrastructureLogging
|
|
18
|
+
|
|
7
19
|
#### v2.10.0
|
|
8
20
|
|
|
9
21
|
> 15 July 2026
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @ideasonpurpose/build-tools-wordpress
|
|
2
2
|
|
|
3
|
-
#### Version 2.10.
|
|
3
|
+
#### Version 2.10.3
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@ideasonpurpose/build-tools-wordpress)
|
|
6
6
|
[](https://github.com/ideasonpurpose/build-tools-wordpress#readme)
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
3
|
import chalk from "chalk";
|
|
4
|
-
import
|
|
4
|
+
import { filesize } from "filesize";
|
|
5
|
+
import { prettierHrtime } from "./prettier-hrtime.js";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Clean post-compilation summary for dev server.
|
|
8
|
-
* Shows status, duration, and the local URL
|
|
9
|
+
* Shows status, duration, entrypoints with sizes, and the local URL.
|
|
9
10
|
*/
|
|
10
11
|
export class AfterDoneReporterPlugin {
|
|
11
12
|
constructor(options = {}) {
|
|
@@ -26,7 +27,7 @@ export class AfterDoneReporterPlugin {
|
|
|
26
27
|
const url = chalk.blue.underline(`http://${host}:${port}`);
|
|
27
28
|
|
|
28
29
|
const durationMs = stats.endTime && stats.startTime ? stats.endTime - stats.startTime : 0;
|
|
29
|
-
const time =
|
|
30
|
+
const time = prettierHrtime(durationMs);
|
|
30
31
|
|
|
31
32
|
const hasErrors = stats.hasErrors();
|
|
32
33
|
const hasWarnings = stats.hasWarnings();
|
|
@@ -41,6 +42,49 @@ export class AfterDoneReporterPlugin {
|
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
console.log(`\n${statusLine} → ${url}`);
|
|
45
|
+
|
|
46
|
+
// Entrypoint assets with sizes (exclude hot-update)
|
|
47
|
+
try {
|
|
48
|
+
const json = stats.toJson({
|
|
49
|
+
all: false,
|
|
50
|
+
assets: true,
|
|
51
|
+
entrypoints: true,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const assetMap = new Map();
|
|
55
|
+
for (const asset of json.assets ?? []) {
|
|
56
|
+
if (/hot-update/.test(asset.name)) continue;
|
|
57
|
+
assetMap.set(asset.name, asset);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const entrypoints = Object.entries(json.entrypoints ?? {}).sort(([a], [b]) =>
|
|
61
|
+
a.localeCompare(b),
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
if (entrypoints.length) {
|
|
65
|
+
for (const [epName, epInfo] of entrypoints) {
|
|
66
|
+
const epAssets = (epInfo.assets ?? [])
|
|
67
|
+
.map((a) => assetMap.get(a.name ?? a))
|
|
68
|
+
.filter(Boolean)
|
|
69
|
+
.sort((a, b) => (b.size ?? 0) - (a.size ?? 0));
|
|
70
|
+
|
|
71
|
+
if (!epAssets.length) continue;
|
|
72
|
+
|
|
73
|
+
console.log(
|
|
74
|
+
` ${chalk.gray("↳")} ${chalk.bold(epName)} ${chalk.gray(`(${epAssets.length})`)}:`,
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
for (const asset of epAssets) {
|
|
78
|
+
const size = asset.size != null ? filesize(asset.size) : "?";
|
|
79
|
+
console.log(
|
|
80
|
+
` ${chalk.gray("·")} ${chalk.white(asset.name)} ${chalk.gray(`— ${size}`)}`,
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
} catch {
|
|
86
|
+
// Non-fatal: don't clutter output if stats parsing fails
|
|
87
|
+
}
|
|
44
88
|
});
|
|
45
89
|
}
|
|
46
90
|
}
|
|
@@ -27,7 +27,7 @@ export class WatchRunReporterPlugin {
|
|
|
27
27
|
compiler.hooks.watchRun.tap(this.name, () => {
|
|
28
28
|
if (!this.config.echo) return;
|
|
29
29
|
|
|
30
|
-
const root =
|
|
30
|
+
const root = process.cwd();
|
|
31
31
|
const modFiles = compiler.modifiedFiles?.size
|
|
32
32
|
? Array.from(compiler.modifiedFiles)
|
|
33
33
|
: null;
|
|
@@ -39,22 +39,29 @@ export class WatchRunReporterPlugin {
|
|
|
39
39
|
if (!changed) return;
|
|
40
40
|
|
|
41
41
|
const relFiles = changed
|
|
42
|
-
.map((p) => path.relative(root, p) ||
|
|
42
|
+
.map((p) => path.relative(root, p) || ".")
|
|
43
43
|
.sort();
|
|
44
44
|
|
|
45
|
+
const MAX_FILES = 6;
|
|
45
46
|
let changeMsg;
|
|
47
|
+
|
|
46
48
|
if (relFiles.length === 1) {
|
|
47
49
|
changeMsg = chalk.bold.yellow(relFiles[0]);
|
|
48
|
-
} else if (relFiles.length <=
|
|
50
|
+
} else if (relFiles.length <= MAX_FILES) {
|
|
49
51
|
changeMsg = chalk.bold.yellow(relFiles.join(", "));
|
|
50
52
|
} else {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
const visible = relFiles.slice(0, MAX_FILES).join(", ");
|
|
54
|
+
const remaining = relFiles.length - MAX_FILES;
|
|
55
|
+
changeMsg =
|
|
56
|
+
chalk.bold.yellow(visible) +
|
|
57
|
+
chalk.gray(` +${remaining} more`);
|
|
54
58
|
}
|
|
55
59
|
|
|
60
|
+
const count =
|
|
61
|
+
relFiles.length > 1 ? chalk.cyan(`(${relFiles.length})`) + " " : "";
|
|
62
|
+
|
|
56
63
|
console.log(
|
|
57
|
-
`\n${chalk.cyan("⟳")} Changed: ${changeMsg} ${this.config.message}`,
|
|
64
|
+
`\n${chalk.cyan("⟳")} Changed: ${count}${changeMsg} ${this.config.message}`,
|
|
58
65
|
);
|
|
59
66
|
});
|
|
60
67
|
}
|
package/lib/prettier-hrtime.js
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import prettyHrtime from "pretty-hrtime";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Format hrtime tuples or millisecond durations into a human string.
|
|
5
|
+
* Accepts:
|
|
6
|
+
* - [seconds, nanoseconds] (from process.hrtime())
|
|
7
|
+
* - number (milliseconds, e.g. stats.endTime - stats.startTime)
|
|
8
|
+
*/
|
|
3
9
|
export const prettierHrtime = (hrtime) => {
|
|
10
|
+
if (typeof hrtime === "number") {
|
|
11
|
+
const secs = Math.floor(hrtime / 1000);
|
|
12
|
+
const nsecs = Math.round((hrtime % 1000) * 1e6);
|
|
13
|
+
hrtime = [secs, nsecs];
|
|
14
|
+
}
|
|
15
|
+
|
|
4
16
|
let timeString;
|
|
5
17
|
const seconds = hrtime[1] > 5e6 ? " seconds" : " second";
|
|
6
18
|
if (hrtime[0] > 60) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ideasonpurpose/build-tools-wordpress",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.3",
|
|
4
4
|
"description": "Build scripts and dependencies for IOP's WordPress development environments.",
|
|
5
5
|
"homepage": "https://github.com/ideasonpurpose/build-tools-wordpress#readme",
|
|
6
6
|
"bugs": {
|