@gjsify/runtime 0.30.0 → 0.32.0
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 +1 -1
- package/lib/types/index.d.ts +30 -6
- package/lib/types/index.spec.d.ts +2 -0
- package/package.json +15 -5
package/lib/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=typeof process<`u
|
|
1
|
+
const e=typeof process<`u`?process:void 0,t=globalThis.Bun!==void 0,n=globalThis.Deno!==void 0,r=globalThis.imports?.gi!==void 0||!t&&!n&&typeof e?.versions?.gjs==`string`,i=!t&&!n&&!r&&typeof e?.versions?.node==`string`,a=t?`Bun`:n?`Deno`:r?`GJS`:i?`Node.js`:`Unknown`,o=t?`bun`:n?`deno`:r?`gjs`:i?`node`:void 0,s=t?globalThis.Bun?.version:n?globalThis.Deno?.version?.deno:r?e?.versions?.gjs:i?e?.versions?.node:void 0;export{t as isBun,n as isDeno,r as isGJS,i as isNode,a as runtimeName,o as runtimeTarget,s as runtimeVersion};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,17 +1,41 @@
|
|
|
1
|
+
/** `true` when running on Bun. */
|
|
2
|
+
export declare const isBun: boolean;
|
|
3
|
+
/** `true` when running on Deno. */
|
|
4
|
+
export declare const isDeno: boolean;
|
|
1
5
|
/**
|
|
2
6
|
* `true` when running on GJS (GNOME JavaScript).
|
|
7
|
+
*
|
|
8
|
+
* Checks the ambient GJS host (`imports.gi`) as well as `process.versions.gjs`:
|
|
9
|
+
* the latter is set by `@gjsify/process` via `@gjsify/node-globals`, so a bare
|
|
10
|
+
* GJS program that does not pull the Node globals in has no `process` at all
|
|
11
|
+
* and used to report `'Unknown'` about itself.
|
|
3
12
|
*/
|
|
4
13
|
export declare const isGJS: boolean;
|
|
5
|
-
/**
|
|
6
|
-
* `true` when running on Node.js.
|
|
7
|
-
*/
|
|
14
|
+
/** `true` when running on Node.js — and NOT on Bun, Deno or GJS. */
|
|
8
15
|
export declare const isNode: boolean;
|
|
9
16
|
/**
|
|
10
|
-
* Human-readable runtime name: `'GJS'`, `'Node.js'`,
|
|
17
|
+
* Human-readable runtime name: `'GJS'`, `'Node.js'`, `'Bun'`, `'Deno'`, or
|
|
18
|
+
* `'Unknown'`.
|
|
19
|
+
*
|
|
20
|
+
* For the lowercase token `gjsify run --runtime` accepts, use
|
|
21
|
+
* {@link runtimeTarget}.
|
|
11
22
|
*/
|
|
12
23
|
export declare const runtimeName: string;
|
|
13
24
|
/**
|
|
14
|
-
*
|
|
15
|
-
* `
|
|
25
|
+
* The runtime as the CLI spells it — `'gjs' | 'node' | 'bun' | 'deno'`, the
|
|
26
|
+
* vocabulary of `--runtime` and of `gjsify.example.runtimes`. `undefined` on an
|
|
27
|
+
* unrecognised host.
|
|
28
|
+
*
|
|
29
|
+
* Kept distinct from {@link runtimeName}, which is prose for a user interface:
|
|
30
|
+
* one of these two is safe to pass back to the tooling and the other is not.
|
|
31
|
+
*/
|
|
32
|
+
export declare const runtimeTarget: 'gjs' | 'node' | 'bun' | 'deno' | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Runtime version string, e.g. `'1.86.0'` (GJS), `'24.1.0'` (Node.js),
|
|
35
|
+
* `'1.2.0'` (Bun), `'2.1.0'` (Deno). `undefined` if it cannot be determined.
|
|
36
|
+
*
|
|
37
|
+
* Bun and Deno are read from their own globals rather than
|
|
38
|
+
* `process.versions.node`, which on both reports the Node version they emulate
|
|
39
|
+
* — a real number, about a runtime you are not on.
|
|
16
40
|
*/
|
|
17
41
|
export declare const runtimeVersion: string | undefined;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/runtime",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Platform-independent runtime detection for GJS
|
|
3
|
+
"version": "0.32.0",
|
|
4
|
+
"description": "Platform-independent runtime detection for GJS, Node.js, Bun and Deno",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gjs",
|
|
7
7
|
"node",
|
|
@@ -23,14 +23,24 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
|
-
"clear": "gjsify clear lib tsconfig.tsbuildinfo",
|
|
26
|
+
"clear": "gjsify clear lib tsconfig.tsbuildinfo test.gjs.mjs test.node.mjs",
|
|
27
27
|
"check": "gjsify tsc --noEmit",
|
|
28
28
|
"build": "gjsify run build:gjsify && gjsify run build:types",
|
|
29
29
|
"build:gjsify": "gjsify build --library 'src/**/*.{ts,js}' --exclude 'src/**/*.spec.{mts,ts}' 'src/test.{mts,ts}'",
|
|
30
|
-
"build:types": "gjsify tsc"
|
|
30
|
+
"build:types": "gjsify tsc",
|
|
31
|
+
"build:test": "gjsify run build:test:gjs && gjsify run build:test:node",
|
|
32
|
+
"build:test:gjs": "gjsify build src/test.mts --app gjs --outfile test.gjs.mjs",
|
|
33
|
+
"build:test:node": "gjsify build src/test.mts --app node --outfile test.node.mjs",
|
|
34
|
+
"test": "gjsify run build:gjsify && gjsify run build:test && gjsify run test:node && gjsify run test:gjs",
|
|
35
|
+
"test:gjs": "gjsify run test.gjs.mjs",
|
|
36
|
+
"test:node": "node test.node.mjs",
|
|
37
|
+
"test:bun": "bun test.node.mjs",
|
|
38
|
+
"test:deno": "deno run -A --no-lock --node-modules-dir=none test.node.mjs",
|
|
39
|
+
"test:cross-runtime": "gjsify run build:test:node && gjsify run test:node && gjsify run test:bun && gjsify run test:deno"
|
|
31
40
|
},
|
|
32
41
|
"devDependencies": {
|
|
33
|
-
"@gjsify/cli": "^0.
|
|
42
|
+
"@gjsify/cli": "^0.32.0",
|
|
43
|
+
"@gjsify/unit": "^0.32.0",
|
|
34
44
|
"@types/node": "^25.9.2",
|
|
35
45
|
"typescript": "^6.0.3"
|
|
36
46
|
},
|