@hydranium/protocol 1.0.0-next.298 → 1.0.0-next.299

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.
@@ -18,9 +18,9 @@
18
18
  * handshake through the global `postMessage` regardless of the connection it
19
19
  * was configured with, a plain string no JSON-RPC reader can parse.
20
20
  *
21
- * The global therefore carries the host protocol: the bootstrap in, failure
22
- * reports out, and whatever else the host adds for itself. A message that
23
- * belongs to a head belongs on that head's port.
21
+ * The global therefore carries the host protocol: the bootstrap in, the ready
22
+ * message and failure reports out, and whatever else the host adds for
23
+ * itself. A message that belongs to a head belongs on that head's port.
24
24
  *
25
25
  * The ports are {@link TransferredMessagePort}s, because this package compiles
26
26
  * without the DOM lib and the structural type is also what rejects a `Worker`
@@ -41,13 +41,23 @@ export interface WorkerBootstrapMessage {
41
41
  readonly ports: HeadPorts;
42
42
  }
43
43
  export declare function isWorkerBootstrapMessage(value: unknown): value is WorkerBootstrapMessage;
44
+ /**
45
+ * Discriminator of the message the worker posts on the global once every head
46
+ * is up. Until it arrives, the page takes the `Worker`'s `error` event as a
47
+ * worker that never started and ends the heads; after it, as an uncaught error
48
+ * the worker runs on from, which it reports and keeps the heads through.
49
+ */
50
+ export declare const WORKER_READY_MESSAGE_TYPE = "hydranium/ready";
51
+ export interface WorkerReadyMessage {
52
+ readonly type: typeof WORKER_READY_MESSAGE_TYPE;
53
+ }
54
+ export declare function isWorkerReadyMessage(value: unknown): value is WorkerReadyMessage;
44
55
  /**
45
56
  * Discriminator of a failure report the worker posts on the global.
46
57
  *
47
58
  * A worker has no console anyone is looking at, and the failures that matter
48
- * most reach nobody by default: an LSP notification handler that rejects has
49
- * no reply to reject, so a workspace walk that throws looks exactly like a
50
- * workspace with no documents in it.
59
+ * most reach nobody by default: a workspace walk that throws has no reply to
60
+ * reject, so it looks exactly like a workspace with no documents in it.
51
61
  */
52
62
  export declare const WORKER_ERROR_MESSAGE_TYPE = "hydranium/worker-error";
53
63
  /** The phase a failed bootstrap reports under; no head answers after it. */
@@ -1 +1 @@
1
- {"version":3,"file":"worker-handshake.d.ts","sourceRoot":"","sources":["../../src/client/worker-handshake.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAEvE,gFAAgF;AAChF,eAAO,MAAM,6BAA6B,wBAAwB,CAAC;AAEnE,qCAAqC;AACrC,MAAM,WAAW,SAAS;IACvB,QAAQ,CAAC,GAAG,EAAE,sBAAsB,CAAC;IACrC,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC;IACtC,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC;CACxC;AAED,8EAA8E;AAC9E,MAAM,WAAW,sBAAsB;IACpC,QAAQ,CAAC,IAAI,EAAE,OAAO,6BAA6B,CAAC;IACpD,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;CAC5B;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,sBAAsB,CAMxF;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,2BAA2B,CAAC;AAElE,4EAA4E;AAC5E,eAAO,MAAM,sBAAsB,cAAc,CAAC;AAElD,MAAM,WAAW,kBAAkB;IAChC,QAAQ,CAAC,IAAI,EAAE,OAAO,yBAAyB,CAAC;IAChD,wFAAwF;IACxF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,kBAAkB,CAMhF"}
1
+ {"version":3,"file":"worker-handshake.d.ts","sourceRoot":"","sources":["../../src/client/worker-handshake.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAEvE,gFAAgF;AAChF,eAAO,MAAM,6BAA6B,wBAAwB,CAAC;AAEnE,qCAAqC;AACrC,MAAM,WAAW,SAAS;IACvB,QAAQ,CAAC,GAAG,EAAE,sBAAsB,CAAC;IACrC,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC;IACtC,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC;CACxC;AAED,8EAA8E;AAC9E,MAAM,WAAW,sBAAsB;IACpC,QAAQ,CAAC,IAAI,EAAE,OAAO,6BAA6B,CAAC;IACpD,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;CAC5B;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,sBAAsB,CAMxF;AAED;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,oBAAoB,CAAC;AAE3D,MAAM,WAAW,kBAAkB;IAChC,QAAQ,CAAC,IAAI,EAAE,OAAO,yBAAyB,CAAC;CAClD;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,kBAAkB,CAEhF;AAED;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,2BAA2B,CAAC;AAElE,4EAA4E;AAC5E,eAAO,MAAM,sBAAsB,cAAc,CAAC;AAElD,MAAM,WAAW,kBAAkB;IAChC,QAAQ,CAAC,IAAI,EAAE,OAAO,yBAAyB,CAAC;IAChD,wFAAwF;IACxF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,kBAAkB,CAMhF"}
@@ -8,8 +8,9 @@
8
8
  * SPDX-License-Identifier: MIT
9
9
  ********************************************************************************/
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.WORKER_BOOTSTRAP_PHASE = exports.WORKER_ERROR_MESSAGE_TYPE = exports.WORKER_BOOTSTRAP_MESSAGE_TYPE = void 0;
11
+ exports.WORKER_BOOTSTRAP_PHASE = exports.WORKER_ERROR_MESSAGE_TYPE = exports.WORKER_READY_MESSAGE_TYPE = exports.WORKER_BOOTSTRAP_MESSAGE_TYPE = void 0;
12
12
  exports.isWorkerBootstrapMessage = isWorkerBootstrapMessage;
13
+ exports.isWorkerReadyMessage = isWorkerReadyMessage;
13
14
  exports.isWorkerErrorMessage = isWorkerErrorMessage;
14
15
  /** Discriminator of the bootstrap message a page posts on the worker global. */
15
16
  exports.WORKER_BOOTSTRAP_MESSAGE_TYPE = 'hydranium/bootstrap';
@@ -20,13 +21,22 @@ function isWorkerBootstrapMessage(value) {
20
21
  const candidate = value;
21
22
  return candidate.type === exports.WORKER_BOOTSTRAP_MESSAGE_TYPE && typeof candidate.ports === 'object' && candidate.ports !== null;
22
23
  }
24
+ /**
25
+ * Discriminator of the message the worker posts on the global once every head
26
+ * is up. Until it arrives, the page takes the `Worker`'s `error` event as a
27
+ * worker that never started and ends the heads; after it, as an uncaught error
28
+ * the worker runs on from, which it reports and keeps the heads through.
29
+ */
30
+ exports.WORKER_READY_MESSAGE_TYPE = 'hydranium/ready';
31
+ function isWorkerReadyMessage(value) {
32
+ return typeof value === 'object' && value !== null && value.type === exports.WORKER_READY_MESSAGE_TYPE;
33
+ }
23
34
  /**
24
35
  * Discriminator of a failure report the worker posts on the global.
25
36
  *
26
37
  * A worker has no console anyone is looking at, and the failures that matter
27
- * most reach nobody by default: an LSP notification handler that rejects has
28
- * no reply to reject, so a workspace walk that throws looks exactly like a
29
- * workspace with no documents in it.
38
+ * most reach nobody by default: a workspace walk that throws has no reply to
39
+ * reject, so it looks exactly like a workspace with no documents in it.
30
40
  */
31
41
  exports.WORKER_ERROR_MESSAGE_TYPE = 'hydranium/worker-error';
32
42
  /** The phase a failed bootstrap reports under; no head answers after it. */
@@ -1 +1 @@
1
- {"version":3,"file":"worker-handshake.js","sourceRoot":"","sources":["../../src/client/worker-handshake.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;AAyBlF,gFAAgF;AACnE,QAAA,6BAA6B,GAAG,qBAAqB,CAAC;AAenE,kCAAyC,KAAc;IACpD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAC/C,OAAO,KAAK,CAAC;IAChB,CAAC;IACD,MAAM,SAAS,GAAG,KAAwC,CAAC;IAC3D,OAAO,SAAS,CAAC,IAAI,KAAK,QAAA,6BAA6B,IAAI,OAAO,SAAS,CAAC,KAAK,KAAK,QAAQ,IAAI,SAAS,CAAC,KAAK,KAAK,IAAI,CAAC;AAC9H,CAAC;AAED;;;;;;;GAOG;AACU,QAAA,yBAAyB,GAAG,wBAAwB,CAAC;AAElE,4EAA4E;AAC/D,QAAA,sBAAsB,GAAG,WAAW,CAAC;AASlD,8BAAqC,KAAc;IAChD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAC/C,OAAO,KAAK,CAAC;IAChB,CAAC;IACD,MAAM,SAAS,GAAG,KAAoC,CAAC;IACvD,OAAO,SAAS,CAAC,IAAI,KAAK,QAAA,yBAAyB,IAAI,OAAO,SAAS,CAAC,KAAK,KAAK,QAAQ,IAAI,OAAO,SAAS,CAAC,OAAO,KAAK,QAAQ,CAAC;AACvI,CAAC"}
1
+ {"version":3,"file":"worker-handshake.js","sourceRoot":"","sources":["../../src/client/worker-handshake.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;AAyBlF,gFAAgF;AACnE,QAAA,6BAA6B,GAAG,qBAAqB,CAAC;AAenE,kCAAyC,KAAc;IACpD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAC/C,OAAO,KAAK,CAAC;IAChB,CAAC;IACD,MAAM,SAAS,GAAG,KAAwC,CAAC;IAC3D,OAAO,SAAS,CAAC,IAAI,KAAK,QAAA,6BAA6B,IAAI,OAAO,SAAS,CAAC,KAAK,KAAK,QAAQ,IAAI,SAAS,CAAC,KAAK,KAAK,IAAI,CAAC;AAC9H,CAAC;AAED;;;;;GAKG;AACU,QAAA,yBAAyB,GAAG,iBAAiB,CAAC;AAM3D,8BAAqC,KAAc;IAChD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAK,KAAqC,CAAC,IAAI,KAAK,QAAA,yBAAyB,CAAC;AACnI,CAAC;AAED;;;;;;GAMG;AACU,QAAA,yBAAyB,GAAG,wBAAwB,CAAC;AAElE,4EAA4E;AAC/D,QAAA,sBAAsB,GAAG,WAAW,CAAC;AASlD,8BAAqC,KAAc;IAChD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAC/C,OAAO,KAAK,CAAC;IAChB,CAAC;IACD,MAAM,SAAS,GAAG,KAAoC,CAAC;IACvD,OAAO,SAAS,CAAC,IAAI,KAAK,QAAA,yBAAyB,IAAI,OAAO,SAAS,CAAC,KAAK,KAAK,QAAQ,IAAI,OAAO,SAAS,CAAC,OAAO,KAAK,QAAQ,CAAC;AACvI,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hydranium/protocol",
3
- "version": "1.0.0-next.298",
3
+ "version": "1.0.0-next.299",
4
4
  "description": "Generic, language-agnostic types, constants, and pure utilities for the hydranium framework.",
5
5
  "keywords": [
6
6
  "hydranium",
@@ -19,9 +19,9 @@
19
19
  * handshake through the global `postMessage` regardless of the connection it
20
20
  * was configured with, a plain string no JSON-RPC reader can parse.
21
21
  *
22
- * The global therefore carries the host protocol: the bootstrap in, failure
23
- * reports out, and whatever else the host adds for itself. A message that
24
- * belongs to a head belongs on that head's port.
22
+ * The global therefore carries the host protocol: the bootstrap in, the ready
23
+ * message and failure reports out, and whatever else the host adds for
24
+ * itself. A message that belongs to a head belongs on that head's port.
25
25
  *
26
26
  * The ports are {@link TransferredMessagePort}s, because this package compiles
27
27
  * without the DOM lib and the structural type is also what rejects a `Worker`
@@ -54,13 +54,28 @@ export function isWorkerBootstrapMessage(value: unknown): value is WorkerBootstr
54
54
  return candidate.type === WORKER_BOOTSTRAP_MESSAGE_TYPE && typeof candidate.ports === 'object' && candidate.ports !== null;
55
55
  }
56
56
 
57
+ /**
58
+ * Discriminator of the message the worker posts on the global once every head
59
+ * is up. Until it arrives, the page takes the `Worker`'s `error` event as a
60
+ * worker that never started and ends the heads; after it, as an uncaught error
61
+ * the worker runs on from, which it reports and keeps the heads through.
62
+ */
63
+ export const WORKER_READY_MESSAGE_TYPE = 'hydranium/ready';
64
+
65
+ export interface WorkerReadyMessage {
66
+ readonly type: typeof WORKER_READY_MESSAGE_TYPE;
67
+ }
68
+
69
+ export function isWorkerReadyMessage(value: unknown): value is WorkerReadyMessage {
70
+ return typeof value === 'object' && value !== null && (value as Partial<WorkerReadyMessage>).type === WORKER_READY_MESSAGE_TYPE;
71
+ }
72
+
57
73
  /**
58
74
  * Discriminator of a failure report the worker posts on the global.
59
75
  *
60
76
  * A worker has no console anyone is looking at, and the failures that matter
61
- * most reach nobody by default: an LSP notification handler that rejects has
62
- * no reply to reject, so a workspace walk that throws looks exactly like a
63
- * workspace with no documents in it.
77
+ * most reach nobody by default: a workspace walk that throws has no reply to
78
+ * reject, so it looks exactly like a workspace with no documents in it.
64
79
  */
65
80
  export const WORKER_ERROR_MESSAGE_TYPE = 'hydranium/worker-error';
66
81