@@ -65,14 +65,6 @@ const validate = createSchemaValidation(
65
65
66
66
/** @typedef {Map<string, { config: ProvideOptions, version: string | undefined | false }> } ResolvedProvideMap */
67
67
68
- // Helper function to create composite key
69
- function createLookupKey (
70
- request : string ,
71
- config : { layer ?: string | null } ,
72
- ) : string {
73
- return createLookupKeyForSharing ( request , config . layer ) ;
74
- }
75
-
76
68
class ProvideSharedPlugin {
77
69
private _provides : [ string , ProvidesConfig ] [ ] ;
78
70
@@ -146,7 +138,10 @@ class ProvideSharedPlugin {
146
138
const prefixMatchProvides : Map < string , ProvidesConfig > = new Map ( ) ;
147
139
for ( const [ request , config ] of this . _provides ) {
148
140
const actualRequest = config . request || request ;
149
- const lookupKey = createLookupKey ( actualRequest , config ) ;
141
+ const lookupKey = createLookupKeyForSharing (
142
+ actualRequest ,
143
+ config . layer ,
144
+ ) ;
150
145
if ( / ^ ( \/ | [ A - Z a - z ] : \\ | \\ \\ | \. \. ? ( \/ | $ ) ) / . test ( actualRequest ) ) {
151
146
// relative request - apply filtering if include/exclude are defined
152
147
if ( this . shouldProvideSharedModule ( config ) ) {
@@ -177,18 +172,20 @@ class ProvideSharedPlugin {
177
172
'ProvideSharedPlugin' ,
178
173
( module , { resource, resourceResolveData } , resolveData ) => {
179
174
const moduleLayer = module . layer ;
180
- const lookupKey = createLookupKey ( resource || '' , {
181
- layer : moduleLayer || undefined ,
182
- } ) ;
175
+ const lookupKey = createLookupKeyForSharing (
176
+ resource || '' ,
177
+ moduleLayer || undefined ,
178
+ ) ;
183
179
184
180
if ( resource && resolvedProvideMap . has ( lookupKey ) ) {
185
181
return module ;
186
182
}
187
183
const { request } = resolveData ;
188
184
{
189
- const requestKey = createLookupKey ( request , {
190
- layer : moduleLayer || undefined ,
191
- } ) ;
185
+ const requestKey = createLookupKeyForSharing (
186
+ request ,
187
+ moduleLayer || undefined ,
188
+ ) ;
192
189
const config = matchProvides . get ( requestKey ) ;
193
190
if ( config !== undefined && resource ) {
194
191
this . provideSharedModule (
@@ -220,32 +217,6 @@ class ProvideSharedPlugin {
220
217
221
218
const shareKey = config . shareKey + remainder ;
222
219
223
- // Check singleton warning for request filters
224
- if ( config . singleton ) {
225
- if ( config . include ?. request ) {
226
- addSingletonFilterWarning (
227
- compilation ,
228
- shareKey ,
229
- 'include' ,
230
- 'request' ,
231
- config . include . request ,
232
- request ,
233
- resource ,
234
- ) ;
235
- }
236
- if ( config . exclude ?. request ) {
237
- addSingletonFilterWarning (
238
- compilation ,
239
- shareKey ,
240
- 'exclude' ,
241
- 'request' ,
242
- config . exclude . request ,
243
- request ,
244
- resource ,
245
- ) ;
246
- }
247
- }
248
-
249
220
this . provideSharedModule (
250
221
compilation ,
251
222
resolvedProvideMap ,
@@ -431,7 +402,7 @@ class ProvideSharedPlugin {
431
402
}
432
403
}
433
404
434
- const lookupKey = createLookupKey ( resource , config ) ;
405
+ const lookupKey = createLookupKeyForSharing ( resource , config . layer ) ;
435
406
resolvedProvideMap . set ( lookupKey , {
436
407
config,
437
408
version,
0 commit comments