@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 +1 -1
- package/src/exports/vite/dev/index.js +24 -11
package/package.json
CHANGED
|
@@ -315,17 +315,30 @@ export async function dev(vite, vite_config, svelte_config) {
|
|
|
315
315
|
}
|
|
316
316
|
});
|
|
317
317
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
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 {
|