@akanjs/language 3.1.2-rc.3 → 3.2.0-rc.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.ko.md CHANGED
@@ -40,3 +40,44 @@ index.renameAt(fileName, offset, "inFeed", readText);
40
40
  키에서 만들어진 이름 전부와 모듈 dictionary의 키와 함께 바꾸는 편집을 돌려줍니다.
41
41
 
42
42
  ES module과 CommonJS로 배포하며, 런타임 의존성은 없습니다.
43
+
44
+ ## 언어 서버
45
+
46
+ `akan-language-server --stdio`는 같은 색인을 LSP로 냅니다. Akan 확장이 있는 VS Code와 Cursor 말고 다른 에디터를
47
+ 위한 것입니다. TypeScript 서버 옆에 띄우면 에디터가 두 서버의 답을 합쳐 줍니다. 정의, hover, 참조를 답합니다.
48
+ 에디터의 루트나 그 위에서 가장 가까운, `apps/*`나 `libs/*`에 `akan.config.ts`가 있는 폴더를 색인합니다. 에디터가
49
+ watched-file 등록을 지원하면 디스크에서 바뀐 파일도 다시 읽습니다.
50
+
51
+ 설치 절처럼 워크스페이스에 추가해서 bin이 `node_modules/.bin`에 들어가게 하세요. 그러면 `bunx --no-install`이 그
52
+ 사본을 실행하고, 레지스트리에서 받아 오지 않습니다.
53
+
54
+ Neovim 0.11 이상:
55
+
56
+ ```lua
57
+ vim.lsp.config("akan", {
58
+ cmd = function(dispatchers, config)
59
+ return vim.lsp.rpc.start({ "bunx", "--no-install", "akan-language-server", "--stdio" }, dispatchers, {
60
+ cwd = config.root_dir,
61
+ })
62
+ end,
63
+ filetypes = { "typescript", "typescriptreact" },
64
+ root_markers = { "bun.lock" },
65
+ })
66
+ vim.lsp.enable("akan")
67
+ ```
68
+
69
+ Helix의 `languages.toml`:
70
+
71
+ ```toml
72
+ [language-server.akan]
73
+ command = "bunx"
74
+ args = ["--no-install", "akan-language-server", "--stdio"]
75
+
76
+ [[language]]
77
+ name = "typescript"
78
+ language-servers = ["typescript-language-server", "akan"]
79
+
80
+ [[language]]
81
+ name = "tsx"
82
+ language-servers = ["typescript-language-server", "akan"]
83
+ ```
package/README.md CHANGED
@@ -40,3 +40,45 @@ name resolves within its own app and every lib, never another app. `renameAt` re
40
40
  query key together with every name derived from it and its key in the module dictionary.
41
41
 
42
42
  The package ships as an ES module and as CommonJS, with no runtime dependency.
43
+
44
+ ## Language server
45
+
46
+ `akan-language-server --stdio` serves the same index over LSP. It is for editors other than VS Code and Cursor,
47
+ which have the Akan extension. Run it next to TypeScript's server, and the editor merges the two servers' answers. It
48
+ answers definition, hover and references. It indexes the nearest folder at or above the editor's root whose `apps/*`
49
+ or `libs/*` holds an `akan.config.ts`. It rereads files changed on disk when the editor supports watched-file
50
+ registration.
51
+
52
+ Add it to the workspace, as in Install, so the bin lands in `node_modules/.bin`. `bunx --no-install` then runs that
53
+ copy and never fetches one from the registry.
54
+
55
+ Neovim 0.11 or later:
56
+
57
+ ```lua
58
+ vim.lsp.config("akan", {
59
+ cmd = function(dispatchers, config)
60
+ return vim.lsp.rpc.start({ "bunx", "--no-install", "akan-language-server", "--stdio" }, dispatchers, {
61
+ cwd = config.root_dir,
62
+ })
63
+ end,
64
+ filetypes = { "typescript", "typescriptreact" },
65
+ root_markers = { "bun.lock" },
66
+ })
67
+ vim.lsp.enable("akan")
68
+ ```
69
+
70
+ Helix, in `languages.toml`:
71
+
72
+ ```toml
73
+ [language-server.akan]
74
+ command = "bunx"
75
+ args = ["--no-install", "akan-language-server", "--stdio"]
76
+
77
+ [[language]]
78
+ name = "typescript"
79
+ language-servers = ["typescript-language-server", "akan"]
80
+
81
+ [[language]]
82
+ name = "tsx"
83
+ language-servers = ["typescript-language-server", "akan"]
84
+ ```
package/akanGraph.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { AkanGraph } from "akanjs/common/akanGraph.ts";
2
2
  import type * as TS from "typescript";
3
3
  import type { Ts } from "./ast";
4
- import type { FileFacts } from "./moduleFacts";
4
+ import { type AkanFactReader, type FileFacts } from "./moduleFacts";
5
5
  import type { AkanTarget } from "./nameTable";
6
6
  export interface AkanGraphSource {
7
7
  ts: Ts;
@@ -12,6 +12,8 @@ export interface AkanGraphSource {
12
12
  resolve: (fileName: string, identifier: TS.Identifier) => AkanTarget[];
13
13
  relative: (fileName: string) => string;
14
14
  ownerOf: (fileName: string) => string | null;
15
+ reader: AkanFactReader;
16
+ digests?: boolean;
15
17
  }
16
18
  export declare class GraphBuilder {
17
19
  #private;
@@ -0,0 +1,10 @@
1
+ import type { AkanGraph, AkanGraphChange } from "akanjs/common/akanGraph.ts";
2
+ export interface AkanGraphChanges extends AkanGraph {
3
+ summary: {
4
+ [change in AkanGraphChange]: number;
5
+ };
6
+ }
7
+ export declare class AkanGraphDiff {
8
+ #private;
9
+ static between(base: AkanGraph, head: AkanGraph): AkanGraphChanges;
10
+ }
package/akanIndex.d.ts CHANGED
@@ -33,7 +33,9 @@ export declare class AkanIndex {
33
33
  sourceKeysOf(givenName: string): AkanSourceKey[];
34
34
  sourceKeyAt(givenName: string, offset: number): AkanSourceKey | null;
35
35
  referencesAt(givenName: string, offset: number, readText: (fileName: string) => string | undefined): AkanSpan[];
36
- graph(readText: (fileName: string) => string | undefined): AkanGraph;
36
+ graph(readText: (fileName: string) => string | undefined, { digests }?: {
37
+ digests?: boolean | undefined;
38
+ }): AkanGraph;
37
39
  renameTargetAt(givenName: string, offset: number): {
38
40
  family: AkanFamily;
39
41
  sourceKey: string;
@@ -0,0 +1,16 @@
1
+ import type { FrameworkChannel } from "akanjs/common/frameworkMap.ts";
2
+ import type * as TS from "typescript";
3
+ import type { Ts } from "./ast";
4
+ export interface FrameworkChannelSpec {
5
+ file: string;
6
+ union: string;
7
+ label: string;
8
+ /** Classes that route the channel's messages by `type` on their way to the handlers, who sit beyond the reader. */
9
+ relays?: string[];
10
+ }
11
+ export declare class FrameworkChannelReader {
12
+ #private;
13
+ constructor(ts: Ts, specs: FrameworkChannelSpec[], sources: Map<string, TS.SourceFile>);
14
+ get missing(): string[];
15
+ channels(): FrameworkChannel[];
16
+ }
@@ -0,0 +1,20 @@
1
+ import type { FrameworkMap } from "akanjs/common/frameworkMap.ts";
2
+ import type { Ts } from "./ast";
3
+ import { type FrameworkChannelSpec } from "./frameworkChannelReader";
4
+ export interface FrameworkSourcePackage {
5
+ name: string;
6
+ root: string;
7
+ split: boolean;
8
+ }
9
+ export interface FrameworkMapSource {
10
+ ts: Ts;
11
+ packages: FrameworkSourcePackage[];
12
+ files: [file: string, text: string][];
13
+ channels: FrameworkChannelSpec[];
14
+ }
15
+ export declare class FrameworkMapBuilder {
16
+ #private;
17
+ constructor(source: FrameworkMapSource);
18
+ static isSourcePath(file: string): boolean;
19
+ build(): FrameworkMap;
20
+ }
@@ -0,0 +1,10 @@
1
+ import type { FrameworkMap } from "akanjs/common/frameworkMap.ts";
2
+ export declare class FrameworkMapDoc {
3
+ #private;
4
+ static readonly regenerate = "bun run akan sync-architecture";
5
+ static render(map: FrameworkMap, docDir: string): string;
6
+ static generatedOf(markdown: string): string | null;
7
+ static splice(markdown: string, generated: string): string;
8
+ static citedClasses(markdown: string): string[];
9
+ static unknownClasses(markdown: string, map: FrameworkMap): string[];
10
+ }