Skip to content

perf: always link runtimes from the global virtual store directory#10233

Merged
zkochan merged 12 commits intomainfrom
link-node-from-central-location
Dec 1, 2025
Merged

perf: always link runtimes from the global virtual store directory#10233
zkochan merged 12 commits intomainfrom
link-node-from-central-location

Conversation

@zkochan
Copy link
Copy Markdown
Member

@zkochan zkochan commented Nov 25, 2025

Runtime dependencies (node/deno/bun) are big and they don't have any dependencies of their own. It makes sense to symlink them from a single location on the disk (the global virtual store).

@zkochan zkochan force-pushed the link-node-from-central-location branch from 5d59c3e to 2366e1e Compare November 25, 2025 19:39
@zkochan zkochan force-pushed the link-node-from-central-location branch from 54f8a02 to 12e5107 Compare November 26, 2025 00:17
@zkochan zkochan added this to the v11.0 milestone Dec 1, 2025
@zkochan zkochan marked this pull request as ready for review December 1, 2025 00:45
@zkochan zkochan requested a review from Copilot December 1, 2025 00:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a performance optimization where runtime dependencies (Node.js, Bun, Deno) are always linked from the global virtual store directory, enabling sharing across projects regardless of the enableGlobalVirtualStore setting. This change adds a new required globalVirtualStoreDir parameter to multiple interfaces across the codebase.

Key changes:

  • Added isRuntimeDepPath utility function to identify runtime dependencies by their @runtime: prefix
  • Introduced globalVirtualStoreDir parameter to dependency resolution and installation options
  • Modified dependency graph building to conditionally place runtime dependencies in the global virtual store
  • Extracted calcGraphNodeHash function from iterateHashedGraphNodes for reuse in runtime dependency handling

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/dependency-path/src/index.ts Added isRuntimeDepPath function to detect runtime dependencies using regex pattern
packages/dependency-path/test/index.ts Added unit tests for the new isRuntimeDepPath function
packages/calc-dep-state/src/index.ts Extracted calcGraphNodeHash function and exported DepsStateCache type for external use
deps/graph-builder/src/iteratePkgsForVirtualStore.ts Updated to use globalVirtualStoreDir for runtime dependencies and refactored directory path construction
deps/graph-builder/src/lockfileToDepGraph.ts Added globalVirtualStoreDir to options interface and updated variable name for clarity
pkg-manager/resolve-dependencies/src/resolveDependencyTree.ts Added globalVirtualStoreDir to ResolveDependenciesOptions interface
pkg-manager/resolve-dependencies/src/index.ts Modified extendGraph to process runtime dependencies; missing proper globalVirtualStoreDir usage
pkg-manager/headless/src/index.ts Added globalVirtualStoreDir to HeadlessOptions interface
pkg-manager/core/src/install/extendInstallOptions.ts Added logic to set globalVirtualStoreDir based on store configuration; has redundant assignment
pkg-manager/core/src/install/index.ts Threaded globalVirtualStoreDir parameter through to resolveDependencies
pkg-manager/core/src/getPeerDependencyIssues.ts Added globalVirtualStoreDir requirement and passed through to resolution
pkg-manager/core/test/install/nodeRuntime.ts Added assertions verifying runtime dependencies link to global virtual store
.changeset/angry-streets-bow.md Documents the major version bump for all affected packages

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +144 to +147
test('isRuntimeDepPath', () => {
expect(isRuntimeDepPath('node@runtime:20.1.0' as DepPath)).toBeTruthy()
expect(isRuntimeDepPath('node@20.1.0' as DepPath)).toBeFalsy()
})
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

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

The test for isRuntimeDepPath only covers Node.js runtime, but the implementation (via the regex /^(?:node|bun|deno)@runtime:/) also supports bun and deno runtimes. Consider adding test cases for these runtimes as well:

expect(isRuntimeDepPath('bun@runtime:1.0.0' as DepPath)).toBeTruthy()
expect(isRuntimeDepPath('deno@runtime:1.30.0' as DepPath)).toBeTruthy()

Copilot uses AI. Check for mistakes.
@kenrick95
Copy link
Copy Markdown
Member

Pardon my ignorance, but what are 'runtime dependencies'? Are those node/bun/deno? and this PR we treat them specially? Thanks~

@zkochan
Copy link
Copy Markdown
Member Author

zkochan commented Dec 1, 2025

yes, those are node/bun/deno. This PR will make installing them faster because they will be just symlinked from a shared location.

Copy link
Copy Markdown
Member

@ryo-manba ryo-manba left a comment

Choose a reason for hiding this comment

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

LGTM with nits.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zkochan zkochan merged commit 5f73b0f into main Dec 1, 2025
17 of 19 checks passed
@zkochan zkochan deleted the link-node-from-central-location branch December 1, 2025 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants