Conversation
monaco-editor 0.53+ rewrote how custom workers are created and lost the `exports` field escape hatch monaco-graphql relied on for deep imports, breaking every monaco-graphql install on modern monaco-editor. Fixes graphql#4382. Two independent breaks bundled together: 1. `editor.createWebWorker({ moduleId, label, createData })` no longer loads a worker by moduleId or delivers createData - the type is now `{ worker: Worker | Promise<Worker> }`, and the caller is expected to construct the worker itself. WorkerManager now builds the worker via `MonacoEnvironment.getWorker()` and configures it through a new `GraphQLWorker#initialize()` RPC call once the worker is ready, instead of via constructor args that are no longer transported. 2. `graphql.worker.ts`'s bootstrap wrapped `initialize()` inside an extra `onmessage` handler. monaco-editor's client now sends a throwaway ping message immediately followed by the real `$initialize` handshake; the extra wrapper consumed the ping and only called `initialize()` on the next message - the real handshake - one message too late for its reply to reach the client, hanging every worker RPC call forever. `monaco-editor/editor/editor.worker`'s own bootstrap calls `initialize` unwrapped for the same reason; mirrored that here. Also updates the now-relocated `monaco-editor/esm/vs/...` deep imports (exports field dropped the old paths), the deprecated `languages.json.jsonDefaults` reference, and bumps the monaco-editor peer range to `>= 0.56.0`. This is a breaking change for consumers on monaco-editor < 0.53 - no attempt is made to support both API shapes at once.
|
|
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.
Fixes #4382.
monaco-editor 0.53+ rewrote how custom workers are created and dropped
the
exportsfield escape hatch monaco-graphql relied on for its deepimports, breaking every monaco-graphql install on modern monaco-editor.
Two independent breaks bundled together
editor.createWebWorker()no longer loads a worker bymoduleIdor delivers
createData. The type is now{ worker: Worker | Promise<Worker> }- the caller is expected toconstruct the worker itself.
WorkerManagernow builds the worker viaMonacoEnvironment.getWorker()and configures it through a newGraphQLWorker#initialize()RPC call once the worker is ready,instead of via constructor args that are no longer transported.
graphql.worker.ts's bootstrap wrappedinitialize()inside anextra
onmessagehandler. monaco-editor's client now sends athrowaway ping message immediately followed by the real
$initializehandshake; the extra wrapper consumed the ping andonly called
initialize()on the next message - the real handshake -one message too late for its reply to reach the client, hanging
every worker RPC call forever.
monaco-editor/editor/editor.worker's own bootstrap callsinitializeunwrapped for the same reason; mirrored that here.Also updates the now-relocated
monaco-editor/esm/vs/...deep imports(the
exportsfield dropped the old paths), the deprecatedlanguages.json.jsonDefaultsreference, and bumps themonaco-editorpeer range to
>= 0.56.0.This is a breaking change for consumers on monaco-editor < 0.53 -
no attempt is made to support both API shapes at once, matching the
scope implied by #4382.
Test plan
tsgo --buildpasses cleanMonacoEnvironment.getWorkerworker setup, novite-plugin-monaco-editor) on monaco-editor 0.56.0: GraphQLautocomplete, hover, and validation all round-trip through the
worker correctly - confirmed via instrumented worker calls that
the full
WorkerManager -> createWebWorker -> initialize() -> doValidation()chain resolves and returns real diagnostics(previously threw
Missing requestHandler or method: doValidation/
doComplete/doHoveron every call)vitest run) - not run in this pass,happy to run if maintainers want it before review