Skip to content

Commit ae62bdc

Browse files
committed
Merge branch 'master' into release-3.4
2 parents 972eaf6 + b7881a2 commit ae62bdc

File tree

132 files changed

+4816
-1024
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+4816
-1024
lines changed

scripts/authors.ts

Lines changed: 45 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ type Command = {
1515
description?: string;
1616
};
1717

18-
const mailMapPath = path.resolve("../.mailmap");
19-
const authorsPath = path.resolve("../AUTHORS.md");
18+
const mailMapPath = path.resolve(__dirname, "../.mailmap");
19+
const authorsPath = path.resolve(__dirname, "../AUTHORS.md");
2020

2121
function getKnownAuthors(): Author[] {
2222
const segmentRegExp = /\s?([^<]+)\s+<([^>]+)>/g;
@@ -113,56 +113,54 @@ namespace Commands {
113113
const cmd = "git shortlog -se " + specs.join(" ");
114114
console.log(cmd);
115115
const outputRegExp = /\d+\s+([^<]+)<([^>]+)>/;
116-
const tty = process.platform === 'win32' ? 'CON' : '/dev/tty';
117116
const authors: { name: string, email: string, knownAuthor?: Author }[] = [];
118-
child_process.exec(`${cmd} < ${tty}`, { cwd: path.resolve("../") }, function (error, stdout, stderr) {
119-
if (error) {
120-
console.log(stderr.toString());
121-
}
122-
else {
123-
const output = stdout.toString();
124-
const lines = output.split("\n");
125-
lines.forEach(line => {
126-
if (line) {
127-
let match: RegExpExecArray | null;
128-
if (match = outputRegExp.exec(line)) {
129-
authors.push({ name: match[1], email: match[2] });
130-
}
131-
else {
132-
throw new Error("Could not parse output: " + line);
133-
}
117+
const {output: [error, stdout, stderr]} = child_process.spawnSync(`git`, ["shortlog", "-se", ...specs], { cwd: path.resolve(__dirname, "../") });
118+
if (error) {
119+
console.log(stderr.toString());
120+
}
121+
else {
122+
const output = stdout.toString();
123+
const lines = output.split("\n");
124+
lines.forEach(line => {
125+
if (line) {
126+
let match: RegExpExecArray | null;
127+
if (match = outputRegExp.exec(line)) {
128+
authors.push({ name: match[1], email: match[2] });
129+
}
130+
else {
131+
throw new Error("Could not parse output: " + line);
134132
}
135-
});
136-
137-
const maps = getKnownAuthorMaps();
138-
139-
const lookupAuthor = function ({name, email}: { name: string, email: string }) {
140-
return maps.authorsByEmail[email.toLocaleLowerCase()] || maps.authorsByName[name];
141-
};
142-
143-
const knownAuthors = authors
144-
.map(lookupAuthor)
145-
.filter(a => !!a)
146-
.map(getAuthorName);
147-
const unknownAuthors = authors
148-
.filter(a => !lookupAuthor(a))
149-
.map(a => `${a.name} <${a.email}>`);
150-
151-
if (knownAuthors.length) {
152-
console.log("\r\n");
153-
console.log("Found known authors: ");
154-
console.log("=====================");
155-
deduplicate(knownAuthors).sort(sortAuthors).forEach(log);
156133
}
134+
});
135+
136+
const maps = getKnownAuthorMaps();
137+
138+
const lookupAuthor = function ({name, email}: { name: string, email: string }) {
139+
return maps.authorsByEmail[email.toLocaleLowerCase()] || maps.authorsByName[name];
140+
};
141+
142+
const knownAuthors = authors
143+
.map(lookupAuthor)
144+
.filter(a => !!a)
145+
.map(getAuthorName);
146+
const unknownAuthors = authors
147+
.filter(a => !lookupAuthor(a))
148+
.map(a => `${a.name} <${a.email}>`);
149+
150+
if (knownAuthors.length) {
151+
console.log("\r\n");
152+
console.log("Found known authors: ");
153+
console.log("=====================");
154+
deduplicate(knownAuthors).sort(sortAuthors).forEach(log);
155+
}
157156

158-
if (unknownAuthors.length) {
159-
console.log("\r\n");
160-
console.log("Found unknown authors: ");
161-
console.log("=====================");
162-
deduplicate(unknownAuthors).sort(sortAuthors).forEach(log);
163-
}
157+
if (unknownAuthors.length) {
158+
console.log("\r\n");
159+
console.log("Found unknown authors: ");
160+
console.log("=====================");
161+
deduplicate(unknownAuthors).sort(sortAuthors).forEach(log);
164162
}
165-
});
163+
}
166164
};
167165
listAuthors.description = "List known and unknown authors for a given spec, e.g. 'node authors.js listAuthors origin/release-2.6..origin/release-2.7'";
168166
}

scripts/perf-result-post.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// @ts-check
2+
/// <reference lib="esnext.asynciterable" />
3+
// Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally
4+
const Octokit = require("@octokit/rest");
5+
const fs = require("fs");
6+
7+
const requester = process.env.requesting_user;
8+
const source = process.env.source_issue;
9+
const postedComment = process.env.status_comment;
10+
console.log(`Loading fragment from ${process.argv[3]}...`);
11+
const outputTableText = fs.readFileSync(process.argv[3], { encoding: "utf8" });
12+
console.log(`Fragment contents:
13+
${outputTableText}`);
14+
15+
const gh = new Octokit();
16+
gh.authenticate({
17+
type: "token",
18+
token: process.argv[2]
19+
});
20+
gh.issues.createComment({
21+
number: +source,
22+
owner: "Microsoft",
23+
repo: "TypeScript",
24+
body: `@${requester}
25+
The results of the perf run you requested are in! Here they are:
26+
27+
${outputTableText}`
28+
}).then(async data => {
29+
console.log(`Results posted!`);
30+
const newCommentUrl = data.data.html_url;
31+
const comment = await gh.issues.getComment({
32+
owner: "Microsoft",
33+
repo: "TypeScript",
34+
comment_id: +postedComment
35+
});
36+
const newBody = `${comment.data.body}
37+
38+
Update: [The results are in!](${newCommentUrl})`;
39+
return await gh.issues.updateComment({
40+
owner: "Microsoft",
41+
repo: "TypeScript",
42+
comment_id: +postedComment,
43+
body: newBody
44+
});
45+
}).catch(e => {
46+
console.error(e);
47+
process.exit(1);
48+
});

src/compiler/builderState.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ namespace ts.BuilderState {
230230

231231
// Create the reference map, and set the file infos
232232
for (const sourceFile of newProgram.getSourceFiles()) {
233-
const version = sourceFile.version;
233+
const version = Debug.assertDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
234234
const oldInfo = useOldState ? oldState!.fileInfos.get(sourceFile.path) : undefined;
235235
if (referencedMap) {
236236
const newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);

0 commit comments

Comments
 (0)