@azerothjs/language-server 0.4.0-beta.2 → 0.5.0-beta.1

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
@@ -39,20 +39,51 @@ back any other host without this package.
39
39
  | `tsc-cli.ts` | Executable entry point (`azeroth-tsc`); runs one check and sets the exit code. |
40
40
  | `index.ts` | Library entry point; exports `startServer` and `runTsc`. |
41
41
 
42
- ### `azeroth-tsc` (command-line type checking)
42
+ ### `azeroth-tsc` (combined command-line type checking)
43
43
 
44
44
  `tsc` cannot parse `.azeroth`, so this package ships `azeroth-tsc`, the `vue-tsc`
45
- equivalent. It reuses the language service to compile each `.azeroth` file to its
46
- virtual TypeScript module, type-check it against the project's tsconfig, and print
47
- `tsc`-style diagnostics mapped back to the original `.azeroth` positions, exiting
48
- non-zero on the first error. It is a `--noEmit` gate (the Vite plugin / compiler
49
- owns code emit), meant to run in CI and pre-commit beside `tsc`:
45
+ equivalent. It builds ONE TypeScript program containing BOTH the project's real
46
+ `.ts` files AND every `.azeroth` file (compiled to its virtual TypeScript module
47
+ by the language service). Because both live in the same program:
48
+
49
+ - a `.ts` file importing `'./x.component.azeroth'` resolves the component's REAL
50
+ default, named, and type exports - no `declare module '*.azeroth'` shim;
51
+ - `.azeroth` <-> `.azeroth` and `.azeroth` <-> `.ts` imports resolve both ways;
52
+ - `.azeroth` internals (including typed component tags) are checked;
53
+ - diagnostics map back to original `.ts`/`.azeroth` positions.
54
+
55
+ It is a `--noEmit` gate (the Vite plugin / compiler owns code emit) that
56
+ REPLACES `tsc`:
50
57
 
51
58
  ```sh
52
- npx azeroth-tsc # check every .azeroth file under the cwd
59
+ npx azeroth-tsc # check the whole project (.ts + .azeroth)
53
60
  npx azeroth-tsc -p tsconfig.json
61
+ npx azeroth-tsc --watch # re-check on change (alias: -w)
54
62
  ```
55
63
 
64
+ #### Build wiring
65
+
66
+ One checker covers the whole project, so the canonical consumer build is just
67
+ the checker plus the bundler:
68
+
69
+ ```jsonc
70
+ // package.json
71
+ {
72
+ "scripts": {
73
+ "build": "azeroth-tsc && vite build",
74
+ "typecheck": "azeroth-tsc",
75
+ "dev:check": "azeroth-tsc --watch"
76
+ }
77
+ }
78
+ ```
79
+
80
+ With Vite installed, the consumer needs no `declare module '*.azeroth'` shim and
81
+ no `vite-env.d.ts` / `"types": ["vite/client"]` entry: `import.meta.env`,
82
+ `*.png` / `?url` asset imports, and cross-file `.azeroth` types all resolve.
83
+ `@azerothjs/typescript-plugin` gives the editor's TypeScript server the same
84
+ `.ts` -> `.azeroth` resolution live; `azeroth-tsc` is the matching CI/pre-commit
85
+ gate.
86
+
56
87
  ### Settings
57
88
 
58
89
  On initialization the server reads `initializationOptions` and, when the client
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { startServer } from './server.ts';
2
- export { runTsc, parseArgs, type TscOptions, type TscResult } from './tsc.ts';
2
+ export { runTsc, watchTsc, parseArgs, type TscOptions, type TscResult, type TscWatcher } from './tsc.ts';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC"}
package/dist/index.js CHANGED
@@ -5,5 +5,5 @@
5
5
  // re-exports it so the server can also be embedded (e.g. in a web worker host
6
6
  // or an integration test that drives it through an in-memory connection).
7
7
  export { startServer } from "./server.js";
8
- export { runTsc, parseArgs } from "./tsc.js";
8
+ export { runTsc, watchTsc, parseArgs } from "./tsc.js";
9
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,EAAE;AACF,4EAA4E;AAC5E,gFAAgF;AAChF,8EAA8E;AAC9E,0EAA0E;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,SAAS,EAAmC,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,EAAE;AACF,4EAA4E;AAC5E,gFAAgF;AAChF,8EAA8E;AAC9E,0EAA0E;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAoD,MAAM,UAAU,CAAC"}
package/dist/tsc-cli.js CHANGED
@@ -3,7 +3,15 @@
3
3
  // non-zero when any `.azeroth` file has an error, so it drops into CI and
4
4
  // pre-commit the same way `tsc --noEmit` does. All behaviour lives in the
5
5
  // testable `runTsc`.
6
- import { runTsc, parseArgs } from "./tsc.js";
7
- const { errorCount } = runTsc(parseArgs(process.argv.slice(2)));
8
- process.exit(errorCount > 0 ? 1 : 0);
6
+ import { runTsc, watchTsc, parseArgs } from "./tsc.js";
7
+ const options = parseArgs(process.argv.slice(2));
8
+ if (options.watch) {
9
+ // The fs watcher keeps the event loop alive; the process stays up until the
10
+ // user interrupts it. Errors are reported each pass but don't exit the loop.
11
+ watchTsc(options);
12
+ }
13
+ else {
14
+ const { errorCount } = runTsc(options);
15
+ process.exit(errorCount > 0 ? 1 : 0);
16
+ }
9
17
  //# sourceMappingURL=tsc-cli.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tsc-cli.js","sourceRoot":"","sources":["../src/tsc-cli.ts"],"names":[],"mappings":";AACA,4EAA4E;AAC5E,0EAA0E;AAC1E,0EAA0E;AAC1E,qBAAqB;AAErB,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChE,OAAO,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"tsc-cli.js","sourceRoot":"","sources":["../src/tsc-cli.ts"],"names":[],"mappings":";AACA,4EAA4E;AAC5E,0EAA0E;AAC1E,0EAA0E;AAC1E,qBAAqB;AAErB,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAEvD,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAEjD,IAAI,OAAO,CAAC,KAAK,EACjB,CAAC;IACG,4EAA4E;IAC5E,6EAA6E;IAC7E,QAAQ,CAAC,OAAO,CAAC,CAAC;AACtB,CAAC;KAED,CAAC;IACG,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IACvC,OAAO,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC"}
package/dist/tsc.d.ts CHANGED
@@ -4,12 +4,21 @@ export interface TscOptions {
4
4
  cwd?: string;
5
5
  /** Explicit tsconfig path; otherwise the nearest one is used. */
6
6
  project?: string;
7
+ /** Re-check on every `.azeroth` change instead of running once. */
8
+ watch?: boolean;
7
9
  /** Sink for formatted output (default: stdout). */
8
10
  write?: (text: string) => void;
9
11
  }
12
+ /** A running watch session. */
13
+ export interface TscWatcher {
14
+ /** Runs one full check pass now (re-reading files from disk). */
15
+ recheck: () => TscResult;
16
+ /** Stops watching and releases the file-system watcher. */
17
+ close: () => void;
18
+ }
10
19
  /** Outcome of a check run. */
11
20
  export interface TscResult {
12
- /** Number of `.azeroth` files checked. */
21
+ /** Number of files checked (`.azeroth` + `.ts`). */
13
22
  fileCount: number;
14
23
  /** Number of error-severity diagnostics found. */
15
24
  errorCount: number;
@@ -28,4 +37,20 @@ export declare function parseArgs(argv: string[]): TscOptions;
28
37
  * ```
29
38
  */
30
39
  export declare function runTsc(options?: TscOptions): TscResult;
40
+ /**
41
+ * Runs an initial check, then re-checks whenever a `.azeroth` file under `cwd`
42
+ * changes. A single language service is reused across passes (each pass re-reads
43
+ * changed files from disk and bumps their version), so unchanged files and the
44
+ * lib/node_modules program are not re-parsed every time. Returns a handle:
45
+ * `recheck()` forces a pass (used by tests and the file watcher); `close()`
46
+ * stops watching. The returned watcher keeps the process alive via the
47
+ * underlying fs watcher.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * const w = watchTsc({ cwd: 'app' }); // checks now, then on every change
52
+ * // ... later: w.close();
53
+ * ```
54
+ */
55
+ export declare function watchTsc(options?: TscOptions): TscWatcher;
31
56
  //# sourceMappingURL=tsc.d.ts.map
package/dist/tsc.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tsc.d.ts","sourceRoot":"","sources":["../src/tsc.ts"],"names":[],"mappings":"AAcA,8CAA8C;AAC9C,MAAM,WAAW,UAAU;IAEvB,+DAA+D;IAC/D,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,mDAAmD;IACnD,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAED,8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,13 +1,17 @@
1
- // azeroth-tsc: a batch type-checker for `.azeroth` files, the vue-tsc
2
- // equivalent for this framework. `tsc` itself cannot parse `.azeroth` markup,
3
- // so this driver reuses the language service (which compiles each file to a
4
- // virtual TypeScript module and maps diagnostics back to original positions)
5
- // and prints them in the familiar `tsc` format. It is meant to run in CI and
6
- // pre-commit, alongside `tsc` for the surrounding `.ts`.
7
- //
8
- // Scope: this reports type errors in `.azeroth` files. It does not emit `.js`
9
- // (the Vite plugin / compiler does that) - like `tsc --noEmit`, it is a gate.
1
+ // azeroth-tsc: a combined `.ts` + `.azeroth` type-checker, the vue-tsc
2
+ // equivalent for this framework. `tsc` itself cannot parse `.azeroth` markup, so
3
+ // this driver builds ONE TypeScript program containing both the project's real
4
+ // `.ts` files AND every `.azeroth` file (compiled to a virtual TS module by the
5
+ // language service). Because both live in the same program:
6
+ // - a `.ts` file importing `'./x.component.azeroth'` resolves the component's
7
+ // REAL default/named/type exports (no `declare module '*.azeroth'` shim);
8
+ // - `.azeroth` <-> `.azeroth` and `.azeroth` <-> `.ts` imports resolve both ways;
9
+ // - `.azeroth` internals are still checked.
10
+ // Diagnostics map back to original `.ts`/`.azeroth` positions and print in the
11
+ // familiar `tsc` format. It does not emit `.js` (the Vite plugin / compiler does
12
+ // that) - like `tsc --noEmit`, it is a gate that REPLACES `tsc && azeroth-tsc`.
10
13
  import path from 'node:path';
14
+ import { watch as fsWatch } from 'node:fs';
11
15
  import ts from 'typescript';
12
16
  import { AzerothLanguageService, pathToUri, DiagnosticSeverity } from '@azerothjs/language-service';
13
17
  /** Parses the argv subset this CLI understands into {@link TscOptions}. */
@@ -21,6 +25,9 @@ export function parseArgs(argv) {
21
25
  else if (arg.startsWith('--project=')) {
22
26
  options.project = arg.slice('--project='.length);
23
27
  }
28
+ else if (arg === '--watch' || arg === '-w') {
29
+ options.watch = true;
30
+ }
24
31
  else if (!arg.startsWith('-')) {
25
32
  options.cwd = arg;
26
33
  }
@@ -43,16 +50,40 @@ export function runTsc(options = {}) {
43
50
  const write = options.write ?? ((text) => {
44
51
  process.stdout.write(text);
45
52
  });
53
+ // rootProjectFiles: pull the project's real `.ts` files into the same
54
+ // program as the `.azeroth` virtual modules, so the `.ts` side is checked and
55
+ // the `.ts` -> `.azeroth` import boundary resolves real types.
56
+ const service = new AzerothLanguageService(cwd, options.project, { rootProjectFiles: true });
57
+ return checkPass(service, cwd, write, new Set());
58
+ }
59
+ /**
60
+ * Runs one diagnostic pass over every `.azeroth` file under `cwd` using the
61
+ * given (possibly long-lived) service. `open` tracks which document URIs were
62
+ * open after the previous pass so files deleted since then are closed - this is
63
+ * what lets a single service be reused across watch passes without leaking
64
+ * stale documents. On return, `open` holds exactly the URIs seen this pass.
65
+ */
66
+ function checkPass(service, cwd, write, open) {
46
67
  const files = ts.sys.readDirectory(cwd, ['.azeroth'], ['**/node_modules/**', '**/dist/**', '**/.git/**'], ['**/*.azeroth']);
47
- const service = new AzerothLanguageService(cwd, options.project);
68
+ // On a reused service (watch), a file created or deleted since the last pass
69
+ // changes the program's root set; refresh discovery so cross-file resolution
70
+ // stays correct. Skipped on the first pass - the constructor just discovered.
71
+ if (open.size > 0 && files.length !== open.size) {
72
+ service.refreshWorkspace();
73
+ }
74
+ const seen = new Set();
48
75
  let errorCount = 0;
76
+ // 1) The `.azeroth` files: diagnostics map back to original markup positions.
49
77
  for (const file of files) {
50
78
  const source = ts.sys.readFile(file);
51
79
  if (source === undefined) {
52
80
  continue;
53
81
  }
54
82
  const uri = pathToUri(file);
55
- service.didOpen(uri, source);
83
+ seen.add(uri);
84
+ // didChange opens-or-updates: it bumps the version and invalidates just
85
+ // this file's virtual cache, so the reused service always reflects disk.
86
+ service.didChange(uri, source);
56
87
  for (const diag of service.getDiagnostics(uri)) {
57
88
  const isError = diag.severity === DiagnosticSeverity.Error;
58
89
  if (isError) {
@@ -61,13 +92,116 @@ export function runTsc(options = {}) {
61
92
  write(formatDiagnostic(cwd, file, diag, isError) + '\n');
62
93
  }
63
94
  }
95
+ // 2) The project's real `.ts` files (from tsconfig), checked in the
96
+ // same program - this is what lets a `.ts` barrel importing a `.azeroth`
97
+ // component type-check against real types, so the consumer can delete its
98
+ // `declare module '*.azeroth'` shim.
99
+ const tsFiles = service.getProjectTsFiles();
100
+ for (const file of tsFiles) {
101
+ for (const diag of service.getTsDiagnostics(file)) {
102
+ const isError = diag.severity === DiagnosticSeverity.Error;
103
+ if (isError) {
104
+ errorCount++;
105
+ }
106
+ write(formatDiagnostic(cwd, file, diag, isError) + '\n');
107
+ }
108
+ }
109
+ // Drop documents whose files vanished since the previous pass.
110
+ for (const uri of open) {
111
+ if (!seen.has(uri)) {
112
+ service.didClose(uri);
113
+ }
114
+ }
115
+ open.clear();
116
+ for (const uri of seen) {
117
+ open.add(uri);
118
+ }
119
+ const total = files.length + tsFiles.length;
64
120
  if (errorCount === 0) {
65
- write(`Checked ${files.length} .azeroth file(s); no type errors.\n`);
121
+ write(`Checked ${total} file(s) (${files.length} .azeroth, ${tsFiles.length} .ts); no type errors.\n`);
66
122
  }
67
123
  else {
68
- write(`\nFound ${errorCount} error(s) in ${files.length} .azeroth file(s).\n`);
124
+ write(`\nFound ${errorCount} error(s) across ${total} file(s) (${files.length} .azeroth, ${tsFiles.length} .ts).\n`);
69
125
  }
70
- return { fileCount: files.length, errorCount };
126
+ return { fileCount: total, errorCount };
127
+ }
128
+ /**
129
+ * Runs an initial check, then re-checks whenever a `.azeroth` file under `cwd`
130
+ * changes. A single language service is reused across passes (each pass re-reads
131
+ * changed files from disk and bumps their version), so unchanged files and the
132
+ * lib/node_modules program are not re-parsed every time. Returns a handle:
133
+ * `recheck()` forces a pass (used by tests and the file watcher); `close()`
134
+ * stops watching. The returned watcher keeps the process alive via the
135
+ * underlying fs watcher.
136
+ *
137
+ * @example
138
+ * ```ts
139
+ * const w = watchTsc({ cwd: 'app' }); // checks now, then on every change
140
+ * // ... later: w.close();
141
+ * ```
142
+ */
143
+ export function watchTsc(options = {}) {
144
+ const cwd = path.resolve(options.cwd ?? process.cwd());
145
+ const write = options.write ?? ((text) => {
146
+ process.stdout.write(text);
147
+ });
148
+ // One service for the whole session: lib.d.ts, node_modules and unchanged
149
+ // `.azeroth` files are parsed once and reused across passes via the document
150
+ // registry, instead of building a fresh program on every change. `open`
151
+ // tracks the open document set so deleted files are closed between passes.
152
+ const service = new AzerothLanguageService(cwd, options.project, { rootProjectFiles: true });
153
+ const open = new Set();
154
+ const recheck = () => {
155
+ write('\n[azeroth-tsc] checking...\n');
156
+ try {
157
+ // Re-scan + bump the project version so on-disk edits to BOTH
158
+ // `.ts` and `.azeroth` files are re-read this pass (the first pass
159
+ // skips it - the constructor just discovered).
160
+ if (open.size > 0) {
161
+ service.refreshWorkspace();
162
+ }
163
+ return checkPass(service, cwd, write, open);
164
+ }
165
+ catch (error) {
166
+ // A bad tsconfig or an unreadable file must not kill the watch loop;
167
+ // report it and keep watching.
168
+ const message = error instanceof Error ? error.message : String(error);
169
+ write(`[azeroth-tsc] check failed: ${message}\n`);
170
+ return { fileCount: 0, errorCount: 0 };
171
+ }
172
+ };
173
+ recheck();
174
+ let debounce = null;
175
+ let watcher;
176
+ try {
177
+ watcher = fsWatch(cwd, { recursive: true }, (_event, fileName) => {
178
+ // Recursive watch reports every file; only react to source the
179
+ // combined checker covers. AzerothJS projects are `.ts` + `.azeroth`
180
+ // (the `.azeroth` language replaces `.tsx`), so those two extensions.
181
+ if (fileName && !/\.(?:azeroth|ts)$/.test(String(fileName))) {
182
+ return;
183
+ }
184
+ if (debounce) {
185
+ clearTimeout(debounce);
186
+ }
187
+ debounce = setTimeout(recheck, 120);
188
+ });
189
+ write(`[azeroth-tsc] watching ${cwd} for .azeroth changes (Ctrl+C to exit)\n`);
190
+ }
191
+ catch {
192
+ // Recursive watch isn't supported on every platform; fall back to a
193
+ // one-shot check rather than crashing.
194
+ write('[azeroth-tsc] file watching unavailable on this platform; ran a single check\n');
195
+ }
196
+ return {
197
+ recheck,
198
+ close: () => {
199
+ if (debounce) {
200
+ clearTimeout(debounce);
201
+ }
202
+ watcher?.close();
203
+ }
204
+ };
71
205
  }
72
206
  /** Formats one diagnostic in `tsc`'s `file(line,col): error TSxxxx: msg` shape. */
73
207
  function formatDiagnostic(cwd, file, diag, isError) {
package/dist/tsc.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tsc.js","sourceRoot":"","sources":["../src/tsc.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,8EAA8E;AAC9E,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,yDAAyD;AACzD,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAE9E,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAyBpG,2EAA2E;AAC3E,MAAM,UAAU,SAAS,CAAC,IAAc;IAEpC,MAAM,OAAO,GAAe,EAAE,CAAC;IAC/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EACpC,CAAC;QACG,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,IAAI,GAAG,KAAK,WAAW,IAAI,GAAG,KAAK,IAAI,EACvC,CAAC;YACG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QAChC,CAAC;aACI,IAAI,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC,EACrC,CAAC;YACG,OAAO,CAAC,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QACrD,CAAC;aACI,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAC7B,CAAC;YACG,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC;QACtB,CAAC;IACL,CAAC;IACD,OAAO,OAAO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;QACH,KAAK,CAAC,0BAA2B,GAAI,0CAA0C,CAAC,CAAC;IACrF,CAAC;IACD,MACA,CAAC;QACG,oEAAoE;QACpE,uCAAuC;QACvC,KAAK,CAAC,gFAAgF,CAAC,CAAC;IAC5F,CAAC;IAED,OAAO;QACH,OAAO;QACP,KAAK,EAAE,GAAS,EAAE;YAEd,IAAI,QAAQ,EACZ,CAAC;gBACG,YAAY,CAAC,QAAQ,CAAC,CAAC;YAC3B,CAAC;YACD,OAAO,EAAE,KAAK,EAAE,CAAC;QACrB,CAAC;KACJ,CAAC;AACN,CAAC;AAED,mFAAmF;AACnF,SAAS,gBAAgB,CACrB,GAAW,EACX,IAAY,EACZ,IAAwG,EACxG,OAAgB;IAGhB,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACzD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC;IAC9C,MAAM,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/C,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAO,IAAI,CAAC,IAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACtE,OAAO,GAAI,GAAI,IAAK,IAAK,IAAK,MAAO,MAAO,QAAS,GAAI,IAAK,KAAM,IAAI,CAAC,OAAQ,EAAE,CAAC;AACxF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azerothjs/language-server",
3
- "version": "0.4.0-beta.2",
3
+ "version": "0.5.0-beta.1",
4
4
  "description": "AzerothJS language server — a Language Server Protocol front-end for .azeroth files",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -28,7 +28,7 @@
28
28
  ],
29
29
  "dependencies":
30
30
  {
31
- "@azerothjs/language-service": "0.4.0-beta.2",
31
+ "@azerothjs/language-service": "0.5.0-beta.1",
32
32
  "typescript": ">=5",
33
33
  "vscode-languageserver": "^9",
34
34
  "vscode-languageserver-textdocument": "^1"