@wargas/crawler 0.0.2 → 0.0.4

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/bun.lock CHANGED
@@ -12,9 +12,10 @@
12
12
  },
13
13
  "devDependencies": {
14
14
  "@types/bun": "latest",
15
+ "tsc": "^2.0.4",
15
16
  },
16
17
  "peerDependencies": {
17
- "typescript": "^5",
18
+ "typescript": "^6.0.3",
18
19
  },
19
20
  },
20
21
  },
@@ -103,9 +104,11 @@
103
104
 
104
105
  "tough-cookie-file-store": ["tough-cookie-file-store@3.3.0", "", { "dependencies": { "tough-cookie": "^6.0.0" } }, "sha512-FbO/cOi/jp4wweo8soVNG/ZjDsgpBZWqaxWwu7gRKvsjg/Qt44kStp87VLfJnin749DlTbZDYvV1wuSr5jly2g=="],
105
106
 
107
+ "tsc": ["tsc@2.0.4", "", { "bin": { "tsc": "bin/tsc" } }, "sha512-fzoSieZI5KKJVBYGvwbVZs/J5za84f2lSTLPYf6AGiIf43tZ3GNrI1QzTLcjtyDDP4aLxd46RTZq1nQxe7+k5Q=="],
108
+
106
109
  "type-fest": ["type-fest@5.6.0", "", { "dependencies": { "tagged-tag": "^1.0.0" } }, "sha512-8ZiHFm91orbSAe2PSAiSVBVko18pbhbiB3U9GglSzF/zCGkR+rxpHx6sEMCUm4kxY4LjDIUGgCfUMtwfZfjfUA=="],
107
110
 
108
- "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
111
+ "typescript": ["typescript@6.0.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw=="],
109
112
 
110
113
  "uhyphen": ["uhyphen@0.2.0", "", {}, "sha512-qz3o9CHXmJJPGBdqzab7qAYuW8kQGKNEuoHFYrBwV6hWIMcpAmxDLXojcHfFr9US1Pe6zUswEIJIbLI610fuqA=="],
111
114
 
package/dist/index.js CHANGED
@@ -23285,7 +23285,7 @@ class Crawler {
23285
23285
  client;
23286
23286
  cookieJar;
23287
23287
  html = ``;
23288
- document = parseHTML(``);
23288
+ document = parseHTML(``).document;
23289
23289
  static factory() {
23290
23290
  const instance = new Crawler;
23291
23291
  instance.cookieJar = new CookieJar(new cookie_file_store_default(`cookies.json`));
@@ -23295,12 +23295,14 @@ class Crawler {
23295
23295
  (res) => {
23296
23296
  if (typeof res.body == `string`) {
23297
23297
  instance.html = res.body;
23298
- instance.document = parseHTML(res.body);
23298
+ instance.document = parseHTML(res.body).document;
23299
23299
  }
23300
23300
  return res;
23301
23301
  }
23302
23302
  ]
23303
- }
23303
+ },
23304
+ followRedirect: false,
23305
+ cookieJar: instance.cookieJar
23304
23306
  });
23305
23307
  return instance;
23306
23308
  }
package/index.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ // crawler.d.ts
2
+
3
+ import type { Got } from "got";
4
+ import type { CookieJar } from "tough-cookie";
5
+
6
+ export declare class Crawler {
7
+ client: Got;
8
+ cookieJar: CookieJar;
9
+ html: string;
10
+ document: Document;
11
+
12
+ static factory(): Crawler;
13
+
14
+ removeAllCookies(): Promise<void>;
15
+ }
package/index.test.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { expect, test } from 'bun:test'
2
- import { Crawler } from "./index";
2
+ import { Crawler } from "./";
3
3
 
4
4
  test(`get page title`, async function() {
5
5
 
package/index.ts CHANGED
@@ -8,7 +8,7 @@ export class Crawler {
8
8
  client!: Got
9
9
  cookieJar!: CookieJar
10
10
  html = ``
11
- document = parseHTML(``).document
11
+ document: Document = parseHTML(``).document
12
12
 
13
13
  static factory() {
14
14
  const instance = new Crawler()
@@ -27,9 +27,9 @@ export class Crawler {
27
27
  return res
28
28
  }
29
29
  ]
30
- }
31
- // followRedirect:false,
32
- // cookieJar: instance.cookieJar,
30
+ },
31
+ followRedirect:false,
32
+ cookieJar: instance.cookieJar,
33
33
 
34
34
  })
35
35
 
package/package.json CHANGED
@@ -1,18 +1,20 @@
1
1
  {
2
2
  "name": "@wargas/crawler",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "module": "index.ts",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
7
7
  "private": false,
8
8
  "scripts": {
9
- "build": "bun build index.ts --target node --outdir dist"
9
+ "build": "bun build index.ts --target node --outdir dist",
10
+ "publish": "npm publish --tag latest --access public"
10
11
  },
11
12
  "devDependencies": {
12
- "@types/bun": "latest"
13
+ "@types/bun": "latest",
14
+ "tsc": "^2.0.4"
13
15
  },
14
16
  "peerDependencies": {
15
- "typescript": "^5"
17
+ "typescript": "^6.0.3"
16
18
  },
17
19
  "dependencies": {
18
20
  "got": "^15.0.5",