提交 1c38df78 编写于 作者: J Joao Moreno

fixes #18363

上级 3437c463
......@@ -3,9 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
"use strict";
var fs = require('fs');
var path = require('path');
var vm = require('vm');
var fs = require("fs");
var path = require("path");
var vm = require("vm");
/**
* Bundle `entryPoints` given config `config`.
*/
......@@ -186,7 +186,7 @@ function extractStrings(destFiles) {
path: null,
contents: [
'(function() {',
("var __m = " + JSON.stringify(sortedByUseModules) + ";"),
"var __m = " + JSON.stringify(sortedByUseModules) + ";",
"var __M = function(deps) {",
" var result = [];",
" for (var i = 0, len = deps.length; i < len; i++) {",
......
......@@ -3,19 +3,19 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
var gulp = require('gulp');
var tsb = require('gulp-tsb');
var es = require('event-stream');
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 bom = require('gulp-bom');
var sourcemaps = require('gulp-sourcemaps');
var _ = require('underscore');
var monacodts = require('../monaco/api');
var fs = require('fs');
var nls = require("./nls");
var util = require("./util");
var reporter_1 = require("./reporter");
var path = require("path");
var bom = require("gulp-bom");
var sourcemaps = require("gulp-sourcemaps");
var _ = require("underscore");
var monacodts = require("../monaco/api");
var fs = require("fs");
var reporter = reporter_1.createReporter();
var rootDir = path.join(__dirname, '../../src');
var options = require('../../src/tsconfig.json').compilerOptions;
......@@ -23,6 +23,8 @@ options.verbose = false;
options.sourceMap = true;
options.rootDir = rootDir;
options.sourceRoot = util.toFileUri(rootDir);
var smSourceRootPath = path.resolve(path.dirname(rootDir));
var smSourceRoot = util.toFileUri(smSourceRootPath);
function createCompile(build, emitError) {
var opts = _.clone(options);
opts.inlineSources = !!build;
......@@ -46,7 +48,7 @@ function createCompile(build, emitError) {
.pipe(sourcemaps.write('.', {
addComment: false,
includeContent: !!build,
sourceRoot: options.sourceRoot
sourceRoot: smSourceRoot
}))
.pipe(tsFilter.restore)
.pipe(reporter.end(emitError));
......
......@@ -28,14 +28,17 @@ options.sourceMap = true;
options.rootDir = rootDir;
options.sourceRoot = util.toFileUri(rootDir);
function createCompile(build:boolean, emitError?:boolean): (token?:util.ICancellationToken) => NodeJS.ReadWriteStream {
const smSourceRootPath = path.resolve(path.dirname(rootDir));
const smSourceRoot = util.toFileUri(smSourceRootPath);
function createCompile(build: boolean, emitError?: boolean): (token?: util.ICancellationToken) => NodeJS.ReadWriteStream {
const opts = _.clone(options);
opts.inlineSources = !!build;
opts.noFilesystemLookup = true;
const ts = tsb.create(opts, null, null, err => reporter(err.toString()));
return function (token?:util.ICancellationToken) {
return function (token?: util.ICancellationToken) {
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)));
......@@ -54,7 +57,7 @@ function createCompile(build:boolean, emitError?:boolean): (token?:util.ICancell
.pipe(sourcemaps.write('.', {
addComment: false,
includeContent: !!build,
sourceRoot: options.sourceRoot
sourceRoot: smSourceRoot
}))
.pipe(tsFilter.restore)
.pipe(reporter.end(emitError));
......@@ -63,7 +66,7 @@ function createCompile(build:boolean, emitError?:boolean): (token?:util.ICancell
};
}
export function compileTask(out:string, build:boolean): () => NodeJS.ReadWriteStream {
export function compileTask(out: string, build: boolean): () => NodeJS.ReadWriteStream {
const compile = createCompile(build, true);
return function () {
......@@ -79,7 +82,7 @@ export function compileTask(out:string, build:boolean): () => NodeJS.ReadWriteSt
};
}
export function watchTask(out:string, build:boolean): () => NodeJS.ReadWriteStream {
export function watchTask(out: string, build: boolean): () => NodeJS.ReadWriteStream {
const compile = createCompile(build);
return function () {
......@@ -96,21 +99,21 @@ export function watchTask(out:string, build:boolean): () => NodeJS.ReadWriteStre
};
}
function monacodtsTask(out:string, isWatch:boolean): NodeJS.ReadWriteStream {
let timer:NodeJS.Timer = null;
function monacodtsTask(out: string, isWatch: boolean): NodeJS.ReadWriteStream {
let timer: NodeJS.Timer = null;
const runSoon = function(howSoon:number) {
const runSoon = function (howSoon: number) {
if (timer !== null) {
clearTimeout(timer);
timer = null;
}
timer = setTimeout(function() {
timer = setTimeout(function () {
timer = null;
runNow();
}, howSoon);
};
const runNow = function() {
const runNow = function () {
if (timer !== null) {
clearTimeout(timer);
timer = null;
......@@ -133,16 +136,16 @@ function monacodtsTask(out:string, isWatch:boolean): NodeJS.ReadWriteStream {
if (isWatch) {
const filesToWatchMap: {[file:string]:boolean;} = {};
monacodts.getFilesToWatch(out).forEach(function(filePath) {
const filesToWatchMap: { [file: string]: boolean; } = {};
monacodts.getFilesToWatch(out).forEach(function (filePath) {
filesToWatchMap[path.normalize(filePath)] = true;
});
watch('build/monaco/*').pipe(es.through(function() {
watch('build/monaco/*').pipe(es.through(function () {
runSoon(5000);
}));
resultStream = es.through(function(data) {
resultStream = es.through(function (data) {
const filePath = path.normalize(data.path);
if (filesToWatchMap[filePath]) {
runSoon(5000);
......@@ -152,7 +155,7 @@ function monacodtsTask(out:string, isWatch:boolean): NodeJS.ReadWriteStream {
} else {
resultStream = es.through(null, function() {
resultStream = es.through(null, function () {
runNow();
this.emit('end');
});
......
......@@ -3,9 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
"use strict";
var event_stream_1 = require('event-stream');
var assign = require('object-assign');
var remote = require('gulp-remote-src');
var event_stream_1 = require("event-stream");
var assign = require("object-assign");
var remote = require("gulp-remote-src");
var flatmap = require('gulp-flatmap');
var vzip = require('gulp-vinyl-zip');
var filter = require('gulp-filter');
......
......@@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
"use strict";
var path = require('path');
var fs = require('fs');
var path = require("path");
var fs = require("fs");
/**
* Returns the sha1 commit version of a repository or undefined in case of failure.
*/
......
......@@ -3,11 +3,11 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
"use strict";
var path = require('path');
var fs = require('fs');
var event_stream_1 = require('event-stream');
var File = require('vinyl');
var Is = require('is');
var path = require("path");
var fs = require("fs");
var event_stream_1 = require("event-stream");
var File = require("vinyl");
var Is = require("is");
var util = require('gulp-util');
function log(message) {
var rest = [];
......@@ -233,7 +233,7 @@ function processCoreBundleFormat(fileHeader, json, emitter) {
var modules = bundleSection[bundle];
var contents = [
fileHeader,
("define(\"" + bundle + ".nls." + language.iso639_2 + "\", {")
"define(\"" + bundle + ".nls." + language.iso639_2 + "\", {"
];
modules.forEach(function (module, index) {
contents.push("\t\"" + module + "\": [");
......
"use strict";
var ts = require('./typescript/typescriptServices');
var lazy = require('lazy.js');
var event_stream_1 = require('event-stream');
var File = require('vinyl');
var sm = require('source-map');
var assign = require('object-assign');
var path = require('path');
var ts = require("./typescript/typescriptServices");
var lazy = require("lazy.js");
var event_stream_1 = require("event-stream");
var File = require("vinyl");
var sm = require("source-map");
var assign = require("object-assign");
var path = require("path");
var CollectStepResult;
(function (CollectStepResult) {
CollectStepResult[CollectStepResult["Yes"] = 0] = "Yes";
......@@ -71,7 +71,6 @@ function nls() {
function isImportNode(node) {
return node.kind === 212 /* ImportDeclaration */ || node.kind === 211 /* ImportEqualsDeclaration */;
}
var nls;
(function (nls_1) {
function fileFrom(file, contents, path) {
if (path === void 0) { path = file.path; }
......
......@@ -3,21 +3,21 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
var path = require('path');
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var filter = require('gulp-filter');
var minifyCSS = require('gulp-cssnano');
var uglify = require('gulp-uglify');
var es = require('event-stream');
var concat = require('gulp-concat');
var VinylFile = require('vinyl');
var bundle = require('./bundle');
var util = require('./util');
var i18n = require('./i18n');
var gulpUtil = require('gulp-util');
var flatmap = require('gulp-flatmap');
var pump = require('pump');
var path = require("path");
var gulp = require("gulp");
var sourcemaps = require("gulp-sourcemaps");
var filter = require("gulp-filter");
var minifyCSS = require("gulp-cssnano");
var uglify = require("gulp-uglify");
var es = require("event-stream");
var concat = require("gulp-concat");
var VinylFile = require("vinyl");
var bundle = require("./bundle");
var util = require("./util");
var i18n = require("./i18n");
var gulpUtil = require("gulp-util");
var flatmap = require("gulp-flatmap");
var pump = require("pump");
var REPO_ROOT_PATH = path.join(__dirname, '../..');
function log(prefix, message) {
gulpUtil.log(gulpUtil.colors.cyan('[' + prefix + ']'), message);
......@@ -208,7 +208,7 @@ function uglifyWithCopyrights() {
return es.duplex(input, output);
}
function minifyTask(src, sourceMapBaseUrl) {
var sourceMappingURL = sourceMapBaseUrl && (function (f) { return (sourceMapBaseUrl + "/" + f.relative + ".map"); });
var sourceMappingURL = sourceMapBaseUrl && (function (f) { return sourceMapBaseUrl + "/" + f.relative + ".map"; });
return function (cb) {
var jsFilter = filter('**/*.js', { restore: true });
var cssFilter = filter('**/*.css', { restore: true });
......
......@@ -3,9 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
var es = require('event-stream');
var _ = require('underscore');
var util = require('gulp-util');
var es = require("event-stream");
var _ = require("underscore");
var util = require("gulp-util");
var allErrors = [];
var startTime = null;
var count = 0;
......
......@@ -8,12 +8,12 @@ var __extends = (this && this.__extends) || function (d, b) {
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var path_1 = require('path');
var Lint = require('tslint');
var path_1 = require("path");
var Lint = require("tslint");
var Rule = (function (_super) {
__extends(Rule, _super);
function Rule() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
Rule.prototype.apply = function (sourceFile) {
return this.applyWithWalker(new ImportPatterns(sourceFile, this.getOptions()));
......@@ -24,8 +24,9 @@ exports.Rule = Rule;
var ImportPatterns = (function (_super) {
__extends(ImportPatterns, _super);
function ImportPatterns(file, opts) {
_super.call(this, file, opts);
this.imports = Object.create(null);
var _this = _super.call(this, file, opts) || this;
_this.imports = Object.create(null);
return _this;
}
ImportPatterns.prototype.visitImportDeclaration = function (node) {
var path = node.moduleSpecifier.getText();
......
......@@ -8,12 +8,12 @@ var __extends = (this && this.__extends) || function (d, b) {
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Lint = require('tslint');
var minimatch = require('minimatch');
var Lint = require("tslint");
var minimatch = require("minimatch");
var Rule = (function (_super) {
__extends(Rule, _super);
function Rule() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
Rule.prototype.apply = function (sourceFile) {
var configs = this.getOptions().ruleArguments;
......@@ -31,8 +31,9 @@ exports.Rule = Rule;
var ImportPatterns = (function (_super) {
__extends(ImportPatterns, _super);
function ImportPatterns(file, opts, _config) {
_super.call(this, file, opts);
this._config = _config;
var _this = _super.call(this, file, opts) || this;
_this._config = _config;
return _this;
}
ImportPatterns.prototype.visitImportDeclaration = function (node) {
var path = node.moduleSpecifier.getText();
......
......@@ -8,12 +8,12 @@ var __extends = (this && this.__extends) || function (d, b) {
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Lint = require('tslint');
var path_1 = require('path');
var Lint = require("tslint");
var path_1 = require("path");
var Rule = (function (_super) {
__extends(Rule, _super);
function Rule() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
Rule.prototype.apply = function (sourceFile) {
var parts = path_1.dirname(sourceFile.fileName).split(/\\|\//);
......@@ -44,8 +44,9 @@ exports.Rule = Rule;
var LayeringRule = (function (_super) {
__extends(LayeringRule, _super);
function LayeringRule(file, config, opts) {
_super.call(this, file, opts);
this._config = config;
var _this = _super.call(this, file, opts) || this;
_this._config = config;
return _this;
}
LayeringRule.prototype.visitImportDeclaration = function (node) {
var path = node.moduleSpecifier.getText();
......
......@@ -8,15 +8,15 @@ var __extends = (this && this.__extends) || function (d, b) {
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var ts = require('typescript');
var Lint = require('tslint');
var ts = require("typescript");
var Lint = require("tslint");
/**
* Implementation of the no-unexternalized-strings rule.
*/
var Rule = (function (_super) {
__extends(Rule, _super);
function Rule() {
_super.apply(this, arguments);
return _super.apply(this, arguments) || this;
}
Rule.prototype.apply = function (sourceFile) {
return this.applyWithWalker(new NoUnexternalizedStringsRuleWalker(sourceFile, this.getOptions()));
......@@ -36,14 +36,13 @@ function isPropertyAssignment(node) {
var NoUnexternalizedStringsRuleWalker = (function (_super) {
__extends(NoUnexternalizedStringsRuleWalker, _super);
function NoUnexternalizedStringsRuleWalker(file, opts) {
var _this = this;
_super.call(this, file, opts);
this.signatures = Object.create(null);
this.ignores = Object.create(null);
this.messageIndex = undefined;
this.keyIndex = undefined;
this.usedKeys = Object.create(null);
var options = this.getOptions();
var _this = _super.call(this, file, opts) || this;
_this.signatures = Object.create(null);
_this.ignores = Object.create(null);
_this.messageIndex = undefined;
_this.keyIndex = undefined;
_this.usedKeys = Object.create(null);
var options = _this.getOptions();
var first = options && options.length > 0 ? options[0] : null;
if (first) {
if (Array.isArray(first.signatures)) {
......@@ -53,12 +52,13 @@ var NoUnexternalizedStringsRuleWalker = (function (_super) {
first.ignores.forEach(function (ignore) { return _this.ignores[ignore] = true; });
}
if (typeof first.messageIndex !== 'undefined') {
this.messageIndex = first.messageIndex;
_this.messageIndex = first.messageIndex;
}
if (typeof first.keyIndex !== 'undefined') {
this.keyIndex = first.keyIndex;
_this.keyIndex = first.keyIndex;
}
}
return _this;
}
NoUnexternalizedStringsRuleWalker.prototype.visitSourceFile = function (node) {
var _this = this;
......@@ -89,7 +89,6 @@ var NoUnexternalizedStringsRuleWalker = (function (_super) {
if (functionName && this.ignores[functionName]) {
return;
}
var x = "foo";
if (doubleQuoted && (!callInfo || callInfo.argIndex === -1 || !this.signatures[functionName])) {
var s = node.getText();
var replacement = new Lint.Replacement(node.getStart(), node.getWidth(), "nls.localize('KEY-" + s.substring(1, s.length - 1) + "', " + s + ")");
......@@ -113,8 +112,8 @@ var NoUnexternalizedStringsRuleWalker = (function (_super) {
for (var i = 0; i < keyArg.properties.length; i++) {
var property = keyArg.properties[i];
if (isPropertyAssignment(property)) {
var name = property.name.getText();
if (name === 'key') {
var name_1 = property.name.getText();
if (name_1 === 'key') {
var initializer = property.initializer;
if (isStringLiteral(initializer)) {
this.recordKey(initializer, this.messageIndex ? callInfo.callExpression.arguments[this.messageIndex] : undefined);
......@@ -167,6 +166,6 @@ var NoUnexternalizedStringsRuleWalker = (function (_super) {
node = parent;
}
};
NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE = '"';
return NoUnexternalizedStringsRuleWalker;
}(Lint.RuleWalker));
NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE = '"';
......@@ -3,16 +3,16 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
var es = require('event-stream');
var debounce = require('debounce');
var _filter = require('gulp-filter');
var rename = require('gulp-rename');
var _ = require('underscore');
var path = require('path');
var fs = require('fs');
var _rimraf = require('rimraf');
var git = require('./git');
var VinylFile = require('vinyl');
var es = require("event-stream");
var debounce = require("debounce");
var _filter = require("gulp-filter");
var rename = require("gulp-rename");
var _ = require("underscore");
var path = require("path");
var fs = require("fs");
var _rimraf = require("rimraf");
var git = require("./git");
var VinylFile = require("vinyl");
var NoCancellationToken = { isCancellationRequested: function () { return false; } };
function incremental(streamProvider, initial, supportsCancellation) {
var input = es.through();
......
......@@ -3,9 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
"use strict";
var fs = require('fs');
var ts = require('typescript');
var path = require('path');
var fs = require("fs");
var ts = require("typescript");
var path = require("path");
var util = require('gulp-util');
function log(message) {
var rest = [];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册