@sveltejs/kit
Advanced tools
Comparing version 1.27.5 to 1.27.6
{ | ||
"name": "@sveltejs/kit", | ||
"version": "1.27.5", | ||
"version": "1.27.6", | ||
"description": "The fastest way to build Svelte apps", | ||
@@ -35,3 +35,2 @@ "repository": { | ||
"dts-buddy": "^0.2.4", | ||
"marked": "^9.0.0", | ||
"rollup": "^3.29.4", | ||
@@ -88,6 +87,6 @@ "svelte": "^4.2.2", | ||
"scripts": { | ||
"lint": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore", | ||
"lint": "prettier --config ../../.prettierrc --check .", | ||
"check": "tsc", | ||
"check:all": "tsc && pnpm -r --filter=\"./**\" check", | ||
"format": "prettier --write . --config ../../.prettierrc --ignore-path .gitignore", | ||
"format": "prettier --config ../../.prettierrc --write .", | ||
"test": "pnpm test:unit && pnpm test:integration", | ||
@@ -94,0 +93,0 @@ "test:integration": "pnpm -r --workspace-concurrency 1 --filter=\"./test/**\" test", |
@@ -43,13 +43,23 @@ import { dedent, isSvelte5Plus, write_if_changed } from './utils.js'; | ||
<script> | ||
import { setContext, afterUpdate, onMount, tick } from 'svelte'; | ||
import { setContext, ${isSvelte5Plus() ? '' : 'afterUpdate, '}onMount, tick } from 'svelte'; | ||
import { browser } from '$app/environment'; | ||
// stores | ||
export let stores; | ||
export let page; | ||
${ | ||
isSvelte5Plus() | ||
? dedent` | ||
let { stores, page, constructors, components = [], form, ${levels | ||
.map((l) => `data_${l} = null`) | ||
.join(', ')} } = $props(); | ||
` | ||
: dedent` | ||
export let stores; | ||
export let page; | ||
export let constructors; | ||
export let components = []; | ||
export let form; | ||
${levels.map((l) => `export let data_${l} = null;`).join('\n')} | ||
export let constructors; | ||
export let components = []; | ||
export let form; | ||
${levels.map((l) => `export let data_${l} = null;`).join('\n')} | ||
` | ||
} | ||
@@ -60,8 +70,27 @@ if (!browser) { | ||
$: stores.page.set(page); | ||
afterUpdate(stores.page.notify); | ||
${ | ||
isSvelte5Plus() | ||
? dedent` | ||
if (browser) { | ||
$effect.pre(() => stores.page.set(page)); | ||
} else { | ||
stores.page.set(page); | ||
} | ||
` | ||
: '$: stores.page.set(page);' | ||
} | ||
${ | ||
isSvelte5Plus() | ||
? dedent` | ||
$effect(() => { | ||
stores;page;constructors;components;form;${levels.map((l) => `data_${l}`).join(';')}; | ||
stores.page.notify(); | ||
}); | ||
` | ||
: 'afterUpdate(stores.page.notify);' | ||
} | ||
let mounted = false; | ||
let navigated = false; | ||
let title = null; | ||
let mounted = ${isSvelte5Plus() ? '$state(false)' : 'false'}; | ||
let navigated = ${isSvelte5Plus() ? '$state(false)' : 'false'}; | ||
let title = ${isSvelte5Plus() ? '$state(null)' : 'null'}; | ||
@@ -68,0 +97,0 @@ onMount(() => { |
@@ -142,4 +142,5 @@ import fs from 'node:fs'; | ||
lib: ['esnext', 'DOM', 'DOM.Iterable'], | ||
moduleResolution: 'node', | ||
moduleResolution: 'node', // TODO change to "bundler" in SvelteKit v2 | ||
module: 'esnext', | ||
noEmit: true, // prevent tsconfig error "overwriting input files" - Vite handles the build and ignores this | ||
target: 'esnext', | ||
@@ -185,4 +186,4 @@ | ||
: Array.isArray(extend) | ||
? extend.some((e) => path.resolve(cwd, e) === out) | ||
: false; | ||
? extend.some((e) => path.resolve(cwd, e) === out) | ||
: false; | ||
@@ -189,0 +190,0 @@ const options = config.options.compilerOptions || {}; |
@@ -45,8 +45,8 @@ import 'svelte'; // pick up `declare module "*.svelte"` | ||
: input extends Record<string, any> | ||
? { | ||
[key in keyof input]: Awaited<input[key]>; | ||
} | ||
: {} extends input // handles the any case | ||
? input | ||
: unknown; | ||
? { | ||
[key in keyof input]: Awaited<input[key]>; | ||
} | ||
: {} extends input // handles the any case | ||
? input | ||
: unknown; | ||
@@ -74,4 +74,4 @@ export type AwaitedProperties<input extends Record<string, any> | void> = | ||
: T extends void | ||
? undefined // needs to be undefined, because void will corrupt union type | ||
: T; | ||
? undefined // needs to be undefined, because void will corrupt union type | ||
: T; | ||
@@ -78,0 +78,0 @@ /** |
@@ -59,2 +59,13 @@ import { DEV } from 'esm-env'; | ||
/** | ||
* Loads `href` the old-fashioned way, with a full page reload. | ||
* Returns a `Promise` that never resolves (to prevent any | ||
* subsequent work, e.g. history manipulation, from happening) | ||
* @param {URL} url | ||
*/ | ||
function native_navigation(url) { | ||
location.href = url.href; | ||
return new Promise(() => {}); | ||
} | ||
/** | ||
* @param {import('./types.js').SvelteKitApp} app | ||
@@ -539,6 +550,6 @@ * @param {HTMLElement} target | ||
: data instanceof Response | ||
? 'a Response object' | ||
: Array.isArray(data) | ||
? 'an array' | ||
: 'a non-plain object' | ||
? 'a Response object' | ||
: Array.isArray(data) | ||
? 'an array' | ||
: 'a non-plain object' | ||
}, but must return a plain object at the top level (i.e. \`return {...}\`)` | ||
@@ -1201,13 +1212,2 @@ ); | ||
/** | ||
* Loads `href` the old-fashioned way, with a full page reload. | ||
* Returns a `Promise` that never resolves (to prevent any | ||
* subsequent work, e.g. history manipulation, from happening) | ||
* @param {URL} url | ||
*/ | ||
function native_navigation(url) { | ||
location.href = url.href; | ||
return new Promise(() => {}); | ||
} | ||
if (import.meta.hot) { | ||
@@ -1848,3 +1848,3 @@ import.meta.hot.on('vite:beforeUpdate', () => { | ||
* @param {boolean[]} invalid | ||
* @returns {Promise<import('types').ServerNodesResponse |import('types').ServerRedirectNode>} | ||
* @returns {Promise<import('types').ServerNodesResponse | import('types').ServerRedirectNode>} | ||
*/ | ||
@@ -1864,2 +1864,8 @@ async function load_data(url, invalid) { | ||
// if `__data.json` doesn't exist or the server has an internal error, | ||
// fallback to native navigation so we avoid parsing the HTML error page as a JSON | ||
if (res.headers.get('content-type')?.includes('text/html')) { | ||
await native_navigation(url); | ||
} | ||
if (!res.ok) { | ||
@@ -1871,3 +1877,3 @@ // error message is a JSON-stringified string which devalue can't handle at the top level | ||
// TODO: fix eslint error | ||
// TODO: fix eslint error / figure out if it actually applies to our situation | ||
// eslint-disable-next-line | ||
@@ -1874,0 +1880,0 @@ return new Promise(async (resolve) => { |
@@ -294,3 +294,3 @@ import { text } from '../../../exports/index.js'; | ||
csr: get_option(nodes, 'csr') ?? true, | ||
ssr: true | ||
ssr: get_option(nodes, 'ssr') ?? true | ||
}, | ||
@@ -297,0 +297,0 @@ status, |
@@ -362,6 +362,6 @@ import { disable_search, make_trackable } from '../../../utils/url.js'; | ||
: data instanceof Response | ||
? 'a Response object' | ||
: Array.isArray(data) | ||
? 'an array' | ||
: 'a non-plain object' | ||
? 'a Response object' | ||
: Array.isArray(data) | ||
? 'an array' | ||
: 'a non-plain object' | ||
}, but must return a plain object at the top level (i.e. \`return {...}\`)` | ||
@@ -368,0 +368,0 @@ ); |
@@ -344,4 +344,4 @@ import { DEV } from 'esm-env'; | ||
: route?.page && is_action_json_request(event) | ||
? action_json_redirect(e) | ||
: redirect_response(e.status, e.location); | ||
? action_json_redirect(e) | ||
: redirect_response(e.status, e.location); | ||
add_cookies_to_headers(response.headers, Object.values(cookies_to_add)); | ||
@@ -348,0 +348,0 @@ return response; |
// generated during release, do not modify | ||
/** @type {string} */ | ||
export const VERSION = '1.27.5'; | ||
export const VERSION = '1.27.6'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
675830
12
19861
11
75
359282
1