dt-app
Version:
The Dynatrace App Toolkit is a tool you can use from your command line to create, develop, and deploy apps on your Dynatrace environment.
28 lines (27 loc) • 1.34 kB
TypeScript
import type { Plugin } from 'vite';
/**
* Holds the latest TypeScript error message from the worker thread.
* Shared between the plugin (reads on every HTML response) and
* the TypeScript worker callbacks in vite-dev-server.ts (writes).
*/
export interface TypeScriptErrorHolder {
lastError: string | null;
}
/**
* Generates a static HTML snippet for the TypeScript error overlay.
* Injected directly into the HTML response so it is visible even after
* Vite-triggered page reloads caused by failed HMR updates.
*/
export declare function generateErrorOverlayHtml(message: string): string;
/**
* Vite plugin that injects a lightweight TypeScript error overlay into the dev server.
* Works in tandem with the TypeScript worker callbacks wired up in vite-dev-server.ts.
*
* Two complementary mechanisms are used:
* 1. **Server-side**: When the HTML is served and there is a stored TypeScript error,
* the error overlay HTML is injected directly into the response. This survives
* Vite-triggered page reloads caused by failed HMR updates.
* 2. **Client-side (HMR)**: A virtual module listens for `dt:ts-error` / `dt:ts-errors-clear`
* custom HMR events and dynamically shows/hides the overlay without a page reload.
*/
export declare function dtErrorOverlayPlugin(errorHolder: TypeScriptErrorHolder): Plugin;