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: add environment::listen #18263

Merged
merged 8 commits into from
Oct 17, 2024

Conversation

sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Oct 3, 2024

Description

The upside of this approach is that this makes the implementation of environments cleaner IMO.

close #18264

Copy link

stackblitz bot commented Oct 3, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@sapphi-red sapphi-red added the enhancement New feature or request label Oct 17, 2024
@sapphi-red sapphi-red marked this pull request as ready for review October 17, 2024 02:35
@sapphi-red
Copy link
Member Author

I tried this API here: https://github.com/sapphi-red/daienjo-architecture/blob/966c60a5a94dcc388ba163ddbe9f2ba3435b2cbb/environment-pkgs/workerd/index.ts#L89-L290

I had to pass in hot always even if it might be false later. I'm making hot noop when it should be hot: false. (previous code)

Other than that, the API worked fine.

Copy link
Collaborator

@hi-ogawa hi-ogawa left a comment

Choose a reason for hiding this comment

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

Looks good to me!
In your code, it doesn't override init, so previousInstance is not used? I think I'll also mostly go with listen -> close pattern, but maybe someone finds a good use.

@patak-dev
Copy link
Member

Thanks for exploring the different options for the API @sapphi-red!

@patak-dev patak-dev merged commit 4d5f51d into vitejs:main Oct 17, 2024
14 checks passed
@sapphi-red sapphi-red deleted the feat/environment-api-listen branch October 18, 2024 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feat: environment API Vite Environment API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A way to instantiate a resource that must be a singleton inside a dev environment
3 participants