Skip to content

Commit e7e403d

Browse files
authored
Bump target for build scripts (#165287)
1 parent 640bcd7 commit e7e403d

12 files changed

+177
-111
lines changed

build/lib/compilation.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,12 @@ function watchTask(out, build) {
122122
exports.watchTask = watchTask;
123123
const REPO_SRC_FOLDER = path.join(__dirname, '../../src');
124124
class MonacoGenerator {
125+
_isWatch;
126+
stream;
127+
_watchedFiles;
128+
_fsProvider;
129+
_declarationResolver;
125130
constructor(isWatch) {
126-
this._executeSoonTimer = null;
127131
this._isWatch = isWatch;
128132
this.stream = es.through();
129133
this._watchedFiles = {};
@@ -153,6 +157,7 @@ class MonacoGenerator {
153157
});
154158
}
155159
}
160+
_executeSoonTimer = null;
156161
_executeSoon() {
157162
if (this._executeSoonTimer !== null) {
158163
clearTimeout(this._executeSoonTimer);

build/lib/i18n.js

+51-46
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ var BundledFormat;
6363
BundledFormat.is = is;
6464
})(BundledFormat || (BundledFormat = {}));
6565
class Line {
66+
buffer = [];
6667
constructor(indent = 0) {
67-
this.buffer = [];
6868
if (indent > 0) {
6969
this.buffer.push(new Array(indent + 1).join(' '));
7070
}
@@ -79,6 +79,7 @@ class Line {
7979
}
8080
exports.Line = Line;
8181
class TextModel {
82+
_lines;
8283
constructor(contents) {
8384
this._lines = contents.split(/\r\n|\r|\n/);
8485
}
@@ -87,6 +88,10 @@ class TextModel {
8788
}
8889
}
8990
class XLF {
91+
project;
92+
buffer;
93+
files;
94+
numberOfMessages;
9095
constructor(project) {
9196
this.project = project;
9297
this.buffer = [];
@@ -168,55 +173,55 @@ class XLF {
168173
line.append(content);
169174
this.buffer.push(line.toString());
170175
}
171-
}
172-
exports.XLF = XLF;
173-
XLF.parse = function (xlfString) {
174-
return new Promise((resolve, reject) => {
175-
const parser = new xml2js.Parser();
176-
const files = [];
177-
parser.parseString(xlfString, function (err, result) {
178-
if (err) {
179-
reject(new Error(`XLF parsing error: Failed to parse XLIFF string. ${err}`));
180-
}
181-
const fileNodes = result['xliff']['file'];
182-
if (!fileNodes) {
183-
reject(new Error(`XLF parsing error: XLIFF file does not contain "xliff" or "file" node(s) required for parsing.`));
184-
}
185-
fileNodes.forEach((file) => {
186-
const name = file.$.original;
187-
if (!name) {
188-
reject(new Error(`XLF parsing error: XLIFF file node does not contain original attribute to determine the original location of the resource file.`));
176+
static parse = function (xlfString) {
177+
return new Promise((resolve, reject) => {
178+
const parser = new xml2js.Parser();
179+
const files = [];
180+
parser.parseString(xlfString, function (err, result) {
181+
if (err) {
182+
reject(new Error(`XLF parsing error: Failed to parse XLIFF string. ${err}`));
189183
}
190-
const language = file.$['target-language'];
191-
if (!language) {
192-
reject(new Error(`XLF parsing error: XLIFF file node does not contain target-language attribute to determine translated language.`));
193-
}
194-
const messages = {};
195-
const transUnits = file.body[0]['trans-unit'];
196-
if (transUnits) {
197-
transUnits.forEach((unit) => {
198-
const key = unit.$.id;
199-
if (!unit.target) {
200-
return; // No translation available
201-
}
202-
let val = unit.target[0];
203-
if (typeof val !== 'string') {
204-
// We allow empty source values so support them for translations as well.
205-
val = val._ ? val._ : '';
206-
}
207-
if (!key) {
208-
reject(new Error(`XLF parsing error: trans-unit ${JSON.stringify(unit, undefined, 0)} defined in file ${name} is missing the ID attribute.`));
209-
return;
210-
}
211-
messages[key] = decodeEntities(val);
212-
});
213-
files.push({ messages, name, language: language.toLowerCase() });
184+
const fileNodes = result['xliff']['file'];
185+
if (!fileNodes) {
186+
reject(new Error(`XLF parsing error: XLIFF file does not contain "xliff" or "file" node(s) required for parsing.`));
214187
}
188+
fileNodes.forEach((file) => {
189+
const name = file.$.original;
190+
if (!name) {
191+
reject(new Error(`XLF parsing error: XLIFF file node does not contain original attribute to determine the original location of the resource file.`));
192+
}
193+
const language = file.$['target-language'];
194+
if (!language) {
195+
reject(new Error(`XLF parsing error: XLIFF file node does not contain target-language attribute to determine translated language.`));
196+
}
197+
const messages = {};
198+
const transUnits = file.body[0]['trans-unit'];
199+
if (transUnits) {
200+
transUnits.forEach((unit) => {
201+
const key = unit.$.id;
202+
if (!unit.target) {
203+
return; // No translation available
204+
}
205+
let val = unit.target[0];
206+
if (typeof val !== 'string') {
207+
// We allow empty source values so support them for translations as well.
208+
val = val._ ? val._ : '';
209+
}
210+
if (!key) {
211+
reject(new Error(`XLF parsing error: trans-unit ${JSON.stringify(unit, undefined, 0)} defined in file ${name} is missing the ID attribute.`));
212+
return;
213+
}
214+
messages[key] = decodeEntities(val);
215+
});
216+
files.push({ messages, name, language: language.toLowerCase() });
217+
}
218+
});
219+
resolve(files);
215220
});
216-
resolve(files);
217221
});
218-
});
219-
};
222+
};
223+
}
224+
exports.XLF = XLF;
220225
function sortLanguages(languages) {
221226
return languages.sort((a, b) => {
222227
return a.id < b.id ? -1 : (a.id > b.id ? 1 : 0);

build/lib/monaco-api.js

+9
Original file line numberDiff line numberDiff line change
@@ -492,12 +492,17 @@ class FSProvider {
492492
}
493493
exports.FSProvider = FSProvider;
494494
class CacheEntry {
495+
sourceFile;
496+
mtime;
495497
constructor(sourceFile, mtime) {
496498
this.sourceFile = sourceFile;
497499
this.mtime = mtime;
498500
}
499501
}
500502
class DeclarationResolver {
503+
_fsProvider;
504+
ts;
505+
_sourceFileCache;
501506
constructor(_fsProvider) {
502507
this._fsProvider = _fsProvider;
503508
this.ts = require('typescript');
@@ -553,6 +558,10 @@ function run3(resolver) {
553558
}
554559
exports.run3 = run3;
555560
class TypeScriptLanguageServiceHost {
561+
_ts;
562+
_libs;
563+
_files;
564+
_compilerOptions;
556565
constructor(ts, libs, files, compilerOptions) {
557566
this._ts = ts;
558567
this._libs = libs;

build/lib/nls.js

+12-6
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,22 @@ var _nls;
9595
return { line: position.line - 1, character: position.column };
9696
}
9797
class SingleFileServiceHost {
98+
options;
99+
filename;
100+
file;
101+
lib;
98102
constructor(ts, options, filename, contents) {
99103
this.options = options;
100104
this.filename = filename;
101-
this.getCompilationSettings = () => this.options;
102-
this.getScriptFileNames = () => [this.filename];
103-
this.getScriptVersion = () => '1';
104-
this.getScriptSnapshot = (name) => name === this.filename ? this.file : this.lib;
105-
this.getCurrentDirectory = () => '';
106-
this.getDefaultLibFileName = () => 'lib.d.ts';
107105
this.file = ts.ScriptSnapshot.fromString(contents);
108106
this.lib = ts.ScriptSnapshot.fromString('');
109107
}
108+
getCompilationSettings = () => this.options;
109+
getScriptFileNames = () => [this.filename];
110+
getScriptVersion = () => '1';
111+
getScriptSnapshot = (name) => name === this.filename ? this.file : this.lib;
112+
getCurrentDirectory = () => '';
113+
getDefaultLibFileName = () => 'lib.d.ts';
110114
readFile(path, _encoding) {
111115
if (path === this.filename) {
112116
return this.file.getText(0, this.file.getLength());
@@ -208,6 +212,8 @@ var _nls;
208212
};
209213
}
210214
class TextModel {
215+
lines;
216+
lineEndings;
211217
constructor(contents) {
212218
const regex = /\r\n|\r|\n/g;
213219
let index = 0;

build/lib/policies.js

+9
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ function renderADMLString(prefix, moduleName, nlsString, translations) {
4141
return `<string id="${prefix}_${nlsString.nlsKey}">${value}</string>`;
4242
}
4343
class BasePolicy {
44+
policyType;
45+
name;
46+
category;
47+
minimumVersion;
48+
description;
49+
moduleName;
4450
constructor(policyType, name, category, minimumVersion, description, moduleName) {
4551
this.policyType = policyType;
4652
this.name = name;
@@ -96,6 +102,7 @@ class BooleanPolicy extends BasePolicy {
96102
}
97103
}
98104
class IntPolicy extends BasePolicy {
105+
defaultValue;
99106
static from(name, category, minimumVersion, description, moduleName, settingNode) {
100107
const type = getStringProperty(settingNode, 'type');
101108
if (type !== 'number') {
@@ -140,6 +147,8 @@ class StringPolicy extends BasePolicy {
140147
}
141148
}
142149
class StringEnumPolicy extends BasePolicy {
150+
enum_;
151+
enumDescriptions;
143152
static from(name, category, minimumVersion, description, moduleName, settingNode) {
144153
const type = getStringProperty(settingNode, 'type');
145154
if (type !== 'string') {

build/lib/reporter.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ const ansiColors = require("ansi-colors");
1212
const fs = require("fs");
1313
const path = require("path");
1414
class ErrorLog {
15+
id;
1516
constructor(id) {
1617
this.id = id;
17-
this.allErrors = [];
18-
this.startTime = null;
19-
this.count = 0;
2018
}
19+
allErrors = [];
20+
startTime = null;
21+
count = 0;
2122
onStart() {
2223
if (this.count++ > 0) {
2324
return;

build/lib/stats.js

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ const es = require("event-stream");
99
const fancyLog = require("fancy-log");
1010
const ansiColors = require("ansi-colors");
1111
class Entry {
12+
name;
13+
totalCount;
14+
totalSize;
1215
constructor(name, totalCount, totalSize) {
1316
this.name = name;
1417
this.totalCount = totalCount;

build/lib/treeshaking.js

+6
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ function processLibFiles(ts, options) {
163163
* A TypeScript language service host
164164
*/
165165
class TypeScriptLanguageServiceHost {
166+
_ts;
167+
_libs;
168+
_files;
169+
_compilerOptions;
166170
constructor(ts, libs, files, compilerOptions) {
167171
this._ts = ts;
168172
this._libs = libs;
@@ -747,6 +751,8 @@ function findSymbolFromHeritageType(ts, checker, type) {
747751
return null;
748752
}
749753
class SymbolImportTuple {
754+
symbol;
755+
symbolImportNode;
750756
constructor(symbol, symbolImportNode) {
751757
this.symbol = symbol;
752758
this.symbolImportNode = symbolImportNode;

build/lib/tsb/builder.js

+19-6
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,8 @@ function createTypeScriptBuilder(config, projectFile, cmd) {
299299
}
300300
exports.createTypeScriptBuilder = createTypeScriptBuilder;
301301
class ScriptSnapshot {
302+
_text;
303+
_mtime;
302304
constructor(text, mtime) {
303305
this._text = text;
304306
this._mtime = mtime;
@@ -317,6 +319,7 @@ class ScriptSnapshot {
317319
}
318320
}
319321
class VinylScriptSnapshot extends ScriptSnapshot {
322+
_base;
320323
constructor(file) {
321324
super(file.contents.toString(), file.stat.mtime);
322325
this._base = file.base;
@@ -326,15 +329,20 @@ class VinylScriptSnapshot extends ScriptSnapshot {
326329
}
327330
}
328331
class LanguageServiceHost {
332+
_cmdLine;
333+
_projectPath;
334+
_log;
335+
_snapshots;
336+
_filesInProject;
337+
_filesAdded;
338+
_dependencies;
339+
_dependenciesRecomputeList;
340+
_fileNameToDeclaredModule;
341+
_projectVersion;
329342
constructor(_cmdLine, _projectPath, _log) {
330343
this._cmdLine = _cmdLine;
331344
this._projectPath = _projectPath;
332345
this._log = _log;
333-
this.directoryExists = ts.sys.directoryExists;
334-
this.getDirectories = ts.sys.getDirectories;
335-
this.fileExists = ts.sys.fileExists;
336-
this.readFile = ts.sys.readFile;
337-
this.readDirectory = ts.sys.readDirectory;
338346
this._snapshots = Object.create(null);
339347
this._filesInProject = new Set(_cmdLine.fileNames);
340348
this._filesAdded = new Set();
@@ -389,6 +397,7 @@ class LanguageServiceHost {
389397
}
390398
return result;
391399
}
400+
static _declareModule = /declare\s+module\s+('|")(.+)\1/g;
392401
addScriptSnapshot(filename, snapshot) {
393402
this._projectVersion++;
394403
filename = normalize(filename);
@@ -432,6 +441,11 @@ class LanguageServiceHost {
432441
getDefaultLibFileName(options) {
433442
return ts.getDefaultLibFilePath(options);
434443
}
444+
directoryExists = ts.sys.directoryExists;
445+
getDirectories = ts.sys.getDirectories;
446+
fileExists = ts.sys.fileExists;
447+
readFile = ts.sys.readFile;
448+
readDirectory = ts.sys.readDirectory;
435449
// ---- dependency management
436450
collectDependents(filename, target) {
437451
while (this._dependenciesRecomputeList.length) {
@@ -488,4 +502,3 @@ class LanguageServiceHost {
488502
});
489503
}
490504
}
491-
LanguageServiceHost._declareModule = /declare\s+module\s+('|")(.+)\1/g;

0 commit comments

Comments
 (0)