@sveltejs/kit
Advanced tools
Comparing version 2.5.10 to 2.5.11
{ | ||
"name": "@sveltejs/kit", | ||
"version": "2.5.10", | ||
"version": "2.5.11", | ||
"description": "The fastest way to build Svelte apps", | ||
"keywords": [ | ||
"framework", | ||
"official", | ||
"svelte", | ||
"sveltekit", | ||
"vite" | ||
], | ||
"repository": { | ||
@@ -28,3 +35,3 @@ "type": "git", | ||
"devDependencies": { | ||
"@playwright/test": "^1.41.0", | ||
"@playwright/test": "^1.44.1", | ||
"@sveltejs/vite-plugin-svelte": "^3.0.1", | ||
@@ -38,6 +45,6 @@ "@types/connect": "^3.4.38", | ||
"svelte": "^4.2.10", | ||
"svelte-preprocess": "^5.1.3", | ||
"svelte-preprocess": "^6.0.0", | ||
"typescript": "^5.3.3", | ||
"vite": "^5.2.8", | ||
"vitest": "^1.5.0" | ||
"vitest": "^1.6.0" | ||
}, | ||
@@ -44,0 +51,0 @@ "peerDependencies": { |
@@ -43,3 +43,3 @@ import { load_config } from './src/core/config/index.js'; | ||
const config = await load_config(); | ||
await sync.all(config, 'development'); | ||
sync.all(config, 'development'); | ||
} catch (error) { | ||
@@ -46,0 +46,0 @@ console.error('Error while trying to sync SvelteKit config'); |
@@ -38,3 +38,3 @@ import fs from 'node:fs'; | ||
const sync = await import('./core/sync/sync.js'); | ||
await sync.all_types(config, mode); | ||
sync.all_types(config, mode); | ||
} catch (error) { | ||
@@ -41,0 +41,0 @@ handle_error(error); |
@@ -249,3 +249,3 @@ import { join } from 'node:path'; | ||
origin = new URL(input).origin; | ||
} catch (e) { | ||
} catch { | ||
throw new Error(`${keypath} must be a valid origin`); | ||
@@ -252,0 +252,0 @@ } |
@@ -279,3 +279,13 @@ import { existsSync, readFileSync, statSync, writeFileSync } from 'node:fs'; | ||
for (const href of hrefs) { | ||
/** @param {string} href */ | ||
const removePrerenderOrigin = (href) => { | ||
if (href.startsWith(config.prerender.origin)) { | ||
if (href === config.prerender.origin) return '/'; | ||
if (href.at(config.prerender.origin.length) !== '/') return href; | ||
return href.slice(config.prerender.origin.length); | ||
} | ||
return href; | ||
}; | ||
for (const href of hrefs.map(removePrerenderOrigin)) { | ||
if (!is_root_relative(href)) continue; | ||
@@ -282,0 +292,0 @@ |
@@ -26,3 +26,3 @@ import path from 'node:path'; | ||
*/ | ||
export async function create(config) { | ||
export function create(config) { | ||
const manifest_data = create_manifest_data({ config }); | ||
@@ -35,3 +35,3 @@ | ||
write_root(manifest_data, output); | ||
await write_all_types(config, manifest_data); | ||
write_all_types(config, manifest_data); | ||
@@ -49,6 +49,4 @@ return { manifest_data }; | ||
*/ | ||
export async function update(config, manifest_data, file) { | ||
await write_types(config, manifest_data, file); | ||
return { manifest_data }; | ||
export function update(config, manifest_data, file) { | ||
write_types(config, manifest_data, file); | ||
} | ||
@@ -61,5 +59,5 @@ | ||
*/ | ||
export async function all(config, mode) { | ||
export function all(config, mode) { | ||
init(config, mode); | ||
return await create(config); | ||
return create(config); | ||
} | ||
@@ -72,6 +70,6 @@ | ||
*/ | ||
export async function all_types(config, mode) { | ||
export function all_types(config, mode) { | ||
init(config, mode); | ||
const manifest_data = create_manifest_data({ config }); | ||
await write_all_types(config, manifest_data); | ||
write_all_types(config, manifest_data); | ||
} | ||
@@ -78,0 +76,0 @@ |
@@ -31,3 +31,3 @@ import fs from 'node:fs'; | ||
*/ | ||
export async function write_all_types(config, manifest_data) { | ||
export function write_all_types(config, manifest_data) { | ||
if (!ts) return; | ||
@@ -137,3 +137,3 @@ | ||
*/ | ||
export async function write_types(config, manifest_data, file) { | ||
export function write_types(config, manifest_data, file) { | ||
if (!ts) return; | ||
@@ -140,0 +140,0 @@ |
@@ -106,2 +106,4 @@ import { createReadStream } from 'node:fs'; | ||
*/ | ||
// TODO 3.0 make the signature synchronous? | ||
// eslint-disable-next-line @typescript-eslint/require-await | ||
export async function getRequest({ request, base, bodySizeLimit }) { | ||
@@ -125,2 +127,4 @@ return new Request(base + request.url, { | ||
*/ | ||
// TODO 3.0 make the signature synchronous? | ||
// eslint-disable-next-line @typescript-eslint/require-await | ||
export async function setResponse(res, response) { | ||
@@ -127,0 +131,0 @@ for (const [key, value] of response.headers) { |
@@ -69,3 +69,3 @@ import fs from 'node:fs'; | ||
name: 'service-worker-build-virtual-modules', | ||
async resolveId(id) { | ||
resolveId(id) { | ||
if (id.startsWith('$env/') || id.startsWith('$app/') || id === '$service-worker') { | ||
@@ -76,3 +76,3 @@ return `\0virtual:${id}`; | ||
async load(id) { | ||
load(id) { | ||
if (!id.startsWith('\0virtual:')) return; | ||
@@ -79,0 +79,0 @@ |
@@ -100,5 +100,5 @@ import fs from 'node:fs'; | ||
async function update_manifest() { | ||
function update_manifest() { | ||
try { | ||
({ manifest_data } = await sync.create(svelte_config)); | ||
({ manifest_data } = sync.create(svelte_config)); | ||
@@ -277,3 +277,3 @@ if (manifest_error) { | ||
await update_manifest(); | ||
update_manifest(); | ||
@@ -394,3 +394,3 @@ /** | ||
vite.middlewares.use(async (req, res, next) => { | ||
vite.middlewares.use((req, res, next) => { | ||
try { | ||
@@ -397,0 +397,0 @@ const base = `${vite.config.server.https ? 'https' : 'http'}://${ |
@@ -134,5 +134,5 @@ import fs from 'node:fs'; | ||
// @ts-expect-error the types are wrong | ||
const resolved = await imr.resolve(dependency, pathToFileURL(process.cwd() + '/dummy.js')); | ||
const resolved = imr.resolve(dependency, pathToFileURL(process.cwd() + '/dummy.js')); | ||
return import(resolved); | ||
} catch (e) { | ||
} catch { | ||
throw new Error( | ||
@@ -246,3 +246,3 @@ `Could not resolve peer dependency "${dependency}" relative to your project — please install it and try again.` | ||
*/ | ||
async config(config, config_env) { | ||
config(config, config_env) { | ||
initial_config = config; | ||
@@ -344,3 +344,3 @@ vite_config_env = config_env; | ||
if (!secondary_build_started) { | ||
manifest_data = (await sync.all(svelte_config, config_env.mode)).manifest_data; | ||
manifest_data = sync.all(svelte_config, config_env.mode).manifest_data; | ||
} | ||
@@ -379,3 +379,3 @@ } else { | ||
async resolveId(id, importer) { | ||
resolveId(id, importer) { | ||
// If importing from a service-worker, only allow $service-worker & $env/static/public, but none of the other virtual modules. | ||
@@ -404,3 +404,3 @@ // This check won't catch transitive imports, but it will warn when the import comes from a service-worker directly. | ||
async load(id, options) { | ||
load(id, options) { | ||
const browser = !options?.ssr; | ||
@@ -541,3 +541,3 @@ | ||
sequential: true, | ||
async handler(_options) { | ||
handler(_options) { | ||
if (vite_config.build.ssr) return; | ||
@@ -569,3 +569,3 @@ | ||
*/ | ||
async config(config) { | ||
config(config) { | ||
/** @type {import('vite').UserConfig} */ | ||
@@ -572,0 +572,0 @@ let new_config; |
@@ -88,3 +88,3 @@ import { getContext } from 'svelte'; | ||
return getStores()[name]; | ||
} catch (e) { | ||
} catch { | ||
throw new Error( | ||
@@ -91,0 +91,0 @@ `Cannot subscribe to '${name}' store on the server outside of a Svelte component, as it is bound to the current request via component context. This prevents state from leaking between users.` + |
@@ -22,2 +22,3 @@ import { BROWSER, DEV } from 'esm-env'; | ||
// detect whether async stack traces work | ||
// eslint-disable-next-line @typescript-eslint/require-await | ||
const check_stack_trace = async () => { | ||
@@ -24,0 +25,0 @@ const stack = /** @type {string} */ (new Error().stack); |
@@ -243,2 +243,3 @@ import { BROWSER, DEV } from 'esm-env'; | ||
subscribe, | ||
// eslint-disable-next-line @typescript-eslint/require-await | ||
check: async () => false | ||
@@ -245,0 +246,0 @@ }; |
@@ -222,3 +222,3 @@ import { HttpError, SvelteKitError, Redirect } from '../../control.js'; | ||
str = devalue.stringify(value, reducers); | ||
} catch (e) { | ||
} catch { | ||
const error = await handle_error_and_jsonify( | ||
@@ -225,0 +225,0 @@ event, |
@@ -149,3 +149,3 @@ import { text } from '../../../exports/index.js'; | ||
const parent = await server_promises[j]; | ||
if (parent) Object.assign(data, await parent.data); | ||
if (parent) Object.assign(data, parent.data); | ||
} | ||
@@ -152,0 +152,0 @@ return data; |
@@ -559,3 +559,3 @@ import * as devalue from 'devalue'; | ||
str = devalue.uneval({ id, data, error }, replacer); | ||
} catch (e) { | ||
} catch { | ||
error = await handle_error_and_jsonify( | ||
@@ -562,0 +562,0 @@ event, |
@@ -53,2 +53,3 @@ import { render_response } from './render.js'; | ||
node: default_layout, | ||
// eslint-disable-next-line @typescript-eslint/require-await | ||
parent: async () => ({}) | ||
@@ -63,2 +64,3 @@ }); | ||
node: default_layout, | ||
// eslint-disable-next-line @typescript-eslint/require-await | ||
parent: async () => ({}), | ||
@@ -65,0 +67,0 @@ resolve_opts, |
@@ -88,3 +88,3 @@ import { DEV } from 'esm-env'; | ||
rerouted_path = options.hooks.reroute({ url: new URL(url) }) ?? url.pathname; | ||
} catch (e) { | ||
} catch { | ||
return text('Internal Server Error', { | ||
@@ -91,0 +91,0 @@ status: 500 |
@@ -152,10 +152,11 @@ import { SvelteComponent } from 'svelte'; | ||
depth: number; | ||
/** The +page.svelte */ | ||
component?: string; // TODO supply default component if it's missing (bit of an edge case) | ||
/** The +page.js/.ts */ | ||
universal?: string; | ||
/** The +page.server.js/ts */ | ||
server?: string; | ||
parent_id?: string; | ||
parent?: PageNode; | ||
/** | ||
* Filled with the pages that reference this layout (if this is a layout) | ||
*/ | ||
/** Filled with the pages that reference this layout (if this is a layout) */ | ||
child_pages?: PageNode[]; | ||
@@ -162,0 +163,0 @@ } |
@@ -10,3 +10,3 @@ import { fileURLToPath } from 'node:url'; | ||
* @param {string} module `import.meta.url` of the file | ||
* @param {(opts: T) => U} callback The function that is invoked in the subprocess | ||
* @param {(opts: T) => Promise<U>} callback The function that is invoked in the subprocess | ||
* @returns {(opts: T) => Promise<U>} A function that when called starts the subprocess | ||
@@ -13,0 +13,0 @@ */ |
@@ -12,3 +12,3 @@ /** | ||
accept.split(',').forEach((str, i) => { | ||
const match = /([^/]+)\/([^;]+)(?:;q=([0-9.]+))?/.exec(str); | ||
const match = /([^/ \t]+)\/([^; \t]+)[ \t]*(?:;[ \t]*q=([0-9.]+))?/.exec(str); | ||
@@ -15,0 +15,0 @@ // no match equals invalid header — ignore |
// generated during release, do not modify | ||
/** @type {string} */ | ||
export const VERSION = '2.5.10'; | ||
export const VERSION = '2.5.11'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
731926
21316