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: export server.bindCLIShortcuts #13675

Merged
merged 10 commits into from
Sep 4, 2023
Merged

feat: export server.bindCLIShortcuts #13675

merged 10 commits into from
Sep 4, 2023

Conversation

deot
Copy link
Contributor

@deot deot commented Jun 29, 2023

Description

When i use createServer(Node API), expect to use keyboard shortcuts. can it export?

node/index.ts

export { bindShortcuts } from './shortcuts'
  • example
import { createServer, bindShortcuts } from 'vite'

...
const server = await createServer(...);
await server.listen();
bindShortcuts(server)

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the PR Title Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@stackblitz
Copy link

stackblitz bot commented Jun 29, 2023

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

@ArnaudBarre
Copy link
Member

cc @bluwy this makes changing the behaviour of rawMode a lot more breaking. But that's fine if we change this only in Vite 5.

The printHelp option was there from the beginning to make this customisable later when using the JS API

@patak-dev
Copy link
Member

Should it be a method in server if we expose this?

@bluwy
Copy link
Member

bluwy commented Jul 5, 2023

Yeah making it server.bindShortcuts() feel more natural to me. As a start, we can also avoid exposing extending the shortcuts so it won't be a breaking change when we decide to add more.

docs/guide/api-javascript.md Outdated Show resolved Hide resolved
docs/guide/api-javascript.md Outdated Show resolved Hide resolved
packages/vite/src/node/index.ts Outdated Show resolved Hide resolved
packages/vite/src/node/server/index.ts Outdated Show resolved Hide resolved
packages/vite/src/node/preview.ts Outdated Show resolved Hide resolved
@patak-dev patak-dev added the p2-nice-to-have Not breaking anything but nice to have (priority) label Jul 17, 2023
bluwy
bluwy previously approved these changes Jul 21, 2023
@patak-dev patak-dev added this to the 5.0 milestone Jul 21, 2023
@bluwy bluwy changed the title feat: export bindShortcuts from vite/node feat: export server.bindCLIShortcuts Sep 4, 2023
Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks for spotting the meeting notes and making the changes. We forgot to leave a comment about it 😅

@bluwy bluwy merged commit 1a2e5e6 into vitejs:main Sep 4, 2023
13 checks passed
@shellscape
Copy link

hey folks, apologies for this kind of question, but I'm unfamiliar with the release scheduling for Vite and I wasn't able to dig up (or missed) the docs around it. Is there any info that outlines when we could expect to see this released?

@bluwy
Copy link
Member

bluwy commented Sep 8, 2023

We haven't made a release this week. I'll skim through some PRs to merge and cut a new release today. The next version should be 5.0.0-beta.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants