Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the package.json file to include TypeScript type definitions and modern exports mapping for the library. A critical issue was identified regarding a Dual Package Hazard, as the current exports configuration points the import and require conditions to different files, which could lead to multiple singleton instances of the library; a suggestion was provided to unify the entry point to maintain a single shared state.
There was a problem hiding this comment.
Pull request overview
This PR updates the published package entrypoints to improve consumer module/type resolution by adding a TypeScript declaration entry and an explicit exports map.
Changes:
- Add a top-level
typesentry pointing to the package’s declaration file. - Add an
exportsmap defining conditionalimport/require/typesresolution for the package root. - Expose
./package.jsonviaexportsfor tooling compatibility.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This comment was marked as resolved.
This comment was marked as resolved.
|
@sangafabrice @sebastianjnuwu |
Add TypeScript declaration and an explicit exports map. Adds a top-level "types" pointing to dist/core/core.d.ts and an "exports" field mapping the package root to types/import/require paths and exposing ./package.json. This clarifies ESM/CJS entry points and improves TypeScript and module resolution for consumers. Point package import export to dist/htmlhint.js Update package.json exports: change the 'import' entry from './dist/core/core.js' to './dist/htmlhint.js'. This aligns the ESM import entry with the CommonJS 'require' entry and ensures consumers import the intended bundled entry point. Point package import export to dist/htmlhint.js Update package.json exports: change the 'import' entry from './dist/core/core.js' to './dist/htmlhint.js'. This aligns the ESM import entry with the CommonJS 'require' entry and ensures consumers import the intended bundled entry point. Document ESM usage and bump version to 2.0.0-beta-1 Update README to clarify programmatic usage for both ESM and CommonJS consumers, adding an ESM example that imports the default export (htmlhint) and extracts HTMLHint. Also bump package.json and package-lock.json version from 1.9.2 to 2.0.0-beta-1. Document ESM usage and bump version to 2.0.0-beta-1 Update README to clarify programmatic usage for both ESM and CommonJS consumers, adding an ESM example that imports the default export (htmlhint) and extracts HTMLHint. Also bump package.json and package-lock.json version from 1.9.2 to 2.0.0-beta-1.
e37b5d5 to
c4edc1b
Compare
Add TypeScript declaration and an explicit exports map. Adds a top-level "types" pointing to dist/core/core.d.ts and an "exports" field mapping the package root to types/import/require paths and exposing ./package.json. This clarifies ESM/CJS entry points and improves TypeScript and module resolution for consumers.