first commit

This commit is contained in:
2026-10-07 11:08:05 +09:00
commit 6c7d3cc893
1811 changed files with 572221 additions and 0 deletions
@@ -0,0 +1,149 @@
import { c as defineEventHandler, u as useRuntimeConfig, r as readBody, e as createError } from '../../_/nitro.mjs';
import 'unhead/server';
import 'vue';
import 'unhead/legacy';
import 'unhead/plugins';
import 'node:http';
import 'node:https';
import 'node:events';
import 'node:buffer';
import 'node:fs';
import 'node:path';
import 'node:crypto';
import 'node:url';
const consult_post = defineEventHandler(async (event) => {
const config = useRuntimeConfig();
const body = await readBody(event);
const {
studentName,
parentPhone,
name,
phone,
schoolName,
grade,
location,
regionName,
memo,
url
} = body || {};
const finalStudentName = studentName || name || "\uBBF8\uAE30\uC7AC";
const finalParentPhone = parentPhone || phone || "";
const finalLocation = location || regionName || "\uBBF8\uAE30\uC7AC";
const finalGrade = grade || "\uBBF8\uC9C0\uC815";
const finalSchool = schoolName || "\uBBF8\uAE30\uC7AC";
if (!finalParentPhone) {
throw createError({
statusCode: 400,
statusMessage: "\uBD80\uBAA8\uB2D8 \uC5F0\uB77D\uCC98\uB97C \uC62C\uBC14\uB974\uAC8C \uC785\uB825\uD574\uC8FC\uC138\uC694."
});
}
const webhookUrl = config.discordWebhookUrl || "https://discordapp.com/api/webhooks/1557204310369116210/9J4y96kmSbYNGtw5OxRgIz7InWcM8o3f8UX0Ad71-IyofwdS7tWmXkF7dj457-I8Ypiu";
const siteName = config.public.siteName || "1:1 \uB9DE\uCDA4\uACFC\uC678";
const siteDomain = config.public.siteDomain || "https://aeseo.cloud";
const now = /* @__PURE__ */ new Date();
const kstTime = new Intl.DateTimeFormat("ko-KR", {
timeZone: "Asia/Seoul",
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
hour12: false
}).format(now);
const discordPayload = {
username: `${siteName} \uC0C1\uB2F4 \uC54C\uB9BC \uBD07`,
avatar_url: "https://cdn-icons-png.flaticon.com/512/2997/2997295.png",
embeds: [
{
title: `[\uC2E0\uADDC \uBB34\uB8CC \uC0C1\uB2F4 \uC2E0\uCCAD \uC811\uC218] ${finalLocation} - ${finalGrade} (${finalStudentName} \uD559\uC0DD)`,
description: `**${siteName}** \uC0AC\uC774\uD2B8\uC5D0\uC11C \uC0C8\uB85C\uC6B4 1:1 \uD559\uC2B5 \uC0C1\uB2F4 \uC2E0\uCCAD\uC774 \uC811\uC218\uB418\uC5C8\uC2B5\uB2C8\uB2E4.`,
color: 10033947,
// 신뢰감 있는 딥 레드/네이비
fields: [
{
name: "[\uC811\uC218 \uC0AC\uC774\uD2B8]",
value: `**${siteName}**
${siteDomain}`,
inline: true
},
{
name: "[\uC0AC\uB294 \uACF3]",
value: finalLocation,
inline: true
},
{
name: "[\uD559\uC0DD \uC774\uB984]",
value: `**${finalStudentName}**`,
inline: true
},
{
name: "[\uBD80\uBAA8\uB2D8 \uC5F0\uB77D\uCC98]",
value: `**${finalParentPhone}**`,
inline: true
},
{
name: "[\uB2E4\uB2C8\uB294 \uD559\uAD50]",
value: finalSchool,
inline: true
},
{
name: "[\uD559\uB144]",
value: finalGrade,
inline: true
},
{
name: "[\uC811\uC218 \uC77C\uC2DC (KST)]",
value: kstTime,
inline: true
},
{
name: "[\uC720\uC785 \uD398\uC774\uC9C0 URL]",
value: url ? `${url}` : `${siteDomain}`,
inline: false
},
{
name: "[\uC0C1\uB2F4\uBB38\uC758 \uB0B4\uC6A9 (\uC120\uD0DD)]",
value: memo && memo.trim() ? memo.trim() : "\uC785\uB825\uB41C \uC0C1\uC138 \uBB38\uC758 \uB0B4\uC6A9 \uC5C6\uC74C",
inline: false
}
],
footer: {
text: `${siteName} \uC2E4\uC2DC\uAC04 \uC0C1\uB2F4 \uC54C\uB9BC \uC2DC\uC2A4\uD15C`
},
timestamp: now.toISOString()
}
]
};
try {
const res = await fetch(webhookUrl, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(discordPayload)
});
if (!res.ok) {
const errText = await res.text();
console.error("[Discord Webhook Error]:", res.status, errText);
return {
success: false,
message: "\uB514\uC2A4\uCF54\uB4DC \uC804\uC1A1 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
};
}
return {
success: true,
message: "\uC0C1\uB2F4 \uC2E0\uCCAD\uC774 \uC815\uC0C1\uC801\uC73C\uB85C \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4."
};
} catch (err) {
console.error("[Consult Submission Error]:", err.message);
return {
success: false,
message: "\uC11C\uBC84 \uC624\uB958\uB85C \uC778\uD574 \uC804\uC1A1\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4."
};
}
});
export { consult_post as default };
//# sourceMappingURL=consult.post.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"consult.post.mjs","sources":["../../../../../server/api/consult.post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qBAAe,kBAAA,CAAmB,OAAO,KAAA,KAAU;AACjD,EAAA,MAAM,SAAS,gBAAA,EAAiB;AAChC,EAAA,MAAM,IAAA,GAAO,MAAM,QAAA,CAAS,KAAK,CAAA;AAEjC,EAAA,MAAM;AAAA,IACJ,WAAA;AAAA,IACA,WAAA;AAAA,IACA,IAAA;AAAA,IACA,KAAA;AAAA,IACA,UAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA,IAAA;AAAA,IACA;AAAA,GACF,GAAI,QAAQ,EAAC;AAEb,EAAA,MAAM,gBAAA,GAAmB,eAAe,IAAA,IAAQ,oBAAA;AAChD,EAAA,MAAM,gBAAA,GAAmB,eAAe,KAAA,IAAS,EAAA;AACjD,EAAA,MAAM,aAAA,GAAgB,YAAY,UAAA,IAAc,oBAAA;AAChD,EAAA,MAAM,aAAa,KAAA,IAAS,oBAAA;AAC5B,EAAA,MAAM,cAAc,UAAA,IAAc,oBAAA;AAElC,EAAA,IAAI,CAAC,gBAAA,EAAkB;AACrB,IAAA,MAAM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AA,MAClC,MAAA,EAAQ,MAAA;AAAA,MACR,OAAA,EAAS;AAAA,QACP,cAAA,EAAgB;AAAA,OAClB;AAAA,MACA,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,cAAc;AAAA,KACpC,CAAA;AAED,IAAA,IAAI,CAAC,IAAI,EAAA,EAAI;AACX,MAAA,MAAM,OAAA,GAAU,MAAM,GAAA,CAAI,IAAA,EAAK;AAC/B,MAAA,OAAA,CAAQ,KAAA,CAAM,0BAAA,EAA4B,GAAA,CAAI,MAAA,EAAQ,OAAO,CAAA;AAC7D,MAAA,OAAO;AAAA,QACL,OAAA,EAAS,KAAA;AAAA,QACT,OAAA,EAAS;AAAA,OACX;AAAA,IACF;AAEA,IAAA,OAAO;AAAA,MACL,OAAA,EAAS,IAAA;AAAA,MACT,OAAA,EAAS;AAAA,KACX;AAAA,EACF,SAAS,GAAA,EAAU;AACjB,IAAA,OAAA,CAAQ,KAAA,CAAM,6BAAA,EAA+B,GAAA,CAAI,OAAO,CAAA;AACxD,IAAA,OAAO;AAAA,MACL,OAAA,EAAS,KAAA;AAAA,MACT,OAAA,EAAS;AAAA,KACX;AAAA,EACF;AACF,CAAC,CAAA;;"}
@@ -0,0 +1,566 @@
import { j as joinRelativeURL, u as useRuntimeConfig, g as appRootTag, h as appRootAttrs, i as appSpaLoaderTag, k as appSpaLoaderAttrs, w as writeEarlyHints, e as createError, b as useNitroApp, l as getRouteRules, m as createHead, N as NUXT_PRERENDER_NO_SSR_ROUTES, n as unheadOptions, o as appId, p as getQuery, q as appHead, d as destr, v as NUXT_SSR_STREAMING, x as renderSSRHeadOptions, y as appTeleportAttrs, z as NUXT_NO_SCRIPTS_PATTERNS, A as relative, B as joinURL, C as appTeleportTag, D as NUXT_PAGE_PATTERNS, E as defineRenderHandler, F as toRequestEvent, G as setResponseHeader } from '../_/nitro.mjs';
import { defineDiagnostics, createConsoleReporter } from 'nostics';
import { renderToString } from 'vue/server-renderer';
import { createRenderer, getRequestDependencies, getPreloadLinks, getPrefetchLinks } from 'vue-bundle-renderer/runtime';
import { propsToString, renderSSRHead } from 'unhead/server';
import { stringify, uneval } from 'devalue';
//#region src/runtime/utils/paths.ts
function baseURL() {
return useRuntimeConfig().app.baseURL;
}
function buildAssetsDir() {
return useRuntimeConfig().app.buildAssetsDir;
}
function buildAssetsURL(...path) {
return joinRelativeURL(publicAssetsURL(), buildAssetsDir(), ...path);
}
function publicAssetsURL(...path) {
const app = useRuntimeConfig().app;
const publicBase = app.cdnURL || app.baseURL;
return path.length ? joinRelativeURL(publicBase, ...path) : publicBase;
}
//#region src/runtime/utils/response.ts
/**
* The response the renderer builds, keeping its body as the renderer produced it.
*
* A real `Response` turns every body into a `ReadableStream`, which would send a rendered
* document as a chunked stream where nitro sends the string it was given. The renderer only
* reads the fields below back, so this describes just those.
*/
var NodeRenderResponse = class {
body;
status;
statusText;
headers;
constructor(body, init) {
this.body = body;
this.status = init?.status || 200;
this.statusText = init?.statusText || "";
this.headers = init?.headers instanceof Headers ? init.headers : new Headers(init?.headers);
}
};
//#region src/runtime/server/renderer/cache.ts
function lazyCachedFunction(fn) {
let res = null;
return () => {
if (res === null) res = fn().catch((err) => {
res = null;
throw err;
});
return res;
};
}
/**
* E8xxx
* SSR rendering diagnostics, sharing the range with the server runtime that
* hosts the renderer.
*/
const docsBase = (code) => `https://nuxt.com/docs/4.x/errors/${code.replace("NUXT_", "").toLowerCase()}`;
const rendererDiagnostics = /* #__PURE__ */ defineDiagnostics({
docsBase,
reporters: [/* @__PURE__ */ createConsoleReporter(void 0)],
codes: {
NUXT_E8001: {
why: (p) => `\`render:html\` mutated \`body\`/\`bodyAppend\` while streaming (\`${p.path}\`). These fields are silently dropped because the body is about to stream.`,
fix: "Use the `render:html:close` hook instead.",
docs: false
},
NUXT_E8002: {
why: (p) => `SSR streaming committed the response before render completed (\`${p.path}\`). The following mutations did not reach the client and were dropped:\n - ${p.mutations}`,
fix: (p) => `Move the mutation into a plugin (which runs before the shell is flushed), or opt this route out of streaming with \`routeRules: { '${p.path}': { streaming: false } }\` or the \`render:route\` hook.`,
docs: false
},
NUXT_E8004: {
why: "The server bundle is not available.",
fix: "Ensure the Nuxt build completed successfully and the server entry was emitted by your builder.",
docs: false
},
NUXT_E8006: {
why: (p) => `The payload for \`${p.path}\` is ${p.size}, which will increase the page size and slow down hydration.${p.keys ? ` Largest payload keys:\n - ${p.keys}` : ""}`,
fix: "Use the `pick` or `transform` options of `useAsyncData`/`useFetch` to strip out data the client does not need.",
docs: false
},
NUXT_E8007: {
why: (p) => `\`${p.path}\` relies on client-side JavaScript, but \`features.noScripts: 'production'\` will strip scripts from this route in production:\n - ${p.reasons}`,
fix: "Remove the client-side dependency from this route, or scope script stripping with the `noScripts` route rule instead of enabling it globally."
},
NUXT_E8009: {
why: (p) => `A page error interrupted the stream for \`${p.path}\`, and ${p.what} also failed while rendering the error response.\n ${p.cause}`,
fix: "Fix the page error first. If it keeps happening, report the failure below - the browser will show a blank or partial page instead of the error page."
}
}
});
//#region src/runtime/server/renderer/build-files.ts
const APP_ROOT_OPEN_TAG = `<${appRootTag}${propsToString(appRootAttrs)}>`;
const APP_ROOT_CLOSE_TAG = `</${appRootTag}>`;
const getServerEntry = () => import('../virtual/entry.mjs').then(function (n) { return n.g; }).then((r) => r.default || r);
const getPrecomputedDependencies = () => import('../virtual/precomputed.mjs').then((r) => "default" in r ? r.default : r).then((r) => typeof r === "function" ? r() : r);
/** Load the build artifacts for a set of renderer options, caching each of them on the returned object. */
function createBuildFiles(options) {
const buildAssetsURL = (...path) => options.buildAssetsURL(...path);
const getSSRRenderer = lazyCachedFunction(async () => {
const createSSRApp = await getServerEntry();
if (!createSSRApp) throw rendererDiagnostics.NUXT_E8004();
const precomputed = await getPrecomputedDependencies();
const renderer = createRenderer(createSSRApp, {
precomputed,
manifest: void 0,
renderToString: renderToString$1,
buildAssetsURL
});
async function renderToString$1(input, context) {
const html = await renderToString(input, context);
return APP_ROOT_OPEN_TAG + html + APP_ROOT_CLOSE_TAG;
}
return renderer;
});
const getSPARenderer = lazyCachedFunction(async () => {
const precomputed = await getPrecomputedDependencies();
const template = renderSPATemplate();
const renderer = createRenderer(() => () => {}, {
precomputed,
manifest: void 0,
renderToString: () => template,
buildAssetsURL
});
const result = await renderer.renderToString({});
const renderToString = (ssrContext) => {
const config = ssrContext.runtimeConfig;
ssrContext.modules ||= /* @__PURE__ */ new Set();
ssrContext.payload.serverRendered = false;
ssrContext.config = {
public: config.public,
app: config.app
};
return Promise.resolve(result);
};
return {
rendererContext: renderer.rendererContext,
renderToString
};
});
return {
getRenderer: (ssrContext) => ssrContext.noSSR ? getSPARenderer() : getSSRRenderer(),
getSSRRenderer,
getServerApp: lazyCachedFunction(getServerEntry)
};
}
function renderSPATemplate() {
{
`<${appSpaLoaderTag}${propsToString(appSpaLoaderAttrs)}>`;
return APP_ROOT_OPEN_TAG + APP_ROOT_CLOSE_TAG + ("");
}
}
const getSSRStyles = lazyCachedFunction(() => import('../virtual/styles.mjs').then((r) => r.default || r));
const getInlinedCSS = lazyCachedFunction(() => import('../virtual/styles.mjs').then((r) => r.inlinedCSS || {}));
//#region src/runtime/server/renderer/instance.ts
/**
* Create the renderer state for a set of options.
*
* Called by `createNuxtRenderer()`; call it directly only to render against the same
* artifacts as a renderer created elsewhere (an island handler sharing the server bundle
* loaded for page renders), and pass the result to `createNuxtRenderer()`.
*/
function createRendererInstance(options) {
return {
options,
...createBuildFiles(options)
};
}
//#region src/runtime/server/renderer/runtime.ts
/** The event to pass to application code and to the render hooks. */
function appEvent(event) {
return event["~app"] ?? event;
}
function getRequestState(event) {
return event.context.nuxt;
}
//#region src/runtime/utils/renderer/options.ts
globalThis.__buildAssetsURL = buildAssetsURL;
globalThis.__publicAssetsURL = publicAssetsURL;
/** The capabilities a nitropack v2 host provides to the Nuxt renderer. */
const rendererOptions = {
runtimeConfig: (event) => useRuntimeConfig(appEvent(event)),
buildAssetsURL,
publicAssetsURL,
getRouteRules: (event) => getRouteRules(appEvent(event)),
hooks: () => useNitroApp().hooks,
createResponse: (body, init) => new NodeRenderResponse(body, init),
createError: (init) => createError({
statusCode: init.status,
statusMessage: init.statusText,
message: init.statusText,
data: init.data
}),
writeEarlyHints: (event, hints) => writeEarlyHints(appEvent(event), hints.link),
onRenderSuccess: void 0,
prerender: void 0
};
/**
* The renderer the page and island handlers share, so that both render against a single
* load of the server bundle and its manifest.
*/
const rendererInstance = createRendererInstance(rendererOptions);
//#region src/runtime/server/renderer/url.ts
/**
* The fragment of a request URL, avoiding the lazy URL parse that reading `hash` triggers when
* there is none. A fragment is never sent over the wire, so it can only appear on a URL the
* server constructed itself.
*/
function urlHash(url) {
return url.href.includes("#") ? url.hash : "";
}
//#region src/runtime/server/renderer/app.ts
new Set(NUXT_PRERENDER_NO_SSR_ROUTES);
function createServerHead() {
return createHead(unheadOptions);
}
function createSSRContext(options, event) {
const url = event.url.pathname + event.url.search + urlHash(event.url);
const ssrContext = {
url,
event: appEvent(event),
runtimeConfig: options.runtimeConfig(event),
noSSR: getRequestState(event)?.noSSR || (false),
head: createServerHead(),
error: false,
nuxt: void 0,
payload: {},
["~payloadReducers"]: Object.create(null),
modules: /* @__PURE__ */ new Set()
};
return ssrContext;
}
/**
* Turn the response the renderer assembled into a web-standard `Response`, carrying the
* headers queued on the event alongside the ones the response names for itself.
*/
function returnRenderResponse(options, event, response) {
const headers = new Headers(event.res.headers);
for (const name in response.headers) headers.set(name, response.headers[name]);
return options.createResponse(response.body ?? null, {
status: response.statusCode ?? event.res.status,
statusText: response.statusMessage ?? event.res.statusText,
headers
});
}
function setSSRError(ssrContext, error) {
ssrContext.error = true;
ssrContext.payload = { error };
ssrContext.url = error.url;
}
function renderPayloadJsonScript(opts) {
const contents = opts.data ? encodeForwardSlashes(stringify(opts.data, opts.ssrContext["~payloadReducers"])) : "";
const payload = {
"type": "application/json",
"innerHTML": contents,
"data-nuxt-data": appId,
"data-ssr": !(opts.ssrContext.noSSR)
};
payload.id = "__NUXT_DATA__";
if (opts.src) payload["data-src"] = opts.src;
const config = uneval(opts.ssrContext.config);
return [payload, { innerHTML: `window.__NUXT__={};window.__NUXT__.config=${config}` }];
}
/**
* Encode forward slashes as unicode escape sequences to prevent
* Google from treating them as internal links and trying to crawl them.
* @see https://github.com/nuxt/nuxt/issues/24175
*/
function encodeForwardSlashes(str) {
return str.replaceAll("/", "\\u002F");
}
//#region src/runtime/server/renderer/inline-styles.ts
async function renderInlineStyles(usedModules) {
const styleMap = await getSSRStyles();
const inlinedStyles = /* @__PURE__ */ new Set();
const promises = [];
for (const mod of usedModules) if (mod in styleMap && styleMap[mod]) promises.push(styleMap[mod]());
for (const styles of await Promise.all(promises)) for (const style of styles) inlinedStyles.add(style);
return Array.from(inlinedStyles).map((style) => ({ innerHTML: style }));
}
//#region src/runtime/server/renderer/inlined-css.ts
/**
* Build a predicate telling whether the contents of an emitted CSS file were
* inlined as `<style>` tags for this request, meaning its `<link>` can be
* dropped.
*
* The builder can only remove a link at build time when every CSS source in
* the file is inlined for a module that is always rendered. For the rest it
* records the modules that inline each source, and the answer depends on what
* the request actually rendered: a component inside `<ClientOnly>` never
* reaches `ssrContext.modules`, so its styles are only ever delivered by the
* link. (#36058)
*/
async function createInlinedCSSFilter(modules) {
const inlinedCSS = await getInlinedCSS();
return (file) => {
const conditions = inlinedCSS[file.slice(file.lastIndexOf("/") + 1)];
if (!conditions) return false;
if (!modules?.size) return false;
for (const inliners of conditions) {
let inlined = false;
for (const id of inliners) if (modules.has(id)) {
inlined = true;
break;
}
if (!inlined) return false;
}
return true;
};
}
const entryIds = ["../site1/node_modules/nuxt/dist/app/entry.js"];
const entryFileName = "w-qEIetm.js";
//#region src/runtime/server/renderer/index.ts
const HAS_APP_TELEPORTS = !!(appTeleportAttrs.id);
const APP_TELEPORT_OPEN_TAG = HAS_APP_TELEPORTS ? `<${appTeleportTag}${propsToString(appTeleportAttrs)}>` : "";
const APP_TELEPORT_CLOSE_TAG = HAS_APP_TELEPORTS ? `</${appTeleportTag}>` : "";
/**
* Create a Nuxt SSR renderer, returning a web-standard handler for the requests a Nuxt
* app serves from its pages.
*
* Everything the renderer reads belongs to the renderer it was created for, so a bundle
* may create as many as it needs. Pass an instance from `createRendererInstance()` to
* render against the artifacts already loaded for another renderer.
*/
function createNuxtRenderer(optionsOrInstance) {
const instance = "getRenderer" in optionsOrInstance ? optionsOrInstance : createRendererInstance(optionsOrInstance);
return { fetch: (event) => fetch(instance, event) };
}
function fetch(instance, event) {
const runtime = instance.options;
const isErrorRoute = event.url.pathname.startsWith("/__nuxt_error");
if (isErrorRoute && !getRequestState(event)?.["~rendering-error"]) {
return Promise.reject(runtime.createError({
status: 404,
statusText: "Page Not Found: /__nuxt_error"
}));
}
const ssrError = isErrorRoute ? getQuery(event.url.href) : null;
const render = () => renderRoute(instance, event, ssrError).then((response) => returnRenderResponse(runtime, event, response));
const rendering = render();
return rendering;
}
async function renderRoute(instance, event, ssrError) {
const runtime = instance.options;
const hooks = runtime.hooks();
const hookEvent = appEvent(event);
runtime.prerender?.payloadCache;
const ssrContext = createSSRContext(runtime, event);
ssrContext.head.push(appHead);
if (ssrError) {
const status = ssrError.status || ssrError.statusCode;
if (status) ssrError.status = ssrError.statusCode = Number.parseInt(status);
if (typeof ssrError.data === "string") try {
ssrError.data = destr(ssrError.data);
} catch {}
setSSRError(ssrContext, ssrError);
}
const routeOptions = runtime.getRouteRules(event);
const NO_SCRIPTS = !!routeOptions.noScripts;
if (routeOptions.ssr === false && true) ssrContext.noSSR = true;
!ssrContext.noSSR && !ssrError && false;
const renderer = await instance.getRenderer(ssrContext);
for (const id of entryIds) ssrContext.modules.add(id);
const canStream = NUXT_SSR_STREAMING;
const renderRouteContext = {
canStream,
prefersStream: false
};
await hooks.callHook("render:route", renderRouteContext, { event: hookEvent });
const _rendered = await (renderer.renderToString(ssrContext)).catch(async (error) => {
if ((ssrContext["~renderResponse"] || ssrContext._renderResponse) && error.message === "skipping render") return {};
const _err = !ssrError && ssrContext.payload?.error || error;
await ssrContext.nuxt?.hooks.callHook("app:error", _err);
throw _err;
});
const inlinedStyles = !ssrContext["~renderResponse"] && !ssrContext._renderResponse && true ? await renderInlineStyles(ssrContext.modules ?? []) : [];
await ssrContext.nuxt?.hooks.callHook("app:rendered", {
ssrContext,
renderResult: _rendered
});
if (ssrContext["~renderResponse"] || ssrContext._renderResponse) return ssrContext["~renderResponse"] || ssrContext._renderResponse;
if (ssrContext.payload?.error && !ssrError) throw ssrContext.payload.error;
const { styles, scripts } = getRequestDependencies(ssrContext, renderer.rendererContext);
pushNoScriptsHints(ssrContext, NO_SCRIPTS);
if (!NO_SCRIPTS) {
const path = entryImportMapPath(instance, event, ssrContext);
ssrContext.head.push({ script: [{
type: "importmap",
innerHTML: { imports: { "#entry": path } }
}] });
}
if (inlinedStyles.length) ssrContext.head.push({ style: inlinedStyles });
const link = [];
const inlinedHrefs = [];
const isCSSInlined = await createInlinedCSSFilter(ssrContext.modules) ;
for (const resource of Object.values(styles)) {
if (isCSSInlined?.(resource.file)) {
inlinedHrefs.push(renderer.rendererContext.buildAssetsURL(resource.file));
continue;
}
link.push({
rel: "stylesheet",
href: renderer.rendererContext.buildAssetsURL(resource.file),
crossorigin: ""
});
}
if (link.length) ssrContext.head.push({ link });
const dependencyOptions = {
exclude: ssrContext["~lazyHydratedModules"]?.size ? ssrContext["~lazyHydratedModules"] : void 0,
scripts: !NO_SCRIPTS
};
const excludeHrefs = new Set(link.map((l) => l.href));
for (const href of inlinedHrefs) excludeHrefs.add(href);
for (const id of ssrContext["~neverHydratedModules"] ?? []) {
const file = renderer.rendererContext.manifest?.[id]?.file;
if (file) excludeHrefs.add(renderer.rendererContext.buildAssetsURL(file));
}
const hints = [];
for (const l of getPreloadLinks(ssrContext, renderer.rendererContext, dependencyOptions)) if (!excludeHrefs.has(l.href)) hints.push(l);
for (const l of getPrefetchLinks(ssrContext, renderer.rendererContext, dependencyOptions)) if (!excludeHrefs.has(l.href)) hints.push(l);
if (hints.length) ssrContext.head.push({ link: hints });
if (!NO_SCRIPTS) ssrContext.head.push({ script: renderPayloadJsonScript({
ssrContext,
data: stripInlineOnlyPayloadFields(ssrContext.payload)
}) }, {
tagPosition: "bodyClose",
tagPriority: "high"
});
if (!routeOptions.noScripts) {
const tagPosition = "head";
ssrContext.head.push({ script: Object.values(scripts).map((resource) => ({
type: resource.module ? "module" : null,
src: renderer.rendererContext.buildAssetsURL(resource.file),
defer: resource.module ? null : true,
tagPosition,
crossorigin: ""
})) });
}
const { headTags, bodyTags, bodyTagsOpen, htmlAttrs, bodyAttrs } = renderSSRHead(ssrContext.head, renderSSRHeadOptions);
const htmlContext = {
htmlAttrs: htmlAttrs ? [htmlAttrs] : [],
head: normalizeChunks([headTags]),
bodyAttrs: bodyAttrs ? [bodyAttrs] : [],
bodyPrepend: normalizeChunks([bodyTagsOpen, ssrContext.teleports?.body]),
body: [_rendered.html, APP_TELEPORT_OPEN_TAG + (HAS_APP_TELEPORTS ? joinTags([ssrContext.teleports?.[`#${appTeleportAttrs.id}`]]) : "") + APP_TELEPORT_CLOSE_TAG],
bodyAppend: [bodyTags]
};
await hooks.callHook("render:html", htmlContext, { event: hookEvent });
return {
body: renderHTMLDocument(htmlContext),
statusCode: event.res.status,
statusMessage: event.res.statusText,
headers: {
"content-type": "text/html;charset=utf-8",
"x-powered-by": "Nuxt"
}
};
}
/**
* Routes served without scripts navigate with full-page loads. This emits the
* declarative navigation hints that speed those up, on both the pages served
* without scripts (a blanket rule over same-origin links) and scripted pages
* that may link to them (rules scoped to the `noScripts` route patterns):
*
* - speculation rules, so supporting browsers prefetch and prerender the
* target ahead of the navigation;
* - when view transitions are enabled, an opt-in to same-origin cross-document
* view transitions, animating the navigation without a client runtime (the
* client-side `startViewTransition` plugin is not shipped).
*
* Both tags are declarative and execute no JavaScript.
*/
function pushNoScriptsHints(ssrContext, noScripts) {
if (noScripts) pushSpeculationRulesScript(ssrContext, NUXT_PAGE_PATTERNS.length ? NUXT_PAGE_PATTERNS : ["/*"]);
else if (NUXT_NO_SCRIPTS_PATTERNS.length) pushSpeculationRulesScript(ssrContext, NUXT_NO_SCRIPTS_PATTERNS);
else return;
}
const entryPaths = /* @__PURE__ */ new WeakMap();
/** URL of the hashed entry chunk, which `#entry` is pinned to so chunk hashes stay stable across it. */
function entryImportMapPath(instance, event, ssrContext) {
const cached = entryPaths.get(instance);
if (cached) return cached;
const url = instance.options.buildAssetsURL(entryFileName);
if (ssrContext.runtimeConfig.app.cdnURL || /^(?:\/|\.+\/)/.test(url)) {
entryPaths.set(instance, url);
return url;
}
const path = relative(event.url.pathname.replace(/\/[^/]+$/, "/"), joinURL("/", url));
return /^(?:\/|\.+\/)/.test(path) ? path : `./${path}`;
}
function pushSpeculationRulesScript(ssrContext, patterns) {
const rules = patterns.map((href_matches) => ({
where: { href_matches },
eagerness: "moderate"
}));
ssrContext.head.push({ script: [{
tagPosition: "head",
type: "speculationrules",
innerHTML: {
prefetch: rules,
prerender: rules
}
}] });
}
function normalizeChunks(chunks) {
const result = [];
for (const _chunk of chunks) {
const chunk = _chunk?.trim();
if (chunk) result.push(chunk);
}
return result;
}
function joinTags(tags) {
return tags.join("");
}
function joinAttrs(chunks) {
if (chunks.length === 0) return "";
return " " + chunks.join(" ");
}
function renderHTMLDocument(html) {
return `<!DOCTYPE html><html${joinAttrs(html.htmlAttrs)}><head>${joinTags(html.head)}</head><body${joinAttrs(html.bodyAttrs)}>${joinTags(html.bodyPrepend)}${joinTags(html.body)}${joinTags(html.bodyAppend)}</body></html>`;
}
function stripInlineOnlyPayloadFields(payload) {
if (!payload.prefetchLinks) return payload;
const { prefetchLinks: _, ...rest } = payload;
return rest;
}
const renderer = createNuxtRenderer(rendererInstance);
const handler = defineRenderHandler(async (event) => {
const response = await renderer.fetch(toRequestEvent(event));
for (const [name, value] of response.headers) {
if (name === "set-cookie") continue;
setResponseHeader(event, name, value);
}
return {
body: response.body,
statusCode: response.status,
statusMessage: response.statusText || void 0
};
});
const renderer$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
__proto__: null,
default: handler
}, Symbol.toStringTag, { value: 'Module' }));
export { baseURL as b, renderer$1 as r };
//# sourceMappingURL=renderer.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"renderer.mjs","sources":["../../../../../site1/node_modules/@nuxt/nitro-server/dist/runtime/utils/paths.mjs","../../../../../site1/node_modules/@nuxt/nitro-server/dist/runtime/utils/response.mjs","../../../../../site1/node_modules/nuxt/dist/runtime/server/renderer/cache.js","../../../../../site1/node_modules/nuxt/dist/runtime/server/renderer/diagnostics.js","../../../../../site1/node_modules/nuxt/dist/runtime/server/renderer/build-files.js","../../../../../site1/node_modules/nuxt/dist/runtime/server/renderer/instance.js","../../../../../site1/node_modules/nuxt/dist/runtime/server/renderer/runtime.js","../../../../../site1/node_modules/@nuxt/nitro-server/dist/runtime/utils/renderer/options.mjs","../../../../../site1/node_modules/nuxt/dist/runtime/server/renderer/url.js","../../../../../site1/node_modules/nuxt/dist/runtime/server/renderer/app.js","../../../../../site1/node_modules/nuxt/dist/runtime/server/renderer/payload.js","../../../../../site1/node_modules/nuxt/dist/runtime/server/renderer/inline-styles.js","../../../../../site1/node_modules/nuxt/dist/runtime/server/renderer/inlined-css.js","../../../../../site1/node_modules/nuxt/dist/runtime/server/renderer/index.js","../../../../../site1/node_modules/@nuxt/nitro-server/dist/runtime/handlers/renderer.mjs"],"names":[],"mappings":"","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]}
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long