@gjsify/process 0.64.5 → 0.64.7

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 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import{getGjsGlobal as e}from"./gjs.js";import{hostExecPath as t}from"@gjsify/utils/core";function getEnvProxy(){if(typeof globalThis.process?.env==`object`)return globalThis.process.env;try{let t=e().imports?.gi?.GLib;if(t)return new Proxy({},{get(e,n){if(typeof n==`string`)return t.getenv(n)??void 0},set(e,n,r){return typeof n==`string`?(t.setenv(n,String(r),!0),!0):!1},deleteProperty(e,n){return typeof n==`string`?(t.unsetenv(n),!0):!1},has(e,n){return typeof n==`string`?t.getenv(n)!==null:!1},ownKeys(e){return t.listenv()},getOwnPropertyDescriptor(e,n){if(typeof n!=`string`)return;let r=t.getenv(n);if(r!==null)return{configurable:!0,enumerable:!0,writable:!0,value:r}}})}catch{}return{}}function getArgv(){if(globalThis.process?.argv!==void 0)return globalThis.process.argv;try{let t=e().imports?.system;if(t?.programArgs)return[`gjs`,t.programInvocationName||``,...t.programArgs]}catch{}return[`gjs`]}function getExecPath(){let e=globalThis.process;return!isGjsHost()&&typeof e?.execPath==`string`?e.execPath:t()??`/usr/bin/gjs`}function isGjsHost(){try{return e().imports?.gi!==void 0}catch{return!1}}function getCwd(){try{let t=e().imports?.gi?.GLib;if(t?.get_current_dir)return t.get_current_dir()}catch{}return`/`}function chdir(t){let n=e().imports?.gi?.GLib;try{if(n?.chdir){if(!n.file_test(t,16)){let e=Error(`ENOENT: no such file or directory, chdir '${t}'`);throw e.code=`ENOENT`,e.syscall=`chdir`,e.path=t,e}n.chdir(t);return}}catch(e){if(e&&typeof e==`object`&&e.code===`ENOENT`)throw e}if(!n){let e=globalThis.process;if(e&&typeof e.chdir==`function`){e.chdir(t);return}}throw Error(`process.chdir() is not supported in this environment`)}export{chdir,getArgv,getCwd,getEnvProxy,getExecPath};
1
+ import"../_virtual/_rolldown/runtime.js";import{getGjsGlobal as e}from"./gjs.js";import{hostExecPath as t}from"@gjsify/utils/core";function getEnvProxy(){if(typeof globalThis.process?.env==`object`)return globalThis.process.env;try{let t=e().imports?.gi?.GLib;if(t)return new Proxy({},{get(e,n){if(typeof n==`string`)return t.getenv(n)??void 0},set(e,n,r){return typeof n==`string`?(t.setenv(n,String(r),!0),!0):!1},deleteProperty(e,n){return typeof n==`string`?(t.unsetenv(n),!0):!1},has(e,n){return typeof n==`string`?t.getenv(n)!==null:!1},ownKeys(e){return t.listenv()},getOwnPropertyDescriptor(e,n){if(typeof n!=`string`)return;let r=t.getenv(n);if(r!==null)return{configurable:!0,enumerable:!0,writable:!0,value:r}}})}catch{}return{}}function getArgv(){if(globalThis.process?.argv!==void 0)return globalThis.process.argv;try{let t=e().imports?.system;if(t?.programArgs)return[`gjs`,t.programInvocationName||``,...t.programArgs]}catch{}return[`gjs`]}function getExecPath(){let e=globalThis.process;return!isGjsHost()&&typeof e?.execPath==`string`?e.execPath:t()??`/usr/bin/gjs`}function isGjsHost(){try{return e().imports?.gi!==void 0}catch{return!1}}function getCwd(){try{let t=e().imports?.gi?.GLib;if(t?.get_current_dir)return t.get_current_dir()}catch{}return`/`}function chdir(t){let n=e().imports?.gi?.GLib;try{if(n?.chdir){if(!n.file_test(t,16)){let e=Error(`ENOENT: no such file or directory, chdir '${t}'`);throw e.code=`ENOENT`,e.syscall=`chdir`,e.path=t,e}n.chdir(t);return}}catch(e){if(e&&typeof e==`object`&&e.code===`ENOENT`)throw e}if(!n){let e=globalThis.process;if(e&&typeof e.chdir==`function`){e.chdir(t);return}}throw Error(`process.chdir() is not supported in this environment`)}function getExecArgv(){if(!isGjsHost()){let e=globalThis.process;return Array.isArray(e?.execArgv)?e.execArgv:[]}try{let t=e().imports?.gi?.GLib;if(t?.file_get_contents){let[,e]=t.file_get_contents(`/proc/self/cmdline`);if(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=new TextDecoder().decode(t).split(`\0`).filter(e=>e.length>0),r=[];for(let e=1;e<n.length&&n[e].startsWith(`-`);e++)r.push(n[e]);return r}}}catch{}return[]}export{chdir,getArgv,getCwd,getEnvProxy,getExecArgv,getExecPath};
@@ -1 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";import{detectArch as e,detectPlatform as t,detectPpid as n,detectVersionInfo as r,getPid as i}from"./internal/detect.js";import{chdir as a,getArgv as o,getCwd as s,getEnvProxy as c,getExecPath as l}from"./internal/env.js";import{exitProcess as u}from"./internal/exit.js";import{hrtime as d,hrtimeBigint as f}from"./internal/hrtime.js";import{cpuUsage as p,killPid as m,memoryUsage as h,readUmask as g}from"./internal/system.js";import{armSignal as _,disarmSignal as v,isDeliverableSignal as y}from"./internal/signals.js";import{ProcessReadStream as b,ProcessWriteStream as x}from"./streams.js";import{restoreClaimedRawModes as S}from"@gjsify/terminal-native";import{EventEmitter as C}from"@gjsify/events";const w=Date.now();function defineLazy(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){let r=n();return Object.defineProperty(e,t,{value:r,configurable:!0,enumerable:!0,writable:!1}),r}})}var Process=class extends C{platform;arch;env;argv;argv0;execPath;pid;ppid;version;versions;title;execArgv;config;exitCode;constructor(){super(),this.on(`exit`,()=>{try{S()}catch(e){console.error(`@gjsify/process: raw mode could not be restored:`,e)}}),defineLazy(this,`platform`,t),defineLazy(this,`arch`,e),this.env=c(),this.argv=o(),this.argv0=this.argv[0]||`gjs`,this.execPath=l(),this.execArgv=globalThis.process?.execArgv??[],this.config=globalThis.process?.config??{target_defaults:{},variables:{}},this.pid=i(),this.ppid=n();let a=r();this.version=a.version,this.versions=a.versions,this.title=a.title,this.on(`newListener`,e=>{y(e)&&_(e,e=>this.emit(e,e))}),this.on(`removeListener`,e=>{y(e)&&this.listenerCount(e)===0&&v(e)})}cwd(){return s()}chdir(e){a(e)}kill(e,t){return m(e,t)}exit(e){return this.exitCode=e??this.exitCode??0,this.emit(`exit`,this.exitCode),u(this.exitCode)}nextTick(e,...t){typeof queueMicrotask==`function`?queueMicrotask(()=>e(...t)):Promise.resolve().then(()=>e(...t))}hrtime(e){return d(e)}uptime(){return(Date.now()-w)/1e3}memoryUsage(){return h()}cpuUsage(e){return p(e)}stdout=new x(1);stderr=new x(2);stdin=new b(0);abort(){this.exit(1)}umask(e){let t=g();return e!==void 0&&!this._umaskWarned&&(this._umaskWarned=!0,this.emitWarning(`process.umask(0${e.toString(8)}) cannot change the file-creation mask under GJS — there is no umask(2) binding, so the mask is UNCHANGED. Pass an explicit \`mode\` to open/mkdir/writeFile instead; the kernel applies it atomically at creation.`,`UnsupportedWarning`)),t}_umaskWarned=!1;emitWarning(e,t){console.warn(typeof e==`string`?`(${t||`Warning`}): ${e}`:e.message)}};Process.prototype.hrtime.bigint=function(){return f()};export{Process};
1
+ import"./_virtual/_rolldown/runtime.js";import{detectArch as e,detectPlatform as t,detectPpid as n,detectVersionInfo as r,getPid as i}from"./internal/detect.js";import{chdir as a,getArgv as o,getCwd as s,getEnvProxy as c,getExecArgv as l,getExecPath as u}from"./internal/env.js";import{exitProcess as d}from"./internal/exit.js";import{hrtime as f,hrtimeBigint as p}from"./internal/hrtime.js";import{cpuUsage as m,killPid as h,memoryUsage as g,readUmask as _}from"./internal/system.js";import{armSignal as v,disarmSignal as y,isDeliverableSignal as b}from"./internal/signals.js";import{ProcessReadStream as x,ProcessWriteStream as S}from"./streams.js";import{restoreClaimedRawModes as C}from"@gjsify/terminal-native";import{EventEmitter as w}from"@gjsify/events";const T=Date.now();function defineLazy(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){let r=n();return Object.defineProperty(e,t,{value:r,configurable:!0,enumerable:!0,writable:!1}),r}})}var Process=class extends w{platform;arch;env;argv;argv0;execPath;pid;ppid;version;versions;title;execArgv;config;exitCode;constructor(){super(),this.on(`exit`,()=>{try{C()}catch(e){console.error(`@gjsify/process: raw mode could not be restored:`,e)}}),defineLazy(this,`platform`,t),defineLazy(this,`arch`,e),this.env=c(),this.argv=o(),this.argv0=this.argv[0]||`gjs`,this.execPath=u(),this.execArgv=l(),this.config=globalThis.process?.config??{target_defaults:{},variables:{}},this.pid=i(),this.ppid=n();let a=r();this.version=a.version,this.versions=a.versions,this.title=a.title,this.on(`newListener`,e=>{b(e)&&v(e,e=>this.emit(e,e))}),this.on(`removeListener`,e=>{b(e)&&this.listenerCount(e)===0&&y(e)})}cwd(){return s()}chdir(e){a(e)}kill(e,t){return h(e,t)}exit(e){return this.exitCode=e??this.exitCode??0,this.emit(`exit`,this.exitCode),d(this.exitCode)}nextTick(e,...t){typeof queueMicrotask==`function`?queueMicrotask(()=>e(...t)):Promise.resolve().then(()=>e(...t))}hrtime(e){return f(e)}uptime(){return(Date.now()-T)/1e3}memoryUsage(){return g()}cpuUsage(e){return m(e)}stdout=new S(1);stderr=new S(2);stdin=new x(0);abort(){this.exit(1)}umask(e){let t=_();return e!==void 0&&!this._umaskWarned&&(this._umaskWarned=!0,this.emitWarning(`process.umask(0${e.toString(8)}) cannot change the file-creation mask under GJS — there is no umask(2) binding, so the mask is UNCHANGED. Pass an explicit \`mode\` to open/mkdir/writeFile instead; the kernel applies it atomically at creation.`,`UnsupportedWarning`)),t}_umaskWarned=!1;emitWarning(e,t){console.warn(typeof e==`string`?`(${t||`Warning`}): ${e}`:e.message)}};Process.prototype.hrtime.bigint=function(){return p()};export{Process};
@@ -22,3 +22,4 @@ export declare function getArgv(): string[];
22
22
  export declare function getExecPath(): string;
23
23
  export declare function getCwd(): string;
24
24
  export declare function chdir(directory: string): void;
25
+ export declare function getExecArgv(): string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/process",
3
- "version": "0.64.5",
3
+ "version": "0.64.7",
4
4
  "description": "Node.js process module for Gjs",
5
5
  "module": "lib/esm/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -40,14 +40,14 @@
40
40
  "process"
41
41
  ],
42
42
  "dependencies": {
43
- "@gjsify/events": "^0.64.5",
44
- "@gjsify/string_decoder": "^0.64.5",
45
- "@gjsify/terminal-native": "^0.64.5",
46
- "@gjsify/utils": "^0.64.5"
43
+ "@gjsify/events": "^0.64.7",
44
+ "@gjsify/string_decoder": "^0.64.7",
45
+ "@gjsify/terminal-native": "^0.64.7",
46
+ "@gjsify/utils": "^0.64.7"
47
47
  },
48
48
  "devDependencies": {
49
- "@gjsify/cli": "^0.64.5",
50
- "@gjsify/unit": "^0.64.5",
49
+ "@gjsify/cli": "^0.64.7",
50
+ "@gjsify/unit": "^0.64.7",
51
51
  "@types/node": "^25.9.2",
52
52
  "typescript": "^6.0.3"
53
53
  },