@sveltejs/vite-plugin-svelte 6.2.2 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/vite-plugin-svelte",
3
- "version": "6.2.2",
3
+ "version": "6.2.4",
4
4
  "license": "MIT",
5
5
  "author": "dominikg",
6
6
  "files": [
@@ -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 this.environment.transformRequest(mod.url);
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);
package/src/utils/id.js CHANGED
@@ -184,6 +184,7 @@ export function buildIdFilter(options) {
184
184
  id: {
185
185
  include: [extensionsRE, .../**@type {Array<string|RegExp>}*/ arraify(include)],
186
186
  exclude: /**@type {Array<string|RegExp>}*/ [
187
+ '\0',
187
188
  SVELTE_VIRTUAL_STYLE_ID_REGEX, // exclude from regular pipeline, we load it in a separate plugin
188
189
  ...arraify(exclude)
189
190
  ]
@@ -225,7 +226,7 @@ export function buildModuleIdFilter(options) {
225
226
  return {
226
227
  id: {
227
228
  include: [infixWithExtRE, .../**@type {Array<string|RegExp>}*/ arraify(include)],
228
- exclude: /**@type {Array<string|RegExp>}*/ arraify(exclude)
229
+ exclude: ['\0', .../**@type {Array<string|RegExp>}*/ arraify(exclude)]
229
230
  }
230
231
  };
231
232
  }