https://github.com/stagas/vite-open
Open any file directly in a Vite dev server.
https://github.com/stagas/vite-open
dev-server file open vite
Last synced: 12 months ago
JSON representation
Open any file directly in a Vite dev server.
- Host: GitHub
- URL: https://github.com/stagas/vite-open
- Owner: stagas
- License: mit
- Created: 2022-01-17T19:37:13.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-08-10T03:42:58.000Z (over 3 years ago)
- Last Synced: 2025-03-12T08:51:21.630Z (about 1 year ago)
- Topics: dev-server, file, open, vite
- Language: TypeScript
- Homepage:
- Size: 724 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
vite-open
Open any file directly in a Vite dev server.
npm i vite-open -g
pnpm add vite-open -g
yarn global add vite-open
## CLI
## Features
- **_Zero config, zero setup_**. Open `.js` `.jsx` `.ts` `.tsx` `.md` and `.html` files directly.
- **_Vite_** configured for development, **_all ESNext features_** and accurate sourcemaps.
- Strict CORS headers enabling **_all Web features_**.
- Compile time pattern-based **_debugging_** using [rollup-plugin-debug](https://github.com/stagas/rollup-plugin-debug).
- Open files in VSCode by **_clicking links directly_** in Chrome DevTools using the [open-in-editor](https://github.com/generalov/open-in-editor-extension) Chrome extension _(installed separately)_.
- **_QR code_** display with the external address for easy access by phone.
## API
# Options src/index.ts#L27
# constructor()
debugging = '' src/index.ts#L34 string
debuggingThis = false src/index.ts#L35 boolean
file src/index.ts#L28 string
https = false src/index.ts#L30 boolean
jsx = 'react' src/index.ts#L31 string
log = defaultLog src/index.ts#L38 noForce = false src/index.ts#L33 boolean
noOpen = false src/index.ts#L32 boolean
quiet = false src/index.ts#L36 boolean
responses = {} src/index.ts#L42 Record<string, {
# content src/index.ts#L44
string
fn src/index.ts#L45 type src/index.ts#L43 string
root = '.' src/index.ts#L29 string
virtual = {} src/index.ts#L40 Record<string, any>
viteOptions = {} src/index.ts#L53 Partial<InlineConfig>
VirtualModules src/.fastpm/-/vite-plugin-virtual@0.1.1/dist/index.d.ts#L4 ViteServer src/server.ts#L10 # localAddr src/server.ts#L12
string
log src/server.ts#L18 networkAddr src/server.ts#L14 string
vite src/server.ts#L16 ViteDevServer
VirtualModule src/.fastpm/-/vite-plugin-virtual@0.1.1/dist/index.d.ts#L3 string | object
virtualPlugin src/index.ts#L23 any
invalidateVirtualModule(server, id) src/.fastpm/-/vite-plugin-virtual@0.1.1/dist/index.d.ts#L7 # open(options) src/index.ts#L114 # options
Partial<Options>
open(options) =>
Promise<ViteServer>
updateVirtualModule(plugin, id, value) src/.fastpm/-/vite-plugin-virtual@0.1.1/dist/index.d.ts#L8
## Credits
- [@babel/core](https://npmjs.org/package/@babel/core) by [The Babel Team](https://babel.dev/team) – Babel compiler core.
- [@babel/plugin-proposal-class-properties](https://npmjs.org/package/@babel/plugin-proposal-class-properties) by [The Babel Team](https://babel.dev/team) – This plugin transforms static class properties as well as properties declared with the property initializer syntax
- [@babel/plugin-proposal-decorators](https://npmjs.org/package/@babel/plugin-proposal-decorators) by [The Babel Team](https://babel.dev/team) – Compile class and object decorators to ES5
- [@babel/plugin-proposal-private-methods](https://npmjs.org/package/@babel/plugin-proposal-private-methods) by [The Babel Team](https://babel.dev/team) – This plugin transforms private class methods
- [@babel/plugin-transform-react-jsx](https://npmjs.org/package/@babel/plugin-transform-react-jsx) by [The Babel Team](https://babel.dev/team) – Turn JSX into React function calls
- [@babel/plugin-transform-typescript](https://npmjs.org/package/@babel/plugin-transform-typescript) by [The Babel Team](https://babel.dev/team) – Transform TypeScript into ES.next
- [@stagas/chalk](https://npmjs.org/package/@stagas/chalk) by [@stagas](@stagas/chalk) – Terminal string styling done right (+ CommonJS build)
- [@vitejs/plugin-basic-ssl](https://npmjs.org/package/@vitejs/plugin-basic-ssl) by [Evan You and Vite Contributors](https://github.com/vitejs)
- [decarg](https://npmjs.org/package/decarg) by [stagas](https://github.com/stagas) – decorator based cli arguments parser
- [everyday-node](https://npmjs.org/package/everyday-node) by [stagas](https://github.com/stagas) – Everyday node utilities.
- [everyday-utils](https://npmjs.org/package/everyday-utils) by [stagas](https://github.com/stagas) – Everyday utilities
- [github-markdown-css](https://npmjs.org/package/github-markdown-css) by [Sindre Sorhus](https://sindresorhus.com) – The minimal amount of CSS to replicate the GitHub Markdown style
- [open-in-editor-connect](https://npmjs.org/package/open-in-editor-connect) by [Evgeniy V. Generalov](https://github.com/generalov) – Open in editor middleware
- [qrcode-terminal](https://npmjs.org/package/qrcode-terminal) by [gtanner](https://github.com/gtanner) – QRCodes, in the terminal
- [rollup-plugin-debug](https://npmjs.org/package/rollup-plugin-debug) by [stagas](https://github.com/stagas) – Console debug statements that can be pattern toggled at compile time from comments in the code.
- [running-at](https://npmjs.org/package/running-at) by [Maximilian Schiller](https://github.com/BetaHuhn) – Get local and network ip address
- [vite](https://npmjs.org/package/vite) by [Evan You](https://github.com/vitejs) – Native-ESM powered web dev build tool
- [vite-plugin-babel](https://npmjs.org/package/vite-plugin-babel) by [Miłosz Mandowski](https://github.com/owlsdepartment) – Runs Babel in Vite during all commands
- [vite-plugin-markdown](https://npmjs.org/package/vite-plugin-markdown) by [Kengo Hamasaki](https://github.com/hmsk) – Import markdown files in vite
- [vite-plugin-virtual](https://npmjs.org/package/vite-plugin-virtual) by [patak-js](https://github.com/patak-js) – Virtual modules with HMR invalidation plugin for Vite
## Contributing
[Fork](https://github.com/stagas/vite-open/fork) or [edit](https://github.dev/stagas/vite-open) and submit a PR.
All contributions are welcome!
## License
MIT © 2022 [stagas](https://github.com/stagas)