Skip to content

Commit 4bfaa1c

Browse files
authored
upgrade monaco (#325)
* upgrade to react18 * fix * remove .pause() * fix login test * log generate test * upgrade react inspector * upgrade package lock * fix react-inspector * fix * Upgrade monaco (#324) * wip: update monaco * upgrade typescript and monaco * upgrade to react18 (#323) * upgrade to react18 * fix * remove .pause() * fix login test * log generate test * upgrade react inspector * upgrade package lock * fix react-inspector * fix * fix tests * improve regexps
1 parent 7b80ce0 commit 4bfaa1c

File tree

15 files changed

+139
-116
lines changed

15 files changed

+139
-116
lines changed

package-lock.json

Lines changed: 49 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
"scripts": {
1515
"--postinstall": "npm run bootstrap",
1616
"patch-package": "patch-package",
17-
"bootstrap": "lerna bootstrap --ci -- --force && npm run patch-package",
18-
"install-new-packages": "lerna bootstrap -- --force && npm run patch-package",
17+
"postinstall": "patch-package",
18+
"bootstrap": "lerna bootstrap --ci -- --force",
19+
"install-new-packages": "lerna bootstrap -- --force",
1920
"playwright:dev": "lerna run playwright:dev --stream",
2021
"playwright:preview": "lerna run playwright:preview --stream",
2122
"install-playwright": "npx playwright install --with-deps",

packages/common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"devDependencies": {
1111
"rimraf": "^3.0.2",
12-
"typescript": "4.3.2",
12+
"typescript": "4.5.5",
1313
"@types/uuid": "^8.3.4",
1414
"rollup-plugin-node-polyfills": "^0.2.1"
1515
},

packages/editor/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"matrix-js-sdk": "^19.4.0",
5757
"mobx": "^6.2.0",
5858
"mobx-react-lite": "^3.2.0",
59-
"monaco-editor": "^0.27.0",
59+
"monaco-editor": "^0.34.1",
6060
"penpal": "^6.1.0",
6161
"prettier": "2.4.1",
6262
"probe.gl": "^3.1.4",
@@ -78,7 +78,7 @@
7878
"string.prototype.replaceall": "^1.0.5",
7979
"styled-components": "3.2.6",
8080
"tippy.js": "^6.3.1",
81-
"typescript": "4.3.2",
81+
"typescript": "4.5.5",
8282
"ua-parser-js": "^0.7.28",
8383
"uuid": "^8.3.2",
8484
"vscode-lib": "^0.1.2",

packages/editor/src/app/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { observer } from "mobx-react-lite";
2-
import React from "react";
32
import { BrowserRouter, Route, Routes } from "react-router-dom";
43
import { getStoreService } from "../store/local/stores";
54
import { StartScreen } from "./main/components/startscreen/StartScreen";
@@ -12,6 +11,7 @@ import { ProfileRoute } from "./routes/profile";
1211
import { Register } from "./routes/register";
1312

1413
export const App = observer((props: { config: ValidatedServerConfig }) => {
14+
console.log("app render");
1515
const { sessionStore } = getStoreService();
1616
if (sessionStore.user === "loading") {
1717
return <div>Loading</div>;

packages/editor/src/runtime/editor/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import EditorWorker from "./workers/editor.worker?worker"; // eslint-disable-lin
77
// @ts-ignore
88
import TsWorker from "./workers/ts.worker?worker"; // eslint-disable-line import/no-webpack-loader-syntax
99
// @ts-ignore
10-
import CSSWorker from "./workers/css.worker?worker"; // eslint-disable-line import/no-webpack-loader-syntax
10+
import CSSWorker from "monaco-editor/esm/vs/language/css/css.worker?worker";
1111

1212
import { getDefaultSandboxCompilerOptions } from "./compilerOptions";
1313
import { setupPrettier } from "./prettier";

packages/editor/src/runtime/editor/languages/typescript/typeAcquisition.ts

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,25 @@ const errorMsg = (msg: string, response: any, config: ATAConfig) => {
3535
);
3636
};
3737

38+
// https://regex101.com/r/Jxa3KX/4
39+
40+
const requirePattern = RegExp(
41+
/(const|let|var)(.|\n)*? require\(('|")(.*)('|")\);?$/,
42+
"gm"
43+
);
44+
// this handle ths 'from' imports https://regex101.com/r/hdEpzO/4
45+
const es6Pattern = RegExp(
46+
/(import|export)((?!from)(?!require)(.|\n))*?(from|require\()\s?('|")(.*)('|")\)?;?$/,
47+
"gm"
48+
);
49+
// https://regex101.com/r/hdEpzO/6
50+
const es6ImportOnly = RegExp(/import\s?\(?('|")(.*)('|")\)?;?/, "gm");
51+
3852
/**
3953
* Grab any import/requires from inside the code and make a list of
4054
* its dependencies
4155
*/
4256
const parseFileForModuleReferences = (sourceCode: string) => {
43-
// https://regex101.com/r/Jxa3KX/4
44-
const requirePattern =
45-
/(const|let|var)(.|\n)*? require\(('|")(.*)('|")\);?$/gm;
46-
// this handle ths 'from' imports https://regex101.com/r/hdEpzO/4
47-
const es6Pattern =
48-
/(import|export)((?!from)(?!require)(.|\n))*?(from|require\()\s?('|")(.*)('|")\)?;?$/gm;
49-
// https://regex101.com/r/hdEpzO/6
50-
const es6ImportOnly = /import\s?\(?('|")(.*)('|")\)?;?/gm;
51-
5257
const foundModules = new Set<string>();
5358
var match;
5459

@@ -421,6 +426,11 @@ const getCachedDTSString = async (config: ATAConfig, url: string) => {
421426
return content;
422427
};
423428

429+
const referencePathExtractionPattern = RegExp(
430+
/<reference path="(.*)" \/>/,
431+
"gm"
432+
);
433+
424434
const getReferenceDependencies = async (
425435
sourceCode: string,
426436
mod: string,
@@ -430,7 +440,7 @@ const getReferenceDependencies = async (
430440
var match;
431441
if (sourceCode.indexOf("reference path") > 0) {
432442
// https://regex101.com/r/DaOegw/1
433-
const referencePathExtractionPattern = /<reference path="(.*)" \/>/gm;
443+
434444
while ((match = referencePathExtractionPattern.exec(sourceCode)) !== null) {
435445
const relativePath = match[1];
436446
if (relativePath) {

0 commit comments

Comments
 (0)