-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
46 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
/** | ||
* This is a developement only file for testing types. | ||
* This is a development only file for testing types. | ||
*/ | ||
import type { Plugin as RollupPlugin } from 'rollup' | ||
import type { Equal, ExpectExtends, ExpectTrue } from '@type-challenges/utils' | ||
import type { EnvironmentPlugin, PluginContextExtension } from '../plugin' | ||
import type { Plugin, PluginContextExtension } from '../plugin' | ||
import type { ROLLUP_HOOKS } from '../constants' | ||
import type { | ||
GetHookContextMap, | ||
NonNeverKeys, | ||
RollupPluginHooks, | ||
} from '../typeUtils' | ||
|
||
type EnvironmentPluginHooksContext = GetHookContextMap<EnvironmentPlugin> | ||
type EnvironmentPluginHooksContext = GetHookContextMap<Plugin> | ||
type EnvironmentPluginHooksContextMatched = { | ||
[K in keyof EnvironmentPluginHooksContext]: EnvironmentPluginHooksContext[K] extends PluginContextExtension | ||
? never | ||
: false | ||
} | ||
|
||
type HooksMissingExtension = NonNeverKeys<EnvironmentPluginHooksContextMatched> | ||
type HooksMissingInConstans = Exclude< | ||
type HooksMissingInConstants = Exclude< | ||
RollupPluginHooks, | ||
(typeof ROLLUP_HOOKS)[number] | ||
> | ||
|
||
export type cases = [ | ||
// Ensure environment plugin hooks are superset of rollup plugin hooks | ||
ExpectTrue<ExpectExtends<RollupPlugin, EnvironmentPlugin>>, | ||
ExpectTrue<ExpectExtends<RollupPlugin, Plugin>>, | ||
|
||
// Ensure all Rollup hooks have Vite's plugin context extension | ||
ExpectTrue<Equal<HooksMissingExtension, never>>, | ||
|
||
// Ensure the `ROLLUP_HOOKS` constant is up-to-date | ||
ExpectTrue<Equal<HooksMissingInConstans, never>>, | ||
ExpectTrue<Equal<HooksMissingInConstants, never>>, | ||
] | ||
|
||
export {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters