@gjsify/webassembly 0.3.20 → 0.4.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.
@@ -0,0 +1 @@
1
+ var e=Object.defineProperty,__name=(t,n)=>e(t,`name`,{value:n,configurable:!0});export{__name};
package/lib/esm/index.js CHANGED
@@ -1 +1 @@
1
- const e=globalThis.WebAssembly;if(e===void 0)throw Error(`@gjsify/webassembly: globalThis.WebAssembly is not defined; nothing to polyfill.`);const t=e.Module,n=e.Instance;function r(e){try{return Promise.resolve(new t(e))}catch(e){return Promise.reject(e)}}function i(e){try{return new t(e),!0}catch{return!1}}function a(e,r){try{if(e instanceof t)return Promise.resolve(new n(e,r));let i=new t(e),a=new n(i,r);return Promise.resolve({module:i,instance:a})}catch(e){return Promise.reject(e)}}async function o(e){return(await e).arrayBuffer()}async function s(e){return r(await o(e))}async function c(e,t){return a(await o(e),t)}var l={compile:r,compileStreaming:s,instantiate:a,instantiateStreaming:c,validate:i};export{r as compile,s as compileStreaming,l as default,a as instantiate,c as instantiateStreaming,i as validate};
1
+ import"./_virtual/_rolldown/runtime.js";const e=globalThis.WebAssembly;if(e===void 0)throw Error(`@gjsify/webassembly: globalThis.WebAssembly is not defined; nothing to polyfill.`);const t=e.Module,n=e.Instance;function compile(e){try{return Promise.resolve(new t(e))}catch(e){return Promise.reject(e)}}function validate(e){try{return new t(e),!0}catch{return!1}}function instantiate(e,r){try{if(e instanceof t)return Promise.resolve(new n(e,r));let i=new t(e),a=new n(i,r);return Promise.resolve({module:i,instance:a})}catch(e){return Promise.reject(e)}}async function bufferFromSource(e){return(await e).arrayBuffer()}async function compileStreaming(e){return compile(await bufferFromSource(e))}async function instantiateStreaming(e,t){return instantiate(await bufferFromSource(e),t)}var r={compile,compileStreaming,instantiate,instantiateStreaming,validate};export{compile,compileStreaming,r as default,instantiate,instantiateStreaming,validate};
@@ -1 +1 @@
1
- import{compile as e,compileStreaming as t,instantiate as n,instantiateStreaming as r,validate as i}from"../index.js";const a=globalThis.WebAssembly;if(a!==void 0){let o=(e,t)=>{try{Object.defineProperty(a,e,{value:t,writable:!0,configurable:!0,enumerable:!0})}catch{}};o(`compile`,e),o(`compileStreaming`,t),o(`instantiate`,n),o(`instantiateStreaming`,r),o(`validate`,i)}
1
+ import{compile as e,compileStreaming as t,instantiate as n,instantiateStreaming as r,validate as i}from"../index.js";const a=globalThis.WebAssembly;if(a!==void 0){let replace=(e,t)=>{try{Object.defineProperty(a,e,{value:t,writable:!0,configurable:!0,enumerable:!0})}catch{}};replace(`compile`,e),replace(`compileStreaming`,t),replace(`instantiate`,n),replace(`instantiateStreaming`,r),replace(`validate`,i)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/webassembly",
3
- "version": "0.3.20",
3
+ "version": "0.4.0",
4
4
  "description": "WebAssembly Promise-API polyfill for GJS — wraps the synchronous Module/Instance constructors that work in SpiderMonkey 128+.",
5
5
  "type": "module",
6
6
  "module": "lib/esm/index.js",
@@ -45,8 +45,8 @@
45
45
  "polyfill"
46
46
  ],
47
47
  "devDependencies": {
48
- "@gjsify/cli": "^0.3.20",
49
- "@gjsify/unit": "^0.3.20",
48
+ "@gjsify/cli": "^0.4.0",
49
+ "@gjsify/unit": "^0.4.0",
50
50
  "@types/node": "^25.6.2",
51
51
  "typescript": "^6.0.3"
52
52
  }