Skip to content

Conversation

@RobinTail
Copy link
Owner

@RobinTail RobinTail commented Jul 12, 2025

It turned out that all LTS versions of Node.js might already support require(ESM).

https://nodejs.org/api/modules.html#loading-ecmascript-modules-using-require

Unflagged in: v23.0.0, v22.12.0, v20.19.0
And those are exactly the ones in v25

Summary by CodeRabbit

  • Chores
    • Updated build and packaging configuration to support only ES modules, removing CommonJS outputs and related type declarations.
    • Simplified package entry points and exports for a more streamlined ES module experience.

@RobinTail RobinTail added CI/CD breaking Backward incompatible changes labels Jul 12, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 12, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes consolidate the build and export configurations of two packages to use only ES modules, removing all CommonJS support. This includes updating build scripts, modifying the main, types, and exports fields in package.json, and simplifying build tool configurations to output only ES modules.

Changes

Files/Paths Change Summary
express-zod-api/package.json, migration/package.json Updated main, types, and exports fields to point only to ES module outputs; updated postbuild script to use --profile esm-only; removed CommonJS references.
express-zod-api/tsup.config.ts Removed logic for downgrading dynamic import support for CommonJS; now only sets environment variables.
tsup.base.ts Changed build output format from both "cjs" and "esm" to only "esm".

Suggested labels

dependencies

Poem

🐰
The modules now are ESM,
No CJS to debug or condemn.
With configs light and exports neat,
Our builds are now a single treat.
The rabbit hops with glee today,
For CommonJS has hopped away!


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.

@coveralls-official
Copy link

coveralls-official bot commented Jul 12, 2025

Coverage Status

coverage: 100.0%. remained the same
when pulling a012b66 on pure-esm
into 089977f on make-v25.

@RobinTail
Copy link
Owner Author

Experiment seems to be a success

@RobinTail RobinTail changed the title Exp: Pure ESM Pure ESM distribution Jul 12, 2025
@RobinTail RobinTail added this to the v25 milestone Jul 12, 2025
@RobinTail RobinTail marked this pull request as ready for review July 12, 2025 21:13
@RobinTail
Copy link
Owner Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 12, 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.

@RobinTail RobinTail added the dependencies Pull requests that update a dependency file label Jul 12, 2025
@RobinTail
Copy link
Owner Author

I can't believe that we, as the humanity, have finally reached this point!

@RobinTail RobinTail added the documentation Improvements or additions to documentation label Jul 12, 2025
@RobinTail RobinTail merged commit 7c284a3 into make-v25 Jul 12, 2025
13 checks passed
@RobinTail RobinTail deleted the pure-esm branch July 12, 2025 21:31
@RobinTail RobinTail added the miracle Mysterious events are happening here label Jul 12, 2025
RobinTail added a commit that referenced this pull request Aug 2, 2025
### Dedication


![image](https://github.com/user-attachments/assets/47dc18f9-70fa-4276-9c79-2a84ef360642)

**Sara Millerey González** was a 32 years young trans woman from Bello,
Antioquia, Colombia.
She was killed in April 2025. Millerey was raped, tortured, and thrown
into a ravine by a group of men. Denounced as a hate crime by press and
Antioquia's mayor, the Colombian National Working Group on Violence
Based on Victims' Sexual Orientation or Gender Identity is collaborating
with the Attorney's General's Office on identifying remaining suspects.

Transgender women suffer too frequently from transphobic violence and
cruelty, being the less protected social group. I'd like to raise an
awareness of this problem. Humans should be creators — not killers. But
most importantly, I want every transgender girl to have an opportunity
to create applications quickly and, in general, learn to write code
easily in order to receive job offers and leave dangerously transphobic
territories for more favorable and civilized ones, and live happily
there. Protect transgender women.

### Breaking

- `zod` version is `^4.0.0`;
  - Compatibility with `zod@^3` is dropped;
  - You SHOULD now `import { z } from "zod"` without the `/v4` suffix;
- Node.js version is `^20.19.0 || ^22.12.0 || ^24.0.0`;
  - The framework distribution is now ESM-only (finally);
  - All the Node.js versions listed above support `require(ESM)` syntax;
- Changes to the `Middleware` class:
- When the `input` schema is not defined, the `input` argument of the
`handler` method is now `unknown`;
- Plugin changes to metadata:
  - `example` removed;
  - object-based `examples` removed (only array remains);
- use either `.example()` or `.meta({})` with `examples` being an array.
- Public `getExamples()` helper removed:
  - use `.meta()?.examples` or `globalRegistry.get()?.examples` instead.

### Content

- #2622 
- #2711 
- #2740 
- #2742 
- #2777 
- #2809 
- #2814 
- #2815 
- #2842 
- #2843 
- #2844 

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Summary by CodeRabbit

* **New Features**
* Dropped support for Zod v3; now requires Zod v4 and updates all
imports to use `"zod"` directly.
* Framework is now distributed as ESM-only and supports Node.js
^20.19.0, ^22.12.0, or ^24.0.0.
  * Introduced a unified empty schema utility for input/output defaults.
* Added Vitest configuration with experimental eventsource flag for
testing.

* **Breaking Changes**
* Removed the public `getExamples()` helper; access examples via
`.meta()?.examples` or the global registry.
* Middleware and factory input schemas now default to `undefined` when
omitted, not an empty object schema.
* Dropped support for object-based `examples` in schema metadata; use
`.example()` or array-based `examples` instead.
* Removed deprecated enum and literal depicters from documentation
helpers.
* Updated import paths from `"zod/v4"` to `"zod"` throughout codebase
and examples.
* Adjusted migration rules to reflect import and metadata changes only.

* **Bug Fixes**
* Improved handling of empty schemas and type inference for middleware
and endpoint factories.

* **Chores**
* Updated documentation and changelogs for new Zod import paths and
version requirements.
* Updated build, test, and lint configurations for ESM-only output and
new dependency versions.
* Adjusted GitHub workflows to monitor new branches and updated Node.js
versions.
* Removed legacy migration rules and simplified migration logic focusing
on import and metadata changes.
* Removed legacy dependencies like `undici` and adjusted package
metadata.
  * Simplified ESLint and tsup configurations for ESM-only builds.
  * Updated startup logo dedication message.

* **Tests**
* Refactored and updated tests to align with new schema defaults and Zod
v4 usage.
* Simplified migration tests and rules to focus on import path changes.
  * Added tests for new empty schema utilities.

* **Style**
  * Updated dedication message in the startup logo.

* **Revert**
* Removed legacy and deprecated migration logic and configuration
overrides.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@coderabbitai coderabbitai bot mentioned this pull request Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Backward incompatible changes CI/CD dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation miracle Mysterious events are happening here

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants