Skip to content

Commit 6c816cb

Browse files
committed
fix: Vite plugins for UI frameworks should return a mutable Array.
1 parent 4100313 commit 6c816cb

6 files changed

Lines changed: 23 additions & 5 deletions

File tree

‎packages/md/src/plugin.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function hasIslandFiles(dir: string): boolean {
6767
return false;
6868
}
6969

70-
export function voidMarkdown(options?: MarkdownOptions): ReadonlyArray<Plugin> {
70+
export function voidMarkdown(options?: MarkdownOptions): Array<Plugin> {
7171
let adapter: FrameworkAdapter | null = null;
7272
let mdPages: ReadonlyArray<MdPage> = [];
7373
let root = '';

‎packages/react/src/plugin.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export type VoidReactOptions = Readonly<{
1515
prefetch?: PrefetchConfig;
1616
}>;
1717

18-
export function voidReact(options?: VoidReactOptions): ReadonlyArray<Plugin> {
18+
export function voidReact(options?: VoidReactOptions): Array<Plugin> {
1919
const pagesDir = join(process.cwd(), 'pages');
2020
return [
2121
...react(options?.react),

‎packages/solid/src/plugin.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function configPlugin(): Plugin {
4444
};
4545
}
4646

47-
export function voidSolid(options?: VoidSolidOptions): ReadonlyArray<Plugin> {
47+
export function voidSolid(options?: VoidSolidOptions): Array<Plugin> {
4848
const pagesDir = join(process.cwd(), 'pages');
4949
return [
5050
configPlugin(),

‎packages/svelte/src/plugin.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export type VoidSvelteOptions = Readonly<{
1515
prefetch?: PrefetchConfig;
1616
}>;
1717

18-
export function voidSvelte(options?: VoidSvelteOptions): ReadonlyArray<Plugin> {
18+
export function voidSvelte(options?: VoidSvelteOptions): Array<Plugin> {
1919
const pagesDir = join(process.cwd(), 'pages');
2020
return [
2121
...(svelte(options?.svelte) as ReadonlyArray<Plugin>),

‎packages/vue/src/plugin.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export type VoidVueOptions = Readonly<{
99
viewTransitions?: boolean;
1010
}>;
1111

12-
export function voidVue(options?: VoidVueOptions): ReadonlyArray<Plugin> {
12+
export function voidVue(options?: VoidVueOptions): Array<Plugin> {
1313
const pagesDir = join(process.cwd(), 'pages');
1414
return [
1515
vue(options?.vue) as Plugin,
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import type { Plugin, UserConfig } from 'vite';
2+
import { describe, expectTypeOf, it } from 'vite-plus/test';
3+
import type { voidPlugin } from 'void';
4+
import { voidVue } from '../../src/plugin.ts';
5+
6+
type VitePlugins = NonNullable<UserConfig['plugins']>;
7+
8+
describe('voidVue plugin types', () => {
9+
it('returns a mutable plugin array for Vite config compatibility', () => {
10+
expectTypeOf<ReturnType<typeof voidVue>>().toEqualTypeOf<Array<Plugin>>();
11+
});
12+
13+
it('supports the scaffolded nested Vite plugins shape', () => {
14+
expectTypeOf<
15+
[ReturnType<typeof voidPlugin>, ReturnType<typeof voidVue>]
16+
>().toMatchTypeOf<VitePlugins>();
17+
});
18+
});

0 commit comments

Comments
 (0)