From 681b38140f1a659b7c75a72ea1df65162a19a767 Mon Sep 17 00:00:00 2001 From: Remco Haszing Date: Thu, 5 Jan 2023 16:46:14 +0100 Subject: [PATCH] Export custom TypeScript worker variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A custom TypeScript worker factory function gets passed `TypeScriptWorker`, `ts`, and `libFileMap`. It also exports `create` using ESM. However, this can’t be used, because the custom worker factory is only called if a custom worker path is defined. Exposing these members, means a worker can be defined using ESM. --- src/language/typescript/ts.worker.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/language/typescript/ts.worker.ts b/src/language/typescript/ts.worker.ts index f03e32d1b2..d654d679b6 100644 --- a/src/language/typescript/ts.worker.ts +++ b/src/language/typescript/ts.worker.ts @@ -3,15 +3,17 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as edworker from 'monaco-editor-core/esm/vs/editor/editor.worker'; -import { ICreateData, create } from './tsWorker'; +import { initialize } from 'monaco-editor-core/esm/vs/editor/editor.worker'; +import * as ts from './lib/typescriptServices'; +import { ICreateData, TypeScriptWorker, create } from './tsWorker'; import { worker } from '../../fillers/monaco-editor-core'; +import { libFileMap } from './lib/lib'; self.onmessage = () => { // ignore the first message - edworker.initialize((ctx: worker.IWorkerContext, createData: ICreateData) => { + initialize((ctx: worker.IWorkerContext, createData: ICreateData) => { return create(ctx, createData); }); }; -export { create } from './tsWorker'; +export { TypeScriptWorker, create, initialize, libFileMap, ts };