@dcloudio/uni-app-x 0.7.81 → 0.7.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/types/{dom2 → dom2-internal}/UniCSSTransition.d.ts +1 -0
- package/types/dom2-internal/UniElement.d.ts +42 -6
- package/types/{dom2 → dom2-internal}/UniImageElement.d.ts +2 -0
- package/types/{dom2 → dom2-internal}/UniNativeBaseView.d.ts +1 -0
- package/types/dom2-internal/UniNativeScrollView.d.ts +49 -0
- package/types/dom2-internal/UniNestedScrollBodyElement.d.ts +14 -0
- package/types/dom2-internal/UniNestedScrollHeaderElement.d.ts +14 -0
- package/types/{dom2 → dom2-internal}/UniPage.d.ts +30 -81
- package/types/dom2-internal/global.d.ts +280 -1
- package/types/dom2-internal/index.d.ts +44 -1
- package/types/{dom2 → dom2-internal}/sharedData.d.ts +2 -0
- package/types/index.d.ts +0 -1
- package/types/native/UniElement.d.ts +3 -0
- package/types/native/UniPage.d.ts +150 -0
- package/types/node_modules/.package-lock.json +20 -0
- package/types/node_modules/typescript/LICENSE.txt +55 -0
- package/types/node_modules/typescript/ThirdPartyNoticeText.txt +193 -0
- package/types/node_modules/typescript/bin/tsc +2 -0
- package/types/node_modules/typescript/bin/tsserver +2 -0
- package/types/node_modules/typescript/lib/cancellationToken.js +90 -0
- package/types/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +1880 -0
- package/types/node_modules/typescript/lib/de/diagnosticMessages.generated.json +1880 -0
- package/types/node_modules/typescript/lib/es/diagnosticMessages.generated.json +1880 -0
- package/types/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +1880 -0
- package/types/node_modules/typescript/lib/it/diagnosticMessages.generated.json +1880 -0
- package/types/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +1880 -0
- package/types/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +1880 -0
- package/types/node_modules/typescript/lib/lib.d.ts +22 -0
- package/types/node_modules/typescript/lib/lib.decorators.d.ts +386 -0
- package/types/node_modules/typescript/lib/lib.decorators.legacy.d.ts +22 -0
- package/types/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +33 -0
- package/types/node_modules/typescript/lib/lib.dom.d.ts +28596 -0
- package/types/node_modules/typescript/lib/lib.dom.iterable.d.ts +475 -0
- package/types/node_modules/typescript/lib/lib.es2015.collection.d.ts +147 -0
- package/types/node_modules/typescript/lib/lib.es2015.core.d.ts +597 -0
- package/types/node_modules/typescript/lib/lib.es2015.d.ts +28 -0
- package/types/node_modules/typescript/lib/lib.es2015.generator.d.ts +77 -0
- package/types/node_modules/typescript/lib/lib.es2015.iterable.d.ts +495 -0
- package/types/node_modules/typescript/lib/lib.es2015.promise.d.ts +81 -0
- package/types/node_modules/typescript/lib/lib.es2015.proxy.d.ts +128 -0
- package/types/node_modules/typescript/lib/lib.es2015.reflect.d.ts +144 -0
- package/types/node_modules/typescript/lib/lib.es2015.symbol.d.ts +46 -0
- package/types/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
- package/types/node_modules/typescript/lib/lib.es2016.array.include.d.ts +116 -0
- package/types/node_modules/typescript/lib/lib.es2016.d.ts +21 -0
- package/types/node_modules/typescript/lib/lib.es2016.full.d.ts +23 -0
- package/types/node_modules/typescript/lib/lib.es2016.intl.d.ts +31 -0
- package/types/node_modules/typescript/lib/lib.es2017.d.ts +25 -0
- package/types/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
- package/types/node_modules/typescript/lib/lib.es2017.full.d.ts +23 -0
- package/types/node_modules/typescript/lib/lib.es2017.intl.d.ts +44 -0
- package/types/node_modules/typescript/lib/lib.es2017.object.d.ts +49 -0
- package/types/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +135 -0
- package/types/node_modules/typescript/lib/lib.es2017.string.d.ts +45 -0
- package/types/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +53 -0
- package/types/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +77 -0
- package/types/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +43 -0
- package/types/node_modules/typescript/lib/lib.es2018.d.ts +24 -0
- package/types/node_modules/typescript/lib/lib.es2018.full.d.ts +24 -0
- package/types/node_modules/typescript/lib/lib.es2018.intl.d.ts +83 -0
- package/types/node_modules/typescript/lib/lib.es2018.promise.d.ts +30 -0
- package/types/node_modules/typescript/lib/lib.es2018.regexp.d.ts +37 -0
- package/types/node_modules/typescript/lib/lib.es2019.array.d.ts +79 -0
- package/types/node_modules/typescript/lib/lib.es2019.d.ts +24 -0
- package/types/node_modules/typescript/lib/lib.es2019.full.d.ts +24 -0
- package/types/node_modules/typescript/lib/lib.es2019.intl.d.ts +23 -0
- package/types/node_modules/typescript/lib/lib.es2019.object.d.ts +33 -0
- package/types/node_modules/typescript/lib/lib.es2019.string.d.ts +37 -0
- package/types/node_modules/typescript/lib/lib.es2019.symbol.d.ts +24 -0
- package/types/node_modules/typescript/lib/lib.es2020.bigint.d.ts +727 -0
- package/types/node_modules/typescript/lib/lib.es2020.d.ts +27 -0
- package/types/node_modules/typescript/lib/lib.es2020.date.d.ts +42 -0
- package/types/node_modules/typescript/lib/lib.es2020.full.d.ts +24 -0
- package/types/node_modules/typescript/lib/lib.es2020.intl.d.ts +474 -0
- package/types/node_modules/typescript/lib/lib.es2020.number.d.ts +28 -0
- package/types/node_modules/typescript/lib/lib.es2020.promise.d.ts +47 -0
- package/types/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +97 -0
- package/types/node_modules/typescript/lib/lib.es2020.string.d.ts +42 -0
- package/types/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +37 -0
- package/types/node_modules/typescript/lib/lib.es2021.d.ts +23 -0
- package/types/node_modules/typescript/lib/lib.es2021.full.d.ts +24 -0
- package/types/node_modules/typescript/lib/lib.es2021.intl.d.ts +166 -0
- package/types/node_modules/typescript/lib/lib.es2021.promise.d.ts +48 -0
- package/types/node_modules/typescript/lib/lib.es2021.string.d.ts +33 -0
- package/types/node_modules/typescript/lib/lib.es2021.weakref.d.ts +76 -0
- package/types/node_modules/typescript/lib/lib.es2022.array.d.ts +121 -0
- package/types/node_modules/typescript/lib/lib.es2022.d.ts +26 -0
- package/types/node_modules/typescript/lib/lib.es2022.error.d.ts +73 -0
- package/types/node_modules/typescript/lib/lib.es2022.full.d.ts +24 -0
- package/types/node_modules/typescript/lib/lib.es2022.intl.d.ts +117 -0
- package/types/node_modules/typescript/lib/lib.es2022.object.d.ts +26 -0
- package/types/node_modules/typescript/lib/lib.es2022.regexp.d.ts +39 -0
- package/types/node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts +39 -0
- package/types/node_modules/typescript/lib/lib.es2022.string.d.ts +25 -0
- package/types/node_modules/typescript/lib/lib.es2023.array.d.ts +924 -0
- package/types/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
- package/types/node_modules/typescript/lib/lib.es2023.d.ts +22 -0
- package/types/node_modules/typescript/lib/lib.es2023.full.d.ts +24 -0
- package/types/node_modules/typescript/lib/lib.es2023.intl.d.ts +56 -0
- package/types/node_modules/typescript/lib/lib.es5.d.ts +4585 -0
- package/types/node_modules/typescript/lib/lib.es6.d.ts +23 -0
- package/types/node_modules/typescript/lib/lib.esnext.array.d.ts +35 -0
- package/types/node_modules/typescript/lib/lib.esnext.collection.d.ts +106 -0
- package/types/node_modules/typescript/lib/lib.esnext.d.ts +28 -0
- package/types/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
- package/types/node_modules/typescript/lib/lib.esnext.disposable.d.ts +185 -0
- package/types/node_modules/typescript/lib/lib.esnext.full.d.ts +24 -0
- package/types/node_modules/typescript/lib/lib.esnext.intl.d.ts +21 -0
- package/types/node_modules/typescript/lib/lib.esnext.object.d.ts +29 -0
- package/types/node_modules/typescript/lib/lib.esnext.promise.d.ts +35 -0
- package/types/node_modules/typescript/lib/lib.esnext.regexp.d.ts +25 -0
- package/types/node_modules/typescript/lib/lib.esnext.string.d.ts +29 -0
- package/types/node_modules/typescript/lib/lib.scripthost.d.ts +322 -0
- package/types/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +33 -0
- package/types/node_modules/typescript/lib/lib.webworker.d.ts +9431 -0
- package/types/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +23 -0
- package/types/node_modules/typescript/lib/lib.webworker.iterable.d.ts +276 -0
- package/types/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +1880 -0
- package/types/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +1880 -0
- package/types/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +1880 -0
- package/types/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +1880 -0
- package/types/node_modules/typescript/lib/tsc.js +129741 -0
- package/types/node_modules/typescript/lib/tsserver.js +621 -0
- package/types/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
- package/types/node_modules/typescript/lib/tsserverlibrary.js +21 -0
- package/types/node_modules/typescript/lib/typesMap.json +497 -0
- package/types/node_modules/typescript/lib/typescript.d.ts +11240 -0
- package/types/node_modules/typescript/lib/typescript.js +194910 -0
- package/types/node_modules/typescript/lib/typingsInstaller.js +236 -0
- package/types/node_modules/typescript/lib/watchGuard.js +53 -0
- package/types/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +1880 -0
- package/types/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +1880 -0
- package/types/node_modules/typescript/package.json +116 -0
- package/types/uni/uts-plugin-component/global.d.ts +1 -0
- package/types/uni/uts-plugin-component/index.d.ts +1 -0
- package/types/uni/uts-plugin-component/lib/uni-textarea/utssdk/global.d.ts +9 -0
- package/types/uni/uts-plugin-component/lib/uni-textarea/utssdk/index.d.ts +5 -0
- package/types/uni/uts-plugin-component/lib/uni-textarea/utssdk/interface.d.ts +0 -0
- package/types/dom2/UniElement.d.ts +0 -340
- package/types/dom2/UniNativeViewElement.d.ts +0 -72
- package/types/dom2/global.d.ts +0 -301
- package/types/dom2/index.d.ts +0 -41
- /package/types/{dom2 → dom2-internal}/UniCSSProperty.d.ts +0 -0
- /package/types/{dom2 → dom2-internal}/UniCSSTransform.d.ts +0 -0
- /package/types/{dom2 → dom2-internal}/UniCSSType.d.ts +0 -0
- /package/types/{dom2 → dom2-internal}/UniCommon.d.ts +0 -0
- /package/types/{dom2 → dom2-internal}/UniElementType.d.ts +0 -0
- /package/types/{dom2 → dom2-internal}/UniNativeCustomView.d.ts +0 -0
- /package/types/{dom2 → dom2-internal}/UniNativeDefines.d.ts +0 -0
- /package/types/{dom2 → dom2-internal}/UniNativeImageView.d.ts +0 -0
- /package/types/{dom2/UniNativeScrollView.d.ts → dom2-internal/UniNativeNestedScrollView.d.ts} +0 -0
- /package/types/{dom2 → dom2-internal}/UniNativeTextView.d.ts +0 -0
- /package/types/{dom2 → dom2-internal}/UniNativeView.d.ts +0 -0
- /package/types/{dom2 → dom2-internal}/UniNativeViewType.d.ts +0 -0
- /package/types/{dom2 → dom2-internal}/UniScrollViewElement.d.ts +0 -0
- /package/types/{dom2 → dom2-internal}/UniTextElement.d.ts +0 -0
- /package/types/{dom2 → dom2-internal}/UniTextLayout.d.ts +0 -0
- /package/types/{dom2 → dom2-internal}/UniViewElement.d.ts +0 -0
|
@@ -0,0 +1,621 @@
|
|
|
1
|
+
/*! *****************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
4
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
5
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
8
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
9
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
10
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
11
|
+
|
|
12
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
13
|
+
and limitations under the License.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
"use strict";
|
|
18
|
+
var __defProp = Object.defineProperty;
|
|
19
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
20
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
21
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
22
|
+
var __copyProps = (to, from, except, desc) => {
|
|
23
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
24
|
+
for (let key of __getOwnPropNames(from))
|
|
25
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
26
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
27
|
+
}
|
|
28
|
+
return to;
|
|
29
|
+
};
|
|
30
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
31
|
+
|
|
32
|
+
// src/typescript/typescript.ts
|
|
33
|
+
var typescript_exports = {};
|
|
34
|
+
__reExport(typescript_exports, require("./typescript.js"));
|
|
35
|
+
|
|
36
|
+
// src/tsserver/common.ts
|
|
37
|
+
function getLogLevel(level) {
|
|
38
|
+
if (level) {
|
|
39
|
+
const l = level.toLowerCase();
|
|
40
|
+
for (const name in typescript_exports.server.LogLevel) {
|
|
41
|
+
if (isNaN(+name) && l === name.toLowerCase()) {
|
|
42
|
+
return typescript_exports.server.LogLevel[name];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return void 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// src/tsserver/nodeServer.ts
|
|
50
|
+
function parseLoggingEnvironmentString(logEnvStr) {
|
|
51
|
+
if (!logEnvStr) {
|
|
52
|
+
return {};
|
|
53
|
+
}
|
|
54
|
+
const logEnv = { logToFile: true };
|
|
55
|
+
const args = logEnvStr.split(" ");
|
|
56
|
+
const len = args.length - 1;
|
|
57
|
+
for (let i = 0; i < len; i += 2) {
|
|
58
|
+
const option = args[i];
|
|
59
|
+
const { value, extraPartCounter } = getEntireValue(i + 1);
|
|
60
|
+
i += extraPartCounter;
|
|
61
|
+
if (option && value) {
|
|
62
|
+
switch (option) {
|
|
63
|
+
case "-file":
|
|
64
|
+
logEnv.file = value;
|
|
65
|
+
break;
|
|
66
|
+
case "-level":
|
|
67
|
+
const level = getLogLevel(value);
|
|
68
|
+
logEnv.detailLevel = level !== void 0 ? level : typescript_exports.server.LogLevel.normal;
|
|
69
|
+
break;
|
|
70
|
+
case "-traceToConsole":
|
|
71
|
+
logEnv.traceToConsole = value.toLowerCase() === "true";
|
|
72
|
+
break;
|
|
73
|
+
case "-logToFile":
|
|
74
|
+
logEnv.logToFile = value.toLowerCase() === "true";
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return logEnv;
|
|
80
|
+
function getEntireValue(initialIndex) {
|
|
81
|
+
let pathStart = args[initialIndex];
|
|
82
|
+
let extraPartCounter = 0;
|
|
83
|
+
if (pathStart.charCodeAt(0) === typescript_exports.CharacterCodes.doubleQuote && pathStart.charCodeAt(pathStart.length - 1) !== typescript_exports.CharacterCodes.doubleQuote) {
|
|
84
|
+
for (let i = initialIndex + 1; i < args.length; i++) {
|
|
85
|
+
pathStart += " ";
|
|
86
|
+
pathStart += args[i];
|
|
87
|
+
extraPartCounter++;
|
|
88
|
+
if (pathStart.charCodeAt(pathStart.length - 1) === typescript_exports.CharacterCodes.doubleQuote) break;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return { value: (0, typescript_exports.stripQuotes)(pathStart), extraPartCounter };
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function parseServerMode() {
|
|
95
|
+
const mode = typescript_exports.server.findArgument("--serverMode");
|
|
96
|
+
if (!mode) return void 0;
|
|
97
|
+
switch (mode.toLowerCase()) {
|
|
98
|
+
case "semantic":
|
|
99
|
+
return typescript_exports.LanguageServiceMode.Semantic;
|
|
100
|
+
case "partialsemantic":
|
|
101
|
+
return typescript_exports.LanguageServiceMode.PartialSemantic;
|
|
102
|
+
case "syntactic":
|
|
103
|
+
return typescript_exports.LanguageServiceMode.Syntactic;
|
|
104
|
+
default:
|
|
105
|
+
return mode;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function initializeNodeSystem() {
|
|
109
|
+
const sys4 = typescript_exports.Debug.checkDefined(typescript_exports.sys);
|
|
110
|
+
const childProcess = require("child_process");
|
|
111
|
+
const fs = require("fs");
|
|
112
|
+
class Logger {
|
|
113
|
+
constructor(logFilename, traceToConsole, level) {
|
|
114
|
+
this.logFilename = logFilename;
|
|
115
|
+
this.traceToConsole = traceToConsole;
|
|
116
|
+
this.level = level;
|
|
117
|
+
this.seq = 0;
|
|
118
|
+
this.inGroup = false;
|
|
119
|
+
this.firstInGroup = true;
|
|
120
|
+
this.fd = -1;
|
|
121
|
+
if (this.logFilename) {
|
|
122
|
+
try {
|
|
123
|
+
this.fd = fs.openSync(this.logFilename, "w");
|
|
124
|
+
} catch (_) {
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
static padStringRight(str, padding) {
|
|
129
|
+
return (str + padding).slice(0, padding.length);
|
|
130
|
+
}
|
|
131
|
+
close() {
|
|
132
|
+
if (this.fd >= 0) {
|
|
133
|
+
fs.close(this.fd, typescript_exports.noop);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
getLogFileName() {
|
|
137
|
+
return this.logFilename;
|
|
138
|
+
}
|
|
139
|
+
perftrc(s) {
|
|
140
|
+
this.msg(s, typescript_exports.server.Msg.Perf);
|
|
141
|
+
}
|
|
142
|
+
info(s) {
|
|
143
|
+
this.msg(s, typescript_exports.server.Msg.Info);
|
|
144
|
+
}
|
|
145
|
+
err(s) {
|
|
146
|
+
this.msg(s, typescript_exports.server.Msg.Err);
|
|
147
|
+
}
|
|
148
|
+
startGroup() {
|
|
149
|
+
this.inGroup = true;
|
|
150
|
+
this.firstInGroup = true;
|
|
151
|
+
}
|
|
152
|
+
endGroup() {
|
|
153
|
+
this.inGroup = false;
|
|
154
|
+
}
|
|
155
|
+
loggingEnabled() {
|
|
156
|
+
return !!this.logFilename || this.traceToConsole;
|
|
157
|
+
}
|
|
158
|
+
hasLevel(level) {
|
|
159
|
+
return this.loggingEnabled() && this.level >= level;
|
|
160
|
+
}
|
|
161
|
+
msg(s, type = typescript_exports.server.Msg.Err) {
|
|
162
|
+
var _a, _b, _c;
|
|
163
|
+
switch (type) {
|
|
164
|
+
case typescript_exports.server.Msg.Info:
|
|
165
|
+
(_a = typescript_exports.perfLogger) == null ? void 0 : _a.logInfoEvent(s);
|
|
166
|
+
break;
|
|
167
|
+
case typescript_exports.server.Msg.Perf:
|
|
168
|
+
(_b = typescript_exports.perfLogger) == null ? void 0 : _b.logPerfEvent(s);
|
|
169
|
+
break;
|
|
170
|
+
default:
|
|
171
|
+
(_c = typescript_exports.perfLogger) == null ? void 0 : _c.logErrEvent(s);
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
if (!this.canWrite()) return;
|
|
175
|
+
s = `[${typescript_exports.server.nowString()}] ${s}
|
|
176
|
+
`;
|
|
177
|
+
if (!this.inGroup || this.firstInGroup) {
|
|
178
|
+
const prefix = Logger.padStringRight(type + " " + this.seq.toString(), " ");
|
|
179
|
+
s = prefix + s;
|
|
180
|
+
}
|
|
181
|
+
this.write(s, type);
|
|
182
|
+
if (!this.inGroup) {
|
|
183
|
+
this.seq++;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
canWrite() {
|
|
187
|
+
return this.fd >= 0 || this.traceToConsole;
|
|
188
|
+
}
|
|
189
|
+
write(s, _type) {
|
|
190
|
+
if (this.fd >= 0) {
|
|
191
|
+
const buf = Buffer.from(s);
|
|
192
|
+
fs.writeSync(
|
|
193
|
+
this.fd,
|
|
194
|
+
buf,
|
|
195
|
+
0,
|
|
196
|
+
buf.length,
|
|
197
|
+
/*position*/
|
|
198
|
+
null
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
if (this.traceToConsole) {
|
|
202
|
+
console.warn(s);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
const libDirectory = (0, typescript_exports.getDirectoryPath)((0, typescript_exports.normalizePath)(sys4.getExecutingFilePath()));
|
|
207
|
+
const useWatchGuard = process.platform === "win32";
|
|
208
|
+
const originalWatchDirectory = sys4.watchDirectory.bind(sys4);
|
|
209
|
+
const logger = createLogger();
|
|
210
|
+
typescript_exports.Debug.loggingHost = {
|
|
211
|
+
log(level, s) {
|
|
212
|
+
switch (level) {
|
|
213
|
+
case typescript_exports.LogLevel.Error:
|
|
214
|
+
case typescript_exports.LogLevel.Warning:
|
|
215
|
+
return logger.msg(s, typescript_exports.server.Msg.Err);
|
|
216
|
+
case typescript_exports.LogLevel.Info:
|
|
217
|
+
case typescript_exports.LogLevel.Verbose:
|
|
218
|
+
return logger.msg(s, typescript_exports.server.Msg.Info);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
const pending = (0, typescript_exports.createQueue)();
|
|
223
|
+
let canWrite = true;
|
|
224
|
+
if (useWatchGuard) {
|
|
225
|
+
const currentDrive = extractWatchDirectoryCacheKey(
|
|
226
|
+
sys4.resolvePath(sys4.getCurrentDirectory()),
|
|
227
|
+
/*currentDriveKey*/
|
|
228
|
+
void 0
|
|
229
|
+
);
|
|
230
|
+
const statusCache = /* @__PURE__ */ new Map();
|
|
231
|
+
sys4.watchDirectory = (path, callback, recursive, options) => {
|
|
232
|
+
const cacheKey = extractWatchDirectoryCacheKey(path, currentDrive);
|
|
233
|
+
let status = cacheKey && statusCache.get(cacheKey);
|
|
234
|
+
if (status === void 0) {
|
|
235
|
+
if (logger.hasLevel(typescript_exports.server.LogLevel.verbose)) {
|
|
236
|
+
logger.info(`${cacheKey} for path ${path} not found in cache...`);
|
|
237
|
+
}
|
|
238
|
+
try {
|
|
239
|
+
const args = [(0, typescript_exports.combinePaths)(libDirectory, "watchGuard.js"), path];
|
|
240
|
+
if (logger.hasLevel(typescript_exports.server.LogLevel.verbose)) {
|
|
241
|
+
logger.info(`Starting ${process.execPath} with args:${typescript_exports.server.stringifyIndented(args)}`);
|
|
242
|
+
}
|
|
243
|
+
childProcess.execFileSync(process.execPath, args, { stdio: "ignore", env: { ELECTRON_RUN_AS_NODE: "1" } });
|
|
244
|
+
status = true;
|
|
245
|
+
if (logger.hasLevel(typescript_exports.server.LogLevel.verbose)) {
|
|
246
|
+
logger.info(`WatchGuard for path ${path} returned: OK`);
|
|
247
|
+
}
|
|
248
|
+
} catch (e) {
|
|
249
|
+
status = false;
|
|
250
|
+
if (logger.hasLevel(typescript_exports.server.LogLevel.verbose)) {
|
|
251
|
+
logger.info(`WatchGuard for path ${path} returned: ${e.message}`);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (cacheKey) {
|
|
255
|
+
statusCache.set(cacheKey, status);
|
|
256
|
+
}
|
|
257
|
+
} else if (logger.hasLevel(typescript_exports.server.LogLevel.verbose)) {
|
|
258
|
+
logger.info(`watchDirectory for ${path} uses cached drive information.`);
|
|
259
|
+
}
|
|
260
|
+
if (status) {
|
|
261
|
+
return watchDirectorySwallowingException(path, callback, recursive, options);
|
|
262
|
+
} else {
|
|
263
|
+
return typescript_exports.noopFileWatcher;
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
} else {
|
|
267
|
+
sys4.watchDirectory = watchDirectorySwallowingException;
|
|
268
|
+
}
|
|
269
|
+
sys4.write = (s) => writeMessage(Buffer.from(s, "utf8"));
|
|
270
|
+
sys4.setTimeout = setTimeout;
|
|
271
|
+
sys4.clearTimeout = clearTimeout;
|
|
272
|
+
sys4.setImmediate = setImmediate;
|
|
273
|
+
sys4.clearImmediate = clearImmediate;
|
|
274
|
+
if (typeof global !== "undefined" && global.gc) {
|
|
275
|
+
sys4.gc = () => {
|
|
276
|
+
var _a;
|
|
277
|
+
return (_a = global.gc) == null ? void 0 : _a.call(global);
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
let cancellationToken;
|
|
281
|
+
try {
|
|
282
|
+
const factory = require("./cancellationToken");
|
|
283
|
+
cancellationToken = factory(sys4.args);
|
|
284
|
+
} catch (e) {
|
|
285
|
+
cancellationToken = typescript_exports.server.nullCancellationToken;
|
|
286
|
+
}
|
|
287
|
+
const localeStr = typescript_exports.server.findArgument("--locale");
|
|
288
|
+
if (localeStr) {
|
|
289
|
+
(0, typescript_exports.validateLocaleAndSetLanguage)(localeStr, sys4);
|
|
290
|
+
}
|
|
291
|
+
const modeOrUnknown = parseServerMode();
|
|
292
|
+
let serverMode;
|
|
293
|
+
let unknownServerMode;
|
|
294
|
+
if (modeOrUnknown !== void 0) {
|
|
295
|
+
if (typeof modeOrUnknown === "number") serverMode = modeOrUnknown;
|
|
296
|
+
else unknownServerMode = modeOrUnknown;
|
|
297
|
+
}
|
|
298
|
+
return {
|
|
299
|
+
args: process.argv,
|
|
300
|
+
logger,
|
|
301
|
+
cancellationToken,
|
|
302
|
+
serverMode,
|
|
303
|
+
unknownServerMode,
|
|
304
|
+
startSession: startNodeSession
|
|
305
|
+
};
|
|
306
|
+
function createLogger() {
|
|
307
|
+
const cmdLineLogFileName = typescript_exports.server.findArgument("--logFile");
|
|
308
|
+
const cmdLineVerbosity = getLogLevel(typescript_exports.server.findArgument("--logVerbosity"));
|
|
309
|
+
const envLogOptions = parseLoggingEnvironmentString(process.env.TSS_LOG);
|
|
310
|
+
const unsubstitutedLogFileName = cmdLineLogFileName ? (0, typescript_exports.stripQuotes)(cmdLineLogFileName) : envLogOptions.logToFile ? envLogOptions.file || libDirectory + "/.log" + process.pid.toString() : void 0;
|
|
311
|
+
const substitutedLogFileName = unsubstitutedLogFileName ? unsubstitutedLogFileName.replace("PID", process.pid.toString()) : void 0;
|
|
312
|
+
const logVerbosity = cmdLineVerbosity || envLogOptions.detailLevel;
|
|
313
|
+
return new Logger(substitutedLogFileName, envLogOptions.traceToConsole, logVerbosity);
|
|
314
|
+
}
|
|
315
|
+
function writeMessage(buf) {
|
|
316
|
+
if (!canWrite) {
|
|
317
|
+
pending.enqueue(buf);
|
|
318
|
+
} else {
|
|
319
|
+
canWrite = false;
|
|
320
|
+
process.stdout.write(buf, setCanWriteFlagAndWriteMessageIfNecessary);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
function setCanWriteFlagAndWriteMessageIfNecessary() {
|
|
324
|
+
canWrite = true;
|
|
325
|
+
if (!pending.isEmpty()) {
|
|
326
|
+
writeMessage(pending.dequeue());
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
function extractWatchDirectoryCacheKey(path, currentDriveKey) {
|
|
330
|
+
path = (0, typescript_exports.normalizeSlashes)(path);
|
|
331
|
+
if (isUNCPath(path)) {
|
|
332
|
+
const firstSlash = path.indexOf(typescript_exports.directorySeparator, 2);
|
|
333
|
+
return firstSlash !== -1 ? (0, typescript_exports.toFileNameLowerCase)(path.substring(0, firstSlash)) : path;
|
|
334
|
+
}
|
|
335
|
+
const rootLength = (0, typescript_exports.getRootLength)(path);
|
|
336
|
+
if (rootLength === 0) {
|
|
337
|
+
return currentDriveKey;
|
|
338
|
+
}
|
|
339
|
+
if (path.charCodeAt(1) === typescript_exports.CharacterCodes.colon && path.charCodeAt(2) === typescript_exports.CharacterCodes.slash) {
|
|
340
|
+
return (0, typescript_exports.toFileNameLowerCase)(path.charAt(0));
|
|
341
|
+
}
|
|
342
|
+
if (path.charCodeAt(0) === typescript_exports.CharacterCodes.slash && path.charCodeAt(1) !== typescript_exports.CharacterCodes.slash) {
|
|
343
|
+
return currentDriveKey;
|
|
344
|
+
}
|
|
345
|
+
return void 0;
|
|
346
|
+
}
|
|
347
|
+
function isUNCPath(s) {
|
|
348
|
+
return s.length > 2 && s.charCodeAt(0) === typescript_exports.CharacterCodes.slash && s.charCodeAt(1) === typescript_exports.CharacterCodes.slash;
|
|
349
|
+
}
|
|
350
|
+
function watchDirectorySwallowingException(path, callback, recursive, options) {
|
|
351
|
+
try {
|
|
352
|
+
return originalWatchDirectory(path, callback, recursive, options);
|
|
353
|
+
} catch (e) {
|
|
354
|
+
logger.info(`Exception when creating directory watcher: ${e.message}`);
|
|
355
|
+
return typescript_exports.noopFileWatcher;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
function parseEventPort(eventPortStr) {
|
|
360
|
+
const eventPort = eventPortStr === void 0 ? void 0 : parseInt(eventPortStr);
|
|
361
|
+
return eventPort !== void 0 && !isNaN(eventPort) ? eventPort : void 0;
|
|
362
|
+
}
|
|
363
|
+
function startNodeSession(options, logger, cancellationToken) {
|
|
364
|
+
const childProcess = require("child_process");
|
|
365
|
+
const os = require("os");
|
|
366
|
+
const net = require("net");
|
|
367
|
+
const readline = require("readline");
|
|
368
|
+
const rl = readline.createInterface({
|
|
369
|
+
input: process.stdin,
|
|
370
|
+
output: process.stdout,
|
|
371
|
+
terminal: false
|
|
372
|
+
});
|
|
373
|
+
const _NodeTypingsInstallerAdapter = class _NodeTypingsInstallerAdapter extends typescript_exports.server.TypingsInstallerAdapter {
|
|
374
|
+
constructor(telemetryEnabled2, logger2, host, globalTypingsCacheLocation, typingSafeListLocation2, typesMapLocation2, npmLocation2, validateDefaultNpmLocation2, event) {
|
|
375
|
+
super(
|
|
376
|
+
telemetryEnabled2,
|
|
377
|
+
logger2,
|
|
378
|
+
host,
|
|
379
|
+
globalTypingsCacheLocation,
|
|
380
|
+
event,
|
|
381
|
+
_NodeTypingsInstallerAdapter.maxActiveRequestCount
|
|
382
|
+
);
|
|
383
|
+
this.typingSafeListLocation = typingSafeListLocation2;
|
|
384
|
+
this.typesMapLocation = typesMapLocation2;
|
|
385
|
+
this.npmLocation = npmLocation2;
|
|
386
|
+
this.validateDefaultNpmLocation = validateDefaultNpmLocation2;
|
|
387
|
+
}
|
|
388
|
+
createInstallerProcess() {
|
|
389
|
+
if (this.logger.hasLevel(typescript_exports.server.LogLevel.requestTime)) {
|
|
390
|
+
this.logger.info("Binding...");
|
|
391
|
+
}
|
|
392
|
+
const args = [typescript_exports.server.Arguments.GlobalCacheLocation, this.globalTypingsCacheLocation];
|
|
393
|
+
if (this.telemetryEnabled) {
|
|
394
|
+
args.push(typescript_exports.server.Arguments.EnableTelemetry);
|
|
395
|
+
}
|
|
396
|
+
if (this.logger.loggingEnabled() && this.logger.getLogFileName()) {
|
|
397
|
+
args.push(typescript_exports.server.Arguments.LogFile, (0, typescript_exports.combinePaths)((0, typescript_exports.getDirectoryPath)((0, typescript_exports.normalizeSlashes)(this.logger.getLogFileName())), `ti-${process.pid}.log`));
|
|
398
|
+
}
|
|
399
|
+
if (this.typingSafeListLocation) {
|
|
400
|
+
args.push(typescript_exports.server.Arguments.TypingSafeListLocation, this.typingSafeListLocation);
|
|
401
|
+
}
|
|
402
|
+
if (this.typesMapLocation) {
|
|
403
|
+
args.push(typescript_exports.server.Arguments.TypesMapLocation, this.typesMapLocation);
|
|
404
|
+
}
|
|
405
|
+
if (this.npmLocation) {
|
|
406
|
+
args.push(typescript_exports.server.Arguments.NpmLocation, this.npmLocation);
|
|
407
|
+
}
|
|
408
|
+
if (this.validateDefaultNpmLocation) {
|
|
409
|
+
args.push(typescript_exports.server.Arguments.ValidateDefaultNpmLocation);
|
|
410
|
+
}
|
|
411
|
+
const execArgv = [];
|
|
412
|
+
for (const arg of process.execArgv) {
|
|
413
|
+
const match = /^--((?:debug|inspect)(?:-brk)?)(?:=(\d+))?$/.exec(arg);
|
|
414
|
+
if (match) {
|
|
415
|
+
const currentPort = match[2] !== void 0 ? +match[2] : match[1].charAt(0) === "d" ? 5858 : 9229;
|
|
416
|
+
execArgv.push(`--${match[1]}=${currentPort + 1}`);
|
|
417
|
+
break;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
const typingsInstaller = (0, typescript_exports.combinePaths)((0, typescript_exports.getDirectoryPath)(typescript_exports.sys.getExecutingFilePath()), "typingsInstaller.js");
|
|
421
|
+
this.installer = childProcess.fork(typingsInstaller, args, { execArgv });
|
|
422
|
+
this.installer.on("message", (m) => this.handleMessage(m));
|
|
423
|
+
this.host.setImmediate(() => this.event({ pid: this.installer.pid }, "typingsInstallerPid"));
|
|
424
|
+
process.on("exit", () => {
|
|
425
|
+
this.installer.kill();
|
|
426
|
+
});
|
|
427
|
+
return this.installer;
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
// This number is essentially arbitrary. Processing more than one typings request
|
|
431
|
+
// at a time makes sense, but having too many in the pipe results in a hang
|
|
432
|
+
// (see https://github.com/nodejs/node/issues/7657).
|
|
433
|
+
// It would be preferable to base our limit on the amount of space left in the
|
|
434
|
+
// buffer, but we have yet to find a way to retrieve that value.
|
|
435
|
+
_NodeTypingsInstallerAdapter.maxActiveRequestCount = 10;
|
|
436
|
+
let NodeTypingsInstallerAdapter = _NodeTypingsInstallerAdapter;
|
|
437
|
+
class IOSession extends typescript_exports.server.Session {
|
|
438
|
+
constructor() {
|
|
439
|
+
const event = (body, eventName) => {
|
|
440
|
+
this.event(body, eventName);
|
|
441
|
+
};
|
|
442
|
+
const host = typescript_exports.sys;
|
|
443
|
+
const typingsInstaller = disableAutomaticTypingAcquisition ? void 0 : new NodeTypingsInstallerAdapter(telemetryEnabled, logger, host, getGlobalTypingsCacheLocation(), typingSafeListLocation, typesMapLocation, npmLocation, validateDefaultNpmLocation, event);
|
|
444
|
+
super({
|
|
445
|
+
host,
|
|
446
|
+
cancellationToken,
|
|
447
|
+
...options,
|
|
448
|
+
typingsInstaller,
|
|
449
|
+
byteLength: Buffer.byteLength,
|
|
450
|
+
hrtime: process.hrtime,
|
|
451
|
+
logger,
|
|
452
|
+
canUseEvents: true,
|
|
453
|
+
typesMapLocation
|
|
454
|
+
});
|
|
455
|
+
this.eventPort = eventPort;
|
|
456
|
+
if (this.canUseEvents && this.eventPort) {
|
|
457
|
+
const s = net.connect({ port: this.eventPort }, () => {
|
|
458
|
+
this.eventSocket = s;
|
|
459
|
+
if (this.socketEventQueue) {
|
|
460
|
+
for (const event2 of this.socketEventQueue) {
|
|
461
|
+
this.writeToEventSocket(event2.body, event2.eventName);
|
|
462
|
+
}
|
|
463
|
+
this.socketEventQueue = void 0;
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
this.constructed = true;
|
|
468
|
+
}
|
|
469
|
+
event(body, eventName) {
|
|
470
|
+
typescript_exports.Debug.assert(!!this.constructed, "Should only call `IOSession.prototype.event` on an initialized IOSession");
|
|
471
|
+
if (this.canUseEvents && this.eventPort) {
|
|
472
|
+
if (!this.eventSocket) {
|
|
473
|
+
if (this.logger.hasLevel(typescript_exports.server.LogLevel.verbose)) {
|
|
474
|
+
this.logger.info(`eventPort: event "${eventName}" queued, but socket not yet initialized`);
|
|
475
|
+
}
|
|
476
|
+
(this.socketEventQueue || (this.socketEventQueue = [])).push({ body, eventName });
|
|
477
|
+
return;
|
|
478
|
+
} else {
|
|
479
|
+
typescript_exports.Debug.assert(this.socketEventQueue === void 0);
|
|
480
|
+
this.writeToEventSocket(body, eventName);
|
|
481
|
+
}
|
|
482
|
+
} else {
|
|
483
|
+
super.event(body, eventName);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
writeToEventSocket(body, eventName) {
|
|
487
|
+
this.eventSocket.write(typescript_exports.server.formatMessage(typescript_exports.server.toEvent(eventName, body), this.logger, this.byteLength, this.host.newLine), "utf8");
|
|
488
|
+
}
|
|
489
|
+
exit() {
|
|
490
|
+
var _a;
|
|
491
|
+
this.logger.info("Exiting...");
|
|
492
|
+
this.projectService.closeLog();
|
|
493
|
+
(_a = typescript_exports.tracing) == null ? void 0 : _a.stopTracing();
|
|
494
|
+
process.exit(0);
|
|
495
|
+
}
|
|
496
|
+
listen() {
|
|
497
|
+
rl.on("line", (input) => {
|
|
498
|
+
const message = input.trim();
|
|
499
|
+
this.onMessage(message);
|
|
500
|
+
});
|
|
501
|
+
rl.on("close", () => {
|
|
502
|
+
this.exit();
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
class IpcIOSession extends IOSession {
|
|
507
|
+
writeMessage(msg) {
|
|
508
|
+
const verboseLogging = logger.hasLevel(typescript_exports.server.LogLevel.verbose);
|
|
509
|
+
if (verboseLogging) {
|
|
510
|
+
const json = JSON.stringify(msg);
|
|
511
|
+
logger.info(`${msg.type}:${typescript_exports.server.indent(json)}`);
|
|
512
|
+
}
|
|
513
|
+
process.send(msg);
|
|
514
|
+
}
|
|
515
|
+
parseMessage(message) {
|
|
516
|
+
return message;
|
|
517
|
+
}
|
|
518
|
+
toStringMessage(message) {
|
|
519
|
+
return JSON.stringify(message, void 0, 2);
|
|
520
|
+
}
|
|
521
|
+
listen() {
|
|
522
|
+
process.on("message", (e) => {
|
|
523
|
+
this.onMessage(e);
|
|
524
|
+
});
|
|
525
|
+
process.on("disconnect", () => {
|
|
526
|
+
this.exit();
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
const eventPort = parseEventPort(typescript_exports.server.findArgument("--eventPort"));
|
|
531
|
+
const typingSafeListLocation = typescript_exports.server.findArgument(typescript_exports.server.Arguments.TypingSafeListLocation);
|
|
532
|
+
const typesMapLocation = typescript_exports.server.findArgument(typescript_exports.server.Arguments.TypesMapLocation) || (0, typescript_exports.combinePaths)((0, typescript_exports.getDirectoryPath)(typescript_exports.sys.getExecutingFilePath()), "typesMap.json");
|
|
533
|
+
const npmLocation = typescript_exports.server.findArgument(typescript_exports.server.Arguments.NpmLocation);
|
|
534
|
+
const validateDefaultNpmLocation = typescript_exports.server.hasArgument(typescript_exports.server.Arguments.ValidateDefaultNpmLocation);
|
|
535
|
+
const disableAutomaticTypingAcquisition = typescript_exports.server.hasArgument("--disableAutomaticTypingAcquisition");
|
|
536
|
+
const useNodeIpc = typescript_exports.server.hasArgument("--useNodeIpc");
|
|
537
|
+
const telemetryEnabled = typescript_exports.server.hasArgument(typescript_exports.server.Arguments.EnableTelemetry);
|
|
538
|
+
const commandLineTraceDir = typescript_exports.server.findArgument("--traceDirectory");
|
|
539
|
+
const traceDir = commandLineTraceDir ? (0, typescript_exports.stripQuotes)(commandLineTraceDir) : process.env.TSS_TRACE;
|
|
540
|
+
if (traceDir) {
|
|
541
|
+
(0, typescript_exports.startTracing)("server", traceDir);
|
|
542
|
+
}
|
|
543
|
+
const ioSession = useNodeIpc ? new IpcIOSession() : new IOSession();
|
|
544
|
+
process.on("uncaughtException", (err) => {
|
|
545
|
+
ioSession.logError(err, "unknown");
|
|
546
|
+
});
|
|
547
|
+
process.noAsar = true;
|
|
548
|
+
ioSession.listen();
|
|
549
|
+
function getGlobalTypingsCacheLocation() {
|
|
550
|
+
switch (process.platform) {
|
|
551
|
+
case "win32": {
|
|
552
|
+
const basePath = process.env.LOCALAPPDATA || process.env.APPDATA || os.homedir && os.homedir() || process.env.USERPROFILE || process.env.HOMEDRIVE && process.env.HOMEPATH && (0, typescript_exports.normalizeSlashes)(process.env.HOMEDRIVE + process.env.HOMEPATH) || os.tmpdir();
|
|
553
|
+
return (0, typescript_exports.combinePaths)((0, typescript_exports.combinePaths)((0, typescript_exports.normalizeSlashes)(basePath), "Microsoft/TypeScript"), typescript_exports.versionMajorMinor);
|
|
554
|
+
}
|
|
555
|
+
case "openbsd":
|
|
556
|
+
case "freebsd":
|
|
557
|
+
case "netbsd":
|
|
558
|
+
case "darwin":
|
|
559
|
+
case "linux":
|
|
560
|
+
case "android": {
|
|
561
|
+
const cacheLocation = getNonWindowsCacheLocation(process.platform === "darwin");
|
|
562
|
+
return (0, typescript_exports.combinePaths)((0, typescript_exports.combinePaths)(cacheLocation, "typescript"), typescript_exports.versionMajorMinor);
|
|
563
|
+
}
|
|
564
|
+
default:
|
|
565
|
+
return typescript_exports.Debug.fail(`unsupported platform '${process.platform}'`);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
function getNonWindowsCacheLocation(platformIsDarwin) {
|
|
569
|
+
if (process.env.XDG_CACHE_HOME) {
|
|
570
|
+
return process.env.XDG_CACHE_HOME;
|
|
571
|
+
}
|
|
572
|
+
const usersDir = platformIsDarwin ? "Users" : "home";
|
|
573
|
+
const homePath = os.homedir && os.homedir() || process.env.HOME || (process.env.LOGNAME || process.env.USER) && `/${usersDir}/${process.env.LOGNAME || process.env.USER}` || os.tmpdir();
|
|
574
|
+
const cacheFolder = platformIsDarwin ? "Library/Caches" : ".cache";
|
|
575
|
+
return (0, typescript_exports.combinePaths)((0, typescript_exports.normalizeSlashes)(homePath), cacheFolder);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
// src/tsserver/server.ts
|
|
580
|
+
function findArgumentStringArray(argName) {
|
|
581
|
+
const arg = typescript_exports.server.findArgument(argName);
|
|
582
|
+
if (arg === void 0) {
|
|
583
|
+
return typescript_exports.emptyArray;
|
|
584
|
+
}
|
|
585
|
+
return arg.split(",").filter((name) => name !== "");
|
|
586
|
+
}
|
|
587
|
+
function start({ args, logger, cancellationToken, serverMode, unknownServerMode, startSession: startServer }, platform) {
|
|
588
|
+
logger.info(`Starting TS Server`);
|
|
589
|
+
logger.info(`Version: ${typescript_exports.version}`);
|
|
590
|
+
logger.info(`Arguments: ${args.join(" ")}`);
|
|
591
|
+
logger.info(`Platform: ${platform} NodeVersion: ${process.version} CaseSensitive: ${typescript_exports.sys.useCaseSensitiveFileNames}`);
|
|
592
|
+
logger.info(`ServerMode: ${serverMode} hasUnknownServerMode: ${unknownServerMode}`);
|
|
593
|
+
typescript_exports.setStackTraceLimit();
|
|
594
|
+
if (typescript_exports.Debug.isDebugging) {
|
|
595
|
+
typescript_exports.Debug.enableDebugInfo();
|
|
596
|
+
}
|
|
597
|
+
if (typescript_exports.sys.tryEnableSourceMapsForHost && /^development$/i.test(typescript_exports.sys.getEnvironmentVariable("NODE_ENV"))) {
|
|
598
|
+
typescript_exports.sys.tryEnableSourceMapsForHost();
|
|
599
|
+
}
|
|
600
|
+
console.log = (...args2) => logger.msg(args2.length === 1 ? args2[0] : args2.join(", "), typescript_exports.server.Msg.Info);
|
|
601
|
+
console.warn = (...args2) => logger.msg(args2.length === 1 ? args2[0] : args2.join(", "), typescript_exports.server.Msg.Err);
|
|
602
|
+
console.error = (...args2) => logger.msg(args2.length === 1 ? args2[0] : args2.join(", "), typescript_exports.server.Msg.Err);
|
|
603
|
+
startServer(
|
|
604
|
+
{
|
|
605
|
+
globalPlugins: findArgumentStringArray("--globalPlugins"),
|
|
606
|
+
pluginProbeLocations: findArgumentStringArray("--pluginProbeLocations"),
|
|
607
|
+
allowLocalPluginLoads: typescript_exports.server.hasArgument("--allowLocalPluginLoads"),
|
|
608
|
+
useSingleInferredProject: typescript_exports.server.hasArgument("--useSingleInferredProject"),
|
|
609
|
+
useInferredProjectPerProjectRoot: typescript_exports.server.hasArgument("--useInferredProjectPerProjectRoot"),
|
|
610
|
+
suppressDiagnosticEvents: typescript_exports.server.hasArgument("--suppressDiagnosticEvents"),
|
|
611
|
+
noGetErrOnBackgroundUpdate: typescript_exports.server.hasArgument("--noGetErrOnBackgroundUpdate"),
|
|
612
|
+
canUseWatchEvents: typescript_exports.server.hasArgument("--canUseWatchEvents"),
|
|
613
|
+
serverMode
|
|
614
|
+
},
|
|
615
|
+
logger,
|
|
616
|
+
cancellationToken
|
|
617
|
+
);
|
|
618
|
+
}
|
|
619
|
+
typescript_exports.setStackTraceLimit();
|
|
620
|
+
start(initializeNodeSystem(), require("os").platform());
|
|
621
|
+
//# sourceMappingURL=tsserver.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*! *****************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
4
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
5
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
8
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
9
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
10
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
11
|
+
|
|
12
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
13
|
+
and limitations under the License.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
|
|
16
|
+
import ts = require("./typescript.js");
|
|
17
|
+
export = ts;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*! *****************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
4
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
5
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
8
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
9
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
10
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
11
|
+
|
|
12
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
13
|
+
and limitations under the License.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
|
|
16
|
+
if (typeof module !== "undefined" && module.exports) {
|
|
17
|
+
module.exports = require("./typescript.js");
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
throw new Error("tsserverlibrary requires CommonJS; use typescript.js instead");
|
|
21
|
+
}
|