@hydranium/data-server 1.0.0-next.42 → 1.0.0-next.421

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.
Files changed (48) hide show
  1. package/README.md +62 -77
  2. package/lib/browser/index.d.ts +10 -0
  3. package/lib/browser/index.d.ts.map +1 -0
  4. package/lib/browser/index.js +15 -0
  5. package/lib/browser/index.js.map +1 -0
  6. package/lib/browser/start-data-server-in-worker.d.ts +23 -0
  7. package/lib/browser/start-data-server-in-worker.d.ts.map +1 -0
  8. package/lib/browser/start-data-server-in-worker.js +29 -0
  9. package/lib/browser/start-data-server-in-worker.js.map +1 -0
  10. package/lib/data-server.d.ts +411 -331
  11. package/lib/data-server.d.ts.map +1 -1
  12. package/lib/data-server.js +728 -530
  13. package/lib/data-server.js.map +1 -1
  14. package/lib/default-diagnostics.d.ts +1 -25
  15. package/lib/default-diagnostics.d.ts.map +1 -1
  16. package/lib/default-diagnostics.js +8 -27
  17. package/lib/default-diagnostics.js.map +1 -1
  18. package/lib/diagnostics-provider.d.ts +1 -1
  19. package/lib/messages/index.d.ts +1 -1
  20. package/lib/messages/index.d.ts.map +1 -1
  21. package/lib/messages/index.js +1 -1
  22. package/lib/messages/index.js.map +1 -1
  23. package/lib/node/node-diagnostics-provider.d.ts +18 -6
  24. package/lib/node/node-diagnostics-provider.d.ts.map +1 -1
  25. package/lib/node/node-diagnostics-provider.js +63 -20
  26. package/lib/node/node-diagnostics-provider.js.map +1 -1
  27. package/lib/testing/data-server-harness.d.ts +27 -14
  28. package/lib/testing/data-server-harness.d.ts.map +1 -1
  29. package/lib/testing/data-server-harness.js +5 -2
  30. package/lib/testing/data-server-harness.js.map +1 -1
  31. package/lib/testing/index.d.ts +1 -0
  32. package/lib/testing/index.d.ts.map +1 -1
  33. package/lib/testing/index.js.map +1 -1
  34. package/package.json +32 -44
  35. package/src/browser/index.ts +15 -0
  36. package/src/browser/start-data-server-in-worker.ts +35 -0
  37. package/src/data-server.ts +909 -592
  38. package/src/default-diagnostics.ts +8 -27
  39. package/src/diagnostics-provider.ts +1 -1
  40. package/src/messages/index.ts +8 -1
  41. package/src/node/node-diagnostics-provider.ts +73 -27
  42. package/src/testing/data-server-harness.ts +44 -25
  43. package/src/testing/index.ts +5 -2
  44. package/lib/default-diagnostics.browser.d.ts +0 -18
  45. package/lib/default-diagnostics.browser.d.ts.map +0 -1
  46. package/lib/default-diagnostics.browser.js +0 -36
  47. package/lib/default-diagnostics.browser.js.map +0 -1
  48. package/src/default-diagnostics.browser.ts +0 -41
package/package.json CHANGED
@@ -1,30 +1,37 @@
1
1
  {
2
2
  "name": "@hydranium/data-server",
3
- "version": "1.0.0-next.42",
3
+ "version": "1.0.0-next.421",
4
4
  "description": "Typed-RPC protocol head for the hydranium framework. Peer of @hydranium/core/lsp and @hydranium/glsp-server; built on @hydranium/core.",
5
5
  "keywords": [
6
+ "data-server",
6
7
  "hydranium",
7
8
  "langium",
8
9
  "language-server",
9
10
  "lsp",
10
- "rpc",
11
- "data-server"
11
+ "rpc"
12
12
  ],
13
13
  "homepage": "https://github.com/eclipse-emfcloud/hydranium/tree/main/packages/data-server",
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/data-server"
21
25
  },
22
- "license": "MIT",
23
- "author": {
24
- "name": "Hydranium Team"
25
- },
26
- "sideEffects": false,
26
+ "files": [
27
+ "lib",
28
+ "src",
29
+ "!lib/**/*.tsbuildinfo"
30
+ ],
27
31
  "type": "module",
32
+ "sideEffects": false,
33
+ "main": "lib/index.js",
34
+ "types": "lib/index.d.ts",
28
35
  "exports": {
29
36
  ".": {
30
37
  "types": "./lib/index.d.ts",
@@ -34,69 +41,50 @@
34
41
  "types": "./lib/node/index.d.ts",
35
42
  "default": "./lib/node/index.js"
36
43
  },
37
- "./lib/node": {
38
- "types": "./lib/node/index.d.ts",
39
- "default": "./lib/node/index.js"
44
+ "./browser": {
45
+ "types": "./lib/browser/index.d.ts",
46
+ "default": "./lib/browser/index.js"
40
47
  },
41
48
  "./messages": {
42
49
  "types": "./lib/messages/index.d.ts",
43
50
  "default": "./lib/messages/index.js"
44
51
  },
45
- "./lib/messages": {
46
- "types": "./lib/messages/index.d.ts",
47
- "default": "./lib/messages/index.js"
48
- },
49
52
  "./testing": {
50
53
  "types": "./lib/testing/index.d.ts",
51
54
  "default": "./lib/testing/index.js"
52
- },
53
- "./lib/testing": {
54
- "types": "./lib/testing/index.d.ts",
55
- "default": "./lib/testing/index.js"
56
55
  }
57
56
  },
58
- "main": "lib/index.js",
59
- "browser": {
60
- "./lib/default-diagnostics.js": "./lib/default-diagnostics.browser.js"
57
+ "publishConfig": {
58
+ "access": "public"
61
59
  },
62
- "types": "lib/index.d.ts",
63
- "files": [
64
- "lib",
65
- "src",
66
- "!lib/**/*.tsbuildinfo"
67
- ],
68
60
  "scripts": {
69
61
  "build": "tsc -b",
70
62
  "clean": "rimraf lib tsconfig.tsbuildinfo",
71
- "lint": "eslint src test --max-warnings 0",
63
+ "lint": "oxlint --format stylish --config ../../oxlint.config.cjs src test --max-warnings 0",
72
64
  "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);}\"",
73
65
  "test": "npm run typecheck:test && vitest run",
74
66
  "typecheck:test": "tsc --noEmit -p tsconfig.test.json",
75
67
  "watch": "tsc -b -w --preserveWatchOutput"
76
68
  },
77
69
  "devDependencies": {
78
- "@hydranium/core": "1.0.0-next.42",
79
- "@hydranium/langium": "1.0.0-next.42",
80
- "@hydranium/protocol": "1.0.0-next.42",
70
+ "@hydranium/core": "1.0.0-next.421",
71
+ "@hydranium/langium": "1.0.0-next.421",
72
+ "@hydranium/protocol": "1.0.0-next.421",
81
73
  "rimraf": "^5.0.0",
82
- "typescript": "^5.8.0",
83
- "vscode-jsonrpc": "9.0.1",
74
+ "typescript": "^7.0.2",
75
+ "vscode-jsonrpc": "9.0.3",
84
76
  "vscode-languageserver-textdocument": "^1.0.12"
85
77
  },
86
78
  "peerDependencies": {
87
- "@hydranium/core": "1.0.0-next.42",
88
- "@hydranium/langium": "1.0.0-next.42",
89
- "@hydranium/protocol": "1.0.0-next.42",
90
- "vscode-jsonrpc": "9.0.1",
79
+ "@hydranium/core": "1.0.0-next.421",
80
+ "@hydranium/langium": "1.0.0-next.421",
81
+ "@hydranium/protocol": "1.0.0-next.421",
82
+ "vscode-jsonrpc": "^9.0.3",
91
83
  "vscode-languageserver-textdocument": "^1.0.12"
92
84
  },
93
85
  "engines": {
94
86
  "node": ">=22.13"
95
87
  },
96
- "publishConfig": {
97
- "access": "public"
98
- },
99
- "//browser": "Selects the diagnostics default per platform, the same mechanism @eclipse-glsp/server uses to swap its node build for its browser one. The Node module imports @hydranium/core/node; a browser bundler resolves the twin instead and therefore never follows that import, which is what keeps this package's `.` entry bundleable. Node ignores this field, so a Node host keeps the real implementation with no configuration. `check:neutral` is the proof it still applies — it bundles `.` for the browser and would fail on node:fs the moment the mapping stops matching.",
100
- "//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.",
101
- "//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."
88
+ "//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 starts at 9.0.3, the transport protocol 3.18.4 pins, since an earlier one leaves an unhandled rejection for a request written to a destroyed stream, and no protocol this framework accepts pins it. 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`.",
89
+ "//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."
102
90
  }
@@ -0,0 +1,15 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 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
+ // Browser-only entry (`@hydranium/data-server/browser`). Holds the worker
11
+ // starter, whose connection comes from `vscode-jsonrpc/browser`. The portable
12
+ // `.` entry stays free of that import for the same reason it stays free of the
13
+ // node one: it must resolve under both platforms, and a build that names one
14
+ // has picked.
15
+ export * from './start-data-server-in-worker.js';
@@ -0,0 +1,35 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 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
+ import { createMessagePortTransport, type TransferredMessagePort } from '@hydranium/protocol';
11
+ import type { ServerSharedServicesMinimal } from '@hydranium/core';
12
+ import { createMessageConnection, type MessageConnection } from 'vscode-jsonrpc/browser';
13
+
14
+ /**
15
+ * Start the data head on the port the page transferred for it, on the same
16
+ * shared tier the LSP head runs on, and return the server `create` built.
17
+ *
18
+ * `create` constructs the adopter's `DataServer`, or a subclass of it, around
19
+ * the connection, as a Node host's socket callback does, and the connection
20
+ * listens once it has returned, in the order the Node launcher uses. The
21
+ * page's end of the port closing disposes the server, which ends every
22
+ * session this connection registered.
23
+ */
24
+ export function startDataServerInWorker<TServer>(
25
+ port: TransferredMessagePort,
26
+ shared: Pick<ServerSharedServicesMinimal, 'Logger'>,
27
+ create: (connection: MessageConnection) => TServer
28
+ ): TServer {
29
+ // Both ends use `createMessagePortTransport`; see it for why.
30
+ const transport = createMessagePortTransport(port);
31
+ const connection = createMessageConnection(transport.reader, transport.writer, shared.Logger.with('ModelServer'));
32
+ const server = create(connection);
33
+ connection.listen();
34
+ return server;
35
+ }