@gjsify/os 0.54.0 → 0.55.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.
@@ -1,3 +1,3 @@
1
- import"./_virtual/_rolldown/runtime.js";import e from"./constants.js";const t=`
2
- `,n=`/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)=>{},r={UV_UDP_REUSEADDR:4,errno:e.errno,signals:e.signals,priority:{PRIORITY_LOW:19,PRIORITY_BELOW_NORMAL:10,PRIORITY_NORMAL:0,PRIORITY_ABOVE_NORMAL:-7,PRIORITY_HIGH:-14,PRIORITY_HIGHEST:-20},dlopen:{}};var i={EOL:`
3
- `,devNull:n,arch,availableParallelism,constants:r,cpus,endianness,freemem,getPriority,homedir,hostname,loadavg,machine,networkInterfaces,platform,release,setPriority,tmpdir,totalmem,type,uptime,userInfo,version};export{t as EOL,arch,availableParallelism,r as constants,cpus,i as default,n as devNull,endianness,freemem,getPriority,homedir,hostname,loadavg,machine,networkInterfaces,platform,release,setPriority,tmpdir,totalmem,type,uptime,userInfo,version};
1
+ import"./_virtual/_rolldown/runtime.js";import e from"./constants.js";import{SIGNALS as t}from"./signals.js";const n=`
2
+ `,r=`/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)=>{},i={UV_UDP_REUSEADDR:4,errno:e.errno,signals:t.linux,priority:{PRIORITY_LOW:19,PRIORITY_BELOW_NORMAL:10,PRIORITY_NORMAL:0,PRIORITY_ABOVE_NORMAL:-7,PRIORITY_HIGH:-14,PRIORITY_HIGHEST:-20},dlopen:{}};var a={EOL:`
3
+ `,devNull:r,arch,availableParallelism,constants:i,cpus,endianness,freemem,getPriority,homedir,hostname,loadavg,machine,networkInterfaces,platform,release,setPriority,tmpdir,totalmem,type,uptime,userInfo,version};export{n as EOL,arch,availableParallelism,i as constants,cpus,a as default,r as devNull,endianness,freemem,getPriority,homedir,hostname,loadavg,machine,networkInterfaces,platform,release,setPriority,tmpdir,totalmem,type,uptime,userInfo,version};
@@ -1 +1 @@
1
- var e={UV_UDP_REUSEADDR:4,errno:{E2BIG:7,EACCES:13,EADDRINUSE:98,EADDRNOTAVAIL:99,EAFNOSUPPORT:97,EAGAIN:11,EALREADY:114,EBADF:9,EBADMSG:74,EBUSY:16,ECANCELED:125,ECHILD:10,ECONNABORTED:103,ECONNREFUSED:111,ECONNRESET:104,EDEADLK:35,EDESTADDRREQ:89,EDOM:33,EDQUOT:122,EEXIST:17,EFAULT:14,EFBIG:27,EHOSTUNREACH:113,EIDRM:43,EILSEQ:84,EINPROGRESS:115,EINTR:4,EINVAL:22,EIO:5,EISCONN:106,EISDIR:21,ELOOP:40,EMFILE:24,EMLINK:31,EMSGSIZE:90,EMULTIHOP:72,ENAMETOOLONG:36,ENETDOWN:100,ENETRESET:102,ENETUNREACH:101,ENFILE:23,ENOBUFS:105,ENODATA:61,ENODEV:19,ENOENT:2,ENOEXEC:8,ENOLCK:37,ENOLINK:67,ENOMEM:12,ENOMSG:42,ENOPROTOOPT:92,ENOSPC:28,ENOSR:63,ENOSTR:60,ENOSYS:38,ENOTCONN:107,ENOTDIR:20,ENOTEMPTY:39,ENOTSOCK:88,ENOTSUP:95,ENOTTY:25,ENXIO:6,EOPNOTSUPP:95,EOVERFLOW:75,EPERM:1,EPIPE:32,EPROTO:71,EPROTONOSUPPORT:93,EPROTOTYPE:91,ERANGE:34,EROFS:30,ESPIPE:29,ESRCH:3,ESTALE:116,ETIME:62,ETIMEDOUT:110,ETXTBSY:26,EWOULDBLOCK:11,EXDEV:18},signals:{SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGILL:4,SIGTRAP:5,SIGABRT:6,SIGIOT:6,SIGBUS:7,SIGFPE:8,SIGKILL:9,SIGUSR1:10,SIGSEGV:11,SIGUSR2:12,SIGPIPE:13,SIGALRM:14,SIGTERM:15,SIGCHLD:17,SIGSTKFLT:16,SIGCONT:18,SIGSTOP:19,SIGTSTP:20,SIGTTIN:21,SIGTTOU:22,SIGURG:23,SIGXCPU:24,SIGXFSZ:25,SIGVTALRM:26,SIGPROF:27,SIGWINCH:28,SIGIO:29,SIGPOLL:29,SIGPWR:30,SIGSYS:31},priority:{PRIORITY_LOW:19,PRIORITY_BELOW_NORMAL:10,PRIORITY_NORMAL:0,PRIORITY_ABOVE_NORMAL:-7,PRIORITY_HIGH:-14,PRIORITY_HIGHEST:-20},dlopen:{RTLD_LAZY:1,RTLD_NOW:2,RTLD_GLOBAL:256,RTLD_LOCAL:0,RTLD_DEEPBIND:8}};export{e as default};
1
+ var e={UV_UDP_REUSEADDR:4,errno:{E2BIG:7,EACCES:13,EADDRINUSE:98,EADDRNOTAVAIL:99,EAFNOSUPPORT:97,EAGAIN:11,EALREADY:114,EBADF:9,EBADMSG:74,EBUSY:16,ECANCELED:125,ECHILD:10,ECONNABORTED:103,ECONNREFUSED:111,ECONNRESET:104,EDEADLK:35,EDESTADDRREQ:89,EDOM:33,EDQUOT:122,EEXIST:17,EFAULT:14,EFBIG:27,EHOSTUNREACH:113,EIDRM:43,EILSEQ:84,EINPROGRESS:115,EINTR:4,EINVAL:22,EIO:5,EISCONN:106,EISDIR:21,ELOOP:40,EMFILE:24,EMLINK:31,EMSGSIZE:90,EMULTIHOP:72,ENAMETOOLONG:36,ENETDOWN:100,ENETRESET:102,ENETUNREACH:101,ENFILE:23,ENOBUFS:105,ENODATA:61,ENODEV:19,ENOENT:2,ENOEXEC:8,ENOLCK:37,ENOLINK:67,ENOMEM:12,ENOMSG:42,ENOPROTOOPT:92,ENOSPC:28,ENOSR:63,ENOSTR:60,ENOSYS:38,ENOTCONN:107,ENOTDIR:20,ENOTEMPTY:39,ENOTSOCK:88,ENOTSUP:95,ENOTTY:25,ENXIO:6,EOPNOTSUPP:95,EOVERFLOW:75,EPERM:1,EPIPE:32,EPROTO:71,EPROTONOSUPPORT:93,EPROTOTYPE:91,ERANGE:34,EROFS:30,ESPIPE:29,ESRCH:3,ESTALE:116,ETIME:62,ETIMEDOUT:110,ETXTBSY:26,EWOULDBLOCK:11,EXDEV:18},priority:{PRIORITY_LOW:19,PRIORITY_BELOW_NORMAL:10,PRIORITY_NORMAL:0,PRIORITY_ABOVE_NORMAL:-7,PRIORITY_HIGH:-14,PRIORITY_HIGHEST:-20},dlopen:{RTLD_LAZY:1,RTLD_NOW:2,RTLD_GLOBAL:256,RTLD_LOCAL:0,RTLD_DEEPBIND:8}};export{e as default};
package/lib/esm/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import"./_virtual/_rolldown/runtime.js";import e from"./constants.js";import{cpus as t,endianness as n,freemem as r,loadavg as i,networkInterfaces as a,totalmem as o,uptime as s}from"./darwin.js";import{cpus as c,endianness as l,freemem as u,loadavg as d,networkInterfaces as f,totalmem as p,uptime as m}from"./linux.js";import{cli as h,getPathSeparator as g}from"@gjsify/utils";import{mapMachine as _,mapSysname as v}from"@gjsify/utils/core";import y from"@girs/gio-2.0";import b from"@girs/glib-2.0";let x=``;const getOs=()=>x||(x=v(h(`uname -s`))??`linux`,x);let S=0;const getPid=()=>(S||=new y.Credentials().get_unix_pid(),S),C=g()===`/`?`
1
+ import"./_virtual/_rolldown/runtime.js";import e from"./constants.js";import{signalsFor as t}from"./signals.js";import{cpus as n,endianness as r,freemem as i,loadavg as a,networkInterfaces as o,totalmem as s,uptime as c}from"./darwin.js";import{cpus as l,endianness as u,freemem as d,loadavg as f,networkInterfaces as p,totalmem as m,uptime as h}from"./linux.js";import{cli as g,getPathSeparator as _}from"@gjsify/utils";import{isTargetOs as v,mapMachine as y,mapSysname as b}from"@gjsify/utils/core";import x from"@girs/gio-2.0";import S from"@girs/glib-2.0";let C=``;const getOs=()=>C||(C=b(g(`uname -s`))??`linux`,C);let w=0;const getPid=()=>(w||=new x.Credentials().get_unix_pid(),w),T={...e,get signals(){let e=getOs();return t(v(e)?e:void 0)}},E=_()===`/`?`
2
2
  `:`\r
3
- `,w=g()===`/`?`/dev/null`:`\\\\.\\nul`,homedir=()=>b.get_home_dir(),hostname=()=>b.get_host_name(),release=()=>h(`uname -r`).trim(),tmpdir=()=>{let e=b.get_tmp_dir(),t=g();return e.length>1&&e.endsWith(t)?e.slice(0,-1):e},type=()=>h(`uname`).trim(),platform=()=>getOs(),arch=()=>_(h(`uname -m`))??`x64`,machine=()=>h(`uname -m`).trim(),version=()=>h(`uname -v`).trim(),uptime=()=>{switch(getOs()){case`darwin`:return s();case`linux`:return m();default:return 0}},totalmem=()=>{switch(getOs()){case`darwin`:return o();case`linux`:return p();default:return 0}},availableParallelism=()=>{let e=cpus();return e?e.length:1},userInfo=()=>{let e=1e3,t=100,n=``;try{e=parseInt(h(`id -u`),10),t=parseInt(h(`id -g`),10),n=b.getenv(`SHELL`)||``}catch{}return{uid:e,gid:t,username:b.get_user_name(),homedir:b.get_home_dir(),shell:n}},cpus=()=>{let e=getOs();switch(e){case`darwin`:return t();case`linux`:return c();default:console.warn(`${e} is not supported!`);break}},endianness=()=>{let e=getOs();switch(e){case`darwin`:return n();case`linux`:return l();default:console.warn(`${e} is not supported!`);break}},freemem=()=>{let e=getOs();switch(e){case`darwin`:return r();case`linux`:return u();default:console.warn(`${e} is not supported!`);break}},loadavg=()=>{let e=getOs();switch(e){case`darwin`:return i();case`linux`:return d();default:console.warn(`${e} is not supported!`);break}},networkInterfaces=()=>{let e=getOs();switch(e){case`darwin`:return a();case`linux`:return f();default:console.warn(`${e} is not supported!`);break}},getPriority=e=>{let t=e===void 0||e===0?getPid():e;try{let e=h(`ps -o ni= -p ${t}`).trim(),n=parseInt(e,10);if(!isNaN(n))return n}catch{}return 0},setPriority=(e,t)=>{let n,r;if(t===void 0?(r=e,n=0):(n=e,r=t),typeof n!=`number`||!Number.isInteger(n))throw TypeError(`The "pid" argument must be an integer`);if(typeof r!=`number`||!Number.isInteger(r)||r<-20||r>19)throw RangeError(`The "priority" argument must be an integer between -20 and 19`);try{let e=n===0?getPid():n;h(`renice -n ${r} -p ${e}`)}catch{let e=Error(`A system error occurred: priority could not be set`);throw e.code=`ERR_SYSTEM_ERROR`,e}};var T={EOL:C,arch,availableParallelism,constants:e,cpus,devNull:w,endianness,freemem,getPriority,homedir,hostname,loadavg,machine,networkInterfaces,platform,release,setPriority,tmpdir,totalmem,type,uptime,userInfo,version};export{C as EOL,arch,availableParallelism,e as constants,cpus,T as default,w as devNull,endianness,freemem,getPriority,homedir,hostname,loadavg,machine,networkInterfaces,platform,release,setPriority,tmpdir,totalmem,type,uptime,userInfo,version};
3
+ `,D=_()===`/`?`/dev/null`:`\\\\.\\nul`,homedir=()=>S.get_home_dir(),hostname=()=>S.get_host_name(),release=()=>g(`uname -r`).trim(),tmpdir=()=>{let e=S.get_tmp_dir(),t=_();return e.length>1&&e.endsWith(t)?e.slice(0,-1):e},type=()=>g(`uname`).trim(),platform=()=>getOs(),arch=()=>y(g(`uname -m`))??`x64`,machine=()=>g(`uname -m`).trim(),version=()=>g(`uname -v`).trim(),uptime=()=>{switch(getOs()){case`darwin`:return c();case`linux`:return h();default:return 0}},totalmem=()=>{switch(getOs()){case`darwin`:return s();case`linux`:return m();default:return 0}},availableParallelism=()=>{let e=cpus();return e?e.length:1},userInfo=()=>{let e=1e3,t=100,n=``;try{e=parseInt(g(`id -u`),10),t=parseInt(g(`id -g`),10),n=S.getenv(`SHELL`)||``}catch{}return{uid:e,gid:t,username:S.get_user_name(),homedir:S.get_home_dir(),shell:n}},cpus=()=>{let e=getOs();switch(e){case`darwin`:return n();case`linux`:return l();default:console.warn(`${e} is not supported!`);break}},endianness=()=>{let e=getOs();switch(e){case`darwin`:return r();case`linux`:return u();default:console.warn(`${e} is not supported!`);break}},freemem=()=>{let e=getOs();switch(e){case`darwin`:return i();case`linux`:return d();default:console.warn(`${e} is not supported!`);break}},loadavg=()=>{let e=getOs();switch(e){case`darwin`:return a();case`linux`:return f();default:console.warn(`${e} is not supported!`);break}},networkInterfaces=()=>{let e=getOs();switch(e){case`darwin`:return o();case`linux`:return p();default:console.warn(`${e} is not supported!`);break}},getPriority=e=>{let t=e===void 0||e===0?getPid():e;try{let e=g(`ps -o ni= -p ${t}`).trim(),n=parseInt(e,10);if(!isNaN(n))return n}catch{}return 0},setPriority=(e,t)=>{let n,r;if(t===void 0?(r=e,n=0):(n=e,r=t),typeof n!=`number`||!Number.isInteger(n))throw TypeError(`The "pid" argument must be an integer`);if(typeof r!=`number`||!Number.isInteger(r)||r<-20||r>19)throw RangeError(`The "priority" argument must be an integer between -20 and 19`);try{let e=n===0?getPid():n;g(`renice -n ${r} -p ${e}`)}catch{let e=Error(`A system error occurred: priority could not be set`);throw e.code=`ERR_SYSTEM_ERROR`,e}};var O={EOL:E,arch,availableParallelism,constants:T,cpus,devNull:D,endianness,freemem,getPriority,homedir,hostname,loadavg,machine,networkInterfaces,platform,release,setPriority,tmpdir,totalmem,type,uptime,userInfo,version};export{E as EOL,arch,availableParallelism,T as constants,cpus,O as default,D as devNull,endianness,freemem,getPriority,homedir,hostname,loadavg,machine,networkInterfaces,platform,release,setPriority,tmpdir,totalmem,type,uptime,userInfo,version};
@@ -0,0 +1 @@
1
+ import"./_virtual/_rolldown/runtime.js";const e=Object.freeze({SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGILL:4,SIGTRAP:5,SIGABRT:6,SIGIOT:6,SIGBUS:7,SIGFPE:8,SIGKILL:9,SIGUSR1:10,SIGSEGV:11,SIGUSR2:12,SIGPIPE:13,SIGALRM:14,SIGTERM:15,SIGSTKFLT:16,SIGCHLD:17,SIGCONT:18,SIGSTOP:19,SIGTSTP:20,SIGTTIN:21,SIGTTOU:22,SIGURG:23,SIGXCPU:24,SIGXFSZ:25,SIGVTALRM:26,SIGPROF:27,SIGWINCH:28,SIGIO:29,SIGPOLL:29,SIGPWR:30,SIGSYS:31}),t=Object.freeze({SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGILL:4,SIGTRAP:5,SIGABRT:6,SIGIOT:6,SIGFPE:8,SIGKILL:9,SIGBUS:10,SIGSEGV:11,SIGSYS:12,SIGPIPE:13,SIGALRM:14,SIGTERM:15,SIGURG:16,SIGSTOP:17,SIGTSTP:18,SIGCONT:19,SIGCHLD:20,SIGTTIN:21,SIGTTOU:22,SIGIO:23,SIGXCPU:24,SIGXFSZ:25,SIGVTALRM:26,SIGPROF:27,SIGWINCH:28,SIGINFO:29,SIGUSR1:30,SIGUSR2:31}),n=Object.freeze({SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGILL:4,SIGFPE:8,SIGKILL:9,SIGSEGV:11,SIGTERM:15,SIGBREAK:21,SIGABRT:22,SIGWINCH:28}),r=Object.freeze({linux:e,darwin:t,win32:n}),signalsFor=e=>r[e??`linux`];export{r as SIGNALS,signalsFor};
@@ -129,41 +129,7 @@ export declare const constants: {
129
129
  EWOULDBLOCK: number;
130
130
  EXDEV: number;
131
131
  };
132
- readonly signals: {
133
- SIGHUP: number;
134
- SIGINT: number;
135
- SIGQUIT: number;
136
- SIGILL: number;
137
- SIGTRAP: number;
138
- SIGABRT: number;
139
- SIGIOT: number;
140
- SIGBUS: number;
141
- SIGFPE: number;
142
- SIGKILL: number;
143
- SIGUSR1: number;
144
- SIGSEGV: number;
145
- SIGUSR2: number;
146
- SIGPIPE: number;
147
- SIGALRM: number;
148
- SIGTERM: number;
149
- SIGCHLD: number;
150
- SIGSTKFLT: number;
151
- SIGCONT: number;
152
- SIGSTOP: number;
153
- SIGTSTP: number;
154
- SIGTTIN: number;
155
- SIGTTOU: number;
156
- SIGURG: number;
157
- SIGXCPU: number;
158
- SIGXFSZ: number;
159
- SIGVTALRM: number;
160
- SIGPROF: number;
161
- SIGWINCH: number;
162
- SIGIO: number;
163
- SIGPOLL: number;
164
- SIGPWR: number;
165
- SIGSYS: number;
166
- };
132
+ readonly signals: Readonly<Record<string, number>>;
167
133
  readonly priority: {
168
134
  readonly PRIORITY_LOW: 19;
169
135
  readonly PRIORITY_BELOW_NORMAL: 10;
@@ -262,41 +228,7 @@ declare const _default: {
262
228
  EWOULDBLOCK: number;
263
229
  EXDEV: number;
264
230
  };
265
- readonly signals: {
266
- SIGHUP: number;
267
- SIGINT: number;
268
- SIGQUIT: number;
269
- SIGILL: number;
270
- SIGTRAP: number;
271
- SIGABRT: number;
272
- SIGIOT: number;
273
- SIGBUS: number;
274
- SIGFPE: number;
275
- SIGKILL: number;
276
- SIGUSR1: number;
277
- SIGSEGV: number;
278
- SIGUSR2: number;
279
- SIGPIPE: number;
280
- SIGALRM: number;
281
- SIGTERM: number;
282
- SIGCHLD: number;
283
- SIGSTKFLT: number;
284
- SIGCONT: number;
285
- SIGSTOP: number;
286
- SIGTSTP: number;
287
- SIGTTIN: number;
288
- SIGTTOU: number;
289
- SIGURG: number;
290
- SIGXCPU: number;
291
- SIGXFSZ: number;
292
- SIGVTALRM: number;
293
- SIGPROF: number;
294
- SIGWINCH: number;
295
- SIGIO: number;
296
- SIGPOLL: number;
297
- SIGPWR: number;
298
- SIGSYS: number;
299
- };
231
+ readonly signals: Readonly<Record<string, number>>;
300
232
  readonly priority: {
301
233
  readonly PRIORITY_LOW: 19;
302
234
  readonly PRIORITY_BELOW_NORMAL: 10;
@@ -81,41 +81,6 @@ declare const _default: {
81
81
  EWOULDBLOCK: number;
82
82
  EXDEV: number;
83
83
  };
84
- signals: {
85
- SIGHUP: number;
86
- SIGINT: number;
87
- SIGQUIT: number;
88
- SIGILL: number;
89
- SIGTRAP: number;
90
- SIGABRT: number;
91
- SIGIOT: number;
92
- SIGBUS: number;
93
- SIGFPE: number;
94
- SIGKILL: number;
95
- SIGUSR1: number;
96
- SIGSEGV: number;
97
- SIGUSR2: number;
98
- SIGPIPE: number;
99
- SIGALRM: number;
100
- SIGTERM: number;
101
- SIGCHLD: number;
102
- SIGSTKFLT: number;
103
- SIGCONT: number;
104
- SIGSTOP: number;
105
- SIGTSTP: number;
106
- SIGTTIN: number;
107
- SIGTTOU: number;
108
- SIGURG: number;
109
- SIGXCPU: number;
110
- SIGXFSZ: number;
111
- SIGVTALRM: number;
112
- SIGPROF: number;
113
- SIGWINCH: number;
114
- SIGIO: number;
115
- SIGPOLL: number;
116
- SIGPWR: number;
117
- SIGSYS: number;
118
- };
119
84
  priority: {
120
85
  PRIORITY_LOW: number;
121
86
  PRIORITY_BELOW_NORMAL: number;
@@ -1,5 +1,117 @@
1
- export { constants };
2
- import constants from './constants.js';
1
+ import { type SignalTable } from './signals.js';
2
+ /**
3
+ * `os.constants`, with `signals` the HOST's table rather than one build's.
4
+ *
5
+ * A getter, not a value chosen at module scope: `getOs()` shells out to `uname`,
6
+ * and a module-scope read would spend a subprocess on every GJS bundle that
7
+ * imports this module without ever asking for a signal number. Node answers the
8
+ * same question at its BUILD time and hands out one frozen table, so the getter
9
+ * still returns the same frozen object on every call.
10
+ *
11
+ * `ObjectFreeze(constants.signals)` is Node's (`lib/os.js`), so the tables in
12
+ * `./signals.ts` are frozen; a bare assignment in a consumer's strict-mode ESM
13
+ * throws `TypeError` exactly as it does on Node.
14
+ */
15
+ export declare const constants: {
16
+ signals: SignalTable;
17
+ UV_UDP_REUSEADDR: number;
18
+ errno: {
19
+ E2BIG: number;
20
+ EACCES: number;
21
+ EADDRINUSE: number;
22
+ EADDRNOTAVAIL: number;
23
+ EAFNOSUPPORT: number;
24
+ EAGAIN: number;
25
+ EALREADY: number;
26
+ EBADF: number;
27
+ EBADMSG: number;
28
+ EBUSY: number;
29
+ ECANCELED: number;
30
+ ECHILD: number;
31
+ ECONNABORTED: number;
32
+ ECONNREFUSED: number;
33
+ ECONNRESET: number;
34
+ EDEADLK: number;
35
+ EDESTADDRREQ: number;
36
+ EDOM: number;
37
+ EDQUOT: number;
38
+ EEXIST: number;
39
+ EFAULT: number;
40
+ EFBIG: number;
41
+ EHOSTUNREACH: number;
42
+ EIDRM: number;
43
+ EILSEQ: number;
44
+ EINPROGRESS: number;
45
+ EINTR: number;
46
+ EINVAL: number;
47
+ EIO: number;
48
+ EISCONN: number;
49
+ EISDIR: number;
50
+ ELOOP: number;
51
+ EMFILE: number;
52
+ EMLINK: number;
53
+ EMSGSIZE: number;
54
+ EMULTIHOP: number;
55
+ ENAMETOOLONG: number;
56
+ ENETDOWN: number;
57
+ ENETRESET: number;
58
+ ENETUNREACH: number;
59
+ ENFILE: number;
60
+ ENOBUFS: number;
61
+ ENODATA: number;
62
+ ENODEV: number;
63
+ ENOENT: number;
64
+ ENOEXEC: number;
65
+ ENOLCK: number;
66
+ ENOLINK: number;
67
+ ENOMEM: number;
68
+ ENOMSG: number;
69
+ ENOPROTOOPT: number;
70
+ ENOSPC: number;
71
+ ENOSR: number;
72
+ ENOSTR: number;
73
+ ENOSYS: number;
74
+ ENOTCONN: number;
75
+ ENOTDIR: number;
76
+ ENOTEMPTY: number;
77
+ ENOTSOCK: number;
78
+ ENOTSUP: number;
79
+ ENOTTY: number;
80
+ ENXIO: number;
81
+ EOPNOTSUPP: number;
82
+ EOVERFLOW: number;
83
+ EPERM: number;
84
+ EPIPE: number;
85
+ EPROTO: number;
86
+ EPROTONOSUPPORT: number;
87
+ EPROTOTYPE: number;
88
+ ERANGE: number;
89
+ EROFS: number;
90
+ ESPIPE: number;
91
+ ESRCH: number;
92
+ ESTALE: number;
93
+ ETIME: number;
94
+ ETIMEDOUT: number;
95
+ ETXTBSY: number;
96
+ EWOULDBLOCK: number;
97
+ EXDEV: number;
98
+ };
99
+ priority: {
100
+ PRIORITY_LOW: number;
101
+ PRIORITY_BELOW_NORMAL: number;
102
+ PRIORITY_NORMAL: number;
103
+ PRIORITY_ABOVE_NORMAL: number;
104
+ PRIORITY_HIGH: number;
105
+ PRIORITY_HIGHEST: number;
106
+ };
107
+ dlopen: {
108
+ RTLD_LAZY: number;
109
+ RTLD_NOW: number;
110
+ RTLD_GLOBAL: number;
111
+ RTLD_LOCAL: number;
112
+ RTLD_DEEPBIND: number;
113
+ };
114
+ };
3
115
  export declare const EOL: string;
4
116
  export declare const devNull: string;
5
117
  export declare const homedir: () => string;
@@ -54,6 +166,7 @@ declare const _default: {
54
166
  arch: () => NodeJS.Architecture;
55
167
  availableParallelism: () => number;
56
168
  constants: {
169
+ signals: SignalTable;
57
170
  UV_UDP_REUSEADDR: number;
58
171
  errno: {
59
172
  E2BIG: number;
@@ -136,41 +249,6 @@ declare const _default: {
136
249
  EWOULDBLOCK: number;
137
250
  EXDEV: number;
138
251
  };
139
- signals: {
140
- SIGHUP: number;
141
- SIGINT: number;
142
- SIGQUIT: number;
143
- SIGILL: number;
144
- SIGTRAP: number;
145
- SIGABRT: number;
146
- SIGIOT: number;
147
- SIGBUS: number;
148
- SIGFPE: number;
149
- SIGKILL: number;
150
- SIGUSR1: number;
151
- SIGSEGV: number;
152
- SIGUSR2: number;
153
- SIGPIPE: number;
154
- SIGALRM: number;
155
- SIGTERM: number;
156
- SIGCHLD: number;
157
- SIGSTKFLT: number;
158
- SIGCONT: number;
159
- SIGSTOP: number;
160
- SIGTSTP: number;
161
- SIGTTIN: number;
162
- SIGTTOU: number;
163
- SIGURG: number;
164
- SIGXCPU: number;
165
- SIGXFSZ: number;
166
- SIGVTALRM: number;
167
- SIGPROF: number;
168
- SIGWINCH: number;
169
- SIGIO: number;
170
- SIGPOLL: number;
171
- SIGPWR: number;
172
- SIGSYS: number;
173
- };
174
252
  priority: {
175
253
  PRIORITY_LOW: number;
176
254
  PRIORITY_BELOW_NORMAL: number;
@@ -0,0 +1,16 @@
1
+ import type { TargetOs } from '@gjsify/utils/core';
2
+ /** Signal name → the number this host's `<signal.h>` gives it. */
3
+ export type SignalTable = Readonly<Record<string, number>>;
4
+ /** The one table per operating system ADR 0018 declares as a target. */
5
+ export declare const SIGNALS: Record<TargetOs, SignalTable>;
6
+ /**
7
+ * This host's table, or the Linux one for a host outside the declared target set.
8
+ *
9
+ * Linux is the fallback because it is the overwhelmingly common GJS host, and
10
+ * because it is what every other OS question in this package already falls back
11
+ * to (`getOs()`, `@gjsify/process`'s `detectPlatform()`). A FreeBSD host — real,
12
+ * and in `mapSysname`'s vocabulary, but not on the `gjsify.os` axis — therefore
13
+ * gets Linux numbers, which is wrong there and stated here rather than guessed
14
+ * at: the BSD layout is not the Linux one, so no partial guess would be closer.
15
+ */
16
+ export declare const signalsFor: (os: TargetOs | undefined) => SignalTable;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/os",
3
- "version": "0.54.0",
3
+ "version": "0.55.0",
4
4
  "description": "Node.js os module for Gjs",
5
5
  "module": "lib/esm/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -40,11 +40,11 @@
40
40
  "dependencies": {
41
41
  "@girs/gio-2.0": "5.4.0",
42
42
  "@girs/glib-2.0": "5.4.0",
43
- "@gjsify/utils": "^0.54.0"
43
+ "@gjsify/utils": "^0.55.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@gjsify/cli": "^0.54.0",
47
- "@gjsify/unit": "^0.54.0",
46
+ "@gjsify/cli": "^0.55.0",
47
+ "@gjsify/unit": "^0.55.0",
48
48
  "@types/node": "^25.9.2",
49
49
  "typescript": "^6.0.3"
50
50
  },
@@ -62,8 +62,8 @@
62
62
  "win32": "partial"
63
63
  },
64
64
  "osNotes": {
65
- "darwin": "`os.cpus()` reports the documented all-zero `times` on macOS. Linux reads the per-CPU tick counters from `/proc/stat`; the darwin equivalent is Mach's `host_processor_info(PROCESSOR_CPU_LOAD_INFO)`, which GJS cannot call without a native bridge, and no userland tool prints the cumulative per-core totals Node returns (`top`/`iostat` give an instantaneous aggregate percentage). Every other export — cpus model/speed, memory, uptime, loadavg, networkInterfaces, userInfo — is real on darwin and covered by the macOS suites. `src/index.spec.ts` carries the matching `it.failing(…, { when })`, so the claim retires itself the day a reader exists.",
66
- "win32": "A `src/win32.ts` covers the per-platform answers, but it is unexercised for the same structural reason as `@gjsify/child_process`: `runtimes.node: \"none\"` sends `test:node` to native Node, and there is no GJS host on Windows to run `test:gjs`. Measured on the win11-gjsify VM: 10 of 178 specs fail there, and all ten are POSIX assumptions in the SPECS (asserting `type()` is `Linux`, EOL is `\\n`, devNull is `/dev/null`) rather than defects in this module."
65
+ "darwin": "`os.cpus()` reports the documented all-zero `times` on macOS. Linux reads the per-CPU tick counters from `/proc/stat`; the darwin equivalent is Mach’s `host_processor_info(PROCESSOR_CPU_LOAD_INFO)`, which GJS cannot call without a native bridge, and no userland tool prints the cumulative per-core totals Node returns (`top`/`iostat` give an instantaneous aggregate percentage). Every other export — cpus model/speed, memory, uptime, loadavg, networkInterfaces, userInfo — is real on darwin and covered by the macOS suites. `src/index.spec.ts` carries the matching `it.failing(…, { when })`, so the claim retires itself the day a reader exists. `os.constants.signals` was a Linux table served to every host until #2001 and is now XNU’s (`src/signals.ts`): its darwin table is asserted key-for-key by `src/signals.spec.ts` on Linux AND against native Node by `macos-suites.yml`, so those numbers are measured rather than claimed. What is left in this claim is the `cpus()` gap alone.",
66
+ "win32": "A `src/win32.ts` covers the per-platform answers, but it is unexercised for the same structural reason as `@gjsify/child_process`: `runtimes.node: \"none\"` sends `test:node` to native Node, and there is no GJS host on Windows to run `test:gjs`. Measured on the win11-gjsify VM: 10 of 178 specs fail there, and all ten are POSIX assumptions in the SPECS (asserting `type()` is `Linux`, EOL is `\\n`, devNull is `/dev/null`) rather than defects in this module. Two things now differ from that shape. `os.constants.signals` is NOT unexercised: `windows-suites.yml` runs `test:node`, whose `on(‘Node.js’)` block compares our win32 table against native Node’s on a real Windows host (#2001), so those seven CRT numbers are verified there rather than asserted from Linux. The SELECTION is still unexercised — `src/signals.ts` picks the table from `getOs()`’s `uname` probe, which no GJS host on Windows has ever run, because none exists (ADR 0024 § 4). `os.constants.errno` and `dlopen` remain glibc’s on this host too; see `status/open-todos/runtime-apis.md`."
67
67
  }
68
68
  },
69
69
  "license": "MIT",