/opt/canhelp/node_modules/next/dist/export/routes
NameSizeModeActions
app-page.d.ts10610644editdlrm
app-page.js92070644editdlrm
app-page.js.map146190644editdlrm
app-route.d.ts10790644editdlrm
app-route.js61090644editdlrm
app-route.js.map98620644editdlrm
pages.d.ts11720644editdlrm
pages.js81530644editdlrm
pages.js.map134890644editdlrm
types.d.ts2450644editdlrm
types.js1150644editdlrm
types.js.map670644editdlrm
Edit: /opt/canhelp/node_modules/next/dist/export/routes/pages.js.map (13489B)
{"version":3,"sources":["../../../src/export/routes/pages.ts"],"sourcesContent":["import type { ExportRouteResult } from '../types'\nimport type {\n PagesRenderContext,\n PagesSharedContext,\n RenderOpts,\n} from '../../server/render'\nimport type { LoadComponentsReturnType } from '../../server/load-components'\nimport type { AmpValidation } from '../types'\nimport type { NextParsedUrlQuery } from '../../server/request-meta'\nimport type { Params } from '../../server/request/params'\n\nimport RenderResult from '../../server/render-result'\nimport { join } from 'path'\nimport type {\n MockedRequest,\n MockedResponse,\n} from '../../server/lib/mock-request'\nimport { isInAmpMode } from '../../shared/lib/amp-mode'\nimport {\n HTML_CONTENT_TYPE_HEADER,\n NEXT_DATA_SUFFIX,\n SERVER_PROPS_EXPORT_ERROR,\n} from '../../lib/constants'\nimport { isBailoutToCSRError } from '../../shared/lib/lazy-dynamic/bailout-to-csr'\nimport { FileType, fileExists } from '../../lib/file-exists'\nimport { lazyRenderPagesPage } from '../../server/route-modules/pages/module.render'\nimport type { MultiFileWriter } from '../../lib/multi-file-writer'\nimport {\n getAmpValidatorInstance,\n getBundledAmpValidatorFilepath,\n} from '../helpers/get-amp-html-validator'\n\n/**\n * Renders & exports a page associated with the /pages directory\n */\nexport async function exportPagesPage(\n req: MockedRequest,\n res: MockedResponse,\n path: string,\n page: string,\n query: NextParsedUrlQuery,\n params: Params | undefined,\n htmlFilepath: string,\n htmlFilename: string,\n ampPath: string,\n subFolders: boolean,\n outDir: string,\n ampValidatorPath: string | undefined,\n pagesDataDir: string,\n buildExport: boolean,\n isDynamic: boolean,\n sharedContext: PagesSharedContext,\n renderContext: PagesRenderContext,\n hasOrigQueryValues: boolean,\n renderOpts: RenderOpts,\n components: LoadComponentsReturnType,\n fileWriter: MultiFileWriter\n): Promise {\n const ampState = {\n ampFirst: components.pageConfig?.amp === true,\n hasQuery: Boolean(query.amp),\n hybrid: components.pageConfig?.amp === 'hybrid',\n }\n\n if (!ampValidatorPath) {\n ampValidatorPath = getBundledAmpValidatorFilepath()\n }\n\n const inAmpMode = isInAmpMode(ampState)\n const hybridAmp = ampState.hybrid\n\n if (components.getServerSideProps) {\n throw new Error(`Error for page ${page}: ${SERVER_PROPS_EXPORT_ERROR}`)\n }\n\n // for non-dynamic SSG pages we should have already\n // prerendered the file\n if (!buildExport && components.getStaticProps && !isDynamic) {\n return\n }\n\n // Pages router merges page params (e.g. [lang]) with query params\n // primarily to support them both being accessible on `useRouter().query`.\n // If we extracted dynamic params from the path, we need to merge them\n // back into the query object.\n const searchAndDynamicParams = {\n ...query,\n ...params,\n }\n\n if (components.getStaticProps && !htmlFilepath.endsWith('.html')) {\n // make sure it ends with .html if the name contains a dot\n htmlFilepath += '.html'\n htmlFilename += '.html'\n }\n\n let renderResult: RenderResult | undefined\n\n if (typeof components.Component === 'string') {\n renderResult = RenderResult.fromStatic(\n components.Component,\n HTML_CONTENT_TYPE_HEADER\n )\n\n if (hasOrigQueryValues) {\n throw new Error(\n `\\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`\n )\n }\n } else {\n /**\n * This sets environment variable to be used at the time of SSR by head.tsx.\n * Using this from process.env allows targeting SSR by calling\n * `process.env.__NEXT_OPTIMIZE_CSS`.\n */\n if (renderOpts.optimizeCss) {\n process.env.__NEXT_OPTIMIZE_CSS = JSON.stringify(true)\n }\n try {\n renderResult = await lazyRenderPagesPage(\n req,\n res,\n page,\n searchAndDynamicParams,\n renderOpts,\n sharedContext,\n renderContext\n )\n } catch (err) {\n if (!isBailoutToCSRError(err)) throw err\n }\n }\n\n const ssgNotFound = renderResult?.metadata.isNotFound\n\n const ampValidations: AmpValidation[] = []\n\n const validateAmp = async (\n rawAmpHtml: string,\n ampPageName: string,\n validatorPath: string | undefined\n ) => {\n const validator = await getAmpValidatorInstance(validatorPath)\n const result = validator.validateString(rawAmpHtml)\n const errors = result.errors.filter((error) => {\n if (error.severity === 'ERROR') {\n // Unclear yet if these actually prevent the page from being indexed by the AMP cache.\n // These are coming from React so all we can do is ignore them for now.\n\n // \n // https://github.com/ampproject/amphtml/issues/40279\n if (\n error.code === 'DISALLOWED_ATTR' &&\n error.params[0] === 'blocking' &&\n error.params[1] === 'link'\n ) {\n return false\n }\n //