@gjsify/utils 0.64.12 → 0.64.13
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/core.js +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/main-loop.js +1 -1
- package/lib/types/main-loop.d.ts +13 -4
- package/package.json +2 -2
package/lib/esm/core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{makeCallable as e}from"./callable.js";import{deferEmit as t}from"./defer.js";import{initErrorV8Methods as n}from"./error.js";import{GIO_ERROR_TO_NODE as r,GLIB_FILE_ERROR_TO_NODE as i,createGLibFileError as a,createNodeError as o,isNotFoundError as s}from"./gio-errors.js";import{registerGlobal as c}from"./globals.js";import{TARGET_OSES as l,hostOs as u,hostPlatform as d,isDarwin as f,isLinux as p,isTargetOs as m,isWin32 as h}from"./host-os.js";import{notImplemented as g,warnNotImplemented as _}from"./message.js";import{queueMicrotask as v}from"./microtask.js";import{encodePathForFileUrl as y,isWindowsPath as b,lastPathSeparatorIndex as x,pathToFileUrlHref as S,splitPathComponents as C}from"./path-shape.js";import{PROBED_GI_LIBDIRS as w,TYPELIB_SUBDIR as T,dyldDefaultFallbackDirs as E,giLibraryDirsForTypelibDir as D,splitSearchPath as O,systemGiLibraryDirs as k}from"./system-gi-dirs.js";import{decodeXmlEntities as A,scanXml as j}from"./xml-scan.js";import{mapMachine as M,mapSysname as N}from"./platform-names.js";import{structuredClone as P}from"./structured-clone.js";import{hasProcfs as F,hostEnv as I,hostExecPath as L,hostPid as R,hostPpid as z,readProcessMemory as B}from"./host-process.js";import{acquireMainLoop as V,ensureMainLoop as H,holdMainLoop as U,quitMainLoop as W,releaseMainLoop as G,
|
|
1
|
+
import{makeCallable as e}from"./callable.js";import{deferEmit as t}from"./defer.js";import{initErrorV8Methods as n}from"./error.js";import{GIO_ERROR_TO_NODE as r,GLIB_FILE_ERROR_TO_NODE as i,createGLibFileError as a,createNodeError as o,isNotFoundError as s}from"./gio-errors.js";import{registerGlobal as c}from"./globals.js";import{TARGET_OSES as l,hostOs as u,hostPlatform as d,isDarwin as f,isLinux as p,isTargetOs as m,isWin32 as h}from"./host-os.js";import{notImplemented as g,warnNotImplemented as _}from"./message.js";import{queueMicrotask as v}from"./microtask.js";import{encodePathForFileUrl as y,isWindowsPath as b,lastPathSeparatorIndex as x,pathToFileUrlHref as S,splitPathComponents as C}from"./path-shape.js";import{PROBED_GI_LIBDIRS as w,TYPELIB_SUBDIR as T,dyldDefaultFallbackDirs as E,giLibraryDirsForTypelibDir as D,splitSearchPath as O,systemGiLibraryDirs as k}from"./system-gi-dirs.js";import{decodeXmlEntities as A,scanXml as j}from"./xml-scan.js";import{mapMachine as M,mapSysname as N}from"./platform-names.js";import{structuredClone as P}from"./structured-clone.js";import{hasProcfs as F,hostEnv as I,hostExecPath as L,hostPid as R,hostPpid as z,readProcessMemory as B}from"./host-process.js";import{acquireMainLoop as V,ensureMainLoop as H,holdMainLoop as U,quitMainLoop as W,releaseMainLoop as G,trackRequest as K,trackTimer as q,untrackRequest as J,untrackTimer as Y}from"./main-loop.js";import{NativeLibraryLoadError as X,colocateNativeLibrary as Z,loadOptionalNativeModule as Q,missingLibraryDependency as $,openNativeLibrary as ee,probeNativeLibrary as te}from"./native-library.js";import{__resetBurstStateForTests as ne,nextTick as re}from"./next-tick.js";export{r as GIO_ERROR_TO_NODE,i as GLIB_FILE_ERROR_TO_NODE,X as NativeLibraryLoadError,w as PROBED_GI_LIBDIRS,l as TARGET_OSES,T as TYPELIB_SUBDIR,ne as __resetBurstStateForTests,V as acquireMainLoop,Z as colocateNativeLibrary,a as createGLibFileError,o as createNodeError,A as decodeXmlEntities,t as deferEmit,E as dyldDefaultFallbackDirs,y as encodePathForFileUrl,H as ensureMainLoop,D as giLibraryDirsForTypelibDir,F as hasProcfs,U as holdMainLoop,I as hostEnv,L as hostExecPath,u as hostOs,R as hostPid,d as hostPlatform,z as hostPpid,n as initErrorV8Methods,f as isDarwin,p as isLinux,s as isNotFoundError,m as isTargetOs,h as isWin32,b as isWindowsPath,x as lastPathSeparatorIndex,Q as loadOptionalNativeModule,e as makeCallable,M as mapMachine,N as mapSysname,$ as missingLibraryDependency,re as nextTick,g as notImplemented,ee as openNativeLibrary,S as pathToFileUrlHref,te as probeNativeLibrary,v as queueMicrotask,W as quitMainLoop,B as readProcessMemory,c as registerGlobal,G as releaseMainLoop,j as scanXml,C as splitPathComponents,O as splitSearchPath,P as structuredClone,k as systemGiLibraryDirs,K as trackRequest,q as trackTimer,J as untrackRequest,Y as untrackTimer,_ as warnNotImplemented};
|
package/lib/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{gbytesToUint8Array as e}from"./byte-array.js";import{makeCallable as t}from"./callable.js";import{cli as n}from"./cli.js";import{deferEmit as r}from"./defer.js";import{initErrorV8Methods as i}from"./error.js";import{GIO_ERROR_TO_NODE as a,GLIB_FILE_ERROR_TO_NODE as o,createGLibFileError as s,createNodeError as c,isNotFoundError as l}from"./gio-errors.js";import{registerGlobal as u}from"./globals.js";import{TARGET_OSES as d,hostOs as f,hostPlatform as p,isDarwin as m,isLinux as h,isTargetOs as g,isWin32 as _}from"./host-os.js";import{notImplemented as v,warnNotImplemented as y}from"./message.js";import{queueMicrotask as b}from"./microtask.js";import{encodePathForFileUrl as x,isWindowsPath as S,lastPathSeparatorIndex as C,pathToFileUrlHref as w,splitPathComponents as T}from"./path-shape.js";import{PROBED_GI_LIBDIRS as E,TYPELIB_SUBDIR as D,dyldDefaultFallbackDirs as O,giLibraryDirsForTypelibDir as k,splitSearchPath as A,systemGiLibraryDirs as j}from"./system-gi-dirs.js";import{decodeXmlEntities as M,scanXml as N}from"./xml-scan.js";import{mapMachine as P,mapSysname as F}from"./platform-names.js";import{structuredClone as I}from"./structured-clone.js";import{hasProcfs as L,hostEnv as R,hostExecPath as z,hostPid as B,hostPpid as V,readProcessMemory as H}from"./host-process.js";import{acquireMainLoop as U,ensureMainLoop as W,holdMainLoop as G,quitMainLoop as K,releaseMainLoop as q,
|
|
1
|
+
import{gbytesToUint8Array as e}from"./byte-array.js";import{makeCallable as t}from"./callable.js";import{cli as n}from"./cli.js";import{deferEmit as r}from"./defer.js";import{initErrorV8Methods as i}from"./error.js";import{GIO_ERROR_TO_NODE as a,GLIB_FILE_ERROR_TO_NODE as o,createGLibFileError as s,createNodeError as c,isNotFoundError as l}from"./gio-errors.js";import{registerGlobal as u}from"./globals.js";import{TARGET_OSES as d,hostOs as f,hostPlatform as p,isDarwin as m,isLinux as h,isTargetOs as g,isWin32 as _}from"./host-os.js";import{notImplemented as v,warnNotImplemented as y}from"./message.js";import{queueMicrotask as b}from"./microtask.js";import{encodePathForFileUrl as x,isWindowsPath as S,lastPathSeparatorIndex as C,pathToFileUrlHref as w,splitPathComponents as T}from"./path-shape.js";import{PROBED_GI_LIBDIRS as E,TYPELIB_SUBDIR as D,dyldDefaultFallbackDirs as O,giLibraryDirsForTypelibDir as k,splitSearchPath as A,systemGiLibraryDirs as j}from"./system-gi-dirs.js";import{decodeXmlEntities as M,scanXml as N}from"./xml-scan.js";import{mapMachine as P,mapSysname as F}from"./platform-names.js";import{structuredClone as I}from"./structured-clone.js";import{hasProcfs as L,hostEnv as R,hostExecPath as z,hostPid as B,hostPpid as V,readProcessMemory as H}from"./host-process.js";import{acquireMainLoop as U,ensureMainLoop as W,holdMainLoop as G,quitMainLoop as K,releaseMainLoop as q,trackRequest as J,trackTimer as Y,untrackRequest as X,untrackTimer as Z}from"./main-loop.js";import{NativeLibraryLoadError as Q,colocateNativeLibrary as $,loadOptionalNativeModule as ee,missingLibraryDependency as te,openNativeLibrary as ne,probeNativeLibrary as re}from"./native-library.js";import{__resetBurstStateForTests as ie,nextTick as ae}from"./next-tick.js";import"./core.js";import{readJSON as oe}from"./file.js";import{existsFD as se,existsSync as ce}from"./fs.js";import{gioAsync as le,inputStreamAsyncIterator as ue,readBytesAsync as de}from"./gio.js";import{getNodeModulesPath as fe,getPathSeparator as pe,getProgramDir as me,getProgramExe as he,resolve as ge}from"./path.js";import{closeSocketService as _e,releaseListenPort as ve}from"./socket-service.js";export{a as GIO_ERROR_TO_NODE,o as GLIB_FILE_ERROR_TO_NODE,Q as NativeLibraryLoadError,E as PROBED_GI_LIBDIRS,d as TARGET_OSES,D as TYPELIB_SUBDIR,ie as __resetBurstStateForTests,U as acquireMainLoop,n as cli,_e as closeSocketService,$ as colocateNativeLibrary,s as createGLibFileError,c as createNodeError,M as decodeXmlEntities,r as deferEmit,O as dyldDefaultFallbackDirs,x as encodePathForFileUrl,W as ensureMainLoop,se as existsFD,ce as existsSync,e as gbytesToUint8Array,fe as getNodeModulesPath,pe as getPathSeparator,me as getProgramDir,he as getProgramExe,k as giLibraryDirsForTypelibDir,le as gioAsync,L as hasProcfs,G as holdMainLoop,R as hostEnv,z as hostExecPath,f as hostOs,B as hostPid,p as hostPlatform,V as hostPpid,i as initErrorV8Methods,ue as inputStreamAsyncIterator,m as isDarwin,h as isLinux,l as isNotFoundError,g as isTargetOs,_ as isWin32,S as isWindowsPath,C as lastPathSeparatorIndex,ee as loadOptionalNativeModule,t as makeCallable,P as mapMachine,F as mapSysname,te as missingLibraryDependency,ae as nextTick,v as notImplemented,ne as openNativeLibrary,w as pathToFileUrlHref,re as probeNativeLibrary,b as queueMicrotask,K as quitMainLoop,de as readBytesAsync,oe as readJSON,H as readProcessMemory,u as registerGlobal,ve as releaseListenPort,q as releaseMainLoop,ge as resolve,N as scanXml,T as splitPathComponents,A as splitSearchPath,I as structuredClone,j as systemGiLibraryDirs,J as trackRequest,Y as trackTimer,X as untrackRequest,Z as untrackTimer,y as warnNotImplemented};
|
package/lib/esm/main-loop.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";let e=null,t=!1,n=!1,r=0,i=!1,a=0,o=!1,s=!1;function glib(){let e=globalThis;if(typeof e.process?.versions?.gjs==`string`||e.process===void 0)return e.imports?.gi?.GLib}function arm(e){n||(n=!0,e.runAsync().catch(()=>{}))}function ensureMainLoop(){return i=!1,createLoop()}function createLoop(){let n=glib();if(n)return t?e:(e=new n.MainLoop(null,!1),t=!0,n.main_depth()===0&&arm(e),e)}function holdMainLoop(){let e=ensureMainLoop();return e&&arm(e),e}function acquireMainLoop(){let e=t,n=createLoop();if(n)return r===0&&!
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";let e=null,t=!1,n=!1,r=0,i=!1,a=0,o=!1,s=!1,c=!1;function glib(){let e=globalThis;if(typeof e.process?.versions?.gjs==`string`||e.process===void 0)return e.imports?.gi?.GLib}function arm(e){n||(n=!0,e.runAsync().catch(()=>{}))}function ensureMainLoop(){return i=!1,createLoop()}function createLoop(){let n=glib();if(n)return t?e:(e=new n.MainLoop(null,!1),t=!0,n.main_depth()===0&&arm(e),e)}function holdMainLoop(){let e=ensureMainLoop();return e&&arm(e),e}function acquireMainLoop(){let e=t,n=createLoop();if(n)return r===0&&!s&&(i=!e),r+=1,n}function releaseMainLoop(){r===0||!e||(--r,drainIfIdle())}function trackTimer(){a+=1}function untrackTimer(){dropPending()}function trackRequest(){a+=1}function untrackRequest(){dropPending()}function dropPending(){a!==0&&(--a,a===0&&drainIfIdle())}function drainIfIdle(){if(r!==0||!e||!i)return;let t=e;if(!n){quitMainLoop();return}if(a!==0){s=!0;return}if(!t.is_running()){s=!0,awaitEntrySettle(t);return}exitParked()}function awaitEntrySettle(t){let n=glib();!n||c||(c=!0,n.timeout_add(n.PRIORITY_DEFAULT,20,()=>e!==t||r!==0||a!==0?(c=!1,n.SOURCE_REMOVE):t.is_running()?(c=!1,exitParked(),n.SOURCE_REMOVE):n.SOURCE_CONTINUE))}function exitParked(){let t=globalThis.process,n=glib();if(typeof t?.exit!=`function`||!n){quitMainLoop(),t?.exit?.(t.exitCode??0);return}if(o)return;o=!0;let i=e;n.timeout_add(n.PRIORITY_DEFAULT,0,()=>{if(o=!1,e!==i||r!==0)return n.SOURCE_REMOVE;if(a!==0)return s=!0,n.SOURCE_REMOVE;let c=t.exitCode??0;return quitMainLoop(),t.exit(c),n.SOURCE_REMOVE})}function quitMainLoop(){e&&(e.quit(),t=!1,n=!1,e=null,r=0,i=!1,s=!1)}export{acquireMainLoop,ensureMainLoop,holdMainLoop,quitMainLoop,releaseMainLoop,trackRequest,trackTimer,untrackRequest,untrackTimer};
|
package/lib/types/main-loop.d.ts
CHANGED
|
@@ -76,15 +76,24 @@ export declare function holdMainLoop(): GLib.MainLoop | undefined;
|
|
|
76
76
|
export declare function acquireMainLoop(): GLib.MainLoop | undefined;
|
|
77
77
|
/**
|
|
78
78
|
* Release one hold acquired with {@link acquireMainLoop}. Idempotent beyond
|
|
79
|
-
* the count (calls at 0 are a no-op), no-op on Node.js. At 0, with no
|
|
80
|
-
* ({@link trackTimer})
|
|
81
|
-
*
|
|
79
|
+
* the count (calls at 0 are a no-op), no-op on Node.js. At 0, with no
|
|
80
|
+
* referenced timer ({@link trackTimer}) or request ({@link trackRequest})
|
|
81
|
+
* pending and the entry module settled, the loop created by this module is
|
|
82
|
+
* quit and the process exits — the Node "refs drained" moment.
|
|
82
83
|
*/
|
|
83
84
|
export declare function releaseMainLoop(): void;
|
|
84
|
-
/** Count one referenced timer. See {@link
|
|
85
|
+
/** Count one referenced timer. See {@link _pending}. */
|
|
85
86
|
export declare function trackTimer(): void;
|
|
86
87
|
/** Drop one referenced timer; the last one may complete a postponed exit. */
|
|
87
88
|
export declare function untrackTimer(): void;
|
|
89
|
+
/**
|
|
90
|
+
* Count one in-flight async request (a Gio `*_async` call a Node API is
|
|
91
|
+
* waiting on). See {@link _pending}. Like a timer it only defers an exit, it
|
|
92
|
+
* never arms a loop — safe to call from any Node-layer I/O, GTK apps included.
|
|
93
|
+
*/
|
|
94
|
+
export declare function trackRequest(): void;
|
|
95
|
+
/** Drop one in-flight request after its completion has been delivered. */
|
|
96
|
+
export declare function untrackRequest(): void;
|
|
88
97
|
/**
|
|
89
98
|
* Quit the MainLoop created by `ensureMainLoop()`. Idempotent, no-op on Node.js.
|
|
90
99
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/utils",
|
|
3
|
-
"version": "0.64.
|
|
3
|
+
"version": "0.64.13",
|
|
4
4
|
"description": "Utils module for gjsify",
|
|
5
5
|
"module": "lib/esm/index.js",
|
|
6
6
|
"types": "lib/types/index.d.ts",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"fs"
|
|
50
50
|
],
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@gjsify/cli": "^0.64.
|
|
52
|
+
"@gjsify/cli": "^0.64.13",
|
|
53
53
|
"typescript": "^6.0.3"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|