@qwik.dev/core 2.0.0-alpha.9 → 2.0.0-beta.2

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 (87) hide show
  1. package/bindings/qwik.darwin-arm64.node +0 -0
  2. package/bindings/qwik.darwin-x64.node +0 -0
  3. package/bindings/qwik.linux-x64-gnu.node +0 -0
  4. package/bindings/qwik.wasm.cjs +27 -27
  5. package/bindings/qwik.wasm.mjs +27 -27
  6. package/bindings/qwik.win32-x64-msvc.node +0 -0
  7. package/bindings/qwik_wasm_bg.wasm +0 -0
  8. package/dist/build/index.cjs +3 -3
  9. package/dist/build/index.d.ts +22 -22
  10. package/dist/build/package.json +1 -1
  11. package/dist/cli.cjs +6 -6
  12. package/dist/core-internal.d.ts +4447 -4153
  13. package/dist/core.cjs +5698 -5353
  14. package/dist/core.cjs.map +1 -1
  15. package/dist/core.min.mjs +1 -1
  16. package/dist/core.mjs +5691 -5350
  17. package/dist/core.mjs.map +1 -1
  18. package/dist/core.prod.cjs +2811 -2633
  19. package/dist/core.prod.mjs +3193 -3039
  20. package/dist/insights/index.qwik.cjs +1 -4142
  21. package/dist/insights/index.qwik.mjs +63 -4133
  22. package/dist/insights/vite/index.cjs +1 -82
  23. package/dist/insights/vite/index.mjs +65 -37
  24. package/dist/insights/vite.d.ts +22 -0
  25. package/dist/{insights/insights.d.ts → insights.d.ts} +33 -22
  26. package/dist/loader/index.cjs +2 -2
  27. package/dist/loader/index.mjs +2 -2
  28. package/dist/loader/package.json +1 -1
  29. package/dist/optimizer.cjs +554 -355
  30. package/dist/optimizer.d.ts +779 -707
  31. package/dist/optimizer.mjs +552 -399
  32. package/dist/preloader.cjs +269 -0
  33. package/dist/preloader.mjs +198 -0
  34. package/dist/qwikloader.debug.js +242 -222
  35. package/dist/qwikloader.js +1 -3
  36. package/dist/server.cjs +678 -566
  37. package/dist/server.d.ts +504 -402
  38. package/dist/server.mjs +659 -551
  39. package/dist/starters/adapters/aws-lambda/serverless.yml +15 -0
  40. package/dist/starters/adapters/aws-lambda/src/entry_aws-lambda.tsx +0 -2
  41. package/dist/starters/adapters/azure-swa/public/staticwebapp.config.json +7 -0
  42. package/dist/starters/adapters/azure-swa/src/entry.azure-swa.tsx +1 -2
  43. package/dist/starters/adapters/bun/src/entry.bun.ts +3 -2
  44. package/dist/starters/adapters/cloud-run/src/entry.cloud-run.tsx +1 -3
  45. package/dist/starters/adapters/cloudflare-pages/public/_headers +2 -0
  46. package/dist/starters/adapters/cloudflare-pages/src/entry.cloudflare-pages.tsx +1 -2
  47. package/dist/starters/adapters/deno/src/entry.deno.ts +3 -2
  48. package/dist/starters/adapters/express/src/entry.express.tsx +5 -2
  49. package/dist/starters/adapters/fastify/src/entry.fastify.tsx +2 -1
  50. package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +9 -1
  51. package/dist/starters/adapters/firebase/firebase.json +12 -1
  52. package/dist/starters/adapters/firebase/functions/index.js +2 -3
  53. package/dist/starters/adapters/firebase/src/entry-firebase.tsx +1 -2
  54. package/dist/starters/adapters/netlify-edge/public/_headers +2 -0
  55. package/dist/starters/adapters/netlify-edge/src/entry.netlify-edge.tsx +1 -2
  56. package/dist/starters/adapters/node-server/src/entry.node-server.tsx +3 -2
  57. package/dist/starters/adapters/static/README.md +4 -0
  58. package/dist/starters/adapters/vercel-edge/src/entry.vercel-edge.tsx +1 -2
  59. package/dist/starters/adapters/vercel-edge/vercel.json +1 -1
  60. package/dist/starters/features/bootstrap/src/routes/bootstrap/layout.tsx +0 -11
  61. package/dist/starters/features/localize/src/entry.ssr.tsx +0 -2
  62. package/dist/starters/features/localize/src/routes/[locale]/i18n-utils.ts +1 -1
  63. package/dist/starters/features/partytown/package.json +4 -4
  64. package/dist/starters/features/partytown/src/components/partytown/partytown.tsx +2 -2
  65. package/dist/starters/features/postcss/postcss.config.js +1 -1
  66. package/dist/starters/features/service-worker/package.json +13 -0
  67. package/dist/starters/features/service-worker/src/routes/service-worker.ts +14 -0
  68. package/dist/starters/features/styled-vanilla-extract/package.json +2 -1
  69. package/dist/starters/features/tailwind/package.json +2 -1
  70. package/dist/starters/features/tailwind/src/global.css +1 -1
  71. package/dist/starters/features/tailwind-v3/tailwind.config.js +2 -2
  72. package/dist/testing/index.cjs +7988 -7723
  73. package/dist/testing/index.d.ts +141 -141
  74. package/dist/testing/index.mjs +8069 -7810
  75. package/dist/testing/package.json +1 -1
  76. package/package.json +19 -11
  77. package/public.d.ts +4 -0
  78. package/server.d.ts +1 -0
  79. package/dist/insights/index.d.ts +0 -1
  80. package/dist/insights/vite/index.d.ts +0 -1
  81. package/dist/insights/vite/insights-plugin.d.ts +0 -10
  82. package/dist/prefetch/index.cjs +0 -4
  83. package/dist/prefetch/index.d.ts +0 -2
  84. package/dist/prefetch/index.mjs +0 -3
  85. package/dist/prefetch/package.json +0 -8
  86. package/dist/qwik-prefetch.debug.js +0 -244
  87. package/dist/qwik-prefetch.js +0 -1
package/dist/server.d.ts CHANGED
@@ -1,404 +1,506 @@
1
1
  /// <reference path="./server-modules.d.ts" />
2
2
 
3
- import type { QwikManifest } from './optimizer';
4
- import type { ResolvedManifest } from './optimizer';
5
- import type { SnapshotResult } from '.';
6
- import type { StreamWriter } from '.';
7
- import type { SymbolMapperFn } from './optimizer';
8
-
9
- /** @public */
10
- declare interface DevJSX {
11
- fileName: string;
12
- lineNumber: number;
13
- columnNumber: number;
14
- stack?: string;
15
- }
16
-
17
- /**
18
- * Any function taking a props object that returns JSXOutput.
19
- *
20
- * The `key`, `flags` and `dev` parameters are for internal use.
21
- *
22
- * @public
23
- */
24
- declare type FunctionComponent<P = unknown> = {
25
- renderFn(props: P, key: string | null, flags: number, dev?: DevJSX): JSXOutput;
26
- }['renderFn'];
27
-
28
- /**
29
- * Provides the `qwikloader.js` file as a string. Useful for tooling to inline the qwikloader script
30
- * into HTML.
31
- *
32
- * @public
33
- */
34
- export declare function getQwikLoaderScript(opts?: {
35
- debug?: boolean;
36
- }): string;
37
-
38
- /**
39
- * Provides the `qwik-prefetch-service-worker.js` file as a string. Useful for tooling to inline the
40
- * qwik-prefetch-service-worker script into HTML.
41
- *
42
- * @public
43
- */
44
- export declare function getQwikPrefetchWorkerScript(opts?: {
45
- debug?: boolean;
46
- }): string;
47
-
48
- /** @public */
49
- declare interface GlobalInjections {
50
- tag: string;
51
- attributes?: {
52
- [key: string]: string;
53
- };
54
- location: 'head' | 'body';
55
- }
56
-
57
- /** @public */
58
- export declare interface InOrderAuto {
59
- strategy: 'auto';
60
- maximumInitialChunk?: number;
61
- maximumChunk?: number;
62
- }
63
-
64
- /** @public */
65
- declare interface InOrderDirect {
66
- strategy: 'direct';
67
- }
68
-
69
- /** @public */
70
- export declare interface InOrderDisabled {
71
- strategy: 'disabled';
72
- }
73
-
74
- /** @public */
75
- export declare type InOrderStreaming = InOrderAuto | InOrderDisabled | InOrderDirect;
76
-
77
- /** @public */
78
- declare type JSXChildren = string | number | boolean | null | undefined | Function | RegExp | JSXChildren[] | Promise<JSXChildren> | Signal<JSXChildren> | JSXNode;
79
-
80
- /**
81
- * A JSX Node, an internal structure. You probably want to use `JSXOutput` instead.
82
- *
83
- * @public
84
- */
85
- declare interface JSXNode<T extends string | FunctionComponent | unknown = unknown> {
86
- type: T;
87
- props: T extends FunctionComponent<infer P> ? P : Record<any, unknown>;
88
- children: JSXChildren | null;
89
- key: string | null;
90
- dev?: DevJSX;
91
- }
92
-
93
- /**
94
- * Any valid output for a component
95
- *
96
- * @public
97
- */
98
- declare type JSXOutput = JSXNode | string | number | boolean | null | undefined | JSXOutput[];
99
-
100
- /** @public */
101
- export declare interface PrefetchImplementation {
102
- /**
103
- * `js-append`: Use JS runtime to create each `<link>` and append to the body.
104
- *
105
- * `html-append`: Render each `<link>` within html, appended at the end of the body.
106
- */
107
- linkInsert?: 'js-append' | 'html-append' | null;
108
- /**
109
- * Value of the `<link rel="...">` attribute when link is used. Defaults to `prefetch` if links
110
- * are inserted.
111
- */
112
- linkRel?: 'prefetch' | 'preload' | 'modulepreload' | null;
113
- /**
114
- * Value of the `<link fetchpriority="...">` attribute when link is used. Defaults to `null` if
115
- * links are inserted.
116
- */
117
- linkFetchPriority?: 'auto' | 'low' | 'high' | null;
118
- /**
119
- * `always`: Always include the worker fetch JS runtime.
120
- *
121
- * `no-link-support`: Only include the worker fetch JS runtime when the browser doesn't support
122
- * `<link>` prefetch/preload/modulepreload.
123
- */
124
- workerFetchInsert?: 'always' | 'no-link-support' | null;
125
- /**
126
- * Dispatch a `qprefetch` event with detail data containing the bundles that should be prefetched.
127
- * The event dispatch script will be inlined into the document's HTML so any listeners of this
128
- * event should already be ready to handle the event.
129
- *
130
- * This implementation will inject a script similar to:
131
- *
132
- * ```
133
- * <script type="module">
134
- * document.dispatchEvent(new CustomEvent("qprefetch", { detail:{ "bundles": [...] } }))
135
- * </script>
136
- * ```
137
- *
138
- * By default, the `prefetchEvent` implementation will be set to `always`.
139
- */
140
- prefetchEvent?: 'always' | null;
141
- }
142
-
143
- /** @public */
144
- export declare interface PrefetchResource {
145
- url: string;
146
- imports: PrefetchResource[];
147
- }
148
-
149
- /** @public */
150
- export declare interface PrefetchStrategy {
151
- implementation?: PrefetchImplementation;
152
- symbolsToPrefetch?: SymbolsToPrefetch;
153
- }
154
-
155
- /** @public */
156
- declare interface QwikBundle {
157
- size: number;
158
- /** Not precise, but an indication of whether this import may be a task */
159
- isTask?: boolean;
160
- symbols?: string[];
161
- imports?: string[];
162
- dynamicImports?: string[];
163
- origins?: string[];
164
- }
165
-
166
- /** @public */
167
- export declare interface QwikLoaderOptions {
168
- include?: 'always' | 'never' | 'auto';
169
- position?: 'top' | 'bottom';
170
- }
171
-
172
- /**
173
- * The metadata of the build. One of its uses is storing where QRL symbols are located.
174
- *
175
- * @public
176
- */
177
- declare interface QwikManifest_2 {
178
- /** Content hash of the manifest, if this changes, the code changed */
179
- manifestHash: string;
180
- /** QRL symbols */
181
- symbols: {
182
- [symbolName: string]: QwikSymbol;
183
- };
184
- /** Where QRLs are located */
185
- mapping: {
186
- [symbolName: string]: string;
187
- };
188
- /** All code bundles, used to know the import graph */
189
- bundles: {
190
- [fileName: string]: QwikBundle;
191
- };
192
- /** CSS etc to inject in the document head */
193
- injections?: GlobalInjections[];
194
- version: string;
195
- options?: {
196
- target?: string;
197
- buildMode?: string;
198
- entryStrategy?: {
199
- [key: string]: any;
200
- };
201
- };
202
- platform?: {
203
- [name: string]: string;
204
- };
205
- }
206
-
207
- /**
208
- * Options which determine how the Qwik Prefetch Service Worker is added to the document.
209
- *
210
- * Qwik Prefetch Service Worker is used to prefetch resources so that the QwikLoader will always
211
- * have a cache hit. This will ensure that there will not be any delays for the end user while
212
- * interacting with the application.
213
- *
214
- * @public
215
- */
216
- declare interface QwikPrefetchServiceWorkerOptions {
217
- /**
218
- * Should the Qwik Prefetch Service Worker be added to the container. Defaults to `false` until
219
- * the QwikRouter Service Worker is deprecated.
220
- */
221
- include?: boolean;
222
- /**
223
- * Where should the Qwik Prefetch Service Worker be added to the container. Defaults to `top` to
224
- * get prefetching going as fast as possible.
225
- */
226
- position?: 'top' | 'bottom';
227
- }
228
-
229
- /** @public */
230
- declare interface QwikSymbol {
231
- origin: string;
232
- displayName: string;
233
- hash: string;
234
- canonicalFilename: string;
235
- ctxKind: 'function' | 'event';
236
- ctxName: string;
237
- captures: boolean;
238
- parent: string | null;
239
- loc: [number, number];
240
- }
241
-
242
- /** @public */
243
- declare interface ReadonlySignal<T = unknown> {
244
- readonly value: T;
245
- }
246
-
247
- /** @public */
248
- export declare type Render = RenderToString | RenderToStream;
249
-
250
- /** @public */
251
- export declare interface RenderOptions extends SerializeDocumentOptions {
252
- /** Defaults to `true` */
253
- snapshot?: boolean;
254
- /**
255
- * Specifies the root of the JS files of the client build. Setting a base, will cause the render
256
- * of the `q:base` attribute in the `q:container` element.
257
- */
258
- base?: string | ((options: RenderOptions) => string);
259
- /** Language to use when rendering the document. */
260
- locale?: string | ((options: RenderOptions) => string);
261
- /**
262
- * Specifies if the Qwik Loader script is added to the document or not.
263
- *
264
- * Defaults to `{ include: true }`.
265
- */
266
- qwikLoader?: QwikLoaderOptions;
267
- /**
268
- * Specifies if the Qwik Prefetch Service Worker script is added to the document or not.
269
- *
270
- * Defaults to `{ include: false }`. NOTE: This may be change in the future.
271
- */
272
- qwikPrefetchServiceWorker?: QwikPrefetchServiceWorkerOptions;
273
- prefetchStrategy?: PrefetchStrategy | null;
274
- /**
275
- * When set, the app is serialized into a fragment. And the returned html is not a complete
276
- * document. Defaults to `html`
277
- */
278
- containerTagName?: string;
279
- containerAttributes?: Record<string, string>;
280
- serverData?: Record<string, any>;
281
- }
282
-
283
- /** @public */
284
- export declare interface RenderResult {
285
- prefetchResources: PrefetchResource[];
286
- snapshotResult: SnapshotResult | undefined;
287
- isStatic: boolean;
288
- manifest?: QwikManifest;
289
- /** @internal TODO: Move to snapshotResult */
290
- _symbols?: string[];
291
- }
292
-
293
- /** @public */
294
- export declare type RenderToStream = (opts: RenderToStreamOptions) => Promise<RenderToStreamResult>;
295
-
296
- /**
297
- * Creates a server-side `document`, renders to root node to the document, then serializes the
298
- * document to a string.
299
- *
300
- * @public
301
- */
302
- export declare const renderToStream: (jsx: JSXOutput, opts: RenderToStreamOptions) => Promise<RenderToStreamResult>;
303
-
304
- /** @public */
305
- export declare interface RenderToStreamOptions extends RenderOptions {
306
- stream: StreamWriter;
307
- streaming?: StreamingOptions;
308
- }
309
-
310
- /** @public */
311
- export declare interface RenderToStreamResult extends RenderResult {
312
- flushes: number;
313
- size: number;
314
- timing: {
315
- firstFlush: number;
316
- render: number;
317
- snapshot: number;
318
- };
319
- }
320
-
321
- /** @public */
322
- export declare type RenderToString = (opts: RenderToStringOptions) => Promise<RenderToStringResult>;
323
-
324
- /**
325
- * Creates a server-side `document`, renders to root node to the document, then serializes the
326
- * document to a string.
327
- *
328
- * @public
329
- */
330
- export declare const renderToString: (jsx: JSXOutput, opts?: RenderToStringOptions) => Promise<RenderToStringResult>;
331
-
332
- /** @public */
333
- export declare interface RenderToStringOptions extends RenderOptions {
334
- }
335
-
336
- /** @public */
337
- export declare interface RenderToStringResult extends RenderResult {
338
- html: string;
339
- timing: {
340
- firstFlush: number;
341
- render: number;
342
- snapshot: number;
343
- };
344
- }
345
-
346
- /** @public */
347
- declare interface ResolvedManifest_2 {
348
- mapper: SymbolMapper;
349
- manifest: QwikManifest_2;
350
- }
351
-
352
- /** @public */
353
- export declare function resolveManifest(manifest: QwikManifest | ResolvedManifest_2 | undefined): ResolvedManifest_2 | undefined;
354
-
355
- /** @public */
356
- export declare interface SerializeDocumentOptions {
357
- manifest?: QwikManifest | ResolvedManifest;
358
- symbolMapper?: SymbolMapperFn;
359
- debug?: boolean;
360
- }
361
-
362
- /** @public */
363
- export declare function setServerPlatform(manifest: QwikManifest | ResolvedManifest | undefined): Promise<void>;
364
-
365
- /**
366
- * A signal is a reactive value which can be read and written. When the signal is written, all tasks
367
- * which are tracking the signal will be re-run and all components that read the signal will be
368
- * re-rendered.
369
- *
370
- * Furthermore, when a signal value is passed as a prop to a component, the optimizer will
371
- * automatically forward the signal. This means that `return <div title={signal.value}>hi</div>`
372
- * will update the `title` attribute when the signal changes without having to re-render the
373
- * component.
374
- *
375
- * @public
376
- */
377
- declare interface Signal<T = any> extends ReadonlySignal<T> {
378
- value: T;
379
- }
380
-
381
- /** @public */
382
- export declare interface StreamingOptions {
383
- inOrder?: InOrderStreaming;
384
- }
385
-
386
- /** @public */
387
- declare type SymbolMapper = Record<string, readonly [symbol: string, chunk: string]>;
388
-
389
- /**
390
- * Auto: Prefetch all possible QRLs used by the document. Default
391
- *
392
- * @public
393
- */
394
- export declare type SymbolsToPrefetch = 'auto' | ((opts: {
395
- manifest: QwikManifest;
396
- }) => PrefetchResource[]);
397
-
398
- /** @public */
399
- export declare const versions: {
400
- readonly qwik: string;
401
- readonly qwikDom: string;
402
- };
403
-
404
- export { }
3
+ import type { QwikManifest } from './optimizer';
4
+ import type { ResolvedManifest } from './optimizer';
5
+ import type { ServerQwikManifest } from './optimizer';
6
+ import type { SnapshotResult } from '.';
7
+ import type { StreamWriter } from '.';
8
+ import type { SymbolMapperFn } from './optimizer';
9
+
10
+ /** @public */
11
+ declare interface ComponentEntryStrategy {
12
+ type: 'component';
13
+ manual?: Record<string, string>;
14
+ }
15
+
16
+ /** @public */
17
+ declare interface DevJSX {
18
+ fileName: string;
19
+ lineNumber: number;
20
+ columnNumber: number;
21
+ stack?: string;
22
+ }
23
+
24
+ /** @public */
25
+ declare type EntryStrategy = InlineEntryStrategy | HoistEntryStrategy | SingleEntryStrategy | HookEntryStrategy | SegmentEntryStrategy | ComponentEntryStrategy | SmartEntryStrategy;
26
+
27
+ /**
28
+ * Any function taking a props object that returns JSXOutput.
29
+ *
30
+ * The `key`, `flags` and `dev` parameters are for internal use.
31
+ *
32
+ * @public
33
+ */
34
+ declare type FunctionComponent<P = unknown> = {
35
+ renderFn(props: P, key: string | null, flags: number, dev?: DevJSX): JSXOutput;
36
+ }['renderFn'];
37
+
38
+ /**
39
+ * Provides the `qwikloader.js` file as a string. Useful for tooling to inline the qwikloader script
40
+ * into HTML.
41
+ *
42
+ * @public
43
+ */
44
+ export declare function getQwikLoaderScript(opts?: {
45
+ debug?: boolean;
46
+ }): string;
47
+
48
+ /**
49
+ * Provides the `qwik-prefetch-service-worker.js` file as a string. Useful for tooling to inline the
50
+ * qwik-prefetch-service-worker script into HTML.
51
+ *
52
+ * @public
53
+ */
54
+ export declare function getQwikPrefetchWorkerScript(opts?: {
55
+ debug?: boolean;
56
+ }): string;
57
+
58
+ /** @public */
59
+ declare interface GlobalInjections {
60
+ tag: string;
61
+ attributes?: {
62
+ [key: string]: string;
63
+ };
64
+ location: 'head' | 'body';
65
+ }
66
+
67
+ /** @public */
68
+ declare interface HoistEntryStrategy {
69
+ type: 'hoist';
70
+ }
71
+
72
+ /** @deprecated Use SegmentStrategy instead */
73
+ declare interface HookEntryStrategy {
74
+ type: 'hook';
75
+ manual?: Record<string, string>;
76
+ }
77
+
78
+ /** @public */
79
+ declare interface InlineEntryStrategy {
80
+ type: 'inline';
81
+ }
82
+
83
+ /** @public */
84
+ export declare interface InOrderAuto {
85
+ strategy: 'auto';
86
+ maximumInitialChunk?: number;
87
+ maximumChunk?: number;
88
+ }
89
+
90
+ /** @public */
91
+ declare interface InOrderDirect {
92
+ strategy: 'direct';
93
+ }
94
+
95
+ /** @public */
96
+ export declare interface InOrderDisabled {
97
+ strategy: 'disabled';
98
+ }
99
+
100
+ /** @public */
101
+ export declare type InOrderStreaming = InOrderAuto | InOrderDisabled | InOrderDirect;
102
+
103
+ /** @public */
104
+ declare type JSXChildren = string | number | boolean | null | undefined | Function | RegExp | JSXChildren[] | Promise<JSXChildren> | Signal<JSXChildren> | JSXNode;
105
+
106
+ /**
107
+ * A JSX Node, an internal structure. You probably want to use `JSXOutput` instead.
108
+ *
109
+ * @public
110
+ */
111
+ declare interface JSXNode<T extends string | FunctionComponent | unknown = unknown> {
112
+ type: T;
113
+ props: T extends FunctionComponent<infer P> ? P : Record<any, unknown>;
114
+ children: JSXChildren | null;
115
+ key: string | null;
116
+ dev?: DevJSX;
117
+ }
118
+
119
+ /**
120
+ * Any valid output for a component
121
+ *
122
+ * @public
123
+ */
124
+ declare type JSXOutput = JSXNode | string | number | boolean | null | undefined | JSXOutput[];
125
+
126
+ /** @public @deprecated Use `preloader` instead */
127
+ export declare interface PrefetchImplementation {
128
+ /** @deprecated No longer used. */
129
+ linkRel?: 'prefetch' | 'preload' | 'modulepreload' | null;
130
+ /** @deprecated No longer used. */
131
+ linkFetchPriority?: 'auto' | 'low' | 'high' | null;
132
+ /** @deprecated No longer used. */
133
+ linkInsert?: 'js-append' | 'html-append' | null;
134
+ /** @deprecated No longer used. */
135
+ workerFetchInsert?: 'always' | 'no-link-support' | null;
136
+ /** @deprecated No longer used. */
137
+ prefetchEvent?: 'always' | null;
138
+ }
139
+
140
+ /** @public */
141
+ export declare interface PrefetchResource {
142
+ url: string;
143
+ imports: PrefetchResource[];
144
+ }
145
+
146
+ /** @public */
147
+ export declare interface PrefetchStrategy {
148
+ implementation?: PrefetchImplementation;
149
+ symbolsToPrefetch?: SymbolsToPrefetch;
150
+ }
151
+
152
+ /** @public */
153
+ export declare interface PreloaderOptions {
154
+ /**
155
+ * Maximum number of preload links to add during SSR. These instruct the browser to preload likely
156
+ * bundles before the preloader script is active. This most likely includes the core and the
157
+ * preloader script itself. Setting this to 0 will disable all preload links.
158
+ *
159
+ * Preload links can delay LCP, which is a Core Web Vital, but it can increase TTI, which is not a
160
+ * Core Web Vital but more noticeable to the user.
161
+ *
162
+ * Defaults to `5`
163
+ */
164
+ ssrPreloads?: number;
165
+ /**
166
+ * The minimum probability for a bundle to be added as a preload link during SSR.
167
+ *
168
+ * Defaults to `0.7` (70% probability)
169
+ */
170
+ ssrPreloadProbability?: number;
171
+ /**
172
+ * Log preloader debug information to the console.
173
+ *
174
+ * Defaults to `false`
175
+ */
176
+ debug?: boolean;
177
+ /**
178
+ * Maximum number of simultaneous preload links that the preloader will maintain. If you set this
179
+ * higher, the browser will have all JS files in memory sooner, but it will contend with other
180
+ * resource downloads. Furthermore, if a bundle suddenly becomes more likely, it will have to wait
181
+ * longer to be preloaded.
182
+ *
183
+ * Bundles that reach 100% probability (static imports of other bundles) will always be preloaded
184
+ * immediately, no limit.
185
+ *
186
+ * Defaults to `25`
187
+ */
188
+ maxIdlePreloads?: number;
189
+ /**
190
+ * The minimum probability for a bundle to be added to the preload queue.
191
+ *
192
+ * Defaults to `0.35` (35% probability)
193
+ */
194
+ preloadProbability?: number;
195
+ }
196
+
197
+ /** @public */
198
+ declare interface QwikAsset {
199
+ /** Name of the asset */
200
+ name: string | undefined;
201
+ /** Size of the asset */
202
+ size: number;
203
+ }
204
+
205
+ /** @public */
206
+ declare interface QwikBundle {
207
+ /** Size of the bundle */
208
+ size: number;
209
+ /** Total size of this bundle's static import graph */
210
+ total: number;
211
+ /** Interactivity score of the bundle */
212
+ interactivity?: number;
213
+ /** Symbols in the bundle */
214
+ symbols?: string[];
215
+ /** Direct imports */
216
+ imports?: string[];
217
+ /** Dynamic imports */
218
+ dynamicImports?: string[];
219
+ /** Source files of the bundle */
220
+ origins?: string[];
221
+ }
222
+
223
+ /**
224
+ * Bundle graph.
225
+ *
226
+ * Format: [ 'bundle-a.js', 3, 5 // Depends on 'bundle-b.js' and 'bundle-c.js' 'bundle-b.js', 5, //
227
+ * Depends on 'bundle-c.js' 'bundle-c.js', ]
228
+ *
229
+ * @public
230
+ */
231
+ declare type QwikBundleGraph = Array<string | number>;
232
+
233
+ /** @public */
234
+ export declare interface QwikLoaderOptions {
235
+ /**
236
+ * Whether to include the qwikloader script in the document. Normally you don't need to worry
237
+ * about this, but in case of multi-container apps using different Qwik versions, you might want
238
+ * to only enable it on one of the containers.
239
+ *
240
+ * Defaults to `'auto'`.
241
+ */
242
+ include?: 'always' | 'never' | 'auto';
243
+ /** @deprecated No longer used, the qwikloader is always loaded as soon as possible */
244
+ position?: 'top' | 'bottom';
245
+ }
246
+
247
+ /**
248
+ * The metadata of the build. One of its uses is storing where QRL symbols are located.
249
+ *
250
+ * @public
251
+ */
252
+ declare interface QwikManifest_2 {
253
+ /** Content hash of the manifest, if this changes, the code changed */
254
+ manifestHash: string;
255
+ /** QRL symbols */
256
+ symbols: {
257
+ [symbolName: string]: QwikSymbol;
258
+ };
259
+ /** Where QRLs are located. The key is the symbol name, the value is the bundle fileName */
260
+ mapping: {
261
+ [symbolName: string]: string;
262
+ };
263
+ /**
264
+ * All code bundles, used to know the import graph. The key is the bundle fileName relative to
265
+ * "build/"
266
+ */
267
+ bundles: {
268
+ [fileName: string]: QwikBundle;
269
+ };
270
+ /** All assets. The key is the fileName relative to the rootDir */
271
+ assets?: {
272
+ [fileName: string]: QwikAsset;
273
+ };
274
+ /** All bundles in a compact graph format with probabilities */
275
+ bundleGraph?: QwikBundleGraph;
276
+ /** The bundle graph fileName */
277
+ bundleGraphAsset?: string;
278
+ /** The preloader bundle fileName */
279
+ preloader?: string;
280
+ /** The Qwik core bundle fileName */
281
+ core?: string;
282
+ /** The Qwik loader bundle fileName */
283
+ qwikLoader?: string;
284
+ /** CSS etc to inject in the document head */
285
+ injections?: GlobalInjections[];
286
+ /** The version of the manifest */
287
+ version: string;
288
+ /** The options used to build the manifest */
289
+ options?: {
290
+ target?: string;
291
+ buildMode?: string;
292
+ entryStrategy?: {
293
+ type: EntryStrategy['type'];
294
+ };
295
+ };
296
+ /** The platform used to build the manifest */
297
+ platform?: {
298
+ [name: string]: string;
299
+ };
300
+ }
301
+
302
+ /** @public */
303
+ declare interface QwikSymbol {
304
+ origin: string;
305
+ displayName: string;
306
+ hash: string;
307
+ canonicalFilename: string;
308
+ ctxKind: 'function' | 'eventHandler';
309
+ ctxName: string;
310
+ /** Whether the symbol captures a variable */
311
+ captures: boolean;
312
+ parent: string | null;
313
+ loc: [number, number];
314
+ /** The parameter names if it's a function with parameters */
315
+ paramNames?: string[];
316
+ /** The transformed names of scoped variables, if any */
317
+ captureNames?: string[];
318
+ }
319
+
320
+ /** @public */
321
+ declare interface ReadonlySignal<T = unknown> {
322
+ readonly value: T;
323
+ }
324
+
325
+ /** @public */
326
+ export declare type Render = RenderToString | RenderToStream;
327
+
328
+ /** @public */
329
+ export declare interface RenderOptions extends SerializeDocumentOptions {
330
+ /** Defaults to `true` */
331
+ snapshot?: boolean;
332
+ /**
333
+ * Specifies the root of the JS files of the client build. Setting a base, will cause the render
334
+ * of the `q:base` attribute in the `q:container` element.
335
+ */
336
+ base?: string | ((options: RenderOptions) => string);
337
+ /** Language to use when rendering the document. */
338
+ locale?: string | ((options: RenderOptions) => string);
339
+ /**
340
+ * Specifies if the Qwik Loader script is added to the document or not.
341
+ *
342
+ * Defaults to `{ include: true }`.
343
+ */
344
+ qwikLoader?: QwikLoaderOptions;
345
+ preloader?: PreloaderOptions | false;
346
+ /** @deprecated Use `preloader` instead */
347
+ prefetchStrategy?: PrefetchStrategy | null;
348
+ /**
349
+ * When set, the app is serialized into a fragment. And the returned html is not a complete
350
+ * document. Defaults to `html`
351
+ */
352
+ containerTagName?: string;
353
+ containerAttributes?: Record<string, string>;
354
+ serverData?: Record<string, any>;
355
+ }
356
+
357
+ /** @public */
358
+ export declare interface RenderResult {
359
+ snapshotResult: SnapshotResult | undefined;
360
+ isStatic: boolean;
361
+ manifest?: ServerQwikManifest;
362
+ }
363
+
364
+ /** @public */
365
+ export declare type RenderToStream = (opts: RenderToStreamOptions) => Promise<RenderToStreamResult>;
366
+
367
+ /**
368
+ * Creates a server-side `document`, renders to root node to the document, then serializes the
369
+ * document to a string.
370
+ *
371
+ * @public
372
+ */
373
+ export declare const renderToStream: (jsx: JSXOutput, opts: RenderToStreamOptions) => Promise<RenderToStreamResult>;
374
+
375
+ /** @public */
376
+ export declare interface RenderToStreamOptions extends RenderOptions {
377
+ stream: StreamWriter;
378
+ streaming?: StreamingOptions;
379
+ }
380
+
381
+ /** @public */
382
+ export declare interface RenderToStreamResult extends RenderResult {
383
+ flushes: number;
384
+ size: number;
385
+ timing: {
386
+ firstFlush: number;
387
+ render: number;
388
+ snapshot: number;
389
+ };
390
+ }
391
+
392
+ /** @public */
393
+ export declare type RenderToString = (opts: RenderToStringOptions) => Promise<RenderToStringResult>;
394
+
395
+ /**
396
+ * Creates a server-side `document`, renders to root node to the document, then serializes the
397
+ * document to a string.
398
+ *
399
+ * @public
400
+ */
401
+ export declare const renderToString: (jsx: JSXOutput, opts?: RenderToStringOptions) => Promise<RenderToStringResult>;
402
+
403
+ /** @public */
404
+ export declare interface RenderToStringOptions extends RenderOptions {
405
+ }
406
+
407
+ /** @public */
408
+ export declare interface RenderToStringResult extends RenderResult {
409
+ html: string;
410
+ timing: {
411
+ firstFlush: number;
412
+ render: number;
413
+ snapshot: number;
414
+ };
415
+ }
416
+
417
+ /** @public */
418
+ declare interface ResolvedManifest_2 {
419
+ mapper: SymbolMapper;
420
+ manifest: ServerQwikManifest_2;
421
+ injections?: GlobalInjections[];
422
+ bundleGraph?: QwikBundleGraph;
423
+ }
424
+
425
+ /**
426
+ * Merges a given manifest with the built manifest and provides mappings for symbols.
427
+ *
428
+ * @public
429
+ */
430
+ export declare function resolveManifest(manifest?: Partial<QwikManifest | ResolvedManifest_2> | undefined): ResolvedManifest_2 | undefined;
431
+
432
+ /** @public */
433
+ declare interface SegmentEntryStrategy {
434
+ type: 'segment';
435
+ manual?: Record<string, string>;
436
+ }
437
+
438
+ /** @public */
439
+ export declare interface SerializeDocumentOptions {
440
+ manifest?: Partial<QwikManifest | ResolvedManifest>;
441
+ symbolMapper?: SymbolMapperFn;
442
+ debug?: boolean;
443
+ }
444
+
445
+ /**
446
+ * The manifest values that are needed for SSR.
447
+ *
448
+ * @public
449
+ */
450
+ declare type ServerQwikManifest_2 = Pick<QwikManifest_2, 'manifestHash' | 'injections' | 'bundleGraph' | 'bundleGraphAsset' | 'mapping' | 'preloader' | 'core' | 'qwikLoader'>;
451
+
452
+ /** @public */
453
+ export declare function setServerPlatform(manifest?: Partial<QwikManifest | ResolvedManifest>): Promise<void>;
454
+
455
+ /**
456
+ * A signal is a reactive value which can be read and written. When the signal is written, all tasks
457
+ * which are tracking the signal will be re-run and all components that read the signal will be
458
+ * re-rendered.
459
+ *
460
+ * Furthermore, when a signal value is passed as a prop to a component, the optimizer will
461
+ * automatically forward the signal. This means that `return <div title={signal.value}>hi</div>`
462
+ * will update the `title` attribute when the signal changes without having to re-render the
463
+ * component.
464
+ *
465
+ * @public
466
+ */
467
+ declare interface Signal<T = any> extends ReadonlySignal<T> {
468
+ value: T;
469
+ }
470
+
471
+ /** @public */
472
+ declare interface SingleEntryStrategy {
473
+ type: 'single';
474
+ manual?: Record<string, string>;
475
+ }
476
+
477
+ /** @public */
478
+ declare interface SmartEntryStrategy {
479
+ type: 'smart';
480
+ manual?: Record<string, string>;
481
+ }
482
+
483
+ /** @public */
484
+ export declare interface StreamingOptions {
485
+ inOrder?: InOrderStreaming;
486
+ }
487
+
488
+ /** @public */
489
+ declare type SymbolMapper = Record<string, readonly [symbol: string, chunk: string]>;
490
+
491
+ /**
492
+ * Auto: Prefetch all possible QRLs used by the document. Default
493
+ *
494
+ * @public
495
+ */
496
+ export declare type SymbolsToPrefetch = 'auto' | ((opts: {
497
+ manifest: ServerQwikManifest;
498
+ }) => PrefetchResource[]);
499
+
500
+ /** @public */
501
+ export declare const versions: {
502
+ readonly qwik: string;
503
+ readonly qwikDom: string;
504
+ };
505
+
506
+ export { }