vite-devtools-svelte 0.2.0 → 0.2.1

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.
@@ -0,0 +1,42 @@
1
+ import { Plugin } from 'vite';
2
+ /**
3
+ * SvelteKit dev bypasses Vite's `transformIndexHtml`, so `@vitejs/devtools`'s
4
+ * `DevToolsInjection` never reaches the served HTML and the dock is invisible
5
+ * on every SvelteKit page. Tracked upstream at
6
+ * https://github.com/baseballyama/vite-devtools-repl/tree/main/sveltekit-transform-index-html-bypass
7
+ *
8
+ * As a stopgap, SvelteKit inlines `src/app.html` as a JS string literal inside
9
+ * `.svelte-kit/generated/server/internal.js`:
10
+ *
11
+ * templates: {
12
+ * app: ({ head, body, ... }) => "<!doctype html>...<body>...</body>...",
13
+ * }
14
+ *
15
+ * That file is loaded through Vite's module pipeline (`vite.ssrLoadModule`),
16
+ * so a regular `transform` hook can rewrite the literal to insert the dock's
17
+ * inject script before `</body>`. The actual `<script>` runs in the browser
18
+ * once the HTML is delivered, so no SSR safety guard on the inject module is
19
+ * needed for this path.
20
+ *
21
+ * This is intentionally narrow — SvelteKit-specific path match plus a
22
+ * structural assertion — and there's a test (`template-injector.test.ts`)
23
+ * that fails if SvelteKit's generated shape changes, so a silent break shows
24
+ * up in CI instead of as a missing dock in production.
25
+ */
26
+ export declare const SVELTEKIT_INTERNAL_SUFFIX = ".svelte-kit/generated/server/internal.js";
27
+ /** Marker that the `templates.app` literal in SvelteKit's generated server. */
28
+ export declare const TEMPLATE_APP_MARKER = "templates: {";
29
+ /**
30
+ * Transform `.svelte-kit/generated/server/internal.js` to add the
31
+ * `@vitejs/devtools` inject script right before `</body>` inside the app
32
+ * template literal. Exposed for unit testing.
33
+ *
34
+ * Returns the new source if a substitution was made, or `null` to signal
35
+ * "nothing to do" (already injected, structural marker missing, etc.).
36
+ */
37
+ export declare function injectIntoSvelteKitInternal(code: string): string | null;
38
+ /**
39
+ * Vite plugin: inject `@vitejs/devtools/client/inject` into SvelteKit's
40
+ * dev-only generated server template. Dev-only by construction.
41
+ */
42
+ export declare function sveltekitTemplateInjector(): Plugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-devtools-svelte",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Svelte DevTools plugin for Vite DevTools",
5
5
  "license": "MIT",
6
6
  "author": "Yuichiro Yamashita",
@@ -42,7 +42,7 @@
42
42
  "access": "public"
43
43
  },
44
44
  "dependencies": {
45
- "@modelcontextprotocol/sdk": "^1.18.0",
45
+ "@modelcontextprotocol/sdk": "^1.29.0",
46
46
  "@vitejs/devtools-kit": "^0.2.0",
47
47
  "zod": "^4.4.3"
48
48
  },