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 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
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