mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
Bump target for build scripts (#165287)
This commit is contained in:
@@ -122,8 +122,12 @@ function watchTask(out, build) {
|
||||
exports.watchTask = watchTask;
|
||||
const REPO_SRC_FOLDER = path.join(__dirname, '../../src');
|
||||
class MonacoGenerator {
|
||||
_isWatch;
|
||||
stream;
|
||||
_watchedFiles;
|
||||
_fsProvider;
|
||||
_declarationResolver;
|
||||
constructor(isWatch) {
|
||||
this._executeSoonTimer = null;
|
||||
this._isWatch = isWatch;
|
||||
this.stream = es.through();
|
||||
this._watchedFiles = {};
|
||||
@@ -153,6 +157,7 @@ class MonacoGenerator {
|
||||
});
|
||||
}
|
||||
}
|
||||
_executeSoonTimer = null;
|
||||
_executeSoon() {
|
||||
if (this._executeSoonTimer !== null) {
|
||||
clearTimeout(this._executeSoonTimer);
|
||||
|
||||
+53
-48
@@ -63,8 +63,8 @@ var BundledFormat;
|
||||
BundledFormat.is = is;
|
||||
})(BundledFormat || (BundledFormat = {}));
|
||||
class Line {
|
||||
buffer = [];
|
||||
constructor(indent = 0) {
|
||||
this.buffer = [];
|
||||
if (indent > 0) {
|
||||
this.buffer.push(new Array(indent + 1).join(' '));
|
||||
}
|
||||
@@ -79,6 +79,7 @@ class Line {
|
||||
}
|
||||
exports.Line = Line;
|
||||
class TextModel {
|
||||
_lines;
|
||||
constructor(contents) {
|
||||
this._lines = contents.split(/\r\n|\r|\n/);
|
||||
}
|
||||
@@ -87,6 +88,10 @@ class TextModel {
|
||||
}
|
||||
}
|
||||
class XLF {
|
||||
project;
|
||||
buffer;
|
||||
files;
|
||||
numberOfMessages;
|
||||
constructor(project) {
|
||||
this.project = project;
|
||||
this.buffer = [];
|
||||
@@ -168,55 +173,55 @@ class XLF {
|
||||
line.append(content);
|
||||
this.buffer.push(line.toString());
|
||||
}
|
||||
static parse = function (xlfString) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const parser = new xml2js.Parser();
|
||||
const files = [];
|
||||
parser.parseString(xlfString, function (err, result) {
|
||||
if (err) {
|
||||
reject(new Error(`XLF parsing error: Failed to parse XLIFF string. ${err}`));
|
||||
}
|
||||
const fileNodes = result['xliff']['file'];
|
||||
if (!fileNodes) {
|
||||
reject(new Error(`XLF parsing error: XLIFF file does not contain "xliff" or "file" node(s) required for parsing.`));
|
||||
}
|
||||
fileNodes.forEach((file) => {
|
||||
const name = file.$.original;
|
||||
if (!name) {
|
||||
reject(new Error(`XLF parsing error: XLIFF file node does not contain original attribute to determine the original location of the resource file.`));
|
||||
}
|
||||
const language = file.$['target-language'];
|
||||
if (!language) {
|
||||
reject(new Error(`XLF parsing error: XLIFF file node does not contain target-language attribute to determine translated language.`));
|
||||
}
|
||||
const messages = {};
|
||||
const transUnits = file.body[0]['trans-unit'];
|
||||
if (transUnits) {
|
||||
transUnits.forEach((unit) => {
|
||||
const key = unit.$.id;
|
||||
if (!unit.target) {
|
||||
return; // No translation available
|
||||
}
|
||||
let val = unit.target[0];
|
||||
if (typeof val !== 'string') {
|
||||
// We allow empty source values so support them for translations as well.
|
||||
val = val._ ? val._ : '';
|
||||
}
|
||||
if (!key) {
|
||||
reject(new Error(`XLF parsing error: trans-unit ${JSON.stringify(unit, undefined, 0)} defined in file ${name} is missing the ID attribute.`));
|
||||
return;
|
||||
}
|
||||
messages[key] = decodeEntities(val);
|
||||
});
|
||||
files.push({ messages, name, language: language.toLowerCase() });
|
||||
}
|
||||
});
|
||||
resolve(files);
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
exports.XLF = XLF;
|
||||
XLF.parse = function (xlfString) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const parser = new xml2js.Parser();
|
||||
const files = [];
|
||||
parser.parseString(xlfString, function (err, result) {
|
||||
if (err) {
|
||||
reject(new Error(`XLF parsing error: Failed to parse XLIFF string. ${err}`));
|
||||
}
|
||||
const fileNodes = result['xliff']['file'];
|
||||
if (!fileNodes) {
|
||||
reject(new Error(`XLF parsing error: XLIFF file does not contain "xliff" or "file" node(s) required for parsing.`));
|
||||
}
|
||||
fileNodes.forEach((file) => {
|
||||
const name = file.$.original;
|
||||
if (!name) {
|
||||
reject(new Error(`XLF parsing error: XLIFF file node does not contain original attribute to determine the original location of the resource file.`));
|
||||
}
|
||||
const language = file.$['target-language'];
|
||||
if (!language) {
|
||||
reject(new Error(`XLF parsing error: XLIFF file node does not contain target-language attribute to determine translated language.`));
|
||||
}
|
||||
const messages = {};
|
||||
const transUnits = file.body[0]['trans-unit'];
|
||||
if (transUnits) {
|
||||
transUnits.forEach((unit) => {
|
||||
const key = unit.$.id;
|
||||
if (!unit.target) {
|
||||
return; // No translation available
|
||||
}
|
||||
let val = unit.target[0];
|
||||
if (typeof val !== 'string') {
|
||||
// We allow empty source values so support them for translations as well.
|
||||
val = val._ ? val._ : '';
|
||||
}
|
||||
if (!key) {
|
||||
reject(new Error(`XLF parsing error: trans-unit ${JSON.stringify(unit, undefined, 0)} defined in file ${name} is missing the ID attribute.`));
|
||||
return;
|
||||
}
|
||||
messages[key] = decodeEntities(val);
|
||||
});
|
||||
files.push({ messages, name, language: language.toLowerCase() });
|
||||
}
|
||||
});
|
||||
resolve(files);
|
||||
});
|
||||
});
|
||||
};
|
||||
function sortLanguages(languages) {
|
||||
return languages.sort((a, b) => {
|
||||
return a.id < b.id ? -1 : (a.id > b.id ? 1 : 0);
|
||||
|
||||
@@ -492,12 +492,17 @@ class FSProvider {
|
||||
}
|
||||
exports.FSProvider = FSProvider;
|
||||
class CacheEntry {
|
||||
sourceFile;
|
||||
mtime;
|
||||
constructor(sourceFile, mtime) {
|
||||
this.sourceFile = sourceFile;
|
||||
this.mtime = mtime;
|
||||
}
|
||||
}
|
||||
class DeclarationResolver {
|
||||
_fsProvider;
|
||||
ts;
|
||||
_sourceFileCache;
|
||||
constructor(_fsProvider) {
|
||||
this._fsProvider = _fsProvider;
|
||||
this.ts = require('typescript');
|
||||
@@ -553,6 +558,10 @@ function run3(resolver) {
|
||||
}
|
||||
exports.run3 = run3;
|
||||
class TypeScriptLanguageServiceHost {
|
||||
_ts;
|
||||
_libs;
|
||||
_files;
|
||||
_compilerOptions;
|
||||
constructor(ts, libs, files, compilerOptions) {
|
||||
this._ts = ts;
|
||||
this._libs = libs;
|
||||
|
||||
+12
-6
@@ -95,18 +95,22 @@ var _nls;
|
||||
return { line: position.line - 1, character: position.column };
|
||||
}
|
||||
class SingleFileServiceHost {
|
||||
options;
|
||||
filename;
|
||||
file;
|
||||
lib;
|
||||
constructor(ts, options, filename, contents) {
|
||||
this.options = options;
|
||||
this.filename = filename;
|
||||
this.getCompilationSettings = () => this.options;
|
||||
this.getScriptFileNames = () => [this.filename];
|
||||
this.getScriptVersion = () => '1';
|
||||
this.getScriptSnapshot = (name) => name === this.filename ? this.file : this.lib;
|
||||
this.getCurrentDirectory = () => '';
|
||||
this.getDefaultLibFileName = () => 'lib.d.ts';
|
||||
this.file = ts.ScriptSnapshot.fromString(contents);
|
||||
this.lib = ts.ScriptSnapshot.fromString('');
|
||||
}
|
||||
getCompilationSettings = () => this.options;
|
||||
getScriptFileNames = () => [this.filename];
|
||||
getScriptVersion = () => '1';
|
||||
getScriptSnapshot = (name) => name === this.filename ? this.file : this.lib;
|
||||
getCurrentDirectory = () => '';
|
||||
getDefaultLibFileName = () => 'lib.d.ts';
|
||||
readFile(path, _encoding) {
|
||||
if (path === this.filename) {
|
||||
return this.file.getText(0, this.file.getLength());
|
||||
@@ -208,6 +212,8 @@ var _nls;
|
||||
};
|
||||
}
|
||||
class TextModel {
|
||||
lines;
|
||||
lineEndings;
|
||||
constructor(contents) {
|
||||
const regex = /\r\n|\r|\n/g;
|
||||
let index = 0;
|
||||
|
||||
@@ -41,6 +41,12 @@ function renderADMLString(prefix, moduleName, nlsString, translations) {
|
||||
return `<string id="${prefix}_${nlsString.nlsKey}">${value}</string>`;
|
||||
}
|
||||
class BasePolicy {
|
||||
policyType;
|
||||
name;
|
||||
category;
|
||||
minimumVersion;
|
||||
description;
|
||||
moduleName;
|
||||
constructor(policyType, name, category, minimumVersion, description, moduleName) {
|
||||
this.policyType = policyType;
|
||||
this.name = name;
|
||||
@@ -96,6 +102,7 @@ class BooleanPolicy extends BasePolicy {
|
||||
}
|
||||
}
|
||||
class IntPolicy extends BasePolicy {
|
||||
defaultValue;
|
||||
static from(name, category, minimumVersion, description, moduleName, settingNode) {
|
||||
const type = getStringProperty(settingNode, 'type');
|
||||
if (type !== 'number') {
|
||||
@@ -140,6 +147,8 @@ class StringPolicy extends BasePolicy {
|
||||
}
|
||||
}
|
||||
class StringEnumPolicy extends BasePolicy {
|
||||
enum_;
|
||||
enumDescriptions;
|
||||
static from(name, category, minimumVersion, description, moduleName, settingNode) {
|
||||
const type = getStringProperty(settingNode, 'type');
|
||||
if (type !== 'string') {
|
||||
|
||||
@@ -12,12 +12,13 @@ const ansiColors = require("ansi-colors");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
class ErrorLog {
|
||||
id;
|
||||
constructor(id) {
|
||||
this.id = id;
|
||||
this.allErrors = [];
|
||||
this.startTime = null;
|
||||
this.count = 0;
|
||||
}
|
||||
allErrors = [];
|
||||
startTime = null;
|
||||
count = 0;
|
||||
onStart() {
|
||||
if (this.count++ > 0) {
|
||||
return;
|
||||
|
||||
@@ -9,6 +9,9 @@ const es = require("event-stream");
|
||||
const fancyLog = require("fancy-log");
|
||||
const ansiColors = require("ansi-colors");
|
||||
class Entry {
|
||||
name;
|
||||
totalCount;
|
||||
totalSize;
|
||||
constructor(name, totalCount, totalSize) {
|
||||
this.name = name;
|
||||
this.totalCount = totalCount;
|
||||
|
||||
@@ -163,6 +163,10 @@ function processLibFiles(ts, options) {
|
||||
* A TypeScript language service host
|
||||
*/
|
||||
class TypeScriptLanguageServiceHost {
|
||||
_ts;
|
||||
_libs;
|
||||
_files;
|
||||
_compilerOptions;
|
||||
constructor(ts, libs, files, compilerOptions) {
|
||||
this._ts = ts;
|
||||
this._libs = libs;
|
||||
@@ -747,6 +751,8 @@ function findSymbolFromHeritageType(ts, checker, type) {
|
||||
return null;
|
||||
}
|
||||
class SymbolImportTuple {
|
||||
symbol;
|
||||
symbolImportNode;
|
||||
constructor(symbol, symbolImportNode) {
|
||||
this.symbol = symbol;
|
||||
this.symbolImportNode = symbolImportNode;
|
||||
|
||||
@@ -299,6 +299,8 @@ function createTypeScriptBuilder(config, projectFile, cmd) {
|
||||
}
|
||||
exports.createTypeScriptBuilder = createTypeScriptBuilder;
|
||||
class ScriptSnapshot {
|
||||
_text;
|
||||
_mtime;
|
||||
constructor(text, mtime) {
|
||||
this._text = text;
|
||||
this._mtime = mtime;
|
||||
@@ -317,6 +319,7 @@ class ScriptSnapshot {
|
||||
}
|
||||
}
|
||||
class VinylScriptSnapshot extends ScriptSnapshot {
|
||||
_base;
|
||||
constructor(file) {
|
||||
super(file.contents.toString(), file.stat.mtime);
|
||||
this._base = file.base;
|
||||
@@ -326,15 +329,20 @@ class VinylScriptSnapshot extends ScriptSnapshot {
|
||||
}
|
||||
}
|
||||
class LanguageServiceHost {
|
||||
_cmdLine;
|
||||
_projectPath;
|
||||
_log;
|
||||
_snapshots;
|
||||
_filesInProject;
|
||||
_filesAdded;
|
||||
_dependencies;
|
||||
_dependenciesRecomputeList;
|
||||
_fileNameToDeclaredModule;
|
||||
_projectVersion;
|
||||
constructor(_cmdLine, _projectPath, _log) {
|
||||
this._cmdLine = _cmdLine;
|
||||
this._projectPath = _projectPath;
|
||||
this._log = _log;
|
||||
this.directoryExists = ts.sys.directoryExists;
|
||||
this.getDirectories = ts.sys.getDirectories;
|
||||
this.fileExists = ts.sys.fileExists;
|
||||
this.readFile = ts.sys.readFile;
|
||||
this.readDirectory = ts.sys.readDirectory;
|
||||
this._snapshots = Object.create(null);
|
||||
this._filesInProject = new Set(_cmdLine.fileNames);
|
||||
this._filesAdded = new Set();
|
||||
@@ -389,6 +397,7 @@ class LanguageServiceHost {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
static _declareModule = /declare\s+module\s+('|")(.+)\1/g;
|
||||
addScriptSnapshot(filename, snapshot) {
|
||||
this._projectVersion++;
|
||||
filename = normalize(filename);
|
||||
@@ -432,6 +441,11 @@ class LanguageServiceHost {
|
||||
getDefaultLibFileName(options) {
|
||||
return ts.getDefaultLibFilePath(options);
|
||||
}
|
||||
directoryExists = ts.sys.directoryExists;
|
||||
getDirectories = ts.sys.getDirectories;
|
||||
fileExists = ts.sys.fileExists;
|
||||
readFile = ts.sys.readFile;
|
||||
readDirectory = ts.sys.readDirectory;
|
||||
// ---- dependency management
|
||||
collectDependents(filename, target) {
|
||||
while (this._dependenciesRecomputeList.length) {
|
||||
@@ -488,4 +502,3 @@ class LanguageServiceHost {
|
||||
});
|
||||
}
|
||||
}
|
||||
LanguageServiceHost._declareModule = /declare\s+module\s+('|")(.+)\1/g;
|
||||
|
||||
+55
-46
@@ -3,7 +3,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SwcTranspiler = exports.TscTranspiler = void 0;
|
||||
const swc = require("@swc/core");
|
||||
@@ -39,6 +38,7 @@ if (!threads.isMainThread) {
|
||||
});
|
||||
}
|
||||
class OutputFileNameOracle {
|
||||
getOutputFileName;
|
||||
constructor(cmdLine, configFilePath) {
|
||||
this.getOutputFileName = (file) => {
|
||||
try {
|
||||
@@ -68,10 +68,12 @@ class OutputFileNameOracle {
|
||||
}
|
||||
}
|
||||
class TranspileWorker {
|
||||
static pool = 1;
|
||||
id = TranspileWorker.pool++;
|
||||
_worker = new threads.Worker(__filename);
|
||||
_pending;
|
||||
_durations = [];
|
||||
constructor(outFileFn) {
|
||||
this.id = TranspileWorker.pool++;
|
||||
this._worker = new threads.Worker(__filename);
|
||||
this._durations = [];
|
||||
this._worker.addListener('message', (res) => {
|
||||
if (!this._pending) {
|
||||
console.error('RECEIVING data WITHOUT request');
|
||||
@@ -142,14 +144,18 @@ class TranspileWorker {
|
||||
});
|
||||
}
|
||||
}
|
||||
TranspileWorker.pool = 1;
|
||||
class TscTranspiler {
|
||||
_onError;
|
||||
_cmdLine;
|
||||
static P = Math.floor((0, node_os_1.cpus)().length * .5);
|
||||
_outputFileNames;
|
||||
onOutfile;
|
||||
_workerPool = [];
|
||||
_queue = [];
|
||||
_allJobs = [];
|
||||
constructor(logFn, _onError, configFilePath, _cmdLine) {
|
||||
this._onError = _onError;
|
||||
this._cmdLine = _cmdLine;
|
||||
this._workerPool = [];
|
||||
this._queue = [];
|
||||
this._allJobs = [];
|
||||
logFn('Transpile', `will use ${TscTranspiler.P} transpile worker`);
|
||||
this._outputFileNames = new OutputFileNameOracle(_cmdLine, configFilePath);
|
||||
}
|
||||
@@ -218,7 +224,6 @@ class TscTranspiler {
|
||||
}
|
||||
}
|
||||
exports.TscTranspiler = TscTranspiler;
|
||||
TscTranspiler.P = Math.floor((0, node_os_1.cpus)().length * .5);
|
||||
function _isDefaultEmpty(src) {
|
||||
return src
|
||||
.replace('"use strict";', '')
|
||||
@@ -226,11 +231,16 @@ function _isDefaultEmpty(src) {
|
||||
.trim().length === 0;
|
||||
}
|
||||
class SwcTranspiler {
|
||||
_logFn;
|
||||
_onError;
|
||||
_cmdLine;
|
||||
onOutfile;
|
||||
_outputFileNames;
|
||||
_jobs = [];
|
||||
constructor(_logFn, _onError, configFilePath, _cmdLine) {
|
||||
this._logFn = _logFn;
|
||||
this._onError = _onError;
|
||||
this._cmdLine = _cmdLine;
|
||||
this._jobs = [];
|
||||
_logFn('Transpile', `will use SWC to transpile source files`);
|
||||
this._outputFileNames = new OutputFileNameOracle(_cmdLine, configFilePath);
|
||||
}
|
||||
@@ -274,41 +284,40 @@ class SwcTranspiler {
|
||||
this._onError(err);
|
||||
}));
|
||||
}
|
||||
// --- .swcrc
|
||||
static _swcrcAmd = {
|
||||
exclude: '\.js$',
|
||||
jsc: {
|
||||
parser: {
|
||||
syntax: 'typescript',
|
||||
tsx: false,
|
||||
decorators: true
|
||||
},
|
||||
target: 'es2020',
|
||||
loose: false,
|
||||
minify: {
|
||||
compress: false,
|
||||
mangle: false
|
||||
}
|
||||
},
|
||||
module: {
|
||||
type: 'amd',
|
||||
noInterop: true
|
||||
},
|
||||
minify: false,
|
||||
};
|
||||
static _swcrcCommonJS = {
|
||||
...this._swcrcAmd,
|
||||
module: {
|
||||
type: 'commonjs',
|
||||
importInterop: 'none'
|
||||
}
|
||||
};
|
||||
static _swcrcEsm = {
|
||||
...this._swcrcAmd,
|
||||
module: {
|
||||
type: 'es6'
|
||||
}
|
||||
};
|
||||
}
|
||||
exports.SwcTranspiler = SwcTranspiler;
|
||||
_a = SwcTranspiler;
|
||||
// --- .swcrc
|
||||
SwcTranspiler._swcrcAmd = {
|
||||
exclude: '\.js$',
|
||||
jsc: {
|
||||
parser: {
|
||||
syntax: 'typescript',
|
||||
tsx: false,
|
||||
decorators: true
|
||||
},
|
||||
target: 'es2020',
|
||||
loose: false,
|
||||
minify: {
|
||||
compress: false,
|
||||
mangle: false
|
||||
}
|
||||
},
|
||||
module: {
|
||||
type: 'amd',
|
||||
noInterop: true
|
||||
},
|
||||
minify: false,
|
||||
};
|
||||
SwcTranspiler._swcrcCommonJS = {
|
||||
..._a._swcrcAmd,
|
||||
module: {
|
||||
type: 'commonjs',
|
||||
importInterop: 'none'
|
||||
}
|
||||
};
|
||||
SwcTranspiler._swcrcEsm = {
|
||||
..._a._swcrcAmd,
|
||||
module: {
|
||||
type: 'es6'
|
||||
}
|
||||
};
|
||||
|
||||
@@ -71,9 +71,10 @@ var graph;
|
||||
}
|
||||
graph.newNode = newNode;
|
||||
class Graph {
|
||||
_hashFn;
|
||||
_nodes = {};
|
||||
constructor(_hashFn) {
|
||||
this._hashFn = _hashFn;
|
||||
this._nodes = {};
|
||||
// empty
|
||||
}
|
||||
traverse(start, inwards, callback) {
|
||||
|
||||
Reference in New Issue
Block a user