@sveltejs/vite-plugin-svelte 6.2.3 → 6.2.4
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/package.json +1 -1
- package/src/plugins/hot-update.js +16 -1
package/package.json
CHANGED
|
@@ -96,10 +96,25 @@ export function hotUpdate(api) {
|
|
|
96
96
|
}
|
|
97
97
|
const affectedModules = [];
|
|
98
98
|
const prevResults = svelteModules.map((m) => transformResultCache.get(m.id));
|
|
99
|
+
|
|
100
|
+
/** @type {Set<string>} */
|
|
101
|
+
const seen = new Set();
|
|
102
|
+
/** @param {string} url */
|
|
103
|
+
const transformRequest = async (url) => {
|
|
104
|
+
if (!seen.has(url)) {
|
|
105
|
+
seen.add(url);
|
|
106
|
+
await this.environment.transformRequest(url);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// Transform the Svelte component itself first, so that the
|
|
111
|
+
// CSS cache always gets updated.
|
|
112
|
+
await transformRequest(svelteRequest.filename);
|
|
113
|
+
|
|
99
114
|
for (let i = 0; i < svelteModules.length; i++) {
|
|
100
115
|
const mod = svelteModules[i];
|
|
101
116
|
const prev = prevResults[i];
|
|
102
|
-
await
|
|
117
|
+
await transformRequest(mod.url);
|
|
103
118
|
const next = transformResultCache.get(mod.id);
|
|
104
119
|
if (hasCodeChanged(prev, next, mod.id)) {
|
|
105
120
|
affectedModules.push(mod);
|