@qwik.dev/core 2.0.0-beta.3 → 2.0.0-beta.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 (139) hide show
  1. package/dist/backpatch/index.d.ts +2 -0
  2. package/dist/backpatch/index.mjs +5 -0
  3. package/dist/backpatch/package.json +8 -0
  4. package/dist/backpatch-executor.debug.js +39 -0
  5. package/dist/backpatch-executor.js +1 -0
  6. package/dist/build/package.json +1 -1
  7. package/dist/cli.mjs +12961 -0
  8. package/dist/core-internal.d.ts +1117 -707
  9. package/dist/core.min.mjs +2 -1
  10. package/dist/core.mjs +12216 -8953
  11. package/dist/core.mjs.map +1 -1
  12. package/dist/core.prod.mjs +8677 -5376
  13. package/dist/insights/index.qwik.mjs +80 -57
  14. package/dist/insights/vite/index.mjs +36 -33
  15. package/dist/loader/index.mjs +2 -2
  16. package/dist/loader/package.json +1 -1
  17. package/dist/optimizer.d.ts +47 -278
  18. package/dist/optimizer.mjs +2427 -3791
  19. package/dist/preloader.mjs +212 -117
  20. package/dist/qwikloader.debug.js +173 -135
  21. package/dist/qwikloader.js +1 -1
  22. package/dist/server.d.ts +51 -203
  23. package/dist/server.mjs +1661 -1157
  24. package/dist/server.prod.mjs +3452 -0
  25. package/dist/starters/adapters/aws-lambda/adapters/aws-lambda/{vite.config.mts → vite.config.ts} +2 -2
  26. package/dist/starters/adapters/aws-lambda/package.json +3 -2
  27. package/dist/starters/adapters/aws-lambda/src/entry_aws-lambda.tsx +2 -6
  28. package/dist/starters/adapters/azure-swa/adapters/azure-swa/{vite.config.mts → vite.config.ts} +2 -2
  29. package/dist/starters/adapters/azure-swa/package.json +3 -2
  30. package/dist/starters/adapters/azure-swa/src/entry.azure-swa.tsx +2 -3
  31. package/dist/starters/adapters/bun/adapters/bun/{vite.config.mts → vite.config.ts} +3 -3
  32. package/dist/starters/adapters/bun/package.json +3 -2
  33. package/dist/starters/adapters/bun/src/entry.bun.ts +0 -2
  34. package/dist/starters/adapters/cloud-run/adapters/cloud-run/{vite.config.mts → vite.config.ts} +2 -2
  35. package/dist/starters/adapters/cloud-run/package.json +3 -2
  36. package/dist/starters/adapters/cloud-run/src/entry.cloud-run.tsx +1 -3
  37. package/dist/starters/adapters/cloudflare-pages/adapters/cloudflare-pages/{vite.config.mts → vite.config.ts} +2 -2
  38. package/dist/starters/adapters/cloudflare-pages/package.json +3 -2
  39. package/dist/starters/adapters/cloudflare-pages/src/entry.cloudflare-pages.tsx +2 -3
  40. package/dist/starters/adapters/cloudflare-workers/README.md +52 -0
  41. package/dist/starters/adapters/cloudflare-workers/adapters/cloudflare-workers/vite.config.ts +15 -0
  42. package/dist/starters/adapters/cloudflare-workers/gitignore +3 -0
  43. package/dist/starters/adapters/cloudflare-workers/package.json +31 -0
  44. package/dist/starters/adapters/cloudflare-workers/public/.assetsignore +4 -0
  45. package/dist/starters/adapters/cloudflare-workers/public/_headers +11 -0
  46. package/dist/starters/adapters/cloudflare-workers/public/_redirects +1 -0
  47. package/dist/starters/adapters/cloudflare-workers/src/entry.cloudflare-pages.tsx +23 -0
  48. package/dist/starters/adapters/cloudflare-workers/worker-configuration.d.ts +5 -0
  49. package/dist/starters/adapters/cloudflare-workers/wrangler.jsonc +41 -0
  50. package/dist/starters/adapters/deno/adapters/deno/{vite.config.mts → vite.config.ts} +2 -2
  51. package/dist/starters/adapters/deno/package.json +3 -2
  52. package/dist/starters/adapters/deno/src/entry.deno.ts +0 -2
  53. package/dist/starters/adapters/express/adapters/express/{vite.config.mts → vite.config.ts} +2 -2
  54. package/dist/starters/adapters/express/package.json +4 -3
  55. package/dist/starters/adapters/express/src/entry.express.tsx +1 -3
  56. package/dist/starters/adapters/fastify/adapters/fastify/{vite.config.mts → vite.config.ts} +2 -2
  57. package/dist/starters/adapters/fastify/package.json +4 -3
  58. package/dist/starters/adapters/fastify/src/entry.fastify.tsx +1 -1
  59. package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +1 -2
  60. package/dist/starters/adapters/firebase/adapters/firebase/{vite.config.mts → vite.config.ts} +2 -2
  61. package/dist/starters/adapters/firebase/package.json +3 -2
  62. package/dist/starters/adapters/firebase/src/entry-firebase.tsx +2 -3
  63. package/dist/starters/adapters/netlify-edge/adapters/netlify-edge/{vite.config.mts → vite.config.ts} +2 -2
  64. package/dist/starters/adapters/netlify-edge/package.json +5 -4
  65. package/dist/starters/adapters/netlify-edge/src/entry.netlify-edge.tsx +2 -3
  66. package/dist/starters/adapters/node-server/adapters/node-server/{vite.config.mts → vite.config.ts} +2 -2
  67. package/dist/starters/adapters/node-server/package.json +3 -2
  68. package/dist/starters/adapters/node-server/src/entry.node-server.tsx +0 -2
  69. package/dist/starters/adapters/{static/adapters/static/vite.config.mts → ssg/adapters/ssg/vite.config.ts} +3 -3
  70. package/dist/starters/adapters/ssg/package.json +20 -0
  71. package/dist/starters/adapters/vercel-edge/README.md +2 -2
  72. package/dist/starters/adapters/vercel-edge/adapters/vercel-edge/{vite.config.mts → vite.config.ts} +2 -2
  73. package/dist/starters/adapters/vercel-edge/package.json +3 -2
  74. package/dist/starters/adapters/vercel-edge/src/entry.vercel-edge.tsx +2 -3
  75. package/dist/starters/adapters/vercel-edge/vercel.json +1 -1
  76. package/dist/starters/features/auth/package.json +1 -1
  77. package/dist/starters/features/compiled-i18n/package.json +37 -0
  78. package/dist/starters/features/compiled-i18n/src/components/locale-selector/locale-selector.tsx +30 -0
  79. package/dist/starters/features/compiled-i18n/src/entry.ssr.tsx +31 -0
  80. package/dist/starters/features/compiled-i18n/src/routes/plugin@compiled-i18n.ts +28 -0
  81. package/dist/starters/features/csr/index.html +27 -0
  82. package/dist/starters/features/csr/package.json +29 -0
  83. package/dist/starters/features/csr/src/root.tsx +15 -0
  84. package/dist/starters/features/csr/vite.config.ts +13 -0
  85. package/dist/starters/features/cypress/src/actions/example.action.ts +5 -0
  86. package/dist/starters/features/cypress/src/components/example/example.cy.tsx +50 -8
  87. package/dist/starters/features/cypress/src/components/example/example.tsx +13 -3
  88. package/dist/starters/features/cypress/src/loaders/example.loader.ts +5 -0
  89. package/dist/starters/features/pandacss/package.json +1 -1
  90. package/dist/starters/features/postcss/postcss.config.js +1 -1
  91. package/dist/starters/features/storybook/.storybook/tsconfig.json +0 -1
  92. package/dist/starters/features/styled-vanilla-extract/package.json +2 -1
  93. package/dist/starters/features/tailwind/package.json +2 -2
  94. package/dist/starters/features/tailwind/prettier.config.js +10 -0
  95. package/dist/starters/features/tailwind-v3/package.json +1 -1
  96. package/dist/starters/features/tailwind-v3/prettier.config.js +10 -0
  97. package/dist/testing/index.d.ts +928 -6
  98. package/dist/testing/index.mjs +16212 -11578
  99. package/dist/testing/package.json +1 -1
  100. package/handlers.mjs +1 -1
  101. package/package.json +34 -56
  102. package/public.d.ts +5 -1
  103. package/{qwik-cli.cjs → qwik-cli.mjs} +1 -1
  104. package/server.d.ts +2 -0
  105. package/bindings/qwik.darwin-arm64.node +0 -0
  106. package/bindings/qwik.darwin-x64.node +0 -0
  107. package/bindings/qwik.linux-x64-gnu.node +0 -0
  108. package/bindings/qwik.wasm.cjs +0 -471
  109. package/bindings/qwik.wasm.mjs +0 -464
  110. package/bindings/qwik.win32-x64-msvc.node +0 -0
  111. package/bindings/qwik_wasm_bg.wasm +0 -0
  112. package/dist/build/index.cjs +0 -35
  113. package/dist/build/index.cjs.map +0 -7
  114. package/dist/build/index.dev.cjs +0 -37
  115. package/dist/build/index.dev.cjs.map +0 -7
  116. package/dist/build/index.prod.cjs +0 -37
  117. package/dist/build/index.prod.cjs.map +0 -7
  118. package/dist/cli.cjs +0 -5545
  119. package/dist/core.cjs +0 -11800
  120. package/dist/core.cjs.map +0 -1
  121. package/dist/core.prod.cjs +0 -5661
  122. package/dist/insights/index.qwik.cjs +0 -1
  123. package/dist/insights/vite/index.cjs +0 -1
  124. package/dist/loader/index.cjs +0 -4
  125. package/dist/optimizer.cjs +0 -4020
  126. package/dist/preloader.cjs +0 -269
  127. package/dist/server.cjs +0 -3037
  128. package/dist/starters/adapters/static/package.json +0 -19
  129. package/dist/starters/features/localize/package.json +0 -37
  130. package/dist/starters/features/localize/src/entry.ssr.tsx +0 -30
  131. package/dist/starters/features/localize/src/locales/message.en.json +0 -8
  132. package/dist/starters/features/localize/src/locales/message.it.json +0 -8
  133. package/dist/starters/features/localize/src/routes/[locale]/i18n-utils.ts +0 -94
  134. package/dist/starters/features/localize/src/routes/[locale]/index.tsx +0 -52
  135. package/dist/starters/features/localize/src/routes/[locale]/layout.tsx +0 -12
  136. package/dist/starters/features/playwright/playwright-report/index.html +0 -22026
  137. package/dist/starters/features/tailwind/.prettierrc.js +0 -3
  138. package/dist/testing/index.cjs +0 -33331
  139. /package/dist/starters/adapters/{static → ssg}/README.md +0 -0
package/dist/server.d.ts CHANGED
@@ -1,18 +1,12 @@
1
1
  /// <reference path="./server-modules.d.ts" />
2
2
 
3
3
  import type { QwikManifest } from './optimizer';
4
- import type { ResolvedManifest } from './optimizer';
4
+ import { ResolvedManifest } from './optimizer';
5
5
  import type { ServerQwikManifest } from './optimizer';
6
6
  import type { SnapshotResult } from '.';
7
- import type { StreamWriter } from '.';
7
+ import type { StreamWriter } from './internal';
8
8
  import type { SymbolMapperFn } from './optimizer';
9
9
 
10
- /** @public */
11
- declare interface ComponentEntryStrategy {
12
- type: 'component';
13
- manual?: Record<string, string>;
14
- }
15
-
16
10
  /** @public */
17
11
  declare interface DevJSX {
18
12
  fileName: string;
@@ -21,9 +15,6 @@ declare interface DevJSX {
21
15
  stack?: string;
22
16
  }
23
17
 
24
- /** @public */
25
- declare type EntryStrategy = InlineEntryStrategy | HoistEntryStrategy | SingleEntryStrategy | HookEntryStrategy | SegmentEntryStrategy | ComponentEntryStrategy | SmartEntryStrategy;
26
-
27
18
  /**
28
19
  * Any function taking a props object that returns JSXOutput.
29
20
  *
@@ -35,6 +26,15 @@ declare type FunctionComponent<P = unknown> = {
35
26
  renderFn(props: P, key: string | null, flags: number, dev?: DevJSX): JSXOutput;
36
27
  }['renderFn'];
37
28
 
29
+ /**
30
+ * Provides the `backpatch-executor.js` executor script as a string.
31
+ *
32
+ * @public
33
+ */
34
+ export declare function getQwikBackpatchExecutorScript(opts?: {
35
+ debug?: boolean;
36
+ }): string;
37
+
38
38
  /**
39
39
  * Provides the `qwikloader.js` file as a string. Useful for tooling to inline the qwikloader script
40
40
  * into HTML.
@@ -55,31 +55,6 @@ export declare function getQwikPrefetchWorkerScript(opts?: {
55
55
  debug?: boolean;
56
56
  }): string;
57
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
58
  /** @public */
84
59
  export declare interface InOrderAuto {
85
60
  strategy: 'auto';
@@ -166,6 +141,8 @@ export declare interface PreloaderOptions {
166
141
  * The minimum probability for a bundle to be added as a preload link during SSR.
167
142
  *
168
143
  * Defaults to `0.7` (70% probability)
144
+ *
145
+ * This makes sure that the most likely bundles are preloaded ahead of time.
169
146
  */
170
147
  ssrPreloadProbability?: number;
171
148
  /**
@@ -187,140 +164,23 @@ export declare interface PreloaderOptions {
187
164
  */
188
165
  maxIdlePreloads?: number;
189
166
  /**
190
- * The minimum probability for a bundle to be added to the preload queue.
167
+ * @deprecated The minimum probability for a bundle to be added to the preload queue.
168
+ *
169
+ * Defaulted to `0.35` (35% probability).
191
170
  *
192
- * Defaults to `0.35` (35% probability)
171
+ * Deprecated because this could cause performance issues with bundles fetched on on click instead
172
+ * of being preloaded ahead of time.
193
173
  */
194
174
  preloadProbability?: number;
195
175
  }
196
176
 
197
177
  /** @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
- */
178
+ export declare type QwikLoaderOptions = 'module' | 'inline' | 'never' | {
179
+ /** @deprecated No longer used. */
242
180
  include?: 'always' | 'never' | 'auto';
243
- /** @deprecated No longer used, the qwikloader is always loaded as soon as possible */
181
+ /** @deprecated No longer used. */
244
182
  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
- }
183
+ };
324
184
 
325
185
  /** @public */
326
186
  export declare type Render = RenderToString | RenderToStream;
@@ -337,11 +197,25 @@ export declare interface RenderOptions extends SerializeDocumentOptions {
337
197
  /** Language to use when rendering the document. */
338
198
  locale?: string | ((options: RenderOptions) => string);
339
199
  /**
340
- * Specifies if the Qwik Loader script is added to the document or not.
200
+ * Specifies how the Qwik Loader is included in the document. This enables interactivity and lazy
201
+ * loading.
202
+ *
203
+ * `module`: Use a `<script>` tag to load the Qwik Loader. Subsequent page loads will have the
204
+ * script cached and instantly running.
205
+ *
206
+ * `inline`: This embeds the Qwik Loader script directly in the document. This adds about 3kB
207
+ * before compression, which typically is reduced to about 1.6kB with gzip.
341
208
  *
342
- * Defaults to `{ include: true }`.
209
+ * `never`: Do not include the Qwik Loader script. This is mostly useful when embedding multiple
210
+ * containers on the same page.
211
+ *
212
+ * Defaults to `module`.
213
+ *
214
+ * Note that the Qwik Loader is absolutely required for Qwik to work. There must be an instance of
215
+ * it loaded for any interactivity to happen.
343
216
  */
344
217
  qwikLoader?: QwikLoaderOptions;
218
+ /** Specifies how preloading is handled. This ensures that code is instantly available when needed. */
345
219
  preloader?: PreloaderOptions | false;
346
220
  /** @deprecated Use `preloader` instead */
347
221
  prefetchStrategy?: PrefetchStrategy | null;
@@ -351,12 +225,14 @@ export declare interface RenderOptions extends SerializeDocumentOptions {
351
225
  */
352
226
  containerTagName?: string;
353
227
  containerAttributes?: Record<string, string>;
228
+ /** Metadata that can be retrieved during SSR with `useServerData()`. */
354
229
  serverData?: Record<string, any>;
355
230
  }
356
231
 
357
232
  /** @public */
358
233
  export declare interface RenderResult {
359
- snapshotResult: SnapshotResult | undefined;
234
+ /** @deprecated Not longer used in v2 */
235
+ snapshotResult?: SnapshotResult | undefined;
360
236
  isStatic: boolean;
361
237
  manifest?: ServerQwikManifest;
362
238
  }
@@ -414,26 +290,12 @@ export declare interface RenderToStringResult extends RenderResult {
414
290
  };
415
291
  }
416
292
 
417
- /** @public */
418
- declare interface ResolvedManifest_2 {
419
- mapper: SymbolMapper;
420
- manifest: ServerQwikManifest_2;
421
- injections?: GlobalInjections[];
422
- bundleGraph?: QwikBundleGraph;
423
- }
424
-
425
293
  /**
426
294
  * Merges a given manifest with the built manifest and provides mappings for symbols.
427
295
  *
428
296
  * @public
429
297
  */
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
- }
298
+ export declare function resolveManifest(manifest?: Partial<QwikManifest | ResolvedManifest> | undefined): ResolvedManifest | undefined;
437
299
 
438
300
  /** @public */
439
301
  export declare interface SerializeDocumentOptions {
@@ -442,13 +304,6 @@ export declare interface SerializeDocumentOptions {
442
304
  debug?: boolean;
443
305
  }
444
306
 
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
307
  /** @public */
453
308
  export declare function setServerPlatform(manifest?: Partial<QwikManifest | ResolvedManifest>): Promise<void>;
454
309
 
@@ -464,20 +319,16 @@ export declare function setServerPlatform(manifest?: Partial<QwikManifest | Reso
464
319
  *
465
320
  * @public
466
321
  */
467
- declare interface Signal<T = any> extends ReadonlySignal<T> {
322
+ declare interface Signal<T = any> {
323
+ /** Reading from this subscribes to updates; writing to this triggers updates. */
468
324
  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>;
325
+ /** Reading from this does not subscribe to updates; writing to this does not trigger updates. */
326
+ untrackedValue: T;
327
+ /**
328
+ * Use this to trigger running subscribers, for example when the value mutated but remained the
329
+ * same object.
330
+ */
331
+ trigger(): void;
481
332
  }
482
333
 
483
334
  /** @public */
@@ -485,9 +336,6 @@ export declare interface StreamingOptions {
485
336
  inOrder?: InOrderStreaming;
486
337
  }
487
338
 
488
- /** @public */
489
- declare type SymbolMapper = Record<string, readonly [symbol: string, chunk: string]>;
490
-
491
339
  /**
492
340
  * Auto: Prefetch all possible QRLs used by the document. Default
493
341
  *