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

ts-trace-viewer integration (WIP) #5

Closed
wants to merge 9 commits into from
Closed
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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ jobs:
- name: Install
run: pnpm i

- name: UiBuild
run: pnpm ui:build

- name: Build
run: pnpm build

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
.nitro
.cache
dist
out
spa/dist
*.vsix

# Node dependencies
node_modules
Expand Down
13 changes: 12 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
{
"npm.packageManager": "pnpm",
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"cSpell.words": [
"antfu",
"Trpc",
"tsperf"
],
"eslint.experimental.useFlatConfig": true,
"eslint.format.enable": true,
"eslint.lintTask.enable": false,
"[typescript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
}
}
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules
test
.github
.vscode
spa
3 changes: 3 additions & 0 deletions debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pnpm ui:build --sourcemap &&
pnpm build --sourcemap &&
code ./playground --extensionDevelopmentPath=. --inspect-extensions 3300
2 changes: 2 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ export default antfu({
stylistic: true,
ignores: [
'playground/**',
'spa/.quasar/**',
'out/**',
],
})
36 changes: 36 additions & 0 deletions messages/src/messages.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import z from 'zod'

export const ping = z.object({
message: z.literal('ping'),
})
export type Ping = z.infer<typeof ping>

export const pong = z.object({
message: z.literal('pong'),
})
export type Pong = z.infer<typeof pong>

export const gotoPosition = z.object({
message: z.literal('gotoPosition'),
fileName: z.string(),
pos: z.number(),
})
export type GotoPosition = z.infer<typeof gotoPosition>

export const gotoLocation = z.object({
message: z.literal('gotoLocation'),
fileName: z.string(),
line: z.number(),
character: z.number(),
})
export type GotoLocation = z.infer<typeof gotoPosition>

export const traceFile = z.object({
message: z.literal('traceFile'),
fileName: z.string(),
traceString: z.string(),
})
export type TraceFile = z.infer<typeof traceFile>

export type Message = z.infer<typeof message>
export const message = z.union([ping, pong, gotoLocation, gotoPosition, traceFile])
54 changes: 53 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,58 @@
"onLanguage:typescript",
"workspaceContains:tsconfig.json"
],
"contributes": {
"configuration": {
"title": "tsperf.tracer",
"properties": {
"tsperf.tracer.checkTimeWarning": {
"type": "number",
"default": 1,
"description": "Warn when type check times exceed this number of seconds"
},
"tsperf.tracer.port": {
"type": "number",
"default": 3000,
"description": "port to run local web server on"
}
}
},
"commandPalette": [
{
"command": "tsperf.tracer.sendTrace",
"when": "!notebookEditorFocused && editorLangId == 'json'"
}
],
"commands": [
{
"command": "tsperf.tracer.openInBrowser",
"title": "Open trace view in browser",
"icon": {
"dark": "resources/todo.svg",
"light": "resources/todo.svg"
}
},
{
"command": "tsperf.tracer.runTrace",
"title": "tsc trace",
"icon": {
"dark": "resources/todo.svg",
"light": "resources/todo.svg"
}
},
{
"command": "tsperf.tracer.sendTrace",
"title": "Send Trace to Trace Viewer",
"when": "!notebookEditorFocused && editorLangId == 'json'"
}
]
},
"scripts": {
"pretest": "npm run ui:build && npm run build && npm run lint",
"build": "rollup -c",
"dev": "nr build --watch",
"dev": "nr build --watch --sourcemap",
"ui:dev": "nuxt dev ui",
"ui:build": "nuxt build ui",
"lint": "eslint .",
"vscode:prepublish": "nr build",
"publish": "vsce publish --no-dependencies",
Expand All @@ -41,6 +90,9 @@
"typecheck": "tsc --noEmit && pnpm --filter ui typecheck",
"release": "bumpp && nr publish"
},
"dependencies": {
"zod": "^3.23.8"
},
"devDependencies": {
"@antfu/eslint-config": "^2.17.0",
"@antfu/ni": "^0.21.12",
Expand Down
15 changes: 15 additions & 0 deletions playground/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"use strict";
const example = {};
const exampleUsage1 = example();
const exampleUsage2 = exampleUsage1();
const exampleUsage3 = exampleUsage2();
const exampleUsage4 = exampleUsage3();
const exampleUsage5 = exampleUsage4();
const exampleUsage6 = exampleUsage5();
const exampleUsage7 = exampleUsage6();
const exampleUsage8 = exampleUsage7();
const exampleUsage9 = exampleUsage8();
const exampleUsage10 = exampleUsage9();
const exampleUsage11 = exampleUsage10();
//
//
1,467 changes: 1,467 additions & 0 deletions playground/traces/trace.json

Large diffs are not rendered by default.

483 changes: 483 additions & 0 deletions playground/traces/types.json

Large diffs are not rendered by default.

Loading
Loading