-
Notifications
You must be signed in to change notification settings - Fork 527
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
build: mirror nitro
and nitropack
npm packages
#2497
Merged
Merged
Conversation
This file contains 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
pi0
changed the title
[draft] feat: interchangeable usage of
[wip] feat: interchangeable usage of Jun 7, 2024
nitro
and nitropack
nitro
and nitropack
danielroe
approved these changes
Jun 7, 2024
pi0
force-pushed
the
refactor/nitro-nitropack
branch
from
June 13, 2024 11:36
0b5e86a
to
3190477
Compare
pi0
changed the title
[wip] feat: interchangeable usage of
build: mirror Jun 13, 2024
nitro
and nitropack
nitro
and nitropack
npm packages
Closed
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.
TLDR
This PR allows a way to use
nitro
ornitropack
as a dependency and import the same.Context
With access to
nitro
npm package (thanks to @jgermade and @danielroe) we can adopt using a shorter name across.I had some doubts about this from #1362 mainly because we cannot use
@nitro/
namespace in npm but with structure overhaul (#2473) and adoption of subpath exports, this is no longer a concern + usage of subpaths gives much more reasons that more end-users would benefit from explicit imports in their codebase rather than usages of a zero-dep CLI utility.Approach
Adoption is tricky. We have a lot of current users that depend on
nitropack
as canonical andnitro
can be only versioned for>3
to avoid conflict with the previous state.This PR:
nitro
ornitropack
The virtual mirror package does not copy but reexports subpaths. This is to ensure in mixed scenarios, we don't duplicate bundle and install sizes.
Mirror dependency
The mirror package needs to have a dependency on the main package. Using
peerDependencies
is ideal because can help to dedup, but it turns out in cases like usingnpm:
alias package managers show strange behavior and won't install! So it main package is in thedependencies
of the mirror package.Nitro 2.x (current)
Nitro 2.x, will use
nitropack
as canonical as before to avoid any changes but only supportsnitro/
subpath import aliases that will redirect tonitropack/
for forward compatibility.We release
[email protected]
(with2.x
tag) andnitro-nightly@2-compat
for forward compatibility.Nitro 3.x (next)
Nitro 3.x, will use
nitro
as canonical and redirectnitropack/
subpath imports.We release
[email protected]
(with thelatest
tag) and[email protected]
for backward compatibility.TODO
nitro
/nitropack
/nitro/types
andnitropack/types
regardless of canonical (nitro{pack}/types
)