Skip to content
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

feat: Stabilize Deno.serve() API #19141

Merged
merged 14 commits into from
Jul 3, 2023
Prev Previous commit
Next Next commit
updates after merge
  • Loading branch information
bartlomieju committed Jun 28, 2023
commit d6ce3992a9cf53943666307f0f2b288fba633878
2 changes: 1 addition & 1 deletion cli/tests/integration/lsp_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4788,7 +4788,7 @@ fn lsp_completions_auto_import() {
"source": "./b.ts",
"data": {
"exportName": "foo",
"exportMapKey": "foo|6840|file:https:///a/b",
"exportMapKey": "foo|6842|file:https:///a/b",
"moduleSpecifier": "./b.ts",
"fileName": "file:https:///a/b.ts"
},
Expand Down
22 changes: 22 additions & 0 deletions cli/tsc/dts/lib.deno.ns.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5706,6 +5706,28 @@ declare namespace Deno {
handler: ServeHandler;
}

/** An instance of the server created using `Deno.serve()` API.
*
* @category HTTP Server
*/
export interface Server {
/** A promise that resolves once server finishes - eg. when aborted using
* the signal passed to {@linkcode ServeOptions.signal}.
*/
finished: Promise<void>;

/**
* Make the server block the event loop from finishing.
*
* Note: the server blocks the event loop from finishing by default.
* This method is only meaningful after `.unref()` is called.
*/
ref(): void;

/** Make the server not block the event loop from finishing. */
unref(): void;
}

/** Serves HTTP requests with the given handler.
Copy link
Member

Choose a reason for hiding this comment

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

these docs are repeated for each overload?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that's a requirement for deno_doc

Copy link
Member

Choose a reason for hiding this comment

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

Maybe each doc should be specific to the overload? Or maybe we should just consider that a bug in deno_doc and do what makes sense in the d.ts file. It does not make sense to duplicate documentation three times - so there's definitely a bug here (either in deno_doc or jsdoc spec)

Copy link
Member Author

Choose a reason for hiding this comment

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

CC @dsherret @crowlKats do you remember the reason why this was needed? Can we somehow flatten all three overloads to be next to each other with only a single doc?

Copy link
Member

Choose a reason for hiding this comment

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

a doc block is specific to its overload; there is no way to specify a single doc for all overloads. unsure how we could change this, as it is favourable to have the capability to document overloads differently from each other.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've updated the docs so that each overload has a different doc string.

*
* You can specify an object with a port and hostname option, which is the
Expand Down
Loading