@gjsify/utils 0.64.11 → 0.64.12-next.280
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 +9 -5
- package/package.json +4 -3
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}from"./main-loop.js";import{NativeLibraryLoadError as
|
|
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,trackTimer as K,untrackTimer as q}from"./main-loop.js";import{NativeLibraryLoadError as J,colocateNativeLibrary as Y,loadOptionalNativeModule as X,missingLibraryDependency as Z,openNativeLibrary as Q,probeNativeLibrary as $}from"./native-library.js";import{__resetBurstStateForTests as ee,nextTick as te}from"./next-tick.js";export{r as GIO_ERROR_TO_NODE,i as GLIB_FILE_ERROR_TO_NODE,J as NativeLibraryLoadError,w as PROBED_GI_LIBDIRS,l as TARGET_OSES,T as TYPELIB_SUBDIR,ee as __resetBurstStateForTests,V as acquireMainLoop,Y 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,X as loadOptionalNativeModule,e as makeCallable,M as mapMachine,N as mapSysname,Z as missingLibraryDependency,te as nextTick,g as notImplemented,Q as openNativeLibrary,S as pathToFileUrlHref,$ 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 trackTimer,q 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}from"./main-loop.js";import{NativeLibraryLoadError as
|
|
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,trackTimer 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";import"./core.js";import{readJSON as ie}from"./file.js";import{existsFD as ae,existsSync as oe}from"./fs.js";import{gioAsync as se,inputStreamAsyncIterator as ce,readBytesAsync as le}from"./gio.js";import{getNodeModulesPath as ue,getPathSeparator as de,getProgramDir as fe,getProgramExe as pe,resolve as me}from"./path.js";import{closeSocketService as he,releaseListenPort as ge}from"./socket-service.js";export{a as GIO_ERROR_TO_NODE,o as GLIB_FILE_ERROR_TO_NODE,X as NativeLibraryLoadError,E as PROBED_GI_LIBDIRS,d as TARGET_OSES,D as TYPELIB_SUBDIR,ne as __resetBurstStateForTests,U as acquireMainLoop,n as cli,he as closeSocketService,Z as colocateNativeLibrary,s as createGLibFileError,c as createNodeError,M as decodeXmlEntities,r as deferEmit,O as dyldDefaultFallbackDirs,x as encodePathForFileUrl,W as ensureMainLoop,ae as existsFD,oe as existsSync,e as gbytesToUint8Array,ue as getNodeModulesPath,de as getPathSeparator,fe as getProgramDir,pe as getProgramExe,k as giLibraryDirsForTypelibDir,se 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,ce as inputStreamAsyncIterator,m as isDarwin,h as isLinux,l as isNotFoundError,g as isTargetOs,_ as isWin32,S as isWindowsPath,C as lastPathSeparatorIndex,Q as loadOptionalNativeModule,t as makeCallable,P as mapMachine,F as mapSysname,$ as missingLibraryDependency,re as nextTick,v as notImplemented,ee as openNativeLibrary,w as pathToFileUrlHref,te as probeNativeLibrary,b as queueMicrotask,K as quitMainLoop,le as readBytesAsync,ie as readJSON,H as readProcessMemory,u as registerGlobal,ge as releaseListenPort,q as releaseMainLoop,me as resolve,N as scanXml,T as splitPathComponents,A as splitSearchPath,I as structuredClone,j as systemGiLibraryDirs,J as trackTimer,Y 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;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&&(i=!e),r+=1,n}function releaseMainLoop(){
|
|
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&&!o&&(i=!e),r+=1,n}function releaseMainLoop(){r===0||!e||(--r,drainIfIdle())}function trackTimer(){a+=1}function untrackTimer(){a!==0&&(--a,a===0&&drainIfIdle())}function drainIfIdle(){if(r!==0||!e||!i)return;let t=e;if(!n){quitMainLoop();return}if(a!==0){o=!0;return}if(!t.is_running()){o=!0,awaitEntrySettle(t);return}exitParked()}function awaitEntrySettle(t){let n=glib();!n||s||(s=!0,n.timeout_add(n.PRIORITY_DEFAULT,20,()=>e!==t||r!==0||a!==0?(s=!1,n.SOURCE_REMOVE):t.is_running()?(s=!1,exitParked(),n.SOURCE_REMOVE):n.SOURCE_CONTINUE))}function exitParked(){quitMainLoop();let e=globalThis.process;if(typeof e?.exit!=`function`)return;let t=e.exitCode??0,n=glib();n?n.timeout_add(n.PRIORITY_DEFAULT,0,()=>(e.exit(t),n.SOURCE_REMOVE)):e.exit(t)}function quitMainLoop(){e&&(e.quit(),t=!1,n=!1,e=null,r=0,i=!1,o=!1)}export{acquireMainLoop,ensureMainLoop,holdMainLoop,quitMainLoop,releaseMainLoop,trackTimer,untrackTimer};
|
package/lib/types/main-loop.d.ts
CHANGED
|
@@ -63,8 +63,8 @@ export declare function holdMainLoop(): GLib.MainLoop | undefined;
|
|
|
63
63
|
* no "run until no sources remain" — so a drain cannot be observed by the loop
|
|
64
64
|
* itself; it has to be counted.
|
|
65
65
|
*
|
|
66
|
-
* Known limit, counted holds are only the `worker_threads`
|
|
67
|
-
* `net`/`http`/`dgram`/`ws
|
|
66
|
+
* Known limit, counted holds are only the `worker_threads` and `child_process` consumers today:
|
|
67
|
+
* `net`/`http`/`dgram`/`ws` park via {@link ensureMainLoop}
|
|
68
68
|
* forever (their close paths don't release yet), so an app holding BOTH a
|
|
69
69
|
* live server and a worker stays parked when the worker drains — same as on
|
|
70
70
|
* those packages' pre-existent behavior, and the slot for their migration is
|
|
@@ -76,11 +76,15 @@ 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
|
|
80
|
-
*
|
|
81
|
-
*
|
|
79
|
+
* the count (calls at 0 are a no-op), no-op on Node.js. At 0, with no referenced timer
|
|
80
|
+
* ({@link trackTimer}) pending and the entry module settled, the loop created
|
|
81
|
+
* by this module is quit and the process exits — the Node "refs drained" moment.
|
|
82
82
|
*/
|
|
83
83
|
export declare function releaseMainLoop(): void;
|
|
84
|
+
/** Count one referenced timer. See {@link _timers}. */
|
|
85
|
+
export declare function trackTimer(): void;
|
|
86
|
+
/** Drop one referenced timer; the last one may complete a postponed exit. */
|
|
87
|
+
export declare function untrackTimer(): void;
|
|
84
88
|
/**
|
|
85
89
|
* Quit the MainLoop created by `ensureMainLoop()`. Idempotent, no-op on Node.js.
|
|
86
90
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/utils",
|
|
3
|
-
"version": "0.64.
|
|
3
|
+
"version": "0.64.12-next.280",
|
|
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": "
|
|
52
|
+
"@gjsify/cli": "0.64.12-next.280",
|
|
53
53
|
"typescript": "^6.0.3"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
@@ -109,5 +109,6 @@
|
|
|
109
109
|
"darwin": "supported",
|
|
110
110
|
"win32": "supported"
|
|
111
111
|
}
|
|
112
|
-
}
|
|
112
|
+
},
|
|
113
|
+
"gitHead": "0a9185d91127072fce6aa54dc126e87e6ecd0c3d"
|
|
113
114
|
}
|