astro-sveltia-cms
Version:
Add Sveltia CMS admin dashboard and a custom OAuth backend to your Astro project
35 lines (34 loc) • 1.02 kB
JavaScript
const n = {
adminRoute: "/admin",
oauthDisabled: !1,
oauthLoginRoute: "/oauth",
oauthCallbackRoute: "/oauth/callback"
};
function i(e) {
const { adminRoute: t, oauthDisabled: o, oauthLoginRoute: a, oauthCallbackRoute: s } = { ...n, ...e };
if (!(t != null && t.startsWith("/")) || !(a != null && a.startsWith("/")) || !(s != null && s.startsWith("/")))
throw new Error('`adminRoute`, `oauthLoginRoute` and `oauthCallbackRoute` options must start with "/"');
return {
name: "astro-sveltia-cms",
hooks: {
"astro:config:setup": async ({ injectRoute: r }) => {
r({
pattern: t,
entrypoint: "astro-sveltia-cms/src/admin.astro",
prerender: !1
}), o || (r({
pattern: a,
entrypoint: "astro-sveltia-cms/src/oauth/index.ts",
prerender: !1
}), r({
pattern: s,
entrypoint: "astro-sveltia-cms/src/oauth/callback.ts",
prerender: !1
}));
}
}
};
}
export {
i as default
};