@workerdeck/web 0.6.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.
- package/LICENSE +21 -0
- package/README.md +59 -0
- package/dist/assets/emscripten-module.browser-5SUE27GY-ntU7dq9B.js +1 -0
- package/dist/assets/ffi-CdNMd84O.js +1 -0
- package/dist/assets/highlighted-body-OFNGDK62-3ziW0qKZ.js +1 -0
- package/dist/assets/index-B-6d1dTe.css +1 -0
- package/dist/assets/index-CkFmqlop.js +22 -0
- package/dist/assets/index-Cw8epeIo.js +1 -0
- package/dist/assets/index-d8zBDtNE.js +2 -0
- package/dist/assets/index-p6gzNhpM.js +481 -0
- package/dist/assets/inter-cyrillic-400-normal-obahsSVq.woff2 +0 -0
- package/dist/assets/inter-cyrillic-500-normal-BasfLYem.woff2 +0 -0
- package/dist/assets/inter-cyrillic-600-normal-CWCymEST.woff2 +0 -0
- package/dist/assets/inter-cyrillic-700-normal-CjBOestx.woff2 +0 -0
- package/dist/assets/inter-cyrillic-ext-400-normal-BQZuk6qB.woff2 +0 -0
- package/dist/assets/inter-cyrillic-ext-500-normal-B0yAr1jD.woff2 +0 -0
- package/dist/assets/inter-cyrillic-ext-600-normal-Dfes3d0z.woff2 +0 -0
- package/dist/assets/inter-cyrillic-ext-700-normal-BjwYoWNd.woff2 +0 -0
- package/dist/assets/inter-greek-400-normal-B4URO6DV.woff2 +0 -0
- package/dist/assets/inter-greek-500-normal-BIZE56-Y.woff2 +0 -0
- package/dist/assets/inter-greek-600-normal-plRanbMR.woff2 +0 -0
- package/dist/assets/inter-greek-700-normal-C3JjAnD8.woff2 +0 -0
- package/dist/assets/inter-greek-ext-400-normal-DGGRlc-M.woff2 +0 -0
- package/dist/assets/inter-greek-ext-500-normal-C4iEst2y.woff2 +0 -0
- package/dist/assets/inter-greek-ext-600-normal-DRtmH8MT.woff2 +0 -0
- package/dist/assets/inter-greek-ext-700-normal-qfdV9bQt.woff2 +0 -0
- package/dist/assets/inter-latin-400-normal-C38fXH4l.woff2 +0 -0
- package/dist/assets/inter-latin-500-normal-Cerq10X2.woff2 +0 -0
- package/dist/assets/inter-latin-600-normal-LgqL8muc.woff2 +0 -0
- package/dist/assets/inter-latin-700-normal-Yt3aPRUw.woff2 +0 -0
- package/dist/assets/inter-latin-ext-400-normal-C1nco2VV.woff2 +0 -0
- package/dist/assets/inter-latin-ext-500-normal-CV4jyFjo.woff2 +0 -0
- package/dist/assets/inter-latin-ext-600-normal-D2bJ5OIk.woff2 +0 -0
- package/dist/assets/inter-latin-ext-700-normal-Ca8adRJv.woff2 +0 -0
- package/dist/assets/inter-vietnamese-400-normal-DMkecbls.woff2 +0 -0
- package/dist/assets/inter-vietnamese-500-normal-DOriooB6.woff2 +0 -0
- package/dist/assets/inter-vietnamese-600-normal-Cc8MFFhd.woff2 +0 -0
- package/dist/assets/inter-vietnamese-700-normal-DlLaEgI2.woff2 +0 -0
- package/dist/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
- package/dist/assets/jetbrains-mono-cyrillic-500-normal-DmUKJPL_.woff2 +0 -0
- package/dist/assets/jetbrains-mono-cyrillic-600-normal-EVf6-Yzo.woff2 +0 -0
- package/dist/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
- package/dist/assets/jetbrains-mono-greek-500-normal-JpySY46c.woff2 +0 -0
- package/dist/assets/jetbrains-mono-greek-600-normal-H7WoG9Et.woff2 +0 -0
- package/dist/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/dist/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
- package/dist/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
- package/dist/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
- package/dist/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
- package/dist/assets/jetbrains-mono-latin-ext-600-normal-BfB_LPfz.woff2 +0 -0
- package/dist/assets/module-asyncify-R6PWJ6ZV-V2kApR_G.js +6 -0
- package/dist/favicon.svg +11 -0
- package/dist/index.html +27 -0
- package/entry.d.mts +17 -0
- package/entry.mjs +39 -0
- package/package.json +69 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{I as J,J as P,b as g,E as v,G as y}from"./index-Cw8epeIo.js";var X=Object.defineProperty,ee=(e,t)=>{for(var r in t)X(e,r,{get:t[r],enumerable:!0})};function b(...e){}var te={};ee(te,{QuickJSAsyncifyError:()=>N,QuickJSAsyncifySuspended:()=>O,QuickJSEmptyGetOwnPropertyNames:()=>B,QuickJSEmscriptenModuleError:()=>ie,QuickJSMemoryLeakDetected:()=>re,QuickJSNotImplemented:()=>k,QuickJSPromisePending:()=>j,QuickJSUnknownIntrinsic:()=>V,QuickJSUnwrapError:()=>A,QuickJSUseAfterFree:()=>M,QuickJSWrongOwner:()=>F});var A=class extends Error{constructor(e,t){let r=typeof e=="object"&&e&&"message"in e?String(e.message):String(e);super(r),this.cause=e,this.context=t,this.name="QuickJSUnwrapError"}},F=class extends Error{constructor(){super(...arguments),this.name="QuickJSWrongOwner"}},M=class extends Error{constructor(){super(...arguments),this.name="QuickJSUseAfterFree"}},k=class extends Error{constructor(){super(...arguments),this.name="QuickJSNotImplemented"}},N=class extends Error{constructor(){super(...arguments),this.name="QuickJSAsyncifyError"}},O=class extends Error{constructor(){super(...arguments),this.name="QuickJSAsyncifySuspended"}},re=class extends Error{constructor(){super(...arguments),this.name="QuickJSMemoryLeakDetected"}},ie=class extends Error{constructor(){super(...arguments),this.name="QuickJSEmscriptenModuleError"}},V=class extends TypeError{constructor(){super(...arguments),this.name="QuickJSUnknownIntrinsic"}},j=class extends Error{constructor(){super(...arguments),this.name="QuickJSPromisePending"}},B=class extends Error{constructor(){super(...arguments),this.name="QuickJSEmptyGetOwnPropertyNames"}};function*U(e){return yield e}function se(e){return U(C(e))}var E=U;E.of=se;function L(e,t){return(...r)=>{let i=t.call(e,E,...r);return C(i)}}function ne(e,t){let r=t.call(e,E);return C(r)}function C(e){function t(r){return r.done?r.value:r.value instanceof Promise?r.value.then(i=>t(e.next(i)),i=>t(e.throw(i))):t(e.next(r.value))}return t(e.next())}var m=class{[Symbol.dispose](){return this.dispose()}},T=Symbol.dispose??Symbol.for("Symbol.dispose"),R=m.prototype;R[T]||(R[T]=function(){return this.dispose()});var l=class G extends m{constructor(t,r,i,s){super(),this._value=t,this.copier=r,this.disposer=i,this._owner=s,this._alive=!0,this._constructorStack=void 0}get alive(){return this._alive}get value(){return this.assertAlive(),this._value}get owner(){return this._owner}get dupable(){return!!this.copier}dup(){if(this.assertAlive(),!this.copier)throw new Error("Non-dupable lifetime");return new G(this.copier(this._value),this.copier,this.disposer,this._owner)}consume(t){this.assertAlive();let r=t(this);return this.dispose(),r}map(t){return this.assertAlive(),t(this)}tap(t){return t(this),this}dispose(){this.assertAlive(),this.disposer&&this.disposer(this._value),this._alive=!1}assertAlive(){if(!this.alive)throw this._constructorStack?new M(`Lifetime not alive
|
|
2
|
+
${this._constructorStack}
|
|
3
|
+
Lifetime used`):new M("Lifetime not alive")}},f=class extends l{constructor(e,t){super(e,void 0,void 0,t)}get dupable(){return!0}dup(){return this}dispose(){}},I=class extends l{constructor(e,t,r,i){super(e,t,r,i)}dispose(){this._alive=!1}};function Q(e,t){let r;try{e.dispose()}catch(i){r=i}if(t&&r)throw Object.assign(t,{message:`${t.message}
|
|
4
|
+
Then, failed to dispose scope: ${r.message}`,disposeError:r}),t;if(t||r)throw t||r}var c=class x extends m{constructor(){super(...arguments),this._disposables=new l(new Set),this.manage=t=>(this._disposables.value.add(t),t)}static withScope(t){let r=new x,i;try{return t(r)}catch(s){throw i=s,s}finally{Q(r,i)}}static withScopeMaybeAsync(t,r){return ne(void 0,function*(i){let s=new x,o;try{return yield*i.of(r.call(t,i,s))}catch(a){throw o=a,a}finally{Q(s,o)}})}static async withScopeAsync(t){let r=new x,i;try{return await t(r)}catch(s){throw i=s,s}finally{Q(r,i)}}get alive(){return this._disposables.alive}dispose(){let t=Array.from(this._disposables.value.values()).reverse();for(let r of t)r.alive&&r.dispose();this._disposables.dispose()}};function oe(e){let t=e?Array.from(e):[];function r(){return t.forEach(s=>s.alive?s.dispose():void 0)}function i(){return t.some(s=>s.alive)}return Object.defineProperty(t,T,{configurable:!0,enumerable:!1,value:r}),Object.defineProperty(t,"dispose",{configurable:!0,enumerable:!1,value:r}),Object.defineProperty(t,"alive",{configurable:!0,enumerable:!1,get:i}),t}function _(e){return!!(e&&(typeof e=="object"||typeof e=="function")&&"alive"in e&&typeof e.alive=="boolean"&&"dispose"in e&&typeof e.dispose=="function")}var H=class D extends m{static success(t){return new ae(t)}static fail(t,r){return new ue(t,r)}static is(t){return t instanceof D}},ae=class extends H{constructor(e){super(),this.value=e}get alive(){return _(this.value)?this.value.alive:!0}dispose(){_(this.value)&&this.value.dispose()}unwrap(){return this.value}unwrapOr(e){return this.value}},ue=class extends H{constructor(e,t){super(),this.error=e,this.onUnwrap=t}get alive(){return _(this.error)?this.error.alive:!0}dispose(){_(this.error)&&this.error.dispose()}unwrap(){throw this.onUnwrap(this),this.error}unwrapOr(e){return e}},w=H,le=class extends m{constructor(e){super(),this.resolve=t=>{this.resolveHandle.alive&&(this.context.unwrapResult(this.context.callFunction(this.resolveHandle,this.context.undefined,t||this.context.undefined)).dispose(),this.disposeResolvers(),this.onSettled())},this.reject=t=>{this.rejectHandle.alive&&(this.context.unwrapResult(this.context.callFunction(this.rejectHandle,this.context.undefined,t||this.context.undefined)).dispose(),this.disposeResolvers(),this.onSettled())},this.dispose=()=>{this.handle.alive&&this.handle.dispose(),this.disposeResolvers()},this.context=e.context,this.owner=e.context.runtime,this.handle=e.promiseHandle,this.settled=new Promise(t=>{this.onSettled=t}),this.resolveHandle=e.resolveHandle,this.rejectHandle=e.rejectHandle}get alive(){return this.handle.alive||this.resolveHandle.alive||this.rejectHandle.alive}disposeResolvers(){this.resolveHandle.alive&&this.resolveHandle.dispose(),this.rejectHandle.alive&&this.rejectHandle.dispose()}},$=class{constructor(e){this.module=e}toPointerArray(e){let t=new Int32Array(e.map(s=>s.value)),r=t.length*t.BYTES_PER_ELEMENT,i=this.module._malloc(r);return new Uint8Array(this.module.HEAPU8.buffer,i,r).set(new Uint8Array(t.buffer)),new l(i,void 0,s=>this.module._free(s))}newTypedArray(e,t){let r=new e(new Array(t).fill(0)),i=r.length*r.BYTES_PER_ELEMENT,s=this.module._malloc(i),o=new e(this.module.HEAPU8.buffer,s,t);return o.set(r),new l({typedArray:o,ptr:s},void 0,a=>this.module._free(a.ptr))}newMutablePointerArray(e){return this.newTypedArray(Int32Array,e)}newHeapCharPointer(e){let t=this.module.lengthBytesUTF8(e),r=t+1,i=this.module._malloc(r);return this.module.stringToUTF8(e,i,r),new l({ptr:i,strlen:t},void 0,s=>this.module._free(s.ptr))}newHeapBufferPointer(e){let t=e.byteLength,r=this.module._malloc(t);return this.module.HEAPU8.set(e,r),new l({pointer:r,numBytes:t},void 0,i=>this.module._free(i.pointer))}consumeHeapCharPointer(e){let t=this.module.UTF8ToString(e);return this.module._free(e),t}};function z(e){if(!e)return 0;let t=0;for(let[r,i]of Object.entries(e)){if(!(r in J))throw new V(r);i&&(t|=J[r])}return t}function q(e){if(typeof e=="number")return e;if(e===void 0)return 0;let{type:t,strict:r,strip:i,compileOnly:s,backtraceBarrier:o}=e,a=0;return t==="global"&&(a|=v.JS_EVAL_TYPE_GLOBAL),t==="module"&&(a|=v.JS_EVAL_TYPE_MODULE),r&&(a|=v.JS_EVAL_FLAG_STRICT),i&&(a|=v.JS_EVAL_FLAG_STRIP),s&&(a|=v.JS_EVAL_FLAG_COMPILE_ONLY),o&&(a|=v.JS_EVAL_FLAG_BACKTRACE_BARRIER),a}function he(e){if(typeof e=="number")return e;if(e===void 0)return 0;let{strings:t,symbols:r,quickjsPrivate:i,onlyEnumerable:s,numbers:o,numbersAsStrings:a}=e,n=0;return t&&(n|=y.JS_GPN_STRING_MASK),r&&(n|=y.JS_GPN_SYMBOL_MASK),i&&(n|=y.JS_GPN_PRIVATE_MASK),s&&(n|=y.JS_GPN_ENUM_ONLY),o&&(n|=y.QTS_GPN_NUMBER_MASK),a&&(n|=y.QTS_STANDARD_COMPLIANT_NUMBER),n}function ce(...e){let t=[];for(let r of e)r!==void 0&&(t=t.concat(r));return t}var me=class extends m{constructor(e,t){super(),this.handle=e,this.context=t,this._isDone=!1,this.owner=t.runtime}[Symbol.iterator](){return this}next(e){if(!this.alive||this._isDone)return{done:!0,value:void 0};let t=this._next??(this._next=this.context.getProp(this.handle,"next"));return this.callIteratorMethod(t,e)}return(e){if(!this.alive)return{done:!0,value:void 0};let t=this.context.getProp(this.handle,"return");if(t===this.context.undefined&&e===void 0)return this.dispose(),{done:!0,value:void 0};let r=this.callIteratorMethod(t,e);return t.dispose(),this.dispose(),r}throw(e){if(!this.alive)return{done:!0,value:void 0};let t=e instanceof l?e:this.context.newError(e),r=this.context.getProp(this.handle,"throw"),i=this.callIteratorMethod(r,e);return t.alive&&t.dispose(),r.dispose(),this.dispose(),i}get alive(){return this.handle.alive}dispose(){this._isDone=!0,this.handle.dispose(),this._next?.dispose()}callIteratorMethod(e,t){let r=t?this.context.callFunction(e,this.handle,t):this.context.callFunction(e,this.handle);if(r.error)return this.dispose(),{value:r};let i=this.context.getProp(r.value,"done").consume(o=>this.context.dump(o));if(i)return r.value.dispose(),this.dispose(),{done:i,value:void 0};let s=this.context.getProp(r.value,"value");return r.value.dispose(),{value:w.success(s),done:i}}},de=class extends ${constructor(e){super(e.module),this.scope=new c,this.copyJSValue=t=>this.ffi.QTS_DupValuePointer(this.ctx.value,t),this.freeJSValue=t=>{this.ffi.QTS_FreeValuePointer(this.ctx.value,t)},e.ownedLifetimes?.forEach(t=>this.scope.manage(t)),this.owner=e.owner,this.module=e.module,this.ffi=e.ffi,this.rt=e.rt,this.ctx=this.scope.manage(e.ctx)}get alive(){return this.scope.alive}dispose(){return this.scope.dispose()}[Symbol.dispose](){return this.dispose()}manage(e){return this.scope.manage(e)}consumeJSCharPointer(e){let t=this.module.UTF8ToString(e);return this.ffi.QTS_FreeCString(this.ctx.value,e),t}heapValueHandle(e){return new l(e,this.copyJSValue,this.freeJSValue,this.owner)}staticHeapValueHandle(e){return this.manage(this.heapValueHandle(e)),new f(e,this.owner)}},K=class extends m{constructor(e){super(),this._undefined=void 0,this._null=void 0,this._false=void 0,this._true=void 0,this._global=void 0,this._BigInt=void 0,this._Symbol=void 0,this._SymbolIterator=void 0,this._SymbolAsyncIterator=void 0,this.fnNextId=-32768,this.fnMaps=new Map,this.cToHostCallbacks={callFunction:(t,r,i,s,o)=>{if(t!==this.ctx.value)throw new Error("QuickJSContext instance received C -> JS call with mismatched ctx");let a=this.getFunction(o);if(!a)throw new Error(`QuickJSContext had no callback with id ${o}`);return c.withScopeMaybeAsync(this,function*(n,u){let d=u.manage(new I(r,this.memory.copyJSValue,this.memory.freeJSValue,this.runtime)),p=new Array(i);for(let h=0;h<i;h++){let S=this.ffi.QTS_ArgvGetJSValueConstPointer(s,h);p[h]=u.manage(new I(S,this.memory.copyJSValue,this.memory.freeJSValue,this.runtime))}try{let h=yield*n(a.apply(d,p));if(h){if("error"in h&&h.error)throw this.runtime.debugLog("throw error",h.error),h.error;let S=u.manage(h instanceof l?h:h.value);return this.ffi.QTS_DupValuePointer(this.ctx.value,S.value)}return 0}catch(h){return this.errorToHandle(h).consume(S=>this.ffi.QTS_Throw(this.ctx.value,S.value))}})}},this.runtime=e.runtime,this.module=e.module,this.ffi=e.ffi,this.rt=e.rt,this.ctx=e.ctx,this.memory=new de({...e,owner:this.runtime}),e.callbacks.setContextCallbacks(this.ctx.value,this.cToHostCallbacks),this.dump=this.dump.bind(this),this.getString=this.getString.bind(this),this.getNumber=this.getNumber.bind(this),this.resolvePromise=this.resolvePromise.bind(this),this.uint32Out=this.memory.manage(this.memory.newTypedArray(Uint32Array,1))}get alive(){return this.memory.alive}dispose(){this.memory.dispose()}get undefined(){if(this._undefined)return this._undefined;let e=this.ffi.QTS_GetUndefined();return this._undefined=new f(e)}get null(){if(this._null)return this._null;let e=this.ffi.QTS_GetNull();return this._null=new f(e)}get true(){if(this._true)return this._true;let e=this.ffi.QTS_GetTrue();return this._true=new f(e)}get false(){if(this._false)return this._false;let e=this.ffi.QTS_GetFalse();return this._false=new f(e)}get global(){if(this._global)return this._global;let e=this.ffi.QTS_GetGlobalObject(this.ctx.value);return this._global=this.memory.staticHeapValueHandle(e),this._global}newNumber(e){return this.memory.heapValueHandle(this.ffi.QTS_NewFloat64(this.ctx.value,e))}newString(e){let t=this.memory.newHeapCharPointer(e).consume(r=>this.ffi.QTS_NewString(this.ctx.value,r.value.ptr));return this.memory.heapValueHandle(t)}newUniqueSymbol(e){let t=(typeof e=="symbol"?e.description:e)??"",r=this.memory.newHeapCharPointer(t).consume(i=>this.ffi.QTS_NewSymbol(this.ctx.value,i.value.ptr,0));return this.memory.heapValueHandle(r)}newSymbolFor(e){let t=(typeof e=="symbol"?e.description:e)??"",r=this.memory.newHeapCharPointer(t).consume(i=>this.ffi.QTS_NewSymbol(this.ctx.value,i.value.ptr,1));return this.memory.heapValueHandle(r)}getWellKnownSymbol(e){return this._Symbol??(this._Symbol=this.memory.manage(this.getProp(this.global,"Symbol"))),this.getProp(this._Symbol,e)}newBigInt(e){if(!this._BigInt){let i=this.getProp(this.global,"BigInt");this.memory.manage(i),this._BigInt=new f(i.value,this.runtime)}let t=this._BigInt,r=String(e);return this.newString(r).consume(i=>this.unwrapResult(this.callFunction(t,this.undefined,i)))}newObject(e){e&&this.runtime.assertOwned(e);let t=e?this.ffi.QTS_NewObjectProto(this.ctx.value,e.value):this.ffi.QTS_NewObject(this.ctx.value);return this.memory.heapValueHandle(t)}newArray(){let e=this.ffi.QTS_NewArray(this.ctx.value);return this.memory.heapValueHandle(e)}newArrayBuffer(e){let t=new Uint8Array(e),r=this.memory.newHeapBufferPointer(t),i=this.ffi.QTS_NewArrayBuffer(this.ctx.value,r.value.pointer,t.length);return this.memory.heapValueHandle(i)}newPromise(e){let t=c.withScope(r=>{let i=r.manage(this.memory.newMutablePointerArray(2)),s=this.ffi.QTS_NewPromiseCapability(this.ctx.value,i.value.ptr),o=this.memory.heapValueHandle(s),[a,n]=Array.from(i.value.typedArray).map(u=>this.memory.heapValueHandle(u));return new le({context:this,promiseHandle:o,resolveHandle:a,rejectHandle:n})});return e&&typeof e=="function"&&(e=new Promise(e)),e&&Promise.resolve(e).then(t.resolve,r=>r instanceof l?t.reject(r):this.newError(r).consume(t.reject)),t}newFunction(e,t){let r=++this.fnNextId;return this.setFunction(r,t),this.memory.heapValueHandle(this.ffi.QTS_NewFunction(this.ctx.value,r,e))}newError(e){let t=this.memory.heapValueHandle(this.ffi.QTS_NewError(this.ctx.value));return e&&typeof e=="object"?(e.name!==void 0&&this.newString(e.name).consume(r=>this.setProp(t,"name",r)),e.message!==void 0&&this.newString(e.message).consume(r=>this.setProp(t,"message",r))):typeof e=="string"?this.newString(e).consume(r=>this.setProp(t,"message",r)):e!==void 0&&this.newString(String(e)).consume(r=>this.setProp(t,"message",r)),t}typeof(e){return this.runtime.assertOwned(e),this.memory.consumeHeapCharPointer(this.ffi.QTS_Typeof(this.ctx.value,e.value))}getNumber(e){return this.runtime.assertOwned(e),this.ffi.QTS_GetFloat64(this.ctx.value,e.value)}getString(e){return this.runtime.assertOwned(e),this.memory.consumeJSCharPointer(this.ffi.QTS_GetString(this.ctx.value,e.value))}getSymbol(e){this.runtime.assertOwned(e);let t=this.memory.consumeJSCharPointer(this.ffi.QTS_GetSymbolDescriptionOrKey(this.ctx.value,e.value));return this.ffi.QTS_IsGlobalSymbol(this.ctx.value,e.value)?Symbol.for(t):Symbol(t)}getBigInt(e){this.runtime.assertOwned(e);let t=this.getString(e);return BigInt(t)}getArrayBuffer(e){this.runtime.assertOwned(e);let t=this.ffi.QTS_GetArrayBufferLength(this.ctx.value,e.value),r=this.ffi.QTS_GetArrayBuffer(this.ctx.value,e.value);if(!r)throw new Error("Couldn't allocate memory to get ArrayBuffer");return new l(this.module.HEAPU8.subarray(r,r+t),void 0,()=>this.module._free(r))}getPromiseState(e){this.runtime.assertOwned(e);let t=this.ffi.QTS_PromiseState(this.ctx.value,e.value);if(t<0)return{type:"fulfilled",value:e,notAPromise:!0};if(t===P.Pending)return{type:"pending",get error(){return new j("Cannot unwrap a pending promise")}};let r=this.ffi.QTS_PromiseResult(this.ctx.value,e.value),i=this.memory.heapValueHandle(r);if(t===P.Fulfilled)return{type:"fulfilled",value:i};if(t===P.Rejected)return{type:"rejected",error:i};throw i.dispose(),new Error(`Unknown JSPromiseStateEnum: ${t}`)}resolvePromise(e){this.runtime.assertOwned(e);let t=c.withScope(r=>{let i=r.manage(this.getProp(this.global,"Promise")),s=r.manage(this.getProp(i,"resolve"));return this.callFunction(s,i,e)});return t.error?Promise.resolve(t):new Promise(r=>{c.withScope(i=>{let s=i.manage(this.newFunction("resolve",u=>{r(this.success(u&&u.dup()))})),o=i.manage(this.newFunction("reject",u=>{r(this.fail(u&&u.dup()))})),a=i.manage(t.value),n=i.manage(this.getProp(a,"then"));this.callFunction(n,a,s,o).unwrap().dispose()})})}isEqual(e,t,r=g.IsStrictlyEqual){if(e===t)return!0;this.runtime.assertOwned(e),this.runtime.assertOwned(t);let i=this.ffi.QTS_IsEqual(this.ctx.value,e.value,t.value,r);if(i===-1)throw new k("WASM variant does not expose equality");return!!i}eq(e,t){return this.isEqual(e,t,g.IsStrictlyEqual)}sameValue(e,t){return this.isEqual(e,t,g.IsSameValue)}sameValueZero(e,t){return this.isEqual(e,t,g.IsSameValueZero)}getProp(e,t){this.runtime.assertOwned(e);let r;return typeof t=="number"&&t>=0?r=this.ffi.QTS_GetPropNumber(this.ctx.value,e.value,t):r=this.borrowPropertyKey(t).consume(i=>this.ffi.QTS_GetProp(this.ctx.value,e.value,i.value)),this.memory.heapValueHandle(r)}getLength(e){if(this.runtime.assertOwned(e),!(this.ffi.QTS_GetLength(this.ctx.value,this.uint32Out.value.ptr,e.value)<0))return this.uint32Out.value.typedArray[0]}getOwnPropertyNames(e,t={strings:!0,numbersAsStrings:!0}){this.runtime.assertOwned(e),e.value;let r=he(t);if(r===0)throw new B("No options set, will return an empty array");return c.withScope(i=>{let s=i.manage(this.memory.newMutablePointerArray(1)),o=this.ffi.QTS_GetOwnPropertyNames(this.ctx.value,s.value.ptr,this.uint32Out.value.ptr,e.value,r);if(o)return this.fail(this.memory.heapValueHandle(o));let a=this.uint32Out.value.typedArray[0],n=s.value.typedArray[0],u=new Uint32Array(this.module.HEAP8.buffer,n,a),d=Array.from(u).map(p=>this.memory.heapValueHandle(p));return this.ffi.QTS_FreeVoidPointer(this.ctx.value,n),this.success(oe(d))})}getIterator(e){let t=this._SymbolIterator??(this._SymbolIterator=this.memory.manage(this.getWellKnownSymbol("iterator")));return c.withScope(r=>{let i=r.manage(this.getProp(e,t)),s=this.callFunction(i,e);return s.error?s:this.success(new me(s.value,this))})}setProp(e,t,r){this.runtime.assertOwned(e),this.borrowPropertyKey(t).consume(i=>this.ffi.QTS_SetProp(this.ctx.value,e.value,i.value,r.value))}defineProp(e,t,r){this.runtime.assertOwned(e),c.withScope(i=>{let s=i.manage(this.borrowPropertyKey(t)),o=r.value||this.undefined,a=!!r.configurable,n=!!r.enumerable,u=!!r.value,d=r.get?i.manage(this.newFunction(r.get.name,r.get)):this.undefined,p=r.set?i.manage(this.newFunction(r.set.name,r.set)):this.undefined;this.ffi.QTS_DefineProp(this.ctx.value,e.value,s.value,o.value,d.value,p.value,a,n,u)})}callFunction(e,t,...r){this.runtime.assertOwned(e);let i,s=r[0];s===void 0||Array.isArray(s)?i=s??[]:i=r;let o=this.memory.toPointerArray(i).consume(n=>this.ffi.QTS_Call(this.ctx.value,e.value,t.value,i.length,n.value)),a=this.ffi.QTS_ResolveException(this.ctx.value,o);return a?(this.ffi.QTS_FreeValuePointer(this.ctx.value,o),this.fail(this.memory.heapValueHandle(a))):this.success(this.memory.heapValueHandle(o))}callMethod(e,t,r=[]){return this.getProp(e,t).consume(i=>this.callFunction(i,e,r))}evalCode(e,t="eval.js",r){let i=r===void 0?1:0,s=q(r),o=this.memory.newHeapCharPointer(e).consume(n=>this.ffi.QTS_Eval(this.ctx.value,n.value.ptr,n.value.strlen,t,i,s)),a=this.ffi.QTS_ResolveException(this.ctx.value,o);return a?(this.ffi.QTS_FreeValuePointer(this.ctx.value,o),this.fail(this.memory.heapValueHandle(a))):this.success(this.memory.heapValueHandle(o))}throw(e){return this.errorToHandle(e).consume(t=>this.ffi.QTS_Throw(this.ctx.value,t.value))}borrowPropertyKey(e){return typeof e=="number"?this.newNumber(e):typeof e=="string"?this.newString(e):new f(e.value,this.runtime)}getMemory(e){if(e===this.rt.value)return this.memory;throw new Error("Private API. Cannot get memory from a different runtime")}dump(e){this.runtime.assertOwned(e);let t=this.typeof(e);if(t==="string")return this.getString(e);if(t==="number")return this.getNumber(e);if(t==="bigint")return this.getBigInt(e);if(t==="undefined")return;if(t==="symbol")return this.getSymbol(e);let r=this.getPromiseState(e);if(r.type==="fulfilled"&&!r.notAPromise)return e.dispose(),{type:r.type,value:r.value.consume(this.dump)};if(r.type==="pending")return e.dispose(),{type:r.type};if(r.type==="rejected")return e.dispose(),{type:r.type,error:r.error.consume(this.dump)};let i=this.memory.consumeJSCharPointer(this.ffi.QTS_Dump(this.ctx.value,e.value));try{return JSON.parse(i)}catch{return i}}unwrapResult(e){if(e.error){let t="context"in e.error?e.error.context:this,r=e.error.consume(i=>this.dump(i));if(r&&typeof r=="object"&&typeof r.message=="string"){let{message:i,name:s,stack:o,...a}=r,n=new A(r,t);typeof s=="string"&&(n.name=r.name),n.message=i;let u=n.stack;throw typeof o=="string"&&(n.stack=`${s}: ${i}
|
|
5
|
+
${r.stack}Host: ${u}`),Object.assign(n,a),n}throw new A(r)}return e.value}[Symbol.for("nodejs.util.inspect.custom")](){return this.alive?`${this.constructor.name} { ctx: ${this.ctx.value} rt: ${this.rt.value} }`:`${this.constructor.name} { disposed }`}getFunction(e){let t=e>>8,r=this.fnMaps.get(t);if(r)return r.get(e)}setFunction(e,t){let r=e>>8,i=this.fnMaps.get(r);return i||(i=new Map,this.fnMaps.set(r,i)),i.set(e,t)}errorToHandle(e){return e instanceof l?e:this.newError(e)}encodeBinaryJSON(e){let t=this.ffi.QTS_bjson_encode(this.ctx.value,e.value);return this.memory.heapValueHandle(t)}decodeBinaryJSON(e){let t=this.ffi.QTS_bjson_decode(this.ctx.value,e.value);return this.memory.heapValueHandle(t)}success(e){return w.success(e)}fail(e){return w.fail(e,t=>this.unwrapResult(t))}},W=class extends m{constructor(e){super(),this.scope=new c,this.contextMap=new Map,this._debugMode=!1,this.cToHostCallbacks={shouldInterrupt:t=>{if(t!==this.rt.value)throw new Error("QuickJSContext instance received C -> JS interrupt with mismatched rt");let r=this.interruptHandler;if(!r)throw new Error("QuickJSContext had no interrupt handler");return r(this)?1:0},loadModuleSource:L(this,function*(t,r,i,s){let o=this.moduleLoader;if(!o)throw new Error("Runtime has no module loader");if(r!==this.rt.value)throw new Error("Runtime pointer mismatch");let a=this.contextMap.get(i)??this.newContext({contextPointer:i});try{let n=yield*t(o(s,a));if(typeof n=="object"&&"error"in n&&n.error)throw this.debugLog("cToHostLoadModule: loader returned error",n.error),n.error;let u=typeof n=="string"?n:"value"in n?n.value:n;return this.memory.newHeapCharPointer(u).value.ptr}catch(n){return this.debugLog("cToHostLoadModule: caught error",n),a.throw(n),0}}),normalizeModule:L(this,function*(t,r,i,s,o){let a=this.moduleNormalizer;if(!a)throw new Error("Runtime has no module normalizer");if(r!==this.rt.value)throw new Error("Runtime pointer mismatch");let n=this.contextMap.get(i)??this.newContext({contextPointer:i});try{let u=yield*t(a(s,o,n));if(typeof u=="object"&&"error"in u&&u.error)throw this.debugLog("cToHostNormalizeModule: normalizer returned error",u.error),u.error;let d=typeof u=="string"?u:u.value;return n.getMemory(this.rt.value).newHeapCharPointer(d).value.ptr}catch(u){return this.debugLog("normalizeModule: caught error",u),n.throw(u),0}})},e.ownedLifetimes?.forEach(t=>this.scope.manage(t)),this.module=e.module,this.memory=new $(this.module),this.ffi=e.ffi,this.rt=e.rt,this.callbacks=e.callbacks,this.scope.manage(this.rt),this.callbacks.setRuntimeCallbacks(this.rt.value,this.cToHostCallbacks),this.executePendingJobs=this.executePendingJobs.bind(this)}get alive(){return this.scope.alive}dispose(){return this.scope.dispose()}newContext(e={}){let t=z(e.intrinsics),r=new l(e.contextPointer||this.ffi.QTS_NewContext(this.rt.value,t),void 0,s=>{this.contextMap.delete(s),this.callbacks.deleteContext(s),this.ffi.QTS_FreeContext(s)}),i=new K({module:this.module,ctx:r,ffi:this.ffi,rt:this.rt,ownedLifetimes:e.ownedLifetimes,runtime:this,callbacks:this.callbacks});return this.contextMap.set(r.value,i),i}setModuleLoader(e,t){this.moduleLoader=e,this.moduleNormalizer=t,this.ffi.QTS_RuntimeEnableModuleLoader(this.rt.value,this.moduleNormalizer?1:0)}removeModuleLoader(){this.moduleLoader=void 0,this.ffi.QTS_RuntimeDisableModuleLoader(this.rt.value)}hasPendingJob(){return!!this.ffi.QTS_IsJobPending(this.rt.value)}setInterruptHandler(e){let t=this.interruptHandler;this.interruptHandler=e,t||this.ffi.QTS_RuntimeEnableInterruptHandler(this.rt.value)}removeInterruptHandler(){this.interruptHandler&&(this.ffi.QTS_RuntimeDisableInterruptHandler(this.rt.value),this.interruptHandler=void 0)}executePendingJobs(e=-1){let t=this.memory.newMutablePointerArray(1),r=this.ffi.QTS_ExecutePendingJob(this.rt.value,e??-1,t.value.ptr),i=t.value.typedArray[0];if(t.dispose(),i===0)return this.ffi.QTS_FreeValuePointerRuntime(this.rt.value,r),w.success(0);let s=this.contextMap.get(i)??this.newContext({contextPointer:i}),o=s.getMemory(this.rt.value).heapValueHandle(r);if(s.typeof(o)==="number"){let a=s.getNumber(o);return o.dispose(),w.success(a)}else{let a=Object.assign(o,{context:s});return w.fail(a,n=>s.unwrapResult(n))}}setMemoryLimit(e){if(e<0&&e!==-1)throw new Error("Cannot set memory limit to negative number. To unset, pass -1");this.ffi.QTS_RuntimeSetMemoryLimit(this.rt.value,e)}computeMemoryUsage(){let e=this.getSystemContext().getMemory(this.rt.value);return e.heapValueHandle(this.ffi.QTS_RuntimeComputeMemoryUsage(this.rt.value,e.ctx.value))}dumpMemoryUsage(){return this.memory.consumeHeapCharPointer(this.ffi.QTS_RuntimeDumpMemoryUsage(this.rt.value))}setMaxStackSize(e){if(e<0)throw new Error("Cannot set memory limit to negative number. To unset, pass 0.");this.ffi.QTS_RuntimeSetMaxStackSize(this.rt.value,e)}assertOwned(e){if(e.owner&&e.owner.rt!==this.rt)throw new F(`Handle is not owned by this runtime: ${e.owner.rt.value} != ${this.rt.value}`)}setDebugMode(e){this._debugMode=e,this.ffi.DEBUG&&this.rt.alive&&this.ffi.QTS_SetDebugLogEnabled(this.rt.value,e?1:0)}isDebugMode(){return this._debugMode}debugLog(...e){this._debugMode&&console.log("quickjs-emscripten:",...e)}[Symbol.for("nodejs.util.inspect.custom")](){return this.alive?`${this.constructor.name} { rt: ${this.rt.value} }`:`${this.constructor.name} { disposed }`}getSystemContext(){return this.context||(this.context=this.scope.manage(this.newContext())),this.context}},fe=class{constructor(e){this.callFunction=e.callFunction,this.shouldInterrupt=e.shouldInterrupt,this.loadModuleSource=e.loadModuleSource,this.normalizeModule=e.normalizeModule}},pe=class{constructor(e){this.contextCallbacks=new Map,this.runtimeCallbacks=new Map,this.suspendedCount=0,this.cToHostCallbacks=new fe({callFunction:(t,r,i,s,o,a)=>this.handleAsyncify(t,()=>{try{let n=this.contextCallbacks.get(r);if(!n)throw new Error(`QuickJSContext(ctx = ${r}) not found for C function call "${a}"`);return n.callFunction(r,i,s,o,a)}catch(n){return console.error("[C to host error: returning null]",n),0}}),shouldInterrupt:(t,r)=>this.handleAsyncify(t,()=>{try{let i=this.runtimeCallbacks.get(r);if(!i)throw new Error(`QuickJSRuntime(rt = ${r}) not found for C interrupt`);return i.shouldInterrupt(r)}catch(i){return console.error("[C to host interrupt: returning error]",i),1}}),loadModuleSource:(t,r,i,s)=>this.handleAsyncify(t,()=>{try{let o=this.runtimeCallbacks.get(r);if(!o)throw new Error(`QuickJSRuntime(rt = ${r}) not found for C module loader`);let a=o.loadModuleSource;if(!a)throw new Error(`QuickJSRuntime(rt = ${r}) does not support module loading`);return a(r,i,s)}catch(o){return console.error("[C to host module loader error: returning null]",o),0}}),normalizeModule:(t,r,i,s,o)=>this.handleAsyncify(t,()=>{try{let a=this.runtimeCallbacks.get(r);if(!a)throw new Error(`QuickJSRuntime(rt = ${r}) not found for C module loader`);let n=a.normalizeModule;if(!n)throw new Error(`QuickJSRuntime(rt = ${r}) does not support module loading`);return n(r,i,s,o)}catch(a){return console.error("[C to host module loader error: returning null]",a),0}})}),this.module=e,this.module.callbacks=this.cToHostCallbacks}setRuntimeCallbacks(e,t){this.runtimeCallbacks.set(e,t)}deleteRuntime(e){this.runtimeCallbacks.delete(e)}setContextCallbacks(e,t){this.contextCallbacks.set(e,t)}deleteContext(e){this.contextCallbacks.delete(e)}handleAsyncify(e,t){if(e)return e.handleSleep(i=>{try{let s=t();if(!(s instanceof Promise)){b("asyncify.handleSleep: not suspending:",s),i(s);return}if(this.suspended)throw new N(`Already suspended at: ${this.suspended.stack}
|
|
6
|
+
Attempted to suspend at:`);this.suspended=new O(`(${this.suspendedCount++})`),b("asyncify.handleSleep: suspending:",this.suspended),s.then(o=>{this.suspended=void 0,b("asyncify.handleSleep: resolved:",o),i(o)},o=>{b("asyncify.handleSleep: rejected:",o),console.error("QuickJS: cannot handle error in suspended function",o),this.suspended=void 0})}catch(s){throw this.suspended=void 0,s}});let r=t();if(r instanceof Promise)throw new Error("Promise return value not supported in non-asyncify context.");return r}};function Y(e,t){t.interruptHandler&&e.setInterruptHandler(t.interruptHandler),t.maxStackSizeBytes!==void 0&&e.setMaxStackSize(t.maxStackSizeBytes),t.memoryLimitBytes!==void 0&&e.setMemoryLimit(t.memoryLimitBytes)}function Z(e,t){t.moduleLoader&&e.setModuleLoader(t.moduleLoader),t.shouldInterrupt&&e.setInterruptHandler(t.shouldInterrupt),t.memoryLimitBytes!==void 0&&e.setMemoryLimit(t.memoryLimitBytes),t.maxStackSizeBytes!==void 0&&e.setMaxStackSize(t.maxStackSizeBytes)}var ve=class{constructor(e,t){this.module=e,this.ffi=t,this.callbacks=new pe(e)}newRuntime(e={}){let t=new l(this.ffi.QTS_NewRuntime(),void 0,i=>{this.callbacks.deleteRuntime(i),this.ffi.QTS_FreeRuntime(i)}),r=new W({module:this.module,callbacks:this.callbacks,ffi:this.ffi,rt:t});return Y(r,e),e.moduleLoader&&r.setModuleLoader(e.moduleLoader),r}newContext(e={}){let t=this.newRuntime(),r=t.newContext({...e,ownedLifetimes:ce(t,e.ownedLifetimes)});return t.context=r,r}evalCode(e,t={}){return c.withScope(r=>{let i=r.manage(this.newContext());Z(i.runtime,t);let s=i.evalCode(e,"eval.js");if(t.memoryLimitBytes!==void 0&&i.runtime.setMemoryLimit(-1),s.error)throw i.dump(r.manage(s.error));return i.dump(r.manage(s.value))})}getWasmMemory(){let e=this.module.quickjsEmscriptenInit?.(()=>{})?.getWasmMemory?.();if(!e)throw new Error("Variant does not support getting WebAssembly.Memory");return e}getFFI(){return this.ffi}},ye=class extends K{async evalCodeAsync(e,t="eval.js",r){let i=r===void 0?1:0,s=q(r),o=0;try{o=await this.memory.newHeapCharPointer(e).consume(n=>this.ffi.QTS_Eval_MaybeAsync(this.ctx.value,n.value.ptr,n.value.strlen,t,i,s))}catch(n){throw this.runtime.debugLog("QTS_Eval_MaybeAsync threw",n),n}let a=this.ffi.QTS_ResolveException(this.ctx.value,o);return a?(this.ffi.QTS_FreeValuePointer(this.ctx.value,o),this.fail(this.memory.heapValueHandle(a))):this.success(this.memory.heapValueHandle(o))}newAsyncifiedFunction(e,t){return this.newFunction(e,t)}},we=class extends W{constructor(e){super(e)}newContext(e={}){let t=z(e.intrinsics),r=new l(this.ffi.QTS_NewContext(this.rt.value,t),void 0,s=>{this.contextMap.delete(s),this.callbacks.deleteContext(s),this.ffi.QTS_FreeContext(s)}),i=new ye({module:this.module,ctx:r,ffi:this.ffi,rt:this.rt,ownedLifetimes:[],runtime:this,callbacks:this.callbacks});return this.contextMap.set(r.value,i),i}setModuleLoader(e,t){super.setModuleLoader(e,t)}setMaxStackSize(e){return super.setMaxStackSize(e)}},ge=class extends ve{constructor(e,t){super(e,t),this.ffi=t,this.module=e}newRuntime(e={}){let t=new l(this.ffi.QTS_NewRuntime(),void 0,i=>{this.callbacks.deleteRuntime(i),this.ffi.QTS_FreeRuntime(i)}),r=new we({module:this.module,ffi:this.ffi,rt:t,callbacks:this.callbacks});return Y(r,e),e.moduleLoader&&r.setModuleLoader(e.moduleLoader),r}newContext(e={}){let t=this.newRuntime(),r=e.ownedLifetimes?e.ownedLifetimes.concat([t]):[t],i=t.newContext({...e,ownedLifetimes:r});return t.context=i,i}evalCode(){throw new k("QuickJSWASMModuleAsyncify.evalCode: use evalCodeAsync instead")}evalCodeAsync(e,t){return c.withScopeAsync(async r=>{let i=r.manage(this.newContext());Z(i.runtime,t);let s=await i.evalCodeAsync(e,"eval.js");if(t.memoryLimitBytes!==void 0&&i.runtime.setMemoryLimit(-1),s.error)throw i.dump(r.manage(s.error));return i.dump(r.manage(s.value))})}};export{ge as QuickJSAsyncWASMModule};
|
package/dist/favicon.svg
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#525252" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
2
|
+
<style>
|
|
3
|
+
@media (prefers-color-scheme: dark) {
|
|
4
|
+
svg { stroke: #d4d4d4; }
|
|
5
|
+
}
|
|
6
|
+
</style>
|
|
7
|
+
<path d="M8 3.5h9A3.5 3.5 0 0 1 20.5 7v9" />
|
|
8
|
+
<rect width="13.5" height="13.5" x="3.5" y="7" rx="3.5" />
|
|
9
|
+
<path d="m7 16.5 2.5-2.5L7 11.5" />
|
|
10
|
+
<circle cx="13.2" cy="14" r="1.7" fill="#2fbf71" stroke="none" />
|
|
11
|
+
</svg>
|
package/dist/index.html
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en" data-theme="light">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
|
|
7
|
+
<title>workerdeck</title>
|
|
8
|
+
<script>
|
|
9
|
+
;(function () {
|
|
10
|
+
var el = document.documentElement
|
|
11
|
+
try {
|
|
12
|
+
var t = localStorage.getItem('workerdeck.theme')
|
|
13
|
+
var dark =
|
|
14
|
+
t === 'dark' || (t !== 'light' && window.matchMedia('(prefers-color-scheme: dark)').matches)
|
|
15
|
+
el.setAttribute('data-theme', dark ? 'dark' : 'light')
|
|
16
|
+
} catch (e) {
|
|
17
|
+
el.setAttribute('data-theme', 'light')
|
|
18
|
+
}
|
|
19
|
+
})()
|
|
20
|
+
</script>
|
|
21
|
+
<script type="module" crossorigin src="/assets/index-p6gzNhpM.js"></script>
|
|
22
|
+
<link rel="stylesheet" crossorigin href="/assets/index-B-6d1dTe.css">
|
|
23
|
+
</head>
|
|
24
|
+
<body>
|
|
25
|
+
<div id="root"></div>
|
|
26
|
+
</body>
|
|
27
|
+
</html>
|
package/entry.d.mts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Absolute path to the built dashboard (`index.html` + content-hashed assets).
|
|
3
|
+
*
|
|
4
|
+
* Mount it at a **domain root** (the build sets no `base`, so assets resolve
|
|
5
|
+
* from an absolute `/assets/...`) and serve the gateway on the **same origin**
|
|
6
|
+
* under `/v1` — the app builds its client from `location.origin`, and
|
|
7
|
+
* same-origin is what lets a browser authenticate the session WebSocket, since
|
|
8
|
+
* a tab cannot set headers on an upgrade.
|
|
9
|
+
*
|
|
10
|
+
* The app uses hash history, so no SPA rewrite rules are needed: serve
|
|
11
|
+
* `index.html` for every non-asset path, hashed assets `immutable`, and
|
|
12
|
+
* `index.html` `no-cache`.
|
|
13
|
+
*/
|
|
14
|
+
export declare const dashboardDir: string
|
|
15
|
+
|
|
16
|
+
/** Absolute path to the entry document inside {@link dashboardDir}. */
|
|
17
|
+
export declare const dashboardIndexHtml: string
|
package/entry.mjs
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// The package entry is a *path*, not a component tree: this is a built
|
|
2
|
+
// application, not a library. Hand-written rather than bundled — there is
|
|
3
|
+
// nothing here worth a build step, and keeping it out of vite's graph means the
|
|
4
|
+
// published entry can never drift from the published dist.
|
|
5
|
+
import { dirname, join } from 'node:path'
|
|
6
|
+
import { fileURLToPath } from 'node:url'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Absolute path to the built dashboard — an `index.html` plus content-hashed
|
|
10
|
+
* assets, ready to serve.
|
|
11
|
+
*
|
|
12
|
+
* Two constraints come with it, both baked in at build time:
|
|
13
|
+
*
|
|
14
|
+
* 1. **Mount it at a domain root.** `vite.config.ts` sets no `base`, so assets
|
|
15
|
+
* resolve from an absolute `/assets/...`. A subpath mount serves a blank page.
|
|
16
|
+
* 2. **Serve the gateway on the same origin, under `/v1`.** The app builds its
|
|
17
|
+
* client from `location.origin`, and same-origin is also what lets a browser
|
|
18
|
+
* authenticate the session WebSocket at all — a tab cannot put a header on an
|
|
19
|
+
* upgrade, so a same-origin cookie is its only option.
|
|
20
|
+
*
|
|
21
|
+
* Routing needs no server support: the app uses hash history, so every route is
|
|
22
|
+
* `#/…` and only `index.html` is ever requested. Serve hashed assets immutable
|
|
23
|
+
* and `index.html` with `no-cache`, or a deployed update never reaches a browser
|
|
24
|
+
* that already has the old one.
|
|
25
|
+
*
|
|
26
|
+
* If you just want this served correctly, the `workerdeck` package already
|
|
27
|
+
* does all of the above.
|
|
28
|
+
*
|
|
29
|
+
* @type {string}
|
|
30
|
+
*/
|
|
31
|
+
export const dashboardDir = join(dirname(fileURLToPath(import.meta.url)), 'dist')
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Absolute path to the entry document, for hosts that serve it explicitly on
|
|
35
|
+
* every non-asset route.
|
|
36
|
+
*
|
|
37
|
+
* @type {string}
|
|
38
|
+
*/
|
|
39
|
+
export const dashboardIndexHtml = join(dashboardDir, 'index.html')
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@workerdeck/web",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "The WorkerDeck dashboard as prebuilt static files: session list, create/resume flow, live panel, jobs, profiles, settings. Ships dist/ plus the path to it — serve it from the same origin as the gateway. Zero runtime dependencies.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "./entry.mjs",
|
|
8
|
+
"types": "./entry.d.mts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"entry.mjs",
|
|
12
|
+
"entry.d.mts"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./entry.d.mts",
|
|
17
|
+
"default": "./entry.mjs"
|
|
18
|
+
},
|
|
19
|
+
"./dist/*": "./dist/*",
|
|
20
|
+
"./package.json": "./package.json"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@fontsource/inter": "^5.2.8",
|
|
24
|
+
"@fontsource/jetbrains-mono": "^5.2.8",
|
|
25
|
+
"@jitl/quickjs-singlefile-browser-release-asyncify": "^0.31.0",
|
|
26
|
+
"@tailwindcss/vite": "^4.3.1",
|
|
27
|
+
"@tanstack/react-router": "^1.170.16",
|
|
28
|
+
"@types/node": "^22.10.0",
|
|
29
|
+
"@types/react": "^19.2.0",
|
|
30
|
+
"@types/react-dom": "^19.2.0",
|
|
31
|
+
"@vitejs/plugin-react-swc": "^3.9.0",
|
|
32
|
+
"lucide-react": "^1.21.0",
|
|
33
|
+
"react": "^19.2.0",
|
|
34
|
+
"react-dom": "^19.2.0",
|
|
35
|
+
"rimraf": "^6.1.3",
|
|
36
|
+
"tailwindcss": "^4.3.1",
|
|
37
|
+
"vite": "^6.3.0",
|
|
38
|
+
"@workerdeck/protocol": "0.6.0",
|
|
39
|
+
"@workerdeck/react": "0.6.0",
|
|
40
|
+
"@workerdeck/ui": "0.6.0",
|
|
41
|
+
"@workerdeck/client": "0.6.0"
|
|
42
|
+
},
|
|
43
|
+
"author": "Tobias Strebitzer",
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "git+https://github.com/workerdeck/workerdeck.git",
|
|
47
|
+
"directory": "packages/web"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://workerdeck.github.io/workerdeck/",
|
|
50
|
+
"bugs": "https://github.com/workerdeck/workerdeck/issues",
|
|
51
|
+
"keywords": [
|
|
52
|
+
"claude",
|
|
53
|
+
"claude-code",
|
|
54
|
+
"anthropic",
|
|
55
|
+
"agent",
|
|
56
|
+
"dashboard",
|
|
57
|
+
"spa"
|
|
58
|
+
],
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"access": "public"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"clean": "rimraf dist",
|
|
64
|
+
"dev": "vite",
|
|
65
|
+
"build": "vite build && node ./scripts/trim-fonts.mjs",
|
|
66
|
+
"preview": "vite preview",
|
|
67
|
+
"typecheck": "tsgo -p tsconfig.json"
|
|
68
|
+
}
|
|
69
|
+
}
|