Skip to content

No ticket: Drop uuid dependency in favor of native parse/stringify#3527

Closed
jimexist wants to merge 2 commits into
masterfrom
claude/intelligent-varahamihira-7964e6
Closed

No ticket: Drop uuid dependency in favor of native parse/stringify#3527
jimexist wants to merge 2 commits into
masterfrom
claude/intelligent-varahamihira-7964e6

Conversation

@jimexist
Copy link
Copy Markdown
Member

Summary

Replaces the uuid npm package with a tiny in-tree helper. The runtime was only using parse() and stringify() from the library in two protocol files — trivial hex/UUID conversions that don't justify an external dependency.

Changes

  • Add lib/nodejs/lib/thrift/uuid.js — native parse (validating UUID string → 16-byte Uint8Array) and stringify (16 bytes → canonical lowercase UUID string). Both throw TypeError on invalid input, matching the library's behavior at the call sites.
  • Update binary_protocol.js and compact_protocol.js to require("./uuid").
  • Remove uuid from package.json dependencies and regenerate package-lock.json. (The transitive uuid@3.4.0 pulled in by istanbul-lib-processinfo remains — it's a devDep we don't control.)

lib/nodejs/test/package-lock.json is left untouched; it has been stale across recent uuid bumps and is out of scope here.

Why

One fewer supply-chain surface for a built-in capability. Node has no native UUID parse/stringify, but the implementations are short enough to live in-tree.

Checklist

  • No JIRA ticket — trivial dependency cleanup, in line with previous "Bump uuid" commits.
  • Single squashed commit.
  • Client: tag included in commit message.
  • AI authorship labeled via Co-Authored-By:.
  • Tests: no behavior change; existing protocol tests cover read/write round-trips. Verified parse/stringify round-trip and validation behavior locally.

🤖 Generated with Claude Code

Client: nodejs

The uuid npm package was used only for parse() and stringify() in the
binary and compact protocols. Replaced with a small in-tree helper so
the runtime no longer pulls in an external dependency for two trivial
hex conversions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Client: js,nodejs,ts,compiler

Generated JS/TS code used to import the third-party 'uuid' package for
v4() generation. With the runtime no longer depending on 'uuid', emit
crypto.randomUUID by default and stop pulling the package into user
projects.

The new generator option js:native_uuid defaults to true. Pass
-gen js:native_uuid=false to restore the legacy import for environments
where crypto.randomUUID is unavailable (Node < 14.17, insecure-context
browsers).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jimexist jimexist requested a review from Jens-G as a code owner May 25, 2026 00:20
@mergeable mergeable Bot added the javascript Pull requests that update Javascript code label May 25, 2026
@jimexist jimexist closed this May 25, 2026
@mergeable mergeable Bot added the compiler label May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler javascript Pull requests that update Javascript code nodejs typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant