@wendoo/bridge-app 0.2.2
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 +44 -0
- package/dist/app-bridge.d.ts +77 -0
- package/dist/app-bridge.d.ts.map +1 -0
- package/dist/app-bridge.js +205 -0
- package/dist/app-environment-host.d.ts +524 -0
- package/dist/app-environment-host.d.ts.map +1 -0
- package/dist/app-environment-host.js +1560 -0
- package/dist/brain-diagnostics.d.ts +47 -0
- package/dist/brain-diagnostics.d.ts.map +1 -0
- package/dist/brain-diagnostics.js +100 -0
- package/dist/bridge-project.d.ts +32 -0
- package/dist/bridge-project.d.ts.map +1 -0
- package/dist/bridge-project.js +69 -0
- package/dist/compilation.d.ts +145 -0
- package/dist/compilation.d.ts.map +1 -0
- package/dist/compilation.js +404 -0
- package/dist/core-extension.d.ts +10 -0
- package/dist/core-extension.d.ts.map +1 -0
- package/dist/core-extension.js +9 -0
- package/dist/embedded-extension-id-gate.d.ts +38 -0
- package/dist/embedded-extension-id-gate.d.ts.map +1 -0
- package/dist/embedded-extension-id-gate.js +55 -0
- package/dist/embedded-extension-loader.d.ts +33 -0
- package/dist/embedded-extension-loader.d.ts.map +1 -0
- package/dist/embedded-extension-loader.js +90 -0
- package/dist/embedded-extension-vite-plugin.d.ts +34 -0
- package/dist/embedded-extension-vite-plugin.d.ts.map +1 -0
- package/dist/embedded-extension-vite-plugin.js +39 -0
- package/dist/embedded-extensions.d.ts +293 -0
- package/dist/embedded-extensions.d.ts.map +1 -0
- package/dist/embedded-extensions.js +526 -0
- package/dist/extension-catalog.d.ts +243 -0
- package/dist/extension-catalog.d.ts.map +1 -0
- package/dist/extension-catalog.js +408 -0
- package/dist/extension-install-log.d.ts +54 -0
- package/dist/extension-install-log.d.ts.map +1 -0
- package/dist/extension-install-log.js +22 -0
- package/dist/extension-install.d.ts +162 -0
- package/dist/extension-install.d.ts.map +1 -0
- package/dist/extension-install.js +412 -0
- package/dist/extension-report-presenter.d.ts +40 -0
- package/dist/extension-report-presenter.d.ts.map +1 -0
- package/dist/extension-report-presenter.js +36 -0
- package/dist/fetched-extension-snapshots.d.ts +66 -0
- package/dist/fetched-extension-snapshots.d.ts.map +1 -0
- package/dist/fetched-extension-snapshots.js +137 -0
- package/dist/folder-host-session.d.ts +85 -0
- package/dist/folder-host-session.d.ts.map +1 -0
- package/dist/folder-host-session.js +210 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/library-offer.d.ts +60 -0
- package/dist/library-offer.d.ts.map +1 -0
- package/dist/library-offer.js +47 -0
- package/dist/library-uninstall-guard.d.ts +66 -0
- package/dist/library-uninstall-guard.d.ts.map +1 -0
- package/dist/library-uninstall-guard.js +103 -0
- package/dist/manifest-files.d.ts +53 -0
- package/dist/manifest-files.d.ts.map +1 -0
- package/dist/manifest-files.js +242 -0
- package/dist/node.d.ts +4 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +2 -0
- package/dist/project-file-bridge.d.ts +10 -0
- package/dist/project-file-bridge.d.ts.map +1 -0
- package/dist/project-file-bridge.js +87 -0
- package/dist/user-tile-registration.d.ts +89 -0
- package/dist/user-tile-registration.d.ts.map +1 -0
- package/dist/user-tile-registration.js +100 -0
- package/dist/vfs-asset-url-provider.d.ts +22 -0
- package/dist/vfs-asset-url-provider.d.ts.map +1 -0
- package/dist/vfs-asset-url-provider.js +52 -0
- package/dist/workspace-folder-project-store.d.ts +125 -0
- package/dist/workspace-folder-project-store.d.ts.map +1 -0
- package/dist/workspace-folder-project-store.js +400 -0
- package/package.json +103 -0
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @wendoo/bridge-app
|
|
2
|
+
|
|
3
|
+
App-side client for the Wendoo bridge.
|
|
4
|
+
|
|
5
|
+
Wraps `@wendoo/bridge-client` with app-role-specific behavior: automatic join code
|
|
6
|
+
management and the `"app"` WebSocket path. Apps that connect to the bridge should depend on
|
|
7
|
+
this package rather than using `bridge-client` directly.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { createAppBridge } from "@wendoo/bridge-app";
|
|
13
|
+
import { createCompilationFeature } from "@wendoo/bridge-app/compilation";
|
|
14
|
+
|
|
15
|
+
const bridge = createAppBridge({
|
|
16
|
+
appName: "My App",
|
|
17
|
+
bridgeUrl: "ws://localhost:6464",
|
|
18
|
+
filesystem: myProjectFileSystem,
|
|
19
|
+
features: [createCompilationFeature({ compiler })],
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
bridge.start();
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The bridge facade supports:
|
|
26
|
+
|
|
27
|
+
- `start()` / `stop()` -- lifecycle management
|
|
28
|
+
- `requestSync()` -- request a full project file sync from the VS Code extension
|
|
29
|
+
- `snapshot()` -- current connection status and join code
|
|
30
|
+
- `onStateChange(...)` / `onRemoteChange(...)` -- event subscriptions
|
|
31
|
+
|
|
32
|
+
Optional features (like compilation) attach through the `features` array and receive
|
|
33
|
+
a `AppBridgeFeatureContext` with project file access, sync hooks, and diagnostic/status
|
|
34
|
+
publication helpers.
|
|
35
|
+
|
|
36
|
+
## Install
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
npm install @wendoo/bridge-app
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## License
|
|
43
|
+
|
|
44
|
+
MIT
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { ProjectFileChange, ProjectFileSnapshot, ProjectFileSystem } from "@wendoo/app-host";
|
|
2
|
+
import type { ConnectionStatus } from "@wendoo/bridge-client";
|
|
3
|
+
import type { CompileDiagnosticEntry } from "@wendoo/bridge-protocol";
|
|
4
|
+
export type { ProjectFileSystem, ProjectFileChange, ProjectFileSnapshot };
|
|
5
|
+
/** Connection status of the underlying bridge session. */
|
|
6
|
+
export type AppBridgeState = ConnectionStatus;
|
|
7
|
+
/** A single compiler diagnostic entry surfaced through the bridge. */
|
|
8
|
+
export type DiagnosticEntry = CompileDiagnosticEntry;
|
|
9
|
+
/**
|
|
10
|
+
* App-side handle for a Wendoo bridge session. Owns the lifecycle of the
|
|
11
|
+
* underlying connection and forwards local project file edits to and from the
|
|
12
|
+
* remote peer.
|
|
13
|
+
*/
|
|
14
|
+
export interface AppBridge {
|
|
15
|
+
/** Open the bridge connection. No-op if already started. */
|
|
16
|
+
start(): void;
|
|
17
|
+
/** Close the bridge connection and release resources. */
|
|
18
|
+
stop(): void;
|
|
19
|
+
/** Request a full project file resync from the peer. */
|
|
20
|
+
requestSync(): Promise<void>;
|
|
21
|
+
/** Read the current connection state. */
|
|
22
|
+
snapshot(): AppBridgeSnapshot;
|
|
23
|
+
/** Subscribe to connection-state changes. Returns an unsubscribe function. */
|
|
24
|
+
onStateChange(listener: (state: AppBridgeState) => void): () => void;
|
|
25
|
+
/** Subscribe to project file changes pushed by the remote peer. */
|
|
26
|
+
onRemoteChange(listener: (change: ProjectFileChange) => void): () => void;
|
|
27
|
+
}
|
|
28
|
+
/** Snapshot of the bridge connection state. */
|
|
29
|
+
export interface AppBridgeSnapshot {
|
|
30
|
+
status: AppBridgeState;
|
|
31
|
+
/** Code the user pastes into the peer to bind the session, when available. */
|
|
32
|
+
joinCode?: string;
|
|
33
|
+
}
|
|
34
|
+
/** Options for {@link createAppBridge}. */
|
|
35
|
+
export interface AppBridgeOptions {
|
|
36
|
+
bridgeUrl: string;
|
|
37
|
+
filesystem: ProjectFileSystem;
|
|
38
|
+
/** Optional features attached to the bridge for the duration of each session. */
|
|
39
|
+
features?: readonly AppBridgeFeature[];
|
|
40
|
+
/** Persisted token used to rebind to a previously established session. */
|
|
41
|
+
bindingToken?: string;
|
|
42
|
+
/** Callback invoked whenever the server issues an updated binding token. */
|
|
43
|
+
onBindingTokenChange?: (token: string) => void;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Pluggable extension to {@link AppBridge}. `attach` is invoked when the bridge
|
|
47
|
+
* starts and must return a disposer that cleans up when the bridge stops.
|
|
48
|
+
*/
|
|
49
|
+
export interface AppBridgeFeature {
|
|
50
|
+
attach(context: AppBridgeFeatureContext): () => void;
|
|
51
|
+
}
|
|
52
|
+
/** Context passed to an {@link AppBridgeFeature} on attach. */
|
|
53
|
+
export interface AppBridgeFeatureContext {
|
|
54
|
+
snapshot(): AppBridgeSnapshot;
|
|
55
|
+
projectFileSnapshot(): ProjectFileSnapshot;
|
|
56
|
+
onStateChange(listener: (state: AppBridgeState) => void): () => void;
|
|
57
|
+
onRemoteChange(listener: (change: ProjectFileChange) => void): () => void;
|
|
58
|
+
/** Subscribe to full project file sync completions from the peer. */
|
|
59
|
+
onDidSync(listener: () => void): () => void;
|
|
60
|
+
/** Send the diagnostics for `file` to the peer. */
|
|
61
|
+
publishDiagnostics(file: string, diagnostics: readonly DiagnosticEntry[]): void;
|
|
62
|
+
/** Send a compile pass/fail status update for `file` to the peer. */
|
|
63
|
+
publishStatus(update: AppBridgeFeatureStatus): void;
|
|
64
|
+
}
|
|
65
|
+
/** Per-file compile status published by features through {@link AppBridgeFeatureContext}. */
|
|
66
|
+
export interface AppBridgeFeatureStatus {
|
|
67
|
+
file: string;
|
|
68
|
+
/** `true` when the file compiled with no errors. */
|
|
69
|
+
success: boolean;
|
|
70
|
+
diagnosticCount: {
|
|
71
|
+
error: number;
|
|
72
|
+
warning: number;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/** Create an {@link AppBridge}. */
|
|
76
|
+
export declare function createAppBridge(options: AppBridgeOptions): AppBridge;
|
|
77
|
+
//# sourceMappingURL=app-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-bridge.d.ts","sourceRoot":"","sources":["../src/app-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAClG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAoB,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAIxF,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAC;AAC1E,0DAA0D;AAC1D,MAAM,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAC9C,sEAAsE;AACtE,MAAM,MAAM,eAAe,GAAG,sBAAsB,CAAC;AAErD;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,4DAA4D;IAC5D,KAAK,IAAI,IAAI,CAAC;IACd,yDAAyD;IACzD,IAAI,IAAI,IAAI,CAAC;IACb,wDAAwD;IACxD,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,yCAAyC;IACzC,QAAQ,IAAI,iBAAiB,CAAC;IAC9B,8EAA8E;IAC9E,aAAa,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IACrE,mEAAmE;IACnE,cAAc,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CAC3E;AAED,+CAA+C;AAC/C,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,cAAc,CAAC;IACvB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,2CAA2C;AAC3C,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,iBAAiB,CAAC;IAC9B,iFAAiF;IACjF,QAAQ,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACvC,0EAA0E;IAC1E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAChD;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,IAAI,CAAC;CACtD;AAED,+DAA+D;AAC/D,MAAM,WAAW,uBAAuB;IACtC,QAAQ,IAAI,iBAAiB,CAAC;IAC9B,mBAAmB,IAAI,mBAAmB,CAAC;IAC3C,aAAa,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IACrE,cAAc,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAC1E,qEAAqE;IACrE,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;IAC5C,mDAAmD;IACnD,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,eAAe,EAAE,GAAG,IAAI,CAAC;IAChF,qEAAqE;IACrE,aAAa,CAAC,MAAM,EAAE,sBAAsB,GAAG,IAAI,CAAC;CACrD;AAED,6FAA6F;AAC7F,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE;QACf,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED,mCAAmC;AACnC,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAEpE"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { BridgeProject } from "./bridge-project.js";
|
|
2
|
+
import { toFileSystemNotification, toFileSystemSnapshot, toProjectFileChange } from "./project-file-bridge.js";
|
|
3
|
+
/** Create an {@link AppBridge}. */
|
|
4
|
+
export function createAppBridge(options) {
|
|
5
|
+
return new AppBridgeController(options);
|
|
6
|
+
}
|
|
7
|
+
class AppBridgeController {
|
|
8
|
+
_options;
|
|
9
|
+
_stateListeners = new Set();
|
|
10
|
+
_remoteChangeListeners = new Set();
|
|
11
|
+
_syncListeners = new Set();
|
|
12
|
+
_diagnosticVersions = new Map();
|
|
13
|
+
_featureDisposers = [];
|
|
14
|
+
_project;
|
|
15
|
+
_filesystemUnsub;
|
|
16
|
+
_projectUnsubs = [];
|
|
17
|
+
_status = "disconnected";
|
|
18
|
+
_joinCode;
|
|
19
|
+
constructor(options) {
|
|
20
|
+
this._options = options;
|
|
21
|
+
}
|
|
22
|
+
start() {
|
|
23
|
+
if (this._project) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
this.attachFeatures();
|
|
27
|
+
const project = new BridgeProject({
|
|
28
|
+
bridgeUrl: this._options.bridgeUrl,
|
|
29
|
+
initialFileSnapshot: toFileSystemSnapshot(this._options.filesystem.exportSnapshot()),
|
|
30
|
+
bindingToken: this._options.bindingToken,
|
|
31
|
+
});
|
|
32
|
+
this._project = project;
|
|
33
|
+
this._filesystemUnsub = this._options.filesystem.onLocalChange((change) => {
|
|
34
|
+
project.files.toRemote.applyNotification(toFileSystemNotification(change));
|
|
35
|
+
});
|
|
36
|
+
this._projectUnsubs = [
|
|
37
|
+
project.session.addEventListener("status", (status) => {
|
|
38
|
+
this.setStatus(status);
|
|
39
|
+
}),
|
|
40
|
+
project.session.on("session:welcome", (msg) => {
|
|
41
|
+
const token = msg.payload?.bindingToken;
|
|
42
|
+
if (token) {
|
|
43
|
+
this._options.bindingToken = token;
|
|
44
|
+
this._options.onBindingTokenChange?.(token);
|
|
45
|
+
}
|
|
46
|
+
}),
|
|
47
|
+
project.onJoinCodeChange((joinCode) => {
|
|
48
|
+
this.setJoinCode(joinCode);
|
|
49
|
+
}),
|
|
50
|
+
project.onRemoteFileChange((notification) => {
|
|
51
|
+
const change = toProjectFileChange(notification);
|
|
52
|
+
this._options.filesystem.applyRemoteChange(change);
|
|
53
|
+
this.emitRemoteChange(change);
|
|
54
|
+
}),
|
|
55
|
+
project.onDidSync(() => {
|
|
56
|
+
this.emitDidSync();
|
|
57
|
+
}),
|
|
58
|
+
];
|
|
59
|
+
project.session.start();
|
|
60
|
+
}
|
|
61
|
+
stop() {
|
|
62
|
+
const project = this._project;
|
|
63
|
+
if (!project) {
|
|
64
|
+
this.setJoinCode(undefined);
|
|
65
|
+
this.setStatus("disconnected");
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
project.session.stop();
|
|
69
|
+
this.disposeProjectBindings();
|
|
70
|
+
this._project = undefined;
|
|
71
|
+
this.setJoinCode(undefined);
|
|
72
|
+
this.disposeFeatures();
|
|
73
|
+
}
|
|
74
|
+
async requestSync() {
|
|
75
|
+
const project = this.requireProject();
|
|
76
|
+
await project.requestSync();
|
|
77
|
+
}
|
|
78
|
+
snapshot() {
|
|
79
|
+
return {
|
|
80
|
+
status: this._status,
|
|
81
|
+
joinCode: this._joinCode,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
onStateChange(listener) {
|
|
85
|
+
this._stateListeners.add(listener);
|
|
86
|
+
return () => {
|
|
87
|
+
this._stateListeners.delete(listener);
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
onRemoteChange(listener) {
|
|
91
|
+
this._remoteChangeListeners.add(listener);
|
|
92
|
+
return () => {
|
|
93
|
+
this._remoteChangeListeners.delete(listener);
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
attachFeatures() {
|
|
97
|
+
if (this._featureDisposers.length > 0) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const features = this._options.features ?? [];
|
|
101
|
+
const context = {
|
|
102
|
+
snapshot: () => this.snapshot(),
|
|
103
|
+
projectFileSnapshot: () => this._options.filesystem.exportSnapshot(),
|
|
104
|
+
onStateChange: (listener) => this.onStateChange(listener),
|
|
105
|
+
onRemoteChange: (listener) => this.onRemoteChange(listener),
|
|
106
|
+
onDidSync: (listener) => this.onDidSync(listener),
|
|
107
|
+
publishDiagnostics: (file, diagnostics) => {
|
|
108
|
+
this.publishDiagnostics(file, diagnostics);
|
|
109
|
+
},
|
|
110
|
+
publishStatus: (update) => {
|
|
111
|
+
this.publishStatus(update);
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
for (const feature of features) {
|
|
115
|
+
this._featureDisposers.push(feature.attach(context));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
disposeFeatures() {
|
|
119
|
+
for (const dispose of this._featureDisposers.splice(0)) {
|
|
120
|
+
dispose();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
onDidSync(listener) {
|
|
124
|
+
this._syncListeners.add(listener);
|
|
125
|
+
return () => {
|
|
126
|
+
this._syncListeners.delete(listener);
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
emitDidSync() {
|
|
130
|
+
for (const listener of this._syncListeners) {
|
|
131
|
+
listener();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
emitRemoteChange(change) {
|
|
135
|
+
for (const listener of this._remoteChangeListeners) {
|
|
136
|
+
listener(change);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
publishDiagnostics(file, diagnostics) {
|
|
140
|
+
const project = this._project;
|
|
141
|
+
if (!project || this._status !== "connected") {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const version = (this._diagnosticVersions.get(file) ?? 0) + 1;
|
|
145
|
+
this._diagnosticVersions.set(file, version);
|
|
146
|
+
const message = {
|
|
147
|
+
type: "compile:diagnostics",
|
|
148
|
+
payload: {
|
|
149
|
+
file,
|
|
150
|
+
version,
|
|
151
|
+
diagnostics: [...diagnostics],
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
project.session.send(message);
|
|
155
|
+
}
|
|
156
|
+
publishStatus(update) {
|
|
157
|
+
const project = this._project;
|
|
158
|
+
if (!project || this._status !== "connected") {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const message = {
|
|
162
|
+
type: "compile:status",
|
|
163
|
+
payload: {
|
|
164
|
+
file: update.file,
|
|
165
|
+
success: update.success,
|
|
166
|
+
diagnosticCount: {
|
|
167
|
+
error: update.diagnosticCount.error,
|
|
168
|
+
warning: update.diagnosticCount.warning,
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
project.session.send(message);
|
|
173
|
+
}
|
|
174
|
+
setStatus(status) {
|
|
175
|
+
if (this._status === status) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
this._status = status;
|
|
179
|
+
for (const listener of this._stateListeners) {
|
|
180
|
+
listener(status);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
setJoinCode(joinCode) {
|
|
184
|
+
if (this._joinCode === joinCode) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
this._joinCode = joinCode;
|
|
188
|
+
for (const listener of this._stateListeners) {
|
|
189
|
+
listener(this._status);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
disposeProjectBindings() {
|
|
193
|
+
this._filesystemUnsub?.();
|
|
194
|
+
this._filesystemUnsub = undefined;
|
|
195
|
+
for (const unsub of this._projectUnsubs.splice(0)) {
|
|
196
|
+
unsub();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
requireProject() {
|
|
200
|
+
if (!this._project) {
|
|
201
|
+
throw new Error("Bridge not started");
|
|
202
|
+
}
|
|
203
|
+
return this._project;
|
|
204
|
+
}
|
|
205
|
+
}
|