@sveltejs/kit
Advanced tools
Comparing version 1.22.6 to 1.23.0
{ | ||
"name": "@sveltejs/kit", | ||
"version": "1.22.6", | ||
"version": "1.23.0", | ||
"description": "The fastest way to build Svelte apps", | ||
@@ -5,0 +5,0 @@ "repository": { |
import fs from 'node:fs'; | ||
import path from 'node:path'; | ||
import colors from 'kleur'; | ||
import mime from 'mime'; | ||
@@ -204,5 +205,28 @@ import { list_files, runtime_directory } from '../../utils.js'; | ||
if (file.is_dir) continue; | ||
if (!file.name.startsWith('+')) continue; | ||
if (!valid_extensions.find((ext) => file.name.endsWith(ext))) continue; | ||
const ext = valid_extensions.find((ext) => file.name.endsWith(ext)); | ||
if (!ext) continue; | ||
if (!file.name.startsWith('+')) { | ||
const name = file.name.slice(0, -ext.length); | ||
// check if it is a valid route filename but missing the + prefix | ||
const typo = | ||
/^(?:(page(?:@(.*))?)|(layout(?:@(.*))?)|(error))$/.test(name) || | ||
/^(?:(server)|(page(?:(@[a-zA-Z0-9_-]*))?(\.server)?)|(layout(?:(@[a-zA-Z0-9_-]*))?(\.server)?))$/.test( | ||
name | ||
); | ||
if (typo) { | ||
console.log( | ||
colors | ||
.bold() | ||
.yellow( | ||
`Missing route file prefix. Did you mean +${file.name}?` + | ||
` at ${path.join(dir, file.name)}` | ||
) | ||
); | ||
} | ||
continue; | ||
} | ||
if (file.name.endsWith('.d.ts')) { | ||
@@ -209,0 +233,0 @@ let name = file.name.slice(0, -5); |
@@ -0,4 +1,6 @@ | ||
import path from 'node:path'; | ||
import { relative_path, resolve_entry } from '../../utils/filesystem.js'; | ||
import { s } from '../../utils/misc.js'; | ||
import { dedent, write_if_changed } from './utils.js'; | ||
import colors from 'kleur'; | ||
@@ -111,2 +113,14 @@ /** | ||
const typo = resolve_entry('src/+hooks.client'); | ||
if (typo) { | ||
console.log( | ||
colors | ||
.bold() | ||
.yellow( | ||
`Unexpected + prefix. Did you mean ${typo.split('/').at(-1)?.slice(1)}?` + | ||
` at ${path.resolve(typo)}` | ||
) | ||
); | ||
} | ||
write_if_changed( | ||
@@ -113,0 +127,0 @@ `${output}/app.js`, |
@@ -1,2 +0,1 @@ | ||
import fs from 'node:fs'; | ||
import path from 'node:path'; | ||
@@ -9,2 +8,3 @@ import { hash } from '../../runtime/hash.js'; | ||
import { write_if_changed } from './utils.js'; | ||
import colors from 'kleur'; | ||
@@ -80,5 +80,16 @@ /** | ||
export function write_server(config, output) { | ||
// TODO the casting shouldn't be necessary — investigate | ||
const hooks_file = /** @type {string} */ (resolve_entry(config.kit.files.hooks.server)); | ||
const hooks_file = resolve_entry(config.kit.files.hooks.server); | ||
const typo = resolve_entry('src/+hooks.server'); | ||
if (typo) { | ||
console.log( | ||
colors | ||
.bold() | ||
.yellow( | ||
`Unexpected + prefix. Did you mean ${typo.split('/').at(-1)?.slice(1)}?` + | ||
` at ${path.resolve(typo)}` | ||
) | ||
); | ||
} | ||
/** @param {string} file */ | ||
@@ -93,3 +104,3 @@ function relative(file) { | ||
config, | ||
hooks: fs.existsSync(hooks_file) ? relative(hooks_file) : null, | ||
hooks: hooks_file ? relative(hooks_file) : null, | ||
has_service_worker: | ||
@@ -96,0 +107,0 @@ config.kit.serviceWorker.register && !!resolve_entry(config.kit.files.serviceWorker), |
@@ -41,3 +41,3 @@ import { HttpError, Redirect, ActionFailure } from '../runtime/control.js'; | ||
* @param {300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#redirection_messages). Must be in the range 300-308. | ||
* @param {string} location The location to redirect to. | ||
* @param {string | URL} location The location to redirect to. | ||
*/ | ||
@@ -49,3 +49,3 @@ export function redirect(status, location) { | ||
return new Redirect(status, location); | ||
return new Redirect(status, location.toString()); | ||
} | ||
@@ -52,0 +52,0 @@ |
@@ -122,3 +122,3 @@ import 'svelte'; // pick up `declare module "*.svelte"` | ||
getServerDirectory(): string; | ||
/** Get the application path including any configured `base` path, e.g. `/my-base-path/_app`. */ | ||
/** Get the application path including any configured `base` path, e.g. `my-base-path/_app`. */ | ||
getAppPath(): string; | ||
@@ -855,3 +855,3 @@ | ||
*/ | ||
type: Omit<NavigationType, 'enter'>; | ||
type: Exclude<NavigationType, 'enter'>; | ||
/** | ||
@@ -880,3 +880,3 @@ * Whether or not the navigation will result in the page being unloaded (i.e. not a client-side navigation) | ||
*/ | ||
export interface AfterNavigate extends Navigation { | ||
export interface AfterNavigate extends Omit<Navigation, 'type'> { | ||
/** | ||
@@ -890,3 +890,3 @@ * The type of navigation: | ||
*/ | ||
type: Omit<NavigationType, 'leave'>; | ||
type: Exclude<NavigationType, 'leave'>; | ||
/** | ||
@@ -893,0 +893,0 @@ * Since `afterNavigate` is called after a navigation completes, it will never be called with a navigation that unloads the page. |
@@ -905,3 +905,3 @@ import { DEV } from 'esm-env'; | ||
* url: URL; | ||
* type: import('@sveltejs/kit').NavigationType; | ||
* type: import('@sveltejs/kit').Navigation["type"]; | ||
* intent?: import('./types').NavigationIntent; | ||
@@ -959,3 +959,3 @@ * delta?: number; | ||
* } | null; | ||
* type: import('@sveltejs/kit').NavigationType; | ||
* type: import('@sveltejs/kit').Navigation["type"]; | ||
* delta?: number; | ||
@@ -962,0 +962,0 @@ * nav_token?: {}; |
@@ -142,2 +142,4 @@ import { BROWSER } from 'esm-env'; | ||
export function disable_hash(url) { | ||
allow_nodejs_console_log(url); | ||
Object.defineProperty(url, 'hash', { | ||
@@ -157,2 +159,4 @@ get() { | ||
export function disable_search(url) { | ||
allow_nodejs_console_log(url); | ||
for (const property of ['search', 'searchParams']) { | ||
@@ -167,2 +171,15 @@ Object.defineProperty(url, property, { | ||
/** | ||
* Allow URL to be console logged, bypassing disabled properties. | ||
* @param {URL} url | ||
*/ | ||
function allow_nodejs_console_log(url) { | ||
if (!BROWSER) { | ||
// @ts-ignore | ||
url[Symbol.for('nodejs.util.inspect.custom')] = (depth, opts, inspect) => { | ||
return inspect(new URL(url), opts); | ||
}; | ||
} | ||
} | ||
const DATA_SUFFIX = '/__data.json'; | ||
@@ -169,0 +186,0 @@ |
// generated during release, do not modify | ||
/** @type {string} */ | ||
export const VERSION = '1.22.6'; | ||
export const VERSION = '1.23.0'; |
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
663133
19542