https://github.com/aslemammad/vite-plugin-terminal
Log in the node terminal from the browser
https://github.com/aslemammad/vite-plugin-terminal
Last synced: 9 months ago
JSON representation
Log in the node terminal from the browser
- Host: GitHub
- URL: https://github.com/aslemammad/vite-plugin-terminal
- Owner: Aslemammad
- License: mit
- Fork: true (patak-dev/vite-plugin-terminal)
- Created: 2022-01-20T20:16:53.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-20T21:49:45.000Z (over 4 years ago)
- Last Synced: 2024-10-01T02:12:06.788Z (over 1 year ago)
- Size: 623 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# vite-plugin-terminal
[](https://www.npmjs.com/package/vite-plugin-terminal)
Log in the node terminal from the browser

[Open a playground online in StackBlitz](https://stackblitz.com/edit/vitejs-vite-c8dfaq?file=main.js&terminal=dev)
## Install
```bash
npm i -D vite-plugin-terminal
```
Add plugin to your `vite.config.ts`:
```ts
// vite.config.ts
import Terminal from 'vite-plugin-terminal'
export default {
plugins: [
Terminal()
]
}
```
## Usage
In your source code import `terminal`, and use it like you do with `console.log`.
```
import { terminal } from 'virtual:terminal'
terminal.log('Hey terminal! A message from the browser')
```
The terminal log calls will be removed when building the app.
## API
Supported methods:
- `terminal.log(obj)`
- `terminal.info(obj)`
- `terminal.warn(obj)`
- `terminal.error(obj)`
- `terminal.assert(assertion, obj)`
## Credits
- Original idea from [Domenic Elm](https://twitter.com/elmd_)
- Project setup from [@antfu's vite-plugin-inspect](https://github.com/antfu/vite-plugin-inspect)
- Bundling by [unbuild](https://github.com/unjs/unbuild)
- Strip functions during build uses [rollup-plugin-strip](https://github.com/rollup/plugins/tree/master/packages/strip)
## Sponsors
## License
[MIT](./LICENSE) License © 2022-present [Matias Capeletto](https://github.com/patak-dev)