mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-20 02:08:47 +00:00
@@ -1,9 +1,10 @@
|
||||
{
|
||||
"env": {
|
||||
"node": true
|
||||
"node": true,
|
||||
"es6": true
|
||||
},
|
||||
"rules": {
|
||||
"no-undef": 2,
|
||||
"no-unused-vars": 1
|
||||
}
|
||||
"no-console": 0
|
||||
},
|
||||
"extends": "eslint:recommended"
|
||||
}
|
||||
6
.vscode/tasks.json
vendored
6
.vscode/tasks.json
vendored
@@ -25,14 +25,14 @@
|
||||
"absolute"
|
||||
],
|
||||
"pattern": {
|
||||
"regexp": "^\\*\\*\\* Error: ([^(]+)\\((\\d+|\\d+,\\d+|\\d+,\\d+,\\d+,\\d+)\\): (.*)$",
|
||||
"regexp": "Error: ([^(]+)\\((\\d+|\\d+,\\d+|\\d+,\\d+,\\d+,\\d+)\\): (.*)$",
|
||||
"file": 1,
|
||||
"location": 2,
|
||||
"message": 3
|
||||
},
|
||||
"watching": {
|
||||
"beginsPattern": "^\\*\\*\\* Starting\\.\\.\\.$",
|
||||
"endsPattern": "^\\*\\*\\* Finished"
|
||||
"beginsPattern": "Starting compilation",
|
||||
"endsPattern": "Finished compilation"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -17,8 +17,6 @@ var util = require('./lib/util');
|
||||
var i18n = require('./lib/i18n');
|
||||
var gulpUtil = require('gulp-util');
|
||||
|
||||
var quiet = !!process.env['VSCODE_BUILD_QUIET'];
|
||||
|
||||
function log(prefix, message) {
|
||||
gulpUtil.log(gulpUtil.colors.cyan('[' + prefix + ']'), message);
|
||||
}
|
||||
@@ -26,16 +24,6 @@ function log(prefix, message) {
|
||||
var root = path.dirname(__dirname);
|
||||
var commit = util.getVersion(root);
|
||||
|
||||
var tsOptions = {
|
||||
target: 'ES5',
|
||||
module: 'amd',
|
||||
verbose: !quiet,
|
||||
preserveConstEnums: true,
|
||||
experimentalDecorators: true,
|
||||
sourceMap: true,
|
||||
rootDir: path.join(path.dirname(__dirname), 'src')
|
||||
};
|
||||
|
||||
exports.loaderConfig = function (emptyPaths) {
|
||||
var result = {
|
||||
paths: {
|
||||
@@ -75,7 +63,7 @@ function loader(bundledFileHeader) {
|
||||
.pipe(util.loadSourcemaps())
|
||||
.pipe(concat('vs/loader.js'))
|
||||
.pipe(es.mapSync(function (f) {
|
||||
f.sourceMap.sourceRoot = util.toFileUri(tsOptions.rootDir);
|
||||
f.sourceMap.sourceRoot = util.toFileUri(path.join(path.dirname(__dirname), 'src'));
|
||||
return f;
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ var glob = require('glob');
|
||||
var sourcemaps = require('gulp-sourcemaps');
|
||||
var nlsDev = require('vscode-nls-dev');
|
||||
|
||||
var quiet = !!process.env['VSCODE_BUILD_QUIET'];
|
||||
var extensionsPath = path.join(path.dirname(__dirname), 'extensions');
|
||||
|
||||
var compilations = glob.sync('**/tsconfig.json', {
|
||||
@@ -34,7 +33,7 @@ var tasks = compilations.map(function(tsconfigFile) {
|
||||
var relativeDirname = path.dirname(tsconfigFile);
|
||||
|
||||
var tsOptions = require(absolutePath).compilerOptions;
|
||||
tsOptions.verbose = !quiet;
|
||||
tsOptions.verbose = false;
|
||||
tsOptions.sourceMap = true;
|
||||
|
||||
var name = relativeDirname.replace(/\//g, '-');
|
||||
@@ -56,15 +55,15 @@ var tasks = compilations.map(function(tsconfigFile) {
|
||||
var i18n = path.join(__dirname, '..', 'i18n');
|
||||
|
||||
function createPipeline(build) {
|
||||
var reporter = quiet ? null : createReporter();
|
||||
var reporter = createReporter();
|
||||
|
||||
tsOptions.inlineSources = !!build;
|
||||
var compilation = tsb.create(tsOptions, null, null, quiet ? null : function (err) { reporter(err.toString()); });
|
||||
var compilation = tsb.create(tsOptions, null, null, err => reporter(err.toString()));
|
||||
|
||||
return function () {
|
||||
var input = es.through();
|
||||
var tsFilter = filter(['**/*.ts', '!**/lib/lib*.d.ts', '!**/node_modules/**'], { restore: true });
|
||||
var output = input
|
||||
const input = es.through();
|
||||
const tsFilter = filter(['**/*.ts', '!**/lib/lib*.d.ts', '!**/node_modules/**'], { restore: true });
|
||||
const output = input
|
||||
.pipe(tsFilter)
|
||||
.pipe(util.loadSourcemaps())
|
||||
.pipe(compilation())
|
||||
@@ -73,27 +72,27 @@ var tasks = compilations.map(function(tsconfigFile) {
|
||||
addComment: false,
|
||||
includeContent: !!build,
|
||||
sourceRoot: function(file) {
|
||||
var levels = file.relative.split(path.sep).length;
|
||||
const levels = file.relative.split(path.sep).length;
|
||||
return '../'.repeat(levels) + 'src';
|
||||
}
|
||||
}))
|
||||
.pipe(tsFilter.restore)
|
||||
.pipe(build ? nlsDev.createAdditionalLanguageFiles(languages, i18n, out) : es.through())
|
||||
.pipe(quiet ? es.through() : reporter.end());
|
||||
.pipe(reporter.end());
|
||||
|
||||
return es.duplex(input, output);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
var srcOpts = { cwd: path.dirname(__dirname), base: srcBase };
|
||||
const srcOpts = { cwd: path.dirname(__dirname), base: srcBase };
|
||||
|
||||
gulp.task(clean, function (cb) {
|
||||
rimraf(out, cb);
|
||||
});
|
||||
|
||||
gulp.task(compile, [clean], function () {
|
||||
var pipeline = createPipeline(false);
|
||||
var input = gulp.src(src, srcOpts);
|
||||
const pipeline = createPipeline(false);
|
||||
const input = gulp.src(src, srcOpts);
|
||||
|
||||
return input
|
||||
.pipe(pipeline())
|
||||
@@ -101,9 +100,9 @@ var tasks = compilations.map(function(tsconfigFile) {
|
||||
});
|
||||
|
||||
gulp.task(watch, [clean], function () {
|
||||
var pipeline = createPipeline(false);
|
||||
var input = gulp.src(src, srcOpts);
|
||||
var watchInput = watcher(src, srcOpts);
|
||||
const pipeline = createPipeline(false);
|
||||
const input = gulp.src(src, srcOpts);
|
||||
const watchInput = watcher(src, srcOpts);
|
||||
|
||||
return watchInput
|
||||
.pipe(util.incremental(pipeline, input))
|
||||
@@ -115,8 +114,8 @@ var tasks = compilations.map(function(tsconfigFile) {
|
||||
});
|
||||
|
||||
gulp.task(compileBuild, [clean], function () {
|
||||
var pipeline = createPipeline(true);
|
||||
var input = gulp.src(src, srcOpts);
|
||||
const pipeline = createPipeline(true);
|
||||
const input = gulp.src(src, srcOpts);
|
||||
|
||||
return input
|
||||
.pipe(pipeline())
|
||||
@@ -124,8 +123,9 @@ var tasks = compilations.map(function(tsconfigFile) {
|
||||
});
|
||||
|
||||
gulp.task(watchBuild, [clean], function () {
|
||||
var input = gulp.src(src, srcOpts);
|
||||
var watchInput = watcher(src, srcOpts);
|
||||
const pipeline = createPipeline(true);
|
||||
const input = gulp.src(src, srcOpts);
|
||||
const watchInput = watcher(src, srcOpts);
|
||||
|
||||
return watchInput
|
||||
.pipe(util.incremental(function () { return pipeline(true); }, input))
|
||||
|
||||
@@ -8,16 +8,12 @@ var fs = require('fs');
|
||||
var event_stream_1 = require('event-stream');
|
||||
var File = require('vinyl');
|
||||
var Is = require('is');
|
||||
var quiet = !!process.env['VSCODE_BUILD_QUIET'] && false;
|
||||
var util = require('gulp-util');
|
||||
function log(message) {
|
||||
var rest = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
rest[_i - 1] = arguments[_i];
|
||||
}
|
||||
if (quiet) {
|
||||
return;
|
||||
}
|
||||
util.log.apply(util, [util.colors.cyan('[i18n]'), message].concat(rest));
|
||||
}
|
||||
var LocalizeInfo;
|
||||
|
||||
@@ -11,13 +11,8 @@ import { ThroughStream } from 'through';
|
||||
import File = require('vinyl');
|
||||
import * as Is from 'is';
|
||||
|
||||
const quiet = !!process.env['VSCODE_BUILD_QUIET'] && false;
|
||||
|
||||
var util = require('gulp-util');
|
||||
function log(message: any, ...rest: any[]): void {
|
||||
if (quiet) {
|
||||
return;
|
||||
}
|
||||
util.log(util.colors.cyan('[i18n]'), message, ...rest);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,18 +3,23 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
var es = require('event-stream');
|
||||
var _ = require('underscore');
|
||||
'use strict';
|
||||
|
||||
var allErrors = [];
|
||||
var count = 0;
|
||||
const es = require('event-stream');
|
||||
const _ = require('underscore');
|
||||
const util = require('gulp-util');
|
||||
|
||||
const allErrors = [];
|
||||
let startTime = null;
|
||||
let count = 0;
|
||||
|
||||
function onStart() {
|
||||
if (count++ > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('*** Starting...');
|
||||
startTime = new Date().getTime();
|
||||
util.log(util.colors.green('Starting compilation'));
|
||||
}
|
||||
|
||||
function onEnd() {
|
||||
@@ -23,8 +28,9 @@ function onEnd() {
|
||||
}
|
||||
|
||||
var errors = _.flatten(allErrors);
|
||||
errors.map(function (err) { console.error('*** Error:', err); });
|
||||
console.log('*** Finished with', errors.length, 'errors.');
|
||||
errors.map(err => util.log(`${ util.colors.red('Error') }: ${ err }`));
|
||||
|
||||
util.log(`${ util.colors.green('Finished compilation') } with ${ util.colors.red(errors.length + ' errors') } in ${ util.colors.blue((new Date().getTime() - startTime) + 'ms') }.`);
|
||||
}
|
||||
|
||||
module.exports = function () {
|
||||
|
||||
@@ -275,3 +275,16 @@ exports.rebase = function (count) {
|
||||
f.dirname = parts.slice(count).join(path.sep);
|
||||
});
|
||||
};
|
||||
|
||||
exports.filter = fn => {
|
||||
const result = es.through(function(data) {
|
||||
if (fn(data)) {
|
||||
this.emit('data', data);
|
||||
} else {
|
||||
result.restore.push(data);
|
||||
}
|
||||
});
|
||||
|
||||
result.restore = es.through();
|
||||
return result;
|
||||
};
|
||||
@@ -202,7 +202,7 @@ function format(text) {
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
|
||||
InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: true,
|
||||
PlaceOpenBraceOnNewLineForFunctions: false,
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: false
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: false,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
142
gulpfile.js
142
gulpfile.js
@@ -3,72 +3,53 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// Increase max listeners for event emitters
|
||||
require('events').EventEmitter.defaultMaxListeners = 100;
|
||||
|
||||
var gulp = require('gulp');
|
||||
var json = require('gulp-json-editor');
|
||||
var buffer = require('gulp-buffer');
|
||||
var tsb = require('gulp-tsb');
|
||||
var filter = require('gulp-filter');
|
||||
var mocha = require('gulp-mocha');
|
||||
var es = require('event-stream');
|
||||
var watch = require('./build/lib/watch');
|
||||
var nls = require('./build/lib/nls');
|
||||
var util = require('./build/lib/util');
|
||||
var reporter = require('./build/lib/reporter')();
|
||||
var remote = require('gulp-remote-src');
|
||||
var zip = require('gulp-vinyl-zip');
|
||||
var path = require('path');
|
||||
var bom = require('gulp-bom');
|
||||
var sourcemaps = require('gulp-sourcemaps');
|
||||
var _ = require('underscore');
|
||||
var assign = require('object-assign');
|
||||
var quiet = !!process.env['VSCODE_BUILD_QUIET'];
|
||||
var monacodts = require('./build/monaco/api');
|
||||
var fs = require('fs');
|
||||
const gulp = require('gulp');
|
||||
const json = require('gulp-json-editor');
|
||||
const buffer = require('gulp-buffer');
|
||||
const tsb = require('gulp-tsb');
|
||||
const filter = require('gulp-filter');
|
||||
const mocha = require('gulp-mocha');
|
||||
const es = require('event-stream');
|
||||
const watch = require('./build/lib/watch');
|
||||
const nls = require('./build/lib/nls');
|
||||
const util = require('./build/lib/util');
|
||||
const reporter = require('./build/lib/reporter')();
|
||||
const remote = require('gulp-remote-src');
|
||||
const zip = require('gulp-vinyl-zip');
|
||||
const path = require('path');
|
||||
const bom = require('gulp-bom');
|
||||
const sourcemaps = require('gulp-sourcemaps');
|
||||
const _ = require('underscore');
|
||||
const assign = require('object-assign');
|
||||
const monacodts = require('./build/monaco/api');
|
||||
const fs = require('fs');
|
||||
|
||||
var rootDir = path.join(__dirname, 'src');
|
||||
var tsOptions = {
|
||||
target: 'ES5',
|
||||
declaration: true,
|
||||
module: 'amd',
|
||||
verbose: !quiet,
|
||||
preserveConstEnums: true,
|
||||
experimentalDecorators: true,
|
||||
sourceMap: true,
|
||||
rootDir: rootDir,
|
||||
sourceRoot: util.toFileUri(rootDir)
|
||||
};
|
||||
|
||||
function createFastFilter(filterFn) {
|
||||
var result = es.through(function(data) {
|
||||
if (filterFn(data)) {
|
||||
this.emit('data', data);
|
||||
} else {
|
||||
result.restore.push(data);
|
||||
}
|
||||
});
|
||||
result.restore = es.through();
|
||||
return result;
|
||||
}
|
||||
const rootDir = path.join(__dirname, 'src');
|
||||
const options = require('./src/tsconfig.json').compilerOptions;
|
||||
options.verbose = false;
|
||||
options.sourceMap = true;
|
||||
options.rootDir = rootDir;
|
||||
options.sourceRoot = util.toFileUri(rootDir);
|
||||
|
||||
function createCompile(build, emitError) {
|
||||
var opts = _.clone(tsOptions);
|
||||
const opts = _.clone(options);
|
||||
opts.inlineSources = !!build;
|
||||
opts.noFilesystemLookup = true;
|
||||
|
||||
var ts = tsb.create(opts, null, null, quiet ? null : function (err) {
|
||||
reporter(err.toString());
|
||||
});
|
||||
const ts = tsb.create(opts, null, null, err => reporter(err.toString()));
|
||||
|
||||
return function (token) {
|
||||
var utf8Filter = createFastFilter(function(data) { return /(\/|\\)test(\/|\\).*utf8/.test(data.path); });
|
||||
var tsFilter = createFastFilter(function(data) { return /\.ts$/.test(data.path); });
|
||||
var noDeclarationsFilter = createFastFilter(function(data) { return !(/\.d\.ts$/.test(data.path)); });
|
||||
const utf8Filter = util.filter(data => /(\/|\\)test(\/|\\).*utf8/.test(data.path));
|
||||
const tsFilter = util.filter(data => /\.ts$/.test(data.path));
|
||||
const noDeclarationsFilter = util.filter(data => !(/\.d\.ts$/.test(data.path)));
|
||||
|
||||
var input = es.through();
|
||||
var output = input
|
||||
const input = es.through();
|
||||
const output = input
|
||||
.pipe(utf8Filter)
|
||||
.pipe(bom())
|
||||
.pipe(utf8Filter.restore)
|
||||
@@ -81,20 +62,20 @@ function createCompile(build, emitError) {
|
||||
.pipe(sourcemaps.write('.', {
|
||||
addComment: false,
|
||||
includeContent: !!build,
|
||||
sourceRoot: tsOptions.sourceRoot
|
||||
sourceRoot: options.sourceRoot
|
||||
}))
|
||||
.pipe(tsFilter.restore)
|
||||
.pipe(quiet ? es.through() : reporter.end(emitError));
|
||||
.pipe(reporter.end(emitError));
|
||||
|
||||
return es.duplex(input, output);
|
||||
};
|
||||
}
|
||||
|
||||
function compileTask(out, build) {
|
||||
var compile = createCompile(build, true);
|
||||
const compile = createCompile(build, true);
|
||||
|
||||
return function () {
|
||||
var src = es.merge(
|
||||
const src = es.merge(
|
||||
gulp.src('src/**', { base: 'src' }),
|
||||
gulp.src('node_modules/typescript/lib/lib.d.ts')
|
||||
);
|
||||
@@ -107,14 +88,14 @@ function compileTask(out, build) {
|
||||
}
|
||||
|
||||
function watchTask(out, build) {
|
||||
var compile = createCompile(build);
|
||||
const compile = createCompile(build);
|
||||
|
||||
return function () {
|
||||
var src = es.merge(
|
||||
const src = es.merge(
|
||||
gulp.src('src/**', { base: 'src' }),
|
||||
gulp.src('node_modules/typescript/lib/lib.d.ts')
|
||||
);
|
||||
var watchSrc = watch('src/**', { base: 'src' });
|
||||
const watchSrc = watch('src/**', { base: 'src' });
|
||||
|
||||
return watchSrc
|
||||
.pipe(util.incremental(compile, src, true))
|
||||
@@ -124,10 +105,9 @@ function watchTask(out, build) {
|
||||
}
|
||||
|
||||
function monacodtsTask(out, isWatch) {
|
||||
let timer = -1;
|
||||
|
||||
var timer = -1;
|
||||
|
||||
var runSoon = function(howSoon) {
|
||||
const runSoon = function(howSoon) {
|
||||
if (timer !== -1) {
|
||||
clearTimeout(timer);
|
||||
timer = -1;
|
||||
@@ -138,7 +118,7 @@ function monacodtsTask(out, isWatch) {
|
||||
}, howSoon);
|
||||
};
|
||||
|
||||
var runNow = function() {
|
||||
const runNow = function() {
|
||||
if (timer !== -1) {
|
||||
clearTimeout(timer);
|
||||
timer = -1;
|
||||
@@ -147,7 +127,7 @@ function monacodtsTask(out, isWatch) {
|
||||
// monacodts.complainErrors();
|
||||
// return;
|
||||
// }
|
||||
var result = monacodts.run(out);
|
||||
const result = monacodts.run(out);
|
||||
if (!result.isTheSame) {
|
||||
if (isWatch) {
|
||||
fs.writeFileSync(result.filePath, result.content);
|
||||
@@ -157,11 +137,11 @@ function monacodtsTask(out, isWatch) {
|
||||
}
|
||||
};
|
||||
|
||||
var resultStream;
|
||||
let resultStream;
|
||||
|
||||
if (isWatch) {
|
||||
|
||||
var filesToWatchMap = {};
|
||||
const filesToWatchMap = {};
|
||||
monacodts.getFilesToWatch(out).forEach(function(filePath) {
|
||||
filesToWatchMap[path.normalize(filePath)] = true;
|
||||
});
|
||||
@@ -171,7 +151,7 @@ function monacodtsTask(out, isWatch) {
|
||||
}));
|
||||
|
||||
resultStream = es.through(function(data) {
|
||||
var filePath = path.normalize(data.path);
|
||||
const filePath = path.normalize(data.path);
|
||||
if (filesToWatchMap[filePath]) {
|
||||
runSoon(5000);
|
||||
}
|
||||
@@ -180,7 +160,7 @@ function monacodtsTask(out, isWatch) {
|
||||
|
||||
} else {
|
||||
|
||||
resultStream = es.through(null, function(end) {
|
||||
resultStream = es.through(null, function() {
|
||||
runNow();
|
||||
this.emit('end');
|
||||
});
|
||||
@@ -220,24 +200,24 @@ gulp.task('test', function () {
|
||||
});
|
||||
|
||||
gulp.task('mixin', function () {
|
||||
var repo = process.env['VSCODE_MIXIN_REPO'];
|
||||
const repo = process.env['VSCODE_MIXIN_REPO'];
|
||||
|
||||
if (!repo) {
|
||||
console.log('Missing VSCODE_MIXIN_REPO, skipping mixin');
|
||||
return;
|
||||
}
|
||||
|
||||
var quality = process.env['VSCODE_QUALITY'];
|
||||
const quality = process.env['VSCODE_QUALITY'];
|
||||
|
||||
if (!quality) {
|
||||
console.log('Missing VSCODE_QUALITY, skipping mixin');
|
||||
return;
|
||||
}
|
||||
|
||||
var url = 'https://github.com/' + repo + '/archive/master.zip';
|
||||
var opts = { base: '' };
|
||||
var username = process.env['VSCODE_MIXIN_USERNAME'];
|
||||
var password = process.env['VSCODE_MIXIN_PASSWORD'];
|
||||
const url = 'https://github.com/' + repo + '/archive/master.zip';
|
||||
const opts = { base: '' };
|
||||
const username = process.env['VSCODE_MIXIN_USERNAME'];
|
||||
const password = process.env['VSCODE_MIXIN_PASSWORD'];
|
||||
|
||||
if (username || password) {
|
||||
opts.auth = { user: username || '', pass: password || '' };
|
||||
@@ -245,22 +225,22 @@ gulp.task('mixin', function () {
|
||||
|
||||
console.log('Mixing in sources from \'' + url + '\':');
|
||||
|
||||
var all = remote(url, opts)
|
||||
let all = remote(url, opts)
|
||||
.pipe(zip.src())
|
||||
.pipe(filter(function (f) { return !f.isDirectory(); }))
|
||||
.pipe(util.rebase(1));
|
||||
|
||||
if (quality) {
|
||||
var build = all.pipe(filter('build/**'));
|
||||
var productJsonFilter = filter('product.json', { restore: true });
|
||||
const build = all.pipe(filter('build/**'));
|
||||
const productJsonFilter = filter('product.json', { restore: true });
|
||||
|
||||
var mixin = all
|
||||
const mixin = all
|
||||
.pipe(filter('quality/' + quality + '/**'))
|
||||
.pipe(util.rebase(2))
|
||||
.pipe(productJsonFilter)
|
||||
.pipe(buffer())
|
||||
.pipe(json(function (patch) {
|
||||
var original = require('./product.json');
|
||||
const original = require('./product.json');
|
||||
return assign(original, patch);
|
||||
}))
|
||||
.pipe(productJsonFilter.restore);
|
||||
|
||||
Reference in New Issue
Block a user