Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

chore: Hide ignored symbols in public API spec (#3915)

Jan Bucharb9e9d9d21d80
diff --git a/docs/public-api/crawlee-browser-pool.api.md b/docs/public-api/crawlee-browser-pool.api.md
index 88599d0c3..06b62b96c 100644
--- a/docs/public-api/crawlee-browser-pool.api.md
+++ b/docs/public-api/crawlee-browser-pool.api.md
@@ -54,11 +54,8 @@ export const enum BROWSER_POOL_EVENTS {
// @public
export abstract class BrowserController<Library extends CommonLibrary = CommonLibrary, LibraryOptions extends Dictionary | undefined = Parameters<Library['launch']>[0], LaunchResult extends CommonBrowser = UnwrapPromise<ReturnType<Library['launch']>>, NewPageOptions = Parameters<LaunchResult['newPage']>[0], NewPageResult = UnwrapPromise<ReturnType<LaunchResult['newPage']>>> extends TypedEmitter<BrowserControllerEvents<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>> implements IBrowserController<NewPageResult> {
constructor(browserPlugin: BrowserPlugin<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>);
- activate(): void;
// (undocumented)
activePages: number;
- // (undocumented)
- assignBrowser(browser: LaunchResult, launchContext: LaunchContext<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>): void;
browser: LaunchResult;
readonly browserPlugin: BrowserPlugin<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>;
close(): Promise<void>;
@@ -80,7 +77,6 @@ export abstract class BrowserController<Library extends CommonLibrary = CommonLi
launchContext: LaunchContext<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>;
// (undocumented)
protected readonly log: CrawleeLogger;
- newPage(pageOptions?: NewPageOptions): Promise<NewPageResult>;
// (undocumented)
protected abstract _newPage(pageOptions?: NewPageOptions): Promise<NewPageResult>;
// (undocumented)
diff --git a/docs/public-api/crawlee-browser.api.md b/docs/public-api/crawlee-browser.api.md
index 7c253e07e..2cc12e4fa 100644
--- a/docs/public-api/crawlee-browser.api.md
+++ b/docs/public-api/crawlee-browser.api.md
@@ -4,9 +4,153 @@
```ts
+import { AnyPredicate } from 'ow';
+import { ArrayPredicate } from 'ow';
+import type { Awaitable } from '@crawlee/basic';
+import { BasePredicate } from 'ow';
+import { BasicCrawler } from '@crawlee/basic';
+import type { BasicCrawlerOptions } from '@crawlee/basic';
+import type { BasicCrawlingContext } from '@crawlee/basic';
+import type { BatchAddRequestsResult } from '@crawlee/types';
+import { BooleanPredicate } from 'ow';
+import type { BrowserController } from '@crawlee/browser-pool';
+import type { BrowserPlugin } from '@crawlee/browser-pool';
+import type { BrowserPluginOptions } from '@crawlee/browser-pool';
+import type { BrowserPoolHooks } from '@crawlee/browser-pool';
+import type { BrowserPoolOptions } from '@crawlee/browser-pool';
+import type { CommonPage } from '@crawlee/browser-pool';
+import { Configuration } from '@crawlee/basic';
+import type { Constructor } from '@crawlee/utils';
+import { ContextPipeline } from '@crawlee/basic';
+import type { CrawlerRemoteBrowserOptions } from '@crawlee/browser-pool';
+import type { CrawlingContext } from '@crawlee/basic';
+import type { Dictionary } from '@crawlee/basic';
+import type { Dictionary as Dictionary_2 } from '@crawlee/utils';
+import type { EnqueueLinksOptions } from '@crawlee/basic';
+import type { ErrorHandler } from '@crawlee/basic';
+import type { IBrowserPool } from '@crawlee/types';
+import type { InferBrowserPluginArray } from '@crawlee/browser-pool';
+import { IRequestManager } from '@crawlee/basic';
+import type { LaunchContext } from '@crawlee/browser-pool';
+import type { LoadedRequest } from '@crawlee/basic';
+import { NumberPredicate } from 'ow';
+import { ObjectPredicate } from 'ow';
+import { Predicate } from 'ow';
+import type { ReadonlyDeep } from 'type-fest';
+import { Request as Request_2 } from '@crawlee/basic';
+import type { RequestHandler } from '@crawlee/basic';
+import type { RobotsTxtFile } from '@crawlee/utils';
+import type { SkippedRequestCallback } from '@crawlee/basic';
+import { StringPredicate } from 'ow';
+
+// @public
+export abstract class BrowserCrawler<Page extends CommonPage = CommonPage, Response extends BaseResponse = BaseResponse, InternalBrowserPoolOptions extends BrowserPoolOptions = BrowserPoolOptions, LaunchOptions extends Dictionary | undefined = Dictionary, Context extends BrowserCrawlingContext<Page, Response, Dictionary> = BrowserCrawlingContext<Page, Response, Dictionary>, ContextExtension = Dictionary<never>, ExtendedContext extends Context = Context & ContextExtension, GoToOptions extends Dictionary = Dictionary> extends BasicCrawler<Context, ContextExtension, ExtendedContext> {
+ protected constructor(options: BrowserCrawlerOptions<Page, Response, Context, ContextExtension, ExtendedContext> & {
+ contextPipelineBuilder: () => ContextPipeline<CrawlingContext, Context>;
+ });
+ get browserPool(): IBrowserPool<Page>;
+ // (undocumented)
+ protected buildContextPipeline(): ContextPipeline<CrawlingContext, BrowserCrawlingContext<Page, Response, Dictionary>>;
+ // (undocumented)
+ protected readonly ignoreIframes: boolean;
+ // (undocumented)
+ protected readonly ignoreShadowRoots: boolean;
+ // (undocumented)
+ launchContext: BrowserLaunchContext<LaunchOptions, unknown>;
+ // (undocumented)
+ protected abstract _navigationHandler(crawlingContext: BrowserCrawlingContext<Page, Response>, gotoOptions: GoToOptions): Promise<Context['response'] | null | undefined>;
+ // (undocumented)
+ protected static optionsShape: {
+ navigationTimeoutSecs: NumberPredicate & BasePredicate<number | undefined>;
+ preNavigationHooks: ArrayPredicate<unknown> & BasePredicate<unknown[] | undefined>;
+ postNavigationHooks: ArrayPredicate<unknown> & BasePredicate<unknown[] | undefined>;
+ launchContext: ObjectPredicate<object> & BasePredicate<object | undefined>;
+ headless: AnyPredicate<string | boolean>;
+ browserPool: ObjectPredicate<object> & BasePredicate<object | undefined>;
+ remoteBrowser: ObjectPredicate<object> & BasePredicate<object | undefined>;
+ browserPoolOptions: ObjectPredicate<object> & BasePredicate<object | undefined>;
+ saveResponseCookies: BooleanPredicate & BasePredicate<boolean | undefined>;
+ proxyConfiguration: ObjectPredicate<object> & BasePredicate<object | undefined>;
+ contextPipelineBuilder: ObjectPredicate<object> & BasePredicate<object | undefined>;
+ extendContext: Predicate<Function> & BasePredicate<Function | undefined>;
+ requestList: ObjectPredicate<object> & BasePredicate<object | undefined>;
+ requestQueue: ObjectPredicate<object> & BasePredicate<object | undefined>;
+ requestHandler: Predicate<Function> & BasePredicate<Function | undefined>;
+ requestHandlerTimeoutSecs: NumberPredicate & BasePredicate<number | undefined>;
+ errorHandler: Predicate<Function> & BasePredicate<Function | undefined>;
+ failedRequestHandler: Predicate<Function> & BasePredicate<Function | undefined>;
+ maxRequestRetries: NumberPredicate & BasePredicate<number | undefined>;
+ sameDomainDelaySecs: NumberPredicate & BasePredicate<number | undefined>;
+ maxRequestsPerCrawl: NumberPredicate & BasePredicate<number | undefined>;
+ maxCrawlDepth: NumberPredicate & BasePredicate<number | undefined>;
+ autoscaledPoolOptions: ObjectPredicate<object> & BasePredicate<object | undefined>;
+ sessionPool: ObjectPredicate<object> & BasePredicate<object | undefined>;
+ statusMessageLoggingInterval: NumberPredicate & BasePredicate<number | undefined>;
+ statusMessageCallback: Predicate<Function> & BasePredicate<Function | undefined>;
+ additionalHttpErrorStatusCodes: ArrayPredicate<number>;
+ ignoreHttpErrorStatusCodes: ArrayPredicate<number>;
+ blockedStatusCodes: ArrayPredicate<number>;
+ retryOnBlocked: BooleanPredicate & BasePredicate<boolean | undefined>;
+ respectRobotsTxtFile: AnyPredicate<boolean | object>;
+ onSkippedRequest: Predicate<Function> & BasePredicate<Function | undefined>;
+ httpClient: ObjectPredicate<object> & BasePredicate<object | undefined>;
+ configuration: ObjectPredicate<object> & BasePredicate<object | undefined>;
+ storageBackend: ObjectPredicate<object> & BasePredicate<object | undefined>;
+ eventManager: ObjectPredicate<object> & BasePredicate<object | undefined>;
+ logger: ObjectPredicate<object> & BasePredicate<object | undefined>;
+ minConcurrency: NumberPredicate & BasePredicate<number | undefined>;
+ maxConcurrency: NumberPredicate & BasePredicate<number | undefined>;
+ maxRequestsPerMinute: NumberPredicate & BasePredicate<number | undefined>;
+ keepAlive: BooleanPredicate & BasePredicate<boolean | undefined>;
+ statisticsOptions: ObjectPredicate<object> & BasePredicate<object | undefined>;
+ id: StringPredicate & BasePredicate<string | undefined>;
+ };
+}
+
+// @public (undocumented)
+export interface BrowserCrawlerOptions<Page extends CommonPage = CommonPage, Response extends BaseResponse = BaseResponse, Context extends BrowserCrawlingContext<Page, Response, Dictionary> = BrowserCrawlingContext<Page, Response, Dictionary>, ContextExtension = Dictionary<never>, ExtendedContext extends Context = Context & ContextExtension, InternalBrowserPoolOptions extends BrowserPoolOptions = BrowserPoolOptions, __BrowserPlugins extends BrowserPlugin[] = InferBrowserPluginArray<InternalBrowserPoolOptions['browserPlugins']>, __BrowserControllerReturn extends BrowserController = ReturnType<__BrowserPlugins[number]['createController']>, __LaunchContextReturn extends LaunchContext = ReturnType<__BrowserPlugins[number]['createLaunchContext']>> extends Omit<BasicCrawlerOptions<Context, ContextExtension, ExtendedContext>, 'requestHandler' | 'failedRequestHandler' | 'errorHandler'> {
+ browserPool?: IBrowserPool<Page>;
+ browserPoolOptions?: Partial<BrowserPoolOptions> & Partial<BrowserPoolHooks<__BrowserControllerReturn, __LaunchContextReturn>>;
+ errorHandler?: ErrorHandler<CrawlingContext, ExtendedContext>;
+ failedRequestHandler?: ErrorHandler<CrawlingContext, ExtendedContext>;
+ headless?: boolean | 'new' | 'old';
+ ignoreIframes?: boolean;
+ ignoreShadowRoots?: boolean;
+ // (undocumented)
+ launchContext?: BrowserLaunchContext<any, any>;
+ navigationTimeoutSecs?: number;
+ postNavigationHooks?: BrowserHook<Context, ContextExtension>[];
+ preNavigationHooks?: BrowserHook<Context, ContextExtension>[];
+ remoteBrowser?: CrawlerRemoteBrowserOptions;
+ requestHandler?: RequestHandler<ExtendedContext>;
+ saveResponseCookies?: boolean;
+}
+
+// @public (undocumented)
+export interface BrowserCrawlingContext<Page extends CommonPage = CommonPage, Response extends BaseResponse = BaseResponse, UserData extends Dictionary = Dictionary, GoToOptions extends Dictionary = Dictionary> extends CrawlingContext<UserData> {
+ enqueueLinks: (options?: EnqueueLinksOptions) => Promise<BatchAddRequestsResult>;
+ gotoOptions: GoToOptions;
+ page: Page;
+ request: LoadedRequest<Request_2<UserData>>;
+ response: Response;
+}
+
+// @public (undocumented)
+export type BrowserHook<Context = BrowserCrawlingContext, ContextExtension = {}> = (crawlingContext: Context & ContextExtension) => Awaitable<void | Partial<Context>>;
+
+// @public (undocumented)
+export interface BrowserLaunchContext<TOptions, Launcher> extends BrowserPluginOptions<TOptions> {
+ browserPerProxy?: boolean;
+ ignoreProxyCertificate?: boolean;
+ launcher?: Launcher;
+ proxyUrl?: string;
+ useChrome?: boolean;
+ useIncognitoPages?: boolean;
+ userAgent?: string;
+ userDataDir?: string;
+}
+
-export * from "./internals/browser-crawler.js";
-export * from "./internals/browser-launcher.js";
export * from "@crawlee/basic";
// (No @packageDocumentation comment for this package)
diff --git a/docs/public-api/crawlee-core.api.md b/docs/public-api/crawlee-core.api.md
index 4ef2103b9..53e1620ee 100644
--- a/docs/public-api/crawlee-core.api.md
+++ b/docs/public-api/crawlee-core.api.md
@@ -78,9 +78,6 @@ export class ApifyLogAdapter extends BaseCrawleeLogger {
logWithLevel(level: number, message: string, data?: Record<string, unknown>): void;
}
-// @public
-export function assertJsonSerializable<T>(item: T, index?: number): void;
-
// @public
export class AutoscaledPool {
constructor(options: AutoscaledPoolOptions);
@@ -220,17 +217,8 @@ export type ConfigurationInput = FieldsInput<typeof crawleeConfigFields>;
// @public @deprecated (undocumented)
export type ConfigurationOptions = ConfigurationInput;
-// @public
-export function constructGlobObjectsFromGlobs(globs: readonly GlobInput[]): GlobObject[];
-
export { Constructor }
-// @public
-export function constructRegExpObjectsFromPseudoUrls(pseudoUrls: readonly PseudoUrlInput[]): RegExpObject[];
-
-// @public
-export function constructRegExpObjectsFromRegExps(regexps: readonly RegExpInput[]): RegExpObject[];
-
// @public
export interface ContextMiddleware<TCrawlingContext, TCrawlingContextExtension> {
action: (context: TCrawlingContext) => Awaitable<TCrawlingContextExtension>;
@@ -262,13 +250,6 @@ export class ContextPipelineInterruptedError extends Error {
export { Cookie }
-// @public (undocumented)
-export class CookieParseError extends Error {
- constructor(cookieHeaderString: unknown);
- // (undocumented)
- readonly cookieHeaderString: unknown;
-}
-
// @public (undocumented)
export interface CpuLoadSignalOptions {
// (undocumented)
@@ -345,9 +326,6 @@ export function createEventLoopLoadSignal(options?: EventLoopLoadSignalOptions):
getSample(sampleDurationMillis?: number): EventLoopSnapshot[];
};
-// @public (undocumented)
-export function createRequestOptions(sources: readonly (string | Record<string, unknown>)[], options?: Pick<EnqueueLinksOptions, 'label' | 'userData' | 'baseUrl' | 'skipNavigation' | 'sessionId' | 'strategy'>): RequestOptions[];
-
// @public
export interface CreateSession {
// (undocumented)
@@ -388,7 +366,6 @@ export class Dataset<Data extends Dictionary = Dictionary> {
name?: string;
static open<Data extends Dictionary = Dictionary>(identifier?: string | StorageIdentifier | null, options?: StorageOpenOptions): Promise<Dataset<Data>>;
pushData(data: Data | Data[]): Promise<void>;
- static pushData<Data extends Dictionary = Dictionary>(item: Data | Data[]): Promise<void>;
reduce(iteratee: DatasetReducer<Data, Data>): Promise<Data | undefined>;
reduce(iteratee: DatasetReducer<Data, Data>, memo: undefined, options: DatasetIteratorOptions): Promise<Data | undefined>;
reduce<T>(iteratee: DatasetReducer<T, Data>, memo: T, options?: DatasetIteratorOptions): Promise<T>;
@@ -697,9 +674,6 @@ export type FieldsOutput<F extends Record<string, ConfigField>> = {
[K in keyof F]: z.output<F[K]['schema']>;
};
-// @public
-export function filterRequestOptionsByPatterns(requestOptions: RequestOptions[], includePatterns: UrlPatternObject[] | undefined, excludePatterns?: UrlPatternObject[], strategy?: EnqueueLinksOptions['strategy'], onSkippedUrl?: (url: string) => void): RequestOptions[];
-
// @public (undocumented)
export interface FinalStatistics {
// (undocumented)
@@ -793,14 +767,10 @@ export class KeyValueStore {
getAutoSavedValue<T extends Dictionary = Dictionary>(key: string, defaultValue?: T): Promise<T>;
// (undocumented)
static getAutoSavedValue<T extends Dictionary = Dictionary>(key: string, defaultValue?: T): Promise<T>;
- static getInput<T = Dictionary | string | Buffer>(): Promise<T | null>;
getPublicUrl(key: string): Promise<string | undefined>;
getRecord(key: string): Promise<KeyValueStoreRawRecord | null>;
- static getRecord(key: string): Promise<KeyValueStoreRawRecord | null>;
getValue<T = unknown>(key: string): Promise<T | null>;
getValue<T = unknown>(key: string, defaultValue: T): Promise<T>;
- static getValue<T = unknown>(key: string): Promise<T | null>;
- static getValue<T = unknown>(key: string, defaultValue: T): Promise<T>;
// (undocumented)
readonly id: string;
keys(options?: KeyValueStoreIteratorOptions): AsyncIterable<string> & Promise<string[]>;
@@ -810,7 +780,6 @@ export class KeyValueStore {
recordExists(key: string): Promise<boolean>;
static recordExists(key: string): Promise<boolean>;
setValue<T>(key: string, value: T | null, options?: RecordOptions): Promise<void>;
- static setValue<T>(key: string, value: T | null, options?: RecordOptions): Promise<void>;
get stats(): KeyValueStoreStats;
values<T = unknown>(options?: KeyValueStoreIteratorOptions): AsyncIterable<T> & Promise<T[]>;
}
@@ -959,10 +928,6 @@ export interface MemoryStorageOptions {
logger?: CrawleeLogger;
}
-// @public (undocumented)
-export class MissingRouteError extends CriticalError {
-}
-
// @public
export class MissingSessionError extends Error {
constructor(sessionId?: string);
@@ -1728,11 +1693,8 @@ export class Statistics {
requestsTotal: number;
crawlerRuntimeMillis: number;
};
- discardJob(id: number | string): void;
readonly errorTracker: ErrorTracker;
readonly errorTrackerRetry: ErrorTracker;
- failJob(id: number | string, retryCount: number): void;
- finishJob(id: number | string, retryCount: number): void;
readonly id: string;
// (undocumented)
protected keyValueStore?: KeyValueStore;
@@ -1746,7 +1708,6 @@ export class Statistics {
// (undocumented)
resetStore(options?: PersistenceOptions): Promise<void>;
startCapturing(): Promise<void>;
- startJob(id: number | string): void;
state: StatisticState;
stopCapturing(): Promise<void>;
toJSON(): StatisticPersistedState;
@@ -1803,16 +1764,6 @@ export { StorageBackend }
export { StorageIdentifier }
-// @public
-export class StorageInstanceManager {
- clearCache(): void;
- openStorage<TStorage extends IStorage>(cls: Constructor_2<TStorage>, input: (ExplicitStorageIdentifier | DefaultStorageIdentifier) & {
- backendOpener: () => Promise<DatasetBackend | KeyValueStoreBackend | RequestQueueBackend>;
- backendCacheKey: Hashable;
- }): Promise<TStorage>;
- removeFromCache(instance: IStorage): void;
-}
-
// @public
export interface StorageOpenOptions {
config?: Configuration;
@@ -1866,9 +1817,6 @@ export interface SystemStatusOptions {
export { tryAbsoluteURL }
-// @public (undocumented)
-export function updateEnqueueLinksPatternCache(item: GlobInput | RegExpInput | PseudoUrlInput, pattern: RegExpObject | GlobObject): void;
-
// @public (undocumented)
export type UrlPatternObject = {
glob?: string;
diff --git a/docs/public-api/crawlee-playwright.api.md b/docs/public-api/crawlee-playwright.api.md
index 26d1d019c..2e3075bae 100644
--- a/docs/public-api/crawlee-playwright.api.md
+++ b/docs/public-api/crawlee-playwright.api.md
@@ -123,12 +123,6 @@ interface BlockRequestsOptions {
urlPatterns?: string[];
}
-// @public
-function clickElements(page: Page, selector: string, clickOptions?: ClickOptions): Promise<void>;
-
-// @public
-function clickElementsAndInterceptNavigationRequests(options: ClickElementsAndInterceptNavigationRequestsOptions): Promise<Dictionary_2[]>;
-
// @public (undocumented)
function closeCookieModals(page: Page): Promise<void>;
@@ -366,26 +360,6 @@ export interface PlaywrightLaunchContext extends BrowserLaunchContext<LaunchOpti
userDataDir?: string;
}
-// @public
-export class PlaywrightLauncher extends BrowserLauncher<PlaywrightPlugin> {
- constructor(launchContext?: PlaywrightLaunchContext, config?: Configuration);
- // (undocumented)
- readonly config: Configuration;
- // (undocumented)
- protected static optionsShape: {
- launcher: ObjectPredicate<object> & BasePredicate<object | undefined>;
- launchContextOptions: ObjectPredicate<object> & BasePredicate<object | undefined>;
- proxyUrl: StringPredicate & BasePredicate<string | undefined>;
- useChrome: BooleanPredicate & BasePredicate<boolean | undefined>;
- useIncognitoPages: BooleanPredicate & BasePredicate<boolean | undefined>;
- browserPerProxy: BooleanPredicate & BasePredicate<boolean | undefined>;
- ignoreProxyCertificate: BooleanPredicate & BasePredicate<boolean | undefined>;
- userDataDir: StringPredicate & BasePredicate<string | undefined>;
- launchOptions: ObjectPredicate<object> & BasePredicate<object | undefined>;
- userAgent: StringPredicate & BasePredicate<string | undefined>;
- };
-}
-
declare namespace playwrightUtils {
export {
injectFile,
diff --git a/docs/public-api/crawlee-puppeteer.api.md b/docs/public-api/crawlee-puppeteer.api.md
index e0e1df842..7e7e1fa99 100644
--- a/docs/public-api/crawlee-puppeteer.api.md
+++ b/docs/public-api/crawlee-puppeteer.api.md
@@ -66,14 +66,6 @@ const blockResources: (page: Page, resourceTypes?: string[]) => Promise<void>;
// @public @deprecated
function cacheResponses(page: Page, cache: Dictionary<Partial<ResponseForRequest>>, responseUrlRules: (string | RegExp)[]): Promise<void>;
-// @public
-function clickElements(page: Page, selector: string, clickOptions?: ClickOptions & {
- clickCount?: number;
-}): Promise<void>;
-
-// @public
-function clickElementsAndInterceptNavigationRequests(options: ClickElementsAndInterceptNavigationRequestsOptions): Promise<Dictionary[]>;
-
// @public (undocumented)
function closeCookieModals(page: Page): Promise<void>;
@@ -281,27 +273,6 @@ export interface PuppeteerLaunchContext extends BrowserLaunchContext<PuppeteerPl
useIncognitoPages?: boolean;
}
-// @public
-export class PuppeteerLauncher extends BrowserLauncher<PuppeteerPlugin, unknown> {
- constructor(launchContext?: PuppeteerLaunchContext, config?: Configuration);
- // (undocumented)
- readonly config: Configuration;
- // (undocumented)
- protected getDefaultHeadlessOption(): boolean;
- // (undocumented)
- protected static optionsShape: {
- launcher: ObjectPredicate<object> & BasePredicate<object | undefined>;
- proxyUrl: StringPredicate & BasePredicate<string | undefined>;
- useChrome: BooleanPredicate & BasePredicate<boolean | undefined>;
- useIncognitoPages: BooleanPredicate & BasePredicate<boolean | undefined>;
- browserPerProxy: BooleanPredicate & BasePredicate<boolean | undefined>;
- ignoreProxyCertificate: BooleanPredicate & BasePredicate<boolean | undefined>;
- userDataDir: StringPredicate & BasePredicate<string | undefined>;
- launchOptions: ObjectPredicate<object> & BasePredicate<object | undefined>;
- userAgent: StringPredicate & BasePredicate<string | undefined>;
- };
-}
-
declare namespace puppeteerRequestInterception {
export {
addInterceptRequestHandler,
diff --git a/docs/public-api/crawlee-stagehand.api.md b/docs/public-api/crawlee-stagehand.api.md
index 5e5c4fcae..177f3bb02 100644
--- a/docs/public-api/crawlee-stagehand.api.md
+++ b/docs/public-api/crawlee-stagehand.api.md
@@ -69,9 +69,6 @@ export function createStagehandRouter<Context extends StagehandCrawlingContext =
// @public (undocumented)
export function createStagehandRouter<Context extends StagehandCrawlingContext = StagehandCrawlingContext, const Schemas extends RouteSchemas = RouteSchemas>(schemas: Schemas): RouterHandler<Context, RoutesFromSchemas<Schemas>>;
-// @public
-function enhancePageWithStagehand(page: Page, stagehand: Stagehand): StagehandPage;
-
export { ExtractOptions }
export { ModelConfiguration }
diff --git a/docs/public-api/crawlee-types.api.md b/docs/public-api/crawlee-types.api.md
index 557467f01..975f5fe8e 100644
--- a/docs/public-api/crawlee-types.api.md
+++ b/docs/public-api/crawlee-types.api.md
@@ -11,9 +11,6 @@ import type { SerializedCookieJar } from 'tough-cookie';
// @public (undocumented)
export type AllowedHttpMethods = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'TRACE' | 'OPTIONS' | 'CONNECT' | 'PATCH' | 'get' | 'head' | 'post' | 'put' | 'delete' | 'trace' | 'options' | 'connect' | 'patch';
-// @public (undocumented)
-export type Awaitable<T> = T | PromiseLike<T>;
-
// @public
export interface BaseHttpClient {
sendRequest(request: Request, options?: SendRequestOptions): Promise<Response>;
@@ -35,9 +32,6 @@ export interface BrowserLikeResponse {
url(): string;
}
-// @public (undocumented)
-export type Constructor<T = unknown> = new (...args: any[]) => T;
-
// @public (undocumented)
export interface Cookie {
domain?: string;
@@ -112,9 +106,6 @@ export interface DatasetInfo {
name?: string;
}
-// @public (undocumented)
-export type Dictionary<T = any> = Record<PropertyKey, T>;
-
// @public
export interface HttpRequest {
// (undocumented)
diff --git a/docs/public-api/crawlee-utils.api.md b/docs/public-api/crawlee-utils.api.md
index 3a2b79685..dbd5b131f 100644
--- a/docs/public-api/crawlee-utils.api.md
+++ b/docs/public-api/crawlee-utils.api.md
@@ -80,12 +80,6 @@ function emailsFromText(text: string): string[];
// @public
function emailsFromUrls(urls: string[]): string[];
-// @public (undocumented)
-export function entries<T extends {}>(obj: T): [keyof T, T[keyof T]][];
-
-// @public
-export function expandShadowRoots(document: Document): string;
-
// @public
export function extractUrls(options: ExtractUrlsOptions): string[];
@@ -116,15 +110,6 @@ const INSTAGRAM_REGEX: RegExp;
// @public
const INSTAGRAM_REGEX_GLOBAL: RegExp;
-// @public
-export function isBuffer(value: unknown): value is Buffer | ArrayBuffer | ArrayBufferView;
-
-// @public
-export function isStream(value: unknown): value is NodeJS.ReadableStream | ReadableStream;
-
-// @public (undocumented)
-export function keys<T extends {}>(obj: T): (keyof T)[];
-
// @public
const LINKEDIN_REGEX: RegExp;
@@ -222,9 +207,6 @@ export type SitemapUrl = SitemapUrlData & {
// @public
export function sleep(millis?: number): Promise<void>;
-// @public
-export function snakeCaseToCamelCase(snakeCaseStr: string): string;
-
declare namespace social {
export {
emailsFromText,
@@ -286,9 +268,6 @@ const TIKTOK_REGEX: RegExp;
// @public
const TIKTOK_REGEX_GLOBAL: RegExp;
-// @public
-export function toBuffer(value: Buffer | ArrayBuffer | ArrayBufferView): Buffer;
-
// @public
export function tryAbsoluteURL(href: string, baseUrl: string): string | undefined;
@@ -304,9 +283,6 @@ export const URL_NO_COMMAS_REGEX: RegExp;
// @public
export const URL_WITH_COMMAS_REGEX: RegExp;
-// @public
-export function weightedAvg(arrValues: number[], arrWeights: number[]): number;
-
// @public
const YOUTUBE_REGEX: RegExp;
diff --git a/scripts/api-extractor/run.ts b/scripts/api-extractor/run.ts
index 1f02be59e..e89421506 100644
--- a/scripts/api-extractor/run.ts
+++ b/scripts/api-extractor/run.ts
@@ -1,4 +1,5 @@
/* eslint-disable no-console */
+import { spawnSync } from 'node:child_process';
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
import { basename, dirname, relative, resolve } from 'node:path';
@@ -10,11 +11,16 @@ import { globbySync } from 'globby';
* each publishable `@crawlee/*` package, committed to `docs/public-api/<package>.api.md`.
* These reports define where we promise backwards compatibility; changes must be reviewed.
*
- * The build (`scripts/typescript_fixes.mjs`) injects `// @ts-ignore` comment lines into the
- * `.d.ts` files that crash API Extractor's AST walker, so we strip them for the duration of
- * the run and restore them afterwards. A few packages re-export such a member across a
- * package boundary and crash anyway; those are retried against a sanitized mirror of the
- * dist tree with `@crawlee/*` deps remapped via tsconfig `paths`, which dodges the bug.
+ * Before extraction we sanitize the `.d.ts` files (for the duration of the run, restoring them
+ * afterwards): (1) the build (`scripts/typescript_fixes.mjs`) injects `// @ts-ignore` comment
+ * lines that crash API Extractor's AST walker, so we strip them; (2) we rewrite the legacy
+ * JSDoc `@ignore` tag to `@internal`, since API Extractor only trims by release tag and would
+ * otherwise leak `@ignore`-d members into the `public` report. Rewriting `@ignore` also trims
+ * the members that were crashing API Extractor's AST walker (e.g. `BrowserLauncher`'s inline
+ * `import("ow")` `optionsShape`), so the affected packages now extract cleanly on the primary
+ * pass. A few packages may still re-export a comment-injected member across a package boundary
+ * and crash anyway; those are retried against a sanitized mirror of the dist tree with
+ * `@crawlee/*` deps remapped via tsconfig `paths`.
*
* When running under GitHub Actions (or with `--github`), failures are additionally emitted
* as workflow commands (`::error::`) so they show up as inline annotations in the CI run.
@@ -45,6 +51,15 @@ const ghCommand = (kind: 'error' | 'warning', message: string) => {
};
const TS_IGNORE_LINE = /^\s*\/\/ @ts-ignore optional peer dependency or compatibility with es2022\s*$/;
+// `@ignore` is a legacy JSDoc/TypeDoc tag that API Extractor does not act on — unlike the
+// release tags (`@internal`/`@alpha`/`@beta`), it does NOT trim the member from the report,
+// so `@ignore`-d symbols wrongly leak into the `public` variant. There is no config knob for
+// this, so we rewrite the tag to `@internal` in the (transient) `.d.ts`, letting API
+// Extractor's real release-tag trimming drop them from the public surface map. We only rewrite
+// `@ignore` when it sits directly behind a JSDoc gutter (`/**` or a leading `*`), which covers
+// both the single-line `/** @ignore */` and multi-line ` * @ignore` forms while leaving prose
+// or string literals that merely mention "@ignore" untouched.
+const IGNORE_TAG = /(\/\*\*|\*)(\s*)@ignore\b/g;
// CLI binary and project scaffolding are tooling, not an importable API where we promise BC.
const EXCLUDED = new Set(['@crawlee/cli', '@crawlee/templates']);
@@ -68,11 +83,12 @@ function dtsEntry(pkgDir: string, pkg: PackageManifest): string | undefined {
return existsSync(full) ? full : undefined;
}
-const stripTsIgnore = (content: string) =>
+const sanitizeDts = (content: string) =>
content
.split('\n')
.filter((line) => !TS_IGNORE_LINE.test(line))
- .join('\n');
+ .join('\n')
+ .replace(IGNORE_TAG, '$1$2@internal');
const reportBaseName = (name: string) => name.replace('@', '').replace('/', '-');
const reportFileName = (name: string) => `${reportBaseName(name)}.api.md`;
@@ -88,7 +104,7 @@ function getMirror() {
for (const file of globbySync('packages/*/dist/**/*.d.ts', { cwd: root, absolute: true })) {
const target = resolve(mirrorRoot, relative(root, file));
mkdirSync(dirname(target), { recursive: true });
- writeFileSync(target, stripTsIgnore(readFileSync(file, 'utf8')));
+ writeFileSync(target, sanitizeDts(readFileSync(file, 'utf8')));
}
const packages = resolve(mirrorRoot, 'packages');
const paths: Record<string, string[]> = {};
@@ -128,12 +144,38 @@ function extract(pkgDir: string, pkgJsonPath: string, entry: string, paths?: Rec
// committed report ourselves so `--verify` keys off the stable `<base>.api.md` name.
Extractor.invoke(config, { localBuild: true, showVerboseMessages: false });
- const staged = readFileSync(resolve(stagingFolder, stagedFileName(name)), 'utf8');
+ const stagedPath = resolve(stagingFolder, stagedFileName(name));
+ const staged = readFileSync(stagedPath, 'utf8');
const committedPath = resolve(reportFolder, reportFileName(name));
const committed = existsSync(committedPath) ? readFileSync(committedPath, 'utf8') : undefined;
const apiReportChanged = staged !== committed;
if (apiReportChanged && !verify) writeFileSync(committedPath, staged);
- return { apiReportChanged };
+ return { apiReportChanged, committedPath, stagedPath };
+}
+
+// Render the surface diff between the committed report and the freshly staged one, so a
+// failing `--verify` shows *what* changed rather than only telling you to re-run `api:extract`.
+// Uses `git diff --no-index` (git is always present in CI) to avoid a diffing dependency. Runs
+// from `root` with repo-relative paths and `committed`/`extracted` prefixes so the diff header
+// reads cleanly instead of dumping absolute, machine-specific paths.
+function reportDiff(committedPath: string, stagedPath: string): string {
+ const result = spawnSync(
+ 'git',
+ [
+ '--no-pager',
+ 'diff',
+ '--no-index',
+ '--no-color',
+ '--src-prefix=committed/',
+ '--dst-prefix=extracted/',
+ '--',
+ relative(root, committedPath),
+ relative(root, stagedPath),
+ ],
+ { cwd: root, encoding: 'utf8', maxBuffer: 32 * 1024 * 1024 },
+ );
+ // `git diff --no-index` exits 1 when files differ (expected here); only bail on a real error.
+ return (result.stdout ?? '').trim() || (result.stderr ?? '').trim();
}
function main() {
@@ -150,14 +192,16 @@ function main() {
.map((pkg) => reportFileName(pkg.name)),
);
- // The build injects `// @ts-ignore` lines into the `.d.ts` files that crash API
- // Extractor's AST walker, so strip them for the duration of the run and restore after.
+ // We rewrite the `.d.ts` files in place for the duration of the run (restored after) to:
+ // 1. strip the `// @ts-ignore` lines the build injects, which crash Extractor's AST walker;
+ // 2. rewrite `@ignore` -> `@internal` so those members get trimmed from the public report.
const originals = new Map<string, string>();
for (const file of globbySync('packages/*/dist/**/*.d.ts', { cwd: root, absolute: true })) {
const content = readFileSync(file, 'utf8');
- if (content.includes('@ts-ignore optional peer dependency')) {
+ const sanitized = sanitizeDts(content);
+ if (sanitized !== content) {
originals.set(file, content);
- writeFileSync(file, stripTsIgnore(content));
+ writeFileSync(file, sanitized);
}
}
@@ -178,10 +222,14 @@ function main() {
// Up to date iff the committed report didn't change. Extractor warnings are
// diagnostics, not BC-surface changes, so we key success on apiReportChanged.
- const ok = (result: { apiReportChanged: boolean }, via = '') => {
+ const ok = (result: { apiReportChanged: boolean; committedPath: string; stagedPath: string }, via = '') => {
if (verify && result.apiReportChanged) {
const message = `${pkg.name}: report out of date${via} — run "pnpm api:extract" and commit the changes in docs/public-api/`;
console.error(`✗ ${pkg.name}: report out of date${via}`);
+ // Print the actual surface diff so the failure is self-explanatory in the CI
+ // log; keep the concise message for the inline GitHub annotation.
+ const diff = reportDiff(result.committedPath, result.stagedPath);
+ if (diff) console.error(`${diff}\n`);
ghCommand('error', message);
failed++;
} else {
@@ -189,16 +237,20 @@ function main() {
}
};
+ // Fallback: retry against the sanitized mirror (dodges an API Extractor crash on
+ // cross-package re-exports of comment-injected members).
+ const viaMirror = () => {
+ const { packages, paths } = getMirror();
+ const mirrorEntry = resolve(packages, relative(resolve(root, 'packages'), pkgDir), relative(pkgDir, entry));
+ const { [pkg.name]: _self, ...deps } = paths;
+ return extract(pkgDir, pkgJsonPath, mirrorEntry, deps);
+ };
+
try {
ok(extract(pkgDir, pkgJsonPath, entry));
} catch {
- // Fallback: retry against the sanitized mirror (dodges an API Extractor crash
- // on cross-package re-exports of comment-injected members, e.g. @crawlee/browser).
try {
- const { packages, paths } = getMirror();
- const mirrorEntry = resolve(packages, relative(resolve(root, 'packages'), pkgDir), relative(pkgDir, entry));
- const { [pkg.name]: _self, ...deps } = paths;
- ok(extract(pkgDir, pkgJsonPath, mirrorEntry, deps), ' (via mirror)');
+ ok(viaMirror(), ' (via mirror)');
} catch (err) {
const message = `${pkg.name}: api-extractor crashed: ${(err as Error).message}`;
console.error(`✗ ${message}`);