capnweb 0.0.0-6d805d4 → 0.0.0-76fdff1
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/README.md +4 -0
- package/dist/index-workers.cjs +7 -4
- package/dist/index-workers.cjs.map +1 -1
- package/dist/index-workers.d.cts +1 -1
- package/dist/index-workers.d.ts +1 -1
- package/dist/index-workers.js +7 -4
- package/dist/index-workers.js.map +1 -1
- package/dist/index.cjs +7 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -21
- package/dist/index.d.ts +29 -21
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -642,6 +642,10 @@ function newWebSocketRpcSession(
|
|
|
642
642
|
: Disposable;
|
|
643
643
|
```
|
|
644
644
|
|
|
645
|
+
### HTTP server using Hono
|
|
646
|
+
|
|
647
|
+
If your app is built on [Hono](https://hono.dev/) (on any runtime it supports), check out [`@hono/capnweb`](https://github.com/honojs/middleware/tree/main/packages/capnweb).
|
|
648
|
+
|
|
645
649
|
### MessagePort
|
|
646
650
|
|
|
647
651
|
Cap'n Web can also talk over MessagePorts. This can be used in a browser to talk to Web Workers, iframes, etc.
|
package/dist/index-workers.cjs
CHANGED
|
@@ -23,15 +23,15 @@ function _interopNamespace(e) {
|
|
|
23
23
|
var cfw__namespace = /*#__PURE__*/_interopNamespace(cfw);
|
|
24
24
|
|
|
25
25
|
// src/symbols.ts
|
|
26
|
-
var WORKERS_MODULE_SYMBOL = Symbol("workers-module");
|
|
26
|
+
var WORKERS_MODULE_SYMBOL = /* @__PURE__ */ Symbol("workers-module");
|
|
27
27
|
globalThis[WORKERS_MODULE_SYMBOL] = cfw__namespace;
|
|
28
28
|
|
|
29
29
|
// src/core.ts
|
|
30
30
|
if (!Symbol.dispose) {
|
|
31
|
-
Symbol.dispose = Symbol.for("dispose");
|
|
31
|
+
Symbol.dispose = /* @__PURE__ */ Symbol.for("dispose");
|
|
32
32
|
}
|
|
33
33
|
if (!Symbol.asyncDispose) {
|
|
34
|
-
Symbol.asyncDispose = Symbol.for("asyncDispose");
|
|
34
|
+
Symbol.asyncDispose = /* @__PURE__ */ Symbol.for("asyncDispose");
|
|
35
35
|
}
|
|
36
36
|
if (!Promise.withResolvers) {
|
|
37
37
|
Promise.withResolvers = function() {
|
|
@@ -47,6 +47,8 @@ if (!Promise.withResolvers) {
|
|
|
47
47
|
var workersModule = globalThis[WORKERS_MODULE_SYMBOL];
|
|
48
48
|
var RpcTarget = workersModule ? workersModule.RpcTarget : class {
|
|
49
49
|
};
|
|
50
|
+
var AsyncFunction = (async function() {
|
|
51
|
+
}).constructor;
|
|
50
52
|
function typeForRpc(value) {
|
|
51
53
|
switch (typeof value) {
|
|
52
54
|
case "boolean":
|
|
@@ -71,6 +73,7 @@ function typeForRpc(value) {
|
|
|
71
73
|
case Object.prototype:
|
|
72
74
|
return "object";
|
|
73
75
|
case Function.prototype:
|
|
76
|
+
case AsyncFunction.prototype:
|
|
74
77
|
return "function";
|
|
75
78
|
case Array.prototype:
|
|
76
79
|
return "array";
|
|
@@ -154,7 +157,7 @@ function withCallInterceptor(interceptor, callback) {
|
|
|
154
157
|
doCall = oldValue;
|
|
155
158
|
}
|
|
156
159
|
}
|
|
157
|
-
var RAW_STUB = Symbol("realStub");
|
|
160
|
+
var RAW_STUB = /* @__PURE__ */ Symbol("realStub");
|
|
158
161
|
var PROXY_HANDLERS = {
|
|
159
162
|
apply(target, thisArg, argumentsList) {
|
|
160
163
|
let stub = target.raw;
|