@xberg-io/crawlberg 1.1.3 → 1.2.0

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 (3) hide show
  1. package/index.d.ts +168 -6
  2. package/index.js +54 -52
  3. package/package.json +9 -9
package/index.d.ts CHANGED
@@ -407,6 +407,13 @@ export interface CrawlConfig {
407
407
  maxDepth?: number
408
408
  /** Maximum number of pages to crawl. */
409
409
  maxPages?: number
410
+ /**
411
+ * Maximum links enqueued from a single page. Defaults to 10000.
412
+ *
413
+ * Bounds the work one hostile or pathological page can create; links past the
414
+ * cap are dropped and a warning is logged.
415
+ */
416
+ maxLinksPerPage?: number
410
417
  /** Maximum number of concurrent requests. */
411
418
  maxConcurrent?: number
412
419
  /** Whether to respect robots.txt directives. */
@@ -472,7 +479,17 @@ export interface CrawlConfig {
472
479
  proxy?: ProxyConfig
473
480
  /** List of user-agent strings for rotation. If non-empty, overrides `user_agent`. */
474
481
  userAgents?: Array<string>
475
- /** Whether to capture a screenshot when using the browser. */
482
+ /**
483
+ * Whether to capture a screenshot when using the browser.
484
+ *
485
+ * Only supported by `scrape()` with `BrowserBackend.Chromiumoxide` and
486
+ * `BrowserMode.Always` or `Stealth`. A screenshot is 100–500 KB of PNG per page,
487
+ * so `crawl()` does not carry screenshots in `CrawlPageResult`/`CrawlResult` at
488
+ * all — a multi-thousand-page crawl holding one per page in memory is not a safe
489
+ * default. Setting this with any other configuration (a different backend,
490
+ * `BrowserMode.Auto`/`Never`, or during `crawl()`) has no effect and logs a
491
+ * warning rather than silently doing nothing.
492
+ */
476
493
  captureScreenshot?: boolean
477
494
  /**
478
495
  * Re-enqueue discovered `LinkType.Document` URLs into the crawl frontier so
@@ -487,15 +504,42 @@ export interface CrawlConfig {
487
504
  * outer `max_depth` and (if set) `document_url_depth` permit it.
488
505
  */
489
506
  documentUrlDepth?: number
490
- /** Whether to download non-HTML documents (PDF, DOCX, images, code, etc.) instead of skipping them. */
507
+ /**
508
+ * Whether to download non-HTML documents (PDF, DOCX, images, code, etc.) instead of skipping them.
509
+ * Defaults to `true` — unlike `download_assets` and `capture_screenshot`, which default to `false`.
510
+ */
491
511
  downloadDocuments?: boolean
492
512
  /** Maximum size in bytes for document downloads. Defaults to 50 MB. */
493
513
  documentMaxSize?: number
494
514
  /** Allowlist of MIME types to download. If empty, uses built-in defaults. */
495
515
  documentMimeTypes?: Array<string>
516
+ /**
517
+ * Directory to stream downloaded document bytes into instead of holding them in
518
+ * memory on `DownloadedDocument.content`. When set, `content` is left empty and
519
+ * `DownloadedDocument.content_path` is populated with `<dir>/<content_hash>.<ext>`.
520
+ * `None` (default) preserves today's in-memory-only behavior. Has no effect on
521
+ * wasm32, which has no filesystem — use `document_content_encoding` there instead.
522
+ */
523
+ documentOutputDir?: string
524
+ /**
525
+ * Opt-in encoding that duplicates `DownloadedDocument.content` into a serializable
526
+ * field for language bindings that need the bytes in-memory (`content` itself is
527
+ * `alef(skip)`ed). `None` (default) means no encoding is produced. Independent of
528
+ * `document_output_dir` — set both to get a file on disk and an in-memory copy.
529
+ */
530
+ documentContentEncoding?: JsDocumentContentEncoding
496
531
  /** Path to write WARC output. If `None`, WARC output is disabled. */
497
532
  warcOutput?: string
498
- /** Named browser profile for persistent sessions (cookies, localStorage). */
533
+ /**
534
+ * Named browser profile for persistent sessions (cookies, localStorage).
535
+ *
536
+ * Chromiumoxide backend only. The native backend runs an in-process JavaScript
537
+ * engine with no Chrome process and therefore no profile directory, so this is
538
+ * ignored there and logs a warning. It is also ignored — with a warning — when a
539
+ * shared browser pool is in use (the pool launches before any per-crawl config
540
+ * exists) or when connecting to an external CDP endpoint whose process crawlberg
541
+ * does not own.
542
+ */
499
543
  browserProfile?: string
500
544
  /** Whether to save changes back to the browser profile on exit. */
501
545
  saveBrowserProfile?: boolean
@@ -503,11 +547,38 @@ export interface CrawlConfig {
503
547
  * SSRF policy for outbound network requests. Default: deny private networks,
504
548
  * allow http/https only, max 5 redirects.
505
549
  *
506
- * Phase 1: `deny_private` and `max_redirects` are exposed to all language
507
- * bindings. `allowlist` is skipped (see `SsrfPolicy` fields) and will be
508
- * added in a follow-up when `HostMatcher`'s tagged-enum FFI form is decided.
550
+ * `deny_private`, `allowlist` and `max_redirects` are exposed to all language
551
+ * bindings. `scheme_allowlist` stays Rust-only — see `SsrfPolicy`.
552
+ *
553
+ * **wasm32 (including Node.js): `deny_private` does not stop hostname-based
554
+ * requests.** There is no DNS resolution on this target, so only a literal IP host is
555
+ * checked against the policy — a domain name is always permitted, regardless of
556
+ * `deny_private`. Under Node, where `fetch` enforces no CORS, this means a service
557
+ * embedding the wasm binding can be driven to internal hosts by domain name even with
558
+ * `deny_private = true`. Enforce egress restrictions at the network layer for that
559
+ * deployment target; do not rely on this field. See `crawlberg.net.validate_url`.
509
560
  */
510
561
  ssrf?: JsSsrfPolicy
562
+ /**
563
+ * Pins `SsrfPolicy.deny_private` to a caller-chosen value, bypassing the
564
+ * `CRAWLBERG_ALLOW_PRIVATE_NETWORK` operator override entirely for this config.
565
+ *
566
+ * `ssrf.deny_private` is a plain, always-serialized `bool`: several alef-generated
567
+ * bindings construct `SsrfPolicy.default()` (hardcoding `deny_private: true`)
568
+ * whenever their caller never touches SSRF settings at all, so `true` on that field
569
+ * alone cannot distinguish "the caller wants private networks denied" from "the
570
+ * binding's own structural default landed on `true`". The environment variable
571
+ * exists precisely to resolve that ambiguity in the common case by treating any
572
+ * `true` as inconclusive and deferring to the operator.
573
+ *
574
+ * Set this field when that default-deferral is wrong for your call — e.g. a test
575
+ * that must prove `deny_private: true` still denies even while the operator has set
576
+ * `CRAWLBERG_ALLOW_PRIVATE_NETWORK` suite-wide for every other call. `None` (default)
577
+ * preserves today's behavior: the environment variable may still flip
578
+ * `ssrf.deny_private` to `false`. `Some(value)` pins `ssrf.deny_private` to `value`
579
+ * and the environment variable is not consulted for this config.
580
+ */
581
+ ssrfDenyPrivateExplicit?: boolean
511
582
  }
512
583
 
513
584
  export declare function crawlConfigDefault(): CrawlConfig
@@ -616,6 +687,19 @@ export interface CrawlStreamRequest {
616
687
  */
617
688
  export declare function createEngine(config?: CrawlConfig | undefined | null): CrawlEngineHandle
618
689
 
690
+ /**
691
+ * Opt-in encoding applied to a downloaded document's bytes for callers who need the
692
+ * content available in a serializable field rather than reading it from disk.
693
+ *
694
+ * `None` (the `CrawlConfig.document_content_encoding` default) produces neither — unlike
695
+ * screenshots, base64-encoding a document by default would duplicate an already
696
+ * up-to-`document_max_size` buffer (50 MB default) in memory per document.
697
+ */
698
+ export declare const enum DocumentContentEncoding {
699
+ /** Populate `DownloadedDocument.content_base64` with a base64-encoded copy. */
700
+ Base64 = 'base_64'
701
+ }
702
+
619
703
  /** A downloaded asset from a page. */
620
704
  export interface DownloadedAsset {
621
705
  /** The original URL of the asset. */
@@ -652,6 +736,21 @@ export interface DownloadedDocument {
652
736
  contentHash?: string
653
737
  /** Selected response headers. */
654
738
  headers?: Record<string, string>
739
+ /**
740
+ * True when `content` (or the file at `content_path`) was truncated to
741
+ * `document_max_size`; `size` still reports the original, untruncated length.
742
+ */
743
+ truncated?: boolean
744
+ /**
745
+ * Filesystem path the document was streamed to when `document_output_dir` was
746
+ * set. `content` is empty in memory when this is populated.
747
+ */
748
+ contentPath?: string
749
+ /**
750
+ * Base64-encoded copy of `content`, populated only when
751
+ * `document_content_encoding` was set to `Base64`.
752
+ */
753
+ contentBase64?: string
655
754
  }
656
755
 
657
756
  /** Metadata about an LLM extraction pass. */
@@ -717,6 +816,28 @@ export interface HeadingInfo {
717
816
  text?: string
718
817
  }
719
818
 
819
+ /**
820
+ * Hostname/IP allowlist matcher for SSRF policy.
821
+ *
822
+ * Serializes as an internally-tagged object so each variant is distinguishable on the
823
+ * wire and round-trips losslessly:
824
+ *
825
+ * ```json
826
+ * {"type": "exact", "value": "api.example.com"}
827
+ * {"type": "suffix", "value": ".example.com"}
828
+ * {"type": "cidr", "value": "10.0.0.0/8"}
829
+ * ```
830
+ *
831
+ * A bare JSON string is still accepted on deserialization and resolves to `Exact`,
832
+ * preserving configs written against the previous untagged representation.
833
+ *
834
+ * `Exact`: HostMatcher.Exact
835
+ */
836
+ export interface HostMatcher {
837
+ type: string
838
+ value?: string
839
+ }
840
+
720
841
  /** An hreflang alternate link entry. */
721
842
  export interface HreflangEntry {
722
843
  /** The language code (e.g., "en", "fr", "x-default"). */
@@ -762,6 +883,13 @@ export interface InteractionResult {
762
883
  finalHtml?: string
763
884
  /** Final page URL (may have changed due to navigation). */
764
885
  finalUrl?: string
886
+ /**
887
+ * Base64-encoded PNG screenshot taken after all actions.
888
+ *
889
+ * Populated only when a `PageAction.Screenshot` action actually ran, so
890
+ * callers that never request a screenshot do not pay the encoding cost.
891
+ */
892
+ screenshotBase64?: string
765
893
  }
766
894
 
767
895
  /** A JSON-LD structured data entry found on a page. */
@@ -1025,6 +1153,14 @@ export interface ScrapeResult {
1025
1153
  extractedData?: any
1026
1154
  /** Metadata about the LLM extraction pass (cost, tokens, model). */
1027
1155
  extractionMeta?: ExtractionMeta
1156
+ /**
1157
+ * Base64-encoded PNG screenshot of the page.
1158
+ *
1159
+ * Populated only when `CrawlConfig.capture_screenshot` was enabled for this
1160
+ * request, so callers that never requested a screenshot do not pay the
1161
+ * encoding cost.
1162
+ */
1163
+ screenshotBase64?: string
1028
1164
  /** Downloaded non-HTML document (PDF, DOCX, image, code, etc.). */
1029
1165
  downloadedDocument?: DownloadedDocument
1030
1166
  /**
@@ -1058,6 +1194,24 @@ export interface SitemapUrl {
1058
1194
  export interface SsrfPolicy {
1059
1195
  /** If true, reject URLs that resolve to private/metadata IP ranges. */
1060
1196
  denyPrivate?: boolean
1197
+ /**
1198
+ * Hostnames and IP ranges permitted regardless of `deny_private`.
1199
+ *
1200
+ * The allowlist is an *override* of `deny_private`, not an intersection with it.
1201
+ * Precedence, in order:
1202
+ *
1203
+ * 1. `deny_private == false` permits everything; the allowlist is not consulted.
1204
+ * 2. A hostname matching an `Exact` or `Suffix` entry is permitted immediately,
1205
+ * *before* DNS resolution — so the deny-list is never applied to it. This trusts
1206
+ * the host string: a name that resolves into private space is still permitted.
1207
+ * 3. A literal or resolved IP inside a `Cidr` entry is permitted even though it is
1208
+ * in the default deny-list.
1209
+ * 4. Otherwise the default deny-list decides.
1210
+ *
1211
+ * An empty allowlist therefore denies nothing by itself — it simply leaves
1212
+ * `deny_private` and the deny-list in sole control.
1213
+ */
1214
+ allowlist?: Array<JsHostMatcher>
1061
1215
  /** Maximum number of HTTP redirects to follow during validation. */
1062
1216
  maxRedirects?: number
1063
1217
  }
@@ -1075,5 +1229,13 @@ export declare function ssrfPolicyDefault(): SsrfPolicy
1075
1229
  * - Outbound requests in a browser go through the fetch API, which enforces its own network policies.
1076
1230
  * - Rust-side SSRF checking is unenforceable and redundant in a wasm32 context.
1077
1231
  * - For testing and localhost access, the host's network sandbox is the enforcing boundary.
1232
+ *
1233
+ * **Node.js caveat:** `deny_private` (whatever its value) has no effect on hostname-based
1234
+ * requests under `wasm32`. There is no DNS resolution on this target, so `validate_url`
1235
+ * only ever checks a literal IP host; a domain name falls straight through to `Ok(())`. In a
1236
+ * browser this is covered by same-origin/CORS. Node's `fetch` enforces no CORS, so a Node
1237
+ * service embedding this wasm module can be driven to internal hosts by domain name even
1238
+ * though `deny_private = true`. Do not rely on this policy to stop that in Node — enforce
1239
+ * egress restrictions (network policy, firewall, proxy allowlist) outside the process.
1078
1240
  */
1079
1241
  export declare function ssrfPolicyFromEnv(): SsrfPolicy
package/index.js CHANGED
@@ -77,8 +77,8 @@ function requireNative() {
77
77
  try {
78
78
  const binding = require('@xberg-io/crawlberg-android-arm64')
79
79
  const bindingPackageVersion = require('@xberg-io/crawlberg-android-arm64/package.json').version
80
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
80
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
82
82
  }
83
83
  return binding
84
84
  } catch (e) {
@@ -93,8 +93,8 @@ function requireNative() {
93
93
  try {
94
94
  const binding = require('@xberg-io/crawlberg-android-arm-eabi')
95
95
  const bindingPackageVersion = require('@xberg-io/crawlberg-android-arm-eabi/package.json').version
96
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
96
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
98
98
  }
99
99
  return binding
100
100
  } catch (e) {
@@ -114,8 +114,8 @@ function requireNative() {
114
114
  try {
115
115
  const binding = require('@xberg-io/crawlberg-win32-x64-gnu')
116
116
  const bindingPackageVersion = require('@xberg-io/crawlberg-win32-x64-gnu/package.json').version
117
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
117
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
119
119
  }
120
120
  return binding
121
121
  } catch (e) {
@@ -130,8 +130,8 @@ function requireNative() {
130
130
  try {
131
131
  const binding = require('@xberg-io/crawlberg-win32-x64-msvc')
132
132
  const bindingPackageVersion = require('@xberg-io/crawlberg-win32-x64-msvc/package.json').version
133
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
133
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
135
135
  }
136
136
  return binding
137
137
  } catch (e) {
@@ -147,8 +147,8 @@ function requireNative() {
147
147
  try {
148
148
  const binding = require('@xberg-io/crawlberg-win32-ia32-msvc')
149
149
  const bindingPackageVersion = require('@xberg-io/crawlberg-win32-ia32-msvc/package.json').version
150
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
152
  }
153
153
  return binding
154
154
  } catch (e) {
@@ -163,8 +163,8 @@ function requireNative() {
163
163
  try {
164
164
  const binding = require('@xberg-io/crawlberg-win32-arm64-msvc')
165
165
  const bindingPackageVersion = require('@xberg-io/crawlberg-win32-arm64-msvc/package.json').version
166
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
166
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
168
168
  }
169
169
  return binding
170
170
  } catch (e) {
@@ -182,8 +182,8 @@ function requireNative() {
182
182
  try {
183
183
  const binding = require('@xberg-io/crawlberg-darwin-universal')
184
184
  const bindingPackageVersion = require('@xberg-io/crawlberg-darwin-universal/package.json').version
185
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
185
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
187
  }
188
188
  return binding
189
189
  } catch (e) {
@@ -198,8 +198,8 @@ function requireNative() {
198
198
  try {
199
199
  const binding = require('@xberg-io/crawlberg-darwin-x64')
200
200
  const bindingPackageVersion = require('@xberg-io/crawlberg-darwin-x64/package.json').version
201
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
201
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
203
  }
204
204
  return binding
205
205
  } catch (e) {
@@ -214,8 +214,8 @@ function requireNative() {
214
214
  try {
215
215
  const binding = require('@xberg-io/crawlberg-darwin-arm64')
216
216
  const bindingPackageVersion = require('@xberg-io/crawlberg-darwin-arm64/package.json').version
217
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
217
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
219
219
  }
220
220
  return binding
221
221
  } catch (e) {
@@ -234,8 +234,8 @@ function requireNative() {
234
234
  try {
235
235
  const binding = require('@xberg-io/crawlberg-freebsd-x64')
236
236
  const bindingPackageVersion = require('@xberg-io/crawlberg-freebsd-x64/package.json').version
237
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
237
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
239
  }
240
240
  return binding
241
241
  } catch (e) {
@@ -250,8 +250,8 @@ function requireNative() {
250
250
  try {
251
251
  const binding = require('@xberg-io/crawlberg-freebsd-arm64')
252
252
  const bindingPackageVersion = require('@xberg-io/crawlberg-freebsd-arm64/package.json').version
253
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
253
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
255
255
  }
256
256
  return binding
257
257
  } catch (e) {
@@ -271,8 +271,8 @@ function requireNative() {
271
271
  try {
272
272
  const binding = require('@xberg-io/crawlberg-linux-x64-musl')
273
273
  const bindingPackageVersion = require('@xberg-io/crawlberg-linux-x64-musl/package.json').version
274
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
274
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
276
  }
277
277
  return binding
278
278
  } catch (e) {
@@ -287,8 +287,8 @@ function requireNative() {
287
287
  try {
288
288
  const binding = require('@xberg-io/crawlberg-linux-x64-gnu')
289
289
  const bindingPackageVersion = require('@xberg-io/crawlberg-linux-x64-gnu/package.json').version
290
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
290
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
292
292
  }
293
293
  return binding
294
294
  } catch (e) {
@@ -305,8 +305,8 @@ function requireNative() {
305
305
  try {
306
306
  const binding = require('@xberg-io/crawlberg-linux-arm64-musl')
307
307
  const bindingPackageVersion = require('@xberg-io/crawlberg-linux-arm64-musl/package.json').version
308
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
308
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
310
310
  }
311
311
  return binding
312
312
  } catch (e) {
@@ -321,8 +321,8 @@ function requireNative() {
321
321
  try {
322
322
  const binding = require('@xberg-io/crawlberg-linux-arm64-gnu')
323
323
  const bindingPackageVersion = require('@xberg-io/crawlberg-linux-arm64-gnu/package.json').version
324
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
324
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
326
326
  }
327
327
  return binding
328
328
  } catch (e) {
@@ -339,8 +339,8 @@ function requireNative() {
339
339
  try {
340
340
  const binding = require('@xberg-io/crawlberg-linux-arm-musleabihf')
341
341
  const bindingPackageVersion = require('@xberg-io/crawlberg-linux-arm-musleabihf/package.json').version
342
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
342
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
344
344
  }
345
345
  return binding
346
346
  } catch (e) {
@@ -355,8 +355,8 @@ function requireNative() {
355
355
  try {
356
356
  const binding = require('@xberg-io/crawlberg-linux-arm-gnueabihf')
357
357
  const bindingPackageVersion = require('@xberg-io/crawlberg-linux-arm-gnueabihf/package.json').version
358
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
358
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
360
360
  }
361
361
  return binding
362
362
  } catch (e) {
@@ -373,8 +373,8 @@ function requireNative() {
373
373
  try {
374
374
  const binding = require('@xberg-io/crawlberg-linux-loong64-musl')
375
375
  const bindingPackageVersion = require('@xberg-io/crawlberg-linux-loong64-musl/package.json').version
376
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
376
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
378
  }
379
379
  return binding
380
380
  } catch (e) {
@@ -389,8 +389,8 @@ function requireNative() {
389
389
  try {
390
390
  const binding = require('@xberg-io/crawlberg-linux-loong64-gnu')
391
391
  const bindingPackageVersion = require('@xberg-io/crawlberg-linux-loong64-gnu/package.json').version
392
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
392
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
394
394
  }
395
395
  return binding
396
396
  } catch (e) {
@@ -407,8 +407,8 @@ function requireNative() {
407
407
  try {
408
408
  const binding = require('@xberg-io/crawlberg-linux-riscv64-musl')
409
409
  const bindingPackageVersion = require('@xberg-io/crawlberg-linux-riscv64-musl/package.json').version
410
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
410
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
412
  }
413
413
  return binding
414
414
  } catch (e) {
@@ -423,8 +423,8 @@ function requireNative() {
423
423
  try {
424
424
  const binding = require('@xberg-io/crawlberg-linux-riscv64-gnu')
425
425
  const bindingPackageVersion = require('@xberg-io/crawlberg-linux-riscv64-gnu/package.json').version
426
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
426
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
428
428
  }
429
429
  return binding
430
430
  } catch (e) {
@@ -440,8 +440,8 @@ function requireNative() {
440
440
  try {
441
441
  const binding = require('@xberg-io/crawlberg-linux-ppc64-gnu')
442
442
  const bindingPackageVersion = require('@xberg-io/crawlberg-linux-ppc64-gnu/package.json').version
443
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
445
  }
446
446
  return binding
447
447
  } catch (e) {
@@ -456,8 +456,8 @@ function requireNative() {
456
456
  try {
457
457
  const binding = require('@xberg-io/crawlberg-linux-s390x-gnu')
458
458
  const bindingPackageVersion = require('@xberg-io/crawlberg-linux-s390x-gnu/package.json').version
459
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
459
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
461
  }
462
462
  return binding
463
463
  } catch (e) {
@@ -476,8 +476,8 @@ function requireNative() {
476
476
  try {
477
477
  const binding = require('@xberg-io/crawlberg-openharmony-arm64')
478
478
  const bindingPackageVersion = require('@xberg-io/crawlberg-openharmony-arm64/package.json').version
479
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
479
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
481
  }
482
482
  return binding
483
483
  } catch (e) {
@@ -492,8 +492,8 @@ function requireNative() {
492
492
  try {
493
493
  const binding = require('@xberg-io/crawlberg-openharmony-x64')
494
494
  const bindingPackageVersion = require('@xberg-io/crawlberg-openharmony-x64/package.json').version
495
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
495
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
497
497
  }
498
498
  return binding
499
499
  } catch (e) {
@@ -508,8 +508,8 @@ function requireNative() {
508
508
  try {
509
509
  const binding = require('@xberg-io/crawlberg-openharmony-arm')
510
510
  const bindingPackageVersion = require('@xberg-io/crawlberg-openharmony-arm/package.json').version
511
- if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
- throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
511
+ if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
+ throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
513
513
  }
514
514
  return binding
515
515
  } catch (e) {
@@ -608,6 +608,8 @@ module.exports.crawl = nativeBinding.crawl
608
608
  module.exports.crawlConfigDefault = nativeBinding.crawlConfigDefault
609
609
  module.exports.crawlStream = nativeBinding.crawlStream
610
610
  module.exports.createEngine = nativeBinding.createEngine
611
+ module.exports.DocumentContentEncoding = nativeBinding.DocumentContentEncoding
612
+ module.exports.JsDocumentContentEncoding = nativeBinding.JsDocumentContentEncoding
611
613
  module.exports.FeedType = nativeBinding.FeedType
612
614
  module.exports.JsFeedType = nativeBinding.JsFeedType
613
615
  module.exports.generateCitations = nativeBinding.generateCitations
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xberg-io/crawlberg",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
4
  "description": "High-performance web crawling engine",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -22,14 +22,14 @@
22
22
  "*.node"
23
23
  ],
24
24
  "optionalDependencies": {
25
- "@xberg-io/crawlberg-darwin-arm64": "1.1.3",
26
- "@xberg-io/crawlberg-darwin-x64": "1.1.3",
27
- "@xberg-io/crawlberg-linux-arm64-gnu": "1.1.3",
28
- "@xberg-io/crawlberg-linux-arm64-musl": "1.1.3",
29
- "@xberg-io/crawlberg-linux-x64-gnu": "1.1.3",
30
- "@xberg-io/crawlberg-linux-x64-musl": "1.1.3",
31
- "@xberg-io/crawlberg-win32-arm64-msvc": "1.1.3",
32
- "@xberg-io/crawlberg-win32-x64-msvc": "1.1.3"
25
+ "@xberg-io/crawlberg-darwin-arm64": "1.2.0",
26
+ "@xberg-io/crawlberg-darwin-x64": "1.2.0",
27
+ "@xberg-io/crawlberg-linux-arm64-gnu": "1.2.0",
28
+ "@xberg-io/crawlberg-linux-arm64-musl": "1.2.0",
29
+ "@xberg-io/crawlberg-linux-x64-gnu": "1.2.0",
30
+ "@xberg-io/crawlberg-linux-x64-musl": "1.2.0",
31
+ "@xberg-io/crawlberg-win32-arm64-msvc": "1.2.0",
32
+ "@xberg-io/crawlberg-win32-x64-msvc": "1.2.0"
33
33
  },
34
34
  "napi": {
35
35
  "packageName": "@xberg-io/crawlberg",