From 7a22ca24bbac57913cd1e65a8fb245c4a01d7272 Mon Sep 17 00:00:00 2001
From: alexzhang1030 <1642114555@qq.com>
Date: Wed, 2 Aug 2023 16:51:10 +0800
Subject: [PATCH 01/11] feat: add state analyze init
---
packages/core/build.config.ts | 1 +
packages/core/package.json | 1 +
.../src/compiler/__test__/analyze.test.ts | 9 +++---
.../core/src/compiler/__test__/common.test.ts | 15 ----------
packages/core/src/compiler/common/analyze.ts | 14 ++++++----
packages/core/src/compiler/common/parse.ts | 11 ++++----
packages/core/src/compiler/index.ts | 28 +++++++++++++++----
packages/core/src/compiler/state-analyze.ts | 16 +++++++++++
packages/node/src/vite.ts | 24 +++++++++++-----
pnpm-lock.yaml | 23 +++++++++++++--
tsconfig.json | 2 +-
11 files changed, 97 insertions(+), 47 deletions(-)
create mode 100644 packages/core/src/compiler/state-analyze.ts
diff --git a/packages/core/build.config.ts b/packages/core/build.config.ts
index 268b6001..40d41421 100644
--- a/packages/core/build.config.ts
+++ b/packages/core/build.config.ts
@@ -11,6 +11,7 @@ export default defineBuildConfig({
'@babel/parser',
'estree-walker',
'magic-string',
+ 'esm-analyzer',
],
declaration: true,
rollup: {
diff --git a/packages/core/package.json b/packages/core/package.json
index 903c04b0..844cf7af 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -38,6 +38,7 @@
"dependencies": {
"@babel/parser": "^7.22.7",
"birpc": "^0.2.12",
+ "esm-analyzer": "^0.2.6",
"estree-walker": "^2.0.2",
"magic-string": "^0.30.2",
"vite-hot-client": "^0.2.1"
diff --git a/packages/core/src/compiler/__test__/analyze.test.ts b/packages/core/src/compiler/__test__/analyze.test.ts
index e2a0031e..f00bac96 100644
--- a/packages/core/src/compiler/__test__/analyze.test.ts
+++ b/packages/core/src/compiler/__test__/analyze.test.ts
@@ -3,17 +3,18 @@ import { analyzeCode } from '..'
const baseConfig: AnalyzeOptions = {
rerenderTrace: true,
+ stateAnalyze: true,
}
describe('analyzeCode - exclude', () => {
test('not acceptable lang', () => {
- expect(analyzeCode('', 'test.txt', baseConfig)).toBe('')
+ expect(analyzeCode('', 'test.txt', baseConfig)).toBeNull()
})
test('excluded path', () => {
- expect(analyzeCode('', 'node_modules/test.js', baseConfig)).toBe('')
+ expect(analyzeCode('', 'node_modules/test.js', baseConfig)).toBeNull()
})
test('not enabled', () => {
- expect(analyzeCode('', 'test.js', { rerenderTrace: false })).toBe('')
+ expect(analyzeCode('', 'test.js', { rerenderTrace: false, stateAnalyze: false })).toBeNull()
})
test('should execute', () => {
expect(analyzeCode(`
@@ -39,7 +40,7 @@ describe('analyzeCode - rerender - sfc', () => {
`
- const result = analyzeCode(code, 'test.vue', baseConfig)
+ const result = analyzeCode(code, 'test.vue', baseConfig) as { code: string } | undefined
expect(result?.code).toMatchSnapshot()
})
test('script setup with script', () => {
diff --git a/packages/core/src/compiler/__test__/common.test.ts b/packages/core/src/compiler/__test__/common.test.ts
index 5e7d7480..c787f952 100644
--- a/packages/core/src/compiler/__test__/common.test.ts
+++ b/packages/core/src/compiler/__test__/common.test.ts
@@ -25,19 +25,4 @@ describe('compiler:common:parseSFC', () => {
parseSFC(code, 'test.vue')
}).not.toThrow()
})
- test('should throw if
-
-
-
- `
- expect(() => {
- parseSFC(code, 'test.vue')
- }).toThrow()
- })
})
diff --git a/packages/core/src/compiler/common/analyze.ts b/packages/core/src/compiler/common/analyze.ts
index 998849c5..0b148f45 100644
--- a/packages/core/src/compiler/common/analyze.ts
+++ b/packages/core/src/compiler/common/analyze.ts
@@ -8,9 +8,6 @@ function isSetupFn(node: Node): node is ObjectMethod | ObjectProperty {
return isObjectFn(node) && (node.key as Identifier).name === SETUP_FN
}
-/**
- * @returns insert code location
- */
export function analyzeVueSFC(code: string, filename: string) {
const {
scriptSetup,
@@ -18,6 +15,7 @@ export function analyzeVueSFC(code: string, filename: string) {
script,
scriptLocation,
getScriptAST,
+ lang,
} = parseSFC(code, filename)
if (!scriptSetup && !script)
@@ -27,10 +25,11 @@ export function analyzeVueSFC(code: string, filename: string) {
// script only: start: after
@@ -200,6 +206,9 @@ const { showGraphSetting } = useGraphSettings()
+
diff --git a/packages/client/types.ts b/packages/client/types.ts
index b12f0914..d14e0a22 100644
--- a/packages/client/types.ts
+++ b/packages/client/types.ts
@@ -1,4 +1,5 @@
import type { Router } from 'vue-router'
+import type { getAnalyzeResultByPath, prepareStateAnalyze } from '@vite-plugin-vue-devtools/core/compiler'
type WithOptional = Omit & Partial>
@@ -32,6 +33,10 @@ export interface VueDevtoolsHostClient {
rerenderHighlight: {
updateInfo: (uid: string, name: string, _bounds: ComponentInspectorBounds) => void
}
+ stateAnalyze?: {
+ prepareState: typeof prepareStateAnalyze
+ getAnalyzeResultByPath: typeof getAnalyzeResultByPath
+ }
}
export type BuiltinTabGroup = 'app' | 'modules' | 'advanced'
diff --git a/packages/core/package.json b/packages/core/package.json
index 844cf7af..6c97ce78 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -38,7 +38,7 @@
"dependencies": {
"@babel/parser": "^7.22.7",
"birpc": "^0.2.12",
- "esm-analyzer": "^0.2.6",
+ "esm-analyzer": "^0.3.2",
"estree-walker": "^2.0.2",
"magic-string": "^0.30.2",
"vite-hot-client": "^0.2.1"
diff --git a/packages/node/client.d.ts b/packages/node/client.d.ts
index 1a00b9d1..f6025cb7 100644
--- a/packages/node/client.d.ts
+++ b/packages/node/client.d.ts
@@ -1,3 +1,5 @@
+import { getAnalyzeResultByPath } from "@vite-plugin-vue-devtools/core/compiler"
+
declare type AssetType = 'image' | 'font' | 'video' | 'audio' | 'text' | 'json' | 'other'
declare interface AssetInfo {
@@ -45,6 +47,8 @@ declare interface RPCFunctions {
installPackage(packages: string[], options?: ExecNpmScriptOptions): Promise
uninstallPackage(packages: string[], options?: ExecNpmScriptOptions): Promise
root(): string
+ stateAnalyzePrepare: (callback: () => void) => Promise
+ stateAnalyzeGetResultByPath(path: string): Promise>
}
diff --git a/packages/node/src/vite.ts b/packages/node/src/vite.ts
index 2f911a3f..f3819382 100644
--- a/packages/node/src/vite.ts
+++ b/packages/node/src/vite.ts
@@ -7,7 +7,8 @@ import Inspect from 'vite-plugin-inspect'
import VueInspector from 'vite-plugin-vue-inspector'
import { PLUGIN_NAME, createRPCServer } from '@vite-plugin-vue-devtools/core'
import type { AnalyzeOptions, DeepRequired } from '@vite-plugin-vue-devtools/core/compiler'
-import { analyzeCode, analyzeOptionsDefault } from '@vite-plugin-vue-devtools/core/compiler'
+import { analyzeCode, analyzeOptionsDefault, getAnalyzeResultByPath, prepareStateAnalyze } from '@vite-plugin-vue-devtools/core/compiler'
+import type { ExecNpmScriptOptions, RPCFunctions } from '../client'
import { DIR_CLIENT } from './dir'
import {
execNpmScript,
@@ -121,6 +122,12 @@ export default function VitePluginVueDevTools(options?: VitePluginVueDevToolsOpt
rpc.onTerminalExit({ data })
},
}),
+ stateAnalyzePrepare: async () => {
+ await prepareStateAnalyze()
+ },
+ stateAnalyzeGetResultByPath: (path: string) => {
+ return getAnalyzeResultByPath(path)
+ },
})
}
const plugin = {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index acb0d918..b569f1f9 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -199,8 +199,8 @@ importers:
specifier: ^0.2.12
version: 0.2.12
esm-analyzer:
- specifier: ^0.2.6
- version: 0.2.6
+ specifier: ^0.3.2
+ version: 0.3.2
estree-walker:
specifier: ^2.0.2
version: 2.0.2
@@ -3871,8 +3871,8 @@ packages:
- supports-color
dev: true
- /esm-analyzer@0.2.6:
- resolution: {integrity: sha512-rOc7+O4Z2WxjDK2MEuPtMtUyZCa+QeZt0m+apVInuqf26EHHhEZVH4BZiwlLactfLMk1PBccDb2soTmiCrm4jg==}
+ /esm-analyzer@0.3.2:
+ resolution: {integrity: sha512-FbuRZZTkdtYfnf1FDw/CM7dyONFp0OkczDYDCKwhOEFD+FNUpqigUE+NQkM2zLus0tfK4at1Pb88jiLuKR09BQ==}
dependencies:
'@babel/parser': 7.22.7
estree-walker: 2.0.2
From 04ab57a252f9bae8f7066326489a0354c55067e3 Mon Sep 17 00:00:00 2001
From: alexzhang1030 <1642114555@qq.com>
Date: Thu, 3 Aug 2023 11:52:03 +0800
Subject: [PATCH 03/11] feat: ui init
---
packages/client/components/SearchBox.vue | 4 +--
packages/client/logic/graph.ts | 9 -----
packages/client/logic/rpc.ts | 1 -
packages/client/logic/state-graph.ts | 38 +++++++++++++++++++++
packages/client/package.json | 1 +
packages/client/pages/graph.vue | 24 +++++++------
packages/core/package.json | 1 -
packages/core/src/compiler/index.ts | 2 +-
packages/core/src/compiler/state-analyze.ts | 23 +++++++------
packages/node/client.d.ts | 5 +--
packages/node/src/vite.ts | 10 ++----
packages/ui-kit/src/components/Loading.vue | 21 ++++++++++++
pnpm-lock.yaml | 10 +++---
13 files changed, 98 insertions(+), 51 deletions(-)
create mode 100644 packages/client/logic/state-graph.ts
create mode 100644 packages/ui-kit/src/components/Loading.vue
diff --git a/packages/client/components/SearchBox.vue b/packages/client/components/SearchBox.vue
index a3941126..8083e74f 100644
--- a/packages/client/components/SearchBox.vue
+++ b/packages/client/components/SearchBox.vue
@@ -5,7 +5,7 @@ const { graphSettings } = useGraphSettings()
-
diff --git a/packages/client/types.ts b/packages/client/types.ts
index d14e0a22..b12f0914 100644
--- a/packages/client/types.ts
+++ b/packages/client/types.ts
@@ -1,5 +1,4 @@
import type { Router } from 'vue-router'
-import type { getAnalyzeResultByPath, prepareStateAnalyze } from '@vite-plugin-vue-devtools/core/compiler'
type WithOptional = Omit & Partial>
@@ -33,10 +32,6 @@ export interface VueDevtoolsHostClient {
rerenderHighlight: {
updateInfo: (uid: string, name: string, _bounds: ComponentInspectorBounds) => void
}
- stateAnalyze?: {
- prepareState: typeof prepareStateAnalyze
- getAnalyzeResultByPath: typeof getAnalyzeResultByPath
- }
}
export type BuiltinTabGroup = 'app' | 'modules' | 'advanced'
From 8ab1965c555f1b2b54b16059d6d9fc522e7bfa5d Mon Sep 17 00:00:00 2001
From: alexzhang1030 <1642114555@qq.com>
Date: Thu, 3 Aug 2023 15:17:39 +0800
Subject: [PATCH 05/11] fix: correctly set config
---
tsconfig.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tsconfig.json b/tsconfig.json
index b7fcce65..60d2a63c 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -16,5 +16,5 @@
"vitest/globals"
]
},
- "exclude": ["node_modules", "dist", "src/node/app.js", "**/*/dist"]
+ "exclude": ["node_modules", "dist", "*/node/src/app.js", "**/*/dist"]
}
From 87805fb2c1460cba0aec198a3df919383faa83b9 Mon Sep 17 00:00:00 2001
From: alexzhang1030 <1642114555@qq.com>
Date: Fri, 4 Aug 2023 13:44:06 +0800
Subject: [PATCH 06/11] feat: show code
---
packages/client/components/GraphDock.vue | 53 ++++++++++++++++
packages/client/components/HighlightCode.vue | 16 +++++
packages/client/components/StateGraph.vue | 20 +-----
packages/client/composables/highlight.ts | 35 +++++++++++
packages/client/logic/state-graph.ts | 63 +++++++++++++------
packages/client/package.json | 3 +-
packages/client/pages/graph.vue | 5 +-
packages/core/src/compiler/common/analyze.ts | 11 ++++
packages/core/src/compiler/index.ts | 9 ++-
packages/core/src/compiler/state-analyze.ts | 6 +-
packages/node/client.d.ts | 4 +-
.../playground/src/components/ReadCounter.vue | 7 +++
pnpm-lock.yaml | 33 ++++++++--
13 files changed, 216 insertions(+), 49 deletions(-)
create mode 100644 packages/client/components/GraphDock.vue
create mode 100644 packages/client/components/HighlightCode.vue
create mode 100644 packages/client/composables/highlight.ts
diff --git a/packages/client/components/GraphDock.vue b/packages/client/components/GraphDock.vue
new file mode 100644
index 00000000..d24bcfe5
--- /dev/null
+++ b/packages/client/components/GraphDock.vue
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/client/components/HighlightCode.vue b/packages/client/components/HighlightCode.vue
new file mode 100644
index 00000000..d433bbfa
--- /dev/null
+++ b/packages/client/components/HighlightCode.vue
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
diff --git a/packages/client/components/StateGraph.vue b/packages/client/components/StateGraph.vue
index 40ca9a22..9e0b98d3 100644
--- a/packages/client/components/StateGraph.vue
+++ b/packages/client/components/StateGraph.vue
@@ -1,25 +1,7 @@
-
{{ stateGraphRawData }}
diff --git a/packages/client/composables/highlight.ts b/packages/client/composables/highlight.ts
new file mode 100644
index 00000000..c2794b20
--- /dev/null
+++ b/packages/client/composables/highlight.ts
@@ -0,0 +1,35 @@
+import type { Highlighter } from 'shiki'
+import { getHighlighter, setCDN } from 'shiki'
+
+const extToLang = {
+ vue: 'vue',
+ js: 'javascript',
+ ts: 'typescript',
+ jsx: 'jsx',
+ tsx: 'tsx',
+}
+
+setCDN('https://unpkg.com/shiki/')
+
+let highlighter: Highlighter
+
+async function initHighlighter() {
+ return await getHighlighter({
+ themes: ['vitesse-dark', 'vitesse-light'],
+ langs: ['vue', 'javascript', 'typescript', 'jsx', 'tsx'],
+ }).then(h => highlighter = h)
+}
+
+export async function useHighlight() {
+ const isDark = useDark()
+ if (!highlighter)
+ await initHighlighter()
+ return {
+ highlightedCode: (code: string, ext: string) => highlighter.codeToHtml(code,
+ {
+ lang: extToLang[ext],
+ theme: isDark.value ? 'vitesse-dark' : 'vitesse-light',
+ },
+ ),
+ }
+}
diff --git a/packages/client/logic/state-graph.ts b/packages/client/logic/state-graph.ts
index c6979bf3..121f1d03 100644
--- a/packages/client/logic/state-graph.ts
+++ b/packages/client/logic/state-graph.ts
@@ -11,10 +11,15 @@ export enum StateGraphStateEnum {
HAS_STATE, // everything is ready
}
-const rawData = ref<{
+const codeData = ref<{
+ code: string
+ filename: string
+}[]>([])
+const rawAnalyzeData = ref<{
code: string
lang: AcceptableLang
path: string
+ offsetContent: string
}[]>([])
const project = shallowRef(new Project('state-analyze'))
export const stateGraphState = ref(StateGraphStateEnum.NOT_READY)
@@ -22,17 +27,28 @@ export const stateGraphState = ref(StateGraphStateEnum.NOT_READY)
export async function initRawData() {
if (stateGraphState.value !== StateGraphStateEnum.NOT_READY)
return
- rawData.value = (await rpc.getStateAnalyzeCollectedData()).map(item => ({
- code: item.code,
- lang: item.lang as AcceptableLang,
- path: item.filename,
- }))
- project.value.addFiles(rawData.value)
+ const rawData = await rpc.getStateAnalyzeCollectedData() ?? []
+ rawData.forEach((item) => {
+ rawAnalyzeData.value.push({
+ code: item.code,
+ lang: item.lang as AcceptableLang,
+ path: item.filename,
+ offsetContent: item.offsetContent,
+ })
+ codeData.value.push({
+ code: item.fullCode,
+ filename: item.filename,
+ })
+ })
+ project.value.addFiles(rawAnalyzeData.value)
await project.value.prepare()
stateGraphState.value = StateGraphStateEnum.READY
}
const currentSelectedFile = ref* file name */string>()
+watch(currentSelectedFile, () => {
+ stateGraphState.value = getState()
+})
export function useStateGraph() {
const [drawerVisible, toggleDrawerVisible] = useToggle(false)
@@ -42,33 +58,44 @@ export function useStateGraph() {
toggleDrawerVisible,
enable: async () => {
toggleDrawerVisible()
- const data = await initRawData()
- console.log({ data })
+ await initRawData()
+ stateGraphState.value = getState()
},
currentSelectedFile,
}
}
-function startAnalyze() {
+function getState() {
// if not ready
if (stateGraphState.value === StateGraphStateEnum.NOT_READY)
- return { state: StateGraphStateEnum.NOT_READY, data: null }
+ return StateGraphStateEnum.NOT_READY
const selectFile = currentSelectedFile.value
// if not selected file
if (!selectFile)
- return { state: StateGraphStateEnum.NOT_SELECT_FILE, data: null }
+ return StateGraphStateEnum.NOT_SELECT_FILE
// if not collected
if (!project.value.getFilePaths().includes(selectFile))
- return { state: StateGraphStateEnum.NOT_COLLECTED, data: null }
+ return StateGraphStateEnum.NOT_COLLECTED
// if no state
const data = project.value.getAnalyzeResults(selectFile)
if (!data || !data.size)
- return { state: StateGraphStateEnum.NO_STATE, data: null }
- return { state: StateGraphStateEnum.HAS_STATE, data }
+ return StateGraphStateEnum.NO_STATE
+ return StateGraphStateEnum.HAS_STATE
+}
+
+function getData() {
+ return stateGraphState.value === StateGraphStateEnum.HAS_STATE
+ ? project.value.getAnalyzeResults(currentSelectedFile.value!)!
+ : null
}
export const stateGraphRawData = computed(() => {
- const { data, state } = startAnalyze()
- stateGraphState.value = state
- return data
+ return getData()
+})
+
+export const currentFullCodeAndFilename = computed(() => {
+ return codeData.value.find(item => item.filename === currentSelectedFile.value) ?? {
+ code: '',
+ filename: '',
+ }
})
diff --git a/packages/client/package.json b/packages/client/package.json
index d5df5c50..fd965543 100644
--- a/packages/client/package.json
+++ b/packages/client/package.json
@@ -34,10 +34,11 @@
"@vueuse/integrations": "^10.3.0",
"@webfansplz/vuedoc-parser": "^0.0.3",
"algoliasearch": "^4.19.1",
- "esm-analyzer": "^0.3.3",
+ "esm-analyzer": "^0.3.5",
"json-editor-vue": "^0.10.6",
"minimatch": "^9.0.3",
"nanoid": "^4.0.2",
+ "shiki": "^0.14.3",
"splitpanes": "^3.1.5",
"vanilla-jsoneditor": "^0.17.8",
"vite-hot-client": "^0.2.1",
diff --git a/packages/client/pages/graph.vue b/packages/client/pages/graph.vue
index 06fb89f7..6c12fb1b 100644
--- a/packages/client/pages/graph.vue
+++ b/packages/client/pages/graph.vue
@@ -200,12 +200,13 @@ const navbar = ref()
+
diff --git a/packages/core/src/compiler/common/analyze.ts b/packages/core/src/compiler/common/analyze.ts
index 0b148f45..bb01dd29 100644
--- a/packages/core/src/compiler/common/analyze.ts
+++ b/packages/core/src/compiler/common/analyze.ts
@@ -8,6 +8,8 @@ function isSetupFn(node: Node): node is ObjectMethod | ObjectProperty {
return isObjectFn(node) && (node.key as Identifier).name === SETUP_FN
}
+const VUE_SFC_SCRIPT_BLOCK_START_RE = /
+
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 1cd281e8..30e6dd43 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -78,8 +78,8 @@ importers:
specifier: ^4.19.1
version: 4.19.1
esm-analyzer:
- specifier: ^0.3.3
- version: 0.3.3
+ specifier: ^0.3.5
+ version: 0.3.5
json-editor-vue:
specifier: ^0.10.6
version: 0.10.6(vanilla-jsoneditor@0.17.8)(vue@3.3.4)
@@ -89,6 +89,9 @@ importers:
nanoid:
specifier: ^4.0.2
version: 4.0.2
+ shiki:
+ specifier: ^0.14.3
+ version: 0.14.3
splitpanes:
specifier: ^3.1.5
version: 3.1.5
@@ -2524,6 +2527,10 @@ packages:
engines: {node: '>=12'}
dev: true
+ /ansi-sequence-parser@1.1.1:
+ resolution: {integrity: sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==}
+ dev: false
+
/ansi-styles@3.2.1:
resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==}
engines: {node: '>=4'}
@@ -3871,8 +3878,8 @@ packages:
- supports-color
dev: true
- /esm-analyzer@0.3.3:
- resolution: {integrity: sha512-IlNE3ykNhMOiOdBsyJE9KP9+jeSQpk+LVf715yNYIdgM2u7UE8fbymMCrUiU7H/azuzyI/adv+fHbbG9AXu6Kw==}
+ /esm-analyzer@0.3.5:
+ resolution: {integrity: sha512-WyXk3t3ppT5mY2/ub/Rrqb6jVIOf7K0+jVYECB+0Bvcqi+foRdK/e0iCRMAztFudG3lr4VETKLNdWucAxaeYBg==}
dependencies:
'@babel/parser': 7.22.7
estree-walker: 2.0.2
@@ -4914,7 +4921,6 @@ packages:
/jsonc-parser@3.2.0:
resolution: {integrity: sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==}
- dev: true
/jsonfile@6.1.0:
resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==}
@@ -6502,6 +6508,15 @@ packages:
/shell-quote@1.8.1:
resolution: {integrity: sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==}
+ /shiki@0.14.3:
+ resolution: {integrity: sha512-U3S/a+b0KS+UkTyMjoNojvTgrBHjgp7L6ovhFVZsXmBGnVdQ4K4U9oK0z63w538S91ATngv1vXigHCSWOwnr+g==}
+ dependencies:
+ ansi-sequence-parser: 1.1.1
+ jsonc-parser: 3.2.0
+ vscode-oniguruma: 1.7.0
+ vscode-textmate: 8.0.0
+ dev: false
+
/side-channel@1.0.4:
resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==}
dependencies:
@@ -7611,6 +7626,14 @@ packages:
engines: {node: '>=0.10.0'}
dev: false
+ /vscode-oniguruma@1.7.0:
+ resolution: {integrity: sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==}
+ dev: false
+
+ /vscode-textmate@8.0.0:
+ resolution: {integrity: sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==}
+ dev: false
+
/vue-demi@0.13.11(vue@3.3.4):
resolution: {integrity: sha512-IR8HoEEGM65YY3ZJYAjMlKygDQn25D5ajNFNoKh9RSDMQtlzCxtfQjdQgv9jjK+m3377SsJXY8ysq8kLCZL25A==}
engines: {node: '>=12'}
From 9660e80b8bfe5fefb153af158f921f5d158d0e61 Mon Sep 17 00:00:00 2001
From: alexzhang1030 <1642114555@qq.com>
Date: Fri, 4 Aug 2023 13:47:13 +0800
Subject: [PATCH 07/11] chore: prettify
---
packages/client/components/HighlightCode.vue | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/packages/client/components/HighlightCode.vue b/packages/client/components/HighlightCode.vue
index d433bbfa..fc861a5a 100644
--- a/packages/client/components/HighlightCode.vue
+++ b/packages/client/components/HighlightCode.vue
@@ -1,5 +1,5 @@
-
+
From 6f2e7af0ca60a63cc46dcc014946d02b2191d5a0 Mon Sep 17 00:00:00 2001
From: alexzhang1030 <1642114555@qq.com>
Date: Fri, 4 Aug 2023 15:08:57 +0800
Subject: [PATCH 08/11] feat: dockbar support drag
---
packages/client/components/DrawerRight.vue | 20 ++++++++++++++++++--
packages/client/components/GraphDock.vue | 3 +--
packages/client/package.json | 1 +
pnpm-lock.yaml | 11 +++++++++++
4 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/packages/client/components/DrawerRight.vue b/packages/client/components/DrawerRight.vue
index 4eed1bdb..f1836f60 100644
--- a/packages/client/components/DrawerRight.vue
+++ b/packages/client/components/DrawerRight.vue
@@ -1,4 +1,7 @@
-
+
diff --git a/packages/client/package.json b/packages/client/package.json
index fd965543..c021932a 100644
--- a/packages/client/package.json
+++ b/packages/client/package.json
@@ -42,6 +42,7 @@
"splitpanes": "^3.1.5",
"vanilla-jsoneditor": "^0.17.8",
"vite-hot-client": "^0.2.1",
+ "vue-resizables": "^0.3.4",
"vue-router": "^4.2.4",
"vuedraggable": "^4.1.0",
"xterm": "^5.2.1",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 30e6dd43..a21d3875 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -101,6 +101,9 @@ importers:
vite-hot-client:
specifier: ^0.2.1
version: 0.2.1(vite@4.4.7)
+ vue-resizables:
+ specifier: ^0.3.4
+ version: 0.3.4(vue@3.3.4)
vue-router:
specifier: ^4.2.4
version: 4.2.4(vue@3.3.4)
@@ -7704,6 +7707,14 @@ packages:
vue: 3.3.4
dev: true
+ /vue-resizables@0.3.4(vue@3.3.4):
+ resolution: {integrity: sha512-eLnVRngj0EMo4MKgAXppzdmtCiTEyQghQ5j4kgu1EjY80LYsqkEZp8mHPII2vdG3aFKnWZeMWuw5JysG8v5hUQ==}
+ peerDependencies:
+ vue: ^3.0.0
+ dependencies:
+ vue: 3.3.4
+ dev: false
+
/vue-resize@2.0.0-alpha.1(vue@3.3.4):
resolution: {integrity: sha512-7+iqOueLU7uc9NrMfrzbG8hwMqchfVfSzpVlCMeJQe4pyibqyoifDNbKTZvwxZKDvGkB+PdFeKvnGZMoEb8esg==}
peerDependencies:
From 67e81c25ebff12e790c9e37cd7ef419f0dd9b026 Mon Sep 17 00:00:00 2001
From: alexzhang1030 <1642114555@qq.com>
Date: Sat, 5 Aug 2023 11:57:47 +0800
Subject: [PATCH 09/11] chore: add linenumber
---
packages/client/components/HighlightCode.vue | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/packages/client/components/HighlightCode.vue b/packages/client/components/HighlightCode.vue
index fc861a5a..5f141efc 100644
--- a/packages/client/components/HighlightCode.vue
+++ b/packages/client/components/HighlightCode.vue
@@ -13,4 +13,20 @@ const { highlightedCode } = await useHighlight()
-
+
From 07ca5e93b18f7bedf538c8ad551e75445f8a0e3c Mon Sep 17 00:00:00 2001
From: alexzhang1030 <1642114555@qq.com>
Date: Sat, 5 Aug 2023 12:09:41 +0800
Subject: [PATCH 10/11] fix: only load shiki once
---
packages/client/composables/highlight.ts | 2 ++
1 file changed, 2 insertions(+)
diff --git a/packages/client/composables/highlight.ts b/packages/client/composables/highlight.ts
index c2794b20..19c00661 100644
--- a/packages/client/composables/highlight.ts
+++ b/packages/client/composables/highlight.ts
@@ -14,6 +14,8 @@ setCDN('https://unpkg.com/shiki/')
let highlighter: Highlighter
async function initHighlighter() {
+ if (highlighter)
+ return highlighter
return await getHighlighter({
themes: ['vitesse-dark', 'vitesse-light'],
langs: ['vue', 'javascript', 'typescript', 'jsx', 'tsx'],
From ef41e84b3f4582ca025c2ff8686b4966c26706d0 Mon Sep 17 00:00:00 2001
From: alexzhang1030 <1642114555@qq.com>
Date: Tue, 8 Aug 2023 18:28:37 +0800
Subject: [PATCH 11/11] feat(wip): support show state graph
---
packages/client/components/StateGraph.vue | 105 +++++++++++++++++++++-
packages/client/logic/state-graph.ts | 2 +-
packages/client/pages/graph.vue | 1 -
3 files changed, 104 insertions(+), 4 deletions(-)
diff --git a/packages/client/components/StateGraph.vue b/packages/client/components/StateGraph.vue
index 9e0b98d3..476d9465 100644
--- a/packages/client/components/StateGraph.vue
+++ b/packages/client/components/StateGraph.vue
@@ -1,7 +1,108 @@
-
- {{ stateGraphRawData }}
+
diff --git a/packages/client/logic/state-graph.ts b/packages/client/logic/state-graph.ts
index 121f1d03..0d120d66 100644
--- a/packages/client/logic/state-graph.ts
+++ b/packages/client/logic/state-graph.ts
@@ -45,7 +45,7 @@ export async function initRawData() {
stateGraphState.value = StateGraphStateEnum.READY
}
-const currentSelectedFile = ref* file name */string>()
+export const currentSelectedFile = ref* file name */string>()
watch(currentSelectedFile, () => {
stateGraphState.value = getState()
})
diff --git a/packages/client/pages/graph.vue b/packages/client/pages/graph.vue
index 6c12fb1b..f6125aa8 100644
--- a/packages/client/pages/graph.vue
+++ b/packages/client/pages/graph.vue
@@ -200,7 +200,6 @@ const navbar = ref()
-