@eclipse-glsp-examples/workflow-server-bundled-web 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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-glsp-examples/workflow-server-bundled-web",
|
|
3
|
-
"version": "2.8.0-next.
|
|
3
|
+
"version": "2.8.0-next.1+ab013b0",
|
|
4
4
|
"description": "GLSP web server for the workflow example (bundled)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eclipse",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "ab013b0c1f1fce1734182e324ea9f915d50f92a6"
|
|
47
47
|
}
|
|
@@ -45408,15 +45408,36 @@ let ElkLayoutModule = class ElkLayoutModule extends server_1.GLSPModule {
|
|
|
45408
45408
|
}
|
|
45409
45409
|
bindElkFactory() {
|
|
45410
45410
|
const { algorithms, defaultLayoutOptions, isWebWorker } = this.options;
|
|
45411
|
-
const factory = () =>
|
|
45412
|
-
algorithms,
|
|
45413
|
-
defaultLayoutOptions,
|
|
45414
|
-
// The node implementation relies on elkjs' `FakeWorker` to set the `workerFactory`. The required file is
|
|
45415
|
-
// dynamically loaded and not available in a web-worker context, so it has to be mocked manually there.
|
|
45416
|
-
workerFactory: isWebWorker ? () => ({ postMessage: () => { } }) : undefined
|
|
45417
|
-
});
|
|
45411
|
+
const factory = () => this.createElk({ algorithms, defaultLayoutOptions }, isWebWorker);
|
|
45418
45412
|
return { constantValue: factory };
|
|
45419
45413
|
}
|
|
45414
|
+
/** Creates the underlying elkjs {@link ELK} instance, see {@link createWebWorkerElk} for the web-worker case. */
|
|
45415
|
+
createElk(options, isWebWorker) {
|
|
45416
|
+
return isWebWorker ? this.createWebWorkerElk(options) : new elk_bundled_1.default(options);
|
|
45417
|
+
}
|
|
45418
|
+
/**
|
|
45419
|
+
* Creates an {@link ELK} instance for a web-worker server. elkjs only exposes its in-process fake worker when it
|
|
45420
|
+
* doesn't detect a dedicated-worker scope (`self` present, `document` absent) — otherwise it hijacks
|
|
45421
|
+
* `self.onmessage` and layout never runs. Briefly presenting a `document` during construction flips elkjs back to
|
|
45422
|
+
* the in-process worker without touching the server's own `self.onmessage` handler.
|
|
45423
|
+
*/
|
|
45424
|
+
createWebWorkerElk(options) {
|
|
45425
|
+
const globalScope = globalThis;
|
|
45426
|
+
const hadDocument = 'document' in globalScope;
|
|
45427
|
+
const previousDocument = globalScope.document;
|
|
45428
|
+
globalScope.document = previousDocument !== null && previousDocument !== void 0 ? previousDocument : {};
|
|
45429
|
+
try {
|
|
45430
|
+
return new elk_bundled_1.default(options);
|
|
45431
|
+
}
|
|
45432
|
+
finally {
|
|
45433
|
+
if (hadDocument) {
|
|
45434
|
+
globalScope.document = previousDocument;
|
|
45435
|
+
}
|
|
45436
|
+
else {
|
|
45437
|
+
delete globalScope.document;
|
|
45438
|
+
}
|
|
45439
|
+
}
|
|
45440
|
+
}
|
|
45420
45441
|
bindGlspElkLayoutEngine() {
|
|
45421
45442
|
return {
|
|
45422
45443
|
dynamicValue: ctx => {
|