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:
Christian Svensson
2025-11-11 15:33:03 +01:00
committed by GitHub
parent ffa845ab0d
commit 1dd8279075
4 changed files with 49 additions and 4 deletions
+12 -4
View File
@@ -35,14 +35,15 @@ export interface ClientSnapshot {
entry: string;
}
/** Configuration options for Fresh when using the Vite plugin */
export interface FreshViteConfig {
/** Path to main server entry file. Default: main.ts */
/** Path to main server entry file. Default: `main.ts` */
serverEntry?: string;
/** Path to main client entry file. Default: client.ts */
/** Path to main client entry file. Default: `client.ts` */
clientEntry?: string;
/** Path to islands directory. Default: ./islands */
/** Path to islands directory. Default: `./islands` */
islandsDir?: string;
/** Path to routes directory. Default: ./routes */
/** Path to routes directory. Default: `./routes` */
routeDir?: string;
/**
* Ignore file paths matching any of the provided regexes when
@@ -54,6 +55,13 @@ export interface FreshViteConfig {
* islands from remote packages.
*/
islandSpecifiers?: string[];
/**
* A list of checks that will be performed for imports.
*
* Can be used to warn or error when certain imports exist in
* server or client code. Useful to enforce that some dependencies
* are not imported in Islands running in the browser.
*/
checkImports?: ImportCheck[];
}