diff --git a/.gitmodules b/.gitmodules
index bd4620625cf..f7632c4abbd 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -18,3 +18,7 @@
path = tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter
url = https://github.com/Microsoft/TypeScript-WeChat-Starter.git
ignore = all
+[submodule "tests/cases/user/webpack/webpack"]
+ path = tests/cases/user/webpack/webpack
+ url = https://github.com/webpack/webpack.git
+ ignore = all
diff --git a/Jakefile.js b/Jakefile.js
index d570a7cfc3d..bda270b0b4c 100644
--- a/Jakefile.js
+++ b/Jakefile.js
@@ -87,93 +87,10 @@ var typingsInstallerSources = filesFromConfig(path.join(serverDirectory, "typing
var watchGuardSources = filesFromConfig(path.join(serverDirectory, "watchGuard/tsconfig.json"));
var serverSources = filesFromConfig(path.join(serverDirectory, "tsconfig.json"));
var languageServiceLibrarySources = filesFromConfig(path.join(serverDirectory, "tsconfig.library.json"));
+var harnessSources = filesFromConfig("./src/harness/tsconfig.json");
var typesMapOutputPath = path.join(builtLocalDirectory, 'typesMap.json');
-var harnessCoreSources = [
- "harness.ts",
- "virtualFileSystem.ts",
- "virtualFileSystemWithWatch.ts",
- "sourceMapRecorder.ts",
- "harnessLanguageService.ts",
- "fourslash.ts",
- "runnerbase.ts",
- "compilerRunner.ts",
- "typeWriter.ts",
- "fourslashRunner.ts",
- "projectsRunner.ts",
- "loggedIO.ts",
- "rwcRunner.ts",
- "externalCompileRunner.ts",
- "test262Runner.ts",
- "./parallel/shared.ts",
- "./parallel/host.ts",
- "./parallel/worker.ts",
- "runner.ts"
-].map(function (f) {
- return path.join(harnessDirectory, f);
-});
-
-var harnessSources = harnessCoreSources.concat([
- "base64.ts",
- "incrementalParser.ts",
- "jsDocParsing.ts",
- "services/colorization.ts",
- "services/documentRegistry.ts",
- "services/preProcessFile.ts",
- "services/patternMatcher.ts",
- "session.ts",
- "versionCache.ts",
- "convertToBase64.ts",
- "transpile.ts",
- "reuseProgramStructure.ts",
- "textStorage.ts",
- "moduleResolution.ts",
- "tsconfigParsing.ts",
- "asserts.ts",
- "builder.ts",
- "commandLineParsing.ts",
- "configurationExtension.ts",
- "convertCompilerOptionsFromJson.ts",
- "convertTypeAcquisitionFromJson.ts",
- "tsserverProjectSystem.ts",
- "tscWatchMode.ts",
- "compileOnSave.ts",
- "typingsInstaller.ts",
- "projectErrors.ts",
- "matchFiles.ts",
- "organizeImports.ts",
- "initializeTSConfig.ts",
- "extractConstants.ts",
- "extractFunctions.ts",
- "extractRanges.ts",
- "extractTestHelpers.ts",
- "printer.ts",
- "textChanges.ts",
- "telemetry.ts",
- "transform.ts",
- "customTransforms.ts",
- "programMissingFiles.ts",
- "programNoParseFalsyFileNames.ts",
- "symbolWalker.ts",
- "languageService.ts",
- "publicApi.ts",
- "hostNewLineSupport.ts",
-].map(function (f) {
- return path.join(unittestsDirectory, f);
-})).concat([
- "protocol.ts",
- "utilities.ts",
- "scriptVersionCache.ts",
- "scriptInfo.ts",
- "project.ts",
- "typingsCache.ts",
- "editorServices.ts",
- "session.ts",
-].map(function (f) {
- return path.join(serverDirectory, f);
-}));
-
var es2015LibrarySources = [
"es2015.core.d.ts",
"es2015.collection.d.ts",
@@ -451,6 +368,8 @@ task("lib", libraryTargets);
// Generate diagnostics
var processDiagnosticMessagesJs = path.join(scriptsDirectory, "processDiagnosticMessages.js");
var processDiagnosticMessagesTs = path.join(scriptsDirectory, "processDiagnosticMessages.ts");
+var processDiagnosticMessagesSources = filesFromConfig("./scripts/processDiagnosticMessages.tsconfig.json");
+
var diagnosticMessagesJson = path.join(compilerDirectory, "diagnosticMessages.json");
var diagnosticInfoMapTs = path.join(compilerDirectory, "diagnosticInformationMap.generated.ts");
var generatedDiagnosticMessagesJSON = path.join(compilerDirectory, "diagnosticMessages.generated.json");
@@ -460,8 +379,8 @@ file(processDiagnosticMessagesTs);
// processDiagnosticMessages script
compileFile(processDiagnosticMessagesJs,
- [processDiagnosticMessagesTs],
- [processDiagnosticMessagesTs],
+ processDiagnosticMessagesSources,
+ processDiagnosticMessagesSources,
[],
/*useBuiltCompiler*/ false);
diff --git a/package-lock.json b/package-lock.json
index 990d3fbcb5a..2e1c6f6207e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,33 +1,16 @@
{
"name": "typescript",
- "version": "2.8.0",
+ "version": "2.9.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
- "@browserify/acorn5-object-spread": {
- "version": "5.0.1",
- "resolved": "https://registry.npmjs.org/@browserify/acorn5-object-spread/-/acorn5-object-spread-5.0.1.tgz",
- "integrity": "sha512-sFCUPzgeEjdq3rinwy4TFXtak2YZdhqpj6MdNusxkdTFr9TXAUEYK4YQSamR8Joqt/yii1drgl5hk8q/AtJDKA==",
- "dev": true,
- "requires": {
- "acorn": "5.3.0"
- },
- "dependencies": {
- "acorn": {
- "version": "5.3.0",
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.3.0.tgz",
- "integrity": "sha512-Yej+zOJ1Dm/IMZzzj78OntP/r3zHEaKcyNoU2lAaxPtrseM6rF0xwqoz5Q5ysAiED9hTjI2hgtvLXitlCN1/Ug==",
- "dev": true
- }
- }
- },
"@gulp-sourcemaps/identity-map": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@gulp-sourcemaps/identity-map/-/identity-map-1.0.1.tgz",
"integrity": "sha1-z6I7xYQPkQTOMqZedNt+epdLvuE=",
"dev": true,
"requires": {
- "acorn": "5.3.0",
+ "acorn": "5.5.3",
"css": "2.2.1",
"normalize-path": "2.1.1",
"source-map": "0.5.7",
@@ -35,9 +18,9 @@
},
"dependencies": {
"acorn": {
- "version": "5.3.0",
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.3.0.tgz",
- "integrity": "sha512-Yej+zOJ1Dm/IMZzzj78OntP/r3zHEaKcyNoU2lAaxPtrseM6rF0xwqoz5Q5ysAiED9hTjI2hgtvLXitlCN1/Ug==",
+ "version": "5.5.3",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.5.3.tgz",
+ "integrity": "sha512-jd5MkIUlbbmb07nXH0DT3y7rDVtkzDi4XZOUVWAer8ajmF/DTSSbl5oNFyDOl/OXA33Bl79+ypHhl2pN20VeOQ==",
"dev": true
}
}
@@ -55,7 +38,7 @@
"@types/browserify": {
"version": "12.0.33",
"resolved": "https://registry.npmjs.org/@types/browserify/-/browserify-12.0.33.tgz",
- "integrity": "sha512-mY6dYfq1Ns3Xqz/JFUcyoWaXtm0XDoNhkU1vCwM/ULM5zqNL+SbtacJhce/JCgPeCdbqdVqq77tJ4HwdtypSxg==",
+ "integrity": "sha1-5hlxwPmFvx93CQSDJkk/ELDdeL0=",
"dev": true,
"requires": {
"@types/insert-module-globals": "7.0.0",
@@ -71,22 +54,22 @@
"@types/convert-source-map": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/@types/convert-source-map/-/convert-source-map-1.5.1.tgz",
- "integrity": "sha512-laiDIXqqthjJlyAMYAXOtN3N8+UlbM+KvZi4BaY5ZOekmVkBs/UxfK5O0HWeJVG2eW8F+Mu2ww13fTX+kY1FlQ==",
+ "integrity": "sha1-1NGA3WrcXLaK2ZvVbgPWN4gfRhY=",
"dev": true
},
"@types/del": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@types/del/-/del-3.0.0.tgz",
- "integrity": "sha512-18mSs54BvzV8+TTQxt0ancig6tsuPZySnhp3cQkWFFDmDMavU4pmWwR+bHHqRBWODYqpzIzVkqKLuk/fP6yypQ==",
+ "integrity": "sha1-HIzYtuONo7VyNSyo6vVSeTFCYog=",
"dev": true,
"requires": {
"@types/glob": "5.0.35"
}
},
"@types/events": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/@types/events/-/events-1.1.0.tgz",
- "integrity": "sha512-y3bR98mzYOo0pAZuiLari+cQyiKk3UXRuT45h1RjhfeCzqkjaVsfZJNaxdgtk7/3tzOm1ozLTqEqMP3VbI48jw==",
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@types/events/-/events-1.2.0.tgz",
+ "integrity": "sha512-KEIlhXnIutzKwRbQkGWb/I4HFqBuUykAdHgDED6xqwXJfONCjF5VoE0cXEiurh3XauygxzeDzgtXUqvLkxFzzA==",
"dev": true
},
"@types/glob": {
@@ -95,7 +78,7 @@
"integrity": "sha512-wc+VveszMLyMWFvXLkloixT4n0harUIVZjnpzztaZ0nKLuul7Z32iMt2fUFGAaZ4y1XWjFRMtCI5ewvyh4aIeg==",
"dev": true,
"requires": {
- "@types/events": "1.1.0",
+ "@types/events": "1.2.0",
"@types/minimatch": "3.0.3",
"@types/node": "8.5.5"
}
@@ -103,7 +86,7 @@
"@types/gulp": {
"version": "3.8.36",
"resolved": "https://registry.npmjs.org/@types/gulp/-/gulp-3.8.36.tgz",
- "integrity": "sha512-u6/zWPzYRNPAtvyFJ3/RSXjmBaBM1dVs5kW22/jU6J786ZGLfSndhLoNOpFI6FGQvqTA+QzFHjSMhpkAN+wxcQ==",
+ "integrity": "sha1-Eer1g78FNGabT/qb/tUVV/qgCkw=",
"dev": true,
"requires": {
"@types/node": "8.5.5",
@@ -114,7 +97,7 @@
"@types/gulp-concat": {
"version": "0.0.32",
"resolved": "https://registry.npmjs.org/@types/gulp-concat/-/gulp-concat-0.0.32.tgz",
- "integrity": "sha512-CUCFADlITzzBfBa2bdGzhKtvBr4eFh+evb+4igVbvPoO5RyPfHifmyQlZl6lM7q19+OKncRlFXDU7B4X9Ayo2g==",
+ "integrity": "sha1-ckhgKLHPX6qUyMHPNMYmUxzsrNY=",
"dev": true,
"requires": {
"@types/node": "8.5.5"
@@ -123,7 +106,7 @@
"@types/gulp-help": {
"version": "0.0.34",
"resolved": "https://registry.npmjs.org/@types/gulp-help/-/gulp-help-0.0.34.tgz",
- "integrity": "sha512-MkW7psZznxxJg2MBk2P2qHE+T8jEZVFz3FG/qGjUYazkyJt7hBJWx5Nuewmay5RVNtUvSWPrdZLr/WTXY3T/6A==",
+ "integrity": "sha1-Dm1mcYySiWZPLtdaIaDmXXqIM+w=",
"dev": true,
"requires": {
"@types/gulp": "3.8.36",
@@ -134,7 +117,7 @@
"@types/gulp-newer": {
"version": "0.0.31",
"resolved": "https://registry.npmjs.org/@types/gulp-newer/-/gulp-newer-0.0.31.tgz",
- "integrity": "sha512-e7J/Zv5Wd7CC0WpuA2syWVitgwrkG0u221e41w7r07XUR6hMH6kHPkq9tUrusHkbeW8QbuLbis5fODOwQCyggQ==",
+ "integrity": "sha1-818j0eT+DXuP9pnknRwhdmy546c=",
"dev": true,
"requires": {
"@types/node": "8.5.5"
@@ -143,7 +126,7 @@
"@types/gulp-sourcemaps": {
"version": "0.0.32",
"resolved": "https://registry.npmjs.org/@types/gulp-sourcemaps/-/gulp-sourcemaps-0.0.32.tgz",
- "integrity": "sha512-+7BAmptW2bxyJnJcCEuie7vLoop3FwWgCdBMzyv7MYXED/HeNMeQuX7uPCkp4vfU1TTu4CYFH0IckNPvo0VePA==",
+ "integrity": "sha1-557mF+DLFXKYdL5FM/5ZwHeToXU=",
"dev": true,
"requires": {
"@types/node": "8.5.5"
@@ -152,7 +135,7 @@
"@types/insert-module-globals": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/@types/insert-module-globals/-/insert-module-globals-7.0.0.tgz",
- "integrity": "sha512-zudCJPwluh1VUDB6Gl/OQdRp+fYy3+47huJB/JMQubMS2p+sH18MCVK4WUz3FqaWLB12yh5ELxVR/+tqwlm/qA==",
+ "integrity": "sha1-jRWN5KY4To2qE7PWPuurbV9nd30=",
"dev": true,
"requires": {
"@types/node": "8.5.5"
@@ -161,7 +144,7 @@
"@types/merge2": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/@types/merge2/-/merge2-1.1.4.tgz",
- "integrity": "sha512-GjaXY4OultxbaOOk7lCLO7xvEcFpdjExC605YmfI6X29vhHKpJfMWKCDZd3x+BITrZaXKg97DgV/SdGVSwdzxA==",
+ "integrity": "sha1-CmUOHMIVove4BALqtraiNuYC96M=",
"dev": true,
"requires": {
"@types/node": "8.5.5"
@@ -182,7 +165,7 @@
"@types/mkdirp": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-0.5.2.tgz",
- "integrity": "sha512-U5icWpv7YnZYGsN4/cmh3WD2onMY0aJIiTE6+51TwJCttdHvtCYmkBNOobHlXwrJRL0nkH9jH4kD+1FAdMN4Tg==",
+ "integrity": "sha1-UDqs/lzCcD1UhDJrGyfvpnoznB8=",
"dev": true,
"requires": {
"@types/node": "8.5.5"
@@ -197,29 +180,29 @@
"@types/node": {
"version": "8.5.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.5.5.tgz",
- "integrity": "sha512-JRnfoh0Ll4ElmIXKxbUfcOodkGvcNHljct6mO1X9hE/mlrMzAx0hYCLAD7sgT53YAY1HdlpzUcV0CkmDqUqTuA==",
+ "integrity": "sha1-b56BZK4aVam+sdJXHPt6z51yDGE=",
"dev": true
},
"@types/orchestrator": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/@types/orchestrator/-/orchestrator-0.3.2.tgz",
- "integrity": "sha512-cKB4yTX0wGaRCSkdHDX2fkGQbMAA8UOshC2U7DQky1CE5o+5q2iQQ8VkbPbE/88uaTtsusvBPMcCX7dgmjxBhQ==",
+ "integrity": "sha1-zRXGzql4oyuY5QVCOcvMeOVWcfE=",
"dev": true,
"requires": {
"@types/node": "8.5.5",
- "@types/q": "1.0.7"
+ "@types/q": "1.5.0"
}
},
"@types/q": {
- "version": "1.0.7",
- "resolved": "https://registry.npmjs.org/@types/q/-/q-1.0.7.tgz",
- "integrity": "sha512-0WS7XU7sXzQ7J1nbnMKKYdjrrFoO3YtZYgUzeV8JFXffPnHfvSJQleR70I8BOAsOm14i4dyaAZ3YzqIl1YhkXQ==",
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.0.tgz",
+ "integrity": "sha512-sWj7AMiG0fYmta6ug1ublLjtj/tqn+CnCZeo7yswR1ykxel0FOWFGdWviTcGSNAMmtLbycDqbg6w98VPFKJmbw==",
"dev": true
},
"@types/run-sequence": {
"version": "0.0.30",
"resolved": "https://registry.npmjs.org/@types/run-sequence/-/run-sequence-0.0.30.tgz",
- "integrity": "sha512-XwGr1b4yCGUILKeBkzmeWcxmGHQ0vFFFpA6D6y1yLO6gKmYorF+PHqdU5KG+nWt38OvtrkDptmrSmlHX/XtpLw==",
+ "integrity": "sha1-s6kMn9KaXu3lgTXdAl6zrEu7Vg4=",
"dev": true,
"requires": {
"@types/gulp": "3.8.36",
@@ -238,7 +221,7 @@
"@types/vinyl": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@types/vinyl/-/vinyl-2.0.2.tgz",
- "integrity": "sha512-2iYpNuOl98SrLPBZfEN9Mh2JCJ2EI9HU35SfgBEb51DcmaHkhp8cKMblYeBqMQiwXMgAD3W60DbQ4i/UdLiXhw==",
+ "integrity": "sha1-TzuNro9YKNOADvcJsM/0iO6FLeM=",
"dev": true,
"requires": {
"@types/node": "8.5.5"
@@ -247,7 +230,7 @@
"@types/xml2js": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/@types/xml2js/-/xml2js-0.4.2.tgz",
- "integrity": "sha512-8aKUBSj3oGcnuiBmDLm3BIk09RYg01mz9HlQ2u4aS17oJ25DxjQrEUVGFSBVNOfM45pQW4OjcBPplq6r/exJdA==",
+ "integrity": "sha1-pLhLOHn/1HEJU/2Syr/emopOhFY=",
"dev": true,
"requires": {
"@types/node": "8.5.5"
@@ -275,6 +258,24 @@
"integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=",
"dev": true
},
+ "acorn-node": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.3.0.tgz",
+ "integrity": "sha512-efP54n3d1aLfjL2UMdaXa6DsswwzJeI5rqhbFvXMrKiJ6eJFpf+7R0zN7t8IC+XKn2YOAFAv6xbBNgHUkoHWLw==",
+ "dev": true,
+ "requires": {
+ "acorn": "5.5.3",
+ "xtend": "4.0.1"
+ },
+ "dependencies": {
+ "acorn": {
+ "version": "5.5.3",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.5.3.tgz",
+ "integrity": "sha512-jd5MkIUlbbmb07nXH0DT3y7rDVtkzDi4XZOUVWAer8ajmF/DTSSbl5oNFyDOl/OXA33Bl79+ypHhl2pN20VeOQ==",
+ "dev": true
+ }
+ }
+ },
"align-text": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz",
@@ -345,6 +346,15 @@
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
"dev": true
},
+ "ansi-styles": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
+ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.1"
+ }
+ },
"ansi-wrap": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz",
@@ -384,7 +394,7 @@
"arr-flatten": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz",
- "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==",
+ "integrity": "sha1-NgSLv/TntH4TZkQxbJlmnqWukfE=",
"dev": true
},
"arr-union": {
@@ -426,7 +436,7 @@
"array-slice": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz",
- "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==",
+ "integrity": "sha1-42jqFfibxwaff/uJrsOmx9SsItQ=",
"dev": true
},
"array-union": {
@@ -457,9 +467,9 @@
"dev": true
},
"asn1.js": {
- "version": "4.9.2",
- "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.9.2.tgz",
- "integrity": "sha512-b/OsSjvWEo8Pi8H0zsDd2P6Uqo2TK2pH8gNLSJtNLM2Db0v2QaAZ0pBQJXVjAn4gBuugeVDr7s63ZogpUIwWDg==",
+ "version": "4.10.1",
+ "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz",
+ "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==",
"dev": true,
"requires": {
"bn.js": "4.11.8",
@@ -556,7 +566,7 @@
"base": {
"version": "0.11.2",
"resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz",
- "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==",
+ "integrity": "sha1-e95c7RRbbVUakNuH+DxVi060io8=",
"dev": true,
"requires": {
"cache-base": "1.0.1",
@@ -569,9 +579,9 @@
}
},
"base64-js": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.2.1.tgz",
- "integrity": "sha512-dwVUVIXsBZXwTuwnXI9RK8sBmgq09NDHzyR9SAph9eqk76gKK2JSQmZARC2zRC81JC2QTtxD0ARU5qTS25gIGw==",
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.2.3.tgz",
+ "integrity": "sha512-MsAhsUW1GxCdgYSO6tAfZrNapmUKk7mWx/k5mFY/A1gBtkaCaNapTg+FExCw1r9yeaZhqx/xPg43xgTFH6KL5w==",
"dev": true
},
"beeper": {
@@ -599,7 +609,7 @@
"braces": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/braces/-/braces-2.3.0.tgz",
- "integrity": "sha512-P4O8UQRdGiMLWSizsApmXVQDBS6KCt7dSexgLKBmH5Hr1CZq7vsnscFh8oR1sP1ab1Zj0uCHCEzZeV6SfUf3rA==",
+ "integrity": "sha1-pGlBy1+0khVrPWplbgbDU2Tj5m4=",
"dev": true,
"requires": {
"arr-flatten": "1.1.0",
@@ -622,16 +632,17 @@
"dev": true
},
"browser-pack": {
- "version": "6.0.2",
- "resolved": "https://registry.npmjs.org/browser-pack/-/browser-pack-6.0.2.tgz",
- "integrity": "sha1-+GzWzvT1MAyOY+B6TVEvZfv/RTE=",
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/browser-pack/-/browser-pack-6.1.0.tgz",
+ "integrity": "sha512-erYug8XoqzU3IfcU8fUgyHqyOXqIE4tUTTQ+7mqUjQlvnXkOO6OlT9c/ZoJVHYoAaqGxr09CN53G7XIsO4KtWA==",
"dev": true,
"requires": {
"JSONStream": "1.3.2",
- "combine-source-map": "0.7.2",
+ "combine-source-map": "0.8.0",
"defined": "1.0.0",
+ "safe-buffer": "5.1.1",
"through2": "2.0.3",
- "umd": "3.0.1"
+ "umd": "3.0.3"
}
},
"browser-resolve": {
@@ -643,6 +654,12 @@
"resolve": "1.1.7"
}
},
+ "browser-stdout": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz",
+ "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==",
+ "dev": true
+ },
"browserify": {
"version": "16.1.1",
"resolved": "https://registry.npmjs.org/browserify/-/browserify-16.1.1.tgz",
@@ -651,10 +668,10 @@
"requires": {
"JSONStream": "1.3.2",
"assert": "1.4.1",
- "browser-pack": "6.0.2",
+ "browser-pack": "6.1.0",
"browser-resolve": "1.11.2",
"browserify-zlib": "0.2.0",
- "buffer": "5.0.8",
+ "buffer": "5.1.0",
"cached-path-relative": "1.0.1",
"concat-stream": "1.6.2",
"console-browserify": "1.1.0",
@@ -670,10 +687,10 @@
"htmlescape": "1.1.1",
"https-browserify": "1.0.0",
"inherits": "2.0.3",
- "insert-module-globals": "7.0.1",
- "labeled-stream-splicer": "2.0.0",
+ "insert-module-globals": "7.0.6",
+ "labeled-stream-splicer": "2.0.1",
"mkdirp": "0.5.1",
- "module-deps": "6.0.0",
+ "module-deps": "6.0.2",
"os-browserify": "0.3.0",
"parents": "1.0.1",
"path-browserify": "0.0.0",
@@ -686,10 +703,10 @@
"shasum": "1.0.2",
"shell-quote": "1.6.1",
"stream-browserify": "2.0.1",
- "stream-http": "2.7.2",
+ "stream-http": "2.8.1",
"string_decoder": "1.0.3",
"subarg": "1.0.0",
- "syntax-error": "1.3.0",
+ "syntax-error": "1.4.0",
"through2": "2.0.3",
"timers-browserify": "1.4.2",
"tty-browserify": "0.0.1",
@@ -697,78 +714,12 @@
"util": "0.10.3",
"vm-browserify": "0.0.4",
"xtend": "4.0.1"
- },
- "dependencies": {
- "concat-stream": {
- "version": "1.6.2",
- "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
- "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
- "dev": true,
- "requires": {
- "buffer-from": "1.0.0",
- "inherits": "2.0.3",
- "readable-stream": "2.3.3",
- "typedarray": "0.0.6"
- }
- },
- "domain-browser": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz",
- "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==",
- "dev": true
- },
- "events": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/events/-/events-2.0.0.tgz",
- "integrity": "sha512-r/M5YkNg9zwI8QbSf7tsDWWJvO3PGwZXyG7GpFAxtMASnHL2eblFd7iHiGPtyGKKFPZ59S63NeX10Ws6WqGDcg==",
- "dev": true
- },
- "module-deps": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-6.0.0.tgz",
- "integrity": "sha512-BKsMhJJENEM4dTgqq2MDTTHXRHcNUFegoAwlG4HO4VMdUyMcJDKgfgI+MOv6tR5Iv8G3MKZFgsSiyP3ZoosRMw==",
- "dev": true,
- "requires": {
- "JSONStream": "1.3.2",
- "browser-resolve": "1.11.2",
- "cached-path-relative": "1.0.1",
- "concat-stream": "1.6.2",
- "defined": "1.0.0",
- "detective": "5.0.2",
- "duplexer2": "0.1.4",
- "inherits": "2.0.3",
- "parents": "1.0.1",
- "readable-stream": "2.3.3",
- "resolve": "1.6.0",
- "stream-combiner2": "1.1.1",
- "subarg": "1.0.0",
- "through2": "2.0.3",
- "xtend": "4.0.1"
- },
- "dependencies": {
- "resolve": {
- "version": "1.6.0",
- "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.6.0.tgz",
- "integrity": "sha512-mw7JQNu5ExIkcw4LPih0owX/TZXjD/ZUF/ZQ/pDnkw3ZKhDcZZw5klmBlj6gVMwjQ3Pz5Jgu7F3d0jcDVuEWdw==",
- "dev": true,
- "requires": {
- "path-parse": "1.0.5"
- }
- }
- }
- },
- "tty-browserify": {
- "version": "0.0.1",
- "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz",
- "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==",
- "dev": true
- }
}
},
"browserify-aes": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.1.1.tgz",
- "integrity": "sha512-UGnTYAnB2a3YuYKIRy1/4FB2HdM866E0qC46JXvVTYKlBlZlnvfpSfY6OKfXZAkv70eJ2a1SqzpAo5CRhZGDFg==",
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
+ "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==",
"dev": true,
"requires": {
"buffer-xor": "1.0.3",
@@ -785,7 +736,7 @@
"integrity": "sha1-mYgkSHS/XtTijalWZtzWasj8Njo=",
"dev": true,
"requires": {
- "browserify-aes": "1.1.1",
+ "browserify-aes": "1.2.0",
"browserify-des": "1.0.0",
"evp_bytestokey": "1.0.3"
}
@@ -808,7 +759,7 @@
"dev": true,
"requires": {
"bn.js": "4.11.8",
- "randombytes": "2.0.5"
+ "randombytes": "2.0.6"
}
},
"browserify-sign": {
@@ -836,13 +787,13 @@
}
},
"buffer": {
- "version": "5.0.8",
- "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.0.8.tgz",
- "integrity": "sha512-xXvjQhVNz50v2nPeoOsNqWCLGfiv4ji/gXZM28jnVwdLJxH4mFyqgqCKfaK9zf1KUbG6zTkjLOy7ou+jSMarGA==",
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.1.0.tgz",
+ "integrity": "sha512-YkIRgwsZwJWTnyQrsBTWefizHh+8GYj3kbL1BTiAQ/9pwpino0G7B2gp5tx/FUBqUlvtxV85KNR3mwfAtv15Yw==",
"dev": true,
"requires": {
- "base64-js": "1.2.1",
- "ieee754": "1.1.8"
+ "base64-js": "1.2.3",
+ "ieee754": "1.1.11"
}
},
"buffer-crc32": {
@@ -884,7 +835,7 @@
"cache-base": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz",
- "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==",
+ "integrity": "sha1-Cn9GQWgxyLZi7jb+TnxZ129marI=",
"dev": true,
"requires": {
"collection-visit": "1.0.0",
@@ -954,32 +905,6 @@
"ansi-styles": "3.2.1",
"escape-string-regexp": "1.0.5",
"supports-color": "5.3.0"
- },
- "dependencies": {
- "ansi-styles": {
- "version": "3.2.1",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
- "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
- "dev": true,
- "requires": {
- "color-convert": "1.9.1"
- }
- },
- "has-flag": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
- "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
- "dev": true
- },
- "supports-color": {
- "version": "5.3.0",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz",
- "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==",
- "dev": true,
- "requires": {
- "has-flag": "3.0.0"
- }
- }
}
},
"check-error": {
@@ -1063,7 +988,7 @@
"is-descriptor": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz",
- "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==",
+ "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=",
"dev": true,
"requires": {
"is-accessor-descriptor": "0.1.6",
@@ -1074,7 +999,7 @@
"kind-of": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
- "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==",
+ "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=",
"dev": true
}
}
@@ -1157,13 +1082,13 @@
"color-support": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz",
- "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==",
+ "integrity": "sha1-k4NDeaHMmgxh+C9S8NBDIiUb1aI=",
"dev": true
},
"combine-source-map": {
- "version": "0.7.2",
- "resolved": "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.7.2.tgz",
- "integrity": "sha1-CHAxKFazB6h8xKxIbzqaYq7MwJ4=",
+ "version": "0.8.0",
+ "resolved": "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.8.0.tgz",
+ "integrity": "sha1-pY0N8ELBhvz4IqjoAV9UUNLXmos=",
"dev": true,
"requires": {
"convert-source-map": "1.1.3",
@@ -1199,36 +1124,15 @@
"dev": true
},
"concat-stream": {
- "version": "1.5.2",
- "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.5.2.tgz",
- "integrity": "sha1-cIl4Yk2FavQaWnQd790mHadSwmY=",
+ "version": "1.6.2",
+ "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
+ "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
"dev": true,
"requires": {
+ "buffer-from": "1.0.0",
"inherits": "2.0.3",
- "readable-stream": "2.0.6",
+ "readable-stream": "2.3.3",
"typedarray": "0.0.6"
- },
- "dependencies": {
- "readable-stream": {
- "version": "2.0.6",
- "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz",
- "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=",
- "dev": true,
- "requires": {
- "core-util-is": "1.0.2",
- "inherits": "2.0.3",
- "isarray": "1.0.0",
- "process-nextick-args": "1.0.7",
- "string_decoder": "0.10.31",
- "util-deprecate": "1.0.2"
- }
- },
- "string_decoder": {
- "version": "0.10.31",
- "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
- "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
- "dev": true
- }
}
},
"concat-with-sourcemaps": {
@@ -1292,7 +1196,7 @@
"cipher-base": "1.0.4",
"inherits": "2.0.3",
"ripemd160": "2.0.1",
- "sha.js": "2.4.9"
+ "sha.js": "2.4.11"
}
},
"create-hmac": {
@@ -1306,7 +1210,7 @@
"inherits": "2.0.3",
"ripemd160": "2.0.1",
"safe-buffer": "5.1.1",
- "sha.js": "2.4.9"
+ "sha.js": "2.4.11"
}
},
"crypto-browserify": {
@@ -1324,8 +1228,8 @@
"inherits": "2.0.3",
"pbkdf2": "3.0.14",
"public-encrypt": "4.0.0",
- "randombytes": "2.0.5",
- "randomfill": "1.0.3"
+ "randombytes": "2.0.6",
+ "randomfill": "1.0.4"
}
},
"css": {
@@ -1381,7 +1285,7 @@
"integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=",
"dev": true,
"requires": {
- "es5-ext": "0.10.37"
+ "es5-ext": "0.10.42"
}
},
"date-now": {
@@ -1399,20 +1303,20 @@
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
- "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=",
"dev": true,
"requires": {
"ms": "2.0.0"
}
},
"debug-fabulous": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/debug-fabulous/-/debug-fabulous-1.0.0.tgz",
- "integrity": "sha512-dsd50qQ1atDeurcxL7XOjPp4nZCGZzWIONDujDXzl1atSyC3hMbZD+v6440etw+Vt0Pr8ce4TQzHfX3KZM05Mw==",
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/debug-fabulous/-/debug-fabulous-1.1.0.tgz",
+ "integrity": "sha512-GZqvGIgKNlUnHUPQhepnUZFIMoi3dgZKQBzKDeL2g7oJF9SNAji/AAu36dusFUas0O+pae74lNeoIPHqXWDkLg==",
"dev": true,
"requires": {
"debug": "3.1.0",
- "memoizee": "0.4.11",
+ "memoizee": "0.4.12",
"object-assign": "4.1.1"
},
"dependencies": {
@@ -1443,7 +1347,7 @@
"deep-eql": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz",
- "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==",
+ "integrity": "sha1-38lARACtHI/gI+faHfHBR8S0RN8=",
"dev": true,
"requires": {
"type-detect": "4.0.5"
@@ -1544,28 +1448,20 @@
"dev": true
},
"detective": {
- "version": "5.0.2",
- "resolved": "https://registry.npmjs.org/detective/-/detective-5.0.2.tgz",
- "integrity": "sha512-NUsLoezj4wb9o7vpxS9F3L5vcO87ceyRBcl48op06YFNwkyIEY997JpSCA5lDlDuDc6JxOtaL5qfK3muoWxpMA==",
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/detective/-/detective-5.1.0.tgz",
+ "integrity": "sha512-TFHMqfOvxlgrfVzTEkNBSh9SvSNX/HfF4OFI2QFGCyPm02EsyILqnUeb5P6q7JZ3SFNTBL5t2sePRgrN4epUWQ==",
"dev": true,
"requires": {
- "@browserify/acorn5-object-spread": "5.0.1",
- "acorn": "5.3.0",
- "defined": "1.0.0"
- },
- "dependencies": {
- "acorn": {
- "version": "5.3.0",
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.3.0.tgz",
- "integrity": "sha512-Yej+zOJ1Dm/IMZzzj78OntP/r3zHEaKcyNoU2lAaxPtrseM6rF0xwqoz5Q5ysAiED9hTjI2hgtvLXitlCN1/Ug==",
- "dev": true
- }
+ "acorn-node": "1.3.0",
+ "defined": "1.0.0",
+ "minimist": "1.2.0"
}
},
"diff": {
- "version": "3.3.1",
- "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz",
- "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==",
+ "version": "3.5.0",
+ "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
+ "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",
"dev": true
},
"diffie-hellman": {
@@ -1576,9 +1472,15 @@
"requires": {
"bn.js": "4.11.8",
"miller-rabin": "4.0.1",
- "randombytes": "2.0.5"
+ "randombytes": "2.0.6"
}
},
+ "domain-browser": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz",
+ "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==",
+ "dev": true
+ },
"duplexer2": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz",
@@ -1588,6 +1490,29 @@
"readable-stream": "2.3.3"
}
},
+ "duplexify": {
+ "version": "3.5.4",
+ "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.5.4.tgz",
+ "integrity": "sha512-JzYSLYMhoVVBe8+mbHQ4KgpvHpm0DZpJuL8PY93Vyv1fW7jYJ90LoXa1di/CVbJM+TgMs91rbDapE/RNIfnJsA==",
+ "dev": true,
+ "requires": {
+ "end-of-stream": "1.4.1",
+ "inherits": "2.0.3",
+ "readable-stream": "2.3.3",
+ "stream-shift": "1.0.0"
+ },
+ "dependencies": {
+ "end-of-stream": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz",
+ "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==",
+ "dev": true,
+ "requires": {
+ "once": "1.4.0"
+ }
+ }
+ }
+ },
"elliptic": {
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz",
@@ -1624,13 +1549,14 @@
}
},
"es5-ext": {
- "version": "0.10.37",
- "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.37.tgz",
- "integrity": "sha1-DudB0Ui4AGm6J9AgOTdWryV978M=",
+ "version": "0.10.42",
+ "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.42.tgz",
+ "integrity": "sha512-AJxO1rmPe1bDEfSR6TJ/FgMFYuTBhR5R57KW58iCkYACMyFbrkqVyzXSurYoScDGvgyMpk7uRF/lPUPPTmsRSA==",
"dev": true,
"requires": {
"es6-iterator": "2.0.3",
- "es6-symbol": "3.1.1"
+ "es6-symbol": "3.1.1",
+ "next-tick": "1.0.0"
}
},
"es6-iterator": {
@@ -1640,7 +1566,7 @@
"dev": true,
"requires": {
"d": "1.0.0",
- "es5-ext": "0.10.37",
+ "es5-ext": "0.10.42",
"es6-symbol": "3.1.1"
}
},
@@ -1657,7 +1583,7 @@
"dev": true,
"requires": {
"d": "1.0.0",
- "es5-ext": "0.10.37"
+ "es5-ext": "0.10.42"
}
},
"es6-weak-map": {
@@ -1667,7 +1593,7 @@
"dev": true,
"requires": {
"d": "1.0.0",
- "es5-ext": "0.10.37",
+ "es5-ext": "0.10.42",
"es6-iterator": "2.0.3",
"es6-symbol": "3.1.1"
}
@@ -1728,9 +1654,15 @@
"dev": true,
"requires": {
"d": "1.0.0",
- "es5-ext": "0.10.37"
+ "es5-ext": "0.10.42"
}
},
+ "events": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/events/-/events-2.0.0.tgz",
+ "integrity": "sha512-r/M5YkNg9zwI8QbSf7tsDWWJvO3PGwZXyG7GpFAxtMASnHL2eblFd7iHiGPtyGKKFPZ59S63NeX10Ws6WqGDcg==",
+ "dev": true
+ },
"evp_bytestokey": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz",
@@ -1808,7 +1740,7 @@
"is-descriptor": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz",
- "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==",
+ "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=",
"dev": true,
"requires": {
"is-accessor-descriptor": "0.1.6",
@@ -1819,7 +1751,7 @@
"kind-of": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
- "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==",
+ "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=",
"dev": true
}
}
@@ -1851,7 +1783,7 @@
"extglob": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.3.tgz",
- "integrity": "sha512-AyptZexgu7qppEPq59DtN/XJGZDrLcVxSHai+4hdgMMS9EpF4GBvygcWWApno8lL9qSjVpYt7Raao28qzJX1ww==",
+ "integrity": "sha1-VeAZ0Mlb+HOUnHN7flFy26hOuyk=",
"dev": true,
"requires": {
"array-unique": "0.3.2",
@@ -2048,7 +1980,7 @@
"glob": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
- "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
+ "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=",
"dev": true,
"requires": {
"fs.realpath": "1.0.0",
@@ -2161,7 +2093,7 @@
"global-modules": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz",
- "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==",
+ "integrity": "sha1-bXcPDrUjrHgWTXK15xqIdyZcw+o=",
"dev": true,
"requires": {
"global-prefix": "1.0.2",
@@ -2443,7 +2375,7 @@
"acorn": "5.5.3",
"convert-source-map": "1.5.1",
"css": "2.2.1",
- "debug-fabulous": "1.0.0",
+ "debug-fabulous": "1.1.0",
"detect-newline": "2.1.0",
"graceful-fs": "4.1.11",
"source-map": "0.6.1",
@@ -2472,9 +2404,9 @@
}
},
"gulp-typescript": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/gulp-typescript/-/gulp-typescript-4.0.1.tgz",
- "integrity": "sha512-BGdaBC1R4SJosXEkkEieeZ21qCZHnfSV78k7zzDljqAxvzDeGRTUqF4geckVclKEeiS3EYOBwNlxoHjJtn20vg==",
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/gulp-typescript/-/gulp-typescript-4.0.2.tgz",
+ "integrity": "sha512-Hhbn5Aa2l3T+tnn0KqsG6RRJmcYEsr3byTL2nBpNBeAK8pqug9Od4AwddU4JEI+hRw7mzZyjRbB8DDWR6paGVA==",
"dev": true,
"requires": {
"ansi-colors": "1.1.0",
@@ -2509,12 +2441,6 @@
"integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=",
"dev": true
},
- "is-valid-glob": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/is-valid-glob/-/is-valid-glob-1.0.0.tgz",
- "integrity": "sha1-Kb8+/3Ab4tTTFdusw5vDn+j2Aao=",
- "dev": true
- },
"json-stable-stringify": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz",
@@ -2539,16 +2465,6 @@
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
},
- "to-absolute-glob": {
- "version": "2.0.2",
- "resolved": "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz",
- "integrity": "sha1-GGX0PZ50sIItufFFt4z/fQ98hJs=",
- "dev": true,
- "requires": {
- "is-absolute": "1.0.0",
- "is-negated-glob": "1.0.0"
- }
- },
"unique-stream": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-2.2.1.tgz",
@@ -2713,9 +2629,9 @@
"dev": true
},
"has-flag": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
- "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
+ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true
},
"has-gulplog": {
@@ -2823,9 +2739,9 @@
"dev": true
},
"ieee754": {
- "version": "1.1.8",
- "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.8.tgz",
- "integrity": "sha1-vjPUCsEO8ZJnAfbwii2G+/0a0+Q=",
+ "version": "1.1.11",
+ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.11.tgz",
+ "integrity": "sha512-VhDzCKN7K8ufStx/CLj5/PDTMgph+qwN5Pkd5i0sGnVwk56zJ0lkT8Qzi1xqWLS0Wp29DgDtNeS7v8/wMoZeHg==",
"dev": true
},
"indexof": {
@@ -2853,7 +2769,7 @@
"ini": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
- "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
+ "integrity": "sha1-7uJfVtscnsYIXgwid4CD9Zar+Sc=",
"dev": true
},
"inline-source-map": {
@@ -2866,16 +2782,17 @@
}
},
"insert-module-globals": {
- "version": "7.0.1",
- "resolved": "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-7.0.1.tgz",
- "integrity": "sha1-wDv04BywhtW15azorQr+eInWOMM=",
+ "version": "7.0.6",
+ "resolved": "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-7.0.6.tgz",
+ "integrity": "sha512-R3sidKJr3SsggqQQ5cEwQb3pWG8RNx0UnpyeiOSR6jorRIeAOzH2gkTWnNdMnyRiVbjrG047K7UCtlMkQ1Mo9w==",
"dev": true,
"requires": {
"JSONStream": "1.3.2",
- "combine-source-map": "0.7.2",
- "concat-stream": "1.5.2",
+ "combine-source-map": "0.8.0",
+ "concat-stream": "1.6.2",
"is-buffer": "1.1.6",
"lexical-scope": "1.2.0",
+ "path-is-absolute": "1.0.1",
"process": "0.11.10",
"through2": "2.0.3",
"xtend": "4.0.1"
@@ -2890,7 +2807,7 @@
"is-absolute": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz",
- "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==",
+ "integrity": "sha1-OV4a6EsR8mrReV5zwXN45IowFXY=",
"dev": true,
"requires": {
"is-relative": "1.0.0",
@@ -2900,7 +2817,7 @@
"is-accessor-descriptor": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
- "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
+ "integrity": "sha1-FpwvbT3x+ZJhgHI2XJsOofaHhlY=",
"dev": true,
"requires": {
"kind-of": "6.0.2"
@@ -2909,13 +2826,13 @@
"is-buffer": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
- "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
+ "integrity": "sha1-76ouqdqg16suoTqXsritUf776L4=",
"dev": true
},
"is-data-descriptor": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
- "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
+ "integrity": "sha1-2Eh2Mh0Oet0DmQQGq7u9NrqSaMc=",
"dev": true,
"requires": {
"kind-of": "6.0.2"
@@ -2924,7 +2841,7 @@
"is-descriptor": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
- "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
+ "integrity": "sha1-OxWXRqZmBLBPjIFSS6NlxfFNhuw=",
"dev": true,
"requires": {
"is-accessor-descriptor": "1.0.0",
@@ -3015,7 +2932,7 @@
"is-plain-object": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
- "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==",
+ "integrity": "sha1-LBY7P6+xtgbZ0Xko8FwqHDjgdnc=",
"dev": true,
"requires": {
"isobject": "3.0.1"
@@ -3030,7 +2947,7 @@
"is-relative": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz",
- "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==",
+ "integrity": "sha1-obtpNc6MXboei5dUubLcwCDiJg0=",
"dev": true,
"requires": {
"is-unc-path": "1.0.0"
@@ -3039,7 +2956,7 @@
"is-unc-path": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz",
- "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==",
+ "integrity": "sha1-1zHoiY7QkKEsNSrS6u1Qla0yLJ0=",
"dev": true,
"requires": {
"unc-path-regex": "0.1.2"
@@ -3051,6 +2968,12 @@
"integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=",
"dev": true
},
+ "is-valid-glob": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-valid-glob/-/is-valid-glob-1.0.0.tgz",
+ "integrity": "sha1-Kb8+/3Ab4tTTFdusw5vDn+j2Aao=",
+ "dev": true
+ },
"is-windows": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.1.tgz",
@@ -3180,7 +3103,7 @@
"js-yaml": {
"version": "3.10.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz",
- "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==",
+ "integrity": "sha1-LnhEFka9RoLpY/IrbpKCPDCcYtw=",
"dev": true,
"requires": {
"argparse": "1.0.9",
@@ -3190,7 +3113,7 @@
"esprima": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz",
- "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==",
+ "integrity": "sha1-RJnt3NERDgshi6zy+n9/WfVcqAQ=",
"dev": true
}
}
@@ -3225,24 +3148,24 @@
"kind-of": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz",
- "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==",
+ "integrity": "sha1-ARRrNqYhjmTljzqNZt5df8b20FE=",
"dev": true
},
"labeled-stream-splicer": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/labeled-stream-splicer/-/labeled-stream-splicer-2.0.0.tgz",
- "integrity": "sha1-pS4dE4AkwAuGscDJH2d5GLiuClk=",
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/labeled-stream-splicer/-/labeled-stream-splicer-2.0.1.tgz",
+ "integrity": "sha512-MC94mHZRvJ3LfykJlTUipBqenZz1pacOZEMhhQ8dMGcDHs0SBE5GbsavUXV7YtP3icBW17W0Zy1I0lfASmo9Pg==",
"dev": true,
"requires": {
"inherits": "2.0.3",
- "isarray": "0.0.1",
+ "isarray": "2.0.4",
"stream-splicer": "2.0.0"
},
"dependencies": {
"isarray": {
- "version": "0.0.1",
- "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
- "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.4.tgz",
+ "integrity": "sha512-GMxXOiUirWg1xTKRipM0Ek07rX+ubx4nNVElTJdNLYmNO/2YrDkgJGw9CljXn+r4EWiDQg/8lsRdHyg2PJuUaA==",
"dev": true
}
}
@@ -3458,13 +3381,13 @@
"integrity": "sha1-Jzi9nw089PhEkMVzbEhpmsYyzaM=",
"dev": true,
"requires": {
- "es5-ext": "0.10.37"
+ "es5-ext": "0.10.42"
}
},
"make-error": {
- "version": "1.3.2",
- "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.2.tgz",
- "integrity": "sha512-l9ra35l5VWLF24y75Tg8XgfGLX0ueRhph118WKM6H5denx4bB5QF59+4UAm9oJ2qsPQZas/CQUDdtDdfvYHBdQ==",
+ "version": "1.3.4",
+ "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.4.tgz",
+ "integrity": "sha512-0Dab5btKVPhibSalc9QGXb559ED7G7iLjFXBaj9Wq8O3vorueR5K5jaE3hkG6ZQINyhA/JgG6Qk4qdFQjsYV6g==",
"dev": true
},
"make-iterator": {
@@ -3525,19 +3448,19 @@
}
},
"memoizee": {
- "version": "0.4.11",
- "resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.11.tgz",
- "integrity": "sha1-vemBdmPJ5A/bKk6hw2cpYIeujI8=",
+ "version": "0.4.12",
+ "resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.12.tgz",
+ "integrity": "sha512-sprBu6nwxBWBvBOh5v2jcsGqiGLlL2xr2dLub3vR8dnE8YB17omwtm/0NSHl8jjNbcsJd5GMWJAnTSVe/O0Wfg==",
"dev": true,
"requires": {
"d": "1.0.0",
- "es5-ext": "0.10.37",
+ "es5-ext": "0.10.42",
"es6-weak-map": "2.0.2",
"event-emitter": "0.3.5",
"is-promise": "2.1.0",
"lru-queue": "0.1.0",
"next-tick": "1.0.0",
- "timers-ext": "0.1.2"
+ "timers-ext": "0.1.5"
}
},
"merge2": {
@@ -3592,7 +3515,7 @@
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
- "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
+ "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=",
"dev": true,
"requires": {
"brace-expansion": "1.1.8"
@@ -3607,7 +3530,7 @@
"mixin-deep": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.0.tgz",
- "integrity": "sha512-dgaCvoh6i1nosAUBKb0l0pfJ78K8+S9fluyIR2YvAeUD/QuMahnFnF3xYty5eYXMjhGSsB0DsW6A0uAZyetoAg==",
+ "integrity": "sha1-R6hzK6l3mUV8jB7KKPlRMtfoFQo=",
"dev": true,
"requires": {
"for-in": "1.0.2",
@@ -3617,7 +3540,7 @@
"is-extendable": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz",
- "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==",
+ "integrity": "sha1-p0cPnkJnM9gb2B4RVSZOOjUHyrQ=",
"dev": true,
"requires": {
"is-plain-object": "2.0.4"
@@ -3643,9 +3566,9 @@
}
},
"mocha": {
- "version": "5.0.4",
- "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.0.4.tgz",
- "integrity": "sha512-nMOpAPFosU1B4Ix1jdhx5e3q7XO55ic5a8cgYvW27CequcEY+BabS0kUVL1Cw1V5PuVHZWeNRWFLmEPexo79VA==",
+ "version": "5.0.5",
+ "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.0.5.tgz",
+ "integrity": "sha512-3MM3UjZ5p8EJrYpG7s+29HAI9G7sTzKEe4+w37Dg0QP7qL4XGsV+Q2xet2cE37AqdgN1OtYQB6Vl98YiPV3PgA==",
"dev": true,
"requires": {
"browser-stdout": "1.3.1",
@@ -3660,12 +3583,6 @@
"supports-color": "4.4.0"
},
"dependencies": {
- "browser-stdout": {
- "version": "1.3.1",
- "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz",
- "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==",
- "dev": true
- },
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
@@ -3675,10 +3592,10 @@
"ms": "2.0.0"
}
},
- "diff": {
- "version": "3.5.0",
- "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
- "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
"dev": true
},
"supports-color": {
@@ -3698,6 +3615,40 @@
"integrity": "sha1-zK/w4ckc9Vf+d+B535lUuRt0d1Y=",
"dev": true
},
+ "module-deps": {
+ "version": "6.0.2",
+ "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-6.0.2.tgz",
+ "integrity": "sha512-KWBI3009iRnHjRlxRhe8nJ6kdeBTg4sMi5N6AZgg5f1/v5S7EBCRBOY854I4P5Anl4kx6AJH+4bBBC2Gi3nkvg==",
+ "dev": true,
+ "requires": {
+ "JSONStream": "1.3.2",
+ "browser-resolve": "1.11.2",
+ "cached-path-relative": "1.0.1",
+ "concat-stream": "1.6.2",
+ "defined": "1.0.0",
+ "detective": "5.1.0",
+ "duplexer2": "0.1.4",
+ "inherits": "2.0.3",
+ "parents": "1.0.1",
+ "readable-stream": "2.3.3",
+ "resolve": "1.6.0",
+ "stream-combiner2": "1.1.1",
+ "subarg": "1.0.0",
+ "through2": "2.0.3",
+ "xtend": "4.0.1"
+ },
+ "dependencies": {
+ "resolve": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.6.0.tgz",
+ "integrity": "sha512-mw7JQNu5ExIkcw4LPih0owX/TZXjD/ZUF/ZQ/pDnkw3ZKhDcZZw5klmBlj6gVMwjQ3Pz5Jgu7F3d0jcDVuEWdw==",
+ "dev": true,
+ "requires": {
+ "path-parse": "1.0.5"
+ }
+ }
+ }
+ },
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
@@ -3778,7 +3729,7 @@
"natives": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/natives/-/natives-1.1.1.tgz",
- "integrity": "sha512-8eRaxn8u/4wN8tGkhlc2cgwwvOLMLUMUn4IYTexMgWd+LyUDfeXVkk2ygQR0hvIHbJQXgHujia3ieUUDwNGkEA==",
+ "integrity": "sha1-ARrM4ffL2H97prMJPWzZOSvhxXQ=",
"dev": true
},
"next-tick": {
@@ -3861,7 +3812,7 @@
"is-descriptor": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz",
- "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==",
+ "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=",
"dev": true,
"requires": {
"is-accessor-descriptor": "0.1.6",
@@ -3872,7 +3823,7 @@
"kind-of": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
- "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==",
+ "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=",
"dev": true
}
}
@@ -4025,7 +3976,7 @@
"p-map": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz",
- "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==",
+ "integrity": "sha1-5OlPMR6rvIYzoeeZCBZfyiYkG2s=",
"dev": true
},
"pako": {
@@ -4049,8 +4000,8 @@
"integrity": "sha1-N8T5t+06tlx0gXtfJICTf7+XxxI=",
"dev": true,
"requires": {
- "asn1.js": "4.9.2",
- "browserify-aes": "1.1.1",
+ "asn1.js": "4.10.1",
+ "browserify-aes": "1.2.0",
"create-hash": "1.1.3",
"evp_bytestokey": "1.0.3",
"pbkdf2": "3.0.14"
@@ -4146,7 +4097,7 @@
"create-hmac": "1.1.6",
"ripemd160": "2.0.1",
"safe-buffer": "5.1.1",
- "sha.js": "2.4.9"
+ "sha.js": "2.4.11"
}
},
"pify": {
@@ -4262,7 +4213,7 @@
"browserify-rsa": "4.0.1",
"create-hash": "1.1.3",
"parse-asn1": "5.1.0",
- "randombytes": "2.0.5"
+ "randombytes": "2.0.6"
}
},
"pump": {
@@ -4295,29 +4246,6 @@
"duplexify": "3.5.4",
"inherits": "2.0.3",
"pump": "2.0.1"
- },
- "dependencies": {
- "duplexify": {
- "version": "3.5.4",
- "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.5.4.tgz",
- "integrity": "sha512-JzYSLYMhoVVBe8+mbHQ4KgpvHpm0DZpJuL8PY93Vyv1fW7jYJ90LoXa1di/CVbJM+TgMs91rbDapE/RNIfnJsA==",
- "dev": true,
- "requires": {
- "end-of-stream": "1.4.1",
- "inherits": "2.0.3",
- "readable-stream": "2.3.3",
- "stream-shift": "1.0.0"
- }
- },
- "end-of-stream": {
- "version": "1.4.1",
- "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz",
- "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==",
- "dev": true,
- "requires": {
- "once": "1.4.0"
- }
- }
}
},
"punycode": {
@@ -4345,21 +4273,21 @@
"dev": true
},
"randombytes": {
- "version": "2.0.5",
- "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.5.tgz",
- "integrity": "sha512-8T7Zn1AhMsQ/HI1SjcCfT/t4ii3eAqco3yOcSzS4mozsOz69lHLsoMXmF9nZgnFanYscnSlUSgs8uZyKzpE6kg==",
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.6.tgz",
+ "integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==",
"dev": true,
"requires": {
"safe-buffer": "5.1.1"
}
},
"randomfill": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.3.tgz",
- "integrity": "sha512-YL6GrhrWoic0Eq8rXVbMptH7dAxCs0J+mh5Y0euNekPPYaxEmdVGim6GdoxoRzKW2yJoU8tueifS7mYxvcFDEQ==",
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz",
+ "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==",
"dev": true,
"requires": {
- "randombytes": "2.0.5",
+ "randombytes": "2.0.6",
"safe-buffer": "5.1.1"
}
},
@@ -4375,7 +4303,7 @@
"readable-stream": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz",
- "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==",
+ "integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=",
"dev": true,
"requires": {
"core-util-is": "1.0.2",
@@ -4494,7 +4422,7 @@
"rimraf": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz",
- "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==",
+ "integrity": "sha1-LtgVDSShbqhlHm1u8PR8QVjOejY=",
"dev": true,
"requires": {
"glob": "7.1.2"
@@ -4513,7 +4441,7 @@
"run-sequence": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/run-sequence/-/run-sequence-2.2.1.tgz",
- "integrity": "sha512-qkzZnQWMZjcKbh3CNly2srtrkaO/2H/SI5f2eliMCapdRD3UhMrwjfOAZJAnZ2H8Ju4aBzFZkBGXUqFs9V0yxw==",
+ "integrity": "sha1-HOZD2jb9jH6n4akynaM/wriJhJU=",
"dev": true,
"requires": {
"chalk": "1.1.3",
@@ -4551,7 +4479,7 @@
"safe-buffer": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
- "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==",
+ "integrity": "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=",
"dev": true
},
"sander": {
@@ -4577,7 +4505,7 @@
"sax": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
- "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
+ "integrity": "sha1-KBYjTiN4vdxOU1T6tcqold9xANk=",
"dev": true
},
"semver": {
@@ -4604,7 +4532,7 @@
"set-value": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz",
- "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==",
+ "integrity": "sha1-ca5KiPD+77v1LR6mBPP7MV67YnQ=",
"dev": true,
"requires": {
"extend-shallow": "2.0.1",
@@ -4614,9 +4542,9 @@
}
},
"sha.js": {
- "version": "2.4.9",
- "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.9.tgz",
- "integrity": "sha512-G8zektVqbiPHrylgew9Zg1VRB1L/DtXNUVAM6q4QLy8NE3qtHlFXTf8VLL4k1Yl6c7NMjtZUTdXV+X44nFaT6A==",
+ "version": "2.4.11",
+ "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
+ "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==",
"dev": true,
"requires": {
"inherits": "2.0.3",
@@ -4630,7 +4558,7 @@
"dev": true,
"requires": {
"json-stable-stringify": "0.0.1",
- "sha.js": "2.4.9"
+ "sha.js": "2.4.11"
}
},
"shell-quote": {
@@ -4719,7 +4647,7 @@
"is-descriptor": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz",
- "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==",
+ "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=",
"dev": true,
"requires": {
"is-accessor-descriptor": "0.1.6",
@@ -4730,7 +4658,7 @@
"kind-of": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
- "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==",
+ "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=",
"dev": true
}
}
@@ -4738,7 +4666,7 @@
"snapdragon-node": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz",
- "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==",
+ "integrity": "sha1-bBdfhv8UvbByRWPo88GwIaKGhTs=",
"dev": true,
"requires": {
"define-property": "1.0.0",
@@ -4749,7 +4677,7 @@
"snapdragon-util": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz",
- "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==",
+ "integrity": "sha1-+VZHlIbyrNeXAGk/b3uAXkWrVuI=",
"dev": true,
"requires": {
"kind-of": "3.2.2"
@@ -4787,7 +4715,7 @@
"source-map-resolve": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.1.tgz",
- "integrity": "sha512-0KW2wvzfxm8NCTb30z0LMNyPqWCdDGE2viwzUaucqJdkTRXtZiSY3I+2A6nVAjmdOy0I4gU8DwnVVGsk9jvP2A==",
+ "integrity": "sha1-etD1k/IoFZjoVN+A8ZquS5LXoRo=",
"dev": true,
"requires": {
"atob": "2.0.3",
@@ -4838,7 +4766,7 @@
"split-string": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz",
- "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==",
+ "integrity": "sha1-fLCd2jqGWFcFxks5pkZgOGguj+I=",
"dev": true,
"requires": {
"extend-shallow": "3.0.2"
@@ -4857,7 +4785,7 @@
"is-extendable": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz",
- "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==",
+ "integrity": "sha1-p0cPnkJnM9gb2B4RVSZOOjUHyrQ=",
"dev": true,
"requires": {
"is-plain-object": "2.0.4"
@@ -4933,7 +4861,7 @@
"is-descriptor": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz",
- "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==",
+ "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=",
"dev": true,
"requires": {
"is-accessor-descriptor": "0.1.6",
@@ -4944,7 +4872,7 @@
"kind-of": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
- "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==",
+ "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=",
"dev": true
}
}
@@ -4976,9 +4904,9 @@
"dev": true
},
"stream-http": {
- "version": "2.7.2",
- "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.7.2.tgz",
- "integrity": "sha512-c0yTD2rbQzXtSsFSVhtpvY/vS6u066PcXOX9kBB3mSO76RiUQzL340uJkGBWnlBg4/HZzqiUXtaVA7wcRcJgEw==",
+ "version": "2.8.1",
+ "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.1.tgz",
+ "integrity": "sha512-cQ0jo17BLca2r0GfRdZKYAGLU6JRoIWxqSOakUMuKOT6MOK7AAlE856L33QuDmAy/eeOrhLee3dZKX0Uadu93A==",
"dev": true,
"requires": {
"builtin-status-codes": "3.0.0",
@@ -5042,7 +4970,7 @@
"string_decoder": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
- "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
+ "integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=",
"dev": true,
"requires": {
"safe-buffer": "5.1.1"
@@ -5082,13 +5010,22 @@
"minimist": "1.2.0"
}
},
- "syntax-error": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/syntax-error/-/syntax-error-1.3.0.tgz",
- "integrity": "sha1-HtkmbE1AvnXcVb+bsct3Biu5bKE=",
+ "supports-color": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz",
+ "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==",
"dev": true,
"requires": {
- "acorn": "4.0.13"
+ "has-flag": "3.0.0"
+ }
+ },
+ "syntax-error": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/syntax-error/-/syntax-error-1.4.0.tgz",
+ "integrity": "sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w==",
+ "dev": true,
+ "requires": {
+ "acorn-node": "1.3.0"
}
},
"through": {
@@ -5142,15 +5079,25 @@
}
},
"timers-ext": {
- "version": "0.1.2",
- "resolved": "https://registry.npmjs.org/timers-ext/-/timers-ext-0.1.2.tgz",
- "integrity": "sha1-YcxHp2wavTGV8UUn+XjViulMUgQ=",
+ "version": "0.1.5",
+ "resolved": "https://registry.npmjs.org/timers-ext/-/timers-ext-0.1.5.tgz",
+ "integrity": "sha512-tsEStd7kmACHENhsUPaxb8Jf8/+GZZxyNFQbZD07HQOyooOa6At1rQqjffgvg7n+dxscQa9cjjMdWhJtsP2sxg==",
"dev": true,
"requires": {
- "es5-ext": "0.10.37",
+ "es5-ext": "0.10.42",
"next-tick": "1.0.0"
}
},
+ "to-absolute-glob": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz",
+ "integrity": "sha1-GGX0PZ50sIItufFFt4z/fQ98hJs=",
+ "dev": true,
+ "requires": {
+ "is-absolute": "1.0.0",
+ "is-negated-glob": "1.0.0"
+ }
+ },
"to-arraybuffer": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz",
@@ -5240,7 +5187,7 @@
"is-descriptor": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz",
- "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==",
+ "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=",
"dev": true,
"requires": {
"is-accessor-descriptor": "0.1.6",
@@ -5251,7 +5198,7 @@
"kind-of": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
- "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==",
+ "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=",
"dev": true
}
}
@@ -5289,8 +5236,8 @@
"requires": {
"arrify": "1.0.1",
"chalk": "2.3.2",
- "diff": "3.3.1",
- "make-error": "1.3.2",
+ "diff": "3.5.0",
+ "make-error": "1.3.4",
"minimist": "1.2.0",
"mkdirp": "0.5.1",
"source-map-support": "0.5.4",
@@ -5298,9 +5245,9 @@
}
},
"tslib": {
- "version": "1.8.1",
- "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.8.1.tgz",
- "integrity": "sha1-aUavLR1lGnsYY7Ux1uWvpBqkTqw=",
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.0.tgz",
+ "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==",
"dev": true
},
"tslint": {
@@ -5313,14 +5260,14 @@
"builtin-modules": "1.1.1",
"chalk": "2.3.2",
"commander": "2.15.1",
- "diff": "3.3.1",
+ "diff": "3.5.0",
"glob": "7.1.2",
"js-yaml": "3.10.0",
"minimatch": "3.0.4",
"resolve": "1.6.0",
"semver": "5.5.0",
- "tslib": "1.8.1",
- "tsutils": "2.16.0"
+ "tslib": "1.9.0",
+ "tsutils": "2.26.1"
},
"dependencies": {
"commander": {
@@ -5347,14 +5294,20 @@
}
},
"tsutils": {
- "version": "2.16.0",
- "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.16.0.tgz",
- "integrity": "sha512-9Ier/60O7OZRNPiw+or5QAtAY4kQA+WDiO/r6xOYATEyefH9bdfvTRLCxrYnFhQlZfET2vYXKfpr3Vw2BiArZw==",
+ "version": "2.26.1",
+ "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.26.1.tgz",
+ "integrity": "sha512-bnm9bcjOqOr1UljleL94wVCDlpa6KjfGaTkefeLch4GRafgDkROxPizbB/FxTEdI++5JqhxczRy/Qub0syNqZA==",
"dev": true,
"requires": {
- "tslib": "1.8.1"
+ "tslib": "1.9.0"
}
},
+ "tty-browserify": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz",
+ "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==",
+ "dev": true
+ },
"type-check": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
@@ -5367,7 +5320,7 @@
"type-detect": {
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.5.tgz",
- "integrity": "sha512-N9IvkQslUGYGC24RkJk1ba99foK6TkwC2FHAEBlQFBP0RxQZS8ZpJuAZcwiY/w9ZJHFQb1aOXBI60OdxhTrwEQ==",
+ "integrity": "sha1-1w5byB223io4G8rKDG4MvcdjXeI=",
"dev": true
},
"typedarray": {
@@ -5377,9 +5330,9 @@
"dev": true
},
"typescript": {
- "version": "2.8.0-dev.20180322",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.8.0-dev.20180322.tgz",
- "integrity": "sha512-dSYa9IAoj3CRAxtKx9+cSCQLetB7OLtHXhvQWeWY6PPIXvbpAC41ulQWX3TUAkMYU9NS/kGIU8TFM9VFpinJTg==",
+ "version": "2.9.0-dev.20180407",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.0-dev.20180407.tgz",
+ "integrity": "sha512-Tg0/hU2hSz+4pb5Lj5+bj1uLldN7C8NO5Ik19WfftMlpeXRyZQJzglV0oncmsXOfN9gG+JC0xnO58YspE6sZ1w==",
"dev": true
},
"uglify-js": {
@@ -5402,9 +5355,9 @@
"optional": true
},
"umd": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/umd/-/umd-3.0.1.tgz",
- "integrity": "sha1-iuVW4RAR9jwllnCKiDclnwGz1g4=",
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/umd/-/umd-3.0.3.tgz",
+ "integrity": "sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow==",
"dev": true
},
"unc-path-regex": {
@@ -5572,7 +5525,7 @@
"is-descriptor": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz",
- "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==",
+ "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=",
"dev": true,
"requires": {
"is-accessor-descriptor": "0.1.6",
@@ -5583,7 +5536,7 @@
"kind-of": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
- "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==",
+ "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=",
"dev": true
}
}
@@ -5766,7 +5719,7 @@
"vlq": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/vlq/-/vlq-0.2.3.tgz",
- "integrity": "sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow==",
+ "integrity": "sha1-jz5DKM9jsVQMDWfhsneDhviXWyY=",
"dev": true
},
"vm-browserify": {
@@ -5781,7 +5734,7 @@
"which": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz",
- "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==",
+ "integrity": "sha1-/wS9/AEO5UfXgL7DjhrBwnd9JTo=",
"dev": true,
"requires": {
"isexe": "2.0.0"
@@ -5809,7 +5762,7 @@
"xml2js": {
"version": "0.4.19",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz",
- "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==",
+ "integrity": "sha1-aGwg8hMgnpSr8NG88e+qKRx4J6c=",
"dev": true,
"requires": {
"sax": "1.2.4",
diff --git a/scripts/processDiagnosticMessages.ts b/scripts/processDiagnosticMessages.ts
index dd66564b134..848a60cfb4f 100644
--- a/scripts/processDiagnosticMessages.ts
+++ b/scripts/processDiagnosticMessages.ts
@@ -1,9 +1,7 @@
-///
-///
-
interface DiagnosticDetails {
category: string;
code: number;
+ reportsUnnecessary?: {};
isEarly?: boolean;
}
@@ -56,17 +54,17 @@ function buildInfoFileOutput(messageTable: InputDiagnosticMessageTable, inputFil
let result =
"// \r\n" +
"// generated from '" + inputFilePathRel + "' by '" + thisFilePathRel + "'\r\n" +
- "/// \r\n" +
"/* @internal */\r\n" +
"namespace ts {\r\n" +
- " function diag(code: number, category: DiagnosticCategory, key: string, message: string): DiagnosticMessage {\r\n" +
- " return { code, category, key, message };\r\n" +
+ " function diag(code: number, category: DiagnosticCategory, key: string, message: string, reportsUnnecessary?: {}): DiagnosticMessage {\r\n" +
+ " return { code, category, key, message, reportsUnnecessary };\r\n" +
" }\r\n" +
" // tslint:disable-next-line variable-name\r\n" +
" export const Diagnostics = {\r\n";
- messageTable.forEach(({ code, category }, name) => {
+ messageTable.forEach(({ code, category, reportsUnnecessary }, name) => {
const propName = convertPropertyName(name);
- result += ` ${propName}: diag(${code}, DiagnosticCategory.${category}, "${createKey(propName, code)}", ${JSON.stringify(name)}),\r\n`;
+ const argReportsUnnecessary = reportsUnnecessary ? `, /*reportsUnnecessary*/ ${reportsUnnecessary}` : "";
+ result += ` ${propName}: diag(${code}, DiagnosticCategory.${category}, "${createKey(propName, code)}", ${JSON.stringify(name)}${argReportsUnnecessary}),\r\n`;
});
result += " };\r\n}";
diff --git a/scripts/processDiagnosticMessages.tsconfig.json b/scripts/processDiagnosticMessages.tsconfig.json
new file mode 100644
index 00000000000..5675c8783b9
--- /dev/null
+++ b/scripts/processDiagnosticMessages.tsconfig.json
@@ -0,0 +1,20 @@
+{
+ "compilerOptions": {
+ "removeComments": false,
+ "outFile": "processDiagnosticMessages.js",
+ "target": "es5",
+ "declaration": false,
+ "lib": [
+ "es6",
+ "scripthost"
+ ]
+ },
+ "files": [
+ "../src/compiler/types.ts",
+ "../src/compiler/performance.ts",
+ "../src/compiler/core.ts",
+ "../src/compiler/sys.ts",
+
+ "processDiagnosticMessages.ts"
+ ]
+}
diff --git a/scripts/tslint/rules/booleanTriviaRule.ts b/scripts/tslint/rules/booleanTriviaRule.ts
index dbfdc28438e..0224a0f08d8 100644
--- a/scripts/tslint/rules/booleanTriviaRule.ts
+++ b/scripts/tslint/rules/booleanTriviaRule.ts
@@ -28,13 +28,11 @@ function walk(ctx: Lint.WalkContext): void {
function shouldIgnoreCalledExpression(expression: ts.Expression): boolean {
if (expression.kind === ts.SyntaxKind.PropertyAccessExpression) {
const methodName = (expression as ts.PropertyAccessExpression).name.text;
- if (methodName.indexOf("set") === 0) {
+ if (methodName.startsWith("set") || methodName.startsWith("assert")) {
return true;
}
switch (methodName) {
case "apply":
- case "assert":
- case "assertEqual":
case "call":
case "equal":
case "fail":
@@ -46,11 +44,10 @@ function walk(ctx: Lint.WalkContext): void {
}
else if (expression.kind === ts.SyntaxKind.Identifier) {
const functionName = (expression as ts.Identifier).text;
- if (functionName.indexOf("set") === 0) {
+ if (functionName.startsWith("set") || functionName.startsWith("assert")) {
return true;
}
switch (functionName) {
- case "assert":
case "contains":
case "createAnonymousType":
case "createImportSpecifier":
diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts
index 2bbb4ef44a2..12dbd2e42d4 100644
--- a/src/compiler/binder.ts
+++ b/src/compiler/binder.ts
@@ -1,6 +1,3 @@
-///
-///
-
/* @internal */
namespace ts {
export const enum ModuleInstanceState {
diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts
index cc506852252..92e651061ed 100644
--- a/src/compiler/builder.ts
+++ b/src/compiler/builder.ts
@@ -1,5 +1,3 @@
-///
-
/*@internal*/
namespace ts {
/**
diff --git a/src/compiler/builderState.ts b/src/compiler/builderState.ts
index 581aa05f12c..ac9f36b1258 100644
--- a/src/compiler/builderState.ts
+++ b/src/compiler/builderState.ts
@@ -1,4 +1,3 @@
-///
namespace ts {
export interface EmitOutput {
outputFiles: OutputFile[];
diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts
index acefa47cb95..e310e5f1f21 100644
--- a/src/compiler/checker.ts
+++ b/src/compiler/checker.ts
@@ -1,7 +1,3 @@
-///
-///
-///
-
/* @internal */
namespace ts {
const ambientModuleSymbolRegex = /^".+"$/;
@@ -2216,7 +2212,22 @@ namespace ts {
// An external module with an 'export =' declaration resolves to the target of the 'export =' declaration,
// and an external module with no 'export =' declaration resolves to the module itself.
function resolveExternalModuleSymbol(moduleSymbol: Symbol, dontResolveAlias?: boolean): Symbol {
- return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports.get(InternalSymbolName.ExportEquals), dontResolveAlias)) || moduleSymbol;
+ return moduleSymbol && getMergedSymbol(resolveSymbol(getCommonJsExportEquals(moduleSymbol), dontResolveAlias)) || moduleSymbol;
+ }
+
+ function getCommonJsExportEquals(moduleSymbol: Symbol): Symbol {
+ const exported = moduleSymbol.exports.get(InternalSymbolName.ExportEquals);
+ if (!exported || !exported.exports || moduleSymbol.exports.size === 1) {
+ return exported;
+ }
+ const merged = cloneSymbol(exported);
+ moduleSymbol.exports.forEach((s, name) => {
+ if (name === InternalSymbolName.ExportEquals) return;
+ if (!merged.exports.has(name)) {
+ merged.exports.set(name, s);
+ }
+ });
+ return merged;
}
// An external module with an 'export =' declaration may be referenced as an ES6 module provided the 'export ='
@@ -2740,7 +2751,7 @@ namespace ts {
}
function hasVisibleDeclarations(symbol: Symbol, shouldComputeAliasToMakeVisible: boolean): SymbolVisibilityResult {
- let aliasesToMakeVisible: AnyImportSyntax[];
+ let aliasesToMakeVisible: LateVisibilityPaintedStatement[];
if (forEach(symbol.declarations, declaration => !getIsDeclarationVisible(declaration))) {
return undefined;
}
@@ -2754,15 +2765,13 @@ namespace ts {
const anyImportSyntax = getAnyImportSyntax(declaration);
if (anyImportSyntax &&
!hasModifier(anyImportSyntax, ModifierFlags.Export) && // import clause without export
- isDeclarationVisible(anyImportSyntax.parent)) {
- // In function "buildTypeDisplay" where we decide whether to write type-alias or serialize types,
- // we want to just check if type- alias is accessible or not but we don't care about emitting those alias at that time
- // since we will do the emitting later in trackSymbol.
- if (shouldComputeAliasToMakeVisible) {
- getNodeLinks(declaration).isVisible = true;
- aliasesToMakeVisible = appendIfUnique(aliasesToMakeVisible, anyImportSyntax);
- }
- return true;
+ isDeclarationVisible(anyImportSyntax.parent)) {
+ return addVisibleAlias(declaration, anyImportSyntax);
+ }
+ else if (isVariableDeclaration(declaration) && isVariableStatement(declaration.parent.parent) &&
+ !hasModifier(declaration.parent.parent, ModifierFlags.Export) && // unexported variable statement
+ isDeclarationVisible(declaration.parent.parent.parent)) {
+ return addVisibleAlias(declaration, declaration.parent.parent);
}
// Declaration is not visible
@@ -2771,6 +2780,17 @@ namespace ts {
return true;
}
+
+ function addVisibleAlias(declaration: Declaration, aliasingStatement: LateVisibilityPaintedStatement) {
+ // In function "buildTypeDisplay" where we decide whether to write type-alias or serialize types,
+ // we want to just check if type- alias is accessible or not but we don't care about emitting those alias at that time
+ // since we will do the emitting later in trackSymbol.
+ if (shouldComputeAliasToMakeVisible) {
+ getNodeLinks(declaration).isVisible = true;
+ aliasesToMakeVisible = appendIfUnique(aliasesToMakeVisible, aliasingStatement);
+ }
+ return true;
+ }
}
function isEntityNameVisible(entityName: EntityNameOrEntityNameExpression, enclosingDeclaration: Node): SymbolVisibilityResult {
@@ -3835,7 +3855,7 @@ namespace ts {
return symbolName(symbol);
}
- function isDeclarationVisible(node: Declaration | AnyImportSyntax): boolean {
+ function isDeclarationVisible(node: Node): boolean {
if (node) {
const links = getNodeLinks(node);
if (links.isVisible === undefined) {
@@ -3849,7 +3869,7 @@ namespace ts {
function determineIfDeclarationIsVisible() {
switch (node.kind) {
case SyntaxKind.BindingElement:
- return isDeclarationVisible(node.parent.parent);
+ return isDeclarationVisible(node.parent.parent);
case SyntaxKind.VariableDeclaration:
if (isBindingPattern((node as VariableDeclaration).name) &&
!((node as VariableDeclaration).name as BindingPattern).elements.length) {
@@ -3875,7 +3895,7 @@ namespace ts {
return isGlobalSourceFile(parent);
}
// Exported members/ambient module elements (exception import declaration) are visible if parent is visible
- return isDeclarationVisible(parent);
+ return isDeclarationVisible(parent);
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.PropertySignature:
@@ -3905,7 +3925,7 @@ namespace ts {
case SyntaxKind.UnionType:
case SyntaxKind.IntersectionType:
case SyntaxKind.ParenthesizedType:
- return isDeclarationVisible(node.parent);
+ return isDeclarationVisible(node.parent);
// Default binding, import specifier and namespace import is visible
// only on demand so by default it is not visible
@@ -4150,14 +4170,17 @@ namespace ts {
else {
// Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form)
const name = declaration.propertyName || declaration.name;
- if (isComputedNonLiteralName(name)) {
- // computed properties with non-literal names are treated as 'any'
+ const isLate = isLateBindableName(name);
+ const isWellKnown = isComputedPropertyName(name) && isWellKnownSymbolSyntactically(name.expression);
+ if (!isLate && !isWellKnown && isComputedNonLiteralName(name)) {
return anyType;
}
// Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature,
// or otherwise the type of the string index signature.
- const text = getTextOfPropertyName(name);
+ const text = isLate ? getLateBoundNameFromType(checkComputedPropertyName(name as ComputedPropertyName) as LiteralType | UniqueESSymbolType) :
+ isWellKnown ? getPropertyNameForKnownSymbolName(idText(((name as ComputedPropertyName).expression as PropertyAccessExpression).name)) :
+ getTextOfPropertyName(name);
// Relax null check on ambient destructuring parameters, since the parameters have no implementation and are just documentation
if (strictNullChecks && declaration.flags & NodeFlags.Ambient && isParameterDeclaration(declaration)) {
@@ -4343,14 +4366,15 @@ namespace ts {
for (const declaration of symbol.declarations) {
let declarationInConstructor = false;
const expression = declaration.kind === SyntaxKind.BinaryExpression ? declaration :
- declaration.kind === SyntaxKind.PropertyAccessExpression ? getAncestor(declaration, SyntaxKind.BinaryExpression) :
+ declaration.kind === SyntaxKind.PropertyAccessExpression ? cast(declaration.parent, isBinaryExpression) :
undefined;
if (!expression) {
return unknownType;
}
- if (isPropertyAccessExpression(expression.left) && expression.left.expression.kind === SyntaxKind.ThisKeyword) {
+ const special = getSpecialPropertyAssignmentKind(expression);
+ if (special === SpecialPropertyAssignmentKind.ThisProperty) {
const thisContainer = getThisContainer(expression, /*includeArrowFunctions*/ false);
// Properties defined in a constructor (or javascript constructor function) don't get undefined added.
// Function expressions that are assigned to the prototype count as methods.
@@ -4380,7 +4404,33 @@ namespace ts {
}
else if (!jsDocType) {
// If we don't have an explicit JSDoc type, get the type from the expression.
- const type = getWidenedLiteralType(checkExpressionCached(expression.right));
+ let type = getWidenedLiteralType(checkExpressionCached(expression.right));
+
+ if (getObjectFlags(type) & ObjectFlags.Anonymous &&
+ special === SpecialPropertyAssignmentKind.ModuleExports &&
+ symbol.escapedName === InternalSymbolName.ExportEquals) {
+ const exportedType = resolveStructuredTypeMembers(type as AnonymousType);
+ const members = createSymbolTable();
+ copyEntries(exportedType.members, members);
+ symbol.exports.forEach((s, name) => {
+ if (members.has(name)) {
+ const exportedMember = exportedType.members.get(name);
+ const union = createSymbol(s.flags | exportedMember.flags, name);
+ union.type = getUnionType([getTypeOfSymbol(s), getTypeOfSymbol(exportedMember)]);
+ members.set(name, union);
+ }
+ else {
+ members.set(name, s);
+ }
+ });
+ type = createAnonymousType(
+ exportedType.symbol,
+ members,
+ exportedType.callSignatures,
+ exportedType.constructSignatures,
+ exportedType.stringIndexInfo,
+ exportedType.numberIndexInfo);
+ }
let anyedType = type;
if (isEmptyArrayLiteralType(type)) {
anyedType = anyArrayType;
@@ -7163,15 +7213,15 @@ namespace ts {
return symbol.members.get(InternalSymbolName.Index);
}
- function getIndexDeclarationOfSymbol(symbol: Symbol, kind: IndexKind): SignatureDeclaration {
+ function getIndexDeclarationOfSymbol(symbol: Symbol, kind: IndexKind): IndexSignatureDeclaration {
const syntaxKind = kind === IndexKind.Number ? SyntaxKind.NumberKeyword : SyntaxKind.StringKeyword;
const indexSymbol = getIndexSymbol(symbol);
if (indexSymbol) {
for (const decl of indexSymbol.declarations) {
- const node = decl;
+ const node = cast(decl, isIndexSignatureDeclaration);
if (node.parameters.length === 1) {
const parameter = node.parameters[0];
- if (parameter && parameter.type && parameter.type.kind === syntaxKind) {
+ if (parameter.type && parameter.type.kind === syntaxKind) {
return node;
}
}
@@ -7181,7 +7231,7 @@ namespace ts {
return undefined;
}
- function createIndexInfo(type: Type, isReadonly: boolean, declaration?: SignatureDeclaration): IndexInfo {
+ function createIndexInfo(type: Type, isReadonly: boolean, declaration?: IndexSignatureDeclaration): IndexInfo {
return { type, isReadonly, declaration };
}
@@ -13833,7 +13883,8 @@ namespace ts {
const assignmentKind = getAssignmentTargetKind(node);
if (assignmentKind) {
- if (!(localOrExportSymbol.flags & SymbolFlags.Variable)) {
+ if (!(localOrExportSymbol.flags & SymbolFlags.Variable) &&
+ !(isInJavaScriptFile(node) && localOrExportSymbol.flags & SymbolFlags.ValueModule)) {
error(node, Diagnostics.Cannot_assign_to_0_because_it_is_not_a_variable, symbolToString(symbol));
return unknownType;
}
@@ -16621,12 +16672,18 @@ namespace ts {
}
}
}
- const suggestion = getSuggestionForNonexistentProperty(propNode, containingType);
- if (suggestion !== undefined) {
- errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2, declarationNameToString(propNode), typeToString(containingType), suggestion);
+ const promisedType = getPromisedTypeOfPromise(containingType);
+ if (promisedType && getPropertyOfType(promisedType, propNode.escapedText)) {
+ errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_forget_to_use_await, declarationNameToString(propNode), typeToString(containingType));
}
else {
- errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(containingType));
+ const suggestion = getSuggestionForNonexistentProperty(propNode, containingType);
+ if (suggestion !== undefined) {
+ errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2, declarationNameToString(propNode), typeToString(containingType), suggestion);
+ }
+ else {
+ errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(containingType));
+ }
}
diagnostics.add(createDiagnosticForNodeFromMessageChain(propNode, errorInfo));
}
@@ -19038,6 +19095,9 @@ namespace ts {
const links = getNodeLinks(node);
const type = getTypeOfSymbol(node.symbol);
+ if (isTypeAny(type)) {
+ return type;
+ }
// Check if function expression is contextually typed and assign parameter types if so.
if (!(links.flags & NodeCheckFlags.ContextChecked)) {
@@ -19800,8 +19860,9 @@ namespace ts {
// VarExpr = ValueExpr
// requires VarExpr to be classified as a reference
// A compound assignment furthermore requires VarExpr to be classified as a reference (section 4.1)
- // and the type of the non - compound operation to be assignable to the type of VarExpr.
- if (checkReferenceExpression(left, Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)) {
+ // and the type of the non-compound operation to be assignable to the type of VarExpr.
+ if (checkReferenceExpression(left, Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)
+ && (!isIdentifier(left) || unescapeLeadingUnderscores(left.escapedText) !== "exports")) {
// to avoid cascading errors check assignability only if 'isReference' check succeeded and no errors were reported
checkTypeAssignableTo(valueType, leftType, left, /*headMessage*/ undefined);
}
@@ -21819,6 +21880,10 @@ namespace ts {
// and give a better error message when the host function mentions `arguments`
// but the tag doesn't have an array type
if (decl) {
+ const i = getJSDocTags(decl).filter(isJSDocParameterTag).indexOf(node);
+ if (i > -1 && i < decl.parameters.length && isBindingPattern(decl.parameters[i].name)) {
+ return;
+ }
if (!containsArgumentsReference(decl)) {
error(node.name,
Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name,
@@ -24573,7 +24638,7 @@ namespace ts {
const exportEqualsSymbol = moduleSymbol.exports.get("export=" as __String);
if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) {
const declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration;
- if (!isTopLevelInExternalModuleAugmentation(declaration)) {
+ if (!isTopLevelInExternalModuleAugmentation(declaration) && !isInJavaScriptFile(declaration)) {
error(declaration, Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements);
}
}
@@ -24654,7 +24719,6 @@ namespace ts {
case SyntaxKind.ConstructorType:
case SyntaxKind.CallSignature:
case SyntaxKind.ConstructSignature:
- return checkSignatureDeclaration(node);
case SyntaxKind.IndexSignature:
return checkSignatureDeclaration(node);
case SyntaxKind.MethodDeclaration:
@@ -24774,8 +24838,6 @@ namespace ts {
case SyntaxKind.ExportAssignment:
return checkExportAssignment(node);
case SyntaxKind.EmptyStatement:
- checkGrammarStatementInAmbientContext(node);
- return;
case SyntaxKind.DebuggerStatement:
checkGrammarStatementInAmbientContext(node);
return;
@@ -25453,9 +25515,6 @@ namespace ts {
}
function getShorthandAssignmentValueSymbol(location: Node): Symbol {
- // The function returns a value symbol of an identifier in the short-hand property assignment.
- // This is necessary as an identifier in short-hand property assignment can contains two meaning:
- // property name and property value.
if (location && location.kind === SyntaxKind.ShorthandPropertyAssignment) {
return resolveEntityName((location).name, SymbolFlags.Value | SymbolFlags.Alias);
}
diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts
index f88b43d1304..f6550e3e0ed 100644
--- a/src/compiler/commandLineParser.ts
+++ b/src/compiler/commandLineParser.ts
@@ -1,9 +1,3 @@
-///
-///
-///
-///
-///
-
namespace ts {
/* @internal */
export const compileOnSaveCommandLineOption: CommandLineOption = { name: "compileOnSave", type: "boolean" };
diff --git a/src/compiler/comments.ts b/src/compiler/comments.ts
index f26a66701e4..de629cccfe1 100644
--- a/src/compiler/comments.ts
+++ b/src/compiler/comments.ts
@@ -1,5 +1,3 @@
-///
-
/* @internal */
namespace ts {
export interface CommentWriter {
diff --git a/src/compiler/core.ts b/src/compiler/core.ts
index 4055f49a856..5840a6bcef5 100644
--- a/src/compiler/core.ts
+++ b/src/compiler/core.ts
@@ -1,6 +1,3 @@
-///
-///
-
namespace ts {
// WARNING: The script `configureNightly.ts` uses a regexp to parse out these values.
// If changing the text in this section, be sure to test `configureNightly` too.
@@ -1268,10 +1265,7 @@ namespace ts {
});
}
- export function assign, T2, T3>(t: T1, arg1: T2, arg2: T3): T1 & T2 & T3;
- export function assign, T2>(t: T1, arg1: T2): T1 & T2;
- export function assign>(t: T1, ...args: any[]): any;
- export function assign>(t: T1, ...args: any[]) {
+ export function assign(t: T, ...args: T[]) {
for (const arg of args) {
for (const p in arg) {
if (hasProperty(arg, p)) {
@@ -1317,12 +1311,13 @@ namespace ts {
* the same key with the given 'makeKey' function, then the element with the higher
* index in the array will be the one associated with the produced key.
*/
- export function arrayToMap(array: ReadonlyArray, makeKey: (value: T) => string): Map;
- export function arrayToMap(array: ReadonlyArray, makeKey: (value: T) => string, makeValue: (value: T) => U): Map;
- export function arrayToMap(array: ReadonlyArray, makeKey: (value: T) => string, makeValue: (value: T) => T | U = identity): Map {
+ export function arrayToMap(array: ReadonlyArray, makeKey: (value: T) => string | undefined): Map;
+ export function arrayToMap(array: ReadonlyArray, makeKey: (value: T) => string | undefined, makeValue: (value: T) => U): Map;
+ export function arrayToMap(array: ReadonlyArray, makeKey: (value: T) => string | undefined, makeValue: (value: T) => T | U = identity): Map {
const result = createMap();
for (const value of array) {
- result.set(makeKey(value), makeValue(value));
+ const key = makeKey(value);
+ if (key !== undefined) result.set(key, makeValue(value));
}
return result;
}
@@ -1343,8 +1338,9 @@ namespace ts {
* @param array the array of input elements.
*/
export function arrayToSet(array: ReadonlyArray): Map;
- export function arrayToSet(array: ReadonlyArray, makeKey: (value: T) => string): Map;
- export function arrayToSet(array: ReadonlyArray, makeKey?: (value: any) => string): Map {
+ export function arrayToSet(array: ReadonlyArray, makeKey: (value: T) => string | undefined): Map;
+ export function arrayToSet(array: ReadonlyArray, makeKey: (value: T) => __String | undefined): UnderscoreEscapedMap;
+ export function arrayToSet(array: ReadonlyArray, makeKey?: (value: any) => string | __String | undefined): Map | UnderscoreEscapedMap {
return arrayToMap(array, makeKey || (s => s), () => true);
}
@@ -1606,7 +1602,7 @@ namespace ts {
messageText: text,
category: message.category,
code: message.code,
- reportsUnnecessary: message.unused,
+ reportsUnnecessary: message.reportsUnnecessary,
};
}
@@ -1637,7 +1633,7 @@ namespace ts {
messageText: text,
category: message.category,
code: message.code,
- reportsUnnecessary: message.unused,
+ reportsUnnecessary: message.reportsUnnecessary,
};
}
@@ -1727,6 +1723,10 @@ namespace ts {
return compareComparableValues(a, b);
}
+ export function min(a: T, b: T, compare: Comparer): T {
+ return compare(a, b) === Comparison.LessThan ? a : b;
+ }
+
/**
* Compare two strings using a case-insensitive ordinal comparison.
*
@@ -2246,6 +2246,8 @@ namespace ts {
* Adds a trailing directory separator to a path, if it does not already have one.
* @param path The path.
*/
+ export function ensureTrailingDirectorySeparator(path: Path): Path;
+ export function ensureTrailingDirectorySeparator(path: string): string;
export function ensureTrailingDirectorySeparator(path: string) {
if (path.charAt(path.length - 1) !== directorySeparator) {
return path + directorySeparator;
@@ -3124,8 +3126,8 @@ namespace ts {
return (arg: T) => f(arg) && g(arg);
}
- export function or(f: (arg: T) => boolean, g: (arg: T) => boolean) {
- return (arg: T) => f(arg) || g(arg);
+ export function or(f: (arg: T) => boolean, g: (arg: T) => boolean): (arg: T) => boolean {
+ return arg => f(arg) || g(arg);
}
export function assertTypeIsNever(_: never): void { } // tslint:disable-line no-empty
diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json
index 2637d57b140..034da2d078d 100644
--- a/src/compiler/diagnosticMessages.json
+++ b/src/compiler/diagnosticMessages.json
@@ -2012,7 +2012,10 @@
"category": "Error",
"code": 2569
},
-
+ "Property '{0}' does not exist on type '{1}'. Did you forget to use 'await'?": {
+ "category": "Error",
+ "code": 2570
+ },
"JSX element attributes type '{0}' may not be a union type.": {
"category": "Error",
"code": 2600
@@ -3287,7 +3290,7 @@
"'{0}' is declared but its value is never read.": {
"category": "Error",
"code": 6133,
- "unused": true
+ "reportsUnnecessary": true
},
"Report errors on unused locals.": {
"category": "Message",
@@ -3308,7 +3311,7 @@
"Property '{0}' is declared but its value is never read.": {
"category": "Error",
"code": 6138,
- "unused": true
+ "reportsUnnecessary": true
},
"Import emit helpers from 'tslib'.": {
"category": "Message",
@@ -3521,7 +3524,7 @@
"All imports in import declaration are unused.": {
"category": "Error",
"code": 6192,
- "unused": true
+ "reportsUnnecessary": true
},
"Found 1 error.": {
"category": "Message",
@@ -3615,7 +3618,7 @@
"Unused label.": {
"category": "Error",
"code": 7028,
- "unused": true
+ "reportsUnnecessary": true
},
"Fallthrough case in switch.": {
"category": "Error",
@@ -4167,5 +4170,9 @@
"Convert all constructor functions to classes": {
"category": "Message",
"code": 95045
+ },
+ "Generate 'get' and 'set' accessors": {
+ "category": "Message",
+ "code": 95046
}
}
diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts
index 7db8abb1920..0dbda93b362 100644
--- a/src/compiler/emitter.ts
+++ b/src/compiler/emitter.ts
@@ -1,8 +1,3 @@
-///
-///
-///
-///
-
namespace ts {
const brackets = createBracketsMap();
diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts
index df40db444aa..d6ab7d4e89c 100644
--- a/src/compiler/factory.ts
+++ b/src/compiler/factory.ts
@@ -1,6 +1,3 @@
-///
-///
-
namespace ts {
function createSynthesizedNode(kind: SyntaxKind): Node {
const node = createNode(kind, -1, -1);
diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts
index 454c51853e0..5ea149b93f6 100644
--- a/src/compiler/moduleNameResolver.ts
+++ b/src/compiler/moduleNameResolver.ts
@@ -1,6 +1,3 @@
-///
-///
-
namespace ts {
/* @internal */
export function trace(host: ModuleResolutionHost, message: DiagnosticMessage, ...args: any[]): void;
@@ -118,7 +115,8 @@ namespace ts {
}
}
- function readJson(path: string, host: ModuleResolutionHost): PackageJson {
+ /* @internal */
+ export function readJson(path: string, host: { readFile(fileName: string): string | undefined }): object {
try {
const jsonText = host.readFile(path);
return jsonText ? JSON.parse(jsonText) : {};
@@ -301,7 +299,7 @@ namespace ts {
// `types-publisher` sometimes creates packages with `"typings": null` for packages that don't provide their own types.
// See `createNotNeededPackageJSON` in the types-publisher` repo.
// tslint:disable-next-line:no-null-keyword
- const isNotNeededPackage = host.fileExists(packageJsonPath) && readJson(packageJsonPath, host).typings === null;
+ const isNotNeededPackage = host.fileExists(packageJsonPath) && (readJson(packageJsonPath, host) as PackageJson).typings === null;
if (!isNotNeededPackage) {
// Return just the type directive names
result.push(getBaseFileName(normalized));
@@ -995,7 +993,7 @@ namespace ts {
const directoryExists = !onlyRecordFailures && directoryProbablyExists(nodeModuleDirectory, host);
const packageJsonPath = pathToPackageJson(nodeModuleDirectory);
if (directoryExists && host.fileExists(packageJsonPath)) {
- const packageJsonContent = readJson(packageJsonPath, host);
+ const packageJsonContent = readJson(packageJsonPath, host) as PackageJson;
if (subModuleName === "") { // looking up the root - need to handle types/typings/main redirects for subModuleName
const path = tryReadPackageJsonFields(/*readTypes*/ true, packageJsonContent, nodeModuleDirectory, state);
if (typeof path === "string") {
@@ -1046,7 +1044,7 @@ namespace ts {
const onlyRecordFailures = !directoryProbablyExists(getDirectoryPath(file), state.host);
const fromFile = tryFile(file, failedLookupLocations, onlyRecordFailures, state);
if (fromFile) {
- const resolved = fromFile && resolvedIfExtensionMatches(extensions, fromFile);
+ const resolved = resolvedIfExtensionMatches(extensions, fromFile);
if (resolved) {
return resolved;
}
diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts
index 406d8dfa680..252ae045da3 100644
--- a/src/compiler/parser.ts
+++ b/src/compiler/parser.ts
@@ -1,6 +1,3 @@
-///
-///
-
namespace ts {
const enum SignatureFlags {
None = 0,
@@ -6402,8 +6399,8 @@ namespace ts {
case "arg":
case "argument":
case "param":
- tag = parseParameterOrPropertyTag(atToken, tagName, PropertyLikeParse.Parameter);
- break;
+ addTag(parseParameterOrPropertyTag(atToken, tagName, PropertyLikeParse.Parameter, indent));
+ return;
case "return":
case "returns":
tag = parseReturnTag(atToken, tagName);
@@ -6552,7 +6549,7 @@ namespace ts {
}
}
- function parseParameterOrPropertyTag(atToken: AtToken, tagName: Identifier, target: PropertyLikeParse): JSDocParameterTag | JSDocPropertyTag {
+ function parseParameterOrPropertyTag(atToken: AtToken, tagName: Identifier, target: PropertyLikeParse, indent: number | undefined): JSDocParameterTag | JSDocPropertyTag {
let typeExpression = tryParseTypeExpression();
let isNameFirst = !typeExpression;
skipWhitespace();
@@ -6567,6 +6564,8 @@ namespace ts {
const result = target === PropertyLikeParse.Parameter ?
createNode(SyntaxKind.JSDocParameterTag, atToken.pos) :
createNode(SyntaxKind.JSDocPropertyTag, atToken.pos);
+ let comment: string | undefined;
+ if (indent !== undefined) comment = parseTagComments(indent + scanner.getStartPos() - atToken.pos);
const nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name, target);
if (nestedTypeLiteral) {
typeExpression = nestedTypeLiteral;
@@ -6578,6 +6577,7 @@ namespace ts {
result.name = name;
result.isNameFirst = isNameFirst;
result.isBracketed = isBracketed;
+ result.comment = comment;
return finishNode(result);
}
@@ -6824,7 +6824,7 @@ namespace ts {
if (target !== t) {
return false;
}
- const tag = parseParameterOrPropertyTag(atToken, tagName, target);
+ const tag = parseParameterOrPropertyTag(atToken, tagName, target, /*indent*/ undefined);
tag.comment = parseTagComments(tag.end - tag.pos);
return tag;
}
@@ -7641,7 +7641,7 @@ namespace ts {
const tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/im;
const singleLinePragmaRegEx = /^\/\/\/?\s*@(\S+)\s*(.*)\s*$/im;
function extractPragmas(pragmas: PragmaPsuedoMapEntry[], range: CommentRange, text: string) {
- const tripleSlash = tripleSlashXMLCommentStartRegEx.exec(text);
+ const tripleSlash = range.kind === SyntaxKind.SingleLineCommentTrivia && tripleSlashXMLCommentStartRegEx.exec(text);
if (tripleSlash) {
const name = tripleSlash[1].toLowerCase() as keyof PragmaPsuedoMap; // Technically unsafe cast, but we do it so the below check to make it safe typechecks
const pragma = commentPragmas[name] as PragmaDefinition;
@@ -7678,15 +7678,17 @@ namespace ts {
return;
}
- const singleLine = singleLinePragmaRegEx.exec(text);
+ const singleLine = range.kind === SyntaxKind.SingleLineCommentTrivia && singleLinePragmaRegEx.exec(text);
if (singleLine) {
return addPragmaForMatch(pragmas, range, PragmaKindFlags.SingleLine, singleLine);
}
- const multiLinePragmaRegEx = /\s*@(\S+)\s*(.*)\s*$/gim; // Defined inline since it uses the "g" flag, which keeps a persistent index (for iterating)
- let multiLineMatch: RegExpExecArray;
- while (multiLineMatch = multiLinePragmaRegEx.exec(text)) {
- addPragmaForMatch(pragmas, range, PragmaKindFlags.MultiLine, multiLineMatch);
+ if (range.kind === SyntaxKind.MultiLineCommentTrivia) {
+ const multiLinePragmaRegEx = /\s*@(\S+)\s*(.*)\s*$/gim; // Defined inline since it uses the "g" flag, which keeps a persistent index (for iterating)
+ let multiLineMatch: RegExpExecArray;
+ while (multiLineMatch = multiLinePragmaRegEx.exec(text)) {
+ addPragmaForMatch(pragmas, range, PragmaKindFlags.MultiLine, multiLineMatch);
+ }
}
}
diff --git a/src/compiler/program.ts b/src/compiler/program.ts
index 1294faab912..acb888d09cf 100644
--- a/src/compiler/program.ts
+++ b/src/compiler/program.ts
@@ -1,7 +1,3 @@
-///
-///
-///
-
namespace ts {
const ignoreDiagnosticCommentRegEx = /(^\s*$)|(^\s*\/\/\/?\s*(@ts-ignore)?)/;
@@ -577,7 +573,6 @@ namespace ts {
const packageIdToSourceFile = createMap();
// Maps from a SourceFile's `.path` to the name of the package it was imported with.
let sourceFileToPackageName = createMap();
- // See `sourceFileIsRedirectedTo`.
let redirectTargetsSet = createMap();
const filesByName = createMap();
diff --git a/src/compiler/resolutionCache.ts b/src/compiler/resolutionCache.ts
index 0946948f43d..c2b96649cf2 100644
--- a/src/compiler/resolutionCache.ts
+++ b/src/compiler/resolutionCache.ts
@@ -1,7 +1,3 @@
-///
-///
-///
-
/*@internal*/
namespace ts {
/** This is the cache of module/typedirectives resolution that can be retained across program */
diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts
index 43320b453c4..f2a01d22c24 100644
--- a/src/compiler/scanner.ts
+++ b/src/compiler/scanner.ts
@@ -1,6 +1,3 @@
-///
-///
-
namespace ts {
export type ErrorCallback = (message: DiagnosticMessage, length: number) => void;
diff --git a/src/compiler/sourcemap.ts b/src/compiler/sourcemap.ts
index 2e81da35cfd..6251f1963fa 100644
--- a/src/compiler/sourcemap.ts
+++ b/src/compiler/sourcemap.ts
@@ -1,5 +1,3 @@
-///
-
/* @internal */
namespace ts {
export interface SourceMapWriter {
diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts
index 8c2612155e4..c37315a2e56 100644
--- a/src/compiler/sys.ts
+++ b/src/compiler/sys.ts
@@ -1,5 +1,3 @@
-///
-
declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any;
declare function clearTimeout(handle: any): void;
diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts
index c187176d069..8cadba453d8 100644
--- a/src/compiler/transformer.ts
+++ b/src/compiler/transformer.ts
@@ -1,18 +1,3 @@
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-
/* @internal */
namespace ts {
function getModuleTransformer(moduleKind: ModuleKind): TransformerFactory {
diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts
index 4021a05cd20..67e4fa31cb2 100644
--- a/src/compiler/transformers/declarations.ts
+++ b/src/compiler/transformers/declarations.ts
@@ -1,7 +1,3 @@
-///
-///
-///
-
/*@internal*/
namespace ts {
export function getDeclarationDiagnostics(host: EmitHost, resolver: EmitResolver, file: SourceFile | undefined): Diagnostic[] {
@@ -27,10 +23,12 @@ namespace ts {
let needsDeclare = true;
let isBundledEmit = false;
let resultHasExternalModuleIndicator = false;
+ let needsScopeFixMarker = false;
+ let resultHasScopeMarker = false;
let enclosingDeclaration: Node;
let necessaryTypeRefernces: Map;
- let possibleImports: AnyImportSyntax[];
- let importDeclarationMap: Map;
+ let lateMarkedStatements: LateVisibilityPaintedStatement[];
+ let lateStatementReplacementMap: Map;
let suppressNewDiagnosticContexts: boolean;
const symbolTracker: SymbolTracker = {
@@ -63,12 +61,12 @@ namespace ts {
if (symbolAccessibilityResult.accessibility === SymbolAccessibility.Accessible) {
// Add aliases back onto the possible imports list if they're not there so we can try them again with updated visibility info
if (symbolAccessibilityResult && symbolAccessibilityResult.aliasesToMakeVisible) {
- if (!possibleImports) {
- possibleImports = symbolAccessibilityResult.aliasesToMakeVisible;
+ if (!lateMarkedStatements) {
+ lateMarkedStatements = symbolAccessibilityResult.aliasesToMakeVisible;
}
else {
for (const ref of symbolAccessibilityResult.aliasesToMakeVisible) {
- pushIfUnique(possibleImports, ref);
+ pushIfUnique(lateMarkedStatements, ref);
}
}
}
@@ -142,10 +140,12 @@ namespace ts {
hasNoDefaultLib = hasNoDefaultLib || sourceFile.hasNoDefaultLib;
currentSourceFile = sourceFile;
enclosingDeclaration = sourceFile;
- possibleImports = undefined;
+ lateMarkedStatements = undefined;
suppressNewDiagnosticContexts = false;
- importDeclarationMap = createMap();
+ lateStatementReplacementMap = createMap();
getSymbolAccessibilityDiagnostic = throwDiagnostic;
+ needsScopeFixMarker = false;
+ resultHasScopeMarker = false;
collectReferences(sourceFile, refs);
if (isExternalModule(sourceFile)) {
resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules)
@@ -161,7 +161,7 @@ namespace ts {
}
needsDeclare = true;
const updated = visitNodes(sourceFile.statements, visitDeclarationStatements);
- return updateSourceFileNode(sourceFile, updated, /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false);
+ return updateSourceFileNode(sourceFile, filterCandidateImports(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false);
}
));
bundle.syntheticFileReferences = [];
@@ -175,14 +175,16 @@ namespace ts {
// Single source file
needsDeclare = true;
+ needsScopeFixMarker = false;
+ resultHasScopeMarker = false;
enclosingDeclaration = node;
currentSourceFile = node;
getSymbolAccessibilityDiagnostic = throwDiagnostic;
isBundledEmit = false;
resultHasExternalModuleIndicator = false;
suppressNewDiagnosticContexts = false;
- possibleImports = undefined;
- importDeclarationMap = createMap();
+ lateMarkedStatements = undefined;
+ lateStatementReplacementMap = createMap();
necessaryTypeRefernces = undefined;
const refs = collectReferences(currentSourceFile, createMap());
const references: FileReference[] = [];
@@ -192,7 +194,7 @@ namespace ts {
const statements = visitNodes(node.statements, visitDeclarationStatements);
let combinedStatements = setTextRange(createNodeArray(filterCandidateImports(statements)), node.statements);
const emittedImports = filter(combinedStatements, isAnyImportSyntax);
- if (isExternalModule(node) && !resultHasExternalModuleIndicator) {
+ if (isExternalModule(node) && (!resultHasExternalModuleIndicator || (needsScopeFixMarker && !resultHasScopeMarker))) {
combinedStatements = setTextRange(createNodeArray([...combinedStatements, createExportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, createNamedExports([]), /*moduleSpecifier*/ undefined)]), combinedStatements);
}
const updated = updateSourceFileNode(node, combinedStatements, /*isDeclarationFile*/ true, references, getFileReferencesForUsedTypeReferences(), node.hasNoDefaultLib);
@@ -532,7 +534,7 @@ namespace ts {
// Nothing visible
}
- function filterCandidateImports(statements: ReadonlyArray): ReadonlyArray {
+ function filterCandidateImports(statements: NodeArray): NodeArray {
// This is a `while` loop because `handleSymbolAccessibilityError` can see additional import aliases marked as visible during
// error handling which must now be included in the output and themselves checked for errors.
// For example:
@@ -547,45 +549,63 @@ namespace ts {
// In such a scenario, only Q and D are initially visible, but we don't consider imports as private names - instead we say they if they are referenced they must
// be recorded. So while checking D's visibility we mark C as visible, then we must check C which in turn marks B, completing the chain of
// dependent imports and allowing a valid declaration file output. Today, this dependent alias marking only happens for internal import aliases.
- const unconsideredImports: AnyImportSyntax[] = [];
- while (length(possibleImports)) {
- const i = possibleImports.shift();
+ const unconsideredStatements: LateVisibilityPaintedStatement[] = [];
+ while (length(lateMarkedStatements)) {
+ const i = lateMarkedStatements.shift();
if ((isSourceFile(i.parent) ? i.parent : i.parent.parent) !== enclosingDeclaration) { // Filter to only declarations in the current scope
- unconsideredImports.push(i);
+ unconsideredStatements.push(i);
continue;
}
- // Eagerly transform import equals - if they're not visible, we'll get nothing, if they are, we'll immediately add them since it's complete
- if (i.kind === SyntaxKind.ImportEqualsDeclaration) {
- const result = transformImportEqualsDeclaration(i);
- importDeclarationMap.set("" + getNodeId(i), result);
- continue;
+ if (!isLateVisibilityPaintedStatement(i)) {
+ return Debug.fail(`Late replaced statement was foudn which is not handled by the declaration transformer!: ${(ts as any).SyntaxKind ? (ts as any).SyntaxKind[(i as any).kind] : (i as any).kind}`);
+ }
+ switch (i.kind) {
+ case SyntaxKind.ImportEqualsDeclaration: {
+ const result = transformImportEqualsDeclaration(i);
+ lateStatementReplacementMap.set("" + getNodeId(i), result);
+ break;
+ }
+ case SyntaxKind.ImportDeclaration: {
+ const result = transformImportDeclaration(i);
+ lateStatementReplacementMap.set("" + getNodeId(i), result);
+ break;
+ }
+ case SyntaxKind.VariableStatement: {
+ const result = transformVariableStatement(i, /*privateDeclaration*/ true); // Transform the statement (potentially again, possibly revealing more sub-nodes)
+ lateStatementReplacementMap.set("" + getNodeId(i), result);
+ break;
+ }
+ default: Debug.assertNever(i, "Unhandled late painted statement!");
}
- // Import declarations, on the other hand, can be partially painted by multiple aliases; so we can see many indeterminate states
- // until we've marked all possible visibility
- const result = transformImportDeclaration(i);
- importDeclarationMap.set("" + getNodeId(i), result);
}
// Filtering available imports is the last thing done within a scope, so the possible set becomes those which could not
// be considered in the child scope
- possibleImports = unconsideredImports;
+ lateMarkedStatements = unconsideredStatements;
+
// And lastly, we need to get the final form of all those indetermine import declarations from before and add them to the output list
// (and remove them from the set to examine for outter declarations)
- return mapDefined(statements, statement => {
- if (isImportDeclaration(statement) || isImportEqualsDeclaration(statement)) {
- const key = "" + getNodeId(statement);
- if (importDeclarationMap.has(key)) {
- const result = importDeclarationMap.get(key);
- importDeclarationMap.delete(key);
- return result;
- }
- else {
- return undefined;
+ return visitNodes(statements, visitLateVisibilityMarkedStatements);
+ }
+
+ function visitLateVisibilityMarkedStatements(statement: Statement) {
+ if (isLateVisibilityPaintedStatement(statement)) {
+ const key = "" + getNodeId(statement);
+ if (lateStatementReplacementMap.has(key)) {
+ const result = lateStatementReplacementMap.get(key);
+ lateStatementReplacementMap.delete(key);
+ if (result && isSourceFile(statement.parent) && !isAnyImportOrReExport(result) && !isExportAssignment(result) && !hasModifier(result, ModifierFlags.Export)) {
+ // Top-level declarations in .d.ts files are always considered exported even without a modifier unless there's an export assignment or specifier
+ needsScopeFixMarker = true;
}
+ return result;
}
else {
- return statement;
+ return getParseTreeNode(statement) ? undefined : statement;
}
- });
+ }
+ else {
+ return statement;
+ }
}
function visitDeclarationSubtree(input: Node): VisitResult {
@@ -816,6 +836,7 @@ namespace ts {
case SyntaxKind.ExportDeclaration: {
if (isSourceFile(input.parent)) {
resultHasExternalModuleIndicator = true;
+ resultHasScopeMarker = true;
}
// Always visible if the parent node isn't dropped for being not visible
// Rewrite external module names if necessary
@@ -825,6 +846,7 @@ namespace ts {
// Always visible if the parent node isn't dropped for being not visible
if (isSourceFile(input.parent)) {
resultHasExternalModuleIndicator = true;
+ resultHasScopeMarker = true;
}
if (input.expression.kind === SyntaxKind.Identifier) {
return input;
@@ -844,8 +866,8 @@ namespace ts {
case SyntaxKind.ImportDeclaration: {
// Different parts of the import may be marked visible at different times (via visibility checking), so we defer our first look until later
// to reduce the likelihood we need to rewrite it
- possibleImports = possibleImports || [];
- pushIfUnique(possibleImports, input);
+ lateMarkedStatements = lateMarkedStatements || [];
+ pushIfUnique(lateMarkedStatements, input);
return input;
}
}
@@ -866,7 +888,7 @@ namespace ts {
if (canProdiceDiagnostic) {
getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(input as DeclarationDiagnosticProducing);
}
- let oldPossibleImports: typeof possibleImports;
+ let oldPossibleImports: typeof lateMarkedStatements;
switch (input.kind) {
case SyntaxKind.TypeAliasDeclaration: // Type aliases get `declare`d if need be (for legacy support), but that's all
@@ -906,8 +928,8 @@ namespace ts {
case SyntaxKind.ModuleDeclaration: {
previousNeedsDeclare = needsDeclare;
needsDeclare = false;
- oldPossibleImports = possibleImports;
- possibleImports = undefined;
+ oldPossibleImports = lateMarkedStatements;
+ lateMarkedStatements = undefined;
const inner = input.body;
if (inner && inner.kind === SyntaxKind.ModuleBlock) {
const statements = visitNodes(inner.statements, visitDeclarationStatements);
@@ -1029,10 +1051,9 @@ namespace ts {
}
}
case SyntaxKind.VariableStatement: {
- if (!forEach(input.declarationList.declarations, getBindingNameVisible)) return;
- const nodes = visitNodes(input.declarationList.declarations, visitDeclarationSubtree);
- if (!length(nodes)) return;
- return cleanup(updateVariableStatement(input, createNodeArray(ensureModifiers(input)), updateVariableDeclarationList(input.declarationList, nodes)));
+ const result = transformVariableStatement(input);
+ lateStatementReplacementMap.set("" + getNodeId(input), result); // Don't actually elide yet; just leave as original node - will be elided/swapped by late pass
+ return cleanup(input);
}
case SyntaxKind.EnumDeclaration: {
return cleanup(updateEnumDeclaration(input, /*decorators*/ undefined, createNodeArray(ensureModifiers(input)), input.name, createNodeArray(mapDefined(input.members, m => {
@@ -1053,12 +1074,12 @@ namespace ts {
}
if (input.kind === SyntaxKind.ModuleDeclaration) {
needsDeclare = previousNeedsDeclare;
- possibleImports = concatenate(oldPossibleImports, possibleImports);
+ lateMarkedStatements = concatenate(oldPossibleImports, lateMarkedStatements);
}
if (canProdiceDiagnostic) {
getSymbolAccessibilityDiagnostic = oldDiag;
}
- if (returnValue) {
+ if (returnValue && (!isLateVisibilityPaintedStatement(input) || lateStatementReplacementMap.get("" + getNodeId(input)))) {
if (!resultHasExternalModuleIndicator && hasModifier(input, ModifierFlags.Export) && isSourceFile(input.parent)) {
// Exported top-level member indicates moduleness
resultHasExternalModuleIndicator = true;
@@ -1071,6 +1092,13 @@ namespace ts {
}
}
+ function transformVariableStatement(input: VariableStatement, privateDeclaration?: boolean) {
+ if (!forEach(input.declarationList.declarations, getBindingNameVisible)) return;
+ const nodes = visitNodes(input.declarationList.declarations, visitDeclarationSubtree);
+ if (!length(nodes)) return;
+ return updateVariableStatement(input, createNodeArray(ensureModifiers(input, privateDeclaration)), updateVariableDeclarationList(input.declarationList, nodes));
+ }
+
function recreateBindingPattern(d: BindingPattern): VariableDeclaration[] {
return flatten(mapDefined(d.elements, e => recreateBindingElement(e)));
}
@@ -1122,21 +1150,21 @@ namespace ts {
return false;
}
- function ensureModifiers(node: Node): ReadonlyArray {
+ function ensureModifiers(node: Node, privateDeclaration?: boolean): ReadonlyArray {
const currentFlags = getModifierFlags(node);
- const newFlags = ensureModifierFlags(node);
+ const newFlags = ensureModifierFlags(node, privateDeclaration);
if (currentFlags === newFlags) {
return node.modifiers;
}
return createModifiersFromModifierFlags(newFlags);
}
- function ensureModifierFlags(node: Node): ModifierFlags {
+ function ensureModifierFlags(node: Node, privateDeclaration?: boolean): ModifierFlags {
let mask = ModifierFlags.All ^ (ModifierFlags.Public | ModifierFlags.Async); // No async modifiers in declaration files
let additions = (needsDeclare && !isAlwaysType(node)) ? ModifierFlags.Ambient : ModifierFlags.None;
const parentIsFile = node.parent.kind === SyntaxKind.SourceFile;
if (!parentIsFile || (isBundledEmit && parentIsFile && isExternalModule(node.parent as SourceFile))) {
- mask ^= ((isBundledEmit && parentIsFile ? 0 : ModifierFlags.Export) | ModifierFlags.Default | ModifierFlags.Ambient);
+ mask ^= ((privateDeclaration || (isBundledEmit && parentIsFile) ? 0 : ModifierFlags.Export) | ModifierFlags.Default | ModifierFlags.Ambient);
additions = ModifierFlags.None;
}
return maskModifierFlags(node, mask, additions);
diff --git a/src/compiler/transformers/destructuring.ts b/src/compiler/transformers/destructuring.ts
index bafe43b0b15..35101d3be7f 100644
--- a/src/compiler/transformers/destructuring.ts
+++ b/src/compiler/transformers/destructuring.ts
@@ -1,6 +1,3 @@
-///
-///
-
/*@internal*/
namespace ts {
interface FlattenContext {
diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts
index 72068688f9d..0a607494bb5 100644
--- a/src/compiler/transformers/es2015.ts
+++ b/src/compiler/transformers/es2015.ts
@@ -1,7 +1,3 @@
-///
-///
-///
-
/*@internal*/
namespace ts {
const enum ES2015SubstitutionFlags {
diff --git a/src/compiler/transformers/es2016.ts b/src/compiler/transformers/es2016.ts
index a9468991776..22b2f11b612 100644
--- a/src/compiler/transformers/es2016.ts
+++ b/src/compiler/transformers/es2016.ts
@@ -1,6 +1,3 @@
-///
-///
-
/*@internal*/
namespace ts {
export function transformES2016(context: TransformationContext) {
diff --git a/src/compiler/transformers/es2017.ts b/src/compiler/transformers/es2017.ts
index f2a5aeb35d2..6689f83ed5b 100644
--- a/src/compiler/transformers/es2017.ts
+++ b/src/compiler/transformers/es2017.ts
@@ -1,6 +1,3 @@
-///
-///
-
/*@internal*/
namespace ts {
type SuperContainer = ClassDeclaration | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | ConstructorDeclaration;
diff --git a/src/compiler/transformers/es5.ts b/src/compiler/transformers/es5.ts
index bc6ee13520f..92ecce6a15c 100644
--- a/src/compiler/transformers/es5.ts
+++ b/src/compiler/transformers/es5.ts
@@ -1,6 +1,3 @@
-///
-///
-
/*@internal*/
namespace ts {
/**
diff --git a/src/compiler/transformers/esnext.ts b/src/compiler/transformers/esnext.ts
index 97fe93e508b..68861a5bb43 100644
--- a/src/compiler/transformers/esnext.ts
+++ b/src/compiler/transformers/esnext.ts
@@ -1,7 +1,3 @@
-///
-///
-///
-
/*@internal*/
namespace ts {
const enum ESNextSubstitutionFlags {
diff --git a/src/compiler/transformers/generators.ts b/src/compiler/transformers/generators.ts
index 82d8bc513f0..15f0d2d0f81 100644
--- a/src/compiler/transformers/generators.ts
+++ b/src/compiler/transformers/generators.ts
@@ -1,6 +1,3 @@
-///
-///
-
// Transforms generator functions into a compatible ES5 representation with similar runtime
// semantics. This is accomplished by first transforming the body of each generator
// function into an intermediate representation that is the compiled into a JavaScript
diff --git a/src/compiler/transformers/jsx.ts b/src/compiler/transformers/jsx.ts
index 07dc8f74db4..4acdf63b275 100644
--- a/src/compiler/transformers/jsx.ts
+++ b/src/compiler/transformers/jsx.ts
@@ -1,7 +1,3 @@
-///
-///
-///
-
/*@internal*/
namespace ts {
export function transformJsx(context: TransformationContext) {
diff --git a/src/compiler/transformers/module/es2015.ts b/src/compiler/transformers/module/es2015.ts
index 4f218e4fdcf..a3315852632 100644
--- a/src/compiler/transformers/module/es2015.ts
+++ b/src/compiler/transformers/module/es2015.ts
@@ -1,6 +1,3 @@
-///
-///
-
/*@internal*/
namespace ts {
export function transformES2015Module(context: TransformationContext) {
diff --git a/src/compiler/transformers/module/module.ts b/src/compiler/transformers/module/module.ts
index 45d13357123..f9fb47f6a27 100644
--- a/src/compiler/transformers/module/module.ts
+++ b/src/compiler/transformers/module/module.ts
@@ -1,7 +1,3 @@
-///
-///
-///
-
/*@internal*/
namespace ts {
export function transformModule(context: TransformationContext) {
diff --git a/src/compiler/transformers/module/system.ts b/src/compiler/transformers/module/system.ts
index ca55cb3a9d1..5cde69e2ef6 100644
--- a/src/compiler/transformers/module/system.ts
+++ b/src/compiler/transformers/module/system.ts
@@ -1,7 +1,3 @@
-///
-///
-///
-
/*@internal*/
namespace ts {
export function transformSystemModule(context: TransformationContext) {
diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts
index f22d8f02870..6cb4be16c74 100644
--- a/src/compiler/transformers/ts.ts
+++ b/src/compiler/transformers/ts.ts
@@ -1,7 +1,3 @@
-///
-///
-///
-
/*@internal*/
namespace ts {
/**
diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts
index 09b64701988..f16ca98c93d 100644
--- a/src/compiler/tsc.ts
+++ b/src/compiler/tsc.ts
@@ -1,7 +1,3 @@
-///
-///
-///
-
namespace ts {
interface Statistic {
name: string;
@@ -22,7 +18,7 @@ namespace ts {
}
let reportDiagnostic = createDiagnosticReporter(sys);
- function udpateReportDiagnostic(options: CompilerOptions) {
+ function updateReportDiagnostic(options: CompilerOptions) {
if (options.pretty) {
reportDiagnostic = createDiagnosticReporter(sys, /*pretty*/ true);
}
@@ -111,7 +107,7 @@ namespace ts {
const commandLineOptions = commandLine.options;
if (configFileName) {
const configParseResult = parseConfigFileWithSystem(configFileName, commandLineOptions, sys, reportDiagnostic);
- udpateReportDiagnostic(configParseResult.options);
+ updateReportDiagnostic(configParseResult.options);
if (isWatchSet(configParseResult.options)) {
reportWatchModeWithoutSysSupport();
createWatchOfConfigFile(configParseResult, commandLineOptions);
@@ -121,7 +117,7 @@ namespace ts {
}
}
else {
- udpateReportDiagnostic(commandLineOptions);
+ updateReportDiagnostic(commandLineOptions);
if (isWatchSet(commandLineOptions)) {
reportWatchModeWithoutSysSupport();
createWatchOfFilesAndCompilerOptions(commandLine.fileNames, commandLineOptions);
diff --git a/src/compiler/tsconfig.json b/src/compiler/tsconfig.json
index 58626f2cdc1..46e5384434a 100644
--- a/src/compiler/tsconfig.json
+++ b/src/compiler/tsconfig.json
@@ -6,36 +6,38 @@
"declaration": true
},
"files": [
- "core.ts",
- "performance.ts",
- "sys.ts",
"types.ts",
+ "performance.ts",
+ "core.ts",
+ "sys.ts",
+ "diagnosticInformationMap.generated.ts",
"scanner.ts",
- "parser.ts",
"utilities.ts",
+ "parser.ts",
"binder.ts",
"symbolWalker.ts",
+ "moduleNameResolver.ts",
"checker.ts",
"factory.ts",
"visitor.ts",
"transformers/utilities.ts",
+ "transformers/destructuring.ts",
"transformers/ts.ts",
- "transformers/jsx.ts",
- "transformers/esnext.ts",
"transformers/es2017.ts",
+ "transformers/esnext.ts",
+ "transformers/jsx.ts",
"transformers/es2016.ts",
"transformers/es2015.ts",
"transformers/es5.ts",
"transformers/generators.ts",
- "transformers/destructuring.ts",
"transformers/module/module.ts",
"transformers/module/system.ts",
"transformers/module/es2015.ts",
"transformers/declarations/diagnostics.ts",
"transformers/declarations.ts",
"transformer.ts",
- "comments.ts",
"sourcemap.ts",
+ "comments.ts",
"emitter.ts",
"watchUtilities.ts",
"program.ts",
@@ -44,7 +46,6 @@
"resolutionCache.ts",
"watch.ts",
"commandLineParser.ts",
- "tsc.ts",
- "diagnosticInformationMap.generated.ts"
+ "tsc.ts"
]
}
diff --git a/src/compiler/types.ts b/src/compiler/types.ts
index e80e71451b7..269aa89e602 100644
--- a/src/compiler/types.ts
+++ b/src/compiler/types.ts
@@ -2528,7 +2528,7 @@ namespace ts {
/**
* If two source files are for the same version of the same package, one will redirect to the other.
* (See `createRedirectSourceFile` in program.ts.)
- * The redirect will have this set. The other will not have anything set, but see Program#sourceFileIsRedirectedTo.
+ * The redirect will have this set. The redirected-to source file will be in `redirectTargetsSet`.
*/
/* @internal */ redirectInfo?: RedirectInfo | undefined;
@@ -2853,6 +2853,10 @@ namespace ts {
getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
getSymbolAtLocation(node: Node): Symbol | undefined;
getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[];
+ /**
+ * The function returns the value (local variable) symbol of an identifier in the short-hand property assignment.
+ * This is necessary as an identifier in short-hand property assignment can contains two meaning: property name and property value.
+ */
getShorthandAssignmentValueSymbol(location: Node): Symbol | undefined;
getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol | undefined;
/**
@@ -3207,10 +3211,13 @@ namespace ts {
/* @internal */
export type RequireOrImportCall = CallExpression & { arguments: [StringLiteralLike] };
+ /* @internal */
+ export type LateVisibilityPaintedStatement = AnyImportSyntax | VariableStatement;
+
/* @internal */
export interface SymbolVisibilityResult {
accessibility: SymbolAccessibility;
- aliasesToMakeVisible?: AnyImportSyntax[]; // aliases that need to have this symbol visible
+ aliasesToMakeVisible?: LateVisibilityPaintedStatement[]; // aliases that need to have this symbol visible
errorSymbolName?: string; // Optional symbol name that results in error
errorNode?: Node; // optional node that results in error
}
@@ -3982,7 +3989,7 @@ namespace ts {
export interface IndexInfo {
type: Type;
isReadonly: boolean;
- declaration?: SignatureDeclaration;
+ declaration?: IndexSignatureDeclaration;
}
/* @internal */
@@ -4083,7 +4090,7 @@ namespace ts {
category: DiagnosticCategory;
code: number;
message: string;
- unused?: {};
+ reportsUnnecessary?: {};
}
/**
diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts
index e301bec6880..ccd0802601b 100644
--- a/src/compiler/utilities.ts
+++ b/src/compiler/utilities.ts
@@ -1,5 +1,3 @@
-///
-
/* @internal */
namespace ts {
export const resolvingEmptyArray: never[] = [] as never[];
@@ -546,6 +544,17 @@ namespace ts {
}
}
+ export function isLateVisibilityPaintedStatement(node: Node): node is LateVisibilityPaintedStatement {
+ switch (node.kind) {
+ case SyntaxKind.ImportDeclaration:
+ case SyntaxKind.ImportEqualsDeclaration:
+ case SyntaxKind.VariableStatement:
+ return true;
+ default:
+ return false;
+ }
+ }
+
export function isAnyImportOrReExport(node: Node): node is AnyImportOrReExport {
return isAnyImportSyntax(node) || isExportDeclaration(node);
}
@@ -4278,7 +4287,7 @@ namespace ts {
}
}
- export function isParameterPropertyDeclaration(node: Node): boolean {
+ export function isParameterPropertyDeclaration(node: Node): node is ParameterDeclaration {
return hasModifier(node, ModifierFlags.ParameterPropertyModifier) && node.parent.kind === SyntaxKind.Constructor && isClassLike(node.parent.parent);
}
@@ -4637,11 +4646,21 @@ namespace ts {
* parameters by name and binding patterns do not have a name.
*/
export function getJSDocParameterTags(param: ParameterDeclaration): ReadonlyArray {
- if (param.name && isIdentifier(param.name)) {
- const name = param.name.escapedText;
- return getJSDocTags(param.parent).filter((tag): tag is JSDocParameterTag => isJSDocParameterTag(tag) && isIdentifier(tag.name) && tag.name.escapedText === name);
+ if (param.name) {
+ if (isIdentifier(param.name)) {
+ const name = param.name.escapedText;
+ return getJSDocTags(param.parent).filter((tag): tag is JSDocParameterTag => isJSDocParameterTag(tag) && isIdentifier(tag.name) && tag.name.escapedText === name);
+ }
+ else {
+ const i = param.parent.parameters.indexOf(param);
+ Debug.assert(i > -1, "Parameters should always be in their parents' parameter list");
+ const paramTags = getJSDocTags(param.parent).filter(isJSDocParameterTag);
+ if (i < paramTags.length) {
+ return [paramTags[i]];
+ }
+ }
}
- // a binding pattern doesn't have a name, so it's not possible to match it a JSDoc parameter, which is identified by name
+ // return empty array for: out-of-order binding patterns and JSDoc function syntax, which has un-named parameters
return emptyArray;
}
@@ -5634,6 +5653,10 @@ namespace ts {
|| kind === SyntaxKind.MissingDeclaration;
}
+ export function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement {
+ return isTypeElement(node) || isClassElement(node);
+ }
+
export function isObjectLiteralElementLike(node: Node): node is ObjectLiteralElementLike {
const kind = node.kind;
return kind === SyntaxKind.PropertyAssignment
@@ -6316,4 +6339,9 @@ namespace ts {
export function isStringLiteralLike(node: Node): node is StringLiteralLike {
return node.kind === SyntaxKind.StringLiteral || node.kind === SyntaxKind.NoSubstitutionTemplateLiteral;
}
+
+ /** @internal */
+ export function isNamedImportsOrExports(node: Node): node is NamedImportsOrExports {
+ return node.kind === SyntaxKind.NamedImports || node.kind === SyntaxKind.NamedExports;
+ }
}
diff --git a/src/compiler/visitor.ts b/src/compiler/visitor.ts
index 8d8e47a8f4c..7a70eb02e8e 100644
--- a/src/compiler/visitor.ts
+++ b/src/compiler/visitor.ts
@@ -1,7 +1,3 @@
-///
-///
-///
-
namespace ts {
const isTypeNodeOrTypeParameterDeclaration = or(isTypeNode, isTypeParameterDeclaration);
diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts
index f53f01e3eb2..7f3d078b790 100644
--- a/src/compiler/watch.ts
+++ b/src/compiler/watch.ts
@@ -1,7 +1,3 @@
-///
-///
-///
-
/*@internal*/
namespace ts {
const sysFormatDiagnosticsHost: FormatDiagnosticsHost = sys ? {
diff --git a/src/compiler/watchUtilities.ts b/src/compiler/watchUtilities.ts
index 12ed9f855df..4fa9b28e162 100644
--- a/src/compiler/watchUtilities.ts
+++ b/src/compiler/watchUtilities.ts
@@ -1,5 +1,3 @@
-///
-
/* @internal */
namespace ts {
/**
diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts
index 8c71a385d58..b479b5596a8 100644
--- a/src/harness/fourslash.ts
+++ b/src/harness/fourslash.ts
@@ -1081,8 +1081,20 @@ namespace FourSlash {
}
}
+ private verifyDocumentHighlightsRespectFilesList(files: ReadonlyArray): void {
+ const startFile = this.activeFile.fileName;
+ for (const fileName of files) {
+ const searchFileNames = startFile === fileName ? [startFile] : [startFile, fileName];
+ const highlights = this.getDocumentHighlightsAtCurrentPosition(searchFileNames);
+ if (!highlights.every(dh => ts.contains(searchFileNames, dh.fileName))) {
+ this.raiseError(`When asking for document highlights only in files ${searchFileNames}, got document highlights in ${unique(highlights, dh => dh.fileName)}`);
+ }
+ }
+ }
+
public verifyReferencesOf(range: Range, references: Range[]) {
this.goToRangeStart(range);
+ this.verifyDocumentHighlightsRespectFilesList(unique(references, e => e.fileName));
this.verifyReferencesAre(references);
}
@@ -1094,7 +1106,7 @@ namespace FourSlash {
}
}
- public verifyReferenceGroups(starts: string | string[] | Range | Range[], parts: FourSlashInterface.ReferenceGroup[]): void {
+ public verifyReferenceGroups(starts: string | string[] | Range | Range[], parts: FourSlashInterface.ReferenceGroup[] | undefined): void {
interface ReferenceGroupJson {
definition: string | { text: string, range: ts.TextSpan };
references: ts.ReferenceEntry[];
@@ -1128,6 +1140,10 @@ namespace FourSlash {
};
});
this.assertObjectsEqual(fullActual, fullExpected);
+
+ if (parts) {
+ this.verifyDocumentHighlightsRespectFilesList(unique(ts.flatMap(parts, p => p.ranges), r => r.fileName));
+ }
}
}
diff --git a/src/harness/tsconfig.json b/src/harness/tsconfig.json
index fe4b066c5e7..0d56447b28a 100644
--- a/src/harness/tsconfig.json
+++ b/src/harness/tsconfig.json
@@ -13,132 +13,147 @@
]
},
"files": [
- "../compiler/core.ts",
- "../compiler/performance.ts",
- "../compiler/sys.ts",
"../compiler/types.ts",
+ "../compiler/performance.ts",
+ "../compiler/core.ts",
+ "../compiler/sys.ts",
+ "../compiler/diagnosticInformationMap.generated.ts",
"../compiler/scanner.ts",
- "../compiler/parser.ts",
"../compiler/utilities.ts",
+ "../compiler/parser.ts",
"../compiler/binder.ts",
"../compiler/symbolWalker.ts",
+ "../compiler/moduleNameResolver.ts",
"../compiler/checker.ts",
"../compiler/factory.ts",
"../compiler/visitor.ts",
"../compiler/transformers/utilities.ts",
+ "../compiler/transformers/destructuring.ts",
"../compiler/transformers/ts.ts",
- "../compiler/transformers/jsx.ts",
- "../compiler/transformers/esnext.ts",
"../compiler/transformers/es2017.ts",
+ "../compiler/transformers/esnext.ts",
+ "../compiler/transformers/jsx.ts",
"../compiler/transformers/es2016.ts",
"../compiler/transformers/es2015.ts",
"../compiler/transformers/es5.ts",
"../compiler/transformers/generators.ts",
- "../compiler/transformers/es5.ts",
- "../compiler/transformers/destructuring.ts",
"../compiler/transformers/module/module.ts",
"../compiler/transformers/module/system.ts",
"../compiler/transformers/module/es2015.ts",
"../compiler/transformers/declarations/diagnostics.ts",
"../compiler/transformers/declarations.ts",
"../compiler/transformer.ts",
- "../compiler/comments.ts",
"../compiler/sourcemap.ts",
+ "../compiler/comments.ts",
"../compiler/emitter.ts",
+ "../compiler/watchUtilities.ts",
"../compiler/program.ts",
+ "../compiler/builderState.ts",
"../compiler/builder.ts",
+ "../compiler/resolutionCache.ts",
+ "../compiler/watch.ts",
"../compiler/commandLineParser.ts",
- "../compiler/diagnosticInformationMap.generated.ts",
- "../services/breakpoints.ts",
- "../services/navigateTo.ts",
- "../services/navigationBar.ts",
- "../services/outliningElementsCollector.ts",
- "../services/patternMatcher.ts",
+
+ "../services/types.ts",
+ "../services/utilities.ts",
+ "../services/classifier.ts",
"../services/pathCompletions.ts",
"../services/completions.ts",
- "../services/services.ts",
- "../services/shims.ts",
- "../services/signatureHelp.ts",
- "../services/utilities.ts",
+ "../services/documentHighlights.ts",
+ "../services/documentRegistry.ts",
+ "../services/importTracker.ts",
+ "../services/findAllReferences.ts",
+ "../services/goToDefinition.ts",
+ "../services/jsDoc.ts",
+ "../services/semver.ts",
"../services/jsTyping.ts",
- "../services/formatting/formatting.ts",
+ "../services/navigateTo.ts",
+ "../services/navigationBar.ts",
+ "../services/organizeImports.ts",
+ "../services/outliningElementsCollector.ts",
+ "../services/patternMatcher.ts",
+ "../services/preProcess.ts",
+ "../services/rename.ts",
+ "../services/signatureHelp.ts",
+ "../services/suggestionDiagnostics.ts",
+ "../services/symbolDisplay.ts",
+ "../services/transpile.ts",
"../services/formatting/formattingContext.ts",
"../services/formatting/formattingScanner.ts",
"../services/formatting/rule.ts",
"../services/formatting/rules.ts",
"../services/formatting/rulesMap.ts",
+ "../services/formatting/formatting.ts",
"../services/formatting/smartIndenter.ts",
+ "../services/textChanges.ts",
"../services/codeFixProvider.ts",
- "../services/codefixes/fixes.ts",
- "../services/codefixes/helpers.ts",
+ "../services/refactorProvider.ts",
+ "../services/codefixes/addMissingInvocationForDecorator.ts",
+ "../services/codefixes/annotateWithTypeFromJSDoc.ts",
+ "../services/codefixes/convertFunctionToEs6Class.ts",
+ "../services/codefixes/convertToEs6Module.ts",
+ "../services/codefixes/correctQualifiedNameToIndexedAccessType.ts",
+ "../services/codefixes/fixClassIncorrectlyImplementsInterface.ts",
"../services/codefixes/importFixes.ts",
+ "../services/codefixes/fixSpelling.ts",
+ "../services/codefixes/fixAddMissingMember.ts",
+ "../services/codefixes/fixCannotFindModule.ts",
+ "../services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts",
+ "../services/codefixes/fixClassSuperMustPrecedeThisAccess.ts",
+ "../services/codefixes/fixConstructorForDerivedNeedSuperCall.ts",
+ "../services/codefixes/fixExtendsInterfaceBecomesImplements.ts",
+ "../services/codefixes/fixForgottenThisPropertyAccess.ts",
"../services/codefixes/fixUnusedIdentifier.ts",
+ "../services/codefixes/fixJSDocTypes.ts",
+ "../services/codefixes/fixAwaitInSyncFunction.ts",
"../services/codefixes/disableJsDiagnostics.ts",
+ "../services/codefixes/helpers.ts",
+ "../services/codefixes/inferFromUsage.ts",
+ "../services/codefixes/fixInvalidImportSyntax.ts",
+ "../services/codefixes/fixStrictClassInitialization.ts",
+ "../services/codefixes/useDefaultImport.ts",
+ "../services/codefixes/fixes.ts",
+ "../services/refactors/extractSymbol.ts",
+ "../services/refactors/generateGetAccessorAndSetAccessor.ts",
+ "../services/refactors/refactors.ts",
+ "../services/sourcemaps.ts",
+ "../services/services.ts",
+ "../services/breakpoints.ts",
+ "../services/transform.ts",
+ "../services/shims.ts",
+
+ "../server/typingsInstaller/typingsInstaller.ts",
+
+ "../server/types.ts",
+ "../server/shared.ts",
+ "../server/utilities.ts",
+ "../server/protocol.ts",
+ "../server/scriptInfo.ts",
+ "../server/typingsCache.ts",
+ "../server/project.ts",
+ "../server/editorServices.ts",
+ "../server/session.ts",
+ "../server/scriptVersionCache.ts",
- "harness.ts",
"sourceMapRecorder.ts",
- "harnessLanguageService.ts",
- "fourslash.ts",
"runnerbase.ts",
- "compilerRunner.ts",
- "typeWriter.ts",
+ "virtualFileSystem.ts",
+ "harness.ts",
+ "virtualFileSystemWithWatch.ts",
+ "harnessLanguageService.ts",
"fourslashRunner.ts",
+ "fourslash.ts",
+ "typeWriter.ts",
+ "compilerRunner.ts",
"projectsRunner.ts",
"loggedIO.ts",
"rwcRunner.ts",
"externalCompileRunner.ts",
"test262Runner.ts",
- "./parallel/shared.ts",
- "./parallel/host.ts",
- "./parallel/worker.ts",
- "runner.ts",
- "virtualFileSystemWithWatch.ts",
- "../server/protocol.ts",
- "../server/session.ts",
- "../server/client.ts",
- "../server/editorServices.ts",
- "./unittests/base64.ts",
- "./unittests/incrementalParser.ts",
- "./unittests/jsDocParsing.ts",
- "./unittests/services/colorization.ts",
- "./unittests/services/documentRegistry.ts",
- "./unittests/services/preProcessFile.ts",
- "./unittests/services/patternMatcher.ts",
- "./unittests/session.ts",
- "./unittests/symbolWalker.ts",
- "./unittests/versionCache.ts",
- "./unittests/convertToBase64.ts",
- "./unittests/transpile.ts",
- "./unittests/reuseProgramStructure.ts",
- "./unittests/moduleResolution.ts",
- "./unittests/tsconfigParsing.ts",
- "./unittests/asserts.ts",
- "./unittests/builder.ts",
- "./unittests/commandLineParsing.ts",
- "./unittests/configurationExtension.ts",
- "./unittests/convertCompilerOptionsFromJson.ts",
- "./unittests/convertTypeAcquisitionFromJson.ts",
- "./unittests/tsserverProjectSystem.ts",
- "./unittests/tscWatchMode.ts",
- "./unittests/matchFiles.ts",
- "./unittests/organizeImports.ts",
- "./unittests/initializeTSConfig.ts",
- "./unittests/compileOnSave.ts",
- "./unittests/typingsInstaller.ts",
- "./unittests/projectErrors.ts",
- "./unittests/printer.ts",
- "./unittests/transform.ts",
- "./unittests/customTransforms.ts",
- "./unittests/extractConstants.ts",
- "./unittests/extractFunctions.ts",
- "./unittests/extractRanges.ts",
- "./unittests/extractTestHelpers.ts",
- "./unittests/textChanges.ts",
- "./unittests/telemetry.ts",
- "./unittests/languageService.ts",
- "./unittests/programMissingFiles.ts",
- "./unittests/programNoParseFalsyFileNames.ts",
- "./unittests/publicApi.ts",
- "./unittests/hostNewLineSupport.ts"
- ]
+ "parallel/host.ts",
+ "parallel/worker.ts",
+ "parallel/shared.ts",
+ "runner.ts"
+ ],
+ "include": ["unittests/**.ts"]
}
diff --git a/src/harness/unittests/jsDocParsing.ts b/src/harness/unittests/jsDocParsing.ts
index 39416dc5776..fbd9e761625 100644
--- a/src/harness/unittests/jsDocParsing.ts
+++ b/src/harness/unittests/jsDocParsing.ts
@@ -305,6 +305,12 @@ namespace ts {
* @param x hi
< > still part of the previous comment
*/`);
+
+ parsesCorrectly("Nested @param tags",
+`/**
+* @param {object} o Doc doc
+* @param {string} o.f Doc for f
+*/`);
});
});
describe("getFirstToken", () => {
diff --git a/src/harness/unittests/organizeImports.ts b/src/harness/unittests/organizeImports.ts
index 3de5588af8e..7d496b97d99 100644
--- a/src/harness/unittests/organizeImports.ts
+++ b/src/harness/unittests/organizeImports.ts
@@ -247,6 +247,24 @@ import D from "lib";
},
libFile);
+ testOrganizeImports("Unused_false_positive_shorthand_assignment",
+ {
+ path: "/test.ts",
+ content: `
+import { x } from "a";
+const o = { x };
+`
+ });
+
+ testOrganizeImports("Unused_false_positive_export_shorthand",
+ {
+ path: "/test.ts",
+ content: `
+import { x } from "a";
+export { x };
+`
+ });
+
testOrganizeImports("MoveToTop",
{
path: "/test.ts",
diff --git a/src/harness/unittests/services/patternMatcher.ts b/src/harness/unittests/services/patternMatcher.ts
index a3e2d1d5cff..64de3557da4 100644
--- a/src/harness/unittests/services/patternMatcher.ts
+++ b/src/harness/unittests/services/patternMatcher.ts
@@ -95,376 +95,245 @@ describe("PatternMatcher", () => {
describe("SingleWordPattern", () => {
it("PreferCaseSensitiveExact", () => {
- const match = getFirstMatch("Foo", "Foo");
-
- assert.equal(ts.PatternMatchKind.exact, match.kind);
- assert.equal(true, match.isCaseSensitive);
+ assertSegmentMatch("Foo", "Foo", { kind: ts.PatternMatchKind.exact, isCaseSensitive: true });
});
it("PreferCaseSensitiveExactInsensitive", () => {
- const match = getFirstMatch("foo", "Foo");
-
- assert.equal(ts.PatternMatchKind.exact, match.kind);
- assert.equal(false, match.isCaseSensitive);
+ assertSegmentMatch("foo", "Foo", { kind: ts.PatternMatchKind.exact, isCaseSensitive: false });
});
it("PreferCaseSensitivePrefix", () => {
- const match = getFirstMatch("Foo", "Fo");
-
- assert.equal(ts.PatternMatchKind.prefix, match.kind);
- assert.equal(true, match.isCaseSensitive);
+ assertSegmentMatch("Foo", "Fo", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true });
});
it("PreferCaseSensitivePrefixCaseInsensitive", () => {
- const match = getFirstMatch("Foo", "fo");
-
- assert.equal(ts.PatternMatchKind.prefix, match.kind);
- assert.equal(false, match.isCaseSensitive);
+ assertSegmentMatch("Foo", "fo", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: false });
});
it("PreferCaseSensitiveCamelCaseMatchSimple", () => {
- const match = getFirstMatch("FogBar", "FB");
-
- assert.equal(ts.PatternMatchKind.camelCase, match.kind);
- assert.equal(true, match.isCaseSensitive);
+ assertSegmentMatch("FogBar", "FB", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true });
});
it("PreferCaseSensitiveCamelCaseMatchPartialPattern", () => {
- const match = getFirstMatch("FogBar", "FoB");
-
- assert.equal(ts.PatternMatchKind.camelCase, match.kind);
- assert.equal(true, match.isCaseSensitive);
+ assertSegmentMatch("FogBar", "FoB", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true });
});
it("PreferCaseSensitiveCamelCaseMatchToLongPattern1", () => {
- const match = getFirstMatch("FogBar", "FBB");
-
- assert.isTrue(match === undefined);
+ assertSegmentMatch("FogBar", "FBB", undefined);
});
it("PreferCaseSensitiveCamelCaseMatchToLongPattern2", () => {
- const match = getFirstMatch("FogBar", "FoooB");
-
- assert.isTrue(match === undefined);
+ assertSegmentMatch("FogBar", "FoooB", undefined);
});
it("CamelCaseMatchPartiallyUnmatched", () => {
- const match = getFirstMatch("FogBarBaz", "FZ");
-
- assert.isTrue(match === undefined);
+ assertSegmentMatch("FogBarBaz", "FZ", undefined);
});
it("CamelCaseMatchCompletelyUnmatched", () => {
- const match = getFirstMatch("FogBarBaz", "ZZ");
-
- assert.isTrue(match === undefined);
+ assertSegmentMatch("FogBarBaz", "ZZ", undefined);
});
it("TwoUppercaseCharacters", () => {
- const match = getFirstMatch("SimpleUIElement", "SiUI");
-
- assert.equal(ts.PatternMatchKind.camelCase, match.kind);
- assert.equal(true, match.isCaseSensitive);
+ assertSegmentMatch("SimpleUIElement", "SiUI", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true });
});
it("PreferCaseSensitiveLowercasePattern", () => {
- const match = getFirstMatch("FogBar", "b");
-
- assert.equal(ts.PatternMatchKind.substring, match.kind);
- assert.equal(false, match.isCaseSensitive);
+ assertSegmentMatch("FogBar", "b", { kind: ts.PatternMatchKind.substring, isCaseSensitive: false });
});
it("PreferCaseSensitiveLowercasePattern2", () => {
- const match = getFirstMatch("FogBar", "fB");
-
- assert.equal(ts.PatternMatchKind.camelCase, match.kind);
- assert.equal(false, match.isCaseSensitive);
+ assertSegmentMatch("FogBar", "fB", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: false });
});
it("PreferCaseSensitiveTryUnderscoredName", () => {
- const match = getFirstMatch("_fogBar", "_fB");
-
- assert.equal(ts.PatternMatchKind.camelCase, match.kind);
- assert.equal(true, match.isCaseSensitive);
+ assertSegmentMatch("_fogBar", "_fB", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true });
});
it("PreferCaseSensitiveTryUnderscoredName2", () => {
- const match = getFirstMatch("_fogBar", "fB");
-
- assert.equal(ts.PatternMatchKind.camelCase, match.kind);
- assert.equal(true, match.isCaseSensitive);
+ assertSegmentMatch("_fogBar", "fB", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true });
});
it("PreferCaseSensitiveTryUnderscoredNameInsensitive", () => {
- const match = getFirstMatch("_FogBar", "_fB");
-
- assert.equal(ts.PatternMatchKind.camelCase, match.kind);
- assert.equal(false, match.isCaseSensitive);
+ assertSegmentMatch("_FogBar", "_fB", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: false });
});
it("PreferCaseSensitiveMiddleUnderscore", () => {
- const match = getFirstMatch("Fog_Bar", "FB");
-
- assert.equal(ts.PatternMatchKind.camelCase, match.kind);
- assert.equal(true, match.isCaseSensitive);
+ assertSegmentMatch("Fog_Bar", "FB", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true });
});
it("PreferCaseSensitiveMiddleUnderscore2", () => {
- const match = getFirstMatch("Fog_Bar", "F_B");
-
- assert.equal(ts.PatternMatchKind.camelCase, match.kind);
- assert.equal(true, match.isCaseSensitive);
+ assertSegmentMatch("Fog_Bar", "F_B", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true });
});
it("PreferCaseSensitiveMiddleUnderscore3", () => {
- const match = getFirstMatch("Fog_Bar", "F__B");
-
- assert.isTrue(undefined === match);
+ assertSegmentMatch("Fog_Bar", "F__B", undefined);
});
it("PreferCaseSensitiveMiddleUnderscore4", () => {
- const match = getFirstMatch("Fog_Bar", "f_B");
-
- assert.equal(ts.PatternMatchKind.camelCase, match.kind);
- assert.equal(false, match.isCaseSensitive);
+ assertSegmentMatch("Fog_Bar", "f_B", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: false });
});
it("PreferCaseSensitiveMiddleUnderscore5", () => {
- const match = getFirstMatch("Fog_Bar", "F_b");
-
- assert.equal(ts.PatternMatchKind.camelCase, match.kind);
- assert.equal(false, match.isCaseSensitive);
+ assertSegmentMatch("Fog_Bar", "F_b", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: false });
});
it("AllLowerPattern1", () => {
- const match = getFirstMatch("FogBarChangedEventArgs", "changedeventargs");
-
- assert.isTrue(undefined !== match);
+ assertSegmentMatch("FogBarChangedEventArgs", "changedeventargs", { kind: ts.PatternMatchKind.substring, isCaseSensitive: false });
});
it("AllLowerPattern2", () => {
- const match = getFirstMatch("FogBarChangedEventArgs", "changedeventarrrgh");
-
- assert.isTrue(undefined === match);
+ assertSegmentMatch("FogBarChangedEventArgs", "changedeventarrrgh", undefined);
});
it("AllLowerPattern3", () => {
- const match = getFirstMatch("ABCDEFGH", "bcd");
-
- assert.isTrue(undefined !== match);
+ assertSegmentMatch("ABCDEFGH", "bcd", { kind: ts.PatternMatchKind.substring, isCaseSensitive: false });
});
it("AllLowerPattern4", () => {
- const match = getFirstMatch("AbcdefghijEfgHij", "efghij");
-
- assert.isTrue(undefined === match);
+ assertSegmentMatch("AbcdefghijEfgHij", "efghij", undefined);
});
});
describe("MultiWordPattern", () => {
it("ExactWithLowercase", () => {
- const matches = getAllMatches("AddMetadataReference", "addmetadatareference");
-
- assertContainsKind(ts.PatternMatchKind.exact, matches);
+ assertSegmentMatch("AddMetadataReference", "addmetadatareference", { kind: ts.PatternMatchKind.exact, isCaseSensitive: false });
});
it("SingleLowercasedSearchWord1", () => {
- const matches = getAllMatches("AddMetadataReference", "add");
-
- assertContainsKind(ts.PatternMatchKind.prefix, matches);
+ assertSegmentMatch("AddMetadataReference", "add", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: false });
});
it("SingleLowercasedSearchWord2", () => {
- const matches = getAllMatches("AddMetadataReference", "metadata");
-
- assertContainsKind(ts.PatternMatchKind.substring, matches);
+ assertSegmentMatch("AddMetadataReference", "metadata", { kind: ts.PatternMatchKind.substring, isCaseSensitive: false });
});
it("SingleUppercaseSearchWord1", () => {
- const matches = getAllMatches("AddMetadataReference", "Add");
-
- assertContainsKind(ts.PatternMatchKind.prefix, matches);
+ assertSegmentMatch("AddMetadataReference", "Add", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true });
});
it("SingleUppercaseSearchWord2", () => {
- const matches = getAllMatches("AddMetadataReference", "Metadata");
-
- assertContainsKind(ts.PatternMatchKind.substring, matches);
+ assertSegmentMatch("AddMetadataReference", "Metadata", { kind: ts.PatternMatchKind.substring, isCaseSensitive: true });
});
it("SingleUppercaseSearchLetter1", () => {
- const matches = getAllMatches("AddMetadataReference", "A");
-
- assertContainsKind(ts.PatternMatchKind.prefix, matches);
+ assertSegmentMatch("AddMetadataReference", "A", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true });
});
it("SingleUppercaseSearchLetter2", () => {
- const matches = getAllMatches("AddMetadataReference", "M");
-
- assertContainsKind(ts.PatternMatchKind.substring, matches);
+ assertSegmentMatch("AddMetadataReference", "M", { kind: ts.PatternMatchKind.substring, isCaseSensitive: true });
});
- it("TwoLowercaseWords", () => {
- const matches = getAllMatches("AddMetadataReference", "add metadata");
-
- assertContainsKind(ts.PatternMatchKind.prefix, matches);
- assertContainsKind(ts.PatternMatchKind.substring, matches);
+ it("TwoLowercaseWords0", () => {
+ assertSegmentMatch("AddMetadataReference", "add metadata", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: false });
});
- it("TwoLowercaseWords", () => {
- const matches = getAllMatches("AddMetadataReference", "A M");
-
- assertContainsKind(ts.PatternMatchKind.prefix, matches);
- assertContainsKind(ts.PatternMatchKind.substring, matches);
+ it("TwoLowercaseWords1", () => {
+ assertSegmentMatch("AddMetadataReference", "A M", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true });
});
- it("TwoLowercaseWords", () => {
- const matches = getAllMatches("AddMetadataReference", "AM");
-
- assertContainsKind(ts.PatternMatchKind.camelCase, matches);
+ it("TwoLowercaseWords2", () => {
+ assertSegmentMatch("AddMetadataReference", "AM", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true });
});
- it("TwoLowercaseWords", () => {
- const matches = getAllMatches("AddMetadataReference", "ref Metadata");
-
- assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.substring, ts.PatternMatchKind.substring]);
+ it("TwoLowercaseWords3", () => {
+ assertSegmentMatch("AddMetadataReference", "ref Metadata", { kind: ts.PatternMatchKind.substring, isCaseSensitive: true });
});
- it("TwoLowercaseWords", () => {
- const matches = getAllMatches("AddMetadataReference", "ref M");
-
- assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.substring, ts.PatternMatchKind.substring]);
+ it("TwoLowercaseWords4", () => {
+ assertSegmentMatch("AddMetadataReference", "ref M", { kind: ts.PatternMatchKind.substring, isCaseSensitive: true });
});
it("MixedCamelCase", () => {
- const matches = getAllMatches("AddMetadataReference", "AMRe");
-
- assertContainsKind(ts.PatternMatchKind.camelCase, matches);
+ assertSegmentMatch("AddMetadataReference", "AMRe", { kind: ts.PatternMatchKind.camelCase, isCaseSensitive: true });
});
it("BlankPattern", () => {
- const matches = getAllMatches("AddMetadataReference", "");
-
- assert.isTrue(matches === undefined);
+ assertInvalidPattern("");
});
it("WhitespaceOnlyPattern", () => {
- const matches = getAllMatches("AddMetadataReference", " ");
-
- assert.isTrue(matches === undefined);
+ assertInvalidPattern(" ");
});
it("EachWordSeparately1", () => {
- const matches = getAllMatches("AddMetadataReference", "add Meta");
-
- assertContainsKind(ts.PatternMatchKind.prefix, matches);
- assertContainsKind(ts.PatternMatchKind.substring, matches);
+ assertSegmentMatch("AddMetadataReference", "add Meta", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: false });
});
it("EachWordSeparately2", () => {
- const matches = getAllMatches("AddMetadataReference", "Add meta");
-
- assertContainsKind(ts.PatternMatchKind.prefix, matches);
- assertContainsKind(ts.PatternMatchKind.substring, matches);
+ assertSegmentMatch("AddMetadataReference", "Add meta", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true });
});
it("EachWordSeparately3", () => {
- const matches = getAllMatches("AddMetadataReference", "Add Meta");
-
- assertContainsKind(ts.PatternMatchKind.prefix, matches);
- assertContainsKind(ts.PatternMatchKind.substring, matches);
+ assertSegmentMatch("AddMetadataReference", "Add Meta", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true });
});
it("MixedCasing", () => {
- const matches = getAllMatches("AddMetadataReference", "mEta");
-
- assert.isTrue(matches === undefined);
+ assertSegmentMatch("AddMetadataReference", "mEta", undefined);
});
it("MixedCasing2", () => {
- const matches = getAllMatches("AddMetadataReference", "Data");
-
- assert.isTrue(matches === undefined);
+ assertSegmentMatch("AddMetadataReference", "Data", undefined);
});
it("AsteriskSplit", () => {
- const matches = getAllMatches("GetKeyWord", "K*W");
-
- assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.substring, ts.PatternMatchKind.substring]);
+ assertSegmentMatch("GetKeyWord", "K*W", { kind: ts.PatternMatchKind.substring, isCaseSensitive: true });
});
it("LowercaseSubstring1", () => {
- const matches = getAllMatches("Operator", "a");
-
- assert.isTrue(matches === undefined);
+ assertSegmentMatch("Operator", "a", undefined);
});
it("LowercaseSubstring2", () => {
- const matches = getAllMatches("FooAttribute", "a");
- assertContainsKind(ts.PatternMatchKind.substring, matches);
- assert.isFalse(matches[0].isCaseSensitive);
+ assertSegmentMatch("FooAttribute", "a", { kind: ts.PatternMatchKind.substring, isCaseSensitive: false });
});
});
describe("DottedPattern", () => {
it("DottedPattern1", () => {
- const match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "B.Q");
-
- assert.equal(ts.PatternMatchKind.prefix, match.kind);
- assert.equal(true, match.isCaseSensitive);
+ assertFullMatch("Foo.Bar.Baz", "Quux", "B.Q", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true });
});
it("DottedPattern2", () => {
- const match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "C.Q");
- assert.isTrue(match === undefined);
+ assertFullMatch("Foo.Bar.Baz", "Quux", "C.Q", undefined);
});
it("DottedPattern3", () => {
- const match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "B.B.Q");
- assert.equal(ts.PatternMatchKind.prefix, match.kind);
- assert.equal(true, match.isCaseSensitive);
+ assertFullMatch("Foo.Bar.Baz", "Quux", "B.B.Q", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true });
});
it("DottedPattern4", () => {
- const match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "Baz.Quux");
- assert.equal(ts.PatternMatchKind.exact, match.kind);
- assert.equal(true, match.isCaseSensitive);
+ assertFullMatch("Foo.Bar.Baz", "Quux", "Baz.Quux", { kind: ts.PatternMatchKind.exact, isCaseSensitive: true });
});
it("DottedPattern5", () => {
- const match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "F.B.B.Quux");
- assert.equal(ts.PatternMatchKind.exact, match.kind);
- assert.equal(true, match.isCaseSensitive);
+ assertFullMatch("Foo.Bar.Baz", "Quux", "F.B.B.Quux", { kind: ts.PatternMatchKind.prefix, isCaseSensitive: true });
});
it("DottedPattern6", () => {
- const match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "F.F.B.B.Quux");
- assert.isTrue(match === undefined);
+ assertFullMatch("Foo.Bar.Baz", "Quux", "F.F.B.B.Quux", undefined);
});
it("DottedPattern7", () => {
- let match = getFirstMatch("UIElement", "UIElement");
- match = getFirstMatch("GetKeyword", "UIElement");
- assert.isTrue(match === undefined);
+ assertSegmentMatch("UIElement", "UIElement", { kind: ts.PatternMatchKind.exact, isCaseSensitive: true });
+ assertSegmentMatch("GetKeyword", "UIElement", undefined);
});
});
- function getFirstMatch(candidate: string, pattern: string): ts.PatternMatch {
- const matches = ts.createPatternMatcher(pattern).getMatchesForLastSegmentOfPattern(candidate);
- return matches ? matches[0] : undefined;
+ function assertSegmentMatch(candidate: string, pattern: string, expected: ts.PatternMatch | undefined): void {
+ assert.deepEqual(ts.createPatternMatcher(pattern).getMatchForLastSegmentOfPattern(candidate), expected);
}
- function getAllMatches(candidate: string, pattern: string): ts.PatternMatch[] {
- return ts.createPatternMatcher(pattern).getMatchesForLastSegmentOfPattern(candidate);
+ function assertInvalidPattern(pattern: string) {
+ assert.equal(ts.createPatternMatcher(pattern), undefined);
}
- function getFirstMatchForDottedPattern(dottedContainer: string, candidate: string, pattern: string): ts.PatternMatch {
- const matches = ts.createPatternMatcher(pattern).getMatches(dottedContainer.split("."), candidate);
- return matches ? matches[0] : undefined;
+ function assertFullMatch(dottedContainer: string, candidate: string, pattern: string, expected: ts.PatternMatch | undefined): void {
+ assert.deepEqual(ts.createPatternMatcher(pattern).getFullMatch(dottedContainer.split("."), candidate), expected);
}
function spanListToSubstrings(identifier: string, spans: ts.TextSpan[]) {
- return ts.map(spans, s => identifier.substr(s.start, s.length));
+ return spans.map(s => identifier.substr(s.start, s.length));
}
function breakIntoCharacterSpans(identifier: string) {
@@ -474,23 +343,12 @@ describe("PatternMatcher", () => {
function breakIntoWordSpans(identifier: string) {
return spanListToSubstrings(identifier, ts.breakIntoWordSpans(identifier));
}
- function assertArrayEquals(array1: T[], array2: T[]) {
- assert.equal(array1.length, array2.length);
-
- for (let i = 0; i < array1.length; i++) {
- assert.equal(array1[i], array2[i]);
- }
- }
function verifyBreakIntoCharacterSpans(original: string, ...parts: string[]): void {
- assertArrayEquals(parts, breakIntoCharacterSpans(original));
+ assert.deepEqual(parts, breakIntoCharacterSpans(original));
}
function verifyBreakIntoWordSpans(original: string, ...parts: string[]): void {
- assertArrayEquals(parts, breakIntoWordSpans(original));
- }
-
- function assertContainsKind(kind: ts.PatternMatchKind, results: ts.PatternMatch[]) {
- assert.isTrue(ts.forEach(results, r => r.kind === kind));
+ assert.deepEqual(parts, breakIntoWordSpans(original));
}
});
diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts
index 8170c663b1f..b167ed21b94 100644
--- a/src/harness/unittests/tsserverProjectSystem.ts
+++ b/src/harness/unittests/tsserverProjectSystem.ts
@@ -4131,10 +4131,10 @@ namespace ts.projectSystem {
checkErrorMessage(session, "semanticDiag", { file: file1.path, diagnostics: [] });
});
- it("info diagnostics", () => {
+ it("suggestion diagnostics", () => {
const file: FileOrFolder = {
path: "/a.js",
- content: 'require("b")',
+ content: "function f(p) {}",
};
const host = createServerHost([file]);
@@ -4177,13 +4177,64 @@ namespace ts.projectSystem {
checkErrorMessage(session, "suggestionDiag", {
file: file.path,
diagnostics: [
- createDiagnostic({ line: 1, offset: 1 }, { line: 1, offset: 13 }, Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module)
+ createDiagnostic({ line: 1, offset: 12 }, { line: 1, offset: 13 }, Diagnostics._0_is_declared_but_its_value_is_never_read, ["p"], "suggestion", /*reportsUnnecssary*/ true)
],
});
checkCompleteEvent(session, 2, expectedSequenceId);
session.clearMessages();
});
+ it("disable suggestion diagnostics", () => {
+ const file: FileOrFolder = {
+ path: "/a.js",
+ content: 'require("b")',
+ };
+
+ const host = createServerHost([file]);
+ const session = createSession(host, { canUseEvents: true });
+ const service = session.getProjectService();
+
+ session.executeCommandSeq({
+ command: server.CommandNames.Open,
+ arguments: { file: file.path, fileContent: file.content },
+ });
+
+ session.executeCommandSeq({
+ command: server.CommandNames.Configure,
+ arguments: {
+ preferences: { disableSuggestions: true }
+ },
+ });
+
+ checkNumberOfProjects(service, { inferredProjects: 1 });
+ session.clearMessages();
+ const expectedSequenceId = session.getNextSeq();
+ host.checkTimeoutQueueLengthAndRun(2);
+
+ checkProjectUpdatedInBackgroundEvent(session, [file.path]);
+ session.clearMessages();
+
+ session.executeCommandSeq({
+ command: server.CommandNames.Geterr,
+ arguments: {
+ delay: 0,
+ files: [file.path],
+ }
+ });
+
+ host.checkTimeoutQueueLengthAndRun(1);
+
+ checkErrorMessage(session, "syntaxDiag", { file: file.path, diagnostics: [] }, /*isMostRecent*/ true);
+ session.clearMessages();
+
+ host.runQueuedImmediateCallbacks(1);
+
+ checkErrorMessage(session, "semanticDiag", { file: file.path, diagnostics: [] });
+ // No suggestion event, we're done.
+ checkCompleteEvent(session, 2, expectedSequenceId);
+ session.clearMessages();
+ });
+
it("suppressed diagnostic events", () => {
const file: FileOrFolder = {
path: "/a.ts",
@@ -4241,8 +4292,8 @@ namespace ts.projectSystem {
session.clearMessages();
});
- function createDiagnostic(start: protocol.Location, end: protocol.Location, message: DiagnosticMessage, args: ReadonlyArray = []): protocol.Diagnostic {
- return { start, end, text: formatStringFromArgs(message.message, args), code: message.code, category: diagnosticCategoryName(message), source: undefined };
+ function createDiagnostic(start: protocol.Location, end: protocol.Location, message: DiagnosticMessage, args: ReadonlyArray = [], category = diagnosticCategoryName(message), reportsUnnecessary?: {}): protocol.Diagnostic {
+ return { start, end, text: formatStringFromArgs(message.message, args), code: message.code, category, reportsUnnecessary, source: undefined };
}
});
diff --git a/src/harness/unittests/typingsInstaller.ts b/src/harness/unittests/typingsInstaller.ts
index 0a27f860352..1a19c98f477 100644
--- a/src/harness/unittests/typingsInstaller.ts
+++ b/src/harness/unittests/typingsInstaller.ts
@@ -141,12 +141,15 @@ namespace ts.projectSystem {
checkNumberOfProjects(projectService, { configuredProjects: 1 });
const p = configuredProjectAt(projectService, 0);
checkProjectActualFiles(p, [file1.path, tsconfig.path]);
+ checkWatchedFiles(host, [tsconfig.path, libFile.path, packageJson.path, "/a/b/bower_components", "/a/b/node_modules"]);
installer.installAll(/*expectedCount*/ 1);
checkNumberOfProjects(projectService, { configuredProjects: 1 });
host.checkTimeoutQueueLengthAndRun(2);
checkProjectActualFiles(p, [file1.path, jquery.path, tsconfig.path]);
+ // should not watch jquery
+ checkWatchedFiles(host, [tsconfig.path, libFile.path, packageJson.path, "/a/b/bower_components", "/a/b/node_modules"]);
});
it("inferred project (typings installed)", () => {
@@ -188,7 +191,7 @@ namespace ts.projectSystem {
checkProjectActualFiles(p, [file1.path]);
installer.installAll(/*expectedCount*/ 1);
-
+ host.checkTimeoutQueueLengthAndRun(2);
checkNumberOfProjects(projectService, { inferredProjects: 1 });
checkProjectActualFiles(p, [file1.path, jquery.path]);
});
@@ -961,6 +964,7 @@ namespace ts.projectSystem {
assert.isTrue(host.fileExists(node.path), "typings for 'node' should be created");
assert.isTrue(host.fileExists(commander.path), "typings for 'commander' should be created");
+ host.checkTimeoutQueueLengthAndRun(2);
checkProjectActualFiles(service.inferredProjects[0], [file.path, node.path, commander.path]);
});
@@ -1106,7 +1110,7 @@ namespace ts.projectSystem {
checkProjectActualFiles(p, [file1.path]);
installer.installAll(/*expectedCount*/ 1);
-
+ host.checkTimeoutQueueLengthAndRun(2);
checkNumberOfProjects(projectService, { inferredProjects: 1 });
checkProjectActualFiles(p, [file1.path, jquery.path]);
});
@@ -1589,4 +1593,32 @@ namespace ts.projectSystem {
checkProjectActualFiles(projectService.inferredProjects[0], [f1.path]);
});
});
+
+ describe("typing installer's npm installation command", () => {
+ const npmPath = "npm", tsVersion = "2.9.0-dev.20180410";
+ const packageNames = ["@types/graphql@ts2.8", "@types/highlight.js@ts2.8", "@types/jest@ts2.8", "@types/mini-css-extract-plugin@ts2.8", "@types/mongoose@ts2.8", "@types/pg@ts2.8", "@types/webpack-bundle-analyzer@ts2.8", "@types/enhanced-resolve@ts2.8", "@types/eslint-plugin-prettier@ts2.8", "@types/friendly-errors-webpack-plugin@ts2.8", "@types/hammerjs@ts2.8", "@types/history@ts2.8", "@types/image-size@ts2.8", "@types/js-cookie@ts2.8", "@types/koa-compress@ts2.8", "@types/less@ts2.8", "@types/material-ui@ts2.8", "@types/mysql@ts2.8", "@types/nodemailer@ts2.8", "@types/prettier@ts2.8", "@types/query-string@ts2.8", "@types/react-places-autocomplete@ts2.8", "@types/react-router@ts2.8", "@types/react-router-config@ts2.8", "@types/react-select@ts2.8", "@types/react-transition-group@ts2.8", "@types/redux-form@ts2.8", "@types/abbrev@ts2.8", "@types/accepts@ts2.8", "@types/acorn@ts2.8", "@types/ansi-regex@ts2.8", "@types/ansi-styles@ts2.8", "@types/anymatch@ts2.8", "@types/apollo-codegen@ts2.8", "@types/are-we-there-yet@ts2.8", "@types/argparse@ts2.8", "@types/arr-union@ts2.8", "@types/array-find-index@ts2.8", "@types/array-uniq@ts2.8", "@types/array-unique@ts2.8", "@types/arrify@ts2.8", "@types/assert-plus@ts2.8", "@types/async@ts2.8", "@types/autoprefixer@ts2.8", "@types/aws4@ts2.8", "@types/babel-code-frame@ts2.8", "@types/babel-generator@ts2.8", "@types/babel-plugin-syntax-jsx@ts2.8", "@types/babel-template@ts2.8", "@types/babel-traverse@ts2.8", "@types/babel-types@ts2.8", "@types/babylon@ts2.8", "@types/base64-js@ts2.8", "@types/basic-auth@ts2.8", "@types/big.js@ts2.8", "@types/bl@ts2.8", "@types/bluebird@ts2.8", "@types/body-parser@ts2.8", "@types/bonjour@ts2.8", "@types/boom@ts2.8", "@types/brace-expansion@ts2.8", "@types/braces@ts2.8", "@types/brorand@ts2.8", "@types/browser-resolve@ts2.8", "@types/bson@ts2.8", "@types/buffer-equal@ts2.8", "@types/builtin-modules@ts2.8", "@types/bytes@ts2.8", "@types/callsites@ts2.8", "@types/camelcase@ts2.8", "@types/camelcase-keys@ts2.8", "@types/caseless@ts2.8", "@types/change-emitter@ts2.8", "@types/check-types@ts2.8", "@types/cheerio@ts2.8", "@types/chokidar@ts2.8", "@types/chownr@ts2.8", "@types/circular-json@ts2.8", "@types/classnames@ts2.8", "@types/clean-css@ts2.8", "@types/clone@ts2.8", "@types/co-body@ts2.8", "@types/color@ts2.8", "@types/color-convert@ts2.8", "@types/color-name@ts2.8", "@types/color-string@ts2.8", "@types/colors@ts2.8", "@types/combined-stream@ts2.8", "@types/common-tags@ts2.8", "@types/component-emitter@ts2.8", "@types/compressible@ts2.8", "@types/compression@ts2.8", "@types/concat-stream@ts2.8", "@types/connect-history-api-fallback@ts2.8", "@types/content-disposition@ts2.8", "@types/content-type@ts2.8", "@types/convert-source-map@ts2.8", "@types/cookie@ts2.8", "@types/cookie-signature@ts2.8", "@types/cookies@ts2.8", "@types/core-js@ts2.8", "@types/cosmiconfig@ts2.8", "@types/create-react-class@ts2.8", "@types/cross-spawn@ts2.8", "@types/cryptiles@ts2.8", "@types/css-modules-require-hook@ts2.8", "@types/dargs@ts2.8", "@types/dateformat@ts2.8", "@types/debug@ts2.8", "@types/decamelize@ts2.8", "@types/decompress@ts2.8", "@types/decompress-response@ts2.8", "@types/deep-equal@ts2.8", "@types/deep-extend@ts2.8", "@types/deepmerge@ts2.8", "@types/defined@ts2.8", "@types/del@ts2.8", "@types/depd@ts2.8", "@types/destroy@ts2.8", "@types/detect-indent@ts2.8", "@types/detect-newline@ts2.8", "@types/diff@ts2.8", "@types/doctrine@ts2.8", "@types/download@ts2.8", "@types/draft-js@ts2.8", "@types/duplexer2@ts2.8", "@types/duplexer3@ts2.8", "@types/duplexify@ts2.8", "@types/ejs@ts2.8", "@types/end-of-stream@ts2.8", "@types/entities@ts2.8", "@types/escape-html@ts2.8", "@types/escape-string-regexp@ts2.8", "@types/escodegen@ts2.8", "@types/eslint-scope@ts2.8", "@types/eslint-visitor-keys@ts2.8", "@types/esprima@ts2.8", "@types/estraverse@ts2.8", "@types/etag@ts2.8", "@types/events@ts2.8", "@types/execa@ts2.8", "@types/exenv@ts2.8", "@types/exit@ts2.8", "@types/exit-hook@ts2.8", "@types/expect@ts2.8", "@types/express@ts2.8", "@types/express-graphql@ts2.8", "@types/extend@ts2.8", "@types/extract-zip@ts2.8", "@types/fancy-log@ts2.8", "@types/fast-diff@ts2.8", "@types/fast-levenshtein@ts2.8", "@types/figures@ts2.8", "@types/file-type@ts2.8", "@types/filenamify@ts2.8", "@types/filesize@ts2.8", "@types/finalhandler@ts2.8", "@types/find-root@ts2.8", "@types/find-up@ts2.8", "@types/findup-sync@ts2.8", "@types/forever-agent@ts2.8", "@types/form-data@ts2.8", "@types/forwarded@ts2.8", "@types/fresh@ts2.8", "@types/from2@ts2.8", "@types/fs-extra@ts2.8", "@types/get-caller-file@ts2.8", "@types/get-stdin@ts2.8", "@types/get-stream@ts2.8", "@types/get-value@ts2.8", "@types/glob-base@ts2.8", "@types/glob-parent@ts2.8", "@types/glob-stream@ts2.8", "@types/globby@ts2.8", "@types/globule@ts2.8", "@types/got@ts2.8", "@types/graceful-fs@ts2.8", "@types/gulp-rename@ts2.8", "@types/gulp-sourcemaps@ts2.8", "@types/gulp-util@ts2.8", "@types/gzip-size@ts2.8", "@types/handlebars@ts2.8", "@types/has-ansi@ts2.8", "@types/hasha@ts2.8", "@types/he@ts2.8", "@types/hoek@ts2.8", "@types/html-entities@ts2.8", "@types/html-minifier@ts2.8", "@types/htmlparser2@ts2.8", "@types/http-assert@ts2.8", "@types/http-errors@ts2.8", "@types/http-proxy@ts2.8", "@types/http-proxy-middleware@ts2.8", "@types/indent-string@ts2.8", "@types/inflected@ts2.8", "@types/inherits@ts2.8", "@types/ini@ts2.8", "@types/inline-style-prefixer@ts2.8", "@types/inquirer@ts2.8", "@types/internal-ip@ts2.8", "@types/into-stream@ts2.8", "@types/invariant@ts2.8", "@types/ip@ts2.8", "@types/ip-regex@ts2.8", "@types/is-absolute-url@ts2.8", "@types/is-binary-path@ts2.8", "@types/is-finite@ts2.8", "@types/is-glob@ts2.8", "@types/is-my-json-valid@ts2.8", "@types/is-number@ts2.8", "@types/is-object@ts2.8", "@types/is-path-cwd@ts2.8", "@types/is-path-in-cwd@ts2.8", "@types/is-promise@ts2.8", "@types/is-scoped@ts2.8", "@types/is-stream@ts2.8", "@types/is-svg@ts2.8", "@types/is-url@ts2.8", "@types/is-windows@ts2.8", "@types/istanbul-lib-coverage@ts2.8", "@types/istanbul-lib-hook@ts2.8", "@types/istanbul-lib-instrument@ts2.8", "@types/istanbul-lib-report@ts2.8", "@types/istanbul-lib-source-maps@ts2.8", "@types/istanbul-reports@ts2.8", "@types/jest-diff@ts2.8", "@types/jest-docblock@ts2.8", "@types/jest-get-type@ts2.8", "@types/jest-matcher-utils@ts2.8", "@types/jest-validate@ts2.8", "@types/jpeg-js@ts2.8", "@types/js-base64@ts2.8", "@types/js-string-escape@ts2.8", "@types/js-yaml@ts2.8", "@types/jsbn@ts2.8", "@types/jsdom@ts2.8", "@types/jsesc@ts2.8", "@types/json-parse-better-errors@ts2.8", "@types/json-schema@ts2.8", "@types/json-stable-stringify@ts2.8", "@types/json-stringify-safe@ts2.8", "@types/json5@ts2.8", "@types/jsonfile@ts2.8", "@types/jsontoxml@ts2.8", "@types/jss@ts2.8", "@types/keygrip@ts2.8", "@types/keymirror@ts2.8", "@types/keyv@ts2.8", "@types/klaw@ts2.8", "@types/koa-send@ts2.8", "@types/leven@ts2.8", "@types/listr@ts2.8", "@types/load-json-file@ts2.8", "@types/loader-runner@ts2.8", "@types/loader-utils@ts2.8", "@types/locate-path@ts2.8", "@types/lodash-es@ts2.8", "@types/lodash.assign@ts2.8", "@types/lodash.camelcase@ts2.8", "@types/lodash.clonedeep@ts2.8", "@types/lodash.debounce@ts2.8", "@types/lodash.escape@ts2.8", "@types/lodash.flowright@ts2.8", "@types/lodash.get@ts2.8", "@types/lodash.isarguments@ts2.8", "@types/lodash.isarray@ts2.8", "@types/lodash.isequal@ts2.8", "@types/lodash.isobject@ts2.8", "@types/lodash.isstring@ts2.8", "@types/lodash.keys@ts2.8", "@types/lodash.memoize@ts2.8", "@types/lodash.merge@ts2.8", "@types/lodash.mergewith@ts2.8", "@types/lodash.pick@ts2.8", "@types/lodash.sortby@ts2.8", "@types/lodash.tail@ts2.8", "@types/lodash.template@ts2.8", "@types/lodash.throttle@ts2.8", "@types/lodash.unescape@ts2.8", "@types/lodash.uniq@ts2.8", "@types/log-symbols@ts2.8", "@types/log-update@ts2.8", "@types/loglevel@ts2.8", "@types/loud-rejection@ts2.8", "@types/lru-cache@ts2.8", "@types/make-dir@ts2.8", "@types/map-obj@ts2.8", "@types/media-typer@ts2.8", "@types/mem@ts2.8", "@types/mem-fs@ts2.8", "@types/memory-fs@ts2.8", "@types/meow@ts2.8", "@types/merge-descriptors@ts2.8", "@types/merge-stream@ts2.8", "@types/methods@ts2.8", "@types/micromatch@ts2.8", "@types/mime@ts2.8", "@types/mime-db@ts2.8", "@types/mime-types@ts2.8", "@types/minimatch@ts2.8", "@types/minimist@ts2.8", "@types/minipass@ts2.8", "@types/mkdirp@ts2.8", "@types/mongodb@ts2.8", "@types/morgan@ts2.8", "@types/move-concurrently@ts2.8", "@types/ms@ts2.8", "@types/msgpack-lite@ts2.8", "@types/multimatch@ts2.8", "@types/mz@ts2.8", "@types/negotiator@ts2.8", "@types/node-dir@ts2.8", "@types/node-fetch@ts2.8", "@types/node-forge@ts2.8", "@types/node-int64@ts2.8", "@types/node-ipc@ts2.8", "@types/node-notifier@ts2.8", "@types/nomnom@ts2.8", "@types/nopt@ts2.8", "@types/normalize-package-data@ts2.8", "@types/normalize-url@ts2.8", "@types/number-is-nan@ts2.8", "@types/object-assign@ts2.8", "@types/on-finished@ts2.8", "@types/on-headers@ts2.8", "@types/once@ts2.8", "@types/onetime@ts2.8", "@types/opener@ts2.8", "@types/opn@ts2.8", "@types/optimist@ts2.8", "@types/ora@ts2.8", "@types/os-homedir@ts2.8", "@types/os-locale@ts2.8", "@types/os-tmpdir@ts2.8", "@types/p-cancelable@ts2.8", "@types/p-each-series@ts2.8", "@types/p-event@ts2.8", "@types/p-lazy@ts2.8", "@types/p-limit@ts2.8", "@types/p-locate@ts2.8", "@types/p-map@ts2.8", "@types/p-map-series@ts2.8", "@types/p-reduce@ts2.8", "@types/p-timeout@ts2.8", "@types/p-try@ts2.8", "@types/pako@ts2.8", "@types/parse-glob@ts2.8", "@types/parse-json@ts2.8", "@types/parseurl@ts2.8", "@types/path-exists@ts2.8", "@types/path-is-absolute@ts2.8", "@types/path-parse@ts2.8", "@types/pg-pool@ts2.8", "@types/pg-types@ts2.8", "@types/pify@ts2.8", "@types/pixelmatch@ts2.8", "@types/pkg-dir@ts2.8", "@types/pluralize@ts2.8", "@types/pngjs@ts2.8", "@types/prelude-ls@ts2.8", "@types/pretty-bytes@ts2.8", "@types/pretty-format@ts2.8", "@types/progress@ts2.8", "@types/promise-retry@ts2.8", "@types/proxy-addr@ts2.8", "@types/pump@ts2.8", "@types/q@ts2.8", "@types/qs@ts2.8", "@types/range-parser@ts2.8", "@types/rc@ts2.8", "@types/rc-select@ts2.8", "@types/rc-slider@ts2.8", "@types/rc-tooltip@ts2.8", "@types/rc-tree@ts2.8", "@types/react-event-listener@ts2.8", "@types/react-side-effect@ts2.8", "@types/react-slick@ts2.8", "@types/read-chunk@ts2.8", "@types/read-pkg@ts2.8", "@types/read-pkg-up@ts2.8", "@types/recompose@ts2.8", "@types/recursive-readdir@ts2.8", "@types/relateurl@ts2.8", "@types/replace-ext@ts2.8", "@types/request@ts2.8", "@types/request-promise-native@ts2.8", "@types/require-directory@ts2.8", "@types/require-from-string@ts2.8", "@types/require-relative@ts2.8", "@types/resolve@ts2.8", "@types/resolve-from@ts2.8", "@types/retry@ts2.8", "@types/rx@ts2.8", "@types/rx-lite@ts2.8", "@types/rx-lite-aggregates@ts2.8", "@types/safe-regex@ts2.8", "@types/sane@ts2.8", "@types/sass-graph@ts2.8", "@types/sax@ts2.8", "@types/scriptjs@ts2.8", "@types/semver@ts2.8", "@types/send@ts2.8", "@types/serialize-javascript@ts2.8", "@types/serve-index@ts2.8", "@types/serve-static@ts2.8", "@types/set-value@ts2.8", "@types/shallowequal@ts2.8", "@types/shelljs@ts2.8", "@types/sockjs@ts2.8", "@types/sockjs-client@ts2.8", "@types/source-list-map@ts2.8", "@types/source-map-support@ts2.8", "@types/spdx-correct@ts2.8", "@types/spdy@ts2.8", "@types/split@ts2.8", "@types/sprintf@ts2.8", "@types/sprintf-js@ts2.8", "@types/sqlstring@ts2.8", "@types/sshpk@ts2.8", "@types/stack-utils@ts2.8", "@types/stat-mode@ts2.8", "@types/statuses@ts2.8", "@types/strict-uri-encode@ts2.8", "@types/string-template@ts2.8", "@types/strip-ansi@ts2.8", "@types/strip-bom@ts2.8", "@types/strip-json-comments@ts2.8", "@types/supports-color@ts2.8", "@types/svg2png@ts2.8", "@types/svgo@ts2.8", "@types/table@ts2.8", "@types/tapable@ts2.8", "@types/tar@ts2.8", "@types/temp@ts2.8", "@types/tempfile@ts2.8", "@types/through@ts2.8", "@types/through2@ts2.8", "@types/tinycolor2@ts2.8", "@types/tmp@ts2.8", "@types/to-absolute-glob@ts2.8", "@types/tough-cookie@ts2.8", "@types/trim@ts2.8", "@types/tryer@ts2.8", "@types/type-check@ts2.8", "@types/type-is@ts2.8", "@types/ua-parser-js@ts2.8", "@types/uglify-js@ts2.8", "@types/uglifyjs-webpack-plugin@ts2.8", "@types/underscore@ts2.8", "@types/uniq@ts2.8", "@types/uniqid@ts2.8", "@types/untildify@ts2.8", "@types/urijs@ts2.8", "@types/url-join@ts2.8", "@types/url-parse@ts2.8", "@types/url-regex@ts2.8", "@types/user-home@ts2.8", "@types/util-deprecate@ts2.8", "@types/util.promisify@ts2.8", "@types/utils-merge@ts2.8", "@types/uuid@ts2.8", "@types/vali-date@ts2.8", "@types/vary@ts2.8", "@types/verror@ts2.8", "@types/vinyl@ts2.8", "@types/vinyl-fs@ts2.8", "@types/warning@ts2.8", "@types/watch@ts2.8", "@types/watchpack@ts2.8", "@types/webpack-dev-middleware@ts2.8", "@types/webpack-sources@ts2.8", "@types/which@ts2.8", "@types/window-size@ts2.8", "@types/wrap-ansi@ts2.8", "@types/write-file-atomic@ts2.8", "@types/ws@ts2.8", "@types/xml2js@ts2.8", "@types/xmlbuilder@ts2.8", "@types/xtend@ts2.8", "@types/yallist@ts2.8", "@types/yargs@ts2.8", "@types/yauzl@ts2.8", "@types/yeoman-generator@ts2.8", "@types/zen-observable@ts2.8", "@types/react-content-loader@ts2.8"];
+ const expectedCommands = [
+ TI.getNpmCommandForInstallation(npmPath, tsVersion, packageNames, packageNames.length).command,
+ TI.getNpmCommandForInstallation(npmPath, tsVersion, packageNames, packageNames.length - Math.ceil(packageNames.length / 2)).command
+ ];
+ it("works when the command is too long to install all packages at once", () => {
+ const commands: string[] = [];
+ const hasError = TI.installNpmPackages(npmPath, tsVersion, packageNames, command => {
+ commands.push(command);
+ return false;
+ });
+ assert.isFalse(hasError);
+ assert.deepEqual(commands, expectedCommands, "commands");
+ });
+
+ it("installs remaining packages when one of the partial command fails", () => {
+ const commands: string[] = [];
+ const hasError = TI.installNpmPackages(npmPath, tsVersion, packageNames, command => {
+ commands.push(command);
+ return commands.length === 1;
+ });
+ assert.isTrue(hasError);
+ assert.deepEqual(commands, expectedCommands, "commands");
+ });
+ });
}
diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts
index 1f352cd6f39..ea59c10c83e 100644
--- a/src/lib/es5.d.ts
+++ b/src/lib/es5.d.ts
@@ -772,8 +772,7 @@ interface Date {
interface DateConstructor {
new(): Date;
- new(value: number): Date;
- new(value: string): Date;
+ new(value: number | string): Date;
new(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;
(): string;
readonly prototype: Date;
diff --git a/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl
index 3143f6671dd..c2b2cf32cde 100644
--- a/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl
+++ b/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl
@@ -3771,6 +3771,24 @@
+ -
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
-
@@ -3879,6 +3897,15 @@
+ -
+
+
+
+
+
+
+
+
-
@@ -5988,6 +6015,15 @@
+ -
+
+
+
+
+
+
+
+
-
diff --git a/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl
index 8c72ca29d98..1e9d7342817 100644
--- a/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl
+++ b/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl
@@ -642,6 +642,9 @@
-
+
+
+
@@ -903,18 +906,27 @@
-
+
+
+
-
+
+
+
-
+
+
+
@@ -939,6 +951,9 @@
-
+
+
+
@@ -966,6 +981,9 @@
-
+
+
+
@@ -984,6 +1002,9 @@
-
+
+
+
@@ -1002,18 +1023,27 @@
-
+
+
+
-
+
+
+
-
+
+
+
@@ -1524,6 +1554,9 @@
-
+
+
+
@@ -2151,18 +2184,27 @@
-
+
+
+
-
+
+
+
-
+
+
+
@@ -2475,12 +2517,18 @@
-
+
+
+
-
+
+
+
@@ -2664,6 +2712,9 @@
-
+
+
+
@@ -3714,6 +3765,27 @@
-
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
@@ -3825,6 +3897,12 @@
+ -
+
+
+
+
+
-
@@ -4032,12 +4110,18 @@
-
+
+
+
-
+
+
+
@@ -4239,6 +4323,9 @@
-
+
+
+
@@ -4356,6 +4443,9 @@
-
+
+
+
@@ -4851,6 +4941,9 @@
-
+
+
+
@@ -4950,12 +5043,18 @@
-
+
+
+
-
+
+
+
@@ -5853,6 +5952,9 @@
-
+
+
+
@@ -5910,6 +6012,12 @@
+ -
+
+
+
+
+
-
@@ -6756,6 +6864,9 @@
-
+
+
+
@@ -7500,6 +7611,9 @@
-
+
+
+
@@ -7821,6 +7935,9 @@
-
+
+
+
@@ -7836,6 +7953,9 @@
-
+
+
+
@@ -7896,12 +8016,18 @@
-
+
+
+
-
+
+
+
@@ -7986,6 +8112,9 @@
-
+
+
+
diff --git a/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl
index 6f458cd9d3e..db17f37967b 100644
--- a/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl
+++ b/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl
@@ -3780,6 +3780,24 @@
+ -
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
-
@@ -5997,6 +6015,12 @@
+ -
+
+
+
+
+
-
diff --git a/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl
index e5a04125bd7..58326d7ccb6 100644
--- a/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl
+++ b/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl
@@ -3768,6 +3768,24 @@
+ -
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
-
@@ -5982,6 +6000,12 @@
+ -
+
+
+
+
+
-
diff --git a/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl
index f46e427ce62..342918edc19 100644
--- a/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl
+++ b/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl
@@ -3780,6 +3780,24 @@
+ -
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
-
@@ -5997,6 +6015,12 @@
+ -
+
+
+
+
+
-
diff --git a/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl
index 0ced4a350ff..52881bd0f4e 100644
--- a/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl
+++ b/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl
@@ -651,6 +651,9 @@
-
+
+
+
@@ -912,18 +915,27 @@
-
+
+
+
-
+
+
+
-
+
+
+
@@ -948,6 +960,9 @@
-
+
+
+
@@ -996,6 +1011,9 @@
-
+
+
+
@@ -1014,12 +1032,18 @@
-
+
+
+
-
+
+
+
@@ -1539,6 +1563,9 @@
-
+
+
+
@@ -2166,18 +2193,27 @@
-
+
+
+
-
+
+
+
-
+
+
+
@@ -2490,12 +2526,18 @@
-
+
+
+
-
+
+
+
@@ -3732,6 +3774,27 @@
-
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
@@ -4050,6 +4113,9 @@
-
+
+
+
@@ -4260,6 +4326,9 @@
-
+
+
+
@@ -4377,6 +4446,9 @@
-
+
+
+
@@ -4872,6 +4944,9 @@
-
+
+
+
@@ -4971,12 +5046,18 @@
-
+
+
+
-
+
+
+
@@ -5874,6 +5955,9 @@
-
+
+
+
@@ -5931,6 +6015,12 @@
+ -
+
+
+
+
+
-
@@ -6777,6 +6867,9 @@
-
+
+
+
@@ -7521,6 +7614,9 @@
-
+
+
+
@@ -7842,6 +7938,9 @@
-
+
+
+
@@ -7857,6 +7956,9 @@
-
+
+
+
@@ -7917,12 +8019,18 @@
-
+
+
+
-
+
+
+
@@ -8007,6 +8115,9 @@
-
+
+
+
diff --git a/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl
index f8e4866205b..f68671fdc91 100644
--- a/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl
+++ b/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl
@@ -3771,6 +3771,24 @@
+ -
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
-
@@ -3879,6 +3897,15 @@
+ -
+
+
+
+
+
+
+
+
-
@@ -5988,6 +6015,15 @@
+ -
+
+
+
+
+
+
+
+
-
diff --git a/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl
index 59f1bbd4e46..a0f54926f3f 100644
--- a/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl
+++ b/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl
@@ -3771,6 +3771,24 @@
+ -
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
-
@@ -5988,6 +6006,12 @@
+ -
+
+
+
+
+
-
diff --git a/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl
index 71d0d0e0465..4b42ff8b2bf 100644
--- a/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl
+++ b/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl
@@ -3771,6 +3771,24 @@
+ -
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
-
@@ -5988,6 +6006,12 @@
+ -
+
+
+
+
+
-
diff --git a/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl
index 0d49920f8d9..36e67c41077 100644
--- a/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl
+++ b/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl
@@ -3761,6 +3761,24 @@
+ -
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
-
@@ -3869,6 +3887,15 @@
+ -
+
+
+
+
+
+
+
+
-
@@ -5975,6 +6002,15 @@
+ -
+
+
+
+
+
+
+
+
-
diff --git a/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl
index 5950b7b8a0b..473da1a4a01 100644
--- a/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl
+++ b/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl
@@ -2702,6 +2702,9 @@
-
+
+
+
@@ -3758,6 +3761,24 @@
+ -
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
-
@@ -5912,6 +5933,9 @@
-
+
+
+
@@ -5969,6 +5993,12 @@
+ -
+
+
+
+
+
-
diff --git a/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl
index 20c3ffba771..b341aa7ea84 100644
--- a/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl
+++ b/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl
@@ -3770,6 +3770,24 @@
+ -
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
-
@@ -5987,6 +6005,12 @@
+ -
+
+
+
+
+
-
diff --git a/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl
index 5a9ac5ff177..1ac1d8a83e6 100644
--- a/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl
+++ b/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl
@@ -632,6 +632,15 @@
+ -
+
+
+
+
+
+
+
+
-
@@ -890,18 +899,27 @@
-
+
+
+
-
+
+
+
-
+
+
+
@@ -926,6 +944,9 @@
-
+
+
+
@@ -953,6 +974,9 @@
-
+
+
+
@@ -971,6 +995,9 @@
-
+
+
+
@@ -989,18 +1016,27 @@
-
+
+
+
-
+
+
+
-
+
+
+
@@ -1511,6 +1547,9 @@
-
+
+
+
@@ -2138,18 +2177,27 @@
-
+
+
+
-
+
+
+
-
+
+
+
@@ -2462,12 +2510,18 @@
-
+
+
+
-
+
+
+
@@ -2651,6 +2705,9 @@
-
+
+
+
@@ -3701,6 +3758,27 @@
-
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
@@ -4019,12 +4097,18 @@
-
+
+
+
-
+
+
+
@@ -4226,6 +4310,9 @@
-
+
+
+
@@ -4343,6 +4430,9 @@
-
+
+
+
@@ -4838,6 +4928,9 @@
-
+
+
+
@@ -4934,6 +5027,24 @@
+ -
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
-
@@ -5828,6 +5939,9 @@
-
+
+
+
@@ -5885,6 +5999,12 @@
+ -
+
+
+
+
+
-
@@ -6731,6 +6851,9 @@
-
+
+
+
@@ -7472,11 +7595,11 @@
- -
+
-
-
+
-
+
@@ -7796,6 +7919,15 @@
+ -
+
+
+
+
+
+
+
+
-
@@ -7805,6 +7937,15 @@
+ -
+
+
+
+
+
+
+
+
-
@@ -7859,6 +8000,24 @@
+ -
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
-
@@ -7937,6 +8096,15 @@
+ -
+
+
+
+
+
+
+
+
-
@@ -7964,24 +8132,6 @@
- -
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
diff --git a/src/server/client.ts b/src/server/client.ts
index 87bb2e93414..2238734e90c 100644
--- a/src/server/client.ts
+++ b/src/server/client.ts
@@ -1,5 +1,3 @@
-///
-
namespace ts.server {
export interface SessionClientHost extends LanguageServiceHost {
writeMessage(message: string): void;
@@ -558,7 +556,8 @@ namespace ts.server {
const request = this.processRequest(CommandNames.GetCodeFixes, args);
const response = this.processResponse(request);
- return response.body.map(({ description, changes, fixId, fixAllDescription }) => ({ description, changes: this.convertChanges(changes, file), fixId, fixAllDescription }));
+ return response.body.map(({ fixName, description, changes, commands, fixId, fixAllDescription }) =>
+ ({ fixName, description, changes: this.convertChanges(changes, file), commands: commands as CodeActionCommand[], fixId, fixAllDescription }));
}
getCombinedCodeFix = notImplemented;
diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts
index 09c5e784ba8..1f8f9d3b21b 100644
--- a/src/server/editorServices.ts
+++ b/src/server/editorServices.ts
@@ -1,11 +1,3 @@
-///
-///
-///
-///
-///
-///
-///
-
namespace ts.server {
export const maxProgramSizeForNonTsFiles = 20 * 1024 * 1024;
@@ -392,6 +384,7 @@ namespace ts.server {
public readonly useSingleInferredProject: boolean;
public readonly useInferredProjectPerProjectRoot: boolean;
public readonly typingsInstaller: ITypingsInstaller;
+ private readonly globalCacheLocationDirectoryPath: Path;
public readonly throttleWaitMilliseconds?: number;
private readonly eventHandler?: ProjectServiceEventHandler;
private readonly suppressDiagnosticEvents?: boolean;
@@ -431,6 +424,8 @@ namespace ts.server {
}
this.currentDirectory = this.host.getCurrentDirectory();
this.toCanonicalFileName = createGetCanonicalFileName(this.host.useCaseSensitiveFileNames);
+ this.globalCacheLocationDirectoryPath = this.typingsInstaller.globalTypingsCacheLocation &&
+ ensureTrailingDirectorySeparator(this.toPath(this.typingsInstaller.globalTypingsCacheLocation));
this.throttledOperations = new ThrottledOperations(this.host, this.logger);
if (this.typesMapLocation) {
@@ -548,10 +543,11 @@ namespace ts.server {
else {
if (this.pendingEnsureProjectForOpenFiles) {
this.ensureProjectForOpenFiles();
+
+ // Send the event to notify that there were background project updates
+ // send current list of open files
+ this.sendProjectsUpdatedInBackgroundEvent();
}
- // Send the event to notify that there were background project updates
- // send current list of open files
- this.sendProjectsUpdatedInBackgroundEvent();
}
});
}
@@ -642,7 +638,6 @@ namespace ts.server {
return undefined;
}
if (isInferredProjectName(projectName)) {
- this.ensureProjectStructuresUptoDate();
return findProjectByName(projectName, this.inferredProjects);
}
return this.findExternalProjectByProjectName(projectName) || this.findConfiguredProjectByProjectName(toNormalizedPath(projectName));
@@ -1738,7 +1733,10 @@ namespace ts.server {
private watchClosedScriptInfo(info: ScriptInfo) {
Debug.assert(!info.fileWatcher);
// do not watch files with mixed content - server doesn't know how to interpret it
- if (!info.isDynamicOrHasMixedContent()) {
+ // do not watch files in the global cache location
+ if (!info.isDynamicOrHasMixedContent() &&
+ (!this.globalCacheLocationDirectoryPath ||
+ !startsWith(info.path, this.globalCacheLocationDirectoryPath))) {
const { fileName } = info;
info.fileWatcher = this.watchFactory.watchFilePath(
this.host,
@@ -1836,11 +1834,11 @@ namespace ts.server {
this.logger.info(`Host information ${args.hostInfo}`);
}
if (args.formatOptions) {
- mergeMapLikes(this.hostConfiguration.formatCodeOptions, convertFormatOptions(args.formatOptions));
+ this.hostConfiguration.formatCodeOptions = { ...this.hostConfiguration.formatCodeOptions, ...convertFormatOptions(args.formatOptions) };
this.logger.info("Format host information updated");
}
if (args.preferences) {
- mergeMapLikes(this.hostConfiguration.preferences, args.preferences);
+ this.hostConfiguration.preferences = { ...this.hostConfiguration.preferences, ...args.preferences };
}
if (args.extraFileExtensions) {
this.hostConfiguration.extraFileExtensions = args.extraFileExtensions;
diff --git a/src/server/project.ts b/src/server/project.ts
index 442c7e3f5ad..1502d107dee 100644
--- a/src/server/project.ts
+++ b/src/server/project.ts
@@ -1,10 +1,3 @@
-///
-///
-///
-///
-///
-///
-
namespace ts.server {
export enum ProjectKind {
diff --git a/src/server/protocol.ts b/src/server/protocol.ts
index 98d10e4e407..42e094cce6b 100644
--- a/src/server/protocol.ts
+++ b/src/server/protocol.ts
@@ -1698,6 +1698,8 @@ namespace ts.server.protocol {
}
export interface CodeFixAction extends CodeAction {
+ /** Short name to identify the fix, for use by telemetry. */
+ fixName: string;
/**
* If present, one may call 'getCombinedCodeFix' with this fixId.
* This may be omitted to indicate that the code fix can't be applied in a group.
@@ -2172,6 +2174,8 @@ namespace ts.server.protocol {
*/
category: string;
+ reportsUnnecessary?: {};
+
/**
* The error code of the diagnostic message.
*/
@@ -2638,6 +2642,7 @@ namespace ts.server.protocol {
}
export interface UserPreferences {
+ readonly disableSuggestions?: boolean;
readonly quotePreference?: "double" | "single";
/**
* If enabled, TypeScript will search through all external modules' exports and add them to the completions list.
diff --git a/src/server/scriptInfo.ts b/src/server/scriptInfo.ts
index 843122e44c0..db56973d796 100644
--- a/src/server/scriptInfo.ts
+++ b/src/server/scriptInfo.ts
@@ -1,5 +1,3 @@
-///
-
namespace ts.server {
/* @internal */
@@ -397,15 +395,18 @@ namespace ts.server {
if (formatSettings) {
if (!this.formatSettings) {
this.formatSettings = getDefaultFormatCodeSettings(this.host);
+ assign(this.formatSettings, formatSettings);
+ }
+ else {
+ this.formatSettings = { ...this.formatSettings, ...formatSettings };
}
- mergeMapLikes(this.formatSettings, formatSettings);
}
if (preferences) {
if (!this.preferences) {
- this.preferences = clone(defaultPreferences);
+ this.preferences = defaultPreferences;
}
- mergeMapLikes(this.preferences, preferences);
+ this.preferences = { ...this.preferences, ...preferences };
}
}
diff --git a/src/server/scriptVersionCache.ts b/src/server/scriptVersionCache.ts
index 8a3f43a5434..d57f296e7a7 100644
--- a/src/server/scriptVersionCache.ts
+++ b/src/server/scriptVersionCache.ts
@@ -1,7 +1,3 @@
-///
-///
-///
-
/*@internal*/
namespace ts.server {
const lineCollectionCapacity = 4;
diff --git a/src/server/server.ts b/src/server/server.ts
index d863fe0bde6..6eff3256349 100644
--- a/src/server/server.ts
+++ b/src/server/server.ts
@@ -1,6 +1,3 @@
-///
-///
-
namespace ts.server {
const childProcess: {
fork(modulePath: string, args: string[], options?: { execArgv: string[], env?: MapLike }): NodeChildProcess;
@@ -211,12 +208,6 @@ namespace ts.server {
}
}
- // E.g. "12:34:56.789"
- function nowString() {
- const d = new Date();
- return `${d.getHours()}:${d.getMinutes()}:${d.getSeconds()}.${d.getMilliseconds()}`;
- }
-
interface QueuedOperation {
operationId: string;
operation: () => void;
diff --git a/src/server/session.ts b/src/server/session.ts
index 1c5abc8a96b..1076d17e11f 100644
--- a/src/server/session.ts
+++ b/src/server/session.ts
@@ -1,8 +1,3 @@
-///
-///
-///
-///
-
namespace ts.server {
interface StackTraceError extends Error {
stack?: string;
@@ -80,6 +75,7 @@ namespace ts.server {
text: flattenDiagnosticMessageText(diag.messageText, "\n"),
code: diag.code,
category: diagnosticCategoryName(diag),
+ reportsUnnecessary: diag.reportsUnnecessary,
source: diag.source
};
}
@@ -96,8 +92,8 @@ namespace ts.server {
const text = flattenDiagnosticMessageText(diag.messageText, "\n");
const { code, source } = diag;
const category = diagnosticCategoryName(diag);
- return includeFileName ? { start, end, text, code, category, source, fileName: diag.file && diag.file.fileName } :
- { start, end, text, code, category, source };
+ return includeFileName ? { start, end, text, code, category, source, reportsUnnecessary: diag.reportsUnnecessary, fileName: diag.file && diag.file.fileName } :
+ { start, end, text, code, category, reportsUnnecessary: diag.reportsUnnecessary, source };
}
export interface PendingErrorCheck {
@@ -484,7 +480,7 @@ namespace ts.server {
this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSyntacticDiagnostics(file), "syntaxDiag");
}
- private infoCheck(file: NormalizedPath, project: Project) {
+ private suggestionCheck(file: NormalizedPath, project: Project) {
this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSuggestionDiagnostics(file), "suggestionDiag");
}
@@ -527,12 +523,20 @@ namespace ts.server {
return;
}
- next.immediate(() => {
- this.infoCheck(fileName, project);
+ const goNext = () => {
if (checkList.length > index) {
next.delay(followMs, checkOne);
}
- });
+ };
+ if (this.getPreferences(fileName).disableSuggestions) {
+ goNext();
+ }
+ else {
+ next.immediate(() => {
+ this.suggestionCheck(fileName, project);
+ goNext();
+ });
+ }
});
};
@@ -1659,7 +1663,7 @@ namespace ts.server {
}
}
- private getCodeFixes(args: protocol.CodeFixRequestArgs, simplifiedResult: boolean): ReadonlyArray | ReadonlyArray {
+ private getCodeFixes(args: protocol.CodeFixRequestArgs, simplifiedResult: boolean): ReadonlyArray | ReadonlyArray {
if (args.errorCodes.length === 0) {
return undefined;
}
@@ -1669,15 +1673,7 @@ namespace ts.server {
const { startPosition, endPosition } = this.getStartAndEndPosition(args, scriptInfo);
const codeActions = project.getLanguageService().getCodeFixesAtPosition(file, startPosition, endPosition, args.errorCodes, this.getFormatOptions(file), this.getPreferences(file));
- if (!codeActions) {
- return undefined;
- }
- if (simplifiedResult) {
- return codeActions.map(codeAction => this.mapCodeAction(project, codeAction));
- }
- else {
- return codeActions;
- }
+ return simplifiedResult ? codeActions.map(codeAction => this.mapCodeFixAction(project, codeAction)) : codeActions;
}
private getCombinedCodeFix({ scope, fixId }: protocol.GetCombinedCodeFixRequestArgs, simplifiedResult: boolean): protocol.CombinedCodeActions | CombinedCodeActions {
@@ -1725,9 +1721,12 @@ namespace ts.server {
return { startPosition, endPosition };
}
- private mapCodeAction(project: Project, { description, changes: unmappedChanges, commands, fixId, fixAllDescription }: CodeFixAction): protocol.CodeFixAction {
- const changes = unmappedChanges.map(change => this.mapTextChangesToCodeEditsUsingScriptinfo(change, project.getScriptInfoForNormalizedPath(toNormalizedPath(change.fileName))));
- return { description, changes, commands, fixId, fixAllDescription };
+ private mapCodeAction(project: Project, { description, changes, commands }: CodeAction): protocol.CodeAction {
+ return { description, changes: this.mapTextChangesToCodeEdits(project, changes), commands };
+ }
+
+ private mapCodeFixAction(project: Project, { fixName, description, changes, commands, fixId, fixAllDescription }: CodeFixAction): protocol.CodeFixAction {
+ return { fixName, description, changes: this.mapTextChangesToCodeEdits(project, changes), commands, fixId, fixAllDescription };
}
private mapTextChangesToCodeEdits(project: Project, textChanges: ReadonlyArray): protocol.FileCodeEdits[] {
diff --git a/src/server/shared.ts b/src/server/shared.ts
index e8b64ce06ec..a5528b7ba63 100644
--- a/src/server/shared.ts
+++ b/src/server/shared.ts
@@ -1,5 +1,3 @@
-///
-
namespace ts.server {
// tslint:disable variable-name
export const ActionSet: ActionSet = "action::set";
@@ -33,4 +31,11 @@ namespace ts.server {
? sys.args[index + 1]
: undefined;
}
-}
\ No newline at end of file
+
+ /*@internal*/
+ export function nowString() {
+ // E.g. "12:34:56.789"
+ const d = new Date();
+ return `${d.getHours()}:${d.getMinutes()}:${d.getSeconds()}.${d.getMilliseconds()}`;
+ }
+}
diff --git a/src/server/tsconfig.json b/src/server/tsconfig.json
index c838a7209d9..fe19cd418bd 100644
--- a/src/server/tsconfig.json
+++ b/src/server/tsconfig.json
@@ -9,17 +9,125 @@
]
},
"files": [
- "../services/shims.ts",
+ "../compiler/types.ts",
+ "../compiler/performance.ts",
+ "../compiler/core.ts",
+ "../compiler/sys.ts",
+ "../compiler/diagnosticInformationMap.generated.ts",
+ "../compiler/scanner.ts",
+ "../compiler/utilities.ts",
+ "../compiler/parser.ts",
+ "../compiler/binder.ts",
+ "../compiler/symbolWalker.ts",
+ "../compiler/moduleNameResolver.ts",
+ "../compiler/checker.ts",
+ "../compiler/factory.ts",
+ "../compiler/visitor.ts",
+ "../compiler/transformers/utilities.ts",
+ "../compiler/transformers/destructuring.ts",
+ "../compiler/transformers/ts.ts",
+ "../compiler/transformers/es2017.ts",
+ "../compiler/transformers/esnext.ts",
+ "../compiler/transformers/jsx.ts",
+ "../compiler/transformers/es2016.ts",
+ "../compiler/transformers/es2015.ts",
+ "../compiler/transformers/es5.ts",
+ "../compiler/transformers/generators.ts",
+ "../compiler/transformers/module/module.ts",
+ "../compiler/transformers/module/system.ts",
+ "../compiler/transformers/module/es2015.ts",
+ "../compiler/transformers/declarations/diagnostics.ts",
+ "../compiler/transformers/declarations.ts",
+ "../compiler/transformer.ts",
+ "../compiler/sourcemap.ts",
+ "../compiler/comments.ts",
+ "../compiler/emitter.ts",
+ "../compiler/watchUtilities.ts",
+ "../compiler/program.ts",
+ "../compiler/builderState.ts",
+ "../compiler/builder.ts",
+ "../compiler/resolutionCache.ts",
+ "../compiler/watch.ts",
+ "../compiler/commandLineParser.ts",
+
+ "../services/types.ts",
"../services/utilities.ts",
+ "../services/classifier.ts",
+ "../services/pathCompletions.ts",
+ "../services/completions.ts",
+ "../services/documentHighlights.ts",
+ "../services/documentRegistry.ts",
+ "../services/importTracker.ts",
+ "../services/findAllReferences.ts",
+ "../services/goToDefinition.ts",
+ "../services/jsDoc.ts",
+ "../services/semver.ts",
+ "../services/jsTyping.ts",
+ "../services/navigateTo.ts",
+ "../services/navigationBar.ts",
+ "../services/organizeImports.ts",
+ "../services/outliningElementsCollector.ts",
+ "../services/patternMatcher.ts",
+ "../services/preProcess.ts",
+ "../services/rename.ts",
+ "../services/signatureHelp.ts",
+ "../services/suggestionDiagnostics.ts",
+ "../services/symbolDisplay.ts",
+ "../services/transpile.ts",
+ "../services/formatting/formattingContext.ts",
+ "../services/formatting/formattingScanner.ts",
+ "../services/formatting/rule.ts",
+ "../services/formatting/rules.ts",
+ "../services/formatting/rulesMap.ts",
+ "../services/formatting/formatting.ts",
+ "../services/formatting/smartIndenter.ts",
+ "../services/textChanges.ts",
+ "../services/codeFixProvider.ts",
+ "../services/refactorProvider.ts",
+ "../services/codefixes/addMissingInvocationForDecorator.ts",
+ "../services/codefixes/annotateWithTypeFromJSDoc.ts",
+ "../services/codefixes/convertFunctionToEs6Class.ts",
+ "../services/codefixes/convertToEs6Module.ts",
+ "../services/codefixes/correctQualifiedNameToIndexedAccessType.ts",
+ "../services/codefixes/fixClassIncorrectlyImplementsInterface.ts",
+ "../services/codefixes/importFixes.ts",
+ "../services/codefixes/fixSpelling.ts",
+ "../services/codefixes/fixAddMissingMember.ts",
+ "../services/codefixes/fixCannotFindModule.ts",
+ "../services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts",
+ "../services/codefixes/fixClassSuperMustPrecedeThisAccess.ts",
+ "../services/codefixes/fixConstructorForDerivedNeedSuperCall.ts",
+ "../services/codefixes/fixExtendsInterfaceBecomesImplements.ts",
+ "../services/codefixes/fixForgottenThisPropertyAccess.ts",
+ "../services/codefixes/fixUnusedIdentifier.ts",
+ "../services/codefixes/fixJSDocTypes.ts",
+ "../services/codefixes/fixAwaitInSyncFunction.ts",
+ "../services/codefixes/disableJsDiagnostics.ts",
+ "../services/codefixes/helpers.ts",
+ "../services/codefixes/inferFromUsage.ts",
+ "../services/codefixes/fixInvalidImportSyntax.ts",
+ "../services/codefixes/fixStrictClassInitialization.ts",
+ "../services/codefixes/useDefaultImport.ts",
+ "../services/codefixes/fixes.ts",
+ "../services/refactors/extractSymbol.ts",
+ "../services/refactors/generateGetAccessorAndSetAccessor.ts",
+ "../services/refactors/refactors.ts",
+ "../services/sourcemaps.ts",
+ "../services/services.ts",
+ "../services/breakpoints.ts",
+ "../services/transform.ts",
+ "../services/shims.ts",
+
+ "types.ts",
"shared.ts",
"utilities.ts",
- "scriptVersionCache.ts",
+ "protocol.ts",
"scriptInfo.ts",
"typingsCache.ts",
"project.ts",
"editorServices.ts",
- "protocol.ts",
"session.ts",
+ "scriptVersionCache.ts",
"server.ts"
]
}
diff --git a/src/server/tsconfig.library.json b/src/server/tsconfig.library.json
index aa3148d58a1..54353daf5c6 100644
--- a/src/server/tsconfig.library.json
+++ b/src/server/tsconfig.library.json
@@ -15,17 +15,124 @@
"types": []
},
"files": [
- "editorServices.ts",
- "project.ts",
+ "../compiler/types.ts",
+ "../compiler/performance.ts",
+ "../compiler/core.ts",
+ "../compiler/sys.ts",
+ "../compiler/diagnosticInformationMap.generated.ts",
+ "../compiler/scanner.ts",
+ "../compiler/utilities.ts",
+ "../compiler/parser.ts",
+ "../compiler/binder.ts",
+ "../compiler/symbolWalker.ts",
+ "../compiler/moduleNameResolver.ts",
+ "../compiler/checker.ts",
+ "../compiler/factory.ts",
+ "../compiler/visitor.ts",
+ "../compiler/transformers/utilities.ts",
+ "../compiler/transformers/destructuring.ts",
+ "../compiler/transformers/ts.ts",
+ "../compiler/transformers/es2017.ts",
+ "../compiler/transformers/esnext.ts",
+ "../compiler/transformers/jsx.ts",
+ "../compiler/transformers/es2016.ts",
+ "../compiler/transformers/es2015.ts",
+ "../compiler/transformers/es5.ts",
+ "../compiler/transformers/generators.ts",
+ "../compiler/transformers/module/module.ts",
+ "../compiler/transformers/module/system.ts",
+ "../compiler/transformers/module/es2015.ts",
+ "../compiler/transformers/declarations/diagnostics.ts",
+ "../compiler/transformers/declarations.ts",
+ "../compiler/transformer.ts",
+ "../compiler/sourcemap.ts",
+ "../compiler/comments.ts",
+ "../compiler/emitter.ts",
+ "../compiler/watchUtilities.ts",
+ "../compiler/program.ts",
+ "../compiler/builderState.ts",
+ "../compiler/builder.ts",
+ "../compiler/resolutionCache.ts",
+ "../compiler/watch.ts",
+ "../compiler/commandLineParser.ts",
+
+ "../services/types.ts",
+ "../services/utilities.ts",
+ "../services/classifier.ts",
+ "../services/pathCompletions.ts",
+ "../services/completions.ts",
+ "../services/documentHighlights.ts",
+ "../services/documentRegistry.ts",
+ "../services/importTracker.ts",
+ "../services/findAllReferences.ts",
+ "../services/goToDefinition.ts",
+ "../services/jsDoc.ts",
+ "../services/semver.ts",
+ "../services/jsTyping.ts",
+ "../services/navigateTo.ts",
+ "../services/navigationBar.ts",
+ "../services/organizeImports.ts",
+ "../services/outliningElementsCollector.ts",
+ "../services/patternMatcher.ts",
+ "../services/preProcess.ts",
+ "../services/rename.ts",
+ "../services/signatureHelp.ts",
+ "../services/suggestionDiagnostics.ts",
+ "../services/symbolDisplay.ts",
+ "../services/transpile.ts",
+ "../services/formatting/formattingContext.ts",
+ "../services/formatting/formattingScanner.ts",
+ "../services/formatting/rule.ts",
+ "../services/formatting/rules.ts",
+ "../services/formatting/rulesMap.ts",
+ "../services/formatting/formatting.ts",
+ "../services/formatting/smartIndenter.ts",
+ "../services/textChanges.ts",
+ "../services/codeFixProvider.ts",
+ "../services/refactorProvider.ts",
+ "../services/codefixes/addMissingInvocationForDecorator.ts",
+ "../services/codefixes/annotateWithTypeFromJSDoc.ts",
+ "../services/codefixes/convertFunctionToEs6Class.ts",
+ "../services/codefixes/convertToEs6Module.ts",
+ "../services/codefixes/correctQualifiedNameToIndexedAccessType.ts",
+ "../services/codefixes/fixClassIncorrectlyImplementsInterface.ts",
+ "../services/codefixes/importFixes.ts",
+ "../services/codefixes/fixSpelling.ts",
+ "../services/codefixes/fixAddMissingMember.ts",
+ "../services/codefixes/fixCannotFindModule.ts",
+ "../services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts",
+ "../services/codefixes/fixClassSuperMustPrecedeThisAccess.ts",
+ "../services/codefixes/fixConstructorForDerivedNeedSuperCall.ts",
+ "../services/codefixes/fixExtendsInterfaceBecomesImplements.ts",
+ "../services/codefixes/fixForgottenThisPropertyAccess.ts",
+ "../services/codefixes/fixUnusedIdentifier.ts",
+ "../services/codefixes/fixJSDocTypes.ts",
+ "../services/codefixes/fixAwaitInSyncFunction.ts",
+ "../services/codefixes/disableJsDiagnostics.ts",
+ "../services/codefixes/helpers.ts",
+ "../services/codefixes/inferFromUsage.ts",
+ "../services/codefixes/fixInvalidImportSyntax.ts",
+ "../services/codefixes/fixStrictClassInitialization.ts",
+ "../services/codefixes/useDefaultImport.ts",
+ "../services/codefixes/fixes.ts",
+ "../services/refactors/extractSymbol.ts",
+ "../services/refactors/generateGetAccessorAndSetAccessor.ts",
+ "../services/refactors/refactors.ts",
+ "../services/sourcemaps.ts",
+ "../services/services.ts",
+ "../services/breakpoints.ts",
+ "../services/transform.ts",
+ "../services/shims.ts",
+
+ "types.ts",
+ "shared.ts",
+ "utilities.ts",
"protocol.ts",
"scriptInfo.ts",
- "scriptVersionCache.ts",
- "session.ts",
- "shared.ts",
- "types.ts",
"typingsCache.ts",
- "utilities.ts",
- "../services/shims.ts",
- "../services/utilities.ts"
+ "project.ts",
+ "editorServices.ts",
+ "session.ts",
+ "scriptVersionCache.ts"
]
}
diff --git a/src/server/types.ts b/src/server/types.ts
index 617a3be419a..d4ddd81c53e 100644
--- a/src/server/types.ts
+++ b/src/server/types.ts
@@ -1,7 +1,3 @@
-///
-///
-///
-
declare namespace ts.server {
export interface CompressedData {
length: number;
diff --git a/src/server/typingsCache.ts b/src/server/typingsCache.ts
index a1d8f65f6e0..f2642230f2d 100644
--- a/src/server/typingsCache.ts
+++ b/src/server/typingsCache.ts
@@ -1,5 +1,3 @@
-///
-
namespace ts.server {
export interface InstallPackageOptionsWithProject extends InstallPackageOptions {
projectName: string;
diff --git a/src/server/typingsInstaller/nodeTypingsInstaller.ts b/src/server/typingsInstaller/nodeTypingsInstaller.ts
index 018dac7ec10..35f926f1c14 100644
--- a/src/server/typingsInstaller/nodeTypingsInstaller.ts
+++ b/src/server/typingsInstaller/nodeTypingsInstaller.ts
@@ -21,7 +21,7 @@ namespace ts.server.typingsInstaller {
}
writeLine = (text: string) => {
try {
- fs.appendFileSync(this.logFile, text + sys.newLine);
+ fs.appendFileSync(this.logFile, `[${nowString()}] ${text}${sys.newLine}`);
}
catch (e) {
this.logEnabled = false;
@@ -184,9 +184,8 @@ namespace ts.server.typingsInstaller {
if (this.log.isEnabled()) {
this.log.writeLine(`#${requestId} with arguments'${JSON.stringify(packageNames)}'.`);
}
- const command = `${this.npmPath} install --ignore-scripts ${packageNames.join(" ")} --save-dev --user-agent="typesInstaller/${version}"`;
const start = Date.now();
- const hasError = this.execSyncAndLog(command, { cwd });
+ const hasError = installNpmPackages(this.npmPath, version, packageNames, command => this.execSyncAndLog(command, { cwd }));
if (this.log.isEnabled()) {
this.log.writeLine(`npm install #${requestId} took: ${Date.now() - start} ms`);
}
diff --git a/src/server/typingsInstaller/typingsInstaller.ts b/src/server/typingsInstaller/typingsInstaller.ts
index f87e6d7e8ab..8d482241d1b 100644
--- a/src/server/typingsInstaller/typingsInstaller.ts
+++ b/src/server/typingsInstaller/typingsInstaller.ts
@@ -30,6 +30,31 @@ namespace ts.server.typingsInstaller {
}
}
+ /*@internal*/
+ export function installNpmPackages(npmPath: string, tsVersion: string, packageNames: string[], install: (command: string) => boolean) {
+ let hasError = false;
+ for (let remaining = packageNames.length; remaining > 0;) {
+ const result = getNpmCommandForInstallation(npmPath, tsVersion, packageNames, remaining);
+ remaining = result.remaining;
+ hasError = install(result.command) || hasError;
+ }
+ return hasError;
+ }
+
+ /*@internal*/
+ export function getNpmCommandForInstallation(npmPath: string, tsVersion: string, packageNames: string[], remaining: number) {
+ const sliceStart = packageNames.length - remaining;
+ let command: string, toSlice = remaining;
+ while (true) {
+ command = `${npmPath} install --ignore-scripts ${(toSlice === packageNames.length ? packageNames : packageNames.slice(sliceStart, sliceStart + toSlice)).join(" ")} --save-dev --user-agent="typesInstaller/${tsVersion}"`;
+ if (command.length < 8000) {
+ break;
+ }
+
+ toSlice = toSlice - Math.floor(toSlice / 2);
+ }
+ return { command, remaining: remaining - toSlice };
+ }
export type RequestCompletedAction = (success: boolean) => void;
interface PendingRequest {
diff --git a/src/server/utilities.ts b/src/server/utilities.ts
index e2329b868e3..363393d401e 100644
--- a/src/server/utilities.ts
+++ b/src/server/utilities.ts
@@ -1,6 +1,3 @@
-///
-///
-
namespace ts.server {
export enum LogLevel {
terse,
@@ -83,14 +80,6 @@ namespace ts.server {
};
}
- export function mergeMapLikes(target: T, source: Partial): void {
- for (const key in source) {
- if (hasProperty(source, key)) {
- target[key] = source[key];
- }
- }
- }
-
export type NormalizedPath = string & { __normalizedPathTag: any };
export function toNormalizedPath(fileName: string): NormalizedPath {
diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts
index c608028b55f..faab2b08db6 100644
--- a/src/services/breakpoints.ts
+++ b/src/services/breakpoints.ts
@@ -1,8 +1,3 @@
-// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0.
-// See LICENSE.txt in the project root for complete license information.
-
-///
-
/* @internal */
namespace ts.BreakpointResolver {
/**
diff --git a/src/services/codeFixProvider.ts b/src/services/codeFixProvider.ts
index 291f8fd1d66..39f760ba04c 100644
--- a/src/services/codeFixProvider.ts
+++ b/src/services/codeFixProvider.ts
@@ -24,7 +24,7 @@ namespace ts {
}
export namespace codefix {
- const codeFixRegistrations: CodeFixRegistration[][] = [];
+ const errorCodeToFixes = createMultiMap();
const fixIdToRegistration = createMap();
type DiagnosticAndArguments = DiagnosticMessage | [DiagnosticMessage, string] | [DiagnosticMessage, string, string];
@@ -34,26 +34,21 @@ namespace ts {
: getLocaleSpecificMessage(diag);
}
- export function createCodeFixActionNoFixId(changes: FileTextChanges[], description: DiagnosticAndArguments) {
- return createCodeFixActionWorker(diagnosticToString(description), changes, /*fixId*/ undefined, /*fixAllDescription*/ undefined);
+ export function createCodeFixActionNoFixId(fixName: string, changes: FileTextChanges[], description: DiagnosticAndArguments) {
+ return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, /*fixId*/ undefined, /*fixAllDescription*/ undefined);
}
- export function createCodeFixAction(changes: FileTextChanges[], description: DiagnosticAndArguments, fixId: {}, fixAllDescription: DiagnosticAndArguments, command?: CodeActionCommand): CodeFixAction {
- return createCodeFixActionWorker(diagnosticToString(description), changes, fixId, diagnosticToString(fixAllDescription), command);
+ export function createCodeFixAction(fixName: string, changes: FileTextChanges[], description: DiagnosticAndArguments, fixId: {}, fixAllDescription: DiagnosticAndArguments, command?: CodeActionCommand): CodeFixAction {
+ return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, fixId, diagnosticToString(fixAllDescription), command);
}
- function createCodeFixActionWorker(description: string, changes: FileTextChanges[], fixId?: {}, fixAllDescription?: string, command?: CodeActionCommand): CodeFixAction {
- return { description, changes, fixId, fixAllDescription, commands: command ? [command] : undefined };
+ function createCodeFixActionWorker(fixName: string, description: string, changes: FileTextChanges[], fixId?: {}, fixAllDescription?: string, command?: CodeActionCommand): CodeFixAction {
+ return { fixName, description, changes, fixId, fixAllDescription, commands: command ? [command] : undefined };
}
export function registerCodeFix(reg: CodeFixRegistration) {
for (const error of reg.errorCodes) {
- let registrations = codeFixRegistrations[error];
- if (!registrations) {
- registrations = [];
- codeFixRegistrations[error] = registrations;
- }
- registrations.push(reg);
+ errorCodeToFixes.add(String(error), reg);
}
if (reg.fixIds) {
for (const fixId of reg.fixIds) {
@@ -63,29 +58,12 @@ namespace ts {
}
}
- export function getSupportedErrorCodes() {
- return Object.keys(codeFixRegistrations);
+ export function getSupportedErrorCodes(): string[] {
+ return arrayFrom(errorCodeToFixes.keys());
}
export function getFixes(context: CodeFixContext): CodeFixAction[] {
- const fixes = codeFixRegistrations[context.errorCode];
- const allActions: CodeFixAction[] = [];
-
- forEach(fixes, f => {
- const actions = f.getCodeActions(context);
- if (actions && actions.length > 0) {
- for (const action of actions) {
- if (action === undefined) {
- context.host.log(`Action for error code ${context.errorCode} added an invalid action entry; please log a bug`);
- }
- else {
- allActions.push(action);
- }
- }
- }
- });
-
- return allActions;
+ return flatMap(errorCodeToFixes.get(String(context.errorCode)) || emptyArray, f => f.getCodeActions(context));
}
export function getAllFixes(context: CodeFixAllContext): CombinedCodeActions {
diff --git a/src/services/codefixes/addMissingInvocationForDecorator.ts b/src/services/codefixes/addMissingInvocationForDecorator.ts
index 7b8a7d05fe7..ead64f9a2ca 100644
--- a/src/services/codefixes/addMissingInvocationForDecorator.ts
+++ b/src/services/codefixes/addMissingInvocationForDecorator.ts
@@ -6,7 +6,7 @@ namespace ts.codefix {
errorCodes,
getCodeActions: (context) => {
const changes = textChanges.ChangeTracker.with(context, t => makeChange(t, context.sourceFile, context.span.start));
- return [createCodeFixAction(changes, Diagnostics.Call_decorator_expression, fixId, Diagnostics.Add_to_all_uncalled_decorators)];
+ return [createCodeFixAction(fixId, changes, Diagnostics.Call_decorator_expression, fixId, Diagnostics.Add_to_all_uncalled_decorators)];
},
fixIds: [fixId],
getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => makeChange(changes, diag.file!, diag.start!)),
diff --git a/src/services/codefixes/annotateWithTypeFromJSDoc.ts b/src/services/codefixes/annotateWithTypeFromJSDoc.ts
index c8a3977eb3b..5b809452677 100644
--- a/src/services/codefixes/annotateWithTypeFromJSDoc.ts
+++ b/src/services/codefixes/annotateWithTypeFromJSDoc.ts
@@ -8,7 +8,7 @@ namespace ts.codefix {
const decl = getDeclaration(context.sourceFile, context.span.start);
if (!decl) return;
const changes = textChanges.ChangeTracker.with(context, t => doChange(t, context.sourceFile, decl));
- return [createCodeFixAction(changes, Diagnostics.Annotate_with_type_from_JSDoc, fixId, Diagnostics.Annotate_everything_with_types_from_JSDoc)];
+ return [createCodeFixAction(fixId, changes, Diagnostics.Annotate_with_type_from_JSDoc, fixId, Diagnostics.Annotate_everything_with_types_from_JSDoc)];
},
fixIds: [fixId],
getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => {
diff --git a/src/services/codefixes/convertFunctionToEs6Class.ts b/src/services/codefixes/convertFunctionToEs6Class.ts
index bb260463831..bf20aeda72b 100644
--- a/src/services/codefixes/convertFunctionToEs6Class.ts
+++ b/src/services/codefixes/convertFunctionToEs6Class.ts
@@ -6,7 +6,7 @@ namespace ts.codefix {
errorCodes,
getCodeActions(context: CodeFixContext) {
const changes = textChanges.ChangeTracker.with(context, t => doChange(t, context.sourceFile, context.span.start, context.program.getTypeChecker()));
- return [createCodeFixAction(changes, Diagnostics.Convert_function_to_an_ES2015_class, fixId, Diagnostics.Convert_all_constructor_functions_to_classes)];
+ return [createCodeFixAction(fixId, changes, Diagnostics.Convert_function_to_an_ES2015_class, fixId, Diagnostics.Convert_all_constructor_functions_to_classes)];
},
fixIds: [fixId],
getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, err) => doChange(changes, err.file!, err.start, context.program.getTypeChecker())),
diff --git a/src/services/codefixes/convertToEs6Module.ts b/src/services/codefixes/convertToEs6Module.ts
index b8c78d57827..67aaa60f186 100644
--- a/src/services/codefixes/convertToEs6Module.ts
+++ b/src/services/codefixes/convertToEs6Module.ts
@@ -13,7 +13,7 @@ namespace ts.codefix {
}
});
// No support for fix-all since this applies to the whole file at once anyway.
- return [createCodeFixActionNoFixId(changes, Diagnostics.Convert_to_ES6_module)];
+ return [createCodeFixActionNoFixId("convertToEs6Module", changes, Diagnostics.Convert_to_ES6_module)];
},
});
diff --git a/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts b/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts
index f47b65aad90..54fe1823863 100644
--- a/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts
+++ b/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts
@@ -9,7 +9,7 @@ namespace ts.codefix {
if (!qualifiedName) return undefined;
const changes = textChanges.ChangeTracker.with(context, t => doChange(t, context.sourceFile, qualifiedName));
const newText = `${qualifiedName.left.text}["${qualifiedName.right.text}"]`;
- return [createCodeFixAction(changes, [Diagnostics.Rewrite_as_the_indexed_access_type_0, newText], fixId, Diagnostics.Rewrite_all_as_indexed_access_types)];
+ return [createCodeFixAction(fixId, changes, [Diagnostics.Rewrite_as_the_indexed_access_type_0, newText], fixId, Diagnostics.Rewrite_all_as_indexed_access_types)];
},
fixIds: [fixId],
getAllCodeActions: (context) => codeFixAll(context, errorCodes, (changes, diag) => {
diff --git a/src/services/codefixes/disableJsDiagnostics.ts b/src/services/codefixes/disableJsDiagnostics.ts
index c53c35c5f81..b5d3059dd42 100644
--- a/src/services/codefixes/disableJsDiagnostics.ts
+++ b/src/services/codefixes/disableJsDiagnostics.ts
@@ -1,5 +1,6 @@
/* @internal */
namespace ts.codefix {
+ const fixName = "disableJsDiagnostics";
const fixId = "disableJsDiagnostics";
const errorCodes = mapDefined(Object.keys(Diagnostics) as ReadonlyArray, key => {
const diag = Diagnostics[key];
@@ -18,6 +19,7 @@ namespace ts.codefix {
const fixes: CodeFixAction[] = [
// fixId unnecessary because adding `// @ts-nocheck` even once will ignore every error in the file.
createCodeFixActionNoFixId(
+ fixName,
[createFileTextChanges(sourceFile.fileName, [
createTextChange(sourceFile.checkJsDirective
? createTextSpanFromBounds(sourceFile.checkJsDirective.pos, sourceFile.checkJsDirective.end)
@@ -27,7 +29,7 @@ namespace ts.codefix {
];
if (textChanges.isValidLocationToAddComment(sourceFile, span.start)) {
- fixes.unshift(createCodeFixAction(textChanges.ChangeTracker.with(context, t => makeChange(t, sourceFile, span.start)), Diagnostics.Ignore_this_error_message, fixId, Diagnostics.Add_ts_ignore_to_all_error_messages));
+ fixes.unshift(createCodeFixAction(fixName, textChanges.ChangeTracker.with(context, t => makeChange(t, sourceFile, span.start)), Diagnostics.Ignore_this_error_message, fixId, Diagnostics.Add_ts_ignore_to_all_error_messages));
}
return fixes;
diff --git a/src/services/codefixes/fixAddMissingMember.ts b/src/services/codefixes/fixAddMissingMember.ts
index 9a3b4854351..940201d7008 100644
--- a/src/services/codefixes/fixAddMissingMember.ts
+++ b/src/services/codefixes/fixAddMissingMember.ts
@@ -1,5 +1,6 @@
/* @internal */
namespace ts.codefix {
+ const fixName = "addMissingMember";
const errorCodes = [
Diagnostics.Property_0_does_not_exist_on_type_1.code,
Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code,
@@ -75,7 +76,7 @@ namespace ts.codefix {
function getActionsForAddMissingMemberInJavaScriptFile(context: CodeFixContext, classDeclarationSourceFile: SourceFile, classDeclaration: ClassLikeDeclaration, tokenName: string, makeStatic: boolean): CodeFixAction | undefined {
const changes = textChanges.ChangeTracker.with(context, t => addMissingMemberInJs(t, classDeclarationSourceFile, classDeclaration, tokenName, makeStatic));
return changes.length === 0 ? undefined
- : createCodeFixAction(changes, [makeStatic ? Diagnostics.Initialize_static_property_0 : Diagnostics.Initialize_property_0_in_the_constructor, tokenName], fixId, Diagnostics.Add_all_missing_members);
+ : createCodeFixAction(fixName, changes, [makeStatic ? Diagnostics.Initialize_static_property_0 : Diagnostics.Initialize_property_0_in_the_constructor, tokenName], fixId, Diagnostics.Add_all_missing_members);
}
function addMissingMemberInJs(changeTracker: textChanges.ChangeTracker, classDeclarationSourceFile: SourceFile, classDeclaration: ClassLikeDeclaration, tokenName: string, makeStatic: boolean): void {
@@ -120,7 +121,7 @@ namespace ts.codefix {
function createAddPropertyDeclarationAction(context: CodeFixContext, classDeclarationSourceFile: SourceFile, classDeclaration: ClassLikeDeclaration, makeStatic: boolean, tokenName: string, typeNode: TypeNode): CodeFixAction {
const changes = textChanges.ChangeTracker.with(context, t => addPropertyDeclaration(t, classDeclarationSourceFile, classDeclaration, tokenName, typeNode, makeStatic));
- return createCodeFixAction(changes, [makeStatic ? Diagnostics.Declare_static_property_0 : Diagnostics.Declare_property_0, tokenName], fixId, Diagnostics.Add_all_missing_members);
+ return createCodeFixAction(fixName, changes, [makeStatic ? Diagnostics.Declare_static_property_0 : Diagnostics.Declare_property_0, tokenName], fixId, Diagnostics.Add_all_missing_members);
}
function addPropertyDeclaration(changeTracker: textChanges.ChangeTracker, classDeclarationSourceFile: SourceFile, classDeclaration: ClassLikeDeclaration, tokenName: string, typeNode: TypeNode, makeStatic: boolean): void {
@@ -153,7 +154,7 @@ namespace ts.codefix {
const changes = textChanges.ChangeTracker.with(context, t => t.insertNodeAtClassStart(classDeclarationSourceFile, classDeclaration, indexSignature));
// No fixId here because code-fix-all currently only works on adding individual named properties.
- return createCodeFixActionNoFixId(changes, [Diagnostics.Add_index_signature_for_property_0, tokenName]);
+ return createCodeFixActionNoFixId(fixName, changes, [Diagnostics.Add_index_signature_for_property_0, tokenName]);
}
function getActionForMethodDeclaration(
@@ -167,7 +168,7 @@ namespace ts.codefix {
preferences: UserPreferences,
): CodeFixAction | undefined {
const changes = textChanges.ChangeTracker.with(context, t => addMethodDeclaration(t, classDeclarationSourceFile, classDeclaration, token, callExpression, makeStatic, inJs, preferences));
- return createCodeFixAction(changes, [makeStatic ? Diagnostics.Declare_static_method_0 : Diagnostics.Declare_method_0, token.text], fixId, Diagnostics.Add_all_missing_members);
+ return createCodeFixAction(fixName, changes, [makeStatic ? Diagnostics.Declare_static_method_0 : Diagnostics.Declare_method_0, token.text], fixId, Diagnostics.Add_all_missing_members);
}
function addMethodDeclaration(
diff --git a/src/services/codefixes/fixAwaitInSyncFunction.ts b/src/services/codefixes/fixAwaitInSyncFunction.ts
index 804910e9a22..fd00498573c 100644
--- a/src/services/codefixes/fixAwaitInSyncFunction.ts
+++ b/src/services/codefixes/fixAwaitInSyncFunction.ts
@@ -12,7 +12,7 @@ namespace ts.codefix {
const nodes = getNodes(sourceFile, span.start);
if (!nodes) return undefined;
const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, nodes));
- return [createCodeFixAction(changes, Diagnostics.Add_async_modifier_to_containing_function, fixId, Diagnostics.Add_all_missing_async_modifiers)];
+ return [createCodeFixAction(fixId, changes, Diagnostics.Add_async_modifier_to_containing_function, fixId, Diagnostics.Add_all_missing_async_modifiers)];
},
fixIds: [fixId],
getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => {
diff --git a/src/services/codefixes/fixCannotFindModule.ts b/src/services/codefixes/fixCannotFindModule.ts
index 89f7a3f7793..9699cd3ceb4 100644
--- a/src/services/codefixes/fixCannotFindModule.ts
+++ b/src/services/codefixes/fixCannotFindModule.ts
@@ -8,7 +8,7 @@ namespace ts.codefix {
const { host, sourceFile, span: { start } } = context;
const packageName = getTypesPackageNameToInstall(host, sourceFile, start);
return packageName === undefined ? []
- : [createCodeFixAction(/*changes*/ [], [Diagnostics.Install_0, packageName], fixId, Diagnostics.Install_all_missing_types_packages, getCommand(sourceFile.fileName, packageName))];
+ : [createCodeFixAction(fixId, /*changes*/ [], [Diagnostics.Install_0, packageName], fixId, Diagnostics.Install_all_missing_types_packages, getCommand(sourceFile.fileName, packageName))];
},
fixIds: [fixId],
getAllCodeActions: context => codeFixAll(context, errorCodes, (_, diag, commands) => {
diff --git a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts
index 3a1443c04bb..a931f849cb2 100644
--- a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts
+++ b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts
@@ -11,7 +11,7 @@ namespace ts.codefix {
const { program, sourceFile, span } = context;
const changes = textChanges.ChangeTracker.with(context, t =>
addMissingMembers(getClass(sourceFile, span.start), sourceFile, program.getTypeChecker(), t, context.preferences));
- return changes.length === 0 ? undefined : [createCodeFixAction(changes, Diagnostics.Implement_inherited_abstract_class, fixId, Diagnostics.Implement_all_inherited_abstract_classes)];
+ return changes.length === 0 ? undefined : [createCodeFixAction(fixId, changes, Diagnostics.Implement_inherited_abstract_class, fixId, Diagnostics.Implement_all_inherited_abstract_classes)];
},
fixIds: [fixId],
getAllCodeActions: context => {
diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts
index 91815edb775..4e0b5745149 100644
--- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts
+++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts
@@ -11,7 +11,7 @@ namespace ts.codefix {
const checker = program.getTypeChecker();
return mapDefined(getClassImplementsHeritageClauseElements(classDeclaration), implementedTypeNode => {
const changes = textChanges.ChangeTracker.with(context, t => addMissingDeclarations(checker, implementedTypeNode, sourceFile, classDeclaration, t, context.preferences));
- return changes.length === 0 ? undefined : createCodeFixAction(changes, [Diagnostics.Implement_interface_0, implementedTypeNode.getText(sourceFile)], fixId, Diagnostics.Implement_all_unimplemented_interfaces);
+ return changes.length === 0 ? undefined : createCodeFixAction(fixId, changes, [Diagnostics.Implement_interface_0, implementedTypeNode.getText(sourceFile)], fixId, Diagnostics.Implement_all_unimplemented_interfaces);
});
},
fixIds: [fixId],
diff --git a/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts b/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts
index d9c98747286..af38b8e9025 100644
--- a/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts
+++ b/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts
@@ -10,7 +10,7 @@ namespace ts.codefix {
if (!nodes) return undefined;
const { constructor, superCall } = nodes;
const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, constructor, superCall));
- return [createCodeFixAction(changes, Diagnostics.Make_super_call_the_first_statement_in_the_constructor, fixId, Diagnostics.Make_all_super_calls_the_first_statement_in_their_constructor)];
+ return [createCodeFixAction(fixId, changes, Diagnostics.Make_super_call_the_first_statement_in_the_constructor, fixId, Diagnostics.Make_all_super_calls_the_first_statement_in_their_constructor)];
},
fixIds: [fixId],
getAllCodeActions(context) {
diff --git a/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts b/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts
index 31aa4fcedae..2aed263ee83 100644
--- a/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts
+++ b/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts
@@ -8,7 +8,7 @@ namespace ts.codefix {
const { sourceFile, span } = context;
const ctr = getNode(sourceFile, span.start);
const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, ctr));
- return [createCodeFixAction(changes, Diagnostics.Add_missing_super_call, fixId, Diagnostics.Add_all_missing_super_calls)];
+ return [createCodeFixAction(fixId, changes, Diagnostics.Add_missing_super_call, fixId, Diagnostics.Add_all_missing_super_calls)];
},
fixIds: [fixId],
getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) =>
diff --git a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts
index 381a8228c0d..c3f406b8475 100644
--- a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts
+++ b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts
@@ -10,7 +10,7 @@ namespace ts.codefix {
if (!nodes) return undefined;
const { extendsToken, heritageClauses } = nodes;
const changes = textChanges.ChangeTracker.with(context, t => doChanges(t, sourceFile, extendsToken, heritageClauses));
- return [createCodeFixAction(changes, Diagnostics.Change_extends_to_implements, fixId, Diagnostics.Change_all_extended_interfaces_to_implements)];
+ return [createCodeFixAction(fixId, changes, Diagnostics.Change_extends_to_implements, fixId, Diagnostics.Change_all_extended_interfaces_to_implements)];
},
fixIds: [fixId],
getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => {
diff --git a/src/services/codefixes/fixForgottenThisPropertyAccess.ts b/src/services/codefixes/fixForgottenThisPropertyAccess.ts
index 2cf7e2143a3..b26e4c7cdca 100644
--- a/src/services/codefixes/fixForgottenThisPropertyAccess.ts
+++ b/src/services/codefixes/fixForgottenThisPropertyAccess.ts
@@ -11,7 +11,7 @@ namespace ts.codefix {
return undefined;
}
const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, token));
- return [createCodeFixAction(changes, Diagnostics.Add_this_to_unresolved_variable, fixId, Diagnostics.Add_this_to_all_unresolved_variables_matching_a_member_name)];
+ return [createCodeFixAction(fixId, changes, Diagnostics.Add_this_to_unresolved_variable, fixId, Diagnostics.Add_this_to_all_unresolved_variables_matching_a_member_name)];
},
fixIds: [fixId],
getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => {
diff --git a/src/services/codefixes/fixInvalidImportSyntax.ts b/src/services/codefixes/fixInvalidImportSyntax.ts
index 84bd9867c70..50bf41360bc 100644
--- a/src/services/codefixes/fixInvalidImportSyntax.ts
+++ b/src/services/codefixes/fixInvalidImportSyntax.ts
@@ -1,5 +1,7 @@
/* @internal */
namespace ts.codefix {
+ const fixName = "invalidImportSyntax";
+
registerCodeFix({
errorCodes: [Diagnostics.A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime.code],
getCodeActions: getActionsForInvalidImport
@@ -43,7 +45,7 @@ namespace ts.codefix {
function createAction(context: CodeFixContext, sourceFile: SourceFile, node: Node, replacement: Node): CodeFixAction {
const changes = textChanges.ChangeTracker.with(context, t => t.replaceNode(sourceFile, node, replacement));
- return createCodeFixActionNoFixId(changes, [Diagnostics.Replace_import_with_0, changes[0].textChanges[0].newText]);
+ return createCodeFixActionNoFixId("invalidImportSyntax", changes, [Diagnostics.Replace_import_with_0, changes[0].textChanges[0].newText]);
}
registerCodeFix({
@@ -72,7 +74,7 @@ namespace ts.codefix {
addRange(fixes, getCodeFixesForImportDeclaration(context, relatedImport));
}
const changes = textChanges.ChangeTracker.with(context, t => t.replaceNode(sourceFile, expr, createPropertyAccess(expr, "default"), {}));
- fixes.push(createCodeFixActionNoFixId(changes, Diagnostics.Use_synthetic_default_member));
+ fixes.push(createCodeFixActionNoFixId(fixName, changes, Diagnostics.Use_synthetic_default_member));
return fixes;
}
}
diff --git a/src/services/codefixes/fixJSDocTypes.ts b/src/services/codefixes/fixJSDocTypes.ts
index 848666b67f0..1919b0742f0 100644
--- a/src/services/codefixes/fixJSDocTypes.ts
+++ b/src/services/codefixes/fixJSDocTypes.ts
@@ -22,7 +22,7 @@ namespace ts.codefix {
function fix(type: Type, fixId: string, fixAllDescription: DiagnosticMessage): CodeFixAction {
const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, typeNode, type, checker));
- return createCodeFixAction(changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type)], fixId, fixAllDescription);
+ return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type)], fixId, fixAllDescription);
}
},
fixIds: [fixIdPlain, fixIdNullable],
diff --git a/src/services/codefixes/fixSpelling.ts b/src/services/codefixes/fixSpelling.ts
index 59f5e64f212..252b08b356a 100644
--- a/src/services/codefixes/fixSpelling.ts
+++ b/src/services/codefixes/fixSpelling.ts
@@ -15,7 +15,7 @@ namespace ts.codefix {
const { node, suggestion } = info;
const { target } = context.host.getCompilationSettings();
const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, node, suggestion, target));
- return [createCodeFixAction(changes, [Diagnostics.Change_spelling_to_0, suggestion], fixId, Diagnostics.Fix_all_detected_spelling_errors)];
+ return [createCodeFixAction("spelling", changes, [Diagnostics.Change_spelling_to_0, suggestion], fixId, Diagnostics.Fix_all_detected_spelling_errors)];
},
fixIds: [fixId],
getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => {
diff --git a/src/services/codefixes/fixStrictClassInitialization.ts b/src/services/codefixes/fixStrictClassInitialization.ts
index 69a69a8c3c8..8d4e457662f 100644
--- a/src/services/codefixes/fixStrictClassInitialization.ts
+++ b/src/services/codefixes/fixStrictClassInitialization.ts
@@ -1,5 +1,6 @@
/* @internal */
namespace ts.codefix {
+ const fixName = "strictClassInitialization";
const fixIdAddDefiniteAssignmentAssertions = "addMissingPropertyDefiniteAssignmentAssertions";
const fixIdAddUndefinedType = "addMissingPropertyUndefinedType";
const fixIdAddInitializer = "addMissingPropertyInitializer";
@@ -53,7 +54,7 @@ namespace ts.codefix {
function getActionForAddMissingDefiniteAssignmentAssertion (context: CodeFixContext, propertyDeclaration: PropertyDeclaration): CodeFixAction {
const changes = textChanges.ChangeTracker.with(context, t => addDefiniteAssignmentAssertion(t, context.sourceFile, propertyDeclaration));
- return createCodeFixAction(changes, [Diagnostics.Add_definite_assignment_assertion_to_property_0, propertyDeclaration.getText()], fixIdAddDefiniteAssignmentAssertions, Diagnostics.Add_definite_assignment_assertions_to_all_uninitialized_properties);
+ return createCodeFixAction(fixName, changes, [Diagnostics.Add_definite_assignment_assertion_to_property_0, propertyDeclaration.getText()], fixIdAddDefiniteAssignmentAssertions, Diagnostics.Add_definite_assignment_assertions_to_all_uninitialized_properties);
}
function addDefiniteAssignmentAssertion(changeTracker: textChanges.ChangeTracker, propertyDeclarationSourceFile: SourceFile, propertyDeclaration: PropertyDeclaration): void {
@@ -71,7 +72,7 @@ namespace ts.codefix {
function getActionForAddMissingUndefinedType (context: CodeFixContext, propertyDeclaration: PropertyDeclaration): CodeFixAction {
const changes = textChanges.ChangeTracker.with(context, t => addUndefinedType(t, context.sourceFile, propertyDeclaration));
- return createCodeFixAction(changes, [Diagnostics.Add_undefined_type_to_property_0, propertyDeclaration.name.getText()], fixIdAddUndefinedType, Diagnostics.Add_undefined_type_to_all_uninitialized_properties);
+ return createCodeFixAction(fixName, changes, [Diagnostics.Add_undefined_type_to_property_0, propertyDeclaration.name.getText()], fixIdAddUndefinedType, Diagnostics.Add_undefined_type_to_all_uninitialized_properties);
}
function addUndefinedType(changeTracker: textChanges.ChangeTracker, propertyDeclarationSourceFile: SourceFile, propertyDeclaration: PropertyDeclaration): void {
@@ -86,7 +87,7 @@ namespace ts.codefix {
if (!initializer) return undefined;
const changes = textChanges.ChangeTracker.with(context, t => addInitializer(t, context.sourceFile, propertyDeclaration, initializer));
- return createCodeFixAction(changes, [Diagnostics.Add_initializer_to_property_0, propertyDeclaration.name.getText()], fixIdAddInitializer, Diagnostics.Add_initializers_to_all_uninitialized_properties);
+ return createCodeFixAction(fixName, changes, [Diagnostics.Add_initializer_to_property_0, propertyDeclaration.name.getText()], fixIdAddInitializer, Diagnostics.Add_initializers_to_all_uninitialized_properties);
}
function addInitializer (changeTracker: textChanges.ChangeTracker, propertyDeclarationSourceFile: SourceFile, propertyDeclaration: PropertyDeclaration, initializer: Expression): void {
diff --git a/src/services/codefixes/fixUnusedIdentifier.ts b/src/services/codefixes/fixUnusedIdentifier.ts
index 1fe0107dafb..a37435cd109 100644
--- a/src/services/codefixes/fixUnusedIdentifier.ts
+++ b/src/services/codefixes/fixUnusedIdentifier.ts
@@ -1,5 +1,6 @@
/* @internal */
namespace ts.codefix {
+ const fixName = "unusedIdentifier";
const fixIdPrefix = "unusedIdentifier_prefix";
const fixIdDelete = "unusedIdentifier_delete";
const errorCodes = [
@@ -14,7 +15,7 @@ namespace ts.codefix {
const importDecl = tryGetFullImport(sourceFile, context.span.start);
if (importDecl) {
const changes = textChanges.ChangeTracker.with(context, t => t.deleteNode(sourceFile, importDecl));
- return [createCodeFixAction(changes, [Diagnostics.Remove_import_from_0, showModuleSpecifier(importDecl)], fixIdDelete, Diagnostics.Delete_all_unused_declarations)];
+ return [createCodeFixAction(fixName, changes, [Diagnostics.Remove_import_from_0, showModuleSpecifier(importDecl)], fixIdDelete, Diagnostics.Delete_all_unused_declarations)];
}
const token = getToken(sourceFile, textSpanEnd(context.span));
@@ -22,12 +23,12 @@ namespace ts.codefix {
const deletion = textChanges.ChangeTracker.with(context, t => tryDeleteDeclaration(t, sourceFile, token));
if (deletion.length) {
- result.push(createCodeFixAction(deletion, [Diagnostics.Remove_declaration_for_Colon_0, token.getText(sourceFile)], fixIdDelete, Diagnostics.Delete_all_unused_declarations));
+ result.push(createCodeFixAction(fixName, deletion, [Diagnostics.Remove_declaration_for_Colon_0, token.getText(sourceFile)], fixIdDelete, Diagnostics.Delete_all_unused_declarations));
}
const prefix = textChanges.ChangeTracker.with(context, t => tryPrefixDeclaration(t, errorCode, sourceFile, token));
if (prefix.length) {
- result.push(createCodeFixAction(prefix, [Diagnostics.Prefix_0_with_an_underscore, token.getText(sourceFile)], fixIdPrefix, Diagnostics.Prefix_all_unused_declarations_with_where_possible));
+ result.push(createCodeFixAction(fixName, prefix, [Diagnostics.Prefix_0_with_an_underscore, token.getText(sourceFile)], fixIdPrefix, Diagnostics.Prefix_all_unused_declarations_with_where_possible));
}
return result;
diff --git a/src/services/codefixes/fixes.ts b/src/services/codefixes/fixes.ts
index 50a0afd3925..bc845bd8dc0 100644
--- a/src/services/codefixes/fixes.ts
+++ b/src/services/codefixes/fixes.ts
@@ -1,24 +1 @@
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
+// Please delete me later.
diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts
index 35e75d831fd..cd3c5339a29 100644
--- a/src/services/codefixes/helpers.ts
+++ b/src/services/codefixes/helpers.ts
@@ -25,8 +25,7 @@ namespace ts.codefix {
}
const declaration = declarations[0];
- // Clone name to remove leading trivia.
- const name = getSynthesizedDeepClone(getNameOfDeclaration(declaration)) as PropertyName;
+ const name = getSynthesizedDeepClone(getNameOfDeclaration(declaration), /*includeTrivia*/ false) as PropertyName;
const visibilityModifier = createVisibilityModifier(getModifierFlags(declaration));
const modifiers = visibilityModifier ? createNodeArray([visibilityModifier]) : undefined;
const type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
@@ -69,7 +68,7 @@ namespace ts.codefix {
for (const signature of signatures) {
// Need to ensure nodes are fresh each time so they can have different positions.
- outputMethod(signature, getSynthesizedDeepClones(modifiers), getSynthesizedDeepClone(name));
+ outputMethod(signature, getSynthesizedDeepClones(modifiers, /*includeTrivia*/ false), getSynthesizedDeepClone(name, /*includeTrivia*/ false));
}
if (declarations.length > signatures.length) {
@@ -103,10 +102,6 @@ namespace ts.codefix {
return signatureDeclaration;
}
- function getSynthesizedDeepClones(nodes: NodeArray | undefined): NodeArray | undefined {
- return nodes && createNodeArray(nodes.map(getSynthesizedDeepClone));
- }
-
export function createMethodFromCallExpression(
{ typeArguments, arguments: args }: CallExpression,
methodName: string,
diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts
index 95cd84ee620..ddd530e4246 100644
--- a/src/services/codefixes/importFixes.ts
+++ b/src/services/codefixes/importFixes.ts
@@ -35,7 +35,7 @@ namespace ts.codefix {
function createCodeAction(descriptionDiagnostic: DiagnosticMessage, diagnosticArgs: [string, string], changes: FileTextChanges[]): CodeFixAction {
// TODO: GH#20315
- return createCodeFixActionNoFixId(changes, [descriptionDiagnostic, ...diagnosticArgs] as [DiagnosticMessage, string, string]);
+ return createCodeFixActionNoFixId("import", changes, [descriptionDiagnostic, ...diagnosticArgs] as [DiagnosticMessage, string, string]);
}
function convertToImportCodeFixContext(context: CodeFixContext, symbolToken: Node, symbolName: string): ImportCodeFixContext {
@@ -98,18 +98,18 @@ namespace ts.codefix {
symbolToken: Node | undefined,
preferences: UserPreferences,
): { readonly moduleSpecifier: string, readonly codeAction: CodeAction } {
- const exportInfos = getAllReExportingModules(exportedSymbol, checker, allSourceFiles);
+ const exportInfos = getAllReExportingModules(exportedSymbol, symbolName, checker, allSourceFiles);
Debug.assert(exportInfos.some(info => info.moduleSymbol === moduleSymbol));
// We sort the best codefixes first, so taking `first` is best for completions.
const moduleSpecifier = first(getNewImportInfos(program, sourceFile, exportInfos, compilerOptions, getCanonicalFileName, host, preferences)).moduleSpecifier;
const ctx: ImportCodeFixContext = { host, program, checker, compilerOptions, sourceFile, formatContext, symbolName, getCanonicalFileName, symbolToken, preferences };
return { moduleSpecifier, codeAction: first(getCodeActionsForImport(exportInfos, ctx)) };
}
- function getAllReExportingModules(exportedSymbol: Symbol, checker: TypeChecker, allSourceFiles: ReadonlyArray): ReadonlyArray {
+ function getAllReExportingModules(exportedSymbol: Symbol, symbolName: string, checker: TypeChecker, allSourceFiles: ReadonlyArray): ReadonlyArray {
const result: SymbolExportInfo[] = [];
forEachExternalModule(checker, allSourceFiles, moduleSymbol => {
for (const exported of checker.getExportsOfModule(moduleSymbol)) {
- if (skipAlias(exported, checker) === exportedSymbol) {
+ if (exported.escapedName === InternalSymbolName.Default || exported.name === symbolName && skipAlias(exported, checker) === exportedSymbol) {
const isDefaultExport = checker.tryGetMemberInModuleExports(InternalSymbolName.Default, moduleSymbol) === exported;
result.push({ moduleSymbol, importKind: isDefaultExport ? ImportKind.Default : ImportKind.Named });
}
@@ -240,6 +240,7 @@ namespace ts.codefix {
preferences: UserPreferences,
): ReadonlyArray {
const { baseUrl, paths, rootDirs } = compilerOptions;
+ const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
const addJsExtension = usesJsExtensionOnImports(sourceFile);
const choicesForEachExportingModule = flatMap(moduleSymbols, ({ moduleSymbol, importKind }) => {
const modulePathsGroups = getAllModulePaths(program, moduleSymbol.valueDeclaration.getSourceFile()).map(moduleFileName => {
@@ -252,7 +253,7 @@ namespace ts.codefix {
return [global];
}
- const relativePath = removeExtensionAndIndexPostFix(getRelativePath(moduleFileName, sourceDirectory, getCanonicalFileName), compilerOptions, addJsExtension);
+ const relativePath = removeExtensionAndIndexPostFix(getRelativePath(moduleFileName, sourceDirectory, getCanonicalFileName), moduleResolutionKind, addJsExtension);
if (!baseUrl || preferences.importModuleSpecifierPreference === "relative") {
return [relativePath];
}
@@ -262,7 +263,7 @@ namespace ts.codefix {
return [relativePath];
}
- const importRelativeToBaseUrl = removeExtensionAndIndexPostFix(relativeToBaseUrl, compilerOptions, addJsExtension);
+ const importRelativeToBaseUrl = removeExtensionAndIndexPostFix(relativeToBaseUrl, moduleResolutionKind, addJsExtension);
if (paths) {
const fromPaths = tryGetModuleNameFromPaths(removeFileExtension(relativeToBaseUrl), importRelativeToBaseUrl, paths);
if (fromPaths) {
@@ -390,7 +391,8 @@ namespace ts.codefix {
return firstDefined(roots, unNormalizedTypeRoot => {
const typeRoot = toPath(unNormalizedTypeRoot, /*basePath*/ undefined, getCanonicalFileName);
if (startsWith(moduleFileName, typeRoot)) {
- return removeExtensionAndIndexPostFix(moduleFileName.substring(typeRoot.length + 1), options, addJsExtension);
+ // For a type definition, we can strip `/index` even with classic resolution.
+ return removeExtensionAndIndexPostFix(moduleFileName.substring(typeRoot.length + 1), ModuleResolutionKind.NodeJs, addJsExtension);
}
});
}
@@ -527,11 +529,11 @@ namespace ts.codefix {
});
}
- function removeExtensionAndIndexPostFix(fileName: string, options: CompilerOptions, addJsExtension: boolean): string {
+ function removeExtensionAndIndexPostFix(fileName: string, moduleResolutionKind: ModuleResolutionKind, addJsExtension: boolean): string {
const noExtension = removeFileExtension(fileName);
return addJsExtension
? noExtension + ".js"
- : getEmitModuleResolutionKind(options) === ModuleResolutionKind.NodeJs
+ : moduleResolutionKind === ModuleResolutionKind.NodeJs
? removeSuffix(noExtension, "/index")
: noExtension;
}
diff --git a/src/services/codefixes/inferFromUsage.ts b/src/services/codefixes/inferFromUsage.ts
index 99556fc84de..8b36d3e5d51 100644
--- a/src/services/codefixes/inferFromUsage.ts
+++ b/src/services/codefixes/inferFromUsage.ts
@@ -34,7 +34,7 @@ namespace ts.codefix {
let declaration!: Declaration;
const changes = textChanges.ChangeTracker.with(context, changes => { declaration = doChange(changes, sourceFile, token, errorCode, program, cancellationToken); });
return changes.length === 0 ? undefined
- : [createCodeFixAction(changes, [getDiagnostic(errorCode, token), getNameOfDeclaration(declaration).getText(sourceFile)], fixId, Diagnostics.Infer_all_types_from_usage)];
+ : [createCodeFixAction(fixId, changes, [getDiagnostic(errorCode, token), getNameOfDeclaration(declaration).getText(sourceFile)], fixId, Diagnostics.Infer_all_types_from_usage)];
},
fixIds: [fixId],
getAllCodeActions(context) {
diff --git a/src/services/codefixes/useDefaultImport.ts b/src/services/codefixes/useDefaultImport.ts
index 7a6a0acfc30..632cfc97e00 100644
--- a/src/services/codefixes/useDefaultImport.ts
+++ b/src/services/codefixes/useDefaultImport.ts
@@ -9,7 +9,7 @@ namespace ts.codefix {
const info = getInfo(sourceFile, start);
if (!info) return undefined;
const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, info));
- return [createCodeFixAction(changes, Diagnostics.Convert_to_default_import, fixId, Diagnostics.Convert_all_to_default_imports)];
+ return [createCodeFixAction(fixId, changes, Diagnostics.Convert_to_default_import, fixId, Diagnostics.Convert_all_to_default_imports)];
},
fixIds: [fixId],
getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => {
diff --git a/src/services/completions.ts b/src/services/completions.ts
index 40d3738f12f..3100e4a13a9 100644
--- a/src/services/completions.ts
+++ b/src/services/completions.ts
@@ -1,5 +1,3 @@
-///
-
/* @internal */
namespace ts.Completions {
export type Log = (message: string) => void;
@@ -844,7 +842,7 @@ namespace ts.Completions {
// Check if the caret is at the end of an identifier; this is a partial identifier that we want to complete: e.g. a.toS|
// Skip this partial identifier and adjust the contextToken to the token that precedes it.
- if (contextToken && position <= contextToken.end && isWord(contextToken.kind)) {
+ if (contextToken && position <= contextToken.end && (isIdentifier(contextToken) || isKeyword(contextToken.kind))) {
const start = timestamp();
contextToken = findPrecedingToken(contextToken.getFullStart(), sourceFile, /*startNode*/ undefined, insideJsDocTagTypeExpression);
log("getCompletionData: Get previous token 2: " + (timestamp() - start));
@@ -1555,32 +1553,22 @@ namespace ts.Completions {
* @returns true if 'symbols' was successfully populated; false otherwise.
*/
function tryGetImportOrExportClauseCompletionSymbols(): GlobalsSearch {
- const namedImportsOrExports = tryGetNamedImportsOrExportsForCompletion(contextToken);
- if (!namedImportsOrExports) return undefined;
+ // `import { |` or `import { a as 0, | }`
+ const namedImportsOrExports = contextToken && (contextToken.kind === SyntaxKind.OpenBraceToken || contextToken.kind === SyntaxKind.CommaToken)
+ ? tryCast(contextToken.parent, isNamedImportsOrExports) : undefined;
+ if (!namedImportsOrExports) return GlobalsSearch.Continue;
// cursor is in an import clause
// try to show exported member for imported module
- const declarationKind = namedImportsOrExports.kind === SyntaxKind.NamedImports ?
- SyntaxKind.ImportDeclaration :
- SyntaxKind.ExportDeclaration;
- const importOrExportDeclaration = getAncestor(namedImportsOrExports, declarationKind);
- const moduleSpecifier = importOrExportDeclaration.moduleSpecifier;
-
- if (!moduleSpecifier) {
- return GlobalsSearch.Fail;
- }
+ const { moduleSpecifier } = namedImportsOrExports.kind === SyntaxKind.NamedImports ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent;
+ const moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier);
+ if (!moduleSpecifierSymbol) return GlobalsSearch.Fail;
completionKind = CompletionKind.MemberLike;
isNewIdentifierLocation = false;
-
- const moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier);
- if (!moduleSpecifierSymbol) {
- symbols = emptyArray;
- return GlobalsSearch.Fail;
- }
-
const exports = typeChecker.getExportsAndPropertiesOfModule(moduleSpecifierSymbol);
- symbols = filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements);
+ const existing = arrayToSet(namedImportsOrExports.elements, n => isCurrentlyEditingNode(n) ? undefined : (n.propertyName || n.name).escapedText);
+ symbols = exports.filter(e => e.escapedName !== InternalSymbolName.Default && !existing.get(e.escapedName));
return GlobalsSearch.Success;
}
@@ -1648,26 +1636,6 @@ namespace ts.Completions {
return undefined;
}
- /**
- * Returns the containing list of named imports or exports of a context token,
- * on the condition that one exists and that the context implies completion should be given.
- */
- function tryGetNamedImportsOrExportsForCompletion(contextToken: Node): NamedImportsOrExports {
- if (contextToken) {
- switch (contextToken.kind) {
- case SyntaxKind.OpenBraceToken: // import { |
- case SyntaxKind.CommaToken: // import { a as 0, |
- switch (contextToken.parent.kind) {
- case SyntaxKind.NamedImports:
- case SyntaxKind.NamedExports:
- return contextToken.parent;
- }
- }
- }
-
- return undefined;
- }
-
function isConstructorParameterCompletion(node: Node): boolean {
return !!node.parent && isParameter(node.parent) && isConstructorDeclaration(node.parent.parent)
&& (isParameterPropertyModifier(node.kind) || isDeclarationName(node));
@@ -1911,31 +1879,6 @@ namespace ts.Completions {
return false;
}
- /**
- * Filters out completion suggestions for named imports or exports.
- *
- * @param exportsOfModule The list of symbols which a module exposes.
- * @param namedImportsOrExports The list of existing import/export specifiers in the import/export clause.
- *
- * @returns Symbols to be suggested at an import/export clause, barring those whose named imports/exports
- * do not occur at the current position and have not otherwise been typed.
- */
- function filterNamedImportOrExportCompletionItems(exportsOfModule: Symbol[], namedImportsOrExports: ReadonlyArray): Symbol[] {
- const existingImportsOrExports = createUnderscoreEscapedMap();
-
- for (const element of namedImportsOrExports) {
- // If this is the current item we are editing right now, do not filter it out
- if (isCurrentlyEditingNode(element)) {
- continue;
- }
-
- const name = element.propertyName || element.name;
- existingImportsOrExports.set(name.escapedText, true);
- }
-
- return exportsOfModule.filter(e => e.escapedName !== InternalSymbolName.Default && !existingImportsOrExports.get(e.escapedName));
- }
-
/**
* Filters out completion suggestions for named imports or exports.
*
@@ -2248,7 +2191,7 @@ namespace ts.Completions {
// TODO: GH#19856 Would like to return `node is Node & { parent: (ClassElement | TypeElement) & { parent: ObjectTypeDeclaration } }` but then compilation takes > 10 minutes
function isFromObjectTypeDeclaration(node: Node): boolean {
- return node.parent && (isClassElement(node.parent) || isTypeElement(node.parent)) && isObjectTypeDeclaration(node.parent.parent);
+ return node.parent && isClassOrTypeElement(node.parent) && isObjectTypeDeclaration(node.parent.parent);
}
function hasIndexSignature(type: Type): boolean {
diff --git a/src/services/documentHighlights.ts b/src/services/documentHighlights.ts
index 8d48d526a4b..69c75548fe5 100644
--- a/src/services/documentHighlights.ts
+++ b/src/services/documentHighlights.ts
@@ -1,7 +1,7 @@
/* @internal */
namespace ts.DocumentHighlights {
export function getDocumentHighlights(program: Program, cancellationToken: CancellationToken, sourceFile: SourceFile, position: number, sourceFilesToSearch: ReadonlyArray): DocumentHighlights[] | undefined {
- const node = getTouchingWord(sourceFile, position, /*includeJsDocComment*/ true);
+ const node = getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true);
if (node.parent && (isJsxOpeningElement(node.parent) && node.parent.tagName === node || isJsxClosingElement(node.parent))) {
// For a JSX element, just highlight the matching tag, not all references.
@@ -22,10 +22,20 @@ namespace ts.DocumentHighlights {
}
function getSemanticDocumentHighlights(position: number, node: Node, program: Program, cancellationToken: CancellationToken, sourceFilesToSearch: ReadonlyArray): DocumentHighlights[] | undefined {
- const referenceEntries = FindAllReferences.getReferenceEntriesForNode(position, node, program, sourceFilesToSearch, cancellationToken);
+ const sourceFilesSet = arrayToSet(sourceFilesToSearch, f => f.fileName);
+ const referenceEntries = FindAllReferences.getReferenceEntriesForNode(position, node, program, sourceFilesToSearch, cancellationToken, /*options*/ undefined, sourceFilesSet);
if (!referenceEntries) return undefined;
const map = arrayToMultiMap(referenceEntries.map(FindAllReferences.toHighlightSpan), e => e.fileName, e => e.span);
- return arrayFrom(map.entries(), ([fileName, highlightSpans]) => ({ fileName, highlightSpans }));
+ return arrayFrom(map.entries(), ([fileName, highlightSpans]) => {
+ if (!sourceFilesSet.has(fileName)) {
+ Debug.assert(program.redirectTargetsSet.has(fileName));
+ const redirectTarget = program.getSourceFile(fileName);
+ const redirect = find(sourceFilesToSearch, f => f.redirectInfo && f.redirectInfo.redirectTarget === redirectTarget)!;
+ fileName = redirect.fileName;
+ Debug.assert(sourceFilesSet.has(fileName));
+ }
+ return { fileName, highlightSpans };
+ });
}
function getSyntacticDocumentHighlights(node: Node, sourceFile: SourceFile): DocumentHighlights[] {
diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts
index 2d95cf978e3..5b4689cc476 100644
--- a/src/services/findAllReferences.ts
+++ b/src/services/findAllReferences.ts
@@ -1,5 +1,3 @@
-///
-
/* @internal */
namespace ts.FindAllReferences {
export interface SymbolAndEntries {
@@ -43,7 +41,7 @@ namespace ts.FindAllReferences {
export function findReferencedSymbols(program: Program, cancellationToken: CancellationToken, sourceFiles: ReadonlyArray, sourceFile: SourceFile, position: number): ReferencedSymbol[] | undefined {
const node = getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true);
- const referencedSymbols = Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, /*options*/ {});
+ const referencedSymbols = Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken);
const checker = program.getTypeChecker();
return !referencedSymbols || !referencedSymbols.length ? undefined : mapDefined(referencedSymbols, ({ definition, references }) =>
// Only include referenced symbols that have a valid definition.
@@ -88,8 +86,8 @@ namespace ts.FindAllReferences {
return map(flattenEntries(Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options)), toReferenceEntry);
}
- export function getReferenceEntriesForNode(position: number, node: Node, program: Program, sourceFiles: ReadonlyArray, cancellationToken: CancellationToken, options: Options = {}): Entry[] | undefined {
- return flattenEntries(Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options));
+ export function getReferenceEntriesForNode(position: number, node: Node, program: Program, sourceFiles: ReadonlyArray, cancellationToken: CancellationToken, options: Options = {}, sourceFilesSet: ReadonlyMap = arrayToSet(sourceFiles, f => f.fileName)): Entry[] | undefined {
+ return flattenEntries(Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options, sourceFilesSet));
}
function flattenEntries(referenceSymbols: SymbolAndEntries[]): Entry[] {
@@ -231,10 +229,10 @@ namespace ts.FindAllReferences {
/* @internal */
namespace ts.FindAllReferences.Core {
/** Core find-all-references algorithm. Handles special cases before delegating to `getReferencedSymbolsForSymbol`. */
- export function getReferencedSymbolsForNode(position: number, node: Node, program: Program, sourceFiles: ReadonlyArray, cancellationToken: CancellationToken, options: Options = {}): SymbolAndEntries[] | undefined {
+ export function getReferencedSymbolsForNode(position: number, node: Node, program: Program, sourceFiles: ReadonlyArray, cancellationToken: CancellationToken, options: Options = {}, sourceFilesSet: ReadonlyMap = arrayToSet(sourceFiles, f => f.fileName)): SymbolAndEntries[] | undefined {
if (isSourceFile(node)) {
const reference = GoToDefinition.getReferenceAtPosition(node, position, program);
- return reference && getReferencedSymbolsForModule(program, program.getTypeChecker().getMergedSymbol(reference.file.symbol), sourceFiles);
+ return reference && getReferencedSymbolsForModule(program, program.getTypeChecker().getMergedSymbol(reference.file.symbol), sourceFiles, sourceFilesSet);
}
if (!options.implementations) {
@@ -254,10 +252,10 @@ namespace ts.FindAllReferences.Core {
}
if (symbol.flags & SymbolFlags.Module && isModuleReferenceLocation(node)) {
- return getReferencedSymbolsForModule(program, symbol, sourceFiles);
+ return getReferencedSymbolsForModule(program, symbol, sourceFiles, sourceFilesSet);
}
- return getReferencedSymbolsForSymbol(symbol, node, sourceFiles, checker, cancellationToken, options);
+ return getReferencedSymbolsForSymbol(symbol, node, sourceFiles, sourceFilesSet, checker, cancellationToken, options);
}
function isModuleReferenceLocation(node: Node): boolean {
@@ -277,7 +275,7 @@ namespace ts.FindAllReferences.Core {
}
}
- function getReferencedSymbolsForModule(program: Program, symbol: Symbol, sourceFiles: ReadonlyArray): SymbolAndEntries[] {
+ function getReferencedSymbolsForModule(program: Program, symbol: Symbol, sourceFiles: ReadonlyArray, sourceFilesSet: ReadonlyMap): SymbolAndEntries[] {
Debug.assert(!!symbol.valueDeclaration);
const references = findModuleReferences(program, sourceFiles, symbol).map(reference => {
@@ -299,7 +297,9 @@ namespace ts.FindAllReferences.Core {
// Don't include the source file itself. (This may not be ideal behavior, but awkward to include an entire file as a reference.)
break;
case SyntaxKind.ModuleDeclaration:
- references.push({ type: "node", node: (decl as ModuleDeclaration).name });
+ if (sourceFilesSet.has(decl.getSourceFile().fileName)) {
+ references.push({ type: "node", node: (decl as ModuleDeclaration).name });
+ }
break;
default:
Debug.fail("Expected a module symbol to be declared by a SourceFile or ModuleDeclaration.");
@@ -339,14 +339,14 @@ namespace ts.FindAllReferences.Core {
}
/** Core find-all-references algorithm for a normal symbol. */
- function getReferencedSymbolsForSymbol(symbol: Symbol, node: Node, sourceFiles: ReadonlyArray, checker: TypeChecker, cancellationToken: CancellationToken, options: Options): SymbolAndEntries[] {
+ function getReferencedSymbolsForSymbol(symbol: Symbol, node: Node, sourceFiles: ReadonlyArray, sourceFilesSet: ReadonlyMap, checker: TypeChecker, cancellationToken: CancellationToken, options: Options): SymbolAndEntries[] {
symbol = skipPastExportOrImportSpecifierOrUnion(symbol, node, checker) || symbol;
// Compute the meaning from the location and the symbol it references
const searchMeaning = getIntersectingMeaningFromDeclarations(node, symbol);
const result: SymbolAndEntries[] = [];
- const state = new State(sourceFiles, getSpecialSearchKind(node), checker, cancellationToken, searchMeaning, options, result);
+ const state = new State(sourceFiles, sourceFilesSet, getSpecialSearchKind(node), checker, cancellationToken, searchMeaning, options, result);
if (node.kind === SyntaxKind.DefaultKeyword) {
addReference(node, symbol, state);
@@ -469,10 +469,9 @@ namespace ts.FindAllReferences.Core {
*/
readonly markSeenReExportRHS = nodeSeenTracker();
- private readonly includedSourceFiles: Map;
-
constructor(
readonly sourceFiles: ReadonlyArray,
+ readonly sourceFilesSet: ReadonlyMap,
/** True if we're searching for constructor references. */
readonly specialSearchKind: SpecialSearchKind,
readonly checker: TypeChecker,
@@ -480,17 +479,16 @@ namespace ts.FindAllReferences.Core {
readonly searchMeaning: SemanticMeaning,
readonly options: Options,
private readonly result: Push) {
- this.includedSourceFiles = arrayToSet(sourceFiles, s => s.fileName);
}
includesSourceFile(sourceFile: SourceFile): boolean {
- return this.includedSourceFiles.has(sourceFile.fileName);
+ return this.sourceFilesSet.has(sourceFile.fileName);
}
private importTracker: ImportTracker | undefined;
/** Gets every place to look for references of an exported symbols. See `ImportsResult` in `importTracker.ts` for more documentation. */
getImportSearches(exportSymbol: Symbol, exportInfo: ExportInfo): ImportsResult {
- if (!this.importTracker) this.importTracker = createImportTracker(this.sourceFiles, this.checker, this.cancellationToken);
+ if (!this.importTracker) this.importTracker = createImportTracker(this.sourceFiles, this.sourceFilesSet, this.checker, this.cancellationToken);
return this.importTracker(exportSymbol, exportInfo, this.options.isForRename);
}
@@ -708,10 +706,18 @@ namespace ts.FindAllReferences.Core {
if (!symbol) return true; // Be lenient with invalid code.
return getPossibleSymbolReferencePositions(sourceFile, symbol.name).some(position => {
const token = tryCast(getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true), isIdentifier);
- return token && token !== definition && token.escapedText === definition.escapedText && checker.getSymbolAtLocation(token) === symbol;
+ if (!token || token === definition || token.escapedText !== definition.escapedText) return false;
+ const referenceSymbol = checker.getSymbolAtLocation(token);
+ return referenceSymbol === symbol
+ || checker.getShorthandAssignmentValueSymbol(token.parent) === symbol
+ || isExportSpecifier(token.parent) && getLocalSymbolForExportSpecifier(token, referenceSymbol, token.parent, checker) === symbol;
});
}
+ function getPossibleSymbolReferenceNodes(sourceFile: SourceFile, symbolName: string, container: Node = sourceFile): ReadonlyArray {
+ return getPossibleSymbolReferencePositions(sourceFile, symbolName, container).map(pos => getTouchingPropertyName(sourceFile, pos, /*includeJsDocComment*/ true));
+ }
+
function getPossibleSymbolReferencePositions(sourceFile: SourceFile, symbolName: string, container: Node = sourceFile): ReadonlyArray {
const positions: number[] = [];
@@ -750,11 +756,9 @@ namespace ts.FindAllReferences.Core {
function getLabelReferencesInNode(container: Node, targetLabel: Identifier): SymbolAndEntries[] {
const sourceFile = container.getSourceFile();
const labelName = targetLabel.text;
- const references = mapDefined(getPossibleSymbolReferencePositions(sourceFile, labelName, container), position => {
- const node = getTouchingWord(sourceFile, position, /*includeJsDocComment*/ false);
+ const references = mapDefined(getPossibleSymbolReferenceNodes(sourceFile, labelName, container), node =>
// Only pick labels that are either the target label, or have a target that is the target label
- return node && (node === targetLabel || (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel)) ? nodeEntry(node) : undefined;
- });
+ node === targetLabel || (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel) ? nodeEntry(node) : undefined);
return [{ definition: { type: "label", node: targetLabel }, references }];
}
@@ -784,10 +788,8 @@ namespace ts.FindAllReferences.Core {
function getAllReferencesForKeyword(sourceFiles: ReadonlyArray, keywordKind: SyntaxKind, cancellationToken: CancellationToken): SymbolAndEntries[] {
const references = flatMap(sourceFiles, sourceFile => {
cancellationToken.throwIfCancellationRequested();
- return mapDefined(getPossibleSymbolReferencePositions(sourceFile, tokenToString(keywordKind), sourceFile), position => {
- const referenceLocation = getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true);
- return referenceLocation.kind === keywordKind ? nodeEntry(referenceLocation) : undefined;
- });
+ return mapDefined(getPossibleSymbolReferenceNodes(sourceFile, tokenToString(keywordKind), sourceFile), referenceLocation =>
+ referenceLocation.kind === keywordKind ? nodeEntry(referenceLocation) : undefined);
});
return references.length ? [{ definition: { type: "keyword", node: references[0].node }, references }] : undefined;
}
@@ -1251,9 +1253,8 @@ namespace ts.FindAllReferences.Core {
}
const sourceFile = searchSpaceNode.getSourceFile();
- const references = mapDefined(getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode), position => {
- const node = getTouchingWord(sourceFile, position, /*includeJsDocComment*/ false);
- if (!node || node.kind !== SyntaxKind.SuperKeyword) {
+ const references = mapDefined(getPossibleSymbolReferenceNodes(sourceFile, "super", searchSpaceNode), node => {
+ if (node.kind !== SyntaxKind.SuperKeyword) {
return;
}
@@ -1303,12 +1304,30 @@ namespace ts.FindAllReferences.Core {
return undefined;
}
- const references: Entry[] = [];
- for (const sourceFile of searchSpaceNode.kind === SyntaxKind.SourceFile ? sourceFiles : [searchSpaceNode.getSourceFile()]) {
+ const references = flatMap(searchSpaceNode.kind === SyntaxKind.SourceFile ? sourceFiles : [searchSpaceNode.getSourceFile()], sourceFile => {
cancellationToken.throwIfCancellationRequested();
- const positions = getPossibleSymbolReferencePositions(sourceFile, "this", isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode);
- getThisReferencesInFile(sourceFile, searchSpaceNode.kind === SyntaxKind.SourceFile ? sourceFile : searchSpaceNode, positions, staticFlag, references);
- }
+ return getPossibleSymbolReferenceNodes(sourceFile, "this", isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode).filter(node => {
+ if (!isThis(node)) {
+ return false;
+ }
+ const container = getThisContainer(node, /* includeArrowFunctions */ false);
+ switch (searchSpaceNode.kind) {
+ case SyntaxKind.FunctionExpression:
+ case SyntaxKind.FunctionDeclaration:
+ return searchSpaceNode.symbol === container.symbol;
+ case SyntaxKind.MethodDeclaration:
+ case SyntaxKind.MethodSignature:
+ return isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol;
+ case SyntaxKind.ClassExpression:
+ case SyntaxKind.ClassDeclaration:
+ // Make sure the container belongs to the same class
+ // and has the appropriate static modifier from the original container.
+ return container.parent && searchSpaceNode.symbol === container.parent.symbol && (getModifierFlags(container) & ModifierFlags.Static) === staticFlag;
+ case SyntaxKind.SourceFile:
+ return container.kind === SyntaxKind.SourceFile && !isExternalModule(container);
+ }
+ });
+ }).map(n => nodeEntry(n));
return [{
definition: { type: "this", node: thisOrSuperKeyword },
@@ -1316,52 +1335,11 @@ namespace ts.FindAllReferences.Core {
}];
}
- function getThisReferencesInFile(sourceFile: SourceFile, searchSpaceNode: Node, possiblePositions: ReadonlyArray, staticFlag: ModifierFlags, result: Push): void {
- forEach(possiblePositions, position => {
- const node = getTouchingWord(sourceFile, position, /*includeJsDocComment*/ false);
- if (!node || !isThis(node)) {
- return;
- }
-
- const container = getThisContainer(node, /* includeArrowFunctions */ false);
-
- switch (searchSpaceNode.kind) {
- case SyntaxKind.FunctionExpression:
- case SyntaxKind.FunctionDeclaration:
- if (searchSpaceNode.symbol === container.symbol) {
- result.push(nodeEntry(node));
- }
- break;
- case SyntaxKind.MethodDeclaration:
- case SyntaxKind.MethodSignature:
- if (isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) {
- result.push(nodeEntry(node));
- }
- break;
- case SyntaxKind.ClassExpression:
- case SyntaxKind.ClassDeclaration:
- // Make sure the container belongs to the same class
- // and has the appropriate static modifier from the original container.
- if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (getModifierFlags(container) & ModifierFlags.Static) === staticFlag) {
- result.push(nodeEntry(node));
- }
- break;
- case SyntaxKind.SourceFile:
- if (container.kind === SyntaxKind.SourceFile && !isExternalModule(container)) {
- result.push(nodeEntry(node));
- }
- break;
- }
- });
- }
-
function getReferencesForStringLiteral(node: StringLiteral, sourceFiles: ReadonlyArray, cancellationToken: CancellationToken): SymbolAndEntries[] {
const references = flatMap(sourceFiles, sourceFile => {
cancellationToken.throwIfCancellationRequested();
- return mapDefined(getPossibleSymbolReferencePositions(sourceFile, node.text), position => {
- const ref = tryCast(getTouchingWord(sourceFile, position, /*includeJsDocComment*/ false), isStringLiteral);
- return ref && ref.text === node.text ? nodeEntry(ref, /*isInString*/ true) : undefined;
- });
+ return mapDefined(getPossibleSymbolReferenceNodes(sourceFile, node.text), ref =>
+ isStringLiteral(ref) && ref.text === node.text ? nodeEntry(ref, /*isInString*/ true) : undefined);
});
return [{
@@ -1373,27 +1351,32 @@ namespace ts.FindAllReferences.Core {
// For certain symbol kinds, we need to include other symbols in the search set.
// This is not needed when searching for re-exports.
function populateSearchSymbolSet(symbol: Symbol, location: Node, checker: TypeChecker, implementations: boolean): Symbol[] {
- // The search set contains at least the current symbol
const result: Symbol[] = [];
+ forEachRelatedSymbol(symbol, location, checker,
+ (sym, root, base) => { result.push(base || root || sym); },
+ /*allowBaseTypes*/ () => !implementations);
+ return result;
+ }
+ function forEachRelatedSymbol(
+ symbol: Symbol, location: Node, checker: TypeChecker,
+ cbSymbol: (symbol: Symbol, rootSymbol?: Symbol, baseSymbol?: Symbol) => T | undefined,
+ allowBaseTypes: (rootSymbol: Symbol) => boolean,
+ ): T | undefined {
const containingObjectLiteralElement = getContainingObjectLiteralElement(location);
if (containingObjectLiteralElement) {
- // If the location is name of property symbol from object literal destructuring pattern
- // Search the property symbol
- // for ( { property: p2 } of elems) { }
- if (containingObjectLiteralElement.kind !== SyntaxKind.ShorthandPropertyAssignment) {
- const propertySymbol = getPropertySymbolOfDestructuringAssignment(location, checker);
- if (propertySymbol) {
- result.push(propertySymbol);
- }
- }
-
// If the location is in a context sensitive location (i.e. in an object literal) try
// to get a contextual type for it, and add the property symbol from the contextual
// type to the search set
- for (const contextualSymbol of getPropertySymbolsFromContextualType(containingObjectLiteralElement, checker)) {
- addRootSymbols(contextualSymbol);
- }
+ const res = firstDefined(getPropertySymbolsFromContextualType(containingObjectLiteralElement, checker), fromRoot);
+ if (res) return res;
+
+ // If the location is name of property symbol from object literal destructuring pattern
+ // Search the property symbol
+ // for ( { property: p2 } of elems) { }
+ const propertySymbol = getPropertySymbolOfDestructuringAssignment(location, checker);
+ const res1 = propertySymbol && cbSymbol(propertySymbol);
+ if (res1) return res1;
/* Because in short-hand property assignment, location has two meaning : property name and as value of the property
* When we do findAllReference at the position of the short-hand property assignment, we would want to have references to position of
@@ -1407,49 +1390,41 @@ namespace ts.FindAllReferences.Core {
* will be included correctly.
*/
const shorthandValueSymbol = checker.getShorthandAssignmentValueSymbol(location.parent);
- if (shorthandValueSymbol) {
- result.push(shorthandValueSymbol);
- }
+ const res2 = shorthandValueSymbol && cbSymbol(shorthandValueSymbol);
+ if (res2) return res2;
}
- // If the symbol.valueDeclaration is a property parameter declaration,
- // we should include both parameter declaration symbol and property declaration symbol
- // Parameter Declaration symbol is only visible within function scope, so the symbol is stored in constructor.locals.
- // Property Declaration symbol is a member of the class, so the symbol is stored in its class Declaration.symbol.members
- addRange(result, getParameterPropertySymbols(symbol, checker));
+ const res = fromRoot(symbol);
+ if (res) return res;
+
+ if (symbol.valueDeclaration && isParameterPropertyDeclaration(symbol.valueDeclaration)) {
+ // For a parameter property, now try on the other symbol (property if this was a parameter, parameter if this was a property).
+ const paramProps = checker.getSymbolsOfParameterPropertyDeclaration(cast(symbol.valueDeclaration, isParameter), symbol.name);
+ Debug.assert(paramProps.length === 2 && !!(paramProps[0].flags & SymbolFlags.FunctionScopedVariable) && !!(paramProps[1].flags & SymbolFlags.Property)); // is [parameter, property]
+ return fromRoot(symbol.flags & SymbolFlags.FunctionScopedVariable ? paramProps[1] : paramProps[0]);
+ }
// If this is symbol of binding element without propertyName declaration in Object binding pattern
// Include the property in the search
const bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker);
- if (bindingElementPropertySymbol) {
- result.push(bindingElementPropertySymbol);
- addRootSymbols(bindingElementPropertySymbol);
- }
-
- addRootSymbols(symbol);
-
- return result;
-
- function addRootSymbols(sym: Symbol): void {
- // If this is a union property, add all the symbols from all its source symbols in all unioned types.
- // If the symbol is an instantiation from a another symbol (e.g. widened symbol) , add the root the list
- for (const rootSymbol of checker.getRootSymbols(sym)) {
- result.push(rootSymbol);
+ return bindingElementPropertySymbol && fromRoot(bindingElementPropertySymbol);
+ function fromRoot(sym: Symbol): T | undefined {
+ // If this is a union property:
+ // - In populateSearchSymbolsSet we will add all the symbols from all its source symbols in all unioned types.
+ // - In findRelatedSymbol, we will just use the union symbol if any source symbol is included in the search.
+ // If the symbol is an instantiation from a another symbol (e.g. widened symbol):
+ // - In populateSearchSymbolsSet, add the root the list
+ // - In findRelatedSymbol, return the source symbol if that is in the search. (Do not return the instantiation symbol.)
+ return firstDefined(checker.getRootSymbols(sym), rootSymbol =>
+ cbSymbol(sym, rootSymbol)
// Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions
- if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
- getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, checker, result);
- }
- }
+ || (rootSymbol.parent && rootSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface) && allowBaseTypes(rootSymbol)
+ ? getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, checker, base => cbSymbol(sym, rootSymbol, base))
+ : undefined));
}
}
- function getParameterPropertySymbols(symbol: Symbol, checker: TypeChecker): Symbol[] {
- return symbol.valueDeclaration && isParameter(symbol.valueDeclaration) && isParameterPropertyDeclaration(symbol.valueDeclaration)
- ? checker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)
- : undefined;
- }
-
/**
* Find symbol of the given property-name and add the symbol to the given result array
* @param symbol a symbol to start searching for the given propertyName
@@ -1458,100 +1433,35 @@ namespace ts.FindAllReferences.Core {
* @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisiting of the same symbol.
* The value of previousIterationSymbol is undefined when the function is first called.
*/
- function getPropertySymbolsFromBaseTypes(symbol: Symbol, propertyName: string, checker: TypeChecker, result: Symbol[] = []): Symbol[] {
+ function getPropertySymbolsFromBaseTypes(symbol: Symbol, propertyName: string, checker: TypeChecker, cb: (symbol: Symbol) => T | undefined): T | undefined {
const seen = createMap();
- recur(symbol);
- return result;
+ return recur(symbol);
- function recur(symbol: Symbol): void {
+ function recur(symbol: Symbol): T | undefined {
// Use `addToSeen` to ensure we don't infinitely recurse in this situation:
// interface C extends C {
// /*findRef*/propName: string;
// }
if (!(symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) || !addToSeen(seen, getSymbolId(symbol))) return;
- for (const declaration of symbol.declarations) {
- for (const typeReference of getAllSuperTypeNodes(declaration)) {
- const type = checker.getTypeAtLocation(typeReference);
- if (!(type && type.symbol)) continue;
-
- const propertySymbol = checker.getPropertyOfType(type, propertyName);
- if (propertySymbol) {
- result.push(...checker.getRootSymbols(propertySymbol));
- }
-
- // Visit the typeReference as well to see if it directly or indirectly use that property
- recur(type.symbol);
- }
- }
+ return firstDefined(symbol.declarations, declaration => firstDefined(getAllSuperTypeNodes(declaration), typeReference => {
+ const type = checker.getTypeAtLocation(typeReference);
+ const propertySymbol = type && type.symbol && checker.getPropertyOfType(type, propertyName);
+ // Visit the typeReference as well to see if it directly or indirectly uses that property
+ return propertySymbol && (firstDefined(checker.getRootSymbols(propertySymbol), cb) || recur(type.symbol));
+ }));
}
}
function getRelatedSymbol(search: Search, referenceSymbol: Symbol, referenceLocation: Node, state: State): Symbol | undefined {
const { checker } = state;
- if (search.includes(referenceSymbol)) {
- return referenceSymbol;
- }
-
- if (referenceSymbol.flags & SymbolFlags.FunctionScopedVariable) {
- Debug.assert(!(referenceSymbol.flags & SymbolFlags.Property));
- const paramProps = getParameterPropertySymbols(referenceSymbol, checker);
- if (paramProps) {
- return getRelatedSymbol(search, find(paramProps, x => !!(x.flags & SymbolFlags.Property))!, referenceLocation, state);
- }
- }
-
- // If the reference location is in an object literal, try to get the contextual type for the
- // object literal, lookup the property symbol in the contextual type, and use this symbol to
- // compare to our searchSymbol
- const containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation);
- if (containingObjectLiteralElement) {
- const contextualSymbol = firstDefined(getPropertySymbolsFromContextualType(containingObjectLiteralElement, checker), findRootSymbol);
- if (contextualSymbol) {
- return contextualSymbol;
- }
-
- // If the reference location is the name of property from object literal destructuring pattern
- // Get the property symbol from the object literal's type and look if thats the search symbol
- // In below eg. get 'property' from type of elems iterating type
- // for ( { property: p2 } of elems) { }
- const propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation, checker);
- if (propertySymbol && search.includes(propertySymbol)) {
- return propertySymbol;
- }
- }
-
- // If the reference location is the binding element and doesn't have property name
- // then include the binding element in the related symbols
- // let { a } : { a };
- const bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol, checker);
- if (bindingElementPropertySymbol) {
- const fromBindingElement = findRootSymbol(bindingElementPropertySymbol);
- if (fromBindingElement) return fromBindingElement;
- }
-
- return findRootSymbol(referenceSymbol);
-
- function findRootSymbol(sym: Symbol): Symbol | undefined {
- // Unwrap symbols to get to the root (e.g. transient symbols as a result of widening)
- // Or a union property, use its underlying unioned symbols
- return firstDefined(checker.getRootSymbols(sym), rootSymbol =>
- isMatchingRootSymbol(search, rootSymbol, state.inheritsFromCache, checker)
- // For a root symbol that is a component of a union or intersection, use the original (union/intersection) symbol.
- // That we when a symbol references the whole union we avoid claiming it references some particular member of the union.
- // For a transient symbol we want to use the root symbol instead.
- ? getCheckFlags(sym) & CheckFlags.Synthetic ? sym : rootSymbol
- : undefined);
- }
- }
-
- function isMatchingRootSymbol(search: Search, rootSymbol: Symbol, inheritsFromCache: Map, checker: TypeChecker): boolean {
- return search.includes(rootSymbol)
- || rootSymbol.parent && rootSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface)
- // If we were passed a parent symbol (if 'implementations' set), only include types that are subtypes of the parent symbol.
- && !(search.parents && !search.parents.some(parent => explicitlyInheritsFrom(rootSymbol.parent, parent, inheritsFromCache, checker)))
- // Try all properties with the same name in any type the containing type extended or implemented.
- && getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, checker).some(search.includes);
+ return forEachRelatedSymbol(referenceSymbol, referenceLocation, checker,
+ (sym, rootSymbol, baseSymbol) => search.includes(baseSymbol || rootSymbol || sym)
+ // For a base type, use the symbol for the derived type. For a synthetic (e.g. union) property, use the union symbol.
+ ? rootSymbol && !(getCheckFlags(sym) & CheckFlags.Synthetic) ? rootSymbol : sym
+ : undefined,
+ /*allowBaseTypes*/ rootSymbol =>
+ !(search.parents && !some(search.parents, parent => explicitlyInheritsFrom(rootSymbol.parent, parent, state.inheritsFromCache, checker))));
}
/** Gets all symbols for one property. Does not get symbols for every property. */
diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts
index debec04536a..494a811c238 100644
--- a/src/services/formatting/formatting.ts
+++ b/src/services/formatting/formatting.ts
@@ -1,8 +1,3 @@
-///
-///
-///
-///
-
/* @internal */
namespace ts.formatting {
export interface FormatContext {
diff --git a/src/services/formatting/formattingScanner.ts b/src/services/formatting/formattingScanner.ts
index 9b9c956f670..a53a1e5ce26 100644
--- a/src/services/formatting/formattingScanner.ts
+++ b/src/services/formatting/formattingScanner.ts
@@ -1,6 +1,3 @@
-///
-///
-
/* @internal */
namespace ts.formatting {
const standardScanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false, LanguageVariant.Standard);
diff --git a/src/services/formatting/rulesMap.ts b/src/services/formatting/rulesMap.ts
index 75cc68cb268..b10d163343e 100644
--- a/src/services/formatting/rulesMap.ts
+++ b/src/services/formatting/rulesMap.ts
@@ -1,5 +1,3 @@
-///
-
/* @internal */
namespace ts.formatting {
export function getFormatContext(options: FormatCodeSettings): FormatContext {
diff --git a/src/services/goToDefinition.ts b/src/services/goToDefinition.ts
index 4b2ba7e4536..226fe74ef10 100644
--- a/src/services/goToDefinition.ts
+++ b/src/services/goToDefinition.ts
@@ -1,6 +1,6 @@
/* @internal */
namespace ts.GoToDefinition {
- export function getDefinitionAtPosition(program: Program, sourceFile: SourceFile, position: number): DefinitionInfo[] {
+ export function getDefinitionAtPosition(program: Program, sourceFile: SourceFile, position: number): DefinitionInfo[] | undefined {
const reference = getReferenceAtPosition(sourceFile, position, program);
if (reference) {
return [getDefinitionInfoForFileReference(reference.fileName, reference.file.fileName)];
@@ -29,7 +29,7 @@ namespace ts.GoToDefinition {
// Could not find a symbol e.g. node is string or number keyword,
// or the symbol was an internal symbol and does not have a declaration e.g. undefined symbol
if (!symbol) {
- return undefined;
+ return getDefinitionInfoForIndexSignatures(node, typeChecker);
}
// If this is an alias, and the request came at the declaration location
@@ -157,6 +157,16 @@ namespace ts.GoToDefinition {
return { definitions, textSpan };
}
+ // At 'x.foo', see if the type of 'x' has an index signature, and if so find its declarations.
+ function getDefinitionInfoForIndexSignatures(node: Node, checker: TypeChecker): DefinitionInfo[] | undefined {
+ if (!isPropertyAccessExpression(node.parent) || node.parent.name !== node) return;
+ const type = checker.getTypeAtLocation(node.parent.expression);
+ return mapDefined(type.isUnionOrIntersection() ? type.types : [type], nonUnionType => {
+ const info = checker.getIndexInfoOfType(nonUnionType, IndexKind.String);
+ return info && info.declaration && createDefinitionFromSignatureDeclaration(checker, info.declaration);
+ });
+ }
+
// Go to the original declaration for cases:
//
// (1) when the aliased symbol was declared in the location(parent).
diff --git a/src/services/importTracker.ts b/src/services/importTracker.ts
index de8a49243fa..82f9fc00af6 100644
--- a/src/services/importTracker.ts
+++ b/src/services/importTracker.ts
@@ -12,10 +12,10 @@ namespace ts.FindAllReferences {
export type ImportTracker = (exportSymbol: Symbol, exportInfo: ExportInfo, isForRename: boolean) => ImportsResult;
/** Creates the imports map and returns an ImportTracker that uses it. Call this lazily to avoid calling `getDirectImportsMap` unnecessarily. */
- export function createImportTracker(sourceFiles: ReadonlyArray, checker: TypeChecker, cancellationToken: CancellationToken): ImportTracker {
+ export function createImportTracker(sourceFiles: ReadonlyArray, sourceFilesSet: ReadonlyMap, checker: TypeChecker, cancellationToken: CancellationToken): ImportTracker {
const allDirectImports = getDirectImportsMap(sourceFiles, checker, cancellationToken);
return (exportSymbol, exportInfo, isForRename) => {
- const { directImports, indirectUsers } = getImportersForExport(sourceFiles, allDirectImports, exportInfo, checker, cancellationToken);
+ const { directImports, indirectUsers } = getImportersForExport(sourceFiles, sourceFilesSet, allDirectImports, exportInfo, checker, cancellationToken);
return { indirectUsers, ...getSearchesFromDirectImports(directImports, exportSymbol, exportInfo.exportKind, checker, isForRename) };
};
}
@@ -39,6 +39,7 @@ namespace ts.FindAllReferences {
/** Returns import statements that directly reference the exporting module, and a list of files that may access the module through a namespace. */
function getImportersForExport(
sourceFiles: ReadonlyArray,
+ sourceFilesSet: ReadonlyMap,
allDirectImports: Map,
{ exportingModuleSymbol, exportKind }: ExportInfo,
checker: TypeChecker,
@@ -62,7 +63,7 @@ namespace ts.FindAllReferences {
// Module augmentations may use this module's exports without importing it.
for (const decl of exportingModuleSymbol.declarations) {
- if (isExternalModuleAugmentation(decl)) {
+ if (isExternalModuleAugmentation(decl) && sourceFilesSet.has(decl.getSourceFile().fileName)) {
addIndirectUser(decl);
}
}
diff --git a/src/services/jsTyping.ts b/src/services/jsTyping.ts
index 393b8ca34e0..6b4f7f2e1d4 100644
--- a/src/services/jsTyping.ts
+++ b/src/services/jsTyping.ts
@@ -1,11 +1,3 @@
-// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0.
-// See LICENSE.txt in the project root for complete license information.
-
-///
-///
-///
-///
-
/* @internal */
namespace ts.JsTyping {
diff --git a/src/services/navigateTo.ts b/src/services/navigateTo.ts
index 1a556cf33c0..84c299abf61 100644
--- a/src/services/navigateTo.ts
+++ b/src/services/navigateTo.ts
@@ -10,6 +10,7 @@ namespace ts.NavigateTo {
export function getNavigateToItems(sourceFiles: ReadonlyArray, checker: TypeChecker, cancellationToken: CancellationToken, searchValue: string, maxResultCount: number, excludeDtsFiles: boolean): NavigateToItem[] {
const patternMatcher = createPatternMatcher(searchValue);
+ if (!patternMatcher) return emptyArray;
let rawItems: RawNavigateToItem[] = [];
// Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[]
@@ -35,28 +36,24 @@ namespace ts.NavigateTo {
function getItemsFromNamedDeclaration(patternMatcher: PatternMatcher, name: string, declarations: ReadonlyArray, checker: TypeChecker, fileName: string, rawItems: Push): void {
// First do a quick check to see if the name of the declaration matches the
// last portion of the (possibly) dotted name they're searching for.
- const matches = patternMatcher.getMatchesForLastSegmentOfPattern(name);
-
- if (!matches) {
+ const match = patternMatcher.getMatchForLastSegmentOfPattern(name);
+ if (!match) {
return; // continue to next named declarations
}
for (const declaration of declarations) {
- if (!shouldKeepItem(declaration, checker)) {
- continue;
- }
+ if (!shouldKeepItem(declaration, checker)) continue;
- // It was a match! If the pattern has dots in it, then also see if the
- // declaration container matches as well.
- let containerMatches = matches;
if (patternMatcher.patternContainsDots) {
- containerMatches = patternMatcher.getMatches(getContainers(declaration), name);
- if (!containerMatches) {
- continue;
+ const fullMatch = patternMatcher.getFullMatch(getContainers(declaration), name);
+ if (fullMatch) {
+ rawItems.push({ name, fileName, matchKind: fullMatch.kind, isCaseSensitive: fullMatch.isCaseSensitive, declaration });
}
}
-
- rawItems.push({ name, fileName, matchKind: Math.min(...matches.map(m => m.kind)), isCaseSensitive: matches.every(m => m.isCaseSensitive), declaration });
+ else {
+ // If the pattern has dots in it, then also see if the declaration container matches as well.
+ rawItems.push({ name, fileName, matchKind: match.kind, isCaseSensitive: match.isCaseSensitive, declaration });
+ }
}
}
diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts
index e2176d2c1c9..b029796e718 100644
--- a/src/services/navigationBar.ts
+++ b/src/services/navigationBar.ts
@@ -1,5 +1,3 @@
-///
-
/* @internal */
namespace ts.NavigationBar {
/**
diff --git a/src/services/organizeImports.ts b/src/services/organizeImports.ts
index 52f9a50366f..5109b050b6b 100644
--- a/src/services/organizeImports.ts
+++ b/src/services/organizeImports.ts
@@ -131,9 +131,7 @@ namespace ts.OrganizeImports {
}
function getExternalModuleName(specifier: Expression) {
- return isStringLiteral(specifier) || isNoSubstitutionTemplateLiteral(specifier)
- ? specifier.text
- : undefined;
+ return isStringLiteralLike(specifier) ? specifier.text : undefined;
}
/* @internal */ // Internal for testing
diff --git a/src/services/pathCompletions.ts b/src/services/pathCompletions.ts
index 976449efee5..99ce0afb36c 100644
--- a/src/services/pathCompletions.ts
+++ b/src/services/pathCompletions.ts
@@ -137,8 +137,9 @@ namespace ts.Completions.PathCompletions {
if (directories) {
for (const directory of directories) {
const directoryName = getBaseFileName(normalizePath(directory));
-
- result.push(nameAndKind(directoryName, ScriptElementKind.directory));
+ if (directoryName !== "@types") {
+ result.push(nameAndKind(directoryName, ScriptElementKind.directory));
+ }
}
}
}
@@ -177,19 +178,33 @@ namespace ts.Completions.PathCompletions {
}
}
- if (compilerOptions.moduleResolution === ModuleResolutionKind.NodeJs) {
- forEachAncestorDirectory(scriptPath, ancestor => {
- const nodeModules = combinePaths(ancestor, "node_modules");
- if (host.directoryExists(nodeModules)) {
- getCompletionEntriesForDirectoryFragment(fragment, nodeModules, fileExtensions, /*includeExtensions*/ false, host, /*exclude*/ undefined, result);
- }
- });
+ const fragmentDirectory = containsSlash(fragment) ? getDirectoryPath(fragment) : undefined;
+ for (const ambientName of getAmbientModuleCompletions(fragment, fragmentDirectory, typeChecker)) {
+ result.push(nameAndKind(ambientName, ScriptElementKind.externalModuleName));
}
getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, result);
- for (const moduleName of enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions, typeChecker, host)) {
- result.push(nameAndKind(moduleName, ScriptElementKind.externalModuleName));
+ if (getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.NodeJs) {
+ // If looking for a global package name, don't just include everything in `node_modules` because that includes dependencies' own dependencies.
+ // (But do if we didn't find anything, e.g. 'package.json' missing.)
+ let foundGlobal = false;
+ if (fragmentDirectory === undefined) {
+ for (const moduleName of enumerateNodeModulesVisibleToScript(host, scriptPath)) {
+ if (!result.some(entry => entry.name === moduleName)) {
+ foundGlobal = true;
+ result.push(nameAndKind(moduleName, ScriptElementKind.externalModuleName));
+ }
+ }
+ }
+ if (!foundGlobal) {
+ forEachAncestorDirectory(scriptPath, ancestor => {
+ const nodeModules = combinePaths(ancestor, "node_modules");
+ if (tryDirectoryExists(host, nodeModules)) {
+ getCompletionEntriesForDirectoryFragment(fragment, nodeModules, fileExtensions, /*includeExtensions*/ false, host, /*exclude*/ undefined, result);
+ }
+ });
+ }
}
return result;
@@ -228,7 +243,7 @@ namespace ts.Completions.PathCompletions {
const normalizedPrefixDirectory = getDirectoryPath(normalizedPrefix);
const normalizedPrefixBase = getBaseFileName(normalizedPrefix);
- const fragmentHasPath = stringContains(fragment, directorySeparator);
+ const fragmentHasPath = containsSlash(fragment);
// Try and expand the prefix to include any path from the fragment so that we can limit the readDirectory call
const expandedPrefixDirectory = fragmentHasPath ? combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + getDirectoryPath(fragment)) : normalizedPrefixDirectory;
@@ -262,45 +277,19 @@ namespace ts.Completions.PathCompletions {
return path[0] === directorySeparator ? path.slice(1) : path;
}
- function enumeratePotentialNonRelativeModules(fragment: string, scriptPath: string, options: CompilerOptions, typeChecker: TypeChecker, host: LanguageServiceHost): string[] {
- // Check If this is a nested module
- const isNestedModule = stringContains(fragment, directorySeparator);
- const moduleNameFragment = isNestedModule ? fragment.substr(0, fragment.lastIndexOf(directorySeparator)) : undefined;
-
+ function getAmbientModuleCompletions(fragment: string, fragmentDirectory: string | undefined, checker: TypeChecker): ReadonlyArray {
// Get modules that the type checker picked up
- const ambientModules = map(typeChecker.getAmbientModules(), sym => stripQuotes(sym.name));
- let nonRelativeModuleNames = filter(ambientModules, moduleName => startsWith(moduleName, fragment));
+ const ambientModules = checker.getAmbientModules().map(sym => stripQuotes(sym.name));
+ const nonRelativeModuleNames = ambientModules.filter(moduleName => startsWith(moduleName, fragment));
// Nested modules of the form "module-name/sub" need to be adjusted to only return the string
// after the last '/' that appears in the fragment because that's where the replacement span
// starts
- if (isNestedModule) {
- const moduleNameWithSeperator = ensureTrailingDirectorySeparator(moduleNameFragment);
- nonRelativeModuleNames = map(nonRelativeModuleNames, nonRelativeModuleName => {
- return removePrefix(nonRelativeModuleName, moduleNameWithSeperator);
- });
+ if (fragmentDirectory !== undefined) {
+ const moduleNameWithSeperator = ensureTrailingDirectorySeparator(fragmentDirectory);
+ return nonRelativeModuleNames.map(nonRelativeModuleName => removePrefix(nonRelativeModuleName, moduleNameWithSeperator));
}
-
-
- if (!options.moduleResolution || options.moduleResolution === ModuleResolutionKind.NodeJs) {
- for (const visibleModule of enumerateNodeModulesVisibleToScript(host, scriptPath)) {
- if (!isNestedModule) {
- nonRelativeModuleNames.push(visibleModule.moduleName);
- }
- else if (startsWith(visibleModule.moduleName, moduleNameFragment)) {
- const nestedFiles = tryReadDirectory(host, visibleModule.moduleDir, supportedTypeScriptExtensions, /*exclude*/ undefined, /*include*/ ["./*"]);
- if (nestedFiles) {
- for (let f of nestedFiles) {
- f = normalizePath(f);
- const nestedModule = removeFileExtension(getBaseFileName(f));
- nonRelativeModuleNames.push(nestedModule);
- }
- }
- }
- }
- }
-
- return deduplicate(nonRelativeModuleNames, equateStringsCaseSensitive, compareStringsCaseSensitive);
+ return nonRelativeModuleNames;
}
export function getTripleSlashReferenceCompletion(sourceFile: SourceFile, position: number, compilerOptions: CompilerOptions, host: LanguageServiceHost): ReadonlyArray | undefined {
@@ -390,48 +379,16 @@ namespace ts.Completions.PathCompletions {
return paths;
}
- function enumerateNodeModulesVisibleToScript(host: LanguageServiceHost, scriptPath: string) {
- const result: VisibleModuleInfo[] = [];
+ function enumerateNodeModulesVisibleToScript(host: LanguageServiceHost, scriptPath: string): ReadonlyArray {
+ if (!host.readFile || !host.fileExists) return emptyArray;
- if (host.readFile && host.fileExists) {
- for (const packageJson of findPackageJsons(scriptPath, host)) {
- const contents = tryReadingPackageJson(packageJson);
- if (!contents) {
- return;
- }
-
- const nodeModulesDir = combinePaths(getDirectoryPath(packageJson), "node_modules");
- const foundModuleNames: string[] = [];
-
- // Provide completions for all non @types dependencies
- for (const key of nodeModulesDependencyKeys) {
- addPotentialPackageNames(contents[key], foundModuleNames);
- }
-
- for (const moduleName of foundModuleNames) {
- const moduleDir = combinePaths(nodeModulesDir, moduleName);
- result.push({
- moduleName,
- moduleDir
- });
- }
- }
- }
-
- return result;
-
- function tryReadingPackageJson(filePath: string) {
- try {
- const fileText = tryReadFile(host, filePath);
- return fileText ? JSON.parse(fileText) : undefined;
- }
- catch (e) {
- return undefined;
- }
- }
-
- function addPotentialPackageNames(dependencies: any, result: string[]) {
- if (dependencies) {
+ const result: string[] = [];
+ for (const packageJson of findPackageJsons(scriptPath, host)) {
+ const contents = readJson(packageJson, host as { readFile: (filename: string) => string | undefined }); // Cast to assert that readFile is defined
+ // Provide completions for all non @types dependencies
+ for (const key of nodeModulesDependencyKeys) {
+ const dependencies: object | undefined = (contents as any)[key];
+ if (!dependencies) continue;
for (const dep in dependencies) {
if (dependencies.hasOwnProperty(dep) && !startsWith(dep, "@types/")) {
result.push(dep);
@@ -439,6 +396,7 @@ namespace ts.Completions.PathCompletions {
}
}
}
+ return result;
}
// Replace everything after the last directory seperator that appears
@@ -484,11 +442,6 @@ namespace ts.Completions.PathCompletions {
*/
const tripleSlashDirectiveFragmentRegex = /^(\/\/\/\s*, candidate: string): PatternMatch | undefined;
// Whether or not the pattern contained dots or not. Clients can use this to determine
// If they should call getMatches, or if getMatchesForLastSegmentOfPattern is sufficient.
@@ -97,31 +97,25 @@ namespace ts {
};
}
- export function createPatternMatcher(pattern: string): PatternMatcher {
+ export function createPatternMatcher(pattern: string): PatternMatcher | undefined {
// We'll often see the same candidate string many times when searching (For example, when
// we see the name of a module that is used everywhere, or the name of an overload). As
// such, we cache the information we compute about the candidate for the life of this
// pattern matcher so we don't have to compute it multiple times.
const stringToWordSpans = createMap();
- pattern = pattern.trim();
-
- const dotSeparatedSegments = pattern.split(".").map(p => createSegment(p.trim()));
- const invalidPattern = dotSeparatedSegments.length === 0 || forEach(dotSeparatedSegments, segmentIsInvalid);
+ const dotSeparatedSegments = pattern.trim().split(".").map(p => createSegment(p.trim()));
+ // A segment is considered invalid if we couldn't find any words in it.
+ if (dotSeparatedSegments.some(segment => !segment.subWordTextChunks.length)) return undefined;
return {
- getMatches: (containers, candidate) => skipMatch(candidate) ? undefined : getMatches(containers, candidate, dotSeparatedSegments, stringToWordSpans),
- getMatchesForLastSegmentOfPattern: candidate => skipMatch(candidate) ? undefined : matchSegment(candidate, lastOrUndefined(dotSeparatedSegments), stringToWordSpans),
+ getFullMatch: (containers, candidate) => getFullMatch(containers, candidate, dotSeparatedSegments, stringToWordSpans),
+ getMatchForLastSegmentOfPattern: candidate => matchSegment(candidate, last(dotSeparatedSegments), stringToWordSpans),
patternContainsDots: dotSeparatedSegments.length > 1
};
-
- // Quick checks so we can bail out when asked to match a candidate.
- function skipMatch(candidate: string) {
- return invalidPattern || !candidate;
- }
}
- function getMatches(candidateContainers: ReadonlyArray, candidate: string, dotSeparatedSegments: ReadonlyArray, stringToWordSpans: Map): PatternMatch[] | undefined {
+ function getFullMatch(candidateContainers: ReadonlyArray, candidate: string, dotSeparatedSegments: ReadonlyArray, stringToWordSpans: Map): PatternMatch | undefined {
// First, check that the last part of the dot separated pattern matches the name of the
// candidate. If not, then there's no point in proceeding and doing the more
// expensive work.
@@ -140,29 +134,13 @@ namespace ts {
return undefined;
}
- // So far so good. Now break up the container for the candidate and check if all
- // the dotted parts match up correctly.
- const totalMatch = candidateMatch;
-
+ let bestMatch: PatternMatch | undefined;
for (let i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1;
i >= 0;
i -= 1, j -= 1) {
-
- const segment = dotSeparatedSegments[i];
- const containerName = candidateContainers[j];
-
- const containerMatch = matchSegment(containerName, segment, stringToWordSpans);
- if (!containerMatch) {
- // This container didn't match the pattern piece. So there's no match at all.
- return undefined;
- }
-
- addRange(totalMatch, containerMatch);
+ bestMatch = betterMatch(bestMatch, matchSegment(candidateContainers[j], dotSeparatedSegments[i], stringToWordSpans));
}
-
- // Success, this symbol's full name matched against the dotted name the user was asking
- // about.
- return totalMatch;
+ return bestMatch;
}
function getWordSpans(word: string, stringToWordSpans: Map): TextSpan[] {
@@ -225,7 +203,7 @@ namespace ts {
}
}
- function matchSegment(candidate: string, segment: Segment, stringToWordSpans: Map): PatternMatch[] {
+ function matchSegment(candidate: string, segment: Segment, stringToWordSpans: Map): PatternMatch {
// First check if the segment matches as is. This is also useful if the segment contains
// characters we would normally strip when splitting into parts that we also may want to
// match in the candidate. For example if the segment is "@int" and the candidate is
@@ -235,9 +213,7 @@ namespace ts {
// multi-word segment.
if (every(segment.totalTextChunk.text, ch => ch !== CharacterCodes.space && ch !== CharacterCodes.asterisk)) {
const match = matchTextChunk(candidate, segment.totalTextChunk, stringToWordSpans);
- if (match) {
- return [match];
- }
+ if (match) return match;
}
// The logic for pattern matching is now as follows:
@@ -277,20 +253,19 @@ namespace ts {
// Only if all words have some sort of match is the pattern considered matched.
const subWordTextChunks = segment.subWordTextChunks;
- let matches: PatternMatch[];
-
+ let bestMatch: PatternMatch | undefined;
for (const subWordTextChunk of subWordTextChunks) {
- // Try to match the candidate with this word
- const result = matchTextChunk(candidate, subWordTextChunk, stringToWordSpans);
- if (!result) {
- return undefined;
- }
-
- matches = matches || [];
- matches.push(result);
+ bestMatch = betterMatch(bestMatch, matchTextChunk(candidate, subWordTextChunk, stringToWordSpans));
}
+ return bestMatch;
+ }
- return matches;
+ function betterMatch(a: PatternMatch | undefined, b: PatternMatch | undefined): PatternMatch {
+ return min(a, b, compareMatches);
+ }
+ function compareMatches(a: PatternMatch | undefined, b: PatternMatch | undefined): Comparison {
+ return a === undefined ? Comparison.GreaterThan : b === undefined ? Comparison.LessThan
+ : compareValues(a.kind, b.kind) || compareBooleans(!a.isCaseSensitive, !b.isCaseSensitive);
}
function partStartsWith(candidate: string, candidateSpan: TextSpan, pattern: string, ignoreCase: boolean, patternSpan: TextSpan = { start: 0, length: pattern.length }): boolean {
@@ -381,11 +356,6 @@ namespace ts {
};
}
- // A segment is considered invalid if we couldn't find any words in it.
- function segmentIsInvalid(segment: Segment) {
- return segment.subWordTextChunks.length === 0;
- }
-
function isUpperCaseLetter(ch: number) {
// Fast check for the ascii range.
if (ch >= CharacterCodes.A && ch <= CharacterCodes.Z) {
diff --git a/src/services/refactors/extractSymbol.ts b/src/services/refactors/extractSymbol.ts
index b99a4b26552..5805a986180 100644
--- a/src/services/refactors/extractSymbol.ts
+++ b/src/services/refactors/extractSymbol.ts
@@ -1,6 +1,3 @@
-///
-///
-
/* @internal */
namespace ts.refactor.extractSymbol {
const refactorName = "Extract Symbol";
@@ -701,14 +698,6 @@ namespace ts.refactor.extractSymbol {
Global,
}
- function getUniqueName(baseName: string, fileText: string): string {
- let nameText = baseName;
- for (let i = 1; stringContains(fileText, nameText); i++) {
- nameText = `${baseName}_${i}`;
- }
- return nameText;
- }
-
/**
* Result of 'extractRange' operation for a specific scope.
* Stores either a list of changes that should be applied to extract a range or a list of errors
@@ -1129,37 +1118,6 @@ namespace ts.refactor.extractSymbol {
}
}
- /**
- * @return The index of the (only) reference to the extracted symbol. We want the cursor
- * to be on the reference, rather than the declaration, because it's closer to where the
- * user was before extracting it.
- */
- function getRenameLocation(edits: ReadonlyArray, renameFilename: string, functionNameText: string, isDeclaredBeforeUse: boolean): number {
- let delta = 0;
- let lastPos = -1;
- for (const { fileName, textChanges } of edits) {
- Debug.assert(fileName === renameFilename);
- for (const change of textChanges) {
- const { span, newText } = change;
- const index = newText.indexOf(functionNameText);
- if (index !== -1) {
- lastPos = span.start + delta + index;
-
- // If the reference comes first, return immediately.
- if (!isDeclaredBeforeUse) {
- return lastPos;
- }
- }
- delta += newText.length - span.length;
- }
- }
-
- // If the declaration comes first, return the position of the last occurrence.
- Debug.assert(isDeclaredBeforeUse);
- Debug.assert(lastPos >= 0);
- return lastPos;
- }
-
function getFirstDeclaration(type: Type): Declaration | undefined {
let firstDeclaration;
diff --git a/src/services/refactors/generateGetAccessorAndSetAccessor.ts b/src/services/refactors/generateGetAccessorAndSetAccessor.ts
new file mode 100644
index 00000000000..2f1f5279680
--- /dev/null
+++ b/src/services/refactors/generateGetAccessorAndSetAccessor.ts
@@ -0,0 +1,243 @@
+/* @internal */
+namespace ts.refactor.generateGetAccessorAndSetAccessor {
+ const actionName = "Generate 'get' and 'set' accessors";
+ const actionDescription = Diagnostics.Generate_get_and_set_accessors.message;
+ registerRefactor(actionName, { getEditsForAction, getAvailableActions });
+
+ type AcceptedDeclaration = ParameterDeclaration | PropertyDeclaration | PropertyAssignment;
+ type AcceptedNameType = Identifier | StringLiteral;
+ type ContainerDeclaration = ClassLikeDeclaration | ObjectLiteralExpression;
+
+ interface DeclarationInfo {
+ container: ContainerDeclaration;
+ isStatic: boolean;
+ type: TypeNode | undefined;
+ }
+
+ interface Info extends DeclarationInfo {
+ declaration: AcceptedDeclaration;
+ fieldName: AcceptedNameType;
+ accessorName: AcceptedNameType;
+ }
+
+ function getAvailableActions(context: RefactorContext): ApplicableRefactorInfo[] | undefined {
+ const { file, startPosition } = context;
+ if (!getConvertibleFieldAtPosition(file, startPosition)) return undefined;
+
+ return [{
+ name: actionName,
+ description: actionDescription,
+ actions: [
+ {
+ name: actionName,
+ description: actionDescription
+ }
+ ]
+ }];
+ }
+
+ function getEditsForAction(context: RefactorContext, _actionName: string): RefactorEditInfo | undefined {
+ const { file, startPosition } = context;
+
+ const fieldInfo = getConvertibleFieldAtPosition(file, startPosition);
+ if (!fieldInfo) return undefined;
+
+ const isJS = isSourceFileJavaScript(file);
+ const changeTracker = textChanges.ChangeTracker.fromContext(context);
+ const { isStatic, fieldName, accessorName, type, container, declaration } = fieldInfo;
+
+ const isInClassLike = isClassLike(container);
+ const accessorModifiers = isInClassLike
+ ? !declaration.modifiers || getModifierFlags(declaration) & ModifierFlags.Private ? getModifiers(isJS, isStatic, SyntaxKind.PublicKeyword) : declaration.modifiers
+ : undefined;
+ const fieldModifiers = isInClassLike ? getModifiers(isJS, isStatic, SyntaxKind.PrivateKeyword) : undefined;
+
+ updateFieldDeclaration(changeTracker, file, declaration, fieldName, fieldModifiers, container);
+
+ const getAccessor = generateGetAccessor(fieldName, accessorName, type, accessorModifiers, isStatic, container);
+ const setAccessor = generateSetAccessor(fieldName, accessorName, type, accessorModifiers, isStatic, container);
+
+ insertAccessor(changeTracker, file, getAccessor, declaration, container);
+ insertAccessor(changeTracker, file, setAccessor, declaration, container);
+
+ const edits = changeTracker.getChanges();
+ const renameFilename = file.fileName;
+ const renameLocationOffset = isIdentifier(fieldName) ? 0 : -1;
+ const renameLocation = renameLocationOffset + getRenameLocation(edits, renameFilename, fieldName.text, /*isDeclaredBeforeUse*/ false);
+ return { renameFilename, renameLocation, edits };
+ }
+
+ function isConvertableName (name: DeclarationName): name is AcceptedNameType {
+ return isIdentifier(name) || isStringLiteral(name);
+ }
+
+ function isAcceptedDeclaration(node: Node): node is AcceptedDeclaration {
+ return isParameterPropertyDeclaration(node) || isPropertyDeclaration(node) || isPropertyAssignment(node);
+ }
+
+ function createPropertyName (name: string, originalName: AcceptedNameType) {
+ return isIdentifier(originalName) ? createIdentifier(name) : createLiteral(name);
+ }
+
+ function createAccessorAccessExpression (fieldName: AcceptedNameType, isStatic: boolean, container: ContainerDeclaration) {
+ const leftHead = isStatic ? (container).name : createThis();
+ return isIdentifier(fieldName) ? createPropertyAccess(leftHead, fieldName) : createElementAccess(leftHead, createLiteral(fieldName));
+ }
+
+ function getModifiers(isJS: boolean, isStatic: boolean, accessModifier: SyntaxKind.PublicKeyword | SyntaxKind.PrivateKeyword): NodeArray {
+ const modifiers = append(
+ !isJS ? [createToken(accessModifier) as Token | Token] : undefined,
+ isStatic ? createToken(SyntaxKind.StaticKeyword) : undefined
+ );
+ return modifiers && createNodeArray(modifiers);
+ }
+
+ function getPropertyDeclarationInfo(propertyDeclaration: PropertyDeclaration): DeclarationInfo | undefined {
+ if (!isClassLike(propertyDeclaration.parent) || !propertyDeclaration.parent.members) return undefined;
+
+ return {
+ isStatic: hasStaticModifier(propertyDeclaration),
+ type: propertyDeclaration.type,
+ container: propertyDeclaration.parent
+ };
+ }
+
+ function getParameterPropertyDeclarationInfo(parameterDeclaration: ParameterDeclaration): DeclarationInfo | undefined {
+ if (!isClassLike(parameterDeclaration.parent.parent) || !parameterDeclaration.parent.parent.members) return undefined;
+
+ return {
+ isStatic: false,
+ type: parameterDeclaration.type,
+ container: parameterDeclaration.parent.parent
+ };
+ }
+
+ function getPropertyAssignmentDeclarationInfo(propertyAssignment: PropertyAssignment): DeclarationInfo | undefined {
+ return {
+ isStatic: false,
+ type: undefined,
+ container: propertyAssignment.parent
+ };
+ }
+
+ function getDeclarationInfo(declaration: AcceptedDeclaration) {
+ if (isPropertyDeclaration(declaration)) {
+ return getPropertyDeclarationInfo(declaration);
+ }
+ else if (isPropertyAssignment(declaration)) {
+ return getPropertyAssignmentDeclarationInfo(declaration);
+ }
+ else {
+ return getParameterPropertyDeclarationInfo(declaration);
+ }
+ }
+
+ function getConvertibleFieldAtPosition(file: SourceFile, startPosition: number): Info | undefined {
+ const node = getTokenAtPosition(file, startPosition, /*includeJsDocComment*/ false);
+ const declaration = findAncestor(node.parent, isAcceptedDeclaration);
+ // make sure propertyDeclaration have AccessibilityModifier or Static Modifier
+ const meaning = ModifierFlags.AccessibilityModifier | ModifierFlags.Static;
+ if (!declaration || !isConvertableName(declaration.name) || (getModifierFlags(declaration) | meaning) !== meaning) return undefined;
+
+ const info = getDeclarationInfo(declaration);
+ const fieldName = createPropertyName(getUniqueName(`_${declaration.name.text}`, file.text), declaration.name);
+ suppressLeadingAndTrailingTrivia(fieldName);
+ suppressLeadingAndTrailingTrivia(declaration);
+ return {
+ ...info,
+ declaration,
+ fieldName,
+ accessorName: createPropertyName(declaration.name.text, declaration.name)
+ };
+ }
+
+ function generateGetAccessor(fieldName: AcceptedNameType, accessorName: AcceptedNameType, type: TypeNode, modifiers: ModifiersArray | undefined, isStatic: boolean, container: ContainerDeclaration) {
+ return createGetAccessor(
+ /*decorators*/ undefined,
+ modifiers,
+ accessorName,
+ /*parameters*/ undefined,
+ type,
+ createBlock([
+ createReturn(
+ createAccessorAccessExpression(fieldName, isStatic, container)
+ )
+ ], /*multiLine*/ true)
+ );
+ }
+
+ function generateSetAccessor(fieldName: AcceptedNameType, accessorName: AcceptedNameType, type: TypeNode, modifiers: ModifiersArray | undefined, isStatic: boolean, container: ContainerDeclaration) {
+ return createSetAccessor(
+ /*decorators*/ undefined,
+ modifiers,
+ accessorName,
+ [createParameter(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined,
+ /*dotDotDotToken*/ undefined,
+ createIdentifier("value"),
+ /*questionToken*/ undefined,
+ type
+ )],
+ createBlock([
+ createStatement(
+ createAssignment(
+ createAccessorAccessExpression(fieldName, isStatic, container),
+ createIdentifier("value")
+ )
+ )
+ ], /*multiLine*/ true)
+ );
+ }
+
+ function updatePropertyDeclaration(changeTracker: textChanges.ChangeTracker, file: SourceFile, declaration: PropertyDeclaration, fieldName: AcceptedNameType, modifiers: ModifiersArray | undefined) {
+ const property = updateProperty(
+ declaration,
+ declaration.decorators,
+ modifiers,
+ fieldName,
+ declaration.questionToken || declaration.exclamationToken,
+ declaration.type,
+ declaration.initializer
+ );
+
+ changeTracker.replaceNode(file, declaration, property);
+ }
+
+ function updateParameterPropertyDeclaration(changeTracker: textChanges.ChangeTracker, file: SourceFile, declaration: ParameterDeclaration, fieldName: AcceptedNameType, modifiers: ModifiersArray | undefined, classLikeContainer: ClassLikeDeclaration) {
+ const property = createProperty(
+ declaration.decorators,
+ modifiers,
+ fieldName,
+ declaration.questionToken,
+ declaration.type,
+ declaration.initializer
+ );
+
+ changeTracker.insertNodeAtClassStart(file, classLikeContainer, property);
+ changeTracker.deleteNodeInList(file, declaration);
+ }
+
+ function updatePropertyAssignmentDeclaration (changeTracker: textChanges.ChangeTracker, file: SourceFile, declaration: PropertyAssignment, fieldName: AcceptedNameType) {
+ const assignment = updatePropertyAssignment(declaration, fieldName, declaration.initializer);
+ changeTracker.replacePropertyAssignment(file, declaration, assignment);
+ }
+
+ function updateFieldDeclaration(changeTracker: textChanges.ChangeTracker, file: SourceFile, declaration: AcceptedDeclaration, fieldName: AcceptedNameType, modifiers: ModifiersArray | undefined, container: ContainerDeclaration) {
+ if (isPropertyDeclaration(declaration)) {
+ updatePropertyDeclaration(changeTracker, file, declaration, fieldName, modifiers);
+ }
+ else if (isPropertyAssignment(declaration)) {
+ updatePropertyAssignmentDeclaration(changeTracker, file, declaration, fieldName);
+ }
+ else {
+ updateParameterPropertyDeclaration(changeTracker, file, declaration, fieldName, modifiers, container);
+ }
+ }
+
+ function insertAccessor(changeTracker: textChanges.ChangeTracker, file: SourceFile, accessor: AccessorDeclaration, declaration: AcceptedDeclaration, container: ContainerDeclaration) {
+ isParameterPropertyDeclaration(declaration)
+ ? changeTracker.insertNodeAtClassStart(file, container, accessor)
+ : changeTracker.insertNodeAfter(file, declaration, accessor);
+ }
+}
diff --git a/src/services/refactors/refactors.ts b/src/services/refactors/refactors.ts
index da2f08a8e9f..bc845bd8dc0 100644
--- a/src/services/refactors/refactors.ts
+++ b/src/services/refactors/refactors.ts
@@ -1 +1 @@
-///
+// Please delete me later.
diff --git a/src/services/rename.ts b/src/services/rename.ts
index c40f7908776..2f9de0c0cad 100644
--- a/src/services/rename.ts
+++ b/src/services/rename.ts
@@ -2,7 +2,7 @@
namespace ts.Rename {
export function getRenameInfo(typeChecker: TypeChecker, defaultLibFileName: string, getCanonicalFileName: GetCanonicalFileName, sourceFile: SourceFile, position: number): RenameInfo {
const getCanonicalDefaultLibName = memoize(() => getCanonicalFileName(normalizePath(defaultLibFileName)));
- const node = getTouchingWord(sourceFile, position, /*includeJsDocComment*/ true);
+ const node = getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true);
const renameInfo = node && nodeIsEligibleForRename(node)
? getRenameInfoForNode(node, typeChecker, sourceFile, isDefinedInLibraryFile)
: undefined;
diff --git a/src/services/services.ts b/src/services/services.ts
index d6405b8e732..bed301e452f 100644
--- a/src/services/services.ts
+++ b/src/services/services.ts
@@ -1,37 +1,3 @@
-///
-///
-
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-
namespace ts {
/** The version of the language service API */
export const servicesVersion = "0.8";
@@ -1697,20 +1663,17 @@ namespace ts {
/// References and Occurrences
function getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[] {
- const canonicalFileName = getCanonicalFileName(normalizeSlashes(fileName));
- return flatMap(getDocumentHighlights(fileName, position, [fileName]), entry => entry.highlightSpans.map(highlightSpan => {
- Debug.assert(getCanonicalFileName(normalizeSlashes(entry.fileName)) === canonicalFileName); // Get occurrences only supports reporting occurrences for the file queried.
- return {
- fileName: entry.fileName,
- textSpan: highlightSpan.textSpan,
- isWriteAccess: highlightSpan.kind === HighlightSpanKind.writtenReference,
- isDefinition: false,
- isInString: highlightSpan.isInString,
- };
- }));
+ return flatMap(getDocumentHighlights(fileName, position, [fileName]), entry => entry.highlightSpans.map(highlightSpan => ({
+ fileName: entry.fileName,
+ textSpan: highlightSpan.textSpan,
+ isWriteAccess: highlightSpan.kind === HighlightSpanKind.writtenReference,
+ isDefinition: false,
+ isInString: highlightSpan.isInString,
+ })));
}
function getDocumentHighlights(fileName: string, position: number, filesToSearch: ReadonlyArray): DocumentHighlights[] {
+ Debug.assert(contains(filesToSearch, fileName));
synchronizeHostData();
const sourceFilesToSearch = map(filesToSearch, f => Debug.assertDefined(program.getSourceFile(f)));
const sourceFile = getValidSourceFile(fileName);
diff --git a/src/services/shims.ts b/src/services/shims.ts
index 4ed1afb8813..b8beccab20b 100644
--- a/src/services/shims.ts
+++ b/src/services/shims.ts
@@ -13,8 +13,6 @@
// limitations under the License.
//
-///
-
/* @internal */
let debugObjectHost: { CollectGarbage(): void } = (function (this: any) { return this; })();
diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts
index 250127ecfc6..156539557a3 100644
--- a/src/services/signatureHelp.ts
+++ b/src/services/signatureHelp.ts
@@ -1,4 +1,3 @@
-///
/* @internal */
namespace ts.SignatureHelp {
export const enum ArgumentListKind {
diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts
index 0a48bcf6228..979c44b2cd7 100644
--- a/src/services/textChanges.ts
+++ b/src/services/textChanges.ts
@@ -316,6 +316,12 @@ namespace ts.textChanges {
return this.replaceRangeWithNodes(sourceFile, getAdjustedRange(sourceFile, startNode, endNode, options), newNodes, options);
}
+ public replacePropertyAssignment(sourceFile: SourceFile, oldNode: PropertyAssignment, newNode: PropertyAssignment) {
+ return this.replaceNode(sourceFile, oldNode, newNode, {
+ suffix: "," + this.newLineCharacter
+ });
+ }
+
private insertNodeAt(sourceFile: SourceFile, pos: number, newNode: Node, options: InsertNodeOptions = {}) {
this.replaceRange(sourceFile, createTextRange(pos), newNode, options);
}
@@ -447,10 +453,7 @@ namespace ts.textChanges {
}
public insertNodeAfter(sourceFile: SourceFile, after: Node, newNode: Node): this {
- if (isStatementButNotDeclaration(after) ||
- after.kind === SyntaxKind.PropertyDeclaration ||
- after.kind === SyntaxKind.PropertySignature ||
- after.kind === SyntaxKind.MethodSignature) {
+ if (needSemicolonBetween(after, newNode)) {
// check if previous statement ends with semicolon
// if not - insert semicolon to preserve the code from changing the meaning due to ASI
if (sourceFile.text.charCodeAt(after.end - 1) !== CharacterCodes.semicolon) {
@@ -465,12 +468,15 @@ namespace ts.textChanges {
if (isClassDeclaration(node) || isModuleDeclaration(node)) {
return { prefix: this.newLineCharacter, suffix: this.newLineCharacter };
}
- else if (isStatement(node) || isClassElement(node) || isTypeElement(node)) {
+ else if (isStatement(node) || isClassOrTypeElement(node)) {
return { suffix: this.newLineCharacter };
}
else if (isVariableDeclaration(node)) {
return { prefix: ", " };
}
+ else if (isPropertyAssignment(node)) {
+ return { suffix: "," + this.newLineCharacter };
+ }
else if (isParameter(node)) {
return {};
}
@@ -893,4 +899,9 @@ namespace ts.textChanges {
export function isValidLocationToAddComment(sourceFile: SourceFile, position: number) {
return !isInComment(sourceFile, position) && !isInString(sourceFile, position) && !isInTemplateString(sourceFile, position);
}
+
+ function needSemicolonBetween(a: Node, b: Node): boolean {
+ return (isPropertySignature(a) || isPropertyDeclaration(a)) && isClassOrTypeElement(b) && b.name.kind === SyntaxKind.ComputedPropertyName
+ || isStatementButNotDeclaration(a) && isStatementButNotDeclaration(b); // TODO: only if b would start with a `(` or `[`
+ }
}
diff --git a/src/services/transform.ts b/src/services/transform.ts
index 07fc3c759e2..200fb9aacb2 100644
--- a/src/services/transform.ts
+++ b/src/services/transform.ts
@@ -1,5 +1,3 @@
-///
-///
namespace ts {
/**
* Transform one or more nodes using the supplied transformers.
diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json
index 4f838df6341..a54790df3be 100644
--- a/src/services/tsconfig.json
+++ b/src/services/tsconfig.json
@@ -6,81 +6,113 @@
"declaration": true
},
"files": [
- "../compiler/core.ts",
- "../compiler/performance.ts",
- "../compiler/sys.ts",
"../compiler/types.ts",
+ "../compiler/performance.ts",
+ "../compiler/core.ts",
+ "../compiler/sys.ts",
+ "../compiler/diagnosticInformationMap.generated.ts",
"../compiler/scanner.ts",
- "../compiler/parser.ts",
"../compiler/utilities.ts",
+ "../compiler/parser.ts",
"../compiler/binder.ts",
"../compiler/symbolWalker.ts",
+ "../compiler/moduleNameResolver.ts",
"../compiler/checker.ts",
"../compiler/factory.ts",
"../compiler/visitor.ts",
"../compiler/transformers/utilities.ts",
+ "../compiler/transformers/destructuring.ts",
"../compiler/transformers/ts.ts",
- "../compiler/transformers/jsx.ts",
- "../compiler/transformers/esnext.ts",
"../compiler/transformers/es2017.ts",
+ "../compiler/transformers/esnext.ts",
+ "../compiler/transformers/jsx.ts",
"../compiler/transformers/es2016.ts",
"../compiler/transformers/es2015.ts",
"../compiler/transformers/es5.ts",
"../compiler/transformers/generators.ts",
- "../compiler/transformers/destructuring.ts",
"../compiler/transformers/module/module.ts",
"../compiler/transformers/module/system.ts",
"../compiler/transformers/module/es2015.ts",
"../compiler/transformers/declarations/diagnostics.ts",
"../compiler/transformers/declarations.ts",
"../compiler/transformer.ts",
- "../compiler/comments.ts",
"../compiler/sourcemap.ts",
+ "../compiler/comments.ts",
"../compiler/emitter.ts",
+ "../compiler/watchUtilities.ts",
"../compiler/program.ts",
"../compiler/builderState.ts",
"../compiler/builder.ts",
"../compiler/resolutionCache.ts",
"../compiler/watch.ts",
- "../compiler/watchUtilities.ts",
"../compiler/commandLineParser.ts",
- "../compiler/diagnosticInformationMap.generated.ts",
+
"types.ts",
"utilities.ts",
- "breakpoints.ts",
"classifier.ts",
+ "pathCompletions.ts",
"completions.ts",
"documentHighlights.ts",
"documentRegistry.ts",
- "findAllReferences.ts",
"importTracker.ts",
+ "findAllReferences.ts",
"goToDefinition.ts",
"jsDoc.ts",
+ "semver.ts",
"jsTyping.ts",
"navigateTo.ts",
"navigationBar.ts",
"organizeImports.ts",
"outliningElementsCollector.ts",
- "pathCompletions.ts",
"patternMatcher.ts",
"preProcess.ts",
"rename.ts",
- "services.ts",
- "transform.ts",
- "transpile.ts",
- "semver.ts",
- "shims.ts",
"signatureHelp.ts",
"suggestionDiagnostics.ts",
- "sourcemaps.ts",
"symbolDisplay.ts",
+ "transpile.ts",
+ "formatting/formattingContext.ts",
+ "formatting/formattingScanner.ts",
+ "formatting/rule.ts",
+ "formatting/rules.ts",
+ "formatting/rulesMap.ts",
+ "formatting/formatting.ts",
+ "formatting/smartIndenter.ts",
"textChanges.ts",
+ "codeFixProvider.ts",
"refactorProvider.ts",
- "codeFixProvider.ts"
- ],
- "include": [
- "formatting/*",
- "codefixes/*",
- "refactors/*"
+ "codefixes/addMissingInvocationForDecorator.ts",
+ "codefixes/annotateWithTypeFromJSDoc.ts",
+ "codefixes/convertFunctionToEs6Class.ts",
+ "codefixes/convertToEs6Module.ts",
+ "codefixes/correctQualifiedNameToIndexedAccessType.ts",
+ "codefixes/fixClassIncorrectlyImplementsInterface.ts",
+ "codefixes/importFixes.ts",
+ "codefixes/fixSpelling.ts",
+ "codefixes/fixAddMissingMember.ts",
+ "codefixes/fixCannotFindModule.ts",
+ "codefixes/fixClassDoesntImplementInheritedAbstractMember.ts",
+ "codefixes/fixClassSuperMustPrecedeThisAccess.ts",
+ "codefixes/fixConstructorForDerivedNeedSuperCall.ts",
+ "codefixes/fixExtendsInterfaceBecomesImplements.ts",
+ "codefixes/fixForgottenThisPropertyAccess.ts",
+ "codefixes/fixUnusedIdentifier.ts",
+ "codefixes/fixJSDocTypes.ts",
+ "codefixes/fixAwaitInSyncFunction.ts",
+ "codefixes/disableJsDiagnostics.ts",
+ "codefixes/helpers.ts",
+ "codefixes/inferFromUsage.ts",
+ "codefixes/fixInvalidImportSyntax.ts",
+ "codefixes/fixStrictClassInitialization.ts",
+ "codefixes/useDefaultImport.ts",
+ "codefixes/fixes.ts",
+ "refactors/extractSymbol.ts",
+ "refactors/generateGetAccessorAndSetAccessor.ts",
+ "refactors/refactors.ts",
+ "sourcemaps.ts",
+ "services.ts",
+ "breakpoints.ts",
+ "transform.ts",
+ "shims.ts"
]
}
diff --git a/src/services/types.ts b/src/services/types.ts
index 0c3e6a90314..01b8b5ad4d4 100644
--- a/src/services/types.ts
+++ b/src/services/types.ts
@@ -228,6 +228,7 @@ namespace ts {
}
export interface UserPreferences {
+ readonly disableSuggestions?: boolean;
readonly quotePreference?: "double" | "single";
readonly includeCompletionsForModuleExports?: boolean;
readonly includeCompletionsWithInsertText?: boolean;
@@ -445,6 +446,8 @@ namespace ts {
}
export interface CodeFixAction extends CodeAction {
+ /** Short name to identify the fix, for use by telemetry. */
+ fixName: string;
/**
* If present, one may call 'getCombinedCodeFix' with this fixId.
* This may be omitted to indicate that the code fix can't be applied in a group.
diff --git a/src/services/utilities.ts b/src/services/utilities.ts
index 378a711e0c9..63170678202 100644
--- a/src/services/utilities.ts
+++ b/src/services/utilities.ts
@@ -627,18 +627,12 @@ namespace ts {
return syntaxList;
}
- /* Gets the token whose text has range [start, end) and
- * position >= start and (position < end or (position === end && token is keyword or identifier))
- */
- export function getTouchingWord(sourceFile: SourceFile, position: number, includeJsDocComment: boolean): Node {
- return getTouchingToken(sourceFile, position, includeJsDocComment, n => isWord(n.kind));
- }
-
- /* Gets the token whose text has range [start, end) and position >= start
- * and (position < end or (position === end && token is keyword or identifier or numeric/string literal))
+ /**
+ * Gets the token whose text has range [start, end) and
+ * position >= start and (position < end or (position === end && token is literal or keyword or identifier))
*/
export function getTouchingPropertyName(sourceFile: SourceFile, position: number, includeJsDocComment: boolean): Node {
- return getTouchingToken(sourceFile, position, includeJsDocComment, n => isPropertyName(n.kind));
+ return getTouchingToken(sourceFile, position, includeJsDocComment, n => isPropertyNameLiteral(n) || isKeyword(n.kind));
}
/**
@@ -1059,14 +1053,6 @@ namespace ts {
return undefined;
}
- export function isWord(kind: SyntaxKind): boolean {
- return kind === SyntaxKind.Identifier || isKeyword(kind);
- }
-
- function isPropertyName(kind: SyntaxKind): boolean {
- return kind === SyntaxKind.StringLiteral || kind === SyntaxKind.NumericLiteral || isWord(kind);
- }
-
export function isComment(kind: SyntaxKind): boolean {
return kind === SyntaxKind.SingleLineCommentTrivia || kind === SyntaxKind.MultiLineCommentTrivia;
}
@@ -1459,11 +1445,13 @@ namespace ts {
* WARNING: This is an expensive operation and is only intended to be used in refactorings
* and code fixes (because those are triggered by explicit user actions).
*/
- export function getSynthesizedDeepClone(node: T | undefined): T | undefined {
- if (node === undefined) {
- return undefined;
- }
+ export function getSynthesizedDeepClone(node: T | undefined, includeTrivia = true): T | undefined {
+ const clone = node && getSynthesizedDeepCloneWorker(node);
+ if (clone && !includeTrivia) suppressLeadingAndTrailingTrivia(clone);
+ return clone;
+ }
+ function getSynthesizedDeepCloneWorker(node: T): T | undefined {
const visited = visitEachChild(node, getSynthesizedDeepClone, nullTransformationContext);
if (visited === node) {
// This only happens for leaf nodes - internal nodes always see their children change.
@@ -1474,22 +1462,18 @@ namespace ts {
else if (isNumericLiteral(clone)) {
clone.numericLiteralFlags = (node as any).numericLiteralFlags;
}
- clone.pos = node.pos;
- clone.end = node.end;
- return clone;
+ return setTextRange(clone, node);
}
// PERF: As an optimization, rather than calling getSynthesizedClone, we'll update
// the new node created by visitEachChild with the extra changes getSynthesizedClone
// would have made.
-
visited.parent = undefined;
-
return visited;
}
- export function getSynthesizedDeepClones(nodes: NodeArray | undefined): NodeArray | undefined {
- return nodes && createNodeArray(nodes.map(getSynthesizedDeepClone), nodes.hasTrailingComma);
+ export function getSynthesizedDeepClones(nodes: NodeArray | undefined, includeTrivia = true): NodeArray | undefined {
+ return nodes && createNodeArray(nodes.map(n => getSynthesizedDeepClone(n, includeTrivia)), nodes.hasTrailingComma);
}
/**
@@ -1526,4 +1510,45 @@ namespace ts {
function getFirstChild(node: Node): Node | undefined {
return node.forEachChild(child => child);
}
+
+ /* @internal */
+ export function getUniqueName(baseName: string, fileText: string): string {
+ let nameText = baseName;
+ for (let i = 1; stringContains(fileText, nameText); i++) {
+ nameText = `${baseName}_${i}`;
+ }
+ return nameText;
+ }
+
+ /**
+ * @return The index of the (only) reference to the extracted symbol. We want the cursor
+ * to be on the reference, rather than the declaration, because it's closer to where the
+ * user was before extracting it.
+ */
+ /* @internal */
+ export function getRenameLocation(edits: ReadonlyArray, renameFilename: string, name: string, isDeclaredBeforeUse: boolean): number {
+ let delta = 0;
+ let lastPos = -1;
+ for (const { fileName, textChanges } of edits) {
+ Debug.assert(fileName === renameFilename);
+ for (const change of textChanges) {
+ const { span, newText } = change;
+ const index = newText.indexOf(name);
+ if (index !== -1) {
+ lastPos = span.start + delta + index;
+
+ // If the reference comes first, return immediately.
+ if (!isDeclaredBeforeUse) {
+ return lastPos;
+ }
+ }
+ delta += newText.length - span.length;
+ }
+ }
+
+ // If the declaration comes first, return the position of the last occurrence.
+ Debug.assert(isDeclaredBeforeUse);
+ Debug.assert(lastPos >= 0);
+ return lastPos;
+ }
}
diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json
new file mode 100644
index 00000000000..03cffdc49ff
--- /dev/null
+++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json
@@ -0,0 +1,93 @@
+{
+ "kind": "JSDocComment",
+ "pos": 0,
+ "end": 66,
+ "tags": {
+ "0": {
+ "kind": "JSDocParameterTag",
+ "pos": 6,
+ "end": 63,
+ "atToken": {
+ "kind": "AtToken",
+ "pos": 6,
+ "end": 7
+ },
+ "tagName": {
+ "kind": "Identifier",
+ "pos": 7,
+ "end": 12,
+ "escapedText": "param"
+ },
+ "typeExpression": {
+ "kind": "JSDocTypeExpression",
+ "pos": 34,
+ "end": 63,
+ "type": {
+ "kind": "JSDocTypeLiteral",
+ "pos": 34,
+ "end": 63,
+ "jsDocPropertyTags": [
+ {
+ "kind": "JSDocParameterTag",
+ "pos": 34,
+ "end": 54,
+ "atToken": {
+ "kind": "AtToken",
+ "pos": 34,
+ "end": 35
+ },
+ "tagName": {
+ "kind": "Identifier",
+ "pos": 35,
+ "end": 40,
+ "escapedText": "param"
+ },
+ "typeExpression": {
+ "kind": "JSDocTypeExpression",
+ "pos": 41,
+ "end": 49,
+ "type": {
+ "kind": "StringKeyword",
+ "pos": 42,
+ "end": 48
+ }
+ },
+ "name": {
+ "kind": "FirstNode",
+ "pos": 50,
+ "end": 53,
+ "left": {
+ "kind": "Identifier",
+ "pos": 50,
+ "end": 51,
+ "escapedText": "o"
+ },
+ "right": {
+ "kind": "Identifier",
+ "pos": 52,
+ "end": 53,
+ "escapedText": "f"
+ }
+ },
+ "isNameFirst": false,
+ "isBracketed": false,
+ "comment": "Doc for f"
+ }
+ ]
+ }
+ },
+ "name": {
+ "kind": "Identifier",
+ "pos": 22,
+ "end": 23,
+ "escapedText": "o"
+ },
+ "isNameFirst": true,
+ "isBracketed": false,
+ "comment": "Doc doc"
+ },
+ "length": 1,
+ "pos": 6,
+ "end": 63
+ }
+}
\ No newline at end of file
diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json
index 1a49c026e4c..00d7f0dcc30 100644
--- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json
+++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json
@@ -6,7 +6,7 @@
"0": {
"kind": "JSDocParameterTag",
"pos": 8,
- "end": 28,
+ "end": 40,
"atToken": {
"kind": "AtToken",
"pos": 8,
@@ -40,6 +40,6 @@
},
"length": 1,
"pos": 8,
- "end": 28
+ "end": 40
}
}
\ No newline at end of file
diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json
index 4b463061bb5..6953601f112 100644
--- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json
+++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json
@@ -6,7 +6,7 @@
"0": {
"kind": "JSDocParameterTag",
"pos": 8,
- "end": 33,
+ "end": 45,
"atToken": {
"kind": "AtToken",
"pos": 8,
@@ -40,6 +40,6 @@
},
"length": 1,
"pos": 8,
- "end": 33
+ "end": 45
}
}
\ No newline at end of file
diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json
index 93d7cf14737..472fbbeb6bb 100644
--- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json
+++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json
@@ -6,7 +6,7 @@
"0": {
"kind": "JSDocParameterTag",
"pos": 7,
- "end": 16,
+ "end": 58,
"atToken": {
"kind": "AtToken",
"pos": 7,
@@ -30,6 +30,6 @@
},
"length": 1,
"pos": 7,
- "end": 16
+ "end": 58
}
}
\ No newline at end of file
diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json
index 21d94f52e6a..b3e58d84923 100644
--- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json
+++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json
@@ -6,7 +6,7 @@
"0": {
"kind": "JSDocParameterTag",
"pos": 8,
- "end": 30,
+ "end": 55,
"atToken": {
"kind": "AtToken",
"pos": 8,
@@ -40,6 +40,6 @@
},
"length": 1,
"pos": 8,
- "end": 30
+ "end": 55
}
}
\ No newline at end of file
diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json
index 18649dcb321..6721afb2ea7 100644
--- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json
+++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json
@@ -6,7 +6,7 @@
"0": {
"kind": "JSDocParameterTag",
"pos": 8,
- "end": 31,
+ "end": 57,
"atToken": {
"kind": "AtToken",
"pos": 8,
@@ -40,6 +40,6 @@
},
"length": 1,
"pos": 8,
- "end": 31
+ "end": 57
}
}
\ No newline at end of file
diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json
index 6bddf6235d5..bf53423ad6a 100644
--- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json
+++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json
@@ -6,7 +6,7 @@
"0": {
"kind": "JSDocParameterTag",
"pos": 8,
- "end": 36,
+ "end": 62,
"atToken": {
"kind": "AtToken",
"pos": 8,
@@ -40,6 +40,6 @@
},
"length": 1,
"pos": 8,
- "end": 36
+ "end": 62
}
}
\ No newline at end of file
diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json
index e6c48a3f759..68edeb90190 100644
--- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json
+++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json
@@ -6,7 +6,7 @@
"0": {
"kind": "JSDocParameterTag",
"pos": 8,
- "end": 29,
+ "end": 42,
"atToken": {
"kind": "AtToken",
"pos": 8,
@@ -40,6 +40,6 @@
},
"length": 1,
"pos": 8,
- "end": 29
+ "end": 42
}
}
\ No newline at end of file
diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json
index c73009315bc..6f073802fcd 100644
--- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json
+++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json
@@ -6,7 +6,7 @@
"0": {
"kind": "JSDocParameterTag",
"pos": 8,
- "end": 32,
+ "end": 34,
"atToken": {
"kind": "AtToken",
"pos": 8,
diff --git a/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.errors.txt b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.errors.txt
new file mode 100644
index 00000000000..5548bc5e3dc
--- /dev/null
+++ b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.errors.txt
@@ -0,0 +1,23 @@
+tests/cases/compiler/app.js(6,7): error TS2322: Type '1' is not assignable to type 'WatchHandler'.
+
+
+==== tests/cases/compiler/func.ts (0 errors) ====
+ interface ComponentOptions {
+ watch: Record>;
+ }
+ type WatchHandler = (val: T) => void;
+ declare function extend(options: ComponentOptions<{}>): void;
+ export var vextend = extend;
+==== tests/cases/compiler/app.js (1 errors) ====
+ import {vextend} from './func';
+ // hover on vextend
+ export var a = vextend({
+ watch: {
+ data1(val) {
+ this.data2 = 1;
+ ~~~~~~~~~~
+!!! error TS2322: Type '1' is not assignable to type 'WatchHandler'.
+ },
+ data2(val) { },
+ }
+ });
\ No newline at end of file
diff --git a/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.js b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.js
new file mode 100644
index 00000000000..c2b9ddb5556
--- /dev/null
+++ b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.js
@@ -0,0 +1,38 @@
+//// [tests/cases/compiler/allowJscheckJsTypeParameterNoCrash.ts] ////
+
+//// [func.ts]
+interface ComponentOptions {
+ watch: Record>;
+}
+type WatchHandler = (val: T) => void;
+declare function extend(options: ComponentOptions<{}>): void;
+export var vextend = extend;
+//// [app.js]
+import {vextend} from './func';
+// hover on vextend
+export var a = vextend({
+ watch: {
+ data1(val) {
+ this.data2 = 1;
+ },
+ data2(val) { },
+ }
+});
+
+//// [func.js]
+"use strict";
+exports.__esModule = true;
+exports.vextend = extend;
+//// [app.js]
+"use strict";
+exports.__esModule = true;
+var func_1 = require("./func");
+// hover on vextend
+exports.a = func_1.vextend({
+ watch: {
+ data1: function (val) {
+ this.data2 = 1;
+ },
+ data2: function (val) { }
+ }
+});
diff --git a/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.symbols b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.symbols
new file mode 100644
index 00000000000..2ca59a3dc60
--- /dev/null
+++ b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.symbols
@@ -0,0 +1,51 @@
+=== tests/cases/compiler/func.ts ===
+interface ComponentOptions {
+>ComponentOptions : Symbol(ComponentOptions, Decl(func.ts, 0, 0))
+>V : Symbol(V, Decl(func.ts, 0, 27))
+
+ watch: Record>;
+>watch : Symbol(ComponentOptions.watch, Decl(func.ts, 0, 31))
+>Record : Symbol(Record, Decl(lib.d.ts, --, --))
+>WatchHandler : Symbol(WatchHandler, Decl(func.ts, 2, 1))
+}
+type WatchHandler = (val: T) => void;
+>WatchHandler : Symbol(WatchHandler, Decl(func.ts, 2, 1))
+>T : Symbol(T, Decl(func.ts, 3, 18))
+>val : Symbol(val, Decl(func.ts, 3, 24))
+>T : Symbol(T, Decl(func.ts, 3, 18))
+
+declare function extend(options: ComponentOptions<{}>): void;
+>extend : Symbol(extend, Decl(func.ts, 3, 40))
+>options : Symbol(options, Decl(func.ts, 4, 24))
+>ComponentOptions : Symbol(ComponentOptions, Decl(func.ts, 0, 0))
+
+export var vextend = extend;
+>vextend : Symbol(vextend, Decl(func.ts, 5, 10))
+>extend : Symbol(extend, Decl(func.ts, 3, 40))
+
+=== tests/cases/compiler/app.js ===
+import {vextend} from './func';
+>vextend : Symbol(vextend, Decl(app.js, 0, 8))
+
+// hover on vextend
+export var a = vextend({
+>a : Symbol(a, Decl(app.js, 2, 10))
+>vextend : Symbol(vextend, Decl(app.js, 0, 8))
+
+ watch: {
+>watch : Symbol(watch, Decl(app.js, 2, 24))
+
+ data1(val) {
+>data1 : Symbol(data1, Decl(app.js, 3, 10))
+>val : Symbol(val, Decl(app.js, 4, 10))
+
+ this.data2 = 1;
+>this : Symbol(__type, Decl(lib.d.ts, --, --))
+>data2 : Symbol(data2, Decl(app.js, 4, 16), Decl(app.js, 6, 6))
+
+ },
+ data2(val) { },
+>data2 : Symbol(data2, Decl(app.js, 4, 16), Decl(app.js, 6, 6))
+>val : Symbol(val, Decl(app.js, 7, 10))
+ }
+});
diff --git a/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.types b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.types
new file mode 100644
index 00000000000..396cdd4445e
--- /dev/null
+++ b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.types
@@ -0,0 +1,57 @@
+=== tests/cases/compiler/func.ts ===
+interface ComponentOptions {
+>ComponentOptions : ComponentOptions
+>V : V
+
+ watch: Record>;
+>watch : Record void>
+>Record : Record
+>WatchHandler : (val: T) => void
+}
+type WatchHandler = (val: T) => void;
+>WatchHandler : (val: T) => void
+>T : T
+>val : T
+>T : T
+
+declare function extend(options: ComponentOptions<{}>): void;
+>extend : (options: ComponentOptions<{}>) => void
+>options : ComponentOptions<{}>
+>ComponentOptions : ComponentOptions
+
+export var vextend = extend;
+>vextend : (options: ComponentOptions<{}>) => void
+>extend : (options: ComponentOptions<{}>) => void
+
+=== tests/cases/compiler/app.js ===
+import {vextend} from './func';
+>vextend : (options: ComponentOptions<{}>) => void
+
+// hover on vextend
+export var a = vextend({
+>a : void
+>vextend({ watch: { data1(val) { this.data2 = 1; }, data2(val) { }, }}) : void
+>vextend : (options: ComponentOptions<{}>) => void
+>{ watch: { data1(val) { this.data2 = 1; }, data2(val) { }, }} : { watch: { data1(val: any): void; }; }
+
+ watch: {
+>watch : { data1(val: any): void; }
+>{ data1(val) { this.data2 = 1; }, data2(val) { }, } : { data1(val: any): void; }
+
+ data1(val) {
+>data1 : (val: any) => void
+>val : any
+
+ this.data2 = 1;
+>this.data2 = 1 : 1
+>this.data2 : (val: any) => void
+>this : Record void>
+>data2 : (val: any) => void
+>1 : 1
+
+ },
+ data2(val) { },
+>data2 : any
+>val : any
+ }
+});
diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts
index 80a39517961..ab9436026bf 100644
--- a/tests/baselines/reference/api/tsserverlibrary.d.ts
+++ b/tests/baselines/reference/api/tsserverlibrary.d.ts
@@ -1794,6 +1794,10 @@ declare namespace ts {
getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
getSymbolAtLocation(node: Node): Symbol | undefined;
getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[];
+ /**
+ * The function returns the value (local variable) symbol of an identifier in the short-hand property assignment.
+ * This is necessary as an identifier in short-hand property assignment can contains two meaning: property name and property value.
+ */
getShorthandAssignmentValueSymbol(location: Node): Symbol | undefined;
getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol | undefined;
/**
@@ -2260,7 +2264,7 @@ declare namespace ts {
interface IndexInfo {
type: Type;
isReadonly: boolean;
- declaration?: SignatureDeclaration;
+ declaration?: IndexSignatureDeclaration;
}
enum InferencePriority {
NakedTypeVariable = 1,
@@ -2282,7 +2286,7 @@ declare namespace ts {
category: DiagnosticCategory;
code: number;
message: string;
- unused?: {};
+ reportsUnnecessary?: {};
}
/**
* A linked list of formatted diagnostic messages to be used as part of a multiline message.
@@ -2934,6 +2938,61 @@ declare namespace ts {
function getNodeMajorVersion(): number;
let sys: System;
}
+declare namespace ts {
+ type ErrorCallback = (message: DiagnosticMessage, length: number) => void;
+ interface Scanner {
+ getStartPos(): number;
+ getToken(): SyntaxKind;
+ getTextPos(): number;
+ getTokenPos(): number;
+ getTokenText(): string;
+ getTokenValue(): string;
+ hasExtendedUnicodeEscape(): boolean;
+ hasPrecedingLineBreak(): boolean;
+ isIdentifier(): boolean;
+ isReservedWord(): boolean;
+ isUnterminated(): boolean;
+ reScanGreaterToken(): SyntaxKind;
+ reScanSlashToken(): SyntaxKind;
+ reScanTemplateToken(): SyntaxKind;
+ scanJsxIdentifier(): SyntaxKind;
+ scanJsxAttributeValue(): SyntaxKind;
+ reScanJsxToken(): JsxTokenSyntaxKind;
+ scanJsxToken(): JsxTokenSyntaxKind;
+ scanJSDocToken(): JsDocSyntaxKind;
+ scan(): SyntaxKind;
+ getText(): string;
+ setText(text: string, start?: number, length?: number): void;
+ setOnError(onError: ErrorCallback): void;
+ setScriptTarget(scriptTarget: ScriptTarget): void;
+ setLanguageVariant(variant: LanguageVariant): void;
+ setTextPos(textPos: number): void;
+ lookAhead(callback: () => T): T;
+ scanRange(start: number, length: number, callback: () => T): T;
+ tryScan(callback: () => T): T;
+ }
+ function tokenToString(t: SyntaxKind): string | undefined;
+ function getPositionOfLineAndCharacter(sourceFile: SourceFileLike, line: number, character: number): number;
+ function getLineAndCharacterOfPosition(sourceFile: SourceFileLike, position: number): LineAndCharacter;
+ function isWhiteSpaceLike(ch: number): boolean;
+ /** Does not include line breaks. For that, see isWhiteSpaceLike. */
+ function isWhiteSpaceSingleLine(ch: number): boolean;
+ function isLineBreak(ch: number): boolean;
+ function couldStartTrivia(text: string, pos: number): boolean;
+ function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean) => U): U | undefined;
+ function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T): U | undefined;
+ function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean) => U): U | undefined;
+ function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T): U | undefined;
+ function reduceEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U;
+ function reduceEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U;
+ function getLeadingCommentRanges(text: string, pos: number): CommentRange[] | undefined;
+ function getTrailingCommentRanges(text: string, pos: number): CommentRange[] | undefined;
+ /** Optionally, get the shebang */
+ function getShebang(text: string): string | undefined;
+ function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean;
+ function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
+ function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner;
+}
declare namespace ts {
function getDefaultLibFileName(options: CompilerOptions): string;
function textSpanEnd(span: TextSpan): number;
@@ -2963,7 +3022,7 @@ declare namespace ts {
*/
function collapseTextChangeRangesAcrossMultipleVersions(changes: ReadonlyArray): TextChangeRange;
function getTypeParameterOwner(d: Declaration): Declaration;
- function isParameterPropertyDeclaration(node: Node): boolean;
+ function isParameterPropertyDeclaration(node: Node): node is ParameterDeclaration;
function isEmptyBindingPattern(node: BindingName): node is BindingPattern;
function isEmptyBindingElement(node: BindingElement): boolean;
function getCombinedModifierFlags(node: Node): ModifierFlags;
@@ -3255,6 +3314,7 @@ declare namespace ts {
function isClassLike(node: Node): node is ClassLikeDeclaration;
function isAccessor(node: Node): node is AccessorDeclaration;
function isTypeElement(node: Node): node is TypeElement;
+ function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement;
function isObjectLiteralElementLike(node: Node): node is ObjectLiteralElementLike;
/**
* Node test that determines whether a node is a valid type node.
@@ -3279,61 +3339,6 @@ declare namespace ts {
function isObjectLiteralElement(node: Node): node is ObjectLiteralElement;
function isStringLiteralLike(node: Node): node is StringLiteralLike;
}
-declare namespace ts {
- type ErrorCallback = (message: DiagnosticMessage, length: number) => void;
- interface Scanner {
- getStartPos(): number;
- getToken(): SyntaxKind;
- getTextPos(): number;
- getTokenPos(): number;
- getTokenText(): string;
- getTokenValue(): string;
- hasExtendedUnicodeEscape(): boolean;
- hasPrecedingLineBreak(): boolean;
- isIdentifier(): boolean;
- isReservedWord(): boolean;
- isUnterminated(): boolean;
- reScanGreaterToken(): SyntaxKind;
- reScanSlashToken(): SyntaxKind;
- reScanTemplateToken(): SyntaxKind;
- scanJsxIdentifier(): SyntaxKind;
- scanJsxAttributeValue(): SyntaxKind;
- reScanJsxToken(): JsxTokenSyntaxKind;
- scanJsxToken(): JsxTokenSyntaxKind;
- scanJSDocToken(): JsDocSyntaxKind;
- scan(): SyntaxKind;
- getText(): string;
- setText(text: string, start?: number, length?: number): void;
- setOnError(onError: ErrorCallback): void;
- setScriptTarget(scriptTarget: ScriptTarget): void;
- setLanguageVariant(variant: LanguageVariant): void;
- setTextPos(textPos: number): void;
- lookAhead(callback: () => T): T;
- scanRange(start: number, length: number, callback: () => T): T;
- tryScan(callback: () => T): T;
- }
- function tokenToString(t: SyntaxKind): string | undefined;
- function getPositionOfLineAndCharacter(sourceFile: SourceFileLike, line: number, character: number): number;
- function getLineAndCharacterOfPosition(sourceFile: SourceFileLike, position: number): LineAndCharacter;
- function isWhiteSpaceLike(ch: number): boolean;
- /** Does not include line breaks. For that, see isWhiteSpaceLike. */
- function isWhiteSpaceSingleLine(ch: number): boolean;
- function isLineBreak(ch: number): boolean;
- function couldStartTrivia(text: string, pos: number): boolean;
- function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean) => U): U | undefined;
- function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T): U | undefined;
- function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean) => U): U | undefined;
- function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T): U | undefined;
- function reduceEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U;
- function reduceEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U;
- function getLeadingCommentRanges(text: string, pos: number): CommentRange[] | undefined;
- function getTrailingCommentRanges(text: string, pos: number): CommentRange[] | undefined;
- /** Optionally, get the shebang */
- function getShebang(text: string): string | undefined;
- function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean;
- function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
- function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner;
-}
declare namespace ts {
function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
/**
@@ -3361,59 +3366,6 @@ declare namespace ts {
function isExternalModule(file: SourceFile): boolean;
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
}
-declare namespace ts {
- function parseCommandLine(commandLine: ReadonlyArray, readFile?: (path: string) => string | undefined): ParsedCommandLine;
- /**
- * Read tsconfig.json file
- * @param fileName The path to the config file
- */
- function readConfigFile(fileName: string, readFile: (path: string) => string | undefined): {
- config?: any;
- error?: Diagnostic;
- };
- /**
- * Parse the text of the tsconfig.json file
- * @param fileName The path to the config file
- * @param jsonText The text of the config file
- */
- function parseConfigFileTextToJson(fileName: string, jsonText: string): {
- config?: any;
- error?: Diagnostic;
- };
- /**
- * Read tsconfig.json file
- * @param fileName The path to the config file
- */
- function readJsonConfigFile(fileName: string, readFile: (path: string) => string | undefined): TsConfigSourceFile;
- /**
- * Convert the json syntax tree into the json value
- */
- function convertToObject(sourceFile: JsonSourceFile, errors: Push): any;
- /**
- * Parse the contents of a config file (tsconfig.json).
- * @param json The contents of the config file to parse
- * @param host Instance of ParseConfigHost used to enumerate files in folder.
- * @param basePath A root directory to resolve relative path entries in the config
- * file to. e.g. outDir
- */
- function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray): ParsedCommandLine;
- /**
- * Parse the contents of a config file (tsconfig.json).
- * @param jsonNode The contents of the config file to parse
- * @param host Instance of ParseConfigHost used to enumerate files in folder.
- * @param basePath A root directory to resolve relative path entries in the config
- * file to. e.g. outDir
- */
- function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray): ParsedCommandLine;
- function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
- options: CompilerOptions;
- errors: Diagnostic[];
- };
- function convertTypeAcquisitionFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
- options: TypeAcquisition;
- errors: Diagnostic[];
- };
-}
declare namespace ts {
interface GetEffectiveTypeRootsHost {
directoryExists?(directoryName: string): boolean;
@@ -3978,6 +3930,312 @@ declare namespace ts {
*/
function createProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: Program, configFileParsingDiagnostics?: ReadonlyArray): Program;
}
+declare namespace ts {
+ interface EmitOutput {
+ outputFiles: OutputFile[];
+ emitSkipped: boolean;
+ }
+ interface OutputFile {
+ name: string;
+ writeByteOrderMark: boolean;
+ text: string;
+ }
+}
+declare namespace ts {
+ type AffectedFileResult = {
+ result: T;
+ affected: SourceFile | Program;
+ } | undefined;
+ interface BuilderProgramHost {
+ /**
+ * return true if file names are treated with case sensitivity
+ */
+ useCaseSensitiveFileNames(): boolean;
+ /**
+ * If provided this would be used this hash instead of actual file shape text for detecting changes
+ */
+ createHash?: (data: string) => string;
+ /**
+ * When emit or emitNextAffectedFile are called without writeFile,
+ * this callback if present would be used to write files
+ */
+ writeFile?: WriteFileCallback;
+ }
+ /**
+ * Builder to manage the program state changes
+ */
+ interface BuilderProgram {
+ /**
+ * Returns current program
+ */
+ getProgram(): Program;
+ /**
+ * Get compiler options of the program
+ */
+ getCompilerOptions(): CompilerOptions;
+ /**
+ * Get the source file in the program with file name
+ */
+ getSourceFile(fileName: string): SourceFile | undefined;
+ /**
+ * Get a list of files in the program
+ */
+ getSourceFiles(): ReadonlyArray;
+ /**
+ * Get the diagnostics for compiler options
+ */
+ getOptionsDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray;
+ /**
+ * Get the diagnostics that dont belong to any file
+ */
+ getGlobalDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray;
+ /**
+ * Get the diagnostics from config file parsing
+ */
+ getConfigFileParsingDiagnostics(): ReadonlyArray;
+ /**
+ * Get the syntax diagnostics, for all source files if source file is not supplied
+ */
+ getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray;
+ /**
+ * Get all the dependencies of the file
+ */
+ getAllDependencies(sourceFile: SourceFile): ReadonlyArray;
+ /**
+ * Gets the semantic diagnostics from the program corresponding to this state of file (if provided) or whole program
+ * The semantic diagnostics are cached and managed here
+ * Note that it is assumed that when asked about semantic diagnostics through this API,
+ * the file has been taken out of affected files so it is safe to use cache or get from program and cache the diagnostics
+ * In case of SemanticDiagnosticsBuilderProgram if the source file is not provided,
+ * it will iterate through all the affected files, to ensure that cache stays valid and yet provide a way to get all semantic diagnostics
+ */
+ getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray;
+ /**
+ * Emits the JavaScript and declaration files.
+ * When targetSource file is specified, emits the files corresponding to that source file,
+ * otherwise for the whole program.
+ * In case of EmitAndSemanticDiagnosticsBuilderProgram, when targetSourceFile is specified,
+ * it is assumed that that file is handled from affected file list. If targetSourceFile is not specified,
+ * it will only emit all the affected files instead of whole program
+ *
+ * The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host
+ * in that order would be used to write the files
+ */
+ emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult;
+ /**
+ * Get the current directory of the program
+ */
+ getCurrentDirectory(): string;
+ }
+ /**
+ * The builder that caches the semantic diagnostics for the program and handles the changed files and affected files
+ */
+ interface SemanticDiagnosticsBuilderProgram extends BuilderProgram {
+ /**
+ * Gets the semantic diagnostics from the program for the next affected file and caches it
+ * Returns undefined if the iteration is complete
+ */
+ getSemanticDiagnosticsOfNextAffectedFile(cancellationToken?: CancellationToken, ignoreSourceFile?: (sourceFile: SourceFile) => boolean): AffectedFileResult>;
+ }
+ /**
+ * The builder that can handle the changes in program and iterate through changed file to emit the files
+ * The semantic diagnostics are cached per file and managed by clearing for the changed/affected files
+ */
+ interface EmitAndSemanticDiagnosticsBuilderProgram extends BuilderProgram {
+ /**
+ * Emits the next affected file's emit result (EmitResult and sourceFiles emitted) or returns undefined if iteration is complete
+ * The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host
+ * in that order would be used to write the files
+ */
+ emitNextAffectedFile(writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): AffectedFileResult;
+ }
+ /**
+ * Create the builder to manage semantic diagnostics and cache them
+ */
+ function createSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: SemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): SemanticDiagnosticsBuilderProgram;
+ function createSemanticDiagnosticsBuilderProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: SemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): SemanticDiagnosticsBuilderProgram;
+ /**
+ * Create the builder that can handle the changes in program and iterate through changed files
+ * to emit the those files and manage semantic diagnostics cache as well
+ */
+ function createEmitAndSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): EmitAndSemanticDiagnosticsBuilderProgram;
+ function createEmitAndSemanticDiagnosticsBuilderProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray