UNPKG

fast-brake

Version:

fast js feature detection with zero runtime dependencies; analyzes js to verify compatibility

69 lines (63 loc) 2.7 kB
import { P as Plugin, D as DetectionResult, e as DetectionMode, f as DetectionOptions, S as ScanOptions, g as ScanResult, F as FastBrakeOptions, h as FastBrakeAPI, i as DetectedFeature } from './types-BzXhSiGH.js'; export { B as BrowserVersions, E as Extension, l as ExtensionInput, m as ExtensionOutput, a as FastBrakeSyncAPI, j as Feature, k as SchemaJson } from './types-BzXhSiGH.js'; export { fastBrakeSync } from './sync.js'; declare class Detector { private compiledPatterns; private featureStrings; private featureExcludes; private plugin; private initialized; constructor(); initialize(plugin?: Plugin): Promise<void>; private loadPlugin; private getPluginRule; detectBoolean(code: string): boolean; detectFast(code: string): DetectionResult; detectDetailed(code: string): DetectionResult; detect(code: string, mode?: DetectionMode): DetectionResult; detectFile(filePath: string, mode?: DetectionMode): DetectionResult; private checkStrings; private checkPatterns; private isExcluded; private findFirstValidIndex; private checkPatternMatch; private findFirstStringMatch; private findFirstPatternMatch; private findFirstStringMatchDetailed; private findFirstPatternMatchDetailed; private shouldRunPatternDetection; private hasComplexityIndicators; check(code: string, options: DetectionOptions): boolean; } declare class Scanner { scan(rootPath: string, options?: ScanOptions): ScanResult[]; findFirst(rootPath: string, options?: ScanOptions): ScanResult | undefined; private walkDirectory; private checkTermination; private processEntries; private shouldProcessEntry; private processEntry; private processFile; private addResult; private checkStopConditions; private readDirectorySafe; private getStatsSafe; private shouldIgnore; private simpleGlobMatch; } declare class FastBrakeCache<T = unknown> { private cache; private ttl; constructor(ttlMs?: number); get(key: string): T | undefined; set(key: string, value: T): void; has(key: string): boolean; invalidate(key: string): void; clear(): void; isStale(key: string): boolean; } declare function fastBrake(options: FastBrakeOptions): Promise<FastBrakeAPI>; declare function fastBrake(code: string): Promise<DetectedFeature[]>; declare function detect(code: string): Promise<DetectedFeature[]>; declare function check(code: string, options: DetectionOptions): Promise<boolean>; export { DetectedFeature, DetectionOptions, Detector, FastBrakeAPI, FastBrakeCache, FastBrakeOptions, Scanner, check, fastBrake as default, detect, fastBrake };