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