Skip to content

Commit e8231d5

Browse files
committed
readme update, fix typescript error
1 parent fc1b3cc commit e8231d5

File tree

2 files changed

+35
-6
lines changed

2 files changed

+35
-6
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ The codebase is automatically tested using Vitest and Playwright.
3535

3636
# Credits ❤️
3737

38+
We build on top of some really great technologies:
39+
40+
- [Monaco](https://github.com/microsoft/monaco-editor): the open source editor that also powers VS Code
41+
- [Yjs](https://github.com/yjs/yjs): CRDT for multi-user collaboration
42+
- [MobX](https://mobx.js.org/): for our Reactive Runtime
43+
- [Matrix](https://www.matrix.org): the backend of TypeCell.org is a single Matrix instance, using [Matrix-CRDT](https://github.com/yousefed/matrix-crdt) to store and collaborate on "documents as chat rooms"
44+
- [ESM.sh](https://www.esm.sh/): for dynamic ESM imports from NPM
45+
- [Typescript](https://www.typescriptlang.org/): for our compiler and language toolkit
46+
3847
TypeCell is proudly sponsored by the renowned [NLNet foundation](https://nlnet.nl/foundation/) who are on a mission to support an open internet, and protect the privacy and security of internet users. Check them out!
3948

4049
<a href="https://nlnet.nl"><img src="https://nlnet.nl/image/logos/NGIAssure_tag.svg" alt="NLNet" width="100"></a>

packages/editor/src/runtime/compiler/compilers/MonacoCompiler.ts

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,28 @@ function getCachedItem(model: TypeCellCodeModel) {
105105
return undefined;
106106
}
107107

108+
async function getWorker(monacoInstance: typeof monaco) {
109+
if (mainWorker) {
110+
return mainWorker;
111+
}
112+
113+
for (let tryN = 0; tryN < 5; tryN++) {
114+
try {
115+
mainWorker =
116+
await monacoInstance.languages.typescript.getTypeScriptWorker();
117+
} catch (e) {
118+
// https://github.com/BabylonJS/Babylon.js/pull/11554
119+
if (e === "TypeScript not registered!") {
120+
console.warn(e, "retry " + tryN);
121+
await new Promise<void>((resolve) => setTimeout(resolve, 200));
122+
} else {
123+
throw e;
124+
}
125+
}
126+
}
127+
128+
return mainWorker;
129+
}
108130
async function _compile(
109131
model: TypeCellCodeModel,
110132
monacoInstance: typeof monaco
@@ -124,18 +146,16 @@ async function _compile(
124146

125147
const monacoModel = model.acquireMonacoModel();
126148
try {
127-
if (!mainWorker) {
128-
mainWorker =
129-
await monacoInstance.languages.typescript.getTypeScriptWorker();
130-
}
131-
132-
let compiledCode = (await getCompiledCode(mainWorker, monacoModel.uri))
149+
const worker = await getWorker(monacoInstance);
150+
let compiledCode = (await getCompiledCode(worker, monacoModel.uri))
133151
.firstJSCode;
134152
if (ENABLE_CACHE) {
135153
saveCachedItem(model, { hash: hsh, compiledCode });
136154
}
137155
// console.log(tscode, compiledCode);
138156
return compiledCode;
157+
} catch (e) {
158+
debugger;
139159
} finally {
140160
model.releaseMonacoModel();
141161
}

0 commit comments

Comments
 (0)