Skip to content

Conversation

@gdorsi
Copy link
Contributor

@gdorsi gdorsi commented May 23, 2025

Follow up for #4489

fixes #4470

In that PR was missing:

  • adding the new entries to the files array in the package.json to make them part of the published package
  • filling the missing entries required for the internal imports

Tested on React Native 0.76.7 using the following snippet:

import { z } from "zod";
import * as zMini from "zod/v4-mini";
import * as z3 from "zod/v3";
import * as z4 from "zod/v4";

console.log(z.object({ name: z.string() }).parse({ name: "John" }));
console.log(z3.object({ name: z3.string() }).parse({ name: "John" }));
console.log(zMini.object({ name: zMini.string() }).parse({ name: "John" }));
console.log(z4.object({ name: z4.string() }).parse({ name: "John" }));

Summary by CodeRabbit

  • New Features

    • Added new entry points for core and locale modules, allowing easier imports for consumers.
    • Included additional directories in the package to make new modules available.
  • Chores

    • Updated packaging configuration to include new directories and files.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 23, 2025

Walkthrough

This update adds several new proxy files in the zod package's v4 directory, including both JavaScript and TypeScript declaration files. These files re-export modules from internal dist directories, and the package metadata is updated to include new directories for packaging. No new logic or API changes are introduced.

Changes

File(s) Change Summary
packages/zod/package.json Updated "files" array to include "v3", "v4", and "v4-mini" directories for packaging.
packages/zod/v4/core/index.d.ts Added export-all statement re-exporting from ../../dist/types/v4/core/index.d.ts.
packages/zod/v4/core/index.js New file that re-exports all exports from ../../dist/esm/v4/core/index.js.
packages/zod/v4/locales/en.d.ts, packages/zod/v4/locales/en.js New files that re-export all (and default) exports from ../../dist/types/v4/locales/en.d.ts and ../../dist/esm/v4/locales/en.js.
packages/zod/v4/locales/index.d.ts, packages/zod/v4/locales/index.js New files that re-export all exports from ../../dist/types/v4/locales/index.d.ts and ../../dist/esm/v4/locales/index.js.

Sequence Diagram(s)

sequenceDiagram
    participant Consumer
    participant ProxyModule (e.g. v4/core/index.js)
    participant InternalModule (e.g. dist/esm/v4/core/index.js)

    Consumer->>ProxyModule: import { X } from "zod/v4/core"
    ProxyModule->>InternalModule: import { X } from "../../dist/esm/v4/core/index.js"
    InternalModule-->>ProxyModule: export { X }
    ProxyModule-->>Consumer: export { X }
Loading

Assessment against linked issues

Objective Addressed Explanation
Add support for resolving "zod/v4-mini" in React Native projects (#4470)

Possibly related PRs

Poem

In Zod’s great halls, new proxies appear,
Exports re-routed, the structure is clear.
From locales to core, the modules now flow,
With packaging tweaks, it’s ready to go.
No logic was changed, just a path to the show—
Now importing is easier, as everyone knows!
✨📦

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


📜 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 ca82f6a and 13f4eaf.

📒 Files selected for processing (7)
  • packages/zod/package.json (1 hunks)
  • packages/zod/v4/core/index.d.ts (1 hunks)
  • packages/zod/v4/core/index.js (1 hunks)
  • packages/zod/v4/locales/en.d.ts (1 hunks)
  • packages/zod/v4/locales/en.js (1 hunks)
  • packages/zod/v4/locales/index.d.ts (1 hunks)
  • packages/zod/v4/locales/index.js (1 hunks)
🔇 Additional comments (7)
packages/zod/v4/core/index.d.ts (1)

1-1: Nice fix! The re-export path looks solid now.

Great job addressing the previous feedback about the path mismatch. This now correctly points to the core types as intended.

packages/zod/v4/locales/index.js (1)

1-1: Clean and simple proxy setup.

This re-export looks good and follows the expected pattern for forwarding runtime exports from the ESM build.

packages/zod/v4/locales/en.d.ts (1)

1-2: Solid dual export pattern here.

The combination of export * and export { default } is perfect for ensuring both named and default exports get properly forwarded. This covers all the bases nicely.

packages/zod/v4/locales/index.d.ts (1)

1-1: Looks good - consistent with the other proxy files.

This follows the same clean pattern for forwarding type declarations. The path structure is spot on and maintains consistency across the v4 module structure.

packages/zod/v4/core/index.js (1)

1-1: Heads-up on default exports
Nice proxy, but export * doesn’t forward a default export. If ../../dist/esm/v4/core/index.js has a default, you may want to add:

export { default } from "../../dist/esm/v4/core/index.js";
packages/zod/package.json (1)

7-7: Include versioned directories in published files
Great addition of "v3", "v4", and "v4-mini" to the files array so the new proxies get shipped.

packages/zod/v4/locales/en.js (1)

1-2: Solid re-export of locale “en”
Exporting both named and default ensures full coverage of the locale module.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @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.

Copy link
Contributor

@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: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 29aba82 and 9f9be99.

📒 Files selected for processing (7)
  • packages/zod/package.json (1 hunks)
  • packages/zod/v4/core/index.d.ts (1 hunks)
  • packages/zod/v4/core/index.js (1 hunks)
  • packages/zod/v4/locales/en.d.ts (1 hunks)
  • packages/zod/v4/locales/en.js (1 hunks)
  • packages/zod/v4/locales/index.d.ts (1 hunks)
  • packages/zod/v4/locales/index.js (1 hunks)
🔇 Additional comments (6)
packages/zod/v4/locales/index.js (1)

1-1: Nice proxy setup here!
Soft proxy exporting from the ESM build looks correct and consistent with other v4 modules.

packages/zod/v4/locales/en.d.ts (1)

1-2: Default & named re-exports look solid
You’re correctly forwarding all named exports and the default export from the dist declaration. Looks good for TS consumers.

packages/zod/v4/locales/index.d.ts (1)

1-1: Double-check export target
This file in v4/locales re-exports from core/index.d.ts. Should it target locales/index.d.ts instead? If it’s intentional, a quick note might help future readers.

packages/zod/v4/core/index.js (1)

1-1: All good on the JS proxy
This mirrors the TS declaration proxy and correctly points to the ESM core build.

packages/zod/v4/locales/en.js (1)

1-2: Proxy export looks solid. This module cleanly re-exports both all named exports and the default export from the compiled ESM build at ../../dist/esm/v4/locales/en.js, making the v4/locales/en.js entry point seamless for consumers.

packages/zod/package.json (1)

7-7: Files array updated correctly. Including "v3", "v4", and "v4-mini" here ensures your new versioned directories get packaged. Just double-check that the on-disk folder names exactly match these entries so nothing gets left out.

@colinhacks colinhacks merged commit 7bd15ed into colinhacks:main May 23, 2025
5 checks passed
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.

Unable to resolve "zod/v4-mini" in react-native project

2 participants