@sveltejs/vite-plugin-svelte 1.0.0-next.32 → 1.0.0-next.36

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.
@@ -6,6 +6,7 @@ export class VitePluginSvelteCache {
6
6
  private _js = new Map<string, Code>();
7
7
  private _dependencies = new Map<string, string[]>();
8
8
  private _dependants = new Map<string, Set<string>>();
9
+ private _resolvedSvelteFields = new Map<string, string>();
9
10
 
10
11
  public update(compileData: CompileData) {
11
12
  this.updateCSS(compileData);
@@ -80,4 +81,23 @@ export class VitePluginSvelteCache {
80
81
  const dependants = this._dependants.get(path);
81
82
  return dependants ? [...dependants] : [];
82
83
  }
84
+
85
+ public getResolvedSvelteField(name: string, importer?: string): string | void {
86
+ return this._resolvedSvelteFields.get(this._getResolvedSvelteFieldKey(name, importer));
87
+ }
88
+
89
+ public setResolvedSvelteField(
90
+ importee: string,
91
+ importer: string | undefined = undefined,
92
+ resolvedSvelte: string
93
+ ) {
94
+ this._resolvedSvelteFields.set(
95
+ this._getResolvedSvelteFieldKey(importee, importer),
96
+ resolvedSvelte
97
+ );
98
+ }
99
+
100
+ private _getResolvedSvelteFieldKey(importee: string, importer?: string): string {
101
+ return importer ? `${importer} > ${importee}` : importee;
102
+ }
83
103
  }
@@ -42,8 +42,8 @@ export function setupWatchers(
42
42
  };
43
43
 
44
44
  const triggerViteRestart = (filename: string) => {
45
- if (serverConfig.middlewareMode || options.isSvelteKit) {
46
- // in middlewareMode or for sveltekit we can't restart the server automatically
45
+ if (serverConfig.middlewareMode) {
46
+ // in middlewareMode we can't restart the server automatically
47
47
  // show the user an overlay instead
48
48
  const message =
49
49
  'Svelte config change detected, restart your dev process to apply the changes.';
@@ -54,7 +54,7 @@ export function setupWatchers(
54
54
  });
55
55
  } else {
56
56
  log.info(`svelte config changed: restarting vite server. - file: ${filename}`);
57
- server.restart(!!options.experimental?.prebundleSvelteLibraries);
57
+ server.restart();
58
58
  }
59
59
  };
60
60