worker.d.ts 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import type { FontManifest, FontConfig } from '../server/font-utils';
  2. import type { DomainLocale, NextConfigComplete } from '../server/config-shared';
  3. import type { NextParsedUrlQuery } from '../server/request-meta';
  4. import '../server/node-polyfill-fetch';
  5. import AmpHtmlValidator from 'next/dist/compiled/amphtml-validator';
  6. interface AmpValidation {
  7. page: string;
  8. result: {
  9. errors: AmpHtmlValidator.ValidationError[];
  10. warnings: AmpHtmlValidator.ValidationError[];
  11. };
  12. }
  13. interface PathMap {
  14. page: string;
  15. query?: NextParsedUrlQuery;
  16. }
  17. interface ExportPageInput {
  18. path: string;
  19. pathMap: PathMap;
  20. distDir: string;
  21. outDir: string;
  22. pagesDataDir: string;
  23. renderOpts: RenderOpts;
  24. buildExport?: boolean;
  25. serverRuntimeConfig: {
  26. [key: string]: any;
  27. };
  28. subFolders?: boolean;
  29. serverless: boolean;
  30. optimizeFonts: FontConfig;
  31. optimizeCss: any;
  32. disableOptimizedLoading: any;
  33. parentSpanId: any;
  34. httpAgentOptions: NextConfigComplete['httpAgentOptions'];
  35. serverComponents?: boolean;
  36. appPaths: string[];
  37. }
  38. interface ExportPageResults {
  39. ampValidations: AmpValidation[];
  40. fromBuildExportRevalidate?: number;
  41. error?: boolean;
  42. ssgNotFound?: boolean;
  43. duration: number;
  44. }
  45. interface RenderOpts {
  46. runtimeConfig?: {
  47. [key: string]: any;
  48. };
  49. params?: {
  50. [key: string]: string | string[];
  51. };
  52. ampPath?: string;
  53. ampValidatorPath?: string;
  54. ampSkipValidation?: boolean;
  55. optimizeFonts?: FontConfig;
  56. disableOptimizedLoading?: boolean;
  57. optimizeCss?: any;
  58. fontManifest?: FontManifest;
  59. locales?: string[];
  60. locale?: string;
  61. defaultLocale?: string;
  62. domainLocales?: DomainLocale[];
  63. trailingSlash?: boolean;
  64. }
  65. export default function exportPage({ parentSpanId, path, pathMap, distDir, outDir, pagesDataDir, renderOpts, buildExport, serverRuntimeConfig, subFolders, serverless, optimizeFonts, optimizeCss, disableOptimizedLoading, httpAgentOptions, serverComponents, }: ExportPageInput): Promise<ExportPageResults>;
  66. export {};