UNPKG

@embeddable.com/sdk-core

Version:

Core Embeddable SDK module responsible for web-components bundling and publishing.

27 lines (26 loc) 1.18 kB
import { ServerResponse } from "http"; /** * Wraps a ServerResponse object to prevent setting the Content-Length header. */ export declare function preventContentLength(res: ServerResponse): void; export declare function createWatcherLock(): { lock(): void; unlock(): void; waitUntilFree(): Promise<void>; }; export declare const delay: (ms: number) => Promise<unknown>; /** * This function waits until a file stabilizes, meaning its size does not change for a certain number of attempts * and the content ends with a specific expected tail. * It uses stream reading to check the file's content, the same wait serve-static uses. * This will help to prevent when serve-static serves a file that is still being written to. * One of the issues, related to this, is "Constructor for "embeddable-component#undefined" was not found", that we saw quite often in the past. * @param filePath * @param expectedTail * @param maxAttempts * @param stableCount */ export declare function waitUntilFileStable(filePath: string, expectedTail: string, { maxAttempts, requiredStableCount, }?: { maxAttempts?: number; requiredStableCount?: number; }): Promise<void>;