@gjsify/utils 0.64.1-next.243 → 0.64.1-next.244

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,dyldDefaultFallbackDirs as E,giLibraryDirsForTypelibDir 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,hostEnv 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{NativeLibraryLoadError as H,colocateNativeLibrary as U,loadOptionalNativeModule as W,missingLibraryDependency as G,openNativeLibrary as K,probeNativeLibrary as q}from"./native-library.js";import{__resetBurstStateForTests as J,nextTick as Y}from"./next-tick.js";export{r as GIO_ERROR_TO_NODE,i as GLIB_FILE_ERROR_TO_NODE,H as NativeLibraryLoadError,w as PROBED_GI_LIBDIRS,l as TARGET_OSES,T as TYPELIB_SUBDIR,J as __resetBurstStateForTests,U as colocateNativeLibrary,a as createGLibFileError,o as createNodeError,t as deferEmit,E as dyldDefaultFallbackDirs,y as encodePathForFileUrl,z as ensureMainLoop,D as giLibraryDirsForTypelibDir,N as hasProcfs,B as holdMainLoop,P as hostEnv,F as hostExecPath,u as hostOs,I as hostPid,d as hostPlatform,L 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,W as loadOptionalNativeModule,e as makeCallable,A as mapMachine,j as mapSysname,G as missingLibraryDependency,Y as nextTick,g as notImplemented,K as openNativeLibrary,S as pathToFileUrlHref,q as probeNativeLibrary,v as queueMicrotask,V as quitMainLoop,R as readProcessMemory,c as registerGlobal,C as splitPathComponents,O as splitSearchPath,M as structuredClone,k 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,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{ensureMainLoop as V,holdMainLoop as H,quitMainLoop as U}from"./main-loop.js";import{NativeLibraryLoadError as W,colocateNativeLibrary as G,loadOptionalNativeModule as K,missingLibraryDependency as q,openNativeLibrary as J,probeNativeLibrary as Y}from"./native-library.js";import{__resetBurstStateForTests as X,nextTick as Z}from"./next-tick.js";export{r as GIO_ERROR_TO_NODE,i as GLIB_FILE_ERROR_TO_NODE,W as NativeLibraryLoadError,w as PROBED_GI_LIBDIRS,l as TARGET_OSES,T as TYPELIB_SUBDIR,X as __resetBurstStateForTests,G as colocateNativeLibrary,a as createGLibFileError,o as createNodeError,A as decodeXmlEntities,t as deferEmit,E as dyldDefaultFallbackDirs,y as encodePathForFileUrl,V as ensureMainLoop,D as giLibraryDirsForTypelibDir,F as hasProcfs,H 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,K as loadOptionalNativeModule,e as makeCallable,M as mapMachine,N as mapSysname,q as missingLibraryDependency,Z as nextTick,g as notImplemented,J as openNativeLibrary,S as pathToFileUrlHref,Y as probeNativeLibrary,v as queueMicrotask,U as quitMainLoop,B as readProcessMemory,c as registerGlobal,j as scanXml,C as splitPathComponents,O as splitSearchPath,P as structuredClone,k 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,dyldDefaultFallbackDirs as O,giLibraryDirsForTypelibDir as k,splitSearchPath as A,systemGiLibraryDirs as j}from"./system-gi-dirs.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{ensureMainLoop as V,holdMainLoop as H,quitMainLoop as U}from"./main-loop.js";import{NativeLibraryLoadError as W,colocateNativeLibrary as G,loadOptionalNativeModule as K,missingLibraryDependency as q,openNativeLibrary as J,probeNativeLibrary as Y}from"./native-library.js";import{__resetBurstStateForTests as X,nextTick as Z}from"./next-tick.js";import"./core.js";import{readJSON as Q}from"./file.js";import{existsFD as $,existsSync as ee}from"./fs.js";import{gioAsync as te,inputStreamAsyncIterator as ne,readBytesAsync as re}from"./gio.js";import{getNodeModulesPath as ie,getPathSeparator as ae,getProgramDir as oe,getProgramExe as se,resolve as ce}from"./path.js";import{closeSocketService as le,releaseListenPort as ue}from"./socket-service.js";export{a as GIO_ERROR_TO_NODE,o as GLIB_FILE_ERROR_TO_NODE,W as NativeLibraryLoadError,E as PROBED_GI_LIBDIRS,d as TARGET_OSES,D as TYPELIB_SUBDIR,X as __resetBurstStateForTests,n as cli,le as closeSocketService,G as colocateNativeLibrary,s as createGLibFileError,c as createNodeError,r as deferEmit,O as dyldDefaultFallbackDirs,x as encodePathForFileUrl,V as ensureMainLoop,$ as existsFD,ee as existsSync,e as gbytesToUint8Array,ie as getNodeModulesPath,ae as getPathSeparator,oe as getProgramDir,se as getProgramExe,k as giLibraryDirsForTypelibDir,te as gioAsync,F as hasProcfs,H as holdMainLoop,I as hostEnv,L as hostExecPath,f as hostOs,R as hostPid,p as hostPlatform,z as hostPpid,i as initErrorV8Methods,ne as inputStreamAsyncIterator,m as isDarwin,h as isLinux,l as isNotFoundError,g as isTargetOs,_ as isWin32,S as isWindowsPath,C as lastPathSeparatorIndex,K as loadOptionalNativeModule,t as makeCallable,M as mapMachine,N as mapSysname,q as missingLibraryDependency,Z as nextTick,v as notImplemented,J as openNativeLibrary,w as pathToFileUrlHref,Y as probeNativeLibrary,b as queueMicrotask,U as quitMainLoop,re as readBytesAsync,Q as readJSON,B as readProcessMemory,u as registerGlobal,ue as releaseListenPort,ce as resolve,T as splitPathComponents,A as splitSearchPath,P as structuredClone,j 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,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{ensureMainLoop as U,holdMainLoop as W,quitMainLoop as G}from"./main-loop.js";import{NativeLibraryLoadError as K,colocateNativeLibrary as q,loadOptionalNativeModule as J,missingLibraryDependency as Y,openNativeLibrary as X,probeNativeLibrary as Z}from"./native-library.js";import{__resetBurstStateForTests as Q,nextTick as $}from"./next-tick.js";import"./core.js";import{readJSON as ee}from"./file.js";import{existsFD as te,existsSync as ne}from"./fs.js";import{gioAsync as re,inputStreamAsyncIterator as ie,readBytesAsync as ae}from"./gio.js";import{getNodeModulesPath as oe,getPathSeparator as se,getProgramDir as ce,getProgramExe as le,resolve as ue}from"./path.js";import{closeSocketService as de,releaseListenPort as fe}from"./socket-service.js";export{a as GIO_ERROR_TO_NODE,o as GLIB_FILE_ERROR_TO_NODE,K as NativeLibraryLoadError,E as PROBED_GI_LIBDIRS,d as TARGET_OSES,D as TYPELIB_SUBDIR,Q as __resetBurstStateForTests,n as cli,de as closeSocketService,q as colocateNativeLibrary,s as createGLibFileError,c as createNodeError,M as decodeXmlEntities,r as deferEmit,O as dyldDefaultFallbackDirs,x as encodePathForFileUrl,U as ensureMainLoop,te as existsFD,ne as existsSync,e as gbytesToUint8Array,oe as getNodeModulesPath,se as getPathSeparator,ce as getProgramDir,le as getProgramExe,k as giLibraryDirsForTypelibDir,re as gioAsync,L as hasProcfs,W as holdMainLoop,R as hostEnv,z as hostExecPath,f as hostOs,B as hostPid,p as hostPlatform,V as hostPpid,i as initErrorV8Methods,ie as inputStreamAsyncIterator,m as isDarwin,h as isLinux,l as isNotFoundError,g as isTargetOs,_ as isWin32,S as isWindowsPath,C as lastPathSeparatorIndex,J as loadOptionalNativeModule,t as makeCallable,P as mapMachine,F as mapSysname,Y as missingLibraryDependency,$ as nextTick,v as notImplemented,X as openNativeLibrary,w as pathToFileUrlHref,Z as probeNativeLibrary,b as queueMicrotask,G as quitMainLoop,ae as readBytesAsync,ee as readJSON,H as readProcessMemory,u as registerGlobal,fe as releaseListenPort,ue as resolve,N as scanXml,T as splitPathComponents,A as splitSearchPath,I as structuredClone,j as systemGiLibraryDirs,y as warnNotImplemented};
@@ -0,0 +1 @@
1
+ import"./_virtual/_rolldown/runtime.js";const e={amp:`&`,lt:`<`,gt:`>`,quot:`"`,apos:`'`};function decodeXmlEntities(t){return t.includes(`&`)?t.replace(/&(#[Xx][0-9A-Fa-f]+|#[0-9]+|[A-Za-z][A-Za-z0-9]*);/g,(t,n)=>{if(n.charAt(0)!==`#`)return e[n]??t;let r=n.charAt(1)===`x`||n.charAt(1)===`X`,i=Number.parseInt(r?n.slice(2):n.slice(1),r?16:10);return!Number.isFinite(i)||i<1||i>1114111||i>=55296&&i<=57343?t:String.fromCodePoint(i)}):t}function findTagEnd(e,t){let n=``;for(let r=t+1;r<e.length;r++){let t=e.charAt(r);if(n)t===n&&(n=``);else if(t===`"`||t===`'`)n=t;else if(t===`>`)return r}return-1}const t=/([^\s=/<>]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/g;function parseAttributes(e){let n={};t.lastIndex=0;let r=t.exec(e);for(;r!==null;)r[1]in n||(n[r[1]]=decodeXmlEntities(r[2]??r[3]??``)),r=t.exec(e);return n}function scanXml(e){let t=[],pushText=e=>{t.push({kind:`text`,text:decodeXmlEntities(e)})},n=0;for(;n<e.length;){let r=e.indexOf(`<`,n);if(r<0){pushText(e.slice(n));break}if(r>n&&pushText(e.slice(n,r)),e.startsWith(`<!--`,r)){let t=e.indexOf(`-->`,r+4);n=t<0?e.length:t+3;continue}if(e.startsWith(`<![CDATA[`,r)){let i=e.indexOf(`]]>`,r+9);t.push({kind:`text`,text:e.slice(r+9,i<0?e.length:i)}),n=i<0?e.length:i+3;continue}if(e.startsWith(`<?`,r)){let t=e.indexOf(`?>`,r+2);n=t<0?e.length:t+2;continue}if(e.startsWith(`<!`,r)){let t=e.indexOf(`>`,r+2);n=t<0?e.length:t+1;continue}let i=findTagEnd(e,r);if(i<0){pushText(e.slice(r));break}let a=e.slice(r+1,i);if(n=i+1,a.charAt(0)===`/`){let e=a.slice(1).trim();e!==``&&t.push({kind:`close`,name:e});continue}let o=a,s=!1;o.endsWith(`/`)&&(s=!0,o=o.slice(0,-1));let c=/^([^\s/<>]+)/.exec(o);if(c===null)continue;let l=c[1];t.push({kind:`open`,name:l,attributes:parseAttributes(o.slice(l.length)),selfClosing:s})}return t}export{decodeXmlEntities,scanXml};
@@ -8,6 +8,7 @@ export * from './message.js';
8
8
  export * from './microtask.js';
9
9
  export * from './path-shape.js';
10
10
  export * from './system-gi-dirs.js';
11
+ export * from './xml-scan.js';
11
12
  export * from './platform-names.js';
12
13
  export * from './structured-clone.js';
13
14
  export * from './host-process.js';
@@ -0,0 +1,38 @@
1
+ /** An opening (or self-closing) element. */
2
+ export interface XmlOpenTag {
3
+ kind: 'open';
4
+ /** Element name exactly as written, prefix included (`xml:lang` is an attribute, not this). */
5
+ name: string;
6
+ /** Attribute values with entities already decoded. */
7
+ attributes: Record<string, string>;
8
+ /** `true` for `<foo/>`, which emits no matching {@link XmlCloseTag}. */
9
+ selfClosing: boolean;
10
+ }
11
+ /** A closing element. */
12
+ export interface XmlCloseTag {
13
+ kind: 'close';
14
+ name: string;
15
+ }
16
+ /** Character data between elements, with entities already decoded. */
17
+ export interface XmlText {
18
+ kind: 'text';
19
+ text: string;
20
+ }
21
+ export type XmlToken = XmlOpenTag | XmlCloseTag | XmlText;
22
+ /**
23
+ * Resolve the entity references a metainfo file may contain.
24
+ *
25
+ * An UNKNOWN reference is returned verbatim rather than dropped. A metainfo file is
26
+ * hand-written and `&` is the character most often left unescaped in one; turning
27
+ * `Tom & Jerry` into `Tom ` would silently truncate a developer name, which is exactly
28
+ * the kind of Windows-only difference this module exists to prevent.
29
+ */
30
+ export declare function decodeXmlEntities(text: string): string;
31
+ /**
32
+ * Tokenise an XML document.
33
+ *
34
+ * Returns an array rather than a generator on purpose: a metainfo file is a few kilobytes,
35
+ * three bundler targets (`gjs`, `node`, library) have to agree on the output, and an array
36
+ * is the form that needs no iteration-protocol support from any of them.
37
+ */
38
+ export declare function scanXml(xml: string): XmlToken[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/utils",
3
- "version": "0.64.1-next.243",
3
+ "version": "0.64.1-next.244",
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.1-next.243",
52
+ "@gjsify/cli": "0.64.1-next.244",
53
53
  "typescript": "^6.0.3"
54
54
  },
55
55
  "dependencies": {
@@ -110,5 +110,5 @@
110
110
  "win32": "supported"
111
111
  }
112
112
  },
113
- "gitHead": "f88c7b1074d454e211094963a9f4dc7d0982bf32"
113
+ "gitHead": "9a6ca179c1a74477f23791c5b8f6d5a7bffaee61"
114
114
  }