Skip to content

sync: dev to extern-contrib - #998

Open
github-actions[bot] wants to merge 7 commits into
extern-contribfrom
dev
Open

sync: dev to extern-contrib#998
github-actions[bot] wants to merge 7 commits into
extern-contribfrom
dev

Conversation

@github-actions

@github-actions github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

sync-branches: New code has just landed in dev, so let's bring extern-contrib up to speed!

Summary by Sourcery

Address Monaco editor loading issues and release version 3.5.4.

Bug Fixes:

  • Prevent overlapping Monaco loader initialization to avoid registry resets and random editor load failures.
  • Work around Monaco 0.53.0 global helper variable leakage by pinning the CDN to 0.52.2.

Enhancements:

  • Bump script and package version to 3.5.4 to reflect the latest changes.

boomzero and others added 4 commits July 27, 2026 09:04
Monaco 0.53.0 declares its minified helper variables with `var` at the top
level of every chunk file. AMD chunks are plain scripts rather than modules,
so those helpers land on `window`: a live load leaks h, m, r, o, p, s, i, f,
u, w, M, y and C. Different chunks give the same name different meanings --
`m` is the field-setter helper in language/css/monaco.contribution.js but is
Object.defineProperty in yaml.contribution.6f43d486.js -- so whichever chunk
script evaluates last wins.

When yaml wins, the css chunk's `r(this, "_options")` call resolves to
Object.defineProperty(this, "_options", undefined) and throws
"Property description must be an object: undefined". The editor.main callback
then never fires, ensureMonaco() times out after 30s, and submitpage.php falls
back to the bare textarea. Evaluation order depends on network timing, which
is why it only reproduces on some page loads.

This is upstream microsoft/monaco-editor#5015, fixed in 0.54.0. cdnjs has no
stable release newer than 0.53.0, and the rest of the script sources from
cdnjs, so pin back to 0.52.2 -- it ships as a single bundle and leaks no
globals at all.

Also make ensureMonaco() single-flight. Overlapping callers (submit editor,
merge view, freopen snippets) each appended their own loader.js, and the
second loader resets the AMD registry while the first is still resolving
modules. A failed load clears the cached promise so later calls can retry.

Closes #991

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
fix: pin Monaco to 0.52.2 to stop intermittent editor load failures
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 27, 2026

Copy link
Copy Markdown

Deploying xmoj-script-dev-channel with  Cloudflare Pages  Cloudflare Pages

Latest commit: a8e9df1
Status: ✅  Deploy successful!
Preview URL: https://e95b0306.xmoj-script-dev-channel.pages.dev

View logs

@sourcery-ai

sourcery-ai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

🧙 Sourcery has finished reviewing your pull request!


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • Consider making ensureMonaco() consistently return a Promise (e.g., return Promise.resolve() in the typeof monaco !== 'undefined' fast path) so that callers can safely await it without needing to special-case the already-loaded scenario.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider making `ensureMonaco()` consistently return a `Promise` (e.g., `return Promise.resolve()` in the `typeof monaco !== 'undefined'` fast path) so that callers can safely `await` it without needing to special-case the already-loaded scenario.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@hendragon-bot hendragon-bot Bot added the user-script This issue or pull request is related to the main user script label Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M user-script This issue or pull request is related to the main user script

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant