Skip to content

Commit

Permalink
Merge branch 'master' into feature/36249
Browse files Browse the repository at this point in the history
  • Loading branch information
a-tarasyuk authored Feb 17, 2020
2 parents d58f834 + 7cc4a8d commit 744b863
Show file tree
Hide file tree
Showing 548 changed files with 11,498 additions and 6,857 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ jobs:
npm install
npm update
npm test
- name: Validate the browser can import TypeScript
run: gulp test-browser-integration

7 changes: 6 additions & 1 deletion Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ task("runtests").flags = {
" --shardId": "1-based ID of this shard (default: 1)",
};

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


task("test-browser-integration", () => exec(process.execPath, ["scripts/browserIntegrationTest.js"]));
task("test-browser-integration").description = "Runs scripts/browserIntegrationTest.ts which tests that typescript.js loads in a browser";


task("diff", () => exec(getDiffTool(), [refBaseline, localBaseline], { ignoreExitCode: true, waitForExit: false }));
task("diff").description = "Diffs the compiler baselines using the diff tool specified by the 'DIFF' environment variable";

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "https://www.typescriptlang.org/",
"version": "3.8.0",
"version": "3.9.0",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
Expand Down Expand Up @@ -96,6 +96,7 @@
"through2": "latest",
"travis-fold": "latest",
"typescript": "next",
"playwright": "latest",
"vinyl": "latest",
"vinyl-sourcemaps-apply": "latest",
"xml2js": "^0.4.19"
Expand Down
39 changes: 39 additions & 0 deletions scripts/browserIntegrationTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const playwright = require("playwright");
const chalk = require("chalk");
const { join } = require("path");
const { readFileSync } = require("fs");

// Turning this on will leave the Chromium browser open, giving you the
// chance to open up the web inspector.
const debugging = false;

(async () => {
for (const browserType of ["chromium", "firefox", "webkit"]) {
const browser = await playwright[browserType].launch({ headless: !debugging });
const context = await browser.newContext();
const page = await context.newPage();

const errorCaught = err => {
console.error(chalk.red("There was an error running built/typescript.js in " + browserType));
console.log(err.toString());
process.exitCode = 1;
};

page.on("error", errorCaught);
page.on("pageerror", errorCaught);
page.on("console", log => console[log._type](log._text));

await page.setContent(`
<html>
<script>${readFileSync(join("built", "local", "typescript.js"), "utf8")}</script>
</html>
`);

if (!debugging) {
await browser.close();
}
else {
console.log("Not closing the browser, you'll need to exit the process in your terminal manually");
}
}
})();
29 changes: 20 additions & 9 deletions scripts/open-cherry-pick-pr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally
/// <reference types="node" />

import Octokit = require("@octokit/rest");
import { Octokit } from "@octokit/rest";
const {runSequence} = require("./run-sequence");
import fs = require("fs");
import path = require("path");
Expand All @@ -26,18 +26,34 @@ async function main() {
const currentAuthor = runSequence([
["git", ["log", "-1", `--pretty="%aN <%aE>"`]]
]);

const gh = new Octokit();
gh.authenticate({
type: "token",
token: process.argv[2]
});

const inputPR = (await gh.pulls.get({ pull_number: +process.env.SOURCE_ISSUE, owner: "microsoft", repo: "TypeScript" })).data;
let remoteName = "origin";
if (inputPR.base.repo.git_url !== `git:github.com/microsoft/TypeScript`) {
runSequence([
["git", ["remote", "add", "nonlocal", inputPR.base.repo.git_url]]
]);
remoteName = "nonlocal";
}
const baseBranchName = inputPR.base.ref;
runSequence([
["git", ["fetch", "origin", "master"]]
["git", ["fetch", remoteName, baseBranchName]]
]);
let logText = runSequence([
["git", ["log", `origin/master..${currentSha.trim()}`, `--pretty="%h %s%n%b"`, "--reverse"]]
["git", ["log", `${remoteName}/${baseBranchName}..${currentSha.trim()}`, `--pretty="%h %s%n%b"`, "--reverse"]]
]);
logText = `Cherry-pick PR #${process.env.SOURCE_ISSUE} into ${process.env.TARGET_BRANCH}
Component commits:
${logText.trim()}`;
const logpath = path.join(__dirname, "../", "logmessage.txt");
const mergebase = runSequence([["git", ["merge-base", "origin/master", currentSha]]]).trim();
const mergebase = runSequence([["git", ["merge-base", `${remoteName}/${baseBranchName}`, currentSha]]]).trim();
runSequence([
["git", ["checkout", "-b", "temp-branch"]],
["git", ["reset", mergebase, "--soft"]]
Expand Down Expand Up @@ -67,11 +83,6 @@ ${logText.trim()}`;
["git", ["push", "--set-upstream", "fork", branchName, "-f"]] // push the branch
]);

const gh = new Octokit();
gh.authenticate({
type: "token",
token: process.argv[2]
});
const r = await gh.pulls.create({
owner: "Microsoft",
repo: "TypeScript",
Expand Down
12 changes: 11 additions & 1 deletion src/compiler/binder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4124,8 +4124,18 @@ namespace ts {
case SyntaxKind.TemplateHead:
case SyntaxKind.TemplateMiddle:
case SyntaxKind.TemplateTail:
case SyntaxKind.TemplateExpression:
if ((<NoSubstitutionTemplateLiteral | TemplateHead | TemplateMiddle | TemplateTail>node).templateFlags) {
transformFlags |= TransformFlags.AssertES2018;
break;
}
// falls through
case SyntaxKind.TaggedTemplateExpression:
if (hasInvalidEscape((<TaggedTemplateExpression>node).template)) {
transformFlags |= TransformFlags.AssertES2018;
break;
}
// falls through
case SyntaxKind.TemplateExpression:
case SyntaxKind.ShorthandPropertyAssignment:
case SyntaxKind.StaticKeyword:
case SyntaxKind.MetaProperty:
Expand Down
Loading

0 comments on commit 744b863

Please sign in to comment.