From d2efaccaa74c2755eb530a5701b2120b0497fd8c Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Thu, 19 Jun 2025 23:43:43 +0000 Subject: [PATCH] feat(package): Update package.json to use exports field for dual entry points --- changelog.md | 6 ++++++ package.json | 6 ++++-- ts/00_commitinfo_data.ts | 2 +- ts_web/00_commitinfo_data.ts | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index e8e4b76..e466a7b 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2025-06-19 - 3.2.0 - feat(package) +Update package.json to use exports field for dual entry points + +- Replaced the main and typings fields with an exports object that supports both default and web entry points +- Ensures consistency in module resolution between Node.js and browser environments + ## 2025-06-19 - 3.1.0 - feat(browser) Implement fallback SHA256 for non-HTTPS environments and enhance browser tests for consistent hashing diff --git a/package.json b/package.json index afeff38..0daeb53 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,10 @@ "version": "3.1.0", "private": false, "description": "Cross-environment hash functions (SHA256 and MD5) for Node.js and browsers, with support for strings, streams, and files.", - "main": "dist_ts/index.js", - "typings": "dist_ts/index.d.ts", + "exports": { + ".": "./dist_ts/index.js", + "./web":"./dist_ts_web/index.js" + }, "scripts": { "test": "(tstest test/ --web)", "build": "(tsbuild tsfolders --allowimplicitany)", diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 465a69a..4ead3ef 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smarthash', - version: '3.1.0', + version: '3.2.0', description: 'Cross-environment hash functions (SHA256 and MD5) for Node.js and browsers, with support for strings, streams, and files.' } diff --git a/ts_web/00_commitinfo_data.ts b/ts_web/00_commitinfo_data.ts index 465a69a..4ead3ef 100644 --- a/ts_web/00_commitinfo_data.ts +++ b/ts_web/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smarthash', - version: '3.1.0', + version: '3.2.0', description: 'Cross-environment hash functions (SHA256 and MD5) for Node.js and browsers, with support for strings, streams, and files.' }