@crawlee/utils 3.17.1-beta.51 → 3.17.1-beta.53

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.
@@ -10,7 +10,10 @@ const tslib_1 = require("tslib");
10
10
  const cheerio = tslib_1.__importStar(require("cheerio"));
11
11
  const cheerio_1 = require("./cheerio");
12
12
  // Regex inspired by https://zapier.com/blog/extract-links-email-phone-regex/
13
- const EMAIL_REGEX_STRING = '(?:[a-z0-9!#$%&\'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&\'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\\])';
13
+ // The dot-atom local part and domain labels use RFC 5321 length bounds ({1,64}, {0,62})
14
+ // instead of unbounded quantifiers to avoid quadratic backtracking (ReDoS) on long
15
+ // dotted or hyphenated inputs, e.g. text scraped by parseHandlesFromHtml().
16
+ const EMAIL_REGEX_STRING = '(?:[a-z0-9!#$%&\'*+/=?^_`{|}~-]{1,64}(?:\\.[a-z0-9!#$%&\'*+/=?^_`{|}~-]{1,64}){0,32}|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\\])';
14
17
  /**
15
18
  * Regular expression to exactly match a single email address.
16
19
  * It has the following form: `/^...$/i`.
@@ -51,6 +51,7 @@ function getCurrentCpuTicks() {
51
51
  }, { idle: 0, total: 0 });
52
52
  const idleTicksDelta = ticks.idle - previousTicks.idle;
53
53
  const totalTicksDelta = ticks.total - previousTicks.total;
54
+ Object.assign(previousTicks, ticks);
54
55
  return totalTicksDelta ? 1 - idleTicksDelta / totalTicksDelta : 0;
55
56
  }
56
57
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/utils",
3
- "version": "3.17.1-beta.51",
3
+ "version": "3.17.1-beta.53",
4
4
  "description": "A set of shared utilities that can be used by crawlers",
5
5
  "engines": {
6
6
  "node": ">=16.0.0"
@@ -49,7 +49,7 @@
49
49
  "dependencies": {
50
50
  "@apify/log": "^2.4.0",
51
51
  "@apify/ps-tree": "^1.2.0",
52
- "@crawlee/types": "3.17.1-beta.51",
52
+ "@crawlee/types": "3.17.1-beta.53",
53
53
  "@types/sax": "^1.2.7",
54
54
  "cheerio": "1.0.0-rc.12",
55
55
  "file-type": "^21.3.1",
@@ -70,5 +70,5 @@
70
70
  }
71
71
  }
72
72
  },
73
- "gitHead": "5185ab2c00a7fce4eaecb7e16c172b6077779a64"
73
+ "gitHead": "59a0d19d96e7402cd8d0edd8b90ad4f5abc8f7db"
74
74
  }