Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions packages/zpm/src/linker/pnpm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,12 +449,6 @@ pub async fn link_project_pnpm<'a>(project: &'a Project, install: &'a Install) -
let workspace
= project.try_workspace_by_locator(locator)?;

let physical_package_data = install.package_data.get(&locator.physical_locator())
.unwrap_or_else(|| panic!("Failed to find physical package data for {}", locator.physical_locator().to_print_string()));

let is_local
= matches!(physical_package_data, PackageData::Local {..});

let mut has_explicit_self_dependency
= false;

Expand All @@ -470,16 +464,6 @@ pub async fn link_project_pnpm<'a>(project: &'a Project, install: &'a Install) -

package_map_builder.register_dependency(locator, dep_name, dep_locator)?;

if !is_local && !locator.reference.is_workspace_reference() {
if let Some(hoisted_locator) = hoisted_packages.get(dep_name) {
// If the exact same version is hoisted, skip creating the symlink
// The package will resolve it through the store's shared node_modules
if *hoisted_locator == dep_locator {
continue;
}
}
}

// node_modules/.yarn/store/@types-no-deps-npm-1.0.0-xyz/node_modules/@types/no-deps
let dep_rel_location
= locations_by_package
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,31 @@ describe(`Features`, () => {
),
);

test(
`it should link every dependency next to a store package, even hoisted ones`,
makeTemporaryEnv(
{
dependencies: {
[`one-fixed-dep`]: `1.0.0`,
},
},
{
nodeLinker: `pnpm`,
pnpmHoistPatterns: [`*`],
},
async ({path, run}) => {
await run(`install`);

// Tools that crawl the store (bundlers, type corpora) read a
// package's dependencies from its own node_modules, as pnpm lays
// them out; the hoisted copy isn't a substitute
const store = ppath.join(path, `node_modules/.yarn/store`);
const entry = (await xfs.readdirPromise(store)).find(name => name.startsWith(`one-fixed-dep-`))!;
await expect(xfs.existsPromise(ppath.join(store, entry, `node_modules/no-deps/package.json`))).resolves.toEqual(true);
},
),
);

test(
`pnpmPublicHoistPatterns with wildcard should hoist all transitive dependencies`,
makeTemporaryEnv(
Expand Down
Loading