vite-plugin-terminal icon indicating copy to clipboard operation
vite-plugin-terminal copied to clipboard

Limited output for `event` object

Open danielkellyio opened this issue 1 year ago • 4 comments

See the reproduction here: https://stackblitz.com/edit/vitejs-vite-13prbv?file=vite.config.js,src%2FApp.vue,src%2Fmain.js&terminal=dev

All that's logged to the terminal is

{
  "isTrusted": true
}

I would expect the full event to be logged. Thanks!

danielkellyio avatar Aug 20 '24 16:08 danielkellyio

Hey @danielkellyio, interesting bug. I wasn't expecting to log the whole Event object. I'm thinking it may be a good idea to destructure what props you want instead as it will be noisty anyways. Semi-related to this bug, I'm thinking on deprecating this plugin in favour of unplugin-turbo-console https://utc.yuy1n.io, that now supports the feature set of vite-plugin-terminal and much more. I would be interested in knowing how it works for you to have another data point for doing the call.

patak-dev avatar Aug 20 '24 17:08 patak-dev

@patak-dev we use this plugin in the Vue certificate so that users don't have to dig through the real browser console for debugging coding challenges (there are several logs there from our proctoring service that make it quite noisy).

The goal for us was to replicate what would be sent to the console normally to also be sent to the terminal in the stackblitz embed (without the user doing anything out of the normal. ie just calling console.log).

Is that possible with unplugin-turbo-console?

I'm having trouble understanding exactly how that would work. My attempted replication but not working: https://stackblitz.com/edit/vitejs-vite-ebn9mj?file=vite.config.js,src%2Fmain.js,src%2FApp.vue&terminal=dev

(Maybe this isn't the right place to continue this convo. Let me know if not :) Thanks!)

danielkellyio avatar Aug 20 '24 19:08 danielkellyio

My primary concern for the context of our coding challenge, is that people can see the key property of a keyboard event. https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key

danielkellyio avatar Aug 20 '24 19:08 danielkellyio

The goal for us was to replicate what would be sent to the console normally to also be sent to the terminal in the stackblitz embed (without the user doing anything out of the normal. ie just calling console.log).

Is that possible with unplugin-turbo-console?

Hey @danielkellyio it seems that your requirement you want doesn't exsist in unplugin-turbo-console as far as of what I''ve found reading their docs as they require you to use import '~console' to start a websocket connection with the server and use a special helper object called server instaid of console ex:

<script setup lang="ts">
import { server } from 'unplugin-turbo-console/helper'
import { ref } from 'vue'

const count = ref(0)

function increment() {
  count.value++
  server.log(count.value)
}
</script>

<template>
  <div>
    {{ count }}
  </div>
  <button @click="increment">
    +
  </button>
</template>

full docs about the feature from their website: https://utc.yuy1n.io/features/pass-logs.html

H1Mohamed avatar Sep 13 '24 14:09 H1Mohamed