build: restore strict node_modules, fixing six phantom deps - #1074
Open
lukecotter wants to merge 4 commits into
Open
lukecotter wants to merge 4 commits into
lukecotter wants to merge 4 commits into
Conversation
@jest/globals and tslib were declared by no package. sass, lightningcss and @vscode/codicons are imported by root build files but declared only by log-viewer. @types/node is needed by scripts/tsconfig.json and declared only by lana. Every one resolved through the hoisted root node_modules.
shamefullyHoist put 1241 packages in the root node_modules. About 1200 were undeclared, so any file could import them, across the lana to log-viewer boundary included. Without it the root holds 26. The comment blamed the rollup commonjs and node-resolve plugins. The real dependency was sass. DataGrid.scss loads tabulator-tables through loadPaths, which named only the root node_modules, and tabulator-tables belongs to log-viewer. loadPaths is now searched from the importing stylesheet up to the repo root, the way Node resolves a module.
Each removed range is a subset of one that stays, with the same or a stronger replacement. Nothing resolves differently.
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.
📝 PR Overview
Stacked on #1070 — base is
build-pnpm-12, so review that one first and this diff stays to three commits.shamefullyHoist: trueflattened all 1241 transitive packages into the rootnode_modules. Only 76 are declared across the four manifests, so roughly 1200 undeclared packages were importable from any file in the repo, including across thelanatolog-viewerboundary thatAGENTS.mdmakes a hard rule. Strictnode_modulesis the mechanism that enforces that rule, and it was switched off.Dropping the setting leaves 29 entries in the root and turns six long-standing phantom dependencies into build failures. All six are declared here.
pnpm build,pnpm build:fast,pnpm lint,pnpm test, the docs site and the vsix all pass, and the vsix is unchanged at 26 files / 1021.42 KB.🛠️ Changes made
@jest/globalsandtslibwere declared by no package.@jest/globalsis imported by 175 test files across all three projects;tslibis required byimportHelpers: truein bothlanaandlog-viewer. Both resolved only through the hoisted root.sassandlightningcssare imported byscripts/rollup-plugin-css.mjs, and@vscode/codiconsbyrollup.config.mjsandrolldown.config.ts— all root-level build files, but declared only bylog-viewer. Added to the rootdevDependencies.@types/nodeis required byscripts/tsconfig.json("types": ["node"]) and was declared only bylana. Added to the root.scripts/rollup-plugin-css.mjsderives sassloadPathsfrom the importing stylesheet upwards to the repo root, the way Node resolves a module, instead of naming a single rootnode_modules.DataGrid.scssloadstabulator-tables, which belongs tolog-viewer. The old comment inpnpm-workspace.yamlblamed the rollup commonjs and node-resolve plugins; sass was the real dependency.overridesremoved:@xmldom/xmldom@<0.8.12,fast-uri@<=3.1.0,lodash@>=4.0.0 <=4.17.23andundici@>=7.17.0 <7.24.0. Each is a subset of an entry that stays, with the same or a stronger replacement, so nothing resolves differently.serialize-javascript@<=7.0.2was deliberately kept: it covers versions below 5.0.0, whichserialize-javascript@>=5.0.0 <7.0.5does not.🧩 Type of change (check all applicable)
No user-visible change and no product code touched. The six undeclared dependencies were latent defects rather than live failures — hoisting masked them — so this is filed as a chore.
📷 Screenshots / gifs / video [optional]
None — no UI change.
🔗 Related Issues
None.
✅ Tests added?
No product code changed. The acceptance test is that a clean checkout builds and packages identically under strict linking.
Verification must not be run from a nested worktree. A checkout inside another checkout resolves upward into the parent's hoisted
node_modules, so every command passes while CI would fail. These results come from a checkout extracted outside any repo tree, installed with--frozen-lockfile:pnpm install— 29 entries in the rootnode_modules, down from 1241.pnpm build(rollup) andpnpm build:fast(rolldown) — both succeed; they share the CSS plugin.pnpm lint— 0 errors, 12 pre-existingno-consolewarnings.pnpm test— 188 suites, 2617 tests pass across the three projects.pnpm --filter lana run build:vsix— 26 files, 1021.42 KB, matching the pre-change baseline.pnpm --filter docs-site run build— succeeds.Each of the three commits regenerates
pnpm-lock.yamlfor its own concern, so each is independently consistent.📚 Docs updated?
🧪badge — see RELEASING.md)Build tooling is invisible to extension users. No
shamefullyHoistreference survives anywhere in the repo, so no doc went stale.Anything else we need to know? [optional]
A new undeclared import now fails the build instead of silently working. That is the point of the change, but it is a behaviour change for contributors: adding an import without declaring the package in that workspace's
package.jsonwill no longer resolve.A stale-output issue I hit is already fixed on
main. Before mergingmainin,build:devcleaned onlylana/out, so runningbuild:fastthenbuildleft rolldown chunks behind forrollup-plugin-copyto carry into the vsix — a 32-file, 1.04 MB package instead of 26. #1039 resolves it from both directions: rolldown wipes its own output directory, andbuild:dev:rollupandwatch:rollupnow cleanlog-viewer/outexplicitly. Verified by planting a stale chunk and rebuilding. No follow-up needed.Also spotted, not fixed:
ws@7.5.13resolves in the tree but sits below thews@>=8.0.0 <8.20.1override floor, so that override does not cover it.