Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 1, 2025

  • Explore repository structure and understand the codebase
  • Identify all files using the uuid package
  • Run existing tests to verify current state
  • Run build to verify current state
  • Modify src/uuid.ts to use crypto.randomUUID for all builds:
    • weapp: custom implementation (unchanged - due to limited crypto support)
    • browser: native globalThis.crypto.randomUUID()
    • node/react-native: Node.js crypto.randomUUID()
  • Remove uuid dependency from package.json
  • Remove uuid transformIgnorePatterns from jest config in package.json
  • Remove unnecessary uuid mock from src/__tests__/weapp-test.js
  • Add test for browser uuid in src/__tests__/browser-test.js
  • Update integration/test/ParseUserTest.js to use uuid wrapper instead of direct crypto import
  • Run linter to verify changes
  • Run tests to verify changes (1139 tests pass)
  • Run build to verify changes
  • Run code review and address feedback (use native Web Crypto API for browser builds)
  • Run security scan (no alerts found)
Original prompt

Remove the dependency uuid and replace it's uses in the code with crypto:

For example:

// Before
const { v4: uuidv4 } = require('uuid');

// After
const { randomUUID: uuidv4 } = require('crypto');

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@coderabbitai
Copy link

coderabbitai bot commented Dec 1, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

@parseplatformorg
Copy link
Contributor

parseplatformorg commented Dec 1, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copilot AI and others added 3 commits December 1, 2025 11:47
Co-authored-by: mtrezza <5673677+mtrezza@users.noreply.github.com>
Co-authored-by: mtrezza <5673677+mtrezza@users.noreply.github.com>
Co-authored-by: mtrezza <5673677+mtrezza@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove uuid dependency and replace with crypto Remove uuid dependency, use crypto.randomUUID instead Dec 1, 2025
Copilot finished work on behalf of mtrezza December 1, 2025 11:58
Copilot AI requested a review from mtrezza December 1, 2025 11:58
@mtrezza mtrezza marked this pull request as ready for review December 1, 2025 12:18
@codecov
Copy link

codecov bot commented Dec 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.88%. Comparing base (2794b73) to head (5f488cb).
⚠️ Report is 17 commits behind head on alpha.

Additional details and impacted files
@@           Coverage Diff           @@
##            alpha    #2810   +/-   ##
=======================================
  Coverage   99.88%   99.88%           
=======================================
  Files          64       64           
  Lines        6222     6222           
  Branches     1473     1473           
=======================================
  Hits         6215     6215           
  Misses          7        7           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mtrezza mtrezza changed the title Remove uuid dependency, use crypto.randomUUID instead perf: Replace uuid with crypto dependency Dec 1, 2025
@parse-github-assistant
Copy link

parse-github-assistant bot commented Dec 1, 2025

🚀 Thanks for opening this pull request!

❌ Please fill out all fields with a placeholder FILL_THIS_OUT. If a field does not apply to the pull request, fill in n/a or delete the line.

@mtrezza mtrezza changed the title perf: Replace uuid with crypto dependency perf: Replace uuid dependency with native crypto API Dec 1, 2025
@mtrezza
Copy link
Member

mtrezza commented Dec 1, 2025

@copilot Check any direct imports like const { randomUUID: uuidv4 } = require('crypto'); in tests and src and make sure the uuid wrapper in src/uuid.ts is used instead.

@mtrezza mtrezza changed the title perf: Replace uuid dependency with native crypto API perf: Replace uuid dependency with native crypto.randomUUID() API Dec 1, 2025
Co-authored-by: mtrezza <5673677+mtrezza@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 1, 2025

@copilot Check any direct imports like const { randomUUID: uuidv4 } = require('crypto'); in tests and src and make sure the uuid wrapper in src/uuid.ts is used instead.

Updated integration/test/ParseUserTest.js to use the uuid wrapper (require('../../lib/node/uuid').default) instead of the direct crypto import. Commit: 5f488cb

@mtrezza mtrezza merged commit e06b8a7 into alpha Dec 1, 2025
14 checks passed
@mtrezza mtrezza deleted the copilot/remove-uuid-dependency branch December 1, 2025 13:23
@mtrezza
Copy link
Member

mtrezza commented Dec 1, 2025

@coderabbitai is the change in this PR compatible with Node 18?

parseplatformorg pushed a commit that referenced this pull request Dec 1, 2025
## [7.1.1-alpha.1](7.1.0...7.1.1-alpha.1) (2025-12-01)

### Performance Improvements

* Replace `uuid` dependency with native `crypto.randomUUID()` API ([#2810](#2810)) ([e06b8a7](e06b8a7))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 7.1.1-alpha.1

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Dec 1, 2025
@coderabbitai
Copy link

coderabbitai bot commented Dec 1, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the actual implementation in src/uuid.ts
cat src/uuid.ts

Length of output: 837


🏁 Script executed:

#!/bin/bash
# Check package.json for Node.js version requirements and engines field
cat package.json | jq '.engines, .volta'

Length of output: 47


🏁 Script executed:

#!/bin/bash
# Check if there are any CI/test configurations that specify Node versions
cat .github/workflows/*.yml 2>/dev/null | grep -i "node-version" -A2 -B2 || echo "No workflow files found"

Length of output: 522


🌐 Web query:

When was crypto.randomUUID introduced in Node.js

💡 Result:

crypto.randomUUID was added in Node.js v15.6.0 (released January 15, 2021) and was backported to v14.17.0 (released May 11, 2021). [1][2][3]

Sources:

  • Node.js v15.6.0 release notes (implements randomUUID). [1]
  • Node.js v14.17.0 release notes (backported: adds crypto.randomUUID). [2]
  • Node.js crypto API docs (crypto.randomUUID — "Added in: v15.6.0, v14.17.0"). [3]

@mtrezza Yes, the changes in this PR are fully compatible with Node 18.

The crypto.randomUUID() API was introduced in Node.js v15.6.0 and backported to v14.17.0, which means it's been available since May 2021. Since the repository's package.json specifies "node": "18 || 19 || 20 || 22 || 24", and Node 18 is well above the minimum version where crypto.randomUUID() became available, there are no compatibility concerns.

The implementation in src/uuid.ts correctly uses:

  • require('crypto').randomUUID for Node.js and React Native builds
  • globalThis.crypto.randomUUID() for browser builds
  • Custom implementation for WeApp builds (unchanged)

All supported Node.js versions in this repository have native crypto.randomUUID() support.

parseplatformorg pushed a commit that referenced this pull request Dec 1, 2025
## [7.1.1](7.1.0...7.1.1) (2025-12-01)

### Performance Improvements

* Replace `uuid` dependency with native `crypto.randomUUID()` API ([#2810](#2810)) ([e06b8a7](e06b8a7))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 7.1.1

@parseplatformorg parseplatformorg added the state:released Released as stable version label Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:released Released as stable version state:released-alpha Released as alpha version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants