Skip to content

Commit

Permalink
fix types to only expose options that will work properly right now
Browse files Browse the repository at this point in the history
  • Loading branch information
nksaraf committed Dec 27, 2023
1 parent 099f76e commit 1cf96cd
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
6 changes: 2 additions & 4 deletions packages/vinxi/lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@ import { resolveRouterConfig, routerSchema } from "./router-modes.js";
routers?: import("./router-modes.js").RouterSchemaInput[];
name?:
string;
server?: import('nitropack').NitroConfig & {
baseURL?: string;
};
server?: Omit<import('nitropack').NitroConfig, 'handlers' | 'devHandlers' | 'publicAssets' | 'scanDirs' | 'appConfigFiles' | 'imports' | 'virtual'>;
root?: string
}} AppOptions */

/** @typedef {{
config: {
name: string;
devtools: boolean;
server: import("nitropack").NitroConfig;
server: Omit<import('nitropack').NitroConfig, 'handlers' | 'devHandlers' | 'publicAssets' | 'scanDirs' | 'appConfigFiles' | 'imports' | 'virtual'>;
routers: import("./router-mode.js").Router[];
root: string;
};
Expand Down
1 change: 1 addition & 0 deletions packages/vinxi/lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export async function createBuild(app, buildConfig) {
"node-fetch-native/polyfill": require.resolve(
"node-fetch-native/polyfill",
),
...(app.config.server.alias ?? {}),
// "unstorage/drivers/fs-lite": require.resolve("unstorage/drivers/fs-lite"),
// "unstorage/drivers/fs": require.resolve("unstorage/drivers/fs"),
// defu: require.resolve("defu"),
Expand Down
2 changes: 1 addition & 1 deletion packages/vinxi/lib/plugins/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
*
* @param {string} tag
* @param {Omit<import('vite').InlineConfig, 'router'>} conf
* @param {import('../vite-dev.d.ts').CustomizableConfig} conf
* @returns {import('../vite-dev.d.ts').Plugin}
*/
export function config(tag, conf) {
Expand Down
25 changes: 24 additions & 1 deletion packages/vinxi/lib/vite-dev.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Plugin as VitePlugin, ResolvedConfig as _ResolvedConfig } from "vite";

import { App } from "./app.js";
import { Router } from "./router-mode.js";
import { DevConfig } from "./dev-server.js";
import { Router } from "./router-mode.js";

declare module "vite" {
interface UserConfig {
Expand All @@ -28,4 +28,27 @@ export type ViteConfig = _ResolvedConfig & { router: Router; app: App };

export type Plugin = VitePlugin;

export type CustomizableConfig = Omit<
import("vite").InlineConfig,
| "appType"
| "app"
| "router"
| "base"
| "root"
| "publicDir"
| "mode"
| "server"
| "preview"
| "clearScreen"
| "configFile"
| "envFile"
> & {
build?: Omit<
import("vite").InlineConfig["build"],
"outDir" | "ssr" | "ssrManifest" | "rollupOptions"
> & {
rollupOptions?: Omit<import("vite").BuildOptions["rollupOptions"], "input">;
};
};

export type { ConfigEnv as ConfigEnv } from "vite";

0 comments on commit 1cf96cd

Please sign in to comment.