@gjsify/runtime 0.3.13 → 0.3.15
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/lib/esm/index.js +18 -7
- package/package.json +2 -2
package/lib/esm/index.js
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
|
+
//#region src/index.ts
|
|
2
|
+
/**
|
|
3
|
+
* `true` when running on GJS (GNOME JavaScript).
|
|
4
|
+
*/
|
|
1
5
|
const isGJS = typeof process !== "undefined" && typeof process.versions?.gjs === "string";
|
|
6
|
+
/**
|
|
7
|
+
* `true` when running on Node.js.
|
|
8
|
+
*/
|
|
2
9
|
const isNode = typeof process !== "undefined" && typeof process.versions?.node === "string";
|
|
10
|
+
/**
|
|
11
|
+
* Human-readable runtime name: `'GJS'`, `'Node.js'`, or `'Unknown'`.
|
|
12
|
+
*/
|
|
3
13
|
const runtimeName = isGJS ? "GJS" : isNode ? "Node.js" : "Unknown";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Runtime version string, e.g. `'1.86.0'` (GJS) or `'24.1.0'` (Node.js).
|
|
16
|
+
* `undefined` if the runtime cannot be detected.
|
|
17
|
+
*/
|
|
18
|
+
const runtimeVersion = isGJS ? process.versions.gjs : isNode ? process.versions.node : undefined;
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { isGJS, isNode, runtimeName, runtimeVersion };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/runtime",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.15",
|
|
4
4
|
"description": "Platform-independent runtime detection for GJS and Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gjs",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"build:types": "tsc"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@gjsify/cli": "^0.3.
|
|
30
|
+
"@gjsify/cli": "^0.3.15",
|
|
31
31
|
"@types/node": "^25.6.0",
|
|
32
32
|
"typescript": "^6.0.3"
|
|
33
33
|
}
|