Skip to content

Commit

Permalink
refactor: plugin container (#17288)
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed May 29, 2024
1 parent c373251 commit 909782f
Show file tree
Hide file tree
Showing 3 changed files with 691 additions and 628 deletions.
11 changes: 7 additions & 4 deletions packages/vite/src/node/plugins/importAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import {
withTrailingSlash,
wrapId,
} from '../../shared/utils'
import type { TransformPluginContext } from '../server/pluginContainer'
import { throwOutdatedRequest } from './optimizedDeps'
import { isCSSRequest, isDirectCSSRequest } from './css'
import { browserExternalId } from './resolve'
Expand Down Expand Up @@ -243,7 +244,10 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
throwOutdatedRequest(importer)
}

if (!imports.length && !(this as any)._addedImports) {
if (
!imports.length &&
!(this as unknown as TransformPluginContext)._addedImports
) {
importerModule.isSelfAccepting = false
debug?.(
`${timeFrom(msAtStart)} ${colors.dim(
Expand Down Expand Up @@ -730,9 +734,8 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
// note that we want to handle .css?raw and .css?url here
if (!isCSSRequest(importer) || SPECIAL_QUERY_RE.test(importer)) {
// attached by pluginContainer.addWatchFile
const pluginImports = (this as any)._addedImports as
| Set<string>
| undefined
const pluginImports = (this as unknown as TransformPluginContext)
._addedImports
if (pluginImports) {
;(
await Promise.all(
Expand Down
Loading

0 comments on commit 909782f

Please sign in to comment.