UNPKG

rwsdk

Version:

Build fast, server-driven webapps on Cloudflare with SSR, RSC, and realtime

11 lines (10 loc) 442 B
/** * Efficiently checks if a React directive (e.g., "use server", "use client") * is present in the code. * * This function is optimized for performance by only checking the first few * lines of the code, as directives must appear at the very top of a file. * It handles comments, whitespace, and any valid directive prologue * (e.g., "use strict"). */ export declare function hasDirective(code: string, directive: string): boolean;