@sveltejs/kit 1.2.7 → 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
|
@@ -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 {
|
|
@@ -164,7 +164,15 @@ export async function render_response({
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
/** @param {string} path */
|
|
167
|
-
const prefixed = (path) =>
|
|
167
|
+
const prefixed = (path) => {
|
|
168
|
+
if (path.startsWith('/')) {
|
|
169
|
+
// Vite makes the start script available through the base path and without it.
|
|
170
|
+
// We load it via the base path in order to support remote IDE environments which proxy
|
|
171
|
+
// all URLs under the base path during development.
|
|
172
|
+
return base + path;
|
|
173
|
+
}
|
|
174
|
+
return `${resolved_assets}/${path}`;
|
|
175
|
+
};
|
|
168
176
|
|
|
169
177
|
const serialized = { data: '', form: 'null', error: 'null' };
|
|
170
178
|
|