Skip to content

Commit 08014f0

Browse files
ci: apply automated fixes
1 parent 4e00b36 commit 08014f0

File tree

3 files changed

+35
-32
lines changed

3 files changed

+35
-32
lines changed

packages/start-plugin-core/src/import-protection-plugin/INTERNALS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ path.
155155
7. After edge-survival, `processPendingViolations()` checks graph reachability
156156
from entry points using only post-transform edges. If the violating
157157
importer is reachable → confirm (warn). If unreachable → discard. If
158-
unknown → keep pending or emit conservatively (warm-start fallback).
158+
unknown → keep pending or emit conservatively (warm-start fallback).
159159

160160
Warm-start stability guardrails:
161161

packages/start-plugin-core/src/import-protection-plugin/plugin.ts

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -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

packages/start-plugin-core/tests/importProtection/utils.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ describe('shouldDeferViolation', () => {
137137
})
138138

139139
test('does not defer in dev error mode', () => {
140-
expect(shouldDeferViolation({ isBuild: false, isDevMock: false })).toBe(false)
140+
expect(shouldDeferViolation({ isBuild: false, isDevMock: false })).toBe(
141+
false,
142+
)
141143
})
142144
})
143145

0 commit comments

Comments
 (0)