@stencil/core 5.0.0-alpha.4 → 5.0.0-alpha.6

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 (44) hide show
  1. package/dist/{client-Dti6fFpE.mjs → client-fWOou5EW.mjs} +2360 -2090
  2. package/dist/compiler/index.d.mts +5 -5
  3. package/dist/compiler/index.mjs +2 -2
  4. package/dist/compiler/utils/index.d.mts +2 -2
  5. package/dist/compiler/utils/index.mjs +3 -3
  6. package/dist/{compiler-BYRrEeD-.mjs → compiler-CdUbDTbV.mjs} +13426 -12276
  7. package/dist/declarations/stencil-public-compiler.d.ts +527 -238
  8. package/dist/declarations/stencil-public-compiler.js +2 -3
  9. package/dist/declarations/stencil-public-docs.d.ts +10 -0
  10. package/dist/declarations/stencil-public-runtime.d.ts +51 -12
  11. package/dist/{index-BwTaN1Nq.d.mts → index-D8vvsppY.d.mts} +566 -350
  12. package/dist/{index-CyrGY82h.d.ts → index-Dap2E02-.d.ts} +83 -32
  13. package/dist/{index-9LTuoSiw.d.mts → index-UUlemGuu.d.mts} +13 -2
  14. package/dist/index.d.mts +0 -1
  15. package/dist/index.mjs +1 -1
  16. package/dist/jsx-runtime.d.mts +18 -0
  17. package/dist/jsx-runtime.mjs +2 -0
  18. package/dist/{node-BF2jSfWg.mjs → node-klLZLdDe.mjs} +20 -19
  19. package/dist/{regular-expression-D5pGVpCu.mjs → regular-expression-DUdhF3Ei.mjs} +113 -29
  20. package/dist/runtime/app-data/index.d.ts +1 -1
  21. package/dist/runtime/app-data/index.js +15 -9
  22. package/dist/{runtime-COEYYPyw.js → runtime/client/lazy.js} +2596 -2182
  23. package/dist/runtime/client/{index.d.ts → runtime.d.ts} +89 -47
  24. package/dist/runtime/client/{index.js → runtime.js} +2473 -2183
  25. package/dist/runtime/index.d.ts +46 -5
  26. package/dist/runtime/index.js +4956 -2
  27. package/dist/runtime/server/index.d.mts +85 -63
  28. package/dist/runtime/server/index.mjs +2462 -2193
  29. package/dist/runtime/server/runner.d.mts +44 -32
  30. package/dist/runtime/server/runner.mjs +335 -383
  31. package/dist/signals/index.d.ts +47 -0
  32. package/dist/signals/index.js +199 -0
  33. package/dist/sys/node/index.d.mts +1 -1
  34. package/dist/sys/node/index.mjs +1 -1
  35. package/dist/sys/node/worker.mjs +2 -2
  36. package/dist/testing/index.d.mts +97 -3
  37. package/dist/testing/index.mjs +197 -45
  38. package/dist/{validation-Byxie0Uk.mjs → validation-2QipI30K.mjs} +90 -77
  39. package/package.json +41 -28
  40. package/dist/index-hS-KBdAP.d.ts +0 -30
  41. package/dist/jsx-runtime-DlDkTqps.d.ts +0 -28
  42. package/dist/jsx-runtime.d.ts +0 -2
  43. package/dist/jsx-runtime.js +0 -2
  44. /package/dist/{chunk-CjcI7cDX.mjs → chunk-z9aeyW2b.mjs} +0 -0
@@ -1,4 +1,3 @@
1
- import { Readable } from "node:stream";
2
1
  //#region src/server/runner/create-window.d.ts
3
2
  declare function createWindowFromHtml(templateHtml: string, uniqueId: string): any;
4
3
  //#endregion
@@ -7,7 +6,7 @@ type ResolutionHandler = (elm: HTMLElement) => string | undefined | null;
7
6
  type TagTransformer = (tag: string) => string;
8
7
  //#endregion
9
8
  //#region src/declarations/stencil-public-compiler.d.ts
10
- interface HydrateDocumentOptions {
9
+ interface SsrDocumentOptions {
11
10
  /**
12
11
  * Build ID that will be added to `<html data-stencil-build="BUILD_ID">`. By default
13
12
  * a random ID will be generated
@@ -24,7 +23,7 @@ interface HydrateDocumentOptions {
24
23
  * JavaScript to read the structure of the HTML and rebuild each
25
24
  * component. Defaults to `true`.
26
25
  */
27
- clientHydrateAnnotations?: boolean;
26
+ clientSsrAnnotations?: boolean;
28
27
  /**
29
28
  * Constrain `setTimeout()` to 1ms, but still async. Also
30
29
  * only allows `setInterval()` to fire once, also constrained to 1ms.
@@ -123,10 +122,14 @@ interface HydrateDocumentOptions {
123
122
  default: 'declarative-shadow-dom' | 'scoped';
124
123
  } | boolean;
125
124
  }
126
- interface SerializeDocumentOptions extends HydrateDocumentOptions {
125
+ interface SerializeDocumentOptions extends SsrDocumentOptions {
127
126
  /**
128
127
  * Runs after the `document` has been hydrated.
129
128
  */
129
+ afterSsr?(document: any): any | Promise<any>;
130
+ /**
131
+ * @deprecated Use `afterSsr` instead.
132
+ */
130
133
  afterHydrate?(document: any): any | Promise<any>;
131
134
  /**
132
135
  * Sets an approximate line width the HTML should attempt to stay within.
@@ -139,6 +142,10 @@ interface SerializeDocumentOptions extends HydrateDocumentOptions {
139
142
  /**
140
143
  * Runs before the `document` has been hydrated.
141
144
  */
145
+ beforeSsr?(document: any): any | Promise<any>;
146
+ /**
147
+ * @deprecated Use `beforeSsr` instead.
148
+ */
142
149
  beforeHydrate?(document: any): any | Promise<any>;
143
150
  /**
144
151
  * Format the HTML in a nicely indented format.
@@ -176,7 +183,7 @@ interface SerializeDocumentOptions extends HydrateDocumentOptions {
176
183
  */
177
184
  modes?: ResolutionHandler[];
178
185
  }
179
- interface HydrateFactoryOptions extends SerializeDocumentOptions {
186
+ interface SsrFactoryOptions extends SerializeDocumentOptions {
180
187
  serializeToHtml: boolean;
181
188
  destroyWindow: boolean;
182
189
  destroyDocument: boolean;
@@ -204,7 +211,7 @@ interface PrintLine {
204
211
  errorCharStart: number;
205
212
  errorLength?: number;
206
213
  }
207
- interface HydrateResults {
214
+ interface SsrResults {
208
215
  buildId: string;
209
216
  diagnostics: Diagnostic[];
210
217
  url: string;
@@ -216,42 +223,42 @@ interface HydrateResults {
216
223
  search: string | null;
217
224
  hash: string | null;
218
225
  html: string | null;
219
- components: HydrateComponent[];
220
- anchors: HydrateAnchorElement[];
221
- imgs: HydrateImgElement[];
222
- scripts: HydrateScriptElement[];
223
- styles: HydrateStyleElement[];
224
- staticData: HydrateStaticData[];
226
+ components: SsrComponent[];
227
+ anchors: SsrAnchorElement[];
228
+ imgs: SsrImgElement[];
229
+ scripts: SsrScriptElement[];
230
+ styles: SsrStyleElement[];
231
+ staticData: SsrStaticData[];
225
232
  title: string | null;
226
233
  hydratedCount: number;
227
234
  httpStatus: number | null;
228
235
  }
229
- interface HydrateComponent {
236
+ interface SsrComponent {
230
237
  tag: string;
231
238
  mode: string;
232
239
  count: number;
233
240
  depth: number;
234
241
  }
235
- interface HydrateElement {
242
+ interface SsrElement {
236
243
  [attrName: string]: string | undefined;
237
244
  }
238
- interface HydrateAnchorElement extends HydrateElement {
245
+ interface SsrAnchorElement extends SsrElement {
239
246
  href?: string;
240
247
  target?: string;
241
248
  }
242
- interface HydrateImgElement extends HydrateElement {
249
+ interface SsrImgElement extends SsrElement {
243
250
  src?: string;
244
251
  }
245
- interface HydrateScriptElement extends HydrateElement {
252
+ interface SsrScriptElement extends SsrElement {
246
253
  src?: string;
247
254
  type?: string;
248
255
  }
249
- interface HydrateStyleElement extends HydrateElement {
256
+ interface SsrStyleElement extends SsrElement {
250
257
  id?: string;
251
258
  href?: string;
252
259
  content?: string;
253
260
  }
254
- interface HydrateStaticData {
261
+ interface SsrStaticData {
255
262
  id: string;
256
263
  type: string;
257
264
  content: string;
@@ -265,31 +272,36 @@ interface HydrateStaticData {
265
272
  * @param options - serialization options
266
273
  * @returns the hydration results
267
274
  */
268
- declare function renderToString(html: string | any, options?: SerializeDocumentOptions): Promise<HydrateResults>;
275
+ declare function renderToString(html: string | any, options?: SerializeDocumentOptions): Promise<SsrResults>;
269
276
  /**
270
- * Renders HTML and returns a Node.js Readable stream.
271
- * This is a Node.js-specific convenience wrapper around renderToString.
272
- * Note: This function requires Node.js and cannot be used in QuickJS/WASM environments.
277
+ * Renders HTML and returns a web-standard ReadableStream.
278
+ * Works in Node 22+, Cloudflare Workers, Deno, Bun, and any WinterCG-compatible runtime.
273
279
  * @param html - the HTML string or document to render
274
280
  * @param options - serialization options
275
- * @returns a Node.js Readable stream
281
+ * @returns a ReadableStream
276
282
  */
277
- declare function streamToString(html: string | any, options?: SerializeDocumentOptions): Readable;
283
+ declare function streamToString(html: string | any, options?: SerializeDocumentOptions): ReadableStream<string>;
278
284
  /**
279
- * Hydrates a document or HTML string, returning the full hydration results.
285
+ * Server side renders a document or HTML string, returning the full render results.
280
286
  * This is portable (no Node.js dependencies).
281
- * @param doc - the document or HTML string to hydrate
287
+ * @param doc - the document or HTML string to render
282
288
  * @param options - hydration options
283
- * @returns the hydration results
289
+ * @returns the render results
290
+ */
291
+ declare function ssrDocument(doc: any | string, options?: SsrDocumentOptions): Promise<SsrResults>;
292
+ /**
293
+ * v4 Compat
294
+ * @alias
295
+ * @deprecated Use `ssrDocument()` instead
284
296
  */
285
- declare function hydrateDocument(doc: any | string, options?: HydrateDocumentOptions): Promise<HydrateResults>;
286
- declare function serializeDocumentToString(doc: Document, opts: HydrateFactoryOptions): string;
297
+ declare const hydrateDocument: typeof ssrDocument;
298
+ declare function serializeDocumentToString(doc: Document, opts: SsrFactoryOptions): string;
287
299
  //#endregion
288
300
  //#region src/server/runner/window-initialize.d.ts
289
301
  /**
290
302
  * Reset the docData counters. Useful for testing to ensure deterministic IDs.
291
303
  */
292
- declare function resetHydrateDocData(): void;
304
+ declare function resetSsrDocData(): void;
293
305
  //#endregion
294
306
  //#region src/runtime/tag-transform.d.ts
295
307
  /**
@@ -304,4 +316,4 @@ declare function transformTag<T extends string>(tag: T): T;
304
316
  */
305
317
  declare function setTagTransformer(transformer: TagTransformer): void;
306
318
  //#endregion
307
- export { createWindowFromHtml, hydrateDocument, renderToString, resetHydrateDocData, serializeDocumentToString, setTagTransformer, streamToString, transformTag };
319
+ export { createWindowFromHtml, hydrateDocument, renderToString, resetSsrDocData, serializeDocumentToString, setTagTransformer, ssrDocument, streamToString, transformTag };