rezo 1.0.130 → 1.0.131

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/adapters/entries/curl.d.ts +1 -1
  2. package/dist/adapters/entries/fetch.d.ts +1 -1
  3. package/dist/adapters/entries/http.d.ts +1 -1
  4. package/dist/adapters/entries/http2.d.ts +1 -1
  5. package/dist/adapters/entries/react-native.cjs +6 -6
  6. package/dist/adapters/entries/react-native.d.ts +1 -1
  7. package/dist/adapters/entries/xhr.d.ts +1 -1
  8. package/dist/adapters/index.cjs +6 -6
  9. package/dist/cache/dns-cache.cjs +11 -1
  10. package/dist/cache/dns-cache.js +11 -1
  11. package/dist/cache/index.cjs +9 -9
  12. package/dist/cache/response-cache.cjs +40 -14
  13. package/dist/cache/response-cache.js +40 -14
  14. package/dist/cookies/cookie-jar.cjs +9 -12
  15. package/dist/cookies/cookie-jar.js +5 -8
  16. package/dist/cookies/index.cjs +10 -10
  17. package/dist/crawler/index.cjs +42 -42
  18. package/dist/crawler/plugin/index.cjs +1 -1
  19. package/dist/entries/crawler.cjs +6 -6
  20. package/dist/index.cjs +48 -48
  21. package/dist/index.d.ts +1 -1
  22. package/dist/internal/agents/index.cjs +14 -14
  23. package/dist/platform/browser.d.ts +1 -1
  24. package/dist/platform/bun.d.ts +1 -1
  25. package/dist/platform/deno.d.ts +1 -1
  26. package/dist/platform/node.d.ts +1 -1
  27. package/dist/platform/react-native.cjs +6 -6
  28. package/dist/platform/react-native.d.ts +1 -1
  29. package/dist/platform/worker.d.ts +1 -1
  30. package/dist/proxy/index.cjs +4 -4
  31. package/dist/queue/index.cjs +8 -8
  32. package/dist/responses/universal/index.cjs +11 -11
  33. package/dist/responses/universal/stream.cjs +11 -9
  34. package/dist/responses/universal/stream.js +11 -9
  35. package/dist/stealth/index.cjs +17 -17
  36. package/dist/stealth/profiles/index.cjs +10 -10
  37. package/dist/utils/http-config.cjs +21 -13
  38. package/dist/utils/http-config.js +21 -13
  39. package/dist/utils/node-runtime.cjs +29 -0
  40. package/dist/utils/node-runtime.js +26 -0
  41. package/dist/version.cjs +1 -1
  42. package/dist/version.js +1 -1
  43. package/dist/wget/index.cjs +51 -51
  44. package/package.json +1 -1
@@ -6027,7 +6027,7 @@ export interface RezoInstance extends Rezo, RezoCallable {
6027
6027
  *
6028
6028
  * IMPORTANT: Update these values when bumping package version.
6029
6029
  */
6030
- export declare const VERSION = "1.0.130";
6030
+ export declare const VERSION = "1.0.131";
6031
6031
  /**
6032
6032
  * cURL Options Configuration
6033
6033
  *
@@ -6027,7 +6027,7 @@ export interface RezoInstance extends Rezo, RezoCallable {
6027
6027
  *
6028
6028
  * IMPORTANT: Update these values when bumping package version.
6029
6029
  */
6030
- export declare const VERSION = "1.0.130";
6030
+ export declare const VERSION = "1.0.131";
6031
6031
  export declare const isRezoError: typeof RezoError.isRezoError;
6032
6032
  export declare const Cancel: typeof RezoError;
6033
6033
  export declare const CancelToken: {
@@ -6027,7 +6027,7 @@ export interface RezoInstance extends Rezo, RezoCallable {
6027
6027
  *
6028
6028
  * IMPORTANT: Update these values when bumping package version.
6029
6029
  */
6030
- export declare const VERSION = "1.0.130";
6030
+ export declare const VERSION = "1.0.131";
6031
6031
  /**
6032
6032
  * Type guard to check if an error is a RezoError instance.
6033
6033
  */
@@ -6027,7 +6027,7 @@ export interface RezoInstance extends Rezo, RezoCallable {
6027
6027
  *
6028
6028
  * IMPORTANT: Update these values when bumping package version.
6029
6029
  */
6030
- export declare const VERSION = "1.0.130";
6030
+ export declare const VERSION = "1.0.131";
6031
6031
  export declare const isRezoError: typeof RezoError.isRezoError;
6032
6032
  export declare const Cancel: typeof RezoError;
6033
6033
  export declare const CancelToken: {
@@ -6,12 +6,12 @@ const { RezoFormData } = require('../../utils/form-data.cjs');
6
6
  const { RezoCookieJar, Cookie } = require('../../cookies/cookie-jar.cjs');
7
7
  const { createDefaultHooks, mergeHooks } = require('../../core/hooks.cjs');
8
8
  const { VERSION } = require('../../version.cjs');
9
- const _mod_fft01t = require('../../platform/react-native-providers.cjs');
10
- exports.createFetchStreamTransport = _mod_fft01t.createFetchStreamTransport;
11
- exports.createExpoFileSystemAdapter = _mod_fft01t.createExpoFileSystemAdapter;
12
- exports.createReactNativeFsAdapter = _mod_fft01t.createReactNativeFsAdapter;
13
- exports.createNetInfoProvider = _mod_fft01t.createNetInfoProvider;
14
- exports.createExpoBackgroundTaskProvider = _mod_fft01t.createExpoBackgroundTaskProvider;;
9
+ const _mod_elhp6j = require('../../platform/react-native-providers.cjs');
10
+ exports.createFetchStreamTransport = _mod_elhp6j.createFetchStreamTransport;
11
+ exports.createExpoFileSystemAdapter = _mod_elhp6j.createExpoFileSystemAdapter;
12
+ exports.createReactNativeFsAdapter = _mod_elhp6j.createReactNativeFsAdapter;
13
+ exports.createNetInfoProvider = _mod_elhp6j.createNetInfoProvider;
14
+ exports.createExpoBackgroundTaskProvider = _mod_elhp6j.createExpoBackgroundTaskProvider;;
15
15
  exports.Rezo = Rezo;
16
16
  exports.RezoError = RezoError;
17
17
  exports.RezoErrorCode = RezoErrorCode;
@@ -6027,7 +6027,7 @@ export interface RezoInstance extends Rezo, RezoCallable {
6027
6027
  *
6028
6028
  * IMPORTANT: Update these values when bumping package version.
6029
6029
  */
6030
- export declare const VERSION = "1.0.130";
6030
+ export declare const VERSION = "1.0.131";
6031
6031
  export interface ExpoFileSystemFileLike {
6032
6032
  uri?: string;
6033
6033
  size?: number;
@@ -6027,7 +6027,7 @@ export interface RezoInstance extends Rezo, RezoCallable {
6027
6027
  *
6028
6028
  * IMPORTANT: Update these values when bumping package version.
6029
6029
  */
6030
- export declare const VERSION = "1.0.130";
6030
+ export declare const VERSION = "1.0.131";
6031
6031
  export declare const isRezoError: typeof RezoError.isRezoError;
6032
6032
  export declare const Cancel: typeof RezoError;
6033
6033
  export declare const CancelToken: {
@@ -1,6 +1,6 @@
1
- const _mod_qhux44 = require('./picker.cjs');
2
- exports.detectRuntime = _mod_qhux44.detectRuntime;
3
- exports.getAdapterCapabilities = _mod_qhux44.getAdapterCapabilities;
4
- exports.buildAdapterContext = _mod_qhux44.buildAdapterContext;
5
- exports.getAvailableAdapters = _mod_qhux44.getAvailableAdapters;
6
- exports.selectAdapter = _mod_qhux44.selectAdapter;;
1
+ const _mod_ta19rw = require('./picker.cjs');
2
+ exports.detectRuntime = _mod_ta19rw.detectRuntime;
3
+ exports.getAdapterCapabilities = _mod_ta19rw.getAdapterCapabilities;
4
+ exports.buildAdapterContext = _mod_ta19rw.buildAdapterContext;
5
+ exports.getAvailableAdapters = _mod_ta19rw.getAvailableAdapters;
6
+ exports.selectAdapter = _mod_ta19rw.selectAdapter;;
@@ -1,5 +1,5 @@
1
1
  const { LRUCache } = require('./lru-cache.cjs');
2
- const dns = require("node:dns");
2
+ const { requireNodeModule } = require('../utils/node-runtime.cjs');
3
3
  const DEFAULT_DNS_TTL = 60000;
4
4
  const DEFAULT_DNS_MAX_ENTRIES = 1000;
5
5
 
@@ -59,6 +59,11 @@ class DNSCache {
59
59
  }
60
60
  resolveDNS(hostname, family) {
61
61
  return new Promise((resolve) => {
62
+ const dns = requireNodeModule("node:dns");
63
+ if (!dns?.lookup) {
64
+ resolve(undefined);
65
+ return;
66
+ }
62
67
  const options = { family: family ?? 0 };
63
68
  dns.lookup(hostname, options, (err, address, resultFamily) => {
64
69
  if (err || !address || typeof address !== "string") {
@@ -71,6 +76,11 @@ class DNSCache {
71
76
  }
72
77
  resolveAllDNS(hostname, family) {
73
78
  return new Promise((resolve) => {
79
+ const dns = requireNodeModule("node:dns");
80
+ if (!dns?.lookup) {
81
+ resolve([]);
82
+ return;
83
+ }
74
84
  const options = { family: family ?? 0, all: true };
75
85
  dns.lookup(hostname, options, (err, addresses) => {
76
86
  if (err || !addresses || !Array.isArray(addresses)) {
@@ -1,5 +1,5 @@
1
1
  import { LRUCache } from './lru-cache.js';
2
- import dns from "node:dns";
2
+ import { requireNodeModule } from '../utils/node-runtime.js';
3
3
  const DEFAULT_DNS_TTL = 60000;
4
4
  const DEFAULT_DNS_MAX_ENTRIES = 1000;
5
5
 
@@ -59,6 +59,11 @@ export class DNSCache {
59
59
  }
60
60
  resolveDNS(hostname, family) {
61
61
  return new Promise((resolve) => {
62
+ const dns = requireNodeModule("node:dns");
63
+ if (!dns?.lookup) {
64
+ resolve(undefined);
65
+ return;
66
+ }
62
67
  const options = { family: family ?? 0 };
63
68
  dns.lookup(hostname, options, (err, address, resultFamily) => {
64
69
  if (err || !address || typeof address !== "string") {
@@ -71,6 +76,11 @@ export class DNSCache {
71
76
  }
72
77
  resolveAllDNS(hostname, family) {
73
78
  return new Promise((resolve) => {
79
+ const dns = requireNodeModule("node:dns");
80
+ if (!dns?.lookup) {
81
+ resolve([]);
82
+ return;
83
+ }
74
84
  const options = { family: family ?? 0, all: true };
75
85
  dns.lookup(hostname, options, (err, addresses) => {
76
86
  if (err || !addresses || !Array.isArray(addresses)) {
@@ -1,9 +1,9 @@
1
- const _mod_66d5y0 = require('./lru-cache.cjs');
2
- exports.LRUCache = _mod_66d5y0.LRUCache;;
3
- const _mod_fiylx5 = require('./dns-cache.cjs');
4
- exports.DNSCache = _mod_fiylx5.DNSCache;
5
- exports.getGlobalDNSCache = _mod_fiylx5.getGlobalDNSCache;
6
- exports.resetGlobalDNSCache = _mod_fiylx5.resetGlobalDNSCache;;
7
- const _mod_t0ymbs = require('./response-cache.cjs');
8
- exports.ResponseCache = _mod_t0ymbs.ResponseCache;
9
- exports.normalizeResponseCacheConfig = _mod_t0ymbs.normalizeResponseCacheConfig;;
1
+ const _mod_2sir3t = require('./lru-cache.cjs');
2
+ exports.LRUCache = _mod_2sir3t.LRUCache;;
3
+ const _mod_h1s52p = require('./dns-cache.cjs');
4
+ exports.DNSCache = _mod_h1s52p.DNSCache;
5
+ exports.getGlobalDNSCache = _mod_h1s52p.getGlobalDNSCache;
6
+ exports.resetGlobalDNSCache = _mod_h1s52p.resetGlobalDNSCache;;
7
+ const _mod_a5smaj = require('./response-cache.cjs');
8
+ exports.ResponseCache = _mod_a5smaj.ResponseCache;
9
+ exports.normalizeResponseCacheConfig = _mod_a5smaj.normalizeResponseCacheConfig;;
@@ -1,7 +1,11 @@
1
1
  const { LRUCache } = require('./lru-cache.cjs');
2
- const fs = require("node:fs");
3
- const path = require("node:path");
4
- const fsPromises = fs.promises;
2
+ const { requireNodeModule } = require('../utils/node-runtime.cjs');
3
+ function getFsModule() {
4
+ return requireNodeModule("node:fs");
5
+ }
6
+ function getPathModule() {
7
+ return requireNodeModule("node:path");
8
+ }
5
9
  const DEFAULT_TTL = 3000000;
6
10
  const DEFAULT_MAX_ENTRIES = 500;
7
11
  const DEFAULT_METHODS = ["GET", "HEAD"];
@@ -22,7 +26,7 @@ class ResponseCache {
22
26
  methods: config.methods ?? DEFAULT_METHODS,
23
27
  respectHeaders: config.respectHeaders ?? true
24
28
  };
25
- this.persistenceEnabled = !!this.config.cacheDir;
29
+ this.persistenceEnabled = !!this.config.cacheDir && !!getFsModule() && !!getPathModule();
26
30
  this.memoryCache = new LRUCache({
27
31
  maxEntries: this.config.maxEntries,
28
32
  ttl: this.config.ttl,
@@ -42,8 +46,13 @@ class ResponseCache {
42
46
  async initializePersistenceAsync() {
43
47
  if (!this.config.cacheDir)
44
48
  return;
49
+ const fs = getFsModule();
50
+ if (!fs?.promises) {
51
+ this.persistenceEnabled = false;
52
+ return;
53
+ }
45
54
  try {
46
- await fsPromises.mkdir(this.config.cacheDir, { recursive: true });
55
+ await fs.promises.mkdir(this.config.cacheDir, { recursive: true });
47
56
  await this.loadFromDiskAsync();
48
57
  this.initialized = true;
49
58
  } catch {
@@ -51,34 +60,42 @@ class ResponseCache {
51
60
  }
52
61
  }
53
62
  getCacheFilePath(key) {
63
+ const path = getPathModule();
54
64
  const safeKey = Buffer.from(key).toString("base64url");
55
- return path.join(this.config.cacheDir, `${safeKey}.json`);
65
+ return path && this.config.cacheDir ? path.join(this.config.cacheDir, `${safeKey}.json`) : `${this.config.cacheDir || ""}/${safeKey}.json`;
56
66
  }
57
67
  persistToDisk(key, entry) {
58
68
  if (!this.persistenceEnabled || !this.config.cacheDir)
59
69
  return;
70
+ const fs = getFsModule();
71
+ if (!fs?.promises)
72
+ return;
60
73
  const filePath = this.getCacheFilePath(key);
61
- fsPromises.writeFile(filePath, JSON.stringify(entry), "utf-8").catch(() => {});
74
+ fs.promises.writeFile(filePath, JSON.stringify(entry), "utf-8").catch(() => {});
62
75
  }
63
76
  async loadFromDiskAsync() {
64
77
  if (!this.persistenceEnabled || !this.config.cacheDir)
65
78
  return;
79
+ const fs = getFsModule();
80
+ const path = getPathModule();
81
+ if (!fs?.promises || !path)
82
+ return;
66
83
  try {
67
- const files = await fsPromises.readdir(this.config.cacheDir);
84
+ const files = await fs.promises.readdir(this.config.cacheDir);
68
85
  const now = Date.now();
69
86
  for (const file of files) {
70
87
  if (!file.endsWith(".json"))
71
88
  continue;
72
89
  try {
73
90
  const filePath = path.join(this.config.cacheDir, file);
74
- const content = await fsPromises.readFile(filePath, "utf-8");
91
+ const content = await fs.promises.readFile(filePath, "utf-8");
75
92
  const entry = JSON.parse(content);
76
93
  if (entry.timestamp + entry.ttl > now) {
77
94
  const key = Buffer.from(file.replace(".json", ""), "base64url").toString("utf-8");
78
95
  const remainingTTL = entry.timestamp + entry.ttl - now;
79
96
  this.memoryCache.set(key, entry, remainingTTL);
80
97
  } else {
81
- fsPromises.unlink(filePath).catch(() => {});
98
+ fs.promises.unlink(filePath).catch(() => {});
82
99
  }
83
100
  } catch {}
84
101
  }
@@ -145,6 +162,9 @@ class ResponseCache {
145
162
  loadSingleFromDisk(key) {
146
163
  if (!this.persistenceEnabled || !this.config.cacheDir)
147
164
  return;
165
+ const fs = getFsModule();
166
+ if (!fs)
167
+ return;
148
168
  try {
149
169
  const filePath = this.getCacheFilePath(key);
150
170
  if (!fs.existsSync(filePath))
@@ -241,7 +261,8 @@ class ResponseCache {
241
261
  this.memoryCache.delete(key);
242
262
  if (this.persistenceEnabled) {
243
263
  const filePath = this.getCacheFilePath(key);
244
- fsPromises.unlink(filePath).catch(() => {});
264
+ const fs = getFsModule();
265
+ fs?.promises?.unlink(filePath).catch(() => {});
245
266
  }
246
267
  return;
247
268
  }
@@ -270,18 +291,23 @@ class ResponseCache {
270
291
  this.memoryCache.delete(key);
271
292
  if (this.persistenceEnabled) {
272
293
  const filePath = this.getCacheFilePath(key);
273
- fsPromises.unlink(filePath).catch(() => {});
294
+ const fs = getFsModule();
295
+ fs?.promises?.unlink(filePath).catch(() => {});
274
296
  }
275
297
  }
276
298
  }
277
299
  clear() {
278
300
  this.memoryCache.clear();
279
301
  if (this.persistenceEnabled && this.config.cacheDir) {
302
+ const fs = getFsModule();
303
+ const path = getPathModule();
304
+ if (!fs?.promises || !path)
305
+ return;
280
306
  const cacheDir = this.config.cacheDir;
281
- fsPromises.readdir(cacheDir).then((files) => {
307
+ fs.promises.readdir(cacheDir).then((files) => {
282
308
  for (const file of files) {
283
309
  if (file.endsWith(".json")) {
284
- fsPromises.unlink(path.join(cacheDir, file)).catch(() => {});
310
+ fs.promises.unlink(path.join(cacheDir, file)).catch(() => {});
285
311
  }
286
312
  }
287
313
  }).catch(() => {});
@@ -1,7 +1,11 @@
1
1
  import { LRUCache } from './lru-cache.js';
2
- import fs from "node:fs";
3
- import path from "node:path";
4
- const fsPromises = fs.promises;
2
+ import { requireNodeModule } from '../utils/node-runtime.js';
3
+ function getFsModule() {
4
+ return requireNodeModule("node:fs");
5
+ }
6
+ function getPathModule() {
7
+ return requireNodeModule("node:path");
8
+ }
5
9
  const DEFAULT_TTL = 3000000;
6
10
  const DEFAULT_MAX_ENTRIES = 500;
7
11
  const DEFAULT_METHODS = ["GET", "HEAD"];
@@ -22,7 +26,7 @@ export class ResponseCache {
22
26
  methods: config.methods ?? DEFAULT_METHODS,
23
27
  respectHeaders: config.respectHeaders ?? true
24
28
  };
25
- this.persistenceEnabled = !!this.config.cacheDir;
29
+ this.persistenceEnabled = !!this.config.cacheDir && !!getFsModule() && !!getPathModule();
26
30
  this.memoryCache = new LRUCache({
27
31
  maxEntries: this.config.maxEntries,
28
32
  ttl: this.config.ttl,
@@ -42,8 +46,13 @@ export class ResponseCache {
42
46
  async initializePersistenceAsync() {
43
47
  if (!this.config.cacheDir)
44
48
  return;
49
+ const fs = getFsModule();
50
+ if (!fs?.promises) {
51
+ this.persistenceEnabled = false;
52
+ return;
53
+ }
45
54
  try {
46
- await fsPromises.mkdir(this.config.cacheDir, { recursive: true });
55
+ await fs.promises.mkdir(this.config.cacheDir, { recursive: true });
47
56
  await this.loadFromDiskAsync();
48
57
  this.initialized = true;
49
58
  } catch {
@@ -51,34 +60,42 @@ export class ResponseCache {
51
60
  }
52
61
  }
53
62
  getCacheFilePath(key) {
63
+ const path = getPathModule();
54
64
  const safeKey = Buffer.from(key).toString("base64url");
55
- return path.join(this.config.cacheDir, `${safeKey}.json`);
65
+ return path && this.config.cacheDir ? path.join(this.config.cacheDir, `${safeKey}.json`) : `${this.config.cacheDir || ""}/${safeKey}.json`;
56
66
  }
57
67
  persistToDisk(key, entry) {
58
68
  if (!this.persistenceEnabled || !this.config.cacheDir)
59
69
  return;
70
+ const fs = getFsModule();
71
+ if (!fs?.promises)
72
+ return;
60
73
  const filePath = this.getCacheFilePath(key);
61
- fsPromises.writeFile(filePath, JSON.stringify(entry), "utf-8").catch(() => {});
74
+ fs.promises.writeFile(filePath, JSON.stringify(entry), "utf-8").catch(() => {});
62
75
  }
63
76
  async loadFromDiskAsync() {
64
77
  if (!this.persistenceEnabled || !this.config.cacheDir)
65
78
  return;
79
+ const fs = getFsModule();
80
+ const path = getPathModule();
81
+ if (!fs?.promises || !path)
82
+ return;
66
83
  try {
67
- const files = await fsPromises.readdir(this.config.cacheDir);
84
+ const files = await fs.promises.readdir(this.config.cacheDir);
68
85
  const now = Date.now();
69
86
  for (const file of files) {
70
87
  if (!file.endsWith(".json"))
71
88
  continue;
72
89
  try {
73
90
  const filePath = path.join(this.config.cacheDir, file);
74
- const content = await fsPromises.readFile(filePath, "utf-8");
91
+ const content = await fs.promises.readFile(filePath, "utf-8");
75
92
  const entry = JSON.parse(content);
76
93
  if (entry.timestamp + entry.ttl > now) {
77
94
  const key = Buffer.from(file.replace(".json", ""), "base64url").toString("utf-8");
78
95
  const remainingTTL = entry.timestamp + entry.ttl - now;
79
96
  this.memoryCache.set(key, entry, remainingTTL);
80
97
  } else {
81
- fsPromises.unlink(filePath).catch(() => {});
98
+ fs.promises.unlink(filePath).catch(() => {});
82
99
  }
83
100
  } catch {}
84
101
  }
@@ -145,6 +162,9 @@ export class ResponseCache {
145
162
  loadSingleFromDisk(key) {
146
163
  if (!this.persistenceEnabled || !this.config.cacheDir)
147
164
  return;
165
+ const fs = getFsModule();
166
+ if (!fs)
167
+ return;
148
168
  try {
149
169
  const filePath = this.getCacheFilePath(key);
150
170
  if (!fs.existsSync(filePath))
@@ -241,7 +261,8 @@ export class ResponseCache {
241
261
  this.memoryCache.delete(key);
242
262
  if (this.persistenceEnabled) {
243
263
  const filePath = this.getCacheFilePath(key);
244
- fsPromises.unlink(filePath).catch(() => {});
264
+ const fs = getFsModule();
265
+ fs?.promises?.unlink(filePath).catch(() => {});
245
266
  }
246
267
  return;
247
268
  }
@@ -270,18 +291,23 @@ export class ResponseCache {
270
291
  this.memoryCache.delete(key);
271
292
  if (this.persistenceEnabled) {
272
293
  const filePath = this.getCacheFilePath(key);
273
- fsPromises.unlink(filePath).catch(() => {});
294
+ const fs = getFsModule();
295
+ fs?.promises?.unlink(filePath).catch(() => {});
274
296
  }
275
297
  }
276
298
  }
277
299
  clear() {
278
300
  this.memoryCache.clear();
279
301
  if (this.persistenceEnabled && this.config.cacheDir) {
302
+ const fs = getFsModule();
303
+ const path = getPathModule();
304
+ if (!fs?.promises || !path)
305
+ return;
280
306
  const cacheDir = this.config.cacheDir;
281
- fsPromises.readdir(cacheDir).then((files) => {
307
+ fs.promises.readdir(cacheDir).then((files) => {
282
308
  for (const file of files) {
283
309
  if (file.endsWith(".json")) {
284
- fsPromises.unlink(path.join(cacheDir, file)).catch(() => {});
310
+ fs.promises.unlink(path.join(cacheDir, file)).catch(() => {});
285
311
  }
286
312
  }
287
313
  }).catch(() => {});
@@ -1,7 +1,8 @@
1
1
  const { CookieJar: TouchCookieJar } = require("tough-cookie");
2
2
  const { Cookie } = require('./cookie.cjs');
3
- const _mod_y8mmg9 = require('./cookie.cjs');
4
- exports.Cookie = _mod_y8mmg9.Cookie;;
3
+ const { requireNodeModule } = require('../utils/node-runtime.cjs');
4
+ const _mod_2xetkm = require('./cookie.cjs');
5
+ exports.Cookie = _mod_2xetkm.Cookie;;
5
6
 
6
7
  class RezoCookieJar extends TouchCookieJar {
7
8
  constructor(store, options) {
@@ -402,10 +403,8 @@ class RezoCookieJar extends TouchCookieJar {
402
403
  return this._cookieFile;
403
404
  }
404
405
  loadFromFile(filePath, _defaultUrl) {
405
- let fs;
406
- try {
407
- fs = require("node:fs");
408
- } catch {
406
+ const fs = requireNodeModule("node:fs");
407
+ if (!fs) {
409
408
  throw new Error("loadFromFile() requires Node.js, Bun, or Deno. Not available in browsers or React Native.");
410
409
  }
411
410
  if (!fs.existsSync(filePath)) {
@@ -456,10 +455,8 @@ class RezoCookieJar extends TouchCookieJar {
456
455
  if (!targetPath) {
457
456
  throw new Error("No cookie file path specified. Provide a path or load from a file first.");
458
457
  }
459
- let fs;
460
- try {
461
- fs = require("node:fs");
462
- } catch {
458
+ const fs = requireNodeModule("node:fs");
459
+ if (!fs) {
463
460
  throw new Error("saveToFile() requires Node.js, Bun, or Deno. Not available in browsers or React Native.");
464
461
  }
465
462
  const isJson = targetPath.toLowerCase().endsWith(".json");
@@ -484,7 +481,7 @@ class RezoCookieJar extends TouchCookieJar {
484
481
  }
485
482
  }
486
483
  const CookieJar = exports.CookieJar = RezoCookieJar;
487
- const _mod_2m96de = require("tough-cookie");
488
- exports.Store = _mod_2m96de.Store;;
484
+ const _mod_o2fr98 = require("tough-cookie");
485
+ exports.Store = _mod_o2fr98.Store;;
489
486
 
490
487
  exports.RezoCookieJar = RezoCookieJar;
@@ -1,5 +1,6 @@
1
1
  import { CookieJar as TouchCookieJar } from "tough-cookie";
2
2
  import { Cookie } from './cookie.js';
3
+ import { requireNodeModule } from '../utils/node-runtime.js';
3
4
  export { Cookie } from './cookie.js';
4
5
 
5
6
  export class RezoCookieJar extends TouchCookieJar {
@@ -401,10 +402,8 @@ export class RezoCookieJar extends TouchCookieJar {
401
402
  return this._cookieFile;
402
403
  }
403
404
  loadFromFile(filePath, _defaultUrl) {
404
- let fs;
405
- try {
406
- fs = require("node:fs");
407
- } catch {
405
+ const fs = requireNodeModule("node:fs");
406
+ if (!fs) {
408
407
  throw new Error("loadFromFile() requires Node.js, Bun, or Deno. Not available in browsers or React Native.");
409
408
  }
410
409
  if (!fs.existsSync(filePath)) {
@@ -455,10 +454,8 @@ export class RezoCookieJar extends TouchCookieJar {
455
454
  if (!targetPath) {
456
455
  throw new Error("No cookie file path specified. Provide a path or load from a file first.");
457
456
  }
458
- let fs;
459
- try {
460
- fs = require("node:fs");
461
- } catch {
457
+ const fs = requireNodeModule("node:fs");
458
+ if (!fs) {
462
459
  throw new Error("saveToFile() requires Node.js, Bun, or Deno. Not available in browsers or React Native.");
463
460
  }
464
461
  const isJson = targetPath.toLowerCase().endsWith(".json");
@@ -1,10 +1,10 @@
1
- const _mod_pjz10g = require('./cookie.cjs');
2
- exports.Cookie = _mod_pjz10g.Cookie;
3
- exports.RezoCookie = _mod_pjz10g.RezoCookie;;
4
- const _mod_r06e2k = require('./cookie-store.cjs');
5
- exports.RezoCookieStore = _mod_r06e2k.RezoCookieStore;;
6
- const _mod_8gcdod = require('./cookie-jar.cjs');
7
- exports.RezoCookieJar = _mod_8gcdod.RezoCookieJar;
8
- exports.CookieJar = _mod_8gcdod.CookieJar;;
9
- const _mod_jxvzsj = require("tough-cookie");
10
- exports.Store = _mod_jxvzsj.Store;;
1
+ const _mod_dnn0yd = require('./cookie.cjs');
2
+ exports.Cookie = _mod_dnn0yd.Cookie;
3
+ exports.RezoCookie = _mod_dnn0yd.RezoCookie;;
4
+ const _mod_euh49t = require('./cookie-store.cjs');
5
+ exports.RezoCookieStore = _mod_euh49t.RezoCookieStore;;
6
+ const _mod_n9r664 = require('./cookie-jar.cjs');
7
+ exports.RezoCookieJar = _mod_n9r664.RezoCookieJar;
8
+ exports.CookieJar = _mod_n9r664.CookieJar;;
9
+ const _mod_5ka56g = require("tough-cookie");
10
+ exports.Store = _mod_5ka56g.Store;;
@@ -1,42 +1,42 @@
1
- const _mod_snqf5u = require('./crawler.cjs');
2
- exports.Crawler = _mod_snqf5u.Crawler;;
3
- const _mod_ftmw42 = require('./crawler-options.cjs');
4
- exports.CrawlerOptions = _mod_ftmw42.CrawlerOptions;;
5
- const _mod_emyqnb = require('./plugin/robots-txt.cjs');
6
- exports.RobotsTxt = _mod_emyqnb.RobotsTxt;;
7
- const _mod_f9b9j2 = require('./plugin/file-cacher.cjs');
8
- exports.FileCacher = _mod_f9b9j2.FileCacher;;
9
- const _mod_zijz7m = require('./plugin/url-store.cjs');
10
- exports.UrlStore = _mod_zijz7m.UrlStore;;
11
- const _mod_ha8q6a = require('./plugin/navigation-history.cjs');
12
- exports.NavigationHistory = _mod_ha8q6a.NavigationHistory;;
13
- const _mod_28nyr9 = require('./addon/oxylabs/index.cjs');
14
- exports.Oxylabs = _mod_28nyr9.Oxylabs;;
15
- const _mod_g9bita = require('./addon/oxylabs/options.cjs');
16
- exports.OXYLABS_BROWSER_TYPES = _mod_g9bita.OXYLABS_BROWSER_TYPES;
17
- exports.OXYLABS_COMMON_LOCALES = _mod_g9bita.OXYLABS_COMMON_LOCALES;
18
- exports.OXYLABS_COMMON_GEO_LOCATIONS = _mod_g9bita.OXYLABS_COMMON_GEO_LOCATIONS;
19
- exports.OXYLABS_US_STATES = _mod_g9bita.OXYLABS_US_STATES;
20
- exports.OXYLABS_EUROPEAN_COUNTRIES = _mod_g9bita.OXYLABS_EUROPEAN_COUNTRIES;
21
- exports.OXYLABS_ASIAN_COUNTRIES = _mod_g9bita.OXYLABS_ASIAN_COUNTRIES;
22
- exports.getRandomOxylabsBrowserType = _mod_g9bita.getRandomBrowserType;
23
- exports.getRandomOxylabsLocale = _mod_g9bita.getRandomLocale;
24
- exports.getRandomOxylabsGeoLocation = _mod_g9bita.getRandomGeoLocation;;
25
- const _mod_8aecf8 = require('./scraper.cjs');
26
- exports.isRestrictedDomain = _mod_8aecf8.isRestrictedDomain;;
27
- const _mod_2yqsys = require('./addon/decodo/index.cjs');
28
- exports.Decodo = _mod_2yqsys.Decodo;;
29
- const _mod_l42d3i = require('./addon/decodo/options.cjs');
30
- exports.DECODO_DEVICE_TYPES = _mod_l42d3i.DECODO_DEVICE_TYPES;
31
- exports.DECODO_HEADLESS_MODES = _mod_l42d3i.DECODO_HEADLESS_MODES;
32
- exports.DECODO_COMMON_LOCALES = _mod_l42d3i.DECODO_COMMON_LOCALES;
33
- exports.DECODO_COMMON_COUNTRIES = _mod_l42d3i.DECODO_COMMON_COUNTRIES;
34
- exports.DECODO_EUROPEAN_COUNTRIES = _mod_l42d3i.DECODO_EUROPEAN_COUNTRIES;
35
- exports.DECODO_ASIAN_COUNTRIES = _mod_l42d3i.DECODO_ASIAN_COUNTRIES;
36
- exports.DECODO_US_STATES = _mod_l42d3i.DECODO_US_STATES;
37
- exports.DECODO_COMMON_CITIES = _mod_l42d3i.DECODO_COMMON_CITIES;
38
- exports.getRandomDecodoDeviceType = _mod_l42d3i.getRandomDeviceType;
39
- exports.getRandomDecodoLocale = _mod_l42d3i.getRandomLocale;
40
- exports.getRandomDecodoCountry = _mod_l42d3i.getRandomCountry;
41
- exports.getRandomDecodoCity = _mod_l42d3i.getRandomCity;
42
- exports.generateDecodoSessionId = _mod_l42d3i.generateSessionId;;
1
+ const _mod_22900y = require('./crawler.cjs');
2
+ exports.Crawler = _mod_22900y.Crawler;;
3
+ const _mod_22ubyp = require('./crawler-options.cjs');
4
+ exports.CrawlerOptions = _mod_22ubyp.CrawlerOptions;;
5
+ const _mod_h84o2j = require('./plugin/robots-txt.cjs');
6
+ exports.RobotsTxt = _mod_h84o2j.RobotsTxt;;
7
+ const _mod_jjmsn2 = require('./plugin/file-cacher.cjs');
8
+ exports.FileCacher = _mod_jjmsn2.FileCacher;;
9
+ const _mod_538aj2 = require('./plugin/url-store.cjs');
10
+ exports.UrlStore = _mod_538aj2.UrlStore;;
11
+ const _mod_0mnqbz = require('./plugin/navigation-history.cjs');
12
+ exports.NavigationHistory = _mod_0mnqbz.NavigationHistory;;
13
+ const _mod_euwe7r = require('./addon/oxylabs/index.cjs');
14
+ exports.Oxylabs = _mod_euwe7r.Oxylabs;;
15
+ const _mod_gp9gpd = require('./addon/oxylabs/options.cjs');
16
+ exports.OXYLABS_BROWSER_TYPES = _mod_gp9gpd.OXYLABS_BROWSER_TYPES;
17
+ exports.OXYLABS_COMMON_LOCALES = _mod_gp9gpd.OXYLABS_COMMON_LOCALES;
18
+ exports.OXYLABS_COMMON_GEO_LOCATIONS = _mod_gp9gpd.OXYLABS_COMMON_GEO_LOCATIONS;
19
+ exports.OXYLABS_US_STATES = _mod_gp9gpd.OXYLABS_US_STATES;
20
+ exports.OXYLABS_EUROPEAN_COUNTRIES = _mod_gp9gpd.OXYLABS_EUROPEAN_COUNTRIES;
21
+ exports.OXYLABS_ASIAN_COUNTRIES = _mod_gp9gpd.OXYLABS_ASIAN_COUNTRIES;
22
+ exports.getRandomOxylabsBrowserType = _mod_gp9gpd.getRandomBrowserType;
23
+ exports.getRandomOxylabsLocale = _mod_gp9gpd.getRandomLocale;
24
+ exports.getRandomOxylabsGeoLocation = _mod_gp9gpd.getRandomGeoLocation;;
25
+ const _mod_d6ta58 = require('./scraper.cjs');
26
+ exports.isRestrictedDomain = _mod_d6ta58.isRestrictedDomain;;
27
+ const _mod_sdriey = require('./addon/decodo/index.cjs');
28
+ exports.Decodo = _mod_sdriey.Decodo;;
29
+ const _mod_udz2vx = require('./addon/decodo/options.cjs');
30
+ exports.DECODO_DEVICE_TYPES = _mod_udz2vx.DECODO_DEVICE_TYPES;
31
+ exports.DECODO_HEADLESS_MODES = _mod_udz2vx.DECODO_HEADLESS_MODES;
32
+ exports.DECODO_COMMON_LOCALES = _mod_udz2vx.DECODO_COMMON_LOCALES;
33
+ exports.DECODO_COMMON_COUNTRIES = _mod_udz2vx.DECODO_COMMON_COUNTRIES;
34
+ exports.DECODO_EUROPEAN_COUNTRIES = _mod_udz2vx.DECODO_EUROPEAN_COUNTRIES;
35
+ exports.DECODO_ASIAN_COUNTRIES = _mod_udz2vx.DECODO_ASIAN_COUNTRIES;
36
+ exports.DECODO_US_STATES = _mod_udz2vx.DECODO_US_STATES;
37
+ exports.DECODO_COMMON_CITIES = _mod_udz2vx.DECODO_COMMON_CITIES;
38
+ exports.getRandomDecodoDeviceType = _mod_udz2vx.getRandomDeviceType;
39
+ exports.getRandomDecodoLocale = _mod_udz2vx.getRandomLocale;
40
+ exports.getRandomDecodoCountry = _mod_udz2vx.getRandomCountry;
41
+ exports.getRandomDecodoCity = _mod_udz2vx.getRandomCity;
42
+ exports.generateDecodoSessionId = _mod_udz2vx.generateSessionId;;
@@ -1 +1 @@
1
- var e=require("./file-cacher.cjs");exports.FileCacher=e.FileCacher;var r=require("./url-store.cjs");exports.UrlStore=r.UrlStore;var o=require("./result-stream.cjs");exports.ResultStream=o.ResultStream;var t=require("./memory-monitor.cjs");exports.MemoryMonitor=t.MemoryMonitor;var a=require("./health-metrics.cjs");exports.HealthMetrics=a.HealthMetrics;var m=require("./capped-map.cjs");exports.CappedMap=m.CappedMap;var i=require("./capped-array.cjs");exports.CappedArray=i.CappedArray;
1
+ var e=require("./file-cacher.cjs");exports.FileCacher=e.FileCacher;var r=require("./url-store.cjs");exports.UrlStore=r.UrlStore;var o=require("./result-stream.cjs");exports.ResultStream=o.ResultStream;var t=require("./memory-monitor.cjs");exports.MemoryMonitor=t.MemoryMonitor;var a=require("./health-metrics.cjs");exports.HealthMetrics=a.HealthMetrics;var i=require("./capped-map.cjs");exports.CappedMap=i.CappedMap;var m=require("./capped-array.cjs");exports.CappedArray=m.CappedArray;
@@ -1,6 +1,6 @@
1
- const _mod_yvziln = require('../crawler/crawler.cjs');
2
- exports.Crawler = _mod_yvziln.Crawler;;
3
- const _mod_0tshlc = require('../crawler/crawler-options.cjs');
4
- exports.CrawlerOptions = _mod_0tshlc.CrawlerOptions;;
5
- const _mod_hgxgj8 = require('../crawler/scraper.cjs');
6
- exports.isRestrictedDomain = _mod_hgxgj8.isRestrictedDomain;;
1
+ const _mod_7xcbit = require('../crawler/crawler.cjs');
2
+ exports.Crawler = _mod_7xcbit.Crawler;;
3
+ const _mod_3xf2pz = require('../crawler/crawler-options.cjs');
4
+ exports.CrawlerOptions = _mod_3xf2pz.CrawlerOptions;;
5
+ const _mod_smi7pe = require('../crawler/scraper.cjs');
6
+ exports.isRestrictedDomain = _mod_smi7pe.isRestrictedDomain;;