Skip to content

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

Description

@rgopi2win

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions