docs(vite): add JSDoc and export public API (#3604)
Improves documentation of `@fresh/plugin-vite` related to public API, and exports missing symbols/types that are part of public API (`FreshViteConfig`). - Adds `@module` JSDoc for the `@fresh/plugin-vite/client` entrypoint - Internal only, used for browser HMR - Exports types `ImportCheck` & `ImportCheckDiagnostic`, as they are part of the public API via `FreshViteConfig` - Should make [`ImportCheck` link to correct type](https://jsr.io/@fresh/plugin-vite/doc/~/FreshViteConfig#property_checkimports): <img width="1053" height="285" alt="image" src="https://github.com/user-attachments/assets/766c29f7-7f39-429e-bd81-234fed6b0820" /> - Adds JSDoc descriptions for all public exports; `fresh`, `FreshViteConfig`, `ImportCheck` & `ImportCheckDiagnostic` - Adds description for `FreshViteConfig.checkImports` Part of #3597 & #3596
This commit is contained in:
@@ -27,7 +27,32 @@ import { load as stdLoadEnv } from "@std/dotenv";
|
||||
import path from "node:path";
|
||||
|
||||
export type { FreshViteConfig };
|
||||
export type {
|
||||
ImportCheck,
|
||||
ImportCheckDiagnostic,
|
||||
} from "./plugins/verify_imports.ts";
|
||||
|
||||
/**
|
||||
* Fresh framework support for Vite.
|
||||
*
|
||||
* This plugin uses the Environments feature of Vite to build
|
||||
* both the server and client code for Fresh applications.
|
||||
*
|
||||
* @param config Fresh config options
|
||||
* @returns Vite plugin with Fresh support
|
||||
*
|
||||
* @example Basic usage
|
||||
* ```ts vite.config.ts
|
||||
* import { defineConfig } from "vite";
|
||||
* import { fresh } from "@fresh/plugin-vite";
|
||||
*
|
||||
* export default defineConfig({
|
||||
* plugins: [
|
||||
* fresh({ serverEntry: "server.ts" })
|
||||
* ],
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
export function fresh(config?: FreshViteConfig): Plugin[] {
|
||||
const fConfig: ResolvedFreshViteConfig = {
|
||||
serverEntry: config?.serverEntry ?? "main.ts",
|
||||
|
||||
Reference in New Issue
Block a user