@dxos/rpc-tunnel 0.8.3 → 0.8.4-main.1da679c
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/dist/lib/browser/index.mjs +33 -17
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +33 -17
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/port-muxer.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -3
- package/src/index.ts +1 -1
- package/src/port-muxer.ts +1 -1
- package/dist/lib/node/index.cjs +0 -243
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
package/dist/lib/node/index.cjs
DELETED
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var node_exports = {};
|
|
20
|
-
__export(node_exports, {
|
|
21
|
-
PortMuxer: () => PortMuxer,
|
|
22
|
-
createIFrame: () => createIFrame,
|
|
23
|
-
createIFramePort: () => createIFramePort,
|
|
24
|
-
createWorkerPort: () => createWorkerPort
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(node_exports);
|
|
27
|
-
var import_ua_parser_js = require("ua-parser-js");
|
|
28
|
-
var import_log = require("@dxos/log");
|
|
29
|
-
var import_log2 = require("@dxos/log");
|
|
30
|
-
var import_log3 = require("@dxos/log");
|
|
31
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/mesh/rpc-tunnel/src/ports/iframe.ts";
|
|
32
|
-
var browser;
|
|
33
|
-
var os;
|
|
34
|
-
if (typeof navigator !== "undefined") {
|
|
35
|
-
const parser = new import_ua_parser_js.UAParser(navigator.userAgent);
|
|
36
|
-
browser = parser.getBrowser().name;
|
|
37
|
-
os = parser.getOS().name;
|
|
38
|
-
}
|
|
39
|
-
var sendToIFrame = (iframe, origin, message) => {
|
|
40
|
-
if (!iframe.contentWindow) {
|
|
41
|
-
(0, import_log.log)("IFrame content window missing", {
|
|
42
|
-
origin
|
|
43
|
-
}, {
|
|
44
|
-
F: __dxlog_file,
|
|
45
|
-
L: 24,
|
|
46
|
-
S: void 0,
|
|
47
|
-
C: (f, a) => f(...a)
|
|
48
|
-
});
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
if (browser === "Chrome" && os === "iOS") {
|
|
52
|
-
iframe.contentWindow.postMessage(message, origin);
|
|
53
|
-
} else {
|
|
54
|
-
iframe.contentWindow.postMessage(message, origin, [
|
|
55
|
-
message.payload
|
|
56
|
-
]);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
var sendToParentWindow = (origin, message) => {
|
|
60
|
-
if (browser === "Chrome" && os === "iOS") {
|
|
61
|
-
window.parent.postMessage(message, origin);
|
|
62
|
-
} else {
|
|
63
|
-
window.parent.postMessage(message, origin, [
|
|
64
|
-
message.payload
|
|
65
|
-
]);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
var createIFramePort = ({ channel, iframe, origin, onOrigin }) => {
|
|
69
|
-
return {
|
|
70
|
-
send: async (data) => {
|
|
71
|
-
if (!origin) {
|
|
72
|
-
(0, import_log.log)("no origin set", {
|
|
73
|
-
channel
|
|
74
|
-
}, {
|
|
75
|
-
F: __dxlog_file,
|
|
76
|
-
L: 62,
|
|
77
|
-
S: void 0,
|
|
78
|
-
C: (f, a) => f(...a)
|
|
79
|
-
});
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
(0, import_log.log)("sending", {
|
|
83
|
-
channel,
|
|
84
|
-
data: data.length
|
|
85
|
-
}, {
|
|
86
|
-
F: __dxlog_file,
|
|
87
|
-
L: 66,
|
|
88
|
-
S: void 0,
|
|
89
|
-
C: (f, a) => f(...a)
|
|
90
|
-
});
|
|
91
|
-
const payload = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
|
|
92
|
-
const message = {
|
|
93
|
-
channel,
|
|
94
|
-
payload
|
|
95
|
-
};
|
|
96
|
-
if (iframe) {
|
|
97
|
-
sendToIFrame(iframe, origin, message);
|
|
98
|
-
} else {
|
|
99
|
-
sendToParentWindow(origin, message);
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
subscribe: (callback) => {
|
|
103
|
-
const handler = (event) => {
|
|
104
|
-
if (!iframe && event.source !== window.parent) {
|
|
105
|
-
return;
|
|
106
|
-
} else if (iframe && event.source !== iframe.contentWindow) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
const isMessageData = event.data && typeof event.data === "object" && "channel" in event.data && "payload" in event.data;
|
|
110
|
-
const message = isMessageData ? event.data : void 0;
|
|
111
|
-
if (message?.channel !== channel) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
if (!origin) {
|
|
115
|
-
origin = event.origin;
|
|
116
|
-
onOrigin?.(origin);
|
|
117
|
-
}
|
|
118
|
-
(0, import_log.log)("received", message, {
|
|
119
|
-
F: __dxlog_file,
|
|
120
|
-
L: 98,
|
|
121
|
-
S: void 0,
|
|
122
|
-
C: (f, a) => f(...a)
|
|
123
|
-
});
|
|
124
|
-
callback(new Uint8Array(message.payload));
|
|
125
|
-
};
|
|
126
|
-
window.addEventListener("message", handler);
|
|
127
|
-
return () => window.removeEventListener("message", handler);
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
};
|
|
131
|
-
var createIFrame = (source, id, { hidden = true, allow } = {}) => {
|
|
132
|
-
const create = () => {
|
|
133
|
-
const iframe = document.createElement("iframe");
|
|
134
|
-
iframe.id = id;
|
|
135
|
-
iframe.src = source;
|
|
136
|
-
hidden && iframe.setAttribute("style", "display: none;");
|
|
137
|
-
allow && iframe.setAttribute("allow", allow);
|
|
138
|
-
document.body.appendChild(iframe);
|
|
139
|
-
return iframe;
|
|
140
|
-
};
|
|
141
|
-
return document.getElementById(id) ?? create();
|
|
142
|
-
};
|
|
143
|
-
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/mesh/rpc-tunnel/src/ports/worker.ts";
|
|
144
|
-
var createWorkerPort = ({ port, channel, subscribe }) => ({
|
|
145
|
-
send: async (message) => {
|
|
146
|
-
const payload = message.buffer.slice(message.byteOffset, message.byteOffset + message.byteLength);
|
|
147
|
-
port.postMessage({
|
|
148
|
-
channel,
|
|
149
|
-
payload
|
|
150
|
-
}, [
|
|
151
|
-
payload
|
|
152
|
-
]);
|
|
153
|
-
},
|
|
154
|
-
subscribe: subscribe ?? ((callback) => {
|
|
155
|
-
const handler = (event) => {
|
|
156
|
-
const message = event.data;
|
|
157
|
-
if (channel && message.channel !== channel) {
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
import_log2.log.debug("received", {
|
|
161
|
-
message
|
|
162
|
-
}, {
|
|
163
|
-
F: __dxlog_file2,
|
|
164
|
-
L: 46,
|
|
165
|
-
S: void 0,
|
|
166
|
-
C: (f, a) => f(...a)
|
|
167
|
-
});
|
|
168
|
-
callback(new Uint8Array(message.payload));
|
|
169
|
-
};
|
|
170
|
-
port.onmessage = handler;
|
|
171
|
-
return () => {
|
|
172
|
-
port.onmessage = null;
|
|
173
|
-
};
|
|
174
|
-
})
|
|
175
|
-
});
|
|
176
|
-
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/mesh/rpc-tunnel/src/port-muxer.ts";
|
|
177
|
-
var PortMuxer = class {
|
|
178
|
-
constructor(_messagePort) {
|
|
179
|
-
this._messagePort = _messagePort;
|
|
180
|
-
this._activeChannels = /* @__PURE__ */ new Map();
|
|
181
|
-
this._rpcPorts = /* @__PURE__ */ new Map();
|
|
182
|
-
if (this._messagePort) {
|
|
183
|
-
this._messagePort.onmessage = (event) => this.onWorkerMessage(event);
|
|
184
|
-
}
|
|
185
|
-
if (typeof window !== "undefined") {
|
|
186
|
-
window.addEventListener("message", (event) => this.onWindowMessage(event));
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
createWorkerPort(options) {
|
|
190
|
-
if (!this._messagePort) {
|
|
191
|
-
throw new Error("Message port is required to create worker ports");
|
|
192
|
-
}
|
|
193
|
-
const port = createWorkerPort({
|
|
194
|
-
...options,
|
|
195
|
-
port: this._messagePort,
|
|
196
|
-
subscribe: (callback) => {
|
|
197
|
-
this._activeChannels.set(options.channel, callback);
|
|
198
|
-
return () => this._activeChannels.delete(options.channel);
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
this._rpcPorts.set(options.channel, port);
|
|
202
|
-
return port;
|
|
203
|
-
}
|
|
204
|
-
createIFramePort(options) {
|
|
205
|
-
const port = createIFramePort(options);
|
|
206
|
-
this._rpcPorts.set(options.channel, port);
|
|
207
|
-
return port;
|
|
208
|
-
}
|
|
209
|
-
onWorkerMessage(event) {
|
|
210
|
-
const message = event.data;
|
|
211
|
-
import_log3.log.debug("Recieved message from worker port", {
|
|
212
|
-
channel: message.channel,
|
|
213
|
-
payload: message.payload
|
|
214
|
-
}, {
|
|
215
|
-
F: __dxlog_file3,
|
|
216
|
-
L: 56,
|
|
217
|
-
S: this,
|
|
218
|
-
C: (f, a) => f(...a)
|
|
219
|
-
});
|
|
220
|
-
const callback = this._activeChannels.get(message.channel);
|
|
221
|
-
callback?.(new Uint8Array(message.payload));
|
|
222
|
-
}
|
|
223
|
-
onWindowMessage(event) {
|
|
224
|
-
const message = event.data;
|
|
225
|
-
import_log3.log.debug("Recieved message from window", {
|
|
226
|
-
channel: message.channel,
|
|
227
|
-
payload: message.payload
|
|
228
|
-
}, {
|
|
229
|
-
F: __dxlog_file3,
|
|
230
|
-
L: 67,
|
|
231
|
-
S: this,
|
|
232
|
-
C: (f, a) => f(...a)
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
237
|
-
0 && (module.exports = {
|
|
238
|
-
PortMuxer,
|
|
239
|
-
createIFrame,
|
|
240
|
-
createIFramePort,
|
|
241
|
-
createWorkerPort
|
|
242
|
-
});
|
|
243
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/ports/iframe.ts", "../../../src/ports/worker.ts", "../../../src/port-muxer.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport { UAParser } from 'ua-parser-js';\n\nimport { log } from '@dxos/log';\nimport { type RpcPort } from '@dxos/rpc';\n\nimport { type MessageData } from '../message';\n\nlet browser: string | undefined;\nlet os: string | undefined;\n\nif (typeof navigator !== 'undefined') {\n // TODO(wittjosiah): Stop user agent parsing.\n const parser = new UAParser(navigator.userAgent);\n browser = parser.getBrowser().name;\n os = parser.getOS().name;\n}\n\nconst sendToIFrame = (iframe: HTMLIFrameElement, origin: string, message: MessageData) => {\n if (!iframe.contentWindow) {\n log('IFrame content window missing', { origin });\n return;\n }\n\n if (browser === 'Chrome' && os === 'iOS') {\n iframe.contentWindow.postMessage(message, origin);\n } else {\n iframe.contentWindow.postMessage(message, origin, [message.payload]);\n }\n};\n\nconst sendToParentWindow = (origin: string, message: MessageData) => {\n if (browser === 'Chrome' && os === 'iOS') {\n window.parent.postMessage(message, origin);\n } else {\n window.parent.postMessage(message, origin, [message.payload]);\n }\n};\n\nexport type IFramePortOptions = {\n channel: string;\n iframe?: HTMLIFrameElement;\n origin?: string;\n onOrigin?: (origin: string) => void;\n};\n\n/**\n * Create a RPC port with an iframe over window messaging.\n * @param options.channel Identifier for sent/recieved messages.\n * @param options.iframe Instance of the iframe if sending to child.\n * @param options.origin Origin of the destination window.\n * @param options.onOrigin Callback triggered when origin of destination window is verified.\n * @returns RPC port for messaging.\n */\nexport const createIFramePort = ({ channel, iframe, origin, onOrigin }: IFramePortOptions): RpcPort => {\n return {\n send: async (data) => {\n if (!origin) {\n log('no origin set', { channel });\n return;\n }\n\n log('sending', { channel, data: data.length });\n const payload = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);\n const message = { channel, payload };\n if (iframe) {\n sendToIFrame(iframe, origin, message);\n } else {\n sendToParentWindow(origin, message);\n }\n },\n\n subscribe: (callback) => {\n const handler = (event: MessageEvent<unknown>) => {\n if (!iframe && event.source !== window.parent) {\n // Not from parent window.\n return;\n } else if (iframe && event.source !== iframe.contentWindow) {\n // Not from child window.\n return;\n }\n\n const isMessageData =\n event.data && typeof event.data === 'object' && 'channel' in event.data && 'payload' in event.data;\n const message = isMessageData ? (event.data as MessageData) : undefined;\n if (message?.channel !== channel) {\n return;\n }\n\n if (!origin) {\n origin = event.origin;\n onOrigin?.(origin);\n }\n\n log('received', message);\n callback(new Uint8Array(message.payload));\n };\n\n window.addEventListener('message', handler);\n return () => window.removeEventListener('message', handler);\n },\n };\n};\n\nexport type CreateIFrameOptions = {\n hidden?: boolean;\n allow?: string;\n};\n\n/**\n * Create a hidden iframe and insert it into the DOM.\n * If an element with the same id already exists it will be returned instead.\n * @param source Source of the iframe.\n * @param id DOM id of the iframe.\n * @returns The created iframe.\n */\nexport const createIFrame = (source: string, id: string, { hidden = true, allow }: CreateIFrameOptions = {}) => {\n const create = () => {\n const iframe = document.createElement('iframe') as HTMLIFrameElement;\n iframe.id = id;\n iframe.src = source;\n hidden && iframe.setAttribute('style', 'display: none;');\n allow && iframe.setAttribute('allow', allow);\n document.body.appendChild(iframe);\n return iframe;\n };\n\n return (document.getElementById(id) as HTMLIFrameElement) ?? create();\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { log } from '@dxos/log';\nimport { type RpcPort } from '@dxos/rpc';\n\nimport { type MessageData } from '../message';\n\nexport type WorkerPortOptions = {\n port: MessagePort;\n channel?: string;\n subscribe?: RpcPort['subscribe'];\n};\n\n/**\n * Create a RPC port for a worker.\n * @param options.port Message port to send message on.\n * @param options.channel Identifier for sent/recieved messages.\n * @param options.subscribe\n * @returns RPC port for messaging.\n */\n// TODO(wittjosiah): Rename for more general purpose MessagePort.\nexport const createWorkerPort = ({ port, channel, subscribe }: WorkerPortOptions): RpcPort => ({\n send: async (message) => {\n // Based on https://stackoverflow.com/a/54646864/2804332.\n const payload = message.buffer.slice(message.byteOffset, message.byteOffset + message.byteLength);\n port.postMessage(\n {\n channel,\n payload,\n },\n [payload],\n );\n },\n\n subscribe:\n subscribe ??\n ((callback) => {\n const handler = (event: MessageEvent<MessageData>) => {\n const message = event.data;\n if (channel && message.channel !== channel) {\n return;\n }\n\n log.debug('received', { message });\n callback(new Uint8Array(message.payload));\n };\n\n port.onmessage = handler;\n return () => {\n port.onmessage = null;\n };\n }),\n});\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { log } from '@dxos/log';\nimport { type RpcPort } from '@dxos/rpc';\n\nimport { type MessageData } from './message';\nimport { createIFramePort, createWorkerPort, type IFramePortOptions, type WorkerPortOptions } from './ports';\n\n/**\n * Facilitates the multiplexing of multiple RpcPorts over a single MessagePort.\n */\nexport class PortMuxer {\n private readonly _activeChannels = new Map<string, (msg: Uint8Array) => void>();\n\n private readonly _rpcPorts = new Map<string, RpcPort>();\n\n constructor(private readonly _messagePort?: MessagePort) {\n if (this._messagePort) {\n this._messagePort.onmessage = (event) => this.onWorkerMessage(event);\n }\n\n if (typeof window !== 'undefined') {\n window.addEventListener('message', (event) => this.onWindowMessage(event));\n }\n }\n\n createWorkerPort(options: Omit<WorkerPortOptions, 'port' | 'subscribe' | 'channel'> & { channel: string }): RpcPort {\n if (!this._messagePort) {\n throw new Error('Message port is required to create worker ports');\n }\n\n const port = createWorkerPort({\n ...options,\n port: this._messagePort,\n subscribe: (callback) => {\n this._activeChannels.set(options.channel, callback);\n return () => this._activeChannels.delete(options.channel);\n },\n });\n this._rpcPorts.set(options.channel, port);\n\n return port;\n }\n\n createIFramePort(options: IFramePortOptions): RpcPort {\n const port = createIFramePort(options);\n this._rpcPorts.set(options.channel, port);\n\n return port;\n }\n\n private onWorkerMessage(event: MessageEvent<MessageData>): void {\n const message = event.data;\n log.debug('Recieved message from worker port', {\n channel: message.channel,\n payload: message.payload,\n });\n\n const callback = this._activeChannels.get(message.channel);\n callback?.(new Uint8Array(message.payload));\n }\n\n private onWindowMessage(event: MessageEvent<MessageData>): void {\n const message = event.data;\n log.debug('Recieved message from window', {\n channel: message.channel,\n payload: message.payload,\n });\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,0BAAyB;AAEzB,iBAAoB;ACFpB,IAAAA,cAAoB;ACApB,IAAAA,cAAoB;;AFOpB,IAAIC;AACJ,IAAIC;AAEJ,IAAI,OAAOC,cAAc,aAAa;AAEpC,QAAMC,SAAS,IAAIC,6BAASF,UAAUG,SAAS;AAC/CL,YAAUG,OAAOG,WAAU,EAAGC;AAC9BN,OAAKE,OAAOK,MAAK,EAAGD;AACtB;AAEA,IAAME,eAAe,CAACC,QAA2BC,QAAgBC,YAAAA;AAC/D,MAAI,CAACF,O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WAAWzB,QAAQI,OAAO,CAAA;EAC3C;EAEQ8C,gBAAgB7B,OAAwC;AAC9D,UAAMrB,UAAUqB,MAAMT;AACtBV,gBAAAA,IAAIwC,MAAM,gCAAgC;MACxCjC,SAAST,QAAQS;MACjBL,SAASJ,QAAQI;IACnB,GAAA;;;;;;EACF;AACF;",
|
|
6
|
-
"names": ["import_log", "browser", "os", "navigator", "parser", "UAParser", "userAgent", "getBrowser", "name", "getOS", "sendToIFrame", "iframe", "origin", "message", "contentWindow", "log", "postMessage", "payload", "sendToParentWindow", "window", "parent", "createIFramePort", "channel", "onOrigin", "send", "data", "length", "buffer", "slice", "byteOffset", "byteLength", "subscribe", "callback", "handler", "event", "source", "isMessageData", "undefined", "Uint8Array", "addEventListener", "removeEventListener", "createIFrame", "id", "hidden", "allow", "create", "document", "createElement", "src", "setAttribute", "body", "appendChild", "getElementById", "createWorkerPort", "port", "debug", "onmessage", "PortMuxer", "_messagePort", "_activeChannels", "Map", "_rpcPorts", "onWorkerMessage", "onWindowMessage", "options", "Error", "set", "delete", "get"]
|
|
7
|
-
}
|
package/dist/lib/node/meta.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"inputs":{"packages/core/mesh/rpc-tunnel/src/message.ts":{"bytes":523,"imports":[],"format":"esm"},"packages/core/mesh/rpc-tunnel/src/ports/iframe.ts":{"bytes":13996,"imports":[{"path":"ua-parser-js","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/mesh/rpc-tunnel/src/ports/worker.ts":{"bytes":4845,"imports":[{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/mesh/rpc-tunnel/src/ports/index.ts":{"bytes":555,"imports":[{"path":"packages/core/mesh/rpc-tunnel/src/ports/iframe.ts","kind":"import-statement","original":"./iframe"},{"path":"packages/core/mesh/rpc-tunnel/src/ports/worker.ts","kind":"import-statement","original":"./worker"}],"format":"esm"},"packages/core/mesh/rpc-tunnel/src/port-muxer.ts":{"bytes":7621,"imports":[{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/core/mesh/rpc-tunnel/src/ports/index.ts","kind":"import-statement","original":"./ports"}],"format":"esm"},"packages/core/mesh/rpc-tunnel/src/index.ts":{"bytes":643,"imports":[{"path":"packages/core/mesh/rpc-tunnel/src/message.ts","kind":"import-statement","original":"./message"},{"path":"packages/core/mesh/rpc-tunnel/src/ports/index.ts","kind":"import-statement","original":"./ports"},{"path":"packages/core/mesh/rpc-tunnel/src/port-muxer.ts","kind":"import-statement","original":"./port-muxer"}],"format":"esm"}},"outputs":{"packages/core/mesh/rpc-tunnel/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":12796},"packages/core/mesh/rpc-tunnel/dist/lib/node/index.cjs":{"imports":[{"path":"ua-parser-js","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["PortMuxer","createIFrame","createIFramePort","createWorkerPort"],"entryPoint":"packages/core/mesh/rpc-tunnel/src/index.ts","inputs":{"packages/core/mesh/rpc-tunnel/src/index.ts":{"bytesInOutput":0},"packages/core/mesh/rpc-tunnel/src/ports/iframe.ts":{"bytesInOutput":3199},"packages/core/mesh/rpc-tunnel/src/ports/index.ts":{"bytesInOutput":0},"packages/core/mesh/rpc-tunnel/src/ports/worker.ts":{"bytesInOutput":915},"packages/core/mesh/rpc-tunnel/src/port-muxer.ts":{"bytesInOutput":1853}},"bytes":6241}}}
|