@vscode/component-explorer-vite-plugin 0.2.1-18 → 0.2.1-180

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 CHANGED
@@ -53,3 +53,14 @@ componentExplorer({
53
53
  build: (process.env.EXPLORER_BUILD as BuildMode) ?? undefined,
54
54
  })
55
55
  ```
56
+
57
+ ## Source-linked E2E apps
58
+
59
+ The E2E apps alias the Explorer to its source tree. Their Vite configurations
60
+ deduplicate `zod` so the app and source-linked LinkRPC use the same peer instance,
61
+ rather than bundling a second copy from LinkRPC's isolated workspace.
62
+ Published Explorer packages externalize Zod and do not need this source-link setup.
63
+
64
+ The library app's `all` build includes the lazy daemon RPC client and preserves
65
+ library-mode whitespace. Its measured baseline is 841.8 KB with 10% growth
66
+ tolerance. App-mode and explorer-only size budgets remain unchanged.
@@ -1,4 +1,4 @@
1
- var __buildInfo = {"version":"0.3.0","date":"2026-04-24T13:56:01.704Z"};
1
+ var __buildInfo = {"version":"0.3.0","date":"2026-10-22T18:51:21.324Z"};
2
2
 
3
3
  export { __buildInfo as default };
4
4
  //# sourceMappingURL=_build-info.js.map
@@ -0,0 +1,4 @@
1
+ import type { ViteDevServer } from 'vite';
2
+ export declare const DAEMON_RPC_PATH = "/__explorer/daemon-rpc";
3
+ export declare function installDaemonRpcBridge(server: NonNullable<ViteDevServer['httpServer']>, pipeName: string, log: (message: string) => void): () => void;
4
+ //# sourceMappingURL=daemonRpcBridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daemonRpcBridge.d.ts","sourceRoot":"","sources":["../src/daemonRpcBridge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAM1C,eAAO,MAAM,eAAe,2BAA2B,CAAC;AAExD,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,WAAW,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,EAChD,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAC5B,MAAM,IAAI,CAyGZ"}
@@ -0,0 +1,139 @@
1
+ import net from 'node:net';
2
+ import { HeaderDelimitedTransport } from './external/linkrpc/typescript/packages/linkrpc/dist/node.js';
3
+ import { WebSocketServer } from 'ws';
4
+ import { s as runInitializeHandshake } from './external/linkrpc/typescript/packages/linkrpc/dist/chunks/webSocketTransport-Ct4OIdG9.js';
5
+
6
+ const DAEMON_RPC_PATH = '/__explorer/daemon-rpc';
7
+ function installDaemonRpcBridge(server, pipeName, log) {
8
+ const webSockets = new Set();
9
+ const pendingPipes = new Set();
10
+ const webSocketServer = new WebSocketServer({ noServer: true, maxPayload: 8 * 1024 * 1024 });
11
+ let disposed = false;
12
+ const onUpgrade = (request, socket, head) => {
13
+ let pathname;
14
+ try {
15
+ pathname = new URL(request.url ?? '', 'http://localhost').pathname;
16
+ }
17
+ catch {
18
+ return;
19
+ }
20
+ if (pathname !== DAEMON_RPC_PATH) {
21
+ return;
22
+ }
23
+ const origin = request.headers.origin;
24
+ let validOrigin = false;
25
+ try {
26
+ const parsed = new URL(origin ?? '');
27
+ validOrigin = (parsed.protocol === 'http:' || parsed.protocol === 'https:')
28
+ && parsed.host === request.headers.host;
29
+ }
30
+ catch { /* Missing or invalid origin is not a browser request. */ }
31
+ if (!validOrigin) {
32
+ socket.end('HTTP/1.1 403 Forbidden\r\nConnection: close\r\n\r\n');
33
+ return;
34
+ }
35
+ const pipe = net.createConnection(pipeName);
36
+ pendingPipes.add(pipe);
37
+ let settled = false;
38
+ const fail = (error) => {
39
+ if (settled) {
40
+ return;
41
+ }
42
+ settled = true;
43
+ pendingPipes.delete(pipe);
44
+ log(`Daemon bridge unavailable: ${error.message}`);
45
+ socket.end('HTTP/1.1 503 Service Unavailable\r\nConnection: close\r\n\r\n');
46
+ pipe.destroy();
47
+ };
48
+ pipe.once('error', fail);
49
+ pipe.once('close', () => fail(new Error('Daemon pipe closed')));
50
+ socket.once('close', () => pipe.destroy());
51
+ pipe.once('connect', () => {
52
+ let websocket;
53
+ const transport = new HeaderDelimitedTransport(pipe, pipe, () => {
54
+ if (websocket) {
55
+ websocket.close();
56
+ }
57
+ else {
58
+ fail(new Error('Daemon pipe closed during initialization'));
59
+ }
60
+ });
61
+ void runInitializeHandshake(transport, { kind: 'client' }).then(() => {
62
+ if (socket.destroyed || disposed) {
63
+ transport.dispose();
64
+ pipe.destroy();
65
+ return;
66
+ }
67
+ pendingPipes.delete(pipe);
68
+ settled = true;
69
+ pipe.off('error', fail);
70
+ pipe.off('close', fail);
71
+ webSocketServer.handleUpgrade(request, socket, head, ws => {
72
+ websocket = ws;
73
+ webSockets.add(ws);
74
+ let closed = false;
75
+ const close = () => {
76
+ if (closed) {
77
+ return;
78
+ }
79
+ closed = true;
80
+ webSockets.delete(ws);
81
+ transport.dispose();
82
+ pipe.destroy();
83
+ ws.close();
84
+ };
85
+ pipe.on('error', error => log(`Daemon bridge pipe error: ${error.message}`));
86
+ pipe.on('close', close);
87
+ ws.on('error', error => log(`Daemon bridge websocket error: ${error.message}`));
88
+ ws.on('close', close);
89
+ transport.setListener(message => {
90
+ if (ws.readyState === ws.OPEN) {
91
+ ws.send(JSON.stringify(message), error => {
92
+ if (error) {
93
+ close();
94
+ }
95
+ });
96
+ }
97
+ });
98
+ ws.on('message', (data, isBinary) => {
99
+ try {
100
+ if (isBinary) {
101
+ throw new Error('Binary messages are not supported');
102
+ }
103
+ const message = JSON.parse(data.toString());
104
+ if (!message || typeof message !== 'object' || !('jsonrpc' in message) || message.jsonrpc !== '2.0') {
105
+ throw new Error('Invalid JSON-RPC message');
106
+ }
107
+ void transport.send(message).catch(close);
108
+ }
109
+ catch {
110
+ ws.close(1003, 'Invalid JSON-RPC message');
111
+ close();
112
+ }
113
+ });
114
+ });
115
+ }).catch(error => {
116
+ fail(error instanceof Error ? error : new Error(String(error)));
117
+ transport.dispose();
118
+ });
119
+ });
120
+ };
121
+ server.on('upgrade', onUpgrade);
122
+ return () => {
123
+ if (disposed) {
124
+ return;
125
+ }
126
+ disposed = true;
127
+ server.off('upgrade', onUpgrade);
128
+ for (const pipe of pendingPipes) {
129
+ pipe.destroy();
130
+ }
131
+ for (const ws of webSockets) {
132
+ ws.terminate();
133
+ }
134
+ webSocketServer.close();
135
+ };
136
+ }
137
+
138
+ export { DAEMON_RPC_PATH, installDaemonRpcBridge };
139
+ //# sourceMappingURL=daemonRpcBridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daemonRpcBridge.js","sources":["../src/daemonRpcBridge.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAOO,MAAM,eAAe,GAAG;SAEf,sBAAsB,CACrC,MAAgD,EAChD,QAAgB,EAChB,GAA8B,EAAA;AAE9B,IAAA,MAAM,UAAU,GAAG,IAAI,GAAG,EAAa;AACvC,IAAA,MAAM,YAAY,GAAG,IAAI,GAAG,EAAc;AAC1C,IAAA,MAAM,eAAe,GAAG,IAAI,eAAe,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;IAC5F,IAAI,QAAQ,GAAG,KAAK;IAEpB,MAAM,SAAS,GAAG,CAAC,OAAwB,EAAE,MAAkB,EAAE,IAAY,KAAU;AACtF,QAAA,IAAI,QAAgB;AACpB,QAAA,IAAI;AAAE,YAAA,QAAQ,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,kBAAkB,CAAC,CAAC,QAAQ;QAAE;AAC1E,QAAA,MAAM;YAAE;QAAQ;AAChB,QAAA,IAAI,QAAQ,KAAK,eAAe,EAAE;YAAE;QAAQ;AAE5C,QAAA,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM;QACrC,IAAI,WAAW,GAAG,KAAK;AACvB,QAAA,IAAI;YACH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC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