@hydranium/protocol 1.0.0-next.23 → 1.0.0-next.232
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 +40 -3
- package/lib/abstract-logger.d.ts +5 -0
- package/lib/abstract-logger.d.ts.map +1 -1
- package/lib/abstract-logger.js +7 -0
- package/lib/abstract-logger.js.map +1 -1
- package/lib/client/data-connection.d.ts +236 -0
- package/lib/client/data-connection.d.ts.map +1 -0
- package/lib/client/data-connection.js +404 -0
- package/lib/client/data-connection.js.map +1 -0
- package/lib/client/data-events.d.ts +13 -1
- package/lib/client/data-events.d.ts.map +1 -1
- package/lib/client/data-events.js +21 -0
- package/lib/client/data-events.js.map +1 -1
- package/lib/client/data-port.d.ts +27 -22
- package/lib/client/data-port.d.ts.map +1 -1
- package/lib/client/data-session.d.ts +473 -81
- package/lib/client/data-session.d.ts.map +1 -1
- package/lib/client/data-session.js +743 -108
- package/lib/client/data-session.js.map +1 -1
- package/lib/client/index.d.ts +14 -9
- package/lib/client/index.d.ts.map +1 -1
- package/lib/client/index.js +14 -9
- package/lib/client/index.js.map +1 -1
- package/lib/client/message-relay.d.ts +9 -3
- package/lib/client/message-relay.d.ts.map +1 -1
- package/lib/client/message-relay.js +11 -5
- package/lib/client/message-relay.js.map +1 -1
- package/lib/client/post-message-transport.d.ts +64 -3
- package/lib/client/post-message-transport.d.ts.map +1 -1
- package/lib/client/post-message-transport.js +175 -1
- package/lib/client/post-message-transport.js.map +1 -1
- package/lib/client/rpc-connection.d.ts +157 -0
- package/lib/client/rpc-connection.d.ts.map +1 -0
- package/lib/client/rpc-connection.js +214 -0
- package/lib/client/rpc-connection.js.map +1 -0
- package/lib/client-ids.d.ts +45 -0
- package/lib/client-ids.d.ts.map +1 -0
- package/lib/client-ids.js +48 -0
- package/lib/client-ids.js.map +1 -0
- package/lib/clock.d.ts +38 -0
- package/lib/clock.d.ts.map +1 -1
- package/lib/clock.js +36 -1
- package/lib/clock.js.map +1 -1
- package/lib/console-logger.d.ts +23 -0
- package/lib/console-logger.d.ts.map +1 -0
- package/lib/console-logger.js +39 -0
- package/lib/console-logger.js.map +1 -0
- package/lib/data/data-protocol-methods.d.ts +4 -4
- package/lib/data/data-protocol-methods.d.ts.map +1 -1
- package/lib/data/data-protocol-methods.js +12 -1
- package/lib/data/data-protocol-methods.js.map +1 -1
- package/lib/data/data-server-protocol.d.ts +132 -41
- package/lib/data/data-server-protocol.d.ts.map +1 -1
- package/lib/data/events.d.ts +117 -21
- package/lib/data/events.d.ts.map +1 -1
- package/lib/data/requests.d.ts +69 -11
- package/lib/data/requests.d.ts.map +1 -1
- package/lib/debouncer.d.ts.map +1 -1
- package/lib/debouncer.js.map +1 -1
- package/lib/errors.d.ts +187 -29
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +270 -29
- package/lib/errors.js.map +1 -1
- package/lib/glsp-request-model-args.d.ts +16 -0
- package/lib/glsp-request-model-args.d.ts.map +1 -0
- package/lib/glsp-request-model-args.js +19 -0
- package/lib/glsp-request-model-args.js.map +1 -0
- package/lib/glsp-save-model-actions.d.ts +50 -0
- package/lib/glsp-save-model-actions.d.ts.map +1 -0
- package/lib/glsp-save-model-actions.js +28 -0
- package/lib/glsp-save-model-actions.js.map +1 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +10 -0
- package/lib/index.js.map +1 -1
- package/lib/latency-collector.d.ts +8 -4
- package/lib/latency-collector.d.ts.map +1 -1
- package/lib/latency-collector.js.map +1 -1
- package/lib/logger.d.ts +22 -1
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js +31 -3
- package/lib/logger.js.map +1 -1
- package/lib/messages/index.d.ts +30 -0
- package/lib/messages/index.d.ts.map +1 -0
- package/lib/messages/index.js +62 -0
- package/lib/messages/index.js.map +1 -0
- package/lib/messages/primitives.d.ts +188 -0
- package/lib/messages/primitives.d.ts.map +1 -0
- package/lib/messages/primitives.js +161 -0
- package/lib/messages/primitives.js.map +1 -0
- package/lib/model-server.d.ts +60 -13
- package/lib/model-server.d.ts.map +1 -1
- package/lib/model-server.js +4 -2
- package/lib/model-server.js.map +1 -1
- package/lib/model-service/base-version.d.ts +64 -0
- package/lib/model-service/base-version.d.ts.map +1 -0
- package/lib/model-service/base-version.js +43 -0
- package/lib/model-service/base-version.js.map +1 -0
- package/lib/model-service/index.d.ts +1 -1
- package/lib/model-service/index.d.ts.map +1 -1
- package/lib/model-service/index.js +4 -5
- package/lib/model-service/index.js.map +1 -1
- package/lib/model-service/reference-candidate.d.ts +5 -3
- package/lib/model-service/reference-candidate.d.ts.map +1 -1
- package/lib/{model-service/args.js → node/index.d.ts} +2 -3
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/index.js +29 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/process-memory.d.ts +66 -0
- package/lib/node/process-memory.d.ts.map +1 -0
- package/lib/node/process-memory.js +291 -0
- package/lib/node/process-memory.js.map +1 -0
- package/lib/noop-logger.d.ts.map +1 -1
- package/lib/noop-logger.js.map +1 -1
- package/lib/observable-value.js.map +1 -1
- package/lib/patch-merge.d.ts +35 -32
- package/lib/patch-merge.d.ts.map +1 -1
- package/lib/patch-merge.js +67 -23
- package/lib/patch-merge.js.map +1 -1
- package/lib/profile-session.d.ts +8 -4
- package/lib/profile-session.d.ts.map +1 -1
- package/lib/profile-session.js.map +1 -1
- package/lib/random-uuid.d.ts +14 -0
- package/lib/random-uuid.d.ts.map +1 -0
- package/lib/random-uuid.js +24 -0
- package/lib/random-uuid.js.map +1 -0
- package/lib/reconcile-write.d.ts +65 -0
- package/lib/reconcile-write.d.ts.map +1 -0
- package/lib/reconcile-write.js +67 -0
- package/lib/reconcile-write.js.map +1 -0
- package/lib/rpc/bind-rpc-methods.d.ts +33 -3
- package/lib/rpc/bind-rpc-methods.d.ts.map +1 -1
- package/lib/rpc/bind-rpc-methods.js +32 -3
- package/lib/rpc/bind-rpc-methods.js.map +1 -1
- package/lib/rpc/create-rpc-proxy.d.ts +10 -0
- package/lib/rpc/create-rpc-proxy.d.ts.map +1 -1
- package/lib/rpc/create-rpc-proxy.js +12 -2
- package/lib/rpc/create-rpc-proxy.js.map +1 -1
- package/lib/rpc/index.d.ts +1 -0
- package/lib/rpc/index.d.ts.map +1 -1
- package/lib/rpc/index.js +1 -0
- package/lib/rpc/index.js.map +1 -1
- package/lib/rpc/send-by-method-name.d.ts +76 -0
- package/lib/rpc/send-by-method-name.d.ts.map +1 -0
- package/lib/rpc/send-by-method-name.js +120 -0
- package/lib/rpc/send-by-method-name.js.map +1 -0
- package/lib/rpc/wire-prefix.js.map +1 -1
- package/lib/testing/catalogue-audit.d.ts +80 -0
- package/lib/testing/catalogue-audit.d.ts.map +1 -0
- package/lib/testing/catalogue-audit.js +94 -0
- package/lib/testing/catalogue-audit.js.map +1 -0
- package/lib/testing/data-doubles.d.ts +42 -15
- package/lib/testing/data-doubles.d.ts.map +1 -1
- package/lib/testing/data-doubles.js +58 -10
- package/lib/testing/data-doubles.js.map +1 -1
- package/lib/testing/fake-clock.d.ts +9 -1
- package/lib/testing/fake-clock.d.ts.map +1 -1
- package/lib/testing/fake-clock.js +54 -45
- package/lib/testing/fake-clock.js.map +1 -1
- package/lib/testing/index.d.ts +1 -0
- package/lib/testing/index.d.ts.map +1 -1
- package/lib/testing/index.js +5 -2
- package/lib/testing/index.js.map +1 -1
- package/lib/testing/node/duplex-connection.d.ts.map +1 -1
- package/lib/testing/node/duplex-connection.js +3 -2
- package/lib/testing/node/duplex-connection.js.map +1 -1
- package/lib/testing/node/duplex-stream.js.map +1 -1
- package/lib/testing/node/index.d.ts +1 -0
- package/lib/testing/node/index.d.ts.map +1 -1
- package/lib/testing/node/index.js +2 -2
- package/lib/testing/node/index.js.map +1 -1
- package/lib/testing/node/message-port-pair.d.ts +25 -0
- package/lib/testing/node/message-port-pair.d.ts.map +1 -0
- package/lib/testing/node/message-port-pair.js +26 -0
- package/lib/testing/node/message-port-pair.js.map +1 -0
- package/lib/testing/wait-for.js.map +1 -1
- package/lib/tracer.d.ts.map +1 -1
- package/lib/tracer.js.map +1 -1
- package/lib/transfer-diagnostic.d.ts +33 -0
- package/lib/transfer-diagnostic.d.ts.map +1 -1
- package/lib/transfer-diagnostic.js +23 -0
- package/lib/transfer-diagnostic.js.map +1 -1
- package/lib/transfer-document.d.ts +70 -32
- package/lib/transfer-document.d.ts.map +1 -1
- package/lib/transfer-document.js +17 -9
- package/lib/transfer-document.js.map +1 -1
- package/lib/uri.d.ts.map +1 -1
- package/lib/uri.js.map +1 -1
- package/lib/util.d.ts +8 -0
- package/lib/util.d.ts.map +1 -1
- package/lib/util.js +32 -0
- package/lib/util.js.map +1 -1
- package/package.json +29 -37
- package/src/abstract-logger.ts +8 -0
- package/src/client/data-connection.ts +502 -0
- package/src/client/data-events.ts +33 -1
- package/src/client/data-port.ts +29 -23
- package/src/client/data-session.ts +951 -126
- package/src/client/index.ts +14 -9
- package/src/client/message-relay.ts +29 -7
- package/src/client/post-message-transport.ts +219 -4
- package/src/client/rpc-connection.ts +281 -0
- package/src/client-ids.ts +49 -0
- package/src/clock.ts +56 -0
- package/src/console-logger.ts +39 -0
- package/src/data/data-protocol-methods.ts +13 -4
- package/src/data/data-server-protocol.ts +157 -41
- package/src/data/events.ts +123 -21
- package/src/data/requests.ts +74 -11
- package/src/errors.ts +322 -36
- package/src/glsp-request-model-args.ts +16 -0
- package/src/glsp-save-model-actions.ts +59 -0
- package/src/index.ts +10 -0
- package/src/latency-collector.ts +8 -3
- package/src/logger.ts +28 -2
- package/src/messages/index.ts +37 -0
- package/src/messages/primitives.ts +271 -0
- package/src/model-server.ts +63 -18
- package/src/model-service/base-version.ts +72 -0
- package/src/model-service/index.ts +4 -5
- package/src/model-service/reference-candidate.ts +5 -3
- package/src/node/index.ts +14 -0
- package/src/node/process-memory.ts +299 -0
- package/src/patch-merge.ts +97 -42
- package/src/profile-session.ts +9 -4
- package/src/random-uuid.ts +21 -0
- package/src/reconcile-write.ts +124 -0
- package/src/rpc/README.md +4 -5
- package/src/rpc/bind-rpc-methods.ts +59 -4
- package/src/rpc/create-rpc-proxy.ts +20 -2
- package/src/rpc/index.ts +1 -0
- package/src/rpc/send-by-method-name.ts +140 -0
- package/src/testing/catalogue-audit.ts +111 -0
- package/src/testing/data-doubles.ts +145 -25
- package/src/testing/fake-clock.ts +62 -47
- package/src/testing/index.ts +5 -2
- package/src/testing/node/duplex-connection.ts +3 -2
- package/src/testing/node/index.ts +2 -2
- package/src/testing/node/message-port-pair.ts +40 -0
- package/src/transfer-diagnostic.ts +40 -0
- package/src/transfer-document.ts +87 -34
- package/src/util.ts +33 -0
- package/lib/model-service/args.d.ts +0 -64
- package/lib/model-service/args.d.ts.map +0 -1
- package/lib/model-service/args.js.map +0 -1
- package/src/model-service/args.ts +0 -67
|
@@ -25,6 +25,29 @@ var TransferDiagnostic;
|
|
|
25
25
|
return diagnostic.type === 'parsing-error';
|
|
26
26
|
}
|
|
27
27
|
TransferDiagnostic.isParseError = isParseError;
|
|
28
|
+
/**
|
|
29
|
+
* The diagnostic as a renderable message, for a surface that translates.
|
|
30
|
+
* `undefined` when it carries no framework identity — a syntactic error, an
|
|
31
|
+
* adopter's own check, a linker failure — which is the case a caller must
|
|
32
|
+
* distinguish rather than render.
|
|
33
|
+
*
|
|
34
|
+
* Hand the result to `renderFrameworkMessage` with whatever catalogue the
|
|
35
|
+
* host has loaded. The `text` is the server's English, so a code the
|
|
36
|
+
* catalogue does not carry still yields a complete sentence.
|
|
37
|
+
*
|
|
38
|
+
* `code` alone does not establish an identity: it also holds Langium's
|
|
39
|
+
* internal code and an adopter's own, and either would be looked up against a
|
|
40
|
+
* catalogue that cannot have it. Requiring `params` is what discriminates,
|
|
41
|
+
* and it is why a parameterless framework message still populates the field
|
|
42
|
+
* with an empty object rather than omitting it.
|
|
43
|
+
*/
|
|
44
|
+
function resolved(diagnostic) {
|
|
45
|
+
if (typeof diagnostic.code !== 'string' || diagnostic.params === undefined) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
return { code: diagnostic.code, params: diagnostic.params, text: diagnostic.message };
|
|
49
|
+
}
|
|
50
|
+
TransferDiagnostic.resolved = resolved;
|
|
28
51
|
function getPath(diagnostic) {
|
|
29
52
|
return diagnostic.property ? `${diagnostic.element}${TransferDiagnostic.ELEMENT_PROPERTY_SEPARATOR}${diagnostic.property}` : diagnostic.element;
|
|
30
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer-diagnostic.js","sourceRoot":"","sources":["../src/transfer-diagnostic.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;
|
|
1
|
+
{"version":3,"file":"transfer-diagnostic.js","sourceRoot":"","sources":["../src/transfer-diagnostic.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAsElF,IAAiB,kBAAkB,CAsDlC;AAtDD,WAAiB,kBAAkB;IAChC,mEAAmE;IACtD,4CAAyB,GAAG,GAAG,CAAC;IAC7C,wDAAwD;IAC3C,0CAAuB,GAAG,GAAG,CAAC;IAC3C,sFAAsF;IACzE,6CAA0B,GAAG,GAAG,CAAC;IAE9C,SAAgB,OAAO,CAAC,UAA8B;QACnD,OAAO,UAAU,CAAC,QAAQ,KAAK,OAAO,CAAC;IAC1C,CAAC;IAFe,mBAAA,OAAO,UAEtB,CAAA;IAED,SAAgB,YAAY,CAAC,UAA8B;QACxD,OAAO,UAAU,CAAC,IAAI,KAAK,eAAe,CAAC;IAC9C,CAAC;IAFe,mBAAA,YAAY,eAE3B,CAAA;IAED;;;;;;;;;;;;;;;OAeG;IACH,SAAgB,QAAQ,CAAC,UAA8B;QACpD,IAAI,OAAO,UAAU,CAAC,IAAI,KAAK,QAAQ,IAAI,UAAU,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1E,OAAO,SAAS,CAAC;QACpB,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC;IACzF,CAAC;IALe,mBAAA,QAAQ,WAKvB,CAAA;IAED,SAAgB,OAAO,CAAC,UAA8B;QACnD,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,OAAO,GAAG,6CAA0B,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC;IAChI,CAAC;IAFe,mBAAA,OAAO,UAEtB,CAAA;IAED,SAAgB,MAAM,CAAC,WAAiC;QACrD,OAAO,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAFe,mBAAA,MAAM,SAErB,CAAA;IAED,SAAgB,SAAS,CAAC,WAAiC;QACxD,OAAO,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;IAFe,mBAAA,SAAS,YAExB,CAAA;IAED,SAAgB,cAAc,CAAC,WAAiC;QAC7D,OAAO,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACzC,CAAC;IAFe,mBAAA,cAAc,iBAE7B,CAAA;AACJ,CAAC,EAtDgB,kBAAkB,aAAlB,kBAAkB,GAAlB,kBAAkB,QAsDlC"}
|
|
@@ -8,46 +8,84 @@
|
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import type { TransferDiagnostic } from './transfer-diagnostic';
|
|
10
10
|
import type { TransferElement } from './transfer-element';
|
|
11
|
+
import { type ModelVersion, type TextVersion } from './model-service/base-version';
|
|
12
|
+
/** The model a data server built for a document, encoded for the wire. */
|
|
13
|
+
export interface TransferModelSnapshot<TRoot extends TransferElement, TDiagnostic = TransferDiagnostic> {
|
|
14
|
+
root: TRoot;
|
|
15
|
+
/** Absent until the document is validated; `[]` once it is and nothing was found. */
|
|
16
|
+
diagnostics?: TDiagnostic[];
|
|
17
|
+
/**
|
|
18
|
+
* The version of the text `root` was parsed from. A caller that mutates the
|
|
19
|
+
* model sends this back as the `baseVersion` of its write, and the server
|
|
20
|
+
* rejects the write with `ConflictError` once its text has moved past it.
|
|
21
|
+
*/
|
|
22
|
+
version: ModelVersion;
|
|
23
|
+
/**
|
|
24
|
+
* The data server's fingerprint of `root` and `diagnostics`, or under its
|
|
25
|
+
* `'text-diagnostics'` strategy of the text `root` was parsed from and
|
|
26
|
+
* `diagnostics`.
|
|
27
|
+
* Independent of `version`; an equal hash also means equally validated.
|
|
28
|
+
*/
|
|
29
|
+
hash: string;
|
|
30
|
+
}
|
|
31
|
+
/** The text a data server held for a document when it sent it. */
|
|
32
|
+
export interface TextState {
|
|
33
|
+
/**
|
|
34
|
+
* The server's version of that text. A `TransferModelSnapshot.version` below it
|
|
35
|
+
* means the model was parsed from older text, and an update at this version
|
|
36
|
+
* or a later one follows.
|
|
37
|
+
*/
|
|
38
|
+
version: TextVersion;
|
|
39
|
+
/**
|
|
40
|
+
* What `textHash` makes of the text alone: equal texts hash equal whatever
|
|
41
|
+
* their version or dirty state, across a revert or a server restart that
|
|
42
|
+
* numbers versions afresh.
|
|
43
|
+
*/
|
|
44
|
+
hash: string;
|
|
45
|
+
/**
|
|
46
|
+
* Whether the text differs from the file, as the server last knew the file.
|
|
47
|
+
* A later change arrives as `onDocumentDirtyChanged` to a client watching
|
|
48
|
+
* the document.
|
|
49
|
+
*/
|
|
50
|
+
dirty: boolean;
|
|
51
|
+
}
|
|
11
52
|
/**
|
|
12
53
|
* Wire envelope exchanged between the model-server's data-server head and
|
|
13
|
-
* its clients
|
|
14
|
-
*
|
|
54
|
+
* its clients: the server's model of a document and the text it holds for it,
|
|
55
|
+
* each absent where the server has none.
|
|
15
56
|
*
|
|
16
57
|
* The constraint `TTransfer extends TransferElement` pins the type system
|
|
17
58
|
* to the wire data shape (no `$container` cycles, references as strings;
|
|
18
|
-
* see {@link TransferElement}).
|
|
19
|
-
* `AstDocument<TAst extends AstNode, TDiagnostic>` in
|
|
20
|
-
* `@hydranium/core` — same structural shape, different generic
|
|
21
|
-
* constraint, used at the AST layer before the `TransferEncoder`
|
|
22
|
-
* translation produces a {@link TransferDocument}.
|
|
59
|
+
* see {@link TransferElement}).
|
|
23
60
|
*/
|
|
24
61
|
export interface TransferDocument<TTransfer extends TransferElement, TDiagnostic = TransferDiagnostic> {
|
|
25
62
|
uri: string;
|
|
26
63
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* (or `TransferSaveArgs.baseVersion`) so the server can detect stale-based
|
|
31
|
-
* updates and reject them with `ConflictError`.
|
|
32
|
-
*
|
|
33
|
-
* See `@hydranium/protocol#errors` for the conflict-detection contract.
|
|
34
|
-
*/
|
|
35
|
-
version: number;
|
|
36
|
-
/**
|
|
37
|
-
* Absent when the document does not exist — the server answers an unknown URI
|
|
38
|
-
* with a shaped envelope rather than an error, so absence is an ordinary
|
|
39
|
-
* branch and not a catch. Declared required it reads as a guarantee, and
|
|
40
|
-
* every `root.x` compiles into a throw.
|
|
64
|
+
* Absent when the document does not exist: the server answers an unknown
|
|
65
|
+
* URI with a shaped envelope rather than an error, so absence is an
|
|
66
|
+
* ordinary branch and not a catch.
|
|
41
67
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
68
|
+
model?: TransferModelSnapshot<TTransfer, TDiagnostic>;
|
|
69
|
+
/** Absent when the server holds no text for the document. */
|
|
70
|
+
text?: TextState;
|
|
44
71
|
}
|
|
45
72
|
/**
|
|
46
|
-
* A {@link TransferDocument} the server actually had, so `
|
|
73
|
+
* A {@link TransferDocument} the server actually had, so `model` is present.
|
|
47
74
|
* Narrowed to by {@link TransferDocument.isLoaded} / {@link TransferDocument.assertLoaded}.
|
|
48
75
|
*/
|
|
49
76
|
export type LoadedTransferDocument<TTransfer extends TransferElement, TDiagnostic = TransferDiagnostic> = TransferDocument<TTransfer, TDiagnostic> & {
|
|
50
|
-
|
|
77
|
+
model: TransferModelSnapshot<TTransfer, TDiagnostic>;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* What a save or a persist answers: the document, and in `persisted` the
|
|
81
|
+
* version of the text it wrote to the file. That can differ from
|
|
82
|
+
* `model.version` either way, since writes land between the build and the
|
|
83
|
+
* take, so a client marking a version saved takes it from here.
|
|
84
|
+
*/
|
|
85
|
+
export type TransferSavedDocument<TTransfer extends TransferElement, TDiagnostic = TransferDiagnostic> = TransferDocument<TTransfer, TDiagnostic> & {
|
|
86
|
+
persisted: {
|
|
87
|
+
version: TextVersion;
|
|
88
|
+
};
|
|
51
89
|
};
|
|
52
90
|
export declare namespace TransferDocument {
|
|
53
91
|
/**
|
|
@@ -56,18 +94,18 @@ export declare namespace TransferDocument {
|
|
|
56
94
|
*/
|
|
57
95
|
function isLoaded<TTransfer extends TransferElement, TDiagnostic = TransferDiagnostic>(document: TransferDocument<TTransfer, TDiagnostic>): document is LoadedTransferDocument<TTransfer, TDiagnostic>;
|
|
58
96
|
/**
|
|
59
|
-
* The same document with `
|
|
97
|
+
* The same document with `model` no longer optional, or a throw. For call
|
|
60
98
|
* sites where absence is a bug rather than a branch; the whole envelope is
|
|
61
|
-
* returned because a caller needing `
|
|
99
|
+
* returned because a caller needing `model` usually needs `uri` or `text`
|
|
62
100
|
* with it.
|
|
63
101
|
*/
|
|
64
102
|
function assertLoaded<TTransfer extends TransferElement, TDiagnostic = TransferDiagnostic>(document: TransferDocument<TTransfer, TDiagnostic>): LoadedTransferDocument<TTransfer, TDiagnostic>;
|
|
103
|
+
/** The envelope for a document the server does not have. */
|
|
104
|
+
function absent<TTransfer extends TransferElement, TDiagnostic = TransferDiagnostic>(uri: string): TransferDocument<TTransfer, TDiagnostic>;
|
|
65
105
|
/**
|
|
66
|
-
* Construct a {@link TransferDocument} envelope
|
|
67
|
-
*
|
|
68
|
-
* "no diagnostics yet" code paths don't need to repeat the empty array
|
|
69
|
-
* at every call site.
|
|
106
|
+
* Construct a {@link TransferDocument} envelope with a model, its version
|
|
107
|
+
* marked as coming from a read. `diagnostics` absent means not validated.
|
|
70
108
|
*/
|
|
71
|
-
function create<TTransfer extends TransferElement, TDiagnostic = TransferDiagnostic>(uri: string, version: number, root: TTransfer, diagnostics?: TDiagnostic[]): TransferDocument<TTransfer, TDiagnostic>;
|
|
109
|
+
function create<TTransfer extends TransferElement, TDiagnostic = TransferDiagnostic>(uri: string, version: number, root: TTransfer, hash: string, diagnostics?: TDiagnostic[], text?: TextState): TransferDocument<TTransfer, TDiagnostic>;
|
|
72
110
|
}
|
|
73
111
|
//# sourceMappingURL=transfer-document.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer-document.d.ts","sourceRoot":"","sources":["../src/transfer-document.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"transfer-document.d.ts","sourceRoot":"","sources":["../src/transfer-document.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAkB,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEnG,0EAA0E;AAC1E,MAAM,WAAW,qBAAqB,CAAC,KAAK,SAAS,eAAe,EAAE,WAAW,GAAG,kBAAkB;IACnG,IAAI,EAAE,KAAK,CAAC;IACZ,qFAAqF;IACrF,WAAW,CAAC,EAAE,WAAW,EAAE,CAAC;IAC5B;;;;OAIG;IACH,OAAO,EAAE,YAAY,CAAC;IACtB;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;CACf;AAED,kEAAkE;AAClE,MAAM,WAAW,SAAS;IACvB;;;;OAIG;IACH,OAAO,EAAE,WAA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4D;IAC5D,SAAgB,MAAM,CAAC,SAAS,SAAS,eAAe,EAAE,WAAW,GAAG,kBAAkB,EACvF,GAAG,EAAE,MAAM,GACX,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAE1C;IAED;;;OAGG;IACH,SAAgB,MAAM,CAAC,SAAS,SAAS,eAAe,EAAE,WAAW,GAAG,kBAAkB,EACvF,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,MAAM,EACZ,WAAW,CAAC,EAAE,WAAW,EAAE,EAC3B,IAAI,CAAC,EAAE,SAAS,GAChB,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAM1C;CACH"}
|
package/lib/transfer-document.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
********************************************************************************/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.TransferDocument = void 0;
|
|
12
|
+
const base_version_1 = require("./model-service/base-version");
|
|
12
13
|
var TransferDocument;
|
|
13
14
|
(function (TransferDocument) {
|
|
14
15
|
/**
|
|
@@ -16,13 +17,13 @@ var TransferDocument;
|
|
|
16
17
|
* ordinary state — a view bound to a file that may not exist yet.
|
|
17
18
|
*/
|
|
18
19
|
function isLoaded(document) {
|
|
19
|
-
return document.
|
|
20
|
+
return document.model !== undefined;
|
|
20
21
|
}
|
|
21
22
|
TransferDocument.isLoaded = isLoaded;
|
|
22
23
|
/**
|
|
23
|
-
* The same document with `
|
|
24
|
+
* The same document with `model` no longer optional, or a throw. For call
|
|
24
25
|
* sites where absence is a bug rather than a branch; the whole envelope is
|
|
25
|
-
* returned because a caller needing `
|
|
26
|
+
* returned because a caller needing `model` usually needs `uri` or `text`
|
|
26
27
|
* with it.
|
|
27
28
|
*/
|
|
28
29
|
function assertLoaded(document) {
|
|
@@ -32,14 +33,21 @@ var TransferDocument;
|
|
|
32
33
|
return document;
|
|
33
34
|
}
|
|
34
35
|
TransferDocument.assertLoaded = assertLoaded;
|
|
36
|
+
/** The envelope for a document the server does not have. */
|
|
37
|
+
function absent(uri) {
|
|
38
|
+
return { uri };
|
|
39
|
+
}
|
|
40
|
+
TransferDocument.absent = absent;
|
|
35
41
|
/**
|
|
36
|
-
* Construct a {@link TransferDocument} envelope
|
|
37
|
-
*
|
|
38
|
-
* "no diagnostics yet" code paths don't need to repeat the empty array
|
|
39
|
-
* at every call site.
|
|
42
|
+
* Construct a {@link TransferDocument} envelope with a model, its version
|
|
43
|
+
* marked as coming from a read. `diagnostics` absent means not validated.
|
|
40
44
|
*/
|
|
41
|
-
function create(uri, version, root, diagnostics
|
|
42
|
-
return {
|
|
45
|
+
function create(uri, version, root, hash, diagnostics, text) {
|
|
46
|
+
return {
|
|
47
|
+
uri,
|
|
48
|
+
model: { root, version: (0, base_version_1.asModelVersion)(version), hash, ...(diagnostics === undefined ? {} : { diagnostics }) },
|
|
49
|
+
...(text === undefined ? {} : { text })
|
|
50
|
+
};
|
|
43
51
|
}
|
|
44
52
|
TransferDocument.create = create;
|
|
45
53
|
})(TransferDocument || (exports.TransferDocument = TransferDocument = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer-document.js","sourceRoot":"","sources":["../src/transfer-document.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;
|
|
1
|
+
{"version":3,"file":"transfer-document.js","sourceRoot":"","sources":["../src/transfer-document.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAIlF,+DAAmG;AAyFnG,IAAiB,gBAAgB,CAmDhC;AAnDD,WAAiB,gBAAgB;IAC9B;;;OAGG;IACH,SAAgB,QAAQ,CACrB,QAAkD;QAElD,OAAO,QAAQ,CAAC,KAAK,KAAK,SAAS,CAAC;IACvC,CAAC;IAJe,iBAAA,QAAQ,WAIvB,CAAA;IAED;;;;;OAKG;IACH,SAAgB,YAAY,CACzB,QAAkD;QAElD,IAAI,CAAC,QAAQ,CAAC,QAAQ,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AAE,gBAAgB,CAAA;CAAE,CAAC;AAEnF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"uri.d.ts","sourceRoot":"","sources":["../src/uri.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAA;CAAE,CAAC;AAEzE,uGAAuG;AACvG,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAA;CAAE,CAAC;AAEnF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,UAAW,MAAM,KAAG,YAAqC,CAAC;AAErF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,UAAW,MAAM,KAAG,iBAA+C,CAAC"}
|
package/lib/uri.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uri.js","sourceRoot":"","sources":["../src/uri.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAuClF;;;;;;GAMG;AACI,MAAM,cAAc,GAAG,CAAC,KAAa,EAAgB,EAAE,CAAC,KAAqB,CAAC;AAAxE,QAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"uri.js","sourceRoot":"","sources":["../src/uri.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAuClF;;;;;;GAMG;AACI,MAAM,cAAc,GAAG,CAAC,KAAa,EAAgB,EAAE,CAAC,KAAqB,CAAC;AAAxE,QAAA,cAAc,GAAd,cAAc,CAA0D;AAErF;;;;GAIG;AACI,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAqB,EAAE,CAAC,KAA0B,CAAC;AAAvF,QAAA,mBAAmB,GAAnB,mBAAmB,CAAoE"}
|
package/lib/util.d.ts
CHANGED
|
@@ -144,4 +144,12 @@ export declare function unreachable(input: never): never;
|
|
|
144
144
|
* uncertain, then narrow with a type-guard.
|
|
145
145
|
*/
|
|
146
146
|
export declare function getAt<T = unknown>(obj: unknown, path: string[]): T | undefined;
|
|
147
|
+
/**
|
|
148
|
+
* A stable, non-cryptographic digest of `text`, equal on every host for equal
|
|
149
|
+
* text: the `TextState.hash` a data server stamps, so a client can
|
|
150
|
+
* hash text of its own to compare. An array is read as its elements joined, so
|
|
151
|
+
* a large text is hashed in parts without concatenating it. It tells whether a
|
|
152
|
+
* text changed, not who could forge one.
|
|
153
|
+
*/
|
|
154
|
+
export declare function textHash(text: string | readonly string[]): string;
|
|
147
155
|
//# sourceMappingURL=util.d.ts.map
|
package/lib/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,qCAAqC;AACrC,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC;AAExD;;;;;;;;;GASG;AACH,MAAM,WAAW,UAAU;IACxB,OAAO,IAAI,IAAI,CAAC;CAClB;AAED,yBAAiB,UAAU,CAAC;IACzB,SAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,UAAU,CAEtD;IACD;;;;;;OAMG;IACI,MAAM,KAAK,EAAE,UAAwD,CAAC;CAC/E;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,oBAAqB,YAAW,UAAU;IACpD,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,UAAU,EAAE,CAAM;IAClD,SAAS,CAAC,SAAS,UAAS;IAE5B,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU;
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA;;;;;;;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AgB,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAS9E;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,MAAM,CAGjE"}
|
package/lib/util.js
CHANGED
|
@@ -20,6 +20,7 @@ exports.identity = identity;
|
|
|
20
20
|
exports.findNextUnique = findNextUnique;
|
|
21
21
|
exports.unreachable = unreachable;
|
|
22
22
|
exports.getAt = getAt;
|
|
23
|
+
exports.textHash = textHash;
|
|
23
24
|
var Disposable;
|
|
24
25
|
(function (Disposable) {
|
|
25
26
|
function create(dispose) {
|
|
@@ -208,4 +209,35 @@ function getAt(obj, path) {
|
|
|
208
209
|
}
|
|
209
210
|
return cur;
|
|
210
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* A stable, non-cryptographic digest of `text`, equal on every host for equal
|
|
214
|
+
* text: the `TextState.hash` a data server stamps, so a client can
|
|
215
|
+
* hash text of its own to compare. An array is read as its elements joined, so
|
|
216
|
+
* a large text is hashed in parts without concatenating it. It tells whether a
|
|
217
|
+
* text changed, not who could forge one.
|
|
218
|
+
*/
|
|
219
|
+
function textHash(text) {
|
|
220
|
+
const { high, low } = cyrb53(typeof text === 'string' ? [text] : text);
|
|
221
|
+
return high.toString(16).padStart(8, '0') + low.toString(16).padStart(8, '0');
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* The two 32-bit words cyrb53 ends on, each unsigned, for `parts` read as one
|
|
225
|
+
* string. It needs no `node:*` module, so every host runs it.
|
|
226
|
+
*/
|
|
227
|
+
function cyrb53(parts) {
|
|
228
|
+
let h1 = 0xdeadbeef;
|
|
229
|
+
let h2 = 0x41c6ce57;
|
|
230
|
+
for (const part of parts) {
|
|
231
|
+
for (let i = 0; i < part.length; i++) {
|
|
232
|
+
const code = part.charCodeAt(i);
|
|
233
|
+
h1 = Math.imul(h1 ^ code, 2654435761);
|
|
234
|
+
h2 = Math.imul(h2 ^ code, 1597334677);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507);
|
|
238
|
+
h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3266489909);
|
|
239
|
+
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507);
|
|
240
|
+
h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
241
|
+
return { high: h2 >>> 0, low: h1 >>> 0 };
|
|
242
|
+
}
|
|
211
243
|
//# sourceMappingURL=util.js.map
|
package/lib/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;AAmBlF,IAAiB,UAAU,CAY1B;AAZD,WAAiB,UAAU;IACxB,SAAgB,MAAM,CAAC,OAAmB;QACvC,OAAO,EAAE,OAAO,EAAE,CAAC;IACtB,CAAC;IAFe,WAAA,MAAM,SAErB,CAAA;IACD;;;;;;OAMG;IACU,gBAAK,GAAe,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC;AAChF,CAAC,EAZgB,UAAU,aAAV,UAAU,GAAV,UAAU,QAY1B;AAED;;;;;;;;;;;;;;;GAeG;AACH;IACsB,WAAW,GAAiB,EAAE,CAAC;IACxC,SAAS,GAAG,KAAK,CAAC;IAE5B,IAAI,QAAQ;QACT,OAAO,IAAI,CAAC,SAAS,CAAC;IACzB,CAAC;IAED,IAAI,CAAC,UAAsB;QACxB,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YAClB,UAAU,CAAC,OAAO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next.
|
|
3
|
+
"version": "1.0.0-next.232",
|
|
4
4
|
"description": "Generic, language-agnostic types, constants, and pure utilities for the hydranium framework.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hydranium",
|
|
@@ -14,16 +14,23 @@
|
|
|
14
14
|
"bugs": {
|
|
15
15
|
"url": "https://github.com/eclipse-emfcloud/hydranium/issues"
|
|
16
16
|
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": {
|
|
19
|
+
"name": "Hydranium Team"
|
|
20
|
+
},
|
|
17
21
|
"repository": {
|
|
18
22
|
"type": "git",
|
|
19
23
|
"url": "https://github.com/eclipse-emfcloud/hydranium.git",
|
|
20
24
|
"directory": "packages/protocol"
|
|
21
25
|
},
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
+
"files": [
|
|
27
|
+
"lib",
|
|
28
|
+
"src",
|
|
29
|
+
"!lib/**/*.tsbuildinfo"
|
|
30
|
+
],
|
|
26
31
|
"sideEffects": false,
|
|
32
|
+
"main": "lib/index.js",
|
|
33
|
+
"types": "lib/index.d.ts",
|
|
27
34
|
"exports": {
|
|
28
35
|
".": {
|
|
29
36
|
"types": "./lib/index.d.ts",
|
|
@@ -33,46 +40,34 @@
|
|
|
33
40
|
"types": "./lib/client/index.d.ts",
|
|
34
41
|
"default": "./lib/client/index.js"
|
|
35
42
|
},
|
|
36
|
-
"./lib/client": {
|
|
37
|
-
"types": "./lib/client/index.d.ts",
|
|
38
|
-
"default": "./lib/client/index.js"
|
|
39
|
-
},
|
|
40
43
|
"./data": {
|
|
41
44
|
"types": "./lib/data/index.d.ts",
|
|
42
45
|
"default": "./lib/data/index.js"
|
|
43
46
|
},
|
|
44
|
-
"./
|
|
45
|
-
"types": "./lib/
|
|
46
|
-
"default": "./lib/
|
|
47
|
-
},
|
|
48
|
-
"./testing/node": {
|
|
49
|
-
"types": "./lib/testing/node/index.d.ts",
|
|
50
|
-
"default": "./lib/testing/node/index.js"
|
|
47
|
+
"./messages": {
|
|
48
|
+
"types": "./lib/messages/index.d.ts",
|
|
49
|
+
"default": "./lib/messages/index.js"
|
|
51
50
|
},
|
|
52
|
-
"./
|
|
53
|
-
"types": "./lib/
|
|
54
|
-
"default": "./lib/
|
|
51
|
+
"./node": {
|
|
52
|
+
"types": "./lib/node/index.d.ts",
|
|
53
|
+
"default": "./lib/node/index.js"
|
|
55
54
|
},
|
|
56
|
-
"./
|
|
55
|
+
"./testing": {
|
|
57
56
|
"types": "./lib/testing/index.d.ts",
|
|
58
57
|
"default": "./lib/testing/index.js"
|
|
59
58
|
},
|
|
60
|
-
"./
|
|
59
|
+
"./testing/node": {
|
|
61
60
|
"types": "./lib/testing/node/index.d.ts",
|
|
62
61
|
"default": "./lib/testing/node/index.js"
|
|
63
62
|
}
|
|
64
63
|
},
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"lib",
|
|
69
|
-
"src",
|
|
70
|
-
"!lib/**/*.tsbuildinfo"
|
|
71
|
-
],
|
|
64
|
+
"publishConfig": {
|
|
65
|
+
"access": "public"
|
|
66
|
+
},
|
|
72
67
|
"scripts": {
|
|
73
68
|
"build": "tsc -b",
|
|
74
69
|
"clean": "rimraf lib tsconfig.tsbuildinfo",
|
|
75
|
-
"lint": "
|
|
70
|
+
"lint": "oxlint --format stylish --config ../../oxlint.config.cjs src test --max-warnings 0",
|
|
76
71
|
"prepack": "node -e \"const m=require('./package.json'),fs=require('node:fs');const missing=[m.main,...Object.values(m.bin||{})].filter(entry=>entry&&!fs.existsSync(entry));if(missing.length){console.error('prepack '+m.name+': not built ('+missing.join(', ')+' missing). Run the build before packing: a files entry that matches nothing is skipped silently, so the tarball would ship src only.');process.exit(1);}\"",
|
|
77
72
|
"test": "npm run typecheck:test && vitest run",
|
|
78
73
|
"typecheck:test": "tsc --noEmit -p tsconfig.test.json",
|
|
@@ -84,18 +79,15 @@
|
|
|
84
79
|
"devDependencies": {
|
|
85
80
|
"fast-check": "^3.23.2",
|
|
86
81
|
"rimraf": "^5.0.0",
|
|
87
|
-
"typescript": "^
|
|
88
|
-
"vscode-jsonrpc": "9.0.
|
|
82
|
+
"typescript": "^7.0.2",
|
|
83
|
+
"vscode-jsonrpc": "9.0.0"
|
|
89
84
|
},
|
|
90
85
|
"peerDependencies": {
|
|
91
|
-
"vscode-jsonrpc": "9.0.
|
|
86
|
+
"vscode-jsonrpc": "^9.0.0"
|
|
92
87
|
},
|
|
93
88
|
"engines": {
|
|
94
89
|
"node": ">=22.13"
|
|
95
90
|
},
|
|
96
|
-
"
|
|
97
|
-
|
|
98
|
-
},
|
|
99
|
-
"//peerDependencies": "`vscode-jsonrpc` is EXACT rather than a range, because it is one link of an atomic chain with no independently movable link: `vscode-languageserver-protocol` depends on it at exactly 9.0.1, so any other value an adopter supplies is a SECOND physical copy rather than an upgrade. This wire stack breaks on copy identity rather than on structure — `ParameterStructures.auto` is a singleton compared by `===` in connection.js, so a request type built by one copy and sent over a connection owned by the other throws `Unknown parameter structure auto`. A caret or union range was rejected because npm then resolves a `vscode-jsonrpc@8.2.0` tree SILENTLY, with no diagnostic at all, and the failure surfaces only later at server init. Exact does not fail the install either — npm downgrades an unsatisfiable peer to a warning — but it is a NAMED ERESOLVE warning printing the required version beside the found one, and a hard error for anyone installing with `--strict-peer-deps`. It does NOT prevent a NESTED copy — `@eclipse-glsp/*` carries its own exact `vscode-jsonrpc@8.2.0` dependency and root `overrides` do not ship — so a consumer of the GLSP head must pin the chain in its own manifest.",
|
|
100
|
-
"//prepack": "The publish guard, and it deliberately is NOT a `prepare`: npm runs a workspace `prepare` BEFORE the root `postinstall` that applies patches/vscode-jsonrpc+9.0.1.patch, so building there fails on a cold clone and npm rolls the entire install back. `prepack` runs only when a tarball is made (`npm pack`, `npm publish`) and never on install, so it cannot break the install it has no business touching. It FAILS rather than rebuilds, because the rebuild is exactly the part that ordering defeats. What it defends against: `files` lists `lib`, `lib` is gitignored, and a `files` entry matching nothing is skipped SILENTLY — so `npm publish` from an unbuilt tree emits a tarball of `src` and nothing else, with no error."
|
|
91
|
+
"//peerDependencies": "`vscode-jsonrpc` takes a caret, so the framework shares the transport the LSP connection resolves, which an `init` scaffold pins: each `vscode-languageserver-protocol` release pins its transport exactly, so an exact peer would name a copy a fresh install rarely holds. The caret excludes 8.x, so a tree whose top holds GLSP's copy fails the peer with a named ERESOLVE warning, an error under `--strict-peer-deps`, rather than resolving silently. No peer reaches a NESTED copy, such as GLSP's or one the LSP packages nest. The wire compares message types and `ResponseError`s by copy identity, so the framework sends typed messages by method name and recognises errors with `isResponseError` rather than `instanceof`.",
|
|
92
|
+
"//prepack": "The publish guard, a `prepack` rather than a `prepare`: `prepack` runs only when a tarball is made (`npm pack`, `npm publish`) and never on install, so it cannot break the install it has no business touching. What it defends against: `files` lists `lib`, `lib` is gitignored, and a `files` entry matching nothing is skipped SILENTLY — so `npm publish` from an unbuilt tree emits a tarball of `src` and nothing else, with no error."
|
|
101
93
|
}
|
package/src/abstract-logger.ts
CHANGED
|
@@ -46,6 +46,14 @@ export abstract class AbstractLogger implements Logger {
|
|
|
46
46
|
return Format.timestamp(new Date(this.clock().now()));
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
/**
|
|
50
|
+
* The `[Label - HH:MM:SS.mmm] [component]` prefix every sink starts a line
|
|
51
|
+
* with. The label is padded to the widest, so timestamps line up across sinks.
|
|
52
|
+
*/
|
|
53
|
+
protected formatLinePrefix(label: string): string {
|
|
54
|
+
return `[${label.padEnd(5)} - ${this.timestamp()}]${this.component ? ` [${this.component}]` : ''}`;
|
|
55
|
+
}
|
|
56
|
+
|
|
49
57
|
error(message?: string, ...args: unknown[]): this {
|
|
50
58
|
this.send('error', message, args);
|
|
51
59
|
return this;
|