UNPKG

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.

24 lines (23 loc) 1.28 kB
import type { ServerResponse } from 'http'; import type { ResolvedCliOptions } from '../../../../utils/config/cli-options'; /** * Injects the standard dev-server scripts into an HTML document, mirroring what the * UI/legacy widget paths inject so a Vite-served document behaves the same: * * 1. The SDK web shim (when `injectSdk` is enabled). * 2. The WebSocket URL script used by the Dynatrace runtime. * 3. The `/dev-sw.js` service worker that redirects platform API calls to localhost. * * The scripts are inserted right before `</head>`. The returned HTML is *not* yet * passed through `server.transformIndexHtml`; callers do that to obtain `@vite/client` * + React Fast Refresh. */ export declare function injectDevScripts(html: string, config: ResolvedCliOptions): string; /** * Scans the transformed HTML for inline scripts, computes their SHA-256 hashes, * and appends those hashes to whichever CSP header (enforced or report-only) * was set earlier in the middleware chain by dt-csp-vite-plugin. */ export declare function appendInlineScriptHashesToCsp(res: ServerResponse, html: string): void; /** Returns SHA-256 hashes (CSP format) for every inline script in the given HTML. */ export declare function extractInlineScriptHashes(html: string): string[];