Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sveltejs/kit

Package Overview
Dependencies
Maintainers
4
Versions
795
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sveltejs/kit - npm Package Compare versions

Comparing version 2.6.3 to 2.6.4

2

package.json
{
"name": "@sveltejs/kit",
"version": "2.6.3",
"version": "2.6.4",
"description": "SvelteKit is the fastest way to build Svelte apps",

@@ -5,0 +5,0 @@ "keywords": [

@@ -12,13 +12,1 @@ /**

export const PAGE_METHODS = ['GET', 'POST', 'HEAD'];
/**
* Placeholders for the hash of the app version.
* Later replaced in the generateBundle hook to avoid affecting the chunk hash.
*/
export const APP_VERSION_HASH_PLACEHOLDER_BASE = '__SVELTEKIT_APP_VERSION_HASH__';
/**
* Placeholder for the app version.
* Later replaced in the generateBundle hook to avoid affecting the chunk hash.
*/
export const APP_VERSION_PLACEHOLDER_BASE = '__SVELTEKIT_APP_VERSION__';

@@ -19,2 +19,8 @@ import { existsSync, readFileSync, statSync, writeFileSync } from 'node:fs';

// https://html.spec.whatwg.org/multipage/browsing-the-web.html#scrolling-to-a-fragment
// "If fragment is the empty string, then return the special value top of the document."
// ...and
// "If decodedFragment is an ASCII case-insensitive match for the string 'top', then return the top of the document."
const SPECIAL_HASHLINKS = new Set(['', 'top']);
/**

@@ -489,3 +495,3 @@ * @param {{

if (!hashlinks.includes(id)) {
if (!hashlinks.includes(id) && !SPECIAL_HASHLINKS.has(id)) {
handle_missing_id({ id, path, referrers: Array.from(referrers) });

@@ -492,0 +498,0 @@ }

@@ -399,3 +399,3 @@ import 'svelte'; // pick up `declare module "*.svelte"`

/**
* A prefix that signals that an environment variable is safe to expose to client-side code. See [`$env/static/public`](/docs/modules#$env-static-public) and [`$env/dynamic/public`](/docs/modules#$env-dynamic-public). Note that Vite's [`envPrefix`](https://vitejs.dev/config/shared-options.html#envprefix) must be set separately if you are using Vite's environment variable handling - though use of that feature should generally be unnecessary.
* A prefix that signals that an environment variable is safe to expose to client-side code. See [`$env/static/public`](https://kit.svelte.dev/docs/modules#$env-static-public) and [`$env/dynamic/public`](https://kit.svelte.dev/docs/modules#$env-dynamic-public). Note that Vite's [`envPrefix`](https://vitejs.dev/config/shared-options.html#envprefix) must be set separately if you are using Vite's environment variable handling - though use of that feature should generally be unnecessary.
* @default "PUBLIC_"

@@ -405,3 +405,3 @@ */

/**
* A prefix that signals that an environment variable is unsafe to expose to client-side code. Environment variables matching neither the public nor the private prefix will be discarded completely. See [`$env/static/private`](/docs/modules#$env-static-private) and [`$env/dynamic/private`](/docs/modules#$env-dynamic-private).
* A prefix that signals that an environment variable is unsafe to expose to client-side code. Environment variables matching neither the public nor the private prefix will be discarded completely. See [`$env/static/private`](https://kit.svelte.dev/docs/modules#$env-static-private) and [`$env/dynamic/private`](https://kit.svelte.dev/docs/modules#$env-dynamic-private).
* @default ""

@@ -509,3 +509,3 @@ * @since 1.21.0

/**
* A root-relative path that must start, but not end with `/` (e.g. `/base-path`), unless it is the empty string. This specifies where your app is served from and allows the app to live on a non-root path. Note that you need to prepend all your root-relative links with the base value or they will point to the root of your domain, not your `base` (this is how the browser works). You can use [`base` from `$app/paths`](/docs/modules#$app-paths-base) for that: `<a href="{base}/your-page">Link</a>`. If you find yourself writing this often, it may make sense to extract this into a reusable component.
* A root-relative path that must start, but not end with `/` (e.g. `/base-path`), unless it is the empty string. This specifies where your app is served from and allows the app to live on a non-root path. Note that you need to prepend all your root-relative links with the base value or they will point to the root of your domain, not your `base` (this is how the browser works). You can use [`base` from `$app/paths`](https://kit.svelte.dev/docs/modules#$app-paths-base) for that: `<a href="{base}/your-page">Link</a>`. If you find yourself writing this often, it may make sense to extract this into a reusable component.
* @default ""

@@ -652,3 +652,3 @@ */

*
* If you set `pollInterval` to a non-zero value, SvelteKit will poll for new versions in the background and set the value of the [`updated`](/docs/modules#$app-stores-updated) store to `true` when it detects one.
* If you set `pollInterval` to a non-zero value, SvelteKit will poll for new versions in the background and set the value of the [`updated`](https://kit.svelte.dev/docs/modules#$app-stores-updated) store to `true` when it detects one.
*/

@@ -806,3 +806,3 @@ version?: {

/**
* This function declares that the `load` function has a _dependency_ on one or more URLs or custom identifiers, which can subsequently be used with [`invalidate()`](/docs/modules#$app-navigation-invalidate) to cause `load` to rerun.
* This function declares that the `load` function has a _dependency_ on one or more URLs or custom identifiers, which can subsequently be used with [`invalidate()`](https://kit.svelte.dev/docs/modules#$app-navigation-invalidate) to cause `load` to rerun.
*

@@ -1231,3 +1231,3 @@ * Most of the time you won't need this, as `fetch` calls `depends` on your behalf — it's only necessary if you're using a custom API client that bypasses `fetch`.

/**
* This function declares that the `load` function has a _dependency_ on one or more URLs or custom identifiers, which can subsequently be used with [`invalidate()`](/docs/modules#$app-navigation-invalidate) to cause `load` to rerun.
* This function declares that the `load` function has a _dependency_ on one or more URLs or custom identifiers, which can subsequently be used with [`invalidate()`](https://kit.svelte.dev/docs/modules#$app-navigation-invalidate) to cause `load` to rerun.
*

@@ -1234,0 +1234,0 @@ * Most of the time you won't need this, as `fetch` calls `depends` on your behalf — it's only necessary if you're using a custom API client that bypasses `fetch`.

@@ -273,3 +273,5 @@ import fs from 'node:fs';

function fix_stack_trace(error) {
vite.ssrFixStacktrace(error);
try {
vite.ssrFixStacktrace(error);
} catch {}
return error.stack;

@@ -395,28 +397,22 @@ }

vite.middlewares.use((req, res, next) => {
try {
const base = `${vite.config.server.https ? 'https' : 'http'}://${
req.headers[':authority'] || req.headers.host
}`;
const base = `${vite.config.server.https ? 'https' : 'http'}://${
req.headers[':authority'] || req.headers.host
}`;
const decoded = decodeURI(new URL(base + req.url).pathname);
const decoded = decodeURI(new URL(base + req.url).pathname);
if (decoded.startsWith(assets)) {
const pathname = decoded.slice(assets.length);
const file = svelte_config.kit.files.assets + pathname;
if (decoded.startsWith(assets)) {
const pathname = decoded.slice(assets.length);
const file = svelte_config.kit.files.assets + pathname;
if (fs.existsSync(file) && !fs.statSync(file).isDirectory()) {
if (has_correct_case(file, svelte_config.kit.files.assets)) {
req.url = encodeURI(pathname); // don't need query/hash
asset_server(req, res);
return;
}
if (fs.existsSync(file) && !fs.statSync(file).isDirectory()) {
if (has_correct_case(file, svelte_config.kit.files.assets)) {
req.url = encodeURI(pathname); // don't need query/hash
asset_server(req, res);
return;
}
}
}
next();
} catch (e) {
const error = coalesce_to_error(e);
res.statusCode = 500;
res.end(fix_stack_trace(error));
}
next();
});

@@ -423,0 +419,0 @@

@@ -38,6 +38,2 @@ import fs from 'node:fs';

import { resolve_peer_dependency } from '../../utils/import.js';
import {
APP_VERSION_PLACEHOLDER_BASE,
APP_VERSION_HASH_PLACEHOLDER_BASE
} from '../../constants.js';

@@ -192,13 +188,4 @@ const cwd = process.cwd();

const app_version = kit.version.name;
const version_hash = hash(app_version);
const version_hash = hash(kit.version.name);
// if the app version or hash is longer than the placeholder, we need to pad it to avoid
// source map damage
const app_version_placeholder = APP_VERSION_PLACEHOLDER_BASE.padEnd(app_version.length, '_');
const app_version_hash_placeholder = APP_VERSION_HASH_PLACEHOLDER_BASE.padEnd(
version_hash.length,
'_'
);
/** @type {import('vite').ResolvedConfig} */

@@ -402,3 +389,3 @@ let vite_config;

const global = is_build
? `globalThis.__sveltekit_${browser ? app_version_hash_placeholder : version_hash}`
? `globalThis.__sveltekit_${version_hash}`
: 'globalThis.__sveltekit_dev';

@@ -489,4 +476,6 @@

case sveltekit_environment: {
const { version } = svelte_config.kit;
return dedent`
export const version = ${is_build && browser ? app_version_placeholder : s(kit.version.name)};
export const version = ${s(version.name)};
export let building = false;

@@ -941,46 +930,3 @@ export let prerendering = false;

/** @type {import('vite').Plugin} */
const plugin_replace_version_and_hash = {
name: 'vite-plugin-svelte-replace-version-and-hash',
enforce: 'post',
generateBundle(_, bundle, __) {
if (vite_config.build.ssr) return;
for (const file in bundle) {
if (bundle[file].type !== 'chunk') continue;
const chunk = /** @type {import('rollup').OutputChunk} */ (bundle[file]);
let code = chunk.code;
if (
!(code.includes(app_version_placeholder) || code.includes(app_version_hash_placeholder))
)
continue;
// replace the version and version after the chunk hash has already been calculated
// to avoid affecting the chunk hash
const substitutions = [
[app_version_hash_placeholder, version_hash],
[app_version_placeholder, JSON.stringify(kit.version.name)]
];
for (const [placeholder, replacement] of substitutions) {
code = code.replaceAll(
placeholder,
// pad the replacement to mitigate source map changes
replacement.padEnd(placeholder.length, ' ')
);
}
chunk.code = code;
}
}
};
return [
plugin_setup,
plugin_virtual_modules,
plugin_guard,
plugin_compile,
plugin_replace_version_and_hash
];
return [plugin_setup, plugin_virtual_modules, plugin_guard, plugin_compile];
}

@@ -987,0 +933,0 @@

@@ -165,15 +165,1 @@ import { DEV } from 'esm-env';

}
/**
* @param {string} message
* @param {number} offset
*/
export function warn_with_callsite(message, offset = 0) {
if (DEV) {
const stack = fix_stack_trace(new Error()).split('\n');
const line = stack.at(3 + offset);
message += `\n${line}`;
}
console.warn(message);
}

@@ -5,2 +5,2 @@ This is a simple alias to `src/lib`, or whatever directory is specified as [`config.kit.files.lib`](https://kit.svelte.dev/docs/configuration#files). It allows you to access common components and utility modules without `../../../../` nonsense.

A subdirectory of `$lib`. SvelteKit will prevent you from importing any modules in `$lib/server` into client-side code. See [server-only modules](/docs/server-only-modules).
A subdirectory of `$lib`. SvelteKit will prevent you from importing any modules in `$lib/server` into client-side code. See [server-only modules](https://kit.svelte.dev/docs/server-only-modules).
// generated during release, do not modify
/** @type {string} */
export const VERSION = '2.6.3';
export const VERSION = '2.6.4';

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc