@gjsify/os 0.4.35 → 0.4.37
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/browser.js +3 -0
- package/lib/types/browser.d.ts +107 -0
- package/lib/types/index.browser.spec.d.ts +2 -0
- package/package.json +25 -9
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";const e=`
|
|
2
|
+
`,t=`/dev/null`,homedir=()=>`/`,hostname=()=>`localhost`,tmpdir=()=>`/tmp`,release=()=>``,type=()=>`Browser`,version=()=>``,machine=()=>`browser`,platform=()=>`browser`,arch=()=>`browser`,endianness=()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256?`LE`:`BE`},cpus=()=>[],totalmem=()=>0,freemem=()=>0,loadavg=()=>[0,0,0],uptime=()=>0,networkInterfaces=()=>({}),availableParallelism=()=>{let e=globalThis.navigator;return e?.hardwareConcurrency&&e.hardwareConcurrency>0?e.hardwareConcurrency:1},userInfo=()=>({uid:-1,gid:-1,username:`browser`,homedir:`/`,shell:``}),getPriority=e=>0,setPriority=(e,t)=>{},n={UV_UDP_REUSEADDR:4,errno:{},signals:{},priority:{PRIORITY_LOW:19,PRIORITY_BELOW_NORMAL:10,PRIORITY_NORMAL:0,PRIORITY_ABOVE_NORMAL:-7,PRIORITY_HIGH:-14,PRIORITY_HIGHEST:-20},dlopen:{}};var r={EOL:`
|
|
3
|
+
`,devNull:t,arch,availableParallelism,constants:n,cpus,endianness,freemem,getPriority,homedir,hostname,loadavg,machine,networkInterfaces,platform,release,setPriority,tmpdir,totalmem,type,uptime,userInfo,version};export{e as EOL,arch,availableParallelism,n as constants,cpus,r as default,t as devNull,endianness,freemem,getPriority,homedir,hostname,loadavg,machine,networkInterfaces,platform,release,setPriority,tmpdir,totalmem,type,uptime,userInfo,version};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
export declare const EOL = "\n";
|
|
2
|
+
export declare const devNull = "/dev/null";
|
|
3
|
+
export declare const homedir: () => string;
|
|
4
|
+
export declare const hostname: () => string;
|
|
5
|
+
export declare const tmpdir: () => string;
|
|
6
|
+
export declare const release: () => string;
|
|
7
|
+
export declare const type: () => string;
|
|
8
|
+
export declare const version: () => string;
|
|
9
|
+
export declare const machine: () => string;
|
|
10
|
+
export declare const platform: () => NodeJS.Platform;
|
|
11
|
+
export declare const arch: () => NodeJS.Architecture;
|
|
12
|
+
export declare const endianness: () => "BE" | "LE";
|
|
13
|
+
interface CpuInfo {
|
|
14
|
+
model: string;
|
|
15
|
+
speed: number;
|
|
16
|
+
times: {
|
|
17
|
+
user: number;
|
|
18
|
+
nice: number;
|
|
19
|
+
sys: number;
|
|
20
|
+
idle: number;
|
|
21
|
+
irq: number;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
interface NetworkInterfaceInfo {
|
|
25
|
+
address: string;
|
|
26
|
+
netmask: string;
|
|
27
|
+
family: string;
|
|
28
|
+
mac: string;
|
|
29
|
+
internal: boolean;
|
|
30
|
+
cidr: string | null;
|
|
31
|
+
scopeid?: number;
|
|
32
|
+
}
|
|
33
|
+
export declare const cpus: () => CpuInfo[];
|
|
34
|
+
export declare const totalmem: () => number;
|
|
35
|
+
export declare const freemem: () => number;
|
|
36
|
+
export declare const loadavg: () => [number, number, number];
|
|
37
|
+
export declare const uptime: () => number;
|
|
38
|
+
export declare const networkInterfaces: () => Record<string, NetworkInterfaceInfo[] | undefined>;
|
|
39
|
+
export declare const availableParallelism: () => number;
|
|
40
|
+
export declare const userInfo: () => {
|
|
41
|
+
uid: number;
|
|
42
|
+
gid: number;
|
|
43
|
+
username: string;
|
|
44
|
+
homedir: string;
|
|
45
|
+
shell: string;
|
|
46
|
+
};
|
|
47
|
+
export declare const getPriority: (_pid?: number) => number;
|
|
48
|
+
export declare const setPriority: (_pidOrPriority: number, _priority?: number) => void;
|
|
49
|
+
export declare const constants: {
|
|
50
|
+
readonly UV_UDP_REUSEADDR: 4;
|
|
51
|
+
readonly errno: {};
|
|
52
|
+
readonly signals: {};
|
|
53
|
+
readonly priority: {
|
|
54
|
+
readonly PRIORITY_LOW: 19;
|
|
55
|
+
readonly PRIORITY_BELOW_NORMAL: 10;
|
|
56
|
+
readonly PRIORITY_NORMAL: 0;
|
|
57
|
+
readonly PRIORITY_ABOVE_NORMAL: -7;
|
|
58
|
+
readonly PRIORITY_HIGH: -14;
|
|
59
|
+
readonly PRIORITY_HIGHEST: -20;
|
|
60
|
+
};
|
|
61
|
+
readonly dlopen: {};
|
|
62
|
+
};
|
|
63
|
+
declare const _default: {
|
|
64
|
+
EOL: string;
|
|
65
|
+
devNull: string;
|
|
66
|
+
arch: () => NodeJS.Architecture;
|
|
67
|
+
availableParallelism: () => number;
|
|
68
|
+
constants: {
|
|
69
|
+
readonly UV_UDP_REUSEADDR: 4;
|
|
70
|
+
readonly errno: {};
|
|
71
|
+
readonly signals: {};
|
|
72
|
+
readonly priority: {
|
|
73
|
+
readonly PRIORITY_LOW: 19;
|
|
74
|
+
readonly PRIORITY_BELOW_NORMAL: 10;
|
|
75
|
+
readonly PRIORITY_NORMAL: 0;
|
|
76
|
+
readonly PRIORITY_ABOVE_NORMAL: -7;
|
|
77
|
+
readonly PRIORITY_HIGH: -14;
|
|
78
|
+
readonly PRIORITY_HIGHEST: -20;
|
|
79
|
+
};
|
|
80
|
+
readonly dlopen: {};
|
|
81
|
+
};
|
|
82
|
+
cpus: () => CpuInfo[];
|
|
83
|
+
endianness: () => "BE" | "LE";
|
|
84
|
+
freemem: () => number;
|
|
85
|
+
getPriority: (_pid?: number) => number;
|
|
86
|
+
homedir: () => string;
|
|
87
|
+
hostname: () => string;
|
|
88
|
+
loadavg: () => [number, number, number];
|
|
89
|
+
machine: () => string;
|
|
90
|
+
networkInterfaces: () => Record<string, NetworkInterfaceInfo[] | undefined>;
|
|
91
|
+
platform: () => NodeJS.Platform;
|
|
92
|
+
release: () => string;
|
|
93
|
+
setPriority: (_pidOrPriority: number, _priority?: number) => void;
|
|
94
|
+
tmpdir: () => string;
|
|
95
|
+
totalmem: () => number;
|
|
96
|
+
type: () => string;
|
|
97
|
+
uptime: () => number;
|
|
98
|
+
userInfo: () => {
|
|
99
|
+
uid: number;
|
|
100
|
+
gid: number;
|
|
101
|
+
username: string;
|
|
102
|
+
homedir: string;
|
|
103
|
+
shell: string;
|
|
104
|
+
};
|
|
105
|
+
version: () => string;
|
|
106
|
+
};
|
|
107
|
+
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/os",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.37",
|
|
4
4
|
"description": "Node.js os module for Gjs",
|
|
5
5
|
"module": "lib/esm/index.js",
|
|
6
6
|
"types": "lib/types/index.d.ts",
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
".": {
|
|
13
13
|
"types": "./lib/types/index.d.ts",
|
|
14
14
|
"default": "./lib/esm/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./browser": {
|
|
17
|
+
"types": "./lib/types/browser.d.ts",
|
|
18
|
+
"default": "./lib/esm/browser.js"
|
|
15
19
|
}
|
|
16
20
|
},
|
|
17
21
|
"scripts": {
|
|
@@ -23,6 +27,7 @@
|
|
|
23
27
|
"build:test": "gjsify run build:test:gjs && gjsify run build:test:node",
|
|
24
28
|
"build:test:gjs": "gjsify build src/test.mts --app gjs --outfile test.gjs.mjs",
|
|
25
29
|
"build:test:node": "gjsify build src/test.mts --app node --outfile test.node.mjs",
|
|
30
|
+
"build:test:browser": "gjsify build src/test.browser.mts --app browser --outfile dist/test.browser.mjs",
|
|
26
31
|
"test": "gjsify run build:gjsify && gjsify run build:test && gjsify run test:node && gjsify run test:gjs",
|
|
27
32
|
"test:gjs": "gjsify run test.gjs.mjs",
|
|
28
33
|
"test:node": "node test.node.mjs"
|
|
@@ -33,21 +38,32 @@
|
|
|
33
38
|
"os"
|
|
34
39
|
],
|
|
35
40
|
"dependencies": {
|
|
36
|
-
"@girs/gio-2.0": "2.88.0-4.0.
|
|
37
|
-
"@girs/glib-2.0": "2.88.0-4.0.
|
|
38
|
-
"@gjsify/utils": "^0.4.
|
|
41
|
+
"@girs/gio-2.0": "2.88.0-4.0.4",
|
|
42
|
+
"@girs/glib-2.0": "2.88.0-4.0.4",
|
|
43
|
+
"@gjsify/utils": "^0.4.37"
|
|
39
44
|
},
|
|
40
45
|
"devDependencies": {
|
|
41
|
-
"@gjsify/cli": "^0.4.
|
|
42
|
-
"@gjsify/unit": "^0.4.
|
|
46
|
+
"@gjsify/cli": "^0.4.37",
|
|
47
|
+
"@gjsify/unit": "^0.4.37",
|
|
43
48
|
"@types/node": "^25.9.1",
|
|
44
|
-
"typescript": "^
|
|
49
|
+
"typescript": "^5.9.3"
|
|
45
50
|
},
|
|
46
51
|
"gjsify": {
|
|
47
52
|
"runtimes": {
|
|
48
53
|
"gjs": "polyfill",
|
|
49
54
|
"node": "none",
|
|
50
|
-
"browser": "
|
|
55
|
+
"browser": "polyfill",
|
|
56
|
+
"nativescript": "none"
|
|
51
57
|
}
|
|
52
|
-
}
|
|
58
|
+
},
|
|
59
|
+
"license": "MIT",
|
|
60
|
+
"repository": {
|
|
61
|
+
"type": "git",
|
|
62
|
+
"url": "git+https://github.com/gjsify/gjsify.git",
|
|
63
|
+
"directory": "packages/node/os"
|
|
64
|
+
},
|
|
65
|
+
"bugs": {
|
|
66
|
+
"url": "https://github.com/gjsify/gjsify/issues"
|
|
67
|
+
},
|
|
68
|
+
"homepage": "https://github.com/gjsify/gjsify/tree/main/packages/node/os#readme"
|
|
53
69
|
}
|