@componentor/quickjs-wasmfs-release-sync 0.31.7 → 0.31.9

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.
@@ -9,9 +9,11 @@ function(moduleArg = {}) {
9
9
  var aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a};function ba(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");}var ca=ba(this);
10
10
  function d(a,b){if(b)a:{var c=ca;a=a.split(".");for(var e=0;e<a.length-1;e++){var f=a[e];if(!(f in c))break a;c=c[f]}a=a[a.length-1];e=c[a];b=b(e);b!=e&&null!=b&&aa(c,a,{configurable:!0,writable:!0,value:b})}}function da(a){a=Math.trunc(a)||0;0>a&&(a+=this.length);if(!(0>a||a>=this.length))return this[a]}d("Array.prototype.at",function(a){return a?a:da});function h(a){return a?a:da}d("Int8Array.prototype.at",h);d("Uint8Array.prototype.at",h);d("Uint8ClampedArray.prototype.at",h);
11
11
  d("Int16Array.prototype.at",h);d("Uint16Array.prototype.at",h);d("Int32Array.prototype.at",h);d("Uint32Array.prototype.at",h);d("Float32Array.prototype.at",h);d("Float64Array.prototype.at",h);d("String.prototype.at",function(a){return a?a:da});var m=moduleArg,ea,fa,ha=new Promise((a,b)=>{ea=a;fa=b}),ia="object"==typeof window,ja="function"==typeof importScripts;function ka(a){a={log:a||function(){}};for(const b of ka.vc)b(a);return m.quickJSEmscriptenExtensions=a}ka.vc=[];
12
- m.quickjsEmscriptenInit=ka;ka.vc.push(a=>{a.getWasmMemory=function(){return p}});m.preRun=m.preRun||[];
13
- m.preRun.push(async function(){if("undefined"!==typeof navigator&&navigator.storage&&navigator.storage.getDirectory)if("function"!==typeof m.wasmfsOPFSGetOrCreateDir)console.log("[WasmFS] wasmfsOPFSGetOrCreateDir not available");else try{var a=await navigator.storage.getDirectory(),b=[],c;for await(c of a.entries()){var e=c[0],f=c[1];if("directory"===f.kind){a="/"+e;try{try{m.FS.stat(a);console.log("[WasmFS preRun] Skipping existing:",a);continue}catch(k){}var g=await m.wasmfsOPFSGetOrCreateDir(f,
14
- a);0===g||void 0===g?(b.push(a),console.log("[WasmFS preRun] Mounted OPFS",e,"at",a)):console.warn("[WasmFS preRun] Failed to mount",e,"error code:",g)}catch(k){console.warn("[WasmFS preRun] Error mounting",e,":",k.message)}}}0<b.length&&(console.log("[WasmFS preRun] Successfully mounted:",b),m._opfsMounted=!0,m._opfsMountedPaths=b)}catch(k){console.error("[WasmFS preRun] OPFS initialization failed:",k)}else console.log("[WasmFS] OPFS not available (not in browser or no storage API)")});
12
+ m.quickjsEmscriptenInit=ka;ka.vc.push(a=>{a.getWasmMemory=function(){return p}});
13
+ "undefined"!==typeof navigator&&navigator.storage&&navigator.storage.getDirectory?(m.monitorRunDependencies=function(a){console.log("[WasmFS] Run dependencies remaining:",a)},m._opfsPending=!0,async function(){try{var a=await navigator.storage.getDirectory(),b=[],c;for await(c of a.entries()){var e=c[0],f=c[1];"directory"===f.kind&&b.push({name:e,handle:f})}console.log("[WasmFS] Found OPFS directories:",b.map(function(g){return g.name}));m._opfsDirsToMount=b}catch(g){console.error("[WasmFS] Failed to enumerate OPFS:",
14
+ g),m._opfsDirsToMount=[]}}(),m.preRun=m.preRun||[],m.preRun.push(function(){if("function"!==typeof m.wasmfsOPFSGetOrCreateDir)console.log("[WasmFS preRun] wasmfsOPFSGetOrCreateDir not available");else{var a=m._opfsDirsToMount||[];if(0===a.length)console.log("[WasmFS preRun] No OPFS directories to mount");else{var b=["dev","tmp","proc","sys"];m.addRunDependency("opfs-mount");for(var c=[],e=0;e<a.length;e++)(function(f){if(-1!==b.indexOf(f.name))console.log("[WasmFS preRun] Skipping system dir:",f.name);
15
+ else{var g="/"+f.name;console.log("[WasmFS preRun] Attempting to mount:",f.name,"at",g);c.push(m.wasmfsOPFSGetOrCreateDir(f.handle,g).then(function(k){return{name:f.name,path:g,result:k}}))}})(a[e]);Promise.all(c).then(function(f){for(var g=[],k=0;k<f.length;k++){var l=f[k];0===l.result||void 0===l.result?(g.push(l.path),console.log("[WasmFS preRun] Mounted OPFS",l.name,"at",l.path)):console.warn("[WasmFS preRun] Failed to mount",l.name,"error code:",l.result)}0<g.length&&(m._opfsMounted=!0,m._opfsMountedPaths=
16
+ g,console.log("[WasmFS preRun] Successfully mounted:",g))}).catch(function(f){console.error("[WasmFS preRun] Mount error:",f)}).finally(function(){m.removeRunDependency("opfs-mount")})}}})):console.log("[WasmFS] OPFS not available (not in browser or no storage API)");
15
17
  m.mountOPFS=async function(a="/opfs",b=null){async function c(f,g){if("function"===typeof m.wasmfsOPFSGetOrCreateDir)try{return await m.wasmfsOPFSGetOrCreateDir(f,g),!0}catch(k){try{const l=m.FS.stat(g);if(l&&"undefined"!==typeof l.mode)return console.log("[WasmFS] Mount point already exists at",g),!0}catch(l){}throw k;}else if(m.FS&&m.FS.filesystems&&m.FS.filesystems.Ac){try{m.mkdir(g)}catch(k){if("EEXIST"!==k.code&&20!==k.qc)throw k;}m.FS.mount(m.FS.filesystems.Ac,{root:f},g);return!0}return!1}
16
18
  if(!navigator.storage||!navigator.storage.getDirectory)throw Error("OPFS is not supported in this browser");var e=await navigator.storage.getDirectory();if("/"===a&&(null===b||"/"===b||""===b)){a=[];for await(const [f,g]of e.entries())if("directory"===g.kind){b="/"+f;try{try{m.FS.stat(b);console.log("[WasmFS] Skipping existing directory:",b);continue}catch(k){}await c(g,b);a.push(b);console.log("[WasmFS] Mounted OPFS",f,"at",b)}catch(k){console.warn("[WasmFS] Failed to mount",f,":",k.message)}}console.log("[WasmFS] OPFS mounted directories:",
17
19
  a);return 0<a.length?"/":null}if(b&&"/"!==b&&""!==b){const f=b.split("/").filter(Boolean);for(const g of f)e=await e.getDirectoryHandle(g,{create:!0})}if(!await c(e,a))throw Error("WasmFS OPFS backend not available. Ensure -lopfs.js is in build flags.");console.log("[WasmFS] OPFS mounted at",a,b?"(OPFS path: "+b+")":"");return a};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@componentor/quickjs-wasmfs-release-sync",
3
3
  "license": "MIT",
4
- "version": "0.31.7",
4
+ "version": "0.31.9",
5
5
  "description": "QuickJS variant with WasmFS and OPFS support for native filesystem access in browsers without JS boundary crossing.",
6
6
  "sideEffects": false,
7
7
  "repository": {
@@ -43,10 +43,10 @@
43
43
  }
44
44
  },
45
45
  "dependencies": {
46
- "@componentor/quickjs-ffi-types": "0.31.7"
46
+ "@componentor/quickjs-ffi-types": "0.31.9"
47
47
  },
48
48
  "devDependencies": {
49
- "@jitl/tsconfig": "0.31.7"
49
+ "@jitl/tsconfig": "0.31.9"
50
50
  },
51
51
  "scripts": {
52
52
  "build": "pnpm run build:c && pnpm run build:ts",