Skip to content

release: v3.0.0#66

Open
Rajesh-Royal wants to merge 39 commits into
masterfrom
develop
Open

release: v3.0.0#66
Rajesh-Royal wants to merge 39 commits into
masterfrom
develop

Conversation

@Rajesh-Royal

Copy link
Copy Markdown
Owner

Sync master with develop for v3.0.0 release.

39 commits ahead of master, no divergence — fast-forward sync.

See v3.0.0 release notes and changelog.md for the full breaking-change list.

Rajesh-Royal and others added 30 commits August 11, 2025 12:10
- Added Tailwind CSS and PostCSS configuration for styling.
- Introduced Framer Motion for animations throughout the application.
- Refactored App component to utilize new UI components: Header, TitleSection, FeatureIcons, FingerprintPanel, GenerateButton, and Instructions.
- Created reusable UI components (Button, Badge, Card) with class variance authority for styling.
- Implemented a responsive design with Tailwind CSS utility classes.
- Added new dependencies: class-variance-authority, clsx, framer-motion, lucide-react, tailwind-merge, and tailwindcss.
- Updated TypeScript configuration for module path aliases.
added line

"types": "./lib/index.d.ts"

in exports : { "." : { ...

to typescript knowns where the types are whe you exports the module.
Looks good to me, thanks.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add eslint.config.mjs (flat config) extending typescript-eslint/recommended,
  scoped to src/**/*.ts; loosen rules so existing source lints cleanly
  (ts-comment ban, empty-object-type, no-explicit-any disabled; no-var and
  prefer-const downgraded to warnings).
- Add .prettierrc (4-space, single quotes, no trailing commas, printWidth 100).
- Add .prettierignore (lib/, node_modules/, example/, docs/, lockfile, min).
- Add .editorconfig (UTF-8, LF, 4-space, final newline, trim trailing ws).
- Add lint, lint:fix, format, format:check scripts to package.json.
- Apply prettier --write across src/ to align with the new config.

Verified: npm run lint exits 0, npm run format:check passes, npm run build
still produces lib/ correctly.
…config

chore: add ESLint + Prettier + EditorConfig (#29)
)

- husky + lint-staged: install as devDeps; pre-commit hook (.husky/pre-commit)
  runs `npx lint-staged` to auto-fix staged files. lint-staged glob is wide
  (`*.{ts,tsx}` and `*.{js,json,md,yml,yaml}`) so it catches root-level files
  like vitest.config.ts, not just src/.
- prepare script: `husky` (so `npm install` installs the hooks for
  contributors automatically).
- CONTRIBUTING.md: full contributor guide — prerequisites, setup, project
  structure, dev workflow, code style, testing (notes the pending Vitest
  setup in #32), PR process (branch naming + Conventional Commits), and an
  architecture overview of the audio→canvas→cyrb53 fingerprint pipeline.
- PR template: link to CONTRIBUTING.md, replace ambiguous "Linting/format
  (if applicable)" with explicit `npm run lint` and `npm run format:check`
  checks. Build script reference updated to `npm run build`.
- CI (.github/workflows/ci.yml): add `Lint` and `Format check` steps before
  the existing `Build` step. (npm test deferred until #32 lands a real
  test suite.)
- format / format:check: widen glob to also cover root-level TS/TSX/JSON
  (`"src/**/*.{ts,tsx,js,json,md}" "*.{ts,tsx,json}"`) so CI catches
  malformatted root config files (e.g. tsconfig.json or future
  vitest.config.ts), not just src/. Note: this still does NOT cover
  README/SECURITY/changelog/.github/workflows — see PR description.
- .prettierrc: add JSON/YAML override (`tabWidth: 2`) so package.json and
  tsconfig.json don't fight npm's default 2-space indent.
- .prettierignore: add `.husky/` (husky internals auto-managed) and
  `coverage/` (future test runs).
- .gitignore: add `/.vscode` and `/coverage` (per-developer artifacts).
- tsconfig.json: reformat to match the new JSON override (2-space, compact
  arrays, trailing newline).
- src/code/FingerPrint.ts: trim one trailing-whitespace blank line missed
  by PR #45.

Verified:
- `npm run lint` exits 0 (24 warnings, no errors).
- `npm run format:check` passes.
- `npm run build` succeeds.
- Pre-commit hook empirically auto-formats a staged ugly TS file before
  the commit completes.
…ributing

chore: add husky + lint-staged + CONTRIBUTING.md + CI gates (#30)
- Add `npx tsc --noEmit` step between format:check and build to catch
  type errors as a CI gate.
- Convert single-version build job to a strategy matrix on Node.js 18,
  20, and 22 so we exercise the LTS lineup. fail-fast: false so one
  version's failure doesn't mask the others.

Deferred to a follow-up (waits on #32):
- `npm test` step. The test script is still a placeholder (echo + exit 1)
  on develop; adding it now would fail CI. Will land when #32 merges.

Verified locally:
- npx tsc --noEmit exits 0 against current src.
- npm run lint, format:check, build all still pass.
ESLint 10's stylish formatter calls util.styleText, which was added in
Node 20.12 / 22 and does not exist on Node 18. The Node 18 matrix job
crashed with `TypeError: util.styleText is not a function` after lint
ran, even though linting itself succeeded.

ESLint 9 supports Node ^18.18 || ^20.9 || >=21.1, which covers the
full 18/20/22 matrix. typescript-eslint 8.x supports both ESLint 9
and 10, so no other changes needed.

Verified: npm run lint exits 0 locally (9 warnings, 0 errors).
ci: add type-check + Node 18/20/22 matrix (#36)
Broprint.js is a browser library, not a CLI tool. The 'bin' field
caused npm to install a broken executable, and the key
'getDeviceId()' was an invalid binary name (parentheses).

Verified with 'npm pack --dry-run' — no bin entries in tarball.
Build still succeeds.
- Delete src/webRTC.js (unused, CommonJS, never imported)
- Delete src/code/FingerPrint.ts (driver file, duplicates index.ts)
- Remove murmurhash3_32_gc and javaHashCode from EncryptDecrypt.ts
  (only cyrb53 is actually imported)
- Remove dead Brave-detection branch from index.ts (both branches
  produced identical output) and the now-unused Navigator.brave
  type augmentation
Add explicit parameter and return types to cyrb53 and drop the
@ts-nocheck escape hatch. The audio module's @ts-nocheck is
removed in #22 (full rewrite).

tsc --noEmit passes with strict mode.
BREAKING CHANGE: audio fingerprint output changes for all consumers.
Prior output was prefixed with the literal string 'null' due to
`output = null; output += Math.abs(channelData)` coercing null
to 'null' on first concatenation. Initialize accumulator to 0
to fix.

Also rewrites the module to use function-scoped state instead of
shared module-level mutables (context, oscillator, compressor,
fingerprint, callback). Concurrent calls to
getCurrentBrowserFingerPrint() no longer clobber each other —
each invocation now creates its own OfflineAudioContext and
returns a Promise.

The IIFE + .run(callback) export is replaced by a single
`generateAudioFingerprint(): Promise<string>` export. src/index.ts
adapts to the new API.

Removes @ts-nocheck — full Web Audio API typing.

Closes #22, closes #23.
BREAKING (semantics): the resolved value is now a true string
(typeof === 'string'). The old code returned a number cast through
'unknown as string', which silently broke any consumer that called
string methods on the result.

Drop the Promise constructor antipattern, the nested .then chains,
the dead Brave conditional remnants, and the stale 'sha512 hashed
string' JSDoc (the function never used SHA-512). Canvas-only
fallback is preserved.

Closes #26.
Add BroprintOptions { useAudio?, useCanvas?, seed? } so callers can
opt out of either signal or change the hash seed. Defaults preserve
existing behavior (both signals on, seed=0).

- Throws if both useAudio and useCanvas are false
- If useAudio=true and audio fails: falls back to canvas only when
  useCanvas=true, otherwise rethrows
- BroprintOptions is exported for downstream typing

Closes #27.
Re-export cyrb53, getAudioFingerprint, getCanvasFingerprint, and
isCanvasSupported from the package entry. Lets advanced consumers
compose custom fingerprinting strategies or hash other data with
the same algorithm.

Add JSDoc to each exported function. Rename the audio export from
'generateAudioFingerprint' to 'getAudioFingerprint' for naming
consistency with the canvas helper.

Tree-shaking lands with #31 (sideEffects: false).

Closes #28.
- 'sideEffects': false enables tree-shaking in webpack/Rollup. Safe
  because the only side effect (window assignment in src/index.ts)
  is intended for the IIFE/global build, not ESM consumers.
- 'engines': { node: '>=18' } documents minimum Node version, in
  line with the CI matrix (#36).
- 'prepublishOnly': 'npm run build' prevents publishing stale lib/.
- Keywords: drop 'nodejs' (this is a browser library) and
  'cryptography' (cyrb53 is non-cryptographic), add
  'browser-fingerprint', 'device-id', 'zero-dependency'.

Closes #31.
- vitest@^2.1.9 + @vitest/coverage-v8 added.
- vitest.config.ts: node env, v8 coverage, text/html/lcov reporters,
  80% thresholds. Coverage 'include' is scoped to EncryptDecrypt.ts;
  later test PRs (#33, #34, #35) widen this list as they land so the
  threshold actually exercises the modules under test.
- Scripts: 'npm test', 'test:watch', 'test:coverage'.
- 10 tests for cyrb53 covering golden values, idempotency,
  distribution, empty/unicode/long inputs, seed sensitivity, and
  range invariants.

cyrb53 coverage: 100/100/100/100.

Closes #32.
Mocks document.createElement to exercise both branches of
isCanvasSupported and the fallback + happy-path of getCanvasFingerprint
without depending on a real canvas implementation. Adds jsdom for the
window/document globals; coverage stays at 100% on the file.
Mocks OfflineAudioContext (not available in node/jsdom) to exercise
the happy path, deterministic output, error paths (missing ctor,
sync render failure), webkit fallback, compressor parameter values,
the concurrency invariant from #22 (two overlapping calls resolve
independently), and the null-prefix regression guard from #23.
Coverage on generateTheAudioPrints.ts holds at 100%.
Wires the real cyrb53 + index.ts entry point against mocked
OfflineAudioContext and document.createElement('canvas') to cover
every option combination, the audio-fail → canvas-only fallback,
and the error path when both signals are unavailable. Coverage on
src/index.ts reaches 89/85/100/89 (well above the 80% threshold).
Adds size-limit (@size-limit/preset-small-lib) and a 2KB brotli budget
per format (esm, cjs, iife). Current sizes ~1.0-1.3KB so the budget
gives ~50% headroom before failing. Wires 'npm run size' into CI in
place of the previous 'du -sh lib' which only reported.
Runs npm run test:coverage in CI and uploads lcov.info to Codecov on
the Node 20 matrix leg (so we don't pay 3x upload). Adds codecov.yml
with project + patch coverage targets at 80% (matching the vitest
v8 thresholds set in #32). Codecov posts a per-PR summary; the
Vitest config already fails CI locally if coverage drops below 80%.
Removes factual errors (cryptographically-strong claim, stale
crypto-js reference, dead index.html pointer, hardcoded size badge)
and the duplicate install block. Adds an API reference (options
table, return/throw contract, named exports), a how-it-works
diagram, a browser compatibility table, a caveats section, and
dynamic badges for npm, CI, Codecov, bundlephobia, and license.
Adds a top-of-file pointer to MIGRATION.md for v2->v3.
Documents both intentional output-changing bugfixes (#22 concurrency,
#23 'null' prefix), the dead-code/bin-field removals, and the
additive API surface (options parameter, named exports, full types).
Provides three concrete strategies for consumers who store
fingerprints: dual-period match, age-out, version-tag.
Adopts Keep a Changelog 1.1.0 format. Adds the missing v2.2.1
entry, fills out an [Unreleased] section that aggregates every v3
roadmap issue (Breaking/Added/Changed), and adds compare-link
references at the bottom for every released version. Normalizes
heading casing across older entries while preserving content.
Wires TypeDoc to generate HTML API docs from the existing JSDoc
comments on the public exports (getCurrentBrowserFingerPrint,
getCanvasFingerprint, getAudioFingerprint, cyrb53, isCanvasSupported,
BroprintOptions). Adds 'npm run docs' which writes to docs/api/.
The output is gitignored — generate locally or in a release pipeline.
Bump package.json to 3.0.0, finalize changelog [Unreleased] -> [3.0.0],
regenerate built bundles and type declarations.

See changelog.md for the full breaking-change list. Migration guide:
MIGRATION.md.
@netlify

netlify Bot commented Apr 25, 2026

Copy link
Copy Markdown

Deploy Preview for broprintjs canceled.

Name Link
🔨 Latest commit b9bebd2
🔍 Latest deploy log https://app.netlify.com/projects/broprintjs/deploys/69ed09c3c72741000862c36f

@Rajesh-Royal Rajesh-Royal self-assigned this Apr 26, 2026

@Rajesh-Royal Rajesh-Royal left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Rajesh-Royal
Rajesh-Royal marked this pull request as draft April 26, 2026 17:19
@Rajesh-Royal
Rajesh-Royal marked this pull request as ready for review April 26, 2026 17:20
@codecov

codecov Bot commented Apr 26, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants