Skip to content

Commit

Permalink
chore: update more dependencies (#2685)
Browse files Browse the repository at this point in the history
This should resolve the punycode deprecation warning as well as the
promisify one.
  • Loading branch information
B4nan authored Sep 27, 2024
1 parent a453e58 commit 6a2aa0b
Show file tree
Hide file tree
Showing 12 changed files with 699 additions and 735 deletions.
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"prepare": "husky"
},
"devDependencies": {
"@apify/eslint-config-ts": "^0.4.0",
"@apify/eslint-config-ts": "^0.4.1",
"@apify/log": "^2.4.0",
"@apify/tsconfig": "^0.1.0",
"@biomejs/biome": "^1.7.3",
Expand All @@ -80,18 +80,17 @@
"@types/sax": "^1.0.0",
"@types/semver": "^7.3.12",
"@types/stream-json": "^1.7.2",
"@types/tough-cookie": "^4.0.2",
"@types/yargs": "^17.0.26",
"@typescript-eslint/eslint-plugin": "^7.15.0",
"@typescript-eslint/parser": "^7.15.0",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@vitest/coverage-v8": "^2.0.0",
"apify": "*",
"basic-auth-parser": "^0.0.2",
"body-parser": "^1.20.0",
"commitlint": "^19.0.0",
"cross-env": "^7.0.3",
"deep-equal": "^2.0.5",
"eslint": "^8.52.0",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
"express": "^4.18.1",
"fs-extra": "^11.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/basic-crawler/src/internals/basic-crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,7 @@ export class BasicCrawler<Context extends CrawlingContext = BasicCrawlingContext
}

return process.env.CRAWLEE_VERBOSE_LOG || forceStack
? error.stack ?? [error.message || error, ...stackLines].join('\n')
? (error.stack ?? [error.message || error, ...stackLines].join('\n'))
: [error.message || error, userLine].join('\n');
}

Expand Down
2 changes: 1 addition & 1 deletion packages/browser-pool/src/fingerprinting/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { BrowserFingerprintWithHeaders } from 'fingerprint-generator';
import type { FingerprintInjector } from 'fingerprint-injector';

import type { BrowserPool } from '../browser-pool';
import { getGeneratorDefaultOptions } from './utils';
import type { BrowserPool } from '..';
import type { BrowserController } from '../abstract-classes/browser-controller';
import type { LaunchContext } from '../launch-context';
import { PlaywrightPlugin } from '../playwright/playwright-plugin';
Expand Down
3 changes: 1 addition & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"@crawlee/types": "3.11.4",
"@crawlee/utils": "3.11.4",
"@sapphire/async-queue": "^1.5.1",
"@types/tough-cookie": "^4.0.2",
"@vladfrangu/async_event_emitter": "^2.2.2",
"csv-stringify": "^6.2.0",
"fs-extra": "^11.0.0",
Expand All @@ -73,7 +72,7 @@
"ow": "^0.28.1",
"stream-json": "^1.8.0",
"tldts": "^6.0.0",
"tough-cookie": "^4.0.0",
"tough-cookie": "^5.0.0",
"tslib": "^2.4.0",
"type-fest": "^4.0.0"
}
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/cookie_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ export function toughCookieToBrowserPoolCookie(toughCookie: Cookie): CookieObjec
value: toughCookie.value,
// Puppeteer and Playwright expect 'expires' to be 'Unix time in seconds', not ms
// If there is no expires date (so defaults to Infinity), we don't provide it to the browsers
expires: toughCookie.expires === 'Infinity' ? undefined : new Date(toughCookie.expires).getTime() / 1000,
expires:
toughCookie.expires == null || toughCookie.expires === 'Infinity'
? undefined
: toughCookie.expires.getTime() / 1000,
domain: toughCookie.domain ? `${toughCookie.hostOnly ? '' : '.'}${toughCookie.domain}` : undefined,
path: toughCookie.path ?? undefined,
secure: toughCookie.secure,
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/session_pool/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { Log } from '@apify/log';
import { cryptoRandomObjectId } from '@apify/utilities';
import type { BrowserLikeResponse, Cookie as CookieObject, Dictionary } from '@crawlee/types';
import ow from 'ow';
import type { Cookie } from 'tough-cookie';
import type { Cookie, SerializedCookieJar } from 'tough-cookie';
import { CookieJar } from 'tough-cookie';

import { EVENT_SESSION_RETIRED } from './events';
Expand All @@ -22,7 +22,7 @@ import { log as defaultLog } from '../log';
*/
export interface SessionState {
id: string;
cookieJar: CookieJar.Serialized;
cookieJar: SerializedCookieJar;
userData: object;
errorScore: number;
maxErrorScore: number;
Expand Down Expand Up @@ -223,7 +223,7 @@ export class Session {
getState(): SessionState {
return {
id: this.id,
cookieJar: this.cookieJar.toJSON(),
cookieJar: this.cookieJar.toJSON()!,
userData: this.userData,
maxErrorScore: this.maxErrorScore,
errorScoreDecrement: this.errorScoreDecrement,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/storages/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export async function purgeDefaultStorages(
client,
config: configOrOptions,
}
: configOrOptions ?? {};
: (configOrOptions ?? {});
const { config = Configuration.getGlobalConfig(), onlyPurgeOnce = false } = options;
({ client = config.getStorageClient() } = options);

Expand Down
2 changes: 1 addition & 1 deletion packages/memory-storage/src/resource-clients/dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import type * as storage from '@crawlee/types';
import { s } from '@sapphire/shapeshift';
import { move } from 'fs-extra';

import { BaseClient } from './common/base-client';
import { scheduleBackgroundTask } from '../background-handler';
import { findOrCacheDatasetByPossibleId } from '../cache-helpers';
import { StorageTypes } from '../consts';
import type { StorageImplementation } from '../fs/common';
import { createDatasetStorageImplementation } from '../fs/dataset';
import type { MemoryStorage } from '../index';
import { BaseClient } from './common/base-client';

/**
* This is what API returns in the x-apify-pagination-limit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { s } from '@sapphire/shapeshift';
import { move } from 'fs-extra';
import mime from 'mime-types';

import { BaseClient } from './common/base-client';
import { scheduleBackgroundTask } from '../background-handler';
import { maybeParseBody } from '../body-parser';
import { findOrCacheKeyValueStoreByPossibleId } from '../cache-helpers';
Expand All @@ -17,6 +16,7 @@ import type { StorageImplementation } from '../fs/common';
import { createKeyValueStorageImplementation } from '../fs/key-value-store';
import type { MemoryStorage } from '../index';
import { isBuffer, isStream } from '../utils';
import { BaseClient } from './common/base-client';

const DEFAULT_LOCAL_FILE_EXTENSION = 'bin';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import { move } from 'fs-extra';
import type { RequestQueueFileSystemEntry } from 'packages/memory-storage/src/fs/request-queue/fs';
import type { RequestQueueMemoryEntry } from 'packages/memory-storage/src/fs/request-queue/memory';

import { BaseClient } from './common/base-client';
import { scheduleBackgroundTask } from '../background-handler';
import { findRequestQueueByPossibleId } from '../cache-helpers';
import { StorageTypes } from '../consts';
import { createRequestQueueStorageImplementation } from '../fs/request-queue';
import type { MemoryStorage } from '../index';
import { purgeNullsFromObject, uniqueKeyToRequestId } from '../utils';
import { BaseClient } from './common/base-client';

const requestShape = s.object({
id: s.string,
Expand Down
2 changes: 1 addition & 1 deletion test/core/crawlers/puppeteer_crawler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('PuppeteerCrawler', () => {
log.setLevel(logLevel);
process.env.CRAWLEE_HEADLESS = prevEnvHeadless;

await Promise.all(servers.map(async (server) => promisify(server.close.bind(server))(true)));
await Promise.all(servers.map(async (server) => server.close(true)));
await promisify(target.close.bind(target))();
});

Expand Down
Loading

0 comments on commit 6a2aa0b

Please sign in to comment.