@devvit/runtime-lite 0.11.3-next-2024-10-31-36e124f73.0 → 0.11.3-next-2024-11-11-9c32efd17.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -60,5 +60,5 @@ ${r}${Array.isArray(A)?"]":"}"}`,z}var De=class{constructor(){this.logs=[]}debug
60
60
  };`,"globalThis.devvit = { config: { assets: config.assets } };");try{F(this,re,e.unwrapResult(e.evalCode(`
61
61
  if (!module.exports?.default) throw Error('bundle missing default export')
62
62
  new module.exports.default(config);
63
- `)))}catch(r){throw D(this,Ae,oe).call(this,r),r}}async call(i,e,r){return T.withScopeAsync(async a=>{let g=a.manage(c(this,X).newContext()),d=c(this,re);if(F(this,$,!1),c(this,G).logs=[],!d)return{error:new Error("No actor loaded"),success:!1,value:void 0};let C=g.getProp(d,i),I=c(this,Ie).call(this,g,e),B={...c(this,ue),...r,...c(this,ce)},z=c(this,Ie).call(this,g,B),E=g.callFunction(C,d,I,z),f;try{f=g.unwrapResult(E)}catch(w){return D(this,Ae,oe).call(this,w),{error:w,success:!1,value:void 0}}let x;try{[x]=await Promise.all([g.resolvePromise(f),g.runtime.executePendingJobs()])}catch(w){return D(this,Ae,oe).call(this,w),{error:w,success:!1,value:void 0}}let y;try{y=g.unwrapResult(x)}catch(w){return D(this,Ae,oe).call(this,w),{error:w,success:!1,value:void 0}}let Z=g.dump(y);return c(this,$)?(c(this,G).logs=[],{error:gA(i),success:!1,value:void 0}):{error:void 0,success:!0,value:Z}})}callBinary(){throw new Error("binary calls are unsupported")}onPluginResponse(i,e){let r=c(this,ae)[i];if(r&&r.alive)if(e.success){let a=c(this,k).newString(JSON.stringify(e.value));r.resolve(a),c(this,k).runtime.executePendingJobs(),a.dispose()}else{let a=c(this,k).newError(e.error.message);r.reject(a),c(this,k).runtime.executePendingJobs(),a.dispose()}r.dispose(),delete c(this,ae)[i]}quit(){var i;_.log("[sandboxed runtime] quitting"),(i=c(this,re))==null||i.dispose(),c(this,ne).dispose(),c(this,k).dispose(),c(this,X).dispose(),globalThis.close()}};X=new WeakMap,k=new WeakMap,ne=new WeakMap,re=new WeakMap,$=new WeakMap,G=new WeakMap,ee=new WeakMap,Se=new WeakMap,ae=new WeakMap,ue=new WeakMap,ce=new WeakMap,Ie=new WeakMap,Ce=new WeakSet,Le=function(A,...i){for(let e of i)A.unwrapResult(A.evalCode(e,void 0,{type:"global"})).dispose()},j=new WeakSet,P=function(...A){let i=c(this,k);for(let e of A)i.unwrapResult(i.evalCode(e)).dispose()},Ne=new WeakMap,Me=new WeakMap,Re=new WeakMap,Fe=new WeakMap,Ge=new WeakMap,qe=new WeakMap,Ae=new WeakSet,oe=function(A){var i;QA(A)||((i=c(this,G)).logs??(i.logs=[]),c(this,G).logs.push({method:"error",args:[K(A)]}))};function Qi(A){return A.hostname.split(".")[1]??A.hostname}function Ei(A){var i,e;return`${Qi(A)}@${(i=A.actor)==null?void 0:i.version} by ${(e=A.actor)==null?void 0:e.owner}`}function mi(A,i){Object.assign(A,{CircuitBreakerResponse:pe,log:vi,onmessage:zi,onunhandledrejection:hi,runtime:i})}function fi(A){A.postMessage([q.READY,{start:performance.timeOrigin,end:performance.timeOrigin+performance.now()}])}function vi(...A){this.debugLogging&&console.debug.apply(null,A)}async function zi(A){switch(A.data[0]){case J.ENABLE_APP_LOGGING:this.runtime.enableAppLogging(),this.log("<App logs enabled>");break;case J.ENABLE_DEBUG_LOGGING:this.debugLogging=!0,this.log("<Debug logs enabled>");break;case J.ENABLE_PLUGINS:{let[,i]=A.data;this.log("<Enabling local plugins:>");for(let e of i)this.log(` ${e}`);this.runtime.setPluginList(i),this.postMessage([q.PLUGINS_CONFIGURED]);break}case J.LOAD_BUNDLE:{let[,i]=A.data;this.log(`Loading bundle for app ${Ei(i)}`);try{this.runtime.loadBundle(i),this.postMessage([q.BUNDLE_LOADED,this.runtime.getCallState().logs])}catch(e){this.postMessage([q.BUNDLE_LOAD_FAILED,void 0,e,this.runtime.getCallState().logs])}break}case J.CALL:{let[,i,e,r,a,g]=A.data;this.log(`${i} \u2192 [Call] ${e}`);let d=g?await this.runtime.callBinary(e,r,a):await this.runtime.call(e,r,a);d.success?this.postMessage([q.RETURN,i,d.value,this.runtime.getCallState().logs]):QA(d.error)?this.postMessage([q.CIRCUIT_BREAKER,i,d.value,d.error.cause]):this.postMessage([q.ERROR,i,d.error,this.runtime.getCallState().logs]);break}case J.PLUGIN_RESPONSE:{let[,i,e]=A.data;this.runtime.onPluginResponse(i,e);break}case J.QUIT:this.log("<Shutdown>"),this.runtime.quit();break}}function hi(A){var i;let e;A.reason instanceof Error?e=ki(A.reason):A.reason!=null&&(e=String(A.reason));let r=[...((i=this.runtime)==null?void 0:i.getCallState().logs)??[]];r.push({method:"error",args:[K(A.reason)]}),this.postMessage([q.UNHANDLED_REJECTION,void 0,e,r])}function ki(A){return{cause:A.cause==null?void 0:String(A.cause),columnNumber:A.columnNumber,fileName:A.fileName,lineNumber:A.lineNumber,message:A.message,name:A.name,...A.stack&&{stack:A.stack}}}async function pi(){let A=globalThis.self??globalThis,i=new xe;mi(A,i),await i.init(),fi(A)}pi().catch(console.error);var bi=Object.freeze(Object.defineProperty({__proto__:null,QuickJSModuleCallbacks:bA,QuickJSWASMModule:ai,applyBaseRuntimeOptions:yA,applyModuleEvalRuntimeOptions:wA},Symbol.toStringTag,{value:"Module"}));
63
+ `)))}catch(r){throw D(this,Ae,oe).call(this,r),r}}async call(i,e,r){return T.withScopeAsync(async a=>{let g=a.manage(c(this,X).newContext()),d=c(this,re);if(F(this,$,!1),c(this,G).logs=[],!d)return{error:new Error("No actor loaded"),success:!1,value:void 0};let C=g.getProp(d,i),I=c(this,Ie).call(this,g,e),B={...c(this,ue),...r,...c(this,ce)},z=c(this,Ie).call(this,g,B),E=g.callFunction(C,d,I,z),f;try{f=g.unwrapResult(E)}catch(w){return D(this,Ae,oe).call(this,w),{error:w,success:!1,value:void 0}}let x;try{[x]=await Promise.all([g.resolvePromise(f),g.runtime.executePendingJobs()])}catch(w){return D(this,Ae,oe).call(this,w),{error:w,success:!1,value:void 0}}let y;try{y=g.unwrapResult(x)}catch(w){return D(this,Ae,oe).call(this,w),{error:w,success:!1,value:void 0}}let Z=g.dump(y);return c(this,$)?(c(this,G).logs=[],{error:gA(i),success:!1,value:void 0}):{error:void 0,success:!0,value:Z}})}callBinary(){throw new Error("binary calls are unsupported")}onPluginResponse(i,e){let r=c(this,ae)[i];if(r&&r.alive)if(e.success){let a=c(this,k).newString(JSON.stringify(e.value));r.resolve(a),c(this,k).runtime.executePendingJobs(),a.dispose()}else{let a=c(this,k).newError(e.error.message);r.reject(a),c(this,k).runtime.executePendingJobs(),a.dispose()}r.dispose(),delete c(this,ae)[i]}quit(){var i;_.log("[sandboxed runtime] quitting"),(i=c(this,re))==null||i.dispose(),c(this,ne).dispose(),c(this,k).dispose(),c(this,X).dispose(),globalThis.close()}};X=new WeakMap,k=new WeakMap,ne=new WeakMap,re=new WeakMap,$=new WeakMap,G=new WeakMap,ee=new WeakMap,Se=new WeakMap,ae=new WeakMap,ue=new WeakMap,ce=new WeakMap,Ie=new WeakMap,Ce=new WeakSet,Le=function(A,...i){for(let e of i)A.unwrapResult(A.evalCode(e,void 0,{type:"global"})).dispose()},j=new WeakSet,P=function(...A){let i=c(this,k);for(let e of A)i.unwrapResult(i.evalCode(e)).dispose()},Ne=new WeakMap,Me=new WeakMap,Re=new WeakMap,Fe=new WeakMap,Ge=new WeakMap,qe=new WeakMap,Ae=new WeakSet,oe=function(A){var i;QA(A)||((i=c(this,G)).logs??(i.logs=[]),c(this,G).logs.push({method:"error",args:[K(A)]}))};function Qi(A){return A.hostname.split(".")[1]??A.hostname}function Ei(A){var i,e;return`${Qi(A)}@${(i=A.actor)==null?void 0:i.version} by ${(e=A.actor)==null?void 0:e.owner}`}function mi(A,i){Object.assign(A,{CircuitBreakerResponse:pe,log:vi,onmessage:zi,onunhandledrejection:hi,runtime:i})}function fi(A){A.postMessage([q.READY,{start:performance.timeOrigin,end:performance.timeOrigin+performance.now()}])}function vi(...A){this.debugLogging&&console.debug.apply(null,A)}async function zi(A){switch(A.data[0]){case J.ENABLE_APP_LOGGING:this.runtime.enableAppLogging(),this.log("<App logs enabled>");break;case J.ENABLE_DEBUG_LOGGING:this.debugLogging=!0,this.log("<Debug logs enabled>");break;case J.ENABLE_PLUGINS:{let[,i]=A.data;this.log("<Enabling local plugins:>");for(let e of i)this.log(` ${e}`);this.runtime.setPluginList(i),this.postMessage([q.PLUGINS_CONFIGURED]);break}case J.LOAD_BUNDLE:{let[,i]=A.data;this.log(`Loading bundle for app ${Ei(i)}`);try{let e=performance.now();this.runtime.loadBundle(i);let r=performance.now();this.postMessage([q.BUNDLE_LOADED,this.runtime.getCallState().logs,{start:e,end:r}])}catch(e){this.postMessage([q.BUNDLE_LOAD_FAILED,void 0,e,this.runtime.getCallState().logs])}break}case J.CALL:{let[,i,e,r,a,g]=A.data;this.log(`${i} \u2192 [Call] ${e}`);let d=g?await this.runtime.callBinary(e,r,a):await this.runtime.call(e,r,a);d.success?this.postMessage([q.RETURN,i,d.value,this.runtime.getCallState().logs]):QA(d.error)?this.postMessage([q.CIRCUIT_BREAKER,i,d.value,d.error.cause]):this.postMessage([q.ERROR,i,d.error,this.runtime.getCallState().logs]);break}case J.PLUGIN_RESPONSE:{let[,i,e]=A.data;this.runtime.onPluginResponse(i,e);break}case J.QUIT:this.log("<Shutdown>"),this.runtime.quit();break}}function hi(A){var i;let e;A.reason instanceof Error?e=ki(A.reason):A.reason!=null&&(e=String(A.reason));let r=[...((i=this.runtime)==null?void 0:i.getCallState().logs)??[]];r.push({method:"error",args:[K(A.reason)]}),this.postMessage([q.UNHANDLED_REJECTION,void 0,e,r])}function ki(A){return{cause:A.cause==null?void 0:String(A.cause),columnNumber:A.columnNumber,fileName:A.fileName,lineNumber:A.lineNumber,message:A.message,name:A.name,...A.stack&&{stack:A.stack}}}async function pi(){let A=globalThis.self??globalThis,i=new xe;mi(A,i),await i.init(),fi(A)}pi().catch(console.error);var bi=Object.freeze(Object.defineProperty({__proto__:null,QuickJSModuleCallbacks:bA,QuickJSWASMModule:ai,applyBaseRuntimeOptions:yA,applyModuleEvalRuntimeOptions:wA},Symbol.toStringTag,{value:"Module"}));
64
64
  //# sourceMappingURL=browser-lite.worker.js.map