feat(editor-preview-asyncapi): offload AsyncAPI parsing to web worker#5786
Open
robert-hebel-sb wants to merge 11 commits into
Open
feat(editor-preview-asyncapi): offload AsyncAPI parsing to web worker#5786robert-hebel-sb wants to merge 11 commits into
robert-hebel-sb wants to merge 11 commits into
Conversation
4e3a746 to
6a117b7
Compare
4749fb0 to
f895ea1
Compare
Add asyncapiParserWorkerConfig to ESM and UMD build scripts, register the virtual constructor module, and add fs-shim + nodePolyfills to resolve @asyncapi/parser's Node.js fs imports in the browser bundle. Update actions.js to consume the worker proxy and reconstruct the AsyncAPI document via toAsyncAPIDocument. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rrors selectIsParseInProgress checked parseErrors === null via the normalizing selectParseErrors selector, which always returns [] — never null. The condition was always false, so waitUntil in monaco.contribution.js resolved immediately with stale state and set stale markers that persisted until the next edit. Fix: derive selectIsParseInProgress from parseStatus alone. Also fix showFailure in EditorPreviewAsyncAPI to check parseErrors.length > 0 instead of parseErrors !== null, which was likewise always true and caused the error pane to show on initial load. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Allow consumers to pass parserOptions (e.g. __unstable.resolver) to the AsyncAPI parser worker. Resolver read/canRead functions are wrapped with Comlink.proxy() in parser-worker-proxy so they execute on the main thread, retaining access to store, document, and config. A Comlink transferHandler for urijs Uri objects handles the Uri→string conversion automatically when the parser passes URI arguments across the worker boundary. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add asyncapi-parser.worker to the workers overview table, add a dedicated section covering Comlink proxy loading, custom parserOptions (including Comlink.proxy() resolver pattern), the Uri transfer handler, and ESM/UMD build outputs. Update README webpack entry points, CopyWebpackPlugin patterns, and exports block. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…orker-proxy Use spread on resolver to avoid listing properties explicitly, and extract wrappedResolvers before the return to reduce nesting depth. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move the inline fs-shim plugin definition into vite/plugins/fs-shim.js and replace the three inline copies in vite.config.app.js and the ESM/ UMD worker configs with an import of the shared fsShim() factory. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
cka121
approved these changes
May 21, 2026
glowcloud
approved these changes
May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
worker/asyncapi-parser.worker.ts) with a lazy singleton proxy (worker/parser-worker-proxy.ts) — spawned only on the first parse calldocument.json()) to satisfy structured-clone constraints;AsyncAPIDocumentis reconstructed cheaply on the main thread viatoAsyncAPIDocument()EditorPreviewAsyncAPIrewritten in TypeScript and updated to retain the previous render during re-parses, eliminating the blank-flash on each keystroke (fixes regression caused byselectIsParseInProgressreturningfalsewhenparseResultis non-null)asyncapiParserWorkerConfigbuild step;RewriteEditorWorkerImportupdated to intercept the?workerimport for library consumersTest plan
npm run lintpassesnpx playwright testpasses (60 tests)npm run build:bundle:esmandnpm run build:bundle:umdproduceasyncapi-parser.worker.jsin dist🤖 Generated with Claude Code