@gjsify/rolldown-plugin-gjsify 0.16.9 → 0.18.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/utils/runtime.d.ts +21 -0
- package/lib/utils/runtime.js +30 -0
- package/package.json +7 -7
package/lib/utils/runtime.d.ts
CHANGED
|
@@ -16,3 +16,24 @@ export declare function isGjs(): boolean;
|
|
|
16
16
|
* with `isGjs()` keeps the two host predicates mutually exclusive.
|
|
17
17
|
*/
|
|
18
18
|
export declare function isNode(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The raw GJS runtime version from `imports.system.version` (e.g. `18800` for
|
|
21
|
+
* GJS 1.88.0), or `undefined` when not running under GJS.
|
|
22
|
+
*
|
|
23
|
+
* A distinct probe from {@link isGjs}: use it where the caller needs the numeric
|
|
24
|
+
* version (to format a banner) OR an early GJS short-circuit that must not rely
|
|
25
|
+
* on `@gjsify/process`'s faked `process.versions.node`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function gjsSystemVersion(): number | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Force a hard exit under GJS via `imports.system.exit(code)`.
|
|
30
|
+
*
|
|
31
|
+
* GJS has no atexit hook and would exit 0 at natural shutdown, so a non-zero
|
|
32
|
+
* `process.exitCode` alone does not stick — the CLI must call `system.exit`
|
|
33
|
+
* explicitly there. Node never exposes `imports`, so this is a no-op returning
|
|
34
|
+
* `false`, letting callers fall back to `process.exit`/`process.exitCode`.
|
|
35
|
+
*
|
|
36
|
+
* @returns `true` when the GJS exit was invoked (running under GJS); `false` on
|
|
37
|
+
* Node (the caller owns the Node exit path).
|
|
38
|
+
*/
|
|
39
|
+
export declare function gjsExit(code: number): boolean;
|
package/lib/utils/runtime.js
CHANGED
|
@@ -37,3 +37,33 @@ export function isNode() {
|
|
|
37
37
|
const proc = globalThis.process;
|
|
38
38
|
return typeof proc?.versions?.node === 'string';
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* The raw GJS runtime version from `imports.system.version` (e.g. `18800` for
|
|
42
|
+
* GJS 1.88.0), or `undefined` when not running under GJS.
|
|
43
|
+
*
|
|
44
|
+
* A distinct probe from {@link isGjs}: use it where the caller needs the numeric
|
|
45
|
+
* version (to format a banner) OR an early GJS short-circuit that must not rely
|
|
46
|
+
* on `@gjsify/process`'s faked `process.versions.node`.
|
|
47
|
+
*/
|
|
48
|
+
export function gjsSystemVersion() {
|
|
49
|
+
return globalThis.imports?.system?.version;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Force a hard exit under GJS via `imports.system.exit(code)`.
|
|
53
|
+
*
|
|
54
|
+
* GJS has no atexit hook and would exit 0 at natural shutdown, so a non-zero
|
|
55
|
+
* `process.exitCode` alone does not stick — the CLI must call `system.exit`
|
|
56
|
+
* explicitly there. Node never exposes `imports`, so this is a no-op returning
|
|
57
|
+
* `false`, letting callers fall back to `process.exit`/`process.exitCode`.
|
|
58
|
+
*
|
|
59
|
+
* @returns `true` when the GJS exit was invoked (running under GJS); `false` on
|
|
60
|
+
* Node (the caller owns the Node exit path).
|
|
61
|
+
*/
|
|
62
|
+
export function gjsExit(code) {
|
|
63
|
+
const sys = globalThis.imports?.system;
|
|
64
|
+
if (sys?.exit) {
|
|
65
|
+
sys.exit(code);
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
return false;
|
|
69
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/rolldown-plugin-gjsify",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Rolldown / Rollup / Vite plugin orchestrator for GJS, Node, and Browser targets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
],
|
|
56
56
|
"license": "MIT",
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@gjsify/console": "^0.
|
|
59
|
-
"@gjsify/resolve-npm": "^0.
|
|
60
|
-
"@gjsify/rolldown-plugin-deepkit": "^0.
|
|
61
|
-
"@gjsify/rolldown-plugin-pnp": "^0.
|
|
62
|
-
"@gjsify/vite-plugin-blueprint": "^0.
|
|
58
|
+
"@gjsify/console": "^0.18.0",
|
|
59
|
+
"@gjsify/resolve-npm": "^0.18.0",
|
|
60
|
+
"@gjsify/rolldown-plugin-deepkit": "^0.18.0",
|
|
61
|
+
"@gjsify/rolldown-plugin-pnp": "^0.18.0",
|
|
62
|
+
"@gjsify/vite-plugin-blueprint": "^0.18.0",
|
|
63
63
|
"@rollup/pluginutils": "^5.4.0",
|
|
64
64
|
"acorn": "^8.17.0",
|
|
65
65
|
"acorn-walk": "^8.3.5",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"sass": "^1.101.0"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"@gjsify/lightningcss-native": "^0.
|
|
71
|
+
"@gjsify/lightningcss-native": "^0.18.0",
|
|
72
72
|
"rolldown": "^1.1.4"
|
|
73
73
|
},
|
|
74
74
|
"peerDependenciesMeta": {
|