Skip to content

Commit 0e459fc

Browse files
authored
feat(playground): connect browser engine and language server (VirusTotal#606)
This PR connects the playground end to end. It wires the playground to the official @virustotal/yara-x package for the engine, moves the browser worker glue for the language server into the playground itself, and connects the editor to the wasm language server worker.
1 parent c8d21d3 commit 0e459fc

23 files changed

+1785
-1513
lines changed

.github/workflows/site.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- '**'
99
paths:
1010
- 'site/**'
11+
- 'playground/**'
1112
- '.github/workflows/site.yaml'
1213

1314
# Allows you to run this workflow manually from the Actions tab
@@ -40,7 +41,7 @@ jobs:
4041
- name: Setup Node.js
4142
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
4243
with:
43-
node-version: '18'
44+
node-version: '22'
4445
cache: 'npm'
4546
cache-dependency-path: 'site'
4647
- name: Setup Pages
@@ -50,6 +51,10 @@ jobs:
5051
run: |
5152
cd site
5253
[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true
54+
- name: Install playground dependencies
55+
run: |
56+
cd playground
57+
npm install
5358
- name: Build production website
5459
env:
5560
# For maximum backward compatibility with Hugo modules
@@ -62,6 +67,15 @@ jobs:
6267
--gc \
6368
--minify \
6469
--environment production
70+
- name: Build playground
71+
run: |
72+
cd playground
73+
npm run build
74+
- name: Merge playground into Pages artifact
75+
run: |
76+
rm -rf site/public/playground
77+
mkdir -p site/public/playground
78+
cp -R playground/dist/. site/public/playground/
6579
- name: Upload artifact
6680
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
6781
with:

playground/.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pnpm-lock.yaml
2+
dist
3+
node_modules

playground/README.MD

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
11
# YARA-X Playground
22

3-
This folder contains the browser playground for YARA-X. The goal of the
4-
playground is to provide a lightweight web interface for writing, formatting,
5-
and eventually testing YARA rules directly in the browser.
3+
This folder contains the browser playground for YARA-X.
64

7-
The current version is `0.0.0`. At this stage, the focus is on establishing the
8-
front-end foundation of the playground:
9-
10-
- TypeScript for the application code
11-
- Lit for the UI
12-
- Vite for development and builds
13-
- Monaco-based editor integration for the rule and sample panes
14-
15-
This version is intentionally limited. It is expected to compile and provide
16-
the basic UI structure, but it is not expected to be fully functional end to
17-
end yet.
5+
The playground provides a web interface for writing, formatting, and testing
6+
YARA rules directly in the browser. It uses the official `@virustotal/yara-x`
7+
package for the scanning engine and runs the YARA-X language server inside a
8+
dedicated web worker for editor features.
189

1910
## Requirements
2011

@@ -42,23 +33,3 @@ pnpm build
4233
pnpm preview
4334
pnpm format
4435
```
45-
46-
## Project status
47-
48-
At the moment, this folder contains:
49-
50-
- the application shell and layout
51-
- the editor setup
52-
- the styling and interaction base
53-
- the first browser-facing service contracts for the engine and the language
54-
server
55-
56-
What is still missing:
57-
58-
- a working browser engine integration
59-
- a working browser language server integration
60-
- the final packaging strategy for browser artifacts
61-
- deployment workflows
62-
63-
The intention is to connect those pieces once the browser packages are ready
64-
and their public interfaces are stable.

playground/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
},
1616
"dependencies": {
1717
"@codingame/monaco-vscode-editor-api": "^25.1.2",
18+
"@virustotal/yara-x": "^0.1.1",
1819
"lit": "^3.3.2",
1920
"monaco-languageclient": "^10.7.0",
2021
"vscode-languageclient": "^9.0.1",

0 commit comments

Comments
 (0)