Skip to content

refactor: replace compression with http-compression#146

Merged
chenjiahan merged 3 commits into
mainfrom
replace_compression_0309
Mar 10, 2026
Merged

refactor: replace compression with http-compression#146
chenjiahan merged 3 commits into
mainfrom
replace_compression_0309

Conversation

@chenjiahan

Copy link
Copy Markdown
Member

The compression middleware has been replaced with http-compression which introduces less dependencies.

https://github.com/Kikobeats/http-compression

Copilot AI review requested due to automatic review settings March 9, 2026 14:47
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the project's compression middleware by swapping out the 'compression' package for 'http-compression'. This change aims to streamline the dependency tree by utilizing a more lightweight alternative, thereby potentially improving build times and reducing the overall footprint of the application. The functional behavior of HTTP compression remains intact, with a specific adjustment to disable Brotli compression in the new setup.

Highlights

  • Dependency Replacement: The 'compression' middleware has been replaced with 'http-compression' to reduce the number of dependencies.
  • Type Definitions: New type definitions for the 'http-compression' module were added to support the new dependency.
  • Configuration Update: The server configuration was updated to use the new 'http-compression' middleware, explicitly disabling Brotli compression.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • package.json
    • Removed 'compression' and its associated type definitions from development dependencies.
    • Added 'http-compression' as a new development dependency.
  • pnpm-lock.yaml
    • Updated the lock file to reflect the removal of 'compression', '@types/compression', 'compressible', 'negotiator@0.6.4', and 'on-headers'.
    • Added 'http-compression' and its related dependencies to the lock file.
  • rslib.config.ts
    • Removed 'compression' from the list of external commonjs modules.
  • src/http-compression.d.ts
    • Added a new file containing TypeScript type declarations for the 'http-compression' module.
  • src/server.ts
    • Modified the import statement to use 'http-compression' instead of 'compression'.
    • Updated the middleware instantiation to explicitly configure 'http-compression' with 'brotli: false'.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request refactors the dev server to replace the compression middleware with http-compression to reduce dependencies. The changes are logical and correctly implemented. I have one suggestion to improve the new TypeScript declaration file for http-compression.

Comment thread src/http-compression.d.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6509c01298

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/server.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR replaces the dev server’s compression middleware implementation by switching from compression to http-compression to reduce the dependency footprint.

Changes:

  • Swap the dynamically imported middleware from compression to http-compression, configuring it with brotli: false.
  • Add a local ambient TypeScript declaration for http-compression.
  • Update build/dependency configuration by removing compression from externals and lockfile and adding http-compression.

Reviewed changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/server.ts Switch dynamic import to http-compression and configure middleware options.
src/http-compression.d.ts Add local module declaration to provide TS types for http-compression.
rslib.config.ts Remove compression from server bundle externals.
package.json Remove compression and add http-compression.
pnpm-lock.yaml Lockfile updates reflecting dependency swap.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/server.ts Outdated
@chenjiahan chenjiahan merged commit c2071a7 into main Mar 10, 2026
3 checks passed
@chenjiahan chenjiahan deleted the replace_compression_0309 branch March 10, 2026 02:10
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.

2 participants