@@ -81,10 +81,6 @@ import {
81
81
} from './baseEnvironment'
82
82
import type { MinimalPluginContext , Plugin , PluginContext } from './plugin'
83
83
import type { RollupPluginHooks } from './typeUtils'
84
- import {
85
- createFilterForTransform ,
86
- createIdFilter ,
87
- } from './plugins/pluginFilter'
88
84
import { buildOxcPlugin } from './plugins/oxc'
89
85
90
86
export interface BuildEnvironmentOptions {
@@ -597,7 +593,7 @@ async function buildEnvironment(
597
593
// inject environment and ssr arg to plugin load/transform hooks
598
594
const chunkMetadataMap = new Map < string , ChunkMetadata > ( )
599
595
const plugins = environment . plugins . map ( ( p ) =>
600
- injectEnvironmentAndFilterToHooks ( environment , chunkMetadataMap , p ) ,
596
+ injectEnvironmentToHooks ( environment , chunkMetadataMap , p ) ,
601
597
)
602
598
603
599
const rollupOptions : RolldownOptions = {
@@ -1157,7 +1153,7 @@ function isExternal(id: string, test: string | RegExp) {
1157
1153
}
1158
1154
}
1159
1155
1160
- export function injectEnvironmentAndFilterToHooks (
1156
+ export function injectEnvironmentToHooks (
1161
1157
environment : BuildEnvironment ,
1162
1158
chunkMetadataMap : Map < string , ChunkMetadata > ,
1163
1159
plugin : Plugin ,
@@ -1169,13 +1165,13 @@ export function injectEnvironmentAndFilterToHooks(
1169
1165
for ( const hook of Object . keys ( clone ) as RollupPluginHooks [ ] ) {
1170
1166
switch ( hook ) {
1171
1167
case 'resolveId' :
1172
- clone [ hook ] = wrapEnvironmentAndFilterResolveId ( environment , resolveId )
1168
+ clone [ hook ] = wrapEnvironmentResolveId ( environment , resolveId )
1173
1169
break
1174
1170
case 'load' :
1175
- clone [ hook ] = wrapEnvironmentAndFilterLoad ( environment , load )
1171
+ clone [ hook ] = wrapEnvironmentLoad ( environment , load )
1176
1172
break
1177
1173
case 'transform' :
1178
- clone [ hook ] = wrapEnvironmentAndFilterTransform ( environment , transform )
1174
+ clone [ hook ] = wrapEnvironmentTransform ( environment , transform )
1179
1175
break
1180
1176
default :
1181
1177
if ( ROLLUP_HOOKS . includes ( hook ) ) {
@@ -1193,20 +1189,14 @@ export function injectEnvironmentAndFilterToHooks(
1193
1189
return clone
1194
1190
}
1195
1191
1196
- function wrapEnvironmentAndFilterResolveId (
1192
+ function wrapEnvironmentResolveId (
1197
1193
environment : BuildEnvironment ,
1198
1194
hook ?: Plugin [ 'resolveId' ] ,
1199
1195
) : Plugin [ 'resolveId' ] {
1200
1196
if ( ! hook ) return
1201
1197
1202
- const rawIdFilter = typeof hook === 'object' ? hook . filter ?. id : undefined
1203
- const idFilter = rawIdFilter ? createIdFilter ( rawIdFilter ) : undefined
1204
-
1205
1198
const fn = getHookHandler ( hook )
1206
1199
const handler : Plugin [ 'resolveId' ] = function ( id , importer , options ) {
1207
- if ( idFilter && ! idFilter ( id ) ) {
1208
- return
1209
- }
1210
1200
return fn . call (
1211
1201
injectEnvironmentInContext ( this , environment ) ,
1212
1202
id ,
@@ -1225,20 +1215,14 @@ function wrapEnvironmentAndFilterResolveId(
1225
1215
}
1226
1216
}
1227
1217
1228
- function wrapEnvironmentAndFilterLoad (
1218
+ function wrapEnvironmentLoad (
1229
1219
environment : BuildEnvironment ,
1230
1220
hook ?: Plugin [ 'load' ] ,
1231
1221
) : Plugin [ 'load' ] {
1232
1222
if ( ! hook ) return
1233
1223
1234
- const rawIdFilter = typeof hook === 'object' ? hook . filter ?. id : undefined
1235
- const idFilter = rawIdFilter ? createIdFilter ( rawIdFilter ) : undefined
1236
-
1237
1224
const fn = getHookHandler ( hook )
1238
1225
const handler : Plugin [ 'load' ] = function ( id , ...args ) {
1239
- if ( idFilter && ! idFilter ( id ) ) {
1240
- return
1241
- }
1242
1226
return fn . call (
1243
1227
injectEnvironmentInContext ( this , environment ) ,
1244
1228
id ,
@@ -1256,22 +1240,14 @@ function wrapEnvironmentAndFilterLoad(
1256
1240
}
1257
1241
}
1258
1242
1259
- function wrapEnvironmentAndFilterTransform (
1243
+ function wrapEnvironmentTransform (
1260
1244
environment : BuildEnvironment ,
1261
1245
hook ?: Plugin [ 'transform' ] ,
1262
1246
) : Plugin [ 'transform' ] {
1263
1247
if ( ! hook ) return
1264
1248
1265
- const filters = typeof hook === 'object' ? hook . filter : undefined
1266
- const filter = filters
1267
- ? createFilterForTransform ( filters . id , filters . code )
1268
- : undefined
1269
-
1270
1249
const fn = getHookHandler ( hook )
1271
1250
const handler : Plugin [ 'transform' ] = function ( code , importer , ...args ) {
1272
- if ( filter && ! filter ( importer , code ) ) {
1273
- return
1274
- }
1275
1251
return fn . call (
1276
1252
injectEnvironmentInContext ( this , environment ) ,
1277
1253
code ,
0 commit comments