Skip to content

Commit b464037

Browse files
authored
feat: enable web compatibility for extension (#286)
Co-authored-by: Ruchi Pakhle <ruchipakhle@gmail.com>
1 parent 18dda39 commit b464037

File tree

11 files changed

+1314
-2716
lines changed

11 files changed

+1314
-2716
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ node_modules
44
.vscode-test/
55
*.vsix
66
.DS_Store
7+
*.vscode-test-web/
8+
.vscode/

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
# For more details, read the following article on GitHub: https://help.github.com/articles/about-codeowners/.
66

77
# These are the default owners for the whole content of this repository. The default owners are automatically added as reviewers when you open a pull request unless different owners are specified in the file.
8-
* @ivangsa @derberg @asyncapi-bot-eve
8+
* @ivangsa @derberg @asyncapi-bot-eve @Ruchip16

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,65 @@ You can open AsyncAPI Preview from the editor title/context menu. (If you don't
1010

1111
![AsyncAPI Preview](docs/asyncapi-editor-title-context.png)
1212

13+
## Web Extension Compatibility
14+
15+
The extension now runs in the web version of VS Code i.e. directly in your browser on `vscode.dev`, `github.dev`, `gitlab.com/-/ide`, `gitpod.io`, and other cloud development environments, as well as a local browser host for development.
16+
17+
### Key Benefits
18+
19+
- No install required: open a repo in your browser and preview AsyncAPI files without a desktop VS Code.
20+
- Works on vscode.dev, github.dev, GitLab Web IDE, Gitpod & more: perfect for quick reviews during PRs or exploring examples.
21+
- Consistent experience: same preview workflow on desktop and web.
22+
23+
### Usage
24+
25+
A) On vscode.dev / github.dev
26+
27+
1. Open your repo:
28+
- https://vscode.dev/github/<org>/<repo> (or use the . keyboard shortcut on GitHub to open github.dev).
29+
2. Install AsyncAPI Preview in that browser session (Command Palette → "Extensions: Install from VSIX…" if you're side-loading, or from Marketplace once the web-ready version is published).
30+
3. Open an *.yaml / *.yml (or JSON) AsyncAPI file.
31+
4. Run AsyncAPI: Preview Document from the Command Palette (⇧⌘P / Ctrl+Shift+P).
32+
33+
B) Locally in a browser (dev/test)
34+
1. Install dependencies & build:
35+
```
36+
npm install
37+
npm run build
38+
```
39+
40+
2. (If not already present) add a dev script to package.json to launch a web host:
41+
42+
```
43+
{
44+
"scripts": {
45+
"open-in-browser": "vscode-test-web --extensionDevelopmentPath=. --port=8082 ."
46+
},
47+
"devDependencies": {
48+
"@vscode/test-web": "^1.x.x"
49+
}
50+
}
51+
```
52+
53+
Then:
54+
```
55+
npm run open-in-browser
56+
```
57+
This opens a web VS Code at http://localhost:8082. Open a workspace/folder that contains your AsyncAPI YAMLs, then run AsyncAPI: Preview Document.
58+
59+
Tip: If you don’t see the preview, ensure your file’s language mode is YAML (bottom-right of the status bar), and check Developer: Show Running Extensions to confirm activation.
60+
61+
### Technical Changes
62+
- Removed Node-only modules (e.g., direct path/fs usage).
63+
- Introduced a lightweight pathUtils.ts for browser-safe path handling.
64+
- Updated VS Code engine/types to enable web extension support.
65+
- Removed unmaintained or web-incompatible pieces (e.g., legacy visualizer & Node-specific deps) to simplify the runtime and reduce bundle size.
66+
67+
### Current limitations
68+
- The web host cannot use Node APIs; all file access must go through vscode.workspace.fs.
69+
- Auto-reload works on the active document save; changes to externally referenced files may not hot-reload yet.
70+
- vscode.dev can’t read your local disk—open files from a GitHub repo or use File → Open File… (upload) for one-off files.
71+
1372
## Automatic hot-reloading
1473

1574
Automatic hot-reloading on editor save, but currently, it doesn't reload when saving referenced external files.
@@ -44,3 +103,4 @@ AsyncAPI Viewer utilizes the following open source projects:
44103
### Contributors
45104

46105
Ivan Garcia Sainz-Aja [ivangsa](https://github.com/ivangsa)
106+
Ruchi Pakhle [Ruchip16](https://github.com/Ruchip16)

0 commit comments

Comments
 (0)