@eclipse-glsp-examples/workflow-server-bundled 2.8.0-next.0 → 2.8.0-next.1
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/package.json +2 -2
- package/wf-glsp-server-node.js +28 -7
- package/wf-glsp-server-node.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-glsp-examples/workflow-server-bundled",
|
|
3
|
-
"version": "2.8.0-next.
|
|
3
|
+
"version": "2.8.0-next.1+ab013b0",
|
|
4
4
|
"description": "GLSP node server for the workflow example (bundled)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eclipse",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "ab013b0c1f1fce1734182e324ea9f915d50f92a6"
|
|
53
53
|
}
|
package/wf-glsp-server-node.js
CHANGED
|
@@ -66554,15 +66554,36 @@ let ElkLayoutModule = class ElkLayoutModule extends server_1.GLSPModule {
|
|
|
66554
66554
|
}
|
|
66555
66555
|
bindElkFactory() {
|
|
66556
66556
|
const { algorithms, defaultLayoutOptions, isWebWorker } = this.options;
|
|
66557
|
-
const factory = () =>
|
|
66558
|
-
algorithms,
|
|
66559
|
-
defaultLayoutOptions,
|
|
66560
|
-
// The node implementation relies on elkjs' `FakeWorker` to set the `workerFactory`. The required file is
|
|
66561
|
-
// dynamically loaded and not available in a web-worker context, so it has to be mocked manually there.
|
|
66562
|
-
workerFactory: isWebWorker ? () => ({ postMessage: () => { } }) : undefined
|
|
66563
|
-
});
|
|
66557
|
+
const factory = () => this.createElk({ algorithms, defaultLayoutOptions }, isWebWorker);
|
|
66564
66558
|
return { constantValue: factory };
|
|
66565
66559
|
}
|
|
66560
|
+
/** Creates the underlying elkjs {@link ELK} instance, see {@link createWebWorkerElk} for the web-worker case. */
|
|
66561
|
+
createElk(options, isWebWorker) {
|
|
66562
|
+
return isWebWorker ? this.createWebWorkerElk(options) : new elk_bundled_1.default(options);
|
|
66563
|
+
}
|
|
66564
|
+
/**
|
|
66565
|
+
* Creates an {@link ELK} instance for a web-worker server. elkjs only exposes its in-process fake worker when it
|
|
66566
|
+
* doesn't detect a dedicated-worker scope (`self` present, `document` absent) — otherwise it hijacks
|
|
66567
|
+
* `self.onmessage` and layout never runs. Briefly presenting a `document` during construction flips elkjs back to
|
|
66568
|
+
* the in-process worker without touching the server's own `self.onmessage` handler.
|
|
66569
|
+
*/
|
|
66570
|
+
createWebWorkerElk(options) {
|
|
66571
|
+
const globalScope = globalThis;
|
|
66572
|
+
const hadDocument = 'document' in globalScope;
|
|
66573
|
+
const previousDocument = globalScope.document;
|
|
66574
|
+
globalScope.document = previousDocument !== null && previousDocument !== void 0 ? previousDocument : {};
|
|
66575
|
+
try {
|
|
66576
|
+
return new elk_bundled_1.default(options);
|
|
66577
|
+
}
|
|
66578
|
+
finally {
|
|
66579
|
+
if (hadDocument) {
|
|
66580
|
+
globalScope.document = previousDocument;
|
|
66581
|
+
}
|
|
66582
|
+
else {
|
|
66583
|
+
delete globalScope.document;
|
|
66584
|
+
}
|
|
66585
|
+
}
|
|
66586
|
+
}
|
|
66566
66587
|
bindGlspElkLayoutEngine() {
|
|
66567
66588
|
return {
|
|
66568
66589
|
dynamicValue: ctx => {
|