import { SiteAssetsManager } from './SiteAssetsManager.js'; import { SitePagesManager, AddressablePage } from './SitePagesManager.js'; import { SiteConfig } from './SiteConfig.js'; import { Page } from '../Page/index.js'; import { VariableProcessor } from '../variables/VariableProcessor.js'; import { ExternalManager } from '../External/ExternalManager.js'; import { SiteLinkManager } from '../html/SiteLinkManager.js'; import { PluginManager } from '../plugins/PluginManager.js'; import { LayoutManager } from '../Layout/index.js'; import { ProgressBar } from '../lib/progress/index.js'; import '../patches/htmlparser2.js'; type PageGenerationTask = { mode: string; pages: Page[]; }; type PageGenerationContext = { startTime: Date; numPagesGenerated: number; numPagesToGenerate: number; isCompleted: boolean; }; /** * Orchestrates the site generation process. * Manages the build lifecycle, variable processing, plugin management, * and rebuilding strategies (lazy/background). */ export declare class SiteGenerationManager { rootPath: string; outputPath: string; tempPath: string; siteConfig: SiteConfig; siteConfigPath: string; variableProcessor: VariableProcessor; pluginManager: PluginManager; siteLinkManager: SiteLinkManager; externalManager: ExternalManager; layoutManager: LayoutManager; sitePages: SitePagesManager; siteAssets: SiteAssetsManager; forceReload: boolean; backgroundBuildMode: string | boolean; stopGenerationTimeThreshold: Date; postBackgroundBuildFunc: () => void; onePagePath: string; currentPageViewed: string; currentOpenedPages: string[]; toRebuild: Set; constructor(rootPath: string, outputPath: string, onePagePath: string, forceReload: boolean | undefined, siteConfigPath: string | undefined, isDevMode: any, backgroundBuildMode: boolean, postBackgroundBuildFunc: () => void); configure(siteAssets: SiteAssetsManager, sitePages: SitePagesManager): void; static rejectHandler(error: unknown, removeFolders: string[]): Promise; beforeSiteGenerate(): void; /** * Changes the site variable of the current page being viewed, building it if necessary. * @param normalizedUrl BaseUrl-less and extension-less url of the page * @return Boolean of whether the page needed to be rebuilt */ changeCurrentPage(normalizedUrl: string): boolean; /** * Changes the list of current opened pages * @param normalizedUrls Collection of normalized url of pages taken from the clients * ordered from most-to-least recently opened */ changeCurrentOpenedPages(normalizedUrls: string[]): void; /** * Read and stores the site config from site.json, in Site, SitePages and SiteAssets. * Overwrite the default base URL if it's specified by the user. * @param baseUrl user defined base URL (if exists) */ readSiteConfig(baseUrl?: string): Promise; /** * Collects the base url map in the site/subsites */ collectBaseUrl(): void; /** * Set up the managers used with the configurations. */ buildManagers(baseUrlMap: Set): void; /** * Collects the user defined variables map in the site/subsites */ collectUserDefinedVariablesMap(): void; /** * Collects the user defined variables map in the site/subsites * if there is a change in the variables file * @param filePaths array of paths corresponding to files that have changed */ collectUserDefinedVariablesMapIfNeeded(filePaths: string[]): boolean; /** * Generate the website. * @param baseUrl user defined base URL (if exists) */ generate(baseUrl: string | undefined): Promise; /** * Helper function for generate(). */ calculateBuildTimeForGenerate(startTime: Date, lazyWebsiteGenerationString: string): void; /** * Build all pages of the site */ buildSourceFiles(): Promise; /** * Adds all pages except the viewed pages to toRebuild, flagging them for lazy building later. */ lazyBuildAllPagesNotViewed(viewedPages: string | string[]): Promise; /** * Only build landing page of the site, building more as the author goes to different links. */ lazyBuildSourceFiles(): Promise; /** * Helper function for lazyBuildSourceFiles(). */ copyLazySourceFiles(): Promise; _rebuildAffectedSourceFiles(filePaths: string | string[]): Promise; _rebuildPagesBeingViewed(normalizedUrls: string[]): Promise; /** * Helper function for _rebuildPagesBeingViewed(). */ static calculateBuildTimeForRebuildPagesBeingViewed(startTime: Date): void; _backgroundBuildNotViewedFiles(): Promise; /** * Generates pages that are marked to be built/rebuilt. * @returns A Promise that resolves once all pages are generated. */ generatePagesMarkedToRebuild(): Promise; _rebuildSourceFiles(): Promise; /** * Helper function for _rebuildSourceFiles(). */ rebuildRequiredPages(): Promise; /** * Writes the site data to siteData.json * @param verbose Flag to emit logs of the operation */ writeSiteData(verbose?: boolean): Promise; stopOngoingBuilds(): void; /** * Runs the supplied page generation tasks according to the specified mode of each task. * A page generation task can be a sequential generation or an asynchronous generation. * @param pageGenerationTasks Array of page generation tasks * @returns A Promise that resolves to a boolean which indicates whether the generation * ran to completion */ runPageGenerationTasks(pageGenerationTasks: PageGenerationTask[]): Promise; /** * Generate pages sequentially. That is, the pages are generated * one-by-one in order. * @param pages Pages to be generated * @param progressBar Progress bar of the overall generation process * @returns A Promise that resolves to a boolean which indicates whether the generation * ran to completion */ generatePagesSequential(pages: Page[], progressBar: ProgressBar): Promise; /** * Creates the supplied pages' page generation promises at a throttled rate. * This is done to avoid pushing too many callbacks into the event loop at once. (#1245) * @param pages Pages to be generated * @param progressBar Progress bar of the overall generation process * @returns A Promise that resolves to a boolean which indicates whether the generation * ran to completion */ generatePagesAsyncThrottled(pages: Page[], progressBar: ProgressBar): Promise; /** * Helper function for generatePagesAsyncThrottled(). */ generateProgressBarStatus(progressBar: ProgressBar, context: PageGenerationContext, pageGenerationQueue: (() => Promise)[], resolve: ((arg0: boolean) => any)): void; /** * Renders all pages specified in site configuration file to the output folder */ generatePages(): Promise; /** * Renders only the starting page for lazy loading to the output folder. */ generateLandingPage(): Promise; regenerateAffectedPages(filePaths: string[]): Promise; /** * Helper function for regenerateAffectedPages(). */ calculateBuildTimeForRegenerateAffectedPages(startTime: Date): void; private _setTimestampVariable; rebuildPagesBeingViewed: (this: any, newItem?: string | string[] | undefined) => Promise; /** * Rebuild pages that are affected by changes in filePaths * @param filePaths a single path or an array of paths corresponding to the files that have changed */ rebuildAffectedSourceFiles: (this: any, newItem?: string | string[] | undefined) => Promise; /** * Rebuild all pages */ rebuildSourceFiles: (this: any, newItem?: string | string[] | undefined) => Promise; /** * Builds pages that are yet to build/rebuild in the background */ backgroundBuildNotViewedFiles: (this: any, newItem?: string | string[] | undefined) => Promise; /** * Indexes all the pages of the site using pagefind. * @returns true if indexing succeeded and pagefind assets were written, false otherwise. */ indexSiteWithPagefind(): Promise; reloadSiteConfig(): Promise; /** * Handles the rebuilding of modified pages */ handlePageReload(oldAddressablePages: AddressablePage[], oldPagesSrc: string[], oldSiteConfig: SiteConfig): Promise; } export {}; //# sourceMappingURL=SiteGenerationManager.d.ts.map