feat(blog): add file-based blog with dynamic slugs, MDX content and layout shell
- Introduced blog routing using Next.js App Router - Implemented dynamic [slug] pages for blog posts - Added MDX-based content loading via lib/posts - Integrated shared TopBar layout with navigation - Established clear content, lib and component separation
This commit is contained in:
12
apps/public-web/node_modules/next/dist/export/routes/app-page.d.ts
generated
vendored
Normal file
12
apps/public-web/node_modules/next/dist/export/routes/app-page.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { ExportRouteResult } from '../types';
|
||||
import type { RenderOpts } from '../../server/app-render/types';
|
||||
import type { NextParsedUrlQuery } from '../../server/request-meta';
|
||||
import type { MockedRequest, MockedResponse } from '../../server/lib/mock-request';
|
||||
import type { OpaqueFallbackRouteParams } from '../../server/request/fallback-params';
|
||||
import type { RequestLifecycleOpts } from '../../server/base-server';
|
||||
import type { AppSharedContext } from '../../server/app-render/app-render';
|
||||
import type { MultiFileWriter } from '../../lib/multi-file-writer';
|
||||
/**
|
||||
* Renders & exports a page associated with the /app directory
|
||||
*/
|
||||
export declare function exportAppPage(req: MockedRequest, res: MockedResponse, page: string, path: string, pathname: string, query: NextParsedUrlQuery, fallbackRouteParams: OpaqueFallbackRouteParams | null, partialRenderOpts: Omit<RenderOpts, keyof RequestLifecycleOpts>, htmlFilepath: string, debugOutput: boolean, isDynamicError: boolean, fileWriter: MultiFileWriter, sharedContext: AppSharedContext): Promise<ExportRouteResult>;
|
||||
201
apps/public-web/node_modules/next/dist/export/routes/app-page.js
generated
vendored
Normal file
201
apps/public-web/node_modules/next/dist/export/routes/app-page.js
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "exportAppPage", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return exportAppPage;
|
||||
}
|
||||
});
|
||||
const _isdynamicusageerror = require("../helpers/is-dynamic-usage-error");
|
||||
const _constants = require("../../lib/constants");
|
||||
const _ciinfo = require("../../server/ci-info");
|
||||
const _modulerender = require("../../server/route-modules/app-page/module.render");
|
||||
const _bailouttocsr = require("../../shared/lib/lazy-dynamic/bailout-to-csr");
|
||||
const _node = require("../../server/base-http/node");
|
||||
const _approuterheaders = require("../../client/components/app-router-headers");
|
||||
const _runwithafter = require("../../server/after/run-with-after");
|
||||
const _resumedatacache = require("../../server/resume-data-cache/resume-data-cache");
|
||||
const _entryconstants = require("../../shared/lib/entry-constants");
|
||||
async function exportAppPage(req, res, page, path, pathname, query, fallbackRouteParams, partialRenderOpts, htmlFilepath, debugOutput, isDynamicError, fileWriter, sharedContext) {
|
||||
const afterRunner = new _runwithafter.AfterRunner();
|
||||
const renderOpts = {
|
||||
...partialRenderOpts,
|
||||
waitUntil: afterRunner.context.waitUntil,
|
||||
onClose: afterRunner.context.onClose,
|
||||
onAfterTaskError: afterRunner.context.onTaskError
|
||||
};
|
||||
let isDefaultNotFound = false;
|
||||
let isDefaultGlobalError = false;
|
||||
// If the page is `/_not-found`, then we should update the page to be `/404`.
|
||||
if (page === _entryconstants.UNDERSCORE_NOT_FOUND_ROUTE_ENTRY) {
|
||||
isDefaultNotFound = true;
|
||||
pathname = '/404';
|
||||
}
|
||||
// If the page is `/_global-error`, then we should update the page to be `/500`.
|
||||
if (page === _entryconstants.UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY) {
|
||||
isDefaultGlobalError = true;
|
||||
pathname = '/500';
|
||||
}
|
||||
try {
|
||||
const result = await (0, _modulerender.lazyRenderAppPage)(new _node.NodeNextRequest(req), new _node.NodeNextResponse(res), pathname, query, fallbackRouteParams, renderOpts, undefined, sharedContext);
|
||||
const html = result.toUnchunkedString();
|
||||
// TODO(after): if we abort a prerender because of an error in an after-callback
|
||||
// we should probably communicate that better (and not log the error twice)
|
||||
await afterRunner.executeAfter();
|
||||
const { metadata } = result;
|
||||
const { flightData, cacheControl = {
|
||||
revalidate: false,
|
||||
expire: undefined
|
||||
}, postponed, fetchTags, fetchMetrics, segmentData, renderResumeDataCache } = metadata;
|
||||
// Ensure we don't postpone without having PPR enabled.
|
||||
if (postponed && !renderOpts.experimental.isRoutePPREnabled) {
|
||||
throw Object.defineProperty(new Error('Invariant: page postponed without PPR being enabled'), "__NEXT_ERROR_CODE", {
|
||||
value: "E156",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
if (cacheControl.revalidate === 0) {
|
||||
if (isDynamicError) {
|
||||
throw Object.defineProperty(new Error(`Page with dynamic = "error" encountered dynamic data method on ${path}.`), "__NEXT_ERROR_CODE", {
|
||||
value: "E388",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
const { staticBailoutInfo = {} } = metadata;
|
||||
if (debugOutput && (staticBailoutInfo == null ? void 0 : staticBailoutInfo.description)) {
|
||||
logDynamicUsageWarning({
|
||||
path,
|
||||
description: staticBailoutInfo.description,
|
||||
stack: staticBailoutInfo.stack
|
||||
});
|
||||
}
|
||||
return {
|
||||
cacheControl,
|
||||
fetchMetrics
|
||||
};
|
||||
}
|
||||
// If page data isn't available, it means that the page couldn't be rendered
|
||||
// properly so long as we don't have unknown route params. When a route doesn't
|
||||
// have unknown route params, there will not be any flight data.
|
||||
if (!flightData) {
|
||||
if (!fallbackRouteParams || fallbackRouteParams.size === 0 || renderOpts.cacheComponents) {
|
||||
throw Object.defineProperty(new Error(`Invariant: failed to get page data for ${path}`), "__NEXT_ERROR_CODE", {
|
||||
value: "E194",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// If PPR is enabled, we want to emit a segment prefetch files
|
||||
// instead of the standard rsc. This is because the standard rsc will
|
||||
// contain the dynamic data. We do this if any routes have PPR enabled so
|
||||
// that the cache read/write is the same.
|
||||
if (!renderOpts.experimental.isRoutePPREnabled) {
|
||||
// Writing the RSC payload to a file if we don't have PPR enabled.
|
||||
fileWriter.append(htmlFilepath.replace(/\.html$/, _constants.RSC_SUFFIX), flightData);
|
||||
}
|
||||
}
|
||||
let segmentPaths;
|
||||
if (segmentData) {
|
||||
// Emit the per-segment prefetch data. We emit them as separate files
|
||||
// so that the cache handler has the option to treat each as a
|
||||
// separate entry.
|
||||
segmentPaths = [];
|
||||
const segmentsDir = htmlFilepath.replace(/\.html$/, _constants.RSC_SEGMENTS_DIR_SUFFIX);
|
||||
for (const [segmentPath, buffer] of segmentData){
|
||||
segmentPaths.push(segmentPath);
|
||||
const segmentDataFilePath = segmentsDir + segmentPath + _constants.RSC_SEGMENT_SUFFIX;
|
||||
fileWriter.append(segmentDataFilePath, buffer);
|
||||
}
|
||||
}
|
||||
const headers = {
|
||||
...metadata.headers
|
||||
};
|
||||
// If we're writing the file to disk, we know it's a prerender.
|
||||
headers[_approuterheaders.NEXT_IS_PRERENDER_HEADER] = '1';
|
||||
if (fetchTags) {
|
||||
headers[_constants.NEXT_CACHE_TAGS_HEADER] = fetchTags;
|
||||
}
|
||||
// Writing static HTML to a file.
|
||||
fileWriter.append(htmlFilepath, html);
|
||||
const isParallelRoute = /\/@\w+/.test(page);
|
||||
const isNonSuccessfulStatusCode = res.statusCode > 300;
|
||||
// When PPR is enabled, we don't always send 200 for routes that have been
|
||||
// pregenerated, so we should grab the status code from the mocked
|
||||
// response.
|
||||
let status = renderOpts.experimental.isRoutePPREnabled ? res.statusCode : undefined;
|
||||
if (isDefaultNotFound) {
|
||||
// Override the default /_not-found page status code to 404
|
||||
status = 404;
|
||||
} else if (isDefaultGlobalError) {
|
||||
// Override the default /_global-error page status code to 500
|
||||
status = 500;
|
||||
} else if (isNonSuccessfulStatusCode && !isParallelRoute) {
|
||||
// If it's parallel route the status from mock response is 404
|
||||
status = res.statusCode;
|
||||
}
|
||||
// Writing the request metadata to a file.
|
||||
const meta = {
|
||||
status,
|
||||
headers,
|
||||
postponed,
|
||||
segmentPaths
|
||||
};
|
||||
fileWriter.append(htmlFilepath.replace(/\.html$/, _constants.NEXT_META_SUFFIX), JSON.stringify(meta, null, 2));
|
||||
return {
|
||||
// Filter the metadata if the environment does not have next support.
|
||||
metadata: _ciinfo.hasNextSupport ? meta : {
|
||||
segmentPaths: meta.segmentPaths
|
||||
},
|
||||
hasEmptyStaticShell: Boolean(postponed) && html === '',
|
||||
hasPostponed: Boolean(postponed),
|
||||
cacheControl,
|
||||
fetchMetrics,
|
||||
renderResumeDataCache: renderResumeDataCache ? await (0, _resumedatacache.stringifyResumeDataCache)(renderResumeDataCache, renderOpts.cacheComponents) : undefined
|
||||
};
|
||||
} catch (err) {
|
||||
if (!(0, _isdynamicusageerror.isDynamicUsageError)(err)) {
|
||||
throw err;
|
||||
}
|
||||
// We should fail rendering if a client side rendering bailout
|
||||
// occurred at the page level.
|
||||
if ((0, _bailouttocsr.isBailoutToCSRError)(err)) {
|
||||
throw err;
|
||||
}
|
||||
let fetchMetrics;
|
||||
if (debugOutput) {
|
||||
const store = renderOpts.store;
|
||||
const { dynamicUsageDescription, dynamicUsageStack } = store;
|
||||
fetchMetrics = store.fetchMetrics;
|
||||
logDynamicUsageWarning({
|
||||
path,
|
||||
description: dynamicUsageDescription ?? '',
|
||||
stack: dynamicUsageStack
|
||||
});
|
||||
}
|
||||
return {
|
||||
cacheControl: {
|
||||
revalidate: 0,
|
||||
expire: undefined
|
||||
},
|
||||
fetchMetrics
|
||||
};
|
||||
}
|
||||
}
|
||||
function logDynamicUsageWarning({ path, description, stack }) {
|
||||
const errMessage = Object.defineProperty(new Error(`Static generation failed due to dynamic usage on ${path}, reason: ${description}`), "__NEXT_ERROR_CODE", {
|
||||
value: "E381",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
if (stack) {
|
||||
errMessage.stack = errMessage.message + stack.substring(stack.indexOf('\n'));
|
||||
}
|
||||
console.warn(errMessage);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=app-page.js.map
|
||||
1
apps/public-web/node_modules/next/dist/export/routes/app-page.js.map
generated
vendored
Normal file
1
apps/public-web/node_modules/next/dist/export/routes/app-page.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
14
apps/public-web/node_modules/next/dist/export/routes/app-route.d.ts
generated
vendored
Normal file
14
apps/public-web/node_modules/next/dist/export/routes/app-route.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { ExportRouteResult } from '../types';
|
||||
import type AppRouteRouteModule from '../../server/route-modules/app-route/module';
|
||||
import type { IncrementalCache } from '../../server/lib/incremental-cache';
|
||||
import type { MockedRequest, MockedResponse } from '../../server/lib/mock-request';
|
||||
import type { ExperimentalConfig } from '../../server/config-shared';
|
||||
import type { Params } from '../../server/request/params';
|
||||
import type { MultiFileWriter } from '../../lib/multi-file-writer';
|
||||
export declare const enum ExportedAppRouteFiles {
|
||||
BODY = "BODY",
|
||||
META = "META"
|
||||
}
|
||||
export declare function exportAppRoute(req: MockedRequest, res: MockedResponse, params: Params | undefined, page: string, module: AppRouteRouteModule, incrementalCache: IncrementalCache | undefined, cacheLifeProfiles: undefined | {
|
||||
[profile: string]: import('../../server/use-cache/cache-life').CacheLife;
|
||||
}, htmlFilepath: string, fileWriter: MultiFileWriter, cacheComponents: boolean, experimental: Required<Pick<ExperimentalConfig, 'authInterrupts'>>, buildId: string): Promise<ExportRouteResult>;
|
||||
144
apps/public-web/node_modules/next/dist/export/routes/app-route.js
generated
vendored
Normal file
144
apps/public-web/node_modules/next/dist/export/routes/app-route.js
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
ExportedAppRouteFiles: null,
|
||||
exportAppRoute: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
ExportedAppRouteFiles: function() {
|
||||
return ExportedAppRouteFiles;
|
||||
},
|
||||
exportAppRoute: function() {
|
||||
return exportAppRoute;
|
||||
}
|
||||
});
|
||||
const _constants = require("../../lib/constants");
|
||||
const _node = require("../../server/base-http/node");
|
||||
const _nextrequest = require("../../server/web/spec-extension/adapters/next-request");
|
||||
const _utils = require("../../server/web/utils");
|
||||
const _isdynamicusageerror = require("../helpers/is-dynamic-usage-error");
|
||||
const _isstaticgenenabled = require("../../server/route-modules/app-route/helpers/is-static-gen-enabled");
|
||||
const _ismetadataroute = require("../../lib/metadata/is-metadata-route");
|
||||
const _apppaths = require("../../shared/lib/router/utils/app-paths");
|
||||
const _runwithafter = require("../../server/after/run-with-after");
|
||||
var ExportedAppRouteFiles = /*#__PURE__*/ function(ExportedAppRouteFiles) {
|
||||
ExportedAppRouteFiles["BODY"] = "BODY";
|
||||
ExportedAppRouteFiles["META"] = "META";
|
||||
return ExportedAppRouteFiles;
|
||||
}({});
|
||||
async function exportAppRoute(req, res, params, page, module1, incrementalCache, cacheLifeProfiles, htmlFilepath, fileWriter, cacheComponents, experimental, buildId) {
|
||||
// Ensure that the URL is absolute.
|
||||
req.url = `http://localhost:3000${req.url}`;
|
||||
// Adapt the request and response to the Next.js request and response.
|
||||
const request = _nextrequest.NextRequestAdapter.fromNodeNextRequest(new _node.NodeNextRequest(req), (0, _nextrequest.signalFromNodeResponse)(res));
|
||||
const afterRunner = new _runwithafter.AfterRunner();
|
||||
// Create the context for the handler. This contains the params from
|
||||
// the route and the context for the request.
|
||||
const context = {
|
||||
params,
|
||||
prerenderManifest: {
|
||||
version: 4,
|
||||
routes: {},
|
||||
dynamicRoutes: {},
|
||||
preview: {
|
||||
previewModeEncryptionKey: '',
|
||||
previewModeId: '',
|
||||
previewModeSigningKey: ''
|
||||
},
|
||||
notFoundRoutes: []
|
||||
},
|
||||
renderOpts: {
|
||||
cacheComponents,
|
||||
experimental,
|
||||
nextExport: true,
|
||||
supportsDynamicResponse: false,
|
||||
incrementalCache,
|
||||
waitUntil: afterRunner.context.waitUntil,
|
||||
onClose: afterRunner.context.onClose,
|
||||
onAfterTaskError: afterRunner.context.onTaskError,
|
||||
cacheLifeProfiles
|
||||
},
|
||||
sharedContext: {
|
||||
buildId
|
||||
}
|
||||
};
|
||||
try {
|
||||
const userland = module1.userland;
|
||||
// we don't bail from the static optimization for
|
||||
// metadata routes, since it's app-route we can always append /route suffix.
|
||||
const routePath = (0, _apppaths.normalizeAppPath)(page) + '/route';
|
||||
const isPageMetadataRoute = (0, _ismetadataroute.isMetadataRoute)(routePath);
|
||||
if (!(0, _isstaticgenenabled.isStaticGenEnabled)(userland) && !isPageMetadataRoute && // We don't disable static gen when cacheComponents is enabled because we
|
||||
// expect that anything dynamic in the GET handler will make it dynamic
|
||||
// and thus avoid the cache surprises that led to us removing static gen
|
||||
// unless specifically opted into
|
||||
cacheComponents !== true) {
|
||||
return {
|
||||
cacheControl: {
|
||||
revalidate: 0,
|
||||
expire: undefined
|
||||
}
|
||||
};
|
||||
}
|
||||
const response = await module1.handle(request, context);
|
||||
const isValidStatus = response.status < 400 || response.status === 404;
|
||||
if (!isValidStatus) {
|
||||
return {
|
||||
cacheControl: {
|
||||
revalidate: 0,
|
||||
expire: undefined
|
||||
}
|
||||
};
|
||||
}
|
||||
const blob = await response.blob();
|
||||
// TODO(after): if we abort a prerender because of an error in an after-callback
|
||||
// we should probably communicate that better (and not log the error twice)
|
||||
await afterRunner.executeAfter();
|
||||
const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= _constants.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;
|
||||
const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= _constants.INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;
|
||||
const headers = (0, _utils.toNodeOutgoingHttpHeaders)(response.headers);
|
||||
const cacheTags = context.renderOpts.collectedTags;
|
||||
if (cacheTags) {
|
||||
headers[_constants.NEXT_CACHE_TAGS_HEADER] = cacheTags;
|
||||
}
|
||||
if (!headers['content-type'] && blob.type) {
|
||||
headers['content-type'] = blob.type;
|
||||
}
|
||||
// Writing response body to a file.
|
||||
const body = Buffer.from(await blob.arrayBuffer());
|
||||
fileWriter.append(htmlFilepath.replace(/\.html$/, _constants.NEXT_BODY_SUFFIX), body);
|
||||
// Write the request metadata to a file.
|
||||
const meta = {
|
||||
status: response.status,
|
||||
headers
|
||||
};
|
||||
fileWriter.append(htmlFilepath.replace(/\.html$/, _constants.NEXT_META_SUFFIX), JSON.stringify(meta));
|
||||
return {
|
||||
cacheControl: {
|
||||
revalidate,
|
||||
expire
|
||||
},
|
||||
metadata: meta
|
||||
};
|
||||
} catch (err) {
|
||||
if (!(0, _isdynamicusageerror.isDynamicUsageError)(err)) {
|
||||
throw err;
|
||||
}
|
||||
return {
|
||||
cacheControl: {
|
||||
revalidate: 0,
|
||||
expire: undefined
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=app-route.js.map
|
||||
1
apps/public-web/node_modules/next/dist/export/routes/app-route.js.map
generated
vendored
Normal file
1
apps/public-web/node_modules/next/dist/export/routes/app-route.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
11
apps/public-web/node_modules/next/dist/export/routes/pages.d.ts
generated
vendored
Normal file
11
apps/public-web/node_modules/next/dist/export/routes/pages.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import type { ExportRouteResult } from '../types';
|
||||
import type { PagesRenderContext, PagesSharedContext, RenderOpts } from '../../server/render';
|
||||
import type { LoadComponentsReturnType } from '../../server/load-components';
|
||||
import type { NextParsedUrlQuery } from '../../server/request-meta';
|
||||
import type { Params } from '../../server/request/params';
|
||||
import type { MockedRequest, MockedResponse } from '../../server/lib/mock-request';
|
||||
import type { MultiFileWriter } from '../../lib/multi-file-writer';
|
||||
/**
|
||||
* Renders & exports a page associated with the /pages directory
|
||||
*/
|
||||
export declare function exportPagesPage(req: MockedRequest, res: MockedResponse, path: string, page: string, query: NextParsedUrlQuery, params: Params | undefined, htmlFilepath: string, htmlFilename: string, pagesDataDir: string, buildExport: boolean, isDynamic: boolean, sharedContext: PagesSharedContext, renderContext: PagesRenderContext, hasOrigQueryValues: boolean, renderOpts: RenderOpts, components: LoadComponentsReturnType, fileWriter: MultiFileWriter): Promise<ExportRouteResult | undefined>;
|
||||
91
apps/public-web/node_modules/next/dist/export/routes/pages.js
generated
vendored
Normal file
91
apps/public-web/node_modules/next/dist/export/routes/pages.js
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "exportPagesPage", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return exportPagesPage;
|
||||
}
|
||||
});
|
||||
const _renderresult = /*#__PURE__*/ _interop_require_default(require("../../server/render-result"));
|
||||
const _path = require("path");
|
||||
const _constants = require("../../lib/constants");
|
||||
const _bailouttocsr = require("../../shared/lib/lazy-dynamic/bailout-to-csr");
|
||||
const _modulerender = require("../../server/route-modules/pages/module.render");
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
async function exportPagesPage(req, res, path, page, query, params, htmlFilepath, htmlFilename, pagesDataDir, buildExport, isDynamic, sharedContext, renderContext, hasOrigQueryValues, renderOpts, components, fileWriter) {
|
||||
if (components.getServerSideProps) {
|
||||
throw Object.defineProperty(new Error(`Error for page ${page}: ${_constants.SERVER_PROPS_EXPORT_ERROR}`), "__NEXT_ERROR_CODE", {
|
||||
value: "E15",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
// for non-dynamic SSG pages we should have already
|
||||
// prerendered the file
|
||||
if (!buildExport && components.getStaticProps && !isDynamic) {
|
||||
return;
|
||||
}
|
||||
// Pages router merges page params (e.g. [lang]) with query params
|
||||
// primarily to support them both being accessible on `useRouter().query`.
|
||||
// If we extracted dynamic params from the path, we need to merge them
|
||||
// back into the query object.
|
||||
const searchAndDynamicParams = {
|
||||
...query,
|
||||
...params
|
||||
};
|
||||
if (components.getStaticProps && !htmlFilepath.endsWith('.html')) {
|
||||
// make sure it ends with .html if the name contains a dot
|
||||
htmlFilepath += '.html';
|
||||
htmlFilename += '.html';
|
||||
}
|
||||
let renderResult;
|
||||
if (typeof components.Component === 'string') {
|
||||
renderResult = _renderresult.default.fromStatic(components.Component, _constants.HTML_CONTENT_TYPE_HEADER);
|
||||
if (hasOrigQueryValues) {
|
||||
throw Object.defineProperty(new Error(`\nError: you provided query values for ${path} which is an auto-exported page. These can not be applied since the page can no longer be re-rendered on the server. To disable auto-export for this page add \`getInitialProps\`\n`), "__NEXT_ERROR_CODE", {
|
||||
value: "E505",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
} else {
|
||||
/**
|
||||
* This sets environment variable to be used at the time of SSR by head.tsx.
|
||||
* Using this from process.env allows targeting SSR by calling
|
||||
* `process.env.__NEXT_OPTIMIZE_CSS`.
|
||||
*/ if (renderOpts.optimizeCss) {
|
||||
process.env.__NEXT_OPTIMIZE_CSS = JSON.stringify(true);
|
||||
}
|
||||
try {
|
||||
renderResult = await (0, _modulerender.lazyRenderPagesPage)(req, res, page, searchAndDynamicParams, renderOpts, sharedContext, renderContext);
|
||||
} catch (err) {
|
||||
if (!(0, _bailouttocsr.isBailoutToCSRError)(err)) throw err;
|
||||
}
|
||||
}
|
||||
const ssgNotFound = renderResult == null ? void 0 : renderResult.metadata.isNotFound;
|
||||
const html = renderResult && !renderResult.isNull ? renderResult.toUnchunkedString() : '';
|
||||
const metadata = (renderResult == null ? void 0 : renderResult.metadata) || {};
|
||||
if (metadata.pageData) {
|
||||
const dataFile = (0, _path.join)(pagesDataDir, htmlFilename.replace(/\.html$/, _constants.NEXT_DATA_SUFFIX));
|
||||
fileWriter.append(dataFile, JSON.stringify(metadata.pageData));
|
||||
}
|
||||
if (!ssgNotFound) {
|
||||
// don't attempt writing to disk if getStaticProps returned not found
|
||||
fileWriter.append(htmlFilepath, html);
|
||||
}
|
||||
return {
|
||||
cacheControl: metadata.cacheControl ?? {
|
||||
revalidate: false,
|
||||
expire: undefined
|
||||
},
|
||||
ssgNotFound
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=pages.js.map
|
||||
1
apps/public-web/node_modules/next/dist/export/routes/pages.js.map
generated
vendored
Normal file
1
apps/public-web/node_modules/next/dist/export/routes/pages.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
apps/public-web/node_modules/next/dist/export/routes/types.d.ts
generated
vendored
Normal file
7
apps/public-web/node_modules/next/dist/export/routes/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { OutgoingHttpHeaders } from 'node:http';
|
||||
export type RouteMetadata = {
|
||||
status: number | undefined;
|
||||
headers: OutgoingHttpHeaders | undefined;
|
||||
postponed: string | undefined;
|
||||
segmentPaths: Array<string> | undefined;
|
||||
};
|
||||
6
apps/public-web/node_modules/next/dist/export/routes/types.js
generated
vendored
Normal file
6
apps/public-web/node_modules/next/dist/export/routes/types.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
apps/public-web/node_modules/next/dist/export/routes/types.js.map
generated
vendored
Normal file
1
apps/public-web/node_modules/next/dist/export/routes/types.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":[],"names":[],"mappings":"","ignoreList":[]}
|
||||
Reference in New Issue
Block a user