Skip to content

Commit 465483f

Browse files
authored
Merge pull request #7527 from maiieul/rename-maxBufferPreloads
refactor(preloader): rename maxBufferPreloads
2 parents bca4545 + 240bd0e commit 465483f

File tree

10 files changed

+13
-13
lines changed

10 files changed

+13
-13
lines changed

.changeset/fair-cars-fry.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default function (opts: RenderToStreamOptions) {
4141
// Enable debug logging for preload operations
4242
debug: true,
4343
// Maximum simultaneous preload links
44-
maxBufferPreloads: 5,
44+
maxBufferedPreloads: 5,
4545
// Minimum probability threshold for preloading
4646
preloadProbability: 0.25
4747
// ...and more, see the type JSDoc on hover

packages/docs/src/entry.ssr.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Root from './root';
66
const preloaderSettings = [
77
'ssrPreloads',
88
'ssrPreloadProbability',
9-
'maxBufferPreloads',
9+
'maxBufferedPreloads',
1010
'preloadProbability',
1111
] as const;
1212

packages/docs/src/routes/api/qwik-server/api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
}
125125
],
126126
"kind": "Interface",
127-
"content": "```typescript\nexport interface PreloaderOptions \n```\n\n\n<table><thead><tr><th>\n\nProperty\n\n\n</th><th>\n\nModifiers\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\n[debug?](#)\n\n\n</td><td>\n\n\n</td><td>\n\nboolean\n\n\n</td><td>\n\n_(Optional)_ Log preloader debug information to the console.\n\nDefaults to `false`\n\n\n</td></tr>\n<tr><td>\n\n[maxBufferPreloads?](#)\n\n\n</td><td>\n\n\n</td><td>\n\nnumber\n\n\n</td><td>\n\n_(Optional)_ Maximum number of simultaneous preload links that the preloader will maintain. If you set this higher, the browser will have all JS files in memory sooner, but it will contend with other resource downloads. Furthermore, if a bundle suddenly becomes more likely, it will have to wait longer to be preloaded.\n\nBundles that reach 100% probability (static imports of other bundles) will always be preloaded immediately, no limit.\n\nDefaults to `25`\n\n\n</td></tr>\n<tr><td>\n\n[preloadProbability?](#)\n\n\n</td><td>\n\n\n</td><td>\n\nnumber\n\n\n</td><td>\n\n_(Optional)_ The minimum probability for a bundle to be added to the preload queue.\n\nDefaults to `0.35` (35% probability)\n\n\n</td></tr>\n<tr><td>\n\n[ssrPreloadProbability?](#)\n\n\n</td><td>\n\n\n</td><td>\n\nnumber\n\n\n</td><td>\n\n_(Optional)_ The minimum probability for a bundle to be added as a preload link during SSR.\n\nDefaults to `0.7` (70% probability)\n\n\n</td></tr>\n<tr><td>\n\n[ssrPreloads?](#)\n\n\n</td><td>\n\n\n</td><td>\n\nnumber\n\n\n</td><td>\n\n_(Optional)_ Maximum number of preload links to add during SSR. These instruct the browser to preload likely bundles before the preloader script is active. This most likely includes the core and the preloader script itself. Setting this to 0 will disable all preload links.\n\nPreload links can delay LCP, which is a Core Web Vital, but it can increase TTI, which is not a Core Web Vital but more noticeable to the user.\n\nDefaults to `5`\n\n\n</td></tr>\n</tbody></table>",
127+
"content": "```typescript\nexport interface PreloaderOptions \n```\n\n\n<table><thead><tr><th>\n\nProperty\n\n\n</th><th>\n\nModifiers\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\n[debug?](#)\n\n\n</td><td>\n\n\n</td><td>\n\nboolean\n\n\n</td><td>\n\n_(Optional)_ Log preloader debug information to the console.\n\nDefaults to `false`\n\n\n</td></tr>\n<tr><td>\n\n[maxBufferedPreloads?](#)\n\n\n</td><td>\n\n\n</td><td>\n\nnumber\n\n\n</td><td>\n\n_(Optional)_ Maximum number of simultaneous preload links that the preloader will maintain. If you set this higher, the browser will have all JS files in memory sooner, but it will contend with other resource downloads. Furthermore, if a bundle suddenly becomes more likely, it will have to wait longer to be preloaded.\n\nBundles that reach 100% probability (static imports of other bundles) will always be preloaded immediately, no limit.\n\nDefaults to `25`\n\n\n</td></tr>\n<tr><td>\n\n[preloadProbability?](#)\n\n\n</td><td>\n\n\n</td><td>\n\nnumber\n\n\n</td><td>\n\n_(Optional)_ The minimum probability for a bundle to be added to the preload queue.\n\nDefaults to `0.35` (35% probability)\n\n\n</td></tr>\n<tr><td>\n\n[ssrPreloadProbability?](#)\n\n\n</td><td>\n\n\n</td><td>\n\nnumber\n\n\n</td><td>\n\n_(Optional)_ The minimum probability for a bundle to be added as a preload link during SSR.\n\nDefaults to `0.7` (70% probability)\n\n\n</td></tr>\n<tr><td>\n\n[ssrPreloads?](#)\n\n\n</td><td>\n\n\n</td><td>\n\nnumber\n\n\n</td><td>\n\n_(Optional)_ Maximum number of preload links to add during SSR. These instruct the browser to preload likely bundles before the preloader script is active. This most likely includes the core and the preloader script itself. Setting this to 0 will disable all preload links.\n\nPreload links can delay LCP, which is a Core Web Vital, but it can increase TTI, which is not a Core Web Vital but more noticeable to the user.\n\nDefaults to `5`\n\n\n</td></tr>\n</tbody></table>",
128128
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts",
129129
"mdFile": "qwik.preloaderoptions.md"
130130
},

packages/docs/src/routes/api/qwik-server/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ Defaults to `false`
466466
</td></tr>
467467
<tr><td>
468468

469-
[maxBufferPreloads?](#)
469+
[maxBufferedPreloads?](#)
470470

471471
</td><td>
472472

packages/qwik/src/core/preloader/bundle-graph.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const loadBundleGraph = (
8383
config.$DEBUG$ = !!opts.d;
8484
}
8585
if ('P' in opts) {
86-
config.$maxBufferPreloads$ = opts['P'] as number;
86+
config.$maxBufferedPreloads$ = opts['P'] as number;
8787
}
8888
if ('Q' in opts) {
8989
config.$invPreloadProbability$ = 1 - (opts['Q'] as number);

packages/qwik/src/core/preloader/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const preloadStr = 'preload';
77

88
export const config = {
99
$DEBUG$: false,
10-
$maxBufferPreloads$: 25,
10+
$maxBufferedPreloads$: 25,
1111
$invPreloadProbability$: 0.65,
1212
};
1313

packages/qwik/src/core/preloader/queue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export const trigger = () => {
7878
const probability = 1 - inverseProbability;
7979
const allowedPreloads = graph
8080
? // The more likely the bundle, the more simultaneous preloads we want to allow
81-
Math.max(1, config.$maxBufferPreloads$ * probability)
81+
Math.max(1, config.$maxBufferedPreloads$ * probability)
8282
: // While the graph is not available, we limit to 2 preloads
8383
2;
8484
// When we're 100% sure, everything needs to be queued

packages/qwik/src/server/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export interface PrefetchStrategy {
7474
// @public (undocumented)
7575
export interface PreloaderOptions {
7676
debug?: boolean;
77-
maxBufferPreloads?: number;
77+
maxBufferedPreloads?: number;
7878
preloadProbability?: number;
7979
ssrPreloadProbability?: number;
8080
ssrPreloads?: number;

packages/qwik/src/server/preload-impl.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function includePreloader(
1313
if (referencedBundles.length === 0 || options === false) {
1414
return null;
1515
}
16-
const { ssrPreloads, ssrPreloadProbability, debug, maxBufferPreloads, preloadProbability } =
16+
const { ssrPreloads, ssrPreloadProbability, debug, maxBufferedPreloads, preloadProbability } =
1717
normalizePreLoaderOptions(typeof options === 'boolean' ? undefined : options);
1818
let allowed = ssrPreloads;
1919

@@ -70,8 +70,8 @@ export function includePreloader(
7070
if (debug) {
7171
opts.push('d:1');
7272
}
73-
if (maxBufferPreloads) {
74-
opts.push(`P:${maxBufferPreloads}`);
73+
if (maxBufferedPreloads) {
74+
opts.push(`P:${maxBufferedPreloads}`);
7575
}
7676
if (preloadProbability) {
7777
opts.push(`Q:${preloadProbability}`);
@@ -128,6 +128,6 @@ const PreLoaderOptionsDefault: Required<PreloaderOptions> = {
128128
ssrPreloads: 5,
129129
ssrPreloadProbability: 0.7,
130130
debug: false,
131-
maxBufferPreloads: 25,
131+
maxBufferedPreloads: 25,
132132
preloadProbability: 0.35,
133133
};

packages/qwik/src/server/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export interface PreloaderOptions {
5555
*
5656
* Defaults to `25`
5757
*/
58-
maxBufferPreloads?: number;
58+
maxBufferedPreloads?: number;
5959
/**
6060
* The minimum probability for a bundle to be added to the preload queue.
6161
*

0 commit comments

Comments
 (0)