@crawlee/utils 4.0.0-beta.87 → 4.0.0-beta.88

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.
package/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export * from './internals/blocked.js';
2
2
  export * from './internals/cheerio.js';
3
- export * from './internals/chunk.js';
4
3
  export * from './internals/extract-urls.js';
5
4
  export * from './internals/general.js';
6
5
  export * as social from './internals/social.js';
package/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  export * from './internals/blocked.js';
2
2
  export * from './internals/cheerio.js';
3
- export * from './internals/chunk.js';
4
3
  export * from './internals/extract-urls.js';
5
4
  export * from './internals/general.js';
6
5
  export * as social from './internals/social.js';
@@ -30,11 +30,6 @@ export declare function weightedAvg(arrValues: number[], arrWeights: number[]):
30
30
  * @param millis Period of time to sleep, in milliseconds. If not a positive number, the returned promise resolves immediately.
31
31
  */
32
32
  export declare function sleep(millis?: number): Promise<void>;
33
- /**
34
- * Converts SNAKE_CASE to camelCase.
35
- * @ignore
36
- */
37
- export declare function snakeCaseToCamelCase(snakeCaseStr: string): string;
38
33
  /**
39
34
  * Traverses DOM and expands shadow-root elements (created by custom components).
40
35
  * @ignore
@@ -42,19 +42,6 @@ export function weightedAvg(arrValues, arrWeights) {
42
42
  export async function sleep(millis) {
43
43
  return setTimeout(millis ?? undefined);
44
44
  }
45
- /**
46
- * Converts SNAKE_CASE to camelCase.
47
- * @ignore
48
- */
49
- export function snakeCaseToCamelCase(snakeCaseStr) {
50
- return snakeCaseStr
51
- .toLowerCase()
52
- .split('_')
53
- .map((part, index) => {
54
- return index > 0 ? part.charAt(0).toUpperCase() + part.slice(1) : part;
55
- })
56
- .join('');
57
- }
58
45
  /**
59
46
  * Traverses DOM and expands shadow-root elements (created by custom components).
60
47
  * @ignore
@@ -65,4 +65,3 @@ export declare class RobotsTxtFile {
65
65
  */
66
66
  parseUrlsFromSitemaps(): Promise<string[]>;
67
67
  }
68
- export { RobotsTxtFile as RobotsFile };
@@ -102,5 +102,3 @@ export class RobotsTxtFile {
102
102
  return (await this.parseSitemaps()).urls;
103
103
  }
104
104
  }
105
- // to stay backwards compatible
106
- export { RobotsTxtFile as RobotsFile };
@@ -7,7 +7,7 @@ import { fileTypeStream } from 'file-type';
7
7
  import sax from 'sax';
8
8
  import MIMEType from 'whatwg-mimetype';
9
9
  import { mergeAsyncIterables } from './iterables.js';
10
- import { RobotsFile } from './robots.js';
10
+ import { RobotsTxtFile } from './robots.js';
11
11
  class SitemapTxtParser extends Transform {
12
12
  decoder = new StringDecoder('utf8');
13
13
  buffer = '';
@@ -367,7 +367,7 @@ export async function* discoverValidSitemaps(urls, options = {}) {
367
367
  return;
368
368
  }
369
369
  try {
370
- const robotsFile = await RobotsFile.find(domainUrls[0], {
370
+ const robotsFile = await RobotsTxtFile.find(domainUrls[0], {
371
371
  proxyUrl,
372
372
  timeoutMillis: requestTimeoutMillis,
373
373
  signal,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/utils",
3
- "version": "4.0.0-beta.87",
3
+ "version": "4.0.0-beta.88",
4
4
  "description": "A set of shared utilities that can be used by crawlers",
5
5
  "engines": {
6
6
  "node": ">=22.0.0"
@@ -42,8 +42,8 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@apify/ps-tree": "^1.2.0",
45
- "@crawlee/http-client": "4.0.0-beta.87",
46
- "@crawlee/types": "4.0.0-beta.87",
45
+ "@crawlee/http-client": "4.0.0-beta.88",
46
+ "@crawlee/types": "4.0.0-beta.88",
47
47
  "@types/sax": "^1.2.7",
48
48
  "cheerio": "^1.0.0",
49
49
  "domhandler": "^5.0.3",
@@ -61,5 +61,5 @@
61
61
  }
62
62
  }
63
63
  },
64
- "gitHead": "1b7604cd77b694460aac4448b4555444fa1b2bdb"
64
+ "gitHead": "4f7d17669d59250cf802591e73498793de28967d"
65
65
  }
@@ -1 +0,0 @@
1
- export declare function chunk<T>(array: readonly T[], chunkSize: number): T[][];
@@ -1,39 +0,0 @@
1
- /*
2
- The MIT License (MIT)
3
-
4
- Copyright © `2020` `The Sapphire Community and its contributors`
5
-
6
- Permission is hereby granted, free of charge, to any person
7
- obtaining a copy of this software and associated documentation
8
- files (the “Software”), to deal in the Software without
9
- restriction, including without limitation the rights to use,
10
- copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the
12
- Software is furnished to do so, subject to the following
13
- conditions:
14
-
15
- The above copyright notice and this permission notice shall be
16
- included in all copies or substantial portions of the Software.
17
-
18
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
19
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25
- OTHER DEALINGS IN THE SOFTWARE.
26
- */
27
- export function chunk(array, chunkSize) {
28
- if (!Array.isArray(array))
29
- throw new TypeError('entries must be an array.');
30
- if (!Number.isInteger(chunkSize))
31
- throw new TypeError('chunkSize must be an integer.');
32
- if (chunkSize < 1)
33
- throw new RangeError('chunkSize must be 1 or greater.');
34
- const clone = array.slice();
35
- const chunks = [];
36
- while (clone.length)
37
- chunks.push(clone.splice(0, chunkSize));
38
- return chunks;
39
- }