Skip to content

Commit

Permalink
types: prefer property and pass isEntry rather than omit
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Jun 23, 2022
1 parent 1b3cd8e commit 6c4fe1f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
16 changes: 8 additions & 8 deletions packages/vite/src/node/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ import type { ConfigEnv, ResolvedConfig } from './'
* If a plugin should be applied only for server or build, a function format
* config file can be used to conditional determine the plugins to use.
*/
export interface Plugin
extends Omit<RollupPlugin, 'resolveId' | 'load' | 'transform'> {
export interface Plugin extends RollupPlugin {
/**
* Enforce plugin invocation tier similar to webpack loaders.
*
Expand Down Expand Up @@ -129,7 +128,7 @@ export interface Plugin
/**
* extend hooks with ssr flag
*/
resolveId?(
resolveId?: (
this: PluginContext,
source: string,
importer: string | undefined,
Expand All @@ -140,17 +139,18 @@ export interface Plugin
* @internal
*/
scan?: boolean
isEntry: boolean
}
): Promise<ResolveIdResult> | ResolveIdResult
load?(
) => Promise<ResolveIdResult> | ResolveIdResult
load?: (
this: PluginContext,
id: string,
options?: { ssr?: boolean }
): Promise<LoadResult> | LoadResult
transform?(
) => Promise<LoadResult> | LoadResult
transform?: (
this: TransformPluginContext,
code: string,
id: string,
options?: { ssr?: boolean }
): Promise<TransformResult> | TransformResult
) => Promise<TransformResult> | TransformResult
}
4 changes: 3 additions & 1 deletion packages/vite/src/node/server/pluginContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export interface PluginContainer {
* @internal
*/
scan?: boolean
isEntry?: boolean
}
): Promise<PartialResolvedId | null>
transform(
Expand Down Expand Up @@ -527,6 +528,7 @@ export async function createPluginContainer(
const skip = options?.skip
const ssr = options?.ssr
const scan = !!options?.scan
const isEntry = !!options?.isEntry
const ctx = new Context()
ctx.ssr = !!ssr
ctx._scan = scan
Expand All @@ -546,7 +548,7 @@ export async function createPluginContainer(
ctx as any,
rawId,
importer,
{ ssr, scan }
{ ssr, scan, isEntry }
)
if (!result) continue

Expand Down

0 comments on commit 6c4fe1f

Please sign in to comment.