chore(deps): make node_modules strict, declare what each package imports - #5327
Open
Han5991 wants to merge 1 commit into
Open
chore(deps): make node_modules strict, declare what each package imports#5327Han5991 wants to merge 1 commit into
Han5991 wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size SummaryNo component packages changed. Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
Drops `nodeLinker: hoisted` and `shamefullyHoist: true`, both inherited verbatim from the pre-pnpm-11 .npmrc (facebook#3700). nodeLinker was annotated there as pnpm's default, which it is not -- the default is `isolated` -- and pairing it with shamefullyHoist is pnpm/pnpm#6620. shamefullyHoist is `publicHoistPattern: '*'`, which let nine packages import modules they never declared; all nine are now declared, at the versions the workspace already resolved. The Babel toolchain and Testing Library move into the catalog, each having been duplicated across 4-6 packages. Also fixes a latent `astryx doctor` bug the linker change exposed: checkPeerDeps resolved peers with `require.resolve(name, {paths: [cwd]})`, but Node folds NODE_PATH in regardless, so a peer merely reachable from the ambient environment read as installed and doctor stayed silent about a missing one. It now walks the project's own node_modules and reads package.json off disk, so every peer gets range-checked. The existing test caught this unmodified. Verified on a recreated node_modules: build, test, storybook:build, docsite and sandbox builds, check:repo, verify-exports, eslint, and every typecheck CI gates all pass. The local test failures that remain reproduce on main from a clean worktree -- case-insensitive filesystem, date-dependent suites -- and CI reported none of them.
Han5991
force-pushed
the
chore/drop-node-linker-hoisted
branch
from
August 22, 2026 08:50
6808c5a to
17d3051
Compare
Han5991
marked this pull request as ready for review
August 22, 2026 09:44
Han5991
requested review from
cixzhang,
imdreamrunner,
josephfarina and
potatowagon
as code owners
August 22, 2026 09:44
This file contains hidden or 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
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.
Closes #5328
What
Removes both hoisting settings from
pnpm-workspace.yamland declares the dependencies that were only resolving because of them.linkWorkspacePackages: truestays.Why
Both lines came over verbatim from the pre-pnpm-11
.npmrc(#3700).nodeLinker: hoistedwas annotated there as "Use the Node-modules linker (default), not pnpm's PnP." That is wrong on its own terms — pnpm's default is the node-modules linker, but its default mode isisolated, nothoisted. It also paired badly:nodeLinker: hoistedtogether withshamefullyHoist: trueis pnpm/pnpm#6620, spuriousModuleNotFoundErrors that only clear after toggling the setting off and on.shamefullyHoist: trueispublicHoistPattern: '*'— it republishes every transitive package at the root ofnode_modules, so a package can import a module it never declared and nothing complains.Benefits
isolatedhardlinks each package once into the.pnpmstore instead of writing a flat npm-style tree.What was hiding behind the flag
Turning it off surfaced exactly eight undeclared imports:
@babel/core,glob,chokidar,@testing-library/jest-dom,@stylexjs/babel-pluginpnpm buildfails at@astryxdesign/corelab,charts,richtext@babel/cli,@babel/core,@babel/preset-react,@babel/preset-typescript,@stylexjs/babel-pluginbuild:esm→babel: command not foundlab,charts,richtext@testing-library/reactcore@types/babel__corestorybook@heroicons/react,@stylexjs/stylex,@lexical/react,lexicaldocsite@babel/parsercli@heroicons/react,@stylexjs/stylex,lucide-react,rechartsassets/templates/**is intsconfig.strict.json, which CI runsAll are devDependencies — nothing changes for consumers of the published packages. Every version matches what the workspace already resolved, so the lockfile gains importer entries and zero new package versions.
Risks, and how each was closed
node_modulesbreak — the original stated reason for the flag, naming Storybook and the StyleX babel pluginpnpm build,storybook:build,docsite buildandsandbox buildall passcli typecheck:strict— the one that compiles the 145-error template assetslinkWorkspacePackages: trueuntouched — required, since 64 internal deps are bare"*"(only 4 useworkspace:*) and pnpm ≥ 10 defaults it tofalsePre-existing, left untouched
plainDate,Calendar,DateInputTouch,Schedule,TransferListSelector, 2 CLI suites). Baselined against main with hoisting restored: the same 7 fail there, with more failing cases (69 vs 56).lab typecheck— relative.doc.mjsimports plus aDraweronCloseprop error. Unrelated to module resolution; CI runslab typecheck:docs, which passes.template-viewerbuild — fails identically with hoisting restored.packages/buildaliases the@astryxdesign/coreprefix tocore/src, socore/locales/*.jsonrewrites to a path that does not exist. CI does not build this app.Note for reviewers pulling this branch
Changing hoisting makes pnpm recreate
node_moduleswholesale. Interactively it prompts; in a non-TTY shell it aborts withERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTYunlessCI=trueis set. GitHub Actions setsCIitself, so CI is unaffected.