@hydranium/langium 1.0.0-next.10
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/LICENSE +21 -0
- package/README.md +87 -0
- package/lib/augmentations/synthetic.d.ts +38 -0
- package/lib/augmentations/synthetic.d.ts.map +1 -0
- package/lib/augmentations/synthetic.js +10 -0
- package/lib/augmentations/synthetic.js.map +1 -0
- package/lib/augmentations/uri-utils.d.ts +51 -0
- package/lib/augmentations/uri-utils.d.ts.map +1 -0
- package/lib/augmentations/uri-utils.js +31 -0
- package/lib/augmentations/uri-utils.js.map +1 -0
- package/lib/index.d.ts +38 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +40 -0
- package/lib/index.js.map +1 -0
- package/lib/lsp.d.ts +16 -0
- package/lib/lsp.d.ts.map +1 -0
- package/lib/lsp.js +16 -0
- package/lib/lsp.js.map +1 -0
- package/lib/node.d.ts +16 -0
- package/lib/node.d.ts.map +1 -0
- package/lib/node.js +16 -0
- package/lib/node.js.map +1 -0
- package/lib/test.d.ts +16 -0
- package/lib/test.d.ts.map +1 -0
- package/lib/test.js +16 -0
- package/lib/test.js.map +1 -0
- package/package.json +90 -0
- package/src/augmentations/synthetic.ts +37 -0
- package/src/augmentations/uri-utils.ts +77 -0
- package/src/index.ts +42 -0
- package/src/lsp.ts +16 -0
- package/src/node.ts +16 -0
- package/src/test.ts +16 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# `@hydranium/langium`
|
|
2
|
+
|
|
3
|
+
The pinned [Langium](https://langium.org/) re-export for the
|
|
4
|
+
[Hydranium](https://github.com/eclipse-emfcloud/hydranium) framework — the single chokepoint every
|
|
5
|
+
`@hydranium/*` package, and every adopter of them, imports Langium through.
|
|
6
|
+
|
|
7
|
+
You do not install this for its own API: it is almost entirely passthrough. You install it because a
|
|
8
|
+
framework package will resolve it anyway, and because importing Langium through it is how your
|
|
9
|
+
project stays in lockstep with the version the framework was built against.
|
|
10
|
+
|
|
11
|
+
## Why this package exists
|
|
12
|
+
|
|
13
|
+
Langium is pinned to **one exact version** here, to guarantee a **single physical copy** across the
|
|
14
|
+
workspace. Re-export is transparent — given one physical install, importing `AstNode` or `URI` from
|
|
15
|
+
`@hydranium/langium` and from `langium` yields the same class object and the same declaration. That
|
|
16
|
+
transparency is exactly what a split install destroys: two copies of Langium mean two `AstNode`
|
|
17
|
+
declarations and two `URI` classes, so `instanceof` and every nominal identity check across them
|
|
18
|
+
silently start returning `false`. Without the pin, single-copy is only a semver-dedup coincidence,
|
|
19
|
+
one minor bump away from breaking.
|
|
20
|
+
|
|
21
|
+
For an **adopter**, the reason to route imports here is not runtime identity (that already holds) —
|
|
22
|
+
it is **version coupling**. Langium sits in an atomic chain with `vscode-languageserver`,
|
|
23
|
+
`vscode-languageserver-protocol` and `vscode-jsonrpc`, with no independently movable link. An
|
|
24
|
+
adopter importing `langium` directly owns that pin itself and can drift out of lockstep with the
|
|
25
|
+
framework it composes; importing it from here means the framework owns it.
|
|
26
|
+
|
|
27
|
+
The chokepoint is **lint-enforced**, not merely conventional: an ESLint
|
|
28
|
+
`no-restricted-imports` rule over `packages/**` and `examples/**` rejects direct imports of
|
|
29
|
+
`langium`, `langium/lsp`, `langium/node`, `langium/test` and `vscode-uri` (whose `URI` Langium
|
|
30
|
+
re-exports and owns the version of). This package itself is exempt, as is any `generated` directory —
|
|
31
|
+
`langium-cli` emits direct imports there and rewrites them on every build, which is also why
|
|
32
|
+
`langium` stays a declared dependency of an adopter's own package.
|
|
33
|
+
|
|
34
|
+
## What it gives you
|
|
35
|
+
|
|
36
|
+
- Langium's full API surface, re-exported: `AstNode`, `AstUtils`, `URI`, `UriUtils`, the service
|
|
37
|
+
types, the DI helpers — everything, unfiltered.
|
|
38
|
+
- A subpath per upstream subpath, so `langium/lsp`, `langium/node` and `langium/test` each have a
|
|
39
|
+
chokepoint mirror.
|
|
40
|
+
- One ambient type augmentation: `AstNode.$synthetic`, a marker for a node that was programmatically
|
|
41
|
+
constructed rather than parsed. Type-level only — the behaviour that reads it lives in
|
|
42
|
+
`@hydranium/core`.
|
|
43
|
+
- Two additions to the `UriUtils` namespace, so framework URI helpers sit beside Langium's own:
|
|
44
|
+
`UriUtils.toUri` (normalise a `URI | string`) and `UriUtils.isAncestorOrEqual` (a scheme- and
|
|
45
|
+
authority-aware containment check, unlike `UriUtils.contains`).
|
|
46
|
+
|
|
47
|
+
## Install
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm install @hydranium/langium
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
No peer dependencies: `langium` is a direct, exact dependency of this package.
|
|
54
|
+
|
|
55
|
+
## Subpaths
|
|
56
|
+
|
|
57
|
+
| Subpath | Re-exports | Contents |
|
|
58
|
+
| -------- | -------------- | ----------------------------------------- |
|
|
59
|
+
| `.` | `langium` | Core API + the framework's augmentations. |
|
|
60
|
+
| `./lsp` | `langium/lsp` | LSP service defaults. |
|
|
61
|
+
| `./node` | `langium/node` | `NodeFileSystem`. |
|
|
62
|
+
| `./test` | `langium/test` | Parsing / validation test helpers. |
|
|
63
|
+
|
|
64
|
+
Each named subpath also resolves as `@hydranium/langium/lib/<name>`, so a consumer on classic
|
|
65
|
+
`moduleResolution: "Node"` can reach it.
|
|
66
|
+
|
|
67
|
+
## Usage
|
|
68
|
+
|
|
69
|
+
Replace `langium` with `@hydranium/langium` in your import specifiers; nothing else changes, because
|
|
70
|
+
the symbols are the same objects.
|
|
71
|
+
|
|
72
|
+
The one thing to know is that the root entry is **side-effecting**: importing anything from
|
|
73
|
+
`@hydranium/langium` loads the `UriUtils` augmentation, which mutates the runtime `UriUtils` object.
|
|
74
|
+
That is why the added helpers are visible process-wide once any framework package has loaded — and
|
|
75
|
+
why code that imports `UriUtils` from `langium` without ever loading the framework correctly sees
|
|
76
|
+
only the stock surface.
|
|
77
|
+
|
|
78
|
+
## Status
|
|
79
|
+
|
|
80
|
+
Alpha — pre-v0, not yet published. The API is Langium's and is stable to the extent Langium's is;
|
|
81
|
+
what is not yet settled is the augmentation set and the pinned version. See the
|
|
82
|
+
[repository README](../../README.md) for the current status and known limitations.
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
`MIT` — see this package's [`LICENSE`](./LICENSE), and the repository
|
|
87
|
+
[`NOTICE.md`](../../NOTICE.md) for third-party notices.
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
* Augments Langium's {@link AstNode} with a `$synthetic` marker —
|
|
11
|
+
* `true` when the node was programmatically constructed rather than
|
|
12
|
+
* parsed from source.
|
|
13
|
+
*
|
|
14
|
+
* This is a pure, ambient type-level merge: it widens the canonical
|
|
15
|
+
* `langium` `AstNode` interface so the marker is visible on every
|
|
16
|
+
* AST-derived type (generated subtypes, `$container` hops, `AstUtils`
|
|
17
|
+
* return types) regardless of import path. It carries no runtime code.
|
|
18
|
+
* The behaviour-bearing side of the synthetic concept — `markSynthetic`
|
|
19
|
+
* / `markSyntheticTree` / `isSyntheticNode` and the validation-skip
|
|
20
|
+
* default that reads them — lives in `@hydranium/core`; this package
|
|
21
|
+
* owns only the type widening.
|
|
22
|
+
*
|
|
23
|
+
* Adopters may further narrow this on grammar-specific AST types to give
|
|
24
|
+
* synthetic mirrors a literal-type compile-time hint at construction
|
|
25
|
+
* sites.
|
|
26
|
+
*/
|
|
27
|
+
declare module 'langium' {
|
|
28
|
+
interface AstNode {
|
|
29
|
+
/**
|
|
30
|
+
* Marks the node as synthetic — programmatically constructed, not
|
|
31
|
+
* parsed from source. Synthetic nodes are skipped during validation
|
|
32
|
+
* by default, via `HydraniumDocumentValidator.shouldSkipValidation`.
|
|
33
|
+
*/
|
|
34
|
+
readonly $synthetic?: boolean;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=synthetic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synthetic.d.ts","sourceRoot":"","sources":["../../src/augmentations/synthetic.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,QAAQ,SAAS,CAAC;IACtB,UAAU,OAAO;QACd;;;;WAIG;QACH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;KAChC;CACH"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=synthetic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synthetic.js","sourceRoot":"","sources":["../../src/augmentations/synthetic.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
import { URI } from 'langium';
|
|
10
|
+
/**
|
|
11
|
+
* Namespace augmentation: extend Langium's `UriUtils` with framework
|
|
12
|
+
* helpers, so the framework's URI utilities sit on the same namespace as
|
|
13
|
+
* Langium's own rather than on a second surface adopters have to discover
|
|
14
|
+
* separately.
|
|
15
|
+
*
|
|
16
|
+
* **Side-effect import.** This module mutates the runtime `UriUtils`
|
|
17
|
+
* object. It is loaded by this package's entry point (`index.ts`), so
|
|
18
|
+
* importing anything from `@hydranium/langium` — which every framework
|
|
19
|
+
* package does — makes the augmented members visible process-wide. Code
|
|
20
|
+
* that imports `UriUtils` from `langium` without ever loading the
|
|
21
|
+
* framework sees only the stock surface, which is correct.
|
|
22
|
+
*
|
|
23
|
+
* **Rejected: plain exported `toUri` / `isAncestorOrEqual` functions.**
|
|
24
|
+
* They would avoid the side-effect import, which can break under
|
|
25
|
+
* tree-shaking or CJS interop, at the cost of the single-namespace
|
|
26
|
+
* discovery above. Neither hazard reaches a framework consumer: Langium is
|
|
27
|
+
* a non-optional dependency, so the chokepoint is always loaded in a real
|
|
28
|
+
* composition, and type-only imports are erased.
|
|
29
|
+
*/
|
|
30
|
+
declare module 'langium' {
|
|
31
|
+
namespace UriUtils {
|
|
32
|
+
/**
|
|
33
|
+
* Normalise a `URI | string` argument to a `URI`, so a public API
|
|
34
|
+
* accepting both forms does not have to inline the coercion.
|
|
35
|
+
*/
|
|
36
|
+
function toUri(value: URI | string): URI;
|
|
37
|
+
/**
|
|
38
|
+
* `true` when `ancestor` is the same file or a parent folder of
|
|
39
|
+
* `descendant`. Both URIs must share scheme and authority for the
|
|
40
|
+
* comparison to be meaningful — different schemes always return `false`.
|
|
41
|
+
*
|
|
42
|
+
* **vs. `UriUtils.contains`**: `contains(parent, child)` does the
|
|
43
|
+
* same path-prefix check but **ignores scheme and authority** — a
|
|
44
|
+
* `file:` URI can "contain" an `untitled:` URI. Use this stricter
|
|
45
|
+
* variant when scheme correctness matters, and `contains` where
|
|
46
|
+
* scheme equality is already implied by context.
|
|
47
|
+
*/
|
|
48
|
+
function isAncestorOrEqual(ancestor: URI, descendant: URI): boolean;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=uri-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uri-utils.d.ts","sourceRoot":"","sources":["../../src/augmentations/uri-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,GAAG,EAAY,MAAM,SAAS,CAAC;AAExC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,QAAQ,SAAS,CAAC;IACtB,UAAU,QAAQ,CAAC;QAChB;;;WAGG;QACH,SAAS,KAAK,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,GAAG,GAAG,CAAC;QAEzC;;;;;;;;;;WAUG;QACH,SAAS,iBAAiB,CAAC,QAAQ,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,GAAG,OAAO,CAAC;KACtE;CACH"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
import { URI, UriUtils } from 'langium';
|
|
10
|
+
function toUri(value) {
|
|
11
|
+
return typeof value === 'string' ? URI.parse(value) : value;
|
|
12
|
+
}
|
|
13
|
+
function isAncestorOrEqual(ancestor, descendant) {
|
|
14
|
+
if (ancestor.scheme !== descendant.scheme || ancestor.authority !== descendant.authority) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
const ancestorPath = ancestor.fsPath;
|
|
18
|
+
const descendantPath = descendant.fsPath;
|
|
19
|
+
if (descendantPath === ancestorPath) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
const trailing = ancestorPath.endsWith('/') || ancestorPath.endsWith('\\');
|
|
23
|
+
const prefix = trailing ? ancestorPath : ancestorPath + '/';
|
|
24
|
+
return descendantPath.startsWith(prefix) || descendantPath.startsWith(ancestorPath + '\\');
|
|
25
|
+
}
|
|
26
|
+
// Runtime attachment. `UriUtils` is a namespace, so at runtime it is a plain
|
|
27
|
+
// object that accepts added properties; the cast only strips its declared
|
|
28
|
+
// shape, and the augmentation block above supplies the type-level merge.
|
|
29
|
+
UriUtils.toUri = toUri;
|
|
30
|
+
UriUtils.isAncestorOrEqual = isAncestorOrEqual;
|
|
31
|
+
//# sourceMappingURL=uri-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uri-utils.js","sourceRoot":"","sources":["../../src/augmentations/uri-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AA6CxC,SAAS,KAAK,CAAC,KAAmB;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC/D,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAa,EAAE,UAAe;IACtD,IAAI,QAAQ,CAAC,MAAM,KAAK,UAAU,CAAC,MAAM,IAAI,QAAQ,CAAC,SAAS,KAAK,UAAU,CAAC,SAAS,EAAE,CAAC;QACxF,OAAO,KAAK,CAAC;IAChB,CAAC;IACD,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC;IACrC,MAAM,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC;IACzC,IAAI,cAAc,KAAK,YAAY,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC;IACf,CAAC;IACD,MAAM,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3E,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,GAAG,GAAG,CAAC;IAC5D,OAAO,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,UAAU,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;AAC9F,CAAC;AAED,6EAA6E;AAC7E,0EAA0E;AAC1E,yEAAyE;AACxE,QAAiF,CAAC,KAAK,GAAG,KAAK,CAAC;AAChG,QAAiF,CAAC,iBAAiB,GAAG,iBAAiB,CAAC"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
* `@hydranium/langium` — augmented re-export of the Langium API.
|
|
11
|
+
*
|
|
12
|
+
* This is the single chokepoint where the hydranium framework consumes
|
|
13
|
+
* Langium: it pins the Langium version (one physical copy, guaranteed by
|
|
14
|
+
* the root `overrides`/`resolutions`) and layers the framework's
|
|
15
|
+
* type/namespace augmentations. Framework packages AND adopters import
|
|
16
|
+
* Langium from here, not from `langium` directly — lint-enforced across
|
|
17
|
+
* the `packages` and `examples` trees alike, with any `generated`
|
|
18
|
+
* directory exempt because `langium-cli` emits direct imports there and
|
|
19
|
+
* regenerates them on every build.
|
|
20
|
+
*
|
|
21
|
+
* **Why adopters too, and it is not runtime identity.** Re-export is
|
|
22
|
+
* transparent: given one physical `langium`, importing a symbol from here
|
|
23
|
+
* and from `langium` yields the same object and the same declaration. The
|
|
24
|
+
* reason is VERSION COUPLING: `langium` sits in an atomic chain with
|
|
25
|
+
* `vscode-languageserver` / `-protocol` / `-jsonrpc` (see the `//langium`
|
|
26
|
+
* note in the root `package.json`), so an adopter importing it directly
|
|
27
|
+
* owns that pin itself and can drift out of lockstep with the framework it
|
|
28
|
+
* composes. Here, the framework owns it. This is also the place a Langium
|
|
29
|
+
* rename would be defensively patched, which a direct importer does not
|
|
30
|
+
* benefit from.
|
|
31
|
+
*
|
|
32
|
+
* The only curation is the ambient `$synthetic` `AstNode` widening and the
|
|
33
|
+
* `UriUtils` helper namespace; everything else is passthrough.
|
|
34
|
+
*/
|
|
35
|
+
import './augmentations/synthetic.js';
|
|
36
|
+
import './augmentations/uri-utils.js';
|
|
37
|
+
export * from 'langium';
|
|
38
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,8BAA8B,CAAC;AAEtC,OAAO,8BAA8B,CAAC;AAEtC,cAAc,SAAS,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
* `@hydranium/langium` — augmented re-export of the Langium API.
|
|
11
|
+
*
|
|
12
|
+
* This is the single chokepoint where the hydranium framework consumes
|
|
13
|
+
* Langium: it pins the Langium version (one physical copy, guaranteed by
|
|
14
|
+
* the root `overrides`/`resolutions`) and layers the framework's
|
|
15
|
+
* type/namespace augmentations. Framework packages AND adopters import
|
|
16
|
+
* Langium from here, not from `langium` directly — lint-enforced across
|
|
17
|
+
* the `packages` and `examples` trees alike, with any `generated`
|
|
18
|
+
* directory exempt because `langium-cli` emits direct imports there and
|
|
19
|
+
* regenerates them on every build.
|
|
20
|
+
*
|
|
21
|
+
* **Why adopters too, and it is not runtime identity.** Re-export is
|
|
22
|
+
* transparent: given one physical `langium`, importing a symbol from here
|
|
23
|
+
* and from `langium` yields the same object and the same declaration. The
|
|
24
|
+
* reason is VERSION COUPLING: `langium` sits in an atomic chain with
|
|
25
|
+
* `vscode-languageserver` / `-protocol` / `-jsonrpc` (see the `//langium`
|
|
26
|
+
* note in the root `package.json`), so an adopter importing it directly
|
|
27
|
+
* owns that pin itself and can drift out of lockstep with the framework it
|
|
28
|
+
* composes. Here, the framework owns it. This is also the place a Langium
|
|
29
|
+
* rename would be defensively patched, which a direct importer does not
|
|
30
|
+
* benefit from.
|
|
31
|
+
*
|
|
32
|
+
* The only curation is the ambient `$synthetic` `AstNode` widening and the
|
|
33
|
+
* `UriUtils` helper namespace; everything else is passthrough.
|
|
34
|
+
*/
|
|
35
|
+
// Ambient type-level augmentation of `AstNode` ($synthetic marker).
|
|
36
|
+
import './augmentations/synthetic.js';
|
|
37
|
+
// Side-effecting runtime augmentation of the `UriUtils` namespace.
|
|
38
|
+
import './augmentations/uri-utils.js';
|
|
39
|
+
export * from 'langium';
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,oEAAoE;AACpE,OAAO,8BAA8B,CAAC;AACtC,mEAAmE;AACnE,OAAO,8BAA8B,CAAC;AAEtC,cAAc,SAAS,CAAC"}
|
package/lib/lsp.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
* Chokepoint mirror of Langium's `langium/lsp` subpath — the LSP service
|
|
11
|
+
* defaults (`DefaultCompletionProvider`, etc.). Pure passthrough; it exists
|
|
12
|
+
* so framework packages and adopters reach every Langium subpath through
|
|
13
|
+
* this package and inherit its version pin instead of owning one themselves.
|
|
14
|
+
*/
|
|
15
|
+
export * from 'langium/lsp';
|
|
16
|
+
//# sourceMappingURL=lsp.d.ts.map
|
package/lib/lsp.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lsp.d.ts","sourceRoot":"","sources":["../src/lsp.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;GAKG;AACH,cAAc,aAAa,CAAC"}
|
package/lib/lsp.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
* Chokepoint mirror of Langium's `langium/lsp` subpath — the LSP service
|
|
11
|
+
* defaults (`DefaultCompletionProvider`, etc.). Pure passthrough; it exists
|
|
12
|
+
* so framework packages and adopters reach every Langium subpath through
|
|
13
|
+
* this package and inherit its version pin instead of owning one themselves.
|
|
14
|
+
*/
|
|
15
|
+
export * from 'langium/lsp';
|
|
16
|
+
//# sourceMappingURL=lsp.js.map
|
package/lib/lsp.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lsp.js","sourceRoot":"","sources":["../src/lsp.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;GAKG;AACH,cAAc,aAAa,CAAC"}
|
package/lib/node.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
* Chokepoint mirror of Langium's `langium/node` subpath — the Node.js
|
|
11
|
+
* filesystem provider (`NodeFileSystem`). Pure passthrough; it exists so
|
|
12
|
+
* framework packages and adopters reach every Langium subpath through this
|
|
13
|
+
* package and inherit its version pin instead of owning one themselves.
|
|
14
|
+
*/
|
|
15
|
+
export * from 'langium/node';
|
|
16
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;GAKG;AACH,cAAc,cAAc,CAAC"}
|
package/lib/node.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
* Chokepoint mirror of Langium's `langium/node` subpath — the Node.js
|
|
11
|
+
* filesystem provider (`NodeFileSystem`). Pure passthrough; it exists so
|
|
12
|
+
* framework packages and adopters reach every Langium subpath through this
|
|
13
|
+
* package and inherit its version pin instead of owning one themselves.
|
|
14
|
+
*/
|
|
15
|
+
export * from 'langium/node';
|
|
16
|
+
//# sourceMappingURL=node.js.map
|
package/lib/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;GAKG;AACH,cAAc,cAAc,CAAC"}
|
package/lib/test.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
* Chokepoint mirror of Langium's `langium/test` subpath — parsing and
|
|
11
|
+
* validation test helpers. Pure passthrough; it exists so framework packages
|
|
12
|
+
* and adopters reach every Langium subpath through this package and inherit
|
|
13
|
+
* its version pin instead of owning one themselves.
|
|
14
|
+
*/
|
|
15
|
+
export * from 'langium/test';
|
|
16
|
+
//# sourceMappingURL=test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;GAKG;AACH,cAAc,cAAc,CAAC"}
|
package/lib/test.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
* Chokepoint mirror of Langium's `langium/test` subpath — parsing and
|
|
11
|
+
* validation test helpers. Pure passthrough; it exists so framework packages
|
|
12
|
+
* and adopters reach every Langium subpath through this package and inherit
|
|
13
|
+
* its version pin instead of owning one themselves.
|
|
14
|
+
*/
|
|
15
|
+
export * from 'langium/test';
|
|
16
|
+
//# sourceMappingURL=test.js.map
|
package/lib/test.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;GAKG;AACH,cAAc,cAAc,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hydranium/langium",
|
|
3
|
+
"version": "1.0.0-next.10",
|
|
4
|
+
"description": "Augmented re-export of the Langium API for the hydranium framework: the single chokepoint where hydranium pins the Langium version and layers its type/namespace augmentations. ~99% passthrough today.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"hydranium",
|
|
7
|
+
"langium",
|
|
8
|
+
"language-server",
|
|
9
|
+
"lsp"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://github.com/eclipse-emfcloud/hydranium/tree/main/packages/langium",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/eclipse-emfcloud/hydranium/issues"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/eclipse-emfcloud/hydranium.git",
|
|
18
|
+
"directory": "packages/langium"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"author": {
|
|
22
|
+
"name": "Hydranium Team"
|
|
23
|
+
},
|
|
24
|
+
"sideEffects": [
|
|
25
|
+
"./lib/index.js",
|
|
26
|
+
"./lib/augmentations/*.js"
|
|
27
|
+
],
|
|
28
|
+
"type": "module",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./lib/index.d.ts",
|
|
32
|
+
"default": "./lib/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./lsp": {
|
|
35
|
+
"types": "./lib/lsp.d.ts",
|
|
36
|
+
"default": "./lib/lsp.js"
|
|
37
|
+
},
|
|
38
|
+
"./lib/lsp": {
|
|
39
|
+
"types": "./lib/lsp.d.ts",
|
|
40
|
+
"default": "./lib/lsp.js"
|
|
41
|
+
},
|
|
42
|
+
"./node": {
|
|
43
|
+
"types": "./lib/node.d.ts",
|
|
44
|
+
"default": "./lib/node.js"
|
|
45
|
+
},
|
|
46
|
+
"./lib/node": {
|
|
47
|
+
"types": "./lib/node.d.ts",
|
|
48
|
+
"default": "./lib/node.js"
|
|
49
|
+
},
|
|
50
|
+
"./test": {
|
|
51
|
+
"types": "./lib/test.d.ts",
|
|
52
|
+
"default": "./lib/test.js"
|
|
53
|
+
},
|
|
54
|
+
"./lib/test": {
|
|
55
|
+
"types": "./lib/test.d.ts",
|
|
56
|
+
"default": "./lib/test.js"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"main": "lib/index.js",
|
|
60
|
+
"types": "lib/index.d.ts",
|
|
61
|
+
"files": [
|
|
62
|
+
"lib",
|
|
63
|
+
"src",
|
|
64
|
+
"!lib/**/*.tsbuildinfo"
|
|
65
|
+
],
|
|
66
|
+
"scripts": {
|
|
67
|
+
"build": "tsc -b",
|
|
68
|
+
"clean": "rimraf lib tsconfig.tsbuildinfo",
|
|
69
|
+
"lint": "eslint src --max-warnings 0",
|
|
70
|
+
"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);}\"",
|
|
71
|
+
"test": "npm run typecheck:test && vitest run",
|
|
72
|
+
"typecheck:test": "tsc --noEmit -p tsconfig.test.json",
|
|
73
|
+
"watch": "tsc -b -w --preserveWatchOutput"
|
|
74
|
+
},
|
|
75
|
+
"dependencies": {
|
|
76
|
+
"langium": "4.3.1"
|
|
77
|
+
},
|
|
78
|
+
"devDependencies": {
|
|
79
|
+
"rimraf": "^5.0.0",
|
|
80
|
+
"typescript": "^5.8.0"
|
|
81
|
+
},
|
|
82
|
+
"engines": {
|
|
83
|
+
"node": ">=22.13"
|
|
84
|
+
},
|
|
85
|
+
"publishConfig": {
|
|
86
|
+
"access": "public"
|
|
87
|
+
},
|
|
88
|
+
"//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.",
|
|
89
|
+
"//sideEffects": "NOT `false`, and the two entries are load-bearing. `augmentations/uri-utils.js` mutates the runtime `UriUtils` object it imports from `langium`, and `index.js` is the only module that loads it — everything else there is `export * from 'langium'`. Declared side-effect-free, a bundler rewrites an import of any symbol from this package straight through to `langium` and skips `index.js` entirely, so `UriUtils.toUri` / `.isAncestorOrEqual` are simply absent at runtime. Nothing fails at build time: the augmentation is a type-level `declare module` merge, so the call still typechecks. `./lsp` and `./node` are pure passthroughs of the upstream subpaths and deliberately not listed."
|
|
90
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
/**
|
|
11
|
+
* Augments Langium's {@link AstNode} with a `$synthetic` marker —
|
|
12
|
+
* `true` when the node was programmatically constructed rather than
|
|
13
|
+
* parsed from source.
|
|
14
|
+
*
|
|
15
|
+
* This is a pure, ambient type-level merge: it widens the canonical
|
|
16
|
+
* `langium` `AstNode` interface so the marker is visible on every
|
|
17
|
+
* AST-derived type (generated subtypes, `$container` hops, `AstUtils`
|
|
18
|
+
* return types) regardless of import path. It carries no runtime code.
|
|
19
|
+
* The behaviour-bearing side of the synthetic concept — `markSynthetic`
|
|
20
|
+
* / `markSyntheticTree` / `isSyntheticNode` and the validation-skip
|
|
21
|
+
* default that reads them — lives in `@hydranium/core`; this package
|
|
22
|
+
* owns only the type widening.
|
|
23
|
+
*
|
|
24
|
+
* Adopters may further narrow this on grammar-specific AST types to give
|
|
25
|
+
* synthetic mirrors a literal-type compile-time hint at construction
|
|
26
|
+
* sites.
|
|
27
|
+
*/
|
|
28
|
+
declare module 'langium' {
|
|
29
|
+
interface AstNode {
|
|
30
|
+
/**
|
|
31
|
+
* Marks the node as synthetic — programmatically constructed, not
|
|
32
|
+
* parsed from source. Synthetic nodes are skipped during validation
|
|
33
|
+
* by default, via `HydraniumDocumentValidator.shouldSkipValidation`.
|
|
34
|
+
*/
|
|
35
|
+
readonly $synthetic?: boolean;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
import { URI, UriUtils } from 'langium';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Namespace augmentation: extend Langium's `UriUtils` with framework
|
|
14
|
+
* helpers, so the framework's URI utilities sit on the same namespace as
|
|
15
|
+
* Langium's own rather than on a second surface adopters have to discover
|
|
16
|
+
* separately.
|
|
17
|
+
*
|
|
18
|
+
* **Side-effect import.** This module mutates the runtime `UriUtils`
|
|
19
|
+
* object. It is loaded by this package's entry point (`index.ts`), so
|
|
20
|
+
* importing anything from `@hydranium/langium` — which every framework
|
|
21
|
+
* package does — makes the augmented members visible process-wide. Code
|
|
22
|
+
* that imports `UriUtils` from `langium` without ever loading the
|
|
23
|
+
* framework sees only the stock surface, which is correct.
|
|
24
|
+
*
|
|
25
|
+
* **Rejected: plain exported `toUri` / `isAncestorOrEqual` functions.**
|
|
26
|
+
* They would avoid the side-effect import, which can break under
|
|
27
|
+
* tree-shaking or CJS interop, at the cost of the single-namespace
|
|
28
|
+
* discovery above. Neither hazard reaches a framework consumer: Langium is
|
|
29
|
+
* a non-optional dependency, so the chokepoint is always loaded in a real
|
|
30
|
+
* composition, and type-only imports are erased.
|
|
31
|
+
*/
|
|
32
|
+
declare module 'langium' {
|
|
33
|
+
namespace UriUtils {
|
|
34
|
+
/**
|
|
35
|
+
* Normalise a `URI | string` argument to a `URI`, so a public API
|
|
36
|
+
* accepting both forms does not have to inline the coercion.
|
|
37
|
+
*/
|
|
38
|
+
function toUri(value: URI | string): URI;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* `true` when `ancestor` is the same file or a parent folder of
|
|
42
|
+
* `descendant`. Both URIs must share scheme and authority for the
|
|
43
|
+
* comparison to be meaningful — different schemes always return `false`.
|
|
44
|
+
*
|
|
45
|
+
* **vs. `UriUtils.contains`**: `contains(parent, child)` does the
|
|
46
|
+
* same path-prefix check but **ignores scheme and authority** — a
|
|
47
|
+
* `file:` URI can "contain" an `untitled:` URI. Use this stricter
|
|
48
|
+
* variant when scheme correctness matters, and `contains` where
|
|
49
|
+
* scheme equality is already implied by context.
|
|
50
|
+
*/
|
|
51
|
+
function isAncestorOrEqual(ancestor: URI, descendant: URI): boolean;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function toUri(value: URI | string): URI {
|
|
56
|
+
return typeof value === 'string' ? URI.parse(value) : value;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function isAncestorOrEqual(ancestor: URI, descendant: URI): boolean {
|
|
60
|
+
if (ancestor.scheme !== descendant.scheme || ancestor.authority !== descendant.authority) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
const ancestorPath = ancestor.fsPath;
|
|
64
|
+
const descendantPath = descendant.fsPath;
|
|
65
|
+
if (descendantPath === ancestorPath) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
const trailing = ancestorPath.endsWith('/') || ancestorPath.endsWith('\\');
|
|
69
|
+
const prefix = trailing ? ancestorPath : ancestorPath + '/';
|
|
70
|
+
return descendantPath.startsWith(prefix) || descendantPath.startsWith(ancestorPath + '\\');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Runtime attachment. `UriUtils` is a namespace, so at runtime it is a plain
|
|
74
|
+
// object that accepts added properties; the cast only strips its declared
|
|
75
|
+
// shape, and the augmentation block above supplies the type-level merge.
|
|
76
|
+
(UriUtils as { toUri: typeof toUri; isAncestorOrEqual: typeof isAncestorOrEqual }).toUri = toUri;
|
|
77
|
+
(UriUtils as { toUri: typeof toUri; isAncestorOrEqual: typeof isAncestorOrEqual }).isAncestorOrEqual = isAncestorOrEqual;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
/**
|
|
11
|
+
* `@hydranium/langium` — augmented re-export of the Langium API.
|
|
12
|
+
*
|
|
13
|
+
* This is the single chokepoint where the hydranium framework consumes
|
|
14
|
+
* Langium: it pins the Langium version (one physical copy, guaranteed by
|
|
15
|
+
* the root `overrides`/`resolutions`) and layers the framework's
|
|
16
|
+
* type/namespace augmentations. Framework packages AND adopters import
|
|
17
|
+
* Langium from here, not from `langium` directly — lint-enforced across
|
|
18
|
+
* the `packages` and `examples` trees alike, with any `generated`
|
|
19
|
+
* directory exempt because `langium-cli` emits direct imports there and
|
|
20
|
+
* regenerates them on every build.
|
|
21
|
+
*
|
|
22
|
+
* **Why adopters too, and it is not runtime identity.** Re-export is
|
|
23
|
+
* transparent: given one physical `langium`, importing a symbol from here
|
|
24
|
+
* and from `langium` yields the same object and the same declaration. The
|
|
25
|
+
* reason is VERSION COUPLING: `langium` sits in an atomic chain with
|
|
26
|
+
* `vscode-languageserver` / `-protocol` / `-jsonrpc` (see the `//langium`
|
|
27
|
+
* note in the root `package.json`), so an adopter importing it directly
|
|
28
|
+
* owns that pin itself and can drift out of lockstep with the framework it
|
|
29
|
+
* composes. Here, the framework owns it. This is also the place a Langium
|
|
30
|
+
* rename would be defensively patched, which a direct importer does not
|
|
31
|
+
* benefit from.
|
|
32
|
+
*
|
|
33
|
+
* The only curation is the ambient `$synthetic` `AstNode` widening and the
|
|
34
|
+
* `UriUtils` helper namespace; everything else is passthrough.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
// Ambient type-level augmentation of `AstNode` ($synthetic marker).
|
|
38
|
+
import './augmentations/synthetic.js';
|
|
39
|
+
// Side-effecting runtime augmentation of the `UriUtils` namespace.
|
|
40
|
+
import './augmentations/uri-utils.js';
|
|
41
|
+
|
|
42
|
+
export * from 'langium';
|
package/src/lsp.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
/**
|
|
11
|
+
* Chokepoint mirror of Langium's `langium/lsp` subpath — the LSP service
|
|
12
|
+
* defaults (`DefaultCompletionProvider`, etc.). Pure passthrough; it exists
|
|
13
|
+
* so framework packages and adopters reach every Langium subpath through
|
|
14
|
+
* this package and inherit its version pin instead of owning one themselves.
|
|
15
|
+
*/
|
|
16
|
+
export * from 'langium/lsp';
|
package/src/node.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
/**
|
|
11
|
+
* Chokepoint mirror of Langium's `langium/node` subpath — the Node.js
|
|
12
|
+
* filesystem provider (`NodeFileSystem`). Pure passthrough; it exists so
|
|
13
|
+
* framework packages and adopters reach every Langium subpath through this
|
|
14
|
+
* package and inherit its version pin instead of owning one themselves.
|
|
15
|
+
*/
|
|
16
|
+
export * from 'langium/node';
|
package/src/test.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
/**
|
|
11
|
+
* Chokepoint mirror of Langium's `langium/test` subpath — parsing and
|
|
12
|
+
* validation test helpers. Pure passthrough; it exists so framework packages
|
|
13
|
+
* and adopters reach every Langium subpath through this package and inherit
|
|
14
|
+
* its version pin instead of owning one themselves.
|
|
15
|
+
*/
|
|
16
|
+
export * from 'langium/test';
|