initial commit
This commit is contained in:
5
node_modules/nuxt/dist/pages/runtime/app.vue
generated
vendored
Normal file
5
node_modules/nuxt/dist/pages/runtime/app.vue
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<template>
|
||||
<NuxtLayout>
|
||||
<NuxtPage />
|
||||
</NuxtLayout>
|
||||
</template>
|
||||
42
node_modules/nuxt/dist/pages/runtime/composables.d.ts
generated
vendored
Normal file
42
node_modules/nuxt/dist/pages/runtime/composables.d.ts
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
import { KeepAliveProps, TransitionProps, UnwrapRef } from 'vue';
|
||||
import type { RouteLocationNormalized, RouteLocationNormalizedLoaded, RouteRecordRedirectOption } from 'vue-router';
|
||||
import type { NuxtError } from '#app';
|
||||
export interface PageMeta {
|
||||
[key: string]: any;
|
||||
/**
|
||||
* Validate whether a given route can validly be rendered with this page.
|
||||
*
|
||||
* Return true if it is valid, or false if not. If another match can't be found,
|
||||
* this will mean a 404. You can also directly return an object with
|
||||
* statusCode/statusMessage to respond immediately with an error (other matches
|
||||
* will not be checked).
|
||||
*/
|
||||
validate?: (route: RouteLocationNormalized) => boolean | Promise<boolean> | Partial<NuxtError> | Promise<Partial<NuxtError>>;
|
||||
/**
|
||||
* Where to redirect if the route is directly matched. The redirection happens
|
||||
* before any navigation guard and triggers a new navigation with the new
|
||||
* target location.
|
||||
*/
|
||||
redirect?: RouteRecordRedirectOption;
|
||||
/**
|
||||
* Aliases for the record. Allows defining extra paths that will behave like a
|
||||
* copy of the record. Allows having paths shorthands like `/users/:id` and
|
||||
* `/u/:id`. All `alias` and `path` values must share the same params.
|
||||
*/
|
||||
alias?: string | string[];
|
||||
pageTransition?: boolean | TransitionProps;
|
||||
layoutTransition?: boolean | TransitionProps;
|
||||
key?: false | string | ((route: RouteLocationNormalizedLoaded) => string);
|
||||
keepalive?: boolean | KeepAliveProps;
|
||||
/** You may define a name for this page's route. */
|
||||
name?: string;
|
||||
/** You may define a path matcher, if you have a more complex pattern than can be expressed with the file name. */
|
||||
path?: string;
|
||||
/** Set to `false` to avoid scrolling to top on page navigations */
|
||||
scrollToTop?: boolean;
|
||||
}
|
||||
declare module 'vue-router' {
|
||||
interface RouteMeta extends UnwrapRef<PageMeta> {
|
||||
}
|
||||
}
|
||||
export declare const definePageMeta: (meta: PageMeta) => void;
|
||||
8
node_modules/nuxt/dist/pages/runtime/composables.mjs
generated
vendored
Normal file
8
node_modules/nuxt/dist/pages/runtime/composables.mjs
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
const warnRuntimeUsage = (method) => console.warn(
|
||||
`${method}() is a compiler-hint helper that is only usable inside the script block of a single file component which is also a page. Its arguments should be compiled away and passing it at runtime has no effect.`
|
||||
);
|
||||
export const definePageMeta = (meta) => {
|
||||
if (process.dev) {
|
||||
warnRuntimeUsage("definePageMeta");
|
||||
}
|
||||
};
|
||||
1
node_modules/nuxt/dist/pages/runtime/index.d.ts
generated
vendored
Normal file
1
node_modules/nuxt/dist/pages/runtime/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './composables';
|
||||
1
node_modules/nuxt/dist/pages/runtime/index.mjs
generated
vendored
Normal file
1
node_modules/nuxt/dist/pages/runtime/index.mjs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./composables.mjs";
|
||||
4
node_modules/nuxt/dist/pages/runtime/page-placeholder.d.ts
generated
vendored
Normal file
4
node_modules/nuxt/dist/pages/runtime/page-placeholder.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
declare const _default: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
||||
[key: string]: any;
|
||||
}>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
||||
export default _default;
|
||||
10
node_modules/nuxt/dist/pages/runtime/page-placeholder.mjs
generated
vendored
Normal file
10
node_modules/nuxt/dist/pages/runtime/page-placeholder.mjs
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { defineComponent } from "vue";
|
||||
export default defineComponent({
|
||||
name: "NuxtPage",
|
||||
setup(_, props) {
|
||||
if (process.dev) {
|
||||
console.warn("Create a Vue component in the `pages/` directory to enable `<NuxtPage>`");
|
||||
}
|
||||
return () => props.slots.default?.();
|
||||
}
|
||||
});
|
||||
16
node_modules/nuxt/dist/pages/runtime/page.d.ts
generated
vendored
Normal file
16
node_modules/nuxt/dist/pages/runtime/page.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { DefineComponent } from 'vue';
|
||||
import type { RouteLocationNormalized, RouteLocationNormalizedLoaded } from 'vue-router';
|
||||
declare const _default: DefineComponent<{
|
||||
[key: string]: any;
|
||||
name?: string | undefined;
|
||||
route?: RouteLocationNormalized | undefined;
|
||||
pageKey?: string | ((route: RouteLocationNormalizedLoaded) => string) | undefined;
|
||||
}, {}, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
||||
[key: string]: any;
|
||||
name?: string | undefined;
|
||||
route?: RouteLocationNormalized | undefined;
|
||||
pageKey?: string | ((route: RouteLocationNormalizedLoaded) => string) | undefined;
|
||||
}>>, {
|
||||
[x: string]: any;
|
||||
}>;
|
||||
export default _default;
|
||||
107
node_modules/nuxt/dist/pages/runtime/page.mjs
generated
vendored
Normal file
107
node_modules/nuxt/dist/pages/runtime/page.mjs
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
import { computed, defineComponent, h, provide, reactive, onMounted, nextTick, Suspense, Transition } from "vue";
|
||||
import { RouterView } from "vue-router";
|
||||
import { defu } from "defu";
|
||||
import { generateRouteKey, wrapInKeepAlive } from "./utils.mjs";
|
||||
import { useNuxtApp } from "#app";
|
||||
import { _wrapIf } from "#app/components/utils";
|
||||
import { appPageTransition as defaultPageTransition, appKeepalive as defaultKeepaliveConfig } from "#build/nuxt.config.mjs";
|
||||
export default defineComponent({
|
||||
name: "NuxtPage",
|
||||
inheritAttrs: false,
|
||||
props: {
|
||||
name: {
|
||||
type: String
|
||||
},
|
||||
transition: {
|
||||
type: [Boolean, Object],
|
||||
default: void 0
|
||||
},
|
||||
keepalive: {
|
||||
type: [Boolean, Object],
|
||||
default: void 0
|
||||
},
|
||||
route: {
|
||||
type: Object
|
||||
},
|
||||
pageKey: {
|
||||
type: [Function, String],
|
||||
default: null
|
||||
}
|
||||
},
|
||||
setup(props, { attrs }) {
|
||||
const nuxtApp = useNuxtApp();
|
||||
return () => {
|
||||
return h(RouterView, { name: props.name, route: props.route, ...attrs }, {
|
||||
default: (routeProps) => {
|
||||
if (!routeProps.Component) {
|
||||
return;
|
||||
}
|
||||
const key = generateRouteKey(props.pageKey, routeProps);
|
||||
const done = nuxtApp.deferHydration();
|
||||
const hasTransition = !!(props.transition ?? routeProps.route.meta.pageTransition ?? defaultPageTransition);
|
||||
const transitionProps = hasTransition && _mergeTransitionProps([
|
||||
props.transition,
|
||||
routeProps.route.meta.pageTransition,
|
||||
defaultPageTransition,
|
||||
{ onAfterLeave: () => {
|
||||
nuxtApp.callHook("page:transition:finish", routeProps.Component);
|
||||
} }
|
||||
].filter(Boolean));
|
||||
return _wrapIf(
|
||||
Transition,
|
||||
hasTransition && transitionProps,
|
||||
wrapInKeepAlive(
|
||||
props.keepalive ?? routeProps.route.meta.keepalive ?? defaultKeepaliveConfig,
|
||||
h(Suspense, {
|
||||
onPending: () => nuxtApp.callHook("page:start", routeProps.Component),
|
||||
onResolve: () => {
|
||||
nextTick(() => nuxtApp.callHook("page:finish", routeProps.Component).finally(done));
|
||||
}
|
||||
}, { default: () => h(Component, { key, routeProps, pageKey: key, hasTransition }) })
|
||||
)
|
||||
).default();
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
function _toArray(val) {
|
||||
return Array.isArray(val) ? val : val ? [val] : [];
|
||||
}
|
||||
function _mergeTransitionProps(routeProps) {
|
||||
const _props = routeProps.map((prop) => ({
|
||||
...prop,
|
||||
onAfterLeave: _toArray(prop.onAfterLeave)
|
||||
}));
|
||||
return defu(..._props);
|
||||
}
|
||||
const Component = defineComponent({
|
||||
props: ["routeProps", "pageKey", "hasTransition"],
|
||||
setup(props) {
|
||||
const previousKey = props.pageKey;
|
||||
const previousRoute = props.routeProps.route;
|
||||
const route = {};
|
||||
for (const key in props.routeProps.route) {
|
||||
route[key] = computed(() => previousKey === props.pageKey ? props.routeProps.route[key] : previousRoute[key]);
|
||||
}
|
||||
provide("_route", reactive(route));
|
||||
let vnode;
|
||||
if (process.dev && process.client && props.hasTransition) {
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
if (["#comment", "#text"].includes(vnode?.el?.nodeName)) {
|
||||
const filename = (vnode?.type).__file;
|
||||
console.warn(`[nuxt] \`${filename}\` does not have a single root node and will cause errors when navigating between routes.`);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
return () => {
|
||||
if (process.dev && process.client) {
|
||||
vnode = h(props.routeProps.Component);
|
||||
return vnode;
|
||||
}
|
||||
return h(props.routeProps.Component);
|
||||
};
|
||||
}
|
||||
});
|
||||
8
node_modules/nuxt/dist/pages/runtime/router.d.ts
generated
vendored
Normal file
8
node_modules/nuxt/dist/pages/runtime/router.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import NuxtPage from './page';
|
||||
declare module '@vue/runtime-core' {
|
||||
interface GlobalComponents {
|
||||
NuxtPage: typeof NuxtPage;
|
||||
}
|
||||
}
|
||||
declare const _default: any;
|
||||
export default _default;
|
||||
152
node_modules/nuxt/dist/pages/runtime/router.mjs
generated
vendored
Normal file
152
node_modules/nuxt/dist/pages/runtime/router.mjs
generated
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
import { computed, reactive, shallowRef } from "vue";
|
||||
import {
|
||||
createRouter,
|
||||
createWebHistory,
|
||||
createMemoryHistory,
|
||||
createWebHashHistory
|
||||
} from "vue-router";
|
||||
import { createError } from "h3";
|
||||
import { withoutBase, isEqual } from "ufo";
|
||||
import { callWithNuxt, defineNuxtPlugin, useRuntimeConfig, showError, clearError, navigateTo, useError, useState } from "#app";
|
||||
import _routes from "#build/routes";
|
||||
import routerOptions from "#build/router.options";
|
||||
import { globalMiddleware, namedMiddleware } from "#build/middleware";
|
||||
function createCurrentLocation(base, location) {
|
||||
const { pathname, search, hash } = location;
|
||||
const hashPos = base.indexOf("#");
|
||||
if (hashPos > -1) {
|
||||
const slicePos = hash.includes(base.slice(hashPos)) ? base.slice(hashPos).length : 1;
|
||||
let pathFromHash = hash.slice(slicePos);
|
||||
if (pathFromHash[0] !== "/") {
|
||||
pathFromHash = "/" + pathFromHash;
|
||||
}
|
||||
return withoutBase(pathFromHash, "");
|
||||
}
|
||||
const path = withoutBase(pathname, base);
|
||||
return path + search + hash;
|
||||
}
|
||||
export default defineNuxtPlugin(async (nuxtApp) => {
|
||||
let routerBase = useRuntimeConfig().app.baseURL;
|
||||
if (routerOptions.hashMode && !routerBase.includes("#")) {
|
||||
routerBase += "#";
|
||||
}
|
||||
const history = routerOptions.history?.(routerBase) ?? (process.client ? routerOptions.hashMode ? createWebHashHistory(routerBase) : createWebHistory(routerBase) : createMemoryHistory(routerBase));
|
||||
const routes = routerOptions.routes?.(_routes) ?? _routes;
|
||||
const initialURL = process.server ? nuxtApp.ssrContext.url : createCurrentLocation(routerBase, window.location);
|
||||
const router = createRouter({
|
||||
...routerOptions,
|
||||
history,
|
||||
routes
|
||||
});
|
||||
nuxtApp.vueApp.use(router);
|
||||
const previousRoute = shallowRef(router.currentRoute.value);
|
||||
router.afterEach((_to, from) => {
|
||||
previousRoute.value = from;
|
||||
});
|
||||
Object.defineProperty(nuxtApp.vueApp.config.globalProperties, "previousRoute", {
|
||||
get: () => previousRoute.value
|
||||
});
|
||||
const _route = shallowRef(router.resolve(initialURL));
|
||||
const syncCurrentRoute = () => {
|
||||
_route.value = router.currentRoute.value;
|
||||
};
|
||||
nuxtApp.hook("page:finish", syncCurrentRoute);
|
||||
router.afterEach((to, from) => {
|
||||
if (to.matched[0]?.components?.default === from.matched[0]?.components?.default) {
|
||||
syncCurrentRoute();
|
||||
}
|
||||
});
|
||||
const route = {};
|
||||
for (const key in _route.value) {
|
||||
route[key] = computed(() => _route.value[key]);
|
||||
}
|
||||
nuxtApp._route = reactive(route);
|
||||
nuxtApp._middleware = nuxtApp._middleware || {
|
||||
global: [],
|
||||
named: {}
|
||||
};
|
||||
const error = useError();
|
||||
try {
|
||||
if (process.server) {
|
||||
await router.push(initialURL);
|
||||
}
|
||||
await router.isReady();
|
||||
} catch (error2) {
|
||||
callWithNuxt(nuxtApp, showError, [error2]);
|
||||
}
|
||||
const initialLayout = useState("_layout");
|
||||
router.beforeEach(async (to, from) => {
|
||||
to.meta = reactive(to.meta);
|
||||
if (nuxtApp.isHydrating) {
|
||||
to.meta.layout = initialLayout.value ?? to.meta.layout;
|
||||
}
|
||||
nuxtApp._processingMiddleware = true;
|
||||
const middlewareEntries = /* @__PURE__ */ new Set([...globalMiddleware, ...nuxtApp._middleware.global]);
|
||||
for (const component of to.matched) {
|
||||
const componentMiddleware = component.meta.middleware;
|
||||
if (!componentMiddleware) {
|
||||
continue;
|
||||
}
|
||||
if (Array.isArray(componentMiddleware)) {
|
||||
for (const entry of componentMiddleware) {
|
||||
middlewareEntries.add(entry);
|
||||
}
|
||||
} else {
|
||||
middlewareEntries.add(componentMiddleware);
|
||||
}
|
||||
}
|
||||
for (const entry of middlewareEntries) {
|
||||
const middleware = typeof entry === "string" ? nuxtApp._middleware.named[entry] || await namedMiddleware[entry]?.().then((r) => r.default || r) : entry;
|
||||
if (!middleware) {
|
||||
if (process.dev) {
|
||||
throw new Error(`Unknown route middleware: '${entry}'. Valid middleware: ${Object.keys(namedMiddleware).map((mw) => `'${mw}'`).join(", ")}.`);
|
||||
}
|
||||
throw new Error(`Unknown route middleware: '${entry}'.`);
|
||||
}
|
||||
const result = await callWithNuxt(nuxtApp, middleware, [to, from]);
|
||||
if (process.server || !nuxtApp.payload.serverRendered && nuxtApp.isHydrating) {
|
||||
if (result === false || result instanceof Error) {
|
||||
const error2 = result || createError({
|
||||
statusCode: 404,
|
||||
statusMessage: `Page Not Found: ${initialURL}`
|
||||
});
|
||||
await callWithNuxt(nuxtApp, showError, [error2]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (result || result === false) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
});
|
||||
router.afterEach(async (to) => {
|
||||
delete nuxtApp._processingMiddleware;
|
||||
if (process.client && !nuxtApp.isHydrating && error.value) {
|
||||
await callWithNuxt(nuxtApp, clearError);
|
||||
}
|
||||
if (to.matched.length === 0) {
|
||||
callWithNuxt(nuxtApp, showError, [createError({
|
||||
statusCode: 404,
|
||||
fatal: false,
|
||||
statusMessage: `Page not found: ${to.fullPath}`
|
||||
})]);
|
||||
} else if (process.server) {
|
||||
const currentURL = to.fullPath || "/";
|
||||
if (!isEqual(currentURL, initialURL)) {
|
||||
await callWithNuxt(nuxtApp, navigateTo, [currentURL]);
|
||||
}
|
||||
}
|
||||
});
|
||||
nuxtApp.hooks.hookOnce("app:created", async () => {
|
||||
try {
|
||||
await router.replace({
|
||||
...router.resolve(initialURL),
|
||||
name: void 0,
|
||||
force: true
|
||||
});
|
||||
} catch (error2) {
|
||||
callWithNuxt(nuxtApp, showError, [error2]);
|
||||
}
|
||||
});
|
||||
return { provide: { router } };
|
||||
});
|
||||
2
node_modules/nuxt/dist/pages/runtime/router.options.d.ts
generated
vendored
Normal file
2
node_modules/nuxt/dist/pages/runtime/router.options.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
declare const _default: import("@nuxt/schema").RouterOptions;
|
||||
export default _default;
|
||||
51
node_modules/nuxt/dist/pages/runtime/router.options.mjs
generated
vendored
Normal file
51
node_modules/nuxt/dist/pages/runtime/router.options.mjs
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
import { nextTick } from "vue";
|
||||
import { useNuxtApp } from "#app";
|
||||
import { appPageTransition as defaultPageTransition } from "#build/nuxt.config.mjs";
|
||||
export default {
|
||||
scrollBehavior(to, from, savedPosition) {
|
||||
const nuxtApp = useNuxtApp();
|
||||
let position = savedPosition || void 0;
|
||||
if (!position && from && to && to.meta.scrollToTop !== false && _isDifferentRoute(from, to)) {
|
||||
position = { left: 0, top: 0 };
|
||||
}
|
||||
if (to.path === from.path) {
|
||||
if (from.hash && !to.hash) {
|
||||
return { left: 0, top: 0 };
|
||||
}
|
||||
if (to.hash) {
|
||||
return { el: to.hash, top: _getHashElementScrollMarginTop(to.hash) };
|
||||
}
|
||||
}
|
||||
const hasTransition = (route) => !!(route.meta.pageTransition ?? defaultPageTransition);
|
||||
const hookToWait = hasTransition(from) && hasTransition(to) ? "page:transition:finish" : "page:finish";
|
||||
return new Promise((resolve) => {
|
||||
nuxtApp.hooks.hookOnce(hookToWait, async () => {
|
||||
await nextTick();
|
||||
if (to.hash) {
|
||||
position = { el: to.hash, top: _getHashElementScrollMarginTop(to.hash) };
|
||||
}
|
||||
resolve(position);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
function _getHashElementScrollMarginTop(selector) {
|
||||
try {
|
||||
const elem = document.querySelector(selector);
|
||||
if (elem) {
|
||||
return parseFloat(getComputedStyle(elem).scrollMarginTop);
|
||||
}
|
||||
} catch {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
function _isDifferentRoute(a, b) {
|
||||
const samePageComponent = a.matched[0] === b.matched[0];
|
||||
if (!samePageComponent) {
|
||||
return true;
|
||||
}
|
||||
if (samePageComponent && JSON.stringify(a.params) !== JSON.stringify(b.params)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
9
node_modules/nuxt/dist/pages/runtime/utils.d.ts
generated
vendored
Normal file
9
node_modules/nuxt/dist/pages/runtime/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { RouterView, RouteLocationNormalizedLoaded } from 'vue-router';
|
||||
type InstanceOf<T> = T extends new (...args: any[]) => infer R ? R : never;
|
||||
type RouterViewSlot = Exclude<InstanceOf<typeof RouterView>['$slots']['default'], undefined>;
|
||||
export type RouterViewSlotProps = Parameters<RouterViewSlot>[0];
|
||||
export declare const generateRouteKey: (override: string | ((route: RouteLocationNormalizedLoaded) => string), routeProps: RouterViewSlotProps) => string;
|
||||
export declare const wrapInKeepAlive: (props: any, children: any) => {
|
||||
default: () => any;
|
||||
};
|
||||
export {};
|
||||
12
node_modules/nuxt/dist/pages/runtime/utils.mjs
generated
vendored
Normal file
12
node_modules/nuxt/dist/pages/runtime/utils.mjs
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { KeepAlive, h } from "vue";
|
||||
const interpolatePath = (route, match) => {
|
||||
return match.path.replace(/(:\w+)\([^)]+\)/g, "$1").replace(/(:\w+)[?+*]/g, "$1").replace(/:\w+/g, (r) => route.params[r.slice(1)]?.toString() || "");
|
||||
};
|
||||
export const generateRouteKey = (override, routeProps) => {
|
||||
const matchedRoute = routeProps.route.matched.find((m) => m.components?.default === routeProps.Component.type);
|
||||
const source = override ?? matchedRoute?.meta.key ?? (matchedRoute && interpolatePath(routeProps.route, matchedRoute));
|
||||
return typeof source === "function" ? source(routeProps.route) : source;
|
||||
};
|
||||
export const wrapInKeepAlive = (props, children) => {
|
||||
return { default: () => process.client && props ? h(KeepAlive, props === true ? {} : props, children) : children };
|
||||
};
|
||||
2
node_modules/nuxt/dist/pages/runtime/validate.d.ts
generated
vendored
Normal file
2
node_modules/nuxt/dist/pages/runtime/validate.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
declare const _default: any;
|
||||
export default _default;
|
||||
11
node_modules/nuxt/dist/pages/runtime/validate.mjs
generated
vendored
Normal file
11
node_modules/nuxt/dist/pages/runtime/validate.mjs
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { createError, defineNuxtRouteMiddleware } from "#app";
|
||||
export default defineNuxtRouteMiddleware(async (to) => {
|
||||
if (!to.meta?.validate) {
|
||||
return;
|
||||
}
|
||||
const result = await Promise.resolve(to.meta.validate(to));
|
||||
if (typeof result === "boolean") {
|
||||
return result;
|
||||
}
|
||||
return createError(result);
|
||||
});
|
||||
Reference in New Issue
Block a user