Skip to content

Commit 8ad388a

Browse files
authored
feat: add server.warmupRequest to future deprecation (#20431)
1 parent 344d302 commit 8ad388a

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

docs/changes/per-environment-apis.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The `Environment` instance was first introduced at `v6.0`. The deprecation of `s
1515
future: {
1616
removeServerModuleGraph: 'warn',
1717
removeServerTransformRequest: 'warn',
18+
removeServerWarmupRequest: 'warn',
1819
}
1920
```
2021

packages/vite/src/node/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ export interface FutureOptions {
485485
removeServerModuleGraph?: 'warn'
486486
removeServerHot?: 'warn'
487487
removeServerTransformRequest?: 'warn'
488+
removeServerWarmupRequest?: 'warn'
488489

489490
removeSsrLoadModule?: 'warn'
490491
}
@@ -703,6 +704,7 @@ export const configDefaults = Object.freeze({
703704
removeServerModuleGraph: undefined,
704705
removeServerHot: undefined,
705706
removeServerTransformRequest: undefined,
707+
removeServerWarmupRequest: undefined,
706708
removeSsrLoadModule: undefined,
707709
},
708710
legacy: {

packages/vite/src/node/deprecations.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const deprecationCode = {
1010
removeServerModuleGraph: 'changes/per-environment-apis',
1111
removeServerHot: 'changes/per-environment-apis',
1212
removeServerTransformRequest: 'changes/per-environment-apis',
13+
removeServerWarmupRequest: 'changes/per-environment-apis',
1314

1415
removeSsrLoadModule: 'changes/ssr-using-modulerunner',
1516
} satisfies Record<keyof FutureOptions, string>
@@ -25,6 +26,8 @@ const deprecationMessages = {
2526
removeServerHot: 'The `server.hot` is replaced with `this.environment.hot`.',
2627
removeServerTransformRequest:
2728
'The `server.transformRequest` is replaced with `this.environment.transformRequest`.',
29+
removeServerWarmupRequest:
30+
'The `server.warmupRequest` is replaced with `this.environment.warmupRequest`.',
2831

2932
removeSsrLoadModule:
3033
'The `server.ssrLoadModule` is replaced with Environment Runner.',

packages/vite/src/node/server/index.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -592,15 +592,12 @@ export async function _createServer(
592592
})
593593
},
594594
transformRequest(url, options) {
595-
warnFutureDeprecation(
596-
config,
597-
'removeServerTransformRequest',
598-
'server.transformRequest() is deprecated. Use environment.transformRequest() instead.',
599-
)
595+
warnFutureDeprecation(config, 'removeServerTransformRequest')
600596
const environment = server.environments[options?.ssr ? 'ssr' : 'client']
601597
return environment.transformRequest(url)
602598
},
603599
warmupRequest(url, options) {
600+
warnFutureDeprecation(config, 'removeServerWarmupRequest')
604601
const environment = server.environments[options?.ssr ? 'ssr' : 'client']
605602
return environment.warmupRequest(url)
606603
},

0 commit comments

Comments
 (0)