@sveltejs/kit 1.2.8 → 1.2.9

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/kit",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",
@@ -315,17 +315,30 @@ export async function dev(vite, vite_config, svelte_config) {
315
315
  }
316
316
  });
317
317
 
318
- // This shameful hack allows us to load runtime server code via Vite
319
- // while apps load `HttpError` and `Redirect` in Node, without
320
- // causing `instanceof` checks to fail
321
- const control_module_node = await import(`../../../runtime/control.js`);
322
- const control_module_vite = await vite.ssrLoadModule(`${runtime_base}/control.js`);
323
-
324
- control_module_node.replace_implementations({
325
- ActionFailure: control_module_vite.ActionFailure,
326
- HttpError: control_module_vite.HttpError,
327
- Redirect: control_module_vite.Redirect
328
- });
318
+ async function align_exports() {
319
+ // This shameful hack allows us to load runtime server code via Vite
320
+ // while apps load `HttpError` and `Redirect` in Node, without
321
+ // causing `instanceof` checks to fail
322
+ const control_module_node = await import(`../../../runtime/control.js`);
323
+ const control_module_vite = await vite.ssrLoadModule(`${runtime_base}/control.js`);
324
+
325
+ control_module_node.replace_implementations({
326
+ ActionFailure: control_module_vite.ActionFailure,
327
+ HttpError: control_module_vite.HttpError,
328
+ Redirect: control_module_vite.Redirect
329
+ });
330
+ }
331
+ align_exports();
332
+ const ws_send = vite.ws.send;
333
+ /** @param {any} args */
334
+ vite.ws.send = function (...args) {
335
+ // We need to reapply the patch after Vite did dependency optimizations
336
+ // because that clears the module resolutions
337
+ if (args[0]?.type === 'full-reload' && args[0].path === '*') {
338
+ align_exports();
339
+ }
340
+ return ws_send.apply(vite.ws, args);
341
+ };
329
342
 
330
343
  vite.middlewares.use(async (req, res, next) => {
331
344
  try {