@valbuild/language-server 0.124.0 → 0.126.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/CHANGELOG.md +115 -0
- package/dist/declarations/src/diagnostics.d.ts +9 -9
- package/dist/declarations/src/{mediaMetadataChecks.d.ts → mediaChecks.d.ts} +46 -25
- package/dist/declarations/src/version.d.ts +0 -9
- package/dist/valbuild-language-server.cjs.dev.js +245 -66
- package/dist/valbuild-language-server.cjs.prod.js +245 -66
- package/dist/valbuild-language-server.esm.js +245 -66
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,120 @@
|
|
|
1
1
|
# @valbuild/language-server
|
|
2
2
|
|
|
3
|
+
## 0.126.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`5bfd630`](https://github.com/valbuild/val/commit/5bfd630b63dee2189e238f20fe72ecc5537160f7), [`ccbcda6`](https://github.com/valbuild/val/commit/ccbcda60b3e3c465071229ae1ba28ac735483e63), [`f2fe70d`](https://github.com/valbuild/val/commit/f2fe70dab2b65000dfaf289f09c70b4a8291467a), [`5c18c99`](https://github.com/valbuild/val/commit/5c18c99ecc84651f82123481fc042063db953833), [`171208a`](https://github.com/valbuild/val/commit/171208a20177e68ed5a8b1a6fdaabfe893a6aa5f)]:
|
|
8
|
+
- @valbuild/shared@0.126.0
|
|
9
|
+
- @valbuild/server@0.126.0
|
|
10
|
+
- @valbuild/core@0.126.0
|
|
11
|
+
|
|
12
|
+
## 0.125.0
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#645](https://github.com/valbuild/val/pull/645) [`22f78b4`](https://github.com/valbuild/val/commit/22f78b471fd18e542f518f72b75bd472d7c3dc52) Thanks [@freekh](https://github.com/freekh)! - The editor no longer warns "Remote image was not checked." on every remote image
|
|
17
|
+
and file.
|
|
18
|
+
|
|
19
|
+
That message is a placeholder: core cannot reach the content host, so
|
|
20
|
+
`s.image().remote()` reports it unconditionally and leaves the real check to
|
|
21
|
+
whoever can make it. `val validate` makes it and prints nothing when the ref is
|
|
22
|
+
sound; the language server was publishing the placeholder raw, so every remote
|
|
23
|
+
image in a project carried a permanent warning that no quick fix could clear.
|
|
24
|
+
|
|
25
|
+
It is now adjudicated the same way the metadata placeholder already was — by
|
|
26
|
+
running Val's own check — so a valid ref reports nothing, and a ref that no
|
|
27
|
+
longer matches the bytes behind it reports what the CLI reports:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
Remote ref: https://remote.val.build/file/p/…/renaming.gif is not valid. Use the --fix flag to fix this issue.
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Nothing is downloaded for a ref that still adds up; only a stale one is fetched,
|
|
34
|
+
into the same `.val/remote-file-cache` the CLI uses.
|
|
35
|
+
|
|
36
|
+
- [#638](https://github.com/valbuild/val/pull/638) [`c390397`](https://github.com/valbuild/val/commit/c390397cb5e203eb1bedae3a6fab15726e850b90) Thanks [@freekh](https://github.com/freekh)! - Val now runs on TanStack Start.
|
|
37
|
+
|
|
38
|
+
`@valbuild/tanstack` is a new package with everything `@valbuild/next` has: Val
|
|
39
|
+
Studio at `/val`, the on-page overlay and canvas, draft mode, the client hooks,
|
|
40
|
+
server-side content reads, images, and the MCP tools.
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
npm install @valbuild/tanstack
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
// val.config.ts
|
|
48
|
+
import { initVal } from "@valbuild/tanstack";
|
|
49
|
+
const { s, c, config, tanstackRouter } = initVal({ project: "org/project" });
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Routes are first class.** A Val module for a route is named after the route
|
|
53
|
+
file it sits beside — `src/routes/posts.$postId.tsx` is served content by
|
|
54
|
+
`src/routes/posts.$postId.val.ts` — and its keys are the URLs that route serves:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
export default c.define(
|
|
58
|
+
"/src/routes/posts.$postId.val.ts",
|
|
59
|
+
s.router(tanstackRouter, s.object({ title: s.string() })),
|
|
60
|
+
{ "/posts/hello-world": { title: "Hello world" } },
|
|
61
|
+
);
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`.` and `/` both separate segments, `$param` is a parameter, `$` is a splat, and
|
|
65
|
+
`index`, `route`, `(groups)` and `_pathless` layouts add no URL segment — the
|
|
66
|
+
same rules TanStack Router uses for the route file itself. Val validates every
|
|
67
|
+
key against that pattern, and Val Studio shows these modules as a sitemap under
|
|
68
|
+
**Pages**, where an editor can add a page.
|
|
69
|
+
|
|
70
|
+
Point the route generator away from your content files, in `vite.config.ts` and
|
|
71
|
+
`tsr.config.json`:
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
tanstackStart({ router: { routeFileIgnorePattern: "\\.val\\.[tj]sx?$" } });
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
See the [README](https://github.com/valbuild/val/blob/main/packages/tanstack/README.md)
|
|
78
|
+
for the full wiring, and `examples/tanstack` for a working app.
|
|
79
|
+
|
|
80
|
+
**Also fixed, for everyone:** `Internal.VERSION.core` was `null` in any ESM
|
|
81
|
+
bundle — it was read with `require("../package.json")` inside a `try`, so the
|
|
82
|
+
failure was silent. That version goes into every remote file ref and proxy mode
|
|
83
|
+
refuses to start without it. Every package now reads its version through a
|
|
84
|
+
static JSON import, which is inlined at build time.
|
|
85
|
+
|
|
86
|
+
Two smaller fixes that came out of running the whole toolchain against a
|
|
87
|
+
TanStack project:
|
|
88
|
+
|
|
89
|
+
- `val versions` reports `@valbuild/tanstack`, and `val debug` writes a snapshot
|
|
90
|
+
that names whichever framework package the captured project actually has.
|
|
91
|
+
- `@valbuild/eslint-plugin` reads a `tsconfig.json` that has comments in it. A
|
|
92
|
+
tsconfig is JSONC, and `JSON.parse` is not — so on any project whose tsconfig
|
|
93
|
+
carries a comment (the TanStack starter's does) the
|
|
94
|
+
`module-in-val-modules` rule threw `Expected double-quoted property name in
|
|
95
|
+
JSON` on the first file and took the whole lint run with it.
|
|
96
|
+
|
|
97
|
+
Three fixes found by driving the Studio against a real TanStack app:
|
|
98
|
+
|
|
99
|
+
- **A draft image now loads on the page.** The source the Studio pushes to the
|
|
100
|
+
host page carries `patch_id` for any file whose bytes are still in a patch, so
|
|
101
|
+
the page asks `/api/val/files/...?patch_id=` rather than a `/public` path that
|
|
102
|
+
nothing has written yet. This was silent — the image just did not appear — and
|
|
103
|
+
it affects any page that reads media through the hooks rather than on the
|
|
104
|
+
server, `@valbuild/next` included.
|
|
105
|
+
- **A splat route no longer logs an error on every render.** TanStack returns
|
|
106
|
+
both `_splat` and `*` for the same parameter; Val reported the second as a
|
|
107
|
+
parameter it could not place in the path.
|
|
108
|
+
- The TanStack example and starter render a 404 page instead of throwing
|
|
109
|
+
`notFound()` from a component, which escaped to the error boundary and logged
|
|
110
|
+
`Error in renderToReadableStream` (and, with no not-found component
|
|
111
|
+
configured, aborted the response) on every miss.
|
|
112
|
+
|
|
113
|
+
- Updated dependencies [[`c390397`](https://github.com/valbuild/val/commit/c390397cb5e203eb1bedae3a6fab15726e850b90)]:
|
|
114
|
+
- @valbuild/core@0.125.0
|
|
115
|
+
- @valbuild/shared@0.125.0
|
|
116
|
+
- @valbuild/server@0.125.0
|
|
117
|
+
|
|
3
118
|
## 0.124.0
|
|
4
119
|
|
|
5
120
|
### Patch Changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ModuleFilePath, type SourcePath, type ValidationError, type ValidationFix } from "@valbuild/core";
|
|
2
2
|
import { type SchemaSourceSnapshot } from "@valbuild/shared/internal";
|
|
3
3
|
import { Diagnostic, DiagnosticSeverity } from "vscode-languageserver";
|
|
4
|
-
import { type
|
|
4
|
+
import { type MediaCheckVerdict } from "./mediaChecks.js";
|
|
5
5
|
import type { ValModuleContent } from "./ValProject.js";
|
|
6
6
|
/** Marks diagnostics as ours, so a client can filter on it. */
|
|
7
7
|
export declare const VAL_DIAGNOSTIC_SOURCE = "val";
|
|
@@ -74,7 +74,7 @@ export declare function severityFor({ code, fixes, }: {
|
|
|
74
74
|
code: ValDiagnosticCode;
|
|
75
75
|
fixes?: ValidationFix[];
|
|
76
76
|
}): DiagnosticSeverity;
|
|
77
|
-
export declare function createValDiagnostics({ moduleFilePath, content, text, valRoot, snapshot, galleryChecks,
|
|
77
|
+
export declare function createValDiagnostics({ moduleFilePath, content, text, valRoot, snapshot, galleryChecks, mediaChecks, }: {
|
|
78
78
|
moduleFilePath: ModuleFilePath;
|
|
79
79
|
content: ValModuleContent;
|
|
80
80
|
/** Current text of the module, as the editor sees it. */
|
|
@@ -103,14 +103,14 @@ export declare function createValDiagnostics({ moduleFilePath, content, text, va
|
|
|
103
103
|
*/
|
|
104
104
|
galleryChecks?: ReadonlyMap<string, GalleryCheckVerdict>;
|
|
105
105
|
/**
|
|
106
|
-
* Verdicts for the media
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* or not anything is wrong
|
|
111
|
-
* on every image in the project.
|
|
106
|
+
* Verdicts for the media placeholders core emits unconditionally, from
|
|
107
|
+
* {@link resolveMediaChecks}. Without it the placeholders are dropped, for
|
|
108
|
+
* the same reason the gallery ones are: core reports `image:check-metadata`
|
|
109
|
+
* on every `s.image()` that carries metadata, and `image:check-remote` on
|
|
110
|
+
* every remote image, whether or not anything is wrong -- so publishing them
|
|
111
|
+
* raw puts a permanent warning on every image in the project.
|
|
112
112
|
*/
|
|
113
|
-
|
|
113
|
+
mediaChecks?: ReadonlyMap<string, MediaCheckVerdict>;
|
|
114
114
|
}): Diagnostic[];
|
|
115
115
|
/**
|
|
116
116
|
* Diagnostic for a project that could not be evaluated at all.
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Adjudicating the media
|
|
2
|
+
* Adjudicating the media placeholders core emits unconditionally.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* `s.file()` does the same with `file:check-metadata`.
|
|
4
|
+
* A media schema cannot answer two of its own questions, because both need
|
|
5
|
+
* something core has no access to -- the bytes on disk, or the bytes on the
|
|
6
|
+
* content host. So it defers, by reporting an error that only means "nobody
|
|
7
|
+
* has looked yet":
|
|
9
8
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* and
|
|
13
|
-
*
|
|
14
|
-
* (`
|
|
9
|
+
* - **Metadata.** Any `s.image()` carrying metadata gets an
|
|
10
|
+
* `image:check-metadata` error whether or not anything is wrong
|
|
11
|
+
* (`packages/core/src/schema/image.ts`), and `s.file()` does the same with
|
|
12
|
+
* `file:check-metadata`.
|
|
13
|
+
* - **Remote refs.** Every `s.image().remote()` / `s.file().remote()` value
|
|
14
|
+
* whose path is a remote ref gets `Remote image was not checked.` with
|
|
15
|
+
* `image:check-remote` -- unconditionally, for every remote image in the
|
|
16
|
+
* project.
|
|
17
|
+
*
|
|
18
|
+
* `val validate` resolves both by running the fix handler and then
|
|
19
|
+
* `createFixPatch` in report mode, which returns one error per real problem
|
|
20
|
+
* and nothing at all when there is none. The Studio cannot do that -- a
|
|
21
|
+
* browser has neither the filesystem nor the project's remote credentials --
|
|
22
|
+
* so it drops them wholesale (`partitionValidationErrors` in
|
|
23
|
+
* `@valbuild/shared`).
|
|
15
24
|
*
|
|
16
25
|
* An editor is in the CLI's position, not the browser's, and publishing the
|
|
17
26
|
* placeholders raw put a permanent warning on every image in the project. So
|
|
@@ -20,8 +29,8 @@
|
|
|
20
29
|
*/
|
|
21
30
|
import { type SourcePath, type ValidationError, type ValidationFix } from "@valbuild/core";
|
|
22
31
|
import type { ValModuleContent } from "./ValProject.js";
|
|
23
|
-
/** One
|
|
24
|
-
export type
|
|
32
|
+
/** One thing about a media value that a real check found to be wrong. */
|
|
33
|
+
export type MediaCheckFinding = {
|
|
25
34
|
message: string;
|
|
26
35
|
/** The placeholder's own fixes, so the quick fix and severity survive. */
|
|
27
36
|
fixes?: ValidationFix[];
|
|
@@ -29,12 +38,24 @@ export type MediaMetadataFinding = {
|
|
|
29
38
|
value?: unknown;
|
|
30
39
|
};
|
|
31
40
|
/**
|
|
32
|
-
* The verdict on one placeholder. Empty means the
|
|
33
|
-
* file and nothing should be
|
|
41
|
+
* The verdict on one placeholder. Empty means the check passed -- the metadata
|
|
42
|
+
* agrees with the file, or the remote ref is sound -- and nothing should be
|
|
43
|
+
* published.
|
|
44
|
+
*/
|
|
45
|
+
export type MediaCheckVerdict = MediaCheckFinding[];
|
|
46
|
+
/**
|
|
47
|
+
* Whether this error is the unconditional remote-ref deferral.
|
|
48
|
+
*
|
|
49
|
+
* Unlike the metadata deferral this needs no re-derivation: `image:check-remote`
|
|
50
|
+
* is attached to exactly one error in `ImageSchema.executeValidate`, the
|
|
51
|
+
* fall-through for a remote schema with a remote path, and `FileSchema` mirrors
|
|
52
|
+
* it. Everything else a remote media field can be wrong about carries a
|
|
53
|
+
* different fix (`image:upload-remote`, `image:download-remote`) or none.
|
|
34
54
|
*/
|
|
35
|
-
export
|
|
55
|
+
export declare function isDeferredRemoteCheck(error: ValidationError): boolean;
|
|
36
56
|
/**
|
|
37
|
-
* Whether this error is the unconditional deferral rather than a real
|
|
57
|
+
* Whether this error is the unconditional METADATA deferral rather than a real
|
|
58
|
+
* finding.
|
|
38
59
|
*
|
|
39
60
|
* This is the whole difficulty of the change. `image:check-metadata` is
|
|
40
61
|
* attached to FIVE different image errors, and only the last is a placeholder:
|
|
@@ -53,7 +74,7 @@ export type MediaMetadataVerdict = MediaMetadataFinding[];
|
|
|
53
74
|
* There is no flag on `ValidationError` saying which is which, so the four
|
|
54
75
|
* conditions are re-derived here from the same inputs core used. They are
|
|
55
76
|
* transcribed from `ImageSchema.executeValidate`, in its order, and
|
|
56
|
-
* `
|
|
77
|
+
* `mediaChecks.test.ts` drives real core through all five cases to
|
|
57
78
|
* check that this agrees with it. If core grows a sixth condition, that test is
|
|
58
79
|
* what catches it.
|
|
59
80
|
*
|
|
@@ -72,34 +93,34 @@ export declare function isDeferredMediaMetadataCheck({ error, schema, }: {
|
|
|
72
93
|
schema: unknown;
|
|
73
94
|
}): boolean;
|
|
74
95
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
96
|
+
* Whether an error in a module is either deferral, resolving the schema the
|
|
97
|
+
* metadata classification needs.
|
|
77
98
|
*
|
|
78
99
|
* Both the adjudicator and `createValDiagnostics` have to make the same call,
|
|
79
100
|
* on the same inputs -- one to decide what to adjudicate, the other to decide
|
|
80
101
|
* what to publish -- so it lives here rather than being written out twice.
|
|
81
102
|
*/
|
|
82
|
-
export declare function
|
|
103
|
+
export declare function isDeferredMediaCheckAt({ sourcePath, error, content, }: {
|
|
83
104
|
sourcePath: string;
|
|
84
105
|
error: ValidationError;
|
|
85
106
|
content: ValModuleContent;
|
|
86
107
|
}): boolean;
|
|
87
108
|
/**
|
|
88
|
-
* Adjudicate every deferred
|
|
109
|
+
* Adjudicate every deferred media placeholder in `validation`.
|
|
89
110
|
*
|
|
90
111
|
* Async, and therefore separate from `createValDiagnostics`, which stays
|
|
91
112
|
* synchronous so it can be tested without a project -- the same split
|
|
92
113
|
* `resolveGalleryChecks` uses. The caller runs this first and passes the
|
|
93
114
|
* result in.
|
|
94
115
|
*/
|
|
95
|
-
export declare function
|
|
116
|
+
export declare function resolveMediaChecks({ validation, content, valRoot, remoteHost, }: {
|
|
96
117
|
validation: Record<SourcePath, ValidationError[]>;
|
|
97
118
|
content: ValModuleContent;
|
|
98
119
|
valRoot: string;
|
|
99
120
|
remoteHost?: string;
|
|
100
|
-
}): Promise<Map<string,
|
|
121
|
+
}): Promise<Map<string, MediaCheckVerdict>>;
|
|
101
122
|
/**
|
|
102
123
|
* Key for one placeholder. A value can in principle carry more than one, so
|
|
103
124
|
* the fix names are part of the key -- as they are for the gallery checks.
|
|
104
125
|
*/
|
|
105
|
-
export declare function
|
|
126
|
+
export declare function mediaCheckKey(sourcePath: string, error: ValidationError): string;
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Version of this package, read from its own package.json.
|
|
3
|
-
*
|
|
4
|
-
* Mirrors how `@valbuild/core` reports `Internal.VERSION.core`
|
|
5
|
-
* (see `packages/core/src/index.ts`): the built output lives one directory
|
|
6
|
-
* below the package root, so `../package.json` resolves correctly. Returns
|
|
7
|
-
* `null` rather than throwing if the file cannot be read — the version is only
|
|
8
|
-
* ever used for display, never for behaviour.
|
|
9
|
-
*/
|
|
10
1
|
export declare function getLanguageServerVersion(): string | null;
|