@gjsify/process 0.4.35 → 0.4.36
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/globals.mjs +20 -0
- package/lib/esm/browser.js +1 -0
- package/lib/types/browser.d.ts +197 -0
- package/package.json +31 -12
package/globals.mjs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports the native `process` global for Node.js builds.
|
|
3
|
+
*
|
|
4
|
+
* On Node, `process` is a built-in global — there is no `node:process` value
|
|
5
|
+
* worth importing from our polyfill. The cross-runtime resolver routes
|
|
6
|
+
* `@gjsify/process` here on `--app node` so consumers get the runtime-native
|
|
7
|
+
* value with no detour through the GJS-bound `lib/esm/index.js`.
|
|
8
|
+
*
|
|
9
|
+
* On GJS, this file is NOT consulted — `process` is wired by
|
|
10
|
+
* `@gjsify/node-globals/register/process` at bundle entry time.
|
|
11
|
+
*
|
|
12
|
+
* IMPORTANT: must not reference `node:process` (or any other `node:`
|
|
13
|
+
* specifier) — the audit-runtimes `--strict` probe rejects re-exports from
|
|
14
|
+
* `node:*` for a slot that also serves browser builds.
|
|
15
|
+
*/
|
|
16
|
+
export default globalThis.process;
|
|
17
|
+
export const env = globalThis.process?.env;
|
|
18
|
+
export const argv = globalThis.process?.argv;
|
|
19
|
+
export const platform = globalThis.process?.platform;
|
|
20
|
+
export const nextTick = globalThis.process?.nextTick?.bind(globalThis.process);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";const NOOP=()=>{};let e=[],t=!1;function _drain(){if(!t){for(t=!0;e.length>0;){let t=e;e=[];for(let e of t)try{e.fun(...e.args)}catch(e){queueMicrotask(()=>{throw e})}}t=!1}}function nextTick(n,...r){e.push({fun:n,args:r}),!t&&e.length===1&&queueMicrotask(_drain)}const n={isTTY:!1,columns:80,rows:24,write(e,t,n){return typeof n==`function`&&queueMicrotask(n),!0},end(e,t,n){typeof n==`function`&&queueMicrotask(n)},on:NOOP,once:NOOP,off:NOOP,addListener:NOOP,removeListener:NOOP,removeAllListeners:NOOP,emit:()=>!1,setRawMode(e){return this}},r={isTTY:!1,readable:!1,on:NOOP,once:NOOP,off:NOOP,addListener:NOOP,removeListener:NOOP,removeAllListeners:NOOP,emit:()=>!1,pause(){return this},resume(){return this},setEncoding(e){return this},setRawMode(e){return this},read(){return null}},i={on:NOOP,addListener:NOOP,once:NOOP,off:NOOP,removeListener:NOOP,removeAllListeners:NOOP,emit:()=>!1,prependListener:NOOP,prependOnceListener:NOOP,listeners:e=>[],rawListeners:e=>[],listenerCount:e=>0,eventNames:()=>[],getMaxListeners:()=>1/0,setMaxListeners:NOOP},a={title:`browser`,browser:!0,version:``,versions:{},platform:`browser`,arch:`browser`,pid:0,ppid:0,env:{},argv:[],argv0:`browser`,execPath:``,execArgv:[],config:Object.create(null),stdin:r,stdout:n,stderr:n,nextTick,cwd:()=>`/`,chdir:e=>{throw Error(`process.chdir is not supported in the browser`)},umask:()=>0,exit(e){throw Error(`process.exit is not supported in the browser`)},abort(){throw Error(`process.abort is not supported in the browser`)},kill:(e,t)=>!1,uptime:()=>0,hrtime:Object.assign(e=>[0,0],{bigint:()=>0n}),memoryUsage:Object.assign(()=>({rss:0,heapTotal:0,heapUsed:0,external:0,arrayBuffers:0}),{rss:()=>0}),cpuUsage:e=>({user:0,system:0}),emitWarning:NOOP,binding:e=>{throw Error(`process.binding is not supported in the browser`)},...i},o=a.platform,s=a.arch,c=a.env,l=a.argv,u=a.argv0,d=a.execPath,f=a.execArgv,p=a.pid,m=a.ppid,h=a.version,g=a.versions,_=a.title,v=a.browser,y=a.config,b=a.stdin,x=a.stdout,S=a.stderr,C=a.cwd,w=a.chdir,T=a.exit,E=a.abort,D=a.umask,O=a.kill,k=a.uptime,A=a.hrtime,j=a.memoryUsage,M=a.cpuUsage,N=a.emitWarning,P=a.binding;export{E as abort,s as arch,l as argv,u as argv0,P as binding,v as browser,w as chdir,y as config,M as cpuUsage,C as cwd,a as default,N as emitWarning,c as env,f as execArgv,d as execPath,T as exit,A as hrtime,O as kill,j as memoryUsage,nextTick,p as pid,o as platform,m as ppid,S as stderr,b as stdin,x as stdout,_ as title,D as umask,k as uptime,h as version,g as versions};
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
declare function nextTick(fun: (...args: unknown[]) => void, ...args: unknown[]): void;
|
|
2
|
+
declare const browserProcess: {
|
|
3
|
+
on: () => void;
|
|
4
|
+
addListener: () => void;
|
|
5
|
+
once: () => void;
|
|
6
|
+
off: () => void;
|
|
7
|
+
removeListener: () => void;
|
|
8
|
+
removeAllListeners: () => void;
|
|
9
|
+
emit: () => boolean;
|
|
10
|
+
prependListener: () => void;
|
|
11
|
+
prependOnceListener: () => void;
|
|
12
|
+
listeners: (_name: string) => unknown[];
|
|
13
|
+
rawListeners: (_name: string) => unknown[];
|
|
14
|
+
listenerCount: (_name: string) => number;
|
|
15
|
+
eventNames: () => string[];
|
|
16
|
+
getMaxListeners: () => number;
|
|
17
|
+
setMaxListeners: () => void;
|
|
18
|
+
title: string;
|
|
19
|
+
browser: true;
|
|
20
|
+
version: string;
|
|
21
|
+
versions: Record<string, string>;
|
|
22
|
+
platform: NodeJS.Platform;
|
|
23
|
+
arch: NodeJS.Architecture;
|
|
24
|
+
pid: number;
|
|
25
|
+
ppid: number;
|
|
26
|
+
env: Record<string, string | undefined>;
|
|
27
|
+
argv: string[];
|
|
28
|
+
argv0: string;
|
|
29
|
+
execPath: string;
|
|
30
|
+
execArgv: string[];
|
|
31
|
+
config: Record<string, unknown>;
|
|
32
|
+
stdin: {
|
|
33
|
+
isTTY: false;
|
|
34
|
+
readable: boolean;
|
|
35
|
+
on: () => void;
|
|
36
|
+
once: () => void;
|
|
37
|
+
off: () => void;
|
|
38
|
+
addListener: () => void;
|
|
39
|
+
removeListener: () => void;
|
|
40
|
+
removeAllListeners: () => void;
|
|
41
|
+
emit: () => boolean;
|
|
42
|
+
pause(): any;
|
|
43
|
+
resume(): any;
|
|
44
|
+
setEncoding(_enc: string): any;
|
|
45
|
+
setRawMode(_value: boolean): any;
|
|
46
|
+
read(): any;
|
|
47
|
+
};
|
|
48
|
+
stdout: {
|
|
49
|
+
isTTY: false;
|
|
50
|
+
columns: number;
|
|
51
|
+
rows: number;
|
|
52
|
+
write(_chunk: string | Uint8Array, _enc?: string, cb?: () => void): boolean;
|
|
53
|
+
end(_chunk?: string | Uint8Array, _enc?: string, cb?: () => void): void;
|
|
54
|
+
on: () => void;
|
|
55
|
+
once: () => void;
|
|
56
|
+
off: () => void;
|
|
57
|
+
addListener: () => void;
|
|
58
|
+
removeListener: () => void;
|
|
59
|
+
removeAllListeners: () => void;
|
|
60
|
+
emit: () => boolean;
|
|
61
|
+
setRawMode(_value: boolean): any;
|
|
62
|
+
};
|
|
63
|
+
stderr: {
|
|
64
|
+
isTTY: false;
|
|
65
|
+
columns: number;
|
|
66
|
+
rows: number;
|
|
67
|
+
write(_chunk: string | Uint8Array, _enc?: string, cb?: () => void): boolean;
|
|
68
|
+
end(_chunk?: string | Uint8Array, _enc?: string, cb?: () => void): void;
|
|
69
|
+
on: () => void;
|
|
70
|
+
once: () => void;
|
|
71
|
+
off: () => void;
|
|
72
|
+
addListener: () => void;
|
|
73
|
+
removeListener: () => void;
|
|
74
|
+
removeAllListeners: () => void;
|
|
75
|
+
emit: () => boolean;
|
|
76
|
+
setRawMode(_value: boolean): any;
|
|
77
|
+
};
|
|
78
|
+
nextTick: typeof nextTick;
|
|
79
|
+
cwd: () => string;
|
|
80
|
+
chdir: (_dir: string) => void;
|
|
81
|
+
umask: () => number;
|
|
82
|
+
exit(_code?: number): never;
|
|
83
|
+
abort(): never;
|
|
84
|
+
kill: (_pid: number, _signal?: string | number) => boolean;
|
|
85
|
+
uptime: () => number;
|
|
86
|
+
hrtime: ((_time?: [number, number]) => [number, number]) & {
|
|
87
|
+
bigint: () => bigint;
|
|
88
|
+
};
|
|
89
|
+
memoryUsage: (() => {
|
|
90
|
+
rss: number;
|
|
91
|
+
heapTotal: number;
|
|
92
|
+
heapUsed: number;
|
|
93
|
+
external: number;
|
|
94
|
+
arrayBuffers: number;
|
|
95
|
+
}) & {
|
|
96
|
+
rss: () => number;
|
|
97
|
+
};
|
|
98
|
+
cpuUsage: (_previous?: {
|
|
99
|
+
user: number;
|
|
100
|
+
system: number;
|
|
101
|
+
}) => {
|
|
102
|
+
user: number;
|
|
103
|
+
system: number;
|
|
104
|
+
};
|
|
105
|
+
emitWarning: () => void;
|
|
106
|
+
binding: (_name: string) => never;
|
|
107
|
+
};
|
|
108
|
+
export declare const platform: NodeJS.Platform;
|
|
109
|
+
export declare const arch: NodeJS.Architecture;
|
|
110
|
+
export declare const env: Record<string, string>;
|
|
111
|
+
export declare const argv: string[];
|
|
112
|
+
export declare const argv0: string;
|
|
113
|
+
export declare const execPath: string;
|
|
114
|
+
export declare const execArgv: string[];
|
|
115
|
+
export declare const pid: number;
|
|
116
|
+
export declare const ppid: number;
|
|
117
|
+
export declare const version: string;
|
|
118
|
+
export declare const versions: Record<string, string>;
|
|
119
|
+
export declare const title: string;
|
|
120
|
+
export declare const browser: true;
|
|
121
|
+
export declare const config: Record<string, unknown>;
|
|
122
|
+
export declare const stdin: {
|
|
123
|
+
isTTY: false;
|
|
124
|
+
readable: boolean;
|
|
125
|
+
on: () => void;
|
|
126
|
+
once: () => void;
|
|
127
|
+
off: () => void;
|
|
128
|
+
addListener: () => void;
|
|
129
|
+
removeListener: () => void;
|
|
130
|
+
removeAllListeners: () => void;
|
|
131
|
+
emit: () => boolean;
|
|
132
|
+
pause(): any;
|
|
133
|
+
resume(): any;
|
|
134
|
+
setEncoding(_enc: string): any;
|
|
135
|
+
setRawMode(_value: boolean): any;
|
|
136
|
+
read(): any;
|
|
137
|
+
};
|
|
138
|
+
export declare const stdout: {
|
|
139
|
+
isTTY: false;
|
|
140
|
+
columns: number;
|
|
141
|
+
rows: number;
|
|
142
|
+
write(_chunk: string | Uint8Array, _enc?: string, cb?: () => void): boolean;
|
|
143
|
+
end(_chunk?: string | Uint8Array, _enc?: string, cb?: () => void): void;
|
|
144
|
+
on: () => void;
|
|
145
|
+
once: () => void;
|
|
146
|
+
off: () => void;
|
|
147
|
+
addListener: () => void;
|
|
148
|
+
removeListener: () => void;
|
|
149
|
+
removeAllListeners: () => void;
|
|
150
|
+
emit: () => boolean;
|
|
151
|
+
setRawMode(_value: boolean): any;
|
|
152
|
+
};
|
|
153
|
+
export declare const stderr: {
|
|
154
|
+
isTTY: false;
|
|
155
|
+
columns: number;
|
|
156
|
+
rows: number;
|
|
157
|
+
write(_chunk: string | Uint8Array, _enc?: string, cb?: () => void): boolean;
|
|
158
|
+
end(_chunk?: string | Uint8Array, _enc?: string, cb?: () => void): void;
|
|
159
|
+
on: () => void;
|
|
160
|
+
once: () => void;
|
|
161
|
+
off: () => void;
|
|
162
|
+
addListener: () => void;
|
|
163
|
+
removeListener: () => void;
|
|
164
|
+
removeAllListeners: () => void;
|
|
165
|
+
emit: () => boolean;
|
|
166
|
+
setRawMode(_value: boolean): any;
|
|
167
|
+
};
|
|
168
|
+
export declare const cwd: () => string;
|
|
169
|
+
export declare const chdir: (_dir: string) => void;
|
|
170
|
+
export declare const exit: (_code?: number) => never;
|
|
171
|
+
export declare const abort: () => never;
|
|
172
|
+
export declare const umask: () => number;
|
|
173
|
+
export declare const kill: (_pid: number, _signal?: string | number) => boolean;
|
|
174
|
+
export declare const uptime: () => number;
|
|
175
|
+
export declare const hrtime: ((_time?: [number, number]) => [number, number]) & {
|
|
176
|
+
bigint: () => bigint;
|
|
177
|
+
};
|
|
178
|
+
export declare const memoryUsage: (() => {
|
|
179
|
+
rss: number;
|
|
180
|
+
heapTotal: number;
|
|
181
|
+
heapUsed: number;
|
|
182
|
+
external: number;
|
|
183
|
+
arrayBuffers: number;
|
|
184
|
+
}) & {
|
|
185
|
+
rss: () => number;
|
|
186
|
+
};
|
|
187
|
+
export declare const cpuUsage: (_previous?: {
|
|
188
|
+
user: number;
|
|
189
|
+
system: number;
|
|
190
|
+
}) => {
|
|
191
|
+
user: number;
|
|
192
|
+
system: number;
|
|
193
|
+
};
|
|
194
|
+
export declare const emitWarning: () => void;
|
|
195
|
+
export declare const binding: (_name: string) => never;
|
|
196
|
+
export { nextTick };
|
|
197
|
+
export default browserProcess;
|
package/package.json
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/process",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.36",
|
|
4
4
|
"description": "Node.js process module for Gjs",
|
|
5
5
|
"module": "lib/esm/index.js",
|
|
6
6
|
"types": "lib/types/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
|
-
"lib"
|
|
8
|
+
"lib",
|
|
9
|
+
"globals.mjs"
|
|
9
10
|
],
|
|
10
11
|
"type": "module",
|
|
11
12
|
"exports": {
|
|
12
13
|
".": {
|
|
13
14
|
"types": "./lib/types/index.d.ts",
|
|
14
15
|
"default": "./lib/esm/index.js"
|
|
15
|
-
}
|
|
16
|
+
},
|
|
17
|
+
"./browser": {
|
|
18
|
+
"types": "./lib/types/browser.d.ts",
|
|
19
|
+
"default": "./lib/esm/browser.js"
|
|
20
|
+
},
|
|
21
|
+
"./globals": "./globals.mjs"
|
|
16
22
|
},
|
|
17
23
|
"scripts": {
|
|
18
24
|
"clear": "rm -rf lib tsconfig.tsbuildinfo tsconfig.types.tsbuildinfo test.gjs.mjs test.node.mjs || exit 0",
|
|
@@ -33,21 +39,34 @@
|
|
|
33
39
|
"process"
|
|
34
40
|
],
|
|
35
41
|
"dependencies": {
|
|
36
|
-
"@gjsify/events": "^0.4.
|
|
37
|
-
"@gjsify/terminal-native": "^0.4.
|
|
38
|
-
"@gjsify/utils": "^0.4.
|
|
42
|
+
"@gjsify/events": "^0.4.36",
|
|
43
|
+
"@gjsify/terminal-native": "^0.4.36",
|
|
44
|
+
"@gjsify/utils": "^0.4.36"
|
|
39
45
|
},
|
|
40
46
|
"devDependencies": {
|
|
41
|
-
"@gjsify/cli": "^0.4.
|
|
42
|
-
"@gjsify/unit": "^0.4.
|
|
47
|
+
"@gjsify/cli": "^0.4.36",
|
|
48
|
+
"@gjsify/unit": "^0.4.36",
|
|
43
49
|
"@types/node": "^25.9.1",
|
|
44
|
-
"typescript": "^
|
|
50
|
+
"typescript": "^5.9.3"
|
|
45
51
|
},
|
|
46
52
|
"gjsify": {
|
|
47
53
|
"runtimes": {
|
|
48
54
|
"gjs": "polyfill",
|
|
49
|
-
"node": "
|
|
50
|
-
"browser": "
|
|
55
|
+
"node": "native",
|
|
56
|
+
"browser": "polyfill"
|
|
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/process"
|
|
64
|
+
},
|
|
65
|
+
"bugs": {
|
|
66
|
+
"url": "https://github.com/gjsify/gjsify/issues"
|
|
67
|
+
},
|
|
68
|
+
"homepage": "https://github.com/gjsify/gjsify/tree/main/packages/node/process#readme",
|
|
69
|
+
"sideEffects": [
|
|
70
|
+
"./globals.mjs"
|
|
71
|
+
]
|
|
53
72
|
}
|