Skip to content

Commit b264075

Browse files
committed
fix: vite 6 typings somehow requires to return explicit plugin type for factories
1 parent a4e9093 commit b264075

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

packages/engine/src/vite/build-routes.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import { basename, extname, join } from 'node:path';
22

33
import { createFilter, type Plugin, type ViteDevServer } from 'vite';
44

5-
import { renderRoutes } from '../routes/render.js';
5+
import {
6+
renderRoutes,
7+
type RenderedRouteDefinition,
8+
} from '../routes/render.js';
69
import { REGEX_TAG_LINK, REGEX_TAG_SCRIPT } from '../render/route-template.js';
710
import type { RoutesManifest } from '../routes/route.js';
811
import type { GracileConfig } from '../user-config.js';
@@ -26,7 +29,12 @@ export const buildRoutes = async ({
2629
root: string;
2730
gracileConfig: GracileConfig;
2831
serverMode?: boolean;
29-
}) => {
32+
}): Promise<{
33+
routes: RoutesManifest;
34+
renderedRoutes: RenderedRouteDefinition[];
35+
inputList: string[];
36+
plugin: Plugin[];
37+
}> => {
3038
// TODO: extract upstream, return just the plugins
3139
const { renderedRoutes } = await renderRoutes({
3240
vite: viteServerForBuild,
@@ -103,7 +111,7 @@ export const buildRoutes = async ({
103111

104112
return null;
105113
},
106-
} satisfies Plugin,
114+
},
107115

108116
{
109117
name: 'gracile-collect-handler-assets',
@@ -180,7 +188,7 @@ export const buildRoutes = async ({
180188
}
181189
}
182190
},
183-
} satisfies Plugin,
191+
},
184192
],
185193
};
186194
};

packages/engine/src/vite/html-routes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { Plugin } from 'vite';
77
* but not THAT useful.
88
* @todo Make tests and document this simple feature.
99
*/
10-
export function htmlRoutesLoader() {
10+
export function htmlRoutesLoader(): Plugin[] {
1111
return [
1212
{
1313
name: 'gracile-html-route-loader',
@@ -25,6 +25,6 @@ export default defineRoute({
2525
});
2626
`;
2727
},
28-
} satisfies Plugin,
28+
},
2929
];
3030
}

packages/engine/src/vite/virtual-routes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function virtualRoutes({
1616
// root: string;
1717
routes: RoutesManifest;
1818
renderedRoutes: RenderedRouteDefinition[];
19-
}) {
19+
}): Plugin[] {
2020
const virtualModuleId = 'gracile:routes';
2121
const resolvedVirtualModuleId = `\0${virtualModuleId}`;
2222

@@ -102,7 +102,7 @@ export function virtualRoutesClient({
102102
routes: RoutesManifest;
103103
mode: 'static' | 'server';
104104
gracileConfig: GracileConfig;
105-
}) {
105+
}): Plugin[] {
106106
const virtualModuleId = 'gracile:client:routes';
107107
const resolvedVirtualModuleId = `\0${virtualModuleId}`;
108108

0 commit comments

Comments
 (0)