Skip to content

fix(scraper-tools): restore saveSnapshot() under content-type v2 - #361

Merged
nikitachapovskii-dev merged 1 commit into
masterfrom
fix/content-type-v2-default-import
Sep 3, 2026
Merged

fix(scraper-tools): restore saveSnapshot() under content-type v2#361
nikitachapovskii-dev merged 1 commit into
masterfrom
fix/content-type-v2-default-import

Conversation

@nikitachapovskii-dev

Copy link
Copy Markdown
Contributor

context: https://apify.slack.com/archives/C09TL7LMJE9/p1788355444863089

content-type v2 marks its CommonJS output __esModule without exporting a default, so __importDefault left .default undefined and every context.saveSnapshot() call threw. A named import emits a plain require
with no interop shim. Introduced by the ^1.0.5 -> ^2.0.0 bump in #347, shipped to Cheerio and jsdom Scraper in the 2026-08-31 stable builds.

@nikitachapovskii-dev nikitachapovskii-dev self-assigned this Sep 2, 2026
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: apify/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Essentials

Run ID: 3f595b52-c7c9-43f3-9f8d-89e896281de9

📥 Commits

Reviewing files that changed from the base of the PR and between 96e3896 and 58595d6.

📒 Files selected for processing (2)
  • packages/actor-scraper/web-scraper/src/internals/crawler_setup.ts
  • packages/scraper-tools/src/context.ts

Included review availability: Your plan provides up to 5 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Walkthrough

The crawler now imports and calls the named parse function from content-type for XML detection. Snapshot saving now imports and calls the named format function. Invalid content types, XML detection, and null handling remain unchanged.

Merge Risk: ⚪ Minimal · up to 58595

The change restores snapshot saving and XML content-type handling with content-type v2 named APIs. No current merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the fix and the affected scraper-tools function. It accurately summarizes the main change: restoring saveSnapshot() compatibility with content-type v2.
Description check ✅ Passed The description is directly related to the changeset. It explains the content-type v2 CommonJS interop failure, the affected saveSnapshot() calls, and the named-import fix.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@nikitachapovskii-dev
nikitachapovskii-dev force-pushed the fix/content-type-v2-default-import branch from 36feb7b to 58595d6 Compare September 3, 2026 07:19
@nikitachapovskii-dev
nikitachapovskii-dev marked this pull request as ready for review September 3, 2026 07:20
@nikitachapovskii-dev

Copy link
Copy Markdown
Contributor Author

@nicklamonov nicklamonov added the adhoc Ad-hoc / cross-cutting work label Sep 3, 2026
@nikitachapovskii-dev
nikitachapovskii-dev merged commit 236f190 into master Sep 3, 2026
12 checks passed
@nikitachapovskii-dev
nikitachapovskii-dev deleted the fix/content-type-v2-default-import branch September 3, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc / cross-cutting work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants