Skip to content

Commit 7797a7b

Browse files
author
Loïc Mangeonjean
committed
lib!: update monaco-editor
1 parent e5365be commit 7797a7b

7 files changed

Lines changed: 56 additions & 103 deletions

monaco-patches/0001-fix-preserve-modules.patch

Lines changed: 0 additions & 65 deletions
This file was deleted.

monaco-patches/0002-fix-properly-render-relative-paths.patch renamed to monaco-patches/0001-fix-properly-render-relative-paths.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Subject: [PATCH] fix: properly render relative paths
88
1 file changed, 7 insertions(+)
99

1010
diff --git a/build/esm/rollup-url-to-module-plugin/index.mjs b/build/esm/rollup-url-to-module-plugin/index.mjs
11-
index 8a0168bd..cb21f92a 100644
11+
index 52641abf..7e2ec860 100644
1212
--- a/build/esm/rollup-url-to-module-plugin/index.mjs
1313
+++ b/build/esm/rollup-url-to-module-plugin/index.mjs
1414
@@ -9,6 +9,13 @@

monaco-patches/0004-feat-support-configuring-worker-options.patch renamed to monaco-patches/0002-feat-support-configuring-worker-options.patch

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= <loic@coderpad.io>
3-
Date: Thu, 7 May 2026 15:35:50 +0200
3+
Date: Mon, 20 Jul 2026 17:31:01 +0200
44
Subject: [PATCH] feat: support configuring worker options
55

66
and also use cross-origin compatible worker
77
---
8-
src/common/workers.ts | 18 ++++++++++++++++--
9-
1 file changed, 16 insertions(+), 2 deletions(-)
8+
src/internal/common/workers.ts | 15 +++++++++++++--
9+
1 file changed, 13 insertions(+), 2 deletions(-)
1010

11-
diff --git a/src/common/workers.ts b/src/common/workers.ts
12-
index 94bbc257..8394dd36 100644
13-
--- a/src/common/workers.ts
14-
+++ b/src/common/workers.ts
15-
@@ -52,12 +52,25 @@ if (
11+
diff --git a/src/internal/common/workers.ts b/src/internal/common/workers.ts
12+
index 94bbc257..19df6b15 100644
13+
--- a/src/internal/common/workers.ts
14+
+++ b/src/internal/common/workers.ts
15+
@@ -52,12 +52,22 @@ if (
1616
});
1717
}
1818

@@ -31,14 +31,11 @@ index 94bbc257..8394dd36 100644
3131
interface IMonacoEnvironment {
3232
getWorker?(moduleId: string, label: string): Worker | Promise<Worker>;
3333
getWorkerUrl?(moduleId: string, label: string): string;
34-
+ /**
35-
+ * Return the options for web worker scripts.
36-
+ */
3734
+ getWorkerOptions?(moduleId: string, label: string): WorkerOptions | undefined;
3835
}
3936
const monacoEnvironment: IMonacoEnvironment | undefined = (globalThis as any).MonacoEnvironment;
4037
if (monacoEnvironment) {
41-
@@ -66,9 +79,10 @@ function getWorker(descriptor: { label: string; moduleId: string; createWorker?:
38+
@@ -66,9 +76,10 @@ function getWorker(descriptor: { label: string; moduleId: string; createWorker?:
4239
}
4340
if (typeof monacoEnvironment.getWorkerUrl === 'function') {
4441
const workerUrl = monacoEnvironment.getWorkerUrl('workerMain.js', label);

monaco-patches/0003-fix-add-basic-language-contribution-as-entry.patch

Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= <loic@coderpad.io>
3+
Date: Tue, 21 Jul 2026 16:41:38 +0200
4+
Subject: [PATCH] fix: properly wait for worker to be ready
5+
6+
---
7+
src/internal/common/workers.ts | 15 ++++++++++++++-
8+
1 file changed, 14 insertions(+), 1 deletion(-)
9+
10+
diff --git a/src/internal/common/workers.ts b/src/internal/common/workers.ts
11+
index 19df6b15..0f2b73ff 100644
12+
--- a/src/internal/common/workers.ts
13+
+++ b/src/internal/common/workers.ts
14+
@@ -52,6 +52,18 @@ if (
15+
});
16+
}
17+
18+
+function whenESMWorkerReady(worker: Worker): Promise<Worker> {
19+
+ return new Promise<Worker>((resolve, reject) => {
20+
+ worker.onmessage = function (e) {
21+
+ if (e.data.type === 'vscode-worker-ready') {
22+
+ worker.onmessage = null;
23+
+ resolve(worker);
24+
+ }
25+
+ };
26+
+ worker.onerror = reject;
27+
+ });
28+
+}
29+
+
30+
function getWorkerBootstrapUrl(workerScriptUrl: string, workerOptions: WorkerOptions): string {
31+
const blob = new Blob([[
32+
`${workerOptions.type === 'module' ? 'await import' : 'importScripts'}(${JSON.stringify(workerScriptUrl)});`,
33+
@@ -109,7 +121,8 @@ export function createWebWorker<T extends object>(
34+
moduleId: opts.moduleId,
35+
createWorker: opts.createWorker,
36+
})
37+
- ).then((w) => {
38+
+ ).then(async (w) => {
39+
+ await whenESMWorkerReady(w)
40+
w.postMessage('ignore');
41+
w.postMessage(opts.createData);
42+
return w;

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
"commit": "5264f2156cbcd7aea5fd004d29eaa10209155d66"
3737
},
3838
"monaco": {
39-
"ref": "v0.55.1",
40-
"version": "0.55.1"
39+
"ref": "v0.56.0",
40+
"version": "0.56.0"
4141
}
4242
},
4343
"devDependencies": {

scripts/install-monaco-editor

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ mkdir -p $output_directory/editor
3636
cp out/monaco-editor/esm/vs/editor/editor.api.d.ts $output_directory/editor/editor.api.d.ts
3737
cp -R out/monaco-editor/esm/vs/basic-languages $output_directory/basic-languages
3838
cp -R out/monaco-editor/esm/vs/language $output_directory/language
39-
cp -R out/monaco-editor/esm/vs/common $output_directory/common
39+
cp -R out/monaco-editor/esm/vs/languages $output_directory/languages
40+
cp -R out/monaco-editor/esm/vs/internal $output_directory/internal
4041
cp -R out/monaco-editor/package.json $output_directory/package.json
4142

4243
echo $monacoRef > $version_info

0 commit comments

Comments
 (0)