@@ -31,7 +31,6 @@ import type { ResolvedConfig } from '../config'
3131import { checkPublicFile } from '../publicDir'
3232import { toOutputFilePathInHtml } from '../build'
3333import { resolveEnvPrefix } from '../env'
34- import type { Logger } from '../logger'
3534import { cleanUrl } from '../../shared/utils'
3635import { perEnvironmentState } from '../environment'
3736import { getNodeAssetAttributes } from '../assetSource'
@@ -332,7 +331,6 @@ function handleParseError(
332331export function buildHtmlPlugin ( config : ResolvedConfig ) : Plugin {
333332 const [ preHooks , normalHooks , postHooks ] = resolveHtmlTransforms (
334333 config . plugins ,
335- config . logger ,
336334 )
337335 preHooks . unshift ( injectCspNonceMetaTagHook ( config ) )
338336 preHooks . unshift ( preImportMapHook ( config ) )
@@ -1123,21 +1121,6 @@ export type IndexHtmlTransform =
11231121 | IndexHtmlTransformHook
11241122 | {
11251123 order ?: 'pre' | 'post' | null
1126- /**
1127- * @deprecated renamed to `order`
1128- */
1129- enforce ?: 'pre' | 'post'
1130- /**
1131- * @deprecated renamed to `handler`
1132- */
1133- transform : IndexHtmlTransformHook
1134- }
1135- | {
1136- order ?: 'pre' | 'post' | null
1137- /**
1138- * @deprecated renamed to `order`
1139- */
1140- enforce ?: 'pre' | 'post'
11411124 handler : IndexHtmlTransformHook
11421125 }
11431126
@@ -1306,7 +1289,6 @@ export function injectNonceAttributeTagHook(
13061289
13071290export function resolveHtmlTransforms (
13081291 plugins : readonly Plugin [ ] ,
1309- logger : Logger ,
13101292) : [
13111293 IndexHtmlTransformHook [ ] ,
13121294 IndexHtmlTransformHook [ ] ,
@@ -1323,31 +1305,10 @@ export function resolveHtmlTransforms(
13231305 if ( typeof hook === 'function' ) {
13241306 normalHooks . push ( hook )
13251307 } else {
1326- if ( ! ( 'order' in hook ) && 'enforce' in hook ) {
1327- logger . warnOnce (
1328- colors . yellow (
1329- `plugin '${ plugin . name } ' uses deprecated 'enforce' option. Use 'order' option instead.` ,
1330- ) ,
1331- )
1332- }
1333- if ( ! ( 'handler' in hook ) && 'transform' in hook ) {
1334- logger . warnOnce (
1335- colors . yellow (
1336- `plugin '${ plugin . name } ' uses deprecated 'transform' option. Use 'handler' option instead.` ,
1337- ) ,
1338- )
1339- }
1340-
1341- // `enforce` had only two possible values for the `transformIndexHtml` hook
1342- // `'pre'` and `'post'` (the default). `order` now works with three values
1343- // to align with other hooks (`'pre'`, normal, and `'post'`). We map
1344- // both `enforce: 'post'` to `order: undefined` to avoid a breaking change
1345- const order = hook . order ?? ( hook . enforce === 'pre' ? 'pre' : undefined )
1346- // @ts -expect-error union type
1347- const handler = hook . handler ?? hook . transform
1348- if ( order === 'pre' ) {
1308+ const handler = hook . handler
1309+ if ( hook . order === 'pre' ) {
13491310 preHooks . push ( handler )
1350- } else if ( order === 'post' ) {
1311+ } else if ( hook . order === 'post' ) {
13511312 postHooks . push ( handler )
13521313 } else {
13531314 normalHooks . push ( handler )
0 commit comments