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

feat: add yarnpkg/nm/hoist export #6611

Merged
merged 1 commit into from
Nov 22, 2024
Merged

feat: add yarnpkg/nm/hoist export #6611

merged 1 commit into from
Nov 22, 2024

Conversation

ChALkeR
Copy link
Contributor

@ChALkeR ChALkeR commented Nov 22, 2024

What's the problem this PR addresses?

Bundling @yarnpkg/nm (due to subdeps) is large and not needed when one needs only a few exports from ./hoist file:

import {structUtils, Project, MessageName, Locator} from '@yarnpkg/core';
import {npath, ppath} from '@yarnpkg/fslib';
import {NativePath, PortablePath, Filename} from '@yarnpkg/fslib';
import {PnpApi, PhysicalPackageLocator, PackageInformation, DependencyTarget} from '@yarnpkg/pnp';

But hoist.ts is a zero-dep lib:

/**
* High-level node_modules hoisting algorithm recipe
*

It's already built/distrubuted separately (see https://www.npmjs.com/package/@yarnpkg/nm?activeTab=code), just an entry in package.json was missing

Both its exports (and types) are already re-exported:

export type {HoisterTree, HoisterResult} from './hoist';
export {hoist, HoisterDependencyKind} from './hoist';

So this is not increasing public API surface, just adds a more convenient way to import it without pulling in the whole of @yarnpkg/core and @yarnpkg/pnp

How did you fix it?

Added ./hoist to exports to point to ./lib/hoist.js

Checklist

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@larixer
Copy link
Member

larixer commented Nov 22, 2024

Makes sense. Please execute yarn version check -i and mark @yarnpkg/nm for patch release

@larixer larixer enabled auto-merge November 22, 2024 06:39
@larixer larixer added this pull request to the merge queue Nov 22, 2024
Merged via the queue into yarnpkg:master with commit 2f490dd Nov 22, 2024
25 of 26 checks passed
arcanis pushed a commit that referenced this pull request Dec 28, 2024
## What's the problem this PR addresses?

Same reason as #6611 

Those are already fully exported here:
https://github.com/yarnpkg/berry/blob/8bfe2d545e986993e4450072bac8b1044e5ebed7/packages/yarnpkg-core/sources/index.ts#L9-L10

But importing them from top pulls in all the yarpkg/core subdeps, while
those two are pretty light on their own and don't need all that

## How did you fix it?

Adding them as separate exports would fix this

## Checklist

<!--- Don't worry if you miss something, chores are automatically
tested. -->
<!--- This checklist exists to help you remember doing the chores when
you submit a PR. -->
<!--- Put an `x` in all the boxes that apply. -->
- [x] I have read the [Contributing
Guide](https://yarnpkg.com/advanced/contributing).

<!-- See
https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released
for more details. -->
<!-- Check with `yarn version check` and fix with `yarn version check
-i` -->
- [x] I have set the packages that need to be released for my changes to
be effective.

<!-- The "Testing chores" workflow validates that your PR follows our
guidelines. -->
<!-- If it doesn't pass, click on it to see details as to what your PR
might be missing. -->
- [x] I will check that all automated PR checks pass before the PR gets
reviewed.
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.

2 participants