@sveltejs/kit
Version:
SvelteKit is the fastest way to build Svelte apps
394 lines (350 loc) • 13.5 kB
JavaScript
/* This file is generated by scripts/process-messages/index.js. Do not edit! */
/** @import { ClientWarningOptions } from './internal/shared.js' */
import { DEV } from 'esm-env';
import { bold, normal } from './internal/shared.js';
/**
* Placing `%tag%` directly inside `<body>` is not recommended, as your app may break for users who have certain browser extensions installed
* @param {{ "tag": string }} _values
* @param {ClientWarningOptions} [options]
*/
export function app_body_unwrapped(_values, options) {
const details = options?.element ? [options.element] : [];
if (DEV) {
console.warn(
`%c[sveltekit] ${'app_body_unwrapped'}\n%c${`Placing \`${_values.tag}\` directly inside \`<body>\` is not recommended, as your app may break for users who have certain browser extensions installed`}\nhttps://svelte.dev/e/kit/${'app_body_unwrapped'}`,
bold,
normal,
...details
);
} else {
console.warn('https://svelte.dev/e/kit/app_body_unwrapped', ...details);
}
}
/**
* The `update({ invalidateAll })` option has been deprecated in favour of `update({ refreshAll })`
* @param {void} _values
* @param {ClientWarningOptions} [options]
*/
export function enhance_invalidate_all_deprecated(_values, options) {
const details = options?.element ? [options.element] : [];
if (DEV) {
console.warn(
`%c[sveltekit] ${'enhance_invalidate_all_deprecated'}\n%c${`The \`update({ invalidateAll })\` option has been deprecated in favour of \`update({ refreshAll })\``}\nhttps://svelte.dev/e/kit/${'enhance_invalidate_all_deprecated'}`,
bold,
normal,
...details
);
} else {
console.warn('https://svelte.dev/e/kit/enhance_invalidate_all_deprecated', ...details);
}
}
/**
* An error occurred while loading the page. This will cause a full page reload
* @param {void} _values
* @param {ClientWarningOptions} [options]
*/
export function full_reload_after_error(_values, options) {
const details = options?.element ? [options.element] : [];
if (DEV) {
console.warn(
`%c[sveltekit] ${'full_reload_after_error'}\n%c${`An error occurred while loading the page. This will cause a full page reload`}\nhttps://svelte.dev/e/kit/${'full_reload_after_error'}`,
bold,
normal,
...details
);
} else {
console.warn('https://svelte.dev/e/kit/full_reload_after_error', ...details);
}
}
/**
* The `goto(..., { invalidateAll: %value% })` option has been deprecated in favour of `refreshAll`
* @param {{ "value": string }} _values
* @param {ClientWarningOptions} [options]
*/
export function goto_invalidate_all_deprecated(_values, options) {
const details = options?.element ? [options.element] : [];
if (DEV) {
console.warn(
`%c[sveltekit] ${'goto_invalidate_all_deprecated'}\n%c${`The \`goto(..., { invalidateAll: ${_values.value} })\` option has been deprecated in favour of \`refreshAll\``}\nhttps://svelte.dev/e/kit/${'goto_invalidate_all_deprecated'}`,
bold,
normal,
...details
);
} else {
console.warn('https://svelte.dev/e/kit/goto_invalidate_all_deprecated', ...details);
}
}
/**
* The `goto(..., { replaceState: %value% })` option has been deprecated in favour of `replace`
* @param {{ "value": string }} _values
* @param {ClientWarningOptions} [options]
*/
export function goto_replace_state_deprecated(_values, options) {
const details = options?.element ? [options.element] : [];
if (DEV) {
console.warn(
`%c[sveltekit] ${'goto_replace_state_deprecated'}\n%c${`The \`goto(..., { replaceState: ${_values.value} })\` option has been deprecated in favour of \`replace\``}\nhttps://svelte.dev/e/kit/${'goto_replace_state_deprecated'}`,
bold,
normal,
...details
);
} else {
console.warn('https://svelte.dev/e/kit/goto_replace_state_deprecated', ...details);
}
}
/**
* Avoid using `history.pushState(...)` and `history.replaceState(...)` as these will conflict with SvelteKit's router. Use `goto(...)` from `$app/navigation` instead.
* @param {void} _values
* @param {ClientWarningOptions} [options]
*/
export function history_api_conflict(_values, options) {
const details = options?.element ? [options.element] : [];
if (DEV) {
console.warn(
`%c[sveltekit] ${'history_api_conflict'}\n%c${`Avoid using \`history.pushState(...)\` and \`history.replaceState(...)\` as these will conflict with SvelteKit's router. Use \`goto(...)\` from \`$app/navigation\` instead.`}\nhttps://svelte.dev/e/kit/${'history_api_conflict'}`,
bold,
normal,
...details
);
} else {
console.warn('https://svelte.dev/e/kit/history_api_conflict', ...details);
}
}
/**
* The next HMR update will cause the page to reload
* @param {void} _values
* @param {ClientWarningOptions} [options]
*/
export function hmr_reload_after_error(_values, options) {
const details = options?.element ? [options.element] : [];
if (DEV) {
console.warn(
`%c[sveltekit] ${'hmr_reload_after_error'}\n%c${`The next HMR update will cause the page to reload`}\nhttps://svelte.dev/e/kit/${'hmr_reload_after_error'}`,
bold,
normal,
...details
);
} else {
console.warn('https://svelte.dev/e/kit/hmr_reload_after_error', ...details);
}
}
/**
* Unexpected value for `%name%` — should be one of %options%
* @param {{ "name": string; "options": string }} _values
* @param {ClientWarningOptions} [options]
*/
export function link_option_invalid(_values, options) {
const details = options?.element ? [options.element] : [];
if (DEV) {
console.warn(
`%c[sveltekit] ${'link_option_invalid'}\n%c${`Unexpected value for \`${_values.name}\` — should be one of ${_values.options}`}\nhttps://svelte.dev/e/kit/${'link_option_invalid'}`,
bold,
normal,
...details
);
} else {
console.warn('https://svelte.dev/e/kit/link_option_invalid', ...details);
}
}
/**
* `data-sveltekit-%name%="true"` has been replaced with `data-sveltekit-reset="false"`
* @param {{ "name": string }} _values
* @param {ClientWarningOptions} [options]
*/
export function link_option_replaced(_values, options) {
const details = options?.element ? [options.element] : [];
if (DEV) {
console.warn(
`%c[sveltekit] ${'link_option_replaced'}\n%c${`\`data-sveltekit-${_values.name}="true"\` has been replaced with \`data-sveltekit-reset="false"\``}\nhttps://svelte.dev/e/kit/${'link_option_replaced'}`,
bold,
normal,
...details
);
} else {
console.warn('https://svelte.dev/e/kit/link_option_replaced', ...details);
}
}
/**
* `%id%` has no `+page`, so there is no code to preload. If you meant to warm up an endpoint, request it with `fetch` instead.
* @param {{ "id": string }} _values
* @param {ClientWarningOptions} [options]
*/
export function preload_code_endpoint_only(_values, options) {
const details = options?.element ? [options.element] : [];
if (DEV) {
console.warn(
`%c[sveltekit] ${'preload_code_endpoint_only'}\n%c${`\`${_values.id}\` has no \`+page\`, so there is no code to preload. If you meant to warm up an endpoint, request it with \`fetch\` instead.`}\nhttps://svelte.dev/e/kit/${'preload_code_endpoint_only'}`,
bold,
normal,
...details
);
} else {
console.warn('https://svelte.dev/e/kit/preload_code_endpoint_only', ...details);
}
}
/**
* Preloading data for `%path%` failed with the following error: %message%
* @param {{ "path": string; "message": string }} _values
* @param {ClientWarningOptions} [options]
*/
export function preload_data_failed(_values, options) {
const details = options?.element ? [options.element] : [];
if (DEV) {
console.warn(
`%c[sveltekit] ${'preload_data_failed'}\n%c${`Preloading data for \`${_values.path}\` failed with the following error: ${_values.message}`}\nhttps://svelte.dev/e/kit/${'preload_data_failed'}`,
bold,
normal,
...details
);
} else {
console.warn('https://svelte.dev/e/kit/preload_data_failed', ...details);
}
}
/**
* `%id%` did not match any route, but it does match as a pathname — use `match(...)` from `$app/paths` to convert a pathname into a route ID
* @param {{ "id": string }} _values
* @param {ClientWarningOptions} [options]
*/
export function preload_route_is_pathname(_values, options) {
const details = options?.element ? [options.element] : [];
if (DEV) {
console.warn(
`%c[sveltekit] ${'preload_route_is_pathname'}\n%c${`\`${_values.id}\` did not match any route, but it does match as a pathname — use \`match(...)\` from \`$app/paths\` to convert a pathname into a route ID`}\nhttps://svelte.dev/e/kit/${'preload_route_is_pathname'}`,
bold,
normal,
...details
);
} else {
console.warn('https://svelte.dev/e/kit/preload_route_is_pathname', ...details);
}
}
/**
* `%id%` did not match any route
* @param {{ "id": string }} _values
* @param {ClientWarningOptions} [options]
*/
export function preload_route_missing(_values, options) {
const details = options?.element ? [options.element] : [];
if (DEV) {
console.warn(
`%c[sveltekit] ${'preload_route_missing'}\n%c${`\`${_values.id}\` did not match any route`}\nhttps://svelte.dev/e/kit/${'preload_route_missing'}`,
bold,
normal,
...details
);
} else {
console.warn('https://svelte.dev/e/kit/preload_route_missing', ...details);
}
}
/**
* `pushState(...)` is deprecated. Use `goto(url, { state, shallow: true })` instead.
* @param {void} _values
* @param {ClientWarningOptions} [options]
*/
export function push_state_deprecated(_values, options) {
const details = options?.element ? [options.element] : [];
if (DEV) {
console.warn(
`%c[sveltekit] ${'push_state_deprecated'}\n%c${`\`pushState(...)\` is deprecated. Use \`goto(url, { state, shallow: true })\` instead.`}\nhttps://svelte.dev/e/kit/${'push_state_deprecated'}`,
bold,
normal,
...details
);
} else {
console.warn('https://svelte.dev/e/kit/push_state_deprecated', ...details);
}
}
/**
* Form submission had invalid data, but the validation issues were ignored:
%issues%
Make sure you provide actionable feedback to users, using e.g. `myForm.fields.myField.issues()` or `myForm.fields.allIssues()`
* @param {{ "issues": string }} _values
* @param {ClientWarningOptions} [options]
*/
export function remote_form_issues_ignored(_values, options) {
const details = options?.element ? [options.element] : [];
if (DEV) {
console.warn(
`%c[sveltekit] ${'remote_form_issues_ignored'}\n%c${`Form submission had invalid data, but the validation issues were ignored:
${_values.issues}
Make sure you provide actionable feedback to users, using e.g. \`myForm.fields.myField.issues()\` or \`myForm.fields.allIssues()\``}\nhttps://svelte.dev/e/kit/${'remote_form_issues_ignored'}`,
bold,
normal,
...details
);
} else {
console.warn('https://svelte.dev/e/kit/remote_form_issues_ignored', ...details);
}
}
/**
* Updates can only be sent once per %invocation%. Ignoring additional updates.
* @param {{ "invocation": string }} _values
* @param {ClientWarningOptions} [options]
*/
export function remote_updates_repeated(_values, options) {
const details = options?.element ? [options.element] : [];
if (DEV) {
console.warn(
`%c[sveltekit] ${'remote_updates_repeated'}\n%c${`Updates can only be sent once per ${_values.invocation}. Ignoring additional updates.`}\nhttps://svelte.dev/e/kit/${'remote_updates_repeated'}`,
bold,
normal,
...details
);
} else {
console.warn('https://svelte.dev/e/kit/remote_updates_repeated', ...details);
}
}
/**
* `replaceState(...)` is deprecated. Use `goto(url, { state, shallow: true, replace: true })` instead.
* @param {void} _values
* @param {ClientWarningOptions} [options]
*/
export function replace_state_deprecated(_values, options) {
const details = options?.element ? [options.element] : [];
if (DEV) {
console.warn(
`%c[sveltekit] ${'replace_state_deprecated'}\n%c${`\`replaceState(...)\` is deprecated. Use \`goto(url, { state, shallow: true, replace: true })\` instead.`}\nhttps://svelte.dev/e/kit/${'replace_state_deprecated'}`,
bold,
normal,
...details
);
} else {
console.warn('https://svelte.dev/e/kit/replace_state_deprecated', ...details);
}
}
/**
* `export const snapshot` is deprecated. Use the `snapshot` helper from `$app/navigation` instead.
* @param {void} _values
* @param {ClientWarningOptions} [options]
*/
export function snapshot_export_deprecated(_values, options) {
const details = options?.element ? [options.element] : [];
if (DEV) {
console.warn(
`%c[sveltekit] ${'snapshot_export_deprecated'}\n%c${`\`export const snapshot\` is deprecated. Use the \`snapshot\` helper from \`$app/navigation\` instead.`}\nhttps://svelte.dev/e/kit/${'snapshot_export_deprecated'}`,
bold,
normal,
...details
);
} else {
console.warn('https://svelte.dev/e/kit/snapshot_export_deprecated', ...details);
}
}
/**
* Loading `%url%` using `window.fetch`. For best results, use the `fetch` that is passed to your `load` function
* @param {{ "url": string }} _values
* @param {ClientWarningOptions} [options]
*/
export function window_fetch_in_load(_values, options) {
const details = options?.element ? [options.element] : [];
if (DEV) {
console.warn(
`%c[sveltekit] ${'window_fetch_in_load'}\n%c${`Loading \`${_values.url}\` using \`window.fetch\`. For best results, use the \`fetch\` that is passed to your \`load\` function`}\nhttps://svelte.dev/e/kit/${'window_fetch_in_load'}`,
bold,
normal,
...details
);
} else {
console.warn('https://svelte.dev/e/kit/window_fetch_in_load', ...details);
}
}