@svgrid/mcp 3.0.45 → 3.0.47
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 +7 -6
- package/dist/compile-svelte.d.ts +3 -0
- package/dist/compile-svelte.js +15 -6
- package/dist/data.js +63 -54
- package/dist/preview.d.ts +1 -1
- package/dist/preview.js +1 -1
- package/package.json +5 -7
- package/server.json +2 -2
package/README.md
CHANGED
|
@@ -85,9 +85,10 @@ What it checks:
|
|
|
85
85
|
- **Svelte 5 rules.** `export let` and `$:` in a runes file (compiler errors),
|
|
86
86
|
`on:` / `<slot>` / `createEventDispatcher` (deprecations), and a plain `let`
|
|
87
87
|
array that gets mutated and silently never re-renders.
|
|
88
|
-
- **The file, compiled.** When a Svelte compiler is reachable - the
|
|
89
|
-
project
|
|
90
|
-
|
|
88
|
+
- **The file, compiled.** When a Svelte compiler is reachable - the copy in
|
|
89
|
+
the project the server starts in, or one installed beside `@svgrid/mcp` -
|
|
90
|
+
real parse errors come back too. Svelte is an optional peer, so a bare
|
|
91
|
+
`npx -y @svgrid/mcp` does not download it and starts in a few seconds. The result says which of the two ran in its `compiler` field, so
|
|
91
92
|
"no errors" is never mistaken for "this compiles".
|
|
92
93
|
|
|
93
94
|
It is tuned to shut up when the code is right: it reports **nothing** across
|
|
@@ -102,9 +103,9 @@ The `studio_*` tools let an agent build and edit the **same validated project mo
|
|
|
102
103
|
server's env. Tools that need a licence to be useful should not cost every
|
|
103
104
|
other user context on every request.
|
|
104
105
|
|
|
105
|
-
These tools and `svgrid_scaffold` run on `@svgrid/enterprise`,
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
These tools and `svgrid_scaffold` run on `@svgrid/enterprise`, which
|
|
107
|
+
`npx -y @svgrid/mcp` does not install (it would double the cold start).
|
|
108
|
+
Install both in the project and run the local server:
|
|
108
109
|
|
|
109
110
|
```bash
|
|
110
111
|
npm i -D @svgrid/mcp @svgrid/enterprise
|
package/dist/compile-svelte.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import type { CompileFn } from './validate.js';
|
|
2
|
+
import { type CompileApi } from './compile-core.js';
|
|
3
|
+
/** The Svelte compiler of the project in `dir`; throws when it has none. */
|
|
4
|
+
export declare function projectCompiler(dir: string): Promise<CompileApi>;
|
|
2
5
|
export declare const compileWithSvelte: CompileFn;
|
package/dist/compile-svelte.js
CHANGED
|
@@ -13,18 +13,27 @@ import { join } from 'node:path';
|
|
|
13
13
|
import { compileDiagnostics } from './compile-core.js';
|
|
14
14
|
/**
|
|
15
15
|
* Prefer the Svelte the USER's project is on, so the check matches what their
|
|
16
|
-
* build will do; fall back to
|
|
17
|
-
*
|
|
16
|
+
* build will do; fall back to one installed beside this package. Svelte is an
|
|
17
|
+
* optional peer, not a dependency: it and its dependencies were most of a cold
|
|
18
|
+
* `npx -y @svgrid/mcp` install, and a slow one ran past the 30 s a client
|
|
19
|
+
* waits to connect. Resolved once and reused - the compiler is not cheap to
|
|
20
|
+
* load.
|
|
18
21
|
*/
|
|
19
22
|
let cached;
|
|
23
|
+
/** The Svelte compiler of the project in `dir`; throws when it has none. */
|
|
24
|
+
export async function projectCompiler(dir) {
|
|
25
|
+
// require.resolve picks svelte's `require` entry, a CommonJS file, so the
|
|
26
|
+
// import puts `compile` on `default`. Reading only the top level missed it,
|
|
27
|
+
// and the project's Svelte was never used.
|
|
28
|
+
const require = createRequire(join(dir, 'package.json'));
|
|
29
|
+
const mod = (await import(pathToFileURL(require.resolve('svelte/compiler')).href));
|
|
30
|
+
return typeof mod.compile === 'function' ? mod : mod.default;
|
|
31
|
+
}
|
|
20
32
|
async function loadCompiler() {
|
|
21
33
|
if (cached !== undefined)
|
|
22
34
|
return cached;
|
|
23
35
|
const attempts = [
|
|
24
|
-
|
|
25
|
-
const require = createRequire(join(process.cwd(), 'package.json'));
|
|
26
|
-
return (await import(pathToFileURL(require.resolve('svelte/compiler')).href));
|
|
27
|
-
},
|
|
36
|
+
() => projectCompiler(process.cwd()),
|
|
28
37
|
async () => (await import('svelte/compiler')),
|
|
29
38
|
];
|
|
30
39
|
for (const attempt of attempts) {
|