Skip to content

Conversation

@jaipaljadeja
Copy link
Member

removes esbuild plugin from rollup config due to some issues with build, also adds missing internalContext plugin from vcr and updates tests for cli example.

@jaipaljadeja jaipaljadeja force-pushed the fix/rollup-build-plugin-esbuild branch from 1c43bee to 3421b22 Compare February 19, 2025 12:35
@coderabbitai
Copy link

coderabbitai bot commented Feb 19, 2025

📝 Walkthrough

Walkthrough

This pull request introduces new prerelease JSON metadata for the packages @apibara/indexer and apibara, updating release comments and dependent change types. Test files for Ethereum and Starknet indexers have been modified to exclude fields (_id, _cursor) from snapshot assertions. The Rollup configuration has been updated by removing the esbuild plugin and expanding warning criteria. Additionally, error handling in the internal context plugin has been refined, and its integration into the indexer’s plugin stack has been added. A new TypeScript dependency has also been included in the starknet-client package.

Changes

File(s) Change Summary
change/@apibara-indexer-7d0fe9aa-…edd3ec.json, change/apibara-613baa45-cb22-4333-…a9a.json Added new JSON objects with prerelease metadata for @apibara/indexer and apibara, including release type, comments, email, and patch dependency.
examples/cli/test/ethereum.test.ts, examples/cli/test/starknet.test.ts Modified test assertions to map over rows and exclude fields (e.g., _id, _cursor), updating inline snapshots accordingly.
examples/starknet-client/package.json Added typescript as a devDependency with version ^5.6.2.
packages/cli/src/rollup/config.ts Removed the esbuild plugin from the Rollup configuration and enhanced the onwarn function to check for "/*#__PURE__*/" in warning messages.
packages/indexer/src/plugins/context.ts, packages/indexer/src/testing/index.ts Updated error handling in the internal context plugin (using an explicit undefined check and expanded error message) and integrated the internalContext plugin into the indexer configuration in createVcr.

Sequence Diagram(s)

sequenceDiagram
    participant Caller as "Test/Caller"
    participant VCR as "createVcr()"
    participant InternalPlugin as "internalContext Plugin"
    participant LoggerPlugin as "Logger Plugin"

    Caller->>VCR: Request VCR creation
    VCR->>InternalPlugin: Initialize internal context\n(set indexerName & availableIndexers)
    VCR->>LoggerPlugin: Append logger plugin
    VCR-->>Caller: Return configured VCR with plugins
Loading

Possibly related PRs

Suggested reviewers

  • fracek

Poem

I'm a rabbit, hopping with glee,
Codes have shifted in our repository tree.
Prerelease magic in JSON so neat,
Tests now focus on what is complete.
With plugins and warnings all in a row,
I celebrate these changes—off we go! 🐰
Hooray for code that makes our systems glow!

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@jaipaljadeja jaipaljadeja requested a review from fracek February 19, 2025 12:37
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
examples/starknet-client/package.json (1)

22-23: Consider pinning the TypeScript version.

The addition of TypeScript as a devDependency is good for type safety. However, consider pinning the TypeScript version to avoid potential breaking changes from minor version updates.

Apply this diff to pin the TypeScript version:

-    "typescript": "^5.6.2"
+    "typescript": "5.6.2"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 913b0c5 and 3421b22.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • change/@apibara-indexer-7d0fe9aa-5dc3-4ba2-96c2-26a750edd3ec.json (1 hunks)
  • change/apibara-613baa45-cb22-4333-9430-93f356634a9a.json (1 hunks)
  • examples/cli/test/ethereum.test.ts (1 hunks)
  • examples/cli/test/starknet.test.ts (1 hunks)
  • examples/starknet-client/package.json (1 hunks)
  • packages/cli/src/rollup/config.ts (1 hunks)
  • packages/indexer/src/plugins/context.ts (1 hunks)
  • packages/indexer/src/testing/index.ts (2 hunks)
✅ Files skipped from review due to trivial changes (2)
  • change/@apibara-indexer-7d0fe9aa-5dc3-4ba2-96c2-26a750edd3ec.json
  • change/apibara-613baa45-cb22-4333-9430-93f356634a9a.json
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (7)
packages/indexer/src/plugins/context.ts (1)

33-37: LGTM! Improved error handling.

The changes enhance error handling by:

  1. Using an explicit undefined check instead of a truthy check, preventing false negatives
  2. Providing a more descriptive error message that helps users identify the potential cause
packages/indexer/src/testing/index.ts (1)

32-39: LGTM! Properly configured internalContext plugin.

The changes ensure that the internalContext plugin is:

  1. Always included as the first plugin
  2. Properly configured with meaningful context values derived from cassetteName
examples/cli/test/ethereum.test.ts (1)

35-35: LGTM! Improved test snapshot.

The changes improve test maintainability by excluding implementation details (_id field) from the snapshot, focusing on relevant business data.

packages/cli/src/rollup/config.ts (2)

54-55: LGTM! Added filters for PURE annotation warnings.

The changes properly handle PURE annotation warnings by filtering them out.


1-87:

❓ Verification inconclusive

Verify the impact of removing esbuild plugin.

The removal of the esbuild plugin might affect:

  1. ES features transpilation
  2. Source map generation
  3. Build performance

Let's check the package.json and tsconfig.json files to ensure proper configuration without esbuild:


🏁 Script executed:

#!/bin/bash
# Description: Check TypeScript and build configuration

# Check package.json for relevant build dependencies and scripts
echo "Checking package.json..."
fd -t f "package.json" -x cat {} \; | jq -r '.dependencies,.devDependencies,.scripts'

# Check tsconfig.json for target configuration
echo "Checking tsconfig.json..."
fd -t f "tsconfig.json" -x cat {} \;

Length of output: 12309


Verify Removal of esbuild Plugin Impact

Based on our review of the build configuration:

  • Transpilation: TypeScript settings and the current Rollup plugins (e.g. esmShim, commonjs, nodeResolve) appear to adequately handle ES feature transpilation.
  • Source Maps: Sourcemap generation is explicitly enabled in the Rollup output configuration, so this aspect remains intact.
  • Build Performance: Removing the esbuild plugin might affect build speed if it was previously accelerating transpilation. Verify that the alternative process meets performance expectations.

If the removal of the esbuild plugin is intentional, consider cleaning up its related dependencies from package.json to avoid confusion.

examples/cli/test/starknet.test.ts (2)

35-35: LGTM! Simplified snapshot assertion.

The change to exclude _id from the snapshot assertion helps focus on the essential transaction details (hash and number).


35-35: Verify if _cursor should also be excluded from the snapshot.

The AI summary indicates that both _id and _cursor properties should be excluded, but the code only excludes _id. Please verify if _cursor should also be excluded from the snapshot assertion.

Likely an incorrect or invalid review comment.

Copy link
Contributor

@fracek fracek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you

@fracek fracek merged commit 48b9548 into apibara:main Feb 19, 2025
2 checks passed
@jaipaljadeja jaipaljadeja deleted the fix/rollup-build-plugin-esbuild branch March 11, 2025 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants