@stencil/core 5.0.0-alpha.3 → 5.0.0-alpha.31

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 (56) hide show
  1. package/README.md +94 -0
  2. package/dist/app-data/index.d.ts +2 -0
  3. package/dist/{runtime/app-data → app-data}/index.js +17 -11
  4. package/dist/{client-CSm3x5ke.mjs → client-D1MsT-Rp.mjs} +2717 -2424
  5. package/dist/compiler/index.d.mts +170 -6
  6. package/dist/compiler/index.mjs +4 -3
  7. package/dist/compiler/utils/index.d.mts +272 -2
  8. package/dist/compiler/utils/index.mjs +4 -3
  9. package/dist/{compiler-D6iP7Bzb.mjs → compiler-Cddp97Pg.mjs} +14953 -12327
  10. package/dist/declarations/stencil-ext-modules.d.ts +5 -5
  11. package/dist/declarations/stencil-public-compiler.d.ts +728 -287
  12. package/dist/declarations/stencil-public-compiler.js +2 -3
  13. package/dist/declarations/stencil-public-docs.d.ts +19 -0
  14. package/dist/declarations/stencil-public-runtime.d.ts +131 -17
  15. package/dist/fragment-Di1hWOC8.mjs +4 -0
  16. package/dist/{index-tUR6pD3J.d.mts → index-BHj3EBl2.d.mts} +1052 -668
  17. package/dist/{index-CyrGY82h.d.ts → index-D2PAsXxx.d.ts} +215 -40
  18. package/dist/index-VK8okIiF.d.mts +108 -0
  19. package/dist/index.d.mts +4 -1
  20. package/dist/index.mjs +91 -2
  21. package/dist/jsx-runtime.d.mts +18 -0
  22. package/dist/jsx-runtime.mjs +3 -0
  23. package/dist/{node-Bg-mO5dw.mjs → node-BQR4L-TG.mjs} +76 -73
  24. package/dist/reactive-controller-BdCpSAQP.d.mts +13 -0
  25. package/dist/{regular-expression-D5pGVpCu.mjs → regular-expression-XqU5zmPp.mjs} +141 -31
  26. package/dist/{chunk-CjcI7cDX.mjs → rolldown-runtime-BhDjJH2R.mjs} +1 -1
  27. package/dist/{runtime-BBCnuprF.js → runtime/client/lazy.js} +2987 -2443
  28. package/dist/runtime/client/{index.d.ts → runtime.d.ts} +228 -83
  29. package/dist/runtime/client/{index.js → runtime.js} +2852 -2432
  30. package/dist/runtime/index.d.ts +48 -29
  31. package/dist/runtime/index.js +5069 -2
  32. package/dist/runtime/server/index.d.mts +182 -75
  33. package/dist/runtime/server/index.mjs +2769 -2283
  34. package/dist/runtime/server/runner.d.mts +47 -32
  35. package/dist/runtime/server/runner.mjs +563 -687
  36. package/dist/signals/index.d.ts +49 -0
  37. package/dist/signals/index.js +199 -0
  38. package/dist/sys/node/index.d.mts +1 -2
  39. package/dist/sys/node/index.mjs +1 -1
  40. package/dist/sys/node/worker.d.mts +1 -1
  41. package/dist/sys/node/worker.mjs +6 -3
  42. package/dist/testing/index.d.mts +98 -9
  43. package/dist/testing/index.mjs +395 -70
  44. package/dist/util-BIa-iHnt.mjs +724 -0
  45. package/dist/validation-Dd3g77T5.mjs +778 -0
  46. package/package.json +49 -36
  47. package/dist/index-CXHCTQNt.d.mts +0 -190
  48. package/dist/index-hS-KBdAP.d.ts +0 -30
  49. package/dist/jsx-runtime-DlDkTqps.d.ts +0 -28
  50. package/dist/jsx-runtime.d.ts +0 -2
  51. package/dist/jsx-runtime.js +0 -2
  52. package/dist/runtime/app-data/index.d.ts +0 -2
  53. package/dist/validation-Byxie0Uk.mjs +0 -1445
  54. /package/{LICENSE.md → LICENSE} +0 -0
  55. /package/dist/{runtime/app-globals → app-globals}/index.d.ts +0 -0
  56. /package/dist/{runtime/app-globals → app-globals}/index.js +0 -0
@@ -1,4 +1,6 @@
1
- import { Readable } from "node:stream";
1
+ import "@stencil/core/app-data";
2
+ import "rolldown";
3
+ import "typescript";
2
4
  //#region src/server/runner/create-window.d.ts
3
5
  declare function createWindowFromHtml(templateHtml: string, uniqueId: string): any;
4
6
  //#endregion
@@ -7,7 +9,7 @@ type ResolutionHandler = (elm: HTMLElement) => string | undefined | null;
7
9
  type TagTransformer = (tag: string) => string;
8
10
  //#endregion
9
11
  //#region src/declarations/stencil-public-compiler.d.ts
10
- interface HydrateDocumentOptions {
12
+ interface SsrDocumentOptions {
11
13
  /**
12
14
  * Build ID that will be added to `<html data-stencil-build="BUILD_ID">`. By default
13
15
  * a random ID will be generated
@@ -24,7 +26,7 @@ interface HydrateDocumentOptions {
24
26
  * JavaScript to read the structure of the HTML and rebuild each
25
27
  * component. Defaults to `true`.
26
28
  */
27
- clientHydrateAnnotations?: boolean;
29
+ clientSsrAnnotations?: boolean;
28
30
  /**
29
31
  * Constrain `setTimeout()` to 1ms, but still async. Also
30
32
  * only allows `setInterval()` to fire once, also constrained to 1ms.
@@ -123,10 +125,14 @@ interface HydrateDocumentOptions {
123
125
  default: 'declarative-shadow-dom' | 'scoped';
124
126
  } | boolean;
125
127
  }
126
- interface SerializeDocumentOptions extends HydrateDocumentOptions {
128
+ interface SerializeDocumentOptions extends SsrDocumentOptions {
127
129
  /**
128
130
  * Runs after the `document` has been hydrated.
129
131
  */
132
+ afterSsr?(document: any): any | Promise<any>;
133
+ /**
134
+ * @deprecated Use `afterSsr` instead.
135
+ */
130
136
  afterHydrate?(document: any): any | Promise<any>;
131
137
  /**
132
138
  * Sets an approximate line width the HTML should attempt to stay within.
@@ -139,6 +145,10 @@ interface SerializeDocumentOptions extends HydrateDocumentOptions {
139
145
  /**
140
146
  * Runs before the `document` has been hydrated.
141
147
  */
148
+ beforeSsr?(document: any): any | Promise<any>;
149
+ /**
150
+ * @deprecated Use `beforeSsr` instead.
151
+ */
142
152
  beforeHydrate?(document: any): any | Promise<any>;
143
153
  /**
144
154
  * Format the HTML in a nicely indented format.
@@ -176,7 +186,7 @@ interface SerializeDocumentOptions extends HydrateDocumentOptions {
176
186
  */
177
187
  modes?: ResolutionHandler[];
178
188
  }
179
- interface HydrateFactoryOptions extends SerializeDocumentOptions {
189
+ interface SsrFactoryOptions extends SerializeDocumentOptions {
180
190
  serializeToHtml: boolean;
181
191
  destroyWindow: boolean;
182
192
  destroyDocument: boolean;
@@ -204,7 +214,7 @@ interface PrintLine {
204
214
  errorCharStart: number;
205
215
  errorLength?: number;
206
216
  }
207
- interface HydrateResults {
217
+ interface SsrResults {
208
218
  buildId: string;
209
219
  diagnostics: Diagnostic[];
210
220
  url: string;
@@ -216,42 +226,42 @@ interface HydrateResults {
216
226
  search: string | null;
217
227
  hash: string | null;
218
228
  html: string | null;
219
- components: HydrateComponent[];
220
- anchors: HydrateAnchorElement[];
221
- imgs: HydrateImgElement[];
222
- scripts: HydrateScriptElement[];
223
- styles: HydrateStyleElement[];
224
- staticData: HydrateStaticData[];
229
+ components: SsrComponent[];
230
+ anchors: SsrAnchorElement[];
231
+ imgs: SsrImgElement[];
232
+ scripts: SsrScriptElement[];
233
+ styles: SsrStyleElement[];
234
+ staticData: SsrStaticData[];
225
235
  title: string | null;
226
236
  hydratedCount: number;
227
237
  httpStatus: number | null;
228
238
  }
229
- interface HydrateComponent {
239
+ interface SsrComponent {
230
240
  tag: string;
231
241
  mode: string;
232
242
  count: number;
233
243
  depth: number;
234
244
  }
235
- interface HydrateElement {
245
+ interface SsrElement {
236
246
  [attrName: string]: string | undefined;
237
247
  }
238
- interface HydrateAnchorElement extends HydrateElement {
248
+ interface SsrAnchorElement extends SsrElement {
239
249
  href?: string;
240
250
  target?: string;
241
251
  }
242
- interface HydrateImgElement extends HydrateElement {
252
+ interface SsrImgElement extends SsrElement {
243
253
  src?: string;
244
254
  }
245
- interface HydrateScriptElement extends HydrateElement {
255
+ interface SsrScriptElement extends SsrElement {
246
256
  src?: string;
247
257
  type?: string;
248
258
  }
249
- interface HydrateStyleElement extends HydrateElement {
259
+ interface SsrStyleElement extends SsrElement {
250
260
  id?: string;
251
261
  href?: string;
252
262
  content?: string;
253
263
  }
254
- interface HydrateStaticData {
264
+ interface SsrStaticData {
255
265
  id: string;
256
266
  type: string;
257
267
  content: string;
@@ -265,31 +275,36 @@ interface HydrateStaticData {
265
275
  * @param options - serialization options
266
276
  * @returns the hydration results
267
277
  */
268
- declare function renderToString(html: string | any, options?: SerializeDocumentOptions): Promise<HydrateResults>;
278
+ declare function renderToString(html: string | any, options?: SerializeDocumentOptions): Promise<SsrResults>;
269
279
  /**
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.
280
+ * Renders HTML and returns a web-standard ReadableStream.
281
+ * Works in Node 22+, Cloudflare Workers, Deno, Bun, and any WinterCG-compatible runtime.
273
282
  * @param html - the HTML string or document to render
274
283
  * @param options - serialization options
275
- * @returns a Node.js Readable stream
284
+ * @returns a ReadableStream
276
285
  */
277
- declare function streamToString(html: string | any, options?: SerializeDocumentOptions): Readable;
286
+ declare function streamToString(html: string | any, options?: SerializeDocumentOptions): ReadableStream<string>;
278
287
  /**
279
- * Hydrates a document or HTML string, returning the full hydration results.
288
+ * Server side renders a document or HTML string, returning the full render results.
280
289
  * This is portable (no Node.js dependencies).
281
- * @param doc - the document or HTML string to hydrate
290
+ * @param doc - the document or HTML string to render
282
291
  * @param options - hydration options
283
- * @returns the hydration results
292
+ * @returns the render results
293
+ */
294
+ declare function ssrDocument(doc: any | string, options?: SsrDocumentOptions): Promise<SsrResults>;
295
+ /**
296
+ * v4 Compat
297
+ * @alias
298
+ * @deprecated Use `ssrDocument()` instead
284
299
  */
285
- declare function hydrateDocument(doc: any | string, options?: HydrateDocumentOptions): Promise<HydrateResults>;
286
- declare function serializeDocumentToString(doc: Document, opts: HydrateFactoryOptions): string;
300
+ declare const hydrateDocument: typeof ssrDocument;
301
+ declare function serializeDocumentToString(doc: Document, opts: SsrFactoryOptions): string;
287
302
  //#endregion
288
303
  //#region src/server/runner/window-initialize.d.ts
289
304
  /**
290
305
  * Reset the docData counters. Useful for testing to ensure deterministic IDs.
291
306
  */
292
- declare function resetHydrateDocData(): void;
307
+ declare function resetSsrDocData(): void;
293
308
  //#endregion
294
309
  //#region src/runtime/tag-transform.d.ts
295
310
  /**
@@ -304,4 +319,4 @@ declare function transformTag<T extends string>(tag: T): T;
304
319
  */
305
320
  declare function setTagTransformer(transformer: TagTransformer): void;
306
321
  //#endregion
307
- export { createWindowFromHtml, hydrateDocument, renderToString, resetHydrateDocData, serializeDocumentToString, setTagTransformer, streamToString, transformTag };
322
+ export { createWindowFromHtml, hydrateDocument, renderToString, resetSsrDocData, serializeDocumentToString, setTagTransformer, ssrDocument, streamToString, transformTag };