rwsdk
Version:
Build fast, server-driven webapps on Cloudflare with SSR, RSC, and realtime
32 lines (31 loc) • 1.27 kB
text/typescript
export declare const IMPORT_PATTERNS: string[];
export declare const EXPORT_PATTERNS: string[];
export interface ExportInfo {
name: string;
isDefault: boolean;
alias?: string;
originalName?: string;
isReExport?: boolean;
moduleSpecifier?: string;
}
/**
* Finds import specifiers and their positions in the code using the provided patterns.
* @param code The code to search for import specifiers.
* @param lang The language parser to use (TypeScript or Tsx).
* @param ignoredImportPatterns Array of regex patterns to ignore.
* @param log Optional logger function for debug output.
* @returns Array of objects with start, end, and raw import string.
*/
export declare function findImportSpecifiers(id: string, code: string, ignoredImportPatterns: RegExp[], log?: (...args: any[]) => void): Array<{
s: number;
e: number;
raw: string;
}>;
/**
* Finds export information in the code using ast-grep patterns.
* @param id The file identifier for language detection.
* @param code The code to search for exports.
* @param log Optional logger function for debug output.
* @returns Array of export information objects.
*/
export declare function findExports(id: string, code: string, log?: (...args: any[]) => void): ExportInfo[];