Skip to content

feat(http/unstable): unstable-file-server #6668

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

iuioiua
Copy link
Contributor

@iuioiua iuioiua commented May 21, 2025

This new module is an updated version of @std/http/file-server that uses deno serve, which takes care of the heavy lifting of some argument parsing and can be run in parallel service workers thanks to --parallel. It directly relies on the exported symbols of @std/http/file-server and a few kinks need to be figured out.

Closes #5681

@github-actions github-actions bot added the http label May 21, 2025
Copy link

codecov bot commented May 21, 2025

Codecov Report

Attention: Patch coverage is 53.33333% with 28 lines in your changes missing coverage. Please review.

Project coverage is 94.08%. Comparing base (9195573) to head (6ce9184).

Files with missing lines Patch % Lines
http/unstable_file_server.ts 53.33% 28 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6668      +/-   ##
==========================================
- Coverage   94.69%   94.08%   -0.62%     
==========================================
  Files         562      561       -1     
  Lines       46646    41661    -4985     
  Branches     6569     6558      -11     
==========================================
- Hits        44173    39197    -4976     
+ Misses       2430     2416      -14     
- Partials       43       48       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

stdout: "piped",
stderr: "piped",
}).spawn();
await readUntilMatch(child.stderr, "Listening");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Surprised to see that the output of deno serve prints to stderr instead of stdout. Is this a bug?

}).spawn();
await readUntilMatch(child.stderr, "Listening");
const response = await fetch(`http://localhost:${port}`);
assertEquals(response.status, 200);
Copy link
Contributor Author

@iuioiua iuioiua May 22, 2025

Choose a reason for hiding this comment

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

Haven't been able to look deep into why this fails. Any help would be appreciated.

@iuioiua iuioiua marked this pull request as ready for review May 22, 2025 02:13
@iuioiua iuioiua requested a review from kt3k as a code owner May 22, 2025 02:13
@kt3k
Copy link
Member

kt3k commented May 23, 2025

The entrypoint name seems suggesting this will be merged to file-server in the future, but I don't think we can do that (this script only work with deno serve, not with deno run)

Maybe better to give a different name?

@iuioiua
Copy link
Contributor Author

iuioiua commented May 26, 2025

Yes, I should've clarified that my intention was that this was to replace the current @std/http/file-server. My reasoning is that it's worth the breakage thanks to deno serve doing the heavy lifting of CLI argument parsing and the ability to parallelise requests with deno serve --parallel. Though, I know I'm more liberal with breaking changes than most.

Alternatively, we can depend on denoland/deno#29447 to be implemented as to minimise breaking changes and avoiding having to create a new endpoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

to-do: make @std/http/file-server compatible with deno serve --parallel
2 participants