Merge branch 'master' into ben/sqlite
|
@ -28,7 +28,7 @@ var editorEntryPoints = [
|
|||
name: 'vs/editor/editor.main',
|
||||
include: [],
|
||||
exclude: ['vs/css', 'vs/nls'],
|
||||
prepend: ['out-build/vs/css.js', 'out-build/vs/nls.js'],
|
||||
prepend: ['out-editor-build/vs/css.js', 'out-editor-build/vs/nls.js'],
|
||||
},
|
||||
{
|
||||
name: 'vs/base/common/worker/simpleWorker',
|
||||
|
@ -79,16 +79,21 @@ gulp.task('extract-editor-src', ['clean-editor-src'], function () {
|
|||
apiusages,
|
||||
extrausages
|
||||
],
|
||||
typings: [
|
||||
'typings/lib.ie11_safe_es6.d.ts',
|
||||
'typings/thenable.d.ts',
|
||||
'typings/es6-promise.d.ts',
|
||||
'typings/require-monaco.d.ts',
|
||||
'vs/monaco.d.ts'
|
||||
],
|
||||
libs: [
|
||||
`lib.d.ts`,
|
||||
`lib.es2015.collection.d.ts`
|
||||
`lib.es5.d.ts`,
|
||||
`lib.dom.d.ts`,
|
||||
`lib.webworker.importscripts.d.ts`
|
||||
],
|
||||
redirects: {
|
||||
'vs/base/browser/ui/octiconLabel/octiconLabel': 'vs/base/browser/ui/octiconLabel/octiconLabel.mock',
|
||||
},
|
||||
compilerOptions: {
|
||||
module: 2, // ModuleKind.AMD
|
||||
},
|
||||
shakeLevel: 2, // 0-Files, 1-InnerFile, 2-ClassMembers
|
||||
importIgnorePattern: /^vs\/css!/,
|
||||
destRoot: path.join(root, 'out-editor-src')
|
||||
|
@ -108,6 +113,8 @@ gulp.task('optimize-editor', ['clean-optimized-editor', 'compile-editor-build'],
|
|||
loaderConfig: {
|
||||
paths: {
|
||||
'vs': 'out-editor-build/vs',
|
||||
'vs/css': 'out-editor-build/vs/css.build',
|
||||
'vs/nls': 'out-editor-build/vs/nls.build',
|
||||
'vscode': 'empty:'
|
||||
}
|
||||
},
|
||||
|
@ -125,7 +132,7 @@ gulp.task('clean-editor-esm', util.rimraf('out-editor-esm'));
|
|||
gulp.task('extract-editor-esm', ['clean-editor-esm', 'clean-editor-distro', 'extract-editor-src'], function () {
|
||||
standalone.createESMSourcesAndResources2({
|
||||
srcFolder: './out-editor-src',
|
||||
outFolder: './out-editor-esm/src',
|
||||
outFolder: './out-editor-esm',
|
||||
outResourcesFolder: './out-monaco-editor-core/esm',
|
||||
ignores: [
|
||||
'inlineEntryPoint:0.ts',
|
||||
|
|
|
@ -32,8 +32,12 @@ function bundle(entryPoints, config, callback) {
|
|||
var loader = loaderModule.exports;
|
||||
config.isBuild = true;
|
||||
config.paths = config.paths || {};
|
||||
config.paths['vs/nls'] = 'out-build/vs/nls.build';
|
||||
config.paths['vs/css'] = 'out-build/vs/css.build';
|
||||
if (!config.paths['vs/nls']) {
|
||||
config.paths['vs/nls'] = 'out-build/vs/nls.build';
|
||||
}
|
||||
if (!config.paths['vs/css']) {
|
||||
config.paths['vs/css'] = 'out-build/vs/css.build';
|
||||
}
|
||||
loader.config(config);
|
||||
loader(['require'], function (localRequire) {
|
||||
var resolvePath = function (path) {
|
||||
|
|
|
@ -123,8 +123,12 @@ export function bundle(entryPoints: IEntryPoint[], config: ILoaderConfig, callba
|
|||
const loader: any = loaderModule.exports;
|
||||
config.isBuild = true;
|
||||
config.paths = config.paths || {};
|
||||
config.paths['vs/nls'] = 'out-build/vs/nls.build';
|
||||
config.paths['vs/css'] = 'out-build/vs/css.build';
|
||||
if (!config.paths['vs/nls']) {
|
||||
config.paths['vs/nls'] = 'out-build/vs/nls.build';
|
||||
}
|
||||
if (!config.paths['vs/css']) {
|
||||
config.paths['vs/css'] = 'out-build/vs/css.build';
|
||||
}
|
||||
loader.config(config);
|
||||
|
||||
loader(['require'], (localRequire: any) => {
|
||||
|
|
|
@ -4,23 +4,31 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var gulp = require("gulp");
|
||||
var tsb = require("gulp-tsb");
|
||||
var es = require("event-stream");
|
||||
var watch = require('./watch');
|
||||
var nls = require("./nls");
|
||||
var util = require("./util");
|
||||
var reporter_1 = require("./reporter");
|
||||
var path = require("path");
|
||||
var fs = require("fs");
|
||||
var gulp = require("gulp");
|
||||
var bom = require("gulp-bom");
|
||||
var sourcemaps = require("gulp-sourcemaps");
|
||||
var tsb = require("gulp-tsb");
|
||||
var path = require("path");
|
||||
var _ = require("underscore");
|
||||
var monacodts = require("../monaco/api");
|
||||
var fs = require("fs");
|
||||
var nls = require("./nls");
|
||||
var reporter_1 = require("./reporter");
|
||||
var util = require("./util");
|
||||
var watch = require('./watch');
|
||||
var assign = require("object-assign");
|
||||
var reporter = reporter_1.createReporter();
|
||||
function getTypeScriptCompilerOptions(src) {
|
||||
var rootDir = path.join(__dirname, "../../" + src);
|
||||
var options = require("../../" + src + "/tsconfig.json").compilerOptions;
|
||||
var tsconfig = require("../../" + src + "/tsconfig.json");
|
||||
var options;
|
||||
if (tsconfig.extends) {
|
||||
options = assign({}, require(path.join(rootDir, tsconfig.extends)).compilerOptions, tsconfig.compilerOptions);
|
||||
}
|
||||
else {
|
||||
options = tsconfig.compilerOptions;
|
||||
}
|
||||
options.verbose = false;
|
||||
options.sourceMap = true;
|
||||
if (process.env['VSCODE_NO_SOURCEMAP']) { // To be used by developers in a hurry
|
||||
|
|
|
@ -5,25 +5,32 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
import * as gulp from 'gulp';
|
||||
import * as tsb from 'gulp-tsb';
|
||||
import * as es from 'event-stream';
|
||||
const watch = require('./watch');
|
||||
import * as nls from './nls';
|
||||
import * as util from './util';
|
||||
import { createReporter } from './reporter';
|
||||
import * as path from 'path';
|
||||
import * as fs from 'fs';
|
||||
import * as gulp from 'gulp';
|
||||
import * as bom from 'gulp-bom';
|
||||
import * as sourcemaps from 'gulp-sourcemaps';
|
||||
import * as tsb from 'gulp-tsb';
|
||||
import * as path from 'path';
|
||||
import * as _ from 'underscore';
|
||||
import * as monacodts from '../monaco/api';
|
||||
import * as fs from 'fs';
|
||||
import * as nls from './nls';
|
||||
import { createReporter } from './reporter';
|
||||
import * as util from './util';
|
||||
const watch = require('./watch');
|
||||
import assign = require('object-assign');
|
||||
|
||||
const reporter = createReporter();
|
||||
|
||||
function getTypeScriptCompilerOptions(src: string) {
|
||||
const rootDir = path.join(__dirname, `../../${src}`);
|
||||
const options = require(`../../${src}/tsconfig.json`).compilerOptions;
|
||||
const tsconfig = require(`../../${src}/tsconfig.json`);
|
||||
let options: { [key: string]: any };
|
||||
if (tsconfig.extends) {
|
||||
options = assign({}, require(path.join(rootDir, tsconfig.extends)).compilerOptions, tsconfig.compilerOptions);
|
||||
} else {
|
||||
options = tsconfig.compilerOptions;
|
||||
}
|
||||
options.verbose = false;
|
||||
options.sourceMap = true;
|
||||
if (process.env['VSCODE_NO_SOURCEMAP']) { // To be used by developers in a hurry
|
||||
|
|
|
@ -78,10 +78,6 @@
|
|||
"name": "vs/workbench/parts/logs",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/parts/navigation",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/parts/output",
|
||||
"project": "vscode-workbench"
|
||||
|
|
|
@ -27,6 +27,13 @@ function writeFile(filePath, contents) {
|
|||
fs.writeFileSync(filePath, contents);
|
||||
}
|
||||
function extractEditor(options) {
|
||||
var tsConfig = JSON.parse(fs.readFileSync(path.join(options.sourcesRoot, 'tsconfig.json')).toString());
|
||||
tsConfig.compilerOptions.noUnusedLocals = false;
|
||||
tsConfig.compilerOptions.preserveConstEnums = false;
|
||||
tsConfig.compilerOptions.declaration = false;
|
||||
delete tsConfig.compilerOptions.types;
|
||||
tsConfig.exclude = [];
|
||||
options.compilerOptions = tsConfig.compilerOptions;
|
||||
var result = tss.shake(options);
|
||||
for (var fileName in result) {
|
||||
if (result.hasOwnProperty(fileName)) {
|
||||
|
@ -73,25 +80,16 @@ function extractEditor(options) {
|
|||
}
|
||||
}
|
||||
}
|
||||
var tsConfig = JSON.parse(fs.readFileSync(path.join(options.sourcesRoot, 'tsconfig.json')).toString());
|
||||
tsConfig.compilerOptions.noUnusedLocals = false;
|
||||
tsConfig.compilerOptions.preserveConstEnums = false;
|
||||
tsConfig.compilerOptions.declaration = false;
|
||||
writeOutputFile('tsconfig.json', JSON.stringify(tsConfig, null, '\t'));
|
||||
[
|
||||
'vs/css.build.js',
|
||||
'vs/css.d.ts',
|
||||
'vs/css.js',
|
||||
'vs/loader.js',
|
||||
'vs/monaco.d.ts',
|
||||
'vs/nls.build.js',
|
||||
'vs/nls.d.ts',
|
||||
'vs/nls.js',
|
||||
'vs/nls.mock.ts',
|
||||
'typings/lib.ie11_safe_es6.d.ts',
|
||||
'typings/thenable.d.ts',
|
||||
'typings/es6-promise.d.ts',
|
||||
'typings/require.d.ts',
|
||||
].forEach(copyFile);
|
||||
}
|
||||
exports.extractEditor = extractEditor;
|
||||
|
@ -102,7 +100,7 @@ function createESMSourcesAndResources2(options) {
|
|||
var getDestAbsoluteFilePath = function (file) {
|
||||
var dest = options.renames[file.replace(/\\/g, '/')] || file;
|
||||
if (dest === 'tsconfig.json') {
|
||||
return path.join(OUT_FOLDER, "../tsconfig.json");
|
||||
return path.join(OUT_FOLDER, "tsconfig.json");
|
||||
}
|
||||
if (/\.ts$/.test(dest)) {
|
||||
return path.join(OUT_FOLDER, dest);
|
||||
|
@ -117,11 +115,8 @@ function createESMSourcesAndResources2(options) {
|
|||
}
|
||||
if (file === 'tsconfig.json') {
|
||||
var tsConfig = JSON.parse(fs.readFileSync(path.join(SRC_FOLDER, file)).toString());
|
||||
tsConfig.compilerOptions.moduleResolution = undefined;
|
||||
tsConfig.compilerOptions.baseUrl = undefined;
|
||||
tsConfig.compilerOptions.module = 'es6';
|
||||
tsConfig.compilerOptions.rootDir = 'src';
|
||||
tsConfig.compilerOptions.outDir = path.relative(path.dirname(OUT_FOLDER), OUT_RESOURCES_FOLDER);
|
||||
tsConfig.compilerOptions.outDir = path.join(path.relative(OUT_FOLDER, OUT_RESOURCES_FOLDER), 'vs');
|
||||
write(getDestAbsoluteFilePath(file), JSON.stringify(tsConfig, null, '\t'));
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,15 @@ function writeFile(filePath: string, contents: Buffer | string): void {
|
|||
}
|
||||
|
||||
export function extractEditor(options: tss.ITreeShakingOptions & { destRoot: string }): void {
|
||||
const tsConfig = JSON.parse(fs.readFileSync(path.join(options.sourcesRoot, 'tsconfig.json')).toString());
|
||||
tsConfig.compilerOptions.noUnusedLocals = false;
|
||||
tsConfig.compilerOptions.preserveConstEnums = false;
|
||||
tsConfig.compilerOptions.declaration = false;
|
||||
delete tsConfig.compilerOptions.types;
|
||||
tsConfig.exclude = [];
|
||||
|
||||
options.compilerOptions = tsConfig.compilerOptions;
|
||||
|
||||
let result = tss.shake(options);
|
||||
for (let fileName in result) {
|
||||
if (result.hasOwnProperty(fileName)) {
|
||||
|
@ -79,10 +88,6 @@ export function extractEditor(options: tss.ITreeShakingOptions & { destRoot: str
|
|||
}
|
||||
}
|
||||
|
||||
const tsConfig = JSON.parse(fs.readFileSync(path.join(options.sourcesRoot, 'tsconfig.json')).toString());
|
||||
tsConfig.compilerOptions.noUnusedLocals = false;
|
||||
tsConfig.compilerOptions.preserveConstEnums = false;
|
||||
tsConfig.compilerOptions.declaration = false;
|
||||
writeOutputFile('tsconfig.json', JSON.stringify(tsConfig, null, '\t'));
|
||||
|
||||
[
|
||||
|
@ -90,15 +95,10 @@ export function extractEditor(options: tss.ITreeShakingOptions & { destRoot: str
|
|||
'vs/css.d.ts',
|
||||
'vs/css.js',
|
||||
'vs/loader.js',
|
||||
'vs/monaco.d.ts',
|
||||
'vs/nls.build.js',
|
||||
'vs/nls.d.ts',
|
||||
'vs/nls.js',
|
||||
'vs/nls.mock.ts',
|
||||
'typings/lib.ie11_safe_es6.d.ts',
|
||||
'typings/thenable.d.ts',
|
||||
'typings/es6-promise.d.ts',
|
||||
'typings/require.d.ts',
|
||||
].forEach(copyFile);
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ export function createESMSourcesAndResources2(options: IOptions2): void {
|
|||
const getDestAbsoluteFilePath = (file: string): string => {
|
||||
let dest = options.renames[file.replace(/\\/g, '/')] || file;
|
||||
if (dest === 'tsconfig.json') {
|
||||
return path.join(OUT_FOLDER, `../tsconfig.json`);
|
||||
return path.join(OUT_FOLDER, `tsconfig.json`);
|
||||
}
|
||||
if (/\.ts$/.test(dest)) {
|
||||
return path.join(OUT_FOLDER, dest);
|
||||
|
@ -136,11 +136,8 @@ export function createESMSourcesAndResources2(options: IOptions2): void {
|
|||
|
||||
if (file === 'tsconfig.json') {
|
||||
const tsConfig = JSON.parse(fs.readFileSync(path.join(SRC_FOLDER, file)).toString());
|
||||
tsConfig.compilerOptions.moduleResolution = undefined;
|
||||
tsConfig.compilerOptions.baseUrl = undefined;
|
||||
tsConfig.compilerOptions.module = 'es6';
|
||||
tsConfig.compilerOptions.rootDir = 'src';
|
||||
tsConfig.compilerOptions.outDir = path.relative(path.dirname(OUT_FOLDER), OUT_RESOURCES_FOLDER);
|
||||
tsConfig.compilerOptions.outDir = path.join(path.relative(OUT_FOLDER, OUT_RESOURCES_FOLDER), 'vs');
|
||||
write(getDestAbsoluteFilePath(file), JSON.stringify(tsConfig, null, '\t'));
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -14,8 +14,39 @@ var ShakeLevel;
|
|||
ShakeLevel[ShakeLevel["InnerFile"] = 1] = "InnerFile";
|
||||
ShakeLevel[ShakeLevel["ClassMembers"] = 2] = "ClassMembers";
|
||||
})(ShakeLevel = exports.ShakeLevel || (exports.ShakeLevel = {}));
|
||||
function printDiagnostics(diagnostics) {
|
||||
for (var i = 0; i < diagnostics.length; i++) {
|
||||
var diag = diagnostics[i];
|
||||
var result = '';
|
||||
if (diag.file) {
|
||||
result += diag.file.fileName + ": ";
|
||||
}
|
||||
if (diag.file && diag.start) {
|
||||
var location_1 = diag.file.getLineAndCharacterOfPosition(diag.start);
|
||||
result += "- " + (location_1.line + 1) + "," + location_1.character + " - ";
|
||||
}
|
||||
result += JSON.stringify(diag.messageText);
|
||||
console.log(result);
|
||||
}
|
||||
}
|
||||
function shake(options) {
|
||||
var languageService = createTypeScriptLanguageService(options);
|
||||
var program = languageService.getProgram();
|
||||
var globalDiagnostics = program.getGlobalDiagnostics();
|
||||
if (globalDiagnostics.length > 0) {
|
||||
printDiagnostics(globalDiagnostics);
|
||||
throw new Error("Compilation Errors encountered.");
|
||||
}
|
||||
var syntacticDiagnostics = program.getSyntacticDiagnostics();
|
||||
if (syntacticDiagnostics.length > 0) {
|
||||
printDiagnostics(syntacticDiagnostics);
|
||||
throw new Error("Compilation Errors encountered.");
|
||||
}
|
||||
var semanticDiagnostics = program.getSemanticDiagnostics();
|
||||
if (semanticDiagnostics.length > 0) {
|
||||
printDiagnostics(semanticDiagnostics);
|
||||
throw new Error("Compilation Errors encountered.");
|
||||
}
|
||||
markNodes(languageService, options);
|
||||
return generateResult(languageService, options.shakeLevel);
|
||||
}
|
||||
|
@ -28,13 +59,18 @@ function createTypeScriptLanguageService(options) {
|
|||
options.inlineEntryPoints.forEach(function (inlineEntryPoint, index) {
|
||||
FILES["inlineEntryPoint:" + index + ".ts"] = inlineEntryPoint;
|
||||
});
|
||||
// Add additional typings
|
||||
options.typings.forEach(function (typing) {
|
||||
var filePath = path.join(options.sourcesRoot, typing);
|
||||
FILES[typing] = fs.readFileSync(filePath).toString();
|
||||
});
|
||||
// Resolve libs
|
||||
var RESOLVED_LIBS = {};
|
||||
options.libs.forEach(function (filename) {
|
||||
var filepath = path.join(TYPESCRIPT_LIB_FOLDER, filename);
|
||||
RESOLVED_LIBS["defaultLib:" + filename] = fs.readFileSync(filepath).toString();
|
||||
});
|
||||
var host = new TypeScriptLanguageServiceHost(RESOLVED_LIBS, FILES, options.compilerOptions);
|
||||
var host = new TypeScriptLanguageServiceHost(RESOLVED_LIBS, FILES, ts.convertCompilerOptionsFromJson(options.compilerOptions, "").options);
|
||||
return ts.createLanguageService(host);
|
||||
}
|
||||
/**
|
||||
|
@ -57,7 +93,7 @@ function discoverAndReadFiles(options) {
|
|||
var dts_filename = path.join(options.sourcesRoot, moduleId + '.d.ts');
|
||||
if (fs.existsSync(dts_filename)) {
|
||||
var dts_filecontents = fs.readFileSync(dts_filename).toString();
|
||||
FILES[moduleId + '.d.ts'] = dts_filecontents;
|
||||
FILES[moduleId + ".d.ts"] = dts_filecontents;
|
||||
continue;
|
||||
}
|
||||
var ts_filename = void 0;
|
||||
|
@ -81,7 +117,7 @@ function discoverAndReadFiles(options) {
|
|||
}
|
||||
enqueue(importedModuleId);
|
||||
}
|
||||
FILES[moduleId + '.ts'] = ts_filecontents;
|
||||
FILES[moduleId + ".ts"] = ts_filecontents;
|
||||
}
|
||||
return FILES;
|
||||
}
|
||||
|
@ -517,68 +553,9 @@ function generateResult(languageService, shakeLevel) {
|
|||
* Returns the node's symbol and the `import` node (if the symbol resolved from a different module)
|
||||
*/
|
||||
function getRealNodeSymbol(checker, node) {
|
||||
/**
|
||||
* Returns the containing object literal property declaration given a possible name node, e.g. "a" in x = { "a": 1 }
|
||||
*/
|
||||
/* @internal */
|
||||
function getContainingObjectLiteralElement(node) {
|
||||
switch (node.kind) {
|
||||
case ts.SyntaxKind.StringLiteral:
|
||||
case ts.SyntaxKind.NumericLiteral:
|
||||
if (node.parent.kind === ts.SyntaxKind.ComputedPropertyName) {
|
||||
return ts.isObjectLiteralElement(node.parent.parent) ? node.parent.parent : undefined;
|
||||
}
|
||||
// falls through
|
||||
case ts.SyntaxKind.Identifier:
|
||||
return ts.isObjectLiteralElement(node.parent) &&
|
||||
(node.parent.parent.kind === ts.SyntaxKind.ObjectLiteralExpression || node.parent.parent.kind === ts.SyntaxKind.JsxAttributes) &&
|
||||
node.parent.name === node ? node.parent : undefined;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function getPropertySymbolsFromType(type, propName) {
|
||||
function getTextOfPropertyName(name) {
|
||||
function isStringOrNumericLiteral(node) {
|
||||
var kind = node.kind;
|
||||
return kind === ts.SyntaxKind.StringLiteral
|
||||
|| kind === ts.SyntaxKind.NumericLiteral;
|
||||
}
|
||||
switch (name.kind) {
|
||||
case ts.SyntaxKind.Identifier:
|
||||
return name.text;
|
||||
case ts.SyntaxKind.StringLiteral:
|
||||
case ts.SyntaxKind.NumericLiteral:
|
||||
return name.text;
|
||||
case ts.SyntaxKind.ComputedPropertyName:
|
||||
return isStringOrNumericLiteral(name.expression) ? name.expression.text : undefined;
|
||||
}
|
||||
}
|
||||
var name = getTextOfPropertyName(propName);
|
||||
if (name && type) {
|
||||
var result = [];
|
||||
var symbol_1 = type.getProperty(name);
|
||||
if (type.flags & ts.TypeFlags.Union) {
|
||||
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
|
||||
var t = _a[_i];
|
||||
var symbol_2 = t.getProperty(name);
|
||||
if (symbol_2) {
|
||||
result.push(symbol_2);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
if (symbol_1) {
|
||||
result.push(symbol_1);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function getPropertySymbolsFromContextualType(typeChecker, node) {
|
||||
var objectLiteral = node.parent;
|
||||
var contextualType = typeChecker.getContextualType(objectLiteral);
|
||||
return getPropertySymbolsFromType(contextualType, node.name);
|
||||
}
|
||||
var getPropertySymbolsFromContextualType = ts.getPropertySymbolsFromContextualType;
|
||||
var getContainingObjectLiteralElement = ts.getContainingObjectLiteralElement;
|
||||
var getNameFromPropertyName = ts.getNameFromPropertyName;
|
||||
// Go to the original declaration for cases:
|
||||
//
|
||||
// (1) when the aliased symbol was declared in the location(parent).
|
||||
|
@ -606,8 +583,13 @@ function getRealNodeSymbol(checker, node) {
|
|||
return [null, null];
|
||||
}
|
||||
}
|
||||
var parent = node.parent;
|
||||
var symbol = checker.getSymbolAtLocation(node);
|
||||
var importNode = null;
|
||||
// If this is an alias, and the request came at the declaration location
|
||||
// get the aliased symbol instead. This allows for goto def on an import e.g.
|
||||
// import {A, B} from "mod";
|
||||
// to jump to the implementation directly.
|
||||
if (symbol && symbol.flags & ts.SymbolFlags.Alias && shouldSkipAlias(node, symbol.declarations[0])) {
|
||||
var aliased = checker.getAliasedSymbol(symbol);
|
||||
if (aliased.declarations) {
|
||||
|
@ -636,13 +618,22 @@ function getRealNodeSymbol(checker, node) {
|
|||
// pr/*destination*/op1: number
|
||||
// }
|
||||
// bar<Test>(({pr/*goto*/op1})=>{});
|
||||
if (ts.isPropertyName(node) && ts.isBindingElement(node.parent) && ts.isObjectBindingPattern(node.parent.parent) &&
|
||||
(node === (node.parent.propertyName || node.parent.name))) {
|
||||
var type = checker.getTypeAtLocation(node.parent.parent);
|
||||
if (type) {
|
||||
var propSymbols = getPropertySymbolsFromType(type, node);
|
||||
if (propSymbols) {
|
||||
symbol = propSymbols[0];
|
||||
if (ts.isPropertyName(node) && ts.isBindingElement(parent) && ts.isObjectBindingPattern(parent.parent) &&
|
||||
(node === (parent.propertyName || parent.name))) {
|
||||
var name_1 = getNameFromPropertyName(node);
|
||||
var type = checker.getTypeAtLocation(parent.parent);
|
||||
if (name_1 && type) {
|
||||
if (type.isUnion()) {
|
||||
var prop = type.types[0].getProperty(name_1);
|
||||
if (prop) {
|
||||
symbol = prop;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var prop = type.getProperty(name_1);
|
||||
if (prop) {
|
||||
symbol = prop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -656,10 +647,13 @@ function getRealNodeSymbol(checker, node) {
|
|||
// function Foo(arg: Props) {}
|
||||
// Foo( { pr/*1*/op1: 10, prop2: false })
|
||||
var element = getContainingObjectLiteralElement(node);
|
||||
if (element && checker.getContextualType(element.parent)) {
|
||||
var propertySymbols = getPropertySymbolsFromContextualType(checker, element);
|
||||
if (propertySymbols) {
|
||||
symbol = propertySymbols[0];
|
||||
if (element) {
|
||||
var contextualType = element && checker.getContextualType(element.parent);
|
||||
if (contextualType) {
|
||||
var propertySymbols = getPropertySymbolsFromContextualType(element, checker, contextualType, /*unionSymbolOk*/ false);
|
||||
if (propertySymbols) {
|
||||
symbol = propertySymbols[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,10 +36,14 @@ export interface ITreeShakingOptions {
|
|||
* e.g. `lib.d.ts`, `lib.es2015.collection.d.ts`
|
||||
*/
|
||||
libs: string[];
|
||||
/**
|
||||
* Other .d.ts files
|
||||
*/
|
||||
typings: string[];
|
||||
/**
|
||||
* TypeScript compiler options.
|
||||
*/
|
||||
compilerOptions: ts.CompilerOptions;
|
||||
compilerOptions?: any;
|
||||
/**
|
||||
* The shake level to perform.
|
||||
*/
|
||||
|
@ -56,8 +60,43 @@ export interface ITreeShakingResult {
|
|||
[file: string]: string;
|
||||
}
|
||||
|
||||
function printDiagnostics(diagnostics: ReadonlyArray<ts.Diagnostic>): void {
|
||||
for (let i = 0; i < diagnostics.length; i++) {
|
||||
const diag = diagnostics[i];
|
||||
let result = '';
|
||||
if (diag.file) {
|
||||
result += `${diag.file.fileName}: `;
|
||||
}
|
||||
if (diag.file && diag.start) {
|
||||
let location = diag.file.getLineAndCharacterOfPosition(diag.start);
|
||||
result += `- ${location.line + 1},${location.character} - `
|
||||
}
|
||||
result += JSON.stringify(diag.messageText);
|
||||
console.log(result);
|
||||
}
|
||||
}
|
||||
|
||||
export function shake(options: ITreeShakingOptions): ITreeShakingResult {
|
||||
const languageService = createTypeScriptLanguageService(options);
|
||||
const program = languageService.getProgram()!;
|
||||
|
||||
const globalDiagnostics = program.getGlobalDiagnostics();
|
||||
if (globalDiagnostics.length > 0) {
|
||||
printDiagnostics(globalDiagnostics);
|
||||
throw new Error(`Compilation Errors encountered.`);
|
||||
}
|
||||
|
||||
const syntacticDiagnostics = program.getSyntacticDiagnostics();
|
||||
if (syntacticDiagnostics.length > 0) {
|
||||
printDiagnostics(syntacticDiagnostics);
|
||||
throw new Error(`Compilation Errors encountered.`);
|
||||
}
|
||||
|
||||
const semanticDiagnostics = program.getSemanticDiagnostics();
|
||||
if (semanticDiagnostics.length > 0) {
|
||||
printDiagnostics(semanticDiagnostics);
|
||||
throw new Error(`Compilation Errors encountered.`);
|
||||
}
|
||||
|
||||
markNodes(languageService, options);
|
||||
|
||||
|
@ -74,6 +113,12 @@ function createTypeScriptLanguageService(options: ITreeShakingOptions): ts.Langu
|
|||
FILES[`inlineEntryPoint:${index}.ts`] = inlineEntryPoint;
|
||||
});
|
||||
|
||||
// Add additional typings
|
||||
options.typings.forEach((typing) => {
|
||||
const filePath = path.join(options.sourcesRoot, typing);
|
||||
FILES[typing] = fs.readFileSync(filePath).toString();
|
||||
});
|
||||
|
||||
// Resolve libs
|
||||
const RESOLVED_LIBS: ILibMap = {};
|
||||
options.libs.forEach((filename) => {
|
||||
|
@ -81,7 +126,7 @@ function createTypeScriptLanguageService(options: ITreeShakingOptions): ts.Langu
|
|||
RESOLVED_LIBS[`defaultLib:${filename}`] = fs.readFileSync(filepath).toString();
|
||||
});
|
||||
|
||||
const host = new TypeScriptLanguageServiceHost(RESOLVED_LIBS, FILES, options.compilerOptions);
|
||||
const host = new TypeScriptLanguageServiceHost(RESOLVED_LIBS, FILES, ts.convertCompilerOptionsFromJson(options.compilerOptions, ``).options);
|
||||
return ts.createLanguageService(host);
|
||||
}
|
||||
|
||||
|
@ -109,7 +154,7 @@ function discoverAndReadFiles(options: ITreeShakingOptions): IFileMap {
|
|||
const dts_filename = path.join(options.sourcesRoot, moduleId + '.d.ts');
|
||||
if (fs.existsSync(dts_filename)) {
|
||||
const dts_filecontents = fs.readFileSync(dts_filename).toString();
|
||||
FILES[moduleId + '.d.ts'] = dts_filecontents;
|
||||
FILES[`${moduleId}.d.ts`] = dts_filecontents;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -136,7 +181,7 @@ function discoverAndReadFiles(options: ITreeShakingOptions): IFileMap {
|
|||
enqueue(importedModuleId);
|
||||
}
|
||||
|
||||
FILES[moduleId + '.ts'] = ts_filecontents;
|
||||
FILES[`${moduleId}.ts`] = ts_filecontents;
|
||||
}
|
||||
|
||||
return FILES;
|
||||
|
@ -636,73 +681,12 @@ function generateResult(languageService: ts.LanguageService, shakeLevel: ShakeLe
|
|||
* Returns the node's symbol and the `import` node (if the symbol resolved from a different module)
|
||||
*/
|
||||
function getRealNodeSymbol(checker: ts.TypeChecker, node: ts.Node): [ts.Symbol | null, ts.Declaration | null] {
|
||||
/**
|
||||
* Returns the containing object literal property declaration given a possible name node, e.g. "a" in x = { "a": 1 }
|
||||
*/
|
||||
/* @internal */
|
||||
function getContainingObjectLiteralElement(node: ts.Node): ts.ObjectLiteralElement | undefined {
|
||||
switch (node.kind) {
|
||||
case ts.SyntaxKind.StringLiteral:
|
||||
case ts.SyntaxKind.NumericLiteral:
|
||||
if (node.parent.kind === ts.SyntaxKind.ComputedPropertyName) {
|
||||
return ts.isObjectLiteralElement(node.parent.parent) ? node.parent.parent : undefined;
|
||||
}
|
||||
// falls through
|
||||
case ts.SyntaxKind.Identifier:
|
||||
return ts.isObjectLiteralElement(node.parent) &&
|
||||
(node.parent.parent.kind === ts.SyntaxKind.ObjectLiteralExpression || node.parent.parent.kind === ts.SyntaxKind.JsxAttributes) &&
|
||||
node.parent.name === node ? node.parent : undefined;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function getPropertySymbolsFromType(type: ts.Type, propName: ts.PropertyName) {
|
||||
function getTextOfPropertyName(name: ts.PropertyName): string {
|
||||
|
||||
function isStringOrNumericLiteral(node: ts.Node): node is ts.StringLiteral | ts.NumericLiteral {
|
||||
const kind = node.kind;
|
||||
return kind === ts.SyntaxKind.StringLiteral
|
||||
|| kind === ts.SyntaxKind.NumericLiteral;
|
||||
}
|
||||
|
||||
switch (name.kind) {
|
||||
case ts.SyntaxKind.Identifier:
|
||||
return name.text;
|
||||
case ts.SyntaxKind.StringLiteral:
|
||||
case ts.SyntaxKind.NumericLiteral:
|
||||
return name.text;
|
||||
case ts.SyntaxKind.ComputedPropertyName:
|
||||
return isStringOrNumericLiteral(name.expression) ? name.expression.text : undefined!;
|
||||
}
|
||||
}
|
||||
|
||||
const name = getTextOfPropertyName(propName);
|
||||
if (name && type) {
|
||||
const result: ts.Symbol[] = [];
|
||||
const symbol = type.getProperty(name);
|
||||
if (type.flags & ts.TypeFlags.Union) {
|
||||
for (const t of (<ts.UnionType>type).types) {
|
||||
const symbol = t.getProperty(name);
|
||||
if (symbol) {
|
||||
result.push(symbol);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
if (symbol) {
|
||||
result.push(symbol);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function getPropertySymbolsFromContextualType(typeChecker: ts.TypeChecker, node: ts.ObjectLiteralElement): ts.Symbol[] {
|
||||
const objectLiteral = <ts.ObjectLiteralExpression | ts.JsxAttributes>node.parent;
|
||||
const contextualType = typeChecker.getContextualType(objectLiteral)!;
|
||||
return getPropertySymbolsFromType(contextualType, node.name!)!;
|
||||
}
|
||||
// Use some TypeScript internals to avoid code duplication
|
||||
type ObjectLiteralElementWithName = ts.ObjectLiteralElement & { name: ts.PropertyName; parent: ts.ObjectLiteralExpression | ts.JsxAttributes };
|
||||
const getPropertySymbolsFromContextualType: (node: ObjectLiteralElementWithName, checker: ts.TypeChecker, contextualType: ts.Type, unionSymbolOk: boolean) => ReadonlyArray<ts.Symbol> = (<any>ts).getPropertySymbolsFromContextualType;
|
||||
const getContainingObjectLiteralElement: (node: ts.Node) => ObjectLiteralElementWithName | undefined = (<any>ts).getContainingObjectLiteralElement;
|
||||
const getNameFromPropertyName: (name: ts.PropertyName) => string | undefined = (<any>ts).getNameFromPropertyName;
|
||||
|
||||
// Go to the original declaration for cases:
|
||||
//
|
||||
|
@ -733,8 +717,14 @@ function getRealNodeSymbol(checker: ts.TypeChecker, node: ts.Node): [ts.Symbol |
|
|||
}
|
||||
}
|
||||
|
||||
const { parent } = node;
|
||||
|
||||
let symbol = checker.getSymbolAtLocation(node);
|
||||
let importNode: ts.Declaration | null = null;
|
||||
// If this is an alias, and the request came at the declaration location
|
||||
// get the aliased symbol instead. This allows for goto def on an import e.g.
|
||||
// import {A, B} from "mod";
|
||||
// to jump to the implementation directly.
|
||||
if (symbol && symbol.flags & ts.SymbolFlags.Alias && shouldSkipAlias(node, symbol.declarations[0])) {
|
||||
const aliased = checker.getAliasedSymbol(symbol);
|
||||
if (aliased.declarations) {
|
||||
|
@ -765,13 +755,21 @@ function getRealNodeSymbol(checker: ts.TypeChecker, node: ts.Node): [ts.Symbol |
|
|||
// pr/*destination*/op1: number
|
||||
// }
|
||||
// bar<Test>(({pr/*goto*/op1})=>{});
|
||||
if (ts.isPropertyName(node) && ts.isBindingElement(node.parent) && ts.isObjectBindingPattern(node.parent.parent) &&
|
||||
(node === (node.parent.propertyName || node.parent.name))) {
|
||||
const type = checker.getTypeAtLocation(node.parent.parent);
|
||||
if (type) {
|
||||
const propSymbols = getPropertySymbolsFromType(type, node);
|
||||
if (propSymbols) {
|
||||
symbol = propSymbols[0];
|
||||
if (ts.isPropertyName(node) && ts.isBindingElement(parent) && ts.isObjectBindingPattern(parent.parent) &&
|
||||
(node === (parent.propertyName || parent.name))) {
|
||||
const name = getNameFromPropertyName(node);
|
||||
const type = checker.getTypeAtLocation(parent.parent);
|
||||
if (name && type) {
|
||||
if (type.isUnion()) {
|
||||
const prop = type.types[0].getProperty(name);
|
||||
if (prop) {
|
||||
symbol = prop;
|
||||
}
|
||||
} else {
|
||||
const prop = type.getProperty(name);
|
||||
if (prop) {
|
||||
symbol = prop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -786,10 +784,13 @@ function getRealNodeSymbol(checker: ts.TypeChecker, node: ts.Node): [ts.Symbol |
|
|||
// function Foo(arg: Props) {}
|
||||
// Foo( { pr/*1*/op1: 10, prop2: false })
|
||||
const element = getContainingObjectLiteralElement(node);
|
||||
if (element && checker.getContextualType(element.parent as ts.Expression)) {
|
||||
const propertySymbols = getPropertySymbolsFromContextualType(checker, element);
|
||||
if (propertySymbols) {
|
||||
symbol = propertySymbols[0];
|
||||
if (element) {
|
||||
const contextualType = element && checker.getContextualType(element.parent);
|
||||
if (contextualType) {
|
||||
const propertySymbols = getPropertySymbolsFromContextualType(element, checker, contextualType, /*unionSymbolOk*/ false);
|
||||
if (propertySymbols) {
|
||||
symbol = propertySymbols[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -241,7 +241,7 @@ function generateDeclarationFile(out, inputFiles, recipe) {
|
|||
usage.push("var b;");
|
||||
var generateUsageImport = function (moduleId) {
|
||||
var importName = 'm' + (++usageCounter);
|
||||
usageImports.push("import * as " + importName + " from '" + moduleId.replace(/\.d\.ts$/, '') + "';");
|
||||
usageImports.push("import * as " + importName + " from './" + moduleId.replace(/\.d\.ts$/, '') + "';");
|
||||
return importName;
|
||||
};
|
||||
lines.forEach(function (line) {
|
||||
|
|
|
@ -281,7 +281,7 @@ function generateDeclarationFile(out: string, inputFiles: { [file: string]: stri
|
|||
|
||||
const generateUsageImport = (moduleId: string) => {
|
||||
let importName = 'm' + (++usageCounter);
|
||||
usageImports.push(`import * as ${importName} from '${moduleId.replace(/\.d\.ts$/, '')}';`);
|
||||
usageImports.push(`import * as ${importName} from './${moduleId.replace(/\.d\.ts$/, '')}';`);
|
||||
return importName;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
|
||||
// This file is adding references to various symbols which should not be removed via tree shaking
|
||||
|
||||
import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IHighlight } from 'vs/base/parts/quickopen/browser/quickOpenModel';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { CountBadge } from 'vs/base/browser/ui/countBadge/countBadge';
|
||||
import { SimpleWorkerClient, create as create1 } from 'vs/base/common/worker/simpleWorker';
|
||||
import { create as create2 } from 'vs/editor/common/services/editorSimpleWorker';
|
||||
import { QuickOpenWidget } from 'vs/base/parts/quickopen/browser/quickOpenWidget';
|
||||
import { SyncDescriptor0, SyncDescriptor1, SyncDescriptor2, SyncDescriptor3, SyncDescriptor4, SyncDescriptor5, SyncDescriptor6, SyncDescriptor7, SyncDescriptor8 } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { PolyfillPromise } from 'vs/base/common/winjs.polyfill.promise';
|
||||
import { DiffNavigator } from 'vs/editor/browser/widget/diffNavigator';
|
||||
import * as editorAPI from 'vs/editor/editor.api';
|
||||
import { ServiceIdentifier } from './vs/platform/instantiation/common/instantiation';
|
||||
import { IContextViewService } from './vs/platform/contextview/browser/contextView';
|
||||
import { IHighlight } from './vs/base/parts/quickopen/browser/quickOpenModel';
|
||||
import { IWorkspaceContextService } from './vs/platform/workspace/common/workspace';
|
||||
import { IEnvironmentService } from './vs/platform/environment/common/environment';
|
||||
import { CountBadge } from './vs/base/browser/ui/countBadge/countBadge';
|
||||
import { SimpleWorkerClient, create as create1 } from './vs/base/common/worker/simpleWorker';
|
||||
import { create as create2 } from './vs/editor/common/services/editorSimpleWorker';
|
||||
import { QuickOpenWidget } from './vs/base/parts/quickopen/browser/quickOpenWidget';
|
||||
import { SyncDescriptor0, SyncDescriptor1, SyncDescriptor2, SyncDescriptor3, SyncDescriptor4, SyncDescriptor5, SyncDescriptor6, SyncDescriptor7, SyncDescriptor8 } from './vs/platform/instantiation/common/descriptors';
|
||||
import { PolyfillPromise } from './vs/base/common/winjs.polyfill.promise';
|
||||
import { DiffNavigator } from './vs/editor/browser/widget/diffNavigator';
|
||||
import * as editorAPI from './vs/editor/editor.api';
|
||||
|
||||
(function () {
|
||||
var a: any;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
"@types/gulp-uglify": "^3.0.5",
|
||||
"@types/gulp-util": "^3.0.34",
|
||||
"@types/mime": "0.0.29",
|
||||
"@types/minimatch": "^2.0.29",
|
||||
"@types/minimatch": "^3.0.3",
|
||||
"@types/node": "8.0.33",
|
||||
"@types/pump": "^1.0.1",
|
||||
"@types/request": "^2.47.0",
|
||||
|
@ -35,6 +35,7 @@
|
|||
"mime": "^1.3.4",
|
||||
"minimist": "^1.2.0",
|
||||
"request": "^2.85.0",
|
||||
"typescript": "3.1.1",
|
||||
"xml2js": "^0.4.17"
|
||||
},
|
||||
"scripts": {
|
||||
|
@ -43,4 +44,4 @@
|
|||
"postinstall": "npm run compile",
|
||||
"npmCheckJs": "tsc --noEmit"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,9 @@ steps:
|
|||
- script: |
|
||||
yarn monaco-compile-check
|
||||
displayName: Run Monaco Editor Checks
|
||||
- script: |
|
||||
yarn strict-null-check
|
||||
displayName: Run Strict Null Checks
|
||||
- script: |
|
||||
yarn compile
|
||||
displayName: Compile Sources
|
||||
|
|
|
@ -13,6 +13,7 @@ steps:
|
|||
yarn
|
||||
yarn gulp -- hygiene
|
||||
yarn monaco-compile-check
|
||||
yarn strict-null-check
|
||||
VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)" yarn gulp -- mixin
|
||||
node build/tfs/common/installDistro.js
|
||||
node build/lib/builtInExtensions.js
|
||||
|
|
|
@ -27,6 +27,9 @@ steps:
|
|||
- script: |
|
||||
yarn monaco-compile-check
|
||||
displayName: Run Monaco Editor Checks
|
||||
- script: |
|
||||
yarn strict-null-check
|
||||
displayName: Run Strict Null Checks
|
||||
- script: |
|
||||
yarn compile
|
||||
displayName: Compile Sources
|
||||
|
|
|
@ -18,6 +18,7 @@ steps:
|
|||
CHILD_CONCURRENCY=1 yarn
|
||||
npm run gulp -- hygiene
|
||||
npm run monaco-compile-check
|
||||
npm run strict-null-check
|
||||
VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)" npm run gulp -- mixin
|
||||
node build/tfs/common/installDistro.js
|
||||
node build/lib/builtInExtensions.js
|
||||
|
|
|
@ -21,6 +21,9 @@ steps:
|
|||
- powershell: |
|
||||
yarn monaco-compile-check
|
||||
displayName: Run Monaco Editor Checks
|
||||
- script: |
|
||||
yarn strict-null-check
|
||||
displayName: Run Strict Null Checks
|
||||
- powershell: |
|
||||
yarn compile
|
||||
displayName: Compile Sources
|
||||
|
|
|
@ -22,6 +22,7 @@ steps:
|
|||
exec { yarn }
|
||||
exec { npm run gulp -- hygiene }
|
||||
exec { npm run monaco-compile-check }
|
||||
exec { npm run strict-null-check }
|
||||
exec { npm run gulp -- mixin }
|
||||
exec { node build/tfs/common/installDistro.js }
|
||||
exec { node build/lib/builtInExtensions.js }
|
||||
|
|
|
@ -156,16 +156,11 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/mime/-/mime-0.0.29.tgz#fbcfd330573b912ef59eeee14602bface630754b"
|
||||
integrity sha1-+8/TMFc7kS71nu7hRgK/rOYwdUs=
|
||||
|
||||
"@types/minimatch@*":
|
||||
"@types/minimatch@*", "@types/minimatch@^3.0.3":
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
|
||||
integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==
|
||||
|
||||
"@types/minimatch@^2.0.29":
|
||||
version "2.0.29"
|
||||
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-2.0.29.tgz#5002e14f75e2d71e564281df0431c8c1b4a2a36a"
|
||||
integrity sha1-UALhT3Xi1x5WQoHfBDHIwbSio2o=
|
||||
|
||||
"@types/node@*":
|
||||
version "8.0.51"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.51.tgz#b31d716fb8d58eeb95c068a039b9b6292817d5fb"
|
||||
|
@ -1493,6 +1488,11 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0:
|
|||
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"
|
||||
integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=
|
||||
|
||||
typescript@3.1.1:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.1.1.tgz#3362ba9dd1e482ebb2355b02dfe8bcd19a2c7c96"
|
||||
integrity sha512-Veu0w4dTc/9wlWNf2jeRInNodKlcdLgemvPsrNpfu5Pq39sgfFjvIIgTsvUHCoLBnMhPoUA+tFxsXjU6VexVRQ==
|
||||
|
||||
underscore@1.8.3, underscore@~1.8.3:
|
||||
version "1.8.3"
|
||||
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.8.3.tgz#4f3fb53b106e6097fcf9cb4109f2a5e9bdfa5022"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
|
||||
"Once accepted there, we are happy to receive an update request."
|
||||
],
|
||||
"version": "https://github.com/microsoft/vscode-markdown-tm-grammar/commit/0bd394a33046eeb204a9ebebdffb113d39587591",
|
||||
"version": "https://github.com/microsoft/vscode-markdown-tm-grammar/commit/ee6a11d0bbbe8ef6bcf8e664f446c00fb14212f2",
|
||||
"name": "Markdown",
|
||||
"scopeName": "text.html.markdown",
|
||||
"patterns": [
|
||||
|
@ -2469,7 +2469,7 @@
|
|||
"2": {
|
||||
"name": "string.other.link.title.markdown"
|
||||
},
|
||||
"4": {
|
||||
"3": {
|
||||
"name": "punctuation.definition.string.end.markdown"
|
||||
}
|
||||
},
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"version": "0.0.1",
|
||||
"description": "Dependencies shared by all extensions",
|
||||
"dependencies": {
|
||||
"typescript": "3.1.2"
|
||||
"typescript": "3.1.3"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "node ./postinstall"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# yarn lockfile v1
|
||||
|
||||
|
||||
typescript@3.1.2:
|
||||
version "3.1.2"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.1.2.tgz#c03a5d16f30bb60ad8bb6fe8e7cb212eedeec950"
|
||||
integrity sha512-gOoGJWbNnFAfP9FlrSV63LYD5DJqYJHG5ky1kOXSl3pCImn4rqWy/flyq1BRd4iChQsoCqjbQaqtmXO4yCVPCA==
|
||||
typescript@3.1.3:
|
||||
version "3.1.3"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.1.3.tgz#01b70247a6d3c2467f70c45795ef5ea18ce191d5"
|
||||
integrity sha512-+81MUSyX+BaSo+u2RbozuQk/UWx6hfG0a5gHu4ANEM4sU96XbuIyAB+rWBW1u70c6a5QuZfuYICn3s2UjuHUpA==
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "code-oss-dev",
|
||||
"version": "1.29.0",
|
||||
"distro": "d880cac56e2f97abfbd0a6b8388caebfa96bb40c",
|
||||
"distro": "41eb7ae09bf97fe9448a168eb37838124a2a3695",
|
||||
"author": {
|
||||
"name": "Microsoft Corporation"
|
||||
},
|
||||
|
@ -22,7 +22,8 @@
|
|||
"update-localization-extension": "node build/npm/update-localization-extension.js",
|
||||
"smoketest": "cd test/smoke && node test/index.js",
|
||||
"monaco-compile-check": "tsc -p src/tsconfig.monaco.json --noEmit",
|
||||
"download-builtin-extensions": "node build/lib/builtInExtensions.js"
|
||||
"download-builtin-extensions": "node build/lib/builtInExtensions.js",
|
||||
"strict-null-check": "tsc -p src/tsconfig.strictNullChecks.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"applicationinsights": "1.0.5",
|
||||
|
@ -50,7 +51,7 @@
|
|||
"vscode-nsfw": "1.0.17",
|
||||
"vscode-ripgrep": "^1.2.2",
|
||||
"vscode-textmate": "^4.0.1",
|
||||
"vscode-xterm": "3.9.0-beta5",
|
||||
"vscode-xterm": "3.9.0-beta7",
|
||||
"winreg": "^1.2.4",
|
||||
"yauzl": "^2.9.1",
|
||||
"yazl": "^2.4.3"
|
||||
|
@ -107,7 +108,7 @@
|
|||
"lazy.js": "^0.4.2",
|
||||
"merge-options": "^1.0.1",
|
||||
"mime": "^1.4.1",
|
||||
"minimatch": "^2.0.10",
|
||||
"minimatch": "^3.0.4",
|
||||
"mkdirp": "^0.5.0",
|
||||
"mocha": "^2.2.5",
|
||||
"mocha-junit-reporter": "^1.17.0",
|
||||
|
|
Before Width: | Height: | Size: 149 KiB After Width: | Height: | Size: 149 KiB |
Before Width: | Height: | Size: 147 KiB After Width: | Height: | Size: 147 KiB |
Before Width: | Height: | Size: 148 KiB After Width: | Height: | Size: 148 KiB |
Before Width: | Height: | Size: 147 KiB After Width: | Height: | Size: 147 KiB |
Before Width: | Height: | Size: 147 KiB After Width: | Height: | Size: 147 KiB |
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 146 KiB |
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 145 KiB |
Before Width: | Height: | Size: 147 KiB After Width: | Height: | Size: 147 KiB |
Before Width: | Height: | Size: 147 KiB After Width: | Height: | Size: 147 KiB |
Before Width: | Height: | Size: 147 KiB After Width: | Height: | Size: 147 KiB |
Before Width: | Height: | Size: 149 KiB After Width: | Height: | Size: 149 KiB |
Before Width: | Height: | Size: 147 KiB After Width: | Height: | Size: 147 KiB |
Before Width: | Height: | Size: 147 KiB After Width: | Height: | Size: 147 KiB |
Before Width: | Height: | Size: 147 KiB After Width: | Height: | Size: 147 KiB |
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 146 KiB |
Before Width: | Height: | Size: 147 KiB After Width: | Height: | Size: 147 KiB |
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 146 KiB |
Before Width: | Height: | Size: 147 KiB After Width: | Height: | Size: 147 KiB |
Before Width: | Height: | Size: 150 KiB After Width: | Height: | Size: 150 KiB |
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 146 KiB |
Before Width: | Height: | Size: 148 KiB After Width: | Height: | Size: 148 KiB |
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 144 KiB |
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 146 KiB |
Before Width: | Height: | Size: 147 KiB After Width: | Height: | Size: 147 KiB |
Before Width: | Height: | Size: 147 KiB After Width: | Height: | Size: 147 KiB |
Before Width: | Height: | Size: 148 KiB After Width: | Height: | Size: 148 KiB |
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 146 KiB |
27
src/tsconfig.base.json
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "amd",
|
||||
"moduleResolution": "node",
|
||||
"noImplicitAny": false,
|
||||
"target": "es5",
|
||||
"experimentalDecorators": true,
|
||||
"noImplicitReturns": true,
|
||||
"noUnusedLocals": true,
|
||||
"noImplicitThis": true,
|
||||
"alwaysStrict": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"vs/*": [
|
||||
"./vs/*"
|
||||
]
|
||||
},
|
||||
"types": [
|
||||
"keytar",
|
||||
"minimist",
|
||||
"mocha",
|
||||
"semver",
|
||||
"sinon",
|
||||
"winreg"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1,33 +1,11 @@
|
|||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"module": "amd",
|
||||
"moduleResolution": "node",
|
||||
"noImplicitAny": false,
|
||||
"removeComments": false,
|
||||
"preserveConstEnums": true,
|
||||
"target": "es5",
|
||||
"sourceMap": false,
|
||||
"experimentalDecorators": true,
|
||||
"declaration": true,
|
||||
"noImplicitReturns": true,
|
||||
"noUnusedLocals": true,
|
||||
"noImplicitThis": true,
|
||||
"alwaysStrict": true,
|
||||
"baseUrl": ".",
|
||||
"outDir": "../out",
|
||||
"paths": {
|
||||
"vs/*": [
|
||||
"./vs/*"
|
||||
]
|
||||
},
|
||||
"types": [
|
||||
"keytar",
|
||||
"minimist",
|
||||
"mocha",
|
||||
"semver",
|
||||
"sinon",
|
||||
"winreg"
|
||||
]
|
||||
"outDir": "../out"
|
||||
},
|
||||
"include": [
|
||||
"./typings",
|
||||
|
|
273
src/tsconfig.strictNullChecks.json
Normal file
|
@ -0,0 +1,273 @@
|
|||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": true,
|
||||
"strictNullChecks": true
|
||||
},
|
||||
"include": [
|
||||
"./typings",
|
||||
"./vs/base/browser/browser.ts",
|
||||
"./vs/base/browser/dom.ts",
|
||||
"./vs/base/browser/event.ts",
|
||||
"./vs/base/browser/history.ts",
|
||||
"./vs/base/browser/iframe.ts",
|
||||
"./vs/base/browser/keyboardEvent.ts",
|
||||
"./vs/base/browser/mouseEvent.ts",
|
||||
"./vs/base/browser/ui/list/splice.ts",
|
||||
"./vs/base/browser/ui/octiconLabel/octiconLabel.mock.ts",
|
||||
"./vs/base/browser/ui/octiconLabel/octiconLabel.ts",
|
||||
"./vs/base/browser/ui/scrollbar/scrollableElementOptions.ts",
|
||||
"./vs/base/browser/ui/scrollbar/scrollbarState.ts",
|
||||
"./vs/base/browser/ui/tree/tree.ts",
|
||||
"./vs/base/common/actions.ts",
|
||||
"./vs/base/common/amd.ts",
|
||||
"./vs/base/common/arrays.ts",
|
||||
"./vs/base/common/assert.ts",
|
||||
"./vs/base/common/async.ts",
|
||||
"./vs/base/common/cache.ts",
|
||||
"./vs/base/common/cancellation.ts",
|
||||
"./vs/base/common/charCode.ts",
|
||||
"./vs/base/common/collections.ts",
|
||||
"./vs/base/common/color.ts",
|
||||
"./vs/base/common/comparers.ts",
|
||||
"./vs/base/common/date.ts",
|
||||
"./vs/base/common/decorators.ts",
|
||||
"./vs/base/common/diff/diff.ts",
|
||||
"./vs/base/common/diff/diffChange.ts",
|
||||
"./vs/base/common/errorMessage.ts",
|
||||
"./vs/base/common/errors.ts",
|
||||
"./vs/base/common/errorsWithActions.ts",
|
||||
"./vs/base/common/event.ts",
|
||||
"./vs/base/common/filters.ts",
|
||||
"./vs/base/common/functional.ts",
|
||||
"./vs/base/common/glob.ts",
|
||||
"./vs/base/common/hash.ts",
|
||||
"./vs/base/common/history.ts",
|
||||
"./vs/base/common/htmlContent.ts",
|
||||
"./vs/base/common/idGenerator.ts",
|
||||
"./vs/base/common/iterator.ts",
|
||||
"./vs/base/common/jsonSchema.ts",
|
||||
"./vs/base/common/keyCodes.ts",
|
||||
"./vs/base/common/keybindingParser.ts",
|
||||
"./vs/base/common/labels.ts",
|
||||
"./vs/base/common/lifecycle.ts",
|
||||
"./vs/base/common/linkedList.ts",
|
||||
"./vs/base/common/map.ts",
|
||||
"./vs/base/common/marshalling.ts",
|
||||
"./vs/base/common/network.ts",
|
||||
"./vs/base/common/normalization.ts",
|
||||
"./vs/base/common/numbers.ts",
|
||||
"./vs/base/common/objects.ts",
|
||||
"./vs/base/common/parsers.ts",
|
||||
"./vs/base/common/paths.ts",
|
||||
"./vs/base/common/platform.ts",
|
||||
"./vs/base/common/processes.ts",
|
||||
"./vs/base/common/range.ts",
|
||||
"./vs/base/common/resources.ts",
|
||||
"./vs/base/common/scanCode.ts",
|
||||
"./vs/base/common/scrollable.ts",
|
||||
"./vs/base/common/sequence.ts",
|
||||
"./vs/base/common/severity.ts",
|
||||
"./vs/base/common/stopwatch.ts",
|
||||
"./vs/base/common/strings.ts",
|
||||
"./vs/base/common/types.ts",
|
||||
"./vs/base/common/uri.ts",
|
||||
"./vs/base/common/uriIpc.ts",
|
||||
"./vs/base/common/uuid.ts",
|
||||
"./vs/base/common/winjs.base.d.ts",
|
||||
"./vs/base/common/winjs.polyfill.promise.ts",
|
||||
"./vs/base/common/worker/simpleWorker.ts",
|
||||
"./vs/base/node/decoder.ts",
|
||||
"./vs/base/node/id.ts",
|
||||
"./vs/base/node/paths.ts",
|
||||
"./vs/base/node/ports.ts",
|
||||
"./vs/base/parts/contextmenu/common/contextmenu.ts",
|
||||
"./vs/base/parts/contextmenu/electron-main/contextmenu.ts",
|
||||
"./vs/base/parts/quickopen/common/quickOpen.ts",
|
||||
"./vs/base/test/common/utils.ts",
|
||||
"./vs/base/test/node/uri.test.perf.ts",
|
||||
"./vs/base/worker/defaultWorkerFactory.ts",
|
||||
"./vs/base/worker/workerMain.ts",
|
||||
"./vs/code/electron-browser/issue/issueReporterPage.ts",
|
||||
"./vs/code/electron-browser/issue/issueReporterUtil.ts",
|
||||
"./vs/code/electron-main/keyboard.ts",
|
||||
"./vs/code/electron-main/theme.ts",
|
||||
"./vs/code/node/shellEnv.ts",
|
||||
"./vs/editor/browser/config/charWidthReader.ts",
|
||||
"./vs/editor/browser/config/elementSizeObserver.ts",
|
||||
"./vs/editor/browser/controller/textAreaState.ts",
|
||||
"./vs/editor/common/commands/replaceCommand.ts",
|
||||
"./vs/editor/common/commands/surroundSelectionCommand.ts",
|
||||
"./vs/editor/common/commands/trimTrailingWhitespaceCommand.ts",
|
||||
"./vs/editor/common/config/editorOptions.ts",
|
||||
"./vs/editor/common/config/editorZoom.ts",
|
||||
"./vs/editor/common/config/fontInfo.ts",
|
||||
"./vs/editor/common/controller/cursorEvents.ts",
|
||||
"./vs/editor/common/controller/wordCharacterClassifier.ts",
|
||||
"./vs/editor/common/core/characterClassifier.ts",
|
||||
"./vs/editor/common/core/editOperation.ts",
|
||||
"./vs/editor/common/core/lineTokens.ts",
|
||||
"./vs/editor/common/core/position.ts",
|
||||
"./vs/editor/common/core/range.ts",
|
||||
"./vs/editor/common/core/rgba.ts",
|
||||
"./vs/editor/common/core/selection.ts",
|
||||
"./vs/editor/common/core/stringBuilder.ts",
|
||||
"./vs/editor/common/core/token.ts",
|
||||
"./vs/editor/common/core/uint.ts",
|
||||
"./vs/editor/common/diff/diffComputer.ts",
|
||||
"./vs/editor/common/editorAction.ts",
|
||||
"./vs/editor/common/editorCommon.ts",
|
||||
"./vs/editor/common/editorContextKeys.ts",
|
||||
"./vs/editor/common/model.ts",
|
||||
"./vs/editor/common/model/editStack.ts",
|
||||
"./vs/editor/common/model/indentationGuesser.ts",
|
||||
"./vs/editor/common/model/intervalTree.ts",
|
||||
"./vs/editor/common/model/mirrorTextModel.ts",
|
||||
"./vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase.ts",
|
||||
"./vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBuffer.ts",
|
||||
"./vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBufferBuilder.ts",
|
||||
"./vs/editor/common/model/pieceTreeTextBuffer/rbTreeBase.ts",
|
||||
"./vs/editor/common/model/textModel.ts",
|
||||
"./vs/editor/common/model/textModelEvents.ts",
|
||||
"./vs/editor/common/model/textModelSearch.ts",
|
||||
"./vs/editor/common/model/textModelTokens.ts",
|
||||
"./vs/editor/common/model/wordHelper.ts",
|
||||
"./vs/editor/common/modes.ts",
|
||||
"./vs/editor/common/modes/abstractMode.ts",
|
||||
"./vs/editor/common/modes/languageConfiguration.ts",
|
||||
"./vs/editor/common/modes/languageConfigurationRegistry.ts",
|
||||
"./vs/editor/common/modes/languageFeatureRegistry.ts",
|
||||
"./vs/editor/common/modes/languageSelector.ts",
|
||||
"./vs/editor/common/modes/linkComputer.ts",
|
||||
"./vs/editor/common/modes/nullMode.ts",
|
||||
"./vs/editor/common/modes/supports.ts",
|
||||
"./vs/editor/common/modes/supports/characterPair.ts",
|
||||
"./vs/editor/common/modes/supports/electricCharacter.ts",
|
||||
"./vs/editor/common/modes/supports/indentRules.ts",
|
||||
"./vs/editor/common/modes/supports/inplaceReplaceSupport.ts",
|
||||
"./vs/editor/common/modes/supports/onEnter.ts",
|
||||
"./vs/editor/common/modes/supports/richEditBrackets.ts",
|
||||
"./vs/editor/common/modes/supports/tokenization.ts",
|
||||
"./vs/editor/common/modes/textToHtmlTokenizer.ts",
|
||||
"./vs/editor/common/modes/tokenizationRegistry.ts",
|
||||
"./vs/editor/common/services/editorWorkerService.ts",
|
||||
"./vs/editor/common/services/modelService.ts",
|
||||
"./vs/editor/common/services/modeService.ts",
|
||||
"./vs/editor/common/services/resolverService.ts",
|
||||
"./vs/editor/common/standalone/standaloneBase.ts",
|
||||
"./vs/editor/common/view/minimapCharRenderer.ts",
|
||||
"./vs/editor/common/view/overviewZoneManager.ts",
|
||||
"./vs/editor/common/view/runtimeMinimapCharRenderer.ts",
|
||||
"./vs/editor/common/view/viewEvents.ts",
|
||||
"./vs/editor/common/viewLayout/whitespaceComputer.ts",
|
||||
"./vs/editor/common/viewModel/prefixSumComputer.ts",
|
||||
"./vs/editor/contrib/codeAction/codeActionTrigger.ts",
|
||||
"./vs/editor/contrib/colorPicker/colorPickerModel.ts",
|
||||
"./vs/editor/contrib/find/findState.ts",
|
||||
"./vs/editor/contrib/find/replaceAllCommand.ts",
|
||||
"./vs/editor/contrib/find/replacePattern.ts",
|
||||
"./vs/editor/contrib/indentation/indentUtils.ts",
|
||||
"./vs/editor/contrib/inPlaceReplace/inPlaceReplaceCommand.ts",
|
||||
"./vs/editor/contrib/linesOperations/copyLinesCommand.ts",
|
||||
"./vs/editor/standalone/common/monarch/monarchCommon.ts",
|
||||
"./vs/editor/standalone/common/monarch/monarchCompile.ts",
|
||||
"./vs/editor/standalone/common/monarch/monarchTypes.ts",
|
||||
"./vs/editor/test/common/commentMode.ts",
|
||||
"./vs/editor/test/common/core/viewLineToken.ts",
|
||||
"./vs/editor/test/common/editorTestUtils.ts",
|
||||
"./vs/editor/test/common/mocks/mockMode.ts",
|
||||
"./vs/editor/test/common/model/benchmark/benchmarkUtils.ts",
|
||||
"./vs/editor/test/common/modes/supports/javascriptOnEnterRules.ts",
|
||||
"./vs/editor/test/common/modesTestUtils.ts",
|
||||
"./vs/monaco.d.ts",
|
||||
"./vs/nls.mock.ts",
|
||||
"./vs/platform/broadcast/electron-browser/broadcastService.ts",
|
||||
"./vs/platform/clipboard/common/clipboardService.ts",
|
||||
"./vs/platform/clipboard/electron-browser/clipboardService.ts",
|
||||
"./vs/platform/contextkey/common/contextkey.ts",
|
||||
"./vs/platform/download/common/download.ts",
|
||||
"./vs/platform/editor/common/editor.ts",
|
||||
"./vs/platform/environment/common/environment.ts",
|
||||
"./vs/platform/extensions/common/extensionHost.ts",
|
||||
"./vs/platform/extensions/common/extensions.ts",
|
||||
"./vs/platform/files/common/files.ts",
|
||||
"./vs/platform/files/node/files.ts",
|
||||
"./vs/platform/instantiation/common/descriptors.ts",
|
||||
"./vs/platform/instantiation/common/extensions.ts",
|
||||
"./vs/platform/instantiation/common/graph.ts",
|
||||
"./vs/platform/instantiation/common/instantiation.ts",
|
||||
"./vs/platform/instantiation/common/serviceCollection.ts",
|
||||
"./vs/platform/integrity/common/integrity.ts",
|
||||
"./vs/platform/jsonschemas/common/jsonContributionRegistry.ts",
|
||||
"./vs/platform/lifecycle/common/lifecycle.ts",
|
||||
"./vs/platform/localizations/common/localizations.ts",
|
||||
"./vs/platform/log/common/bufferLog.ts",
|
||||
"./vs/platform/log/common/log.ts",
|
||||
"./vs/platform/log/node/spdlogService.ts",
|
||||
"./vs/platform/markers/common/markers.ts",
|
||||
"./vs/platform/menubar/common/menubar.ts",
|
||||
"./vs/platform/node/minimalTranslations.ts",
|
||||
"./vs/platform/node/package.ts",
|
||||
"./vs/platform/node/product.ts",
|
||||
"./vs/platform/notification/common/notification.ts",
|
||||
"./vs/platform/notification/test/common/testNotificationService.ts",
|
||||
"./vs/platform/opener/common/opener.ts",
|
||||
"./vs/platform/output/node/outputAppender.ts",
|
||||
"./vs/platform/progress/common/progress.ts",
|
||||
"./vs/platform/quickinput/common/quickInput.ts",
|
||||
"./vs/platform/quickOpen/common/quickOpen.ts",
|
||||
"./vs/platform/registry/common/platform.ts",
|
||||
"./vs/platform/search/common/search.ts",
|
||||
"./vs/platform/state/common/state.ts",
|
||||
"./vs/platform/statusbar/common/statusbar.ts",
|
||||
"./vs/platform/telemetry/common/telemetry.ts",
|
||||
"./vs/platform/telemetry/node/telemetryNodeUtils.ts",
|
||||
"./vs/platform/theme/common/colorRegistry.ts",
|
||||
"./vs/platform/theme/common/themeService.ts",
|
||||
"./vs/platform/update/common/update.ts",
|
||||
"./vs/platform/url/common/url.ts",
|
||||
"./vs/platform/url/common/urlService.ts",
|
||||
"./vs/platform/workbench/common/contextkeys.ts",
|
||||
"./vs/workbench/api/shared/tasks.ts",
|
||||
"./vs/workbench/browser/parts/statusbar/statusbar.ts",
|
||||
"./vs/workbench/common/activity.ts",
|
||||
"./vs/workbench/common/composite.ts",
|
||||
"./vs/workbench/common/contributions.ts",
|
||||
"./vs/workbench/common/extensionHostProtocol.ts",
|
||||
"./vs/workbench/common/panel.ts",
|
||||
"./vs/workbench/common/viewlet.ts",
|
||||
"./vs/workbench/parts/codeEditor/browser/simpleEditorOptions.ts",
|
||||
"./vs/workbench/parts/execution/common/execution.ts",
|
||||
"./vs/workbench/parts/extensions/common/extensionQuery.ts",
|
||||
"./vs/workbench/parts/logs/common/logConstants.ts",
|
||||
"./vs/workbench/parts/markers/electron-browser/constants.ts",
|
||||
"./vs/workbench/parts/outline/electron-browser/outline.ts",
|
||||
"./vs/workbench/parts/output/common/output.ts",
|
||||
"./vs/workbench/parts/scm/electron-browser/scmUtil.ts",
|
||||
"./vs/workbench/parts/search/common/constants.ts",
|
||||
"./vs/workbench/parts/terminal/browser/terminalWidgetManager.ts",
|
||||
"./vs/workbench/parts/terminal/common/terminal.ts",
|
||||
"./vs/workbench/parts/welcome/page/electron-browser/vs_code_welcome_page.ts",
|
||||
"./vs/workbench/services/activity/common/activity.ts",
|
||||
"./vs/workbench/services/backup/common/backup.ts",
|
||||
"./vs/workbench/services/configuration/common/jsonEditing.ts",
|
||||
"./vs/workbench/services/decorations/browser/decorations.ts",
|
||||
"./vs/workbench/services/extensions/node/lazyPromise.ts",
|
||||
"./vs/workbench/services/extensions/node/proxyIdentifier.ts",
|
||||
"./vs/workbench/services/files/node/watcher/common.ts",
|
||||
"./vs/workbench/services/files/node/watcher/nsfw/watcher.ts",
|
||||
"./vs/workbench/services/files/node/watcher/unix/watcher.ts",
|
||||
"./vs/workbench/services/hash/common/hashService.ts",
|
||||
"./vs/workbench/services/hash/node/hashService.ts",
|
||||
"./vs/workbench/services/panel/common/panelService.ts",
|
||||
"./vs/workbench/services/scm/common/scm.ts",
|
||||
"./vs/workbench/services/scm/common/scmService.ts",
|
||||
"./vs/workbench/services/search/node/search.ts",
|
||||
"./vs/workbench/services/textMate/electron-browser/textMateService.ts",
|
||||
"./vs/workbench/services/title/common/titleService.ts",
|
||||
"./vs/workbench/test/electron-browser/api/mock.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"./typings/require-monaco.d.ts"
|
||||
]
|
||||
}
|
6
src/typings/require-monaco.d.ts
vendored
|
@ -4,7 +4,9 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
interface NodeRequire {
|
||||
(moduleName: string): any;
|
||||
}
|
||||
toUrl(path: string): string;
|
||||
(dependencies: string[], callback: (...args: any[]) => any, errorback?: (err: any) => void): any;
|
||||
config(data: any): any;
|
||||
}
|
||||
|
||||
declare var require: NodeRequire;
|
|
@ -20,7 +20,7 @@ export function clearNode(node: HTMLElement): void {
|
|||
}
|
||||
}
|
||||
|
||||
export function isInDOM(node: Node): boolean {
|
||||
export function isInDOM(node: Node | null): boolean {
|
||||
while (node) {
|
||||
if (node === document.body) {
|
||||
return true;
|
||||
|
@ -151,7 +151,7 @@ const _manualClassList = new class implements IDomClassList {
|
|||
|
||||
const _nativeClassList = new class implements IDomClassList {
|
||||
hasClass(node: HTMLElement, className: string): boolean {
|
||||
return className && node.classList && node.classList.contains(className);
|
||||
return Boolean(className) && node.classList && node.classList.contains(className);
|
||||
}
|
||||
|
||||
addClasses(node: HTMLElement, ...classNames: string[]): void {
|
||||
|
@ -198,7 +198,7 @@ class DomListener implements IDisposable {
|
|||
private readonly _type: string;
|
||||
private readonly _useCapture: boolean;
|
||||
|
||||
constructor(node: Element | Window | Document, type: string, handler: (e: any) => void, useCapture: boolean) {
|
||||
constructor(node: Element | Window | Document, type: string, handler: (e: any) => void, useCapture?: boolean) {
|
||||
this._node = node;
|
||||
this._type = type;
|
||||
this._handler = handler;
|
||||
|
@ -215,8 +215,8 @@ class DomListener implements IDisposable {
|
|||
this._node.removeEventListener(this._type, this._handler, this._useCapture);
|
||||
|
||||
// Prevent leakers from holding on to the dom or handler func
|
||||
this._node = null;
|
||||
this._handler = null;
|
||||
this._node = null!;
|
||||
this._handler = null!;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,7 +257,7 @@ export let addStandardDisposableListener: IAddStandardDisposableListenerSignatur
|
|||
export function addDisposableNonBubblingMouseOutListener(node: Element, handler: (event: MouseEvent) => void): IDisposable {
|
||||
return addDisposableListener(node, 'mouseout', (e: MouseEvent) => {
|
||||
// Mouse out bubbles, so this is an attempt to ignore faux mouse outs coming from children elements
|
||||
let toElement = <Node>(e.relatedTarget || e.toElement);
|
||||
let toElement: Node | null = <Node>(e.relatedTarget || e.toElement);
|
||||
while (toElement && toElement !== node) {
|
||||
toElement = toElement.parentNode;
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ export function addDisposableNonBubblingMouseOutListener(node: Element, handler:
|
|||
interface IRequestAnimationFrame {
|
||||
(callback: (time: number) => void): number;
|
||||
}
|
||||
let _animationFrame: IRequestAnimationFrame = null;
|
||||
let _animationFrame: IRequestAnimationFrame | null = null;
|
||||
function doRequestAnimationFrame(callback: (time: number) => void): number {
|
||||
if (!_animationFrame) {
|
||||
const emulatedRequestAnimationFrame = (callback: (time: number) => void): any => {
|
||||
|
@ -311,7 +311,7 @@ class AnimationFrameQueueItem implements IDisposable {
|
|||
public priority: number;
|
||||
private _canceled: boolean;
|
||||
|
||||
constructor(runner: () => void, priority: number) {
|
||||
constructor(runner: () => void, priority: number = 0) {
|
||||
this._runner = runner;
|
||||
this.priority = priority;
|
||||
this._canceled = false;
|
||||
|
@ -347,7 +347,7 @@ class AnimationFrameQueueItem implements IDisposable {
|
|||
/**
|
||||
* The runners scheduled at the current animation frame
|
||||
*/
|
||||
let CURRENT_QUEUE: AnimationFrameQueueItem[] = null;
|
||||
let CURRENT_QUEUE: AnimationFrameQueueItem[] | null = null;
|
||||
/**
|
||||
* A flag to keep track if the native requestAnimationFrame was already called
|
||||
*/
|
||||
|
@ -366,7 +366,7 @@ class AnimationFrameQueueItem implements IDisposable {
|
|||
inAnimationFrameRunner = true;
|
||||
while (CURRENT_QUEUE.length > 0) {
|
||||
CURRENT_QUEUE.sort(AnimationFrameQueueItem.sort);
|
||||
let top = CURRENT_QUEUE.shift();
|
||||
let top = CURRENT_QUEUE.shift()!;
|
||||
top.execute();
|
||||
}
|
||||
inAnimationFrameRunner = false;
|
||||
|
@ -387,7 +387,7 @@ class AnimationFrameQueueItem implements IDisposable {
|
|||
runAtThisOrScheduleAtNextAnimationFrame = (runner: () => void, priority?: number) => {
|
||||
if (inAnimationFrameRunner) {
|
||||
let item = new AnimationFrameQueueItem(runner, priority);
|
||||
CURRENT_QUEUE.push(item);
|
||||
CURRENT_QUEUE!.push(item);
|
||||
return item;
|
||||
} else {
|
||||
return scheduleAtNextAnimationFrame(runner, priority);
|
||||
|
@ -407,7 +407,7 @@ export function modify(callback: () => void): IDisposable {
|
|||
* Add a throttled listener. `handler` is fired at most every 16ms or with the next animation frame (if browser supports it).
|
||||
*/
|
||||
export interface IEventMerger<R, E> {
|
||||
(lastEvent: R, currentEvent: E): R;
|
||||
(lastEvent: R | null, currentEvent: E): R;
|
||||
}
|
||||
|
||||
export interface DOMEvent {
|
||||
|
@ -425,13 +425,13 @@ class TimeoutThrottledDomListener<R, E extends DOMEvent> extends Disposable {
|
|||
constructor(node: any, type: string, handler: (event: R) => void, eventMerger: IEventMerger<R, E> = <any>DEFAULT_EVENT_MERGER, minimumTimeMs: number = MINIMUM_TIME_MS) {
|
||||
super();
|
||||
|
||||
let lastEvent: R = null;
|
||||
let lastEvent: R | null = null;
|
||||
let lastHandlerTime = 0;
|
||||
let timeout = this._register(new TimeoutTimer());
|
||||
|
||||
let invokeHandler = () => {
|
||||
lastHandlerTime = (new Date()).getTime();
|
||||
handler(lastEvent);
|
||||
handler(<R>lastEvent);
|
||||
lastEvent = null;
|
||||
};
|
||||
|
||||
|
@ -455,7 +455,7 @@ export function addDisposableThrottledListener<R, E extends DOMEvent = DOMEvent>
|
|||
}
|
||||
|
||||
export function getComputedStyle(el: HTMLElement): CSSStyleDeclaration {
|
||||
return document.defaultView.getComputedStyle(el, null);
|
||||
return document.defaultView!.getComputedStyle(el, null);
|
||||
}
|
||||
|
||||
// Adapted from WinJS
|
||||
|
@ -660,7 +660,7 @@ export const StandardWindow: IStandardWindow = new class implements IStandardWin
|
|||
// modern browsers
|
||||
return window.scrollX;
|
||||
} else {
|
||||
return document.body.scrollLeft + document.documentElement.scrollLeft;
|
||||
return document.body.scrollLeft + document.documentElement!.scrollLeft;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -669,7 +669,7 @@ export const StandardWindow: IStandardWindow = new class implements IStandardWin
|
|||
// modern browsers
|
||||
return window.scrollY;
|
||||
} else {
|
||||
return document.body.scrollTop + document.documentElement.scrollTop;
|
||||
return document.body.scrollTop + document.documentElement!.scrollTop;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -728,7 +728,7 @@ export function getLargestChildWidth(parent: HTMLElement, children: HTMLElement[
|
|||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
export function isAncestor(testChild: Node, testAncestor: Node): boolean {
|
||||
export function isAncestor(testChild: Node | null, testAncestor: Node): boolean {
|
||||
while (testChild) {
|
||||
if (testChild === testAncestor) {
|
||||
return true;
|
||||
|
@ -739,7 +739,7 @@ export function isAncestor(testChild: Node, testAncestor: Node): boolean {
|
|||
return false;
|
||||
}
|
||||
|
||||
export function findParentWithClass(node: HTMLElement, clazz: string, stopAtClazzOrNode?: string | HTMLElement): HTMLElement {
|
||||
export function findParentWithClass(node: HTMLElement, clazz: string, stopAtClazzOrNode?: string | HTMLElement): HTMLElement | null {
|
||||
while (node) {
|
||||
if (hasClass(node, clazz)) {
|
||||
return node;
|
||||
|
@ -771,7 +771,7 @@ export function createStyleSheet(container: HTMLElement = document.getElementsBy
|
|||
return style;
|
||||
}
|
||||
|
||||
let _sharedStyleSheet: HTMLStyleElement = null;
|
||||
let _sharedStyleSheet: HTMLStyleElement | null = null;
|
||||
function getSharedStyleSheet(): HTMLStyleElement {
|
||||
if (!_sharedStyleSheet) {
|
||||
_sharedStyleSheet = createStyleSheet();
|
||||
|
@ -1002,17 +1002,18 @@ export function $<T extends HTMLElement>(description: string, attrs?: { [key: st
|
|||
result.className = match[4].replace(/\./g, ' ').trim();
|
||||
}
|
||||
|
||||
Object.keys(attrs || {}).forEach(name => {
|
||||
attrs = attrs || {};
|
||||
Object.keys(attrs).forEach(name => {
|
||||
const value = attrs![name];
|
||||
if (/^on\w+$/.test(name)) {
|
||||
(<any>result)[name] = attrs[name];
|
||||
(<any>result)[name] = value;
|
||||
} else if (name === 'selected') {
|
||||
const value = attrs[name];
|
||||
if (value) {
|
||||
result.setAttribute(name, 'true');
|
||||
}
|
||||
|
||||
} else {
|
||||
result.setAttribute(name, attrs[name]);
|
||||
result.setAttribute(name, value);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1061,7 +1062,7 @@ export function hide(...elements: HTMLElement[]): void {
|
|||
}
|
||||
}
|
||||
|
||||
function findParentWithAttribute(node: Node, attribute: string): HTMLElement {
|
||||
function findParentWithAttribute(node: Node | null, attribute: string): HTMLElement | null {
|
||||
while (node) {
|
||||
if (node instanceof HTMLElement && node.hasAttribute(attribute)) {
|
||||
return node;
|
||||
|
|
|
@ -14,13 +14,13 @@ export interface IWindowChainElement {
|
|||
/**
|
||||
* The iframe element inside the window.parent corresponding to window
|
||||
*/
|
||||
iframeElement: HTMLIFrameElement;
|
||||
iframeElement: HTMLIFrameElement | null;
|
||||
}
|
||||
|
||||
let hasDifferentOriginAncestorFlag: boolean = false;
|
||||
let sameOriginWindowChainCache: IWindowChainElement[] = null;
|
||||
let sameOriginWindowChainCache: IWindowChainElement[] | null = null;
|
||||
|
||||
function getParentWindowIfSameOrigin(w: Window): Window {
|
||||
function getParentWindowIfSameOrigin(w: Window): Window | null {
|
||||
if (!w.parent || w.parent === w) {
|
||||
return null;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ function getParentWindowIfSameOrigin(w: Window): Window {
|
|||
return w.parent;
|
||||
}
|
||||
|
||||
function findIframeElementInParentWindow(parentWindow: Window, childWindow: Window): HTMLIFrameElement {
|
||||
function findIframeElementInParentWindow(parentWindow: Window, childWindow: Window): HTMLIFrameElement | null {
|
||||
let parentWindowIframes = parentWindow.document.getElementsByTagName('iframe');
|
||||
let iframe: HTMLIFrameElement;
|
||||
for (let i = 0, len = parentWindowIframes.length; i < len; i++) {
|
||||
|
@ -63,7 +63,8 @@ export class IframeUtils {
|
|||
public static getSameOriginWindowChain(): IWindowChainElement[] {
|
||||
if (!sameOriginWindowChainCache) {
|
||||
sameOriginWindowChainCache = [];
|
||||
let w = window, parent: Window;
|
||||
let w: Window | null = window;
|
||||
let parent: Window | null;
|
||||
do {
|
||||
parent = getParentWindowIfSameOrigin(w);
|
||||
if (parent) {
|
||||
|
|
|
@ -66,8 +66,8 @@ export class StandardMouseEvent implements IMouseEvent {
|
|||
this.posy = e.pageY;
|
||||
} else {
|
||||
// Probably hit by MSGestureEvent
|
||||
this.posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
|
||||
this.posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
|
||||
this.posx = e.clientX + document.body.scrollLeft + document.documentElement!.scrollLeft;
|
||||
this.posy = e.clientY + document.body.scrollTop + document.documentElement!.scrollTop;
|
||||
}
|
||||
|
||||
// Find the position of the iframe this code is executing in relative to the iframe where the event was captured.
|
||||
|
|
|
@ -286,7 +286,7 @@ export class ActionItem extends BaseActionItem {
|
|||
}
|
||||
|
||||
updateTooltip(): void {
|
||||
let title: string = null;
|
||||
let title: string | null = null;
|
||||
|
||||
if (this.getAction().tooltip) {
|
||||
title = this.getAction().tooltip;
|
||||
|
@ -602,7 +602,7 @@ export class ActionBar extends Disposable implements IActionRunner {
|
|||
e.stopPropagation();
|
||||
}));
|
||||
|
||||
let item: IActionItem = null;
|
||||
let item: IActionItem | null = null;
|
||||
|
||||
if (this.options.actionItemProvider) {
|
||||
item = this.options.actionItemProvider(action);
|
||||
|
|
|
@ -260,7 +260,7 @@ export class InputBox extends Widget {
|
|||
return document.activeElement === this.input;
|
||||
}
|
||||
|
||||
public select(range: IRange = null): void {
|
||||
public select(range: IRange | null = null): void {
|
||||
this.input.select();
|
||||
|
||||
if (range) {
|
||||
|
@ -339,7 +339,7 @@ export class InputBox extends Widget {
|
|||
}
|
||||
|
||||
public validate(): boolean {
|
||||
let errorMsg: IMessage = null;
|
||||
let errorMsg: IMessage | null = null;
|
||||
|
||||
if (this.validation) {
|
||||
errorMsg = this.validation(this.value);
|
||||
|
|
|
@ -60,7 +60,7 @@ export function shift({ start, end }: IRange, much: number): IRange {
|
|||
*/
|
||||
export function consolidate(groups: IRangedGroup[]): IRangedGroup[] {
|
||||
const result: IRangedGroup[] = [];
|
||||
let previousGroup: IRangedGroup = null;
|
||||
let previousGroup: IRangedGroup | null = null;
|
||||
|
||||
for (let group of groups) {
|
||||
const start = group.range.start;
|
||||
|
|
|
@ -347,7 +347,7 @@ class MenuActionItem extends BaseActionItem {
|
|||
}
|
||||
|
||||
updateTooltip(): void {
|
||||
let title: string = null;
|
||||
let title: string | null = null;
|
||||
|
||||
if (this.getAction().tooltip) {
|
||||
title = this.getAction().tooltip;
|
||||
|
|
|
@ -78,8 +78,16 @@
|
|||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row > .option-text-description {
|
||||
display: none;
|
||||
/* Accepted CSS hiding technique for accessibility reader text */
|
||||
/* https://webaim.org/techniques/css/invisiblecontent/ */
|
||||
|
||||
.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row > .visually-hidden {
|
||||
position: absolute;
|
||||
left: -10000px;
|
||||
top: auto;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.monaco-select-box-dropdown-container > .select-box-dropdown-container-width-control {
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
import 'vs/css!./selectBoxCustom';
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { Event, Emitter, chain } from 'vs/base/common/event';
|
||||
import { KeyCode, KeyCodeUtils } from 'vs/base/common/keyCodes';
|
||||
|
@ -50,6 +49,7 @@ class SelectListRenderer implements IRenderer<ISelectOptionItem, ISelectListTemp
|
|||
data.root = container;
|
||||
data.optionText = dom.append(container, $('.option-text'));
|
||||
data.optionDescriptionText = dom.append(container, $('.option-text-description'));
|
||||
dom.addClass(data.optionDescriptionText, 'visually-hidden');
|
||||
|
||||
return data;
|
||||
}
|
||||
|
@ -60,18 +60,14 @@ class SelectListRenderer implements IRenderer<ISelectOptionItem, ISelectListTemp
|
|||
const optionDisabled = (<ISelectOptionItem>element).optionDisabled;
|
||||
|
||||
data.optionText.textContent = optionText;
|
||||
data.root.setAttribute('aria-label', nls.localize('selectAriaOption', "{0}", optionText) + ',.');
|
||||
|
||||
if (typeof element.optionDescriptionText === 'string') {
|
||||
const optionDescriptionId = (optionText.replace(/ /g, '_').toLowerCase() + '_description_' + data.root.id);
|
||||
data.root.setAttribute('aria-describedby', optionDescriptionId);
|
||||
data.optionText.setAttribute('aria-describedby', optionDescriptionId);
|
||||
data.optionDescriptionText.id = optionDescriptionId;
|
||||
data.optionDescriptionText.setAttribute('aria-label', element.optionDescriptionText);
|
||||
data.optionDescriptionText.innerText = element.optionDescriptionText;
|
||||
}
|
||||
|
||||
// Workaround for list labels
|
||||
data.root.setAttribute('aria-selected', 'true');
|
||||
|
||||
// pseudo-select disabled option
|
||||
if (optionDisabled) {
|
||||
dom.addClass((<HTMLElement>data.root), 'option-disabled');
|
||||
|
|
|
@ -46,7 +46,6 @@ export abstract class Panel implements IView {
|
|||
protected _expanded: boolean;
|
||||
protected disposables: IDisposable[] = [];
|
||||
|
||||
private expandedSize: number | undefined = undefined;
|
||||
private _headerVisible = true;
|
||||
private _minimumBodySize: number;
|
||||
private _maximumBodySize: number;
|
||||
|
@ -55,6 +54,9 @@ export abstract class Panel implements IView {
|
|||
|
||||
private header: HTMLElement;
|
||||
|
||||
private cachedExpandedSize: number | undefined = undefined;
|
||||
private cachedBodySize: number | undefined = undefined;
|
||||
|
||||
private _onDidChange = new Emitter<number | undefined>();
|
||||
readonly onDidChange: Event<number | undefined> = this._onDidChange.event;
|
||||
|
||||
|
@ -129,7 +131,7 @@ export abstract class Panel implements IView {
|
|||
|
||||
this._expanded = !!expanded;
|
||||
this.updateHeader();
|
||||
this._onDidChange.fire(expanded ? this.expandedSize : undefined);
|
||||
this._onDidChange.fire(expanded ? this.cachedExpandedSize : undefined);
|
||||
}
|
||||
|
||||
get headerVisible(): boolean {
|
||||
|
@ -190,8 +192,14 @@ export abstract class Panel implements IView {
|
|||
const headerSize = this.headerVisible ? Panel.HEADER_SIZE : 0;
|
||||
|
||||
if (this.isExpanded()) {
|
||||
this.layoutBody(size - headerSize);
|
||||
this.expandedSize = size;
|
||||
const bodySize = size - headerSize;
|
||||
|
||||
if (bodySize !== this.cachedBodySize) {
|
||||
this.layoutBody(bodySize);
|
||||
this.cachedBodySize = bodySize;
|
||||
}
|
||||
|
||||
this.cachedExpandedSize = size;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -326,7 +334,7 @@ class PanelDraggable extends Disposable {
|
|||
}
|
||||
|
||||
private render(): void {
|
||||
let backgroundColor: string = null;
|
||||
let backgroundColor: string | null = null;
|
||||
|
||||
if (this.dragOverCounter > 0) {
|
||||
backgroundColor = (this.panel.dropBackground || PanelDraggable.DefaultDragOverBackgroundColor).toString();
|
||||
|
|
|
@ -60,7 +60,7 @@ export class Action implements IAction {
|
|||
protected _enabled: boolean;
|
||||
protected _checked: boolean;
|
||||
protected _radio: boolean;
|
||||
protected _actionCallback: (event?: any) => Thenable<any>;
|
||||
protected _actionCallback?: (event?: any) => Thenable<any>;
|
||||
|
||||
constructor(id: string, label: string = '', cssClass: string = '', enabled: boolean = true, actionCallback?: (event?: any) => Thenable<any>) {
|
||||
this._id = id;
|
||||
|
@ -165,7 +165,7 @@ export class Action implements IAction {
|
|||
}
|
||||
|
||||
run(event?: any, _data?: ITelemetryData): Thenable<any> {
|
||||
if (this._actionCallback !== void 0) {
|
||||
if (this._actionCallback) {
|
||||
return this._actionCallback(event);
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ function _sort<T>(a: T[], compare: Compare<T>, lo: number, hi: number, aux: T[])
|
|||
|
||||
export function groupBy<T>(data: T[], compare: (a: T, b: T) => number): T[][] {
|
||||
const result: T[][] = [];
|
||||
let currentGroup: T[];
|
||||
let currentGroup: T[] | undefined = undefined;
|
||||
for (const element of mergeSort(data.slice(0), compare)) {
|
||||
if (!currentGroup || compare(currentGroup[0], element) !== 0) {
|
||||
currentGroup = [element];
|
||||
|
@ -388,7 +388,9 @@ export function firstIndex<T>(array: T[] | ReadonlyArray<T>, fn: (item: T) => bo
|
|||
return -1;
|
||||
}
|
||||
|
||||
export function first<T>(array: T[] | ReadonlyArray<T>, fn: (item: T) => boolean, notFoundValue: T = null): T {
|
||||
export function first<T>(array: T[] | ReadonlyArray<T>, fn: (item: T) => boolean, notFoundValue: T): T;
|
||||
export function first<T>(array: T[] | ReadonlyArray<T>, fn: (item: T) => boolean): T | null;
|
||||
export function first<T>(array: T[] | ReadonlyArray<T>, fn: (item: T) => boolean, notFoundValue: T | null = null): T | null {
|
||||
const index = firstIndex(array, fn);
|
||||
return index < 0 ? notFoundValue : array[index];
|
||||
}
|
||||
|
@ -404,7 +406,7 @@ export function commonPrefixLength<T>(one: T[], other: T[], equals: (a: T, b: T)
|
|||
}
|
||||
|
||||
export function flatten<T>(arr: T[][]): T[] {
|
||||
return [].concat(...arr);
|
||||
return (<T[]>[]).concat(...arr);
|
||||
}
|
||||
|
||||
export function range(to: number): number[];
|
||||
|
@ -481,15 +483,20 @@ export function arrayInsert<T>(target: T[], insertIndex: number, insertArr: T[])
|
|||
* Uses Fisher-Yates shuffle to shuffle the given array
|
||||
* @param array
|
||||
*/
|
||||
export function shuffle<T>(array: T[], seed?: number): void {
|
||||
// Seeded random number generator in JS. Modified from:
|
||||
// https://stackoverflow.com/questions/521295/seeding-the-random-number-generator-in-javascript
|
||||
const random = () => {
|
||||
var x = Math.sin(seed++) * 179426549; // throw away most significant digits and reduce any potential bias
|
||||
return x - Math.floor(x);
|
||||
};
|
||||
export function shuffle<T>(array: T[], _seed?: number): void {
|
||||
let rand: () => number;
|
||||
|
||||
const rand = typeof seed === 'number' ? random : Math.random;
|
||||
if (typeof _seed === 'number') {
|
||||
let seed = _seed;
|
||||
// Seeded random number generator in JS. Modified from:
|
||||
// https://stackoverflow.com/questions/521295/seeding-the-random-number-generator-in-javascript
|
||||
rand = () => {
|
||||
var x = Math.sin(seed++) * 179426549; // throw away most significant digits and reduce any potential bias
|
||||
return x - Math.floor(x);
|
||||
};
|
||||
} else {
|
||||
rand = Math.random;
|
||||
}
|
||||
|
||||
for (let i = array.length - 1; i > 0; i -= 1) {
|
||||
let j = Math.floor(rand() * (i + 1));
|
||||
|
|
|
@ -91,9 +91,9 @@ export interface ITask<T> {
|
|||
*/
|
||||
export class Throttler {
|
||||
|
||||
private activePromise: TPromise;
|
||||
private queuedPromise: TPromise;
|
||||
private queuedPromiseFactory: ITask<TPromise>;
|
||||
private activePromise: TPromise | null;
|
||||
private queuedPromise: TPromise | null;
|
||||
private queuedPromiseFactory: ITask<TPromise> | null;
|
||||
|
||||
constructor() {
|
||||
this.activePromise = null;
|
||||
|
@ -109,26 +109,26 @@ export class Throttler {
|
|||
const onComplete = () => {
|
||||
this.queuedPromise = null;
|
||||
|
||||
const result = this.queue(this.queuedPromiseFactory);
|
||||
const result = this.queue(this.queuedPromiseFactory!);
|
||||
this.queuedPromiseFactory = null;
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
this.queuedPromise = new TPromise(c => {
|
||||
this.activePromise.then(onComplete, onComplete).then(c);
|
||||
this.activePromise!.then(onComplete, onComplete).then(c);
|
||||
});
|
||||
}
|
||||
|
||||
return new TPromise((c, e) => {
|
||||
this.queuedPromise.then(c, e);
|
||||
this.queuedPromise!.then(c, e);
|
||||
});
|
||||
}
|
||||
|
||||
this.activePromise = promiseFactory();
|
||||
|
||||
return new TPromise((c, e) => {
|
||||
this.activePromise.then((result: any) => {
|
||||
this.activePromise!.then((result: any) => {
|
||||
this.activePromise = null;
|
||||
c(result);
|
||||
}, (err: any) => {
|
||||
|
@ -175,10 +175,10 @@ export class SimpleThrottler {
|
|||
export class Delayer<T> {
|
||||
|
||||
private timeout: any;
|
||||
private completionPromise: TPromise;
|
||||
private doResolve: ValueCallback;
|
||||
private completionPromise: TPromise | null;
|
||||
private doResolve: ValueCallback | null;
|
||||
private doReject: (err: any) => void;
|
||||
private task: ITask<T | TPromise<T>>;
|
||||
private task: ITask<T | TPromise<T>> | null;
|
||||
|
||||
constructor(public defaultDelay: number) {
|
||||
this.timeout = null;
|
||||
|
@ -198,7 +198,7 @@ export class Delayer<T> {
|
|||
}).then(() => {
|
||||
this.completionPromise = null;
|
||||
this.doResolve = null;
|
||||
const task = this.task;
|
||||
const task = this.task!;
|
||||
this.task = null;
|
||||
|
||||
return task();
|
||||
|
@ -207,7 +207,7 @@ export class Delayer<T> {
|
|||
|
||||
this.timeout = setTimeout(() => {
|
||||
this.timeout = null;
|
||||
this.doResolve(null);
|
||||
this.doResolve!(null);
|
||||
}, delay);
|
||||
|
||||
return this.completionPromise;
|
||||
|
@ -363,11 +363,11 @@ export function sequence<T>(promiseFactories: ITask<Thenable<T>>[]): Promise<T[]
|
|||
return Promise.resolve(null).then(thenHandler);
|
||||
}
|
||||
|
||||
export function first<T>(promiseFactories: ITask<Thenable<T>>[], shouldStop: (t: T) => boolean = t => !!t, defaultValue: T = null): Promise<T> {
|
||||
export function first<T>(promiseFactories: ITask<Thenable<T>>[], shouldStop: (t: T) => boolean = t => !!t, defaultValue: T | null = null): Promise<T | null> {
|
||||
let index = 0;
|
||||
const len = promiseFactories.length;
|
||||
|
||||
const loop: () => Promise<T> = () => {
|
||||
const loop: () => Promise<T | null> = () => {
|
||||
if (index >= len) {
|
||||
return Promise.resolve(defaultValue);
|
||||
}
|
||||
|
@ -429,7 +429,7 @@ export class Limiter<T> {
|
|||
|
||||
private consume(): void {
|
||||
while (this.outstandingPromises.length && this.runningPromises < this.maxDegreeOfParalellism) {
|
||||
const iLimitedTask = this.outstandingPromises.shift();
|
||||
const iLimitedTask = this.outstandingPromises.shift()!;
|
||||
this.runningPromises++;
|
||||
|
||||
const promise = iLimitedTask.factory();
|
||||
|
@ -567,7 +567,7 @@ export class IntervalTimer extends Disposable {
|
|||
|
||||
export class RunOnceScheduler {
|
||||
|
||||
protected runner: (...args: any[]) => void;
|
||||
protected runner: ((...args: any[]) => void) | null;
|
||||
|
||||
private timeoutToken: any;
|
||||
private timeout: number;
|
||||
|
@ -621,7 +621,9 @@ export class RunOnceScheduler {
|
|||
}
|
||||
|
||||
protected doRun(): void {
|
||||
this.runner();
|
||||
if (this.runner) {
|
||||
this.runner();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -644,7 +646,9 @@ export class RunOnceWorker<T> extends RunOnceScheduler {
|
|||
const units = this.units;
|
||||
this.units = [];
|
||||
|
||||
this.runner(units);
|
||||
if (this.runner) {
|
||||
this.runner(units);
|
||||
}
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
|
@ -689,12 +693,30 @@ declare function cancelIdleCallback(handle: number): void;
|
|||
});
|
||||
runWhenIdle = (runner, timeout = 0) => {
|
||||
let handle = setTimeout(() => runner(dummyIdle), timeout);
|
||||
return { dispose() { clearTimeout(handle); handle = undefined; } };
|
||||
let disposed = false;
|
||||
return {
|
||||
dispose() {
|
||||
if (disposed) {
|
||||
return;
|
||||
}
|
||||
disposed = true;
|
||||
clearTimeout(handle);
|
||||
}
|
||||
};
|
||||
};
|
||||
} else {
|
||||
runWhenIdle = (runner, timeout?) => {
|
||||
let handle = requestIdleCallback(runner, typeof timeout === 'number' ? { timeout } : undefined);
|
||||
return { dispose() { cancelIdleCallback(handle); handle = undefined; } };
|
||||
let handle: number = requestIdleCallback(runner, typeof timeout === 'number' ? { timeout } : undefined);
|
||||
let disposed = false;
|
||||
return {
|
||||
dispose() {
|
||||
if (disposed) {
|
||||
return;
|
||||
}
|
||||
disposed = true;
|
||||
cancelIdleCallback(handle);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
})();
|
||||
|
|
|
@ -13,7 +13,7 @@ export interface CacheResult<T> {
|
|||
|
||||
export class Cache<T> {
|
||||
|
||||
private result: CacheResult<T> = null;
|
||||
private result: CacheResult<T> | null = null;
|
||||
constructor(private task: (ct: CancellationToken) => Promise<T>) { }
|
||||
|
||||
get(): CacheResult<T> {
|
||||
|
|
|
@ -51,7 +51,7 @@ export namespace CancellationToken {
|
|||
class MutableToken implements CancellationToken {
|
||||
|
||||
private _isCancelled: boolean = false;
|
||||
private _emitter: Emitter<any>;
|
||||
private _emitter: Emitter<any> | null = null;
|
||||
|
||||
public cancel() {
|
||||
if (!this._isCancelled) {
|
||||
|
@ -80,7 +80,7 @@ class MutableToken implements CancellationToken {
|
|||
public dispose(): void {
|
||||
if (this._emitter) {
|
||||
this._emitter.dispose();
|
||||
this._emitter = undefined;
|
||||
this._emitter = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ export function size<T>(from: IStringDictionary<T> | INumberDictionary<T>): numb
|
|||
return count;
|
||||
}
|
||||
|
||||
export function first<T>(from: IStringDictionary<T> | INumberDictionary<T>): T {
|
||||
export function first<T>(from: IStringDictionary<T> | INumberDictionary<T>): T | undefined {
|
||||
for (let key in from) {
|
||||
if (hasOwnProperty.call(from, key)) {
|
||||
return from[key];
|
||||
|
|