1 | // Generated by dts-bundle-generator v5.3.0
|
2 |
|
3 | export declare function createWindowFromHtml(templateHtml: string, uniqueId: string): any;
|
4 | export interface HydrateDocumentOptions {
|
5 | /**
|
6 | * Sets the `href` attribute on the `<link rel="canonical">`
|
7 | * tag within the `<head>`. If the value is not defined it will
|
8 | * ensure a canonical link tag is no included in the `<head>`.
|
9 | */
|
10 | canonicalUrl?: string;
|
11 | /**
|
12 | * Constrain `setTimeout()` to 1ms, but still async. Also
|
13 | * only allows `setInterval()` to fire once, also constrained to 1ms.
|
14 | * Defaults to `true`.
|
15 | */
|
16 | constrainTimeouts?: boolean;
|
17 | /**
|
18 | * Include the HTML comments and attributes used by the clientside
|
19 | * JavaScript to read the structure of the HTML and rebuild each
|
20 | * component. Defaults to `true`.
|
21 | */
|
22 | clientHydrateAnnotations?: boolean;
|
23 | /**
|
24 | * Sets `document.cookie`
|
25 | */
|
26 | cookie?: string;
|
27 | /**
|
28 | * Sets the `dir` attribute on the top level `<html>`.
|
29 | */
|
30 | direction?: string;
|
31 | /**
|
32 | * Component tag names listed here will not be prerendered, nor will
|
33 | * hydrated on the clientside. Components listed here will be ignored
|
34 | * as custom elements and treated no differently than a `<div>`.
|
35 | */
|
36 | excludeComponents?: string[];
|
37 | /**
|
38 | * Sets the `lang` attribute on the top level `<html>`.
|
39 | */
|
40 | language?: string;
|
41 | /**
|
42 | * Maximum number of components to hydrate on one page. Defaults to `300`.
|
43 | */
|
44 | maxHydrateCount?: number;
|
45 | /**
|
46 | * Sets `document.referrer`
|
47 | */
|
48 | referrer?: string;
|
49 | /**
|
50 | * Removes every `<script>` element found in the `document`. Defaults to `false`.
|
51 | */
|
52 | removeScripts?: boolean;
|
53 | /**
|
54 | * Removes CSS not used by elements within the `document`. Defaults to `true`.
|
55 | */
|
56 | removeUnusedStyles?: boolean;
|
57 | /**
|
58 | * The url the runtime uses for the resources, such as the assets directory.
|
59 | */
|
60 | resourcesUrl?: string;
|
61 | /**
|
62 | * Prints out runtime console logs to the NodeJS process. Defaults to `false`.
|
63 | */
|
64 | runtimeLogging?: boolean;
|
65 | /**
|
66 | * Component tags listed here will only be prerendered or serverside-rendered
|
67 | * and will not be clientside hydrated. This is useful for components that
|
68 | * are not dynamic and do not need to be defined as a custom element within the
|
69 | * browser. For example, a header or footer component would be a good example that
|
70 | * may not require any clientside JavaScript.
|
71 | */
|
72 | staticComponents?: string[];
|
73 | /**
|
74 | * The amount of milliseconds to wait for a page to finish rendering until
|
75 | * a timeout error is thrown. Defaults to `15000`.
|
76 | */
|
77 | timeout?: number;
|
78 | /**
|
79 | * Sets `document.title`.
|
80 | */
|
81 | title?: string;
|
82 | /**
|
83 | * Sets `location.href`
|
84 | */
|
85 | url?: string;
|
86 | /**
|
87 | * Sets `navigator.userAgent`
|
88 | */
|
89 | userAgent?: string;
|
90 | }
|
91 | export interface SerializeDocumentOptions extends HydrateDocumentOptions {
|
92 | /**
|
93 | * Runs after the `document` has been hydrated.
|
94 | */
|
95 | afterHydrate?(document: any): any | Promise<any>;
|
96 | /**
|
97 | * Sets an approximate line width the HTML should attempt to stay within.
|
98 | * Note that this is "approximate", in that HTML may often not be able
|
99 | * to be split at an exact line width. Additionally, new lines created
|
100 | * is where HTML naturally already has whitespce, such as before an
|
101 | * attribute or spaces between words. Defaults to `100`.
|
102 | */
|
103 | approximateLineWidth?: number;
|
104 | /**
|
105 | * Runs before the `document` has been hydrated.
|
106 | */
|
107 | beforeHydrate?(document: any): any | Promise<any>;
|
108 | /**
|
109 | * Format the HTML in a nicely indented format.
|
110 | * Defaults to `false`.
|
111 | */
|
112 | prettyHtml?: boolean;
|
113 | /**
|
114 | * Remove quotes from attribute values when possible.
|
115 | * Defaults to `true`.
|
116 | */
|
117 | removeAttributeQuotes?: boolean;
|
118 | /**
|
119 | * Remove the `=""` from standardized `boolean` attributes,
|
120 | * such as `hidden` or `checked`. Defaults to `true`.
|
121 | */
|
122 | removeBooleanAttributeQuotes?: boolean;
|
123 | /**
|
124 | * Remove these standardized attributes when their value is empty:
|
125 | * `class`, `dir`, `id`, `lang`, and `name`, `title`. Defaults to `true`.
|
126 | */
|
127 | removeEmptyAttributes?: boolean;
|
128 | /**
|
129 | * Remove HTML comments. Defaults to `true`.
|
130 | */
|
131 | removeHtmlComments?: boolean;
|
132 | }
|
133 | export interface HydrateFactoryOptions extends SerializeDocumentOptions {
|
134 | serializeToHtml: boolean;
|
135 | destroyWindow: boolean;
|
136 | destroyDocument: boolean;
|
137 | }
|
138 | export interface Diagnostic {
|
139 | level: "error" | "warn" | "info" | "log" | "debug";
|
140 | type: string;
|
141 | header?: string;
|
142 | language?: string;
|
143 | messageText: string;
|
144 | debugText?: string;
|
145 | code?: string;
|
146 | absFilePath?: string;
|
147 | relFilePath?: string;
|
148 | lineNumber?: number;
|
149 | columnNumber?: number;
|
150 | lines?: {
|
151 | lineIndex: number;
|
152 | lineNumber: number;
|
153 | text?: string;
|
154 | errorCharStart: number;
|
155 | errorLength?: number;
|
156 | }[];
|
157 | }
|
158 | export interface HydrateResults {
|
159 | diagnostics: Diagnostic[];
|
160 | url: string;
|
161 | host: string;
|
162 | hostname: string;
|
163 | href: string;
|
164 | port: string;
|
165 | pathname: string;
|
166 | search: string;
|
167 | hash: string;
|
168 | html: string;
|
169 | components: HydrateComponent[];
|
170 | anchors: HydrateAnchorElement[];
|
171 | styles: HydrateStyleElement[];
|
172 | scripts: HydrateScriptElement[];
|
173 | imgs: HydrateImgElement[];
|
174 | title: string;
|
175 | hydratedCount: number;
|
176 | httpStatus: number;
|
177 | }
|
178 | export interface HydrateComponent {
|
179 | tag: string;
|
180 | mode: string;
|
181 | count: number;
|
182 | depth: number;
|
183 | }
|
184 | export interface HydrateElement {
|
185 | [attrName: string]: string | undefined;
|
186 | }
|
187 | export interface HydrateAnchorElement extends HydrateElement {
|
188 | href?: string;
|
189 | target?: string;
|
190 | }
|
191 | export interface HydrateStyleElement extends HydrateElement {
|
192 | href?: string;
|
193 | }
|
194 | export interface HydrateScriptElement extends HydrateElement {
|
195 | src?: string;
|
196 | type?: string;
|
197 | }
|
198 | export interface HydrateImgElement extends HydrateElement {
|
199 | src?: string;
|
200 | }
|
201 | export declare function renderToString(html: string | any, options?: SerializeDocumentOptions): Promise<HydrateResults>;
|
202 | export declare function hydrateDocument(doc: any | string, options?: HydrateDocumentOptions): Promise<HydrateResults>;
|
203 | export declare function serializeDocumentToString(doc: any, opts: HydrateFactoryOptions): string;
|
204 |
|
205 | export {};
|