Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR transitions the project from a dual CommonJS/ESM build setup to ESM-only, representing a breaking change that simplifies the build configuration and modernizes the package structure.
- Removes dual build system and related TypeScript configurations
- Updates package.json to specify "type": "module" and consolidates entry points
- Replaces CommonJS module detection pattern with ESM equivalent using import.meta.url
Reviewed Changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.test.json | Removed test-specific TypeScript configuration |
| tsconfig.mjs.json | Removed ESM-specific TypeScript configuration |
| tsconfig.cjs.json | Removed CommonJS-specific TypeScript configuration |
| src/index.ts | Updated module detection from require.main to import.meta.url pattern |
| package.json | Set module type to ESM, updated build scripts, and replaced ts-node with tsx |
| fixup.sh | Removed build script that created dual package.json files |
| .eslintrc | Minor formatting cleanup and removed mocha environment |
| .cfignore | Removed Cloud Foundry ignore file |
| .babelrc | Removed Babel configuration |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Comment on lines
+82
to
+89
| if (import.meta.url.startsWith("file:")) { | ||
| const modulePath = url.fileURLToPath(import.meta.url); | ||
| // Compare the module's path to the path of the main module being executed | ||
| // This approach might need adjustments for symbolic links or specific execution contexts | ||
| if (process.argv[1] === modulePath) { | ||
| // This code block will execute only when the ESM module is run directly | ||
| main(); | ||
| } |
There was a problem hiding this comment.
The condition import.meta.url.startsWith("file:") is unnecessary since import.meta.url will always be a file: URL in Node.js when running local files. The logic should be simplified to just check if the resolved module path matches process.argv[1].
Suggested change
| if (import.meta.url.startsWith("file:")) { | |
| const modulePath = url.fileURLToPath(import.meta.url); | |
| // Compare the module's path to the path of the main module being executed | |
| // This approach might need adjustments for symbolic links or specific execution contexts | |
| if (process.argv[1] === modulePath) { | |
| // This code block will execute only when the ESM module is run directly | |
| main(); | |
| } | |
| const modulePath = url.fileURLToPath(import.meta.url); | |
| // Compare the module's path to the path of the main module being executed | |
| // This approach might need adjustments for symbolic links or specific execution contexts | |
| if (process.argv[1] === modulePath) { | |
| // This code block will execute only when the ESM module is run directly | |
| main(); |
!BREAKING CHANGE:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
!BREAKING CHANGE: