Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(externals): use stable dependency tree #909

Merged
merged 2 commits into from
Feb 5, 2023
Merged

Conversation

pi0
Copy link
Member

@pi0 pi0 commented Feb 5, 2023

  • refactor: improve code readability
  • implement stable tree

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR improves Nitropack v2 externals tracker by analyzing dependency tree between packages in multi phases:

  • Identify single versioned packages and multi versioned packages with their (versionined) parents
  • Wrtie single versioned packages in parallel directly to node_modules
  • For each multi versioned package
    • Sort it's versions based on 1) no parents for hoisting 2) newer to older version
    • For each version
      • Write it to node_modules/.nitro/name@version
      • For each multi version parent, link to node_modules/.nitro/mv_parent}/node_modules/{name}
      • For each single version parent, link to node_modules/{sv_parent}/node_modules/{name}

This solves concurrency issue, improves performance and handling hoisting for hoisted versions (tested against nice reproduction provided by @itpropro against "@azure/app-configuration": "^1.3.1" + "@azure/search-documents": "^11.3.1" + "@azure/identity": "^3.1.3" with conflicting @azure/core-tracing (1.0.1/1.0.0-preview.13)

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@codecov
Copy link

codecov bot commented Feb 5, 2023

Codecov Report

Merging #909 (1da3ef2) into main (dbb89a1) will increase coverage by 0.02%.
The diff coverage is 93.24%.

@@            Coverage Diff             @@
##             main     #909      +/-   ##
==========================================
+ Coverage   67.45%   67.47%   +0.02%     
==========================================
  Files          59       59              
  Lines        5890     5910      +20     
  Branches      643      659      +16     
==========================================
+ Hits         3973     3988      +15     
- Misses       1908     1913       +5     
  Partials        9        9              
Impacted Files Coverage Ξ”
src/rollup/plugins/externals.ts 94.32% <93.24%> (-0.79%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@pi0 pi0 merged commit 78dd4f9 into main Feb 5, 2023
@pi0 pi0 deleted the fix/externals-improvements2 branch February 5, 2023 00:13
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