@xberg-io/crawlberg 1.1.4 → 1.2.1

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 +175 -7
  2. package/index.js +54 -52
  3. package/package.json +9 -9
package/index.d.ts CHANGED
@@ -357,7 +357,7 @@ export interface ContentConfig {
357
357
  removeForms?: boolean
358
358
  /**
359
359
  * HTML tag names to strip (render children only, remove the tag wrapper).
360
- * Default: `["noscript"]`.
360
+ * Default: `[]`.
361
361
  */
362
362
  stripTags?: Array<string>
363
363
  /** HTML tag names to preserve as raw HTML in output. */
@@ -369,6 +369,12 @@ export interface ContentConfig {
369
369
  * excluded elements and all descendants are dropped. Supports CSS selectors:
370
370
  * `.class`, `#id`, `[attribute]`, compound selectors.
371
371
  *
372
+ * Default: `["noscript"]`. `<noscript>` fallback content (no-JS notices,
373
+ * tracking pixels, GTM iframes) is meant for browsers with JavaScript
374
+ * disabled, not for a markdown reader, and `strip_tags` cannot drop it —
375
+ * on `preprocessing_preset: "standard"` (crawlberg's only path) it only
376
+ * removes the wrapper and still renders the children. ~keep
377
+ *
372
378
  * Example: `[".cookie-banner", "#ad-container", "[role='complementary']"]`
373
379
  */
374
380
  excludeSelectors?: Array<string>
@@ -407,6 +413,13 @@ export interface CrawlConfig {
407
413
  maxDepth?: number
408
414
  /** Maximum number of pages to crawl. */
409
415
  maxPages?: number
416
+ /**
417
+ * Maximum links enqueued from a single page. Defaults to 10000.
418
+ *
419
+ * Bounds the work one hostile or pathological page can create; links past the
420
+ * cap are dropped and a warning is logged.
421
+ */
422
+ maxLinksPerPage?: number
410
423
  /** Maximum number of concurrent requests. */
411
424
  maxConcurrent?: number
412
425
  /** Whether to respect robots.txt directives. */
@@ -472,7 +485,17 @@ export interface CrawlConfig {
472
485
  proxy?: ProxyConfig
473
486
  /** List of user-agent strings for rotation. If non-empty, overrides `user_agent`. */
474
487
  userAgents?: Array<string>
475
- /** Whether to capture a screenshot when using the browser. */
488
+ /**
489
+ * Whether to capture a screenshot when using the browser.
490
+ *
491
+ * Only supported by `scrape()` with `BrowserBackend.Chromiumoxide` and
492
+ * `BrowserMode.Always` or `Stealth`. A screenshot is 100–500 KB of PNG per page,
493
+ * so `crawl()` does not carry screenshots in `CrawlPageResult`/`CrawlResult` at
494
+ * all — a multi-thousand-page crawl holding one per page in memory is not a safe
495
+ * default. Setting this with any other configuration (a different backend,
496
+ * `BrowserMode.Auto`/`Never`, or during `crawl()`) has no effect and logs a
497
+ * warning rather than silently doing nothing.
498
+ */
476
499
  captureScreenshot?: boolean
477
500
  /**
478
501
  * Re-enqueue discovered `LinkType.Document` URLs into the crawl frontier so
@@ -487,15 +510,42 @@ export interface CrawlConfig {
487
510
  * outer `max_depth` and (if set) `document_url_depth` permit it.
488
511
  */
489
512
  documentUrlDepth?: number
490
- /** Whether to download non-HTML documents (PDF, DOCX, images, code, etc.) instead of skipping them. */
513
+ /**
514
+ * Whether to download non-HTML documents (PDF, DOCX, images, code, etc.) instead of skipping them.
515
+ * Defaults to `true` — unlike `download_assets` and `capture_screenshot`, which default to `false`.
516
+ */
491
517
  downloadDocuments?: boolean
492
518
  /** Maximum size in bytes for document downloads. Defaults to 50 MB. */
493
519
  documentMaxSize?: number
494
520
  /** Allowlist of MIME types to download. If empty, uses built-in defaults. */
495
521
  documentMimeTypes?: Array<string>
522
+ /**
523
+ * Directory to stream downloaded document bytes into instead of holding them in
524
+ * memory on `DownloadedDocument.content`. When set, `content` is left empty and
525
+ * `DownloadedDocument.content_path` is populated with `<dir>/<content_hash>.<ext>`.
526
+ * `None` (default) preserves today's in-memory-only behavior. Has no effect on
527
+ * wasm32, which has no filesystem — use `document_content_encoding` there instead.
528
+ */
529
+ documentOutputDir?: string
530
+ /**
531
+ * Opt-in encoding that duplicates `DownloadedDocument.content` into a serializable
532
+ * field for language bindings that need the bytes in-memory (`content` itself is
533
+ * `alef(skip)`ed). `None` (default) means no encoding is produced. Independent of
534
+ * `document_output_dir` — set both to get a file on disk and an in-memory copy.
535
+ */
536
+ documentContentEncoding?: JsDocumentContentEncoding
496
537
  /** Path to write WARC output. If `None`, WARC output is disabled. */
497
538
  warcOutput?: string
498
- /** Named browser profile for persistent sessions (cookies, localStorage). */
539
+ /**
540
+ * Named browser profile for persistent sessions (cookies, localStorage).
541
+ *
542
+ * Chromiumoxide backend only. The native backend runs an in-process JavaScript
543
+ * engine with no Chrome process and therefore no profile directory, so this is
544
+ * ignored there and logs a warning. It is also ignored — with a warning — when a
545
+ * shared browser pool is in use (the pool launches before any per-crawl config
546
+ * exists) or when connecting to an external CDP endpoint whose process crawlberg
547
+ * does not own.
548
+ */
499
549
  browserProfile?: string
500
550
  /** Whether to save changes back to the browser profile on exit. */
501
551
  saveBrowserProfile?: boolean
@@ -503,11 +553,38 @@ export interface CrawlConfig {
503
553
  * SSRF policy for outbound network requests. Default: deny private networks,
504
554
  * allow http/https only, max 5 redirects.
505
555
  *
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.
556
+ * `deny_private`, `allowlist` and `max_redirects` are exposed to all language
557
+ * bindings. `scheme_allowlist` stays Rust-only — see `SsrfPolicy`.
558
+ *
559
+ * **wasm32 (including Node.js): `deny_private` does not stop hostname-based
560
+ * requests.** There is no DNS resolution on this target, so only a literal IP host is
561
+ * checked against the policy — a domain name is always permitted, regardless of
562
+ * `deny_private`. Under Node, where `fetch` enforces no CORS, this means a service
563
+ * embedding the wasm binding can be driven to internal hosts by domain name even with
564
+ * `deny_private = true`. Enforce egress restrictions at the network layer for that
565
+ * deployment target; do not rely on this field. See `crawlberg.net.validate_url`.
509
566
  */
510
567
  ssrf?: JsSsrfPolicy
568
+ /**
569
+ * Pins `SsrfPolicy.deny_private` to a caller-chosen value, bypassing the
570
+ * `CRAWLBERG_ALLOW_PRIVATE_NETWORK` operator override entirely for this config.
571
+ *
572
+ * `ssrf.deny_private` is a plain, always-serialized `bool`: several alef-generated
573
+ * bindings construct `SsrfPolicy.default()` (hardcoding `deny_private: true`)
574
+ * whenever their caller never touches SSRF settings at all, so `true` on that field
575
+ * alone cannot distinguish "the caller wants private networks denied" from "the
576
+ * binding's own structural default landed on `true`". The environment variable
577
+ * exists precisely to resolve that ambiguity in the common case by treating any
578
+ * `true` as inconclusive and deferring to the operator.
579
+ *
580
+ * Set this field when that default-deferral is wrong for your call — e.g. a test
581
+ * that must prove `deny_private: true` still denies even while the operator has set
582
+ * `CRAWLBERG_ALLOW_PRIVATE_NETWORK` suite-wide for every other call. `None` (default)
583
+ * preserves today's behavior: the environment variable may still flip
584
+ * `ssrf.deny_private` to `false`. `Some(value)` pins `ssrf.deny_private` to `value`
585
+ * and the environment variable is not consulted for this config.
586
+ */
587
+ ssrfDenyPrivateExplicit?: boolean
511
588
  }
512
589
 
513
590
  export declare function crawlConfigDefault(): CrawlConfig
@@ -616,6 +693,19 @@ export interface CrawlStreamRequest {
616
693
  */
617
694
  export declare function createEngine(config?: CrawlConfig | undefined | null): CrawlEngineHandle
618
695
 
696
+ /**
697
+ * Opt-in encoding applied to a downloaded document's bytes for callers who need the
698
+ * content available in a serializable field rather than reading it from disk.
699
+ *
700
+ * `None` (the `CrawlConfig.document_content_encoding` default) produces neither — unlike
701
+ * screenshots, base64-encoding a document by default would duplicate an already
702
+ * up-to-`document_max_size` buffer (50 MB default) in memory per document.
703
+ */
704
+ export declare const enum DocumentContentEncoding {
705
+ /** Populate `DownloadedDocument.content_base64` with a base64-encoded copy. */
706
+ Base64 = 'base_64'
707
+ }
708
+
619
709
  /** A downloaded asset from a page. */
620
710
  export interface DownloadedAsset {
621
711
  /** The original URL of the asset. */
@@ -652,6 +742,21 @@ export interface DownloadedDocument {
652
742
  contentHash?: string
653
743
  /** Selected response headers. */
654
744
  headers?: Record<string, string>
745
+ /**
746
+ * True when `content` (or the file at `content_path`) was truncated to
747
+ * `document_max_size`; `size` still reports the original, untruncated length.
748
+ */
749
+ truncated?: boolean
750
+ /**
751
+ * Filesystem path the document was streamed to when `document_output_dir` was
752
+ * set. `content` is empty in memory when this is populated.
753
+ */
754
+ contentPath?: string
755
+ /**
756
+ * Base64-encoded copy of `content`, populated only when
757
+ * `document_content_encoding` was set to `Base64`.
758
+ */
759
+ contentBase64?: string
655
760
  }
656
761
 
657
762
  /** Metadata about an LLM extraction pass. */
@@ -717,6 +822,28 @@ export interface HeadingInfo {
717
822
  text?: string
718
823
  }
719
824
 
825
+ /**
826
+ * Hostname/IP allowlist matcher for SSRF policy.
827
+ *
828
+ * Serializes as an internally-tagged object so each variant is distinguishable on the
829
+ * wire and round-trips losslessly:
830
+ *
831
+ * ```json
832
+ * {"type": "exact", "value": "api.example.com"}
833
+ * {"type": "suffix", "value": ".example.com"}
834
+ * {"type": "cidr", "value": "10.0.0.0/8"}
835
+ * ```
836
+ *
837
+ * A bare JSON string is still accepted on deserialization and resolves to `Exact`,
838
+ * preserving configs written against the previous untagged representation.
839
+ *
840
+ * `Exact`: HostMatcher.Exact
841
+ */
842
+ export interface HostMatcher {
843
+ type: string
844
+ value?: string
845
+ }
846
+
720
847
  /** An hreflang alternate link entry. */
721
848
  export interface HreflangEntry {
722
849
  /** The language code (e.g., "en", "fr", "x-default"). */
@@ -762,6 +889,13 @@ export interface InteractionResult {
762
889
  finalHtml?: string
763
890
  /** Final page URL (may have changed due to navigation). */
764
891
  finalUrl?: string
892
+ /**
893
+ * Base64-encoded PNG screenshot taken after all actions.
894
+ *
895
+ * Populated only when a `PageAction.Screenshot` action actually ran, so
896
+ * callers that never request a screenshot do not pay the encoding cost.
897
+ */
898
+ screenshotBase64?: string
765
899
  }
766
900
 
767
901
  /** A JSON-LD structured data entry found on a page. */
@@ -1025,6 +1159,14 @@ export interface ScrapeResult {
1025
1159
  extractedData?: any
1026
1160
  /** Metadata about the LLM extraction pass (cost, tokens, model). */
1027
1161
  extractionMeta?: ExtractionMeta
1162
+ /**
1163
+ * Base64-encoded PNG screenshot of the page.
1164
+ *
1165
+ * Populated only when `CrawlConfig.capture_screenshot` was enabled for this
1166
+ * request, so callers that never requested a screenshot do not pay the
1167
+ * encoding cost.
1168
+ */
1169
+ screenshotBase64?: string
1028
1170
  /** Downloaded non-HTML document (PDF, DOCX, image, code, etc.). */
1029
1171
  downloadedDocument?: DownloadedDocument
1030
1172
  /**
@@ -1058,6 +1200,24 @@ export interface SitemapUrl {
1058
1200
  export interface SsrfPolicy {
1059
1201
  /** If true, reject URLs that resolve to private/metadata IP ranges. */
1060
1202
  denyPrivate?: boolean
1203
+ /**
1204
+ * Hostnames and IP ranges permitted regardless of `deny_private`.
1205
+ *
1206
+ * The allowlist is an *override* of `deny_private`, not an intersection with it.
1207
+ * Precedence, in order:
1208
+ *
1209
+ * 1. `deny_private == false` permits everything; the allowlist is not consulted.
1210
+ * 2. A hostname matching an `Exact` or `Suffix` entry is permitted immediately,
1211
+ * *before* DNS resolution — so the deny-list is never applied to it. This trusts
1212
+ * the host string: a name that resolves into private space is still permitted.
1213
+ * 3. A literal or resolved IP inside a `Cidr` entry is permitted even though it is
1214
+ * in the default deny-list.
1215
+ * 4. Otherwise the default deny-list decides.
1216
+ *
1217
+ * An empty allowlist therefore denies nothing by itself — it simply leaves
1218
+ * `deny_private` and the deny-list in sole control.
1219
+ */
1220
+ allowlist?: Array<JsHostMatcher>
1061
1221
  /** Maximum number of HTTP redirects to follow during validation. */
1062
1222
  maxRedirects?: number
1063
1223
  }
@@ -1075,5 +1235,13 @@ export declare function ssrfPolicyDefault(): SsrfPolicy
1075
1235
  * - Outbound requests in a browser go through the fetch API, which enforces its own network policies.
1076
1236
  * - Rust-side SSRF checking is unenforceable and redundant in a wasm32 context.
1077
1237
  * - For testing and localhost access, the host's network sandbox is the enforcing boundary.
1238
+ *
1239
+ * **Node.js caveat:** `deny_private` (whatever its value) has no effect on hostname-based
1240
+ * requests under `wasm32`. There is no DNS resolution on this target, so `validate_url`
1241
+ * only ever checks a literal IP host; a domain name falls straight through to `Ok(())`. In a
1242
+ * browser this is covered by same-origin/CORS. Node's `fetch` enforces no CORS, so a Node
1243
+ * service embedding this wasm module can be driven to internal hosts by domain name even
1244
+ * though `deny_private = true`. Do not rely on this policy to stop that in Node — enforce
1245
+ * egress restrictions (network policy, firewall, proxy allowlist) outside the process.
1078
1246
  */
1079
1247
  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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
80
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
96
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
117
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
133
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
166
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
185
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
201
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
217
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
237
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
253
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
274
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
290
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
308
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
324
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
342
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
358
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
376
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
392
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
410
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
426
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
459
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
479
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
495
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4' && 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.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
511
+ if (bindingPackageVersion !== '1.2.1' && 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.1 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.4",
3
+ "version": "1.2.1",
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.4",
26
- "@xberg-io/crawlberg-darwin-x64": "1.1.4",
27
- "@xberg-io/crawlberg-linux-arm64-gnu": "1.1.4",
28
- "@xberg-io/crawlberg-linux-arm64-musl": "1.1.4",
29
- "@xberg-io/crawlberg-linux-x64-gnu": "1.1.4",
30
- "@xberg-io/crawlberg-linux-x64-musl": "1.1.4",
31
- "@xberg-io/crawlberg-win32-arm64-msvc": "1.1.4",
32
- "@xberg-io/crawlberg-win32-x64-msvc": "1.1.4"
25
+ "@xberg-io/crawlberg-darwin-arm64": "1.2.1",
26
+ "@xberg-io/crawlberg-darwin-x64": "1.2.1",
27
+ "@xberg-io/crawlberg-linux-arm64-gnu": "1.2.1",
28
+ "@xberg-io/crawlberg-linux-arm64-musl": "1.2.1",
29
+ "@xberg-io/crawlberg-linux-x64-gnu": "1.2.1",
30
+ "@xberg-io/crawlberg-linux-x64-musl": "1.2.1",
31
+ "@xberg-io/crawlberg-win32-arm64-msvc": "1.2.1",
32
+ "@xberg-io/crawlberg-win32-x64-msvc": "1.2.1"
33
33
  },
34
34
  "napi": {
35
35
  "packageName": "@xberg-io/crawlberg",