Skip to content

Conversation

@colinhacks
Copy link
Owner

@colinhacks colinhacks commented Apr 10, 2025

Summary by CodeRabbit

  • New Features

    • Introduced CIDR validation support for both IPv4 and IPv6.
    • Added several new schema methods for richer object and numeric validations.
  • API Updates

    • Simplified date and time format identifiers (e.g., "datetime" replaces "iso_datetime").
    • Replaced the chained intersection method with a dedicated intersection function.
  • Documentation & Performance

    • Updated documentation with new API guidance.
    • Achieved significant bundle size reductions and enhanced performance.
  • Dependency Updates

    • Upgraded core packages to version 4.0.0.

@vercel
Copy link

vercel bot commented Apr 10, 2025

Deployment failed with the following error:

There is no GitHub account connected to this Vercel account.

@colinhacks
Copy link
Owner Author

@coderabbitai review

@colinhacks colinhacks merged commit 5216359 into v4 Apr 10, 2025
3 checks passed
@colinhacks colinhacks deleted the v4-cidr branch April 10, 2025 03:18
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 10, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This change set spans multiple packages and files to update configuration settings, dependency versions, and schema validation logic across the codebase. It renames ISO-format identifiers to simpler strings, removes the deprecated .and() method in favor of z.intersection(), and adds new functions and types for CIDR validation. Core utilities are refactored to use native methods, and documentation is updated to reflect these API changes and improved bundle metrics.

Changes

File(s) Change Summary
.npmrc, global rollup.config.js Commented out prefer-workspace-packages in .npmrc; updated Rollup config to use custom conditions (empty object/customConditions added).
Root & Package package.json files Updated version numbers (e.g., from 3.24.2 to 4.0.0) and added a new dependency alias "zod3": "npm:zod@^3.24.0" in the treeshake package.
packages/core/src/api.ts, checks.ts, locales, regexes.ts, schemas.ts, to-json-schema.ts, util.ts, zsf.ts Renamed ISO format strings (e.g. "iso_datetime""datetime") and corresponding keys; added new CIDR functions (_cidrv4, _cidrv6) with types; updated regex patterns; removed .and() method.
packages/docs/content/**.mdx Removed references to the deprecated .and() method; documented new CIDR methods, updated bundle size metrics, and noted additional API changes.
packages/mini/src/iso.ts, schemas.ts Updated ISO type parameters from specific ISO strings to generic formats; added new CIDR interfaces and helper functions.
packages/treeshake/** Refactored validation framework in out.js (added new classes/functions, removed old config functions); updated treeshake Rollup config; added new boolean demo files.
packages/zod/src/errors.ts, schemas.ts, tests (interface, intersection, json-schema, object, string, template-literal) Adjusted error inheritance; removed .and() and introduced new CIDR methods; updated tests to use z.intersection() and validate the new generic format strings and CIDR validations.
Miscellaneous (e.g. play.ts, packages/tsc/bench/strongly-connected.ts) Added a new object schema extension in play.ts; minor formatting adjustments (additional blank lines) in benchmark files.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ZodAPI
    participant CoreAPI
    participant RegexEngine

    User->>ZodAPI: Create CIDR schema (cidrv4 or cidrv6)
    ZodAPI->>CoreAPI: Call _cidrv4/_cidrv6 with parameters
    CoreAPI->>RegexEngine: Validate input against CIDR regex
    RegexEngine-->>CoreAPI: Return validation result
    CoreAPI-->>ZodAPI: Return configured schema instance
    ZodAPI-->>User: Schema ready for CIDR validation
Loading
sequenceDiagram
    participant User
    participant ZodAPI
    participant IntersectionFunc

    User->>ZodAPI: Request schema intersection
    ZodAPI->>IntersectionFunc: Call z.intersection(schemaA, schemaB)
    IntersectionFunc-->>ZodAPI: Return intersected schema
    ZodAPI-->>User: Intersected schema available
Loading

Poem

I'm a rabbit, hopping through lines of code,
New CIDR checks and cleaner formats now bestowed.
ISO strings shed their old "iso_" skin,
And intersections form where once .and() had been.
With every commit, my ears perk in delight,
Coding in wonder from morning 'til night! 🐰


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 47abe38 and 202e5a1.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (36)
  • .npmrc (1 hunks)
  • package.json (1 hunks)
  • packages/core/src/api.ts (5 hunks)
  • packages/core/src/checks.ts (1 hunks)
  • packages/core/src/locales/en-GB.ts (1 hunks)
  • packages/core/src/locales/en.ts (1 hunks)
  • packages/core/src/regexes.ts (2 hunks)
  • packages/core/src/schemas.ts (9 hunks)
  • packages/core/src/to-json-schema.ts (2 hunks)
  • packages/core/src/util.ts (2 hunks)
  • packages/core/src/zsf.ts (1 hunks)
  • packages/docs/content/packages/zod.mdx (0 hunks)
  • packages/docs/content/v4/changelog.mdx (3 hunks)
  • packages/docs/content/v4/index.mdx (4 hunks)
  • packages/mini/package.json (1 hunks)
  • packages/mini/src/iso.ts (4 hunks)
  • packages/mini/src/schemas.ts (1 hunks)
  • packages/treeshake/out.js (1 hunks)
  • packages/treeshake/package.json (1 hunks)
  • packages/treeshake/rollup.config.js (1 hunks)
  • packages/treeshake/valibot-boolean.ts (1 hunks)
  • packages/treeshake/zod-boolean.ts (1 hunks)
  • packages/treeshake/zod-mini-boolean.ts (1 hunks)
  • packages/treeshake/zod3-boolean.ts (1 hunks)
  • packages/tsc/bench/strongly-connected.ts (1 hunks)
  • packages/zod/package.json (1 hunks)
  • packages/zod/src/errors.ts (1 hunks)
  • packages/zod/src/schemas.ts (7 hunks)
  • packages/zod/tests/interface.test.ts (2 hunks)
  • packages/zod/tests/intersection.test.ts (3 hunks)
  • packages/zod/tests/json-schema.test.ts (3 hunks)
  • packages/zod/tests/object.test.ts (2 hunks)
  • packages/zod/tests/string.test.ts (3 hunks)
  • packages/zod/tests/template-literal.test.ts (1 hunks)
  • play.ts (1 hunks)
  • rollup.config.js (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 10, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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