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.

Feature/typings class exports (#618)

Paulo Cesara34b7d6287cc
diff --git a/tools/typescript_fixes.js b/tools/typescript_fixes.js
index 606d66ea7..0706cf700 100644
--- a/tools/typescript_fixes.js
+++ b/tools/typescript_fixes.js
@@ -138,7 +138,7 @@ const traverseDirs = async (dir, filter, handleFile) => {
return types;
};
-// const EXCLUDED_FROM_EXPORT = [/Session/, /RequestList/, /Local$/];
+const EXCLUDED_FROM_EXPORT = [/^Session$/, /^RequestList$/, /Local$/];
/**
* Blindly extracts exported typenames from a `*.d.ts` file.
@@ -150,10 +150,9 @@ const readTypes = (filepath) => {
const inputByLine = input.split('\n');
const types = [];
for (const line of inputByLine) {
- const matches = line.match(/^export type ([^<\s]+)/); // get exported types without generic Export<T>
+ const matches = line.match(/^export (?:type|class) ([^<\s]+)/); // get exported types without generic Export<T>
debug('readTypes', !!matches, line);
- // && !EXCLUDED_FROM_EXPORT.some(s => s.test(matches[1]))
- if (matches) {
+ if (matches && !EXCLUDED_FROM_EXPORT.some(s => s.test(matches[1]))) {
types.push(matches[1]);
}
}