@gjsify/utils 0.4.31 → 0.4.33

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/cli.js CHANGED
@@ -1 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";import e from"@girs/glib-2.0";const t=imports.byteArray,cli=n=>{let[r,i,a,o]=e.spawn_command_line_sync(n);if(a.byteLength)throw Error(t.toString(a));return t.toString(i)};export{cli};
1
+ import"./_virtual/_rolldown/runtime.js";import e from"@girs/glib-2.0";const cli=t=>{let[n,r,i,a]=e.spawn_command_line_sync(t);if(i.byteLength)throw Error(imports.byteArray.toString(i));return imports.byteArray.toString(r)};export{cli};
package/lib/esm/file.js CHANGED
@@ -1 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";import e from"@girs/glib-2.0";const t=imports.byteArray,readJSON=n=>{let[r,i]=e.file_get_contents(n);if(r)return JSON.parse(t.toString(i));throw Error(`Error on require "${n}"`)};export{readJSON};
1
+ import"./_virtual/_rolldown/runtime.js";import e from"@girs/glib-2.0";const readJSON=t=>{let[n,r]=e.file_get_contents(t);if(n)return JSON.parse(imports.byteArray.toString(r));throw Error(`Error on require "${t}"`)};export{readJSON};
package/lib/esm/gio.js CHANGED
@@ -1 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";import e from"@girs/glib-2.0";import t from"@girs/gio-2.0";const n=imports.byteArray;function gioAsync(e,t,n,...r){return new Promise((i,a)=>{e[t](...r,(t,r)=>{try{i(e[n](r))}catch(e){a(e)}})})}async function readBytesAsync(r,i=4096,a=e.PRIORITY_DEFAULT,o=null){return new Promise((e,s)=>{r.read_bytes_async(i,a,o,(i,a)=>{try{let t=r.read_bytes_finish(a);return t.get_size()===0?e(null):e(n.fromGBytes(t))}catch(n){let r=n;if(typeof r.matches==`function`&&(r.matches(t.IOErrorEnum,t.IOErrorEnum.PARTIAL_INPUT)||r.matches(t.IOErrorEnum,t.IOErrorEnum.CONNECTION_CLOSED)||r.matches(t.IOErrorEnum,t.IOErrorEnum.BROKEN_PIPE)||r.matches(t.IOErrorEnum,t.IOErrorEnum.CLOSED)))return e(null);s(n)}})})}async function*inputStreamAsyncIterator(t,n=4096,r=e.PRIORITY_DEFAULT,i=null){let a;for(;(a=await readBytesAsync(t,n,r,i))!==null;)yield a}export{gioAsync,inputStreamAsyncIterator,readBytesAsync};
1
+ import"./_virtual/_rolldown/runtime.js";import e from"@girs/glib-2.0";import t from"@girs/gio-2.0";function gioAsync(e,t,n,...r){return new Promise((i,a)=>{e[t](...r,(t,r)=>{try{i(e[n](r))}catch(e){a(e)}})})}async function readBytesAsync(n,r=4096,i=e.PRIORITY_DEFAULT,a=null){return new Promise((e,o)=>{n.read_bytes_async(r,i,a,(r,i)=>{try{let t=n.read_bytes_finish(i);return t.get_size()===0?e(null):e(imports.byteArray.fromGBytes(t))}catch(n){let r=n;if(typeof r.matches==`function`&&(r.matches(t.IOErrorEnum,t.IOErrorEnum.PARTIAL_INPUT)||r.matches(t.IOErrorEnum,t.IOErrorEnum.CONNECTION_CLOSED)||r.matches(t.IOErrorEnum,t.IOErrorEnum.BROKEN_PIPE)||r.matches(t.IOErrorEnum,t.IOErrorEnum.CLOSED)))return e(null);o(n)}})})}async function*inputStreamAsyncIterator(t,n=4096,r=e.PRIORITY_DEFAULT,i=null){let a;for(;(a=await readBytesAsync(t,n,r,i))!==null;)yield a}export{gioAsync,inputStreamAsyncIterator,readBytesAsync};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/utils",
3
- "version": "0.4.31",
3
+ "version": "0.4.33",
4
4
  "description": "Utils module for gjsify",
5
5
  "module": "lib/esm/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -35,7 +35,7 @@
35
35
  "fs"
36
36
  ],
37
37
  "devDependencies": {
38
- "@gjsify/cli": "^0.4.31",
38
+ "@gjsify/cli": "^0.4.33",
39
39
  "typescript": "^6.0.3"
40
40
  },
41
41
  "dependencies": {