Skip to content

Commit 073faae

Browse files
committed
Merge branch 'master' into allow-deeply-nested-conditionals-without-complexity
2 parents 0997b7a + 57df466 commit 073faae

File tree

627 files changed

+36762
-10384
lines changed

Some content is hidden

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

627 files changed

+36762
-10384
lines changed

.eslintrc.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
"@typescript-eslint/no-inferrable-types": "error",
2727
"@typescript-eslint/no-misused-new": "error",
2828
"@typescript-eslint/no-this-alias": "error",
29+
30+
"no-unused-expressions": "off",
31+
"@typescript-eslint/no-unused-expressions": ["error", { "allowTernary": true }],
32+
2933
"@typescript-eslint/prefer-for-of": "error",
3034
"@typescript-eslint/prefer-function-type": "error",
3135
"@typescript-eslint/prefer-namespace-keyword": "error",
@@ -36,6 +40,13 @@
3640
"semi": "off",
3741
"@typescript-eslint/semi": "error",
3842

43+
"space-before-function-paren": "off",
44+
"@typescript-eslint/space-before-function-paren": ["error", {
45+
"asyncArrow": "always",
46+
"anonymous": "always",
47+
"named": "never"
48+
}],
49+
3950
"@typescript-eslint/triple-slash-reference": "error",
4051
"@typescript-eslint/type-annotation-spacing": "error",
4152
"@typescript-eslint/unified-signatures": "error",
@@ -97,7 +108,6 @@
97108
"no-trailing-spaces": "error",
98109
"no-undef-init": "error",
99110
"no-unsafe-finally": "error",
100-
"no-unused-expressions": ["error", { "allowTernary": true }],
101111
"no-unused-labels": "error",
102112
"no-var": "error",
103113
"object-shorthand": "error",

.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+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: New Release Branch
2+
3+
on:
4+
repository_dispatch:
5+
types: new-release-branch
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Use node version 12.x
13+
uses: actions/setup-node@v1
14+
with:
15+
node-version: 12.x
16+
- uses: actions/checkout@v2
17+
with:
18+
fetch-depth: 5
19+
- run: |
20+
git checkout -b ${{ github.event.client_payload.branch_name }}
21+
sed -i -e 's/"version": ".*"/"version": "${{ github.event.client_payload.package_version }}"/g' package.json
22+
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' src/compiler/corePublic.ts
23+
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/typescript.d.ts
24+
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/tsserverlibrary.d.ts
25+
sed -i -e 's/const version = `${versionMajorMinor}.0-.*`/const version = `${versionMajorMinor}.0-${{ github.event.client_payload.core_tag || 'dev' }}`/g' src/compiler/corePublic.ts
26+
npm install
27+
gulp LKG
28+
npm test
29+
git diff
30+
git add package.json
31+
git add src/compiler/corePublic.ts
32+
git add tests/baselines/reference/api/typescript.d.ts
33+
git add tests/baselines/reference/api/tsserverlibrary.d.ts
34+
git add ./lib
35+
git config user.email "[email protected]"
36+
git config user.name "TypeScript Bot"
37+
git commit -m 'Bump version to ${{ github.event.client_payload.package_version }} and LKG'
38+
git push --set-upstream origin ${{ github.event.client_payload.branch_name }}

.github/workflows/nightly.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish Nightly
2+
3+
on:
4+
schedule:
5+
- cron: '0 23 * * *'
6+
repository_dispatch:
7+
types: publish-nightly
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Use node version 12
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: 12
19+
registry-url: https://registry.npmjs.org/
20+
- name: Setup and publish nightly
21+
run: |
22+
npm whoami
23+
npm i
24+
gulp configure-nightly
25+
gulp LKG
26+
gulp runtests-parallel
27+
gulp clean
28+
npm publish --tag next
29+
env:
30+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
31+
CI: true
32+

.github/workflows/set-version.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Set branch version
2+
3+
on:
4+
repository_dispatch:
5+
types: set-version
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Use node version 12.x
13+
uses: actions/setup-node@v1
14+
with:
15+
node-version: 12.x
16+
- uses: actions/checkout@v2
17+
with:
18+
ref: ${{ github.event.client_payload.branch_name }}
19+
# notably, this is essentially the same script as `new-release-branch.yaml` (with fewer inputs), but it assumes the branch already exists
20+
# do note that executing the transform below will prevent the `configurePrerelease` script from running on the source, as it makes the
21+
# `version` identifier no longer match the regex it uses
22+
# required client_payload members:
23+
# branch_name - the target branch
24+
# package_version - the full version string (eg, `3.9.1-rc` or `3.9.2`)
25+
# core_major_minor - the major.minor pair associated with the desired package_version (eg, `3.9` for `3.9.3`)
26+
- run: |
27+
sed -i -e 's/"version": ".*"/"version": "${{ github.event.client_payload.package_version }}"/g' package.json
28+
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' src/compiler/corePublic.ts
29+
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/typescript.d.ts
30+
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/tsserverlibrary.d.ts
31+
sed -i -e 's/const version = .*;/const version = "${{ github.event.client_payload.package_version }}" as string;/g' src/compiler/corePublic.ts
32+
npm install
33+
gulp LKG
34+
npm test
35+
git diff
36+
git add package.json
37+
git add src/compiler/corePublic.ts
38+
git add tests/baselines/reference/api/typescript.d.ts
39+
git add tests/baselines/reference/api/tsserverlibrary.d.ts
40+
git add ./lib
41+
git config user.email "[email protected]"
42+
git config user.name "TypeScript Bot"
43+
git commit -m 'Bump version to ${{ github.event.client_payload.package_version }} and LKG'
44+
git push

.github/workflows/sync-branch.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Sync branch with master
2+
3+
on:
4+
repository_dispatch:
5+
types: sync-branch
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Use node version 12.x
13+
uses: actions/setup-node@v1
14+
with:
15+
node-version: 12.x
16+
- uses: actions/checkout@v2
17+
with:
18+
ref: ${{ github.event.client_payload.branch_name }}
19+
# This does a test post-merge and only pushes the result if the test succeeds
20+
# required client_payload members:
21+
# branch_name - the target branch
22+
- run: |
23+
git config user.email "[email protected]"
24+
git config user.name "TypeScript Bot"
25+
git fetch origin master
26+
git merge master --no-ff
27+
npm install
28+
npm test
29+
git push

CopyrightNotice.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/*! *****************************************************************************
2-
Copyright (c) Microsoft Corporation. All rights reserved.
2+
Copyright (c) Microsoft Corporation. All rights reserved.
33
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
44
this file except in compliance with the License. You may obtain a copy of the
5-
License at http://www.apache.org/licenses/LICENSE-2.0
6-
5+
License at http://www.apache.org/licenses/LICENSE-2.0
6+
77
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
88
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10-
MERCHANTABLITY OR NON-INFRINGEMENT.
11-
9+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10+
MERCHANTABLITY OR NON-INFRINGEMENT.
11+
1212
See the Apache Version 2.0 License for specific language governing permissions
1313
and limitations under the License.
1414
***************************************************************************** */

Gulpfile.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,18 @@ task("generate-types-map", generateTypesMap);
408408
const cleanTypesMap = () => del("built/local/typesMap.json");
409409
cleanTasks.push(cleanTypesMap);
410410

411-
const buildOtherOutputs = parallel(buildCancellationToken, buildTypingsInstaller, buildWatchGuard, generateTypesMap);
411+
// Drop a copy of diagnosticMessages.generated.json into the built/local folder. This allows
412+
// it to be synced to the Azure DevOps repo, so that it can get picked up by the build
413+
// pipeline that generates the localization artifacts that are then fed into the translation process.
414+
const builtLocalDiagnosticMessagesGeneratedJson = "built/local/diagnosticMessages.generated.json";
415+
const copyBuiltLocalDiagnosticMessages = () => src(diagnosticMessagesGeneratedJson)
416+
.pipe(newer(builtLocalDiagnosticMessagesGeneratedJson))
417+
.pipe(dest("built/local"));
418+
419+
const cleanBuiltLocalDiagnosticMessages = () => del(builtLocalDiagnosticMessagesGeneratedJson);
420+
cleanTasks.push(cleanBuiltLocalDiagnosticMessages);
421+
422+
const buildOtherOutputs = parallel(buildCancellationToken, buildTypingsInstaller, buildWatchGuard, generateTypesMap, copyBuiltLocalDiagnosticMessages);
412423
task("other-outputs", series(preBuild, buildOtherOutputs));
413424
task("other-outputs").description = "Builds miscelaneous scripts and documents distributed with the LKG";
414425

@@ -430,7 +441,7 @@ const generateCodeCoverage = () => exec("istanbul", ["cover", "node_modules/moch
430441
task("generate-code-coverage", series(preBuild, buildTests, generateCodeCoverage));
431442
task("generate-code-coverage").description = "Generates code coverage data via istanbul";
432443

433-
const preTest = parallel(buildTests, buildServices, buildLssl);
444+
const preTest = parallel(buildTsc, buildTests, buildServices, buildLssl);
434445
preTest.displayName = "preTest";
435446

436447
const postTest = (done) => cmdLineOptions.lint ? lint(done) : done();
@@ -456,7 +467,7 @@ task("runtests").flags = {
456467
" --shardId": "1-based ID of this shard (default: 1)",
457468
};
458469

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

486+
487+
task("test-browser-integration", () => exec(process.execPath, ["scripts/browserIntegrationTest.js"]));
488+
task("test-browser-integration").description = "Runs scripts/browserIntegrationTest.ts which tests that typescript.js loads in a browser";
489+
490+
475491
task("diff", () => exec(getDiffTool(), [refBaseline, localBaseline], { ignoreExitCode: true, waitForExit: false }));
476492
task("diff").description = "Diffs the compiler baselines using the diff tool specified by the 'DIFF' environment variable";
477493

package.json

Lines changed: 9 additions & 8 deletions
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
"keywords": [
@@ -54,9 +54,9 @@
5454
"@types/through2": "latest",
5555
"@types/travis-fold": "latest",
5656
"@types/xml2js": "^0.4.0",
57-
"@typescript-eslint/eslint-plugin": "2.3.2",
58-
"@typescript-eslint/experimental-utils": "2.3.2",
59-
"@typescript-eslint/parser": "2.3.2",
57+
"@typescript-eslint/eslint-plugin": "2.18.0",
58+
"@typescript-eslint/experimental-utils": "2.18.0",
59+
"@typescript-eslint/parser": "2.18.0",
6060
"async": "latest",
6161
"azure-devops-node-api": "^8.0.0",
6262
"browser-resolve": "^1.11.2",
@@ -65,10 +65,10 @@
6565
"chalk": "latest",
6666
"convert-source-map": "latest",
6767
"del": "5.1.0",
68-
"eslint": "6.5.1",
69-
"eslint-formatter-autolinkable-stylish": "1.0.3",
70-
"eslint-plugin-import": "2.18.2",
71-
"eslint-plugin-jsdoc": "15.9.9",
68+
"eslint": "6.8.0",
69+
"eslint-formatter-autolinkable-stylish": "1.1.1",
70+
"eslint-plugin-import": "2.20.0",
71+
"eslint-plugin-jsdoc": "21.0.0",
7272
"eslint-plugin-no-null": "1.0.2",
7373
"fancy-log": "latest",
7474
"fs-extra": "^6.0.1",
@@ -87,6 +87,7 @@
8787
"mocha-fivemat-progress-reporter": "latest",
8888
"ms": "latest",
8989
"node-fetch": "^2.6.0",
90+
"playwright": "latest",
9091
"plugin-error": "latest",
9192
"pretty-hrtime": "^1.0.3",
9293
"prex": "^0.4.3",

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+
})();

0 commit comments

Comments
 (0)