@sveltejs/kit 1.2.6 → 1.2.8
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
|
@@ -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
|
|
|
@@ -110,6 +110,9 @@ export async function respond(request, options, manifest, state) {
|
|
|
110
110
|
/** @type {Record<string, string>} */
|
|
111
111
|
const headers = {};
|
|
112
112
|
|
|
113
|
+
/** @type {Record<string, import('./page/types').Cookie>} */
|
|
114
|
+
let cookies_to_add = {};
|
|
115
|
+
|
|
113
116
|
/** @type {import('types').RequestEvent} */
|
|
114
117
|
const event = {
|
|
115
118
|
// @ts-expect-error `cookies` and `fetch` need to be created after the `event` itself
|
|
@@ -221,6 +224,7 @@ export async function respond(request, options, manifest, state) {
|
|
|
221
224
|
trailing_slash ?? 'never'
|
|
222
225
|
);
|
|
223
226
|
|
|
227
|
+
cookies_to_add = new_cookies;
|
|
224
228
|
event.cookies = cookies;
|
|
225
229
|
event.fetch = create_fetch({ event, options, manifest, state, get_cookie_header });
|
|
226
230
|
|
|
@@ -237,7 +241,7 @@ export async function respond(request, options, manifest, state) {
|
|
|
237
241
|
response.headers.set(key, /** @type {string} */ (value));
|
|
238
242
|
}
|
|
239
243
|
|
|
240
|
-
add_cookies_to_headers(response.headers, Object.values(
|
|
244
|
+
add_cookies_to_headers(response.headers, Object.values(cookies_to_add));
|
|
241
245
|
|
|
242
246
|
if (state.prerendering && event.route.id !== null) {
|
|
243
247
|
response.headers.set('x-sveltekit-routeid', encodeURI(event.route.id));
|
|
@@ -293,11 +297,11 @@ export async function respond(request, options, manifest, state) {
|
|
|
293
297
|
return response;
|
|
294
298
|
} catch (e) {
|
|
295
299
|
if (e instanceof Redirect) {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
300
|
+
const response = is_data_request
|
|
301
|
+
? redirect_json_response(e)
|
|
302
|
+
: redirect_response(e.status, e.location);
|
|
303
|
+
add_cookies_to_headers(response.headers, Object.values(cookies_to_add));
|
|
304
|
+
return response;
|
|
301
305
|
}
|
|
302
306
|
return await handle_fatal_error(event, options, e);
|
|
303
307
|
}
|