2026-08-06 09f01778d5a034e2af50ae05da8908f7b6a871c8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/**
 * SvelteKit registry entry.
 *
 * Detection and the apply/remove pair are the existing adapter's
 * (`../sveltekit-adapter.mjs`); this file only declares them to the registry
 * and names the artifacts the journal has to be able to heal.
 */
 
import {
  SVELTE_LAYOUT_MARKER_OPEN,
  SVELTE_LIVE_ROOT_COMPONENT,
  applySvelteKitLiveAdapter,
  detectSvelteKitProject,
  removeSvelteKitLiveAdapter,
  unpatchSvelteLayout,
} from '../sveltekit-adapter.mjs';
 
export const sveltekit = {
  name: 'sveltekit',
 
  detect(cwd, config) {
    return detectSvelteKitProject(cwd, config);
  },
 
  inject: {
    kind: 'adapter',
 
    apply({ cwd, port, token, config }) {
      return applySvelteKitLiveAdapter({ cwd, port, token, config });
    },
 
    remove({ cwd, config }) {
      return removeSvelteKitLiveAdapter({ cwd, config });
    },
 
    // The generated root component and the `src/lib/impeccable/` runtime paths
    // are already in the static LIVE_IGNORE_PATTERNS list, so nothing extra.
    ignorePatterns() {
      return [];
    },
 
    artifacts({ project }) {
      return [
        {
          kind: 'created',
          path: SVELTE_LIVE_ROOT_COMPONENT,
          marker: 'impeccable-live-root',
          pruneTo: 'src',
        },
        {
          kind: 'patched',
          path: project?.layoutFile || 'src/routes/+layout.svelte',
          patch: 'sveltekit-layout',
          markers: [SVELTE_LAYOUT_MARKER_OPEN],
        },
      ];
    },
 
    unpatch: {
      'sveltekit-layout': unpatchSvelteLayout,
    },
  },
 
  source: {
    extensions: ['.svelte'],
    // Svelte resets component-local state on markup HMR updates, so variants
    // are mounted from generated components rather than written into the route.
    preview: 'component',
    commentSyntax: 'html',
  },
};