8000 Merge branch 'master' into feature/36249 · microsoft/TypeScript@744b863 · GitHub
[go: up one dir, main page]

Skip to content

Commit 744b863

Browse files
authored
Merge branch 'master' into feature/36249
2 parents d58f834 + 7cc4a8d commit 744b863

File tree

548 files changed

+11498
-6857
lines changed

Some content is hidden

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

548 files changed

+11498
-6857
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ jobs:
3535
npm install
3636
npm update
3737
npm test
38+
- name: Validate the browser can import TypeScript
39+
run: gulp test-browser-integration
40+

Gulpfile.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ task("runtests").flags = {
456456
" --shardId": "1-based ID of this shard (default: 1)",
457457
};
458458

459-
const runTestsParallel = () => runConsoleTests("built/local/run.js", "min", /*runInParallel*/ true, /*watchMode*/ false);
459+
const runTestsParallel = () => runConsoleTests("built/local/run.js", "min", /*runInParallel*/ cmdLineOptions.workers > 1, /*watchMode*/ false);
460460
task("runtests-parallel", series(preBuild, preTest, runTestsParallel, postTest));
461461
task("runtests-parallel").description = "Runs all the tests in parallel using the built run.js file.";
462462
task("runtests-parallel").flags = {
@@ -472,6 +472,11 @@ task("runtests-parallel").flags = {
472472
" --shardId": "1-based ID of this shard (default: 1)",
473473
};
474474

475+
476+
task("test-browser-integration", () => exec(process.execPath, ["scripts/browserIntegrationTest.js"]));
477+
task("test-browser-integration").description = "Runs scripts/browserIntegrationTest.ts which tests that typescript.js loads in a browser";
478+
479+
475480
task("diff", () => exec(getDiffTool(), [refBaseline, localBaseline], { ignoreExitCode: true, waitForExit: false }));
476481
task("diff").description = "Diffs the compiler baselines using the diff tool specified by the 'DIFF' environment variable";
477482

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "typescript",
33
"author": "Microsoft Corp.",
44
"homepage": "https://www.typescriptlang.org/",
5-
"version": "3.8.0",
5+
"version": "3.9.0",
66
"license": "Apache-2.0",
77
"description": "TypeScript is a language for application scale JavaScript development",
88
& 10000 quot;keywords": [
@@ -96,6 +96,7 @@
9696
"through2": "latest",
9797
"travis-fold": "latest",
9898
"typescript": "next",
99+
"playwright": "latest",
99100
"vinyl": "latest",
100101
"vinyl-sourcemaps-apply": "latest",
101102
"xml2js": "^0.4.19"

scripts/browserIntegrationTest.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
const playwright = require("playwright");
2+
const chalk = require("chalk");
3+
const { join } = require("path");
4+
const { readFileSync } = require("fs");
5+
6+
// Turning this on will leave the Chromium browser open, giving you the
7+
// chance to open up the web inspector.
8+
const debugging = false;
9+
10+
(async () => {
11+
for (const browserType of ["chromium", "firefox", "webkit"]) {
12+
const browser = await playwright[browserType].launch({ headless: !debugging });
13+
const context = await browser.newContext();
14+
const page = await context.newPage();
15+
16+
const errorCaught = err => {
17+
console.error(chalk.red("There was an error running built/typescript.js in " + browserType));
18+
console.log(err.toString());
19+
process.exitCode = 1;
20+
};
21+
22+
page.on("error", errorCaught);
23+
page.on("pageerror", errorCaught);
24+
page.on("console", log => console[log._type](log._text));
25+
26+
await page.setContent(`
27+
<html>
28+
<script>${readFileSync(join("built", "local", "typescript.js"), "utf8")}</script>
29+
</html>
30+
`);
31+
32+
if (!debugging) {
33+
await browser.close();
34+
}
35+
else {
36+
console.log("Not closing the browser, you'll need to exit the process in your terminal manually");
37+
}
38+
}
39+
})();

scripts/open-cherry-pick-pr.ts

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally
33
/// <reference types="node" />
44

5-
import Octokit = require("@octokit/rest");
5+
import { Octokit } from "@octokit/rest";
66
const {runSequence} = require("./run-sequence");
77
import fs = require("fs");
88
import path = require("path");
@@ -26,18 +26,34 @@ async function main() {
2626
const currentAuthor = runSequence([
2727
["git", ["log", "-1", `--pretty="%aN <%aE>"`]]
2828
]);
29+
30+
const gh = new Octokit();
31+
gh.authenticate({
32+
type: "token",
33+
token: process.argv[2]
34+
});
35+
36+
const inputPR = (await gh.pulls.get({ pull_number: +process.env.SOURCE_ISSUE, owner: "microsoft", repo: "TypeScript" })).data;
37+
let remoteName = "origin";
38+
if (inputPR.base.repo.git_url !== `git:github.com/microsoft/TypeScript`) {
39+
runSequence([
40+
["git", ["remote", "add", "nonlocal", inputPR.base.repo.git_url]]
41+
]);
42+
remoteName = "nonlocal";
43+
}
44+
const baseBranchName = inputPR.base.ref;
2945
runSequence([
30-
["git", ["fetch", "origin", "master"]]
46+
["git", ["fetch", remoteName, baseBranchName]]
3147
]);
3248
let logText = runSequence([
33-
["git", ["log", `origin/master..${currentSha.trim()}`, `--pretty="%h %s%n%b"`, "--reverse"]]
49+
["git", ["log", `${remoteName}/${baseBranchName}..${currentSha.trim()}`, `--pretty="%h %s%n%b"`, "--reverse"]]
3450
]);
3551
logText = `Cherry-pick PR #${process.env.SOURCE_ISSUE} into ${process.env.TARGET_BRANCH}
3652
3753
Component commits:
3854
${logText.trim()}`;
3955
const logpath = path.join(__dirname, "../", "logmessage.txt");
40-
const mergebase = runSequence([["git", ["merge-base", "origin/master", currentSha]]]).trim();
56+
const mergebase = runSequence([["git", ["merge-base", `${remoteName}/${baseBranchName}`, currentSha]]]).trim();
4157
runSequence([
4258
["git", ["checkout", "-b", "temp-branch"]],
4359
["git", ["reset", mergebase, "--soft"]]
@@ -67,11 +83,6 @@ ${logText.trim()}`;
6783
["git", ["push", "--set-upstream", "fork", branchName, "-f"]] // push the branch
6884
]);
6985

70-
const gh = new Octokit();
71-
gh.authenticate({
72-
type: "token",
73-
token: process.argv[2]
74-
});
7586
const r = await gh.pulls.create({
7687
owner: "Microsoft",
7788
repo: "TypeScript",

src/compiler/binder.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4124,8 +4124,18 @@ namespace ts {
41244124
case SyntaxKind.TemplateHead:
41254125
case SyntaxKind.TemplateMiddle:
41264126
case SyntaxKind.TemplateTail:
4127-
case SyntaxKind.TemplateExpression:
4127+
if ((<NoSubstitutionTemplateLiteral | TemplateHead | TemplateMiddle | TemplateTail>node).templateFlags) {
4128+
transformFlags |= TransformFlags.AssertES2018;
4129+
break;
4130+
}
4131+
// falls through
41284132
case SyntaxKind.TaggedTemplateExpression:
4133+
if (hasInvalidEscape((<TaggedTemplateExpression>node).template)) {
4134+
transformFlags |= TransformFlags.AssertES2018;
4135+
break;
4136+
}
4137+
// falls through
4138+
case SyntaxKind.TemplateExpression:
41294139
case SyntaxKind.ShorthandPropertyAssignment:
41304140
case SyntaxKind.StaticKeyword:
41314141
case SyntaxKind.MetaProperty:

0 commit comments

Comments
 (0)
0