Skip to content

Replace redundant dependencies with Node 22 built-ins - #4601

Open
josefs wants to merge 8 commits into
mainfrom
josefs/replace-packages-with-node-22-built-ins
Open

josefs wants to merge 8 commits into
mainfrom
josefs/replace-packages-with-node-22-built-ins

Conversation

@josefs

@josefs josefs commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Replaces several dependencies and devDependencies in extensions/ql-vscode with Node 22 built-ins or existing packages, with each package removal in its own commit:

  1. d3 + @types/d3: Replace the single select(this).on("click", ...) call in src/view/results/Graph.tsx with this.addEventListener("click", ...) and remove "d3" from transformPackages in test/jest-config.ts.
  2. through2 + @types/readable-stream: Replace objectTransform in gulpfile.ts/textmate.ts with new Transform({ objectMode: true, transform(...) }) from Node's built-in "stream".
  3. del: Replace del(...) in gulpfile.ts/typescript.ts with rm(join(tsProject.projectDirectory, "out"), { recursive: true, force: true }) from "fs/promises".
  4. gulp-replace: Replace the single gulp-replace stream in gulpfile.ts/appInsights.ts with readFile and writeFile from "fs/promises".
  5. ansi-colors: Replace gray and red in gulpfile.ts/typescript.ts with styleText from Node's built-in "util".
  6. glob: Replace glob in src/databases/local-databases/database-resolver.ts, src/databases/local-databases/db-contents-heuristics.ts, and src/databases/qlpack.ts with glob from "fs/promises".
  7. nanoid: Replace nanoid() with randomUUID() from "crypto" (and customAlphabet("123456789") in VariantAnalysisAnalyzedRepos.stories.tsx with faker.number.int) and remove "nanoid" from transformPackages in test/jest-config.ts.
  8. tmp: Import dirSync and fileSync in tests from "tmp-promise" (which re-exports them from tmp) and remove the direct "tmp" dependency from dependencies (@types/tmp is kept in devDependencies for tmp-promise's type definitions).

josefs and others added 8 commits October 15, 2026 11:04
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@josefs
josefs marked this pull request as ready for review October 15, 2026 10:44
@josefs
josefs requested a review from a team as a code owner October 15, 2026 10:44
@josefs
josefs requested review from kaspersv and a max review from Copilot October 15, 2026 10:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Native globbing breaks database and query workflows on supported Node 20 extension hosts.

1 open finding
What changed in this PR

Reduces dependencies in the CodeQL VS Code extension by using Node built-ins and existing libraries.

Changes:

  • Replace build utilities and filesystem globbing with Node APIs.
  • Replace identifier generation and graph click handling.
  • Reuse tmp-promise in tests and remove unused dependencies.
File Description
extensions/​ql-vscode/​test/​vscode-tests/​no-workspace/​query-history/​store/​query-history-store.test.ts Use UUIDs in fixtures.
extensions/​ql-vscode/​test/​vscode-tests/​no-workspace/​local-queries/​webview.test.ts Import temporary-file helpers from tmp-promise.
extensions/​ql-vscode/​test/​vscode-tests/​no-workspace/​databases/​local-databases-ui.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​vscode-tests/​no-workspace/​code-tour/​code-tour.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​vscode-tests/​minimal-workspace/​queries-panel/​query-pack-discovery.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​vscode-tests/​minimal-workspace/​queries-panel/​query-discovery.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​vscode-tests/​minimal-workspace/​qlpack-generator.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​vscode-tests/​minimal-workspace/​local-queries/​local-databases.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​vscode-tests/​minimal-workspace/​common/​vscode/​file-path-discovery.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​vscode-tests/​jest.activated-extension.setup.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​vscode-tests/​cli-integration/​query-server/​query-server-client.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​vscode-tests/​cli-integration/​model-editor/​modeled-method-fs.test.ts Generate temporary paths with UUID prefixes.
extensions/​ql-vscode/​test/​vscode-tests/​cli-integration/​local-queries/​skeleton-query-wizard.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​unit-tests/​local-queries/​query-contents.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​unit-tests/​databases/​local-databases/​db-contents-heuristics.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​unit-tests/​common/​files.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​jest-config.ts Remove transforms for removed dependencies.
extensions/​ql-vscode/​test/​common/​logging/​output-channel-logger.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​src/​view/​results/​Graph.tsx Use native click listeners.
extensions/​ql-vscode/​src/​variant-analysis/​run-remote-query.ts Use UUIDs for temporary paths.
extensions/​ql-vscode/​src/​stories/​variant-analysis/​VariantAnalysisAnalyzedRepos.stories.tsx Generate repository identifiers with Faker.
extensions/​ql-vscode/​src/​run-queries-shared.ts Use UUID-based query identifiers.
extensions/​ql-vscode/​src/​query-server/​query-runner.ts Use UUID-based run identifiers.
extensions/​ql-vscode/​src/​model-editor/​extensions-workspace-folder.ts Use UUIDs for pack-location probes.
extensions/​ql-vscode/​src/​databases/​qlpack.ts Use native globbing for database schemes.
extensions/​ql-vscode/​src/​databases/​local-databases/​db-contents-heuristics.ts Use native globbing for root detection.
extensions/​ql-vscode/​src/​databases/​local-databases/​database-resolver.ts Use native globbing for database discovery.
extensions/​ql-vscode/​src/​databases/​database-fetcher.ts Use UUIDs for filename collision fallback.
extensions/​ql-vscode/​src/​compare/​compare-view.ts Use UUID-based streaming identifiers.
extensions/​ql-vscode/​package.json Remove redundant dependencies.
extensions/​ql-vscode/​package-lock.json Prune the dependency graph.
extensions/​ql-vscode/​gulpfile.ts/​typescript.ts Use native styling and directory removal.
extensions/​ql-vscode/​gulpfile.ts/​textmate.ts Use Node’s object-mode transform stream.
extensions/​ql-vscode/​gulpfile.ts/​appInsights.ts Inject telemetry keys through filesystem APIs.
Files not reviewed (1)
  • extensions/ql-vscode/package-lock.json: Generated file

🧠 Review effort: Max


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

} from "./database-contents";
import { DatabaseKind } from "./database-contents";
import { glob } from "glob";
import { glob } from "fs/promises";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure who decides which minimum version of VS Code we support. It might be possible to bump the minimum supported version, but if it isn't we should probably keep the glob dependency for now.

@kaspersv kaspersv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides the pending issue with glob, this looks good to me. Would you mind creating a new PR with the other commits. Then we can get those merged while we clarify whether we can bump the minimum VS Code version we support.

@josefs

josefs commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

@kaspersv #4607

This branch has not been deployed

No deployments
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.

3 participants