feat(externals): support aliasing traced packages#1553
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1553 +/- ##
==========================================
- Coverage 76.47% 76.43% -0.04%
==========================================
Files 73 73
Lines 7574 7580 +6
Branches 750 751 +1
==========================================
+ Hits 5792 5794 +2
- Misses 1781 1784 +3
- Partials 1 2 +1
|
This was referenced Aug 11, 2023
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Linked issue
❓ Type of change
📚 Description
Normally when using the
resolutionsfield to use an aliased package (say original name isaand aliased fromnpm:b), the package manager downloadsbwith and copies all contents intonode_modules/a(whilenode_modules/a/package.jsonis package withname: b.). We use "directory" name as authentic package name to copy into.output/server/node_modulespnpm also does this but there is a catch! the
node_modules/ais a symbolic link tonode_modules/.pnpm/b. When we are running external tracer, we follow the links and assume the real name isbwhich is wrong. To add to the complexity, rollup, mlly and nft also resolve real paths in various places so it is almost impossible to trace aliaces without manually specifying. (We might auto detect from root levelpackage.jsonusingresolutionsandaliases)This PR enables new
externals.traceAliasesoption in order to speficy trace aliased packages:This tells nitro when tracing
.output/server/h3-nightly, try to link it to.output/server/node_modules/h3.(
h3-nightlyalias is added by default as a known dependency)Isolated Preset Testing
This PR enables a new isolated way of testing presets.
Previously, we were running fixture build output within
/<repo>/test/presets/.tmp/node. Even if an external like h3 is missing, tests were wrongly passed since Node.js also searches in/<repo>/node_modules. The tests are now more secure by using/tmp/nitro-test/<preset>/output.📝 Checklist