@hydranium/protocol 1.0.0-next.7 → 1.0.0-next.70
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 +35 -1
- package/lib/client/data-connection.d.ts +103 -0
- package/lib/client/data-connection.d.ts.map +1 -0
- package/lib/client/data-connection.js +114 -0
- package/lib/client/data-connection.js.map +1 -0
- package/lib/client/data-events.d.ts +9 -1
- package/lib/client/data-events.d.ts.map +1 -1
- package/lib/client/data-events.js +14 -0
- package/lib/client/data-events.js.map +1 -1
- package/lib/client/data-port.d.ts +16 -21
- package/lib/client/data-port.d.ts.map +1 -1
- package/lib/client/data-session.d.ts +56 -74
- package/lib/client/data-session.d.ts.map +1 -1
- package/lib/client/data-session.js +67 -101
- package/lib/client/data-session.js.map +1 -1
- package/lib/client/index.d.ts +10 -7
- package/lib/client/index.d.ts.map +1 -1
- package/lib/client/index.js +10 -7
- package/lib/client/index.js.map +1 -1
- package/lib/client/message-relay.d.ts +8 -2
- package/lib/client/message-relay.d.ts.map +1 -1
- package/lib/client/message-relay.js +10 -4
- package/lib/client/message-relay.js.map +1 -1
- package/lib/client/rpc-connection.d.ts +131 -0
- package/lib/client/rpc-connection.d.ts.map +1 -0
- package/lib/client/rpc-connection.js +171 -0
- package/lib/client/rpc-connection.js.map +1 -0
- package/lib/client-ids.d.ts +41 -0
- package/lib/client-ids.d.ts.map +1 -0
- package/lib/client-ids.js +44 -0
- package/lib/client-ids.js.map +1 -0
- package/lib/data/data-protocol-methods.d.ts +2 -2
- package/lib/data/data-protocol-methods.d.ts.map +1 -1
- package/lib/data/data-protocol-methods.js +6 -1
- package/lib/data/data-protocol-methods.js.map +1 -1
- package/lib/data/data-server-protocol.d.ts +21 -1
- package/lib/data/data-server-protocol.d.ts.map +1 -1
- package/lib/data/events.d.ts +70 -3
- package/lib/data/events.d.ts.map +1 -1
- package/lib/errors.d.ts +25 -6
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +32 -12
- package/lib/errors.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -1
- package/lib/messages/index.d.ts +28 -0
- package/lib/messages/index.d.ts.map +1 -0
- package/lib/messages/index.js +52 -0
- package/lib/messages/index.js.map +1 -0
- package/lib/messages/primitives.d.ts +141 -0
- package/lib/messages/primitives.d.ts.map +1 -0
- package/lib/messages/primitives.js +138 -0
- package/lib/messages/primitives.js.map +1 -0
- package/lib/model-server.d.ts +2 -2
- package/lib/model-server.d.ts.map +1 -1
- package/lib/rpc/bind-rpc-methods.d.ts +29 -3
- package/lib/rpc/bind-rpc-methods.d.ts.map +1 -1
- package/lib/rpc/bind-rpc-methods.js +22 -3
- package/lib/rpc/bind-rpc-methods.js.map +1 -1
- package/lib/rpc/create-rpc-proxy.d.ts +7 -0
- package/lib/rpc/create-rpc-proxy.d.ts.map +1 -1
- package/lib/rpc/create-rpc-proxy.js +6 -1
- package/lib/rpc/create-rpc-proxy.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 +11 -12
- package/lib/testing/data-doubles.d.ts.map +1 -1
- package/lib/testing/data-doubles.js +14 -5
- package/lib/testing/data-doubles.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 +4 -1
- package/lib/testing/index.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/package.json +11 -2
- package/src/client/data-connection.ts +160 -0
- package/src/client/data-events.ts +24 -1
- package/src/client/data-port.ts +16 -22
- package/src/client/data-session.ts +86 -124
- package/src/client/index.ts +10 -7
- package/src/client/message-relay.ts +28 -6
- package/src/client/rpc-connection.ts +222 -0
- package/src/client-ids.ts +45 -0
- package/src/data/data-protocol-methods.ts +6 -3
- package/src/data/data-server-protocol.ts +29 -1
- package/src/data/events.ts +74 -3
- package/src/errors.ts +38 -14
- package/src/index.ts +5 -0
- package/src/messages/index.ts +35 -0
- package/src/messages/primitives.ts +215 -0
- package/src/model-server.ts +2 -2
- package/src/rpc/bind-rpc-methods.ts +49 -4
- package/src/rpc/create-rpc-proxy.ts +14 -1
- package/src/testing/catalogue-audit.ts +111 -0
- package/src/testing/data-doubles.ts +33 -17
- package/src/testing/index.ts +4 -1
- package/src/transfer-diagnostic.ts +40 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-rpc-proxy.js","sourceRoot":"","sources":["../../src/rpc/create-rpc-proxy.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;
|
|
1
|
+
{"version":3,"file":"create-rpc-proxy.js","sourceRoot":"","sources":["../../src/rpc/create-rpc-proxy.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;AA6JlF,sDAEC;AAwDD,wCAkFC;AAvSD,mDAA6E;AAC7E,yDAAgF;AAChF,+CAA2D;AAyI3D;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,qBAAqB,CAAC,UAAkB;IACrD,OAAO,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACtC,CAAC;AAED;;;;;GAKG;AACH,SAAS,eAAe,CAAC,QAAgB,EAAE,IAAe;IACvD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CACZ,eAAe,QAAQ,iBAAiB,IAAI,CAAC,MAAM,2DAA2D;YAC3G,uDAAuD,CAC5D,CAAC;IACL,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,SAAgB,cAAc,CAC3B,UAA0D,EAC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5D,MAAM,aAAa,GAAG,IAAI,KAAK,CAAC,gBAAgB,QAAQ,UAAU,CAAC,CAAC;gBACpE,OAAO,kBAAkB;qBACrB,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;qBAC7D,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;oBACrB,IAAI,GAAG,YAAY,KAAK,IAAI,aAAa,CAAC,KAAK,EAAE,CAAC;wBAC/C,GAAG,CAAC,KAAK,GAAG,GAAG,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,8BAA8B,aAAa,CAAC,KAAK,EAAE,CAAC;oBAC9F,CAAC;oBACD,MAAM,GAAG,CAAC;gBACb,CAAC,CAAC,CAAC;YACT,CAAC,CAAC;QACL,CAAC;KACH,CAAgB,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
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
|
+
/**
|
|
10
|
+
* Audit a translation catalogue against the codes that actually exist.
|
|
11
|
+
*
|
|
12
|
+
* **The one failure mode a catalogue has, and the only one nothing else
|
|
13
|
+
* catches.** A key naming no declared code falls back to the English — which is
|
|
14
|
+
* byte-identical to a deliberate omission, so a typo is invisible at runtime and
|
|
15
|
+
* indistinguishable from the partial-catalogue behaviour every adopter relies
|
|
16
|
+
* on. Nothing on the render path can tell them apart, `theia nls-extract`
|
|
17
|
+
* reports what the SOURCE declares rather than whether a catalogue matches it,
|
|
18
|
+
* and the framework's own gates see only the framework's own files.
|
|
19
|
+
*
|
|
20
|
+
* Shipped as test support rather than as a runtime check on purpose: an
|
|
21
|
+
* orphaned key is an authoring mistake, and failing a server boot over one would
|
|
22
|
+
* take a running product down for a cosmetic defect.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Flatten a nested catalogue into the `/`-joined keys a message code is spelled
|
|
26
|
+
* with, dropping `_`-prefixed keys as notes to a human reader.
|
|
27
|
+
*
|
|
28
|
+
* Nesting is a HOST convention, not the framework's: Theia flattens a nested
|
|
29
|
+
* catalogue by joining keys with `/`, which is the separator a code already
|
|
30
|
+
* uses, so an adopter on that host writes the file nested and one handed
|
|
31
|
+
* straight to a `DefaultMessageRenderer` writes it flat. Both end up here.
|
|
32
|
+
*
|
|
33
|
+
* `_`-prefixed keys are dropped by PREFIX rather than by matching one literal
|
|
34
|
+
* name, so a second note added to a file cannot silently become a catalogue
|
|
35
|
+
* entry. A code is three `/`-separated segments, so no real entry can begin
|
|
36
|
+
* with `_`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function flattenCatalogue(catalogue: Record<string, unknown>, prefix?: string): Record<string, string>;
|
|
39
|
+
/** Options for {@link findUndeclaredCodes}. */
|
|
40
|
+
export interface CatalogueAuditOptions {
|
|
41
|
+
/**
|
|
42
|
+
* Key prefixes to skip, for entries whose codes are NOT declared through a
|
|
43
|
+
* `defineMessage` barrel.
|
|
44
|
+
*
|
|
45
|
+
* The real case is a host's own mechanism: Theia's `nls.localize` takes its
|
|
46
|
+
* key as an inline literal at the call site, so those keys exist only in
|
|
47
|
+
* source text and no barrel can enumerate them. Keep this as narrow as the
|
|
48
|
+
* host layer actually is — exempting a namespace is exempting every typo in
|
|
49
|
+
* it, which is what this function exists to find.
|
|
50
|
+
*/
|
|
51
|
+
readonly exemptPrefixes?: readonly string[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Every catalogue key that names no code any of `barrels` declares.
|
|
55
|
+
*
|
|
56
|
+
* Barrels are taken as opaque objects and read with {@link collectMessages},
|
|
57
|
+
* which is what lets a caller pass a `import * as messages` namespace directly:
|
|
58
|
+
* a barrel's value type is a union of its declarations AND its functions, and
|
|
59
|
+
* filtering that union will not narrow to a `MessageDefinition`.
|
|
60
|
+
*
|
|
61
|
+
* Returns the offending keys rather than a boolean, so a failing assertion names
|
|
62
|
+
* WHICH key is wrong — a count says only that something is.
|
|
63
|
+
*/
|
|
64
|
+
export declare function findUndeclaredCodes(catalogueKeys: readonly string[], barrels: readonly object[], options?: CatalogueAuditOptions): string[];
|
|
65
|
+
/**
|
|
66
|
+
* Keys present in more than one catalogue — the shape a split catalogue rots
|
|
67
|
+
* into.
|
|
68
|
+
*
|
|
69
|
+
* Exactly one side renders a given message, so two catalogues holding one code
|
|
70
|
+
* are two authorities over one sentence and they diverge on the first reword.
|
|
71
|
+
* Nothing at runtime notices: both sides render, and whichever ran last wins on
|
|
72
|
+
* its own surface.
|
|
73
|
+
*
|
|
74
|
+
* Takes the key sets rather than a boolean answer for the same reason as
|
|
75
|
+
* {@link findUndeclaredCodes}, and reports NOTHING when a set is empty — an
|
|
76
|
+
* empty catalogue shares no key with anything, so a caller must assert
|
|
77
|
+
* non-emptiness separately or a failed read passes this vacuously.
|
|
78
|
+
*/
|
|
79
|
+
export declare function findSharedCodes(first: readonly string[], second: readonly string[]): string[];
|
|
80
|
+
//# sourceMappingURL=catalogue-audit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalogue-audit.d.ts","sourceRoot":"","sources":["../../src/testing/catalogue-audit.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,SAAK,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAcxG;AAED,+CAA+C;AAC/C,MAAM,WAAW,qBAAqB;IACnC;;;;;;;;;OASG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAChC,aAAa,EAAE,SAAS,MAAM,EAAE,EAChC,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,OAAO,GAAE,qBAA0B,GACnC,MAAM,EAAE,CAIV;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAG7F"}
|
|
@@ -0,0 +1,94 @@
|
|
|
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.flattenCatalogue = flattenCatalogue;
|
|
12
|
+
exports.findUndeclaredCodes = findUndeclaredCodes;
|
|
13
|
+
exports.findSharedCodes = findSharedCodes;
|
|
14
|
+
const primitives_1 = require("../messages/primitives");
|
|
15
|
+
/**
|
|
16
|
+
* Audit a translation catalogue against the codes that actually exist.
|
|
17
|
+
*
|
|
18
|
+
* **The one failure mode a catalogue has, and the only one nothing else
|
|
19
|
+
* catches.** A key naming no declared code falls back to the English — which is
|
|
20
|
+
* byte-identical to a deliberate omission, so a typo is invisible at runtime and
|
|
21
|
+
* indistinguishable from the partial-catalogue behaviour every adopter relies
|
|
22
|
+
* on. Nothing on the render path can tell them apart, `theia nls-extract`
|
|
23
|
+
* reports what the SOURCE declares rather than whether a catalogue matches it,
|
|
24
|
+
* and the framework's own gates see only the framework's own files.
|
|
25
|
+
*
|
|
26
|
+
* Shipped as test support rather than as a runtime check on purpose: an
|
|
27
|
+
* orphaned key is an authoring mistake, and failing a server boot over one would
|
|
28
|
+
* take a running product down for a cosmetic defect.
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Flatten a nested catalogue into the `/`-joined keys a message code is spelled
|
|
32
|
+
* with, dropping `_`-prefixed keys as notes to a human reader.
|
|
33
|
+
*
|
|
34
|
+
* Nesting is a HOST convention, not the framework's: Theia flattens a nested
|
|
35
|
+
* catalogue by joining keys with `/`, which is the separator a code already
|
|
36
|
+
* uses, so an adopter on that host writes the file nested and one handed
|
|
37
|
+
* straight to a `DefaultMessageRenderer` writes it flat. Both end up here.
|
|
38
|
+
*
|
|
39
|
+
* `_`-prefixed keys are dropped by PREFIX rather than by matching one literal
|
|
40
|
+
* name, so a second note added to a file cannot silently become a catalogue
|
|
41
|
+
* entry. A code is three `/`-separated segments, so no real entry can begin
|
|
42
|
+
* with `_`.
|
|
43
|
+
*/
|
|
44
|
+
function flattenCatalogue(catalogue, prefix = '') {
|
|
45
|
+
const flat = {};
|
|
46
|
+
for (const [key, value] of Object.entries(catalogue)) {
|
|
47
|
+
if (key.startsWith('_')) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
const joined = prefix ? `${prefix}/${key}` : key;
|
|
51
|
+
if (typeof value === 'string') {
|
|
52
|
+
flat[joined] = value;
|
|
53
|
+
}
|
|
54
|
+
else if (typeof value === 'object' && value !== null) {
|
|
55
|
+
Object.assign(flat, flattenCatalogue(value, joined));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return flat;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Every catalogue key that names no code any of `barrels` declares.
|
|
62
|
+
*
|
|
63
|
+
* Barrels are taken as opaque objects and read with {@link collectMessages},
|
|
64
|
+
* which is what lets a caller pass a `import * as messages` namespace directly:
|
|
65
|
+
* a barrel's value type is a union of its declarations AND its functions, and
|
|
66
|
+
* filtering that union will not narrow to a `MessageDefinition`.
|
|
67
|
+
*
|
|
68
|
+
* Returns the offending keys rather than a boolean, so a failing assertion names
|
|
69
|
+
* WHICH key is wrong — a count says only that something is.
|
|
70
|
+
*/
|
|
71
|
+
function findUndeclaredCodes(catalogueKeys, barrels, options = {}) {
|
|
72
|
+
const declared = new Set(barrels.flatMap(barrel => (0, primitives_1.collectMessages)(barrel).map(message => message.code)));
|
|
73
|
+
const exempt = options.exemptPrefixes ?? [];
|
|
74
|
+
return catalogueKeys.filter(key => !exempt.some(prefix => key.startsWith(prefix)) && !declared.has(key));
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Keys present in more than one catalogue — the shape a split catalogue rots
|
|
78
|
+
* into.
|
|
79
|
+
*
|
|
80
|
+
* Exactly one side renders a given message, so two catalogues holding one code
|
|
81
|
+
* are two authorities over one sentence and they diverge on the first reword.
|
|
82
|
+
* Nothing at runtime notices: both sides render, and whichever ran last wins on
|
|
83
|
+
* its own surface.
|
|
84
|
+
*
|
|
85
|
+
* Takes the key sets rather than a boolean answer for the same reason as
|
|
86
|
+
* {@link findUndeclaredCodes}, and reports NOTHING when a set is empty — an
|
|
87
|
+
* empty catalogue shares no key with anything, so a caller must assert
|
|
88
|
+
* non-emptiness separately or a failed read passes this vacuously.
|
|
89
|
+
*/
|
|
90
|
+
function findSharedCodes(first, second) {
|
|
91
|
+
const other = new Set(second);
|
|
92
|
+
return first.filter(key => other.has(key));
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=catalogue-audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalogue-audit.js","sourceRoot":"","sources":["../../src/testing/catalogue-audit.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;AAkClF,4CAcC;AA4BD,kDAQC;AAgBD,0CAGC;AArGD,uDAAyD;AAEzD;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;;;GAaG;AACH,SAAgB,gBAAgB,CAAC,SAAkC,EAAE,MAAM,GAAG,EAAE;IAC7E,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C,CAAC;AAC5G,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAgB,eAAe,CAAC,KAAwB,EAAE,MAAyB;IAChF,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
import { type MessageConnection } from 'vscode-jsonrpc';
|
|
33
33
|
import type { DataPort } from '../client/data-port';
|
|
34
34
|
import type { DataClientProtocol } from '../data/data-server-protocol';
|
|
35
|
-
import type { ProjectsChangedEvent, TransferDocumentSavedEvent, TransferDocumentUpdatedEvent } from '../data/events';
|
|
35
|
+
import type { ProjectsChangedEvent, TransferDocumentDeletedEvent, TransferDocumentSavedEvent, TransferDocumentsBuiltEvent, TransferDocumentUpdatedEvent } from '../data/events';
|
|
36
|
+
import type { ResolvedMessage } from '../messages/primitives';
|
|
36
37
|
import type { Project } from '../project';
|
|
37
38
|
import type { TransferDiagnostic } from '../transfer-diagnostic';
|
|
38
39
|
import type { TransferElement } from '../transfer-element';
|
|
@@ -48,13 +49,6 @@ export interface FakeDataPortOptions {
|
|
|
48
49
|
* which the consumer surfaces through {@link FakeDataPort.reported}.
|
|
49
50
|
*/
|
|
50
51
|
connect(): MessageConnection | Promise<MessageConnection>;
|
|
51
|
-
/**
|
|
52
|
-
* Stable client identity. Defaults to `'fake-data-port'`, which avoids the
|
|
53
|
-
* three sentinels the framework reserves (`'language-client'`, `'unknown'`,
|
|
54
|
-
* `'revert-on-close'`); override it when a test needs two distinguishable
|
|
55
|
-
* clients on one server.
|
|
56
|
-
*/
|
|
57
|
-
clientId?: string;
|
|
58
52
|
}
|
|
59
53
|
/** A {@link DataPort} that records what passed through it. */
|
|
60
54
|
export interface FakeDataPort extends DataPort {
|
|
@@ -69,12 +63,13 @@ export interface FakeDataPort extends DataPort {
|
|
|
69
63
|
/**
|
|
70
64
|
* Every {@link DataPort.reportError} call, in order. Read from outside: this
|
|
71
65
|
* is the only place a transport failure surfaces, so a test for the failure
|
|
72
|
-
* path asserts
|
|
73
|
-
*
|
|
66
|
+
* path asserts here rather than on a rejection the consumer may legitimately
|
|
67
|
+
* swallow. Prefer asserting on `message.code`, which is stable, over
|
|
68
|
+
* `message.text`, which is the English default and may be reworded.
|
|
74
69
|
*/
|
|
75
70
|
readonly reported: readonly {
|
|
76
71
|
readonly error: unknown;
|
|
77
|
-
readonly
|
|
72
|
+
readonly message: ResolvedMessage;
|
|
78
73
|
}[];
|
|
79
74
|
/**
|
|
80
75
|
* Fire {@link DataPort.onDispose} — the host tearing the transport down, a
|
|
@@ -101,13 +96,17 @@ export interface CapturingDataClient<TTransfer extends TransferElement, TDiagnos
|
|
|
101
96
|
readonly updates: TransferDocumentUpdatedEvent<TTransfer, TDiagnostic>[];
|
|
102
97
|
/** Every `onDocumentSaved` event, in arrival order. */
|
|
103
98
|
readonly saves: TransferDocumentSavedEvent<TTransfer, TDiagnostic>[];
|
|
99
|
+
/** Every `onDocumentDeleted` event, in arrival order. */
|
|
100
|
+
readonly deletions: TransferDocumentDeletedEvent[];
|
|
101
|
+
/** Every `onDocumentsBuilt` event, in arrival order. */
|
|
102
|
+
readonly builds: TransferDocumentsBuiltEvent[];
|
|
104
103
|
/** Every `onProjectsChanged` event, in arrival order. */
|
|
105
104
|
readonly projectsChanges: ProjectsChangedEvent<TProject>[];
|
|
106
105
|
}
|
|
107
106
|
/**
|
|
108
107
|
* A {@link DataClientProtocol} that records every notification it receives.
|
|
109
108
|
*
|
|
110
|
-
* Recording
|
|
109
|
+
* Recording EVERY channel even when a suite reads one is deliberate: an
|
|
111
110
|
* event delivered on the wrong channel is a real defect of the data head, and a
|
|
112
111
|
* double that drops the other two turns it into silence on the one being
|
|
113
112
|
* watched.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-doubles.d.ts","sourceRoot":"","sources":["../../src/testing/data-doubles.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAW,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"data-doubles.d.ts","sourceRoot":"","sources":["../../src/testing/data-doubles.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAW,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,KAAK,EACT,oBAAoB,EACpB,4BAA4B,EAC5B,0BAA0B,EAC1B,2BAA2B,EAC3B,4BAA4B,EAC9B,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,0CAA0C;AAC1C,MAAM,WAAW,mBAAmB;IACjC;;;;;;;;OAQG;IACH,OAAO,IAAI,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC5D;AAED,8DAA8D;AAC9D,MAAM,WAAW,YAAa,SAAQ,QAAQ;IAC3C;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,EAAE,SAAS,iB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,WAAW,EAAE,QAAQ,CAAC,CAAM,GAAG,mBAAmB,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,CAAC,CAkCtI"}
|
|
@@ -46,7 +46,6 @@ function makeFakeDataPort(options) {
|
|
|
46
46
|
const reported = [];
|
|
47
47
|
const disposeEmitter = new vscode_jsonrpc_1.Emitter();
|
|
48
48
|
return {
|
|
49
|
-
clientId: options.clientId ?? 'fake-data-port',
|
|
50
49
|
connections,
|
|
51
50
|
reported,
|
|
52
51
|
onDispose: disposeEmitter.event,
|
|
@@ -55,8 +54,8 @@ function makeFakeDataPort(options) {
|
|
|
55
54
|
connections.push(connection);
|
|
56
55
|
return connection;
|
|
57
56
|
},
|
|
58
|
-
reportError(error,
|
|
59
|
-
reported.push({ error,
|
|
57
|
+
reportError(error, message) {
|
|
58
|
+
reported.push({ error, message });
|
|
60
59
|
},
|
|
61
60
|
fireDispose() {
|
|
62
61
|
disposeEmitter.fire(undefined);
|
|
@@ -69,7 +68,7 @@ function makeFakeDataPort(options) {
|
|
|
69
68
|
/**
|
|
70
69
|
* A {@link DataClientProtocol} that records every notification it receives.
|
|
71
70
|
*
|
|
72
|
-
* Recording
|
|
71
|
+
* Recording EVERY channel even when a suite reads one is deliberate: an
|
|
73
72
|
* event delivered on the wrong channel is a real defect of the data head, and a
|
|
74
73
|
* double that drops the other two turns it into silence on the one being
|
|
75
74
|
* watched.
|
|
@@ -82,6 +81,8 @@ function makeFakeDataPort(options) {
|
|
|
82
81
|
function makeCapturingDataClient(overrides = {}) {
|
|
83
82
|
const updates = [];
|
|
84
83
|
const saves = [];
|
|
84
|
+
const deletions = [];
|
|
85
|
+
const builds = [];
|
|
85
86
|
const projectsChanges = [];
|
|
86
87
|
const client = {
|
|
87
88
|
onDocumentUpdated: overrides.onDocumentUpdated ??
|
|
@@ -92,11 +93,19 @@ function makeCapturingDataClient(overrides = {}) {
|
|
|
92
93
|
(event => {
|
|
93
94
|
saves.push(event);
|
|
94
95
|
}),
|
|
96
|
+
onDocumentDeleted: overrides.onDocumentDeleted ??
|
|
97
|
+
(event => {
|
|
98
|
+
deletions.push(event);
|
|
99
|
+
}),
|
|
100
|
+
onDocumentsBuilt: overrides.onDocumentsBuilt ??
|
|
101
|
+
(event => {
|
|
102
|
+
builds.push(event);
|
|
103
|
+
}),
|
|
95
104
|
onProjectsChanged: overrides.onProjectsChanged ??
|
|
96
105
|
(event => {
|
|
97
106
|
projectsChanges.push(event);
|
|
98
107
|
})
|
|
99
108
|
};
|
|
100
|
-
return { client, updates, saves, projectsChanges };
|
|
109
|
+
return { client, updates, saves, deletions, builds, projectsChanges };
|
|
101
110
|
}
|
|
102
111
|
//# sourceMappingURL=data-doubles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-doubles.js","sourceRoot":"","sources":["../../src/testing/data-doubles.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;
|
|
1
|
+
{"version":3,"file":"data-doubles.js","sourceRoot":"","sources":["../../src/testing/data-doubles.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;AA0FlF,4CAuBC;AAmCD,0DAsCC;AAxLD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,mDAAiE;AAyDjE;;;;;;GAMG;AACH,SAAgB,gBAAgB,CAAC,OAA4B;IAC1D,MAAM,WAAW,GAAwB,EAAE,CAAC;IAC5C,MAAM,QAAQ,GAAmD,EAAE,CAAC;IACpE,MAAM,cAAc,GAAG,IAAI,wBAAO,EAAQ,CAAC;IAC3C,OAAO;QACJ,WAAW;QACX,QAAQ;QACR,SAAS,EAAE,cAAc,CAAC,KAAK;QAC/B,KAAK,CAAC,OAAO;YACV,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;YAC3C,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC7B,OAAO,UAAU,CAAC;QACrB,CAAC;QACD,WAAW,CAAC,KAAc,EAAE,OAAwB;YACjD,QAAQ,CA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,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;AACzE,CAAC"}
|
package/lib/testing/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAiBlF,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
|
package/lib/testing/index.js
CHANGED
|
@@ -25,7 +25,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
25
25
|
// Subpath barrel for `@hydranium/protocol/testing` — the BROWSER-NEUTRAL shared
|
|
26
26
|
// primitives: `makeFakeClock` (deterministic `Clock` double on one virtual time
|
|
27
27
|
// axis), `waitFor` / `tick`, the client-side data-head doubles
|
|
28
|
-
// (`makeFakeDataPort` / `makeCapturingDataClient`),
|
|
28
|
+
// (`makeFakeDataPort` / `makeCapturingDataClient`), the translation-catalogue
|
|
29
|
+
// audit (`flattenCatalogue` / `findUndeclaredCodes` / `findSharedCodes`), and
|
|
30
|
+
// the `Harness` marker
|
|
29
31
|
// interface every framework harness extends. Kept out of the main barrel so production bundles don't pull
|
|
30
32
|
// the test scaffolding in by default; adopters opt in by importing from
|
|
31
33
|
// `@hydranium/protocol/testing`.
|
|
@@ -34,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
34
36
|
// duplex transports are NOT here: a `PassThrough` pair is in their exported
|
|
35
37
|
// type, so they cannot be made portable and live at `./testing/node` instead.
|
|
36
38
|
// The same rule the package surface uses — the portable name is the short one.
|
|
39
|
+
__exportStar(require("./catalogue-audit"), exports);
|
|
37
40
|
__exportStar(require("./data-doubles"), exports);
|
|
38
41
|
__exportStar(require("./fake-clock"), exports);
|
|
39
42
|
__exportStar(require("./harness"), exports);
|
package/lib/testing/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,gFAAgF;AAChF,gFAAgF;AAChF,+DAA+D;AAC/D,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,gFAAgF;AAChF,gFAAgF;AAChF,+DAA+D;AAC/D,8EAA8E;AAC9E,8EAA8E;AAC9E,uBAAuB;AACvB,0GAA0G;AAC1G,wEAAwE;AACxE,iCAAiC;AACjC,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,8EAA8E;AAC9E,+EAA+E;AAE/E,oDAAkC;AAClC,iDAA+B;AAC/B,+CAA6B;AAC7B,4CAA0B;AAC1B,6CAA2B"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
+
import { type MessageParams, type ResolvedMessage } from './messages/primitives';
|
|
9
10
|
/**
|
|
10
11
|
* Generic, transport-friendly diagnostic shape used by the model-server protocol.
|
|
11
12
|
*
|
|
@@ -55,6 +56,21 @@ export interface TransferDiagnostic {
|
|
|
55
56
|
* is not usable as a rule identity on its own.
|
|
56
57
|
*/
|
|
57
58
|
code?: number | string;
|
|
59
|
+
/**
|
|
60
|
+
* Substitutions for the placeholders in the message this {@link code} names,
|
|
61
|
+
* present only for a diagnostic raised from a framework message declaration.
|
|
62
|
+
*
|
|
63
|
+
* Without them a translated template renders with its `{name}` tokens left
|
|
64
|
+
* standing, because substitution leaves an unmatched token in place rather
|
|
65
|
+
* than raising — so a surface that translates from {@link code} alone is
|
|
66
|
+
* correct for a parameterless sentence and visibly wrong for a parameterised
|
|
67
|
+
* one. This is the field that makes the second case work; the LSP carrier has
|
|
68
|
+
* always moved the params, and no carrier below it did.
|
|
69
|
+
*
|
|
70
|
+
* Prefer {@link TransferDiagnostic.resolved} over reading this: it decides
|
|
71
|
+
* whether an identity is present at all, which a lone `params` cannot.
|
|
72
|
+
*/
|
|
73
|
+
params?: MessageParams;
|
|
58
74
|
}
|
|
59
75
|
export declare namespace TransferDiagnostic {
|
|
60
76
|
/** Path separator between AST nodes within an element location. */
|
|
@@ -65,6 +81,23 @@ export declare namespace TransferDiagnostic {
|
|
|
65
81
|
const ELEMENT_PROPERTY_SEPARATOR = "^";
|
|
66
82
|
function isError(diagnostic: TransferDiagnostic): boolean;
|
|
67
83
|
function isParseError(diagnostic: TransferDiagnostic): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* The diagnostic as a renderable message, for a surface that translates.
|
|
86
|
+
* `undefined` when it carries no framework identity — a syntactic error, an
|
|
87
|
+
* adopter's own check, a linker failure — which is the case a caller must
|
|
88
|
+
* distinguish rather than render.
|
|
89
|
+
*
|
|
90
|
+
* Hand the result to `renderFrameworkMessage` with whatever catalogue the
|
|
91
|
+
* host has loaded. The `text` is the server's English, so a code the
|
|
92
|
+
* catalogue does not carry still yields a complete sentence.
|
|
93
|
+
*
|
|
94
|
+
* `code` alone does not establish an identity: it also holds Langium's
|
|
95
|
+
* internal code and an adopter's own, and either would be looked up against a
|
|
96
|
+
* catalogue that cannot have it. Requiring `params` is what discriminates,
|
|
97
|
+
* and it is why a parameterless framework message still populates the field
|
|
98
|
+
* with an empty object rather than omitting it.
|
|
99
|
+
*/
|
|
100
|
+
function resolved(diagnostic: TransferDiagnostic): ResolvedMessage | undefined;
|
|
68
101
|
function getPath(diagnostic: TransferDiagnostic): string;
|
|
69
102
|
function errors(diagnostics: TransferDiagnostic[]): TransferDiagnostic[];
|
|
70
103
|
function hasErrors(diagnostics: TransferDiagnostic[]): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer-diagnostic.d.ts","sourceRoot":"","sources":["../src/transfer-diagnostic.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IAChC;;;;;OAKG;IACH,IAAI,EAAE,cAAc,GAAG,eAAe,GAAG,kBAAkB,CAAC;IAC5D;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACvC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,yBAAiB,kBAAkB,CAAC;IACjC,mEAAmE;IAC5D,MAAM,yBAAyB,MAAM,CAAC;IAC7C,wDAAwD;IACjD,MAAM,uBAAuB,MAAM,CAAC;IAC3C,sFAAsF;IAC/E,MAAM,0BAA0B,MAAM,CAAC;IAE9C,SAAgB,OAAO,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAE/D;IAED,SAAgB,YAAY,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAEpE;IAED,SAAgB,OAAO,CAAC,UAAU,EAAE,kBAAkB,GAAG,MAAM,CAE9D;IAED,SAAgB,MAAM,CAAC,WAAW,EAAE,kBAAkB,EAAE,GAAG,kBAAkB,EAAE,CAE9E;IAED,SAAgB,SAAS,CAAC,WAAW,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAEpE;IAED,SAAgB,cAAc,CAAC,WAAW,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAEzE;CACH"}
|
|
1
|
+
{"version":3,"file":"transfer-diagnostic.d.ts","sourceRoot":"","sources":["../src/transfer-diagnostic.ts"],"names":[],"m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E,GAAG,OAAO,CAEzE;CACH"}
|
|
@@ -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.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WAAiC;QACxD,OAAO,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;IAFe,4BAAS,YAExB,CAAA;IAED,SAAgB,cAAc,CAAC,WAAiC;QAC7D,OAAO,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACzC,CAAC;IAFe,iCAAc,iBAE7B,CAAA;AACJ,CAAC,EAtDgB,kBAAkB,kCAAlB,kBAAkB,QAsDlC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hydranium/protocol",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.70",
|
|
4
4
|
"description": "Generic, language-agnostic types, constants, and pure utilities for the hydranium framework.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hydranium",
|
|
@@ -41,6 +41,14 @@
|
|
|
41
41
|
"types": "./lib/data/index.d.ts",
|
|
42
42
|
"default": "./lib/data/index.js"
|
|
43
43
|
},
|
|
44
|
+
"./messages": {
|
|
45
|
+
"types": "./lib/messages/index.d.ts",
|
|
46
|
+
"default": "./lib/messages/index.js"
|
|
47
|
+
},
|
|
48
|
+
"./lib/messages": {
|
|
49
|
+
"types": "./lib/messages/index.d.ts",
|
|
50
|
+
"default": "./lib/messages/index.js"
|
|
51
|
+
},
|
|
44
52
|
"./testing": {
|
|
45
53
|
"types": "./lib/testing/index.d.ts",
|
|
46
54
|
"default": "./lib/testing/index.js"
|
|
@@ -88,7 +96,7 @@
|
|
|
88
96
|
"vscode-jsonrpc": "9.0.1"
|
|
89
97
|
},
|
|
90
98
|
"peerDependencies": {
|
|
91
|
-
"vscode-jsonrpc": "
|
|
99
|
+
"vscode-jsonrpc": "9.0.1"
|
|
92
100
|
},
|
|
93
101
|
"engines": {
|
|
94
102
|
"node": ">=22.13"
|
|
@@ -96,5 +104,6 @@
|
|
|
96
104
|
"publishConfig": {
|
|
97
105
|
"access": "public"
|
|
98
106
|
},
|
|
107
|
+
"//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, and docs/adopting/requirements.md carries the block to paste.",
|
|
99
108
|
"//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."
|
|
100
109
|
}
|