UNPKG

nuxt

Version:

Nuxt is a free and open-source framework with an intuitive and extendable way to create type-safe, performant and production-grade full-stack web applications and websites with Vue.js.

64 lines (63 loc) 2.72 kB
import { docsBase, prodReporters, reporters } from "./_shared.js"; import { defineDiagnostics, defineProdDiagnostics } from "nostics"; //#region src/app/diagnostics/state.ts /** * E7xxx * Payload / state / cookie runtime diagnostics. */ const stateDiagnostics = !import.meta.dev ? /* #__PURE__ */ defineProdDiagnostics({ docsBase, reporters: prodReporters }) : /* #__PURE__ */ defineDiagnostics({ docsBase, reporters, codes: { NUXT_E7001: { why: (p) => `Payload URL must not include a hostname (received \`${p.url}\`).`, fix: "Use a relative path (e.g. `/page`) instead of a full URL with hostname." }, NUXT_E7002: { why: (p) => `Cannot load payload \`${p.url}\`.`, fix: "Ensure the payload file is generated and accessible; this may stem from a prerendering issue, server misconfiguration, or a network error.", docs: false }, NUXT_E7003: { why: (p) => `Failed to preload the payload for \`${p.url}\`.`, fix: "This is usually a transient network error; the payload will be fetched on navigation instead.", docs: false }, NUXT_E7004: { why: "`definePayloadReviver` was not called from a plugin `unshift`ed to the beginning of the Nuxt plugins array.", fix: "Move this call into a Nuxt plugin file and ensure the plugin is registered early in the plugin order.", docs: false }, NUXT_E7005: { why: (p) => `Cookie \`${p.name}\` was not set because it has already expired.`, fix: "Update the `expires` or `maxAge` option to a future date.", docs: false }, NUXT_E7006: { why: (p) => `Cookie \`${p.name}\` was previously set to \`${p.previous}\` and is being overridden to \`${p.next}\`, which may cause unexpected issues.`, fix: "Avoid setting the same cookie from multiple places during SSR, or use a single `useCookie()` composable shared across components.", docs: false }, NUXT_E7007: { why: (p) => `\`useState\` init must be a function, but got \`${p.type}\`.`, fix: "Wrap the initial value in a function: `useState('key', () => value)` instead of `useState('key', value)`." }, NUXT_E7008: { why: (p) => `\`callOnce\` \`fn\` must be a function, but got \`${p.type}\`.`, fix: "Pass a function as the second argument: `callOnce('key', () => { ... })`." }, NUXT_E7009: { why: (p) => `\`useState\` key must be a string (received \`${p.key}\`).`, fix: "Pass a string key as the first argument to `useState()`, e.g. `useState('myKey', () => initialValue)`." }, NUXT_E7010: { why: (p) => `\`callOnce\` key must be a string (received \`${p.key}\`).`, fix: "Pass a string key as the first argument to `callOnce()`, e.g. `callOnce('myKey', () => { ... })`." } } }); //#endregion export { stateDiagnostics };