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
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,13 @@ public List<String> getPnpmExecutable() {
List<String> pnpmCommand = getSuitablePnpm();
assert !pnpmCommand.isEmpty();
pnpmCommand = new ArrayList<>(pnpmCommand);
pnpmCommand.add("--shamefully-hoist=true");
// Force hoisted (flat npm-style) layout. CLI takes precedence over
// .npmrc, so this is unambiguous even if the project lacks the
// generated .npmrc. Replaces the previous --shamefully-hoist=true,
// which only controls the partial-hoist heuristic on top of the
// default isolated layout and did not consistently expose every
// transitive at the project root.
pnpmCommand.add("--config.node-linker=hoisted");
return pnpmCommand;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@rollup/plugin-replace": "6.0.3",
"@rollup/pluginutils": "5.3.0",
"@babel/preset-react": "7.28.5",
"@babel/types": "7.28.5",
"rollup-plugin-visualizer": "6.0.5",
"rollup-plugin-brotli": "3.1.0",
"vite-plugin-checker": "0.12.0",
Expand Down
6 changes: 6 additions & 0 deletions flow-server/src/main/resources/npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@
#
# This file sets the default parameters for manual `pnpm install`.
#
# node-linker=hoisted produces a flat node_modules layout (like npm),
# so every transitive dependency lives at the project root. Flow's
# frontend tooling and bundled Vite plugins (e.g. the React function
# location plugin) import transitive deps that pnpm's symlink-based
# layout did not consistently hoist, even with shamefully-hoist=true.
node-linker=hoisted
shamefully-hoist=true
strict-peer-dependencies=false
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,10 @@ public void knownFaultyNpmVersionThrowsException() {
@Test
public void getPnpmExecutable_executableIsAvailable() {
List<String> executable = tools.getPnpmExecutable();
// command line should contain --shamefully-hoist=true option
Assert.assertTrue(executable.contains("--shamefully-hoist=true"));
// command line should force hoisted node-linker so transitive
// deps are always installed at the project root
Assert.assertTrue(
executable.contains("--config.node-linker=hoisted"));
Assert.assertTrue(
executable.stream().anyMatch(cmd -> cmd.contains("pnpm")));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ public void getDefaultDevDependencies_includesAllDependencies_whenUsingVite() {
expectedDependencies.add("transform-ast");
expectedDependencies.add("strip-css-comments");
expectedDependencies.add("@babel/preset-react");
expectedDependencies.add("@babel/types");
expectedDependencies.add("@types/react");
expectedDependencies.add("@types/react-dom");
expectedDependencies.add("@preact/signals-react-transform");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ public void runPnpmInstall_npmRcFileNotFound_newNpmRcFileIsGenerated()
String content = FileUtils.readFileToString(npmRcFile,
StandardCharsets.UTF_8);
Assert.assertTrue(content.contains("shamefully-hoist"));
Assert.assertTrue(content.contains("node-linker=hoisted"));
}

@Test
Expand Down
Loading