@manifest-configuration-language/browser 0.2.0 → 0.3.0

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 CHANGED
@@ -29,9 +29,9 @@ An open project is a Worker-backed session. Call `project.update(files)` with th
29
29
 
30
30
  `project.complete({ entrypoint, position })` returns the MCL language-service candidates for a zero-based UTF-16 position. Completion uses the same local project files as parsing and rendering, including schemas and Helm values schemas. It does not access a Kubernetes API server or any other network service.
31
31
 
32
- `project.definition({ entrypoint, position })` returns a project-relative declaration path and zero-based UTF-16 range for local and imported MCL declarations. `project.hover({ entrypoint, position })` returns declaration syntax, including explicit type annotations and function or rule signatures. Hover does not infer runtime value types, and both operations use only project files already supplied to the browser runtime.
32
+ `project.definition({ entrypoint, position })` returns a project-relative declaration path and zero-based UTF-16 range for local and imported MCL declarations. `project.hover({ entrypoint, position })` returns declaration syntax, including explicit type annotations and function or rule signatures. `project.references({ entrypoint, position })` returns the declaration and references found in the supplied MCL project. These operations use only project files already supplied to the browser runtime.
33
33
 
34
- The package exports the completion, definition, hover, rename, and source map result types, `maxSourceBytes`, `maxSourceMapBytes`, `maxRenameNameLength`, `maxProjectFiles`, `maxProjectFileBytes`, and `maxProjectBytes` so browser interfaces can consume the runtime's public types and limits. `isValidProjectFileSet(paths)` checks path validity, duplicate paths, and file/directory conflicts before a UI creates or renames project files. `rename()` returns source edits for local and non-exported top-level declarations within the active file; exported and cross-file symbols are left unchanged so the result never omits external references.
34
+ The package exports the completion, definition, hover, references, rename, and source map result types, `maxSourceBytes`, `maxSourceMapBytes`, `maxRenameNameLength`, `maxProjectFiles`, `maxProjectFileBytes`, and `maxProjectBytes` so browser interfaces can consume the runtime's public types and limits. `isValidProjectFileSet(paths)` checks path validity, duplicate paths, and file/directory conflicts before a UI creates or renames project files. `rename()` returns edits for local symbols and exported declarations, including qualified value and type references in the supplied MCL project. It returns no edits when a rename would be ambiguous or collide with an existing exported declaration.
35
35
 
36
36
  MCL decodes the request into a root-relative `io/fs` filesystem for project files, module imports, schemas, and dependency locks. Kubernetes resource scope checks use built-in metadata and CRDs in the project; unknown resource kinds can still be rendered. The runtime limits are defined in the [protocol schema](https://github.com/manifest-configuration-language/mcl/blob/main/cmd/mcl-wasm/protocol.schema.json). The worker blocks `fetch` after loading the WASM runtime assets, so MCL project evaluation cannot make external network requests.
37
37
 
package/dist/mcl.wasm CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/mcl.wasm
3
- size: 96317496 bytes
4
- sha256: 58f90cac0af9f6b4608f787528617729b99a6fcb65db52f168f95a1a6703e98f
3
+ size: 96778456 bytes
4
+ sha256: 037981cf0ac4773dca73ca1cd9ddffa8b9e9b25aedb15d8c72b1be8ea26c5558
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manifest-configuration-language/browser",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Run MCL projects in a browser Web Worker using the Go WebAssembly runtime.",
5
5
  "repository": {
6
6
  "type": "git",
package/src/index.d.ts CHANGED
@@ -13,6 +13,8 @@ import type {
13
13
  LintDiagnostic as ProtocolLintDiagnostic,
14
14
  ParseResult,
15
15
  RelatedLocation as ProtocolRelatedLocation,
16
+ ReferenceLocation as ProtocolReferenceLocation,
17
+ ReferencesResult as ProtocolReferencesResult,
16
18
  RenderResult,
17
19
  RenameEdit as ProtocolRenameEdit,
18
20
  RenameResult as ProtocolRenameResult,
@@ -52,6 +54,8 @@ export type HoverResult = ProtocolHoverResult;
52
54
  export type HoverInfo = ProtocolHoverInfo;
53
55
  export type RenameEdit = ProtocolRenameEdit;
54
56
  export type RenameResult = ProtocolRenameResult;
57
+ export type ReferenceLocation = ProtocolReferenceLocation;
58
+ export type ReferencesResult = ProtocolReferencesResult;
55
59
  export type SourceRange = ProtocolSourceRange;
56
60
  export type SourceMap = ProtocolSourceMap;
57
61
  export type SourceMapEntry = ProtocolSourceMapEntry;
@@ -63,6 +67,7 @@ export type MclResult =
63
67
  | ({ operation: "completion" } & ProtocolCompletionResult)
64
68
  | ({ operation: "definition" } & ProtocolDefinitionResult)
65
69
  | ({ operation: "hover" } & ProtocolHoverResult)
70
+ | ({ operation: "references" } & ProtocolReferencesResult)
66
71
  | ({ operation: "rename" } & ProtocolRenameResult)
67
72
  | ({ operation: "format" } & FormatResult)
68
73
  | ({ operation: "check" } & CheckResult)
@@ -114,6 +119,15 @@ export interface MclRuntime {
114
119
  files: ProjectFiles | undefined,
115
120
  options: PositionRequestOptions,
116
121
  ): Promise<MclResult & { operation: "hover" }>;
122
+ references(
123
+ source: string,
124
+ options: PositionRequestOptions,
125
+ ): Promise<MclResult & { operation: "references" }>;
126
+ references(
127
+ source: string,
128
+ files: ProjectFiles | undefined,
129
+ options: PositionRequestOptions,
130
+ ): Promise<MclResult & { operation: "references" }>;
117
131
  rename(
118
132
  source: string,
119
133
  options: RenameRequestOptions,
@@ -134,6 +148,7 @@ export interface MclProject {
134
148
  complete(options: ProjectCompletionOptions): Promise<MclResult & { operation: "completion" }>;
135
149
  definition(options: ProjectNavigationOptions): Promise<MclResult & { operation: "definition" }>;
136
150
  hover(options: ProjectNavigationOptions): Promise<MclResult & { operation: "hover" }>;
151
+ references(options: ProjectNavigationOptions): Promise<MclResult & { operation: "references" }>;
137
152
  rename(options: ProjectRenameOptions): Promise<MclResult & { operation: "rename" }>;
138
153
  format(options?: ProjectOperationOptions): Promise<MclResult & { operation: "format" }>;
139
154
  check(options?: ProjectOperationOptions): Promise<MclResult & { operation: "check" }>;
package/src/index.js CHANGED
@@ -507,6 +507,7 @@ export function createMclRuntime(options = {}) {
507
507
  complete: (requestOptions) => runProjectOperation("completion", requestOptions),
508
508
  definition: (requestOptions) => runProjectOperation("definition", requestOptions),
509
509
  hover: (requestOptions) => runProjectOperation("hover", requestOptions),
510
+ references: (requestOptions) => runProjectOperation("references", requestOptions),
510
511
  rename: (requestOptions) => runProjectOperation("rename", requestOptions),
511
512
  format: (requestOptions) => runProjectOperation("format", requestOptions),
512
513
  check: (requestOptions) => runProjectOperation("check", requestOptions),
@@ -587,6 +588,8 @@ export function createMclRuntime(options = {}) {
587
588
  runSourceNavigation("definition", source, filesOrOptions, requestOptions),
588
589
  hover: (source, filesOrOptions, requestOptions) =>
589
590
  runSourceNavigation("hover", source, filesOrOptions, requestOptions),
591
+ references: (source, filesOrOptions, requestOptions) =>
592
+ runSourceNavigation("references", source, filesOrOptions, requestOptions),
590
593
  rename: (source, filesOrOptions, requestOptions) =>
591
594
  runSourceNavigation("rename", source, filesOrOptions, requestOptions),
592
595
  dispose() {
package/src/protocol.d.ts CHANGED
@@ -5,7 +5,17 @@ export type Request = {
5
5
  requestId?: number;
6
6
  revision?: number;
7
7
  operation:
8
- "parse" | "lint" | "format" | "check" | "evaluate" | "render" | "completion" | "definition" | "hover" | "rename";
8
+ | "parse"
9
+ | "lint"
10
+ | "format"
11
+ | "check"
12
+ | "evaluate"
13
+ | "render"
14
+ | "completion"
15
+ | "definition"
16
+ | "hover"
17
+ | "references"
18
+ | "rename";
9
19
  position?: CompletionPosition;
10
20
  newName?: string;
11
21
  entrypoint?: ProjectPath;
@@ -53,6 +63,7 @@ export interface Response {
53
63
  | CompletionResult
54
64
  | DefinitionResult
55
65
  | HoverResult
66
+ | ReferencesResult
56
67
  | RenameResult;
57
68
  error?: Error;
58
69
  }
@@ -136,6 +147,13 @@ export interface HoverInfo {
136
147
  contents: string;
137
148
  range: SourceRange;
138
149
  }
150
+ export interface ReferencesResult {
151
+ references: ReferenceLocation[];
152
+ }
153
+ export interface ReferenceLocation {
154
+ path: ProjectPath1;
155
+ range: SourceRange;
156
+ }
139
157
  export interface RenameResult {
140
158
  edits: RenameEdit[];
141
159
  }