@@ -144,6 +144,12 @@ export async function createEnvironmentPluginContainer(
144
144
return container
145
145
}
146
146
147
+ export type SkipInformation = {
148
+ id : string
149
+ importer : string | undefined
150
+ plugin : Plugin
151
+ }
152
+
147
153
class EnvironmentPluginContainer {
148
154
private _pluginContextMap = new Map < Plugin , PluginContext > ( )
149
155
private _resolvedRollupOptions ?: InputOptions
@@ -336,7 +342,9 @@ class EnvironmentPluginContainer {
336
342
options ?: {
337
343
attributes ?: Record < string , string >
338
344
custom ?: CustomPluginOptions
345
+ /** @deprecated use `skipCalls` instead */
339
346
skip ?: Set < Plugin >
347
+ skipCalls ?: readonly SkipInformation [ ]
340
348
/**
341
349
* @internal
342
350
*/
@@ -349,17 +357,25 @@ class EnvironmentPluginContainer {
349
357
await this . _buildStartPromise
350
358
}
351
359
const skip = options ?. skip
360
+ const skipCalls = options ?. skipCalls
352
361
const scan = ! ! options ?. scan
353
362
const ssr = this . environment . config . consumer === 'server'
354
- const ctx = new ResolveIdContext ( this , skip , scan )
363
+ const ctx = new ResolveIdContext ( this , skip , skipCalls , scan )
364
+
365
+ const mergedSkip = new Set < Plugin > ( skip )
366
+ for ( const call of skipCalls ?? [ ] ) {
367
+ if ( call . id === rawId && call . importer === importer ) {
368
+ mergedSkip . add ( call . plugin )
369
+ }
370
+ }
355
371
356
372
const resolveStart = debugResolve ? performance . now ( ) : 0
357
373
let id : string | null = null
358
374
const partial : Partial < PartialResolvedId > = { }
359
375
for ( const plugin of this . getSortedPlugins ( 'resolveId' ) ) {
360
376
if ( this . _closed && this . environment . config . dev . recoverable )
361
377
throwClosedServerError ( )
362
- if ( skip ?. has ( plugin ) ) continue
378
+ if ( mergedSkip ?. has ( plugin ) ) continue
363
379
364
380
ctx . _plugin = plugin
365
381
@@ -534,6 +550,7 @@ class PluginContext implements Omit<RollupPluginContext, 'cache'> {
534
550
_activeId : string | null = null
535
551
_activeCode : string | null = null
536
552
_resolveSkips ?: Set < Plugin >
553
+ _resolveSkipCalls ?: readonly SkipInformation [ ]
537
554
meta : RollupPluginContext [ 'meta' ]
538
555
environment : Environment
539
556
@@ -559,16 +576,19 @@ class PluginContext implements Omit<RollupPluginContext, 'cache'> {
559
576
skipSelf ?: boolean
560
577
} ,
561
578
) {
562
- let skip : Set < Plugin > | undefined
563
- if ( options ?. skipSelf !== false ) {
564
- skip = new Set ( this . _resolveSkips )
565
- skip . add ( this . _plugin )
566
- }
579
+ const skipCalls =
580
+ options ?. skipSelf === false
581
+ ? this . _resolveSkipCalls
582
+ : [
583
+ ...( this . _resolveSkipCalls || [ ] ) ,
584
+ { id, importer, plugin : this . _plugin } ,
585
+ ]
567
586
let out = await this . _container . resolveId ( id , importer , {
568
587
attributes : options ?. attributes ,
569
588
custom : options ?. custom ,
570
589
isEntry : ! ! options ?. isEntry ,
571
- skip,
590
+ skip : this . _resolveSkips ,
591
+ skipCalls,
572
592
scan : this . _scan ,
573
593
} )
574
594
if ( typeof out === 'string' ) out = { id : out }
@@ -794,10 +814,12 @@ class ResolveIdContext extends PluginContext {
794
814
constructor (
795
815
container : EnvironmentPluginContainer ,
796
816
skip : Set < Plugin > | undefined ,
817
+ skipCalls : readonly SkipInformation [ ] | undefined ,
797
818
scan : boolean ,
798
819
) {
799
820
super ( null ! , container )
800
821
this . _resolveSkips = skip
822
+ this . _resolveSkipCalls = skipCalls
801
823
this . _scan = scan
802
824
}
803
825
}
@@ -999,7 +1021,9 @@ class PluginContainer {
999
1021
options ?: {
1000
1022
attributes ?: Record < string , string >
1001
1023
custom ?: CustomPluginOptions
1024
+ /** @deprecated use `skipCalls` instead */
1002
1025
skip ?: Set < Plugin >
1026
+ skipCalls ?: readonly SkipInformation [ ]
1003
1027
ssr ?: boolean
1004
1028
/**
1005
1029
* @internal
0 commit comments