plugin-html/src/html-module.ts

35 lines
1.0 KiB
TypeScript

// The HTML-Module is an internal helper structure to track the processing of an HTML file
// This is intended to be serialized into chunk-meta, so it can be cached. (thus keep any functions and circular references out of it)
// TODO: Actually making this serialiable (check rollupResolved, node, as we might no longer need them)
import type {
ModuleInfo,
ResolvedId,
} from 'rollup';
import type {
LoadedReference
} from "../types/load.d.ts";
import {DefaultTreeAdapterMap} from "parse5";
// Internal type
export type HtmlImport = LoadedReference & {
id: string;
resolved: ResolvedId|null;
// loaded: ModuleInfo|null;
node: DefaultTreeAdapterMap['element'];
referenceId: string|null;
placeholder: string,
index: number;
}
export type HtmlModule = {
// TODO might want to impose an own unique id, in case this changes after multiple builds
id: string;
name: string;
importers: Set<string|undefined>,
imports: HtmlImport[];
assetId?: string|null;
document?: DefaultTreeAdapterMap['document'];
}