@sveltejs/kit
Advanced tools
Comparing version
{ | ||
"name": "@sveltejs/kit", | ||
"version": "2.20.3", | ||
"version": "2.20.4", | ||
"description": "SvelteKit is the fastest way to build Svelte apps", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -395,28 +395,2 @@ import fs from 'node:fs'; | ||
async function align_exports() { | ||
// This shameful hack allows us to load runtime server code via Vite | ||
// while apps load `HttpError` and `Redirect` in Node, without | ||
// causing `instanceof` checks to fail | ||
const control_module_node = await import('../../../runtime/control.js'); | ||
const control_module_vite = await vite.ssrLoadModule(`${runtime_base}/control.js`); | ||
control_module_node.replace_implementations({ | ||
ActionFailure: control_module_vite.ActionFailure, | ||
HttpError: control_module_vite.HttpError, | ||
Redirect: control_module_vite.Redirect, | ||
SvelteKitError: control_module_vite.SvelteKitError | ||
}); | ||
} | ||
await align_exports(); | ||
const ws_send = vite.ws.send; | ||
/** @param {any} args */ | ||
vite.ws.send = function (...args) { | ||
// We need to reapply the patch after Vite did dependency optimizations | ||
// because that clears the module resolutions | ||
if (args[0]?.type === 'full-reload' && args[0].path === '*') { | ||
void align_exports(); | ||
} | ||
return ws_send.apply(vite.ws, args); | ||
}; | ||
vite.middlewares.use((req, res, next) => { | ||
@@ -423,0 +397,0 @@ const base = `${vite.config.server.https ? 'https' : 'http'}://${ |
@@ -64,25 +64,1 @@ export class HttpError { | ||
} | ||
/** | ||
* This is a grotesque hack that, in dev, allows us to replace the implementations | ||
* of these classes that you'd get by importing them from `@sveltejs/kit` with the | ||
* ones that are imported via Vite and loaded internally, so that instanceof | ||
* checks work even though SvelteKit imports this module via Vite and consumers | ||
* import it via Node | ||
* @param {{ | ||
* ActionFailure: typeof ActionFailure; | ||
* HttpError: typeof HttpError; | ||
* Redirect: typeof Redirect; | ||
* SvelteKitError: typeof SvelteKitError; | ||
* }} implementations | ||
*/ | ||
export function replace_implementations(implementations) { | ||
// @ts-expect-error | ||
ActionFailure = implementations.ActionFailure; // eslint-disable-line no-class-assign | ||
// @ts-expect-error | ||
HttpError = implementations.HttpError; // eslint-disable-line no-class-assign | ||
// @ts-expect-error | ||
Redirect = implementations.Redirect; // eslint-disable-line no-class-assign | ||
// @ts-expect-error | ||
SvelteKitError = implementations.SvelteKitError; // eslint-disable-line no-class-assign | ||
} |
// generated during release, do not modify | ||
/** @type {string} */ | ||
export const VERSION = '2.20.3'; | ||
export const VERSION = '2.20.4'; |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
820110
-0.25%23485
-0.2%