about-system 0.0.36 → 0.0.37
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/about-system-cli.js +1 -1
- package/dist/cpu-geekbench-1k.json +1 -0
- package/dist/index.js +1 -1
- package/dist/system-info-api-J8OqC6YU.js +2148 -0
- package/dist/system-info-api-J8OqC6YU.js.map +1 -0
- package/dist/system-info-api.js +1 -1
- package/package.json +1 -1
- package/src/info/hardware.ts +51 -13
- package/src/systeminfo-types.d.ts +14 -0
- package/dist/system-info-api-BfolzpSf.js +0 -889
- package/dist/system-info-api-BfolzpSf.js.map +0 -1
package/src/info/hardware.ts
CHANGED
|
@@ -9,6 +9,7 @@ import type { InfoContext } from "../types/internal-types";
|
|
|
9
9
|
import { IS_WINDOWS, IS_LINUX } from "../utils/platform";
|
|
10
10
|
import { execCommand } from "../utils/command";
|
|
11
11
|
import { getCachedValue, setCachedValue } from "../cache/cache";
|
|
12
|
+
import Fuse from "fuse.js";
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Gets CPU model name and specifications
|
|
@@ -190,21 +191,39 @@ export function bench(context: InfoContext): string {
|
|
|
190
191
|
}
|
|
191
192
|
|
|
192
193
|
try {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
let benchmarkPath: string;
|
|
195
|
+
const benchmarkFile = "cpu-geekbench-1k.json";
|
|
196
|
+
|
|
197
|
+
// Try multiple resolution strategies
|
|
198
|
+
if (fs.existsSync(benchmarkFile)) {
|
|
199
|
+
benchmarkPath = benchmarkFile;
|
|
200
|
+
} else if (fs.existsSync(`src/bench/${benchmarkFile}`)) {
|
|
201
|
+
benchmarkPath = `src/bench/${benchmarkFile}`;
|
|
202
|
+
} else if (fs.existsSync(`./bench/${benchmarkFile}`)) {
|
|
203
|
+
benchmarkPath = `./bench/${benchmarkFile}`;
|
|
204
|
+
} else {
|
|
205
|
+
// Last resort: construct path from import.meta.url
|
|
206
|
+
try {
|
|
207
|
+
const url = new URL(`./${benchmarkFile}`, import.meta.url);
|
|
208
|
+
benchmarkPath = url.pathname;
|
|
209
|
+
if (!fs.existsSync(benchmarkPath)) {
|
|
210
|
+
const distPath = url.pathname.substring(0, url.pathname.lastIndexOf('/'));
|
|
211
|
+
benchmarkPath = distPath + `/${benchmarkFile}`;
|
|
212
|
+
}
|
|
213
|
+
} catch {
|
|
214
|
+
benchmarkPath = benchmarkFile;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
197
218
|
const benchmarkData = fs.readFileSync(benchmarkPath, "utf8");
|
|
198
219
|
const parsed = JSON.parse(benchmarkData);
|
|
199
220
|
const scores = parsed.scores as [string, number, number][];
|
|
200
221
|
|
|
201
|
-
// Convert to objects for Fuse
|
|
202
222
|
const cpuList = scores.map((item) => ({ name: item[0], score: item[1], rank: item[2] }));
|
|
203
223
|
|
|
204
|
-
const Fuse = require("fuse.js");
|
|
205
224
|
const fuse = new Fuse(cpuList, {
|
|
206
225
|
keys: ["name"],
|
|
207
|
-
threshold: 0.
|
|
226
|
+
threshold: 0.6,
|
|
208
227
|
minMatchCharLength: 3,
|
|
209
228
|
});
|
|
210
229
|
|
|
@@ -243,10 +262,30 @@ export function cpu_bench_info(context: InfoContext): string {
|
|
|
243
262
|
}
|
|
244
263
|
|
|
245
264
|
try {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
265
|
+
let benchmarkPath: string;
|
|
266
|
+
const benchmarkFile = "cpu-geekbench-1k.json";
|
|
267
|
+
|
|
268
|
+
// Try multiple resolution strategies
|
|
269
|
+
if (fs.existsSync(benchmarkFile)) {
|
|
270
|
+
benchmarkPath = benchmarkFile;
|
|
271
|
+
} else if (fs.existsSync(`src/bench/${benchmarkFile}`)) {
|
|
272
|
+
benchmarkPath = `src/bench/${benchmarkFile}`;
|
|
273
|
+
} else if (fs.existsSync(`./bench/${benchmarkFile}`)) {
|
|
274
|
+
benchmarkPath = `./bench/${benchmarkFile}`;
|
|
275
|
+
} else {
|
|
276
|
+
// Last resort: construct path from import.meta.url
|
|
277
|
+
try {
|
|
278
|
+
const url = new URL(`./${benchmarkFile}`, import.meta.url);
|
|
279
|
+
benchmarkPath = url.pathname;
|
|
280
|
+
if (!fs.existsSync(benchmarkPath)) {
|
|
281
|
+
const distPath = url.pathname.substring(0, url.pathname.lastIndexOf('/'));
|
|
282
|
+
benchmarkPath = distPath + `/${benchmarkFile}`;
|
|
283
|
+
}
|
|
284
|
+
} catch {
|
|
285
|
+
benchmarkPath = benchmarkFile;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
250
289
|
const benchmarkData = fs.readFileSync(benchmarkPath, "utf8");
|
|
251
290
|
const parsed = JSON.parse(benchmarkData);
|
|
252
291
|
const scores = parsed.scores as [string, number, number][];
|
|
@@ -257,10 +296,9 @@ export function cpu_bench_info(context: InfoContext): string {
|
|
|
257
296
|
rank: item[2],
|
|
258
297
|
}));
|
|
259
298
|
|
|
260
|
-
const Fuse = require("fuse.js");
|
|
261
299
|
const fuse = new Fuse(cpuList, {
|
|
262
300
|
keys: ["name"],
|
|
263
|
-
threshold: 0.
|
|
301
|
+
threshold: 0.6,
|
|
264
302
|
minMatchCharLength: 3,
|
|
265
303
|
});
|
|
266
304
|
|
|
@@ -134,6 +134,20 @@ export interface SystemInfo {
|
|
|
134
134
|
*/
|
|
135
135
|
bench: string;
|
|
136
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Detailed CPU benchmark information from Geekbench 6 multi-core
|
|
139
|
+
* Shows score, rank, and architecture type (ARM/Intel/AMD)
|
|
140
|
+
* Uses fuzzy matching to find similar CPU models
|
|
141
|
+
* Empty string if CPU not found or benchmark data unavailable
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* - "Geekbench 6: 37.9k (Rank #1) - ARM" (Apple M4 Ultra)
|
|
145
|
+
* - "Geekbench 6: 20.5k (Rank #68) - Intel" (Intel Core i9)
|
|
146
|
+
* - "Geekbench 6: 19.2k (Rank #91) - AMD" (AMD Ryzen 9 7950X)
|
|
147
|
+
* - "" (CPU not in benchmark database)
|
|
148
|
+
*/
|
|
149
|
+
cpu_bench_info: string;
|
|
150
|
+
|
|
137
151
|
/**
|
|
138
152
|
* Device or computer model name
|
|
139
153
|
* Hardware model identification when available
|