Skip to content

feat: add @constructive-io/noble-hashes — dual CJS+ESM fork#83

Merged
pyramation merged 1 commit intomainfrom
feat/noble-hashes-fork
May 11, 2026
Merged

feat: add @constructive-io/noble-hashes — dual CJS+ESM fork#83
pyramation merged 1 commit intomainfrom
feat/noble-hashes-fork

Conversation

@pyramation
Copy link
Copy Markdown
Contributor

Summary

Adds @constructive-io/noble-hashes — a dual CJS+ESM fork of @noble/hashes v2.2.0 (MIT, Paul Miller).

Why: @noble/hashes v2.x is ESM-only ("type": "module"), which breaks require() in CJS environments (Jest, older Node tooling). Rather than patching every consumer, we maintain this fork with dual output via makage.

What's included:

  • All 19 source files copied unchanged from @noble/hashes@2.2.0
  • Import extensions stripped (.ts → none) for moduleResolution: "node"
  • makage build produces both CJS (dist/) and ESM (dist/esm/)
  • Paul Miller's original MIT license preserved in package-level LICENSE (copied to dist/ via post-build step since makage defaults to the monorepo root license)
  • SHA-256 tests: NIST FIPS 180-4 test vectors + cross-validation against Node.js crypto
  • README with fork attribution note

Build verified: CJS require() and ESM import both produce correct SHA-256 output.

Review & Testing Checklist for Human

  • Verify dist/LICENSE contains Paul Miller's copyright (not the Constructive monorepo one) after running pnpm build in the package
  • Run pnpm test in packages/noble-hashes — 9 tests should pass (NIST vectors + Node crypto cross-validation)
  • Spot-check a few source files against the upstream @noble/hashes@2.2.0 to confirm no unintended modifications

Notes

  • This fork will replace @noble/hashes as the dependency in @constructive-io/upload-client, fixing the ESM-only CI failures in constructive-db PR #1100.
  • To sync upstream: copy source files from new release, strip .ts extensions, build, test, bump version.

Link to Devin session: https://app.devin.ai/sessions/1a2b164e76c747dcb3f8f79ee76fa903
Requested by: @pyramation

…/hashes@2.2.0

Copies all source files from @noble/hashes v2.2.0 (MIT, Paul Miller) and
builds with makage for dual CJS+ESM output. This avoids the 'Must use
import to load ES Module' error that occurs when CJS code requires the
ESM-only upstream package.

- 19 source files copied unchanged (import extensions stripped for moduleResolution: node)
- Paul Miller's MIT license preserved in package and dist
- SHA-256 tests with NIST vectors + Node.js crypto cross-validation
@devin-ai-integration
Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@pyramation pyramation merged commit a0ac269 into main May 11, 2026
44 checks passed
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.

1 participant