mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-22 16:52:14 -06:00
Export ts namespace from tsserver for hacky-post patching
Unlike our other exectuables, tsserver is used in web, which means that there actually would have been a "ts" variable declared for those users (e.g. in a web worker). It looks like VS Code needs this variable to be declared, so change this bundle to look the same as other libraries. Note that in Node, the IIFE will never actually return, so this can have no effect. On web, it will return in order to yield control back to the event loop (as on web, postMessage is used to communicate).
This commit is contained in:
parent
acfe7ac6d2
commit
8486229625
@ -5,4 +5,4 @@ export * from "../../server/_namespaces/ts.server";
|
||||
export * from "../../webServer/_namespaces/ts.server";
|
||||
export * from "../nodeServer";
|
||||
export * from "../webServer";
|
||||
export * from "../server";
|
||||
export * from "../common";
|
||||
|
||||
27
src/tsserver/common.ts
Normal file
27
src/tsserver/common.ts
Normal file
@ -0,0 +1,27 @@
|
||||
import {
|
||||
Logger, LogLevel, ServerCancellationToken, StartSessionOptions,
|
||||
} from "./_namespaces/ts.server";
|
||||
import { LanguageServiceMode } from "./_namespaces/ts";
|
||||
|
||||
/** @internal */
|
||||
export function getLogLevel(level: string | undefined) {
|
||||
if (level) {
|
||||
const l = level.toLowerCase();
|
||||
for (const name in LogLevel) {
|
||||
if (isNaN(+name) && l === name.toLowerCase()) {
|
||||
return LogLevel[name] as any as LogLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export interface StartInput {
|
||||
args: readonly string[];
|
||||
logger: Logger;
|
||||
cancellationToken: ServerCancellationToken;
|
||||
serverMode: LanguageServiceMode | undefined;
|
||||
unknownServerMode?: string;
|
||||
startSession: (option: StartSessionOptions, logger: Logger, cancellationToken: ServerCancellationToken) => void;
|
||||
}
|
||||
@ -1,8 +1,9 @@
|
||||
import {
|
||||
emptyArray, findArgument, hasArgument, initializeNodeSystem, initializeWebSystem, Logger, LogLevel, Msg,
|
||||
ServerCancellationToken, StartSessionOptions,
|
||||
emptyArray, findArgument, hasArgument, initializeNodeSystem, initializeWebSystem, Msg,
|
||||
StartInput,
|
||||
} from "./_namespaces/ts.server";
|
||||
import { Debug, getNodeMajorVersion, LanguageServiceMode, setStackTraceLimit, sys, version } from "./_namespaces/ts";
|
||||
import { Debug, getNodeMajorVersion, setStackTraceLimit, sys, version } from "./_namespaces/ts";
|
||||
export * from "./_namespaces/ts";
|
||||
|
||||
declare const addEventListener: any;
|
||||
declare const removeEventListener: any;
|
||||
@ -14,28 +15,7 @@ function findArgumentStringArray(argName: string): readonly string[] {
|
||||
return arg.split(",").filter(name => name !== "");
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function getLogLevel(level: string | undefined) {
|
||||
if (level) {
|
||||
const l = level.toLowerCase();
|
||||
for (const name in LogLevel) {
|
||||
if (isNaN(+name) && l === name.toLowerCase()) {
|
||||
return LogLevel[name] as any as LogLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export interface StartInput {
|
||||
args: readonly string[];
|
||||
logger: Logger;
|
||||
cancellationToken: ServerCancellationToken;
|
||||
serverMode: LanguageServiceMode | undefined;
|
||||
unknownServerMode?: string;
|
||||
startSession: (option: StartSessionOptions, logger: Logger, cancellationToken: ServerCancellationToken) => void;
|
||||
}
|
||||
function start({ args, logger, cancellationToken, serverMode, unknownServerMode, startSession: startServer }: StartInput, platform: string) {
|
||||
const syntaxOnly = hasArgument("--syntaxOnly");
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user