@forinda/kickjs-view-language-server 0.4.1 → 0.5.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
@@ -36,4 +36,4 @@ Initialization options, relative to the workspace folder:
36
36
 
37
37
  Any file ending in `.kick` is a template, whatever `languageId` the editor sends. The custom request `kick/templateNames` returns every template name except components.
38
38
 
39
- See the [views guide](https://kickjs.app/guide/views#editor-support).
39
+ See the [views guide](https://kickjs.app/guide/views/tooling#editor-support).
package/dist/index.d.ts CHANGED
@@ -17,12 +17,20 @@ interface ServerOptions {
17
17
  layout?: string | Record<string, string>;
18
18
  /** `createViews({ baseLayout })`. */
19
19
  baseLayout?: string;
20
+ /** Named view roots (`ui::…`), as kick.config's `views.roots` writes them. Default: kick.config's (trusted workspaces). */
21
+ roots?: Record<string, string>;
20
22
  /**
21
23
  * The editor trusts the workspace, so the project's own `@forinda/kickjs-view`
22
24
  * may be imported. Otherwise the bundled copy is used. Default `false`.
23
25
  */
24
26
  trusted?: boolean;
25
27
  }
28
+ /**
29
+ * Starts the `.kick` language server on the connection the editor opened (the transport
30
+ * comes from the command-line arguments, such as `--stdio`).
31
+ *
32
+ * @see https://kickjs.app/guide/view-editors
33
+ */
26
34
  export declare function startServer(): void;
27
35
  /**
28
36
  * Where each pipe in `pipes.ts` is declared and what it takes — for hover and
@@ -35,7 +43,9 @@ interface PipeDeclaration {
35
43
  column: number;
36
44
  signature: string;
37
45
  }
46
+ /** The `@forinda/kickjs-view` module the server checks templates with. */
38
47
  type ViewModule = typeof View;
48
+ /** Where a workspace's templates, pipes and validators live, and how to read them. */
39
49
  interface WorkspaceOptions {
40
50
  root: string;
41
51
  /** Absolute. */
@@ -58,7 +68,16 @@ interface WorkspaceOptions {
58
68
  uri: string;
59
69
  text: string;
60
70
  }>>;
71
+ /** Named view roots (`ui::…`), absolute folders. */
72
+ roots?: Array<{
73
+ name: string;
74
+ dir: string;
75
+ }>;
61
76
  }
77
+ /**
78
+ * The editor's view of an app's templates: every `.kick` file under the views folder (an open
79
+ * buffer wins over the file on disk), with diagnostics from the same `parse` and `check` the runtime uses.
80
+ */
62
81
  export declare class Workspace {
63
82
  private readonly opts;
64
83
  private readonly entries;
@@ -69,8 +88,20 @@ export declare class Workspace {
69
88
  constructor(opts: WorkspaceOptions);
70
89
  get view(): ViewModule;
71
90
  load(): Promise<void>;
91
+ /** The app's views folder, then each root's. */
92
+ private folders;
93
+ /** What `ref`, written in template `from`, names: its own root's template first, then the app's. */
94
+ refOf(from: string | undefined, ref: string): string;
95
+ /** A template name's path, without its root. */
96
+ pathPart(name: string): string;
97
+ /** A component: under the components folder, in the app's views or a root's. */
98
+ isComponent(name: string): boolean;
72
99
  private nameOfPath;
73
- /** `uri`'s path inside the views folder (`layouts/main.kick`, `layouts`); `undefined` outside it. */
100
+ private dirOf;
101
+ /**
102
+ * `uri`'s path inside the views folder (`layouts/main.kick`, `layouts`), or
103
+ * inside a root with its prefix (`ui::layouts`); `undefined` outside them.
104
+ */
74
105
  relOf(uri: string): string | undefined;
75
106
  nameOf(uri: string): string | undefined;
76
107
  uriOf(name: string): string;
@@ -117,6 +148,7 @@ export declare class Workspace {
117
148
  /** Parse errors, else everything `check` reports — as LSP diagnostics. */
118
149
  diagnosticsFor(uri: string): Diagnostic[];
119
150
  }
151
+ /** A `.kick` document, with its HTML, `<style>` and `<script>` regions as embedded codes for their own language services. */
120
152
  export declare class KickVirtualCode implements VirtualCode {
121
153
  readonly text: string;
122
154
  readonly id = "root";
@@ -126,8 +158,14 @@ export declare class KickVirtualCode implements VirtualCode {
126
158
  readonly embeddedCodes: VirtualCode[];
127
159
  constructor(text: string);
128
160
  }
161
+ /** The Volar language plugin: `.kick` files, plus TS / JS files for their `ctx.render(...)` template names. */
129
162
  export declare const kickLanguagePlugin: LanguagePlugin<URI>;
163
+ /** The Volar service plugin for `.kick` documents: diagnostics, completion, hover, definitions, references, rename, formatting and semantic tokens. */
130
164
  export declare function createKickServicePlugin(ws: Workspace): LanguageServicePlugin;
165
+ /**
166
+ * Loads the project's `@forinda/kickjs-view` when the workspace is trusted and it has the needed
167
+ * exports; otherwise uses the bundled copy, warning once with the reason when the project's copy was not usable.
168
+ */
131
169
  export declare function loadViewModule(root: string, warn: (message: string) => void,
132
170
  /** The editor trusts this workspace: only then is the project's code imported. */
133
171
  trusted: boolean): Promise<{
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/server.ts","../src/pipes.ts","../src/workspace.ts","../src/language-plugin.ts","../src/plugin/index.ts","../src/view-module.ts"],"mappings":";;;;;;UAoBiB;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA,kBAAkB;;EAElB;;;;;EAKA;;wBAkEc;;;;;;UClGC;;EAEf;EACA;EACA;;KCKU,oBAAoB;UAEf;EACf;;EAEA;EACA;;EAEA;;EAEA;EACA,MAAM;EACN,KAAK,eAAe;;EAEpB,KAAK,cAAc;;EAEnB,kBAAkB;;EAElB;;EAEA,YAAY,QAAQ;IAAQ;IAAa;;;qBAa9B;mBAOkB;mBANZ;mBACA;UACT;UACA;UACA;EAER,YAA6B,MAAM;MAE/B,QAAQ;EAIN,QAAQ;UAWN;;EAOR,MAAM;EAKN,OAAO;EAIP,MAAM;EAIN;EAIA,OAAO;EAIP;EAIA,OAAO;EAKP,MAAM,eAAe,KAAK;;EAO1B,UAAU,aAAa;;EAYvB,KAAK,aAAa;EAIZ,YAAY,eAAe;EAmB3B,YAAY,eAAe;UAoBzB;;UAKM;UAMA;UAON;UA8BA;;UAMA;;EAkBR,aAAa,eAAe;EAgB5B;;EAKA,gBAAgB,eAAe;EAI/B;;EAKA;EAOA,WAAW,KAAK;;EAYhB,qBAAqB;EAOrB,WAAW,QAAQ;IAAQ;IAAa;;EAIxC;;;;;EAQA,SAAS;;EAmBT,eAAe,cAAc;;qBC7DlB,2BAA2B;WAOjB;WANZ;WACA;WACA,UAAU;WACV,UAAU;WACV,eAAe;EAExB,YAAqB;;qBAgEV,oBAAoB,eAAe;wBCnUhC,wBAAwB,IAAI,YAAY;wBCgFlC,eACpB,cACA,OAAO;;AAEP,mBACC;EAAU,MAAM;EAAY;EAA+B"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/server.ts","../src/pipes.ts","../src/workspace.ts","../src/language-plugin.ts","../src/plugin/index.ts","../src/view-module.ts"],"mappings":";;;;;;UAqBiB;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA,kBAAkB;;EAElB;;EAEA,QAAQ;;;;;EAKR;;;;;;;;wBAwEc;;;;;;UC3GC;;EAEf;EACA;EACA;;;KCMU,oBAAoB;;UAGf;EACf;;EAEA;EACA;;EAEA;;EAEA;EACA,MAAM;EACN,KAAK,eAAe;;EAEpB,KAAK,cAAc;;EAEnB,kBAAkB;;EAElB;;EAEA,YAAY,QAAQ;IAAQ;IAAa;;;EAEzC,QAAQ;IAAQ;IAAc;;;;;;;qBAuBnB;mBAOkB;mBANZ;mBACA;UACT;UACA;UACA;EAER,YAA6B,MAAM;MAE/B,QAAQ;EAIN,QAAQ;;UAYN;;EAQR,MAAM,0BAA0B;;EAQhC,SAAS;;EAKT,YAAY;UAMJ;UAUA;;;;;EAWR,MAAM;EAUN,OAAO;EAIP,MAAM;EAIN;EAIA,OAAO;EAKP;EAIA,OAAO;EAKP,MAAM,eAAe,KAAK;;EAO1B,UAAU,aAAa;;EAYvB,KAAK,aAAa;EAIZ,YAAY,eAAe;EAmB3B,YAAY,eAAe;UAoBzB;;UAKM;UAMA;UAON;UAsCA;;UAUA;;EAkBR,aAAa,eAAe;EAkB5B;;EAKA,gBAAgB,eAAe;EAI/B;;EAKA;EAOA,WAAW,KAAK;;EAYhB,qBAAqB;EAOrB,WAAW,QAAQ;IAAQ;IAAa;;EAIxC;;;;;EAQA,SAAS;;EAmBT,eAAe,cAAc;;;qBC9HlB,2BAA2B;WAOjB;WANZ;WACA;WACA,UAAU;WACV,UAAU;WACV,eAAe;EAExB,YAAqB;;;qBAiEV,oBAAoB,eAAe;;wBC9UhC,wBAAwB,IAAI,YAAY;;;;;wBCmFlC,eACpB,cACA,OAAO;;AAEP,mBACC;EAAU,MAAM;EAAY;EAA+B"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-view-language-server v0.4.1
2
+ * @forinda/kickjs-view-language-server v0.5.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,4 +8,4 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- export { a as KickVirtualCode, n as Workspace, i as createKickServicePlugin, o as kickLanguagePlugin, r as loadViewModule, t as startServer } from "./server-8LrzPkVt.js";
11
+ export { a as KickVirtualCode, n as Workspace, i as createKickServicePlugin, o as kickLanguagePlugin, r as loadViewModule, t as startServer } from "./server-g7Phx27h.js";
package/dist/main.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-view-language-server v0.4.1
2
+ * @forinda/kickjs-view-language-server v0.5.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import { t as startServer } from "./server-8LrzPkVt.js";
11
+ import { t as startServer } from "./server-g7Phx27h.js";
12
12
  // src/main.ts
13
13
  /** Runs the server — the entry editors launch (the bin and the VS Code bundle). */
14
14
  startServer();