nuxt4, and some changes on packages
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import { createRenderer, getRequestDependencies, getPreloadLinks, getPrefetchLinks } from 'vue-bundle-renderer/runtime';
|
||||
import { b as buildAssetsURL, u as useRuntimeConfig, g as getResponseStatusText, e as getResponseStatus, f as defineRenderHandler, p as publicAssetsURL, i as getQuery, k as createError, l as getRouteRules, m as useNitroApp } from '../_/nitro.mjs';
|
||||
import { c as buildAssetsURL, u as useRuntimeConfig, g as getResponseStatusText, e as getResponseStatus, f as defineRenderHandler, p as publicAssetsURL, i as getQuery, k as createError, l as destr, m as getRouteRules, n as useNitroApp } from '../_/nitro.mjs';
|
||||
import { renderToString } from 'vue/server-renderer';
|
||||
import { createHead as createHead$1, propsToString, renderSSRHead } from 'unhead/server';
|
||||
import { stringify, uneval } from 'devalue';
|
||||
import { walkResolver } from 'unhead/utils';
|
||||
import { toValue, isRef, hasInjectionContext, inject, ref, watchEffect, getCurrentInstance, onBeforeUnmount, onDeactivated, onActivated } from 'vue';
|
||||
import { DeprecationsPlugin, PromisesPlugin, TemplateParamsPlugin, AliasSortingPlugin } from 'unhead/plugins';
|
||||
|
||||
const VueResolver = (_, value) => {
|
||||
return isRef(value) ? toValue(value) : value;
|
||||
@@ -82,11 +81,15 @@ const appTeleportTag = "div";
|
||||
|
||||
const appTeleportAttrs = {"id":"teleports"};
|
||||
|
||||
const appSpaLoaderTag = "div";
|
||||
|
||||
const appSpaLoaderAttrs = {"id":"__nuxt-loader"};
|
||||
|
||||
const appId = "nuxt-app";
|
||||
|
||||
const APP_ROOT_OPEN_TAG = `<${appRootTag}${propsToString(appRootAttrs)}>`;
|
||||
const APP_ROOT_CLOSE_TAG = `</${appRootTag}>`;
|
||||
const getServerEntry = () => import('../build/server.mjs').then(function (n) { return n.bP; }).then((r) => r.default || r);
|
||||
const getServerEntry = () => import('../build/server.mjs').then(function (n) { return n.bQ; }).then((r) => r.default || r);
|
||||
const getClientManifest = () => import('../build/client.manifest.mjs').then((r) => r.default || r).then((r) => typeof r === "function" ? r() : r);
|
||||
const getSSRRenderer = lazyCachedFunction(async () => {
|
||||
const manifest = await getClientManifest();
|
||||
@@ -113,7 +116,11 @@ const getSPARenderer = lazyCachedFunction(async () => {
|
||||
const manifest = await getClientManifest();
|
||||
const spaTemplate = await import('../virtual/_virtual_spa-template.mjs').then((r) => r.template).catch(() => "").then((r) => {
|
||||
{
|
||||
return APP_ROOT_OPEN_TAG + r + APP_ROOT_CLOSE_TAG;
|
||||
const APP_SPA_LOADER_OPEN_TAG = `<${appSpaLoaderTag}${propsToString(appSpaLoaderAttrs)}>`;
|
||||
const APP_SPA_LOADER_CLOSE_TAG = `</${appSpaLoaderTag}>`;
|
||||
const appTemplate = APP_ROOT_OPEN_TAG + APP_ROOT_CLOSE_TAG;
|
||||
const loaderTemplate = r ? APP_SPA_LOADER_OPEN_TAG + r + APP_SPA_LOADER_CLOSE_TAG : "";
|
||||
return appTemplate + loaderTemplate;
|
||||
}
|
||||
});
|
||||
const options = {
|
||||
@@ -198,8 +205,6 @@ function splitPayload(ssrContext) {
|
||||
|
||||
const unheadOptions = {
|
||||
disableDefaults: true,
|
||||
disableCapoSorting: false,
|
||||
plugins: [DeprecationsPlugin, PromisesPlugin, TemplateParamsPlugin, AliasSortingPlugin],
|
||||
};
|
||||
|
||||
function createSSRContext(event) {
|
||||
@@ -224,7 +229,7 @@ function setSSRError(ssrContext, error) {
|
||||
ssrContext.url = error.url;
|
||||
}
|
||||
|
||||
const renderSSRHeadOptions = {"omitLineBreaks":false};
|
||||
const renderSSRHeadOptions = {"omitLineBreaks":true};
|
||||
|
||||
globalThis.__buildAssetsURL = buildAssetsURL;
|
||||
globalThis.__publicAssetsURL = publicAssetsURL;
|
||||
@@ -246,6 +251,12 @@ const renderer = defineRenderHandler(async (event) => {
|
||||
ssrContext.head.push(appHead, headEntryOptions);
|
||||
if (ssrError) {
|
||||
ssrError.statusCode &&= Number.parseInt(ssrError.statusCode);
|
||||
if (typeof ssrError.data === "string") {
|
||||
try {
|
||||
ssrError.data = destr(ssrError.data);
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
setSSRError(ssrContext, ssrError);
|
||||
}
|
||||
const isRenderingPayload = PAYLOAD_URL_RE.test(ssrContext.url);
|
||||
@@ -315,6 +326,7 @@ const renderer = defineRenderHandler(async (event) => {
|
||||
});
|
||||
}
|
||||
if (!routeOptions.noScripts) {
|
||||
const tagPosition = "head";
|
||||
ssrContext.head.push({
|
||||
script: Object.values(scripts).map((resource) => ({
|
||||
type: resource.module ? "module" : null,
|
||||
@@ -322,7 +334,7 @@ const renderer = defineRenderHandler(async (event) => {
|
||||
defer: resource.module ? null : true,
|
||||
// if we are rendering script tag payloads that import an async payload
|
||||
// we need to ensure this resolves before executing the Nuxt entry
|
||||
tagPosition: "head",
|
||||
tagPosition,
|
||||
crossorigin: ""
|
||||
}))
|
||||
}, headEntryOptions);
|
||||
@@ -366,10 +378,10 @@ 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>`;
|
||||
}
|
||||
|
||||
const renderer$1 = /*#__PURE__*/Object.freeze({
|
||||
const renderer$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
||||
__proto__: null,
|
||||
default: renderer
|
||||
});
|
||||
}, Symbol.toStringTag, { value: 'Module' }));
|
||||
|
||||
export { headSymbol as h, renderer$1 as r, useHead as u };
|
||||
//# sourceMappingURL=renderer.mjs.map
|
||||
|
||||
Reference in New Issue
Block a user