import type { EcoPagesAppConfig, IHmrManager } from '../../../types/internal-types.js'; import type { AssetDefinition, AssetKind, AssetSource, ProcessedAsset } from './assets.types.js'; import { ProcessorRegistry } from './processor.registry.js'; /** * Processes declared component and page asset dependencies for one app instance. * * @remarks * This service is the shared bridge between dependency declarations and emitted * runtime-ready assets. It owns deduplication, processor dispatch, cache reuse, * output URL normalization, and production gzip preparation so route rendering * and HMR flows do not need to understand processor-specific behavior. */ export declare class AssetProcessingService { static readonly RESOLVED_ASSETS_DIR = "assets"; private registry; private hmrManager?; private cache; private readonly config; /** * Creates the asset-processing service bound to one finalized app config. */ constructor(config: EcoPagesAppConfig); /** * Set the HMR manager for the asset processing service. * @param hmrManager The HMR manager to set. */ setHmrManager(hmrManager: IHmrManager): void; getHmrManager(): IHmrManager | undefined; /** * Register a processor for a specific asset kind and source. * @param kind The asset kind. * @param variant The asset source. * @param processor The processor to register. */ registerProcessor(kind: AssetKind, variant: AssetSource, processor: any): void; /** * Processes one dependency list into normalized emitted assets. * * @remarks * Dependencies are deduplicated before processor execution so repeated * declarations across the render tree reuse the same emitted outputs and cache * entries. Returned asset order is unspecified — consumers must re-associate * outputs with inputs via dependency metadata such as `groupedBundle`, not by * array index alignment with the input list. */ processDependencies(deps: AssetDefinition[], key: string): Promise; private prepareDependenciesForProcessing; /** * Processes deduplicated dependencies grouped by processor type. * * @remarks * Grouping keeps cache and processor behavior isolated by asset kind/source * pair, while still allowing the overall dependency set to resolve in * parallel. */ private processDependenciesParallel; /** * Groups dependencies by processor bucket. */ private groupDependenciesByType; /** * Converts a dist-local file path into its public URL. */ private getSrcUrl; /** * Normalizes the public source URL for one processed asset. */ private resolveProcessedAssetSrcUrl; /** * Returns whether a value should be interpreted as a filesystem path instead * of an already-public URL. */ private isFilesystemPath; /** * Applies post-processing for emitted production assets. * * @remarks * Current optimization is intentionally conservative: only generated CSS and * JavaScript files inside the app dist directory are gzipped. */ private optimizeDependencies; /** * Returns the cached processed asset for a dependency key when available. */ private getCachedAsset; private getCachedContentScriptAsset; private resolveCachedContentScriptFilepath; /** * Stores one processed asset in the dependency cache. */ private setCachedAsset; /** * Removes a cached asset and advances the development HTML cache generation * when the removed asset can determine browser runtime URLs. */ private invalidateCachedAsset; private getFileSourceHash; /** * Clears all cached processed assets. */ clearCache(): void; /** * Removes cached assets that were produced from the given file path. */ invalidateCacheForFile(filepath: string): void; /** * Creates a service prewired with the default core processors. */ static createWithDefaultProcessors(appConfig: EcoPagesAppConfig): AssetProcessingService; /** * Returns the processor registry owned by this service. */ getRegistry(): ProcessorRegistry; }