@@ -986,9 +986,7 @@ export function importProtectionPlugin(
986986 }
987987 activeViolations = surviving
988988 env . pendingViolations . set ( file , surviving )
989- } else if (
990- violations . some ( ( pv ) => pv . fromPreTransformResolve )
991- ) {
989+ } else if ( violations . some ( ( pv ) => pv . fromPreTransformResolve ) ) {
992990 // Pre-transform violations (e.g. server-fn lookup) need
993991 // edge-survival verification before emission. When post-transform
994992 // import data IS available, the `if` branch above catches it and
@@ -1189,11 +1187,7 @@ export function importProtectionPlugin(
11891187 )
11901188 const baseMockId =
11911189 config . command === 'serve'
1192- ? mockRuntimeModuleIdFromViolation (
1193- info ,
1194- config . mockAccess ,
1195- config . root ,
1196- )
1190+ ? mockRuntimeModuleIdFromViolation ( info , config . mockAccess , config . root )
11971191 : `${ MOCK_BUILD_PREFIX } ${ buildViolationCounter ++ } `
11981192 return resolveViteId ( makeMockEdgeModuleId ( exports , baseMockId ) )
11991193 }
@@ -1319,13 +1313,25 @@ export function importProtectionPlugin(
13191313
13201314 config . compiledRules . client = {
13211315 specifiers : compileMatchers ( clientSpecifiers ) ,
1322- files : compileMatchers ( pick ( userOpts ?. client ?. files , defaults . client . files ) ) ,
1323- excludeFiles : compileMatchers ( pick ( userOpts ?. client ?. excludeFiles , defaults . client . excludeFiles ) ) ,
1316+ files : compileMatchers (
1317+ pick ( userOpts ?. client ?. files , defaults . client . files ) ,
1318+ ) ,
1319+ excludeFiles : compileMatchers (
1320+ pick ( userOpts ?. client ?. excludeFiles , defaults . client . excludeFiles ) ,
1321+ ) ,
13241322 }
13251323 config . compiledRules . server = {
1326- specifiers : compileMatchers ( dedupePatterns ( pick ( userOpts ?. server ?. specifiers , defaults . server . specifiers ) ) ) ,
1327- files : compileMatchers ( pick ( userOpts ?. server ?. files , defaults . server . files ) ) ,
1328- excludeFiles : compileMatchers ( pick ( userOpts ?. server ?. excludeFiles , defaults . server . excludeFiles ) ) ,
1324+ specifiers : compileMatchers (
1325+ dedupePatterns (
1326+ pick ( userOpts ?. server ?. specifiers , defaults . server . specifiers ) ,
1327+ ) ,
1328+ ) ,
1329+ files : compileMatchers (
1330+ pick ( userOpts ?. server ?. files , defaults . server . files ) ,
1331+ ) ,
1332+ excludeFiles : compileMatchers (
1333+ pick ( userOpts ?. server ?. excludeFiles , defaults . server . excludeFiles ) ,
1334+ ) ,
13291335 }
13301336
13311337 // Include/exclude
@@ -1581,23 +1587,21 @@ export function importProtectionPlugin(
15811587 if ( violatesEnv && ! env . seenViolations . has ( envRetroKey ) ) {
15821588 env . seenViolations . add ( envRetroKey )
15831589 let retroDeferred = false
1584- const importersMap =
1585- env . graph . reverseEdges . get ( normalizedImporter )
1590+ const importersMap = env . graph . reverseEdges . get ( normalizedImporter )
15861591 if ( importersMap && importersMap . size > 0 ) {
15871592 for ( const [ importerFile , specifier ] of importersMap ) {
15881593 if ( ! specifier ) continue
15891594 if ( ! shouldCheckImporter ( importerFile ) ) continue
1590- const markerInfo =
1591- await buildMarkerViolationFromResolvedImport (
1592- provider ,
1593- env ,
1594- envName ,
1595- envType ,
1596- importerFile ,
1597- specifier ,
1598- normalizedImporter ,
1599- getRelativePath ( normalizedImporter ) ,
1600- )
1595+ const markerInfo = await buildMarkerViolationFromResolvedImport (
1596+ provider ,
1597+ env ,
1598+ envName ,
1599+ envType ,
1600+ importerFile ,
1601+ specifier ,
1602+ normalizedImporter ,
1603+ getRelativePath ( normalizedImporter ) ,
1604+ )
16011605 if ( markerInfo ) {
16021606 deferViolation (
16031607 env ,
@@ -1610,10 +1614,7 @@ export function importProtectionPlugin(
16101614 }
16111615 }
16121616 if ( retroDeferred ) {
1613- await processPendingViolations (
1614- env ,
1615- this . warn . bind ( this ) ,
1616- )
1617+ await processPendingViolations ( env , this . warn . bind ( this ) )
16171618 }
16181619 }
16191620
0 commit comments