@forinda/kickjs-view-language-server 0.4.0 → 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
@@ -18,9 +18,11 @@ The KickJS VS Code extension bundles this server. Any LSP client can run it: set
18
18
 
19
19
  ```sh
20
20
  pnpm add -D @forinda/kickjs-view-language-server
21
- kick-view-ls --stdio
21
+ npx -y -p @forinda/kickjs-view-language-server kick-view-ls --stdio
22
22
  ```
23
23
 
24
+ `kick-view-ls` is the command, not a package name. Without `-p`, `npx` finds it only when it's installed in the project the editor starts it in; otherwise `npx` looks for a package called `kick-view-ls` and fails with a 404.
25
+
24
26
  Initialization options, relative to the workspace folder:
25
27
 
26
28
  | option | default |
@@ -34,4 +36,4 @@ Initialization options, relative to the workspace folder:
34
36
 
35
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.
36
38
 
37
- 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
@@ -3,7 +3,6 @@ import { URI } from "vscode-uri";
3
3
  import * as View from "@forinda/kickjs-view";
4
4
  import { Diagnostic, LanguageServicePlugin } from "@volar/language-service";
5
5
  import { CodeMapping, IScriptSnapshot, LanguagePlugin, VirtualCode } from "@volar/language-core";
6
- //#region src/server.d.ts
7
6
  /** `initializationOptions`; paths are relative to the workspace folder. */
8
7
  interface ServerOptions {
9
8
  /** Default `src/views`. */
@@ -18,15 +17,21 @@ interface ServerOptions {
18
17
  layout?: string | Record<string, string>;
19
18
  /** `createViews({ baseLayout })`. */
20
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>;
21
22
  /**
22
23
  * The editor trusts the workspace, so the project's own `@forinda/kickjs-view`
23
24
  * may be imported. Otherwise the bundled copy is used. Default `false`.
24
25
  */
25
26
  trusted?: boolean;
26
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
+ */
27
34
  export declare function startServer(): void;
28
- //#endregion
29
- //#region src/pipes.d.ts
30
35
  /**
31
36
  * Where each pipe in `pipes.ts` is declared and what it takes — for hover and
32
37
  * go to definition. Read lexically, like the engine's `readPipeExports`: only
@@ -38,9 +43,9 @@ interface PipeDeclaration {
38
43
  column: number;
39
44
  signature: string;
40
45
  }
41
- //#endregion
42
- //#region src/workspace.d.ts
46
+ /** The `@forinda/kickjs-view` module the server checks templates with. */
43
47
  type ViewModule = typeof View;
48
+ /** Where a workspace's templates, pipes and validators live, and how to read them. */
44
49
  interface WorkspaceOptions {
45
50
  root: string;
46
51
  /** Absolute. */
@@ -63,7 +68,16 @@ interface WorkspaceOptions {
63
68
  uri: string;
64
69
  text: string;
65
70
  }>>;
71
+ /** Named view roots (`ui::…`), absolute folders. */
72
+ roots?: Array<{
73
+ name: string;
74
+ dir: string;
75
+ }>;
66
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
+ */
67
81
  export declare class Workspace {
68
82
  private readonly opts;
69
83
  private readonly entries;
@@ -74,8 +88,20 @@ export declare class Workspace {
74
88
  constructor(opts: WorkspaceOptions);
75
89
  get view(): ViewModule;
76
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;
77
99
  private nameOfPath;
78
- /** `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
+ */
79
105
  relOf(uri: string): string | undefined;
80
106
  nameOf(uri: string): string | undefined;
81
107
  uriOf(name: string): string;
@@ -122,8 +148,7 @@ export declare class Workspace {
122
148
  /** Parse errors, else everything `check` reports — as LSP diagnostics. */
123
149
  diagnosticsFor(uri: string): Diagnostic[];
124
150
  }
125
- //#endregion
126
- //#region src/language-plugin.d.ts
151
+ /** A `.kick` document, with its HTML, `<style>` and `<script>` regions as embedded codes for their own language services. */
127
152
  export declare class KickVirtualCode implements VirtualCode {
128
153
  readonly text: string;
129
154
  readonly id = "root";
@@ -133,12 +158,14 @@ export declare class KickVirtualCode implements VirtualCode {
133
158
  readonly embeddedCodes: VirtualCode[];
134
159
  constructor(text: string);
135
160
  }
161
+ /** The Volar language plugin: `.kick` files, plus TS / JS files for their `ctx.render(...)` template names. */
136
162
  export declare const kickLanguagePlugin: LanguagePlugin<URI>;
137
- //#endregion
138
- //#region src/plugin/index.d.ts
163
+ /** The Volar service plugin for `.kick` documents: diagnostics, completion, hover, definitions, references, rename, formatting and semantic tokens. */
139
164
  export declare function createKickServicePlugin(ws: Workspace): LanguageServicePlugin;
140
- //#endregion
141
- //#region src/view-module.d.ts
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
+ */
142
169
  export declare function loadViewModule(root: string, warn: (message: string) => void,
143
170
  /** The editor trusts this workspace: only then is the project's code imported. */
144
171
  trusted: boolean): Promise<{
@@ -146,6 +173,5 @@ trusted: boolean): Promise<{
146
173
  source: 'project' | 'bundled';
147
174
  version: string;
148
175
  }>;
149
- //#endregion
150
176
  export type { ServerOptions, ViewModule, WorkspaceOptions };
151
177
  //# sourceMappingURL=index.d.ts.map
@@ -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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) 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-B2sP928V.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.0
2
+ * @forinda/kickjs-view-language-server v0.5.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,11 +8,10 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import { t as startServer } from "./server-B2sP928V.js";
12
- //#region src/main.ts
11
+ import { t as startServer } from "./server-g7Phx27h.js";
12
+ // src/main.ts
13
13
  /** Runs the server — the entry editors launch (the bin and the VS Code bundle). */
14
14
  startServer();
15
- //#endregion
16
15
  export {};
17
16
 
18
17
  //# sourceMappingURL=main.js.map