@hydranium/glsp-client-theia 1.0.0-next.10
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 +134 -0
- package/lib/browser/action-dispatcher.d.ts +85 -0
- package/lib/browser/action-dispatcher.d.ts.map +1 -0
- package/lib/browser/action-dispatcher.js +238 -0
- package/lib/browser/action-dispatcher.js.map +1 -0
- package/lib/browser/client-contribution.d.ts +53 -0
- package/lib/browser/client-contribution.d.ts.map +1 -0
- package/lib/browser/client-contribution.js +111 -0
- package/lib/browser/client-contribution.js.map +1 -0
- package/lib/browser/diagram-loader.d.ts +123 -0
- package/lib/browser/diagram-loader.d.ts.map +1 -0
- package/lib/browser/diagram-loader.js +153 -0
- package/lib/browser/diagram-loader.js.map +1 -0
- package/lib/browser/diagram-only-marker-manager.d.ts +28 -0
- package/lib/browser/diagram-only-marker-manager.d.ts.map +1 -0
- package/lib/browser/diagram-only-marker-manager.js +44 -0
- package/lib/browser/diagram-only-marker-manager.js.map +1 -0
- package/lib/browser/diagram-widget.d.ts +97 -0
- package/lib/browser/diagram-widget.d.ts.map +1 -0
- package/lib/browser/diagram-widget.js +172 -0
- package/lib/browser/diagram-widget.js.map +1 -0
- package/lib/browser/glsp-client-theia-module.d.ts +40 -0
- package/lib/browser/glsp-client-theia-module.d.ts.map +1 -0
- package/lib/browser/glsp-client-theia-module.js +46 -0
- package/lib/browser/glsp-client-theia-module.js.map +1 -0
- package/lib/browser/glsp-diagram-manager.d.ts +46 -0
- package/lib/browser/glsp-diagram-manager.d.ts.map +1 -0
- package/lib/browser/glsp-diagram-manager.js +66 -0
- package/lib/browser/glsp-diagram-manager.js.map +1 -0
- package/lib/browser/glsp-message-service.d.ts +59 -0
- package/lib/browser/glsp-message-service.d.ts.map +1 -0
- package/lib/browser/glsp-message-service.js +97 -0
- package/lib/browser/glsp-message-service.js.map +1 -0
- package/lib/browser/glsp-theia-frontend-module.d.ts +110 -0
- package/lib/browser/glsp-theia-frontend-module.d.ts.map +1 -0
- package/lib/browser/glsp-theia-frontend-module.js +133 -0
- package/lib/browser/glsp-theia-frontend-module.js.map +1 -0
- package/lib/browser/hidden-bounds-updater.d.ts +122 -0
- package/lib/browser/hidden-bounds-updater.d.ts.map +1 -0
- package/lib/browser/hidden-bounds-updater.js +207 -0
- package/lib/browser/hidden-bounds-updater.js.map +1 -0
- package/lib/browser/hydranium-glsp-diagram-configuration.d.ts +52 -0
- package/lib/browser/hydranium-glsp-diagram-configuration.d.ts.map +1 -0
- package/lib/browser/hydranium-glsp-diagram-configuration.js +72 -0
- package/lib/browser/hydranium-glsp-diagram-configuration.js.map +1 -0
- package/lib/browser/index.d.ts +20 -0
- package/lib/browser/index.d.ts.map +1 -0
- package/lib/browser/index.js +38 -0
- package/lib/browser/index.js.map +1 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +39 -0
- package/lib/index.js.map +1 -0
- package/lib/node/connection-container-module.d.ts +22 -0
- package/lib/node/connection-container-module.d.ts.map +1 -0
- package/lib/node/connection-container-module.js +36 -0
- package/lib/node/connection-container-module.js.map +1 -0
- package/lib/node/glsp-server-connection-handler.d.ts +49 -0
- package/lib/node/glsp-server-connection-handler.d.ts.map +1 -0
- package/lib/node/glsp-server-connection-handler.js +64 -0
- package/lib/node/glsp-server-connection-handler.js.map +1 -0
- package/lib/node/index.d.ts +11 -0
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/index.js +28 -0
- package/lib/node/index.js.map +1 -0
- package/lib/testing/bind-recorder.d.ts +67 -0
- package/lib/testing/bind-recorder.d.ts.map +1 -0
- package/lib/testing/bind-recorder.js +72 -0
- package/lib/testing/bind-recorder.js.map +1 -0
- package/lib/testing/index.d.ts +10 -0
- package/lib/testing/index.d.ts.map +1 -0
- package/lib/testing/index.js +30 -0
- package/lib/testing/index.js.map +1 -0
- package/package.json +114 -0
- package/src/browser/action-dispatcher.ts +257 -0
- package/src/browser/client-contribution.ts +100 -0
- package/src/browser/diagram-loader.ts +173 -0
- package/src/browser/diagram-only-marker-manager.ts +33 -0
- package/src/browser/diagram-widget.ts +178 -0
- package/src/browser/glsp-client-theia-module.ts +54 -0
- package/src/browser/glsp-diagram-manager.ts +67 -0
- package/src/browser/glsp-message-service.ts +90 -0
- package/src/browser/glsp-theia-frontend-module.ts +157 -0
- package/src/browser/hidden-bounds-updater.ts +212 -0
- package/src/browser/hydranium-glsp-diagram-configuration.ts +63 -0
- package/src/browser/index.ts +22 -0
- package/src/index.ts +23 -0
- package/src/node/connection-container-module.ts +34 -0
- package/src/node/glsp-server-connection-handler.ts +69 -0
- package/src/node/index.ts +12 -0
- package/src/testing/bind-recorder.ts +126 -0
- package/src/testing/index.ts +15 -0
- package/style/diagram-loading.css +67 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the MIT License which is available in the project root.
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: MIT
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
11
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.AbstractHydraniumGlspDiagramConfiguration = void 0;
|
|
18
|
+
const theia_integration_1 = require("@eclipse-glsp/theia-integration");
|
|
19
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
20
|
+
const diagram_only_marker_manager_js_1 = require("./diagram-only-marker-manager.js");
|
|
21
|
+
/**
|
|
22
|
+
* `GLSPDiagramConfiguration` base for hydranium adopters. By default GLSP
|
|
23
|
+
* validation markers propagate into Theia's Problems view (the stock
|
|
24
|
+
* `@eclipse-glsp/theia-integration` behaviour); a head that already publishes
|
|
25
|
+
* the same diagnostics over LSP suppresses that propagation by setting
|
|
26
|
+
* {@link propagateMarkersToProblemsView} to `false`.
|
|
27
|
+
*
|
|
28
|
+
* **When to suppress.** A head with a co-resident LSP that publishes its
|
|
29
|
+
* diagnostics over standard LSP `publishDiagnostics` would otherwise list each
|
|
30
|
+
* error twice: GLSP's `TheiaMarkerManager` pushes the *same* errors again under
|
|
31
|
+
* a different marker owner, and Theia shows the union across owners. The GLSP
|
|
32
|
+
* path is also open-diagram-scoped (markers clear when the diagram closes), so
|
|
33
|
+
* for such a head it cannot reproduce the LSP head's persistent, cross-file
|
|
34
|
+
* Problems entries — it is only ever a flickering duplicate. A graphical-only
|
|
35
|
+
* head (no LSP diagnostics, or markers the LSP never produces) keeps the
|
|
36
|
+
* default so its markers reach the Problems view. The on-diagram decoration is
|
|
37
|
+
* a separate client feedback path (`ApplyMarkersCommand`), unaffected either
|
|
38
|
+
* way.
|
|
39
|
+
*
|
|
40
|
+
* **How.** {@link initializeContainer} hands {@link connectTheiaMarkerManager}
|
|
41
|
+
* the Theia marker-manager factory by default; when suppression is enabled it
|
|
42
|
+
* hands a no-op {@link ExternalMarkerManager} factory instead, so the
|
|
43
|
+
* per-diagram container binds a manager that renders-but-does-not-forward and
|
|
44
|
+
* the real `TheiaMarkerManager` (with its `@postConstruct`
|
|
45
|
+
* `ProblemManager`/shell subscriptions) is never constructed.
|
|
46
|
+
*
|
|
47
|
+
* NB: this overrides `GLSPDiagramConfiguration.initializeContainer` rather than
|
|
48
|
+
* calling `super`. It mirrors the base body (context-menu + marker-manager
|
|
49
|
+
* wiring); revisit if a future `@eclipse-glsp/theia-integration` adds further
|
|
50
|
+
* setup there.
|
|
51
|
+
*/
|
|
52
|
+
let AbstractHydraniumGlspDiagramConfiguration = class AbstractHydraniumGlspDiagramConfiguration extends theia_integration_1.GLSPDiagramConfiguration {
|
|
53
|
+
/**
|
|
54
|
+
* Whether GLSP markers propagate into Theia's Problems view. `true` (the
|
|
55
|
+
* framework default) keeps the stock Theia propagation; set `false` for a
|
|
56
|
+
* head with a co-resident LSP that already publishes the same diagnostics,
|
|
57
|
+
* to render markers on the diagram only and avoid double-listing.
|
|
58
|
+
*/
|
|
59
|
+
propagateMarkersToProblemsView = true;
|
|
60
|
+
initializeContainer(container) {
|
|
61
|
+
(0, theia_integration_1.connectTheiaContextMenuService)(container, this.contextMenuServiceFactory);
|
|
62
|
+
const markerManagerFactory = this.propagateMarkersToProblemsView
|
|
63
|
+
? this.theiaMarkerManager
|
|
64
|
+
: () => new diagram_only_marker_manager_js_1.NoOpExternalMarkerManager();
|
|
65
|
+
(0, theia_integration_1.connectTheiaMarkerManager)(container, markerManagerFactory, this.diagramType);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
exports.AbstractHydraniumGlspDiagramConfiguration = AbstractHydraniumGlspDiagramConfiguration;
|
|
69
|
+
exports.AbstractHydraniumGlspDiagramConfiguration = AbstractHydraniumGlspDiagramConfiguration = __decorate([
|
|
70
|
+
(0, inversify_1.injectable)()
|
|
71
|
+
], AbstractHydraniumGlspDiagramConfiguration);
|
|
72
|
+
//# sourceMappingURL=hydranium-glsp-diagram-configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydranium-glsp-diagram-configuration.js","sourceRoot":"","sources":["../../src/browser/hydranium-glsp-diagram-configuration.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;AAGlF,uEAAsI;AACtI,4DAA0E;AAC1E,qFAA6E;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEI,IAAe,yCAAyC,GAAxD,MAAe,yCAA0C,SAAQ,4CAAwB;IAC7F;;;;;OAKG;IACO,8BAA8B,GAAG,IAAI,CAAC;IAE7B,mBAAmB,CAAC,SAAoB;QACxD,IAAA,kDAA8B,EAAC,SAAS,EAAE,IAAI,CAAC,yBAAyB,CAAC,CAAC;QAC1E,MAAM,oBAAoB,GAAG,IAAI,CAAC,8BAA8B;YAC7D,CAAC,CAAC,IAAI,CAAC,kBAAkB;YACzB,CAAC,CAAC,GAA0B,EAAE,CAAC,IAAI,0DAAyB,EAAE,CAAC;QAClE,IAAA,6CAAyB,EAAC,SAAS,EAAE,oBAAoB,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAChF,CAAC;CACH,CAAA;AAhBqB,8FAAyC;oDAAzC,yCAAyC;IAD9D,IAAA,sBAAU,GAAE;GACS,yCAAyC,CAgB9D"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
export * from './action-dispatcher';
|
|
10
|
+
export * from './client-contribution';
|
|
11
|
+
export * from './diagram-loader';
|
|
12
|
+
export * from './diagram-only-marker-manager';
|
|
13
|
+
export * from './diagram-widget';
|
|
14
|
+
export * from './glsp-client-theia-module';
|
|
15
|
+
export * from './glsp-diagram-manager';
|
|
16
|
+
export * from './glsp-message-service';
|
|
17
|
+
export * from './glsp-theia-frontend-module';
|
|
18
|
+
export * from './hidden-bounds-updater';
|
|
19
|
+
export * from './hydranium-glsp-diagram-configuration';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wCAAwC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the MIT License which is available in the project root.
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: MIT
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
17
|
+
}) : (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
o[k2] = m[k];
|
|
20
|
+
}));
|
|
21
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
22
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
// Browser-side framework primitives for GLSP-on-Theia adopters.
|
|
26
|
+
// The cross-head Output-channel logger lives in `@hydranium/client-theia/browser`.
|
|
27
|
+
__exportStar(require("./action-dispatcher"), exports);
|
|
28
|
+
__exportStar(require("./client-contribution"), exports);
|
|
29
|
+
__exportStar(require("./diagram-loader"), exports);
|
|
30
|
+
__exportStar(require("./diagram-only-marker-manager"), exports);
|
|
31
|
+
__exportStar(require("./diagram-widget"), exports);
|
|
32
|
+
__exportStar(require("./glsp-client-theia-module"), exports);
|
|
33
|
+
__exportStar(require("./glsp-diagram-manager"), exports);
|
|
34
|
+
__exportStar(require("./glsp-message-service"), exports);
|
|
35
|
+
__exportStar(require("./glsp-theia-frontend-module"), exports);
|
|
36
|
+
__exportStar(require("./hidden-bounds-updater"), exports);
|
|
37
|
+
__exportStar(require("./hydranium-glsp-diagram-configuration"), exports);
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,gEAAgE;AAChE,mFAAmF;AACnF,sDAAoC;AACpC,wDAAsC;AACtC,mDAAiC;AACjC,gEAA8C;AAC9C,mDAAiC;AACjC,6DAA2C;AAC3C,yDAAuC;AACvC,yDAAuC;AACvC,+DAA6C;AAC7C,0DAAwC;AACxC,yEAAuD"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
export * from './browser/index';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAelF,cAAc,iBAAiB,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the MIT License which is available in the project root.
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: MIT
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
17
|
+
}) : (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
o[k2] = m[k];
|
|
20
|
+
}));
|
|
21
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
22
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
// Root barrel re-exports the browser-side surface, mirroring the root entry of
|
|
26
|
+
// the package this one integrates: `@eclipse-glsp/theia-integration`'s own
|
|
27
|
+
// `main` is its browser tier, so an adopter importing the bare specifier
|
|
28
|
+
// expects the same surface here.
|
|
29
|
+
//
|
|
30
|
+
// That makes this root BROWSER-BOUND, not neutral, and not merely
|
|
31
|
+
// DOM-avoiding: the re-exported tier value-imports `@theia/workspace`'s and
|
|
32
|
+
// `@theia/output`'s browser modules, which touch `document` at module load, and
|
|
33
|
+
// its dependency graph imports stylesheets, so loading it needs a bundler with a
|
|
34
|
+
// CSS loader. It is a frontend entry and nothing else. Node-side primitives
|
|
35
|
+
// (connection-handler wiring) stay behind
|
|
36
|
+
// `@hydranium/glsp-client-theia/node` so the `@theia/core/lib/node/...`
|
|
37
|
+
// imports don't leak into a browser bundle.
|
|
38
|
+
__exportStar(require("./browser/index"), exports);
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,+EAA+E;AAC/E,2EAA2E;AAC3E,yEAAyE;AACzE,iCAAiC;AACjC,EAAE;AACF,kEAAkE;AAClE,4EAA4E;AAC5E,gFAAgF;AAChF,iFAAiF;AACjF,4EAA4E;AAC5E,0CAA0C;AAC1C,wEAAwE;AACxE,4CAA4C;AAC5C,kDAAgC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
import { ConnectionHandler } from '@theia/core';
|
|
10
|
+
import { ContainerModule, type interfaces } from '@theia/core/shared/inversify';
|
|
11
|
+
/**
|
|
12
|
+
* Creates the frontend-scoped Theia backend module that registers a GLSP
|
|
13
|
+
* `ConnectionHandler` per browser-frontend connection. Returns a ready-to-
|
|
14
|
+
* export `ContainerModule` so adopters can `export default createGlspConnectionContainerModule(MyHandler)`
|
|
15
|
+
* from their backend-module entry point.
|
|
16
|
+
*
|
|
17
|
+
* The wrapping `ContainerModule + ConnectionContainerModule.create` pattern
|
|
18
|
+
* mirrors the boilerplate every Theia GLSP adopter writes by hand; lifted so
|
|
19
|
+
* adopters declare only the handler class.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createGlspConnectionContainerModule(handlerClass: interfaces.Newable<ConnectionHandler>): ContainerModule;
|
|
22
|
+
//# sourceMappingURL=connection-container-module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection-container-module.d.ts","sourceRoot":"","sources":["../../src/node/connection-container-module.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAEhF;;;;;;;;;GASG;AACH,wBAAgB,mCAAmC,CAAC,YAAY,EAAE,UAAU,CAAC,OAAO,CAAC,iBAAiB,CAAC,GAAG,eAAe,CAUxH"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the MIT License which is available in the project root.
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: MIT
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.createGlspConnectionContainerModule = createGlspConnectionContainerModule;
|
|
12
|
+
const core_1 = require("@theia/core");
|
|
13
|
+
const connection_container_module_1 = require("@theia/core/lib/node/messaging/connection-container-module");
|
|
14
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
15
|
+
/**
|
|
16
|
+
* Creates the frontend-scoped Theia backend module that registers a GLSP
|
|
17
|
+
* `ConnectionHandler` per browser-frontend connection. Returns a ready-to-
|
|
18
|
+
* export `ContainerModule` so adopters can `export default createGlspConnectionContainerModule(MyHandler)`
|
|
19
|
+
* from their backend-module entry point.
|
|
20
|
+
*
|
|
21
|
+
* The wrapping `ContainerModule + ConnectionContainerModule.create` pattern
|
|
22
|
+
* mirrors the boilerplate every Theia GLSP adopter writes by hand; lifted so
|
|
23
|
+
* adopters declare only the handler class.
|
|
24
|
+
*/
|
|
25
|
+
function createGlspConnectionContainerModule(handlerClass) {
|
|
26
|
+
const frontendScopedConnectionModule = connection_container_module_1.ConnectionContainerModule.create(({ bind }) => {
|
|
27
|
+
bind(handlerClass).toSelf().inSingletonScope();
|
|
28
|
+
bind(core_1.ConnectionHandler)
|
|
29
|
+
.toDynamicValue(context => context.container.get(handlerClass))
|
|
30
|
+
.inSingletonScope();
|
|
31
|
+
});
|
|
32
|
+
return new inversify_1.ContainerModule(bind => {
|
|
33
|
+
bind(connection_container_module_1.ConnectionContainerModule).toConstantValue(frontendScopedConnectionModule);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=connection-container-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection-container-module.js","sourceRoot":"","sources":["../../src/node/connection-container-module.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;AAgBlF,kFAUC;AAxBD,sCAAgD;AAChD,4GAAuG;AACvG,4DAAgF;AAEhF;;;;;;;;;GASG;AACH,SAAgB,mCAAmC,CAAC,YAAmD;IACpG,MAAM,8BAA8B,GAAG,uDAAyB,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;QAClF,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;QAC/C,IAAI,CAAC,wBAAiB,CAAC;aACnB,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;aAC9D,gBAAgB,EAAE,CAAC;IAC1B,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,2BAAe,CAAC,IAAI,CAAC,EAAE;QAC/B,IAAI,CAAC,uDAAyB,CAAC,CAAC,eAAe,CAAC,8BAA8B,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
import { AbstractSocketForwardingConnectionHandler } from '@hydranium/client-theia/lib/node';
|
|
10
|
+
import { type Channel, type Disposable } from '@theia/core';
|
|
11
|
+
import type * as net from 'net';
|
|
12
|
+
/** Options for `GlspServerConnectionHandler`. The language contribution
|
|
13
|
+
* id determines the per-language servicePath that Theia routes browser-frontend
|
|
14
|
+
* connections to; the port command is the Theia/VS Code command id whose return
|
|
15
|
+
* value is the GLSP server's listening port. */
|
|
16
|
+
export interface GlspServerConnectionHandlerOptions {
|
|
17
|
+
readonly languageContributionId: string;
|
|
18
|
+
readonly portCommand: string;
|
|
19
|
+
readonly findPortTimeout?: number;
|
|
20
|
+
readonly findPortAttempts?: number;
|
|
21
|
+
readonly connectTimeoutMs?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Optional diagnostic hook called immediately after the outbound
|
|
24
|
+
* `net.Socket` to the GLSP server is created, BEFORE `socket.connect()`
|
|
25
|
+
* is invoked. Adopters use this to attach `'data'` / `'close'` listeners
|
|
26
|
+
* for byte-level observability when debugging wire-level handshake
|
|
27
|
+
* issues; attaching listeners before `connect()` is what guarantees the
|
|
28
|
+
* very first bytes are observed.
|
|
29
|
+
*/
|
|
30
|
+
readonly onSocketCreated?: (socket: net.Socket) => void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Bridges a Theia browser-frontend channel to a GLSP server's TCP socket.
|
|
34
|
+
*
|
|
35
|
+
* The port-discovery + buffer-and-replay race fix + connect orchestration live
|
|
36
|
+
* on the cross-head {@link AbstractSocketForwardingConnectionHandler} base; this
|
|
37
|
+
* subclass supplies only the GLSP specifics — the per-language servicePath
|
|
38
|
+
* (`GLSPContribution.servicePath + '/' + languageContributionId`), the port
|
|
39
|
+
* command, the log labels — and plugs in `@eclipse-glsp/theia-integration`'s
|
|
40
|
+
* `SocketConnectionForwarder` as the byte relay. Adopters with different
|
|
41
|
+
* language ids or command names subclass with a one-line `super({...})` call.
|
|
42
|
+
* Sibling of `@hydranium/data-client-theia`'s `DataServerConnectionHandler`,
|
|
43
|
+
* which subclasses the same base with its own GLSP-free forwarder.
|
|
44
|
+
*/
|
|
45
|
+
export declare class GlspServerConnectionHandler extends AbstractSocketForwardingConnectionHandler {
|
|
46
|
+
constructor(options: GlspServerConnectionHandlerOptions);
|
|
47
|
+
protected forwardToSocketConnection(clientChannel: Channel, socket: net.Socket): Disposable;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=glsp-server-connection-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-server-connection-handler.d.ts","sourceRoot":"","sources":["../../src/node/glsp-server-connection-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF,OAAO,EAAE,yCAAyC,EAAE,MAAM,kCAAkC,CAAC;AAC7F,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,KAAK,KAAK,GAAG,MAAM,KAAK,CAAC;AAEhC;;;iDAGiD;AACjD,MAAM,WAAW,kCAAkC;IAChD,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;IACxC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC;;;;;;;OAOG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,KAAK,IAAI,CAAC;CAC1D;AAED;;;;;;;;;;;;GAYG;AACH,qBACa,2BAA4B,SAAQ,yCAAyC;gBAC9D,OAAO,EAAE,kCAAkC;IAapE,SAAS,CAAC,yBAAyB,CAAC,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,UAAU;CAG7F"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the MIT License which is available in the project root.
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: MIT
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
11
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
|
+
};
|
|
16
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
17
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
18
|
+
};
|
|
19
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
20
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.GlspServerConnectionHandler = void 0;
|
|
24
|
+
const common_1 = require("@eclipse-glsp/theia-integration/lib/common");
|
|
25
|
+
const node_1 = require("@eclipse-glsp/theia-integration/lib/node");
|
|
26
|
+
const node_2 = require("@hydranium/client-theia/lib/node");
|
|
27
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
28
|
+
/**
|
|
29
|
+
* Bridges a Theia browser-frontend channel to a GLSP server's TCP socket.
|
|
30
|
+
*
|
|
31
|
+
* The port-discovery + buffer-and-replay race fix + connect orchestration live
|
|
32
|
+
* on the cross-head {@link AbstractSocketForwardingConnectionHandler} base; this
|
|
33
|
+
* subclass supplies only the GLSP specifics — the per-language servicePath
|
|
34
|
+
* (`GLSPContribution.servicePath + '/' + languageContributionId`), the port
|
|
35
|
+
* command, the log labels — and plugs in `@eclipse-glsp/theia-integration`'s
|
|
36
|
+
* `SocketConnectionForwarder` as the byte relay. Adopters with different
|
|
37
|
+
* language ids or command names subclass with a one-line `super({...})` call.
|
|
38
|
+
* Sibling of `@hydranium/data-client-theia`'s `DataServerConnectionHandler`,
|
|
39
|
+
* which subclasses the same base with its own GLSP-free forwarder.
|
|
40
|
+
*/
|
|
41
|
+
let GlspServerConnectionHandler = class GlspServerConnectionHandler extends node_2.AbstractSocketForwardingConnectionHandler {
|
|
42
|
+
constructor(options) {
|
|
43
|
+
super({
|
|
44
|
+
path: common_1.GLSPContribution.servicePath + '/' + options.languageContributionId,
|
|
45
|
+
portCommand: options.portCommand,
|
|
46
|
+
logComponent: 'GLSP',
|
|
47
|
+
serverName: 'Graphical Server',
|
|
48
|
+
findPortTimeout: options.findPortTimeout,
|
|
49
|
+
findPortAttempts: options.findPortAttempts,
|
|
50
|
+
connectTimeoutMs: options.connectTimeoutMs,
|
|
51
|
+
onSocketCreated: options.onSocketCreated
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
forwardToSocketConnection(clientChannel, socket) {
|
|
55
|
+
return new node_1.SocketConnectionForwarder(clientChannel, socket);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
exports.GlspServerConnectionHandler = GlspServerConnectionHandler;
|
|
59
|
+
exports.GlspServerConnectionHandler = GlspServerConnectionHandler = __decorate([
|
|
60
|
+
(0, inversify_1.injectable)(),
|
|
61
|
+
__param(0, (0, inversify_1.unmanaged)()),
|
|
62
|
+
__metadata("design:paramtypes", [Object])
|
|
63
|
+
], GlspServerConnectionHandler);
|
|
64
|
+
//# sourceMappingURL=glsp-server-connection-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-server-connection-handler.js","sourceRoot":"","sources":["../../src/node/glsp-server-connection-handler.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;AAElF,uEAA8E;AAC9E,mEAAqF;AACrF,2DAA6F;AAE7F,4DAAqE;AAwBrE;;;;;;;;;;;;GAYG;AAEI,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,gDAAyC;IACvF,YAAyB,OAA2C;QACjE,KAAK,CAAC;YACH,IAAI,EAAE,yBAAgB,CAAC,WAAW,GAAG,GAAG,GAAG,OAAO,CAAC,sBAAsB;YACzE,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,YAAY,EAAE,MAAM;YACpB,UAAU,EAAE,kBAAkB;YAC9B,eAAe,EAAE,OAAO,CAAC,eAAe;YACxC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;YAC1C,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;YAC1C,eAAe,EAAE,OAAO,CAAC,eAAe;SAC1C,CAAC,CAAC;IACN,CAAC;IAES,yBAAyB,CAAC,aAAsB,EAAE,MAAkB;QAC3E,OAAO,IAAI,gCAAyB,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IAC/D,CAAC;CACH,CAAA;AAjBY,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,sBAAU,GAAE;IAEG,WAAA,IAAA,qBAAS,GAAE,CAAA;;GADd,2BAA2B,CAiBvC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
export * from './connection-container-module';
|
|
10
|
+
export * from './glsp-server-connection-handler';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the MIT License which is available in the project root.
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: MIT
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
17
|
+
}) : (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
o[k2] = m[k];
|
|
20
|
+
}));
|
|
21
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
22
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
// Node-side framework primitives for GLSP-on-Theia adopters.
|
|
26
|
+
__exportStar(require("./connection-container-module"), exports);
|
|
27
|
+
__exportStar(require("./glsp-server-connection-handler"), exports);
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,6DAA6D;AAC7D,gEAA8C;AAC9C,mEAAiD"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
import type { interfaces } from 'inversify';
|
|
10
|
+
/**
|
|
11
|
+
* One captured `bind(...)` or `rebind(...)` call on a {@link BindRecorder}.
|
|
12
|
+
*
|
|
13
|
+
* `chain` holds the follow-up methods in invocation order, one string per call,
|
|
14
|
+
* rendered as `name(arg, …)`. Arguments are stringified inline so assertions
|
|
15
|
+
* can compare structure without re-resolving service identifiers.
|
|
16
|
+
*/
|
|
17
|
+
export interface BindRecorderEntry {
|
|
18
|
+
readonly kind: 'bind' | 'rebind';
|
|
19
|
+
readonly token: unknown;
|
|
20
|
+
readonly chain: string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A spy set of Inversify binding hooks that records every call and its chain.
|
|
24
|
+
* Hand them to a module-factory under test — they satisfy Inversify's
|
|
25
|
+
* `interfaces.Bind` / `interfaces.Rebind` / `interfaces.Unbind` /
|
|
26
|
+
* `interfaces.IsBound` shapes at the call site but never resolve real services.
|
|
27
|
+
*
|
|
28
|
+
* Together they match GLSP's `BindingContext`, so a factory taking the whole
|
|
29
|
+
* context is called as `factory(recorder, options)` — the recorder *is*
|
|
30
|
+
* structurally a context.
|
|
31
|
+
*
|
|
32
|
+
* Use {@link captured} to assert which tokens were touched and with what
|
|
33
|
+
* fluent chain. {@link find} is a small ergonomic helper for the common
|
|
34
|
+
* lookup pattern.
|
|
35
|
+
*/
|
|
36
|
+
export interface BindRecorder {
|
|
37
|
+
readonly bind: interfaces.Bind;
|
|
38
|
+
readonly rebind: interfaces.Rebind;
|
|
39
|
+
readonly unbind: interfaces.Unbind;
|
|
40
|
+
readonly isBound: interfaces.IsBound;
|
|
41
|
+
readonly captured: readonly BindRecorderEntry[];
|
|
42
|
+
/** Convenience lookup — returns the first entry matching both `kind` and `token`, or `undefined`. */
|
|
43
|
+
find(kind: 'bind' | 'rebind', token: unknown): BindRecorderEntry | undefined;
|
|
44
|
+
}
|
|
45
|
+
/** Options for {@link makeBindRecorder}. */
|
|
46
|
+
export interface BindRecorderOptions {
|
|
47
|
+
/**
|
|
48
|
+
* What `isBound` answers. Defaults to `true` for every token, matching
|
|
49
|
+
* production: a head registers its own module *after* the GLSP default
|
|
50
|
+
* modules, so the tokens a framework module rebinds are already bound. Pass a
|
|
51
|
+
* list to model a container where only those tokens are bound — e.g. to
|
|
52
|
+
* exercise a factory's bind-instead-of-rebind fallback.
|
|
53
|
+
*/
|
|
54
|
+
readonly boundTokens?: readonly unknown[];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Build a {@link BindRecorder} for testing Inversify module factories without a
|
|
58
|
+
* real container: hand it to the factory, then assert over {@link BindRecorder.find}.
|
|
59
|
+
*
|
|
60
|
+
* The `bind` / `rebind` functions return a chained proxy that ignores its
|
|
61
|
+
* arguments structurally but records every method invocation as a string.
|
|
62
|
+
* Stringification: functions → `<className>`, symbols → `Symbol(desc).toString()`,
|
|
63
|
+
* everything else → `String(value)`. This is enough to assert which tokens are
|
|
64
|
+
* involved without dragging real service resolution into the test.
|
|
65
|
+
*/
|
|
66
|
+
export declare function makeBindRecorder(options?: BindRecorderOptions): BindRecorder;
|
|
67
|
+
//# sourceMappingURL=bind-recorder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bind-recorder.d.ts","sourceRoot":"","sources":["../../src/testing/bind-recorder.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,YAAY;IAC1B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAChD,qGAAqG;IACrG,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,EAAE,KAAK,EAAE,OAAO,GAAG,iBAAiB,GAAG,SAAS,CAAC;CAC/E;AAED,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IACjC;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;CAC5C;AAuBD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,mBAAwB,GAAG,YAAY,CAkChF"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the MIT License which is available in the project root.
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: MIT
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.makeBindRecorder = makeBindRecorder;
|
|
12
|
+
/** Methods on Inversify's binding builder that the recorder traps verbatim. */
|
|
13
|
+
const RECORDED_CHAIN_METHODS = [
|
|
14
|
+
'toSelf',
|
|
15
|
+
'to',
|
|
16
|
+
'toService',
|
|
17
|
+
'toConstantValue',
|
|
18
|
+
'toDynamicValue',
|
|
19
|
+
'toFactory',
|
|
20
|
+
'toFunction',
|
|
21
|
+
'toAutoFactory',
|
|
22
|
+
'toProvider',
|
|
23
|
+
'inSingletonScope',
|
|
24
|
+
'inTransientScope',
|
|
25
|
+
'inRequestScope',
|
|
26
|
+
'whenTargetNamed',
|
|
27
|
+
'whenTargetTagged',
|
|
28
|
+
'whenInjectedInto',
|
|
29
|
+
'onActivation',
|
|
30
|
+
'onDeactivation'
|
|
31
|
+
];
|
|
32
|
+
/**
|
|
33
|
+
* Build a {@link BindRecorder} for testing Inversify module factories without a
|
|
34
|
+
* real container: hand it to the factory, then assert over {@link BindRecorder.find}.
|
|
35
|
+
*
|
|
36
|
+
* The `bind` / `rebind` functions return a chained proxy that ignores its
|
|
37
|
+
* arguments structurally but records every method invocation as a string.
|
|
38
|
+
* Stringification: functions → `<className>`, symbols → `Symbol(desc).toString()`,
|
|
39
|
+
* everything else → `String(value)`. This is enough to assert which tokens are
|
|
40
|
+
* involved without dragging real service resolution into the test.
|
|
41
|
+
*/
|
|
42
|
+
function makeBindRecorder(options = {}) {
|
|
43
|
+
const captured = [];
|
|
44
|
+
const stringifyArg = (value) => {
|
|
45
|
+
if (typeof value === 'function') {
|
|
46
|
+
return `<${value.name || 'fn'}>`;
|
|
47
|
+
}
|
|
48
|
+
if (typeof value === 'symbol') {
|
|
49
|
+
return value.toString();
|
|
50
|
+
}
|
|
51
|
+
return String(value);
|
|
52
|
+
};
|
|
53
|
+
const beginEntry = (kind, token) => {
|
|
54
|
+
const entry = { kind, token, chain: [] };
|
|
55
|
+
captured.push(entry);
|
|
56
|
+
const proxy = {};
|
|
57
|
+
for (const method of RECORDED_CHAIN_METHODS) {
|
|
58
|
+
proxy[method] = (...args) => {
|
|
59
|
+
entry.chain.push(`${method}(${args.map(stringifyArg).join(', ')})`);
|
|
60
|
+
return proxy;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return proxy;
|
|
64
|
+
};
|
|
65
|
+
const bind = ((token) => beginEntry('bind', token));
|
|
66
|
+
const rebind = ((token) => beginEntry('rebind', token));
|
|
67
|
+
const unbind = (() => undefined);
|
|
68
|
+
const isBound = ((token) => options.boundTokens?.includes(token) ?? true);
|
|
69
|
+
const find = (kind, token) => captured.find(entry => entry.kind === kind && entry.token === token);
|
|
70
|
+
return { bind, rebind, unbind, isBound, captured, find };
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=bind-recorder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bind-recorder.js","sourceRoot":"","sources":["../../src/testing/bind-recorder.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;AAoFlF,4CAkCC;AAjED,+EAA+E;AAC/E,MAAM,sBAAsB,GAAG;IAC5B,QAAQ;IACR,IAAI;IACJ,WAAW;IACX,iBAAiB;IACjB,gBAAgB;IAChB,WAAW;IACX,YAAY;IACZ,eAAe;IACf,YAAY;IACZ,kBAAkB;IAClB,kBAAkB;IAClB,gBAAgB;IAChB,iBAAiB;IACjB,kBAAkB;IAClB,kBAAkB;IAClB,cAAc;IACd,gBAAgB;CACT,CAAC;AAEX;;;;;;;;;GASG;AACH,SAAgB,gBAAgB,CAAC,UAA+B,EAAE;IAC/D,MAAM,QAAQ,GAAwB,EAAE,CAAC;IAEzC,MAAM,YAAY,GAAG,CAAC,KAAc,EAAU,EAAE;QAC7C,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;YAC/B,OAAO,IAAI,KAAK,CAAC,IAAI,IAAI,IAAI,GAAG,CAAC;QACpC,CAAC;QACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC3B,CAAC;QACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,CAAC,IAAuB,EAAE,KAAc,EAAW,EAAE;QACrE,MAAM,KAAK,GAAsB,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;QAC5D,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,MAAM,KAAK,GAAoD,EAAE,CAAC;QAClE,KAAK,MAAM,MAAM,IAAI,sBAAsB,EAAE,CAAC;YAC3C,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,IAAe,EAAW,EAAE;gBAC7C,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,IAAI,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACpE,OAAO,KAAK,CAAC;YAChB,CAAC,CAAC;QACL,CAAC;QACD,OAAO,KAAK,CAAC;IAChB,CAAC,CAAC;IAEF,MAAM,IAAI,GAAG,CAAC,CAAC,KAAc,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,CAAoB,CAAC;IAChF,MAAM,MAAM,GAAG,CAAC,CAAC,KAAc,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAsB,CAAC;IACtF,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,CAAC,SAAS,CAAiC,CAAC;IACjE,MAAM,OAAO,GAAG,CAAC,CAAC,KAAc,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,IAAI,CAAuB,CAAC;IACzG,MAAM,IAAI,GAAG,CAAC,IAAuB,EAAE,KAAc,EAAiC,EAAE,CACrF,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;IAExE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
export * from './bind-recorder';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAOlF,cAAc,iBAAiB,CAAC"}
|