-
Notifications
You must be signed in to change notification settings - Fork 13
Open deps: bump @types/bun from 1.2.23 to 1.3.1 in /web WITH REQUIRED FIX #1898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open deps: bump @types/bun from 1.2.23 to 1.3.1 in /web WITH REQUIRED FIX #1898
Conversation
Bumps [@types/bun](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/bun) from 1.2.23 to 1.3.1. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/bun) --- updated-dependencies: - dependency-name: "@types/bun" dependency-version: 1.3.1 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]>
Summary of ChangesHello @vorburger, 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 primarily focuses on maintaining the project's dependencies by upgrading the Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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 updates the @types/bun dependency and correctly adapts the code to a breaking change in the Bun.serve API by renaming the static property to routes in web/src/bun/develop.ts. While this change is correct, I've identified a pre-existing bug in the server's routing logic that prevents static assets like CSS from being served, which will likely cause rendering issues. I've provided a detailed comment with a suggested refactoring to centralize the routing logic and fix this bug.
| routes: { | ||
| "/": index, | ||
| "/chat": chat, | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While renaming static to routes is correct for the updated @types/bun dependency, the overall routing logic is split between this routes object and the fetch handler that follows. This can be confusing to maintain.
Furthermore, the current fetch handler appears to have a bug where it doesn't serve static assets like enola.css (referenced in index.html), which will result in a 404 error and cause pages to render incorrectly.
To improve clarity and fix this bug, I recommend consolidating all routing logic within an async fetch handler. This centralizes routing and makes it easier to manage static assets.
Here's an example of how you could refactor the serve call:
serve({
port: PORT,
development: { hmr: false },
async fetch(req) {
const path = new URL(req.url).pathname;
if (IGNORE.includes(path)) {
return new Response("🪹 No Content ", { status: 204 });
}
switch (path) {
case "/":
return new Response(index);
case "/chat":
return new Response(chat);
}
// Serve other static files from the public directory
const publicPath = `./public${path}`;
const publicFile = file(publicPath);
if (await publicFile.exists()) {
return new Response(publicFile);
}
return new Response("🙅🏽♀️ Not Found", { status: 404 });
},
});This approach removes the routes object and handles all paths within fetch, including serving any existing file from the ./public directory, which would fix the issue with missing static assets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CSS actually works just fine (I've tested it).
Fixes #1895.