@sveltejs/kit 2.49.0 → 2.49.2

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": "2.49.0",
3
+ "version": "2.49.2",
4
4
  "description": "SvelteKit is the fastest way to build Svelte apps",
5
5
  "keywords": [
6
6
  "framework",
@@ -8,7 +8,7 @@ import { extname, resolve, join, dirname, relative } from 'node:path';
8
8
  import { pipeline } from 'node:stream';
9
9
  import { promisify } from 'node:util';
10
10
  import zlib from 'node:zlib';
11
- import { copy, rimraf, mkdirp } from '../../utils/filesystem.js';
11
+ import { copy, rimraf, mkdirp, posixify } from '../../utils/filesystem.js';
12
12
  import { generate_manifest } from '../generate_manifest/index.js';
13
13
  import { get_route_segments } from '../../utils/routing.js';
14
14
  import { get_env } from '../../exports/vite/utils.js';
@@ -268,8 +268,8 @@ export function create_builder({
268
268
  copy(`${entrypoint}.map`, `${start}.map`);
269
269
  }
270
270
 
271
- const relative_instrumentation = relative(dirname(entrypoint), instrumentation);
272
- const relative_start = relative(dirname(entrypoint), start);
271
+ const relative_instrumentation = posixify(relative(dirname(entrypoint), instrumentation));
272
+ const relative_start = posixify(relative(dirname(entrypoint), start));
273
273
 
274
274
  const facade =
275
275
  'generateText' in module
@@ -88,6 +88,7 @@ export function write_root(manifest_data, output) {
88
88
  }
89
89
 
90
90
  if (!browser) {
91
+ // svelte-ignore state_referenced_locally
91
92
  setContext('__svelte__', stores);
92
93
  }
93
94
 
@@ -97,6 +98,7 @@ export function write_root(manifest_data, output) {
97
98
  if (browser) {
98
99
  $effect.pre(() => stores.page.set(page));
99
100
  } else {
101
+ // svelte-ignore state_referenced_locally
100
102
  stores.page.set(page);
101
103
  }
102
104
  `
@@ -2145,7 +2145,7 @@ function push_invalidated(resource) {
2145
2145
  }
2146
2146
 
2147
2147
  /**
2148
- * Causes all `load` functions belonging to the currently active page to re-run. Returns a `Promise` that resolves when the page is subsequently updated.
2148
+ * Causes all `load` and `query` functions belonging to the currently active page to re-run. Returns a `Promise` that resolves when the page is subsequently updated.
2149
2149
  * @returns {Promise<void>}
2150
2150
  */
2151
2151
  export function invalidateAll() {
@@ -323,8 +323,8 @@ export function is_external_url(url, base, hash_routing) {
323
323
  return false;
324
324
  }
325
325
 
326
- /** @type {Record<string, boolean>} */
327
- const seen = {};
326
+ /** @type {Set<string> | null} */
327
+ let seen = null;
328
328
 
329
329
  /**
330
330
  * Used for server-side resolution, to replicate Vite's CSS loading behaviour in production.
@@ -341,13 +341,17 @@ export function load_css(deps) {
341
341
  );
342
342
  const csp_nonce = csp_nonce_meta?.nonce || csp_nonce_meta?.getAttribute('nonce');
343
343
 
344
+ seen ??= new Set(
345
+ Array.from(document.querySelectorAll('link[rel="stylesheet"]')).map((link) => {
346
+ return /** @type {HTMLLinkElement} */ (link).href;
347
+ })
348
+ );
349
+
344
350
  for (const dep of deps) {
345
- if (dep in seen) continue;
346
- seen[dep] = true;
351
+ const href = new URL(dep, document.baseURI).href;
347
352
 
348
- if (document.querySelector(`link[href="${dep}"][rel="stylesheet"]`)) {
349
- continue;
350
- }
353
+ if (seen.has(href)) continue;
354
+ seen.add(href);
351
355
 
352
356
  const link = document.createElement('link');
353
357
  link.rel = 'stylesheet';
@@ -220,7 +220,7 @@ export async function deserialize_binary_form(request) {
220
220
  `Could not deserialize binary form: got version ${header[0]}, expected version ${BINARY_FORM_VERSION}`
221
221
  );
222
222
  }
223
- const header_view = new DataView(header.buffer);
223
+ const header_view = new DataView(header.buffer, header.byteOffset, header.byteLength);
224
224
  const data_length = header_view.getUint32(1, true);
225
225
  const file_offsets_length = header_view.getUint16(5, true);
226
226
 
@@ -316,7 +316,7 @@ export function create_universal_fetch(event, state, fetched, csr, resolve_opts)
316
316
  let teed_body;
317
317
 
318
318
  const proxy = new Proxy(response, {
319
- get(response, key, _receiver) {
319
+ get(response, key, receiver) {
320
320
  /**
321
321
  * @param {string | undefined} body
322
322
  * @param {boolean} is_b64
@@ -427,7 +427,28 @@ export function create_universal_fetch(event, state, fetched, csr, resolve_opts)
427
427
  };
428
428
  }
429
429
 
430
- return Reflect.get(response, key, response);
430
+ const value = Reflect.get(response, key, response);
431
+
432
+ if (value instanceof Function) {
433
+ // On Node v24+, the Response object has a private element #state – we
434
+ // need to bind this function to the response in order to allow it to
435
+ // access this private element. Defining the name and length ensure it
436
+ // is identical to the original function when introspected.
437
+ return Object.defineProperties(
438
+ /**
439
+ * @this {any}
440
+ */
441
+ function () {
442
+ return Reflect.apply(value, this === receiver ? response : this, arguments);
443
+ },
444
+ {
445
+ name: { value: value.name },
446
+ length: { value: value.length }
447
+ }
448
+ );
449
+ }
450
+
451
+ return value;
431
452
  }
432
453
  });
433
454
 
package/src/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // generated during release, do not modify
2
2
 
3
3
  /** @type {string} */
4
- export const VERSION = '2.49.0';
4
+ export const VERSION = '2.49.2';
package/types/index.d.ts CHANGED
@@ -3035,7 +3035,7 @@ declare module '$app/navigation' {
3035
3035
  * */
3036
3036
  export function invalidate(resource: string | URL | ((url: URL) => boolean)): Promise<void>;
3037
3037
  /**
3038
- * Causes all `load` functions belonging to the currently active page to re-run. Returns a `Promise` that resolves when the page is subsequently updated.
3038
+ * Causes all `load` and `query` functions belonging to the currently active page to re-run. Returns a `Promise` that resolves when the page is subsequently updated.
3039
3039
  * */
3040
3040
  export function invalidateAll(): Promise<void>;
3041
3041
  /**