@rededor/cura-hydrate 0.5.4 → 1.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/index.d.ts +36 -18
  2. package/index.js +26903 -11240
  3. package/index.mjs +28151 -0
  4. package/package.json +7 -1
package/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
- // Generated by dts-bundle-generator v7.2.0
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ import { Readable } from 'node:stream';
2
4
 
3
5
  export declare function createWindowFromHtml(templateHtml: string, uniqueId: string): any;
4
6
  export interface HydrateDocumentOptions {
@@ -14,7 +16,7 @@ export interface HydrateDocumentOptions {
14
16
  */
15
17
  canonicalUrl?: string;
16
18
  /**
17
- * Include the HTML comments and attributes used by the clientside
19
+ * Include the HTML comments and attributes used by the client-side
18
20
  * JavaScript to read the structure of the HTML and rebuild each
19
21
  * component. Defaults to `true`.
20
22
  */
@@ -35,7 +37,7 @@ export interface HydrateDocumentOptions {
35
37
  direction?: string;
36
38
  /**
37
39
  * Component tag names listed here will not be prerendered, nor will
38
- * hydrated on the clientside. Components listed here will be ignored
40
+ * hydrated on the client-side. Components listed here will be ignored
39
41
  * as custom elements and treated no differently than a `<div>`.
40
42
  */
41
43
  excludeComponents?: string[];
@@ -68,11 +70,11 @@ export interface HydrateDocumentOptions {
68
70
  */
69
71
  runtimeLogging?: boolean;
70
72
  /**
71
- * Component tags listed here will only be prerendered or serverside-rendered
72
- * and will not be clientside hydrated. This is useful for components that
73
+ * Component tags listed here will only be prerendered or server-side-rendered
74
+ * and will not be client-side hydrated. This is useful for components that
73
75
  * are not dynamic and do not need to be defined as a custom element within the
74
76
  * browser. For example, a header or footer component would be a good example that
75
- * may not require any clientside JavaScript.
77
+ * may not require any client-side JavaScript.
76
78
  */
77
79
  staticComponents?: string[];
78
80
  /**
@@ -134,6 +136,19 @@ export interface SerializeDocumentOptions extends HydrateDocumentOptions {
134
136
  * Remove HTML comments. Defaults to `true`.
135
137
  */
136
138
  removeHtmlComments?: boolean;
139
+ /**
140
+ * If set to `false` Stencil will ignore the fact that a component has a `shadow: true`
141
+ * flag and serializes it as a scoped component. If set to `true` the component will
142
+ * be rendered within a Declarative Shadow DOM.
143
+ * @default false
144
+ */
145
+ serializeShadowRoot?: boolean;
146
+ /**
147
+ * The `fullDocument` flag determines the format of the rendered output. Set it to true to
148
+ * generate a complete HTML document, or false to render only the component.
149
+ * @default true
150
+ */
151
+ fullDocument?: boolean;
137
152
  }
138
153
  export interface HydrateFactoryOptions extends SerializeDocumentOptions {
139
154
  serializeToHtml: boolean;
@@ -157,7 +172,7 @@ export interface Diagnostic {
157
172
  export interface PrintLine {
158
173
  lineIndex: number;
159
174
  lineNumber: number;
160
- text?: string;
175
+ text: string;
161
176
  errorCharStart: number;
162
177
  errorLength?: number;
163
178
  }
@@ -165,23 +180,23 @@ export interface HydrateResults {
165
180
  buildId: string;
166
181
  diagnostics: Diagnostic[];
167
182
  url: string;
168
- host: string;
169
- hostname: string;
170
- href: string;
171
- port: string;
172
- pathname: string;
173
- search: string;
174
- hash: string;
175
- html: string;
183
+ host: string | null;
184
+ hostname: string | null;
185
+ href: string | null;
186
+ port: string | null;
187
+ pathname: string | null;
188
+ search: string | null;
189
+ hash: string | null;
190
+ html: string | null;
176
191
  components: HydrateComponent[];
177
192
  anchors: HydrateAnchorElement[];
178
193
  imgs: HydrateImgElement[];
179
194
  scripts: HydrateScriptElement[];
180
195
  styles: HydrateStyleElement[];
181
196
  staticData: HydrateStaticData[];
182
- title: string;
197
+ title: string | null;
183
198
  hydratedCount: number;
184
- httpStatus: number;
199
+ httpStatus: number | null;
185
200
  }
186
201
  export interface HydrateComponent {
187
202
  tag: string;
@@ -211,8 +226,11 @@ export interface HydrateStaticData {
211
226
  type: string;
212
227
  content: string;
213
228
  }
229
+ export declare function streamToString(html: string | any, option?: SerializeDocumentOptions): Readable;
214
230
  export declare function renderToString(html: string | any, options?: SerializeDocumentOptions): Promise<HydrateResults>;
231
+ export declare function renderToString(html: string | any, options: SerializeDocumentOptions | undefined, asStream: true): Readable;
215
232
  export declare function hydrateDocument(doc: any | string, options?: HydrateDocumentOptions): Promise<HydrateResults>;
216
- export declare function serializeDocumentToString(doc: any, opts: HydrateFactoryOptions): string;
233
+ export declare function hydrateDocument(doc: any | string, options: HydrateDocumentOptions | undefined, asStream?: boolean): Readable;
234
+ export declare function serializeDocumentToString(doc: Document, opts: HydrateFactoryOptions): string;
217
235
 
218
236
  export {};