about-system 0.0.17 → 0.0.19

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.
@@ -0,0 +1,236 @@
1
+ #!/usr/bin/env node
2
+ import p from "os";
3
+ import i from "fs";
4
+ import u from "path";
5
+ import { fileURLToPath as x } from "url";
6
+ import { g as $, a as C, b as y, C as S, S as I, c as g, D as w } from "./system-info-api-Bc0iSNdN.js";
7
+ const L = x(import.meta.url), d = p.platform() === "win32";
8
+ function b(e, s, o) {
9
+ if (!s || s.trim() === "") return "";
10
+ const a = g[o.colors[e]] || g.reset, n = o.display.show_emojis && o.emojis[e] || "";
11
+ if (e === "battery" && o.display.show_emojis) {
12
+ const t = s.includes("+") ? o.emojis.battery_charging : o.emojis.battery;
13
+ return `${a}${t}${s}`;
14
+ }
15
+ if (e === "ports" && o.colors[e] === "multicolor" && s) {
16
+ let c = ` ${o.display.show_emojis ? o.emojis.ports : ""}`;
17
+ const r = s.split(" "), l = [31, 32, 33, 34, 35, 36];
18
+ return r.forEach((f, m) => {
19
+ const h = l[m % l.length];
20
+ c += `\x1B[${h}m${f}\x1B[0m `;
21
+ }), c.trim();
22
+ }
23
+ if (e === "pacman" && o.colors[e] === "multicolor" && s) {
24
+ const t = o.display.show_emojis ? o.emojis.pacman : "";
25
+ return `${a}${t}${s}`;
26
+ }
27
+ return `${a}${n}${s}`;
28
+ }
29
+ function _(e) {
30
+ return e.replace(/\x1b\[[0-9;]*m/g, "");
31
+ }
32
+ async function j(e = null) {
33
+ const s = C(), o = e || s.display_order, a = await $();
34
+ if (s.display.single_line) {
35
+ const r = [];
36
+ for (const l of o)
37
+ for (const f of l) {
38
+ const m = a[f], h = b(f, m, s);
39
+ h && h.trim() && r.push(h);
40
+ }
41
+ r.length > 0 && console.log(r.join(" ") + g.reset);
42
+ return;
43
+ }
44
+ const n = [];
45
+ let t = "";
46
+ const c = s.display.line_wrap_length;
47
+ for (const r of o)
48
+ for (const l of r) {
49
+ const f = a[l], m = b(l, f, s);
50
+ if (m && m.trim()) {
51
+ const h = _(m).length, F = _(t).length;
52
+ t && F + h + 1 > c ? (n.push(t), t = m) : t = t ? `${t} ${m}` : m;
53
+ }
54
+ }
55
+ t && n.push(t), n.length > 0 ? n.forEach((r) => {
56
+ console.log(r + g.reset);
57
+ }) : s.advanced.debug && console.log("No system information could be displayed");
58
+ }
59
+ function E(e) {
60
+ const s = C();
61
+ if (e.includes("--settings-init"))
62
+ return y(w) ? console.log("Settings initialized with defaults") : console.log("Failed to initialize settings"), !0;
63
+ if (e.includes("--settings-show"))
64
+ return console.log("Current settings:"), console.log(JSON.stringify(s, null, 2)), !0;
65
+ if (e.includes("--settings-reset"))
66
+ return y(w) ? console.log("Settings reset to defaults") : console.log("Failed to reset settings"), !0;
67
+ if (e.includes("--refresh")) {
68
+ try {
69
+ i.existsSync(S) && (i.unlinkSync(S), console.log("Cache cleared"));
70
+ } catch (a) {
71
+ console.error("Error clearing cache:", a.message);
72
+ }
73
+ return !0;
74
+ }
75
+ const o = e.indexOf("--set");
76
+ if (o !== -1 && e[o + 1] && e[o + 2]) {
77
+ const a = e[o + 1], n = e[o + 2];
78
+ try {
79
+ const t = n.startsWith("{") || n.startsWith("[") ? JSON.parse(n) : n, c = a.split(".");
80
+ let r = s;
81
+ for (let l = 0; l < c.length - 1; l++)
82
+ r[c[l]] || (r[c[l]] = {}), r = r[c[l]];
83
+ r[c[c.length - 1]] = t, y(s) ? console.log(`Setting ${a} = ${n}`) : console.log("Failed to save settings");
84
+ } catch (t) {
85
+ console.error("Error setting value:", t.message);
86
+ }
87
+ return !0;
88
+ }
89
+ return !1;
90
+ }
91
+ function P() {
92
+ const e = p.homedir();
93
+ let s, o;
94
+ d ? (s = u.join(e, "AppData", "Local"), o = u.join(s, "systeminfo")) : (s = u.join(e, ".config"), o = u.join(s, "systeminfo"));
95
+ const a = u.resolve(L);
96
+ try {
97
+ if (i.existsSync(s) || i.mkdirSync(s, { recursive: !0 }), i.copyFileSync(a, o), d || i.chmodSync(o, "755"), d) {
98
+ console.log("Windows installation:"), console.log("1. Script copied to:", o), console.log("2. To add to PowerShell profile, run:"), console.log(` Add-Content $PROFILE "node '${o}'"`), console.log(
99
+ "3. To add to Command Prompt, create a batch file in your startup folder"
100
+ );
101
+ const n = u.join(s, "systeminfo-startup.bat");
102
+ i.writeFileSync(n, `@echo off
103
+ node "${o}"
104
+ `), console.log("4. Batch file created:", n);
105
+ } else {
106
+ try {
107
+ const f = u.join(e, ".hushlogin");
108
+ i.writeFileSync(f, "");
109
+ } catch {
110
+ }
111
+ const n = u.join(e, ".bashrc"), t = `node ${o}`;
112
+ i.existsSync(n) ? i.readFileSync(n, "utf8").includes("systeminfo") || i.appendFileSync(n, `
113
+ ${t}
114
+ `) : i.writeFileSync(n, `${t}
115
+ `);
116
+ const c = u.join(e, ".zshrc");
117
+ i.existsSync(c) && (i.readFileSync(c, "utf8").includes("systeminfo") || i.appendFileSync(c, `
118
+ ${t}
119
+ `));
120
+ const r = u.join(
121
+ e,
122
+ ".config",
123
+ "fish",
124
+ "config.fish"
125
+ );
126
+ i.existsSync(r) && (i.readFileSync(r, "utf8").includes("systeminfo") || i.appendFileSync(
127
+ r,
128
+ `
129
+ set -U fish_greeting ""
130
+ ${t}
131
+ `
132
+ ));
133
+ const l = u.join(
134
+ e,
135
+ ".config",
136
+ "nushell",
137
+ "config.nu"
138
+ );
139
+ i.existsSync(l) && (i.readFileSync(l, "utf8").includes("systeminfo") || i.appendFileSync(
140
+ l,
141
+ `
142
+ $env.config.show_banner = false
143
+ ${t}
144
+ `
145
+ ));
146
+ }
147
+ console.log("Shell greeting installation completed!");
148
+ } catch (n) {
149
+ console.error("Error installing shell greeting:", n.message), process.exit(1);
150
+ }
151
+ }
152
+ function O(e) {
153
+ for (const s of e)
154
+ if (!s.startsWith("--") && s.includes(","))
155
+ return s.split(",").map((o) => o.trim()).filter((o) => o.length > 0);
156
+ for (const s of e)
157
+ if (!s.startsWith("--") && !s.includes("=") && s.length > 0)
158
+ return [s.trim()];
159
+ return null;
160
+ }
161
+ async function v() {
162
+ console.log(`
163
+ System Info Script - TypeScript Version
164
+
165
+ Usage:
166
+ about-system [options]
167
+ about-system <part1,part2,...> # CLI mode: show specific parts only
168
+
169
+ Options:
170
+ --help, -h Show this help message
171
+ --install Install as shell greeting
172
+ --settings-init Initialize settings file with defaults
173
+ --settings-show Display current settings
174
+ --settings-reset Reset settings to defaults
175
+ --refresh Clear the cache file
176
+ --set <key> <value> Set a configuration value (use dot notation)
177
+ --json Output as JSON
178
+
179
+ Examples:
180
+ about-system # Show all info (default)
181
+ about-system cpu,os # Show only CPU and OS info
182
+ about-system user,hostname,ip # Show user, hostname, and IP
183
+ about-system disk_used # Show only disk usage
184
+ about-system --install
185
+ about-system --set display.show_emojis false
186
+ about-system --set colors.user blue
187
+ about-system --set emojis.cpu "🚀 "
188
+ about-system --set labels.cpu "Processor"
189
+ about-system --json
190
+
191
+ Settings file: ${I}
192
+ Cache file: ${S}
193
+
194
+ Platform: ${d ? "Windows" : p.platform() === "darwin" ? "macOS" : p.platform() === "linux" ? "Linux" : "Unknown"}
195
+
196
+ Available display blocks:
197
+ Basic: user, hostname, uptime, shell, os, kernel, device
198
+ Resources: disk_used, ram_used, memory_available, swap_used, top_process
199
+ Network: ip, iplocal, city, domain, isp, network_interfaces
200
+ Hardware: cpu, gpu, temperature, battery, screen_resolution
201
+ System: load_average, users_logged_in, mount_points, services_running
202
+ Tools: pacman, ports, containers
203
+ `);
204
+ }
205
+ async function T() {
206
+ const e = process.argv.slice(2);
207
+ if (E(e))
208
+ return;
209
+ if (e.includes("--help") || e.includes("-h")) {
210
+ await v();
211
+ return;
212
+ }
213
+ if (e.includes("--install")) {
214
+ P();
215
+ return;
216
+ }
217
+ if (e.includes("--json")) {
218
+ const o = await $();
219
+ console.log(JSON.stringify(o, null, 2));
220
+ return;
221
+ }
222
+ const s = O(e);
223
+ if (s) {
224
+ await j([s]);
225
+ return;
226
+ }
227
+ await j();
228
+ }
229
+ T().catch((e) => {
230
+ console.error("Error:", e.message), process.exit(1);
231
+ });
232
+ export {
233
+ j as displaySystemInfo,
234
+ P as installShellGreeting
235
+ };
236
+ //# sourceMappingURL=about-system-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"about-system-cli.js","sources":["../src/about-system-cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport os from \"os\";\nimport fs from \"fs\";\nimport path from \"path\";\nimport { fileURLToPath } from \"url\";\nimport { getSystemInfo } from \"./system-info-api\";\nimport type { SystemInfo, SystemInfoOptions } from \"./systeminfo-types\";\n\nconst __filename = fileURLToPath(import.meta.url);\n\nimport {\n Settings,\n DEFAULT_SETTINGS,\n colors,\n SETTINGS_FILE,\n CACHE_FILE,\n loadSettings,\n saveSettings,\n} from \"./info/settings\";\n\n// Platform detection\nconst IS_WINDOWS = os.platform() === \"win32\";\n\nfunction formatValue(key: string, value: string, settings: Settings): string {\n if (!value || value.trim() === \"\") return \"\";\n\n const color =\n colors[settings.colors[key] as keyof typeof colors] || colors.reset;\n const emoji = settings.display.show_emojis ? settings.emojis[key] || \"\" : \"\";\n\n // Special handling for battery emoji\n if (key === \"battery\" && settings.display.show_emojis) {\n const batteryEmoji = value.includes(\"+\")\n ? settings.emojis.battery_charging\n : settings.emojis.battery;\n return `${color}${batteryEmoji}${value}`;\n }\n\n // Multicolor handling for ports\n if (key === \"ports\" && settings.colors[key] === \"multicolor\" && value) {\n const emoji = settings.display.show_emojis ? settings.emojis.ports : \"\";\n let output = ` ${emoji}`;\n const ports = value.split(\" \");\n const colorCodes = [31, 32, 33, 34, 35, 36];\n ports.forEach((port, index) => {\n const colorCode = colorCodes[index % colorCodes.length];\n output += `\\x1b[${colorCode}m${port}\\x1b[0m `;\n });\n return output.trim();\n }\n\n // Multicolor handling for pacman\n if (key === \"pacman\" && settings.colors[key] === \"multicolor\" && value) {\n const emoji = settings.display.show_emojis ? settings.emojis.pacman : \"\";\n return `${color}${emoji}${value}`;\n }\n\n return `${color}${emoji}${value}`;\n}\n\nfunction removeAnsiCodes(str: string): string {\n return str.replace(/\\x1b\\[[0-9;]*m/g, \"\");\n}\n\nasync function displaySystemInfo(\n customDisplayOrder: string[][] | null = null\n): Promise<void> {\n const settings = loadSettings();\n const displayOrder = customDisplayOrder || settings.display_order;\n\n // Get system info\n const info = await getSystemInfo();\n\n // Single line mode\n if (settings.display.single_line) {\n const allItems: string[] = [];\n\n for (const group of displayOrder) {\n for (const key of group) {\n const value = info[key as keyof SystemInfo] as string;\n const formatted = formatValue(key, value, settings);\n if (formatted && formatted.trim()) {\n allItems.push(formatted);\n }\n }\n }\n\n if (allItems.length > 0) {\n console.log(allItems.join(\" \") + colors.reset);\n }\n return;\n }\n\n // Multi-line mode with intelligent wrapping\n const lines: string[] = [];\n let currentLine = \"\";\n const maxLineLength = settings.display.line_wrap_length;\n\n for (const group of displayOrder) {\n for (const key of group) {\n const value = info[key as keyof SystemInfo] as string;\n const formatted = formatValue(key, value, settings);\n\n if (formatted && formatted.trim()) {\n const formattedLength = removeAnsiCodes(formatted).length;\n const currentLineLength = removeAnsiCodes(currentLine).length;\n\n if (\n currentLine &&\n currentLineLength + formattedLength + 1 > maxLineLength\n ) {\n lines.push(currentLine);\n currentLine = formatted;\n } else {\n currentLine = currentLine ? `${currentLine} ${formatted}` : formatted;\n }\n }\n }\n }\n\n if (currentLine) {\n lines.push(currentLine);\n }\n\n // Output\n if (lines.length > 0) {\n lines.forEach((line) => {\n console.log(line + colors.reset);\n });\n } else if (settings.advanced.debug) {\n console.log(\"No system information could be displayed\");\n }\n}\n\nfunction handleSettingsCommand(args: string[]): boolean {\n const settings = loadSettings();\n\n if (args.includes(\"--settings-init\")) {\n if (saveSettings(DEFAULT_SETTINGS)) {\n console.log(\"Settings initialized with defaults\");\n } else {\n console.log(\"Failed to initialize settings\");\n }\n return true;\n }\n\n if (args.includes(\"--settings-show\")) {\n console.log(\"Current settings:\");\n console.log(JSON.stringify(settings, null, 2));\n return true;\n }\n\n if (args.includes(\"--settings-reset\")) {\n if (saveSettings(DEFAULT_SETTINGS)) {\n console.log(\"Settings reset to defaults\");\n } else {\n console.log(\"Failed to reset settings\");\n }\n return true;\n }\n\n if (args.includes(\"--refresh\")) {\n try {\n if (fs.existsSync(CACHE_FILE)) {\n fs.unlinkSync(CACHE_FILE);\n console.log(\"Cache cleared\");\n }\n } catch (error) {\n console.error(\"Error clearing cache:\", (error as Error).message);\n }\n return true;\n }\n\n const setIndex = args.indexOf(\"--set\");\n if (setIndex !== -1 && args[setIndex + 1] && args[setIndex + 2]) {\n const key = args[setIndex + 1];\n const value = args[setIndex + 2];\n\n try {\n const parsedValue =\n value.startsWith(\"{\") || value.startsWith(\"[\")\n ? JSON.parse(value)\n : value;\n\n const keys = key.split(\".\");\n let current: any = settings;\n for (let i = 0; i < keys.length - 1; i++) {\n if (!current[keys[i]]) current[keys[i]] = {};\n current = current[keys[i]];\n }\n current[keys[keys.length - 1]] = parsedValue;\n\n if (saveSettings(settings)) {\n console.log(`Setting ${key} = ${value}`);\n } else {\n console.log(\"Failed to save settings\");\n }\n } catch (error) {\n console.error(\"Error setting value:\", (error as Error).message);\n }\n return true;\n }\n\n return false;\n}\n\nfunction installShellGreeting(): void {\n const homeDir = os.homedir();\n\n let configDir: string, scriptPath: string;\n if (IS_WINDOWS) {\n configDir = path.join(homeDir, \"AppData\", \"Local\");\n scriptPath = path.join(configDir, \"systeminfo\");\n } else {\n configDir = path.join(homeDir, \".config\");\n scriptPath = path.join(configDir, \"systeminfo\");\n }\n\n const currentScript = path.resolve(__filename);\n\n try {\n if (!fs.existsSync(configDir)) {\n fs.mkdirSync(configDir, { recursive: true });\n }\n\n fs.copyFileSync(currentScript, scriptPath);\n if (!IS_WINDOWS) {\n fs.chmodSync(scriptPath, \"755\");\n }\n\n if (IS_WINDOWS) {\n console.log(\"Windows installation:\");\n console.log(\"1. Script copied to:\", scriptPath);\n console.log(\"2. To add to PowerShell profile, run:\");\n console.log(` Add-Content $PROFILE \"node '${scriptPath}'\"`);\n console.log(\n \"3. To add to Command Prompt, create a batch file in your startup folder\"\n );\n\n const startupBat = path.join(configDir, \"systeminfo-startup.bat\");\n fs.writeFileSync(startupBat, `@echo off\\nnode \"${scriptPath}\"\\n`);\n console.log(\"4. Batch file created:\", startupBat);\n } else {\n try {\n const hushLoginPath = path.join(homeDir, \".hushlogin\");\n fs.writeFileSync(hushLoginPath, \"\");\n } catch {}\n\n const bashrcPath = path.join(homeDir, \".bashrc\");\n const bashLine = `node ${scriptPath}`;\n\n if (fs.existsSync(bashrcPath)) {\n const bashrc = fs.readFileSync(bashrcPath, \"utf8\");\n if (!bashrc.includes(\"systeminfo\")) {\n fs.appendFileSync(bashrcPath, `\\n${bashLine}\\n`);\n }\n } else {\n fs.writeFileSync(bashrcPath, `${bashLine}\\n`);\n }\n\n const zshrcPath = path.join(homeDir, \".zshrc\");\n if (fs.existsSync(zshrcPath)) {\n const zshrc = fs.readFileSync(zshrcPath, \"utf8\");\n if (!zshrc.includes(\"systeminfo\")) {\n fs.appendFileSync(zshrcPath, `\\n${bashLine}\\n`);\n }\n }\n\n const fishConfigPath = path.join(\n homeDir,\n \".config\",\n \"fish\",\n \"config.fish\"\n );\n if (fs.existsSync(fishConfigPath)) {\n const fishConfig = fs.readFileSync(fishConfigPath, \"utf8\");\n if (!fishConfig.includes(\"systeminfo\")) {\n fs.appendFileSync(\n fishConfigPath,\n `\\nset -U fish_greeting \"\"\\n${bashLine}\\n`\n );\n }\n }\n\n const nushellConfigPath = path.join(\n homeDir,\n \".config\",\n \"nushell\",\n \"config.nu\"\n );\n if (fs.existsSync(nushellConfigPath)) {\n const nushellConfig = fs.readFileSync(nushellConfigPath, \"utf8\");\n if (!nushellConfig.includes(\"systeminfo\")) {\n fs.appendFileSync(\n nushellConfigPath,\n `\\n$env.config.show_banner = false\\n${bashLine}\\n`\n );\n }\n }\n }\n\n console.log(\"Shell greeting installation completed!\");\n } catch (error) {\n console.error(\"Error installing shell greeting:\", (error as Error).message);\n process.exit(1);\n }\n}\n\nfunction parseCLIMode(args: string[]): string[] | null {\n for (const arg of args) {\n if (!arg.startsWith(\"--\") && arg.includes(\",\")) {\n return arg\n .split(\",\")\n .map((part) => part.trim())\n .filter((part) => part.length > 0);\n }\n }\n\n for (const arg of args) {\n if (!arg.startsWith(\"--\") && !arg.includes(\"=\") && arg.length > 0) {\n return [arg.trim()];\n }\n }\n\n return null;\n}\n\nasync function showHelp(): Promise<void> {\n console.log(`\nSystem Info Script - TypeScript Version\n\nUsage:\n about-system [options]\n about-system <part1,part2,...> # CLI mode: show specific parts only\n\nOptions:\n --help, -h Show this help message\n --install Install as shell greeting\n --settings-init Initialize settings file with defaults\n --settings-show Display current settings\n --settings-reset Reset settings to defaults\n --refresh Clear the cache file\n --set <key> <value> Set a configuration value (use dot notation)\n --json Output as JSON\n\nExamples:\n about-system # Show all info (default)\n about-system cpu,os # Show only CPU and OS info\n about-system user,hostname,ip # Show user, hostname, and IP\n about-system disk_used # Show only disk usage\n about-system --install\n about-system --set display.show_emojis false\n about-system --set colors.user blue\n about-system --set emojis.cpu \"🚀 \"\n about-system --set labels.cpu \"Processor\"\n about-system --json\n\nSettings file: ${SETTINGS_FILE}\nCache file: ${CACHE_FILE}\n\nPlatform: ${\n IS_WINDOWS\n ? \"Windows\"\n : os.platform() === \"darwin\"\n ? \"macOS\"\n : os.platform() === \"linux\"\n ? \"Linux\"\n : \"Unknown\"\n }\n\nAvailable display blocks:\n Basic: user, hostname, uptime, shell, os, kernel, device\n Resources: disk_used, ram_used, memory_available, swap_used, top_process\n Network: ip, iplocal, city, domain, isp, network_interfaces\n Hardware: cpu, gpu, temperature, battery, screen_resolution\n System: load_average, users_logged_in, mount_points, services_running\n Tools: pacman, ports, containers\n`);\n}\n\nasync function main(): Promise<void> {\n const args = process.argv.slice(2);\n\n if (handleSettingsCommand(args)) {\n return;\n }\n\n if (args.includes(\"--help\") || args.includes(\"-h\")) {\n await showHelp();\n return;\n }\n\n if (args.includes(\"--install\")) {\n installShellGreeting();\n return;\n }\n\n if (args.includes(\"--json\")) {\n const info = await getSystemInfo();\n console.log(JSON.stringify(info, null, 2));\n return;\n }\n\n const cliParts = parseCLIMode(args);\n if (cliParts) {\n const customDisplayOrder = [cliParts];\n await displaySystemInfo(customDisplayOrder);\n return;\n }\n\n await displaySystemInfo();\n}\n\nmain().catch((error) => {\n console.error(\"Error:\", error.message);\n process.exit(1);\n});\n\nexport { displaySystemInfo, installShellGreeting };\n"],"names":["__filename","fileURLToPath","IS_WINDOWS","os","formatValue","key","value","settings","color","colors","emoji","batteryEmoji","output","ports","colorCodes","port","index","colorCode","removeAnsiCodes","str","displaySystemInfo","customDisplayOrder","loadSettings","displayOrder","info","getSystemInfo","allItems","group","formatted","lines","currentLine","maxLineLength","formattedLength","currentLineLength","line","handleSettingsCommand","args","saveSettings","DEFAULT_SETTINGS","fs","CACHE_FILE","error","setIndex","parsedValue","keys","current","i","installShellGreeting","homeDir","configDir","scriptPath","path","currentScript","startupBat","hushLoginPath","bashrcPath","bashLine","zshrcPath","fishConfigPath","nushellConfigPath","parseCLIMode","arg","part","showHelp","SETTINGS_FILE","main","cliParts"],"mappings":";;;;;;AAQA,MAAMA,IAAaC,EAAc,YAAY,GAAG,GAa1CC,IAAaC,EAAG,SAAA,MAAe;AAErC,SAASC,EAAYC,GAAaC,GAAeC,GAA4B;AAC3E,MAAI,CAACD,KAASA,EAAM,KAAA,MAAW,GAAI,QAAO;AAE1C,QAAME,IACJC,EAAOF,EAAS,OAAOF,CAAG,CAAwB,KAAKI,EAAO,OAC1DC,IAAQH,EAAS,QAAQ,eAAcA,EAAS,OAAOF,CAAG,KAAK;AAGrE,MAAIA,MAAQ,aAAaE,EAAS,QAAQ,aAAa;AACrD,UAAMI,IAAeL,EAAM,SAAS,GAAG,IACnCC,EAAS,OAAO,mBAChBA,EAAS,OAAO;AACpB,WAAO,GAAGC,CAAK,GAAGG,CAAY,GAAGL,CAAK;AAAA,EACxC;AAGA,MAA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tC,IACI,YACAC,EAAG,SAAA,MAAe,WAClB,UACAA,EAAG,SAAA,MAAe,UAClB,UACA,SACN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CASD;AACD;AAEA,eAAe8D,IAAsB;AACnC,QAAM7B,IAAO,QAAQ,KAAK,MAAM,CAAC;AAEjC,MAAID,EAAsBC,CAAI;AAC5B;AAGF,MAAIA,EAAK,SAAS,QAAQ,KAAKA,EAAK,SAAS,IAAI,GAAG;AAClD,UAAM2B,EAAA;AACN;AAAA,EACF;AAEA,MAAI3B,EAAK,SAAS,WAAW,GAAG;AAC9B,IAAAW,EAAA;AACA;AAAA,EACF;AAEA,MAAIX,EAAK,SAAS,QAAQ,GAAG;AAC3B,UAAMZ,IAAO,MAAMC,EAAA;AACnB,YAAQ,IAAI,KAAK,UAAUD,GAAM,MAAM,CAAC,CAAC;AACzC;AAAA,EACF;AAEA,QAAM0C,IAAWN,EAAaxB,CAAI;AAClC,MAAI8B,GAAU;AAEZ,UAAM9C,EADqB,CAAC8C,CAAQ,CACM;AAC1C;AAAA,EACF;AAEA,QAAM9C,EAAA;AACR;AAEA6C,IAAO,MAAM,CAACxB,MAAU;AACtB,UAAQ,MAAM,UAAUA,EAAM,OAAO,GACrC,QAAQ,KAAK,CAAC;AAChB,CAAC;"}
@@ -0,0 +1,52 @@
1
+ import { DisplaySystemInfoFunction } from './systeminfo-types.js';
2
+ import { GetSystemInfoFunction } from './systeminfo-types.js';
3
+ import { Platform } from './systeminfo-types.js';
4
+ import { PlatformAvailability } from './systeminfo-types.js';
5
+ import { SystemInfo } from './systeminfo-types.js';
6
+ import { SystemInfo as SystemInfo_2 } from './systeminfo-types';
7
+ import { SystemInfoOptions } from './systeminfo-types.js';
8
+ import { SystemInfoOptions as SystemInfoOptions_2 } from './systeminfo-types';
9
+
10
+ /**
11
+ * Cache storage structure
12
+ */
13
+ declare interface Cache {
14
+ [key: string]: CacheEntry;
15
+ }
16
+
17
+ /**
18
+ * Represents a cached value with timestamp
19
+ */
20
+ declare interface CacheEntry {
21
+ value: any;
22
+ timestamp: number;
23
+ }
24
+
25
+ export { DisplaySystemInfoFunction }
26
+
27
+ /**
28
+ * Get all system information as a clean JSON object
29
+ */
30
+ export declare function getSystemInfo(options?: SystemInfoOptions_2): Promise<SystemInfo_2>;
31
+
32
+ export { GetSystemInfoFunction }
33
+
34
+ /**
35
+ * Loads cache from disk
36
+ */
37
+ export declare function loadCache(): Cache;
38
+
39
+ export { Platform }
40
+
41
+ export { PlatformAvailability }
42
+
43
+ /**
44
+ * Saves cache to disk
45
+ */
46
+ export declare function saveCache(cache: Cache): void;
47
+
48
+ export { SystemInfo }
49
+
50
+ export { SystemInfoOptions }
51
+
52
+ export { }
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ import { g as s, l as o, s as t } from "./system-info-api-Bc0iSNdN.js";
2
+ export {
3
+ s as getSystemInfo,
4
+ o as loadCache,
5
+ t as saveCache
6
+ };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}