asyncapi / asyncapi/parser-js

Request: Browser-compatible bundle for Java/GraalVM integration

Open
#1,131 2 comments 0 reactions 0 assignees View on GitHub
stale
Dominant language
TypeScript
Stars
144
Forks
144
Avg merge
6m
Merged PRs (30d)
11

Description

### Title
Request: Browser-compatible bundle for Java/GraalVM integration

### Description
I'm working on a Java wrapper for the AsyncAPI parser using GraalVM's JavaScript engine. The current @asyncapi/parser package (v3.6.0) cannot be bundled for use in GraalVM because it depends on Node.js-specific APIs (fetch, Headers, etc.) that aren't available in GraalVM's JavaScript environment.

### Current Situation
- The old bundle-es5.js only supports AsyncAPI 2.4.0
- The new @asyncapi/parser v3.x requires fetch API and browser globals
- When bundled with webpack, it fails with: `TypeError: Cannot set property 'Headers' of undefined`

### Request
Could you provide or help create a browser-compatible bundle that:
1. Supports both AsyncAPI v2.x and v3.x
2. Works in environments without fetch API (or includes polyfills)
3. Can run in GraalVM's JavaScript engine
4. Doesn't depend on Node.js-specific modules

### Use Case
Java applications that need to parse AsyncAPI documents without spawning Node.js processes or using native V8 bindings (which don't support macOS ARM).

### Alternative Solutions Considered
- Using Playwright/Puppeteer (too heavy)
- Using J2V8 (no macOS ARM support)
- Creating custom bundle with webpack (fails due to fetch dependency)

### Environment
- GraalVM JS engine via javax.script
- Target: Java 11+
- Platform: macOS ARM, Linux, Windows

Would appreciate guidance on:
1. How to properly bundle the parser for non-browser/non-Node environments
2. If there's an existing standalone bundle
3. If this use case is supported

Contributor guide

Open the contributing guide

Research direction

Start by inspecting the current @asyncapi/parser v3.6.0 package and the existing bundle-es5.js, then reproduce the webpack failure involving fetch and Headers. Determine how the parser’s Node.js-specific dependencies enter the bundle and whether both AsyncAPI v2.x and v3.x can share a supported output. Done means a documented bundle runs in GraalVM’s JavaScript engine without Node.js APIs and covers both requested versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, javascript, typescript
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.