v2.2.0 Multi‑Format Build & CDN Fix #17
Merged
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.
Summary
Adds multi-format build outputs (ESM
index.mjs, CJSindex.js, and global/IIFEindex.global.js), enabling direct browser usage via both<script type="module">and classic<script>tags. ExposesgetCurrentBrowserFingerPrintas a window global when loaded via the global build. Updates export map, adds tsup bundling, updates README with new CDN examples, and adds a changelog entry. Resolves inability to import the library from a CDN previously reported (window.getCurrentBrowserFingerPrint is not a functionand missing named export errors).Type of change
Checklist
npm run build)How to test
npm installnpm run buildlib/index.mjs,lib/index.js,lib/index.global.js,lib/index.d.tsnode -e "const { getCurrentBrowserFingerPrint } = require('./lib'); console.log(typeof getCurrentBrowserFingerPrint);"should printfunction.node --input-type=module -e "import { getCurrentBrowserFingerPrint } from './lib/index.mjs'; console.log(typeof getCurrentBrowserFingerPrint);"should printfunction.Screenshots / Logs
N/A – library build / API unchanged; packaging only.
Related issues
Fixes: CDN usage errors (unreported issue numbers) regarding missing named export and undefined global.
Additional context
devDependencies) for concise multi-target bundling.if (typeof window !== 'undefined' ...)).#7 #16