feat!: transform to pure ESM package and requires Node 20+#59
feat!: transform to pure ESM package and requires Node 20+#59chenjiahan merged 1 commit intomainfrom
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary of ChangesHello @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 Highlights
🧠 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
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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"There was a problem hiding this comment.
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 }], |
There was a problem hiding this comment.
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.
| lib: [{ syntax: 'es2023', dts: true }], | |
| lib: [{ syntax: 'es2023', dts: true, format: 'esm' }], |
package.jsonto use only the ES module entry point by removing the CommonJS export and themainfieldrslib.config.tsto remove the CommonJS build.enginesfield topackage.jsonto require Node.js version^20.19.0or>=22.12.0.