@ice/stark-html
Version:
icestark-html is a JavaScript library for icestark, used for processing html.
25 lines (24 loc) • 1.05 kB
TypeScript
export declare enum AssetTypeEnum {
INLINE = "inline",
EXTERNAL = "external"
}
export interface Asset {
type: AssetTypeEnum;
content: string;
}
export interface ProcessedContent {
html: string;
assets: Asset[];
}
export interface ParsedConfig {
origin: string;
pathname: string;
}
export declare function parseUrl(htmlUrl: string): ParsedConfig;
export declare function startWith(url: string, prefix: string): boolean;
export declare function getUrl(htmlUrl: string, relativePath: string): string;
export declare function getReplacementComments(tag: string, from: string): string;
export declare function getProcessedComments(tag: string, from: string): string;
export declare function processHtml(html: string, htmlUrl?: string): ProcessedContent;
export default function loadHtml(root: HTMLElement | ShadowRoot, htmlUrl: string, fetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>): Promise<string>;
export declare function appendScript(root: HTMLElement | ShadowRoot, asset: Asset): Promise<unknown>;