Skip to content

Comments

feat!: transform to pure ESM package and requires Node 20+#59

Merged
chenjiahan merged 1 commit intomainfrom
pure_esm_0203
Feb 3, 2026
Merged

feat!: transform to pure ESM package and requires Node 20+#59
chenjiahan merged 1 commit intomainfrom
pure_esm_0203

Conversation

@chenjiahan
Copy link
Member

  • Updated package.json to use only the ES module entry point by removing the CommonJS export and the main field
  • Changed the build configuration in rslib.config.ts to remove the CommonJS build.
  • Added an engines field to package.json to require Node.js version ^20.19.0 or >=22.12.0.

Copilot AI review requested due to automatic review settings February 3, 2026 06:21
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@gemini-code-assist
Copy link

Summary of Changes

Hello @chenjiahan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly modernizes the rslog package by transitioning it to a pure ES Module (ESM) format. This change removes legacy CommonJS support, streamlining the package's architecture and aligning it with current JavaScript module standards. Consequently, the minimum required Node.js version has been elevated to ensure compatibility with the pure ESM environment, simplifying the build process and updating usage examples in the documentation.

Highlights

  • Pure ES Module (ESM) Transformation: The package has been fully transformed into a pure ES Module (ESM), removing all CommonJS (CJS) entry points and build artifacts to align with modern JavaScript standards.
  • Node.js Version Requirement Update: The minimum required Node.js version has been updated to ^20.19.0 or >=22.12.0 to ensure compatibility with the pure ESM environment and modern language features.
  • Simplified Build Configuration: The build configuration has been streamlined to focus solely on generating ESM output, removing the CommonJS build target and simplifying the overall build process.
  • Documentation and Test Updates: Usage examples in the README.md and references in test files have been updated to reflect the removal of CommonJS paths and the new ESM-only distribution.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • README.md
    • Removed the CommonJS require usage example, now only showing the ES Module import syntax.
  • package.json
    • Modified the exports field to exclusively use "default": "./dist/index.js", removing separate import and require entries.
    • Removed the main field, which previously pointed to the CommonJS entry point.
    • Added an engines field to enforce Node.js version ^20.19.0 || >=22.12.0.
  • rslib.config.ts
    • Simplified the lib configuration to a single entry [{ syntax: 'es2023', dts: true }], effectively removing the CommonJS build target.
  • tests/utils.test.ts
    • Updated a test string to remove the cjs path reference, reflecting the new ESM-only distribution.
Activity
  • No specific activity (comments, reviews, etc.) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@chenjiahan chenjiahan merged commit abe29fd into main Feb 3, 2026
8 checks passed
@chenjiahan chenjiahan deleted the pure_esm_0203 branch February 3, 2026 06:22
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly transitions the package to be pure ESM, dropping CommonJS support and requiring Node.js 20+. The changes across package.json, rslib.config.ts, and the README.md usage example are all aligned with this goal. I've made one suggestion to improve the exports map in package.json for better ecosystem compatibility. As a follow-up, you may also want to update the 'Environment' section in README.md to reflect these new package requirements, as that part of the file was not in the diff.

"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
"default": "./dist/index.js"

Choose a reason for hiding this comment

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

medium

For better clarity and compatibility with tooling that uses conditional exports, it's a good practice to explicitly define the import condition for ESM packages. While default works as a fallback, explicitly adding the import condition makes the package's entry points clearer for bundlers and runtimes.

      "import": "./dist/index.js",
      "default": "./dist/index.js"

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR transforms the rslog package from a dual CommonJS/ESM distribution to a pure ESM package and establishes a minimum Node.js version requirement of 20.19.0 or 22.12.0+. This is a breaking change that simplifies the package's module system.

Changes:

  • Removed CommonJS build output and exports, keeping only ESM distribution
  • Updated build configuration to output only ESM format with ES2023 syntax
  • Added Node.js engine requirements to enforce minimum versions

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
package.json Removed main field and CommonJS export, replaced import field with default export, added engines constraint for Node 20.19.0+/22.12.0+
rslib.config.ts Simplified build configuration to single ESM output with ES2023 syntax, removed explicit CJS build
tests/utils.test.ts Updated test string to reflect new ESM-only output path (removed /cjs/ from path)
README.md Removed CommonJS usage example, showing only ESM import syntax

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

syntax: 'es2021',
},
],
lib: [{ syntax: 'es2023', dts: true }],
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

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

The format field should be explicitly set to 'esm' when configuring the library build. While rslib may default to ESM when type: "module" is set in package.json, it's better to be explicit about the output format in the build configuration to avoid ambiguity and ensure the correct module format is generated. Add format: 'esm' to the configuration object.

Suggested change
lib: [{ syntax: 'es2023', dts: true }],
lib: [{ syntax: 'es2023', dts: true, format: 'esm' }],

Copilot uses AI. Check for mistakes.
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.

1 participant