@esposter/shared-node 4.3.1 → 4.3.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/dist/bench.d.ts +1 -3
- package/dist/bench.js +1 -2
- package/dist/cache.d.ts +1 -5
- package/dist/cache.js +2 -4
- package/dist/child-process.d.ts +1 -11
- package/dist/child-process.js +5 -9
- package/dist/{execSync-CtM99iYq.js → execSync-DCcbOCo8.js} +2 -4
- package/dist/reporter.d.ts +1 -3
- package/dist/reporter.js +6 -11
- package/package.json +4 -4
package/dist/bench.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { BenchCompareOptions } from "vitest";
|
|
2
|
-
//#region src/services/constants.d.ts
|
|
3
2
|
export declare const BASELINE_TASK_NAME = "native";
|
|
4
|
-
export declare const BENCHMARK_RUN_OPTIONS: BenchCompareOptions;
|
|
5
|
-
//#endregion
|
|
3
|
+
export declare const BENCHMARK_RUN_OPTIONS: BenchCompareOptions;
|
package/dist/bench.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/services/constants.ts
|
|
2
2
|
const BASELINE_TASK_NAME = "native";
|
|
3
3
|
const BENCHMARK_RUN_OPTIONS = {
|
|
4
4
|
iterations: 10,
|
|
@@ -6,5 +6,4 @@ const BENCHMARK_RUN_OPTIONS = {
|
|
|
6
6
|
warmupIterations: 5,
|
|
7
7
|
warmupTime: 0
|
|
8
8
|
};
|
|
9
|
-
//#endregion
|
|
10
9
|
export { BASELINE_TASK_NAME, BENCHMARK_RUN_OPTIONS };
|
package/dist/cache.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
//#region src/services/cache/constants.d.ts
|
|
2
1
|
export declare const CACHE_ROOT: string;
|
|
3
2
|
export declare const CONTENT_CACHE_DIRECTORY: string;
|
|
4
|
-
|
|
5
|
-
//#region src/services/cache/readContentAddressedObject.d.ts
|
|
6
|
-
export declare const readContentAddressedObject: (hash: string, download: () => Promise<Uint8Array>, directory?: string) => Promise<Buffer>;
|
|
7
|
-
//#endregion
|
|
3
|
+
export declare const readContentAddressedObject: (hash: string, download: () => Promise<Uint8Array>, directory?: string) => Promise<Buffer>;
|
package/dist/cache.js
CHANGED
|
@@ -4,11 +4,10 @@ import { join } from "node:path";
|
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
5
|
import { existsSync } from "node:fs";
|
|
6
6
|
import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
7
|
-
|
|
7
|
+
// src/services/cache/constants.ts
|
|
8
8
|
const CACHE_ROOT = join(homedir(), SITE_NAME, "cache");
|
|
9
9
|
const CONTENT_CACHE_DIRECTORY = join(CACHE_ROOT, "content");
|
|
10
|
-
|
|
11
|
-
//#region src/services/cache/readContentAddressedObject.ts
|
|
10
|
+
// src/services/cache/readContentAddressedObject.ts
|
|
12
11
|
const SHA_256_HEX_REGEX = /^[0-9a-f]{64}$/u;
|
|
13
12
|
const readContentAddressedObject = async (hash, download, directory = CONTENT_CACHE_DIRECTORY) => {
|
|
14
13
|
if (!SHA_256_HEX_REGEX.test(hash)) throw new InvalidOperationError(Operation.Read, hash, "is not a SHA-256 hex digest");
|
|
@@ -25,5 +24,4 @@ const readContentAddressedObject = async (hash, download, directory = CONTENT_CA
|
|
|
25
24
|
});
|
|
26
25
|
return bytes;
|
|
27
26
|
};
|
|
28
|
-
//#endregion
|
|
29
27
|
export { CACHE_ROOT, CONTENT_CACHE_DIRECTORY, readContentAddressedObject };
|
package/dist/child-process.d.ts
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import { execFile as execFile$1, execFileSync as execFileSync$1, execSync as execSync$1, spawn as spawn$1, spawnSync as spawnSync$1 } from "node:child_process";
|
|
2
|
-
//#region src/services/childProcess/execFile.d.ts
|
|
3
2
|
export declare const execFile: typeof execFile$1;
|
|
4
|
-
//#endregion
|
|
5
|
-
//#region src/services/childProcess/execFileSync.d.ts
|
|
6
3
|
export declare const execFileSync: typeof execFileSync$1;
|
|
7
|
-
//#endregion
|
|
8
|
-
//#region src/services/childProcess/execSync.d.ts
|
|
9
4
|
export declare const execSync: typeof execSync$1;
|
|
10
|
-
//#endregion
|
|
11
|
-
//#region src/services/childProcess/spawn.d.ts
|
|
12
5
|
export declare const spawn: typeof spawn$1;
|
|
13
|
-
|
|
14
|
-
//#region src/services/childProcess/spawnSync.d.ts
|
|
15
|
-
export declare const spawnSync: typeof spawnSync$1;
|
|
16
|
-
//#endregion
|
|
6
|
+
export declare const spawnSync: typeof spawnSync$1;
|
package/dist/child-process.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import { n as withHiddenWindow, t as execSync } from "./execSync-
|
|
1
|
+
import { n as withHiddenWindow, t as execSync } from "./execSync-DCcbOCo8.js";
|
|
2
2
|
import { execFile as execFile$1, execFileSync as execFileSync$1, spawn as spawn$1, spawnSync as spawnSync$1 } from "node:child_process";
|
|
3
3
|
import { promisify } from "node:util";
|
|
4
|
-
|
|
4
|
+
// src/services/childProcess/execFile.ts
|
|
5
5
|
const execFile = ((file, ...parameters) => execFile$1(file, ...withHiddenWindow(parameters)));
|
|
6
6
|
Object.defineProperty(execFile, promisify.custom, { value: (file, ...parameters) => promisify(execFile$1)(file, ...withHiddenWindow(parameters)) });
|
|
7
|
-
|
|
8
|
-
//#region src/services/childProcess/execFileSync.ts
|
|
7
|
+
// src/services/childProcess/execFileSync.ts
|
|
9
8
|
const execFileSync = ((file, ...parameters) => execFileSync$1(file, ...withHiddenWindow(parameters)));
|
|
10
|
-
|
|
11
|
-
//#region src/services/childProcess/spawn.ts
|
|
9
|
+
// src/services/childProcess/spawn.ts
|
|
12
10
|
const spawn = ((file, ...parameters) => spawn$1(file, ...withHiddenWindow(parameters)));
|
|
13
|
-
|
|
14
|
-
//#region src/services/childProcess/spawnSync.ts
|
|
11
|
+
// src/services/childProcess/spawnSync.ts
|
|
15
12
|
const spawnSync = ((file, ...parameters) => spawnSync$1(file, ...withHiddenWindow(parameters)));
|
|
16
|
-
//#endregion
|
|
17
13
|
export { execFile, execFileSync, execSync, spawn, spawnSync };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { execSync } from "node:child_process";
|
|
2
|
-
|
|
2
|
+
// src/services/childProcess/withHiddenWindow.ts
|
|
3
3
|
const withHiddenWindow = (parameters) => {
|
|
4
4
|
const optionsIndex = Array.isArray(parameters[0]) || parameters[0] === void 0 && parameters.length > 1 ? 1 : 0;
|
|
5
5
|
const options = parameters[optionsIndex];
|
|
@@ -10,8 +10,6 @@ const withHiddenWindow = (parameters) => {
|
|
|
10
10
|
const isPlaceholder = options === void 0 && optionsIndex < parameters.length;
|
|
11
11
|
return parameters.toSpliced(optionsIndex, Number(isPlaceholder), { windowsHide: true });
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
//#region src/services/childProcess/execSync.ts
|
|
13
|
+
// src/services/childProcess/execSync.ts
|
|
15
14
|
const execSync$1 = ((command, ...parameters) => execSync(command, ...withHiddenWindow(parameters)));
|
|
16
|
-
//#endregion
|
|
17
15
|
export { withHiddenWindow as n, execSync$1 as t };
|
package/dist/reporter.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Reporter, TestModule } from "vitest/node";
|
|
2
|
-
//#region src/services/BenchmarkMarkdownReporter.d.ts
|
|
3
2
|
export default class BenchmarkMarkdownReporter implements Reporter {
|
|
4
3
|
onTestRunEnd(testModules: readonly TestModule[]): Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
//#endregion
|
|
4
|
+
}
|
package/dist/reporter.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./bench.js";
|
|
2
|
-
import { t as execSync } from "./execSync-
|
|
2
|
+
import { t as execSync } from "./execSync-DCcbOCo8.js";
|
|
3
3
|
import { GIBIBYTE, InvalidOperationError, Operation, getResult, getResultAsync, noop, normalizeString, takeOne } from "@esposter/shared";
|
|
4
4
|
import { arch, cpus, platform, release, totalmem } from "node:os";
|
|
5
5
|
import { writeFile } from "node:fs/promises";
|
|
6
|
-
|
|
6
|
+
// src/services/readBenchmarkEnvironment.ts
|
|
7
7
|
const readCommit = () => getResult(() => execSync("git rev-parse --short HEAD", {
|
|
8
8
|
encoding: "utf8",
|
|
9
9
|
stdio: "pipe"
|
|
@@ -19,8 +19,7 @@ const readBenchmarkEnvironment = () => {
|
|
|
19
19
|
`- RAM: ${(totalmem() / GIBIBYTE).toFixed(1)} GiB`
|
|
20
20
|
].join("\n");
|
|
21
21
|
};
|
|
22
|
-
|
|
23
|
-
//#region src/services/buildBenchmarkFileReport.ts
|
|
22
|
+
// src/services/buildBenchmarkFileReport.ts
|
|
24
23
|
const getGroupName = (testCase, benchmarkName, benchmarkCount) => benchmarkCount > 1 ? `${testCase.fullName} > ${benchmarkName}` : testCase.fullName;
|
|
25
24
|
const buildBenchmarkFileReport = (filepath, testCases) => {
|
|
26
25
|
const groups = [];
|
|
@@ -49,8 +48,7 @@ const buildBenchmarkFileReport = (filepath, testCases) => {
|
|
|
49
48
|
groups
|
|
50
49
|
}] };
|
|
51
50
|
};
|
|
52
|
-
|
|
53
|
-
//#region src/services/formatBenchmarkMarkdown.ts
|
|
51
|
+
// src/services/formatBenchmarkMarkdown.ts
|
|
54
52
|
const getBaseline = (benchmarks) => benchmarks.find(({ name }) => name === "native") ?? benchmarks[0];
|
|
55
53
|
const formatRelative = (baselineMean, mean) => {
|
|
56
54
|
const ratio = baselineMean / mean;
|
|
@@ -107,8 +105,7 @@ const formatBenchmarkMarkdown = (report, environment) => {
|
|
|
107
105
|
}))
|
|
108
106
|
].join("\n");
|
|
109
107
|
};
|
|
110
|
-
|
|
111
|
-
//#region src/services/writeBenchmarkReport.ts
|
|
108
|
+
// src/services/writeBenchmarkReport.ts
|
|
112
109
|
const TS_EXTENSION_REGEX = /\.ts$/u;
|
|
113
110
|
const writeFileOrThrow = (path, contents) => getResultAsync(() => writeFile(path, contents)).match(noop, (error) => {
|
|
114
111
|
throw new InvalidOperationError(Operation.Create, path, error.message);
|
|
@@ -121,13 +118,11 @@ const writeBenchmarkReport = async (moduleId, relativeModuleId, testCases, envir
|
|
|
121
118
|
const reportPath = basePath.endsWith(".platform.bench") ? `${basePath}.${process.platform}` : basePath;
|
|
122
119
|
await Promise.all([writeFileOrThrow(`${reportPath}.json`, `${JSON.stringify(report, null, 2)}\n`), writeFileOrThrow(`${reportPath}.md`, formatBenchmarkMarkdown(report, environment))]);
|
|
123
120
|
};
|
|
124
|
-
|
|
125
|
-
//#region src/services/BenchmarkMarkdownReporter.ts
|
|
121
|
+
// src/services/BenchmarkMarkdownReporter.ts
|
|
126
122
|
var BenchmarkMarkdownReporter = class {
|
|
127
123
|
async onTestRunEnd(testModules) {
|
|
128
124
|
const environment = readBenchmarkEnvironment();
|
|
129
125
|
await Promise.all(testModules.map((testModule) => writeBenchmarkReport(testModule.moduleId, testModule.relativeModuleId, testModule.children.allTests(), environment)));
|
|
130
126
|
}
|
|
131
127
|
};
|
|
132
|
-
//#endregion
|
|
133
128
|
export { BenchmarkMarkdownReporter as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esposter/shared-node",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.3",
|
|
4
4
|
"description": "Node-only shared tooling: the machine-wide download cache, hidden-window child processes, and benchmark reporting reused across packages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"benchmark",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"typecheck": "tsc"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@esposter/shared": "4.3.
|
|
53
|
+
"@esposter/shared": "4.3.3"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@esposter/configuration": "4.3.
|
|
56
|
+
"@esposter/configuration": "4.3.3",
|
|
57
57
|
"@types/node": "^26.6.5",
|
|
58
58
|
"tsdown": "^0.23.1"
|
|
59
59
|
},
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"optional": true
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "955bbc130ad9b28877fd4ae8efc73a045141ce01"
|
|
69
69
|
}
|