@gjsify/utils 0.45.0 → 0.47.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.
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,splitSearchPath as E,systemGiLibraryDirs as D}from"./system-gi-dirs.js";import{mapMachine as O,mapSysname as k}from"./platform-names.js";import{structuredClone as A}from"./structured-clone.js";import{hasProcfs as j,hostExecPath as M,hostPid as N,hostPpid as P,readProcessMemory as F}from"./host-process.js";import{ensureMainLoop as I,holdMainLoop as L,quitMainLoop as R}from"./main-loop.js";import{__resetBurstStateForTests as z,nextTick as B}from"./next-tick.js";export{r as GIO_ERROR_TO_NODE,i as GLIB_FILE_ERROR_TO_NODE,w as PROBED_GI_LIBDIRS,l as TARGET_OSES,T as TYPELIB_SUBDIR,z as __resetBurstStateForTests,a as createGLibFileError,o as createNodeError,t as deferEmit,y as encodePathForFileUrl,I as ensureMainLoop,j as hasProcfs,L as holdMainLoop,M as hostExecPath,u as hostOs,N as hostPid,d as hostPlatform,P 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,e as makeCallable,O as mapMachine,k as mapSysname,B as nextTick,g as notImplemented,S as pathToFileUrlHref,v as queueMicrotask,R as quitMainLoop,F as readProcessMemory,c as registerGlobal,C as splitPathComponents,E as splitSearchPath,A as structuredClone,D as systemGiLibraryDirs,_ as warnNotImplemented};
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,giLibraryDirsForTypelibDir as E,splitSearchPath as D,systemGiLibraryDirs as O}from"./system-gi-dirs.js";import{mapMachine as k,mapSysname as A}from"./platform-names.js";import{structuredClone as j}from"./structured-clone.js";import{hasProcfs as M,hostExecPath as N,hostPid as P,hostPpid as F,readProcessMemory as I}from"./host-process.js";import{ensureMainLoop as L,holdMainLoop as R,quitMainLoop as z}from"./main-loop.js";import{__resetBurstStateForTests as B,nextTick as V}from"./next-tick.js";export{r as GIO_ERROR_TO_NODE,i as GLIB_FILE_ERROR_TO_NODE,w as PROBED_GI_LIBDIRS,l as TARGET_OSES,T as TYPELIB_SUBDIR,B as __resetBurstStateForTests,a as createGLibFileError,o as createNodeError,t as deferEmit,y as encodePathForFileUrl,L as ensureMainLoop,E as giLibraryDirsForTypelibDir,M as hasProcfs,R as holdMainLoop,N as hostExecPath,u as hostOs,P as hostPid,d as hostPlatform,F 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,e as makeCallable,k as mapMachine,A as mapSysname,V as nextTick,g as notImplemented,S as pathToFileUrlHref,v as queueMicrotask,z as quitMainLoop,I as readProcessMemory,c as registerGlobal,C as splitPathComponents,D as splitSearchPath,j as structuredClone,O as systemGiLibraryDirs,_ 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,splitSearchPath as O,systemGiLibraryDirs as k}from"./system-gi-dirs.js";import{mapMachine as A,mapSysname as j}from"./platform-names.js";import{structuredClone as M}from"./structured-clone.js";import{hasProcfs as N,hostExecPath as P,hostPid as F,hostPpid as I,readProcessMemory as L}from"./host-process.js";import{ensureMainLoop as R,holdMainLoop as z,quitMainLoop as B}from"./main-loop.js";import{__resetBurstStateForTests as V,nextTick as H}from"./next-tick.js";import"./core.js";import{readJSON as U}from"./file.js";import{existsFD as W,existsSync as G}from"./fs.js";import{gioAsync as K,inputStreamAsyncIterator as q,readBytesAsync as J}from"./gio.js";import{getNodeModulesPath as Y,getPathSeparator as X,getProgramDir as Z,getProgramExe as Q,resolve as $}from"./path.js";export{a as GIO_ERROR_TO_NODE,o as GLIB_FILE_ERROR_TO_NODE,E as PROBED_GI_LIBDIRS,d as TARGET_OSES,D as TYPELIB_SUBDIR,V as __resetBurstStateForTests,n as cli,s as createGLibFileError,c as createNodeError,r as deferEmit,x as encodePathForFileUrl,R as ensureMainLoop,W as existsFD,G as existsSync,e as gbytesToUint8Array,Y as getNodeModulesPath,X as getPathSeparator,Z as getProgramDir,Q as getProgramExe,K as gioAsync,N as hasProcfs,z as holdMainLoop,P as hostExecPath,f as hostOs,F as hostPid,p as hostPlatform,I as hostPpid,i as initErrorV8Methods,q as inputStreamAsyncIterator,m as isDarwin,h as isLinux,l as isNotFoundError,g as isTargetOs,_ as isWin32,S as isWindowsPath,C as lastPathSeparatorIndex,t as makeCallable,A as mapMachine,j as mapSysname,H as nextTick,v as notImplemented,w as pathToFileUrlHref,b as queueMicrotask,B as quitMainLoop,J as readBytesAsync,U as readJSON,L as readProcessMemory,u as registerGlobal,$ as resolve,T as splitPathComponents,O as splitSearchPath,M as structuredClone,k as systemGiLibraryDirs,y as warnNotImplemented};
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,giLibraryDirsForTypelibDir as O,splitSearchPath as k,systemGiLibraryDirs as A}from"./system-gi-dirs.js";import{mapMachine as j,mapSysname as M}from"./platform-names.js";import{structuredClone as N}from"./structured-clone.js";import{hasProcfs as P,hostExecPath as F,hostPid as I,hostPpid as L,readProcessMemory as R}from"./host-process.js";import{ensureMainLoop as z,holdMainLoop as B,quitMainLoop as V}from"./main-loop.js";import{__resetBurstStateForTests as H,nextTick as U}from"./next-tick.js";import"./core.js";import{readJSON as W}from"./file.js";import{existsFD as G,existsSync as K}from"./fs.js";import{gioAsync as q,inputStreamAsyncIterator as J,readBytesAsync as Y}from"./gio.js";import{getNodeModulesPath as X,getPathSeparator as Z,getProgramDir as Q,getProgramExe as $,resolve as ee}from"./path.js";export{a as GIO_ERROR_TO_NODE,o as GLIB_FILE_ERROR_TO_NODE,E as PROBED_GI_LIBDIRS,d as TARGET_OSES,D as TYPELIB_SUBDIR,H as __resetBurstStateForTests,n as cli,s as createGLibFileError,c as createNodeError,r as deferEmit,x as encodePathForFileUrl,z as ensureMainLoop,G as existsFD,K as existsSync,e as gbytesToUint8Array,X as getNodeModulesPath,Z as getPathSeparator,Q as getProgramDir,$ as getProgramExe,O as giLibraryDirsForTypelibDir,q as gioAsync,P as hasProcfs,B as holdMainLoop,F as hostExecPath,f as hostOs,I as hostPid,p as hostPlatform,L as hostPpid,i as initErrorV8Methods,J as inputStreamAsyncIterator,m as isDarwin,h as isLinux,l as isNotFoundError,g as isTargetOs,_ as isWin32,S as isWindowsPath,C as lastPathSeparatorIndex,t as makeCallable,j as mapMachine,M as mapSysname,U as nextTick,v as notImplemented,w as pathToFileUrlHref,b as queueMicrotask,V as quitMainLoop,Y as readBytesAsync,W as readJSON,R as readProcessMemory,u as registerGlobal,ee as resolve,T as splitPathComponents,k as splitSearchPath,N as structuredClone,A as systemGiLibraryDirs,y as warnNotImplemented};
@@ -1 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";import{lastPathSeparatorIndex as e,splitPathComponents as t}from"./path-shape.js";const n=`girepository-1.0`,r={darwin:[`/opt/homebrew/lib`,`/usr/local/lib`,`/opt/local/lib`]};function splitSearchPath(e,t=`:`){return(e??``).split(t).filter(Boolean)}function dirname(t){let n=e(t);return n<0?`.`:n===0?t.slice(0,1):t.slice(0,n)}function basename(e){let n=t(e).filter(Boolean);return n.length===0?``:n[n.length-1]}function systemGiLibraryDirs(e){let t=r[e.platform];if(!t)return[];let n=[],add=e=>{e&&e!==`/`&&!n.includes(e)&&n.push(e)};for(let t of splitSearchPath(e.typelibPath)){let n=dirname(t);e.existsDir(n)&&add(n)}let i=[];for(let t of e.pkgConfigDirs??[])basename(t)===`pkgconfig`&&i.push(dirname(t));i.push(...t);for(let t of i)e.existsDir(`${t}/girepository-1.0`)&&add(t);return n}export{r as PROBED_GI_LIBDIRS,n as TYPELIB_SUBDIR,splitSearchPath,systemGiLibraryDirs};
1
+ import"./_virtual/_rolldown/runtime.js";import{isWindowsPath as e,lastPathSeparatorIndex as t,splitPathComponents as n}from"./path-shape.js";const r=`girepository-1.0`,i={darwin:[`/opt/homebrew/lib`,`/usr/local/lib`,`/opt/local/lib`]};function splitSearchPath(e,t=`:`){return(e??``).split(t).filter(Boolean)}function stripTrailingSeparators(t){return t.replace(e(t)?/(?<=.)[\\/]+$/:/(?<=.)\/+$/,``)}function dirname(e){let n=stripTrailingSeparators(e),r=t(n);return r<0?`.`:r===0?n.slice(0,1):n.slice(0,r)}function basename(e){let t=n(e).filter(Boolean);return t.length===0?``:t[t.length-1]}function giLibraryDirsForTypelibDir(e){let t=dirname(e);return basename(e)===`girepository-1.0`?[t]:[e,t]}function systemGiLibraryDirs(e){let t=i[e.platform];if(!t)return[];let n=[],add=e=>{e&&e!==`/`&&!n.includes(e)&&n.push(e)};for(let t of splitSearchPath(e.typelibPath))for(let n of giLibraryDirsForTypelibDir(t))e.existsDir(n)&&add(n);let r=[];for(let t of e.pkgConfigDirs??[])basename(t)===`pkgconfig`&&r.push(dirname(t));r.push(...t);for(let t of r)e.existsDir(`${t}/girepository-1.0`)&&add(t);return n}export{i as PROBED_GI_LIBDIRS,r as TYPELIB_SUBDIR,giLibraryDirsForTypelibDir,splitSearchPath,systemGiLibraryDirs};
@@ -15,6 +15,20 @@ export declare const TYPELIB_SUBDIR = "girepository-1.0";
15
15
  export declare const PROBED_GI_LIBDIRS: Readonly<Record<string, readonly string[]>>;
16
16
  /** Split a `PATH`-shaped value. Empty entries dropped; `undefined` yields `[]`. */
17
17
  export declare function splitSearchPath(value: string | undefined, separator?: string): string[];
18
+ /**
19
+ * The library directories a typelib directory implies, most specific first.
20
+ *
21
+ * TWO LAYOUTS, and a path alone cannot always say which: GI's INSTALL layout keeps
22
+ * the libraries in the PARENT (`<libdir>/girepository-1.0/Gtk-4.0.typelib` beside
23
+ * `<libdir>/libgtk-4.1.dylib`), while a STAGED pair — an ADR 0017 prebuild
24
+ * directory, `gjsify.ship.bundledTypelibs` — keeps them in the DIRECTORY ITSELF.
25
+ * {@link TYPELIB_SUBDIR} as the basename is a positive signal for the first; absent
26
+ * it, both readings are offered and the caller's `existsDir` keeps whichever is real.
27
+ *
28
+ * The measurement, and why the ORDER of the two is the load-bearing half, are in
29
+ * `packages/node-gi/node-gi/system-gi.js`, the copy that ran into it.
30
+ */
31
+ export declare function giLibraryDirsForTypelibDir(typelibDir: string): string[];
18
32
  export interface SystemGiLibraryDirsHost {
19
33
  /** `process.platform`, or the platform being reasoned about. */
20
34
  platform: string;
@@ -32,8 +46,9 @@ export interface SystemGiLibraryDirsHost {
32
46
  * Three sources, in precedence order:
33
47
  *
34
48
  * 1. `GI_TYPELIB_PATH` — the host stating outright where typelibs live; the
35
- * libraries are the sibling `dirname()`. Believed on directory existence
36
- * alone, because an explicit statement is not second-guessed.
49
+ * libraries are wherever {@link giLibraryDirsForTypelibDir} says the layout
50
+ * puts them. Believed on directory existence alone, because an explicit
51
+ * statement is not second-guessed.
37
52
  * 2. `pkg-config`'s `.pc` search path → each `<dir>/pkgconfig`'s parent. The
38
53
  * general mechanism, covering a custom prefix.
39
54
  * 3. {@link PROBED_GI_LIBDIRS}.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/utils",
3
- "version": "0.45.0",
3
+ "version": "0.47.0",
4
4
  "description": "Utils module for gjsify",
5
5
  "module": "lib/esm/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -40,14 +40,14 @@
40
40
  "fs"
41
41
  ],
42
42
  "devDependencies": {
43
- "@gjsify/cli": "^0.45.0",
43
+ "@gjsify/cli": "^0.47.0",
44
44
  "typescript": "^6.0.3"
45
45
  },
46
46
  "dependencies": {
47
- "@girs/gio-2.0": "^4.1.0",
48
- "@girs/giounix-2.0": "^4.1.0",
49
- "@girs/gjs": "^4.1.0",
50
- "@girs/glib-2.0": "^4.1.0"
47
+ "@girs/gio-2.0": "4.6.0",
48
+ "@girs/giounix-2.0": "4.6.0",
49
+ "@girs/gjs": "4.6.0",
50
+ "@girs/glib-2.0": "4.6.0"
51
51
  },
52
52
  "license": "MIT",
53
53
  "repository": {