mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-10 20:32:21 +08:00
chore(deps): update npm dependencies (#5561)
* chore(deps): update npm dependencies * fix: types * chore: replace vite-plugin-monaco-editor-esm with utils/monaco --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Slinetrac <realakayuki@gmail.com>
This commit is contained in:
co-authored by
renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Slinetrac
parent
a271ba6ce5
commit
51760a5b95
@@ -81,7 +81,7 @@ const monacoInitialization = () => {
|
||||
],
|
||||
});
|
||||
// PAC type definitions for JS suggestions
|
||||
monaco.languages.typescript.javascriptDefaults.addExtraLib(pac, "pac.d.ts");
|
||||
monaco.typescript.javascriptDefaults.addExtraLib(pac, "pac.d.ts");
|
||||
|
||||
initialized = true;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/// <reference types="vite/client" />
|
||||
/// <reference types="vite-plugin-svgr/client" />
|
||||
import "./assets/styles/index.scss";
|
||||
import "./utils/monaco";
|
||||
|
||||
import { ResizeObserver } from "@juggle/resize-observer";
|
||||
import { ComposeContextProvider } from "foxact/compose-context-provider";
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import editorWorker from "monaco-editor/esm/vs/editor/editor.worker?worker";
|
||||
import cssWorker from "monaco-editor/esm/vs/language/css/css.worker?worker";
|
||||
import tsWorker from "monaco-editor/esm/vs/language/typescript/ts.worker?worker";
|
||||
import yamlWorker from "monaco-yaml/yaml.worker?worker";
|
||||
|
||||
type WorkerConstructor = new () => Worker;
|
||||
|
||||
// Align with the former plugin mapping so Monaco can resolve its background workers.
|
||||
const workerConstructors: Record<string, WorkerConstructor> = {
|
||||
editorWorkerService: editorWorker,
|
||||
typescript: tsWorker,
|
||||
javascript: tsWorker,
|
||||
"languages.typescript": tsWorker,
|
||||
css: cssWorker,
|
||||
less: cssWorker,
|
||||
scss: cssWorker,
|
||||
"languages.css": cssWorker,
|
||||
yaml: yamlWorker,
|
||||
};
|
||||
|
||||
const defaultWorker = workerConstructors.editorWorkerService;
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
const globalScope = self as typeof self & {
|
||||
MonacoEnvironment?: {
|
||||
getWorker: (moduleId: string, label: string) => Worker;
|
||||
};
|
||||
};
|
||||
|
||||
const getWorker = (_moduleId: string, label: string) => {
|
||||
const WorkerCtor = workerConstructors[label] ?? defaultWorker;
|
||||
return new WorkerCtor();
|
||||
};
|
||||
|
||||
globalScope.MonacoEnvironment = {
|
||||
...globalScope.MonacoEnvironment,
|
||||
getWorker,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user