@qvac/diagnostics 0.1.1 → 0.1.2

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.
Files changed (3) hide show
  1. package/NOTICE +16 -1
  2. package/index.js +8 -66
  3. package/package.json +18 -3
package/NOTICE CHANGED
@@ -1,4 +1,19 @@
1
1
  @qvac/diagnostics
2
2
  Copyright 2026 Tether Data, S.A. de C.V.
3
3
 
4
- This product includes software developed by Tether Data, S.A. de C.V.
4
+ This product includes third-party components under their
5
+ respective licenses. @qvac/diagnostics itself is licensed under
6
+ Apache-2.0; bundled dependencies are governed by the licenses
7
+ listed below.
8
+
9
+ =========================================================================
10
+ JavaScript Dependencies
11
+ =========================================================================
12
+
13
+ --- apache-2.0 (Apache License 2.0) ---
14
+
15
+ bare-os@3.9.1
16
+ https://github.com/holepunchto/bare-os
17
+ which-runtime@1.4.0
18
+ https://github.com/holepunchto/which-runtime
19
+
package/index.js CHANGED
@@ -1,30 +1,7 @@
1
1
  'use strict'
2
2
 
3
- let _os
4
- try {
5
- _os = require('bare-os')
6
- } catch (e) {
7
- try {
8
- _os = require('os')
9
- } catch (e2) {
10
- _os = null
11
- }
12
- }
13
-
14
- let _process
15
- if (typeof global !== 'undefined' && global.process) {
16
- _process = global.process
17
- } else {
18
- try {
19
- _process = require('process')
20
- } catch (e) {
21
- try {
22
- _process = require('bare-process')
23
- } catch (e2) {
24
- _process = null
25
- }
26
- }
27
- }
3
+ const w = require('which-runtime')
4
+ const os = (w.isNode || w.isBare) ? require('os') : null
28
5
 
29
6
  /**
30
7
  * Version of the diagnostic report format
@@ -142,45 +119,10 @@ function registerExtension (name, data) {
142
119
  * @returns {EnvironmentInfo}
143
120
  */
144
121
  function collectEnvironment () {
145
- let os = 'unknown'
146
- let arch = 'unknown'
147
- let osVersion = 'unknown'
148
- let runtime = 'unknown'
149
-
150
- if (_os) {
151
- try {
152
- os = typeof _os.platform === 'function' ? _os.platform() : String(_os.platform || 'unknown')
153
- } catch (e) {
154
- os = 'unknown'
155
- }
156
- try {
157
- arch = typeof _os.arch === 'function' ? _os.arch() : String(_os.arch || 'unknown')
158
- } catch (e) {
159
- arch = 'unknown'
160
- }
161
- try {
162
- osVersion = typeof _os.release === 'function' ? _os.release() : String(_os.release || 'unknown')
163
- } catch (e) {
164
- osVersion = 'unknown'
165
- }
166
- }
167
-
168
- if (_process) {
169
- try {
170
- const ver = _process.version || 'unknown'
171
- const plat = _process.platform || os
172
- runtime = plat === 'android' || plat === 'ios' ? 'bare' : (typeof Bare !== 'undefined' ? 'bare' : 'node')
173
- if (runtime === 'node') {
174
- runtime = 'node ' + ver
175
- } else {
176
- runtime = 'bare ' + ver
177
- }
178
- } catch (e) {
179
- runtime = 'unknown'
180
- }
181
- }
122
+ const runtime = w.isBare ? 'bare' + w.version : (w.isNode ? 'node' + w.version : 'unknown')
123
+ const osVersion = os ? os.release() : 'unknown'
182
124
 
183
- return { os, arch, osVersion, runtime }
125
+ return { os: w.platform, arch: w.arch, osVersion, runtime }
184
126
  }
185
127
 
186
128
  /**
@@ -193,9 +135,9 @@ function collectHardware () {
193
135
  let cpuCores = 0
194
136
  let totalMemoryMB = 0
195
137
 
196
- if (_os) {
138
+ if (os) {
197
139
  try {
198
- const cpuList = typeof _os.cpus === 'function' ? _os.cpus() : []
140
+ const cpuList = typeof os.cpus === 'function' ? os.cpus() : []
199
141
  if (cpuList && cpuList.length > 0) {
200
142
  cpuModel = cpuList[0].model || 'unknown'
201
143
  cpuCores = cpuList.length
@@ -205,7 +147,7 @@ function collectHardware () {
205
147
  cpuCores = 0
206
148
  }
207
149
  try {
208
- const totalBytes = typeof _os.totalmem === 'function' ? _os.totalmem() : 0
150
+ const totalBytes = typeof os.totalmem === 'function' ? os.totalmem() : 0
209
151
  totalMemoryMB = Math.floor(totalBytes / (1024 * 1024))
210
152
  } catch (e) {
211
153
  totalMemoryMB = 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qvac/diagnostics",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Diagnostic report generation library for QVAC",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -19,15 +19,30 @@
19
19
  "qvac"
20
20
  ],
21
21
  "license": "Apache-2.0",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/tetherto/qvac.git",
25
+ "directory": "packages/diagnostics"
26
+ },
27
+ "bugs": "https://github.com/tetherto/qvac/issues",
28
+ "homepage": "https://github.com/tetherto/qvac/tree/main/packages/diagnostics#readme",
29
+ "imports": {
30
+ "os": {
31
+ "bare": "bare-os",
32
+ "default": "os"
33
+ }
34
+ },
22
35
  "exports": {
23
36
  ".": {
24
37
  "types": "./index.d.ts",
25
38
  "default": "./index.js"
26
39
  }
27
40
  },
28
- "devDependencies": {
41
+ "dependencies": {
29
42
  "bare-os": "^3.4.0",
30
- "bare-process": "^4.2.1",
43
+ "which-runtime": "^1.4.0"
44
+ },
45
+ "devDependencies": {
31
46
  "brittle": "^3.10.1",
32
47
  "standard": "17.1.0",
33
48
  "typescript": "^5.9.3"