Skip to content

lib: use Object.freeze to avoid defensive cloning in SourceMap#62830

Open
watilde wants to merge 2 commits intonodejs:mainfrom
watilde:fixes-memory-sourcemap
Open

lib: use Object.freeze to avoid defensive cloning in SourceMap#62830
watilde wants to merge 2 commits intonodejs:mainfrom
watilde:fixes-memory-sourcemap

Conversation

@watilde
Copy link
Copy Markdown
Member

@watilde watilde commented Apr 19, 2026

No description provided.

@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Apr 19, 2026
@watilde watilde force-pushed the fixes-memory-sourcemap branch from 3b8cc82 to 73ffd8a Compare April 19, 2026 10:40
@watilde watilde changed the title perf: use Object.freeze to avoid defensive cloning in SourceMap lib: use Object.freeze to avoid defensive cloning in SourceMap Apr 19, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.62%. Comparing base (d44a71a) to head (f493f69).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #62830      +/-   ##
==========================================
+ Coverage   89.61%   89.62%   +0.01%     
==========================================
  Files         706      706              
  Lines      219203   219201       -2     
  Branches    41995    41990       -5     
==========================================
+ Hits       196445   196468      +23     
+ Misses      14663    14638      -25     
  Partials     8095     8095              
Files with missing lines Coverage Δ
lib/internal/source_map/source_map.js 99.48% <100.00%> (+0.25%) ⬆️

... and 46 files with indirect coverage changes

🚀 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.

@legendecas legendecas added semver-major PRs that contain breaking changes and should be released in the next major version. source maps Issues and PRs related to source map support. labels Apr 20, 2026
Copy link
Copy Markdown
Member

@legendecas legendecas left a comment

Choose a reason for hiding this comment

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

Would you mind adding a note on https://github.com/nodejs/node/blob/main/doc/api/module.md#sourcemappayload that the returned payload is frozen? Thanks!

Copy link
Copy Markdown
Member

@legendecas legendecas left a comment

Choose a reason for hiding this comment

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

Would you mind fixing the linter complaints? Thanks

Comment thread doc/api/module.md
generated code.

#### `sourceMap.payload`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Worth to add a change section:

Suggested change
<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/62830
description: The object is frozen.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This was marked as resolved, but it seems like this was not applied.

@watilde watilde force-pushed the fixes-memory-sourcemap branch from bd11c1e to f5cc42f Compare April 23, 2026 10:36
@watilde watilde force-pushed the fixes-memory-sourcemap branch from f5cc42f to f493f69 Compare April 23, 2026 11:04
@watilde
Copy link
Copy Markdown
Member Author

watilde commented Apr 23, 2026

Fix, rebase and make the commit Verified.

@legendecas legendecas added the commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. label Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run. semver-major PRs that contain breaking changes and should be released in the next major version. source maps Issues and PRs related to source map support.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants