recker 1.0.20-next.9796be9 → 1.0.20-next.b961eae

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.
@@ -1716,7 +1716,7 @@ ${colors.bold('Network:')}
1716
1716
  console.log(colors.gray(` Names: ${mapData.names.length}`));
1717
1717
  console.log(colors.bold('\nOriginal sources:'));
1718
1718
  mapData.sources.forEach((source, i) => {
1719
- const hasContent = mapData.sourcesContent && mapData.sourcesContent[i];
1719
+ const hasContent = mapData.sourcesContent?.[i];
1720
1720
  const sizeInfo = hasContent
1721
1721
  ? colors.green(`[${(mapData.sourcesContent[i].length / 1024).toFixed(1)}kb]`)
1722
1722
  : colors.yellow('[no content]');
@@ -293,7 +293,7 @@ export function cache(options = {}) {
293
293
  key = generateKey(req, baseEntry.vary);
294
294
  cachedEntry = await storage.get(key);
295
295
  }
296
- else if (baseEntry && baseEntry.body) {
296
+ else if (baseEntry?.body) {
297
297
  cachedEntry = baseEntry;
298
298
  }
299
299
  else {
@@ -83,7 +83,7 @@ export function retry(options = {}) {
83
83
  if (onRetry) {
84
84
  onRetry(attempt, err, delayMs);
85
85
  }
86
- if (client.hooks && client.hooks.onRetry) {
86
+ if (client.hooks?.onRetry) {
87
87
  for (const hook of client.hooks.onRetry) {
88
88
  await hook(err, attempt, delayMs, req);
89
89
  }
@@ -99,7 +99,7 @@ export function retry(options = {}) {
99
99
  if (onRetry) {
100
100
  onRetry(attempt, error, delayMs);
101
101
  }
102
- if (client.hooks && client.hooks.onRetry) {
102
+ if (client.hooks?.onRetry) {
103
103
  for (const hook of client.hooks.onRetry) {
104
104
  await hook(error, attempt, delayMs, req);
105
105
  }
@@ -23,7 +23,7 @@ undiciRequestChannel.subscribe((message) => {
23
23
  });
24
24
  undiciBodySentChannel.subscribe((message) => {
25
25
  const store = requestStorage.getStore();
26
- if (store && store.hooks && store.hooks.onRequestSent) {
26
+ if (store?.hooks && store.hooks.onRequestSent) {
27
27
  store.hooks.onRequestSent();
28
28
  }
29
29
  });
@@ -88,7 +88,7 @@ export async function getSecurityRecords(domain) {
88
88
  try {
89
89
  const dmarcRecords = await dns.resolveTxt(`_dmarc.${domain}`);
90
90
  const dmarcTxt = dmarcRecords.map(chunks => chunks.join(''))[0];
91
- if (dmarcTxt && dmarcTxt.startsWith('v=DMARC1')) {
91
+ if (dmarcTxt?.startsWith('v=DMARC1')) {
92
92
  results.dmarc = dmarcTxt;
93
93
  }
94
94
  }
package/dist/utils/dns.js CHANGED
@@ -3,7 +3,7 @@ import { promisify } from 'node:util';
3
3
  const lookupAsync = promisify(lookup);
4
4
  export function createLookupFunction(options) {
5
5
  return (hostname, opts, callback) => {
6
- if (options.override && options.override[hostname]) {
6
+ if (options.override?.[hostname]) {
7
7
  const ip = options.override[hostname];
8
8
  const family = ip.includes(':') ? 6 : 4;
9
9
  return callback(null, ip, family);
@@ -12,7 +12,7 @@ export function createLookupFunction(options) {
12
12
  };
13
13
  }
14
14
  export async function customDNSLookup(hostname, options = {}) {
15
- if (options.override && options.override[hostname]) {
15
+ if (options.override?.[hostname]) {
16
16
  const ip = options.override[hostname];
17
17
  const family = ip.includes(':') ? 6 : 4;
18
18
  return { address: ip, family };
@@ -55,7 +55,7 @@ export async function requireOptional(packageName, submodule) {
55
55
  const err = error;
56
56
  const isModuleNotFound = err.code === 'ERR_MODULE_NOT_FOUND' ||
57
57
  err.code === 'MODULE_NOT_FOUND' ||
58
- (err.message && err.message.includes('Cannot find module'));
58
+ (err.message?.includes('Cannot find module'));
59
59
  if (isModuleNotFound) {
60
60
  const info = OPTIONAL_DEPENDENCIES[packageName];
61
61
  const sub = submodule || info?.submodule || 'this feature';
@@ -246,7 +246,7 @@ export class WebRTCClient extends EventEmitter {
246
246
  if (message.to !== this.peerId)
247
247
  return;
248
248
  const pc = this.connections.get(message.from);
249
- if (pc && pc.remoteDescription) {
249
+ if (pc?.remoteDescription) {
250
250
  await pc.addIceCandidate(message.payload);
251
251
  }
252
252
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "recker",
3
- "version": "1.0.20-next.9796be9",
3
+ "version": "1.0.20-next.b961eae",
4
4
  "description": "AI & DevX focused HTTP client for Node.js 18+",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",