Skip to content

Commit 46c300a

Browse files
committed
Merge branch 'master' into release-2.9
2 parents cd25a3a + 672d8e5 commit 46c300a

27 files changed

+442
-179
lines changed

scripts/open-user-pr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ runSequence([
2727
["git", ["add", "."]], // Add all changes
2828
["git", ["commit", "-m", `"Update user baselines"`]], // Commit all changes
2929
["git", ["remote", "add", "fork", remoteUrl]], // Add the remote fork
30-
["git", ["push", "--set-upstream", "fork", branchName]] // push the branch
30+
["git", ["-c", `http.extraheader="AUTHORIZATION: basic ${process.argv[2]}"`, "push", "--set-upstream", "fork", branchName]] // push the branch
3131
]);
3232

3333
const gh = new Octokit();

src/compiler/commandLineParser.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,10 +1607,12 @@ namespace ts {
16071607
createCompilerDiagnosticOnlyIfJson(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "exclude", "Array");
16081608
}
16091609
}
1610-
else {
1611-
const outDir = raw.compilerOptions && raw.compilerOptions.outDir;
1612-
if (outDir) {
1613-
excludeSpecs = [outDir];
1610+
else if (raw.compilerOptions) {
1611+
const outDir = raw.compilerOptions.outDir;
1612+
const declarationDir = raw.compilerOptions.declarationDir;
1613+
1614+
if (outDir || declarationDir) {
1615+
excludeSpecs = [outDir, declarationDir].filter(d => !!d);
16141616
}
16151617
}
16161618

src/compiler/transformers/esnext.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ namespace ts {
924924
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
925925
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
926926
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
927-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
927+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
928928
function fulfill(value) { resume("next", value); }
929929
function reject(value) { resume("throw", value); }
930930
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
@@ -956,7 +956,7 @@ namespace ts {
956956
var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
957957
var i, p;
958958
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
959-
function verb(n, f) { if (o[n]) i[n] = function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; }; }
959+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
960960
};`
961961
};
962962

@@ -979,8 +979,10 @@ namespace ts {
979979
text: `
980980
var __asyncValues = (this && this.__asyncValues) || function (o) {
981981
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
982-
var m = o[Symbol.asyncIterator];
983-
return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator]();
982+
var m = o[Symbol.asyncIterator], i;
983+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
984+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
985+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
984986
};`
985987
};
986988

src/harness/compilerRunner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class CompilerBaselineRunner extends RunnerBase {
7373
});
7474
});
7575
}
76-
describe(`${this.testSuiteName} tests for ${fileName}}`, () => {
76+
describe(`${this.testSuiteName} tests for ${fileName}`, () => {
7777
this.runSuite(fileName, test);
7878
});
7979
}

src/harness/fakes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ namespace fakes {
150150

151151
private _getStats(path: string) {
152152
try {
153-
return this.vfs.statSync(path);
153+
return this.vfs.existsSync(path) ? this.vfs.statSync(path) : undefined;
154154
}
155155
catch {
156156
return undefined;
@@ -332,7 +332,7 @@ namespace fakes {
332332
let fs = this.vfs;
333333
while (fs.shadowRoot) {
334334
try {
335-
const shadowRootStats = fs.shadowRoot.statSync(canonicalFileName);
335+
const shadowRootStats = fs.shadowRoot.existsSync(canonicalFileName) && fs.shadowRoot.statSync(canonicalFileName);
336336
if (shadowRootStats.dev !== stats.dev ||
337337
shadowRootStats.ino !== stats.ino ||
338338
shadowRootStats.mtimeMs !== stats.mtimeMs) {

src/harness/unittests/tsconfigParsing.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,29 @@ namespace ts {
217217
assertParseFileList(tsconfigWithExclude, "tsconfig.json", rootDir, allFiles, allFiles);
218218
});
219219

220+
it("exclude declarationDir unless overridden", () => {
221+
const tsconfigWithoutExclude =
222+
`{
223+
"compilerOptions": {
224+
"declarationDir": "declarations"
225+
}
226+
}`;
227+
const tsconfigWithExclude =
228+
`{
229+
"compilerOptions": {
230+
"declarationDir": "declarations"
231+
},
232+
"exclude": [ "types" ]
233+
}`;
234+
235+
const rootDir = "/";
236+
const allFiles = ["/declarations/a.d.ts", "/a.ts"];
237+
const expectedFiles = ["/a.ts"];
238+
239+
assertParseFileList(tsconfigWithoutExclude, "tsconfig.json", rootDir, allFiles, expectedFiles);
240+
assertParseFileList(tsconfigWithExclude, "tsconfig.json", rootDir, allFiles, allFiles);
241+
});
242+
220243
it("implicitly exclude common package folders", () => {
221244
assertParseFileList(
222245
`{}`,

src/harness/unittests/tsserverProjectSystem.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ namespace ts.projectSystem {
164164
}
165165

166166
export function fileStats(nonZeroStats: Partial<server.FileStats>): server.FileStats {
167-
return { ts: 0, tsx: 0, dts: 0, js: 0, jsx: 0, ...nonZeroStats };
167+
return { ts: 0, tsx: 0, dts: 0, js: 0, jsx: 0, deferred: 0, ...nonZeroStats };
168168
}
169169

170170
export class TestServerEventManager {

src/harness/vfs.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,14 @@ namespace vfs {
384384

385385
// POSIX API (aligns with NodeJS "fs" module API)
386386

387+
/**
388+
* Determines whether a path exists.
389+
*/
390+
public existsSync(path: string) {
391+
const result = this._walk(this._resolve(path), /*noFollow*/ true, () => "stop");
392+
return result !== undefined && result.node !== undefined;
393+
}
394+
387395
/**
388396
* Get file status. If `path` is a symbolic link, it is dereferenced.
389397
*
@@ -861,8 +869,8 @@ namespace vfs {
861869
*/
862870
private _resolve(path: string) {
863871
return this._cwd
864-
? vpath.resolve(this._cwd, vpath.validate(path, vpath.ValidationFlags.RelativeOrAbsolute))
865-
: vpath.validate(path, vpath.ValidationFlags.Absolute);
872+
? vpath.resolve(this._cwd, vpath.validate(path, vpath.ValidationFlags.RelativeOrAbsolute | vpath.ValidationFlags.AllowWildcard))
873+
: vpath.validate(path, vpath.ValidationFlags.Absolute | vpath.ValidationFlags.AllowWildcard);
866874
}
867875

868876
private _applyFiles(files: FileSet, dirname: string) {

src/harness/vpath.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ namespace vpath {
2626

2727
const invalidRootComponentRegExp = /^(?!(\/|\/\/\w+\/|[a-zA-Z]:\/?|)$)/;
2828
const invalidNavigableComponentRegExp = /[:*?"<>|]/;
29+
const invalidNavigableComponentWithWildcardsRegExp = /[:"<>|]/;
2930
const invalidNonNavigableComponentRegExp = /^\.{1,2}$|[:*?"<>|]/;
31+
const invalidNonNavigableComponentWithWildcardsRegExp = /^\.{1,2}$|[:"<>|]/;
3032
const extRegExp = /\.\w+$/;
3133

3234
export const enum ValidationFlags {
@@ -44,6 +46,7 @@ namespace vpath {
4446
AllowExtname = 1 << 8,
4547
AllowTrailingSeparator = 1 << 9,
4648
AllowNavigation = 1 << 10,
49+
AllowWildcard = 1 << 11,
4750

4851
/** Path must be a valid directory root */
4952
Root = RequireRoot | AllowRoot | AllowTrailingSeparator,
@@ -63,7 +66,9 @@ namespace vpath {
6366
const hasDirname = components.length > 2;
6467
const hasBasename = components.length > 1;
6568
const hasExtname = hasBasename && extRegExp.test(components[components.length - 1]);
66-
const invalidComponentRegExp = flags & ValidationFlags.AllowNavigation ? invalidNavigableComponentRegExp : invalidNonNavigableComponentRegExp;
69+
const invalidComponentRegExp = flags & ValidationFlags.AllowNavigation
70+
? flags & ValidationFlags.AllowWildcard ? invalidNavigableComponentWithWildcardsRegExp : invalidNavigableComponentRegExp
71+
: flags & ValidationFlags.AllowWildcard ? invalidNonNavigableComponentWithWildcardsRegExp : invalidNonNavigableComponentRegExp;
6772

6873
// Validate required components
6974
if (flags & ValidationFlags.RequireRoot && !hasRoot) return false;

0 commit comments

Comments
 (0)