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: controlflow verbose #43

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/components/Editor/Output/ControlflowPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import { debouncedWatch } from '@vueuse/core'
import Checkbox from 'src/components/ui/Checkbox.vue'
import { useOxc } from 'src/composables/oxc'
import { ref, useTemplateRef } from 'vue'
import { ref, useTemplateRef, watch } from 'vue'
import OutputPreview from './OutputPreview.vue'

const viz = await instance()

const { oxc } = await useOxc()
const { oxc, options } = await useOxc()
const panelEl = useTemplateRef<HTMLDivElement>('panel')

debouncedWatch(
Expand All @@ -22,13 +22,22 @@
)

const raw = ref(false)
const verbose = ref(false)

watch(
() => verbose.value,
(val) => {
options.value.controlFlow.verbose = val

Check failure on line 30 in src/components/Editor/Output/ControlflowPanel.vue

View workflow job for this annotation

GitHub Actions / Build Playground

Property 'controlFlow' does not exist on type '{ run: { syntax?: boolean | undefined; lint?: boolean | undefined; format?: boolean | undefined; prettierFormat?: boolean | undefined; prettierIr?: boolean | undefined; transform?: boolean | undefined; typeCheck?: boolean | undefined; scope?: boolean | undefined; symbol?: boolean | undefined; }; ... 4 more ...; mini...'.
},
)
</script>

<template>
<div class="w-full flex flex-col overflow-auto">
<Checkbox id="raw" v-model="raw" title="Raw" class="p-2" />
<Checkbox id="verbose" v-model="verbose" title="Verbose" class="p-2" />

<OutputPreview v-show="raw" :code="oxc.controlFlowGraph" lang="tsx" />
<OutputPreview v-show="raw" :code="oxc.controlFlowGraph" lang="text" />
<!-- eslint-disable-next-line vue/no-unused-refs -->
<div v-show="!raw" ref="panel" />
</div>
Expand Down
3 changes: 3 additions & 0 deletions src/composables/oxc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
transformer: {},
codegen: {},
minifier: {},
controlFlow: {

Check failure on line 40 in src/composables/oxc.ts

View workflow job for this annotation

GitHub Actions / Build Playground

Object literal may only specify known properties, and 'controlFlow' does not exist in type 'Required<OxcOptions>'.
verbose: false,
},
})
const oxc = await oxcPromise
const state = shallowRef(oxc)
Expand Down
2 changes: 1 addition & 1 deletion src/utils/shiki.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const highlighterPromise = createHighlighterCore({
loadWasm: getWasm,
})

export type ShikiLang = 'json' | 'tsx'
export type ShikiLang = 'json' | 'tsx' | 'text'

export function highlight(
highlighter: HighlighterCore,
Expand Down
Loading